@optionfactory/fml 9.0.0-rc18 → 9.0.0-rc19

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.
@@ -1,2 +1,2 @@
1
- var fml=function(e){"use strict";class t{#e;#t=new Map;constructor(e){this.#e=e}getOrCompute(e,t){if(this.#t.has(e))return this.#t.get(e);const s=t(e);return this.#t.size>=this.#e&&this.#t.delete(this.#t.keys().next().value),this.#t.set(e,s),s}get size(){return this.#t.size}}const s={ter:Symbol("ternary"),elv:Symbol("elvis"),nullc:Symbol("null-coalescence"),or:Symbol("or"),and:Symbol("and"),eq:Symbol("eq"),cmp:Symbol("cmp"),not:Symbol("not"),access:Symbol("access"),member:Symbol("access-member"),subscript:Symbol("access-subscript"),method:Symbol("access-method-call"),call:Symbol("module-function-call"),tstring:Symbol("tstring"),literal:Symbol("literal"),array:Symbol("array-literal"),dict:Symbol("dict-literal"),function:Symbol("module-function"),symbol:Symbol("symbol"),templated:{ten:Symbol("templated-node"),teh:Symbol("templated-html"),tet:Symbol("templated-text"),tel:Symbol("templated-literal")},dom:{t:Symbol("text"),h:Symbol("html"),n:Symbol("node")}},r=new Map([["true",!0],["false",!1],["null",null],["undefined",void 0]]);class i extends SyntaxError{constructor(e,t,s,r){super(e),this.expected=t,this.found=s,this.location=r,this.name="SyntaxError"}format(e){let t="Error: "+this.message;if(this.location){let s=null;const r=e.find(e=>e.source===this.location.source);r&&(s=r.text.split(/\r\n|\n|\r/g));const i=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(i):i,a=this.location.source+":"+n.line+":"+n.column;if(s){const e=this.location.end,r="".padEnd(n.line.toString().length," "),o=s[i.line-1],l=(i.line===e.line?e.column:o.length+1)-i.column||1;t+="\n --\x3e "+a+"\n"+r+" |\n"+n.line+" | "+o+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(l,"^")}else t+="\n at "+a}return t}static buildMessage(e,t){function s(e){return e.codePointAt(0).toString(16).toUpperCase()}const r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function i(e){return r?e.replace(r,e=>"\\u{"+s(e)+"}"):e}function n(e){return i(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+s(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+s(e)))}function a(e){return i(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+s(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+s(e)))}const o={literal:e=>'"'+n(e.text)+'"',class(e){const t=e.parts.map(e=>Array.isArray(e)?a(e[0])+"-"+a(e[1]):a(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function l(e){return o[e.type](e)}return"Expected "+function(e){const t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let s=1;s<t.length;s++)t[s-1]!==t[s]&&(t[e]=t[s],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+function(e){return e?'"'+n(e)+'"':"end of input"}(t)+" found."}}const n=(e,t)=>{if("self"===t)return e[e.length-1];for(let s=e.length-1;s>=0;s--){const r=e[s];if(null!=r&&("object"==typeof r||"function"==typeof r)&&t in r)return r[t]}};class a{#s;#r;constructor(e,t){this.#s=e,this.#r=t}#i(e){return n(this.#r,e)}#n(e,t){const r=0===t?e.lhs:e.rhs[t-1];return r.type===s.symbol?r.value:r.type===s.member?r.rhs:null}#a;#o(){return this.#a||(this.#a=new Proxy(this.#r,{get:(e,t)=>this.#i(t)})),this.#a}[s.and](e){return this.visit(e.lhs)&&this.visit(e.rhs)}[s.or](e){return this.visit(e.lhs)||this.visit(e.rhs)}[s.nullc](e){return this.visit(e.lhs)??this.visit(e.rhs)}[s.not](e){return!this.visit(e.expr)}[s.eq](e){const t=this.visit(e.lhs)===this.visit(e.rhs);return"=="===e.op?t:!t}[s.cmp](e){const t=this.visit(e.lhs),s=this.visit(e.rhs);switch(e.op){case">":return t>s;case"<":return t<s;case">=":return t>=s;case"<=":return t<=s;default:throw new Error(`unknown cmp op ${e.op}`)}}[s.call](e){const t=e.value,s=null===t.module?this.#s:this.#s?.[t.module];if(!s)throw new Error(`Module "${t.module}" not found`);const r=s[t.value];if(!r)throw new Error(`Function "#${null===t.module?"":`${t.module}:`}${t.value}" not found`);const i=e.args.map(e=>this.visit(e));return r.apply(this.#o(),i)}[s.literal](e){return e.value}[s.tstring](e){let t="";const s=e.parts;for(let e=0,r=s.length;e<r;e++){const r=this.visit(s[e]);null!=r&&(t+=r)}return t}[s.symbol](e){return this.#i(e.value)}[s.dict](e){return Object.fromEntries(e.value.map(e=>[this.visit(e[0]),this.visit(e[1])]))}[s.array](e){return e.value.map(e=>this.visit(e))}[s.ter](e){return this.visit(e.cond)?this.visit(e.ifTrue):this.visit(e.ifFalse)}[s.elv](e){return this.visit(e.cond)||this.visit(e.ifFalse)}[s.access](e){let t,r=this.visit(e.lhs);for(let i=0;i!==e.rhs.length;++i){const n=e.rhs[i];if(n.ns&&null==r)return;let a;switch(n.type){case s.member:a=r[n.rhs];break;case s.subscript:a=r[this.visit(n.rhs)];break;case s.method:{if(!r){const t=this.#n(e,i);throw new Error(null===t?"Method missing":`Method missing "${t}"`)}const s=n.args.map(e=>this.visit(e));a=r.apply(t,s);break}}t=r,r=a}return r}visit(e,...t){return this[e.type](e,...t)}visitRoot(e,t){return t?e.map(e=>{switch(e.type){case s.templated.tel:return{type:s.dom.t,value:e.value};case s.templated.tet:return{type:s.dom.t,value:this.visit(e.value)};case s.templated.teh:return{type:s.dom.h,value:this.visit(e.value)};case s.templated.ten:return{type:s.dom.n,value:this.visit(e.value)};default:throw new Error(`unknown node type ${e.type.toString()}`)}}):this.visit(e)}}class o{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static#l=new t(1e3);static parse(e,t){const n=t?.toString()+e;return this.#l.getOrCompute(n,()=>function(e,t){const n={},a=(t=void 0!==t?t:{}).grammarSource,o={TemplatedRoot:mt,ExpressionRoot:bt};let l=mt;const u="{{{{",c="}}}}",d="{{{",h="}}}",p="{{",f="}}",m="\\",g="{",b="?",v=":",y="?:",w="??",E="||",x="&&",A="!",S="?.",T=".",C="[",_="]",O="(",q=",",k=")",R="-",L="'",N='"',P="`",M="}",F="#",z="==",D="!=",I=">=",$=">",B="<=",j="<",H=/^[^\\{]/,W=/^[0-9]/,V=/^[^']/,U=/^[^"]/,G=/^[^\\`{]/,Q=/^[a-zA-Z$_]/,K=/^[a-zA-Z$_0-9]/,J=/^[ \t\n\r]/,X=ut("{{{{",!1),Y=ut("}}}}",!1),Z=ut("{{{",!1),ee=ut("}}}",!1),te=ut("{{",!1),se=ut("}}",!1),re=ct(["\\","{"],!0,!1,!1),ie=ut("\\",!1),ne={type:"any"},ae=ut("{",!1),oe=ut("?",!1),le=ut(":",!1),ue=ut("?:",!1),ce=ut("??",!1),de=ut("||",!1),he=ut("&&",!1),pe=ut("!",!1),fe=dt("member"),me=ut("?.",!1),ge=ut(".",!1),be=dt("subscript"),ve=ut("[",!1),ye=ut("]",!1),we=dt("method-call"),Ee=ut("(",!1),xe=ut(",",!1),Ae=ut(")",!1),Se=dt("module-function-call"),Te=dt("number-literal"),Ce=ut("-",!1),_e=ct([["0","9"]],!1,!1,!1),Oe=dt("string-literal"),qe=ut("'",!1),ke=ct(["'"],!0,!1,!1),Re=ut('"',!1),Le=ct(['"'],!0,!1,!1),Ne=ut("`",!1),Pe=dt("tstring-expression"),Me=ut("}",!1),Fe=dt("tstring-literal"),ze=ct(["\\","`","{"],!0,!1,!1),De=dt("array-literal"),Ie=dt("dict-literal"),$e=dt("module-function"),Be=ut("#",!1),je=ct([["a","z"],["A","Z"],"$","_"],!1,!1,!1),He=ct([["a","z"],["A","Z"],"$","_",["0","9"]],!1,!1,!1),We=dt("identifier-or-keyword"),Ve=ut("==",!1),Ue=ut("!=",!1),Ge=ut(">=",!1),Qe=ut(">",!1),Ke=ut("<=",!1),Je=ut("<",!1),Xe=ct([" ","\t","\n","\r"],!1,!1,!1);function Ye(e){return e}function Ze(e,t,s){return{op:t,rhs:s}}function et(e,t,s){return{op:t,rhs:s}}function tt(e){return e}let st=0|t.peg$currPos;const rt=[{line:1,column:1}];let it,nt=st,at=t.peg$maxFailExpected||[],ot=0|t.peg$silentFails,lt={};if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');l=o[t.startRule]}function ut(e,t){return{type:"literal",text:e,ignoreCase:t}}function ct(e,t,s,r){return{type:"class",parts:e,inverted:t,ignoreCase:s,unicode:r}}function dt(e){return{type:"other",description:e}}function ht(t){let s,r=rt[t];if(r)return r;if(t>=rt.length)s=rt.length-1;else for(s=t;!rt[--s];);for(r=rt[s],r={line:r.line,column:r.column};s<t;)10===e.charCodeAt(s)?(r.line++,r.column=1):r.column++,s++;return rt[t]=r,r}function pt(e,t,s){const r=ht(e),i=ht(t);return{source:a,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:i.line,column:i.column}}}function ft(e){st<nt||(st>nt&&(nt=st,at=[]),at.push(e))}function mt(){let e,t;const s=38*st+0,r=lt[s];if(r)return st=r.nextPos,r.result;for(e=[],t=gt();t!==n;)e.push(t),t=gt();return lt[s]={nextPos:st,result:e},e}function gt(){let t,r,i,a,o;const l=38*st+1,b=lt[l];return b?(st=b.nextPos,b.result):(t=st,r=st,i=function(){let t;const s=38*st+2,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,4)===u?(t=u,st+=4):(t=n,0===ot&&ft(X)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+3,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,4)===c?(t=c,st+=4):(t=n,0===ot&&ft(Y)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(v=r,r={type:s.templated.ten,value:v}),t=r,t===n&&(t=st,r=st,i=function(){let t;const s=38*st+4,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,3)===d?(t=d,st+=3):(t=n,0===ot&&ft(Z)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+5,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,3)===h?(t=h,st+=3):(t=n,0===ot&&ft(ee)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(r=function(e){return{type:s.templated.teh,value:e}}(r)),t=r,t===n&&(t=st,r=st,i=function(){let t;const s=38*st+6,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===p?(t=p,st+=2):(t=n,0===ot&&ft(te)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+7,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===f?(t=f,st+=2):(t=n,0===ot&&ft(se)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(r=function(e){return{type:s.templated.tet,value:e}}(r)),t=r,t===n&&(t=st,r=function(){let t,s,r,i,a,o,l;const u=38*st+8,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,s=[],r=st,i=[],a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re));else i=n;if(r=i!==n?e.substring(r,st):i,r===n&&(r=st,92===e.charCodeAt(st)?(i=m,st++):(i=n,0===ot&&ft(ie)),i!==n?(e.length>st?(a=e.charAt(st),st++):(a=n,0===ot&&ft(ne)),a!==n?r=a:(st=r,r=n)):(st=r,r=n),r===n&&(r=st,i=st,123===e.charCodeAt(st)?(a=g,st++):(a=n,0===ot&&ft(ae)),a!==n?(o=st,ot++,123===e.charCodeAt(st)?(l=g,st++):(l=n,0===ot&&ft(ae)),ot--,l===n?o=void 0:(st=o,o=n),o!==n?(a=[a,o],i=a):(st=i,i=n)):(st=i,i=n),r=i!==n?e.substring(r,st):i)),r!==n)for(;r!==n;){if(s.push(r),r=st,i=[],a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re));else i=n;r=i!==n?e.substring(r,st):i,r===n&&(r=st,92===e.charCodeAt(st)?(i=m,st++):(i=n,0===ot&&ft(ie)),i!==n?(e.length>st?(a=e.charAt(st),st++):(a=n,0===ot&&ft(ne)),a!==n?r=Ye(a):(st=r,r=n)):(st=r,r=n),r===n&&(r=st,i=st,123===e.charCodeAt(st)?(a=g,st++):(a=n,0===ot&&ft(ae)),a!==n?(o=st,ot++,123===e.charCodeAt(st)?(l=g,st++):(l=n,0===ot&&ft(ae)),ot--,l===n?o=void 0:(st=o,o=n),o!==n?(a=[a,o],i=a):(st=i,i=n)):(st=i,i=n),r=i!==n?e.substring(r,st):i))}else s=n;return s!==n&&(s=s.join("")),t=s,lt[u]={nextPos:st,result:t},t}(),r!==n&&(r=function(e){return{type:s.templated.tel,value:e}}(r)),t=r))),lt[l]={nextPos:st,result:t},t);var v}function bt(){let e,t;const s=38*st+9,r=lt[s];return r?(st=r.nextPos,r.result):(e=st,Pt(),t=vt(),t!==n?(Pt(),e=t):(st=e,e=n),lt[s]={nextPos:st,result:e},e)}function vt(){let t,r,i,a,o,l;const u=38*st+10,c=lt[u];return c?(st=c.nextPos,c.result):(t=st,r=yt(),r!==n?(Pt(),63===e.charCodeAt(st)?(i=b,st++):(i=n,0===ot&&ft(oe)),i!==n?(Pt(),a=vt(),a!==n?(Pt(),58===e.charCodeAt(st)?(o=v,st++):(o=n,0===ot&&ft(le)),o!==n?(Pt(),l=vt(),l!==n?t={type:s.ter,cond:r,ifTrue:a,ifFalse:l}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=yt()),lt[u]={nextPos:st,result:t},t)}function yt(){let t,r,i,a;const o=38*st+11,l=lt[o];return l?(st=l.nextPos,l.result):(t=st,r=wt(),r!==n?(Pt(),e.substr(st,2)===y?(i=y,st+=2):(i=n,0===ot&&ft(ue)),i!==n?(Pt(),a=yt(),a!==n?t={type:s.elv,cond:r,ifFalse:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=wt()),lt[o]={nextPos:st,result:t},t)}function wt(){let t,r,i,a;const o=38*st+12,l=lt[o];return l?(st=l.nextPos,l.result):(t=st,r=Et(),r!==n?(Pt(),e.substr(st,2)===w?(i=w,st+=2):(i=n,0===ot&&ft(ce)),i!==n?(Pt(),a=wt(),a!==n?t={type:s.nullc,lhs:r,rhs:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=Et()),lt[o]={nextPos:st,result:t},t)}function Et(){let t,r,i,a,o,l;const u=38*st+13,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,r=xt(),r!==n){for(i=[],a=st,Pt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(Pt(),l=xt(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,Pt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(Pt(),l=xt(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);t=function(e,t){let r=e;for(const e of t)r={type:s.or,lhs:r,rhs:e};return r}(r,i)}else st=t,t=n;return lt[u]={nextPos:st,result:t},t}function xt(){let t,r,i,a,o,l;const u=38*st+14,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,r=At(),r!==n){for(i=[],a=st,Pt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(Pt(),l=At(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,Pt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(Pt(),l=At(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);t=function(e,t){let r=e;for(const e of t)r={type:s.and,lhs:r,rhs:e};return r}(r,i)}else st=t,t=n;return lt[u]={nextPos:st,result:t},t}function At(){let e,t,r,i,a,o;const l=38*st+15,u=lt[l];if(u)return st=u.nextPos,u.result;if(e=st,t=St(),t!==n){for(r=[],i=st,Pt(),a=Lt(),a!==n?(Pt(),o=St(),o!==n?i=Ze(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,Pt(),a=Lt(),a!==n?(Pt(),o=St(),o!==n?i=Ze(0,a,o):(st=i,i=n)):(st=i,i=n);e=function(e,t){let r=e;for(const e of t)r={type:s.eq,op:e.op,lhs:r,rhs:e.rhs};return r}(t,r)}else st=e,e=n;return lt[l]={nextPos:st,result:e},e}function St(){let e,t,r,i,a,o;const l=38*st+16,u=lt[l];if(u)return st=u.nextPos,u.result;if(e=st,t=Tt(),t!==n){for(r=[],i=st,Pt(),a=Nt(),a!==n?(Pt(),o=Tt(),o!==n?i=et(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,Pt(),a=Nt(),a!==n?(Pt(),o=Tt(),o!==n?i=et(0,a,o):(st=i,i=n)):(st=i,i=n);e=function(e,t){let r=e;for(const e of t)r={type:s.cmp,op:e.op,lhs:r,rhs:e.rhs};return r}(t,r)}else st=e,e=n;return lt[l]={nextPos:st,result:e},e}function Tt(){let t,r,i;const a=38*st+17,o=lt[a];return o?(st=o.nextPos,o.result):(t=st,33===e.charCodeAt(st)?(r=A,st++):(r=n,0===ot&&ft(pe)),r!==n?(Pt(),i=Tt(),i!==n?t={type:s.not,expr:i}:(st=t,t=n)):(st=t,t=n),t===n&&(t=function(){let e,t,r,i,a;const o=38*st+18,l=lt[o];if(l)return st=l.nextPos,l.result;if(e=st,t=_t(),t!==n){if(Pt(),r=[],i=st,a=Ct(),a!==n?(Pt(),i=a):(st=i,i=n),i!==n)for(;i!==n;)r.push(i),i=st,a=Ct(),a!==n?(Pt(),i=a):(st=i,i=n);else r=n;r!==n?e={type:s.access,lhs:t,rhs:r}:(st=e,e=n)}else st=e,e=n;return e===n&&(e=_t()),lt[o]={nextPos:st,result:e},e}()),lt[a]={nextPos:st,result:t},t)}function Ct(){let t;const r=38*st+19,i=lt[r];return i?(st=i.nextPos,i.result):(t=function(){let t,r,i;const a=38*st+20,o=lt[a];return o?(st=o.nextPos,o.result):(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(46===e.charCodeAt(st)?(r=T,st++):(r=n,0===ot&&ft(ge))),r!==n?(Pt(),i=Rt(),i!==n?t={type:s.member,ns:"?."===r,rhs:i}:(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft(fe)),lt[a]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let t,r,i,a,o;const l=38*st+21,u=lt[l];return u?(st=u.nextPos,u.result):(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(r=null),91===e.charCodeAt(st)?(i=C,st++):(i=n,0===ot&&ft(ve)),i!==n?(Pt(),a=vt(),a!==n?(Pt(),93===e.charCodeAt(st)?(o=_,st++):(o=n,0===ot&&ft(ye)),o!==n?t={type:s.subscript,ns:null!==r,rhs:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft(be)),lt[l]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let t,r,i,a,o,l,u,c;const d=38*st+22,h=lt[d];if(h)return st=h.nextPos,h.result;if(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(r=null),40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n){for(Pt(),a=st,o=vt(),o!==n?(l=Pt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);41===e.charCodeAt(st)?(l=k,st++):(l=n,0===ot&&ft(Ae)),l!==n?t=function(e,t,r){return{type:s.method,ns:null!==e,args:null===t?[]:[t,...r]}}(r,a,o):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(we)),lt[d]={nextPos:st,result:t},t}())),lt[r]={nextPos:st,result:t},t)}function _t(){let t,i,a,o;const l=38*st+23,u=lt[l];return u?(st=u.nextPos,u.result):(t=st,40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n?(Pt(),a=vt(),a!==n?(Pt(),41===e.charCodeAt(st)?(o=k,st++):(o=n,0===ot&&ft(Ae)),o!==n?t=a:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=function(){let t,r,i,a,o,l,u,c;const d=38*st+24,h=lt[d];if(h)return st=h.nextPos,h.result;if(ot++,t=st,r=function(){let t,r,i,a,o;const l=38*st+32,u=lt[l];return u?(st=u.nextPos,u.result):(ot++,t=st,35===e.charCodeAt(st)?(r=F,st++):(r=n,0===ot&&ft(Be)),r!==n?(i=st,a=Rt(),a!==n?(58===e.charCodeAt(st)?(o=v,st++):(o=n,0===ot&&ft(le)),o!==n?i=a:(st=i,i=n)):(st=i,i=n),i===n&&(i=null),a=Rt(),a!==n?t={type:s.function,module:i,value:a}:(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft($e)),lt[l]={nextPos:st,result:t},t)}(),r!==n)if(40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n){for(Pt(),a=st,o=vt(),o!==n?(l=Pt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);41===e.charCodeAt(st)?(l=k,st++):(l=n,0===ot&&ft(Ae)),l!==n?t=function(e,t,r){const i=null===t?[]:[t,...r];return{type:s.call,value:e,args:i}}(r,a,o):(st=t,t=n)}else st=t,t=n;else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(Se)),lt[d]={nextPos:st,result:t},t}(),t===n&&(t=function(){let t;const r=38*st+25,i=lt[r];return i?(st=i.nextPos,i.result):(t=function(){let t,r,i,a,o,l,u,c,d,h;const p=38*st+26,f=lt[p];if(f)return st=f.nextPos,f.result;if(ot++,t=st,r=st,i=st,45===e.charCodeAt(st)?(a=R,st++):(a=n,0===ot&&ft(Ce)),a===n&&(a=null),o=st,l=[],u=e.charAt(st),W.test(u)?st++:(u=n,0===ot&&ft(_e)),u!==n)for(;u!==n;)l.push(u),u=e.charAt(st),W.test(u)?st++:(u=n,0===ot&&ft(_e));else l=n;if(l!==n){if(u=st,46===e.charCodeAt(st)?(c=T,st++):(c=n,0===ot&&ft(ge)),c!==n){for(d=[],h=e.charAt(st),W.test(h)?st++:(h=n,0===ot&&ft(_e));h!==n;)d.push(h),h=e.charAt(st),W.test(h)?st++:(h=n,0===ot&&ft(_e));c=[c,d],u=c}else st=u,u=n;u===n&&(u=null),l=[l,u],o=l}else st=o,o=n;if(o===n)if(o=st,46===e.charCodeAt(st)?(l=T,st++):(l=n,0===ot&&ft(ge)),l!==n){if(u=[],c=e.charAt(st),W.test(c)?st++:(c=n,0===ot&&ft(_e)),c!==n)for(;c!==n;)u.push(c),c=e.charAt(st),W.test(c)?st++:(c=n,0===ot&&ft(_e));else u=n;u!==n?(l=[l,u],o=l):(st=o,o=n)}else st=o,o=n;return o!==n?(a=[a,o],i=a):(st=i,i=n),r=i!==n?e.substring(r,st):i,r!==n&&(r={type:s.literal,value:parseFloat(r)}),t=r,ot--,t===n&&(r=n,0===ot&&ft(Te)),lt[p]={nextPos:st,result:t},t}(),t===n&&(t=Ot(),t===n&&(t=function(){let t,r,i,a,o,l,u;const c=38*st+30,d=lt[c];if(d)return st=d.nextPos,d.result;if(ot++,t=st,91===e.charCodeAt(st)?(r=C,st++):(r=n,0===ot&&ft(ve)),r!==n){for(Pt(),i=vt(),i===n&&(i=null),Pt(),a=[],o=st,44===e.charCodeAt(st)?(l=q,st++):(l=n,0===ot&&ft(xe)),l!==n?(Pt(),u=vt(),u!==n?(Pt(),o=u):(st=o,o=n)):(st=o,o=n);o!==n;)a.push(o),o=st,44===e.charCodeAt(st)?(l=q,st++):(l=n,0===ot&&ft(xe)),l!==n?(Pt(),u=vt(),u!==n?(Pt(),o=u):(st=o,o=n)):(st=o,o=n);93===e.charCodeAt(st)?(o=_,st++):(o=n,0===ot&&ft(ye)),o!==n?t=function(e,t){const r=null===e?[]:[e,...t];return{type:s.array,value:r}}(i,a):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(De)),lt[c]={nextPos:st,result:t},t}(),t===n&&(t=function(){let t,r,i,a,o,l,u,c,d,h,p;const f=38*st+31,m=lt[f];if(m)return st=m.nextPos,m.result;if(ot++,t=st,123===e.charCodeAt(st)?(r=g,st++):(r=n,0===ot&&ft(ae)),r!==n){for(Pt(),i=st,a=Ot(),a!==n?(o=Pt(),58===e.charCodeAt(st)?(l=v,st++):(l=n,0===ot&&ft(le)),l!==n?(u=Pt(),c=vt(),c!==n?i=[a,c]:(st=i,i=n)):(st=i,i=n)):(st=i,i=n),i===n&&(i=null),a=Pt(),o=[],l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=Pt(),d=Ot(),d!==n?(Pt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(Pt(),p=vt(),p!==n?(Pt(),l=[d,p]):(st=l,l=n)):(st=l,l=n)):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=Pt(),d=Ot(),d!==n?(Pt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(Pt(),p=vt(),p!==n?(Pt(),l=[d,p]):(st=l,l=n)):(st=l,l=n)):(st=l,l=n)):(st=l,l=n);125===e.charCodeAt(st)?(l=M,st++):(l=n,0===ot&&ft(Me)),l!==n?t=function(e,t){var r=[];return null!==e&&r.push(e),r.push.apply(r,t),{type:s.dict,value:r}}(i,o):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(Ie)),lt[f]={nextPos:st,result:t},t}()))),lt[r]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let e,t;const i=38*st+34,a=lt[i];return a?(st=a.nextPos,a.result):(ot++,e=st,t=Rt(),t!==n&&(o=t,t=r.has(o)?{type:s.literal,value:r.get(o)}:{type:s.symbol,value:o}),e=t,ot--,e===n&&(t=n,0===ot&&ft(We)),lt[i]={nextPos:st,result:e},e);var o}()))),lt[l]={nextPos:st,result:t},t)}function Ot(){let t,r,i,a,o;const l=38*st+27,u=lt[l];if(u)return st=u.nextPos,u.result;if(ot++,t=st,39===e.charCodeAt(st)?(r=L,st++):(r=n,0===ot&&ft(qe)),r!==n){for(i=st,a=[],o=e.charAt(st),V.test(o)?st++:(o=n,0===ot&&ft(ke));o!==n;)a.push(o),o=e.charAt(st),V.test(o)?st++:(o=n,0===ot&&ft(ke));i=e.substring(i,st),39===e.charCodeAt(st)?(a=L,st++):(a=n,0===ot&&ft(qe)),a!==n?t={type:s.literal,value:i}:(st=t,t=n)}else st=t,t=n;if(t===n){if(t=st,34===e.charCodeAt(st)?(r=N,st++):(r=n,0===ot&&ft(Re)),r!==n){for(i=st,a=[],o=e.charAt(st),U.test(o)?st++:(o=n,0===ot&&ft(Le));o!==n;)a.push(o),o=e.charAt(st),U.test(o)?st++:(o=n,0===ot&&ft(Le));i=e.substring(i,st),34===e.charCodeAt(st)?(a=N,st++):(a=n,0===ot&&ft(Re)),a!==n?t={type:s.literal,value:i}:(st=t,t=n)}else st=t,t=n;if(t===n)if(t=st,96===e.charCodeAt(st)?(r=P,st++):(r=n,0===ot&&ft(Ne)),r!==n){for(i=[],a=qt(),a===n&&(a=kt());a!==n;)i.push(a),a=qt(),a===n&&(a=kt());96===e.charCodeAt(st)?(a=P,st++):(a=n,0===ot&&ft(Ne)),a!==n?t={type:s.tstring,parts:i}:(st=t,t=n)}else st=t,t=n}return ot--,t===n&&(r=n,0===ot&&ft(Oe)),lt[l]={nextPos:st,result:t},t}function qt(){let t,s,r,i;const a=38*st+28,o=lt[a];return o?(st=o.nextPos,o.result):(ot++,t=st,123===e.charCodeAt(st)?(s=g,st++):(s=n,0===ot&&ft(ae)),s!==n?(Pt(),r=vt(),r!==n?(Pt(),125===e.charCodeAt(st)?(i=M,st++):(i=n,0===ot&&ft(Me)),i!==n?t=r:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),ot--,t===n&&(s=n,0===ot&&ft(Pe)),lt[a]={nextPos:st,result:t},t)}function kt(){let t,r,i,a,o;const l=38*st+29,u=lt[l];if(u)return st=u.nextPos,u.result;if(ot++,t=st,r=[],i=st,a=[],o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze)),o!==n)for(;o!==n;)a.push(o),o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze));else a=n;if(i=a!==n?e.substring(i,st):a,i===n&&(i=st,92===e.charCodeAt(st)?(a=m,st++):(a=n,0===ot&&ft(ie)),a!==n?(e.length>st?(o=e.charAt(st),st++):(o=n,0===ot&&ft(ne)),o!==n?i=o:(st=i,i=n)):(st=i,i=n)),i!==n)for(;i!==n;){if(r.push(i),i=st,a=[],o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze)),o!==n)for(;o!==n;)a.push(o),o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze));else a=n;i=a!==n?e.substring(i,st):a,i===n&&(i=st,92===e.charCodeAt(st)?(a=m,st++):(a=n,0===ot&&ft(ie)),a!==n?(e.length>st?(o=e.charAt(st),st++):(o=n,0===ot&&ft(ne)),o!==n?i=tt(o):(st=i,i=n)):(st=i,i=n))}else r=n;return r!==n&&(r={type:s.literal,value:r.join("")}),t=r,t===n&&(t=st,123===e.charCodeAt(st)?(r=g,st++):(r=n,0===ot&&ft(ae)),r!==n&&(r={type:s.literal,value:r}),t=r),ot--,t===n&&(r=n,0===ot&&ft(Fe)),lt[l]={nextPos:st,result:t},t}function Rt(){let t,s,r,i,a;const o=38*st+33,l=lt[o];if(l)return st=l.nextPos,l.result;if(t=st,s=st,r=e.charAt(st),Q.test(r)?st++:(r=n,0===ot&&ft(je)),r!==n){for(i=[],a=e.charAt(st),K.test(a)?st++:(a=n,0===ot&&ft(He));a!==n;)i.push(a),a=e.charAt(st),K.test(a)?st++:(a=n,0===ot&&ft(He));r=[r,i],s=r}else st=s,s=n;return t=s!==n?e.substring(t,st):s,lt[o]={nextPos:st,result:t},t}function Lt(){let t;const s=38*st+35,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===z?(t=z,st+=2):(t=n,0===ot&&ft(Ve)),t===n&&(e.substr(st,2)===D?(t=D,st+=2):(t=n,0===ot&&ft(Ue))),lt[s]={nextPos:st,result:t},t)}function Nt(){let t;const s=38*st+36,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===I?(t=I,st+=2):(t=n,0===ot&&ft(Ge)),t===n&&(62===e.charCodeAt(st)?(t=$,st++):(t=n,0===ot&&ft(Qe)),t===n&&(e.substr(st,2)===B?(t=B,st+=2):(t=n,0===ot&&ft(Ke)),t===n&&(60===e.charCodeAt(st)?(t=j,st++):(t=n,0===ot&&ft(Je))))),lt[s]={nextPos:st,result:t},t)}function Pt(){let t,s;const r=38*st+37,i=lt[r];if(i)return st=i.nextPos,i.result;for(ot++,t=[],s=e.charAt(st),J.test(s)?st++:(s=n,0===ot&&ft(Xe));s!==n;)t.push(s),s=e.charAt(st),J.test(s)?st++:(s=n,0===ot&&ft(Xe));return ot--,lt[r]={nextPos:st,result:t},t}it=l();const Mt=it!==n&&st===e.length;function Ft(){throw it!==n&&st<e.length&&ft({type:"end"}),t=at,s=nt<e.length?function(t=st){const s=e.codePointAt(t);return void 0===s?"":String.fromCodePoint(s)}(nt):null,r=nt<e.length?pt(nt,nt+1):pt(nt,nt),new i(i.buildMessage(t,s),t,s,r);var t,s,r}return t.peg$library?{peg$result:it,peg$currPos:st,peg$FAILED:n,peg$maxFailExpected:at,peg$maxFailPos:nt,peg$success:Mt,peg$throw:Mt?void 0:Ft}:Mt?it:void Ft()}(e,{startRule:t===o.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}static evaluate(e,t,s,r){return new a(e,t).visitRoot(s,r===o.MODE_TEMPLATED)}static interpret(e,t,s,r){return o.evaluate(e,t,o.parse(s,r),r)}}class l{#s;#r;constructor(e,t){this.#s=e,this.#r=t}withModule(e,t){const s=e?{[e]:t}:t;return new l({...this.#s,...s},this.#r)}withOverlay(...e){return new l(this.#s,0===e.length?this.#r:[...this.#r,...e])}resolve(e){return n(this.#r,e)}evaluateExpression(e){return o.interpret(this.#s,this.#r,e,o.MODE_EXPRESSION)}evaluateTemplated(e){return o.interpret(this.#s,this.#r,e,o.MODE_TEMPLATED)}}class u{static fromHtml(...e){const t=document.createElement("template");return t.innerHTML=e.map(e=>e.trim()).join(""),document.adoptNode(t.content)}static toHtml(e){var t=document.createElement("template");return t.content.appendChild(e),t.innerHTML}static isBlank(e){return 0===e.childElementCount&&""===e.textContent.trim()}static from(...e){const t=new DocumentFragment;for(const s of e)t.appendChild(s);return t}static fromChildNodes(e){const t=new DocumentFragment;for(;e.firstChild;)t.appendChild(e.firstChild);return t}}class c{static id=0;static uid(e){return`${e}-${++c.id}`}static defaultValue(e,t,s){return e.hasAttribute(t)||e.setAttribute(t,s),e.getAttribute(t)}static forward(e,t,s){t.getAttributeNames().filter(t=>t.startsWith(e)).forEach(r=>{const i=r.substring(e.length);if("class"===i){const r=t.getAttribute(`${e}class`)?.split(/\s+/).filter(e=>e.length)??[];return void s.classList.add(...r)}s.setAttribute(i,t.getAttribute(r))})}static set(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)}}class d{static from(e){for(const t of e.children)t.matches('[slot=""]')&&t.removeAttribute("slot");const t=Array.from(e.children).filter(e=>e.matches("[slot]")).map(e=>{e.remove();const t=e.getAttribute("slot");return e.removeAttribute("slot"),[t,d.slotFromNode(e)]}),s={};s.default=new DocumentFragment,s.default.append(...e.childNodes);for(const[e,r]of t)e in s||(s[e]=new DocumentFragment),s[e].append(r);return s}static slotFromNode(e){return e instanceof HTMLTemplateElement?document.adoptNode(e.content):e instanceof HTMLScriptElement&&"text/html"===e.type?u.fromHtml(e.innerHTML):e}}class h{static isParsed(e){for(let t=e;t;t=t.parentNode)if(t.nextSibling)return!0;return!1}static waitDomContentLoaded(e){if("loading"===e.readyState)return new Promise(t=>{e.addEventListener("DOMContentLoaded",()=>t(void 0),{once:!0})});if("complete"===e.readyState)return Promise.resolve();const t=e.defaultView;return null===t?Promise.resolve():new Promise(e=>{const s=()=>{t.removeEventListener("DOMContentLoaded",s),t.removeEventListener("load",s),e(void 0)};t.addEventListener("DOMContentLoaded",s),t.addEventListener("load",s)})}static waitParsed(e){return h.isParsed(e)?Promise.resolve(e):new Promise(t=>{const s=new MutationObserver(()=>{h.isParsed(e)&&(s.disconnect(),t(e))});for(let t=e.parentNode;t;t=t.parentNode)s.observe(t,{childList:!0});h.waitDomContentLoaded(e.ownerDocument).then(()=>{s.disconnect(),t(e)})})}static queryChildren(e,t){for(const s of e.children)if(s.matches(t))return s;return null}static queryChildrenAll(e,t){const s=[];for(const r of e.children)r.matches(t)&&s.push(r);return s}}class p{#u=new Set;removed(e){return this.#u.has(e)}remove(e){e.replaceChildren?.(),Object.keys(e.dataset||{}).filter(e=>e.startsWith("tpl")).forEach(t=>{delete e.dataset[t]}),this.#u.add(e)}popData(e,t){const s=e.dataset[t];return delete e.dataset[t],s}prepend(e,t){e.parentNode.insertBefore(t,e)}append(e,t){e.parentNode.insertBefore(t,e.nextSibling)}replace(e,t){this.prepend(e,t),this.remove(e)}cleanup(){for(const e of this.#u)e.remove();this.#u.clear()}}class f{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplRemove","tplVerbatim"];static tplIf(e,t,s,r){r.evaluateExpression(t)||s.remove(e)}static tplWith(e,t,s,r){const i=r.evaluateExpression(t),n=s.popData(e,"tplVar"),a=new b(e,r).withOverlay(n?{[n]:i}:i).render();s.replace(e,a)}static tplEach(e,t,s,r){const i=s.popData(e,"tplVar"),n=s.popData(e,"tplStat"),a=new b(e,r),o=r.evaluateExpression(t),l=null===o||"object"!=typeof o?void 0:Object.getPrototypeOf(o),u=o?.[Symbol.iterator]||l!==Object.prototype&&null!==l?null:Object.entries(o),c=o instanceof Map?[...o]:u,d=null===c?o:c.map(([e,t])=>({key:e,value:t}));if(!d?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);const h=n?d:null,p="number"==typeof h?.length?h.length:h?.size,f="number"==typeof p?p:null;let m=0;for(const t of d){const r=i?{[i]:t}:t,o={index:m,count:m+1,size:f,first:0===m,last:null===f?null:m===f-1,even:m%2==0,odd:m%2==1},l=n?[{[n]:o},r]:[r];s.prepend(e,a.withOverlay(...l).render()),++m}s.remove(e)}static tplWhen(e,t,s,r){r.evaluateExpression(t)||s.remove(e)}static tplVerbatim(e,t,s,r){const i=e.cloneNode(!0);s.replace(e,i)}static tplRemove(e,t,s,r){switch(t.toLowerCase()){case"tag":{const t=u.fromChildNodes(e);"tplVerbatim"in e.dataset?(s.popData(e,"tplVerbatim"),s.replace(e,t)):(s.append(e,t),s.remove(e));break}case"body":e.replaceChildren();break;case"all":s.remove(e)}}static tplClassAppend(e,t,s,r){const i=r.evaluateExpression(t);if(!i)return;const n=(Array.isArray(i)?i:[i]).flatMap(e=>"string"==typeof e?e.split(" "):e).filter(Boolean);0!==n.length&&e.classList.add(...n)}static tplAttrAppend(e,t,s,r){const i=r.evaluateExpression(t);i&&0!==i.length&&(Array.isArray(i[0])?i:[i]).forEach(([t,s])=>{e.setAttribute(t,s)})}static textNode(e,t,r,i){for(const n of i.evaluateTemplated(t))if(null!=n.value)switch(n.type){case s.dom.t:r.prepend(e,document.createTextNode(n.value));break;case s.dom.h:r.prepend(e,u.fromHtml("string"==typeof n.value?n.value:String(n.value)));break;case s.dom.n:if(!(n.value instanceof Node))throw new TypeError(`Expected a Node, got '${typeof n.value}'`);r.prepend(e,n.value)}r.remove(e)}}const m=new t(1e3);function g(e){return m.getOrCompute(e,e=>e.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase())}class b{static fromHtml(e,t,...s){return new b(u.fromHtml(e),new l(t,s))}static fromSelector(e,t,...s){const r=document.querySelector(e);if(!(r instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");return b.fromTemplate(r,t,...s)}static fromTemplate(e,t,...s){const r=document.adoptNode(e.content);return new b(r,new l(t,s))}static fromFragment(e,t,...s){return new b(e,new l(t,s))}#c;#d;constructor(e,t){this.#c=e,this.#d=t}withEvaluator(e){return new b(this.#c,e)}withFragment(e){return new b(e,this.#d)}withModule(e,t){return new b(this.#c,this.#d.withModule(e,t))}withOverlay(...e){return new b(this.#c,this.#d.withOverlay(...e))}evaluateExpression(e,...t){return this.#d.withOverlay(...t).evaluateExpression(e)}evaluateTemplated(e,...t){return this.#d.withOverlay(...t).evaluateTemplated(e)}evaluator(){return this.#d}render(){try{const e=new p,t=document.importNode(this.#c,!0),s=t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t:u.from(t),r=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,b.#h);let i;for(;null!==(i=r.nextNode());){if(e.cleanup(),i.nodeType===Node.TEXT_NODE){try{f.textNode(i,i.nodeValue,e,this.#d)}catch(e){throw v.wrap("Error evaluating text node",i,e)}continue}const t=i;for(const s of f.ORDERED_COMMANDS){if(!(s in t.dataset))continue;const r=e.popData(t,s);try{f[s](t,r,e,this.#d)}catch(e){throw v.wrap(`Error evaluating data-tpl-${g(s)}="${r}"`,t,e)}if(e.removed(t))break}for(const s of Object.keys(t.dataset||{})){if(!s.startsWith("tpl"))continue;const r=g(s),i=e.popData(t,s);try{const e=this.#d.evaluateExpression(i);if("boolean"==typeof e){t.toggleAttribute(r,e);continue}null!=e&&t.setAttribute(r,e)}catch(e){throw v.wrap(`Error evaluating data-tpl-${r}="${i}"`,t,e)}}}return e.cleanup(),s}catch(e){if(e instanceof v)throw e;throw new v("Error rendering template",this.#c,e)}}renderTo(e){e.replaceChildren(this.render())}appendTo(e){e.appendChild(this.render())}renderToSelector(e){const t=document.querySelector(e);t&&this.renderTo(t)}appendToSelector(e){const t=document.querySelector(e);t&&this.appendTo(t)}static#h(e){if(e.nodeType===Node.TEXT_NODE)return e.nodeValue.includes("{{")&&e.nodeValue.includes("}}")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;for(const t of e.attributes)if(t.name.startsWith("data-tpl-"))return NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}}class v extends Error{static FRAMES=3;#p;#f;truncated=!1;static wrap(e,t,s){return s instanceof v&&s.depth>=v.FRAMES?(s.truncated=!0,s):new v(e,t,s)}constructor(e,t,s){super(`${e} in \`${v.describe(t)}\``,{cause:s}),this.name="RenderError",this.#p=t,this.#f=(s instanceof v?s.depth:0)+1}get depth(){return this.#f}get node(){return this.#p}get html(){return v.stringify(this.#p)}static describe(e){if(e.nodeType===Node.TEXT_NODE)return v.#m(String(e.nodeValue).trim());if(e.nodeType===Node.ELEMENT_NODE){const t=e,s=Array.from(t.attributes,e=>` ${e.name}="${e.value}"`).join("");return v.#m(`<${t.localName}${s}>`)}const t=Array.from(e.childNodes).filter(e=>e.nodeType===Node.ELEMENT_NODE||String(e.nodeValue??"").trim().length>0).map(e=>v.describe(e));return v.#m(t.join(""))}static#m(e){return e.length>120?`${e.slice(0,120)}…`:e}static stringify(e){return u.toHtml(v.#g(e.cloneNode(!0)))}static#g(e){e.nodeType===Node.TEXT_NODE&&(e.nodeValue=e.nodeValue.trim());for(let t=0;t<e.childNodes.length;t++){const s=e.childNodes[t];s.nodeType===Node.TEXT_NODE?(s.nodeValue=s.nodeValue.trim(),0===s.nodeValue.length&&(e.removeChild(s),t--)):s.nodeType===Node.ELEMENT_NODE&&v.#g(s)}return e}}class y{#b=new Map;#v;#y=new Promise(e=>{this.#v=e});constructor(){h.waitDomContentLoaded(document).then(()=>{this.#w()})}ready(){return this.#y}async#w(){await this.settled(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1})),this.#v()}enqueue(e){if(this.#b.has(e))return;const{promise:t,resolve:s}=Promise.withResolvers(),r=h.waitParsed(e).then(()=>e.upgrade()).finally(()=>{this.#b.delete(e),s()});this.#b.set(e,{upgrade:r,finished:t})}async#E(e,t){for(;;){const s=Array.from(this.#b).filter(([t])=>e(t)).map(([,e])=>t(e));if(0===s.length)return;await Promise.all(s)}}settled(){return this.#E(()=>!0,e=>e.finished)}upgraded(e){return this.#E(e,e=>e.upgrade)}whenUpgraded(e){return this.#b.get(e)?.upgrade}pending(){return Array.from(this.#b.keys())}}class w{#x={};#A=!1;#S={string:{unmarshal:(e,t,s)=>e,marshal:(e,t,s)=>null==e?null:String(e)},number:{unmarshal:(e,t,s)=>null===e?null:Number(e),marshal:(e,t,s)=>null==e?null:String(e)},presence:{unmarshal:(e,t,s)=>null!==e,marshal:(e,t,s)=>e?"":null},bool:{unmarshal:(e,t,s)=>"true"===e,marshal:(e,t,s)=>null==e?null:String(!0===e)},json:{unmarshal:(e,t,s)=>null===e?null:JSON.parse(e),marshal:(e,t,s)=>null==e?null:JSON.stringify(e)},csv:{unmarshal:(e,t,s)=>null===e?[]:e.split(",").map(e=>e.trim()).filter(e=>e),marshal:(e,t,s)=>null==e?null:e.join(",")}};#T={};#s;#C=[];#d=new l(void 0,[]);#_=new y;defineElement(e,t){return this.#A?(this.#O(e,t),this):(this.#x[e]=t,this)}static declarationsOf(e){const t=[];for(let s=e;null!==s&&s!==HTMLElement;s=Object.getPrototypeOf(s))t.unshift(s);const s=e=>t.flatMap(t=>Object.getOwnPropertyDescriptor(t,e)?.value??[]);return{observed:s("observed"),attributes:s("attributes")}}static propertyOf(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}#O(e,t){const{observed:s,attributes:r}=w.declarationsOf(t),{template:i,templates:n,slots:a,mappers:o,config:l}=t,u=s.map(e=>e.split(":")[0]),c=[...new Set(u.reverse())].reverse(),d=[...r,...s].reduce((e,t)=>{const[s,r]=t.split(":"),i=r??"string";if(!(i in this.#S)&&!(i in(o??{})))throw new Error(`unsupported attribute type: ${i}`);return e[s]=o?.[i]??this.#S[i],e},{}),h=Object.entries(Object.assign({},n,i?{default:i}:{})).map(([e,t])=>[e,b.fromHtml(t)]),p=Object.fromEntries(h);t.BITS={registry:this,enqueue:e=>this.#_.enqueue(e),SLOTS:a,CONFIG:l,OBSERVED:c,DECLARED:[...new Set([...c,...r.map(e=>e.split(":")[0])])],ATTR_TO_MAPPER:d,ATTR_TO_PROPERTY:Object.fromEntries(c.map(e=>[e,w.propertyOf(e)])),TEMPLATES:p},customElements.define(e,t)}defineModule(e,t){const s=e?{[e]:t}:t;return this.#s={...this.#s,...s},this.#q(),this}defineModules(e){return this.#s=e,this.#q(),this}defineComponent(e,t){return this.#T[e]=t,this}defineData(...e){return this.#C=e,this.#q(),this}defineOverlay(...e){return this.#C=[...this.#C,...e],this.#q(),this}defineMapper(e,t){return this.#S[e]=t,this}plugin(e){return e.configure(this),this}configure(){for(const[e,t]of Object.entries(this.#x))this.#O(e,t),delete this.#x[e];return this.#A=!0,this}settle(e){return this.#_.upgraded(e)}whenUpgraded(e){return this.#_.whenUpgraded(e)}pending(){return this.#_.pending()}ready(){return this.#_.ready()}#q(){this.#d=new l(this.#s,this.#C)}evaluator(){return this.#d}component(e){return this.#T[e]}}const E=new w;class x{static fromHtml(e){return b.fromHtml(e).withEvaluator(E.evaluator())}static fromSelector(e){return b.fromSelector(e).withEvaluator(E.evaluator())}static fromTemplate(e){return b.fromTemplate(e).withEvaluator(E.evaluator())}static fromFragment(e){return b.fromFragment(e).withEvaluator(E.evaluator())}}class A{static waitFor(e){return E.settle(t=>e.contains(t))}static waitForChildren(e){return E.settle(t=>e!==t&&e.contains(t))}}class S extends HTMLElement{static BITS={registry:E,enqueue:e=>{},SLOTS:!1,CONFIG:void 0,OBSERVED:[],DECLARED:[],ATTR_TO_MAPPER:{},ATTR_TO_PROPERTY:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}constructor(){super(),this.internals=this.attachInternals()}internals;#k=!1;#R=!1;#L=new Set;#N=null;#P={};#M(){return this.constructor.BITS}#F(e){const t=this.#M().ATTR_TO_MAPPER[e];if(!t)throw new Error(`${this.constructor.name} declares no attribute '${e}': declare it in static observed or static attributes, or read it with getAttribute`);return t}unmarshal(e,t){return this.#F(e).unmarshal(t,e,this)}marshal(e,t){return this.#F(e).marshal(t,e,this)}get _registry(){return this.#M().registry}component(e){return this.#M().registry.component(e)}template(e){const t=this.#M().TEMPLATES[e??"default"];if(!t)throw new Error(`no template named '${e??"default"}' on ${this.constructor.name}`);const s=t.withEvaluator(this.#M().registry.evaluator()),r=this.#M().CONFIG;return r?s.withOverlay({config:r}):s}connectedCallback(){this.#R||this.#M().enqueue(this)}attributeChangedCallback(e,t,s){t!==s&&(this.#L.has(e)||(this.#k?this[this.#M().ATTR_TO_PROPERTY[e]]=this.unmarshal(e,s):null!==this.#N&&e in this.#N&&(this.#N[e]=this.unmarshal(e,s))))}async upgrade(){if(this.#R)return;this.#R=!0;const e=this.#M().SLOTS?d.from(this):void 0,t=Object.fromEntries(this.#M().DECLARED.map(e=>[e,this.unmarshal(e,this.getAttribute(e))])),s=new Set(this.#M().OBSERVED);this.#P=Object.fromEntries(Object.entries(t).filter(([e])=>!s.has(e))),this.#N=t;try{await this.render({slots:e});const s=this.#M().ATTR_TO_PROPERTY;for(const e of this.#M().OBSERVED)this[s[e]]=t[e];this.#k=!0,this.internals.states.add("rendered")}finally{this.#N=null}}render(e){}declared(e){return e in this.#P?this.#P[e]:null!==this.#N&&e in this.#N?this.#N[e]:this.unmarshal(e,this.getAttribute(e))}get rendered(){return this.#k}reflectTo(e,t){const s=this.marshal(e,t);if(s!==this.getAttribute(e)){this.#L.add(e);try{c.set(this,e,s)}finally{this.#L.delete(e)}}}}const T=/\{(\w+)\}/g,C=/\{(\d+)\}/g,_=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),O=new Set,q=e=>{O.has(e)||(O.add(e),console.warn(`l10n: ${e}`))},k=new t(100),R=(e,t,s)=>{const r=`${e.name}|${t??""}|${void 0===s?"":JSON.stringify(s)}`;return k.getOrCompute(r,()=>new e(t,s))};class L{static t(e,...t){const s=this.l10n??{};let r=Object.hasOwn(s,e)?s[e]:void 0;if(void 0===r)return q(`missing message "${e}"`),e;const i=1===t.length&&_(t[0])?t[0]:null;if(_(r))if("number"!=typeof i?.count)q(`plural message "${e}" needs a numeric {count}`),r=r.other;else{const e=this.locale??navigator?.language??"en";r=r[R(Intl.PluralRules,e).select(i.count)]??r.other}return void 0===r||"object"==typeof r?(q(`plural message "${e}" has no "other" form`),e):i?r.replace(T,(t,s)=>Object.hasOwn(i,s)?String(i[s]):(q(`message "${e}" wants {${s}}`),t)):t.length>0?r.replace(C,(s,r)=>{const i=Number(r);return i>=t.length?(q(`message "${e}" wants {${r}}`),s):String(t[i])}):r}static date(e,t){return R(Intl.DateTimeFormat,this.locale,t).format(e)}static number(e,t){return R(Intl.NumberFormat,this.locale,t).format(e)}static bytes(e){const t=R(Intl.NumberFormat,this.locale,{maximumFractionDigits:2}).format;return e>=1073741824?`${t(e/1024/1024/1024)}GiB`:e>=1048576?`${t(e/1024/1024)}MiB`:e>=1024?`${t(e/1024)}KiB`:`${t(e)}B`}static failure(e){return Array.isArray(e?.problems)&&e.problems.length>0?e.problems.map(e=>{return t=e,("string"==typeof t?.reason&&""!==t.reason.trim()?t.reason:void 0)??L.t.call(this,"failure.no-reason");var t}).join("\n"):void 0!==e?.message?String(e.message):null==e?"":String(e)}static of(e={}){const t=e=>E.evaluator().resolve(e),s=s=>(...r)=>s.apply({l10n:t("l10n"),locale:e.locale??t("locale")},r);return{t:s(L.t),date:s(L.date),number:s(L.number),bytes:s(L.bytes),failure:s(L.failure)}}}var N=Object.freeze({__proto__:null,Attributes:c,BoundedCache:t,ExpressionEvaluator:l,Expressions:o,Fragments:u,LightSlots:d,Localization:L,Nodes:h,ParsedElement:S,Registry:w,RenderError:v,Rendering:A,Template:b,Templates:x,registry:E});class P extends Error{constructor(e,t,s){super(e,{cause:s}),this.name="Failure",this.problems=t}dropping(e){return new P(this.message,P.dropProblemsContext(this.problems,e),this)}static dropProblemsContext(e,t){return e.map(({type:e,context:s,reason:r,details:i})=>({type:e,context:s?.startsWith(t)?s.substring(t.length):s,reason:r,details:i}))}}class M{static STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static encode(e,t){const s=t||M.URL_SAFE,r=e.byteLength,i=new Uint8Array(e);let n="";for(let e=0;e<r;e+=3)n+=s[i[e]>>2]+s[(3&i[e])<<4|i[e+1]>>4]+s[(15&i[e+1])<<2|i[e+2]>>6]+s[63&i[e+2]];return r%3==2?n=n.substring(0,n.length-1):r%3==1&&(n=n.substring(0,n.length-2)),n}static decode(e,t){const s=t||M.URL_SAFE;let r=e.length;for(;r>0&&"="===e.charAt(r-1);)--r;const i=e.substring(0,r);if(e.length-r>2||i.includes("=")||0===i.length&&e.length>0)throw new Error("invalid padding");if(i.length%4==1)throw new Error("invalid length");for(const e of i)if(-1===s.indexOf(e))throw new Error(`invalid character '${e}'`);const n=Math.floor(.75*i.length),a=new Uint8Array(n);let o=0,l=0;for(;o<n;){const e=s.indexOf(i.charAt(l++)),t=s.indexOf(i.charAt(l++)),r=s.indexOf(i.charAt(l++)),u=s.indexOf(i.charAt(l++));if(a[o++]=e<<2|t>>4,o===n)break;if(a[o++]=(15&t)<<4|r>>2,o===n)break;a[o++]=(3&r)<<6|u}return a.buffer}}class F{static decode(e){if(e.length%2!=0)throw new Error("invalid length");if(!/^[0-9a-fA-F]*$/.test(e))throw new Error("invalid character");const t=e.length/2;return new Uint8Array(t).map((t,s)=>{const r=2*s,i=e.substring(r,r+2);return parseInt(i,16)})}static encode(e,t){return Array.from(e).map(e=>e.toString(16)).map(e=>t?e.toUpperCase():e).map(e=>e.padStart(2,"0")).join("")}}class z{#z;#D;constructor(e,t){this.#z=e,this.#D=t}get normalized(){return`${this.#z}/${this.#D}`}get type(){return this.#z}get subtype(){return this.#D}static parse(e){if(!e)return new z("unknown","unknown");const[t,s]=e.split(";"),[r,i]=t.trim().toLowerCase().split("/");return r&&i?new z(r,i):new z("unknown","unknown")}}class D extends P{constructor(e,t,s,r){super(e,s,r),this.name="HttpClientError",this.status=t}dropping(e){return new D(this.message,this.status,P.dropProblemsContext(this.problems,e),this)}static problem(e,t){return{type:e,context:null,reason:t,details:null}}static of(e,t){const s=String(t?.message??t??"unknown failure");return new D(s,0,[D.problem(e,s)],t)}static async fromResponse(e){switch(z.parse(e.headers.get("Content-Type")).normalized){case"application/failures+json":{const t=await e.json().catch(()=>D.#I);if(t===D.#I)return D.#$(e);if(!Array.isArray(t))return D.#$(e,"as a failures array");const s=`${e.status} ${e.statusText}: ${t.length} failures`;return new D(s,e.status,t)}case"application/problem+json":{const t=await e.json().catch(()=>D.#I);if(t===D.#I)return D.#$(e);if("object"!=typeof t||null===t||Array.isArray(t))return D.#$(e,"as a problem object");const s=`${e.status} ${e.statusText}: ${t.title} ${t.detail}`;return new D(s,e.status,t.problems||[D.problem("GENERIC_PROBLEM",s)])}default:return D.#B(e)}}static#I=Symbol("unreadable body");static#$(e,t="as json"){const s=z.parse(e.headers.get("Content-Type")).normalized,r=`${e.status} ${e.statusText}: the ${s} body does not decode ${t}`;return new D(r,e.status,[D.problem("GENERIC_PROBLEM",r)])}static async#B(e){const t=await e.text().catch(()=>null),s=null===t?`${e.status} ${e.statusText}: the body could not be read`:`${e.status} ${e.statusText}: ${t}`;return new D(s,e.status,[D.problem("GENERIC_PROBLEM",s)])}}const I=e=>globalThis.document?.querySelector(`meta[name="${e}"]`)?.getAttribute("content")??void 0;class ${async intercept(e,t,s){if(e.origin!==(globalThis.window?.location?.origin??e.origin))return await s.proceed(e,t);const r=I("_csrf_header"),i=I("_csrf");return r&&i&&t.headers.set(r,i),await s.proceed(e,t)}}class B{#j;constructor(e){this.#j=e}async intercept(e,t,s){const r=await s.proceed(e,t);return 401===r.status?(window.location.href=this.#j,new Promise(()=>{})):r}}class j{#H;constructor(){this.#H=[]}withCsrfToken(){return this.#H.push(new $),this}withRedirectOnUnauthorized(e){return this.#H.push(new B(e)),this}withInterceptors(...e){return this.#H.push(...e),this}build(){return new V(this.#H)}}class H{async intercept(e,t,s){try{return await fetch(e,t)}catch(e){throw D.of("CONNECTION_PROBLEM",e)}}}class W{#H;#W;constructor(e,t){this.#H=e,this.#W=t}async proceed(e,t){const s=this.#H[this.#W];return await s.intercept(e,t,new W(this.#H,this.#W+1))}}class V{#H;static builder(){return new j}constructor(e){this.#H=e||[]}async exchange(e,t,s){const r=[...this.#H,...s||[],new H],i=new W(r,0),n=new URL(new Request(e).url),a={...t,headers:new Headers(t?.headers)};return await i.proceed(n,a)}request(e,t){return Q.create(this,e,t)}get(e){return Q.create(this,"GET",e)}head(e){return Q.create(this,"HEAD",e)}post(e){return Q.create(this,"POST",e)}put(e){return Q.create(this,"PUT",e)}patch(e){return Q.create(this,"PATCH",e)}delete(e){return Q.create(this,"DELETE",e)}}const U=async(e,t)=>{try{return await e[t]()}catch(e){throw D.of("UNMARSHALING_PROBLEM",e)}},G=e=>null==e?[]:"string"==typeof e?new URLSearchParams(e):"function"==typeof e[Symbol.iterator]?e:Object.entries(e);class Q{#V;#U;#G;#Q;#K;#J;#X;#H;#c;static create(e,t,s){const r=s.indexOf("#"),i=-1===r?"":s.slice(r),n=-1===r?s:s.slice(0,r),a=n.indexOf("?");return new Q(e,t,-1===a?n:n.slice(0,a),new URLSearchParams(-1===a?"":n.slice(a+1)),new Headers,void 0,{},[],i)}constructor(e,t,s,r,i,n,a,o,l=""){this.#V=e,this.#U=t,this.#G=s,this.#Q=r,this.#J=n,this.#K=i,this.#X=a,this.#H=o,this.#c=l}headers(e){for(const[t,s]of G(e))this.header(t,s);return this}header(e,t){return null==t?this.#K.delete(e):this.#K.set(e,t),this}params(e){for(const[t,s]of G(e))null==s?this.#Q.delete(t):this.#Q.set(t,s);return this}param(e,...t){this.#Q.delete(e);for(const s of t.filter(e=>null!=e))this.#Q.append(e,s);return this}body(e){return this.#J=e,this}json(e){if(void 0===e)return this;const t=JSON.stringify(e);return this.#K.set("Content-Type","application/json"),this.#J=t,this}multipart(e){const t=new FormData;return e(new K(t)),this.#J=t,this}options(e){for(const[t,s]of Object.entries(e))this.#X[t]=s;return this}option(e,t){return this.#X[e]=t,this}interceptors(e){for(const t of e)this.#H.push(t);return this}interceptor(e){return this.#H.push(e),this}async exchange(){const e=this.#Q.size?`?${this.#Q}`:"",t={...this.#X,headers:this.#K,method:this.#U,body:this.#J};return await this.#V.exchange(`${this.#G}${e}${this.#c}`,t,this.#H)}async fetch(){try{const e=await this.exchange();if(!e.ok)throw await D.fromResponse(e);return e}catch(e){if(e instanceof P)throw e;throw D.of("UNEXPECTED_PROBLEM",e)}}async fetchText(){const e=await this.fetch();return await U(e,"text")}async fetchJson(){const e=await this.fetch();return 204===e.status?null:await U(e,"json")}async fetchBlob(){const e=await this.fetch();return await U(e,"blob")}async fetchArrayBuffer(){const e=await this.fetch();return await U(e,"arrayBuffer")}}class K{#Y;constructor(e){this.#Y=e}field(e,t){return this.#Y.append(e,t),this}blob(e,t,s){return this.#Y.append(e,t,s),this}blobs(e,t){for(const s of t)this.#Y.append(e,s);return this}json(e,t,s){const r=new Blob([JSON.stringify(t)],{type:"application/json"});return this.#Y.append(e,r,s),this}}var J=Object.freeze({__proto__:null,Base64:M,Failure:P,Hex:F,HttpClient:V,HttpClientBuilder:j,HttpClientError:D,HttpInterceptorChain:W,HttpMultipartRequestCustomizer:K,HttpRequestBuilder:Q,MediaType:z});const X=e=>{const t=t=>{try{e().removeItem(t)}catch{}},s=s=>{let r;try{r=e().getItem(s)}catch{return}if(null!==r)try{return JSON.parse(r)}catch{return void t(s)}};return{save:(t,s)=>{e().setItem(t,JSON.stringify(s))},load:s,remove:t,pop:e=>{const r=s(e);return t(e),r}}},Y=e=>({save(t,s,r){e.save(t,{revision:s,data:r})},load(t,s){const r=e.load(t);if(null!=r&&"object"==typeof r&&r.revision===s)return r.data;e.remove(t)}}),Z=X(()=>localStorage),ee=X(()=>sessionStorage),te=Y(Z),se=Y(ee);class re{static async fireAsync(e,t,s){e.dispatchEvent(t);const r=t.async?.promises??[],i=s?.mode??"broadcast";if("pipeline"===i&&r.length>1||"delegate"===i&&1!==r.length)throw Promise.all(r).catch(()=>{}),new Error("pipeline"===i?`[AsyncEvents] Event "${t.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${r.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${t.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${r.length} were registered.`);return"broadcast"===i?Promise.all(r):Promise.resolve(r[0])}static asyncOn(e,t,s,r){const i=async e=>{const t=e;t.async||(t.async={promises:[]});const{promise:r,resolve:i,reject:n}=Promise.withResolvers();t.async.promises.push(r);try{i(await s(t))}catch(e){n(e)}};return e.addEventListener(t,i,r),i}static asyncOff(e,t,s,r){e.removeEventListener(t,s,r)}static mixInto(...e){for(const t of e)Object.assign(t.prototype,{async fireAsync(e,t){return await re.fireAsync(this,e,t)},asyncOn(e,t,s){return re.asyncOn(this,e,t,s)},asyncOff(e,t,s){re.asyncOff(this,e,t,s)}})}}class ie{#Z=0;take(){return++this.#Z,this.hold()}hold(){const e=this.#Z,t=this;return{get stale(){return e!==t.#Z}}}invalidate(){++this.#Z}}const ne=e=>{for(let t=e.parentElement;t;t=t.parentElement)if("function"==typeof t.describedBy)return t;return null};class ae{static sleep(e){return new Promise(t=>setTimeout(t,e))}static debounce(e,t,s){const r=s?.immediate??!1;let i=null,n=[],a=0;const o=()=>{const s=performance.now()-a;e>s?i=setTimeout(o,e-s):(i=null,r||t(...n),null===i&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===i&&(i=setTimeout(o,e),r&&t(...n))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}static throttle(e,t,s){const r=s?.leading??!0,i=s?.trailing??!0;let n=null,a=[],o=0;const l=()=>{o=r?performance.now():0,n=null,t(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();o||r||(o=u);const c=0===o?0:e-(u-o);a=s,c<=0||c>e?(null!==n&&(clearTimeout(n),n=null),o=u,t(...a),null===n&&(a=[])):null===n&&i&&(n=setTimeout(l,c))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class oe{static flatten(e,t,s){return Object.keys(e).reduce((r,i)=>{const n=t.length?`${t}.${i}`:i;return s.has(n)||"object"!=typeof e[i]||null===e[i]?r[n]=e[i]:Object.assign(r,oe.flatten(e[i],n,s)),r},{})}static#ee=new Set(["__proto__","prototype","constructor"]);static providePath(e,t,s){const r=t.split(".").map(e=>/^[0-9]+$/.test(e)?+e:e);for(const e of r)if(oe.#ee.has(e))throw new Error(`unsupported name segment '${e}' in '${t}'`);let i=e??{},n=null;for(let t=0;;++t){const a=r[t],o=r[t-1];if(Number.isInteger(a)&&!Array.isArray(i)&&(null!==n?n[o]=i=[]:e=i=[]),t===r.length-1)return i[a]=void 0!==s?s:a in i?i[a]:null,e;"object"==typeof i[a]&&null!==i[a]||(i[a]={}),n=i,i=i[a]}}static extract(e){if("radio"===e.getAttribute("type")){if(!e.checked)return;return"boolean"===e.dataset.fulBindType?"true"===e.value:e.value}return"checkbox"===e.getAttribute("type")?e.checked:"boolean"===e.dataset.fulBindType?e.value?"true"===e.value:null:"SELECT"===e.tagName&&e.multiple?Array.from(e.selectedOptions).map(e=>e.value):"INPUT"!==e.tagName&&"SELECT"!==e.tagName&&"TEXTAREA"!==e.tagName||""!==e.value&&void 0!==e.value?e.value:null}static#te(e){return"submit"===e.type||"reset"===e.type||"button"===e.type}static extractFrom(e,t){let s={};for(const r of e.elements)r.hasAttribute("name")&&(oe.#te(r)&&r!==t||r.matches(":disabled")&&r!==t||(s=oe.providePath(s,r.getAttribute("name"),oe.extract(r))));return s}static mutate(e,t){if("radio"!==e.getAttribute("type"))if("checkbox"!==e.getAttribute("type")){if("SELECT"===e.tagName&&e.multiple){const s=Array.isArray(t)?t.map(String):null==t?[]:[String(t)];return void Array.from(e.options).forEach(e=>{e.selected=s.includes(e.value)})}e.value=t}else e.checked=t;else e.checked=null!=t&&e.getAttribute("value")===String(t)}static mutateIn(e,t){const s=oe.#se(e);for(const[e,r]of Object.entries(oe.flatten(t,"",new Set(s.keys()))))for(const t of s.get(e)??[])oe.mutate(t,r)}static#se(e){const t=new Map;for(const s of e.elements){const e=s.getAttribute("name");if(!e)continue;const r=t.get(e);r?r.push(s):t.set(e,[s])}return t}static errors(e,t,s){const r=t=>t.closest("form")===e;Array.from(e.querySelectorAll("ful-field-error")).filter(r).forEach(e=>{e.setAttribute("aria-live",s?"off":"polite")});const i=e=>("FIELD_ERROR"===e.type||"INVALID_FORMAT"===e.type)&&e.context,n=t.filter(i),a=t.filter(e=>!i(e)),o=oe.#se(e);for(const e of o.values())e.forEach(e=>{e.setCustomValidity?.("")});const l=[];n.forEach(e=>{const t=e.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=t.length;0!==s;--s){const r=t.slice(0,s).join("."),i=o.get(r)??[];if(0===i.length)continue;const n=t.slice(s).join(".");return void i.forEach(t=>{t.setCustomValidity?.(e.reason,n)})}l.push(e)});const u=[...a,...l];e.querySelectorAll("ful-errors").forEach(e=>{if(!r(e))return;const t=e;if(e.setAttribute("role","alert"),0===u.length)return e.replaceChildren(),void e.setAttribute("hidden","");e.removeAttribute("hidden"),t.innerText=u.map(e=>e.reason).join("\n")}),0!==t.length&&s&&Array.from(e.elements).filter(e=>e.matches(":invalid")).sort((e,t)=>e.getBoundingClientRect().y-t.getBoundingClientRect().y)[0]?.focus()}}class le extends S{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#re;#ie=null;#ne;#ae=[];#oe=null;#le;#ue;#ce;#de=[];constructor(){super(),this.internals.role=this.constructor.ROLE}#he(){return[this.#ue??this.#re,...this.#de].filter(e=>e)}#pe({fragment:e,control:t,error:s,label:r=null,described:i=null,claims:n=null,announces:a=t,freeze:o=null,also:l=[]}){if(this.#re=t,this.#le=s,this.#ue=n,this.#ce=a,this.#de=l,o&&o.addEventListener("click",e=>{this.readonly&&e.preventDefault()},!0),this.#ne=i??t,s&&(s.id=s.id||c.uid("ful-field-error"),this.#oe=s.id),this.#fe(),r&&le.#me(this,r,t),this.addEventListener("keydown",e=>{if("Enter"!==e.key||e.defaultPrevented||e.isComposing)return;const t=e.target;t.form!==this.form&&le.#ge(t)&&this._requestSubmit()}),this.replaceChildren(e),null!==this.#ie){const e=this.#ie;this.#ie=null,t.focus(e)}}static#ge(e){return e instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(e.type)}describedBy(e){return!!e&&(e.id||(e.id=c.uid("ful-described")),this.#ae.includes(e.id)||this.#ae.push(e.id),this.#fe(),!0)}#fe(){if(!this.#ne)return;const e=[...this.#ae,this.#oe].filter(e=>e);e.length&&this.#ne.setAttribute("aria-describedby",e.join(" "))}focus(e){this.#re?this.#re.focus(e):this.#ie=e??{}}setCustomValidity(e,t){if(c.set(this.#ce??this.#re,"aria-invalid",e?"true":null),!e)return this.internals.setValidity({}),void(this.#le.innerText="");this.internals.setValidity({customError:!0}," "),this.#le.innerText=e}get form(){return this.internals.form}_requestSubmit(){const e=this.form;if(!e)return;const t=e.querySelectorAll("button:not(:disabled), input:not(:disabled)");e.requestSubmit([...t].find(t=>"submit"===t.type&&t.form===e))}_notifyChange(e={}){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value,...e}}))}static#be=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#me(e,t,s){if(!le.#be.has(s.tagName)||"hidden"===s.getAttribute("type"))return t.id||(t.id=c.uid("ful-label")),s.setAttribute("aria-labelledby",t.id),void t.addEventListener("click",()=>e.focus());s.id||(s.id=c.uid("ful-control")),t.setAttribute("for",s.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}get value(){}set value(e){}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.reflectTo("disabled",e);for(const t of this.#he())t.toggleAttribute("disabled",e)}get readonly(){return this.hasAttribute("readonly")}set readonly(e){for(const t of this.#he())t.readOnly=e;this.#ce&&c.set(this.#ce,"aria-readonly",e?"true":null),this.reflectTo("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.#ce&&c.set(this.#ce,"aria-required",e?"true":null),this.reflectTo("required",e)}render(e){const t=this._build(e);if(t instanceof Promise)return t.then(e=>this.#pe(e));this.#pe(t)}_build(e){throw new Error(`${this.constructor.name} must implement _build`)}}class ue{#ve;#ye;#U;#we;#Ee;constructor(e,t,s,r,i){this.#ve=e,this.#ye=t,this.#U=s,this.#we=r,this.#Ee=i}prepare(e,t){return this.#we(e,t)}async submit(e,t){return await this.#ve.request(this.#U,this.#ye).json(e).fetch()}transform(e,t){return this.#Ee(e,t)}}class ce{#we;#Ee;constructor(e,t){this.#we=e,this.#Ee=t}async prepare(e,t){return await this.#we(e,t)}async submit(e,t,s){return s}async transform(e,t){return await this.#Ee(e,t)}}class de{static create(e,t){const s=e.component("http-client"),r=e.declared("request-mapper")?e.component(e.declared("request-mapper")):e=>e,i=e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e,n=e.declared("action");if(!n)return new ce(r,i);const a=e.declared("method")??"POST";return new ue(s,n,a,r,i)}}class he extends S{static attributes=["action","method","loader","request-mapper","response-mapper","clear-invalid-on-change:presence","scroll-on-error:presence","autocomplete"];form;render(){const e=document.createElement("form");this.form=e,e.setAttribute("novalidate",""),c.forward("form-",this,e),c.set(e,"autocomplete",this.declared("autocomplete")),e.replaceChildren(...this.childNodes),e.addEventListener("submit",async e=>{e.preventDefault(),e.stopPropagation(),await this.submit(e.submitter??void 0)}),this.addEventListener("click",e=>{const t=e.target;t.closest?.('[aria-disabled="true"]')&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.declared("clear-invalid-on-change")&&this.addEventListener("change",e=>{(e.target.form??e.target.internals?.form)===this.form&&e.target.setCustomValidity?.("")}),this.replaceChildren(e)}#xe=!1;async submit(e){if(this.#xe)return;let t,s;this.#xe=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);t=oe.extractFrom(this.form,e),s=await r.prepare(t,this);const i=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:e,values:t,request:s}});if(!this.dispatchEvent(i))return;this.errors=[];const n=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:i.detail.values,request:i.detail.request}});let a=await re.fireAsync(this,n,{mode:"pipeline"});s=n.detail.request,a=await r.submit(s,this,a);const o=await r.transform(a,this);this.dispatchEvent(new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,response:o}}))}catch(r){this.dispatchEvent(new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,exception:r}})),r instanceof P?this.errors=r.problems:console.warn("failed to submit form",this,"reason:",r)}finally{this.#xe=!1,this.spinner(!1)}}reset(){this.form.reset()}#Ae=0;#Se(e){if(c.defaultValue(e,"role","status"),e.hidden=!1,""!==e.textContent.trim())return;const t=document.createElement("span");t.className="ful-sr-only",t.dataset.ref="spinner-label",e.append(t),t.textContent=L.of().t("spinner.loading")}spinner(e){if(e){if(++this.#Ae,1!==this.#Ae)return}else if(this.#Ae=Math.max(0,this.#Ae-1),0!==this.#Ae)return;c.set(this,"aria-busy",e?"true":null),this.querySelectorAll("ful-spinner").forEach(t=>{if(t.closest("form")!==this.form)return;const s=t;e?this.#Se(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(t=>{const s=t;if(s.form===this.form&&("submit"===s.type||"reset"===s.type))if(e)s.dataset.wd=s.getAttribute("aria-disabled")??"",s.setAttribute("aria-disabled","true");else{if(void 0===s.dataset.wd)return;c.set(s,"aria-disabled",s.dataset.wd||null),delete s.dataset.wd}})}set values(e){oe.mutateIn(this.form,e)}get values(){return oe.extractFrom(this.form)}set errors(e){oe.errors(this.form,e,this.declared("scroll-on-error"))}}const pe=new t(100),fe=(e,t)=>pe.getOrCompute(`${e}:${t}`,()=>{try{return new RegExp(t,"g")}catch(s){return console.warn(`invalid ${e} attribute`,t,s),null}}),me={numeric:"numeric",decimal:"decimal"},ge=new Set(["date","time","datetime-local","month","week"]),be={numeric:e=>e.replace(/\D/g,""),decimal:e=>{const t=e.replace(/[^\d.,]/g,""),s=t.search(/[.,]/);return-1===s?t:t.slice(0,s+1)+t.slice(s+1).replace(/[.,]/g,"")}};class ve extends le{static observed=["placeholder"];static attributes=["type","v-type","keep","reject","uppercase:presence","trim:presence","unsigned:presence","autocomplete"];static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-if="type != \'textarea\'" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" placeholder=" " form=""></textarea>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_input;#Te=[];_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:e}){const t=this._type(),s=me[t],r=s?"text":t,i=this.template().withOverlay({type:r,slots:e}).render();this.#Te=[...i.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#Te[0];const n=this.declared("autocomplete")??(this.closest("form")?.getAttribute("autocomplete")??null);const a=(e=>{const t=e.declared("keep"),s=e.declared("reject");if(null!==t&&null!==s&&console.warn("a ful-input declares both keep and reject: keep is applied, reject is ignored",e),null!==t){const e=fe("keep",t);return e&&(t=>(t.match(e)??[]).join(""))}if(null!==s){const e=fe("reject",s);return e&&(t=>t.replace(e,""))}return((e,t)=>{const s=be[e];return s?t?s:e=>((e,t)=>(e.startsWith("-")?"-":"")+t(e))(e,s):null})(e._type(),e.declared("unsigned"))})(this);for(const e of this.#Te)this.#Ce(e,s,n,a);return{fragment:i,control:this._input,error:i.querySelector("ful-field-error"),label:i.querySelector("label")}}#Ce(e,t,s,r){t&&c.set(e,"inputmode",t),c.set(e,"autocomplete",s);const i=e.id;c.forward("input-",this,e),e!==this._input&&c.set(e,"id",i||null),this.#_e(e),e.addEventListener("input",()=>{if(!r)return;const t=e.value,s=r(t);if(t===s)return;const i=e.selectionStart;if(e.value=s,null===i)return;const n=r(t.slice(0,i)).length;e.setSelectionRange(n,n)})}#_e(e){if(!ge.has(e.type))return void e.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});let t=null,s=!1;const r=()=>{s=!1;const e=JSON.stringify(this.value);e!==t&&(t=e,this._notifyChange())};e.addEventListener("focus",()=>{t=JSON.stringify(this.value)}),e.addEventListener("keydown",e=>{"Enter"!==e.key||e.isComposing?s=!0:r()}),e.addEventListener("blur",r),e.addEventListener("change",e=>{e.stopPropagation(),s||r()})}get value(){const e=this.declared("uppercase"),t=this.declared("trim"),s=this._input.value,r=e?s.toUpperCase():s,i=t?r.trim():r;if(""===i)return null;const n="decimal"===this._type()?i.replaceAll(",","."):i;if("number"===this.declared("v-type")){const e=Number(n);return Number.isNaN(e)?n:e}return n}set value(e){const t=""===e||null==e?"":`${e}`;this._input.value!==t&&(this._input.value=t)}get placeholder(){const e=this._input.getAttribute("placeholder");return" "===e?null:e}set placeholder(e){for(const t of this.#Te)c.set(t,"placeholder",e??" ");this.reflectTo("placeholder",e)}}const ye=e=>""===e?null:e;class we extends S{static attributes=["locale","default"];render(){const e=this.textContent.trim(),[t,s,r]=e.split("-").map(Number),i=""===e?null:new Date(t,s-1,r);if(null===i||Number.isNaN(i.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:n}=L.of({locale:this.declared("locale")??void 0});this.replaceChildren(n(i,{year:"numeric",month:"numeric",day:"numeric"}))}}class Ee extends S{static attributes=["locale","default"];render(){const e=this.textContent.trim(),t=""===e?null:new Date(Ee.isoToLocal(e));if(null===t||Number.isNaN(t.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=L.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#Oe(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date(e)}static isoToLocal(e){const t=Ee.#Oe(e),s=(e,t)=>String(t).padStart(e,"0");return`${t.getFullYear()}-${s(2,t.getMonth()+1)}-${s(2,t.getDate())}T${s(2,t.getHours())}:${s(2,t.getMinutes())}:${s(2,t.getSeconds())}.${s(3,t.getMilliseconds())}`}static localToIso(e){const t=Ee.#Oe(e);return Number.isNaN(t.getTime())?null:t.toISOString()}}class xe extends ve{static observed=["step","min","max"];_type(){return"date"}get min(){return ye(this._input.min)}set min(e){this._input.min=xe.#qe(e)}get max(){return ye(this._input.max)}set max(e){this._input.max=xe.#qe(e)}get step(){return ye(this._input.step)}set step(e){this._input.step=e??""}static#qe(e){if(!e)return"";const t=e=>new Date(e.getTime()-6e4*e.getTimezoneOffset()).toISOString().split("T")[0];if("now"===e)return t(new Date);const s=/^([+-])(\d+)([dmy])$/.exec(e);if(!s)return e;const r="-"===s[1]?-1:1,i=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+i*r);break;case"m":{const e=n.getDate();n.setMonth(n.getMonth()+i*r),n.getDate()!==e&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+i*r)}return t(n)}}class Ae extends xe{_type(){return"time"}get min(){return ye(this._input.min)}set min(e){this._input.min=this.#ke(e)}get max(){return ye(this._input.max)}set max(e){this._input.max=this.#ke(e)}#ke(e){if(!e)return"";const t=new Date;if("now"!==e){const s=/^([+-])(\d+)([hm])$/.exec(e);if(!s)return e;const r="-"===s[1]?-1:1,i=+s[2]*r;"h"===s[3]?t.setHours(t.getHours()+i):t.setMinutes(t.getMinutes()+i)}return Ae.#Re(t,Number(this._input.step)||60)}static#Re(e,t){const s=e=>String(e).padStart(2,"0"),r=3600*e.getHours()+60*e.getMinutes()+e.getSeconds(),i=Math.floor(r/t)*t,n=s(Math.floor(i/3600)),a=s(Math.floor(i%3600/60));return t%60==0?`${n}:${a}`:`${n}:${a}:${s(i%60)}`}}class Se extends ve{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){return Ee.localToIso(this._input.value)}set value(e){super.value=e?Ee.isoToLocal(e):""}get min(){return Ee.localToIso(this._input.min)}set min(e){this._input.min=e?Ee.isoToLocal(e):""}get max(){return Ee.localToIso(this._input.max)}set max(e){this._input.max=e?Ee.isoToLocal(e):""}get step(){return ye(this._input.step)}set step(e){this._input.step=e??""}}class Te extends ve{static WARNING_TIMEOUT=5e3;static list(e=[]){const t=new DataTransfer;for(const s of e)t.items.add(s);return t.files}static observed=["placeholder","accept:csv","multiple:presence","item-list:presence","dropzone:presence","max-files:number","max-file-size:number","max-total-size:number","value"];#Le;#Ne;#Pe;#Me;#Fe;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#ze;_build(e){const t=super._build(e),s=t.fragment;return this.#Ne=s.querySelector("ful-item-list"),this.#ze=e.slots?.items&&!u.isBlank(e.slots.items)?x.fromFragment(e.slots.items):null,this.#Pe=s.querySelector("[data-ref=dropzone]"),this.#Me=s.querySelector("ful-field-warnings"),this.#Fe=s.querySelector("ful-control-group"),this.#Me.addEventListener("animationend",e=>{e.target.remove()}),this.#Ne.addEventListener("click",e=>{if(!e.target.closest("button"))return;if(!this._interactive())return;const t=[...this.#Ne.children].indexOf(e.target.closest("ful-item"));-1!==t&&(this.files=Te.list([...this.files].filter((e,s)=>s!==t)),this._notifyChange())}),this.#Pe.addEventListener("click",e=>{this._interactive()&&this._input.click()}),this.#Pe.addEventListener("dragover",e=>{e.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#Pe.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#Pe.addEventListener("drop",e=>{if(e.preventDefault(),this.toggleAttribute("dragover",!1),!this._interactive())return;const t=[...e.dataTransfer.items].filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e);0===t.length||t.length>1&&!this.multiple||(this.files=Te.list(t),this._notifyChange())}),this._input.addEventListener("change",e=>{this.#De()}),{...t,freeze:this.#Fe}}#De(){this.setCustomValidity(),this.#Me.replaceChildren(),this.#Ie(),this.#$e(),this.#Be(),this.#je(),(this.#ze??this.template("items")).withOverlay({files:this.files}).renderTo(this.#Ne)}warning(e,t){this.template("warning").withOverlay({key:e,args:t}).appendTo(this.#Me);const s=this.#Me.lastElementChild;setTimeout(()=>s.remove(),Te.WARNING_TIMEOUT)}#He(e){const t=e.name.toLowerCase();return this.#Le.some(s=>{const r=s.toLowerCase().split(";")[0].trim();return r.startsWith(".")?t.endsWith(r):r.endsWith("/*")?e.type.startsWith(`${r.slice(0,-1)}`):r.includes("/")&&e.type===r})}#Ie(){if(!this.#Le.length)return;const e=[...this.files].filter(e=>!this.#He(e));0!==e.length&&(this.warning("files.unacceptable-file-type",{types:this.#Le.join(", ")}),this._input.files=Te.list([...this.files].filter(t=>!e.includes(t))))}#je(){null!==this.#We&&(this.files.length<=this.#We||(this.warning("files.max-files-exceeded",{count:this.#We}),this._input.files=Te.list()))}#$e(){if(null===this.#Ve)return;const e=[...this.files].filter(e=>e.size>this.#Ve);0!==e.length&&(this.warning("files.max-file-size-exceeded",{size:L.of().bytes(this.#Ve)}),this._input.files=Te.list([...this.files].filter(t=>!e.includes(t))))}#Be(){null!==this.#Ue&&([...this.files].reduce((e,t)=>e+t.size,0)<=this.#Ue||(this.warning("files.max-total-size-exceeded",{size:L.of().bytes(this.#Ue)}),this._input.files=Te.list()))}get accept(){return this.#Le}set accept(e){this._input.accept=e.join(","),this.#Le=e,this.reflectTo("accept",e)}get multiple(){return this._input.multiple}set multiple(e){this._input.multiple=e,this.reflectTo("multiple",e)}get files(){return this._input.files}set files(e){this._input.files=e,this.#De()}get file(){return this.files[0]??null}set file(e){this.files=Te.list(e?[e]:[])}get value(){const e=Array.from(this._input.files).map(e=>e.name);return this.multiple?e:e[0]??null}set value(e){e||(this.files=Te.list())}formResetCallback(){this.value=null}get totalsize(){return Array.from(this.files).reduce((e,t)=>e+t.size,0)}#We;get maxFiles(){return this.#We}set maxFiles(e){this.#We=e,this.reflectTo("max-files",e)}#Ve;get maxFileSize(){return this.#Ve}set maxFileSize(e){this.#Ve=e,this.reflectTo("max-file-size",e)}#Ue;get maxTotalSize(){return this.#Ue}set maxTotalSize(e){this.#Ue=e,this.reflectTo("max-total-size",e)}#Ge;get itemList(){return this.#Ge}set itemList(e){this.#Ge=e,this.reflectTo("item-list",e)}#Qe;get dropzone(){return this.#Qe}set dropzone(e){this.#Qe=e,this.reflectTo("dropzone",e)}}const Ce=new Map;let _e=0,Oe=!1;const qe=(e,t,s)=>Math.min(Math.max(e,t),Math.max(t,s)),ke=(e,t)=>{const{invoker:s,stretch:r}=t,i=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,o=n.clientHeight;e.style.removeProperty("margin");const l=getComputedStyle(e),u=parseFloat(l.marginTop)||0,c=parseFloat(l.marginRight)||0,d=parseFloat(l.marginBottom)||0,h=parseFloat(l.marginLeft)||0;if(e.style.right="auto",e.style.bottom="auto",e.style.margin="0",r){e.style.removeProperty("width"),e.style.removeProperty("min-width"),e.style.removeProperty("max-width");const t=Math.min(parseFloat(l.maxWidth)||a,a-16);e.style.minWidth=`${Math.min(i.width,a-16)}px`,e.style.maxWidth=`${t}px`;const s=e.getBoundingClientRect().width;e.style.left=`${qe(i.left,8,a-s-8)}px`;const r=e.getBoundingClientRect().height,n=i.bottom+u,c=n+r<=o-8?n:i.top-d-r;return void(e.style.top=`${qe(c,8,o-r-8)}px`)}const p=(e=>e.matches("ful-note, .ful-note, [placement]"))(e),f=p?e.getAttribute("placement")??"bottom":"bottom";e.style.removeProperty("max-width");const m=Math.min(parseFloat(l.maxWidth)||a,a-16);e.style.maxWidth=`${m}px`,e.style.left="8px";const g=e.getBoundingClientRect().width;let b="right"===f?i.right+h:"left"===f?i.left-c-g:p?i.left+i.width/2-g/2:i.left;b=qe(b,8,a-g-8),e.style.left=`${b}px`,e.style.maxWidth=`${Math.min(m,a-8-b)}px`;const v=e.getBoundingClientRect().height,y="top"===f?i.top-d-v:"right"===f||"left"===f?i.top+i.height/2-v/2:i.bottom+u;e.style.top=`${qe(y,8,o-v-8)}px`,p&&((e,t)=>{const s=t.getBoundingClientRect(),r=e.getBoundingClientRect();e.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-r.left-e.clientLeft+"px"),e.style.setProperty("--ful-note-callout-block",s.top+s.height/2-r.top-e.clientTop+"px")})(e,s)},Re=()=>{_e=0;for(const[e,t]of Ce)e.isConnected&&t.invoker.isConnected?ke(e,t):Ce.delete(e)},Le=()=>{!_e&&Ce.size>0&&(_e=requestAnimationFrame(Re))};class Ne{static wire(e,t,{prefix:s="ful-anchor",invoke:r=!1,expanded:i=!1,stretch:n=!1,handPlace:a=!1}={}){const o=c.uid(s);r&&(t.id=t.id||o,"button"===e.localName||"input"===e.localName?e.setAttribute("popovertarget",t.id):(e.addEventListener("click",()=>t.togglePopover()),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.togglePopover())})));const l=`--${o}`;if(e.style.anchorName=l,t.style.positionAnchor=l,i&&(e.setAttribute("aria-expanded","false"),t.addEventListener("toggle",t=>{e.setAttribute("aria-expanded","open"===t.newState?"true":"false")})),!a&&CSS.supports("anchor-name: --ful-probe")&&CSS.supports("position-anchor: --ful-probe")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)")&&CSS.supports("width: anchor-size(width)"))return;const u={invoker:e,stretch:n};t.addEventListener("beforetoggle",e=>{"open"===e.newState&&((e,t)=>{e.style.visibility="hidden",queueMicrotask(()=>{e.matches(":popover-open")&&ke(e,t),e.style.removeProperty("visibility")})})(t,u)}),t.addEventListener("toggle",e=>{"open"===e.newState?(Ce.set(t,u),ke(t,u)):(Ce.delete(t),(e=>{for(const t of["top","left","right","bottom","margin","max-width","min-width","width","visibility","--ful-note-callout-inline","--ful-note-callout-block"])e.style.removeProperty(t)})(t))}),Oe||(Oe=!0,document.addEventListener("scroll",Le,!0),window.addEventListener("resize",Le))}static show(e,t,{flip:s=!1,gap:r=0}={}){return"function"!=typeof e.showPopover||e.matches(":popover-open")||e.showPopover(),(()=>{const i=t instanceof Element?t.getBoundingClientRect():t,n=document.documentElement,a=e.getBoundingClientRect(),o=i.bottom+r,l=i.top-r-a.height,u=s&&o+a.height>n.clientHeight-8&&l>=8?l:o;e.style.right="auto",e.style.bottom="auto",e.style.margin="0",e.style.left=`${qe(i.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,e.style.top=`${qe(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),e}}const Pe=(e,t)=>e.filter(({key:e})=>t.some(t=>t==e)),Me=(e,t)=>e.filter(({label:e})=>(e??"").toLowerCase().includes(t?.toLowerCase()??""));class Fe{#ve;#ye;#U;#Ee;#Ke;#Je;#C=null;#Xe=null;#Ye=new ie;constructor({http:e,url:t,method:s,responseMapper:r,prefetch:i,revision:n}){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r,this.#Ke=i,this.#Je=n}async prefetch(){this.#Ke&&await this.#Ze()}async exact(...e){return Pe(await this.#Ze(),e)}async load(e){return Me(await this.#Ze(),e)}async invalidate(){this.#Ye.invalidate(),this.#C=null,this.#Xe=null}async#Ze(){if(null===this.#C){if(null===this.#Xe){const e=this.#Ye.hold();this.#Xe=Fe.#et(this.#ve,this.#U,this.#ye,this.#Je).then(t=>{e.stale||(this.#C=this.#Ee(t))}).finally(()=>{e.stale||(this.#Xe=null)})}await this.#Xe}if(null===this.#C)throw new Error("superseded by an invalidation");return this.#C}static async#et(e,t,s,r){const i=`${t}@${s}`;if(null!==r){const e=te.load(i,r);if(void 0!==e)return e}const n=await e.request(t,s).fetchJson();if(null!==r)try{te.save(i,r,n)}catch(e){console.warn("failed to cache the select options",e)}return n}}class ze{#ve;#ye;#U;#Ee;constructor({http:e,url:t,method:s,responseMapper:r}){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r}async invalidate(){}async exact(...e){const t=await this.#ve.request(this.#U,this.#ye).param("k",...e).fetchJson();return this.#Ee(t)}async load(e){const t=await this.#ve.request(this.#U,this.#ye).param("s",e).fetchJson();return this.#Ee(t)}}class De{#C;constructor(e){this.#C=e}update(e){this.#C=e}async invalidate(){}exact(...e){return Pe(this.#C,e)}load(e){return Me(this.#C,e)}}class Ie{static from({data:e,http:t,url:s,method:r="POST",mode:i,prefetch:n=!1,revision:a=null,responseMapper:o}){return s?"chunked"===i?new ze({http:t,url:s,method:r,responseMapper:o}):new Fe({http:t,url:s,method:r,responseMapper:o,prefetch:n,revision:a}):new De(e??[])}static create(e,t){if(!e.declared("src")){const e=Array.from(t.options?.querySelectorAll("option")??[]);return Ie.from({data:e.map(e=>({key:e.getAttribute("value")??e.innerText.trim(),label:e.innerText.trim(),metadata:void 0}))})}return Ie.from({http:e.component("http-client"),url:e.declared("src"),method:e.declared("method")??"POST",mode:e.declared("mode"),prefetch:e.declared("preload"),revision:Ie.#tt(e),responseMapper:Ie.#st(e)})}static#tt(e){const t=e.declared("revision");if(""!==t)return t;const s=e.component("revision");return null==s?(console.warn("a valueless revision asks the registry for one, and no 'revision' component is defined: the vocabulary will not be cached",e),null):"function"==typeof s?s():s}static#st(e){return e.declared("k-expr")&&e.declared("l-expr")?t=>e._registry.evaluator().withOverlay(t).evaluateExpression(e.declared("d-expr")??"self").map(t=>{const s=e._registry.evaluator().withOverlay(t);return{key:s.evaluateExpression(e.declared("k-expr")),label:s.evaluateExpression(e.declared("l-expr")),metadata:s.evaluateExpression(e.declared("m-expr")??"self")}}):e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e.map(([e,t,s])=>({key:e,label:t,metadata:s}))}}class $e extends S{static attributes=["listbox"];static slots=!0;static template='\n <ful-spinner class="centered" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <ful-empty data-ref="empty" aria-live="polite" hidden>{{ #l10n:t(\'dropdown.empty\') }}</ful-empty>\n <menu tabindex="-1" role="listbox" hidden></menu>\n ';static templates={options:'\n <li data-tpl-each="self" data-tpl-selected="index == 0" data-tpl-value="index" role="option">\n {{ label }}\n </li>\n '};#rt;#it;#nt;#at;#X=new Map;#ot=new ie;render({slots:e}){const t=this.template().render();this.#at=u.isBlank(e.default)?this.template("options"):x.fromFragment(e.default),this.#rt=t.querySelector("ful-spinner"),this.#nt=t.querySelector("[data-ref=empty]"),this.#it=t.querySelector("menu"),this.#it.id=this.declared("listbox")||c.uid("ful-listbox"),this.#it.addEventListener("mousedown",e=>{e.target.closest("li")&&e.preventDefault()}),this.#it.addEventListener("click",e=>{e.stopPropagation();const t=e.target.closest("li");t?t.matches('[aria-disabled="true"]')||this.#lt(t):this.hide()}),this.replaceChildren(t)}#ut(){return this.#it?.querySelector('[selected]:not([aria-disabled="true"])')??this.#it?.querySelector('li:not([aria-disabled="true"])')??null}#ct(e){if(e){for(const t of this.#it.querySelectorAll("li"))t.toggleAttribute("selected",t===e);e.id||=c.uid("ful-option"),this.#dt(e.id),e.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#dt(null)}acceptSelection(){const e=this.#ut();e&&this.#lt(e)}update(e,t=[]){if(void 0===e)throw new Error("null data");this.#X=new Map(e.map((e,t)=>[String(t),e]));const s=e.map((e,t)=>({index:t,...e}));this.#at.withOverlay(s).renderTo(this.#it);for(const[s,r]of[...this.#it.children].entries()){const i=e[s],n=t.some(e=>e==i?.key);r.toggleAttribute("picked",n),r.setAttribute("aria-selected",n?"true":"false");const a=!!i?.metadata?.disabled;a?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"),a&&i.metadata.reason?r.setAttribute("title",String(i.metadata.reason)):r.removeAttribute("title")}this.#nt.toggleAttribute("hidden",0!==e.length),this.#it.toggleAttribute("hidden",0===e.length);const r=e.findIndex(({key:e})=>t.some(t=>t==e));this.#ct(r>=0?this.#it.children[r]:this.#ut())}#lt(e){const t=e.getAttribute("value"),s=this.#X.get(t);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:t,entry:s}}))}hide(){this.#ot.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#dt(null)}#dt(e){this.dispatchEvent(new CustomEvent("activechange",{bubbles:!1,cancelable:!1,detail:{id:e}}))}get shown(){return this.matches(":popover-open")}async show(e,t=[]){const s=this.#ot.take();this.matches(":popover-open")||this.showPopover(),this.#it.setAttribute("hidden",""),this.#rt.removeAttribute("hidden");try{const r=await e();if(s.stale)return;this.update(r,t)}catch(e){if(s.stale)return;throw this.hide(),e}finally{s.stale||this.#rt.setAttribute("hidden","")}}async moveOrShow(e,t,s=[]){if(this.shown){const t=this.#ut(),s=t?.[(e?"next":"previous")+"ElementSibling"],r=s?this.#ht(s,e):null;return void(t&&r&&this.#ct(r))}await this.show(t,s)}#ht(e,t){for(let s=e;s;s=s[(t?"next":"previous")+"ElementSibling"])if(!s.matches('[aria-disabled="true"]'))return s;return null}jump(e){const t=e?this.#it.firstElementChild:this.#it.lastElementChild,s=this.#ht(t,e);s&&this.#ct(s)}page(e){const t=this.#ut();if(!t)return;let s=t;for(let t=0;t!==this.#pt();++t){const t=this.#ht(s[(e?"next":"previous")+"ElementSibling"],e);if(!t)break;s=t}this.#ct(s)}#pt(){const e=this.#it.firstElementChild;return e&&0!==e.offsetHeight?Math.max(1,Math.trunc(this.#it.clientHeight/e.offsetHeight)):1}}class Be extends le{static attributes=["name","loader","k-type","mode","preload:presence","revision","k-expr","l-expr","d-expr","m-expr","response-mapper"];static observed=["multiple:presence","item-list:presence","value:csv","src","method"];unmarshal(e,t){return"value"!==e||""!==t||this.hasAttribute("multiple")?super.unmarshal(e,t):[""]}static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-control>\n <input type="text" form="" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n <ful-dropdown popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </ful-control-group>\n <ful-item-list></ful-item-list>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="entries" data-tpl-var="entry" data-tpl-data-key="entry.key">\n <div><span>{{ entry.label }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'select.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n '};#ft;#mt={src:null,method:null};#X;#re;#gt;#bt;#Ne;#ze;#vt;#yt=!1;#wt=new Map;#Et=new ie;#xt=!1;#At;#St;_build({slots:e}){const t=this.declared("name");this.#X=e.options,this.#Tt(),this.#vt=this.declared("multiple"),this.#ft.prefetch?.()?.catch(e=>{console.warn("failed to prefetch select options",this,"reason:",e)});const s=this.template().withOverlay({slots:e,name:t}).render();this.#bt=s.querySelector("ful-control > input"),this.#Ne=s.querySelector("ful-item-list"),this.#ze=e.items&&!u.isBlank(e.items)?x.fromFragment(e.items):null,c.forward("input-",this,this.#bt),this.#re=s.querySelector("ful-control"),this.#gt=s.querySelector("ful-dropdown");const r=c.uid("ful-listbox");this.#gt.setAttribute("listbox",r),this.#bt.setAttribute("aria-controls",r),this.#gt.addEventListener("beforetoggle",e=>{const t="open"===e.newState;this.#bt.setAttribute("aria-expanded",t?"true":"false"),t||this.#bt.removeAttribute("aria-activedescendant")}),this.#gt.addEventListener("activechange",e=>{c.set(this.#bt,"aria-activedescendant",e.detail.id)});const i=s.querySelector("ful-control-group");return Ne.wire(i,this.#gt,{prefix:"ful-select",stretch:!0}),[this.#At,this.#St]=ae.throttle(400,()=>this.#Ct()),this.#_t(),this.#Ot(),this.#qt(),this.#kt(),{fragment:s,control:this.#bt,error:s.querySelector("ful-field-error"),label:s.querySelector("label")}}#_t(){this.addEventListener("click",e=>{if(!this._interactive())return;const t=e.target.closest('button, [role="button"], a[href], input, select, textarea');t&&t!==this.#bt||(this.#gt.shown?this.#Rt():(this.#bt.focus(),this.#At()))}),this.#Ne.addEventListener("click",e=>{e.stopPropagation(),e.target.closest("button")&&this._interactive()&&this.#Lt([...this.#Ne.children].indexOf(e.target.closest("ful-item")))}),this.#re.addEventListener("click",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t&&(e.stopPropagation(),this.#Nt(t))})}#Ot(){this.addEventListener("keydown",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t?this.#Pt(e,t):"ArrowLeft"===e.code&&e.target===this.#bt&&0===this.#bt.selectionStart&&0===this.#bt.selectionEnd&&this.#Mt().at(-1)?.focus()})}#qt(){this.#bt.addEventListener("change",e=>{e.stopPropagation()}),this.#bt.addEventListener("focus",()=>{this.#xt||this.#bt.select()}),this.#bt.addEventListener("blur",e=>{e.stopPropagation(),e.relatedTarget&&this.contains(e.relatedTarget)||(this.#St(),this.#Rt(!0))}),this.#bt.addEventListener("keydown",e=>{this._interactive()&&this.#Ft(e)}),this.#bt.addEventListener("input",e=>{e.stopPropagation(),this._interactive()&&(this.#xt=!0,this.#At())})}#kt(){this.#gt.addEventListener("change",e=>{e.stopPropagation(),this._interactive()?(this.#vt||this.#wt.clear(),this.#xt=!1,this.#wt.set(this.#zt(e.detail.entry.key),e.detail.entry),this.#Dt(),this.#bt.focus(),this.#gt.hide(),this.#vt||this.#bt.select()):this.#Rt()})}async withLoader(e){return await e(this.#ft)}async reload(){await(this.#ft.invalidate?.()),await(this.#ft.prefetch?.());const e=[...this.#wt.keys()];0!==e.length&&await this.#i(e,this.#Et.take())}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#It()&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#It()&&this.reload()}async reconfigure(e,{notify:t=!1}={}){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);this.#It();const s=[...this.#wt.keys()];await this.reload();const r=[...this.#wt.keys()];t&&r.length!==s.length&&this._notifyChange({entry:this.entry})}#Tt(){this.#mt={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#ft=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#X})}#It(){return(this.getAttribute("src")!==this.#mt.src||this.getAttribute("method")!==this.#mt.method)&&(this.#St(),this.#Rt(),this.#Tt(),!0)}#Mt(){return Array.from(this.#re.querySelectorAll(":scope > ful-badge"))}#Nt(e){this._interactive()&&this.#Lt(this.#Mt().indexOf(e))}#Lt(e){const t=Array.from(this.#wt.keys())[e];void 0!==t&&(this.#wt.delete(t),this.#Dt())}#Pt(e,t){switch(e.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":e.preventDefault(),this.#Nt(t),this.#bt.focus();break;case"ArrowLeft":e.preventDefault(),(this.#Mt()[this.#Mt().indexOf(t)-1]??this.#bt).focus();break;case"ArrowRight":e.preventDefault(),(this.#Mt()[this.#Mt().indexOf(t)+1]??this.#bt).focus();break;case"Escape":this.#bt.focus()}}#Ft(e){switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),this.#$t(e);break;case"Home":this.#gt.shown&&(e.preventDefault(),this.#gt.jump(!0));break;case"End":this.#gt.shown&&(e.preventDefault(),this.#gt.jump(!1));break;case"PageDown":case"PageUp":this.#gt.shown&&(e.preventDefault(),this.#gt.page("PageDown"===e.code));break;case"Escape":this.#St(),this.#Rt();break;case"NumpadEnter":case"Enter":if(!this.#gt.shown)return;e.preventDefault(),this.#xt=!1,this.#Bt(),this.#gt.acceptSelection();break;case"Backspace":0===this.#bt.selectionStart&&0===this.#bt.selectionEnd&&this.#Lt(this.#wt.size-1);break;case"Tab":this.#St(),this.#Rt(!0)}}#$t(e){const t="ArrowDown"===e.code;e.altKey?t&&!this.#gt.shown?this.#Ct():!t&&this.#gt.shown&&this.#Rt():this.#gt.moveOrShow(t,()=>this.#ft.load(this.#jt()),[...this.#wt.keys()])}#Rt(e=!1){this.#gt.hide();const t=e&&this.#xt&&!this.#vt&&""===this.#bt.value&&0!==this.#wt.size;this.#xt=!1,t&&(this.#wt.clear(),this.#Dt()),this.#Bt()}#Ct(){return this.#gt.show(()=>this.#ft.load(this.#jt()),[...this.#wt.keys()])}#jt(){return this.#xt?this.#bt.value:""}get query(){return this.#jt()}#Bt(){const e=this.#wt.values().next().value;this.#bt.value=this.#vt?"":e?.label??""}#Ht(){return[...this.#wt.values()]}#Dt(){this.#Wt(),this._notifyChange({entry:this.entry})}#Wt(){const e=this.#vt?Array.from(this.#wt.entries()).map(([e,t],s)=>{const r=document.createElement("ful-badge");return r.setAttribute("role","button"),r.setAttribute("tabindex",0===s?"0":"-1"),r.setAttribute("value",e),r.innerText=t.label,r}):[];for(const e of this.#re.querySelectorAll(":scope > ful-badge"))e.remove();this.#bt.before(...e),this.#xt||this.#Bt(),this.#Ne.replaceChildren(),(this.#ze??this.template("items")).withOverlay({entries:this.#Ht()}).renderTo(this.#Ne)}#zt(e){switch(this.declared("k-type")){case"number":{const t=""===e?Number.NaN:Number(e);return Number.isNaN(t)?e:t}case"boolean":return!0===e||"true"===e||!1!==e&&"false"!==e&&e;default:return String(e)}}set value(e){const t=(null==e?[]:Array.isArray(e)?e:[e]).map(e=>this.#zt(e));!this.#yt&&t.some(e=>"string"==typeof e&&e.includes(","))&&(this.#yt=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#wt=new Map(t.map(e=>[e,{key:e,label:e,metadata:void 0}]));const s=this.#Et.take();this.#re&&(this.#Wt(),0!==t.length&&this.#i(t,s))}async#i(e,t){const s=await this.#ft.exact(...e);if(t.stale)return;const r=new Map(s.map(e=>[this.#zt(e.key),e]));for(const t of e)this.#wt.has(t)&&(r.has(t)?this.#wt.set(t,r.get(t)):this.#wt.delete(t));this.#Wt()}get value(){return this.#vt?[...this.#wt.keys()]:[...this.#wt.keys()][0]??null}get entry(){const e=this.#Ht();return this.#vt?e:e[0]??null}#Ge;get multiple(){return this.#vt}set multiple(e){this.#vt=e,this.reflectTo("multiple",e)}get itemList(){return this.#Ge}set itemList(e){this.#Ge=e,this.reflectTo("item-list",e)}}class je extends le{static attributes=["name","type"];static slots=!0;static ROLE="radiogroup";static template='\n <fieldset>\n <legend>\n {{{{ slots.default }}}}\n </legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <ful-radio-list>\n <div class="label-wrapper" data-tpl-each="inputsAndLabels" data-tpl-var="ial">\n <label>\n {{{{ ial[0] }}}}\n <div>{{{{ ial[1] }}}}</div>\n </label>\n </div>\n </ful-radio-list>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';#Vt;#Ut;#Gt;_build({slots:e}){const t=this.declared("name")??c.uid("ful-radiogroup"),s=Array.from(e.default.querySelectorAll("ful-radio")),r=s.map(e=>{const s=document.createElement("input");return s.setAttribute("type","radio"),c.forward("input-",this,s),c.forward("",e,s),s.setAttribute("name",`${t}-ignore`),s.setAttribute("form",""),s.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()}),[s,u.fromChildNodes(e)]});s.forEach(e=>{e.remove()});const i=this.template().withOverlay({name:t,slots:e,inputsAndLabels:r}).render();return this.#Vt=i.firstElementChild,this.#Ut=i.querySelector("input[type=radio]"),this.#Gt="boolean"===this.declared("type"),{fragment:i,control:this.#Ut,error:i.querySelector("ful-field-error"),described:this,claims:this.#Vt,announces:this,freeze:this.#Vt}}get value(){const e=this.querySelector("input[type=radio]:checked");return e?this.#Gt?"true"===e.value:e.value:null}set value(e){const t=this.querySelectorAll("input[type=radio]"),s=()=>{t.forEach(e=>{e.checked=!1})};if(null===e)return void s();const r=this.querySelector(`input[type=radio][value=${CSS.escape(String(e))}]`);null!==r?r.checked=!0:s()}}class He extends le{static attributes=["type"];static observed=["value:bool"];static slots=!0;static template='\n <ful-choice data-tpl-switch="isSwitch">\n <input type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </ful-choice>\n <ful-field-error></ful-field-error>\n ';#Qt;#bt;_build({slots:e}){const t="switch"===this.declared("type"),s=this.template().withOverlay({slots:e,isSwitch:t}).render();this.#Qt=s.firstElementChild,this.#bt=s.querySelector("input"),c.forward("input-",this,this.#bt),this.#bt.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});const r=s.querySelector("label");return{fragment:s,control:this.#bt,error:s.querySelector("ful-field-error"),label:r,freeze:this.#Qt}}get value(){return this.#bt.checked}set value(e){this.#bt.checked=e}}class We extends S{static attributes=["sorter"];static observed=["order"];#Kt;render(){const e=this.declared("sorter"),t=["asc","desc",null];this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",()=>{const s=t[(t.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort:requested",{bubbles:!0,cancelable:!1,detail:{value:{sorter:e,order:s}}}))}),this.addEventListener("keydown",e=>{["Enter","NumpadEnter","Space"].includes(e.code)&&(e.preventDefault(),this.click())})}get order(){return this.#Kt||null}set order(e){this.#Kt=e||null,this.reflectTo("order",this.#Kt);const t=this.closest("th");t&&c.set(t,"aria-sort",this.#Kt?"asc"===this.#Kt?"ascending":"descending":null)}}class Ve extends S{static observed=["total:number","current:number"];static attributes=["pages:number"];static config={prevIcon:"chevron-left",nextIcon:"chevron-right",reloadIcon:"arrow-clockwise"};static template='\n <ful-pagination-bar role="navigation" data-tpl-aria-label="#l10n:t(\'pagination.navigation\')">\n <ul>\n <li data-ref="index"> {{ #l10n:t(\'pagination.showing\', { \'current\': curr.label, \'total\': total }) }}</li>\n <li data-ref="reload"><button type="button" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button></li>\n <li data-ref="prev">\n <button type="button" data-tpl-disabled="prev.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.previous\')" data-tpl-data-page="prev.index">\n <ful-icon data-tpl-name="config.prevIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n <li data-ref="page" data-tpl-each="pages" data-tpl-var="page">\n <button type="button" data-tpl-aria-current="curr.index == page.index ? \'page\' : false" data-tpl-data-page="page.index" >\n {{ page.label }}\n </button>\n </li>\n <li data-ref="next">\n <button type="button" data-tpl-disabled="next.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.next\')" data-tpl-data-page="next.index">\n <ful-icon data-tpl-name="config.nextIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n </ul>\n </ful-pagination-bar>\n ';#Jt=0;#W=0;render(){this.addEventListener("click",e=>{const t=e.target.closest("button");t&&!t.hasAttribute("disabled")&&"page"!==t.getAttribute("aria-current")&&this.dispatchEvent(new CustomEvent("page:requested",{bubbles:!0,cancelable:!1,detail:{value:Number(t.dataset.page??this.#W)}}))})}update({current:e,total:t}={}){void 0!==e&&(this.#W=e??0),void 0!==t&&(this.#Jt=t??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#Jt);const s=this.#W,r=this.#Jt,i=this.declared("pages")??5,n=Math.max(r,1),a=s>0,o=s+1<n,l={index:a?s-1:null,enabled:a},u={index:s,label:s+1},c={index:o?s+1:null,enabled:o},d=Math.max(1,Math.min(i,n)),h=Math.max(0,Math.min(s-Math.floor((d-1)/2),n-d)),p=Array.from({length:d},(e,t)=>({index:h+t,label:h+t+1})),f=this.contains(document.activeElement)?document.activeElement.closest("li")?.getAttribute("data-ref"):null,m="page"===f?document.activeElement.dataset.page:null;if(this.template().withOverlay({total:n,prev:l,curr:u,next:c,pages:p}).renderTo(this),!f)return;const g=(null===m?null:this.querySelector(`li[data-ref=page] button[data-page="${m}"]`))??this.querySelector(`li[data-ref=${f}] button:not(:disabled)`)??this.querySelector("li[data-ref=page] button[aria-current=page]");g?.focus()}get total(){return this.#Jt}set total(e){this.update({total:e})}get current(){return this.#W}set current(e){this.update({current:e})}}class Ue{static parse(e,t){const s=e?h.queryChildren(e,"schema"):null;if(!s)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const r=document.createElement("tr"),i=document.createElement("tr");i.setAttribute("data-tpl-each","rows");for(const e of s.getAttributeNames()){const t=s.getAttribute(e);r.setAttribute(e,t??""),i.setAttribute(e,t??"")}const n=h.queryChildrenAll(s,"column"),a=n.filter(e=>e.hasAttribute("order")&&e.hasAttribute("sorter")).map(e=>({sorter:e.getAttribute("sorter"),order:e.getAttribute("order")}))[0]??null;for(const e of n){const t=h.queryChildren(e,"title"),s=e.getAttribute("sorter"),n=e.getAttribute("order"),a=t??document.createTextNode(e.getAttribute("title")??"");t?.remove(),e.removeAttribute("sorter"),e.removeAttribute("order"),e.removeAttribute("title");const o=s||n?(()=>{const e=document.createElement("ful-sorter");return s&&e.setAttribute("sorter",s),n&&e.setAttribute("order",n),e.append(a),e})():a,l=document.createElement("th"),u=document.createElement("td");for(const t of e.getAttributeNames()){const s=e.getAttribute(t);l.setAttribute(t,s??""),u.setAttribute(t,s??"")}l.append(o),u.append(...e.childNodes),r.append(l),i.append(u)}return{headersTemplate:t.withOverlay({inHeaders:!0,inRows:!1}).withFragment(u.from(r)),rowsTemplate:t.withOverlay({inHeaders:!1,inRows:!0}).withFragment(u.from(i)),sort:a,length:n.length}}}class Ge{#C;constructor(e){this.#C=e}async load(e,t,s){const r=this.#Xt(t),i=e.page*e.size,n=i+e.size;return{data:r.slice(i,n),size:r.length}}#Xt(e){if(!e?.sorter)return this.#C;const{sorter:t,order:s}=e,r="desc"===s?-1:1;return[...this.#C].sort((e,s)=>{const i=e?.[t],n=s?.[t];return i===n?0:null==i?1:null==n?-1:(i<n?-1:1)*r})}update(e){this.#C=e}}class Qe{#ve;#ye;#U;#Ee;constructor(e,t,s,r=e=>e){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r}async load(e,t,s){const r=Object.entries(s).filter(([e,t])=>t);return await this.#ve.request(this.#U,this.#ye).param("page",e.page).param("size",e.size).param("sort",t?`${t.sorter},${t.order}`:null).param("filters",r.length>0?JSON.stringify(Object.fromEntries(r)):null).fetchJson().then(e=>this.#Ee(e))}}class Ke{static create(e,t){const s=e.getAttribute("src");if(s){const t=e.component("http-client"),r=e.getAttribute("method")??"GET",i=e.hasAttribute("response-mapper")?e.component(e.getAttribute("response-mapper")):e=>e;return new Qe(t,s,r,i)}return new Ge([])}}class Je extends S{static attributes=["loader","autoload:presence"];static observed=["page-size:number","src","method"];static slots=!0;static config={searchIcon:"search",emptyIcon:"inbox"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <ful-table-wrapper>\n <table>\n <caption data-tpl-if="slots.caption">{{{{ slots.caption }}}}</caption>\n <thead></thead>\n <tbody></tbody>\n <tbody data-ref="initial">\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty>\n <ful-icon data-tpl-if="config.searchIcon" data-tpl-name="config.searchIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.initial\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="empty" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty data-tpl-if="slots.empty" data-ref="empty-authors"></ful-empty>\n <ful-empty data-tpl-if="!slots.empty">\n <ful-icon data-tpl-if="config.emptyIcon" data-tpl-name="config.emptyIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.no-data\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="loading" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-spinner class="big" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="feedback" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <div role="alert">\n <p>{{ #l10n:t(\'table.error\') }}</p>\n <div data-ref="feedback-error"></div>\n </div>\n </td>\n </tr>\n </tbody>\n <tfoot data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </tfoot>\n </table>\n </ful-table-wrapper>\n <ful-pagination current="0" total="1"></ful-pagination>\n ';static templates={row:"\n {{{{ schema.rowsTemplate.withOverlay({'rows': pageResponse.data}).render() }}}}\n "};#ft;#Yt;#J;#Zt;#es;#nt;#ts;#ss;#rs;#is;#ns;#as={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#os=!1;#ls=new ie;#mt={src:null,method:null};get pageSize(){return this.#as.pageRequest.size}set pageSize(e){const t=e??10;t!==this.#as.pageRequest.size&&(this.#as={...this.#as,pageRequest:{page:0,size:t}},this.#os&&this.reload())}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#It()&&this.#os&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#It()&&this.#os&&this.reload()}async reconfigure(e){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);return this.#It(),await this.reload()}#Tt(){this.#mt={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#ft=this.component(this.declared("loader")??"loaders:table").create(this)}#It(){return(this.getAttribute("src")!==this.#mt.src||this.getAttribute("method")!==this.#mt.method)&&(this.#Tt(),this.#as={...this.#as,pageRequest:{...this.#as.pageRequest,page:0}},!0)}async render({slots:e}){const t=this.template(),s=Ue.parse(e.schema,t),r=t.withOverlay({slots:e,schema:s}).render(),i=h.queryChildren(r,"ful-table-wrapper").querySelector("table");c.forward("table-",this,i),this.#Tt(),this.#Yt=s,this.#J=i.querySelector(":scope > tbody"),this.#Zt=i.querySelector(":scope > tbody[data-ref=loading]"),this.#es=i.querySelector(":scope > tbody[data-ref=initial]"),this.#nt=i.querySelector(":scope > tbody[data-ref=empty]"),this.#ts=this.#nt.querySelector("ful-empty[data-ref=empty-authors]"),this.#ss=e.empty&&!u.isBlank(e.empty)?x.fromFragment(e.empty):null,this.#rs=i.querySelector(":scope > tbody[data-ref=feedback]"),this.#is=h.queryChildren(r,"ful-pagination"),this.replaceChildren(r);const n=this.querySelector("thead");s.headersTemplate.renderTo(n),this.#ns=n.querySelectorAll("ful-sorter"),await A.waitForChildren(this);const a=h.queryChildren(this,"ful-form");this.#as={pageRequest:{page:0,size:this.declared("page-size")??10},sortRequest:s.sort,filterRequest:a?.values??{}},a?.addEventListener("submit:success",async e=>{await this.#us(0,e.detail.request)}),this.addEventListener("page:requested",async e=>{await this.#us(e.detail.value,this.#as.filterRequest)}),this.addEventListener("sort:requested",async e=>{const t=e.detail.value.order?e.detail.value:null;await this.load(this.#as.pageRequest,t,this.#as.filterRequest),this.#as.sortRequest===t&&(this.#ns.forEach(e=>{e.order=null}),e.target.order=e.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){return await this.load(this.#as.pageRequest,this.#as.sortRequest,this.#as.filterRequest)}async load(e,t,s){this.#os=!0;const r=this.#ls.take();let i;this.#Zt.toggleAttribute("hidden",this.#J.childElementCount>0),this.#rs.setAttribute("hidden",""),this.#es.setAttribute("hidden",""),this.#nt.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const n=await this.#ft.load(e,t,s);if(r.stale)return;if(i=Math.max(0,Math.ceil(n.size/e.size)-1),e.page<=i)return this.#as={pageRequest:e,sortRequest:t,filterRequest:s},this.#De(e,t,s,n),this.removeAttribute("aria-busy"),void this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:t,filterRequest:s,response:n}}))}catch(i){if(r.stale)return;throw this.#Zt.setAttribute("hidden",""),this.#J.replaceChildren(),this.#rs.removeAttribute("hidden"),this.#rs.querySelector("[data-ref=feedback-error]").textContent=L.of().failure(i),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:t,filterRequest:s,exception:i}})),i}return await this.load({page:i,size:e.size},t,s)}async withLoader(e){return await e(this.#ft)}async resetWithFilter(e){return await this.#us(0,e)}#us(e,t){return this.load({page:e,size:this.#as.pageRequest.size},this.#as.sortRequest,t)}#De(e,t,s,r){const i=Math.ceil(r.size/e.size);this.#Zt.setAttribute("hidden",""),this.#J.replaceChildren(this.template("row").withOverlay({schema:this.#Yt,pageRequest:e,filterRequest:s,pageResponse:r}).render()),this.#nt.toggleAttribute("hidden",0!==r.data.length),this.#ss&&0===r.data.length&&this.#ts.replaceChildren(this.#ss.withOverlay({schema:this.#Yt,pageRequest:e,filterRequest:s,pageResponse:r}).render()),this.#is.update({current:e.page,total:i})}}const Xe=(e,t,{items:s,current:r=()=>null})=>{let i="",n=0;t.addEventListener("beforetoggle",s=>{"closed"===s.newState&&t.contains(document.activeElement)&&e.focus()}),t.addEventListener("toggle",e=>{if("open"!==e.newState)return;const t=s();(r()??t[0])?.focus()}),t.addEventListener("keydown",t=>{const r=t.target,a=s(),o=a.find(e=>e===r||e.contains(r));if(!o)return;const l=a.indexOf(o);switch(t.code){case"ArrowDown":return t.preventDefault(),void a[(l+1)%a.length]?.focus();case"ArrowUp":return t.preventDefault(),void a[(l-1+a.length)%a.length]?.focus();case"Home":return t.preventDefault(),void a[0]?.focus();case"End":return t.preventDefault(),void a[a.length-1]?.focus();case"Enter":case"NumpadEnter":case"Space":return t.preventDefault(),o.click(),void e.focus();case"Escape":return void e.focus()}if(1!==t.key.length||t.ctrlKey||t.altKey||t.metaKey)return;const u=Date.now();i=u-n>500?t.key:i+t.key,n=u;const c=i.toLowerCase(),d=[...c].every(e=>e===c[0]),h=d?c[0]:c,p=d?l+1:l,f=[...a.slice(p),...a.slice(0,p)].find(e=>(e.textContent??"").trim().toLowerCase().startsWith(h));f&&(t.preventDefault(),f.focus())})};class Ye{static narrow(e,t){const s=(e??[]).filter(e=>t.includes(e));return s.length>0?s:[...t]}#cs;#it;#ds;#hs;#ps;#Bt;#fs;#ms;#gs;#bs=!1;#vs=!1;constructor(e,{vocabulary:t,glyphs:s={},labelFor:r=e=>e,display:i=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#cs=e,this.#it=e.nextElementSibling,this.#ds=t,this.#hs=s,this.#ps=r,this.#Bt=i??(e=>s[e]??e),this.#fs=n,this.#ms=a,this.#gs=[...t],this.#it.addEventListener("click",e=>{const t=e.target.closest("li > a");if(!t||!this.#fs())return;const s=t.getAttribute("value"),r=this.value;this.value=s,this.#it.hidePopover?.(),r!==s&&this.#ms(s)})}get allowed(){return this.#gs}set allowed(e){this.#gs=Ye.narrow(e,this.#ds),this.#ys(),!this.#vs&&this.#gs.length>1&&(this.#pe(),this.#vs=!0),this.#ws(),this.pinned&&(this.value=this.#gs[0])}preferring(e){return null!==e&&this.#gs.includes(e)?e:this.#gs[0]}get pinned(){return this.#gs.length<2}set fixed(e){this.#cs.toggleAttribute("hidden",!!e)}get value(){return this.#cs.getAttribute("value")}set value(e){this.#cs.setAttribute("value",e),this.#cs.textContent=this.#Bt(e),c.set(this.#cs,"aria-label",this.#ps(e)),this.#Es()}#Es(){const e=this.value;for(const t of this.#Ne())t.setAttribute("aria-checked",String(t.getAttribute("value")===e))}set claimed(e){this.#bs=e,this.#ws()}#ys(){this.#it.replaceChildren(...this.#gs.map(e=>{const t=document.createElement("li");t.setAttribute("role","none");const s=document.createElement("a");s.setAttribute("role","menuitemradio"),s.setAttribute("tabindex","-1"),s.setAttribute("value",e);const r=this.#ps(e),i=this.#hs[e]??e;if(r===e&&i===e)s.innerText=e;else{const e=document.createElement("span");e.innerText=i;const t=document.createElement("span");t.innerText=r,s.append(e,t)}return t.append(s),t})),this.#Es()}#ws(){const e=this.pinned;this.#cs.toggleAttribute("disabled",e||this.#bs),c.set(this.#cs,"aria-haspopup",e?null:"true"),c.set(this.#cs,"aria-expanded",e?null:"false"),e?this.#cs.removeAttribute("popovertarget"):this.#it.id&&this.#cs.setAttribute("popovertarget",this.#it.id)}#Ne(){return Array.from(this.#it.querySelectorAll("li > a"),e=>e)}#pe(){Ne.wire(this.#cs,this.#it,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),Xe(this.#cs,this.#it,{items:()=>this.#Ne(),current:()=>this.#Ne().find(e=>e.getAttribute("value")===this.value)})}}const Ze={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},et=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],tt=[...et,"CONTAINS","STARTS_WITH","ENDS_WITH"],st=["IGNORE_CASE","CASE_SENSITIVE"],rt={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:it}=L.of(),nt=e=>it(`filters.op.${e}`),at=e=>it(`filters.sensitivity.${e}`),ot=e=>it(""===e?"filters.boolean.any":`filters.boolean.${e}`),lt=e=>e.querySelector(":scope > label")?.textContent.trim()||null,ut=(e,t,{singular:s,plural:r,vocabulary:i,fallback:n})=>{const a=e.declared(s);if(null===a)return;e.hasAttribute(r)&&console.warn(`${e.localName}: ${s} fixes what ${r} offers a menu for, the plural is ignored`,e);const o=i.includes(a);o||console.warn(`${e.localName}: '${a}' is not one of its ${r}, the default is pinned instead`,e),t.allowed=[o?a:n],t.fixed=!0},ct=(e,t,s)=>{const r=s.filter(e=>null!=e&&""!=`${e}`);return 0===r.length?null:{label:e,operator:t,operands:r.map(e=>`${e}`)}};class dt extends ve{static observed=["value:json","operators:csv"];static attributes=["operator"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_container;_value1;_value2;_build(e){const t=super._build(e),s=t.fragment;return this._container=s.querySelector("ful-control-group"),this._value1=s.querySelector("[data-ref=value1]"),this._value2=s.querySelector("[data-ref=value2]"),this._operator=new Ye(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:Ze,labelFor:nt,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),ut(this,this._operator,{singular:"operator",plural:"operators",vocabulary:this._vocabulary(),fallback:this._defaultOperator()}),{...t,freeze:this._container,also:[this._value2]}}_showDefaultOperator(){this._showOperator(this._operator.preferring(this._defaultOperator()))}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||this._showDefaultOperator()}_type(){return"text"}_serialize(e){return e}_deserialize(e){return e}_defaultOperator(){return"EQ"}_vocabulary(){return et}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){null===this.declared("operator")&&(this._operator?(this._operator.allowed=e,this._syncBetween()):this._declaredOperators=Ye.narrow(e,this._vocabulary()))}get value(){return this._tuple()}set value(e){this._applyTuple(e)}_tuple(){const e=this._operator.value,t=this.#xs();return t.some(e=>""===e)?null:[e,...t.map(e=>this._serialize(e))]}_applyTuple(e){if(null==e)return this._value1.value="",void(this._value2.value="");const[t,...s]=e,r=this._operator.pinned?this._operator.allowed[0]:t;this._showOperator(r),this._value1.value=s[0]?this._deserialize(s[0]):s[0]??"",this._value2.value=s[1]?this._deserialize(s[1]):s[1]??""}_showOperator(e){this._operator.value=e,this._syncBetween()}_syncBetween(){this._value2.toggleAttribute("hidden","BETWEEN"!==this._operator.value)}get criterion(){return ct(lt(this),this._operator.value,this.#xs())}#xs(){return"BETWEEN"===this._operator.value?[this._value1.value,this._value2.value]:[this._value1.value]}get disabled(){return super.disabled}set disabled(e){super.disabled=e;for(const t of this._choices())t.claimed=e}_choices(){return[this._operator].filter(e=>e)}}class ht extends dt{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(e){return Ee.localToIso(e)}_deserialize(e){return Ee.isoToLocal(e)}}class pt extends dt{_type(){return"date"}}class ft extends dt{_type(){return"number"}}class mt extends dt{static observed=["sensitivities:csv"];static attributes=["sensitivity"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n <button data-ref="sensitivity" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_defaultOperator(){return"CONTAINS"}_vocabulary(){return tt}_sensitivityButton;_build(e){const t=super._build(e);return this._sensitivityButton=new Ye(t.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:st,glyphs:rt,labelFor:at,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=st[0],ut(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:st,fallback:"IGNORE_CASE"}),t}_choices(){return[...super._choices(),this._sensitivityButton].filter(e=>e)}get _sensitivity(){return this._sensitivityButton.value}_declaredSensitivities;get sensitivities(){return this._sensitivityButton?this._sensitivityButton.allowed:this._declaredSensitivities}set sensitivities(e){if(null!==this.declared("sensitivity"))return;if(!this._sensitivityButton)return void(this._declaredSensitivities=Ye.narrow(e,st));const t=this._sensitivityButton.value;this._sensitivityButton.allowed=e,this._sensitivityButton.value=this._sensitivityButton.preferring(t)}get value(){const e=this._tuple();return null==e?null:[e[0],this._sensitivity,...e.slice(1)]}set value(e){null!=e?(this._sensitivityButton.allowed.includes(e[1])&&(this._sensitivityButton.value=e[1]),this._applyTuple([e[0],...e.slice(2)])):this._applyTuple(e)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const gt=["","true","false"],bt={true:"✓",false:"✗"};class vt extends le{static observed=["value:json","operators:csv"];static slots=!0;static OPERATORS=["EQ","NEQ"];static DEFAULT_OPERATOR="EQ";static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <button data-ref="value" type="button" form=""></button>\n <ul popover role="menu"></ul>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_value;_container;_build({slots:e}){const t=this.template().withOverlay({slots:e}).render();this._container=t.querySelector("ful-control-group");const s=t.querySelector("[data-ref=value]");return this._operator=new Ye(t.querySelector("[data-ref=operator]"),{vocabulary:vt.OPERATORS,glyphs:Ze,labelFor:nt,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new Ye(s,{vocabulary:gt,glyphs:bt,labelFor:ot,display:ot,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(vt.DEFAULT_OPERATOR),this._value.allowed=null,this._value.value="",{fragment:t,control:s,error:t.querySelector("ful-field-error"),label:t.querySelector("label"),announces:null,freeze:this._container}}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){this._operator?this._operator.allowed=e:this._declaredOperators=Ye.narrow(e,this._vocabulary())}_vocabulary(){return vt.OPERATORS}get value(){return""===this._value.value?null:[this._operator.value,this._value.value]}set value(e){null!=e?(this._operator.value=this._operator.pinned?this._operator.allowed[0]:e[0],this._value.value=e[1]??""):this._value.value=""}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(vt.DEFAULT_OPERATOR))}get criterion(){const e=this._value.value;return ct(lt(this),this._operator.value,[""===e?"":ot(e)])}get disabled(){return super.disabled}set disabled(e){super.disabled=e;for(const t of[this._operator,this._value].filter(e=>e))t.claimed=e}}class yt extends Be{static attributes=["operator"];#As(){const e=super.value;return this.multiple?e:null==e?[]:[e]}get value(){const e=this.#As();if(0===e.length)return null;const t=this.declared("operator");return t?[t,...e]:e}set value(e){const t=this.declared("operator");let s=null==e?[]:Array.isArray(e)?e:[e];t&&s[0]===t&&(s=s.slice(1)),super.value=this.multiple?s:s[0]??null}get criterion(){return ct(lt(this),this.declared("operator"),[super.entry].flat().filter(e=>e).map(e=>e.label))}}class wt extends S{static slots=!0;static attributes=["placement","icon","describes:presence"];static config={icon:"info-circle-fill"};static template='\n <span role="button" tabindex="0" class="ful-tip" data-ref="trigger" data-tpl-aria-label="#l10n:t(\'info.tooltip\')"><ful-icon data-tpl-name="icon ?? config.icon" aria-hidden="true"></ful-icon></span>\n <ful-note popover data-ref="content">{{{{ slots.default }}}}</ful-note>\n ';render({slots:e}){const t=this.template().withOverlay({slots:e,icon:this.declared("icon")}).render(),s=t.querySelector("[data-ref=trigger]"),r=t.querySelector("[data-ref=content]");Ne.wire(s,r,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),r.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(t),this.declared("describes")&&wt.#fe(this,s,r)}static#fe(e,t,s){ne(e)?.describedBy(s)?t.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",e)}}class Et{#Ss=new WeakSet;#ue=new WeakMap;async request(e,t,s,r){const i=!this.#Ss.has(t),n={name:s,section:t,index:r,first:i},a=["section:requested",...null!=r?[`section:requested:#${r}`]:[],...s?[`section:requested:${s}`]:[]],o=[];for(const t of a){const s=new CustomEvent(t,{bubbles:!0,detail:n});e.dispatchEvent(s),o.push(...s.async?.promises??[])}if(0===o.length)return;this.#Ss.add(t);let l=this.#ue.get(t);l||(l=new ie,this.#ue.set(t,l));const u=l.take(),c=()=>!u.stale;t.querySelector(":scope > .ful-section-error")?.remove();const d=requestAnimationFrame(()=>{c()&&(t.toggleAttribute("loading",!0),t.setAttribute("aria-busy","true"))});try{return await Promise.all(o)}catch(e){throw c()&&this.#Ts(t,e),e}finally{cancelAnimationFrame(d),c()&&(t.toggleAttribute("loading",!1),t.removeAttribute("aria-busy"))}}#Ts(e,t){e.querySelector(":scope > .ful-section-error")?.remove();const s=document.createElement("div");s.className="ful-section-error",s.setAttribute("role","alert"),s.textContent=L.of().failure(t),e.prepend(s)}}class xt{#Cs;#_s;#Os;#Zt;#qs;#ks=new Et;#Rs=new ie;constructor(e,t,s){this.#Cs=e,this.#_s=t.querySelector("[data-ref=dialog]"),this.#Os=t.querySelector(`[data-ref=${s}]`),this.#Zt=t.querySelector("[data-ref=loading]"),this.#qs=t.querySelector("[data-ref=error]")}get dialog(){return this.#_s}get section(){return this.#Os}dismiss(e,t){this.#Cs.dispatchEvent(e)&&e.cancelable&&t()}onBackdrop(e){let t=!1;this.#_s.addEventListener("mousedown",e=>{t=e.target===this.#_s}),this.#_s.addEventListener("click",s=>{t&&s.target===this.#_s&&e()})}onSubmitted(e){this.#Os.addEventListener("submit:success",t=>{t.target===h.queryChildren(this.#Os,"ful-form")&&e(t.detail.response)})}restChrome(){this.#qs?.replaceChildren(),this.#qs?.setAttribute("hidden",""),this.#Zt?.setAttribute("hidden",""),this.#Os?.removeAttribute("hidden")}request(){return this.#ks.request(this.#Cs,this.#Os,null,null).catch(()=>{})}async update(e,t){const s=this.#Rs.take();this.#Os.replaceChildren(),this.restChrome(),this.#Zt?.removeAttribute("hidden"),this.#Os.setAttribute("hidden",""),t();try{const t=await e();return s.stale||(this.#Os.replaceChildren(t),this.#Zt?.setAttribute("hidden",""),this.#Os.removeAttribute("hidden")),this.#Os}catch(e){throw s.stale||(this.#qs?.removeAttribute("hidden"),this.#qs&&(this.#qs.textContent=L.of().failure(e)),this.#Zt?.setAttribute("hidden",""),this.#Os.setAttribute("hidden","")),e}}}let At=!1;const St=()=>{At||(At=!0,document.addEventListener("click",e=>{const t=e.target.closest?.("[dialog-target]");t&&document.getElementById(t.getAttribute("dialog-target"))?.open?.()}))};class Tt extends S{static attributes=["header","requires-answer:presence","close-on-submit:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header || slots.header || !requiresAnswer" class="ful-dialog-header">\n {{{{ slots.header }}}}\n <h2 data-tpl-if="header">{{ header }}</h2>\n <button data-tpl-if="!requiresAnswer" type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'dialog.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <div data-ref="body" class="ful-dialog-body">{{{{ slots.default }}}}</div>\n <footer class="ful-dialog-footer">\n <button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons && !closeOnSubmit" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>\n {{{{ slots.buttons }}}}\n </footer>\n </dialog>\n ';#_s;#Ls;#Ns=[];#Ps=null;render({slots:e}){const t=this.declared("requires-answer"),s=this.declared("close-on-submit"),r=this.template().withOverlay({slots:e,header:this.declared("header")??"",requiresAnswer:t,closeOnSubmit:s}).render();this.#Ls=new xt(this,r,"body"),this.#_s=this.#Ls.dialog;const i=r.querySelector("h2");i&&(i.id||=c.uid("ful-dialog-title"),this.#_s.setAttribute("aria-labelledby",i.id)),this.#_s.addEventListener("close",()=>{const e=this.#Ms();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#Fs(e)}),this.#_s.addEventListener("click",e=>{const t=e.target.closest("button[data-result]")?.dataset.result;void 0!==t&&this.#_s.close(t)});const n=(e,t=!1)=>this.#Ls.dismiss(new CustomEvent("dialog:dismiss",{cancelable:!t,detail:{reason:e}}),()=>this.#_s.close(""));t||this.#Ls.onBackdrop(()=>n("backdrop")),r.querySelector("[data-ref=close]")?.addEventListener("click",()=>n("button")),s&&this.#Ls.onSubmitted(e=>{this.#Ps={dismissed:!1,result:null,response:e},this.#_s.close("submitted")}),this.#_s.addEventListener("cancel",e=>{if(!e.cancelable)return this.#_s.returnValue="",void n("escape",!0);e.preventDefault(),t||n("escape")}),this.replaceChildren(r),St()}#Ms(){if(this.#Ps)return this.#Ps;const e=this.#_s?.returnValue??"";return""===e?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:e,response:null}}#Fs(e){const t=this.#Ns;this.#Ns=[];for(const s of t)s(e)}disconnectedCallback(){this.#Fs(this.#Ms())}open(){return this.ask()}ask(){return this.#zs()&&(this.#Ls.restChrome(),this.#Ls.request()),new Promise(e=>{this.#Ns.push(e)})}async update(e){return await this.#Ls.update(e,()=>this.#zs())}refresh(){return this.#Ls.request()}close(e){this.#_s.close(e??"")}#zs(){return!this.#_s.open&&(this.#_s.returnValue="",this.#Ps=null,this.#_s.showModal(),!0)}static async ask(e,t,s=[],{className:r}={}){const i=document.createElement("ful-dialog");if(i.setAttribute("header",e),r&&(i.className=r),"string"==typeof t?i.textContent=t:t&&i.append(t),s.length>0){const e=document.createElement("template");e.setAttribute("slot","buttons");for(const t of s){if(t instanceof Node){e.content.append(t);continue}const[s,r,i]=t,n=document.createElement("button");n.type="button",n.dataset.result=s,i&&(n.className=i),n.textContent=r,e.content.append(n)}i.append(e)}document.body.append(i);try{return await A.waitFor(i),await i.ask()}finally{i.remove()}}static async confirm(e,t,s={},r={}){const i=await Tt.ask(e,t,[["cancel",s.cancel??L.of().t("dialog.cancel")],["confirm",s.confirm??L.of().t("dialog.confirm"),"ful-button"]],r);return!i.dismissed&&"confirm"===i.result}}class Ct extends S{static attributes=["header","placement","close-on-submit:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-drawer">\n <header>\n {{{{ slots.header }}}}\n <h2 data-ref="title">{{ title }}</h2>\n <button type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'drawer.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <section data-ref="content">{{{{ slots.default }}}}</section>\n </dialog>\n ';#_s;#Ds;#Ls;#Ps=null;#Is=!1;#$s=e=>{e.target===this.#_s&&this.#Bs()};render({slots:e}){const t=this.template().withOverlay({slots:e,title:this.declared("header")??""}).render();this.#Ls=new xt(this,t,"content"),this.#_s=this.#Ls.dialog,this.#Ds=t.querySelector("[data-ref=title]"),this.#Ds.id||=c.uid("ful-drawer-title"),this.#_s.setAttribute("aria-labelledby",this.#Ds.id);const s=this.declared("placement");s&&this.#_s.setAttribute("placement",s);const r=(e,t=!1)=>this.#Ls.dismiss(new CustomEvent("drawer:dismiss",{cancelable:!t,detail:{reason:e}}),()=>this.close());t.querySelector("[data-ref=close]").addEventListener("click",()=>r("button")),this.#Ls.onBackdrop(()=>r("backdrop")),this.#_s.addEventListener("cancel",e=>{if(!e.cancelable)return this.#js(),void r("escape",!0);e.preventDefault(),r("escape")}),this.#_s.addEventListener("close",()=>{this.dispatchEvent(new CustomEvent("close",{detail:this.#Ps??{dismissed:!0,response:null}}))}),this.declared("close-on-submit")&&this.#Ls.onSubmitted(e=>{this.#Ps={dismissed:!1,response:e},this.close()}),this.replaceChildren(t),St()}get header(){return this.#Ds.textContent}set header(e){this.#Ds.textContent=e??""}async update(e,t){return this.header=e,await this.#Ls.update(t,()=>this.#zs())}refresh(){return this.#Ls.request()}open(){this.#zs()&&(this.#Ls.restChrome(),this.#Ls.request())}close(){!this.#Is&&this.#_s.open&&(matchMedia("(prefers-reduced-motion: reduce)").matches?this.#_s.close():(this.#_s.setAttribute("closing",""),0!==this.#_s.getAnimations().length?(this.#Is=!0,this.#_s.addEventListener("animationend",this.#$s)):this.#Bs()))}#Bs(){this.#js(),this.#_s.close()}#js(){this.#Is=!1,this.#_s.removeEventListener("animationend",this.#$s),this.#_s.removeAttribute("closing")}#zs(){return this.#js(),!this.#_s.open&&(this.#Ps=null,this.#_s.showModal(),!0)}}class _t extends S{static attributes=["for"];render(){const e=this.declared("for"),t=e?document.getElementById(e):null;if(!t)throw new Error(`ful-menu names no invoker: for="${e??""}" must name an element already in the page when the menu upgrades`);this.setAttribute("role","menu"),this.hasAttribute("popover")||this.setAttribute("popover",""),t.setAttribute("aria-haspopup","menu"),Ne.wire(t,this,{prefix:"ful-menu",invoke:!0,expanded:!0}),Xe(t,this,{items:()=>this.items}),this.#Es(),this.addEventListener("click",e=>{const t=e.target;this.items.some(e=>e===t||e.contains(t))&&this.hidePopover()})}get items(){return this.#Es().filter(e=>!e.hasAttribute("disabled")&&!e.hasAttribute("hidden"))}#Es(){const e=[...this.querySelectorAll(":scope > button, :scope > a[href]")];for(const t of e)t.hasAttribute("role")||t.setAttribute("role","menuitem"),t.tabIndex=-1;return e}}const Ot=["info","success","warning","error"],qt=new Set;let kt=!1;class Rt extends S{static attributes=["timeout:number"];#Hs;connectedCallback(){super.connectedCallback(),this.rendered&&qt.add(this)}disconnectedCallback(){qt.delete(this)}render(){this.#Hs=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",L.of().t("toast.region")),this.setAttribute("popover","manual"),kt||(kt=!0,document.addEventListener("show-toast",e=>{if(e.detail)for(const t of qt)t.show(e.detail.message,e.detail)})),qt.add(this)}show(e,t={}){const s=Ot.includes(t.severity)?t.severity:"info",r=document.createElement("ful-toast");r.classList.add(s),r.setAttribute("role","error"===s?"alert":"status");const i=document.createElement("div");i.textContent=L.of().failure(e);const n=document.createElement("button");n.type="button",n.setAttribute("aria-label",L.of().t("toast.dismiss"));const a=document.createElement("ful-icon");a.setAttribute("name","x-lg"),a.setAttribute("aria-hidden","true"),n.append(a),r.append(i);let o=t.timeout??this.#Hs,l=performance.now(),u=0;const c=()=>{clearTimeout(u),r.contains(document.activeElement)&&this.focus(),matchMedia("(prefers-reduced-motion: reduce)").matches?r.remove():(r.classList.add("ful-toast-out"),0===r.getAnimations().length&&r.remove())};if(t.action?.label){const e=document.createElement("button");e.type="button",e.className="ful-toast-action",e.textContent=String(t.action.label),e.addEventListener("click",()=>{t.action.onClick?.(),c()}),r.append(e)}r.append(n),r.addEventListener("animationend",()=>{r.classList.contains("ful-toast-out")&&r.remove()});let d=0;const h=()=>{0===d&&(clearTimeout(u),o=Math.max(0,o-(performance.now()-l))),++d},p=()=>{0!==d&&0===--d&&(l=performance.now(),u=setTimeout(c,o))};return r.addEventListener("mouseenter",h),r.addEventListener("mouseleave",p),r.addEventListener("focusin",h),r.addEventListener("focusout",p),n.addEventListener("click",c),this.append(r),this.#Ws(),u=setTimeout(c,o),r}#Ws(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class Lt extends S{static slots=!0;static observed=["active:number"];static template='\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n {{{{ slots.default }}}}\n ';#Vs;#Us=[];#Gs=[];#ks=new Et;#Qs=0;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#Vs=t.querySelector("ful-tablist");const s=[...this.#Vs.children];this.#Gs=[...t.children].filter(e=>e!==this.#Vs),s.length!==this.#Gs.length&&console.warn(`ful-tabs: ${s.length} tabs declared for ${this.#Gs.length} panels, the surplus is left alone`);const r=Math.min(s.length,this.#Gs.length);this.#Us=[];for(let e=0;e!==r;++e){const t=this.#Gs[e],r=document.createElement("button");r.type="button",r.role="tab",r.id=c.uid("ful-tab"),t.id||(t.id=c.uid("ful-tabpanel")),r.setAttribute("aria-controls",t.id),t.role="tabpanel",t.setAttribute("aria-labelledby",r.id),t.tabIndex=0,r.append(...s[e].childNodes),r.addEventListener("click",()=>{this.active=e}),s[e].replaceWith(r),this.#Us.push(r)}this.#Vs.addEventListener("keydown",e=>{const t=this.#Qs;let s=null;"ArrowRight"===e.key?s=(t+1)%this.#Us.length:"ArrowLeft"===e.key?s=(t-1+this.#Us.length)%this.#Us.length:"Home"===e.key?s=0:"End"===e.key&&(s=this.#Us.length-1),null!==s&&s!==t&&(e.preventDefault(),this.active=s,this.#Us[s].focus())}),this.replaceChildren(t)}get active(){return this.#Qs}refresh(e){const t=e instanceof Element?this.#Gs.indexOf(e):Number.isInteger(e)?e:NaN,s=this.#Gs[t];if(s)return this.#ks.request(this,s,null,t).catch(()=>{});console.warn(`ful-tabs: no panel answers to "${e}"`)}set active(e){const t=Math.min(Math.max(0,Number(e)||0),Math.max(0,this.#Us.length-1)),s=this.#Qs;for(const[e,s]of this.#Us.entries())s.setAttribute("aria-selected",e===t?"true":"false"),s.tabIndex=e===t?0:-1,this.#Gs[e].hidden=e!==t;this.#Qs=t,this.reflectTo("active",t),this.rendered&&t!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:t,previous:s}})),this.#Gs.length>0&&(t!==s||!this.rendered)&&this.#ks.request(this,this.#Gs[t],null,t).catch(()=>{})}}class Nt extends S{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#Fe;#Ks=!1;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#Fe=t.querySelector("ful-accordion-group"),this.replaceChildren(t)}get exclusive(){return this.#Ks}set exclusive(e){this.#Ks=!0===e,this.reflectTo("exclusive",this.#Ks);const t=this.#Ks?c.uid("ful-accordion"):null;for(const e of this.#Fe.querySelectorAll(":scope > details"))null===t?e.removeAttribute("name"):e.setAttribute("name",t)}}class Pt extends S{static slots=!0;static observed=["progress"];static template="\n <ful-steps><ol data-tpl-aria-label=\"#l10n:t('wizard.progress')\">{{{{ slots.steps }}}}</ol></ful-steps>\n {{{{ slots.default }}}}\n ";#Js=[];#Ls=[];#ks=new Et;#Xs=0;#Ys;render({slots:e}){const t=this.template().withOverlay({slots:e}).render(),s=[...t.querySelector("ful-steps ol").children];this.#Ls=[...t.children].filter(e=>"ful-steps"!==e.localName),s.length!==this.#Ls.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#Ls.length} sections, the surplus is left alone`);const r=Math.min(s.length,this.#Ls.length);this.#Js=[];for(let e=0;e!==r;++e){const t=document.createElement("li");t.append(...s[e].childNodes),s[e].replaceWith(t),this.#Js.push(t),this.#Ls[e].tabIndex=-1}if(this.replaceChildren(t),r>0){const e=this.#Ls.findIndex(e=>"step"===e.getAttribute("aria-current"));this.#Zs(-1===e?0:Math.min(e,r-1)),this.#er(this.#Xs).catch(()=>{})}}get index(){return this.#Xs}get step(){return this.#Ls[this.#Xs]?.getAttribute("data-step")??null}get progress(){return this.#Ys}set progress(e){this.#Ys=e,this.reflectTo("progress",e)}next(){return this.#tr(this.#Xs+1)}prev(){return this.#tr(this.#Xs-1)}move(e){const t=this.#Ls.findIndex(t=>t.getAttribute("data-step")===e);if(-1!==t)return this.#tr(t);console.warn(`ful-wizard: no section carries data-step="${e}"`)}refresh(e){const t=e instanceof Element?e:"string"==typeof e?this.#Ls.find(t=>t.getAttribute("data-step")===e):void 0,s=this.#Ls.indexOf(t);if(-1!==s)return this.#er(s).catch(()=>{});console.warn(`ful-wizard: no section answers to "${e}"`)}#er(e){return this.#ks.request(this,this.#Ls[e],this.#Ls[e].getAttribute("data-step"),e)}#tr(e){const t=Math.min(Math.max(0,e),Math.max(0,this.#Js.length-1));if(t!==this.#Xs)return this.#Zs(t),this.#Ls[this.#Xs].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#Xs,step:this.step}})),this.#er(t)}#Zs(e){for(const[t,s]of this.#Js.entries())t===e?(s.setAttribute("aria-current","step"),this.#Ls[t].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#Ls[t].removeAttribute("aria-current"));this.#Xs=e}}const Mt={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","failure.no-reason":"Something went wrong","dialog.acknowledge":"Got it","dialog.close":"Close","dialog.confirm":"Confirm","dialog.cancel":"Cancel","drawer.close":"Close","spinner.loading":"Loading…","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","drawer.close":"Chiudi","spinner.loading":"Caricamento…","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{one:"Se ha superado el número máximo de {count} archivo",other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","failure.no-reason":"Se ha producido un error","dialog.acknowledge":"Entendido","dialog.close":"Cerrar","dialog.confirm":"Confirmar","dialog.cancel":"Cancelar","drawer.close":"Cerrar","spinner.loading":"Cargando…","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","drawer.close":"Fermer","spinner.loading":"Chargement…","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class Ft{#sr;#rr;#ir;constructor(e={}){this.#sr=e.language??navigator?.language??"en",this.#rr=e.translations??{},this.#ir=e.httpClient??null}configure(e){const t=this.#ir??V.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#sr.split("-")[0].toLowerCase(),r={...Mt.en,...Mt[s],...this.#rr};e.defineModule("l10n",L).defineComponent("http-client",t).defineElement("ful-tooltip",wt).defineElement("ful-dialog",Tt).defineElement("ful-drawer",Ct).defineElement("ful-menu",_t).defineElement("ful-toasts",Rt).defineElement("ful-tabs",Lt).defineElement("ful-accordion",Nt).defineElement("ful-wizard",Pt).defineElement("ful-form",he).defineElement("ful-checkbox",He).defineElement("ful-input",ve).defineElement("ful-input-file",Te).defineElement("ful-local-date",we).defineElement("ful-instant",Ee).defineElement("ful-input-local-date",xe).defineElement("ful-input-local-time",Ae).defineElement("ful-input-instant",Se).defineElement("ful-radio-group",je).defineElement("ful-table",Je).defineElement("ful-pagination",Ve).defineElement("ful-sorter",We).defineElement("ful-filter-instant",ht).defineElement("ful-filter-local-date",pt).defineElement("ful-filter-number",ft).defineElement("ful-filter-boolean",vt).defineElement("ful-filter-text",mt).defineElement("ful-filter-in",yt).defineElement("ful-select",Be).defineElement("ful-dropdown",$e).defineComponent("loaders:select",Ie).defineComponent("loaders:form",de).defineComponent("loaders:table",Ke).defineOverlay({l10n:r,locale:this.#sr})}}var zt=Object.freeze({__proto__:null,Accordion:Nt,Anchors:Ne,AsyncEvents:re,Bindings:oe,BooleanFilter:vt,Checkbox:He,Claims:ie,CompareFilter:dt,Dialog:Tt,Drawer:Ct,Dropdown:$e,Field:le,Form:he,FormLoader:de,InFilter:yt,Input:ve,InputFile:Te,InputInstant:Se,InputLocalDate:xe,InputLocalTime:Ae,Instant:Ee,InstantFilter:ht,LocalDate:we,LocalDateFilter:pt,LocalStorage:Z,Menu:_t,NumberFilter:ft,Pagination:Ve,Plugin:Ft,RadioGroup:je,Select:Be,SelectLoader:Ie,SessionStorage:ee,SortButton:We,Table:Je,TableLoader:Ke,TableSchemaParser:Ue,Tabs:Lt,TextFilter:mt,Timing:ae,Toasts:Rt,Tooltip:wt,VersionedLocalStorage:te,VersionedSessionStorage:se,Wizard:Pt,describable:ne});return"undefined"!=typeof window&&(window.ftl=N,window.httpc=J,window.ful=zt),e.Accordion=Nt,e.Anchors=Ne,e.AsyncEvents=re,e.Attributes=c,e.Base64=M,e.Bindings=oe,e.BooleanFilter=vt,e.BoundedCache=t,e.Checkbox=He,e.Claims=ie,e.CompareFilter=dt,e.Dialog=Tt,e.Drawer=Ct,e.Dropdown=$e,e.ExpressionEvaluator=l,e.Expressions=o,e.Failure=P,e.Field=le,e.Form=he,e.FormLoader=de,e.Fragments=u,e.Hex=F,e.HttpClient=V,e.HttpClientBuilder=j,e.HttpClientError=D,e.HttpInterceptorChain=W,e.HttpMultipartRequestCustomizer=K,e.HttpRequestBuilder=Q,e.InFilter=yt,e.Input=ve,e.InputFile=Te,e.InputInstant=Se,e.InputLocalDate=xe,e.InputLocalTime=Ae,e.Instant=Ee,e.InstantFilter=ht,e.LightSlots=d,e.LocalDate=we,e.LocalDateFilter=pt,e.LocalStorage=Z,e.Localization=L,e.MediaType=z,e.Menu=_t,e.Nodes=h,e.NumberFilter=ft,e.Pagination=Ve,e.ParsedElement=S,e.Plugin=Ft,e.RadioGroup=je,e.Registry=w,e.RenderError=v,e.Rendering=A,e.Select=Be,e.SelectLoader=Ie,e.SessionStorage=ee,e.SortButton=We,e.Table=Je,e.TableLoader=Ke,e.TableSchemaParser=Ue,e.Tabs=Lt,e.Template=b,e.Templates=x,e.TextFilter=mt,e.Timing=ae,e.Toasts=Rt,e.Tooltip=wt,e.VersionedLocalStorage=te,e.VersionedSessionStorage=se,e.Wizard=Pt,e.describable=ne,e.registry=E,e}({});
1
+ var fml=function(e){"use strict";class t{#e;#t=new Map;constructor(e){this.#e=e}getOrCompute(e,t){if(this.#t.has(e))return this.#t.get(e);const s=t(e);return this.#t.size>=this.#e&&this.#t.delete(this.#t.keys().next().value),this.#t.set(e,s),s}get size(){return this.#t.size}}const s={ter:Symbol("ternary"),elv:Symbol("elvis"),nullc:Symbol("null-coalescence"),or:Symbol("or"),and:Symbol("and"),eq:Symbol("eq"),cmp:Symbol("cmp"),not:Symbol("not"),access:Symbol("access"),member:Symbol("access-member"),subscript:Symbol("access-subscript"),method:Symbol("access-method-call"),call:Symbol("module-function-call"),tstring:Symbol("tstring"),literal:Symbol("literal"),array:Symbol("array-literal"),dict:Symbol("dict-literal"),function:Symbol("module-function"),symbol:Symbol("symbol"),templated:{ten:Symbol("templated-node"),teh:Symbol("templated-html"),tet:Symbol("templated-text"),tel:Symbol("templated-literal")},dom:{t:Symbol("text"),h:Symbol("html"),n:Symbol("node")}},r=new Map([["true",!0],["false",!1],["null",null],["undefined",void 0]]);class i extends SyntaxError{constructor(e,t,s,r){super(e),this.expected=t,this.found=s,this.location=r,this.name="SyntaxError"}format(e){let t="Error: "+this.message;if(this.location){let s=null;const r=e.find(e=>e.source===this.location.source);r&&(s=r.text.split(/\r\n|\n|\r/g));const i=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(i):i,a=this.location.source+":"+n.line+":"+n.column;if(s){const e=this.location.end,r="".padEnd(n.line.toString().length," "),o=s[i.line-1],l=(i.line===e.line?e.column:o.length+1)-i.column||1;t+="\n --\x3e "+a+"\n"+r+" |\n"+n.line+" | "+o+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(l,"^")}else t+="\n at "+a}return t}static buildMessage(e,t){function s(e){return e.codePointAt(0).toString(16).toUpperCase()}const r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function i(e){return r?e.replace(r,e=>"\\u{"+s(e)+"}"):e}function n(e){return i(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+s(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+s(e)))}function a(e){return i(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+s(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+s(e)))}const o={literal:e=>'"'+n(e.text)+'"',class(e){const t=e.parts.map(e=>Array.isArray(e)?a(e[0])+"-"+a(e[1]):a(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function l(e){return o[e.type](e)}return"Expected "+function(e){const t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let s=1;s<t.length;s++)t[s-1]!==t[s]&&(t[e]=t[s],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+function(e){return e?'"'+n(e)+'"':"end of input"}(t)+" found."}}const n=(e,t)=>{if("self"===t)return e[e.length-1];for(let s=e.length-1;s>=0;s--){const r=e[s];if(null!=r&&("object"==typeof r||"function"==typeof r)&&t in r)return r[t]}};class a{#s;#r;constructor(e,t){this.#s=e,this.#r=t}#i(e){return n(this.#r,e)}#n(e,t){const r=0===t?e.lhs:e.rhs[t-1];return r.type===s.symbol?r.value:r.type===s.member?r.rhs:null}#a;#o(){return this.#a||(this.#a=new Proxy(this.#r,{get:(e,t)=>this.#i(t)})),this.#a}[s.and](e){return this.visit(e.lhs)&&this.visit(e.rhs)}[s.or](e){return this.visit(e.lhs)||this.visit(e.rhs)}[s.nullc](e){return this.visit(e.lhs)??this.visit(e.rhs)}[s.not](e){return!this.visit(e.expr)}[s.eq](e){const t=this.visit(e.lhs)===this.visit(e.rhs);return"=="===e.op?t:!t}[s.cmp](e){const t=this.visit(e.lhs),s=this.visit(e.rhs);switch(e.op){case">":return t>s;case"<":return t<s;case">=":return t>=s;case"<=":return t<=s;default:throw new Error(`unknown cmp op ${e.op}`)}}[s.call](e){const t=e.value,s=null===t.module?this.#s:this.#s?.[t.module];if(!s)throw new Error(`Module "${t.module}" not found`);const r=s[t.value];if(!r)throw new Error(`Function "#${null===t.module?"":`${t.module}:`}${t.value}" not found`);const i=e.args.map(e=>this.visit(e));return r.apply(this.#o(),i)}[s.literal](e){return e.value}[s.tstring](e){let t="";const s=e.parts;for(let e=0,r=s.length;e<r;e++){const r=this.visit(s[e]);null!=r&&(t+=r)}return t}[s.symbol](e){return this.#i(e.value)}[s.dict](e){return Object.fromEntries(e.value.map(e=>[this.visit(e[0]),this.visit(e[1])]))}[s.array](e){return e.value.map(e=>this.visit(e))}[s.ter](e){return this.visit(e.cond)?this.visit(e.ifTrue):this.visit(e.ifFalse)}[s.elv](e){return this.visit(e.cond)||this.visit(e.ifFalse)}[s.access](e){let t,r=this.visit(e.lhs);for(let i=0;i!==e.rhs.length;++i){const n=e.rhs[i];if(n.ns&&null==r)return;let a;switch(n.type){case s.member:a=r[n.rhs];break;case s.subscript:a=r[this.visit(n.rhs)];break;case s.method:{if(!r){const t=this.#n(e,i);throw new Error(null===t?"Method missing":`Method missing "${t}"`)}const s=n.args.map(e=>this.visit(e));a=r.apply(t,s);break}}t=r,r=a}return r}visit(e,...t){return this[e.type](e,...t)}visitRoot(e,t){return t?e.map(e=>{switch(e.type){case s.templated.tel:return{type:s.dom.t,value:e.value};case s.templated.tet:return{type:s.dom.t,value:this.visit(e.value)};case s.templated.teh:return{type:s.dom.h,value:this.visit(e.value)};case s.templated.ten:return{type:s.dom.n,value:this.visit(e.value)};default:throw new Error(`unknown node type ${e.type.toString()}`)}}):this.visit(e)}}class o{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static#l=new t(1e3);static parse(e,t){const n=t?.toString()+e;return this.#l.getOrCompute(n,()=>function(e,t){const n={},a=(t=void 0!==t?t:{}).grammarSource,o={TemplatedRoot:mt,ExpressionRoot:bt};let l=mt;const u="{{{{",c="}}}}",d="{{{",h="}}}",p="{{",f="}}",m="\\",g="{",b="?",v=":",y="?:",w="??",E="||",x="&&",A="!",S="?.",T=".",C="[",_="]",O="(",q=",",k=")",R="-",L="'",N='"',P="`",M="}",F="#",z="==",D="!=",I=">=",$=">",B="<=",j="<",H=/^[^\\{]/,W=/^[0-9]/,V=/^[^']/,U=/^[^"]/,G=/^[^\\`{]/,Q=/^[a-zA-Z$_]/,K=/^[a-zA-Z$_0-9]/,J=/^[ \t\n\r]/,X=ut("{{{{",!1),Y=ut("}}}}",!1),Z=ut("{{{",!1),ee=ut("}}}",!1),te=ut("{{",!1),se=ut("}}",!1),re=ct(["\\","{"],!0,!1,!1),ie=ut("\\",!1),ne={type:"any"},ae=ut("{",!1),oe=ut("?",!1),le=ut(":",!1),ue=ut("?:",!1),ce=ut("??",!1),de=ut("||",!1),he=ut("&&",!1),pe=ut("!",!1),fe=dt("member"),me=ut("?.",!1),ge=ut(".",!1),be=dt("subscript"),ve=ut("[",!1),ye=ut("]",!1),we=dt("method-call"),Ee=ut("(",!1),xe=ut(",",!1),Ae=ut(")",!1),Se=dt("module-function-call"),Te=dt("number-literal"),Ce=ut("-",!1),_e=ct([["0","9"]],!1,!1,!1),Oe=dt("string-literal"),qe=ut("'",!1),ke=ct(["'"],!0,!1,!1),Re=ut('"',!1),Le=ct(['"'],!0,!1,!1),Ne=ut("`",!1),Pe=dt("tstring-expression"),Me=ut("}",!1),Fe=dt("tstring-literal"),ze=ct(["\\","`","{"],!0,!1,!1),De=dt("array-literal"),Ie=dt("dict-literal"),$e=dt("module-function"),Be=ut("#",!1),je=ct([["a","z"],["A","Z"],"$","_"],!1,!1,!1),He=ct([["a","z"],["A","Z"],"$","_",["0","9"]],!1,!1,!1),We=dt("identifier-or-keyword"),Ve=ut("==",!1),Ue=ut("!=",!1),Ge=ut(">=",!1),Qe=ut(">",!1),Ke=ut("<=",!1),Je=ut("<",!1),Xe=ct([" ","\t","\n","\r"],!1,!1,!1);function Ye(e){return e}function Ze(e,t,s){return{op:t,rhs:s}}function et(e,t,s){return{op:t,rhs:s}}function tt(e){return e}let st=0|t.peg$currPos;const rt=[{line:1,column:1}];let it,nt=st,at=t.peg$maxFailExpected||[],ot=0|t.peg$silentFails,lt={};if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');l=o[t.startRule]}function ut(e,t){return{type:"literal",text:e,ignoreCase:t}}function ct(e,t,s,r){return{type:"class",parts:e,inverted:t,ignoreCase:s,unicode:r}}function dt(e){return{type:"other",description:e}}function ht(t){let s,r=rt[t];if(r)return r;if(t>=rt.length)s=rt.length-1;else for(s=t;!rt[--s];);for(r=rt[s],r={line:r.line,column:r.column};s<t;)10===e.charCodeAt(s)?(r.line++,r.column=1):r.column++,s++;return rt[t]=r,r}function pt(e,t,s){const r=ht(e),i=ht(t);return{source:a,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:i.line,column:i.column}}}function ft(e){st<nt||(st>nt&&(nt=st,at=[]),at.push(e))}function mt(){let e,t;const s=38*st+0,r=lt[s];if(r)return st=r.nextPos,r.result;for(e=[],t=gt();t!==n;)e.push(t),t=gt();return lt[s]={nextPos:st,result:e},e}function gt(){let t,r,i,a,o;const l=38*st+1,b=lt[l];return b?(st=b.nextPos,b.result):(t=st,r=st,i=function(){let t;const s=38*st+2,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,4)===u?(t=u,st+=4):(t=n,0===ot&&ft(X)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+3,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,4)===c?(t=c,st+=4):(t=n,0===ot&&ft(Y)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(v=r,r={type:s.templated.ten,value:v}),t=r,t===n&&(t=st,r=st,i=function(){let t;const s=38*st+4,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,3)===d?(t=d,st+=3):(t=n,0===ot&&ft(Z)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+5,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,3)===h?(t=h,st+=3):(t=n,0===ot&&ft(ee)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(r=function(e){return{type:s.templated.teh,value:e}}(r)),t=r,t===n&&(t=st,r=st,i=function(){let t;const s=38*st+6,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===p?(t=p,st+=2):(t=n,0===ot&&ft(te)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+7,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===f?(t=f,st+=2):(t=n,0===ot&&ft(se)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(r=function(e){return{type:s.templated.tet,value:e}}(r)),t=r,t===n&&(t=st,r=function(){let t,s,r,i,a,o,l;const u=38*st+8,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,s=[],r=st,i=[],a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re));else i=n;if(r=i!==n?e.substring(r,st):i,r===n&&(r=st,92===e.charCodeAt(st)?(i=m,st++):(i=n,0===ot&&ft(ie)),i!==n?(e.length>st?(a=e.charAt(st),st++):(a=n,0===ot&&ft(ne)),a!==n?r=a:(st=r,r=n)):(st=r,r=n),r===n&&(r=st,i=st,123===e.charCodeAt(st)?(a=g,st++):(a=n,0===ot&&ft(ae)),a!==n?(o=st,ot++,123===e.charCodeAt(st)?(l=g,st++):(l=n,0===ot&&ft(ae)),ot--,l===n?o=void 0:(st=o,o=n),o!==n?(a=[a,o],i=a):(st=i,i=n)):(st=i,i=n),r=i!==n?e.substring(r,st):i)),r!==n)for(;r!==n;){if(s.push(r),r=st,i=[],a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re));else i=n;r=i!==n?e.substring(r,st):i,r===n&&(r=st,92===e.charCodeAt(st)?(i=m,st++):(i=n,0===ot&&ft(ie)),i!==n?(e.length>st?(a=e.charAt(st),st++):(a=n,0===ot&&ft(ne)),a!==n?r=Ye(a):(st=r,r=n)):(st=r,r=n),r===n&&(r=st,i=st,123===e.charCodeAt(st)?(a=g,st++):(a=n,0===ot&&ft(ae)),a!==n?(o=st,ot++,123===e.charCodeAt(st)?(l=g,st++):(l=n,0===ot&&ft(ae)),ot--,l===n?o=void 0:(st=o,o=n),o!==n?(a=[a,o],i=a):(st=i,i=n)):(st=i,i=n),r=i!==n?e.substring(r,st):i))}else s=n;return s!==n&&(s=s.join("")),t=s,lt[u]={nextPos:st,result:t},t}(),r!==n&&(r=function(e){return{type:s.templated.tel,value:e}}(r)),t=r))),lt[l]={nextPos:st,result:t},t);var v}function bt(){let e,t;const s=38*st+9,r=lt[s];return r?(st=r.nextPos,r.result):(e=st,Pt(),t=vt(),t!==n?(Pt(),e=t):(st=e,e=n),lt[s]={nextPos:st,result:e},e)}function vt(){let t,r,i,a,o,l;const u=38*st+10,c=lt[u];return c?(st=c.nextPos,c.result):(t=st,r=yt(),r!==n?(Pt(),63===e.charCodeAt(st)?(i=b,st++):(i=n,0===ot&&ft(oe)),i!==n?(Pt(),a=vt(),a!==n?(Pt(),58===e.charCodeAt(st)?(o=v,st++):(o=n,0===ot&&ft(le)),o!==n?(Pt(),l=vt(),l!==n?t={type:s.ter,cond:r,ifTrue:a,ifFalse:l}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=yt()),lt[u]={nextPos:st,result:t},t)}function yt(){let t,r,i,a;const o=38*st+11,l=lt[o];return l?(st=l.nextPos,l.result):(t=st,r=wt(),r!==n?(Pt(),e.substr(st,2)===y?(i=y,st+=2):(i=n,0===ot&&ft(ue)),i!==n?(Pt(),a=yt(),a!==n?t={type:s.elv,cond:r,ifFalse:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=wt()),lt[o]={nextPos:st,result:t},t)}function wt(){let t,r,i,a;const o=38*st+12,l=lt[o];return l?(st=l.nextPos,l.result):(t=st,r=Et(),r!==n?(Pt(),e.substr(st,2)===w?(i=w,st+=2):(i=n,0===ot&&ft(ce)),i!==n?(Pt(),a=wt(),a!==n?t={type:s.nullc,lhs:r,rhs:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=Et()),lt[o]={nextPos:st,result:t},t)}function Et(){let t,r,i,a,o,l;const u=38*st+13,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,r=xt(),r!==n){for(i=[],a=st,Pt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(Pt(),l=xt(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,Pt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(Pt(),l=xt(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);t=function(e,t){let r=e;for(const e of t)r={type:s.or,lhs:r,rhs:e};return r}(r,i)}else st=t,t=n;return lt[u]={nextPos:st,result:t},t}function xt(){let t,r,i,a,o,l;const u=38*st+14,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,r=At(),r!==n){for(i=[],a=st,Pt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(Pt(),l=At(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,Pt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(Pt(),l=At(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);t=function(e,t){let r=e;for(const e of t)r={type:s.and,lhs:r,rhs:e};return r}(r,i)}else st=t,t=n;return lt[u]={nextPos:st,result:t},t}function At(){let e,t,r,i,a,o;const l=38*st+15,u=lt[l];if(u)return st=u.nextPos,u.result;if(e=st,t=St(),t!==n){for(r=[],i=st,Pt(),a=Lt(),a!==n?(Pt(),o=St(),o!==n?i=Ze(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,Pt(),a=Lt(),a!==n?(Pt(),o=St(),o!==n?i=Ze(0,a,o):(st=i,i=n)):(st=i,i=n);e=function(e,t){let r=e;for(const e of t)r={type:s.eq,op:e.op,lhs:r,rhs:e.rhs};return r}(t,r)}else st=e,e=n;return lt[l]={nextPos:st,result:e},e}function St(){let e,t,r,i,a,o;const l=38*st+16,u=lt[l];if(u)return st=u.nextPos,u.result;if(e=st,t=Tt(),t!==n){for(r=[],i=st,Pt(),a=Nt(),a!==n?(Pt(),o=Tt(),o!==n?i=et(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,Pt(),a=Nt(),a!==n?(Pt(),o=Tt(),o!==n?i=et(0,a,o):(st=i,i=n)):(st=i,i=n);e=function(e,t){let r=e;for(const e of t)r={type:s.cmp,op:e.op,lhs:r,rhs:e.rhs};return r}(t,r)}else st=e,e=n;return lt[l]={nextPos:st,result:e},e}function Tt(){let t,r,i;const a=38*st+17,o=lt[a];return o?(st=o.nextPos,o.result):(t=st,33===e.charCodeAt(st)?(r=A,st++):(r=n,0===ot&&ft(pe)),r!==n?(Pt(),i=Tt(),i!==n?t={type:s.not,expr:i}:(st=t,t=n)):(st=t,t=n),t===n&&(t=function(){let e,t,r,i,a;const o=38*st+18,l=lt[o];if(l)return st=l.nextPos,l.result;if(e=st,t=_t(),t!==n){if(Pt(),r=[],i=st,a=Ct(),a!==n?(Pt(),i=a):(st=i,i=n),i!==n)for(;i!==n;)r.push(i),i=st,a=Ct(),a!==n?(Pt(),i=a):(st=i,i=n);else r=n;r!==n?e={type:s.access,lhs:t,rhs:r}:(st=e,e=n)}else st=e,e=n;return e===n&&(e=_t()),lt[o]={nextPos:st,result:e},e}()),lt[a]={nextPos:st,result:t},t)}function Ct(){let t;const r=38*st+19,i=lt[r];return i?(st=i.nextPos,i.result):(t=function(){let t,r,i;const a=38*st+20,o=lt[a];return o?(st=o.nextPos,o.result):(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(46===e.charCodeAt(st)?(r=T,st++):(r=n,0===ot&&ft(ge))),r!==n?(Pt(),i=Rt(),i!==n?t={type:s.member,ns:"?."===r,rhs:i}:(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft(fe)),lt[a]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let t,r,i,a,o;const l=38*st+21,u=lt[l];return u?(st=u.nextPos,u.result):(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(r=null),91===e.charCodeAt(st)?(i=C,st++):(i=n,0===ot&&ft(ve)),i!==n?(Pt(),a=vt(),a!==n?(Pt(),93===e.charCodeAt(st)?(o=_,st++):(o=n,0===ot&&ft(ye)),o!==n?t={type:s.subscript,ns:null!==r,rhs:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft(be)),lt[l]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let t,r,i,a,o,l,u,c;const d=38*st+22,h=lt[d];if(h)return st=h.nextPos,h.result;if(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(r=null),40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n){for(Pt(),a=st,o=vt(),o!==n?(l=Pt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);41===e.charCodeAt(st)?(l=k,st++):(l=n,0===ot&&ft(Ae)),l!==n?t=function(e,t,r){return{type:s.method,ns:null!==e,args:null===t?[]:[t,...r]}}(r,a,o):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(we)),lt[d]={nextPos:st,result:t},t}())),lt[r]={nextPos:st,result:t},t)}function _t(){let t,i,a,o;const l=38*st+23,u=lt[l];return u?(st=u.nextPos,u.result):(t=st,40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n?(Pt(),a=vt(),a!==n?(Pt(),41===e.charCodeAt(st)?(o=k,st++):(o=n,0===ot&&ft(Ae)),o!==n?t=a:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=function(){let t,r,i,a,o,l,u,c;const d=38*st+24,h=lt[d];if(h)return st=h.nextPos,h.result;if(ot++,t=st,r=function(){let t,r,i,a,o;const l=38*st+32,u=lt[l];return u?(st=u.nextPos,u.result):(ot++,t=st,35===e.charCodeAt(st)?(r=F,st++):(r=n,0===ot&&ft(Be)),r!==n?(i=st,a=Rt(),a!==n?(58===e.charCodeAt(st)?(o=v,st++):(o=n,0===ot&&ft(le)),o!==n?i=a:(st=i,i=n)):(st=i,i=n),i===n&&(i=null),a=Rt(),a!==n?t={type:s.function,module:i,value:a}:(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft($e)),lt[l]={nextPos:st,result:t},t)}(),r!==n)if(40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n){for(Pt(),a=st,o=vt(),o!==n?(l=Pt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(Pt(),c=vt(),c!==n?(Pt(),l=c):(st=l,l=n)):(st=l,l=n);41===e.charCodeAt(st)?(l=k,st++):(l=n,0===ot&&ft(Ae)),l!==n?t=function(e,t,r){const i=null===t?[]:[t,...r];return{type:s.call,value:e,args:i}}(r,a,o):(st=t,t=n)}else st=t,t=n;else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(Se)),lt[d]={nextPos:st,result:t},t}(),t===n&&(t=function(){let t;const r=38*st+25,i=lt[r];return i?(st=i.nextPos,i.result):(t=function(){let t,r,i,a,o,l,u,c,d,h;const p=38*st+26,f=lt[p];if(f)return st=f.nextPos,f.result;if(ot++,t=st,r=st,i=st,45===e.charCodeAt(st)?(a=R,st++):(a=n,0===ot&&ft(Ce)),a===n&&(a=null),o=st,l=[],u=e.charAt(st),W.test(u)?st++:(u=n,0===ot&&ft(_e)),u!==n)for(;u!==n;)l.push(u),u=e.charAt(st),W.test(u)?st++:(u=n,0===ot&&ft(_e));else l=n;if(l!==n){if(u=st,46===e.charCodeAt(st)?(c=T,st++):(c=n,0===ot&&ft(ge)),c!==n){for(d=[],h=e.charAt(st),W.test(h)?st++:(h=n,0===ot&&ft(_e));h!==n;)d.push(h),h=e.charAt(st),W.test(h)?st++:(h=n,0===ot&&ft(_e));c=[c,d],u=c}else st=u,u=n;u===n&&(u=null),l=[l,u],o=l}else st=o,o=n;if(o===n)if(o=st,46===e.charCodeAt(st)?(l=T,st++):(l=n,0===ot&&ft(ge)),l!==n){if(u=[],c=e.charAt(st),W.test(c)?st++:(c=n,0===ot&&ft(_e)),c!==n)for(;c!==n;)u.push(c),c=e.charAt(st),W.test(c)?st++:(c=n,0===ot&&ft(_e));else u=n;u!==n?(l=[l,u],o=l):(st=o,o=n)}else st=o,o=n;return o!==n?(a=[a,o],i=a):(st=i,i=n),r=i!==n?e.substring(r,st):i,r!==n&&(r={type:s.literal,value:parseFloat(r)}),t=r,ot--,t===n&&(r=n,0===ot&&ft(Te)),lt[p]={nextPos:st,result:t},t}(),t===n&&(t=Ot(),t===n&&(t=function(){let t,r,i,a,o,l,u;const c=38*st+30,d=lt[c];if(d)return st=d.nextPos,d.result;if(ot++,t=st,91===e.charCodeAt(st)?(r=C,st++):(r=n,0===ot&&ft(ve)),r!==n){for(Pt(),i=vt(),i===n&&(i=null),Pt(),a=[],o=st,44===e.charCodeAt(st)?(l=q,st++):(l=n,0===ot&&ft(xe)),l!==n?(Pt(),u=vt(),u!==n?(Pt(),o=u):(st=o,o=n)):(st=o,o=n);o!==n;)a.push(o),o=st,44===e.charCodeAt(st)?(l=q,st++):(l=n,0===ot&&ft(xe)),l!==n?(Pt(),u=vt(),u!==n?(Pt(),o=u):(st=o,o=n)):(st=o,o=n);93===e.charCodeAt(st)?(o=_,st++):(o=n,0===ot&&ft(ye)),o!==n?t=function(e,t){const r=null===e?[]:[e,...t];return{type:s.array,value:r}}(i,a):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(De)),lt[c]={nextPos:st,result:t},t}(),t===n&&(t=function(){let t,r,i,a,o,l,u,c,d,h,p;const f=38*st+31,m=lt[f];if(m)return st=m.nextPos,m.result;if(ot++,t=st,123===e.charCodeAt(st)?(r=g,st++):(r=n,0===ot&&ft(ae)),r!==n){for(Pt(),i=st,a=Ot(),a!==n?(o=Pt(),58===e.charCodeAt(st)?(l=v,st++):(l=n,0===ot&&ft(le)),l!==n?(u=Pt(),c=vt(),c!==n?i=[a,c]:(st=i,i=n)):(st=i,i=n)):(st=i,i=n),i===n&&(i=null),a=Pt(),o=[],l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=Pt(),d=Ot(),d!==n?(Pt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(Pt(),p=vt(),p!==n?(Pt(),l=[d,p]):(st=l,l=n)):(st=l,l=n)):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=q,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=Pt(),d=Ot(),d!==n?(Pt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(Pt(),p=vt(),p!==n?(Pt(),l=[d,p]):(st=l,l=n)):(st=l,l=n)):(st=l,l=n)):(st=l,l=n);125===e.charCodeAt(st)?(l=M,st++):(l=n,0===ot&&ft(Me)),l!==n?t=function(e,t){var r=[];return null!==e&&r.push(e),r.push.apply(r,t),{type:s.dict,value:r}}(i,o):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(Ie)),lt[f]={nextPos:st,result:t},t}()))),lt[r]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let e,t;const i=38*st+34,a=lt[i];return a?(st=a.nextPos,a.result):(ot++,e=st,t=Rt(),t!==n&&(o=t,t=r.has(o)?{type:s.literal,value:r.get(o)}:{type:s.symbol,value:o}),e=t,ot--,e===n&&(t=n,0===ot&&ft(We)),lt[i]={nextPos:st,result:e},e);var o}()))),lt[l]={nextPos:st,result:t},t)}function Ot(){let t,r,i,a,o;const l=38*st+27,u=lt[l];if(u)return st=u.nextPos,u.result;if(ot++,t=st,39===e.charCodeAt(st)?(r=L,st++):(r=n,0===ot&&ft(qe)),r!==n){for(i=st,a=[],o=e.charAt(st),V.test(o)?st++:(o=n,0===ot&&ft(ke));o!==n;)a.push(o),o=e.charAt(st),V.test(o)?st++:(o=n,0===ot&&ft(ke));i=e.substring(i,st),39===e.charCodeAt(st)?(a=L,st++):(a=n,0===ot&&ft(qe)),a!==n?t={type:s.literal,value:i}:(st=t,t=n)}else st=t,t=n;if(t===n){if(t=st,34===e.charCodeAt(st)?(r=N,st++):(r=n,0===ot&&ft(Re)),r!==n){for(i=st,a=[],o=e.charAt(st),U.test(o)?st++:(o=n,0===ot&&ft(Le));o!==n;)a.push(o),o=e.charAt(st),U.test(o)?st++:(o=n,0===ot&&ft(Le));i=e.substring(i,st),34===e.charCodeAt(st)?(a=N,st++):(a=n,0===ot&&ft(Re)),a!==n?t={type:s.literal,value:i}:(st=t,t=n)}else st=t,t=n;if(t===n)if(t=st,96===e.charCodeAt(st)?(r=P,st++):(r=n,0===ot&&ft(Ne)),r!==n){for(i=[],a=qt(),a===n&&(a=kt());a!==n;)i.push(a),a=qt(),a===n&&(a=kt());96===e.charCodeAt(st)?(a=P,st++):(a=n,0===ot&&ft(Ne)),a!==n?t={type:s.tstring,parts:i}:(st=t,t=n)}else st=t,t=n}return ot--,t===n&&(r=n,0===ot&&ft(Oe)),lt[l]={nextPos:st,result:t},t}function qt(){let t,s,r,i;const a=38*st+28,o=lt[a];return o?(st=o.nextPos,o.result):(ot++,t=st,123===e.charCodeAt(st)?(s=g,st++):(s=n,0===ot&&ft(ae)),s!==n?(Pt(),r=vt(),r!==n?(Pt(),125===e.charCodeAt(st)?(i=M,st++):(i=n,0===ot&&ft(Me)),i!==n?t=r:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),ot--,t===n&&(s=n,0===ot&&ft(Pe)),lt[a]={nextPos:st,result:t},t)}function kt(){let t,r,i,a,o;const l=38*st+29,u=lt[l];if(u)return st=u.nextPos,u.result;if(ot++,t=st,r=[],i=st,a=[],o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze)),o!==n)for(;o!==n;)a.push(o),o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze));else a=n;if(i=a!==n?e.substring(i,st):a,i===n&&(i=st,92===e.charCodeAt(st)?(a=m,st++):(a=n,0===ot&&ft(ie)),a!==n?(e.length>st?(o=e.charAt(st),st++):(o=n,0===ot&&ft(ne)),o!==n?i=o:(st=i,i=n)):(st=i,i=n)),i!==n)for(;i!==n;){if(r.push(i),i=st,a=[],o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze)),o!==n)for(;o!==n;)a.push(o),o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(ze));else a=n;i=a!==n?e.substring(i,st):a,i===n&&(i=st,92===e.charCodeAt(st)?(a=m,st++):(a=n,0===ot&&ft(ie)),a!==n?(e.length>st?(o=e.charAt(st),st++):(o=n,0===ot&&ft(ne)),o!==n?i=tt(o):(st=i,i=n)):(st=i,i=n))}else r=n;return r!==n&&(r={type:s.literal,value:r.join("")}),t=r,t===n&&(t=st,123===e.charCodeAt(st)?(r=g,st++):(r=n,0===ot&&ft(ae)),r!==n&&(r={type:s.literal,value:r}),t=r),ot--,t===n&&(r=n,0===ot&&ft(Fe)),lt[l]={nextPos:st,result:t},t}function Rt(){let t,s,r,i,a;const o=38*st+33,l=lt[o];if(l)return st=l.nextPos,l.result;if(t=st,s=st,r=e.charAt(st),Q.test(r)?st++:(r=n,0===ot&&ft(je)),r!==n){for(i=[],a=e.charAt(st),K.test(a)?st++:(a=n,0===ot&&ft(He));a!==n;)i.push(a),a=e.charAt(st),K.test(a)?st++:(a=n,0===ot&&ft(He));r=[r,i],s=r}else st=s,s=n;return t=s!==n?e.substring(t,st):s,lt[o]={nextPos:st,result:t},t}function Lt(){let t;const s=38*st+35,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===z?(t=z,st+=2):(t=n,0===ot&&ft(Ve)),t===n&&(e.substr(st,2)===D?(t=D,st+=2):(t=n,0===ot&&ft(Ue))),lt[s]={nextPos:st,result:t},t)}function Nt(){let t;const s=38*st+36,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===I?(t=I,st+=2):(t=n,0===ot&&ft(Ge)),t===n&&(62===e.charCodeAt(st)?(t=$,st++):(t=n,0===ot&&ft(Qe)),t===n&&(e.substr(st,2)===B?(t=B,st+=2):(t=n,0===ot&&ft(Ke)),t===n&&(60===e.charCodeAt(st)?(t=j,st++):(t=n,0===ot&&ft(Je))))),lt[s]={nextPos:st,result:t},t)}function Pt(){let t,s;const r=38*st+37,i=lt[r];if(i)return st=i.nextPos,i.result;for(ot++,t=[],s=e.charAt(st),J.test(s)?st++:(s=n,0===ot&&ft(Xe));s!==n;)t.push(s),s=e.charAt(st),J.test(s)?st++:(s=n,0===ot&&ft(Xe));return ot--,lt[r]={nextPos:st,result:t},t}it=l();const Mt=it!==n&&st===e.length;function Ft(){throw it!==n&&st<e.length&&ft({type:"end"}),t=at,s=nt<e.length?function(t=st){const s=e.codePointAt(t);return void 0===s?"":String.fromCodePoint(s)}(nt):null,r=nt<e.length?pt(nt,nt+1):pt(nt,nt),new i(i.buildMessage(t,s),t,s,r);var t,s,r}return t.peg$library?{peg$result:it,peg$currPos:st,peg$FAILED:n,peg$maxFailExpected:at,peg$maxFailPos:nt,peg$success:Mt,peg$throw:Mt?void 0:Ft}:Mt?it:void Ft()}(e,{startRule:t===o.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}static evaluate(e,t,s,r){return new a(e,t).visitRoot(s,r===o.MODE_TEMPLATED)}static interpret(e,t,s,r){return o.evaluate(e,t,o.parse(s,r),r)}}class l{#s;#r;constructor(e,t){this.#s=e,this.#r=t}withModule(e,t){const s=e?{[e]:t}:t;return new l({...this.#s,...s},this.#r)}withOverlay(...e){return new l(this.#s,0===e.length?this.#r:[...this.#r,...e])}resolve(e){return n(this.#r,e)}evaluateExpression(e){return o.interpret(this.#s,this.#r,e,o.MODE_EXPRESSION)}evaluateTemplated(e){return o.interpret(this.#s,this.#r,e,o.MODE_TEMPLATED)}}class u{static fromHtml(...e){const t=document.createElement("template");return t.innerHTML=e.map(e=>e.trim()).join(""),document.adoptNode(t.content)}static toHtml(e){var t=document.createElement("template");return t.content.appendChild(e),t.innerHTML}static isBlank(e){return 0===e.childElementCount&&""===e.textContent.trim()}static from(...e){const t=new DocumentFragment;for(const s of e)t.appendChild(s);return t}static fromChildNodes(e){const t=new DocumentFragment;for(;e.firstChild;)t.appendChild(e.firstChild);return t}}class c{static id=0;static uid(e){return`${e}-${++c.id}`}static defaultValue(e,t,s){return e.hasAttribute(t)||e.setAttribute(t,s),e.getAttribute(t)}static forward(e,t,s){t.getAttributeNames().filter(t=>t.startsWith(e)).forEach(r=>{const i=r.substring(e.length);if("class"===i){const r=t.getAttribute(`${e}class`)?.split(/\s+/).filter(e=>e.length)??[];return void s.classList.add(...r)}s.setAttribute(i,t.getAttribute(r))})}static set(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)}}class d{static from(e){for(const t of e.children)t.matches('[slot=""]')&&t.removeAttribute("slot");const t=Array.from(e.children).filter(e=>e.matches("[slot]")).map(e=>{e.remove();const t=e.getAttribute("slot");return e.removeAttribute("slot"),[t,d.slotFromNode(e)]}),s={};s.default=new DocumentFragment,s.default.append(...e.childNodes);for(const[e,r]of t)e in s||(s[e]=new DocumentFragment),s[e].append(r);return s}static slotFromNode(e){return e instanceof HTMLTemplateElement?document.adoptNode(e.content):e instanceof HTMLScriptElement&&"text/html"===e.type?u.fromHtml(e.innerHTML):e}}class h{static isParsed(e){for(let t=e;t;t=t.parentNode)if(t.nextSibling)return!0;return!1}static waitDomContentLoaded(e){if("loading"===e.readyState)return new Promise(t=>{e.addEventListener("DOMContentLoaded",()=>t(void 0),{once:!0})});if("complete"===e.readyState)return Promise.resolve();const t=e.defaultView;return null===t?Promise.resolve():new Promise(e=>{const s=()=>{t.removeEventListener("DOMContentLoaded",s),t.removeEventListener("load",s),e(void 0)};t.addEventListener("DOMContentLoaded",s),t.addEventListener("load",s)})}static waitParsed(e){return h.isParsed(e)?Promise.resolve(e):new Promise(t=>{const s=new MutationObserver(()=>{h.isParsed(e)&&(s.disconnect(),t(e))});for(let t=e.parentNode;t;t=t.parentNode)s.observe(t,{childList:!0});h.waitDomContentLoaded(e.ownerDocument).then(()=>{s.disconnect(),t(e)})})}static queryChildren(e,t){for(const s of e.children)if(s.matches(t))return s;return null}static queryChildrenAll(e,t){const s=[];for(const r of e.children)r.matches(t)&&s.push(r);return s}}class p{#u=new Set;removed(e){return this.#u.has(e)}remove(e){e.replaceChildren?.(),Object.keys(e.dataset||{}).filter(e=>e.startsWith("tpl")).forEach(t=>{delete e.dataset[t]}),this.#u.add(e)}popData(e,t){const s=e.dataset[t];return delete e.dataset[t],s}prepend(e,t){e.parentNode.insertBefore(t,e)}append(e,t){e.parentNode.insertBefore(t,e.nextSibling)}replace(e,t){this.prepend(e,t),this.remove(e)}cleanup(){for(const e of this.#u)e.remove();this.#u.clear()}}class f{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplRemove","tplVerbatim"];static tplIf(e,t,s,r){r.evaluateExpression(t)||s.remove(e)}static tplWith(e,t,s,r){const i=r.evaluateExpression(t),n=s.popData(e,"tplVar"),a=new b(e,r).withOverlay(n?{[n]:i}:i).render();s.replace(e,a)}static tplEach(e,t,s,r){const i=s.popData(e,"tplVar"),n=s.popData(e,"tplStat"),a=new b(e,r),o=r.evaluateExpression(t),l=null===o||"object"!=typeof o?void 0:Object.getPrototypeOf(o),u=o?.[Symbol.iterator]||l!==Object.prototype&&null!==l?null:Object.entries(o),c=o instanceof Map?[...o]:u,d=null===c?o:c.map(([e,t])=>({key:e,value:t}));if(!d?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);const h=n?d:null,p="number"==typeof h?.length?h.length:h?.size,f="number"==typeof p?p:null;let m=0;for(const t of d){const r=i?{[i]:t}:t,o={index:m,count:m+1,size:f,first:0===m,last:null===f?null:m===f-1,even:m%2==0,odd:m%2==1},l=n?[{[n]:o},r]:[r];s.prepend(e,a.withOverlay(...l).render()),++m}s.remove(e)}static tplWhen(e,t,s,r){r.evaluateExpression(t)||s.remove(e)}static tplVerbatim(e,t,s,r){const i=e.cloneNode(!0);s.replace(e,i)}static tplRemove(e,t,s,r){switch(t.toLowerCase()){case"tag":{const t=u.fromChildNodes(e);"tplVerbatim"in e.dataset?(s.popData(e,"tplVerbatim"),s.replace(e,t)):(s.append(e,t),s.remove(e));break}case"body":e.replaceChildren();break;case"all":s.remove(e)}}static tplClassAppend(e,t,s,r){const i=r.evaluateExpression(t);if(!i)return;const n=(Array.isArray(i)?i:[i]).flatMap(e=>"string"==typeof e?e.split(" "):e).filter(Boolean);0!==n.length&&e.classList.add(...n)}static tplAttrAppend(e,t,s,r){const i=r.evaluateExpression(t);i&&0!==i.length&&(Array.isArray(i[0])?i:[i]).forEach(([t,s])=>{e.setAttribute(t,s)})}static textNode(e,t,r,i){for(const n of i.evaluateTemplated(t))if(null!=n.value)switch(n.type){case s.dom.t:r.prepend(e,document.createTextNode(n.value));break;case s.dom.h:r.prepend(e,u.fromHtml("string"==typeof n.value?n.value:String(n.value)));break;case s.dom.n:if(!(n.value instanceof Node))throw new TypeError(`Expected a Node, got '${typeof n.value}'`);r.prepend(e,n.value)}r.remove(e)}}const m=new t(1e3);function g(e){return m.getOrCompute(e,e=>e.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase())}class b{static fromHtml(e,t,...s){return new b(u.fromHtml(e),new l(t,s))}static fromSelector(e,t,...s){const r=document.querySelector(e);if(!(r instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");return b.fromTemplate(r,t,...s)}static fromTemplate(e,t,...s){const r=document.adoptNode(e.content);return new b(r,new l(t,s))}static fromFragment(e,t,...s){return new b(e,new l(t,s))}#c;#d;constructor(e,t){this.#c=e,this.#d=t}withEvaluator(e){return new b(this.#c,e)}withFragment(e){return new b(e,this.#d)}withModule(e,t){return new b(this.#c,this.#d.withModule(e,t))}withOverlay(...e){return new b(this.#c,this.#d.withOverlay(...e))}evaluateExpression(e,...t){return this.#d.withOverlay(...t).evaluateExpression(e)}evaluateTemplated(e,...t){return this.#d.withOverlay(...t).evaluateTemplated(e)}evaluator(){return this.#d}render(){try{const e=new p,t=document.importNode(this.#c,!0),s=t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t:u.from(t),r=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,b.#h);let i;for(;null!==(i=r.nextNode());){if(e.cleanup(),i.nodeType===Node.TEXT_NODE){try{f.textNode(i,i.nodeValue,e,this.#d)}catch(e){throw v.wrap("Error evaluating text node",i,e)}continue}const t=i;for(const s of f.ORDERED_COMMANDS){if(!(s in t.dataset))continue;const r=e.popData(t,s);try{f[s](t,r,e,this.#d)}catch(e){throw v.wrap(`Error evaluating data-tpl-${g(s)}="${r}"`,t,e)}if(e.removed(t))break}for(const s of Object.keys(t.dataset||{})){if(!s.startsWith("tpl"))continue;const r=g(s),i=e.popData(t,s);try{const e=this.#d.evaluateExpression(i);if("boolean"==typeof e){t.toggleAttribute(r,e);continue}null!=e&&t.setAttribute(r,e)}catch(e){throw v.wrap(`Error evaluating data-tpl-${r}="${i}"`,t,e)}}}return e.cleanup(),s}catch(e){if(e instanceof v)throw e;throw new v("Error rendering template",this.#c,e)}}renderTo(e){e.replaceChildren(this.render())}appendTo(e){e.appendChild(this.render())}renderToSelector(e){const t=document.querySelector(e);t&&this.renderTo(t)}appendToSelector(e){const t=document.querySelector(e);t&&this.appendTo(t)}static#h(e){if(e.nodeType===Node.TEXT_NODE)return e.nodeValue.includes("{{")&&e.nodeValue.includes("}}")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;for(const t of e.attributes)if(t.name.startsWith("data-tpl-"))return NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}}class v extends Error{static FRAMES=3;#p;#f;truncated=!1;static wrap(e,t,s){return s instanceof v&&s.depth>=v.FRAMES?(s.truncated=!0,s):new v(e,t,s)}constructor(e,t,s){super(`${e} in \`${v.describe(t)}\``,{cause:s}),this.name="RenderError",this.#p=t,this.#f=(s instanceof v?s.depth:0)+1}get depth(){return this.#f}get node(){return this.#p}get html(){return v.stringify(this.#p)}static describe(e){if(e.nodeType===Node.TEXT_NODE)return v.#m(String(e.nodeValue).trim());if(e.nodeType===Node.ELEMENT_NODE){const t=e,s=Array.from(t.attributes,e=>` ${e.name}="${e.value}"`).join("");return v.#m(`<${t.localName}${s}>`)}const t=Array.from(e.childNodes).filter(e=>e.nodeType===Node.ELEMENT_NODE||String(e.nodeValue??"").trim().length>0).map(e=>v.describe(e));return v.#m(t.join(""))}static#m(e){return e.length>120?`${e.slice(0,120)}…`:e}static stringify(e){return u.toHtml(v.#g(e.cloneNode(!0)))}static#g(e){e.nodeType===Node.TEXT_NODE&&(e.nodeValue=e.nodeValue.trim());for(let t=0;t<e.childNodes.length;t++){const s=e.childNodes[t];s.nodeType===Node.TEXT_NODE?(s.nodeValue=s.nodeValue.trim(),0===s.nodeValue.length&&(e.removeChild(s),t--)):s.nodeType===Node.ELEMENT_NODE&&v.#g(s)}return e}}class y{#b=new Map;#v;#y=new Promise(e=>{this.#v=e});constructor(){h.waitDomContentLoaded(document).then(()=>{this.#w()})}ready(){return this.#y}async#w(){await this.settled(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1})),this.#v()}enqueue(e){if(this.#b.has(e))return;const{promise:t,resolve:s}=Promise.withResolvers(),r=h.waitParsed(e).then(()=>e.upgrade()).finally(()=>{this.#b.delete(e),s()});this.#b.set(e,{upgrade:r,finished:t})}async#E(e,t){for(;;){const s=Array.from(this.#b).filter(([t])=>e(t)).map(([,e])=>t(e));if(0===s.length)return;await Promise.all(s)}}settled(){return this.#E(()=>!0,e=>e.finished)}upgraded(e){return this.#E(e,e=>e.upgrade)}whenUpgraded(e){return this.#b.get(e)?.upgrade}pending(){return Array.from(this.#b.keys())}}class w{#x={};#A=!1;#S={string:{unmarshal:(e,t,s)=>e,marshal:(e,t,s)=>null==e?null:String(e)},number:{unmarshal:(e,t,s)=>null===e?null:Number(e),marshal:(e,t,s)=>null==e?null:String(e)},presence:{unmarshal:(e,t,s)=>null!==e,marshal:(e,t,s)=>e?"":null},bool:{unmarshal:(e,t,s)=>"true"===e,marshal:(e,t,s)=>null==e?null:String(!0===e)},json:{unmarshal:(e,t,s)=>null===e?null:JSON.parse(e),marshal:(e,t,s)=>null==e?null:JSON.stringify(e)},csv:{unmarshal:(e,t,s)=>null===e?[]:e.split(",").map(e=>e.trim()).filter(e=>e),marshal:(e,t,s)=>null==e?null:e.join(",")}};#T={};#s;#C=[];#d=new l(void 0,[]);#_=new y;defineElement(e,t){return this.#A?(this.#O(e,t),this):(this.#x[e]=t,this)}static declarationsOf(e){const t=[];for(let s=e;null!==s&&s!==HTMLElement;s=Object.getPrototypeOf(s))t.unshift(s);const s=e=>t.flatMap(t=>Object.getOwnPropertyDescriptor(t,e)?.value??[]);return{observed:s("observed"),attributes:s("attributes")}}static propertyOf(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}#O(e,t){const{observed:s,attributes:r}=w.declarationsOf(t),{template:i,templates:n,slots:a,mappers:o,config:l}=t,u=s.map(e=>e.split(":")[0]),c=[...new Set(u.reverse())].reverse(),d=[...r,...s].reduce((e,t)=>{const[s,r]=t.split(":"),i=r??"string";if(!(i in this.#S)&&!(i in(o??{})))throw new Error(`unsupported attribute type: ${i}`);return e[s]=o?.[i]??this.#S[i],e},{}),h=Object.entries(Object.assign({},n,i?{default:i}:{})).map(([e,t])=>[e,b.fromHtml(t)]),p=Object.fromEntries(h);t.BITS={registry:this,enqueue:e=>this.#_.enqueue(e),SLOTS:a,CONFIG:l,OBSERVED:c,DECLARED:[...new Set([...c,...r.map(e=>e.split(":")[0])])],ATTR_TO_MAPPER:d,ATTR_TO_PROPERTY:Object.fromEntries(c.map(e=>[e,w.propertyOf(e)])),TEMPLATES:p},customElements.define(e,t)}defineModule(e,t){const s=e?{[e]:t}:t;return this.#s={...this.#s,...s},this.#q(),this}defineModules(e){return this.#s=e,this.#q(),this}defineComponent(e,t){return this.#T[e]=t,this}defineData(...e){return this.#C=e,this.#q(),this}defineOverlay(...e){return this.#C=[...this.#C,...e],this.#q(),this}defineMapper(e,t){return this.#S[e]=t,this}plugin(e){return e.configure(this),this}configure(){for(const[e,t]of Object.entries(this.#x))this.#O(e,t),delete this.#x[e];return this.#A=!0,this}settle(e){return this.#_.upgraded(e)}whenUpgraded(e){return this.#_.whenUpgraded(e)}pending(){return this.#_.pending()}ready(){return this.#_.ready()}#q(){this.#d=new l(this.#s,this.#C)}evaluator(){return this.#d}component(e){return this.#T[e]}}const E=new w;class x{static fromHtml(e){return b.fromHtml(e).withEvaluator(E.evaluator())}static fromSelector(e){return b.fromSelector(e).withEvaluator(E.evaluator())}static fromTemplate(e){return b.fromTemplate(e).withEvaluator(E.evaluator())}static fromFragment(e){return b.fromFragment(e).withEvaluator(E.evaluator())}}class A{static waitFor(e){return E.settle(t=>e.contains(t))}static waitForChildren(e){return E.settle(t=>e!==t&&e.contains(t))}}class S extends HTMLElement{static BITS={registry:E,enqueue:e=>{},SLOTS:!1,CONFIG:void 0,OBSERVED:[],DECLARED:[],ATTR_TO_MAPPER:{},ATTR_TO_PROPERTY:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}constructor(){super(),this.internals=this.attachInternals()}internals;#k=!1;#R=!1;#L=new Set;#N=null;#P={};#M(){return this.constructor.BITS}#F(e){const t=this.#M().ATTR_TO_MAPPER[e];if(!t)throw new Error(`${this.constructor.name} declares no attribute '${e}': declare it in static observed or static attributes, or read it with getAttribute`);return t}unmarshal(e,t){return this.#F(e).unmarshal(t,e,this)}marshal(e,t){return this.#F(e).marshal(t,e,this)}get _registry(){return this.#M().registry}component(e){return this.#M().registry.component(e)}template(e){const t=this.#M().TEMPLATES[e??"default"];if(!t)throw new Error(`no template named '${e??"default"}' on ${this.constructor.name}`);const s=t.withEvaluator(this.#M().registry.evaluator()),r=this.#M().CONFIG;return r?s.withOverlay({config:r}):s}connectedCallback(){this.#R||this.#M().enqueue(this)}attributeChangedCallback(e,t,s){t!==s&&(this.#L.has(e)||(this.#k?this[this.#M().ATTR_TO_PROPERTY[e]]=this.unmarshal(e,s):null!==this.#N&&e in this.#N&&(this.#N[e]=this.unmarshal(e,s))))}async upgrade(){if(this.#R)return;this.#R=!0;const e=this.#M().SLOTS?d.from(this):void 0,t=Object.fromEntries(this.#M().DECLARED.map(e=>[e,this.unmarshal(e,this.getAttribute(e))])),s=new Set(this.#M().OBSERVED);this.#P=Object.fromEntries(Object.entries(t).filter(([e])=>!s.has(e))),this.#N=t;try{await this.render({slots:e});const s=this.#M().ATTR_TO_PROPERTY;for(const e of this.#M().OBSERVED)this[s[e]]=t[e];this.#k=!0,this.internals.states.add("rendered")}finally{this.#N=null}}render(e){}declared(e){return e in this.#P?this.#P[e]:null!==this.#N&&e in this.#N?this.#N[e]:this.unmarshal(e,this.getAttribute(e))}get rendered(){return this.#k}reflectTo(e,t){const s=this.marshal(e,t);if(s!==this.getAttribute(e)){this.#L.add(e);try{c.set(this,e,s)}finally{this.#L.delete(e)}}}}const T=/\{(\w+)\}/g,C=/\{(\d+)\}/g,_=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),O=new Set,q=e=>{O.has(e)||(O.add(e),console.warn(`l10n: ${e}`))},k=new t(100),R=(e,t,s)=>{const r=`${e.name}|${t??""}|${void 0===s?"":JSON.stringify(s)}`;return k.getOrCompute(r,()=>new e(t,s))};class L{static t(e,...t){const s=this.l10n??{};let r=Object.hasOwn(s,e)?s[e]:void 0;if(void 0===r)return q(`missing message "${e}"`),e;const i=1===t.length&&_(t[0])?t[0]:null;if(_(r))if("number"!=typeof i?.count)q(`plural message "${e}" needs a numeric {count}`),r=r.other;else{const e=this.locale??navigator?.language??"en";r=r[R(Intl.PluralRules,e).select(i.count)]??r.other}return void 0===r||"object"==typeof r?(q(`plural message "${e}" has no "other" form`),e):i?r.replace(T,(t,s)=>Object.hasOwn(i,s)?String(i[s]):(q(`message "${e}" wants {${s}}`),t)):t.length>0?r.replace(C,(s,r)=>{const i=Number(r);return i>=t.length?(q(`message "${e}" wants {${r}}`),s):String(t[i])}):r}static date(e,t){return R(Intl.DateTimeFormat,this.locale,t).format(e)}static number(e,t){return R(Intl.NumberFormat,this.locale,t).format(e)}static bytes(e){const t=R(Intl.NumberFormat,this.locale,{maximumFractionDigits:2}).format;return e>=1073741824?`${t(e/1024/1024/1024)}GiB`:e>=1048576?`${t(e/1024/1024)}MiB`:e>=1024?`${t(e/1024)}KiB`:`${t(e)}B`}static failure(e){return Array.isArray(e?.problems)&&e.problems.length>0?e.problems.map(e=>{return t=e,("string"==typeof t?.reason&&""!==t.reason.trim()?t.reason:void 0)??L.t.call(this,"failure.no-reason");var t}).join("\n"):void 0!==e?.message?String(e.message):null==e?"":String(e)}static of(e={}){const t=e=>E.evaluator().resolve(e),s=s=>(...r)=>s.apply({l10n:t("l10n"),locale:e.locale??t("locale")},r);return{t:s(L.t),date:s(L.date),number:s(L.number),bytes:s(L.bytes),failure:s(L.failure)}}}var N=Object.freeze({__proto__:null,Attributes:c,BoundedCache:t,ExpressionEvaluator:l,Expressions:o,Fragments:u,LightSlots:d,Localization:L,Nodes:h,ParsedElement:S,Registry:w,RenderError:v,Rendering:A,Template:b,Templates:x,registry:E});class P extends Error{constructor(e,t,s){super(e,{cause:s}),this.name="Failure",this.problems=t}dropping(e){return new P(this.message,P.dropProblemsContext(this.problems,e),this)}static dropProblemsContext(e,t){return e.map(({type:e,context:s,reason:r,details:i})=>({type:e,context:s?.startsWith(t)?s.substring(t.length):s,reason:r,details:i}))}}class M{static STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static encode(e,t){const s=t||M.URL_SAFE,r=e.byteLength,i=new Uint8Array(e);let n="";for(let e=0;e<r;e+=3)n+=s[i[e]>>2]+s[(3&i[e])<<4|i[e+1]>>4]+s[(15&i[e+1])<<2|i[e+2]>>6]+s[63&i[e+2]];return r%3==2?n=n.substring(0,n.length-1):r%3==1&&(n=n.substring(0,n.length-2)),n}static decode(e,t){const s=t||M.URL_SAFE;let r=e.length;for(;r>0&&"="===e.charAt(r-1);)--r;const i=e.substring(0,r);if(e.length-r>2||i.includes("=")||0===i.length&&e.length>0)throw new Error("invalid padding");if(i.length%4==1)throw new Error("invalid length");for(const e of i)if(-1===s.indexOf(e))throw new Error(`invalid character '${e}'`);const n=Math.floor(.75*i.length),a=new Uint8Array(n);let o=0,l=0;for(;o<n;){const e=s.indexOf(i.charAt(l++)),t=s.indexOf(i.charAt(l++)),r=s.indexOf(i.charAt(l++)),u=s.indexOf(i.charAt(l++));if(a[o++]=e<<2|t>>4,o===n)break;if(a[o++]=(15&t)<<4|r>>2,o===n)break;a[o++]=(3&r)<<6|u}return a.buffer}}class F{static decode(e){if(e.length%2!=0)throw new Error("invalid length");if(!/^[0-9a-fA-F]*$/.test(e))throw new Error("invalid character");const t=e.length/2;return new Uint8Array(t).map((t,s)=>{const r=2*s,i=e.substring(r,r+2);return parseInt(i,16)})}static encode(e,t){return Array.from(e).map(e=>e.toString(16)).map(e=>t?e.toUpperCase():e).map(e=>e.padStart(2,"0")).join("")}}class z{#z;#D;constructor(e,t){this.#z=e,this.#D=t}get normalized(){return`${this.#z}/${this.#D}`}get type(){return this.#z}get subtype(){return this.#D}static parse(e){if(!e)return new z("unknown","unknown");const[t,s]=e.split(";"),[r,i]=t.trim().toLowerCase().split("/");return r&&i?new z(r,i):new z("unknown","unknown")}}class D extends P{constructor(e,t,s,r){super(e,s,r),this.name="HttpClientError",this.status=t}dropping(e){return new D(this.message,this.status,P.dropProblemsContext(this.problems,e),this)}static problem(e,t){return{type:e,context:null,reason:t,details:null}}static of(e,t){const s=String(t?.message??t??"unknown failure");return new D(s,0,[D.problem(e,s)],t)}static async fromResponse(e){switch(z.parse(e.headers.get("Content-Type")).normalized){case"application/failures+json":{const t=await e.json().catch(()=>D.#I);if(t===D.#I)return D.#$(e);if(!Array.isArray(t))return D.#$(e,"as a failures array");const s=`${e.status} ${e.statusText}: ${t.length} failures`;return new D(s,e.status,t)}case"application/problem+json":{const t=await e.json().catch(()=>D.#I);if(t===D.#I)return D.#$(e);if("object"!=typeof t||null===t||Array.isArray(t))return D.#$(e,"as a problem object");const s=`${e.status} ${e.statusText}: ${t.title} ${t.detail}`;return new D(s,e.status,t.problems||[D.problem("GENERIC_PROBLEM",s)])}default:return D.#B(e)}}static#I=Symbol("unreadable body");static#$(e,t="as json"){const s=z.parse(e.headers.get("Content-Type")).normalized,r=`${e.status} ${e.statusText}: the ${s} body does not decode ${t}`;return new D(r,e.status,[D.problem("GENERIC_PROBLEM",r)])}static async#B(e){const t=await e.text().catch(()=>null),s=null===t?`${e.status} ${e.statusText}: the body could not be read`:`${e.status} ${e.statusText}: ${t}`;return new D(s,e.status,[D.problem("GENERIC_PROBLEM",s)])}}const I=e=>globalThis.document?.querySelector(`meta[name="${e}"]`)?.getAttribute("content")??void 0;class ${async intercept(e,t,s){if(e.origin!==(globalThis.window?.location?.origin??e.origin))return await s.proceed(e,t);const r=I("_csrf_header"),i=I("_csrf");return r&&i&&t.headers.set(r,i),await s.proceed(e,t)}}class B{#j;constructor(e){this.#j=e}async intercept(e,t,s){const r=await s.proceed(e,t);return 401===r.status?(window.location.href=this.#j,new Promise(()=>{})):r}}class j{#H;constructor(){this.#H=[]}withCsrfToken(){return this.#H.push(new $),this}withRedirectOnUnauthorized(e){return this.#H.push(new B(e)),this}withInterceptors(...e){return this.#H.push(...e),this}build(){return new V(this.#H)}}class H{async intercept(e,t,s){try{return await fetch(e,t)}catch(e){throw D.of("CONNECTION_PROBLEM",e)}}}class W{#H;#W;constructor(e,t){this.#H=e,this.#W=t}async proceed(e,t){const s=this.#H[this.#W];return await s.intercept(e,t,new W(this.#H,this.#W+1))}}class V{#H;static builder(){return new j}constructor(e){this.#H=e||[]}async exchange(e,t,s){const r=[...this.#H,...s||[],new H],i=new W(r,0),n=new URL(new Request(e).url),a={...t,headers:new Headers(t?.headers)};return await i.proceed(n,a)}request(e,t){return Q.create(this,e,t)}get(e){return Q.create(this,"GET",e)}head(e){return Q.create(this,"HEAD",e)}post(e){return Q.create(this,"POST",e)}put(e){return Q.create(this,"PUT",e)}patch(e){return Q.create(this,"PATCH",e)}delete(e){return Q.create(this,"DELETE",e)}}const U=async(e,t)=>{try{return await e[t]()}catch(e){throw D.of("UNMARSHALING_PROBLEM",e)}},G=e=>null==e?[]:"string"==typeof e?new URLSearchParams(e):"function"==typeof e[Symbol.iterator]?e:Object.entries(e);class Q{#V;#U;#G;#Q;#K;#J;#X;#H;#c;static create(e,t,s){const r=s.indexOf("#"),i=-1===r?"":s.slice(r),n=-1===r?s:s.slice(0,r),a=n.indexOf("?");return new Q(e,t,-1===a?n:n.slice(0,a),new URLSearchParams(-1===a?"":n.slice(a+1)),new Headers,void 0,{},[],i)}constructor(e,t,s,r,i,n,a,o,l=""){this.#V=e,this.#U=t,this.#G=s,this.#Q=r,this.#J=n,this.#K=i,this.#X=a,this.#H=o,this.#c=l}headers(e){for(const[t,s]of G(e))this.header(t,s);return this}header(e,t){return null==t?this.#K.delete(e):this.#K.set(e,t),this}params(e){for(const[t,s]of G(e))null==s?this.#Q.delete(t):this.#Q.set(t,s);return this}param(e,...t){this.#Q.delete(e);for(const s of t.filter(e=>null!=e))this.#Q.append(e,s);return this}body(e){return this.#J=e,this}json(e){if(void 0===e)return this;const t=JSON.stringify(e);return this.#K.set("Content-Type","application/json"),this.#J=t,this}multipart(e){const t=new FormData;return e(new K(t)),this.#J=t,this}options(e){for(const[t,s]of Object.entries(e))this.#X[t]=s;return this}option(e,t){return this.#X[e]=t,this}interceptors(e){for(const t of e)this.#H.push(t);return this}interceptor(e){return this.#H.push(e),this}async exchange(){const e=this.#Q.size?`?${this.#Q}`:"",t={...this.#X,headers:this.#K,method:this.#U,body:this.#J};return await this.#V.exchange(`${this.#G}${e}${this.#c}`,t,this.#H)}async fetch(){try{const e=await this.exchange();if(!e.ok)throw await D.fromResponse(e);return e}catch(e){if(e instanceof P)throw e;throw D.of("UNEXPECTED_PROBLEM",e)}}async fetchText(){const e=await this.fetch();return await U(e,"text")}async fetchJson(){const e=await this.fetch();return 204===e.status?null:await U(e,"json")}async fetchBlob(){const e=await this.fetch();return await U(e,"blob")}async fetchArrayBuffer(){const e=await this.fetch();return await U(e,"arrayBuffer")}}class K{#Y;constructor(e){this.#Y=e}field(e,t){return this.#Y.append(e,t),this}blob(e,t,s){return this.#Y.append(e,t,s),this}blobs(e,t){for(const s of t)this.#Y.append(e,s);return this}json(e,t,s){const r=new Blob([JSON.stringify(t)],{type:"application/json"});return this.#Y.append(e,r,s),this}}var J=Object.freeze({__proto__:null,Base64:M,Failure:P,Hex:F,HttpClient:V,HttpClientBuilder:j,HttpClientError:D,HttpInterceptorChain:W,HttpMultipartRequestCustomizer:K,HttpRequestBuilder:Q,MediaType:z});const X=e=>{const t=t=>{try{e().removeItem(t)}catch{}},s=s=>{let r;try{r=e().getItem(s)}catch{return}if(null!==r)try{return JSON.parse(r)}catch{return void t(s)}};return{save:(t,s)=>{e().setItem(t,JSON.stringify(s))},load:s,remove:t,pop:e=>{const r=s(e);return t(e),r}}},Y=e=>({save(t,s,r){e.save(t,{revision:s,data:r})},load(t,s){const r=e.load(t);if(null!=r&&"object"==typeof r&&r.revision===s)return r.data;e.remove(t)}}),Z=X(()=>localStorage),ee=X(()=>sessionStorage),te=Y(Z),se=Y(ee);class re{static async fireAsync(e,t,s){e.dispatchEvent(t);const r=t.async?.promises??[],i=s?.mode??"broadcast";if("pipeline"===i&&r.length>1||"delegate"===i&&1!==r.length)throw Promise.all(r).catch(()=>{}),new Error("pipeline"===i?`[AsyncEvents] Event "${t.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${r.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${t.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${r.length} were registered.`);return"broadcast"===i?Promise.all(r):Promise.resolve(r[0])}static asyncOn(e,t,s,r){const i=async e=>{const t=e;t.async||(t.async={promises:[]});const{promise:r,resolve:i,reject:n}=Promise.withResolvers();t.async.promises.push(r);try{i(await s(t))}catch(e){n(e)}};return e.addEventListener(t,i,r),i}static asyncOff(e,t,s,r){e.removeEventListener(t,s,r)}static mixInto(...e){for(const t of e)Object.assign(t.prototype,{async fireAsync(e,t){return await re.fireAsync(this,e,t)},asyncOn(e,t,s){return re.asyncOn(this,e,t,s)},asyncOff(e,t,s){re.asyncOff(this,e,t,s)}})}}class ie{#Z=0;take(){return++this.#Z,this.hold()}hold(){const e=this.#Z,t=this;return{get stale(){return e!==t.#Z}}}invalidate(){++this.#Z}}const ne=e=>{for(let t=e.parentElement;t;t=t.parentElement)if("function"==typeof t.describedBy)return t;return null};class ae{static sleep(e){return new Promise(t=>setTimeout(t,e))}static debounce(e,t,s){const r=s?.immediate??!1;let i=null,n=[],a=0;const o=()=>{const s=performance.now()-a;e>s?i=setTimeout(o,e-s):(i=null,r||t(...n),null===i&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===i&&(i=setTimeout(o,e),r&&t(...n))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}static throttle(e,t,s){const r=s?.leading??!0,i=s?.trailing??!0;let n=null,a=[],o=0;const l=()=>{o=r?performance.now():0,n=null,t(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();o||r||(o=u);const c=0===o?0:e-(u-o);a=s,c<=0||c>e?(null!==n&&(clearTimeout(n),n=null),o=u,t(...a),null===n&&(a=[])):null===n&&i&&(n=setTimeout(l,c))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class oe{static flatten(e,t,s){return Object.keys(e).reduce((r,i)=>{const n=t.length?`${t}.${i}`:i;return s.has(n)||"object"!=typeof e[i]||null===e[i]?r[n]=e[i]:Object.assign(r,oe.flatten(e[i],n,s)),r},{})}static#ee=new Set(["__proto__","prototype","constructor"]);static providePath(e,t,s){const r=t.split(".").map(e=>/^[0-9]+$/.test(e)?+e:e);for(const e of r)if(oe.#ee.has(e))throw new Error(`unsupported name segment '${e}' in '${t}'`);let i=e??{},n=null;for(let t=0;;++t){const a=r[t],o=r[t-1];if(Number.isInteger(a)&&!Array.isArray(i)&&(null!==n?n[o]=i=[]:e=i=[]),t===r.length-1)return i[a]=void 0!==s?s:a in i?i[a]:null,e;"object"==typeof i[a]&&null!==i[a]||(i[a]={}),n=i,i=i[a]}}static extract(e){if("radio"===e.getAttribute("type")){if(!e.checked)return;return"boolean"===e.dataset.fulBindType?"true"===e.value:e.value}return"checkbox"===e.getAttribute("type")?e.checked:"boolean"===e.dataset.fulBindType?e.value?"true"===e.value:null:"SELECT"===e.tagName&&e.multiple?Array.from(e.selectedOptions).map(e=>e.value):"INPUT"!==e.tagName&&"SELECT"!==e.tagName&&"TEXTAREA"!==e.tagName||""!==e.value&&void 0!==e.value?e.value:null}static#te(e){return"submit"===e.type||"reset"===e.type||"button"===e.type}static extractFrom(e,t){let s={};for(const r of e.elements)r.hasAttribute("name")&&(oe.#te(r)&&r!==t||r.matches(":disabled")&&r!==t||(s=oe.providePath(s,r.getAttribute("name"),oe.extract(r))));return s}static mutate(e,t){if("radio"!==e.getAttribute("type"))if("checkbox"!==e.getAttribute("type")){if("SELECT"===e.tagName&&e.multiple){const s=Array.isArray(t)?t.map(String):null==t?[]:[String(t)];return void Array.from(e.options).forEach(e=>{e.selected=s.includes(e.value)})}e.value=t}else e.checked=t;else e.checked=null!=t&&e.getAttribute("value")===String(t)}static mutateIn(e,t){const s=oe.#se(e);for(const[e,r]of Object.entries(oe.flatten(t,"",new Set(s.keys()))))for(const t of s.get(e)??[])oe.mutate(t,r)}static#se(e){const t=new Map;for(const s of e.elements){const e=s.getAttribute("name");if(!e)continue;const r=t.get(e);r?r.push(s):t.set(e,[s])}return t}static errors(e,t,s){const r=t=>t.closest("form")===e;Array.from(e.querySelectorAll("ful-field-error")).filter(r).forEach(e=>{e.setAttribute("aria-live",s?"off":"polite")});const i=e=>("FIELD_ERROR"===e.type||"INVALID_FORMAT"===e.type)&&e.context,n=t.filter(i),a=t.filter(e=>!i(e)),o=oe.#se(e);for(const e of o.values())e.forEach(e=>{e.setCustomValidity?.("")});const l=[];n.forEach(e=>{const t=e.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=t.length;0!==s;--s){const r=t.slice(0,s).join("."),i=o.get(r)??[];if(0===i.length)continue;const n=t.slice(s).join(".");return void i.forEach(t=>{t.setCustomValidity?.(e.reason,n)})}l.push(e)});const u=[...a,...l];e.querySelectorAll("ful-errors").forEach(e=>{if(!r(e))return;const t=e;if(e.setAttribute("role","alert"),0===u.length)return e.replaceChildren(),void e.setAttribute("hidden","");e.removeAttribute("hidden"),t.innerText=u.map(e=>e.reason).join("\n")}),0!==t.length&&s&&Array.from(e.elements).filter(e=>e.matches(":invalid")).sort((e,t)=>e.getBoundingClientRect().y-t.getBoundingClientRect().y)[0]?.focus()}}class le extends S{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#re;#ie=null;#ne;#ae=[];#oe=null;#le;#ue;#ce;#de=[];constructor(){super(),this.internals.role=this.constructor.ROLE}#he(){return[this.#ue??this.#re,...this.#de].filter(e=>e)}#pe({fragment:e,control:t,error:s,label:r=null,described:i=null,claims:n=null,announces:a=t,freeze:o=null,also:l=[]}){if(this.#re=t,this.#le=s,this.#ue=n,this.#ce=a,this.#de=l,o&&o.addEventListener("click",e=>{this.readonly&&e.preventDefault()},!0),this.#ne=i??t,s&&(s.id=s.id||c.uid("ful-field-error"),this.#oe=s.id),this.#fe(),r&&le.#me(this,r,t),this.addEventListener("keydown",e=>{if("Enter"!==e.key||e.defaultPrevented||e.isComposing)return;const t=e.target;t.form!==this.form&&le.#ge(t)&&this._requestSubmit()}),this.replaceChildren(e),null!==this.#ie){const e=this.#ie;this.#ie=null,t.focus(e)}}static#ge(e){return e instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(e.type)}describedBy(e){return!!e&&(e.id||(e.id=c.uid("ful-described")),this.#ae.includes(e.id)||this.#ae.push(e.id),this.#fe(),!0)}#fe(){if(!this.#ne)return;const e=[...this.#ae,this.#oe].filter(e=>e);e.length&&this.#ne.setAttribute("aria-describedby",e.join(" "))}focus(e){this.#re?this.#re.focus(e):this.#ie=e??{}}setCustomValidity(e,t){if(c.set(this.#ce??this.#re,"aria-invalid",e?"true":null),!e)return this.internals.setValidity({}),void(this.#le.innerText="");this.internals.setValidity({customError:!0}," "),this.#le.innerText=e}get form(){return this.internals.form}_requestSubmit(){const e=this.form;if(!e)return;const t=e.querySelectorAll("button:not(:disabled), input:not(:disabled)");e.requestSubmit([...t].find(t=>"submit"===t.type&&t.form===e))}_notifyChange(e={}){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value,...e}}))}static#be=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#me(e,t,s){if(!le.#be.has(s.tagName)||"hidden"===s.getAttribute("type"))return t.id||(t.id=c.uid("ful-label")),s.setAttribute("aria-labelledby",t.id),void t.addEventListener("click",()=>e.focus());s.id||(s.id=c.uid("ful-control")),t.setAttribute("for",s.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}get value(){}set value(e){}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.reflectTo("disabled",e);for(const t of this.#he())t.toggleAttribute("disabled",e)}get readonly(){return this.hasAttribute("readonly")}set readonly(e){for(const t of this.#he())t.readOnly=e;this.#ce&&c.set(this.#ce,"aria-readonly",e?"true":null),this.reflectTo("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.#ce&&c.set(this.#ce,"aria-required",e?"true":null),this.reflectTo("required",e)}render(e){const t=this._build(e);if(t instanceof Promise)return t.then(e=>this.#pe(e));this.#pe(t)}_build(e){throw new Error(`${this.constructor.name} must implement _build`)}}class ue{#ve;#ye;#U;#we;#Ee;constructor(e,t,s,r,i){this.#ve=e,this.#ye=t,this.#U=s,this.#we=r,this.#Ee=i}prepare(e,t){return this.#we(e,t)}async submit(e,t){return await this.#ve.request(this.#U,this.#ye).json(e).fetch()}transform(e,t){return this.#Ee(e,t)}}class ce{#we;#Ee;constructor(e,t){this.#we=e,this.#Ee=t}async prepare(e,t){return await this.#we(e,t)}async submit(e,t,s){return s}async transform(e,t){return await this.#Ee(e,t)}}class de{static create(e,t){const s=e.component("http-client"),r=e.declared("request-mapper")?e.component(e.declared("request-mapper")):e=>e,i=e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e,n=e.declared("action");if(!n)return new ce(r,i);const a=e.declared("method")??"POST";return new ue(s,n,a,r,i)}}class he extends S{static attributes=["action","method","loader","request-mapper","response-mapper","clear-invalid-on-change:presence","scroll-on-error:presence","autocomplete"];form;render(){const e=document.createElement("form");this.form=e,e.setAttribute("novalidate",""),c.forward("form-",this,e),c.set(e,"autocomplete",this.declared("autocomplete")),e.replaceChildren(...this.childNodes),e.addEventListener("submit",async e=>{e.preventDefault(),e.stopPropagation(),await this.submit(e.submitter??void 0)}),this.addEventListener("click",e=>{const t=e.target;t.closest?.('[aria-disabled="true"]')&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.declared("clear-invalid-on-change")&&this.addEventListener("change",e=>{(e.target.form??e.target.internals?.form)===this.form&&e.target.setCustomValidity?.("")}),this.replaceChildren(e)}#xe=!1;async submit(e){if(this.#xe)return;let t,s;this.#xe=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);t=oe.extractFrom(this.form,e),s=await r.prepare(t,this);const i=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:e,values:t,request:s}});if(!this.dispatchEvent(i))return;this.errors=[];const n=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:i.detail.values,request:i.detail.request}});let a=await re.fireAsync(this,n,{mode:"pipeline"});s=n.detail.request,a=await r.submit(s,this,a);const o=await r.transform(a,this);this.dispatchEvent(new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,response:o}}))}catch(r){this.dispatchEvent(new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,exception:r}})),r instanceof P?this.errors=r.problems:console.warn("failed to submit form",this,"reason:",r)}finally{this.#xe=!1,this.spinner(!1)}}reset(){this.form.reset()}#Ae=0;#Se(e){if(c.defaultValue(e,"role","status"),e.hidden=!1,""!==e.textContent.trim())return;const t=document.createElement("span");t.className="ful-sr-only",t.dataset.ref="spinner-label",e.append(t),t.textContent=L.of().t("spinner.loading")}spinner(e){if(e){if(++this.#Ae,1!==this.#Ae)return}else if(this.#Ae=Math.max(0,this.#Ae-1),0!==this.#Ae)return;c.set(this,"aria-busy",e?"true":null),this.querySelectorAll("ful-spinner").forEach(t=>{if(t.closest("form")!==this.form)return;const s=t;e?this.#Se(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(t=>{const s=t;if(s.form===this.form&&("submit"===s.type||"reset"===s.type))if(e)s.dataset.wd=s.getAttribute("aria-disabled")??"",s.setAttribute("aria-disabled","true");else{if(void 0===s.dataset.wd)return;c.set(s,"aria-disabled",s.dataset.wd||null),delete s.dataset.wd}})}set values(e){oe.mutateIn(this.form,e)}get values(){return oe.extractFrom(this.form)}set errors(e){oe.errors(this.form,e,this.declared("scroll-on-error"))}}const pe=new t(100),fe=(e,t)=>pe.getOrCompute(`${e}:${t}`,()=>{try{return new RegExp(t,"g")}catch(s){return console.warn(`invalid ${e} attribute`,t,s),null}}),me={numeric:"numeric",decimal:"decimal"},ge=new Set(["date","time","datetime-local","month","week"]),be={numeric:e=>e.replace(/\D/g,""),decimal:e=>{const t=e.replace(/[^\d.,]/g,""),s=t.search(/[.,]/);return-1===s?t:t.slice(0,s+1)+t.slice(s+1).replace(/[.,]/g,"")}};class ve extends le{static observed=["placeholder"];static attributes=["type","v-type","keep","reject","uppercase:presence","trim:presence","unsigned:presence","autocomplete"];static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-if="type != \'textarea\'" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" placeholder=" " form=""></textarea>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_input;#Te=[];_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:e}){const t=this._type(),s=me[t],r=s?"text":t,i=this.template().withOverlay({type:r,slots:e}).render();this.#Te=[...i.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#Te[0];const n=this.declared("autocomplete")??(this.closest("form")?.getAttribute("autocomplete")??null);const a=(e=>{const t=e.declared("keep"),s=e.declared("reject");if(null!==t&&null!==s&&console.warn("a ful-input declares both keep and reject: keep is applied, reject is ignored",e),null!==t){const e=fe("keep",t);return e&&(t=>(t.match(e)??[]).join(""))}if(null!==s){const e=fe("reject",s);return e&&(t=>t.replace(e,""))}return((e,t)=>{const s=be[e];return s?t?s:e=>((e,t)=>(e.startsWith("-")?"-":"")+t(e))(e,s):null})(e._type(),e.declared("unsigned"))})(this);for(const e of this.#Te)this.#Ce(e,s,n,a);return{fragment:i,control:this._input,error:i.querySelector("ful-field-error"),label:i.querySelector("label")}}#Ce(e,t,s,r){t&&c.set(e,"inputmode",t),c.set(e,"autocomplete",s);const i=e.id;c.forward("input-",this,e),e!==this._input&&c.set(e,"id",i||null),this.#_e(e),e.addEventListener("input",()=>{if(!r)return;const t=e.value,s=r(t);if(t===s)return;const i=e.selectionStart;if(e.value=s,null===i)return;const n=r(t.slice(0,i)).length;e.setSelectionRange(n,n)})}#_e(e){if(!ge.has(e.type))return void e.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});let t=null,s=!1;const r=()=>{s=!1;const e=JSON.stringify(this.value);e!==t&&(t=e,this._notifyChange())};e.addEventListener("focus",()=>{t=JSON.stringify(this.value)}),e.addEventListener("keydown",e=>{"Enter"!==e.key||e.isComposing?s=!0:r()}),e.addEventListener("blur",r),e.addEventListener("change",e=>{e.stopPropagation(),s||r()})}get value(){const e=this.declared("uppercase"),t=this.declared("trim"),s=this._input.value,r=e?s.toUpperCase():s,i=t?r.trim():r;if(""===i)return null;const n="decimal"===this._type()?i.replaceAll(",","."):i;if("number"===this.declared("v-type")){const e=Number(n);return Number.isNaN(e)?n:e}return n}set value(e){this._input.value=""===e||null==e?"":`${e}`}get placeholder(){const e=this._input.getAttribute("placeholder");return" "===e?null:e}set placeholder(e){for(const t of this.#Te)c.set(t,"placeholder",e??" ");this.reflectTo("placeholder",e)}}const ye=e=>""===e?null:e;class we extends S{static attributes=["locale","default"];render(){const e=this.textContent.trim(),[t,s,r]=e.split("-").map(Number),i=""===e?null:new Date(t,s-1,r);if(null===i||Number.isNaN(i.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:n}=L.of({locale:this.declared("locale")??void 0});this.replaceChildren(n(i,{year:"numeric",month:"numeric",day:"numeric"}))}}class Ee extends S{static attributes=["locale","default"];render(){const e=this.textContent.trim(),t=""===e?null:new Date(Ee.isoToLocal(e));if(null===t||Number.isNaN(t.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=L.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#Oe(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date(e)}static isoToLocal(e){const t=Ee.#Oe(e),s=(e,t)=>String(t).padStart(e,"0");return`${t.getFullYear()}-${s(2,t.getMonth()+1)}-${s(2,t.getDate())}T${s(2,t.getHours())}:${s(2,t.getMinutes())}:${s(2,t.getSeconds())}.${s(3,t.getMilliseconds())}`}static localToIso(e){const t=Ee.#Oe(e);return Number.isNaN(t.getTime())?null:t.toISOString()}}class xe extends ve{static observed=["step","min","max"];_type(){return"date"}get min(){return ye(this._input.min)}set min(e){this._input.min=xe.#qe(e)}get max(){return ye(this._input.max)}set max(e){this._input.max=xe.#qe(e)}get step(){return ye(this._input.step)}set step(e){this._input.step=e??""}static#qe(e){if(!e)return"";const t=e=>new Date(e.getTime()-6e4*e.getTimezoneOffset()).toISOString().split("T")[0];if("now"===e)return t(new Date);const s=/^([+-])(\d+)([dmy])$/.exec(e);if(!s)return e;const r="-"===s[1]?-1:1,i=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+i*r);break;case"m":{const e=n.getDate();n.setMonth(n.getMonth()+i*r),n.getDate()!==e&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+i*r)}return t(n)}}class Ae extends xe{_type(){return"time"}get min(){return ye(this._input.min)}set min(e){this._input.min=this.#ke(e)}get max(){return ye(this._input.max)}set max(e){this._input.max=this.#ke(e)}#ke(e){if(!e)return"";const t=new Date;if("now"!==e){const s=/^([+-])(\d+)([hm])$/.exec(e);if(!s)return e;const r="-"===s[1]?-1:1,i=+s[2]*r;"h"===s[3]?t.setHours(t.getHours()+i):t.setMinutes(t.getMinutes()+i)}return Ae.#Re(t,Number(this._input.step)||60)}static#Re(e,t){const s=e=>String(e).padStart(2,"0"),r=3600*e.getHours()+60*e.getMinutes()+e.getSeconds(),i=Math.floor(r/t)*t,n=s(Math.floor(i/3600)),a=s(Math.floor(i%3600/60));return t%60==0?`${n}:${a}`:`${n}:${a}:${s(i%60)}`}}class Se extends ve{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){return Ee.localToIso(this._input.value)}set value(e){super.value=e?Ee.isoToLocal(e):""}get min(){return Ee.localToIso(this._input.min)}set min(e){this._input.min=e?Ee.isoToLocal(e):""}get max(){return Ee.localToIso(this._input.max)}set max(e){this._input.max=e?Ee.isoToLocal(e):""}get step(){return ye(this._input.step)}set step(e){this._input.step=e??""}}class Te extends ve{static WARNING_TIMEOUT=5e3;static list(e=[]){const t=new DataTransfer;for(const s of e)t.items.add(s);return t.files}static observed=["placeholder","accept:csv","multiple:presence","item-list:presence","dropzone:presence","max-files:number","max-file-size:number","max-total-size:number","value"];#Le;#Ne;#Pe;#Me;#Fe;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#ze;_build(e){const t=super._build(e),s=t.fragment;return this.#Ne=s.querySelector("ful-item-list"),this.#ze=e.slots?.items&&!u.isBlank(e.slots.items)?x.fromFragment(e.slots.items):null,this.#Pe=s.querySelector("[data-ref=dropzone]"),this.#Me=s.querySelector("ful-field-warnings"),this.#Fe=s.querySelector("ful-control-group"),this.#Me.addEventListener("animationend",e=>{e.target.remove()}),this.#Ne.addEventListener("click",e=>{if(!e.target.closest("button"))return;if(!this._interactive())return;const t=[...this.#Ne.children].indexOf(e.target.closest("ful-item"));-1!==t&&(this.files=Te.list([...this.files].filter((e,s)=>s!==t)),this._notifyChange())}),this.#Pe.addEventListener("click",e=>{this._interactive()&&this._input.click()}),this.#Pe.addEventListener("dragover",e=>{e.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#Pe.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#Pe.addEventListener("drop",e=>{if(e.preventDefault(),this.toggleAttribute("dragover",!1),!this._interactive())return;const t=[...e.dataTransfer.items].filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e);0===t.length||t.length>1&&!this.multiple||(this.files=Te.list(t),this._notifyChange())}),this._input.addEventListener("change",e=>{this.#De()}),{...t,freeze:this.#Fe}}#De(){this.setCustomValidity(),this.#Me.replaceChildren(),this.#Ie(),this.#$e(),this.#Be(),this.#je(),(this.#ze??this.template("items")).withOverlay({files:this.files}).renderTo(this.#Ne)}warning(e,t){this.template("warning").withOverlay({key:e,args:t}).appendTo(this.#Me);const s=this.#Me.lastElementChild;setTimeout(()=>s.remove(),Te.WARNING_TIMEOUT)}#He(e){const t=e.name.toLowerCase();return this.#Le.some(s=>{const r=s.toLowerCase().split(";")[0].trim();return r.startsWith(".")?t.endsWith(r):r.endsWith("/*")?e.type.startsWith(`${r.slice(0,-1)}`):r.includes("/")&&e.type===r})}#Ie(){if(!this.#Le.length)return;const e=[...this.files].filter(e=>!this.#He(e));0!==e.length&&(this.warning("files.unacceptable-file-type",{types:this.#Le.join(", ")}),this._input.files=Te.list([...this.files].filter(t=>!e.includes(t))))}#je(){null!==this.#We&&(this.files.length<=this.#We||(this.warning("files.max-files-exceeded",{count:this.#We}),this._input.files=Te.list()))}#$e(){if(null===this.#Ve)return;const e=[...this.files].filter(e=>e.size>this.#Ve);0!==e.length&&(this.warning("files.max-file-size-exceeded",{size:L.of().bytes(this.#Ve)}),this._input.files=Te.list([...this.files].filter(t=>!e.includes(t))))}#Be(){null!==this.#Ue&&([...this.files].reduce((e,t)=>e+t.size,0)<=this.#Ue||(this.warning("files.max-total-size-exceeded",{size:L.of().bytes(this.#Ue)}),this._input.files=Te.list()))}get accept(){return this.#Le}set accept(e){this._input.accept=e.join(","),this.#Le=e,this.reflectTo("accept",e)}get multiple(){return this._input.multiple}set multiple(e){this._input.multiple=e,this.reflectTo("multiple",e)}get files(){return this._input.files}set files(e){this._input.files=e,this.#De()}get file(){return this.files[0]??null}set file(e){this.files=Te.list(e?[e]:[])}get value(){const e=Array.from(this._input.files).map(e=>e.name);return this.multiple?e:e[0]??null}set value(e){e||(this.files=Te.list())}formResetCallback(){this.value=null}get totalsize(){return Array.from(this.files).reduce((e,t)=>e+t.size,0)}#We;get maxFiles(){return this.#We}set maxFiles(e){this.#We=e,this.reflectTo("max-files",e)}#Ve;get maxFileSize(){return this.#Ve}set maxFileSize(e){this.#Ve=e,this.reflectTo("max-file-size",e)}#Ue;get maxTotalSize(){return this.#Ue}set maxTotalSize(e){this.#Ue=e,this.reflectTo("max-total-size",e)}#Ge;get itemList(){return this.#Ge}set itemList(e){this.#Ge=e,this.reflectTo("item-list",e)}#Qe;get dropzone(){return this.#Qe}set dropzone(e){this.#Qe=e,this.reflectTo("dropzone",e)}}const Ce=new Map;let _e=0,Oe=!1;const qe=(e,t,s)=>Math.min(Math.max(e,t),Math.max(t,s)),ke=(e,t)=>{const{invoker:s,stretch:r}=t,i=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,o=n.clientHeight;e.style.removeProperty("margin");const l=getComputedStyle(e),u=parseFloat(l.marginTop)||0,c=parseFloat(l.marginRight)||0,d=parseFloat(l.marginBottom)||0,h=parseFloat(l.marginLeft)||0;if(e.style.right="auto",e.style.bottom="auto",e.style.margin="0",r){e.style.removeProperty("width"),e.style.removeProperty("min-width"),e.style.removeProperty("max-width");const t=Math.min(parseFloat(l.maxWidth)||a,a-16);e.style.minWidth=`${Math.min(i.width,a-16)}px`,e.style.maxWidth=`${t}px`;const s=e.getBoundingClientRect().width;e.style.left=`${qe(i.left,8,a-s-8)}px`;const r=e.getBoundingClientRect().height,n=i.bottom+u,c=n+r<=o-8?n:i.top-d-r;return void(e.style.top=`${qe(c,8,o-r-8)}px`)}const p=(e=>e.matches("ful-note, .ful-note, [placement]"))(e),f=p?e.getAttribute("placement")??"bottom":"bottom";e.style.removeProperty("max-width");const m=Math.min(parseFloat(l.maxWidth)||a,a-16);e.style.maxWidth=`${m}px`,e.style.left="8px";const g=e.getBoundingClientRect().width;let b="right"===f?i.right+h:"left"===f?i.left-c-g:p?i.left+i.width/2-g/2:i.left;b=qe(b,8,a-g-8),e.style.left=`${b}px`,e.style.maxWidth=`${Math.min(m,a-8-b)}px`;const v=e.getBoundingClientRect().height,y="top"===f?i.top-d-v:"right"===f||"left"===f?i.top+i.height/2-v/2:i.bottom+u;e.style.top=`${qe(y,8,o-v-8)}px`,p&&((e,t)=>{const s=t.getBoundingClientRect(),r=e.getBoundingClientRect();e.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-r.left-e.clientLeft+"px"),e.style.setProperty("--ful-note-callout-block",s.top+s.height/2-r.top-e.clientTop+"px")})(e,s)},Re=()=>{_e=0;for(const[e,t]of Ce)e.isConnected&&t.invoker.isConnected?ke(e,t):Ce.delete(e)},Le=()=>{!_e&&Ce.size>0&&(_e=requestAnimationFrame(Re))};class Ne{static wire(e,t,{prefix:s="ful-anchor",invoke:r=!1,expanded:i=!1,stretch:n=!1,handPlace:a=!1}={}){const o=c.uid(s);r&&(t.id=t.id||o,"button"===e.localName||"input"===e.localName?e.setAttribute("popovertarget",t.id):(e.addEventListener("click",()=>t.togglePopover()),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.togglePopover())})));const l=`--${o}`;if(e.style.anchorName=l,t.style.positionAnchor=l,i&&(e.setAttribute("aria-expanded","false"),t.addEventListener("toggle",t=>{e.setAttribute("aria-expanded","open"===t.newState?"true":"false")})),!a&&CSS.supports("anchor-name: --ful-probe")&&CSS.supports("position-anchor: --ful-probe")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)")&&CSS.supports("width: anchor-size(width)"))return;const u={invoker:e,stretch:n};t.addEventListener("beforetoggle",e=>{"open"===e.newState&&((e,t)=>{e.style.visibility="hidden",queueMicrotask(()=>{e.matches(":popover-open")&&ke(e,t),e.style.removeProperty("visibility")})})(t,u)}),t.addEventListener("toggle",e=>{"open"===e.newState?(Ce.set(t,u),ke(t,u)):(Ce.delete(t),(e=>{for(const t of["top","left","right","bottom","margin","max-width","min-width","width","visibility","--ful-note-callout-inline","--ful-note-callout-block"])e.style.removeProperty(t)})(t))}),Oe||(Oe=!0,document.addEventListener("scroll",Le,!0),window.addEventListener("resize",Le))}static show(e,t,{flip:s=!1,gap:r=0}={}){return"function"!=typeof e.showPopover||e.matches(":popover-open")||e.showPopover(),(()=>{const i=t instanceof Element?t.getBoundingClientRect():t,n=document.documentElement,a=e.getBoundingClientRect(),o=i.bottom+r,l=i.top-r-a.height,u=s&&o+a.height>n.clientHeight-8&&l>=8?l:o;e.style.right="auto",e.style.bottom="auto",e.style.margin="0",e.style.left=`${qe(i.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,e.style.top=`${qe(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),e}}const Pe=(e,t)=>e.filter(({key:e})=>t.some(t=>t==e)),Me=(e,t)=>e.filter(({label:e})=>(e??"").toLowerCase().includes(t?.toLowerCase()??""));class Fe{#ve;#ye;#U;#Ee;#Ke;#Je;#C=null;#Xe=null;#Ye=new ie;constructor({http:e,url:t,method:s,responseMapper:r,prefetch:i,revision:n}){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r,this.#Ke=i,this.#Je=n}async prefetch(){this.#Ke&&await this.#Ze()}async exact(...e){return Pe(await this.#Ze(),e)}async load(e){return Me(await this.#Ze(),e)}async invalidate(){this.#Ye.invalidate(),this.#C=null,this.#Xe=null}async#Ze(){if(null===this.#C){if(null===this.#Xe){const e=this.#Ye.hold();this.#Xe=Fe.#et(this.#ve,this.#U,this.#ye,this.#Je).then(t=>{e.stale||(this.#C=this.#Ee(t))}).finally(()=>{e.stale||(this.#Xe=null)})}await this.#Xe}if(null===this.#C)throw new Error("superseded by an invalidation");return this.#C}static async#et(e,t,s,r){const i=`${t}@${s}`;if(null!==r){const e=te.load(i,r);if(void 0!==e)return e}const n=await e.request(t,s).fetchJson();if(null!==r)try{te.save(i,r,n)}catch(e){console.warn("failed to cache the select options",e)}return n}}class ze{#ve;#ye;#U;#Ee;constructor({http:e,url:t,method:s,responseMapper:r}){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r}async invalidate(){}async exact(...e){const t=await this.#ve.request(this.#U,this.#ye).param("k",...e).fetchJson();return this.#Ee(t)}async load(e){const t=await this.#ve.request(this.#U,this.#ye).param("s",e).fetchJson();return this.#Ee(t)}}class De{#C;constructor(e){this.#C=e}update(e){this.#C=e}async invalidate(){}exact(...e){return Pe(this.#C,e)}load(e){return Me(this.#C,e)}}class Ie{static from({data:e,http:t,url:s,method:r="POST",mode:i,prefetch:n=!1,revision:a=null,responseMapper:o}){return s?"chunked"===i?new ze({http:t,url:s,method:r,responseMapper:o}):new Fe({http:t,url:s,method:r,responseMapper:o,prefetch:n,revision:a}):new De(e??[])}static create(e,t){if(!e.declared("src")){const e=Array.from(t.options?.querySelectorAll("option")??[]);return Ie.from({data:e.map(e=>({key:e.getAttribute("value")??e.innerText.trim(),label:e.innerText.trim(),metadata:void 0}))})}return Ie.from({http:e.component("http-client"),url:e.declared("src"),method:e.declared("method")??"POST",mode:e.declared("mode"),prefetch:e.declared("preload"),revision:Ie.#tt(e),responseMapper:Ie.#st(e)})}static#tt(e){const t=e.declared("revision");if(""!==t)return t;const s=e.component("revision");return null==s?(console.warn("a valueless revision asks the registry for one, and no 'revision' component is defined: the vocabulary will not be cached",e),null):"function"==typeof s?s():s}static#st(e){return e.declared("k-expr")&&e.declared("l-expr")?t=>e._registry.evaluator().withOverlay(t).evaluateExpression(e.declared("d-expr")??"self").map(t=>{const s=e._registry.evaluator().withOverlay(t);return{key:s.evaluateExpression(e.declared("k-expr")),label:s.evaluateExpression(e.declared("l-expr")),metadata:s.evaluateExpression(e.declared("m-expr")??"self")}}):e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e.map(([e,t,s])=>({key:e,label:t,metadata:s}))}}class $e extends S{static attributes=["listbox"];static slots=!0;static template='\n <ful-spinner class="centered" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <ful-empty data-ref="empty" aria-live="polite" hidden>{{ #l10n:t(\'dropdown.empty\') }}</ful-empty>\n <menu tabindex="-1" role="listbox" hidden></menu>\n ';static templates={options:'\n <li data-tpl-each="self" data-tpl-selected="index == 0" data-tpl-value="index" role="option">\n {{ label }}\n </li>\n '};#rt;#it;#nt;#at;#X=new Map;#ot=new ie;render({slots:e}){const t=this.template().render();this.#at=u.isBlank(e.default)?this.template("options"):x.fromFragment(e.default),this.#rt=t.querySelector("ful-spinner"),this.#nt=t.querySelector("[data-ref=empty]"),this.#it=t.querySelector("menu"),this.#it.id=this.declared("listbox")||c.uid("ful-listbox"),this.#it.addEventListener("mousedown",e=>{e.target.closest("li")&&e.preventDefault()}),this.#it.addEventListener("click",e=>{e.stopPropagation();const t=e.target.closest("li");t?t.matches('[aria-disabled="true"]')||this.#lt(t):this.hide()}),this.replaceChildren(t)}#ut(){return this.#it?.querySelector('[selected]:not([aria-disabled="true"])')??this.#it?.querySelector('li:not([aria-disabled="true"])')??null}#ct(e){if(e){for(const t of this.#it.querySelectorAll("li"))t.toggleAttribute("selected",t===e);e.id||=c.uid("ful-option"),this.#dt(e.id),e.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#dt(null)}acceptSelection(){const e=this.#ut();e&&this.#lt(e)}update(e,t=[]){if(void 0===e)throw new Error("null data");this.#X=new Map(e.map((e,t)=>[String(t),e]));const s=e.map((e,t)=>({index:t,...e}));this.#at.withOverlay(s).renderTo(this.#it);for(const[s,r]of[...this.#it.children].entries()){const i=e[s],n=t.some(e=>e==i?.key);r.toggleAttribute("picked",n),r.setAttribute("aria-selected",n?"true":"false");const a=!!i?.metadata?.disabled;a?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"),a&&i.metadata.reason?r.setAttribute("title",String(i.metadata.reason)):r.removeAttribute("title")}this.#nt.toggleAttribute("hidden",0!==e.length),this.#it.toggleAttribute("hidden",0===e.length);const r=e.findIndex(({key:e})=>t.some(t=>t==e));this.#ct(r>=0?this.#it.children[r]:this.#ut())}#lt(e){const t=e.getAttribute("value"),s=this.#X.get(t);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:t,entry:s}}))}hide(){this.#ot.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#dt(null)}#dt(e){this.dispatchEvent(new CustomEvent("activechange",{bubbles:!1,cancelable:!1,detail:{id:e}}))}get shown(){return this.matches(":popover-open")}async show(e,t=[]){const s=this.#ot.take();this.matches(":popover-open")||this.showPopover(),this.#it.setAttribute("hidden",""),this.#rt.removeAttribute("hidden");try{const r=await e();if(s.stale)return;this.update(r,t)}catch(e){if(s.stale)return;throw this.hide(),e}finally{s.stale||this.#rt.setAttribute("hidden","")}}async moveOrShow(e,t,s=[]){if(this.shown){const t=this.#ut(),s=t?.[(e?"next":"previous")+"ElementSibling"],r=s?this.#ht(s,e):null;return void(t&&r&&this.#ct(r))}await this.show(t,s)}#ht(e,t){for(let s=e;s;s=s[(t?"next":"previous")+"ElementSibling"])if(!s.matches('[aria-disabled="true"]'))return s;return null}jump(e){const t=e?this.#it.firstElementChild:this.#it.lastElementChild,s=this.#ht(t,e);s&&this.#ct(s)}page(e){const t=this.#ut();if(!t)return;let s=t;for(let t=0;t!==this.#pt();++t){const t=this.#ht(s[(e?"next":"previous")+"ElementSibling"],e);if(!t)break;s=t}this.#ct(s)}#pt(){const e=this.#it.firstElementChild;return e&&0!==e.offsetHeight?Math.max(1,Math.trunc(this.#it.clientHeight/e.offsetHeight)):1}}class Be extends le{static attributes=["name","loader","k-type","mode","preload:presence","revision","k-expr","l-expr","d-expr","m-expr","response-mapper"];static observed=["multiple:presence","item-list:presence","value:csv","src","method"];unmarshal(e,t){return"value"!==e||""!==t||this.hasAttribute("multiple")?super.unmarshal(e,t):[""]}static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-control>\n <input type="text" form="" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n <ful-dropdown popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </ful-control-group>\n <ful-item-list></ful-item-list>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="entries" data-tpl-var="entry" data-tpl-data-key="entry.key">\n <div><span>{{ entry.label }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'select.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n '};#ft;#mt={src:null,method:null};#X;#re;#gt;#bt;#Ne;#ze;#vt;#yt=!1;#wt=new Map;#Et=new ie;#xt=!1;#At;#St;_build({slots:e}){const t=this.declared("name");this.#X=e.options,this.#Tt(),this.#vt=this.declared("multiple"),this.#ft.prefetch?.()?.catch(e=>{console.warn("failed to prefetch select options",this,"reason:",e)});const s=this.template().withOverlay({slots:e,name:t}).render();this.#bt=s.querySelector("ful-control > input"),this.#Ne=s.querySelector("ful-item-list"),this.#ze=e.items&&!u.isBlank(e.items)?x.fromFragment(e.items):null,c.forward("input-",this,this.#bt),this.#re=s.querySelector("ful-control"),this.#gt=s.querySelector("ful-dropdown");const r=c.uid("ful-listbox");this.#gt.setAttribute("listbox",r),this.#bt.setAttribute("aria-controls",r),this.#gt.addEventListener("beforetoggle",e=>{const t="open"===e.newState;this.#bt.setAttribute("aria-expanded",t?"true":"false"),t||this.#bt.removeAttribute("aria-activedescendant")}),this.#gt.addEventListener("activechange",e=>{c.set(this.#bt,"aria-activedescendant",e.detail.id)});const i=s.querySelector("ful-control-group");return Ne.wire(i,this.#gt,{prefix:"ful-select",stretch:!0}),[this.#At,this.#St]=ae.throttle(400,()=>this.#Ct()),this.#_t(),this.#Ot(),this.#qt(),this.#kt(),{fragment:s,control:this.#bt,error:s.querySelector("ful-field-error"),label:s.querySelector("label")}}#_t(){this.addEventListener("click",e=>{if(!this._interactive())return;const t=e.target.closest('button, [role="button"], a[href], input, select, textarea');t&&t!==this.#bt||(this.#gt.shown?this.#Rt():(this.#bt.focus(),this.#At()))}),this.#Ne.addEventListener("click",e=>{e.stopPropagation(),e.target.closest("button")&&this._interactive()&&this.#Lt([...this.#Ne.children].indexOf(e.target.closest("ful-item")))}),this.#re.addEventListener("click",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t&&(e.stopPropagation(),this.#Nt(t))})}#Ot(){this.addEventListener("keydown",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t?this.#Pt(e,t):"ArrowLeft"===e.code&&e.target===this.#bt&&0===this.#bt.selectionStart&&0===this.#bt.selectionEnd&&this.#Mt().at(-1)?.focus()})}#qt(){this.#bt.addEventListener("change",e=>{e.stopPropagation()}),this.#bt.addEventListener("focus",()=>{this.#xt||this.#bt.select()}),this.#bt.addEventListener("blur",e=>{e.stopPropagation(),e.relatedTarget&&this.contains(e.relatedTarget)||(this.#St(),this.#Rt(!0))}),this.#bt.addEventListener("keydown",e=>{this._interactive()&&this.#Ft(e)}),this.#bt.addEventListener("input",e=>{e.stopPropagation(),this._interactive()&&(this.#xt=!0,this.#At())})}#kt(){this.#gt.addEventListener("change",e=>{e.stopPropagation(),this._interactive()?(this.#vt||this.#wt.clear(),this.#xt=!1,this.#wt.set(this.#zt(e.detail.entry.key),e.detail.entry),this.#Dt(),this.#bt.focus(),this.#gt.hide(),this.#vt||this.#bt.select()):this.#Rt()})}async withLoader(e){return await e(this.#ft)}async reload(){await(this.#ft.invalidate?.()),await(this.#ft.prefetch?.());const e=[...this.#wt.keys()];0!==e.length&&await this.#i(e,this.#Et.take())}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#It()&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#It()&&this.reload()}async reconfigure(e,{notify:t=!1}={}){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);this.#It();const s=[...this.#wt.keys()];await this.reload();const r=[...this.#wt.keys()];t&&r.length!==s.length&&this._notifyChange({entry:this.entry})}#Tt(){this.#mt={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#ft=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#X})}#It(){return(this.getAttribute("src")!==this.#mt.src||this.getAttribute("method")!==this.#mt.method)&&(this.#St(),this.#Rt(),this.#Tt(),!0)}#Mt(){return Array.from(this.#re.querySelectorAll(":scope > ful-badge"))}#Nt(e){this._interactive()&&this.#Lt(this.#Mt().indexOf(e))}#Lt(e){const t=Array.from(this.#wt.keys())[e];void 0!==t&&(this.#wt.delete(t),this.#Dt())}#Pt(e,t){switch(e.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":e.preventDefault(),this.#Nt(t),this.#bt.focus();break;case"ArrowLeft":e.preventDefault(),(this.#Mt()[this.#Mt().indexOf(t)-1]??this.#bt).focus();break;case"ArrowRight":e.preventDefault(),(this.#Mt()[this.#Mt().indexOf(t)+1]??this.#bt).focus();break;case"Escape":this.#bt.focus()}}#Ft(e){switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),this.#$t(e);break;case"Home":this.#gt.shown&&(e.preventDefault(),this.#gt.jump(!0));break;case"End":this.#gt.shown&&(e.preventDefault(),this.#gt.jump(!1));break;case"PageDown":case"PageUp":this.#gt.shown&&(e.preventDefault(),this.#gt.page("PageDown"===e.code));break;case"Escape":this.#St(),this.#Rt();break;case"NumpadEnter":case"Enter":if(!this.#gt.shown)return;e.preventDefault(),this.#xt=!1,this.#Bt(),this.#gt.acceptSelection();break;case"Backspace":0===this.#bt.selectionStart&&0===this.#bt.selectionEnd&&this.#Lt(this.#wt.size-1);break;case"Tab":this.#St(),this.#Rt(!0)}}#$t(e){const t="ArrowDown"===e.code;e.altKey?t&&!this.#gt.shown?this.#Ct():!t&&this.#gt.shown&&this.#Rt():this.#gt.moveOrShow(t,()=>this.#ft.load(this.#jt()),[...this.#wt.keys()])}#Rt(e=!1){this.#gt.hide();const t=e&&this.#xt&&!this.#vt&&""===this.#bt.value&&0!==this.#wt.size;this.#xt=!1,t&&(this.#wt.clear(),this.#Dt()),this.#Bt()}#Ct(){return this.#gt.show(()=>this.#ft.load(this.#jt()),[...this.#wt.keys()])}#jt(){return this.#xt?this.#bt.value:""}get query(){return this.#jt()}#Bt(){const e=this.#wt.values().next().value;this.#bt.value=this.#vt?"":e?.label??""}#Ht(){return[...this.#wt.values()]}#Dt(){this.#Wt(),this._notifyChange({entry:this.entry})}#Wt(){const e=this.#vt?Array.from(this.#wt.entries()).map(([e,t],s)=>{const r=document.createElement("ful-badge");return r.setAttribute("role","button"),r.setAttribute("tabindex",0===s?"0":"-1"),r.setAttribute("value",e),r.innerText=t.label,r}):[];for(const e of this.#re.querySelectorAll(":scope > ful-badge"))e.remove();this.#bt.before(...e),this.#xt||this.#Bt(),this.#Ne.replaceChildren(),(this.#ze??this.template("items")).withOverlay({entries:this.#Ht()}).renderTo(this.#Ne)}#zt(e){switch(this.declared("k-type")){case"number":{const t=""===e?Number.NaN:Number(e);return Number.isNaN(t)?e:t}case"boolean":return!0===e||"true"===e||!1!==e&&"false"!==e&&e;default:return String(e)}}set value(e){const t=(null==e?[]:Array.isArray(e)?e:[e]).map(e=>this.#zt(e));!this.#yt&&t.some(e=>"string"==typeof e&&e.includes(","))&&(this.#yt=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#wt=new Map(t.map(e=>[e,{key:e,label:e,metadata:void 0}]));const s=this.#Et.take();this.#re&&(this.#Wt(),0!==t.length&&this.#i(t,s))}async#i(e,t){const s=await this.#ft.exact(...e);if(t.stale)return;const r=new Map(s.map(e=>[this.#zt(e.key),e]));for(const t of e)this.#wt.has(t)&&(r.has(t)?this.#wt.set(t,r.get(t)):this.#wt.delete(t));this.#Wt()}get value(){return this.#vt?[...this.#wt.keys()]:[...this.#wt.keys()][0]??null}get entry(){const e=this.#Ht();return this.#vt?e:e[0]??null}#Ge;get multiple(){return this.#vt}set multiple(e){this.#vt=e,this.reflectTo("multiple",e)}get itemList(){return this.#Ge}set itemList(e){this.#Ge=e,this.reflectTo("item-list",e)}}class je extends le{static attributes=["name","type"];static slots=!0;static ROLE="radiogroup";static template='\n <fieldset>\n <legend>\n {{{{ slots.default }}}}\n </legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <ful-radio-list>\n <div class="label-wrapper" data-tpl-each="inputsAndLabels" data-tpl-var="ial">\n <label>\n {{{{ ial[0] }}}}\n <div>{{{{ ial[1] }}}}</div>\n </label>\n </div>\n </ful-radio-list>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';#Vt;#Ut;#Gt;_build({slots:e}){const t=this.declared("name")??c.uid("ful-radiogroup"),s=Array.from(e.default.querySelectorAll("ful-radio")),r=s.map(e=>{const s=document.createElement("input");return s.setAttribute("type","radio"),c.forward("input-",this,s),c.forward("",e,s),s.setAttribute("name",`${t}-ignore`),s.setAttribute("form",""),s.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()}),[s,u.fromChildNodes(e)]});s.forEach(e=>{e.remove()});const i=this.template().withOverlay({name:t,slots:e,inputsAndLabels:r}).render();return this.#Vt=i.firstElementChild,this.#Ut=i.querySelector("input[type=radio]"),this.#Gt="boolean"===this.declared("type"),{fragment:i,control:this.#Ut,error:i.querySelector("ful-field-error"),described:this,claims:this.#Vt,announces:this,freeze:this.#Vt}}get value(){const e=this.querySelector("input[type=radio]:checked");return e?this.#Gt?"true"===e.value:e.value:null}set value(e){const t=this.querySelectorAll("input[type=radio]"),s=()=>{t.forEach(e=>{e.checked=!1})};if(null===e)return void s();const r=this.querySelector(`input[type=radio][value=${CSS.escape(String(e))}]`);null!==r?r.checked=!0:s()}}class He extends le{static attributes=["type"];static observed=["value:bool"];static slots=!0;static template='\n <ful-choice data-tpl-switch="isSwitch">\n <input type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </ful-choice>\n <ful-field-error></ful-field-error>\n ';#Qt;#bt;_build({slots:e}){const t="switch"===this.declared("type"),s=this.template().withOverlay({slots:e,isSwitch:t}).render();this.#Qt=s.firstElementChild,this.#bt=s.querySelector("input"),c.forward("input-",this,this.#bt),this.#bt.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});const r=s.querySelector("label");return{fragment:s,control:this.#bt,error:s.querySelector("ful-field-error"),label:r,freeze:this.#Qt}}get value(){return this.#bt.checked}set value(e){this.#bt.checked=e}}class We extends S{static attributes=["sorter"];static observed=["order"];#Kt;render(){const e=this.declared("sorter"),t=["asc","desc",null];this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",()=>{const s=t[(t.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort:requested",{bubbles:!0,cancelable:!1,detail:{value:{sorter:e,order:s}}}))}),this.addEventListener("keydown",e=>{["Enter","NumpadEnter","Space"].includes(e.code)&&(e.preventDefault(),this.click())})}get order(){return this.#Kt||null}set order(e){this.#Kt=e||null,this.reflectTo("order",this.#Kt);const t=this.closest("th");t&&c.set(t,"aria-sort",this.#Kt?"asc"===this.#Kt?"ascending":"descending":null)}}class Ve extends S{static observed=["total:number","current:number"];static attributes=["pages:number"];static config={prevIcon:"chevron-left",nextIcon:"chevron-right",reloadIcon:"arrow-clockwise"};static template='\n <ful-pagination-bar role="navigation" data-tpl-aria-label="#l10n:t(\'pagination.navigation\')">\n <ul>\n <li data-ref="index"> {{ #l10n:t(\'pagination.showing\', { \'current\': curr.label, \'total\': total }) }}</li>\n <li data-ref="reload"><button type="button" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button></li>\n <li data-ref="prev">\n <button type="button" data-tpl-disabled="prev.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.previous\')" data-tpl-data-page="prev.index">\n <ful-icon data-tpl-name="config.prevIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n <li data-ref="page" data-tpl-each="pages" data-tpl-var="page">\n <button type="button" data-tpl-aria-current="curr.index == page.index ? \'page\' : false" data-tpl-data-page="page.index" >\n {{ page.label }}\n </button>\n </li>\n <li data-ref="next">\n <button type="button" data-tpl-disabled="next.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.next\')" data-tpl-data-page="next.index">\n <ful-icon data-tpl-name="config.nextIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n </ul>\n </ful-pagination-bar>\n ';#Jt=0;#W=0;render(){this.addEventListener("click",e=>{const t=e.target.closest("button");t&&!t.hasAttribute("disabled")&&"page"!==t.getAttribute("aria-current")&&this.dispatchEvent(new CustomEvent("page:requested",{bubbles:!0,cancelable:!1,detail:{value:Number(t.dataset.page??this.#W)}}))})}update({current:e,total:t}={}){void 0!==e&&(this.#W=e??0),void 0!==t&&(this.#Jt=t??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#Jt);const s=this.#W,r=this.#Jt,i=this.declared("pages")??5,n=Math.max(r,1),a=s>0,o=s+1<n,l={index:a?s-1:null,enabled:a},u={index:s,label:s+1},c={index:o?s+1:null,enabled:o},d=Math.max(1,Math.min(i,n)),h=Math.max(0,Math.min(s-Math.floor((d-1)/2),n-d)),p=Array.from({length:d},(e,t)=>({index:h+t,label:h+t+1})),f=this.contains(document.activeElement)?document.activeElement.closest("li")?.getAttribute("data-ref"):null,m="page"===f?document.activeElement.dataset.page:null;if(this.template().withOverlay({total:n,prev:l,curr:u,next:c,pages:p}).renderTo(this),!f)return;const g=(null===m?null:this.querySelector(`li[data-ref=page] button[data-page="${m}"]`))??this.querySelector(`li[data-ref=${f}] button:not(:disabled)`)??this.querySelector("li[data-ref=page] button[aria-current=page]");g?.focus()}get total(){return this.#Jt}set total(e){this.update({total:e})}get current(){return this.#W}set current(e){this.update({current:e})}}class Ue{static parse(e,t){const s=e?h.queryChildren(e,"schema"):null;if(!s)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const r=document.createElement("tr"),i=document.createElement("tr");i.setAttribute("data-tpl-each","rows");for(const e of s.getAttributeNames()){const t=s.getAttribute(e);r.setAttribute(e,t??""),i.setAttribute(e,t??"")}const n=h.queryChildrenAll(s,"column"),a=n.filter(e=>e.hasAttribute("order")&&e.hasAttribute("sorter")).map(e=>({sorter:e.getAttribute("sorter"),order:e.getAttribute("order")}))[0]??null;for(const e of n){const t=h.queryChildren(e,"title"),s=e.getAttribute("sorter"),n=e.getAttribute("order"),a=t??document.createTextNode(e.getAttribute("title")??"");t?.remove(),e.removeAttribute("sorter"),e.removeAttribute("order"),e.removeAttribute("title");const o=s||n?(()=>{const e=document.createElement("ful-sorter");return s&&e.setAttribute("sorter",s),n&&e.setAttribute("order",n),e.append(a),e})():a,l=document.createElement("th"),u=document.createElement("td");for(const t of e.getAttributeNames()){const s=e.getAttribute(t);l.setAttribute(t,s??""),u.setAttribute(t,s??"")}l.append(o),u.append(...e.childNodes),r.append(l),i.append(u)}return{headersTemplate:t.withOverlay({inHeaders:!0,inRows:!1}).withFragment(u.from(r)),rowsTemplate:t.withOverlay({inHeaders:!1,inRows:!0}).withFragment(u.from(i)),sort:a,length:n.length}}}class Ge{#C;constructor(e){this.#C=e}async load(e,t,s){const r=this.#Xt(t),i=e.page*e.size,n=i+e.size;return{data:r.slice(i,n),size:r.length}}#Xt(e){if(!e?.sorter)return this.#C;const{sorter:t,order:s}=e,r="desc"===s?-1:1;return[...this.#C].sort((e,s)=>{const i=e?.[t],n=s?.[t];return i===n?0:null==i?1:null==n?-1:(i<n?-1:1)*r})}update(e){this.#C=e}}class Qe{#ve;#ye;#U;#Ee;constructor(e,t,s,r=e=>e){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r}async load(e,t,s){const r=Object.entries(s).filter(([e,t])=>t);return await this.#ve.request(this.#U,this.#ye).param("page",e.page).param("size",e.size).param("sort",t?`${t.sorter},${t.order}`:null).param("filters",r.length>0?JSON.stringify(Object.fromEntries(r)):null).fetchJson().then(e=>this.#Ee(e))}}class Ke{static create(e,t){const s=e.getAttribute("src");if(s){const t=e.component("http-client"),r=e.getAttribute("method")??"GET",i=e.hasAttribute("response-mapper")?e.component(e.getAttribute("response-mapper")):e=>e;return new Qe(t,s,r,i)}return new Ge([])}}class Je extends S{static attributes=["loader","autoload:presence"];static observed=["page-size:number","src","method"];static slots=!0;static config={searchIcon:"search",emptyIcon:"inbox"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <ful-table-wrapper>\n <table>\n <caption data-tpl-if="slots.caption">{{{{ slots.caption }}}}</caption>\n <thead></thead>\n <tbody></tbody>\n <tbody data-ref="initial">\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty>\n <ful-icon data-tpl-if="config.searchIcon" data-tpl-name="config.searchIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.initial\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="empty" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty data-tpl-if="slots.empty" data-ref="empty-authors"></ful-empty>\n <ful-empty data-tpl-if="!slots.empty">\n <ful-icon data-tpl-if="config.emptyIcon" data-tpl-name="config.emptyIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.no-data\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="loading" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-spinner class="big" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="feedback" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <div role="alert">\n <p>{{ #l10n:t(\'table.error\') }}</p>\n <div data-ref="feedback-error"></div>\n </div>\n </td>\n </tr>\n </tbody>\n <tfoot data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </tfoot>\n </table>\n </ful-table-wrapper>\n <ful-pagination current="0" total="1"></ful-pagination>\n ';static templates={row:"\n {{{{ schema.rowsTemplate.withOverlay({'rows': pageResponse.data}).render() }}}}\n "};#ft;#Yt;#J;#Zt;#es;#nt;#ts;#ss;#rs;#is;#ns;#as={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#os=!1;#ls=new ie;#mt={src:null,method:null};get pageSize(){return this.#as.pageRequest.size}set pageSize(e){const t=e??10;t!==this.#as.pageRequest.size&&(this.#as={...this.#as,pageRequest:{page:0,size:t}},this.#os&&this.reload())}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#It()&&this.#os&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#It()&&this.#os&&this.reload()}async reconfigure(e){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);return this.#It(),await this.reload()}#Tt(){this.#mt={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#ft=this.component(this.declared("loader")??"loaders:table").create(this)}#It(){return(this.getAttribute("src")!==this.#mt.src||this.getAttribute("method")!==this.#mt.method)&&(this.#Tt(),this.#as={...this.#as,pageRequest:{...this.#as.pageRequest,page:0}},!0)}async render({slots:e}){const t=this.template(),s=Ue.parse(e.schema,t),r=t.withOverlay({slots:e,schema:s}).render(),i=h.queryChildren(r,"ful-table-wrapper").querySelector("table");c.forward("table-",this,i),this.#Tt(),this.#Yt=s,this.#J=i.querySelector(":scope > tbody"),this.#Zt=i.querySelector(":scope > tbody[data-ref=loading]"),this.#es=i.querySelector(":scope > tbody[data-ref=initial]"),this.#nt=i.querySelector(":scope > tbody[data-ref=empty]"),this.#ts=this.#nt.querySelector("ful-empty[data-ref=empty-authors]"),this.#ss=e.empty&&!u.isBlank(e.empty)?x.fromFragment(e.empty):null,this.#rs=i.querySelector(":scope > tbody[data-ref=feedback]"),this.#is=h.queryChildren(r,"ful-pagination"),this.replaceChildren(r);const n=this.querySelector("thead");s.headersTemplate.renderTo(n),this.#ns=n.querySelectorAll("ful-sorter"),await A.waitForChildren(this);const a=h.queryChildren(this,"ful-form");this.#as={pageRequest:{page:0,size:this.declared("page-size")??10},sortRequest:s.sort,filterRequest:a?.values??{}},a?.addEventListener("submit:success",async e=>{await this.#us(0,e.detail.request)}),this.addEventListener("page:requested",async e=>{await this.#us(e.detail.value,this.#as.filterRequest)}),this.addEventListener("sort:requested",async e=>{const t=e.detail.value.order?e.detail.value:null;await this.load(this.#as.pageRequest,t,this.#as.filterRequest),this.#as.sortRequest===t&&(this.#ns.forEach(e=>{e.order=null}),e.target.order=e.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){return await this.load(this.#as.pageRequest,this.#as.sortRequest,this.#as.filterRequest)}async load(e,t,s){this.#os=!0;const r=this.#ls.take();let i;this.#Zt.toggleAttribute("hidden",this.#J.childElementCount>0),this.#rs.setAttribute("hidden",""),this.#es.setAttribute("hidden",""),this.#nt.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const n=await this.#ft.load(e,t,s);if(r.stale)return;if(i=Math.max(0,Math.ceil(n.size/e.size)-1),e.page<=i)return this.#as={pageRequest:e,sortRequest:t,filterRequest:s},this.#De(e,t,s,n),this.removeAttribute("aria-busy"),void this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:t,filterRequest:s,response:n}}))}catch(i){if(r.stale)return;throw this.#Zt.setAttribute("hidden",""),this.#J.replaceChildren(),this.#rs.removeAttribute("hidden"),this.#rs.querySelector("[data-ref=feedback-error]").textContent=L.of().failure(i),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:t,filterRequest:s,exception:i}})),i}return await this.load({page:i,size:e.size},t,s)}async withLoader(e){return await e(this.#ft)}async resetWithFilter(e){return await this.#us(0,e)}#us(e,t){return this.load({page:e,size:this.#as.pageRequest.size},this.#as.sortRequest,t)}#De(e,t,s,r){const i=Math.ceil(r.size/e.size);this.#Zt.setAttribute("hidden",""),this.#J.replaceChildren(this.template("row").withOverlay({schema:this.#Yt,pageRequest:e,filterRequest:s,pageResponse:r}).render()),this.#nt.toggleAttribute("hidden",0!==r.data.length),this.#ss&&0===r.data.length&&this.#ts.replaceChildren(this.#ss.withOverlay({schema:this.#Yt,pageRequest:e,filterRequest:s,pageResponse:r}).render()),this.#is.update({current:e.page,total:i})}}const Xe=(e,t,{items:s,current:r=()=>null})=>{let i="",n=0;t.addEventListener("beforetoggle",s=>{"closed"===s.newState&&t.contains(document.activeElement)&&e.focus()}),t.addEventListener("toggle",e=>{if("open"!==e.newState)return;const t=s();(r()??t[0])?.focus()}),t.addEventListener("keydown",t=>{const r=t.target,a=s(),o=a.find(e=>e===r||e.contains(r));if(!o)return;const l=a.indexOf(o);switch(t.code){case"ArrowDown":return t.preventDefault(),void a[(l+1)%a.length]?.focus();case"ArrowUp":return t.preventDefault(),void a[(l-1+a.length)%a.length]?.focus();case"Home":return t.preventDefault(),void a[0]?.focus();case"End":return t.preventDefault(),void a[a.length-1]?.focus();case"Enter":case"NumpadEnter":case"Space":return t.preventDefault(),o.click(),void e.focus();case"Escape":return void e.focus()}if(1!==t.key.length||t.ctrlKey||t.altKey||t.metaKey)return;const u=Date.now();i=u-n>500?t.key:i+t.key,n=u;const c=i.toLowerCase(),d=[...c].every(e=>e===c[0]),h=d?c[0]:c,p=d?l+1:l,f=[...a.slice(p),...a.slice(0,p)].find(e=>(e.textContent??"").trim().toLowerCase().startsWith(h));f&&(t.preventDefault(),f.focus())})};class Ye{static narrow(e,t){const s=(e??[]).filter(e=>t.includes(e));return s.length>0?s:[...t]}#cs;#it;#ds;#hs;#ps;#Bt;#fs;#ms;#gs;#bs=!1;#vs=!1;constructor(e,{vocabulary:t,glyphs:s={},labelFor:r=e=>e,display:i=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#cs=e,this.#it=e.nextElementSibling,this.#ds=t,this.#hs=s,this.#ps=r,this.#Bt=i??(e=>s[e]??e),this.#fs=n,this.#ms=a,this.#gs=[...t],this.#it.addEventListener("click",e=>{const t=e.target.closest("li > a");if(!t||!this.#fs())return;const s=t.getAttribute("value"),r=this.value;this.value=s,this.#it.hidePopover?.(),r!==s&&this.#ms(s)})}get allowed(){return this.#gs}set allowed(e){this.#gs=Ye.narrow(e,this.#ds),this.#ys(),!this.#vs&&this.#gs.length>1&&(this.#pe(),this.#vs=!0),this.#ws(),this.pinned&&(this.value=this.#gs[0])}preferring(e){return null!==e&&this.#gs.includes(e)?e:this.#gs[0]}get pinned(){return this.#gs.length<2}set fixed(e){this.#cs.toggleAttribute("hidden",!!e)}get value(){return this.#cs.getAttribute("value")}set value(e){this.#cs.setAttribute("value",e),this.#cs.textContent=this.#Bt(e),c.set(this.#cs,"aria-label",this.#ps(e)),this.#Es()}#Es(){const e=this.value;for(const t of this.#Ne())t.setAttribute("aria-checked",String(t.getAttribute("value")===e))}set claimed(e){this.#bs=e,this.#ws()}#ys(){this.#it.replaceChildren(...this.#gs.map(e=>{const t=document.createElement("li");t.setAttribute("role","none");const s=document.createElement("a");s.setAttribute("role","menuitemradio"),s.setAttribute("tabindex","-1"),s.setAttribute("value",e);const r=this.#ps(e),i=this.#hs[e]??e;if(r===e&&i===e)s.innerText=e;else{const e=document.createElement("span");e.innerText=i;const t=document.createElement("span");t.innerText=r,s.append(e,t)}return t.append(s),t})),this.#Es()}#ws(){const e=this.pinned;this.#cs.toggleAttribute("disabled",e||this.#bs),c.set(this.#cs,"aria-haspopup",e?null:"true"),c.set(this.#cs,"aria-expanded",e?null:"false"),e?this.#cs.removeAttribute("popovertarget"):this.#it.id&&this.#cs.setAttribute("popovertarget",this.#it.id)}#Ne(){return Array.from(this.#it.querySelectorAll("li > a"),e=>e)}#pe(){Ne.wire(this.#cs,this.#it,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),Xe(this.#cs,this.#it,{items:()=>this.#Ne(),current:()=>this.#Ne().find(e=>e.getAttribute("value")===this.value)})}}const Ze={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},et=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],tt=[...et,"CONTAINS","STARTS_WITH","ENDS_WITH"],st=["IGNORE_CASE","CASE_SENSITIVE"],rt={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:it}=L.of(),nt=e=>it(`filters.op.${e}`),at=e=>it(`filters.sensitivity.${e}`),ot=e=>it(""===e?"filters.boolean.any":`filters.boolean.${e}`),lt=e=>e.querySelector(":scope > label")?.textContent.trim()||null,ut=(e,t,{singular:s,plural:r,vocabulary:i,fallback:n})=>{const a=e.declared(s);if(null===a)return;e.hasAttribute(r)&&console.warn(`${e.localName}: ${s} fixes what ${r} offers a menu for, the plural is ignored`,e);const o=i.includes(a);o||console.warn(`${e.localName}: '${a}' is not one of its ${r}, the default is pinned instead`,e),t.allowed=[o?a:n],t.fixed=!0},ct=(e,t,s)=>{const r=s.filter(e=>null!=e&&""!=`${e}`);return 0===r.length?null:{label:e,operator:t,operands:r.map(e=>`${e}`)}};class dt extends ve{static observed=["value:json","operators:csv"];static attributes=["operator"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_container;_value1;_value2;_build(e){const t=super._build(e),s=t.fragment;return this._container=s.querySelector("ful-control-group"),this._value1=s.querySelector("[data-ref=value1]"),this._value2=s.querySelector("[data-ref=value2]"),this._operator=new Ye(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:Ze,labelFor:nt,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),ut(this,this._operator,{singular:"operator",plural:"operators",vocabulary:this._vocabulary(),fallback:this._defaultOperator()}),{...t,freeze:this._container,also:[this._value2]}}_showDefaultOperator(){this._showOperator(this._operator.preferring(this._defaultOperator()))}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||this._showDefaultOperator()}_type(){return"text"}_serialize(e){return e}_deserialize(e){return e}_defaultOperator(){return"EQ"}_vocabulary(){return et}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){null===this.declared("operator")&&(this._operator?(this._operator.allowed=e,this._syncBetween()):this._declaredOperators=Ye.narrow(e,this._vocabulary()))}get value(){return this._tuple()}set value(e){this._applyTuple(e)}_tuple(){const e=this._operator.value,t=this.#xs();return t.some(e=>""===e)?null:[e,...t.map(e=>this._serialize(e))]}_applyTuple(e){if(null==e)return this._value1.value="",void(this._value2.value="");const[t,...s]=e,r=this._operator.pinned?this._operator.allowed[0]:t;this._showOperator(r),this._value1.value=s[0]?this._deserialize(s[0]):s[0]??"",this._value2.value=s[1]?this._deserialize(s[1]):s[1]??""}_showOperator(e){this._operator.value=e,this._syncBetween()}_syncBetween(){this._value2.toggleAttribute("hidden","BETWEEN"!==this._operator.value)}get criterion(){return ct(lt(this),this._operator.value,this.#xs())}#xs(){return"BETWEEN"===this._operator.value?[this._value1.value,this._value2.value]:[this._value1.value]}get disabled(){return super.disabled}set disabled(e){super.disabled=e;for(const t of this._choices())t.claimed=e}_choices(){return[this._operator].filter(e=>e)}}class ht extends dt{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(e){return Ee.localToIso(e)}_deserialize(e){return Ee.isoToLocal(e)}}class pt extends dt{_type(){return"date"}}class ft extends dt{_type(){return"number"}}class mt extends dt{static observed=["sensitivities:csv"];static attributes=["sensitivity"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n <button data-ref="sensitivity" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_defaultOperator(){return"CONTAINS"}_vocabulary(){return tt}_sensitivityButton;_build(e){const t=super._build(e);return this._sensitivityButton=new Ye(t.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:st,glyphs:rt,labelFor:at,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=st[0],ut(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:st,fallback:"IGNORE_CASE"}),t}_choices(){return[...super._choices(),this._sensitivityButton].filter(e=>e)}get _sensitivity(){return this._sensitivityButton.value}_declaredSensitivities;get sensitivities(){return this._sensitivityButton?this._sensitivityButton.allowed:this._declaredSensitivities}set sensitivities(e){if(null!==this.declared("sensitivity"))return;if(!this._sensitivityButton)return void(this._declaredSensitivities=Ye.narrow(e,st));const t=this._sensitivityButton.value;this._sensitivityButton.allowed=e,this._sensitivityButton.value=this._sensitivityButton.preferring(t)}get value(){const e=this._tuple();return null==e?null:[e[0],this._sensitivity,...e.slice(1)]}set value(e){null!=e?(this._sensitivityButton.allowed.includes(e[1])&&(this._sensitivityButton.value=e[1]),this._applyTuple([e[0],...e.slice(2)])):this._applyTuple(e)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const gt=["","true","false"],bt={true:"✓",false:"✗"};class vt extends le{static observed=["value:json","operators:csv"];static slots=!0;static OPERATORS=["EQ","NEQ"];static DEFAULT_OPERATOR="EQ";static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <button data-ref="value" type="button" form=""></button>\n <ul popover role="menu"></ul>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_value;_container;_build({slots:e}){const t=this.template().withOverlay({slots:e}).render();this._container=t.querySelector("ful-control-group");const s=t.querySelector("[data-ref=value]");return this._operator=new Ye(t.querySelector("[data-ref=operator]"),{vocabulary:vt.OPERATORS,glyphs:Ze,labelFor:nt,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new Ye(s,{vocabulary:gt,glyphs:bt,labelFor:ot,display:ot,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(vt.DEFAULT_OPERATOR),this._value.allowed=null,this._value.value="",{fragment:t,control:s,error:t.querySelector("ful-field-error"),label:t.querySelector("label"),announces:null,freeze:this._container}}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){this._operator?this._operator.allowed=e:this._declaredOperators=Ye.narrow(e,this._vocabulary())}_vocabulary(){return vt.OPERATORS}get value(){return""===this._value.value?null:[this._operator.value,this._value.value]}set value(e){null!=e?(this._operator.value=this._operator.pinned?this._operator.allowed[0]:e[0],this._value.value=e[1]??""):this._value.value=""}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(vt.DEFAULT_OPERATOR))}get criterion(){const e=this._value.value;return ct(lt(this),this._operator.value,[""===e?"":ot(e)])}get disabled(){return super.disabled}set disabled(e){super.disabled=e;for(const t of[this._operator,this._value].filter(e=>e))t.claimed=e}}class yt extends Be{static attributes=["operator"];#As(){const e=super.value;return this.multiple?e:null==e?[]:[e]}get value(){const e=this.#As();if(0===e.length)return null;const t=this.declared("operator");return t?[t,...e]:e}set value(e){const t=this.declared("operator");let s=null==e?[]:Array.isArray(e)?e:[e];t&&s[0]===t&&(s=s.slice(1)),super.value=this.multiple?s:s[0]??null}get criterion(){return ct(lt(this),this.declared("operator"),[super.entry].flat().filter(e=>e).map(e=>e.label))}}class wt extends S{static slots=!0;static attributes=["placement","icon","describes:presence"];static config={icon:"info-circle-fill"};static template='\n <span role="button" tabindex="0" class="ful-tip" data-ref="trigger" data-tpl-aria-label="#l10n:t(\'info.tooltip\')"><ful-icon data-tpl-name="icon ?? config.icon" aria-hidden="true"></ful-icon></span>\n <ful-note popover data-ref="content">{{{{ slots.default }}}}</ful-note>\n ';render({slots:e}){const t=this.template().withOverlay({slots:e,icon:this.declared("icon")}).render(),s=t.querySelector("[data-ref=trigger]"),r=t.querySelector("[data-ref=content]");Ne.wire(s,r,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),r.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(t),this.declared("describes")&&wt.#fe(this,s,r)}static#fe(e,t,s){ne(e)?.describedBy(s)?t.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",e)}}class Et{#Ss=new WeakSet;#ue=new WeakMap;async request(e,t,s,r){const i=!this.#Ss.has(t),n={name:s,section:t,index:r,first:i},a=["section:requested",...null!=r?[`section:requested:#${r}`]:[],...s?[`section:requested:${s}`]:[]],o=[];for(const t of a){const s=new CustomEvent(t,{bubbles:!0,detail:n});e.dispatchEvent(s),o.push(...s.async?.promises??[])}if(0===o.length)return;this.#Ss.add(t);let l=this.#ue.get(t);l||(l=new ie,this.#ue.set(t,l));const u=l.take(),c=()=>!u.stale;t.querySelector(":scope > .ful-section-error")?.remove();const d=requestAnimationFrame(()=>{c()&&(t.toggleAttribute("loading",!0),t.setAttribute("aria-busy","true"))});try{return await Promise.all(o)}catch(e){throw c()&&this.#Ts(t,e),e}finally{cancelAnimationFrame(d),c()&&(t.toggleAttribute("loading",!1),t.removeAttribute("aria-busy"))}}#Ts(e,t){e.querySelector(":scope > .ful-section-error")?.remove();const s=document.createElement("div");s.className="ful-section-error",s.setAttribute("role","alert"),s.textContent=L.of().failure(t),e.prepend(s)}}class xt{#Cs;#_s;#Os;#Zt;#qs;#ks=new Et;#Rs=new ie;constructor(e,t,s){this.#Cs=e,this.#_s=t.querySelector("[data-ref=dialog]"),this.#Os=t.querySelector(`[data-ref=${s}]`),this.#Zt=t.querySelector("[data-ref=loading]"),this.#qs=t.querySelector("[data-ref=error]")}get dialog(){return this.#_s}get section(){return this.#Os}dismiss(e,t){this.#Cs.dispatchEvent(e)&&e.cancelable&&t()}onBackdrop(e){let t=!1;this.#_s.addEventListener("mousedown",e=>{t=e.target===this.#_s}),this.#_s.addEventListener("click",s=>{t&&s.target===this.#_s&&e()})}onSubmitted(e){this.#Os.addEventListener("submit:success",t=>{t.target===h.queryChildren(this.#Os,"ful-form")&&e(t.detail.response)})}restChrome(){this.#qs?.replaceChildren(),this.#qs?.setAttribute("hidden",""),this.#Zt?.setAttribute("hidden",""),this.#Os?.removeAttribute("hidden")}request(){return this.#ks.request(this.#Cs,this.#Os,null,null).catch(()=>{})}async update(e,t){const s=this.#Rs.take();this.#Os.replaceChildren(),this.restChrome(),this.#Zt?.removeAttribute("hidden"),this.#Os.setAttribute("hidden",""),t();try{const t=await e();return s.stale||(this.#Os.replaceChildren(t),this.#Zt?.setAttribute("hidden",""),this.#Os.removeAttribute("hidden")),this.#Os}catch(e){throw s.stale||(this.#qs?.removeAttribute("hidden"),this.#qs&&(this.#qs.textContent=L.of().failure(e)),this.#Zt?.setAttribute("hidden",""),this.#Os.setAttribute("hidden","")),e}}}let At=!1;const St=()=>{At||(At=!0,document.addEventListener("click",e=>{const t=e.target.closest?.("[dialog-target]");t&&document.getElementById(t.getAttribute("dialog-target"))?.open?.()}))};class Tt extends S{static attributes=["header","requires-answer:presence","close-on-submit:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header || slots.header || !requiresAnswer" class="ful-dialog-header">\n {{{{ slots.header }}}}\n <h2 data-tpl-if="header">{{ header }}</h2>\n <button data-tpl-if="!requiresAnswer" type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'dialog.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <div data-ref="body" class="ful-dialog-body">{{{{ slots.default }}}}</div>\n <footer class="ful-dialog-footer">\n <button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons && !closeOnSubmit" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>\n {{{{ slots.buttons }}}}\n </footer>\n </dialog>\n ';#_s;#Ls;#Ns=[];#Ps=null;render({slots:e}){const t=this.declared("requires-answer"),s=this.declared("close-on-submit"),r=this.template().withOverlay({slots:e,header:this.declared("header")??"",requiresAnswer:t,closeOnSubmit:s}).render();this.#Ls=new xt(this,r,"body"),this.#_s=this.#Ls.dialog;const i=r.querySelector("h2");i&&(i.id||=c.uid("ful-dialog-title"),this.#_s.setAttribute("aria-labelledby",i.id)),this.#_s.addEventListener("close",()=>{const e=this.#Ms();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#Fs(e)}),this.#_s.addEventListener("click",e=>{const t=e.target.closest("button[data-result]")?.dataset.result;void 0!==t&&this.#_s.close(t)});const n=(e,t=!1)=>this.#Ls.dismiss(new CustomEvent("dialog:dismiss",{cancelable:!t,detail:{reason:e}}),()=>this.#_s.close(""));t||this.#Ls.onBackdrop(()=>n("backdrop")),r.querySelector("[data-ref=close]")?.addEventListener("click",()=>n("button")),s&&this.#Ls.onSubmitted(e=>{this.#Ps={dismissed:!1,result:null,response:e},this.#_s.close("submitted")}),this.#_s.addEventListener("cancel",e=>{if(!e.cancelable)return this.#_s.returnValue="",void n("escape",!0);e.preventDefault(),t||n("escape")}),this.replaceChildren(r),St()}#Ms(){if(this.#Ps)return this.#Ps;const e=this.#_s?.returnValue??"";return""===e?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:e,response:null}}#Fs(e){const t=this.#Ns;this.#Ns=[];for(const s of t)s(e)}disconnectedCallback(){this.#Fs(this.#Ms())}open(){return this.ask()}ask(){return this.#zs()&&(this.#Ls.restChrome(),this.#Ls.request()),new Promise(e=>{this.#Ns.push(e)})}async update(e){return await this.#Ls.update(e,()=>this.#zs())}refresh(){return this.#Ls.request()}close(e){this.#_s.close(e??"")}#zs(){return!this.#_s.open&&(this.#_s.returnValue="",this.#Ps=null,this.#_s.showModal(),!0)}static async ask(e,t,s=[],{className:r}={}){const i=document.createElement("ful-dialog");if(i.setAttribute("header",e),r&&(i.className=r),"string"==typeof t?i.textContent=t:t&&i.append(t),s.length>0){const e=document.createElement("template");e.setAttribute("slot","buttons");for(const t of s){if(t instanceof Node){e.content.append(t);continue}const[s,r,i]=t,n=document.createElement("button");n.type="button",n.dataset.result=s,i&&(n.className=i),n.textContent=r,e.content.append(n)}i.append(e)}document.body.append(i);try{return await A.waitFor(i),await i.ask()}finally{i.remove()}}static async confirm(e,t,s={},r={}){const i=await Tt.ask(e,t,[["cancel",s.cancel??L.of().t("dialog.cancel")],["confirm",s.confirm??L.of().t("dialog.confirm"),"ful-button"]],r);return!i.dismissed&&"confirm"===i.result}}class Ct extends S{static attributes=["header","placement","close-on-submit:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-drawer">\n <header>\n {{{{ slots.header }}}}\n <h2 data-ref="title">{{ title }}</h2>\n <button type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'drawer.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <section data-ref="content">{{{{ slots.default }}}}</section>\n </dialog>\n ';#_s;#Ds;#Ls;#Ps=null;#Is=!1;#$s=e=>{e.target===this.#_s&&this.#Bs()};render({slots:e}){const t=this.template().withOverlay({slots:e,title:this.declared("header")??""}).render();this.#Ls=new xt(this,t,"content"),this.#_s=this.#Ls.dialog,this.#Ds=t.querySelector("[data-ref=title]"),this.#Ds.id||=c.uid("ful-drawer-title"),this.#_s.setAttribute("aria-labelledby",this.#Ds.id);const s=this.declared("placement");s&&this.#_s.setAttribute("placement",s);const r=(e,t=!1)=>this.#Ls.dismiss(new CustomEvent("drawer:dismiss",{cancelable:!t,detail:{reason:e}}),()=>this.close());t.querySelector("[data-ref=close]").addEventListener("click",()=>r("button")),this.#Ls.onBackdrop(()=>r("backdrop")),this.#_s.addEventListener("cancel",e=>{if(!e.cancelable)return this.#js(),void r("escape",!0);e.preventDefault(),r("escape")}),this.#_s.addEventListener("close",()=>{this.dispatchEvent(new CustomEvent("close",{detail:this.#Ps??{dismissed:!0,response:null}}))}),this.declared("close-on-submit")&&this.#Ls.onSubmitted(e=>{this.#Ps={dismissed:!1,response:e},this.close()}),this.replaceChildren(t),St()}get header(){return this.#Ds.textContent}set header(e){this.#Ds.textContent=e??""}async update(e,t){return this.header=e,await this.#Ls.update(t,()=>this.#zs())}refresh(){return this.#Ls.request()}open(){this.#zs()&&(this.#Ls.restChrome(),this.#Ls.request())}close(){!this.#Is&&this.#_s.open&&(matchMedia("(prefers-reduced-motion: reduce)").matches?this.#_s.close():(this.#_s.setAttribute("closing",""),0!==this.#_s.getAnimations().length?(this.#Is=!0,this.#_s.addEventListener("animationend",this.#$s)):this.#Bs()))}#Bs(){this.#js(),this.#_s.close()}#js(){this.#Is=!1,this.#_s.removeEventListener("animationend",this.#$s),this.#_s.removeAttribute("closing")}#zs(){return this.#js(),!this.#_s.open&&(this.#Ps=null,this.#_s.showModal(),!0)}}class _t extends S{static attributes=["for"];render(){const e=this.declared("for"),t=e?document.getElementById(e):null;if(!t)throw new Error(`ful-menu names no invoker: for="${e??""}" must name an element already in the page when the menu upgrades`);this.setAttribute("role","menu"),this.hasAttribute("popover")||this.setAttribute("popover",""),t.setAttribute("aria-haspopup","menu"),Ne.wire(t,this,{prefix:"ful-menu",invoke:!0,expanded:!0}),Xe(t,this,{items:()=>this.items}),this.#Es(),this.addEventListener("click",e=>{const t=e.target;this.items.some(e=>e===t||e.contains(t))&&this.hidePopover()})}get items(){return this.#Es().filter(e=>!e.hasAttribute("disabled")&&!e.hasAttribute("hidden"))}#Es(){const e=[...this.querySelectorAll(":scope > button, :scope > a[href]")];for(const t of e)t.hasAttribute("role")||t.setAttribute("role","menuitem"),t.tabIndex=-1;return e}}const Ot=["info","success","warning","error"],qt=new Set;let kt=!1;class Rt extends S{static attributes=["timeout:number"];#Hs;connectedCallback(){super.connectedCallback(),this.rendered&&qt.add(this)}disconnectedCallback(){qt.delete(this)}render(){this.#Hs=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",L.of().t("toast.region")),this.setAttribute("popover","manual"),kt||(kt=!0,document.addEventListener("show-toast",e=>{if(e.detail)for(const t of qt)t.show(e.detail.message,e.detail)})),qt.add(this)}show(e,t={}){const s=Ot.includes(t.severity)?t.severity:"info",r=document.createElement("ful-toast");r.classList.add(s),r.setAttribute("role","error"===s?"alert":"status");const i=document.createElement("div");i.textContent=L.of().failure(e);const n=document.createElement("button");n.type="button",n.setAttribute("aria-label",L.of().t("toast.dismiss"));const a=document.createElement("ful-icon");a.setAttribute("name","x-lg"),a.setAttribute("aria-hidden","true"),n.append(a),r.append(i);let o=t.timeout??this.#Hs,l=performance.now(),u=0;const c=()=>{clearTimeout(u),r.contains(document.activeElement)&&this.focus(),matchMedia("(prefers-reduced-motion: reduce)").matches?r.remove():(r.classList.add("ful-toast-out"),0===r.getAnimations().length&&r.remove())};if(t.action?.label){const e=document.createElement("button");e.type="button",e.className="ful-toast-action",e.textContent=String(t.action.label),e.addEventListener("click",()=>{t.action.onClick?.(),c()}),r.append(e)}r.append(n),r.addEventListener("animationend",()=>{r.classList.contains("ful-toast-out")&&r.remove()});let d=0;const h=()=>{0===d&&(clearTimeout(u),o=Math.max(0,o-(performance.now()-l))),++d},p=()=>{0!==d&&0===--d&&(l=performance.now(),u=setTimeout(c,o))};return r.addEventListener("mouseenter",h),r.addEventListener("mouseleave",p),r.addEventListener("focusin",h),r.addEventListener("focusout",p),n.addEventListener("click",c),this.append(r),this.#Ws(),u=setTimeout(c,o),r}#Ws(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class Lt extends S{static slots=!0;static observed=["active:number"];static template='\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n {{{{ slots.default }}}}\n ';#Vs;#Us=[];#Gs=[];#ks=new Et;#Qs=0;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#Vs=t.querySelector("ful-tablist");const s=[...this.#Vs.children];this.#Gs=[...t.children].filter(e=>e!==this.#Vs),s.length!==this.#Gs.length&&console.warn(`ful-tabs: ${s.length} tabs declared for ${this.#Gs.length} panels, the surplus is left alone`);const r=Math.min(s.length,this.#Gs.length);this.#Us=[];for(let e=0;e!==r;++e){const t=this.#Gs[e],r=document.createElement("button");r.type="button",r.role="tab",r.id=c.uid("ful-tab"),t.id||(t.id=c.uid("ful-tabpanel")),r.setAttribute("aria-controls",t.id),t.role="tabpanel",t.setAttribute("aria-labelledby",r.id),t.tabIndex=0,r.append(...s[e].childNodes),r.addEventListener("click",()=>{this.active=e}),s[e].replaceWith(r),this.#Us.push(r)}this.#Vs.addEventListener("keydown",e=>{const t=this.#Qs;let s=null;"ArrowRight"===e.key?s=(t+1)%this.#Us.length:"ArrowLeft"===e.key?s=(t-1+this.#Us.length)%this.#Us.length:"Home"===e.key?s=0:"End"===e.key&&(s=this.#Us.length-1),null!==s&&s!==t&&(e.preventDefault(),this.active=s,this.#Us[s].focus())}),this.replaceChildren(t)}get active(){return this.#Qs}refresh(e){const t=e instanceof Element?this.#Gs.indexOf(e):Number.isInteger(e)?e:NaN,s=this.#Gs[t];if(s)return this.#ks.request(this,s,null,t).catch(()=>{});console.warn(`ful-tabs: no panel answers to "${e}"`)}set active(e){const t=Math.min(Math.max(0,Number(e)||0),Math.max(0,this.#Us.length-1)),s=this.#Qs;for(const[e,s]of this.#Us.entries())s.setAttribute("aria-selected",e===t?"true":"false"),s.tabIndex=e===t?0:-1,this.#Gs[e].hidden=e!==t;this.#Qs=t,this.reflectTo("active",t),this.rendered&&t!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:t,previous:s}})),this.#Gs.length>0&&(t!==s||!this.rendered)&&this.#ks.request(this,this.#Gs[t],null,t).catch(()=>{})}}class Nt extends S{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#Fe;#Ks=!1;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#Fe=t.querySelector("ful-accordion-group"),this.replaceChildren(t)}get exclusive(){return this.#Ks}set exclusive(e){this.#Ks=!0===e,this.reflectTo("exclusive",this.#Ks);const t=this.#Ks?c.uid("ful-accordion"):null;for(const e of this.#Fe.querySelectorAll(":scope > details"))null===t?e.removeAttribute("name"):e.setAttribute("name",t)}}class Pt extends S{static slots=!0;static observed=["progress"];static template="\n <ful-steps><ol data-tpl-aria-label=\"#l10n:t('wizard.progress')\">{{{{ slots.steps }}}}</ol></ful-steps>\n {{{{ slots.default }}}}\n ";#Js=[];#Ls=[];#ks=new Et;#Xs=0;#Ys;render({slots:e}){const t=this.template().withOverlay({slots:e}).render(),s=[...t.querySelector("ful-steps ol").children];this.#Ls=[...t.children].filter(e=>"ful-steps"!==e.localName),s.length!==this.#Ls.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#Ls.length} sections, the surplus is left alone`);const r=Math.min(s.length,this.#Ls.length);this.#Js=[];for(let e=0;e!==r;++e){const t=document.createElement("li");t.append(...s[e].childNodes),s[e].replaceWith(t),this.#Js.push(t),this.#Ls[e].tabIndex=-1}if(this.replaceChildren(t),r>0){const e=this.#Ls.findIndex(e=>"step"===e.getAttribute("aria-current"));this.#Zs(-1===e?0:Math.min(e,r-1)),this.#er(this.#Xs).catch(()=>{})}}get index(){return this.#Xs}get step(){return this.#Ls[this.#Xs]?.getAttribute("data-step")??null}get progress(){return this.#Ys}set progress(e){this.#Ys=e,this.reflectTo("progress",e)}next(){return this.#tr(this.#Xs+1)}prev(){return this.#tr(this.#Xs-1)}move(e){const t=this.#Ls.findIndex(t=>t.getAttribute("data-step")===e);if(-1!==t)return this.#tr(t);console.warn(`ful-wizard: no section carries data-step="${e}"`)}refresh(e){const t=e instanceof Element?e:"string"==typeof e?this.#Ls.find(t=>t.getAttribute("data-step")===e):void 0,s=this.#Ls.indexOf(t);if(-1!==s)return this.#er(s).catch(()=>{});console.warn(`ful-wizard: no section answers to "${e}"`)}#er(e){return this.#ks.request(this,this.#Ls[e],this.#Ls[e].getAttribute("data-step"),e)}#tr(e){const t=Math.min(Math.max(0,e),Math.max(0,this.#Js.length-1));if(t!==this.#Xs)return this.#Zs(t),this.#Ls[this.#Xs].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#Xs,step:this.step}})),this.#er(t)}#Zs(e){for(const[t,s]of this.#Js.entries())t===e?(s.setAttribute("aria-current","step"),this.#Ls[t].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#Ls[t].removeAttribute("aria-current"));this.#Xs=e}}const Mt={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","failure.no-reason":"Something went wrong","dialog.acknowledge":"Got it","dialog.close":"Close","dialog.confirm":"Confirm","dialog.cancel":"Cancel","drawer.close":"Close","spinner.loading":"Loading…","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","drawer.close":"Chiudi","spinner.loading":"Caricamento…","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{one:"Se ha superado el número máximo de {count} archivo",other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","failure.no-reason":"Se ha producido un error","dialog.acknowledge":"Entendido","dialog.close":"Cerrar","dialog.confirm":"Confirmar","dialog.cancel":"Cancelar","drawer.close":"Cerrar","spinner.loading":"Cargando…","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","drawer.close":"Fermer","spinner.loading":"Chargement…","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class Ft{#sr;#rr;#ir;constructor(e={}){this.#sr=e.language??navigator?.language??"en",this.#rr=e.translations??{},this.#ir=e.httpClient??null}configure(e){const t=this.#ir??V.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#sr.split("-")[0].toLowerCase(),r={...Mt.en,...Mt[s],...this.#rr};e.defineModule("l10n",L).defineComponent("http-client",t).defineElement("ful-tooltip",wt).defineElement("ful-dialog",Tt).defineElement("ful-drawer",Ct).defineElement("ful-menu",_t).defineElement("ful-toasts",Rt).defineElement("ful-tabs",Lt).defineElement("ful-accordion",Nt).defineElement("ful-wizard",Pt).defineElement("ful-form",he).defineElement("ful-checkbox",He).defineElement("ful-input",ve).defineElement("ful-input-file",Te).defineElement("ful-local-date",we).defineElement("ful-instant",Ee).defineElement("ful-input-local-date",xe).defineElement("ful-input-local-time",Ae).defineElement("ful-input-instant",Se).defineElement("ful-radio-group",je).defineElement("ful-table",Je).defineElement("ful-pagination",Ve).defineElement("ful-sorter",We).defineElement("ful-filter-instant",ht).defineElement("ful-filter-local-date",pt).defineElement("ful-filter-number",ft).defineElement("ful-filter-boolean",vt).defineElement("ful-filter-text",mt).defineElement("ful-filter-in",yt).defineElement("ful-select",Be).defineElement("ful-dropdown",$e).defineComponent("loaders:select",Ie).defineComponent("loaders:form",de).defineComponent("loaders:table",Ke).defineOverlay({l10n:r,locale:this.#sr})}}var zt=Object.freeze({__proto__:null,Accordion:Nt,Anchors:Ne,AsyncEvents:re,Bindings:oe,BooleanFilter:vt,Checkbox:He,Claims:ie,CompareFilter:dt,Dialog:Tt,Drawer:Ct,Dropdown:$e,Field:le,Form:he,FormLoader:de,InFilter:yt,Input:ve,InputFile:Te,InputInstant:Se,InputLocalDate:xe,InputLocalTime:Ae,Instant:Ee,InstantFilter:ht,LocalDate:we,LocalDateFilter:pt,LocalStorage:Z,Menu:_t,NumberFilter:ft,Pagination:Ve,Plugin:Ft,RadioGroup:je,Select:Be,SelectLoader:Ie,SessionStorage:ee,SortButton:We,Table:Je,TableLoader:Ke,TableSchemaParser:Ue,Tabs:Lt,TextFilter:mt,Timing:ae,Toasts:Rt,Tooltip:wt,VersionedLocalStorage:te,VersionedSessionStorage:se,Wizard:Pt,describable:ne});return"undefined"!=typeof window&&(window.ftl=N,window.httpc=J,window.ful=zt),e.Accordion=Nt,e.Anchors=Ne,e.AsyncEvents=re,e.Attributes=c,e.Base64=M,e.Bindings=oe,e.BooleanFilter=vt,e.BoundedCache=t,e.Checkbox=He,e.Claims=ie,e.CompareFilter=dt,e.Dialog=Tt,e.Drawer=Ct,e.Dropdown=$e,e.ExpressionEvaluator=l,e.Expressions=o,e.Failure=P,e.Field=le,e.Form=he,e.FormLoader=de,e.Fragments=u,e.Hex=F,e.HttpClient=V,e.HttpClientBuilder=j,e.HttpClientError=D,e.HttpInterceptorChain=W,e.HttpMultipartRequestCustomizer=K,e.HttpRequestBuilder=Q,e.InFilter=yt,e.Input=ve,e.InputFile=Te,e.InputInstant=Se,e.InputLocalDate=xe,e.InputLocalTime=Ae,e.Instant=Ee,e.InstantFilter=ht,e.LightSlots=d,e.LocalDate=we,e.LocalDateFilter=pt,e.LocalStorage=Z,e.Localization=L,e.MediaType=z,e.Menu=_t,e.Nodes=h,e.NumberFilter=ft,e.Pagination=Ve,e.ParsedElement=S,e.Plugin=Ft,e.RadioGroup=je,e.Registry=w,e.RenderError=v,e.Rendering=A,e.Select=Be,e.SelectLoader=Ie,e.SessionStorage=ee,e.SortButton=We,e.Table=Je,e.TableLoader=Ke,e.TableSchemaParser=Ue,e.Tabs=Lt,e.Template=b,e.Templates=x,e.TextFilter=mt,e.Timing=ae,e.Toasts=Rt,e.Tooltip=wt,e.VersionedLocalStorage=te,e.VersionedSessionStorage=se,e.Wizard=Pt,e.describable=ne,e.registry=E,e}({});
2
2
  //# sourceMappingURL=fml.iife.min.js.map