@optionfactory/fml 8.0.2 → 8.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fml.min.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const t={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")}};class e extends SyntaxError{constructor(t,e,s,r){super(t),this.expected=e,this.found=s,this.location=r,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let s=null;const r=t.find(t=>t.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 t=this.location.end,r="".padEnd(n.line.toString().length," "),l=s[i.line-1],o=(i.line===t.line?t.column:l.length+1)-i.column||1;e+="\n --\x3e "+a+"\n"+r+" |\n"+n.line+" | "+l+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(o,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function s(t){return t.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(t){return r?t.replace(r,t=>"\\u{"+s(t)+"}"):t}function n(t){return i(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+s(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+s(t)))}function a(t){return i(t.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,t=>"\\x0"+s(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+s(t)))}const l={literal:t=>'"'+n(t.text)+'"',class(t){const e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function o(t){return l[t.type](t)}return"Expected "+function(t){const e=t.map(o);if(e.sort(),e.length>0){let t=1;for(let s=1;s<e.length;s++)e[s-1]!==e[s]&&(e[t]=e[s],t++);e.length=t}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}(t)+" but "+function(t){return t?'"'+n(t)+'"':"end of input"}(e)+" found."}}function s(s,r){const i={},n=(r=void 0!==r?r:{}).grammarSource,a={TemplatedRoot:Te,ExpressionRoot:qe};let l=Te;const o="{{{{",u="}}}}",c="{{{",d="}}}",h="{{",p="}}",f="\\",m="{",b="?",g=":",v="?:",y="??",w="||",x="&&",E="!",A="?.",S=".",T="[",C="]",q="(",O=",",P=")",L="true",_="false",k="null",M="undefined",R="-",D="'",N='"',z="`",I="}",F="#",$="==",B="!=",H=">=",j=">",V="<=",U="<",W=/^[^\\{]/,G=/^[0-9]/,J=/^[^']/,X=/^[^"]/,Q=/^[^\\`{]/,Z=/^[a-zA-Z$_]/,Y=/^[a-zA-Z$_0-9_]/,K=/^[ \t\n\r]/,tt=ye("{{{{",!1),et=ye("}}}}",!1),st=ye("{{{",!1),rt=ye("}}}",!1),it=ye("{{",!1),nt=ye("}}",!1),at=we(["\\","{"],!0,!1,!1),lt=ye("\\",!1),ot={type:"any"},ut=ye("{",!1),ct=ye("?",!1),dt=ye(":",!1),ht=ye("?:",!1),pt=ye("??",!1),ft=ye("||",!1),mt=ye("&&",!1),bt=ye("!",!1),gt=xe("member"),vt=ye("?.",!1),yt=ye(".",!1),wt=xe("subscript"),xt=ye("[",!1),Et=ye("]",!1),At=xe("method-call"),St=ye("(",!1),Tt=ye(",",!1),Ct=ye(")",!1),qt=xe("module-function-call"),Ot=xe("boolean-literal"),Pt=ye("true",!1),Lt=ye("false",!1),_t=xe("null-literal"),kt=ye("null",!1),Mt=xe("undefined-literal"),Rt=ye("undefined",!1),Dt=xe("number-literal"),Nt=ye("-",!1),zt=we([["0","9"]],!1,!1,!1),It=xe("string-literal"),Ft=ye("'",!1),$t=we(["'"],!0,!1,!1),Bt=ye('"',!1),Ht=we(['"'],!0,!1,!1),jt=ye("`",!1),Vt=xe("tstring-expression"),Ut=ye("}",!1),Wt=xe("tstring-literal"),Gt=we(["\\","`","{"],!0,!1,!1),Jt=xe("array-literal"),Xt=xe("dict-literal"),Qt=xe("module-function"),Zt=ye("#",!1),Yt=we([["a","z"],["A","Z"],"$","_"],!1,!1,!1),Kt=we([["a","z"],["A","Z"],"$","_",["0","9"],"_"],!1,!1,!1),te=xe("symbol"),ee=ye("==",!1),se=ye("!=",!1),re=ye(">=",!1),ie=ye(">",!1),ne=ye("<=",!1),ae=ye("<",!1),le=we([" ","\t","\n","\r"],!1,!1,!1);function oe(t){return t}function ue(t,e,s){return{op:e,rhs:s}}function ce(t,e,s){return{op:e,rhs:s}}function de(t){return t}let he=0|r.peg$currPos;const pe=[{line:1,column:1}];let fe,me=he,be=r.peg$maxFailExpected||[],ge=0|r.peg$silentFails,ve={};if(r.startRule){if(!(r.startRule in a))throw new Error("Can't start parsing from rule \""+r.startRule+'".');l=a[r.startRule]}function ye(t,e){return{type:"literal",text:t,ignoreCase:e}}function we(t,e,s,r){return{type:"class",parts:t,inverted:e,ignoreCase:s,unicode:r}}function xe(t){return{type:"other",description:t}}function Ee(t){let e,r=pe[t];if(r)return r;if(t>=pe.length)e=pe.length-1;else for(e=t;!pe[--e];);for(r=pe[e],r={line:r.line,column:r.column};e<t;)10===s.charCodeAt(e)?(r.line++,r.column=1):r.column++,e++;return pe[t]=r,r}function Ae(t,e,s){const r=Ee(t),i=Ee(e);return{source:n,start:{offset:t,line:r.line,column:r.column},end:{offset:e,line:i.line,column:i.column}}}function Se(t){he<me||(he>me&&(me=he,be=[]),be.push(t))}function Te(){let t,e;const s=40*he+0,r=ve[s];if(r)return he=r.nextPos,r.result;for(t=[],e=Ce();e!==i;)t.push(e),e=Ce();return ve[s]={nextPos:he,result:t},t}function Ce(){let e,r,n,a,l;const b=40*he+1,g=ve[b];return g?(he=g.nextPos,g.result):(e=he,r=he,n=function(){let t;const e=40*he+2,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,4)===o?(t=o,he+=4):(t=i,0===ge&&Se(tt));return ve[e]={nextPos:he,result:t},t}(),n!==i?(a=qe(),a!==i?(l=function(){let t;const e=40*he+3,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,4)===u?(t=u,he+=4):(t=i,0===ge&&Se(et));return ve[e]={nextPos:he,result:t},t}(),l!==i?r=a:(he=r,r=i)):(he=r,r=i)):(he=r,r=i),r!==i&&(v=r,r={type:t.templated.ten,value:v}),e=r,e===i&&(e=he,r=he,n=function(){let t;const e=40*he+4,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,3)===c?(t=c,he+=3):(t=i,0===ge&&Se(st));return ve[e]={nextPos:he,result:t},t}(),n!==i?(a=qe(),a!==i?(l=function(){let t;const e=40*he+5,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,3)===d?(t=d,he+=3):(t=i,0===ge&&Se(rt));return ve[e]={nextPos:he,result:t},t}(),l!==i?r=a:(he=r,r=i)):(he=r,r=i)):(he=r,r=i),r!==i&&(r=function(e){return{type:t.templated.teh,value:e}}(r)),e=r,e===i&&(e=he,r=he,n=function(){let t;const e=40*he+6,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,2)===h?(t=h,he+=2):(t=i,0===ge&&Se(it));return ve[e]={nextPos:he,result:t},t}(),n!==i?(a=qe(),a!==i?(l=function(){let t;const e=40*he+7,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,2)===p?(t=p,he+=2):(t=i,0===ge&&Se(nt));return ve[e]={nextPos:he,result:t},t}(),l!==i?r=a:(he=r,r=i)):(he=r,r=i)):(he=r,r=i),r!==i&&(r=function(e){return{type:t.templated.tet,value:e}}(r)),e=r,e===i&&(e=he,r=function(){let t,e,r,n,a,l;const o=40*he+8,u=ve[o];if(u)return he=u.nextPos,u.result;t=he,e=[],r=he,n=[],a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at));if(a!==i)for(;a!==i;)n.push(a),a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at));else n=i;r=n!==i?s.substring(r,he):n;r===i&&(r=he,92===s.charCodeAt(he)?(n=f,he++):(n=i,0===ge&&Se(lt)),n!==i?(s.length>he?(a=s.charAt(he),he++):(a=i,0===ge&&Se(ot)),a!==i?r=a:(he=r,r=i)):(he=r,r=i),r===i&&(r=he,123===s.charCodeAt(he)?(n=m,he++):(n=i,0===ge&&Se(ut)),n!==i?(a=he,ge++,123===s.charCodeAt(he)?(l=m,he++):(l=i,0===ge&&Se(ut)),ge--,l===i?a=void 0:(he=a,a=i),a!==i?(n=[n,a],r=n):(he=r,r=i)):(he=r,r=i)));if(r!==i)for(;r!==i;){if(e.push(r),r=he,n=[],a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at)),a!==i)for(;a!==i;)n.push(a),a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at));else n=i;r=n!==i?s.substring(r,he):n,r===i&&(r=he,92===s.charCodeAt(he)?(n=f,he++):(n=i,0===ge&&Se(lt)),n!==i?(s.length>he?(a=s.charAt(he),he++):(a=i,0===ge&&Se(ot)),a!==i?r=oe(a):(he=r,r=i)):(he=r,r=i),r===i&&(r=he,123===s.charCodeAt(he)?(n=m,he++):(n=i,0===ge&&Se(ut)),n!==i?(a=he,ge++,123===s.charCodeAt(he)?(l=m,he++):(l=i,0===ge&&Se(ut)),ge--,l===i?a=void 0:(he=a,a=i),a!==i?(n=[n,a],r=n):(he=r,r=i)):(he=r,r=i)))}else e=i;e!==i&&(e=e.join(""));return t=e,ve[o]={nextPos:he,result:t},t}(),r!==i&&(r=function(e){return{type:t.templated.tel,value:e}}(r)),e=r))),ve[b]={nextPos:he,result:e},e);var v}function qe(){let t,e;const s=40*he+9,r=ve[s];return r?(he=r.nextPos,r.result):(t=he,Ve(),e=Oe(),e!==i?(Ve(),t=e):(he=t,t=i),ve[s]={nextPos:he,result:t},t)}function Oe(){let e,r,n,a,l,o;const u=40*he+10,c=ve[u];return c?(he=c.nextPos,c.result):(e=he,r=Pe(),r!==i?(Ve(),63===s.charCodeAt(he)?(n=b,he++):(n=i,0===ge&&Se(ct)),n!==i?(Ve(),a=Oe(),a!==i?(Ve(),58===s.charCodeAt(he)?(l=g,he++):(l=i,0===ge&&Se(dt)),l!==i?(Ve(),o=Oe(),o!==i?e={type:t.ter,cond:r,ifTrue:a,ifFalse:o}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=Pe()),ve[u]={nextPos:he,result:e},e)}function Pe(){let e,r,n,a;const l=40*he+11,o=ve[l];return o?(he=o.nextPos,o.result):(e=he,r=Le(),r!==i?(Ve(),s.substr(he,2)===v?(n=v,he+=2):(n=i,0===ge&&Se(ht)),n!==i?(Ve(),a=Pe(),a!==i?e={type:t.elv,cond:r,ifFalse:a}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=Le()),ve[l]={nextPos:he,result:e},e)}function Le(){let e,r,n,a;const l=40*he+12,o=ve[l];return o?(he=o.nextPos,o.result):(e=he,r=_e(),r!==i?(Ve(),s.substr(he,2)===y?(n=y,he+=2):(n=i,0===ge&&Se(pt)),n!==i?(Ve(),a=Le(),a!==i?e={type:t.nullc,lhs:r,rhs:a}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=_e()),ve[l]={nextPos:he,result:e},e)}function _e(){let e,r,n,a,l,o;const u=40*he+13,c=ve[u];if(c)return he=c.nextPos,c.result;if(e=he,r=ke(),r!==i){for(n=[],a=he,Ve(),s.substr(he,2)===w?(l=w,he+=2):(l=i,0===ge&&Se(ft)),l!==i?(Ve(),o=ke(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);a!==i;)n.push(a),a=he,Ve(),s.substr(he,2)===w?(l=w,he+=2):(l=i,0===ge&&Se(ft)),l!==i?(Ve(),o=ke(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);e=function(e,s){let r=e;for(const e of s)r={type:t.or,lhs:r,rhs:e};return r}(r,n)}else he=e,e=i;return ve[u]={nextPos:he,result:e},e}function ke(){let e,r,n,a,l,o;const u=40*he+14,c=ve[u];if(c)return he=c.nextPos,c.result;if(e=he,r=Me(),r!==i){for(n=[],a=he,Ve(),s.substr(he,2)===x?(l=x,he+=2):(l=i,0===ge&&Se(mt)),l!==i?(Ve(),o=Me(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);a!==i;)n.push(a),a=he,Ve(),s.substr(he,2)===x?(l=x,he+=2):(l=i,0===ge&&Se(mt)),l!==i?(Ve(),o=Me(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);e=function(e,s){let r=e;for(const e of s)r={type:t.and,lhs:r,rhs:e};return r}(r,n)}else he=e,e=i;return ve[u]={nextPos:he,result:e},e}function Me(){let e,s,r,n,a,l;const o=40*he+15,u=ve[o];if(u)return he=u.nextPos,u.result;if(e=he,s=Re(),s!==i){for(r=[],n=he,Ve(),a=He(),a!==i?(Ve(),l=Re(),l!==i?n=ue(0,a,l):(he=n,n=i)):(he=n,n=i);n!==i;)r.push(n),n=he,Ve(),a=He(),a!==i?(Ve(),l=Re(),l!==i?n=ue(0,a,l):(he=n,n=i)):(he=n,n=i);e=function(e,s){let r=e;for(const e of s)r={type:t.eq,op:e.op,lhs:r,rhs:e.rhs};return r}(s,r)}else he=e,e=i;return ve[o]={nextPos:he,result:e},e}function Re(){let e,s,r,n,a,l;const o=40*he+16,u=ve[o];if(u)return he=u.nextPos,u.result;if(e=he,s=De(),s!==i){for(r=[],n=he,Ve(),a=je(),a!==i?(Ve(),l=De(),l!==i?n=ce(0,a,l):(he=n,n=i)):(he=n,n=i);n!==i;)r.push(n),n=he,Ve(),a=je(),a!==i?(Ve(),l=De(),l!==i?n=ce(0,a,l):(he=n,n=i)):(he=n,n=i);e=function(e,s){let r=e;for(const e of s)r={type:t.cmp,op:e.op,lhs:r,rhs:e.rhs};return r}(s,r)}else he=e,e=i;return ve[o]={nextPos:he,result:e},e}function De(){let e,r,n;const a=40*he+17,l=ve[a];return l?(he=l.nextPos,l.result):(e=he,33===s.charCodeAt(he)?(r=E,he++):(r=i,0===ge&&Se(bt)),r!==i?(Ve(),n=De(),n!==i?e={type:t.not,expr:n}:(he=e,e=i)):(he=e,e=i),e===i&&(e=function(){let e,s,r,n,a;const l=40*he+18,o=ve[l];if(o)return he=o.nextPos,o.result;if(e=he,s=ze(),s!==i){if(Ve(),r=[],n=he,a=Ne(),a!==i?(Ve(),n=a):(he=n,n=i),n!==i)for(;n!==i;)r.push(n),n=he,a=Ne(),a!==i?(Ve(),n=a):(he=n,n=i);else r=i;r!==i?e={type:t.access,lhs:s,rhs:r}:(he=e,e=i)}else he=e,e=i;e===i&&(e=ze());return ve[l]={nextPos:he,result:e},e}()),ve[a]={nextPos:he,result:e},e)}function Ne(){let e;const r=40*he+19,n=ve[r];return n?(he=n.nextPos,n.result):(e=function(){let e,r,n;const a=40*he+20,l=ve[a];if(l)return he=l.nextPos,l.result;ge++,e=he,s.substr(he,2)===A?(r=A,he+=2):(r=i,0===ge&&Se(vt));r===i&&(46===s.charCodeAt(he)?(r=S,he++):(r=i,0===ge&&Se(yt)));r!==i?(Ve(),n=Be(),n!==i?e={type:t.member,ns:"?."===r,rhs:n.value}:(he=e,e=i)):(he=e,e=i);ge--,e===i&&(r=i,0===ge&&Se(gt));return ve[a]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r,n,a,l;const o=40*he+21,u=ve[o];if(u)return he=u.nextPos,u.result;ge++,e=he,s.substr(he,2)===A?(r=A,he+=2):(r=i,0===ge&&Se(vt));r===i&&(r=null);91===s.charCodeAt(he)?(n=T,he++):(n=i,0===ge&&Se(xt));n!==i?(Ve(),a=Oe(),a!==i?(Ve(),93===s.charCodeAt(he)?(l=C,he++):(l=i,0===ge&&Se(Et)),l!==i?e={type:t.subscript,ns:null!==r,rhs:a}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i);ge--,e===i&&(r=i,0===ge&&Se(wt));return ve[o]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r,n,a,l,o,u,c;const d=40*he+22,h=ve[d];if(h)return he=h.nextPos,h.result;ge++,e=he,s.substr(he,2)===A?(r=A,he+=2):(r=i,0===ge&&Se(vt));r===i&&(r=null);40===s.charCodeAt(he)?(n=q,he++):(n=i,0===ge&&Se(St));if(n!==i){for(Ve(),a=he,l=Oe(),l!==i?(o=Ve(),a=l):(he=a,a=i),a===i&&(a=null),l=[],o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);o!==i;)l.push(o),o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);41===s.charCodeAt(he)?(o=P,he++):(o=i,0===ge&&Se(Ct)),o!==i?(f=l,e={type:t.method,ns:null!==r,args:null===(p=a)?[]:[p,...f]}):(he=e,e=i)}else he=e,e=i;var p,f;ge--,e===i&&(r=i,0===ge&&Se(At));return ve[d]={nextPos:he,result:e},e}())),ve[r]={nextPos:he,result:e},e)}function ze(){let e,r,n,a;const l=40*he+23,o=ve[l];return o?(he=o.nextPos,o.result):(e=he,40===s.charCodeAt(he)?(r=q,he++):(r=i,0===ge&&Se(St)),r!==i?(Ve(),n=Oe(),n!==i?(Ve(),41===s.charCodeAt(he)?(a=P,he++):(a=i,0===ge&&Se(Ct)),a!==i?e=n:(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=function(){let e,r,n,a,l,o,u,c;const d=40*he+24,h=ve[d];if(h)return he=h.nextPos,h.result;if(ge++,e=he,r=function(){let e,r,n,a,l,o,u,c;const d=40*he+35,h=ve[d];if(h)return he=h.nextPos,h.result;ge++,e=he,35===s.charCodeAt(he)?(r=F,he++):(r=i,0===ge&&Se(Zt));if(r!==i){if(n=he,a=he,l=he,o=s.charAt(he),Z.test(o)?he++:(o=i,0===ge&&Se(Yt)),o!==i){for(u=[],c=s.charAt(he),Y.test(c)?he++:(c=i,0===ge&&Se(Kt));c!==i;)u.push(c),c=s.charAt(he),Y.test(c)?he++:(c=i,0===ge&&Se(Kt));o=[o,u],l=o}else he=l,l=i;if(a=l!==i?s.substring(a,he):l,a!==i?(58===s.charCodeAt(he)?(l=g,he++):(l=i,0===ge&&Se(dt)),l!==i?n=a:(he=n,n=i)):(he=n,n=i),n===i&&(n=null),a=he,l=he,o=s.charAt(he),Z.test(o)?he++:(o=i,0===ge&&Se(Yt)),o!==i){for(u=[],c=s.charAt(he),Y.test(c)?he++:(c=i,0===ge&&Se(Kt));c!==i;)u.push(c),c=s.charAt(he),Y.test(c)?he++:(c=i,0===ge&&Se(Kt));o=[o,u],l=o}else he=l,l=i;a=l!==i?s.substring(a,he):l,a!==i?e={type:t.function,module:n,value:a}:(he=e,e=i)}else he=e,e=i;ge--,e===i&&(r=i,0===ge&&Se(Qt));return ve[d]={nextPos:he,result:e},e}(),r!==i)if(40===s.charCodeAt(he)?(n=q,he++):(n=i,0===ge&&Se(St)),n!==i){for(Ve(),a=he,l=Oe(),l!==i?(o=Ve(),a=l):(he=a,a=i),a===i&&(a=null),l=[],o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);o!==i;)l.push(o),o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);41===s.charCodeAt(he)?(o=P,he++):(o=i,0===ge&&Se(Ct)),o!==i?e=function(e,s,r){const i=null===s?[]:[s,...r];return{type:t.call,value:e,args:i}}(r,a,l):(he=e,e=i)}else he=e,e=i;else he=e,e=i;ge--,e===i&&(r=i,0===ge&&Se(qt));return ve[d]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e;const r=40*he+25,n=ve[r];if(n)return he=n.nextPos,n.result;e=function(){let e,r,n,a,l,o,u,c,d,h;const p=40*he+29,f=ve[p];if(f)return he=f.nextPos,f.result;ge++,e=he,r=he,n=he,45===s.charCodeAt(he)?(a=R,he++):(a=i,0===ge&&Se(Nt));a===i&&(a=null);l=he,o=[],u=s.charAt(he),G.test(u)?he++:(u=i,0===ge&&Se(zt));if(u!==i)for(;u!==i;)o.push(u),u=s.charAt(he),G.test(u)?he++:(u=i,0===ge&&Se(zt));else o=i;if(o!==i){if(u=he,46===s.charCodeAt(he)?(c=S,he++):(c=i,0===ge&&Se(yt)),c!==i){for(d=[],h=s.charAt(he),G.test(h)?he++:(h=i,0===ge&&Se(zt));h!==i;)d.push(h),h=s.charAt(he),G.test(h)?he++:(h=i,0===ge&&Se(zt));c=[c,d],u=c}else he=u,u=i;u===i&&(u=null),o=[o,u],l=o}else he=l,l=i;if(l===i)if(l=he,46===s.charCodeAt(he)?(o=S,he++):(o=i,0===ge&&Se(yt)),o!==i){if(u=[],c=s.charAt(he),G.test(c)?he++:(c=i,0===ge&&Se(zt)),c!==i)for(;c!==i;)u.push(c),c=s.charAt(he),G.test(c)?he++:(c=i,0===ge&&Se(zt));else u=i;u!==i?(o=[o,u],l=o):(he=l,l=i)}else he=l,l=i;l!==i?(a=[a,l],n=a):(he=n,n=i);r=n!==i?s.substring(r,he):n;r!==i&&(r={type:t.literal,value:parseFloat(r)});e=r,ge--,e===i&&(r=i,0===ge&&Se(Dt));return ve[p]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r;const n=40*he+26,a=ve[n];if(a)return he=a.nextPos,a.result;ge++,e=he,s.substr(he,4)===L?(r=L,he+=4):(r=i,0===ge&&Se(Pt));r!==i&&(r={type:t.literal,value:!0});e=r,e===i&&(e=he,s.substr(he,5)===_?(r=_,he+=5):(r=i,0===ge&&Se(Lt)),r!==i&&(r={type:t.literal,value:!1}),e=r);ge--,e===i&&(r=i,0===ge&&Se(Ot));return ve[n]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r;const n=40*he+27,a=ve[n];if(a)return he=a.nextPos,a.result;ge++,e=he,s.substr(he,4)===k?(r=k,he+=4):(r=i,0===ge&&Se(kt));r!==i&&(r={type:t.literal,value:null});e=r,ge--,e===i&&(r=i,0===ge&&Se(_t));return ve[n]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r;const n=40*he+28,a=ve[n];if(a)return he=a.nextPos,a.result;ge++,e=he,s.substr(he,9)===M?(r=M,he+=9):(r=i,0===ge&&Se(Rt));r!==i&&(r={type:t.literal,value:void 0});e=r,ge--,e===i&&(r=i,0===ge&&Se(Mt));return ve[n]={nextPos:he,result:e},e}(),e===i&&(e=Ie(),e===i&&(e=function(){let e,r,n,a,l,o,u;const c=40*he+33,d=ve[c];if(d)return he=d.nextPos,d.result;ge++,e=he,91===s.charCodeAt(he)?(r=T,he++):(r=i,0===ge&&Se(xt));if(r!==i){for(Ve(),n=Oe(),n===i&&(n=null),Ve(),a=[],l=he,44===s.charCodeAt(he)?(o=O,he++):(o=i,0===ge&&Se(Tt)),o!==i?(Ve(),u=Oe(),u!==i?(Ve(),l=u):(he=l,l=i)):(he=l,l=i);l!==i;)a.push(l),l=he,44===s.charCodeAt(he)?(o=O,he++):(o=i,0===ge&&Se(Tt)),o!==i?(Ve(),u=Oe(),u!==i?(Ve(),l=u):(he=l,l=i)):(he=l,l=i);93===s.charCodeAt(he)?(l=C,he++):(l=i,0===ge&&Se(Et)),l!==i?e=function(e,s){const r=null===e?[]:[e,...s];return{type:t.array,value:r}}(n,a):(he=e,e=i)}else he=e,e=i;ge--,e===i&&(r=i,0===ge&&Se(Jt));return ve[c]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r,n,a,l,o,u,c,d,h,p;const f=40*he+34,b=ve[f];if(b)return he=b.nextPos,b.result;ge++,e=he,123===s.charCodeAt(he)?(r=m,he++):(r=i,0===ge&&Se(ut));if(r!==i){for(Ve(),n=he,a=Ie(),a!==i?(l=Ve(),58===s.charCodeAt(he)?(o=g,he++):(o=i,0===ge&&Se(dt)),o!==i?(u=Ve(),c=Oe(),c!==i?n=[a,c]:(he=n,n=i)):(he=n,n=i)):(he=n,n=i),n===i&&(n=null),a=Ve(),l=[],o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(c=Ve(),d=Ie(),d!==i?(Ve(),58===s.charCodeAt(he)?(h=g,he++):(h=i,0===ge&&Se(dt)),h!==i?(Ve(),p=Oe(),p!==i?(Ve(),o=[d,p]):(he=o,o=i)):(he=o,o=i)):(he=o,o=i)):(he=o,o=i);o!==i;)l.push(o),o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(c=Ve(),d=Ie(),d!==i?(Ve(),58===s.charCodeAt(he)?(h=g,he++):(h=i,0===ge&&Se(dt)),h!==i?(Ve(),p=Oe(),p!==i?(Ve(),o=[d,p]):(he=o,o=i)):(he=o,o=i)):(he=o,o=i)):(he=o,o=i);125===s.charCodeAt(he)?(o=I,he++):(o=i,0===ge&&Se(Ut)),o!==i?(y=l,w=[],null!==(v=n)&&w.push(v),w.push.apply(w,y),e={type:t.dict,value:w}):(he=e,e=i)}else he=e,e=i;var v,y,w;ge--,e===i&&(r=i,0===ge&&Se(Xt));return ve[f]={nextPos:he,result:e},e}()))))));return ve[r]={nextPos:he,result:e},e}(),e===i&&(e=Be()))),ve[l]={nextPos:he,result:e},e)}function Ie(){let e,r,n,a,l;const o=40*he+30,u=ve[o];if(u)return he=u.nextPos,u.result;if(ge++,e=he,39===s.charCodeAt(he)?(r=D,he++):(r=i,0===ge&&Se(Ft)),r!==i){for(n=he,a=[],l=s.charAt(he),J.test(l)?he++:(l=i,0===ge&&Se($t));l!==i;)a.push(l),l=s.charAt(he),J.test(l)?he++:(l=i,0===ge&&Se($t));n=s.substring(n,he),39===s.charCodeAt(he)?(a=D,he++):(a=i,0===ge&&Se(Ft)),a!==i?e={type:t.literal,value:n}:(he=e,e=i)}else he=e,e=i;if(e===i){if(e=he,34===s.charCodeAt(he)?(r=N,he++):(r=i,0===ge&&Se(Bt)),r!==i){for(n=he,a=[],l=s.charAt(he),X.test(l)?he++:(l=i,0===ge&&Se(Ht));l!==i;)a.push(l),l=s.charAt(he),X.test(l)?he++:(l=i,0===ge&&Se(Ht));n=s.substring(n,he),34===s.charCodeAt(he)?(a=N,he++):(a=i,0===ge&&Se(Bt)),a!==i?e=function(e){return{type:t.literal,value:e}}(n):(he=e,e=i)}else he=e,e=i;if(e===i)if(e=he,96===s.charCodeAt(he)?(r=z,he++):(r=i,0===ge&&Se(jt)),r!==i){for(n=[],a=Fe(),a===i&&(a=$e());a!==i;)n.push(a),a=Fe(),a===i&&(a=$e());96===s.charCodeAt(he)?(a=z,he++):(a=i,0===ge&&Se(jt)),a!==i?e={type:t.tstring,parts:n}:(he=e,e=i)}else he=e,e=i}return ge--,e===i&&(r=i,0===ge&&Se(It)),ve[o]={nextPos:he,result:e},e}function Fe(){let t,e,r,n;const a=40*he+31,l=ve[a];return l?(he=l.nextPos,l.result):(ge++,t=he,123===s.charCodeAt(he)?(e=m,he++):(e=i,0===ge&&Se(ut)),e!==i?(Ve(),r=Oe(),r!==i?(Ve(),125===s.charCodeAt(he)?(n=I,he++):(n=i,0===ge&&Se(Ut)),n!==i?t=r:(he=t,t=i)):(he=t,t=i)):(he=t,t=i),ge--,t===i&&(e=i,0===ge&&Se(Vt)),ve[a]={nextPos:he,result:t},t)}function $e(){let e,r,n,a,l;const o=40*he+32,u=ve[o];if(u)return he=u.nextPos,u.result;if(ge++,e=he,r=[],n=he,a=[],l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt)),l!==i)for(;l!==i;)a.push(l),l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt));else a=i;if(n=a!==i?s.substring(n,he):a,n===i&&(n=he,92===s.charCodeAt(he)?(a=f,he++):(a=i,0===ge&&Se(lt)),a!==i?(s.length>he?(l=s.charAt(he),he++):(l=i,0===ge&&Se(ot)),l!==i?n=l:(he=n,n=i)):(he=n,n=i)),n!==i)for(;n!==i;){if(r.push(n),n=he,a=[],l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt)),l!==i)for(;l!==i;)a.push(l),l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt));else a=i;n=a!==i?s.substring(n,he):a,n===i&&(n=he,92===s.charCodeAt(he)?(a=f,he++):(a=i,0===ge&&Se(lt)),a!==i?(s.length>he?(l=s.charAt(he),he++):(l=i,0===ge&&Se(ot)),l!==i?n=de(l):(he=n,n=i)):(he=n,n=i))}else r=i;return r!==i&&(r={type:t.literal,value:r.join("")}),e=r,e===i&&(e=he,123===s.charCodeAt(he)?(r=m,he++):(r=i,0===ge&&Se(ut)),r!==i&&(r={type:t.literal,value:r}),e=r),ge--,e===i&&(r=i,0===ge&&Se(Wt)),ve[o]={nextPos:he,result:e},e}function Be(){let e,r,n,a,l,o;const u=40*he+36,c=ve[u];if(c)return he=c.nextPos,c.result;if(ge++,e=he,r=he,n=he,a=s.charAt(he),Z.test(a)?he++:(a=i,0===ge&&Se(Yt)),a!==i){for(l=[],o=s.charAt(he),Y.test(o)?he++:(o=i,0===ge&&Se(Kt));o!==i;)l.push(o),o=s.charAt(he),Y.test(o)?he++:(o=i,0===ge&&Se(Kt));a=[a,l],n=a}else he=n,n=i;return r=n!==i?s.substring(r,he):n,r!==i&&(r={type:t.symbol,value:r}),e=r,ge--,e===i&&(r=i,0===ge&&Se(te)),ve[u]={nextPos:he,result:e},e}function He(){let t;const e=40*he+37,r=ve[e];return r?(he=r.nextPos,r.result):(s.substr(he,2)===$?(t=$,he+=2):(t=i,0===ge&&Se(ee)),t===i&&(s.substr(he,2)===B?(t=B,he+=2):(t=i,0===ge&&Se(se))),ve[e]={nextPos:he,result:t},t)}function je(){let t;const e=40*he+38,r=ve[e];return r?(he=r.nextPos,r.result):(s.substr(he,2)===H?(t=H,he+=2):(t=i,0===ge&&Se(re)),t===i&&(62===s.charCodeAt(he)?(t=j,he++):(t=i,0===ge&&Se(ie)),t===i&&(s.substr(he,2)===V?(t=V,he+=2):(t=i,0===ge&&Se(ne)),t===i&&(60===s.charCodeAt(he)?(t=U,he++):(t=i,0===ge&&Se(ae))))),ve[e]={nextPos:he,result:t},t)}function Ve(){let t,e;const r=40*he+39,n=ve[r];if(n)return he=n.nextPos,n.result;for(ge++,t=[],e=s.charAt(he),K.test(e)?he++:(e=i,0===ge&&Se(le));e!==i;)t.push(e),e=s.charAt(he),K.test(e)?he++:(e=i,0===ge&&Se(le));return ge--,ve[r]={nextPos:he,result:t},t}fe=l();const Ue=fe!==i&&he===s.length;function We(){throw fe!==i&&he<s.length&&Se({type:"end"}),t=be,r=me<s.length?function(t=he){const e=s.codePointAt(t);return void 0===e?"":String.fromCodePoint(e)}(me):null,n=me<s.length?Ae(me,me+1):Ae(me,me),new e(e.buildMessage(t,r),t,r,n);var t,r,n}return r.peg$library?{peg$result:fe,peg$currPos:he,peg$FAILED:i,peg$maxFailExpected:be,peg$maxFailPos:me,peg$success:Ue,peg$throw:Ue?void 0:We}:Ue?fe:void We()}class r{#t;#e;constructor(t,e){this.#t=t,this.#e=e}#s(t){if("self"===t)return this.#e[this.#e.length-1];for(let e=this.#e.length-1;e>=0;e--){const s=this.#e[e];if(null!=s&&("object"==typeof s||"function"==typeof s)&&t in s)return s[t]}}#r;#i(){return this.#r||(this.#r=new Proxy(this.#e,{get:(t,e)=>this.#s(e)})),this.#r}[t.and](t){return this.visit(t.lhs)&&this.visit(t.rhs)}[t.or](t){return this.visit(t.lhs)||this.visit(t.rhs)}[t.nullc](t){const e=this.visit(t.lhs);return null!=e?e:this.visit(t.rhs)}[t.not](t){return!this.visit(t.expr)}[t.eq](t){const e=this.visit(t.lhs)===this.visit(t.rhs);return"=="===t.op?e:!e}[t.cmp](t){const e=this.visit(t.lhs),s=this.visit(t.rhs);switch(t.op){case">":return e>s;case"<":return e<s;case">=":return e>=s;case"<=":return e<=s;default:throw new Error(`unknown cmp op ${t.op}`)}}[t.call](t){const e=t.value,s=null===e.module?this.#t:this.#t?.[e.module];if(!s)throw new Error(`Module "${e.module}" not found`);const r=s[e.value];if(!r)throw new Error(`Function "#${null===e.module?"":`${e.module}:`}${e.value}" not found`);const i=t.args.map(t=>this.visit(t));return r.apply(this.#i(),i)}[t.literal](t){return t.value}[t.tstring](t){let e="";const s=t.parts;for(let t=0,r=s.length;t<r;t++){const r=this.visit(s[t]);null!=r&&(e+=r)}return e}[t.symbol](t){return this.#s(t.value)}[t.dict](t){return Object.fromEntries(t.value.map(t=>[t[0].value,this.visit(t[1])]))}[t.array](t){return t.value.map(t=>this.visit(t))}[t.ter](t){return this.visit(t.cond)?this.visit(t.ifTrue):this.visit(t.ifFalse)}[t.elv](t){const e=this.visit(t.cond);return e||this.visit(t.ifFalse)}[t.access](e){let s,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 t.member:a=r[n.rhs];break;case t.subscript:a=r[this.visit(n.rhs)];break;case t.method:{if(!r)throw new Error(`Method missing "${e.rhs[i-1].rhs}"`);const t=n.args.map(t=>this.visit(t));a=r.apply(s,t);break}}s=r,r=a}return r}visit(t,...e){return this[t.type](t,...e)}visitRoot(e,s){return s?e.map(e=>{switch(e.type){case t.templated.tel:return{type:t.dom.t,value:e.value};case t.templated.tet:return{type:t.dom.t,value:this.visit(e.value)};case t.templated.teh:return{type:t.dom.h,value:this.visit(e.value)};case t.templated.ten:return{type:t.dom.n,value:this.visit(e.value)};default:throw new Error(`unknown node type ${e.type.toString()}`)}}):this.visit(e)}}class i{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static#n=new Map;static#a=1e3;static parse(t,e){const r=e?.toString()+t;if(!this.#n.has(r)){if(this.#n.size>=this.#a){const t=this.#n.keys().next().value;this.#n.delete(t)}this.#n.set(r,s(t,{startRule:e===i.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}return this.#n.get(r)}static evaluate(t,e,s,n){return new r(t,e).visitRoot(s,n===i.MODE_TEMPLATED)}static interpret(t,e,s,r){return i.evaluate(t,e,i.parse(s,r),r)}}class n{#t;#e;constructor(t,e){this.#t=t,this.#e=e}withModule(t,e){const s=t?{[t]:e}:e;return new n({...this.#t,...s},this.#e)}withOverlay(...t){return new n(this.#t,0===t.length?this.#e:[...this.#e,...t])}evaluate(t,e){return i.interpret(this.#t,this.#e,t,e)}evaluateExpression(t){return this.evaluate(t,i.MODE_EXPRESSION)}evaluateTemplated(t){return this.evaluate(t,i.MODE_TEMPLATED)}}class a{static fromHtml(...t){const e=document.createElement("template");return e.innerHTML=t.map(t=>t.trim()).join(""),document.adoptNode(e.content)}static toHtml(t){var e=document.createElement("template");return e.content.appendChild(t),e.innerHTML}static isBlank(t){return 0===t.childElementCount&&""===t.textContent.trim()}static from(...t){const e=new DocumentFragment;for(const s of t)e.appendChild(s);return e}static fromChildNodes(t){const e=new DocumentFragment;for(;t.firstChild;)e.appendChild(t.firstChild);return e}}class l{static id=0;static uid(t){return`${t}-${++l.id}`}static defaultValue(t,e,s){return t.hasAttribute(e)||t.setAttribute(e,s),t.getAttribute(e)}static forward(t,e,s){e.getAttributeNames().filter(e=>e.startsWith(t)).forEach(r=>{const i=r.substring(t.length);if("class"===i){const r=e.getAttribute(`${t}class`)?.split(/\s+/).filter(t=>t.length)??[];return void s.classList.add(...r)}s.setAttribute(i,e.getAttribute(r))})}static toggle(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}static flip(t,e){t.hasAttribute(e)?t.removeAttribute(e):t.setAttribute(e,"")}static set(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)}}class o{static from(t){const e=Array.from(t.children).filter(t=>t.matches("[slot]")).map(t=>{t.remove();const e=t.getAttribute("slot")||"unnamed";return t.removeAttribute("slot"),[e,o.slotFromNode(t)]}),s={};s.default=new DocumentFragment,s.default.append(...t.childNodes);for(const[t,r]of e)t in s||(s[t]=new DocumentFragment),s[t].append(r);return s}static slotFromNode(t){return t instanceof HTMLTemplateElement?document.adoptNode(t.content):t instanceof HTMLScriptElement&&""!==t.type&&"text/javascript"!==t.type?a.fromHtml(t.innerHTML):t}}class u{static isParsed(t){for(let e=t;e;e=e.parentNode)if(e.nextSibling)return!0;return!1}static waitParsed(t){return"complete"===t.ownerDocument.readyState||u.isParsed(t)?Promise.resolve(t):new Promise(e=>{const s=new AbortController,r=()=>{s.abort(),i.disconnect(),e(t)};t.ownerDocument.addEventListener("DOMContentLoaded",r,{signal:s.signal});const i=new MutationObserver(()=>{u.isParsed(t)&&r()}),n=t.parentNode;i.observe(n,{childList:!0})})}static queryChildren(t,e){for(const s of t.children)if(s.matches(e))return s;return null}static queryChildrenAll(t,e){const s=[];for(const r of t.children)r.matches(e)&&s.push(r);return s}}class c{#l=new Set;removed(t){return this.#l.has(t)}remove(t){t.replaceChildren?.(),Object.keys(t.dataset||{}).filter(t=>t.startsWith("tpl")).forEach(e=>{delete t.dataset[e]}),this.#l.add(t)}popData(t,e){const s=t.dataset[e];return delete t.dataset[e],s}prepend(t,e){t.parentNode.insertBefore(e,t)}append(t,e){t.parentNode.insertBefore(e,t.nextSibling)}replace(t,e){this.prepend(t,e),this.remove(t)}cleanup(){for(const t of this.#l)t.remove();this.#l.clear()}}class d{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplText","tplHtml","tplRemove","tplVerbatim"];static tplIf(t,e,s,r,n){i.interpret(r,n,e)||s.remove(t)}static tplWith(t,e,s,r,n){const a=i.interpret(r,n,e),l=s.popData(t,"tplVar"),o=new f(t,r,n).withOverlay(l?{[l]:a}:a).render();s.replace(t,o)}static tplEach(t,e,s,r,n){const a=s.popData(t,"tplVar"),l=new f(t,r,n),o=i.interpret(r,n,e);if(!o?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);for(const e of o)s.prepend(t,l.withOverlay(a?{[a]:e}:e).render());s.remove(t)}static tplWhen(t,e,s,r,n){i.interpret(r,n,e)||s.remove(t)}static tplVerbatim(t,e,s,r,i){const n=t.cloneNode(!0);s.replace(t,n)}static tplRemove(t,e,s,r,i){switch(e.toLowerCase()){case"tag":{const e=new DocumentFragment;for(;t.firstChild;)e.appendChild(t.firstChild);"tplVerbatim"in t.dataset?(s.popData(t,"tplVerbatim"),s.replace(t,e)):(s.append(t,e),s.remove(t));break}case"body":t.replaceChildren();break;case"all":s.remove(t)}}static tplText(t,e,s,r,n){const a=i.interpret(r,n,e),l=t.cloneNode();l.replaceChildren(null==a?"":a),s.replace(t,l)}static tplHtml(t,e,s,r,n){const a=i.interpret(r,n,e),l=t.cloneNode();l.innerHTML=null==a?"":a,s.replace(t,l)}static tplClassAppend(t,e,s,r,n){const a=i.interpret(r,n,e);if(!a)return;const l=(Array.isArray(a)?a:[a]).flatMap(t=>"string"==typeof t?t.split(" "):t).filter(Boolean);0!==l.length&&t.classList.add(...l)}static tplAttrAppend(t,e,s,r,n){const a=i.interpret(r,n,e);if(!a||0===a.length)return;(Array.isArray(a[0])?a:[a]).forEach(([e,s])=>{t.setAttribute(e,s)})}static textNode(e,s,r,n,l){for(const o of i.interpret(n,l,s,i.MODE_TEMPLATED))if(null!=o.value)switch(o.type){case t.dom.t:r.prepend(e,document.createTextNode(o.value));break;case t.dom.h:r.prepend(e,a.fromHtml(o.value));break;case t.dom.n:r.prepend(e,o.value)}r.remove(e)}}const h=new Map;function p(t){let e=h.get(t);return e||(h.size>=1e3&&h.delete(h.keys().next().value),e=t.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase(),h.set(t,e)),e}class f{static fromHtml(t,e,...s){return new f(a.fromHtml(t),e,s)}static fromSelector(t,e,...s){const r=document.querySelector(t);if(!(r instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");const i=document.adoptNode(r.content);return new f(i,e,s)}static fromTemplate(t,e,...s){const r=document.adoptNode(t.content);return new f(r,e,s)}static fromFragment(t,e,...s){return new f(t,e,s)}#o;#t;#e;constructor(t,e,s){this.#o=t,this.#t=e,this.#e=s}withContext({modules:t,data:e}){return new f(this.#o,t,e)}withContextFrom(t){return this.withContext(t.context())}withFragment(t){return new f(t,this.#t,this.#e)}withModule(t,e){const s=t?{[t]:e}:e;return new f(this.#o,{...this.#t,...s},this.#e)}withModules(t){return new f(this.#o,t,this.#e)}withData(t){return new f(this.#o,this.#t,t)}withOverlay(...t){return new f(this.#o,this.#t,0===t.length?this.#e:[...this.#e,...t])}evaluate(t,e,...s){return new n(this.#t,this.#e).withOverlay(...s).evaluate(t,e)}evaluator(){return new n(this.#t,this.#e)}render(){try{const t=new c,e=document.importNode(this.#o,!0),s=e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e:(()=>{const t=new DocumentFragment;return t.appendChild(e),t})(),r=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,f.#u);let n;for(;null!==(n=r.nextNode());){if(t.cleanup(),n.nodeType===Node.TEXT_NODE){try{d.textNode(n,n.nodeValue,t,this.#t,this.#e)}catch(t){throw new m("Error evaluating text node",n,t)}continue}const e=n;for(const s of d.ORDERED_COMMANDS){if(!(s in e.dataset))continue;const r=t.popData(e,s);try{d[s](e,r,t,this.#t,this.#e)}catch(t){throw new m(`Error evaluating command ${s}`,e,t)}if(t.removed(e))break}for(const s of Object.keys(e.dataset||{})){if(!s.startsWith("tpl"))continue;const r=p(s);try{const n=t.popData(e,s),a=i.interpret(this.#t,this.#e,n);if("boolean"==typeof a){l.toggle(e,r,a);continue}null!=a&&e.setAttribute(r,a)}catch(t){throw new m(`Error evaluating command ${s}`,e,t)}}}return t.cleanup(),s}catch(t){throw new m("Error rendering template",this.#o,t)}}renderTo(t){t.replaceChildren(this.render())}appendTo(t){t.appendChild(this.render())}renderToSelector(t){const e=document.querySelector(t);e&&this.renderTo(e)}appendToSelector(t){const e=document.querySelector(t);e&&this.appendTo(e)}static#u(t){if(t.nodeType===Node.TEXT_NODE)return t.nodeValue.includes("{{")&&t.nodeValue.includes("}}")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;for(const e of t.attributes)if(e.name.startsWith("data-tpl-"))return NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}}class m extends Error{constructor(t,e,s){super(`${t} in \`${m.stringify(e)}\``,{cause:s}),this.name="RenderError",this.node=e.cloneNode(!0)}static stringify(t){const e=document.createElement("template");return e.content.appendChild(m.#c(t.cloneNode(!0))),e.innerHTML}static#c(t){t.nodeType===Node.TEXT_NODE&&(t.nodeValue=t.nodeValue.trim());for(let e=0;e<t.childNodes.length;e++){const s=t.childNodes[e];s.nodeType===Node.TEXT_NODE?(s.nodeValue=s.nodeValue.trim(),0===s.nodeValue.length&&(t.removeChild(s),e--)):s.nodeType===Node.ELEMENT_NODE&&m.#c(s)}return t}}class b{#d=new Map;constructor(){document.addEventListener("DOMContentLoaded",async()=>{await this.settle(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1}))})}#h=new Map;enqueue(t){if(this.#d.has(t))return;const{promise:e,resolve:s}=Promise.withResolvers(),r=u.waitParsed(t).then(()=>t.upgrade()).finally(()=>{this.#d.delete(t),this.#h.delete(t),s()});this.#d.set(t,r),this.#h.set(t,e)}async settle(){for(;0!==this.#h.size;)await Promise.all(Array.from(this.#h.values()))}get entries(){return this.#d.entries()}}class g{#p={};#f=!1;#m={string:{unmarshal:(t,e,s)=>t,marshal:(t,e,s)=>null==t?null:String(t)},number:{unmarshal:(t,e,s)=>null===t?null:Number(t),marshal:(t,e,s)=>null==t?null:String(t)},presence:{unmarshal:(t,e,s)=>null!==t,marshal:(t,e,s)=>t?"":null},bool:{unmarshal:(t,e,s)=>"true"===t,marshal:(t,e,s)=>null==t?null:String(!0===t)},json:{unmarshal:(t,e,s)=>null===t?null:JSON.parse(t),marshal:(t,e,s)=>null==t?null:JSON.stringify(t)},csv:{unmarshal:(t,e,s)=>null===t?[]:t.split(",").map(t=>t.trim()).filter(t=>t),marshal:(t,e,s)=>null==t?null:t.join(",")},csvm:{unmarshal:(t,e,s)=>s.hasAttribute("multiple")?null===t?[]:t.split(",").map(t=>t.trim()).filter(t=>t):null===t||""===t?null:t,marshal:(t,e,s)=>s.hasAttribute("multiple")?null===t?null:t.join(","):null==t?null:String(t)}};#b={};#t;#g=[];#v=new b;defineElement(t,e){return this.#f?(this.#y(t,e),this):(this.#p[t]=e,this)}#y(t,e){const{observed:s,attributes:r,template:i,templates:n,slots:a,mappers:l}=e,o=(s??[]).map(t=>t.split(":")[0]),u=[...r??[],...s??[]].reduce((t,e)=>{const[s,r]=e.split(":"),i=r?.trim()??"string";if(!(i in this.#m)&&!(i in(l??{})))throw new Error(`unsupported attribute type: ${i}`);return t[s.trim()]=l?.[i]??this.#m[i],t},{}),c=Object.entries(Object.assign({},n,i?{default:i}:{})).map(([t,e])=>[t,f.fromHtml(e)]),d=Object.fromEntries(c);e.BITS={enqueue:t=>this.#v.enqueue(t),SLOTS:a,OBSERVED:o,ATTR_TO_MAPPER:u,TEMPLATES:d},customElements.define(t,e)}defineModule(t,e){const s=t?{[t]:e}:e;return this.#t={...this.#t,...s},this}defineModules(t){return this.#t=t,this}defineComponent(t,e){return this.#b[t]=e,this}defineData(...t){return this.#g=t,this}defineOverlay(...t){return this.#g=[...this.#g,...t],this}defineMapper(t,e){return this.#m[t]=e,this}plugin(t){return t.configure(this),this}configure(){for(const[t,e]of Object.entries(this.#p))this.#y(t,e),delete this.#p[t];return this.#f=!0,this}get upgrades(){return this.#v.entries}context(){return{modules:this.#t,data:this.#g}}evaluator(){return new n(this.#t,this.#g)}component(t){return this.#b[t]}}const v=new g;class y{static fromHtml(t){const{modules:e,data:s}=v.context();return f.fromHtml(t,e,...s)}static fromSelector(t){const{modules:e,data:s}=v.context();return f.fromSelector(t,e,...s)}static fromTemplate(t){const{modules:e,data:s}=v.context();return f.fromTemplate(t,e,...s)}static fromFragment(t){const{modules:e,data:s}=v.context();return f.fromFragment(t,e,...s)}}const w=async t=>{for(;;){const e=Array.from(v.upgrades).filter(([e])=>t(e)).map(([,t])=>t);if(0===e.length)return;await Promise.all(e)}};class x{static async waitFor(t){await w(e=>t.contains(e))}static async waitForChildren(t){await w(e=>t!==e&&t.contains(e))}}class E extends HTMLElement{static BITS={enqueue:t=>{},SLOTS:!1,OBSERVED:[],ATTR_TO_MAPPER:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}#w=!1;#x=0;#E(){return this.constructor.BITS}unmarshal(t,e){return this.#E().ATTR_TO_MAPPER[t].unmarshal(e,t,this)}marshal(t,e){return this.#E().ATTR_TO_MAPPER[t].marshal(e,t,this)}template(t){const{modules:e,data:s}=v.context();let r=this.#E().TEMPLATES[t??"default"].withData(s).withModules(e);for(const t of["l10n","config"]){const e=this.constructor[t];e&&(r=r.withOverlay({[t]:e}))}return r}connectedCallback(){this.#w||this.#E().enqueue(this)}attributeChangedCallback(t,e,s){this.#w&&e!==s&&(this.#x>0||(this[t]=this.unmarshal(t,s)))}#A=null;formDisabledCallback(t){this.#w?(Reflect.set(this,"disabled",t),t&&this.#S()):this.#A=t}#S(){this.closest("fieldset:disabled")&&this.removeAttribute("disabled")}async upgrade(){if(this.#w)return;this.#w=!0;const t=this.#E().SLOTS?o.from(this):void 0,e=Object.fromEntries(this.#E().OBSERVED.map(t=>[t,this.unmarshal(t,this.getAttribute(t))])),s=this.#A??!1;await this.render({slots:t,observed:e,disabled:s}),s&&this.#S()}render(t){}reflect(t){++this.#x;try{t()}finally{--this.#x}}reflectTo(t,e){++this.#x;try{l.set(this,t,this.marshal(t,e))}finally{--this.#x}}}var A=Object.freeze({__proto__:null,Attributes:l,ExpressionEvaluator:n,Expressions:i,Fragments:a,LightSlots:o,Nodes:u,ParsedElement:E,Registry:g,RenderError:m,Rendering:x,Template:f,Templates:y,registry:v});class S extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new S(this.message,S.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:r,details:i})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:r,details:i}))}}class T{static encode(t,e){const s=e||T.URL_SAFE,r=t.byteLength,i=new Uint8Array(t);let n="";for(let t=0;t<r;t+=3){n+=s[i[t]>>2]+s[(3&i[t])<<4|i[t+1]>>4]+s[(15&i[t+1])<<2|i[t+2]>>6]+s[63&i[t+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(t,e){const s=e||T.URL_SAFE;let r=Math.floor(.75*t.length);for(let e=0;e!==t.length&&"="===t[t.length-e-1];++e)--r;const i=new Uint8Array(r);let n=0,a=0;for(;n<r;){const e=s.indexOf(t.charAt(a++)),l=s.indexOf(t.charAt(a++)),o=s.indexOf(t.charAt(a++)),u=s.indexOf(t.charAt(a++));if(i[n++]=e<<2|l>>4,n===r)break;if(i[n++]=(15&l)<<4|o>>2,n===r)break;i[n++]=(3&o)<<6|u}return i.buffer}}T.STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T.URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";class C{static decode(t){if(t.length%2!=0)throw new Error("invalid length");const e=t.length/2;return new Uint8Array(e).map((e,s)=>{const r=2*s,i=t.substring(r,r+2);return parseInt(i,16)})}static encode(t,e){return Array.from(t).map(t=>t.toString(16)).map(t=>e?t.toUpperCase():t).map(t=>t.padStart(2,"0")).join("")}}class q{#T;#C;constructor(t,e){this.#T=t,this.#C=e}get normalized(){return`${this.#T}/${this.#C}`}get type(){return this.#T}get subtype(){return this.#C}static parse(t){if(!t)return new q("unknown","unknown");const[e,s]=t.split(";"),[r,i]=e.trim().split("/");return new q(r.toLowerCase(),i?.toLowerCase())}}class O extends S{constructor(t,e,s,r){super(t,s,r),this.name="HttpClientError",this.status=e}dropping(t){return new O(this.message,this.status,S.dropProblemsContext(this.problems,t),this)}static of(t,e){return new O(e.message,0,[{type:t,context:null,reason:e.message,details:null}],e)}static async fromResponse(t){switch(q.parse(t.headers.get("Content-Type")).normalized){case"application/failures+json":{const e=await t.json(),s=`${t.status} ${t.statusText}: ${e.length} failures`;return new O(s,t.status,e)}case"application/problem+json":{const e=await t.json(),s=`${t.status} ${t.statusText}: ${e.title} ${e.detail}`;return new O(s,t.status,e.problems||[{type:"GENERIC_PROBLEM",context:null,reason:s,details:null}])}default:{const e=await t.text(),s=`${t.status} ${t.statusText}: ${e}`;return new O(s,t.status,[{type:"GENERIC_PROBLEM",context:null,reason:s,details:null}])}}}}class P{#q;#O;constructor(){this.#q=document.querySelector("meta[name='_csrf_header']")?.getAttribute("content"),this.#O=document.querySelector("meta[name='_csrf']")?.getAttribute("content")}async intercept(t,e,s){return this.#q&&this.#O&&e.headers.set(this.#q,this.#O),await s.proceed(t,e)}}class L{#P;constructor(t){this.#P=t}async intercept(t,e,s){const r=await s.proceed(t,e);return 401===r.status?(window.location.href=this.#P,new Promise(()=>{})):r}}class _{#L;constructor(){this.#L=[]}withCsrfToken(){return this.#L.push(new P),this}withRedirectOnUnauthorized(t){return this.#L.push(new L(t)),this}withInterceptors(...t){return this.#L.push(...t),this}build(){return new R(this.#L)}}class k{async intercept(t,e,s){return await fetch(t,e)}}class M{#L;#_;constructor(t,e){this.#L=t,this.#_=e}async proceed(t,e){const s=this.#L[this.#_];return await s.intercept(t,e,new M(this.#L,this.#_+1))}}class R{#L;static builder(){return new _}constructor(t){this.#L=t||[]}async exchange(t,e,s){const r=[...this.#L,...s||[],new k],i=new M(r,0),n=new URL(new Request(t).url);return await i.proceed(n,e??{})}request(t,e){return z.create(this,t,e)}get(t){return z.create(this,"GET",t)}head(t){return z.create(this,"HEAD",t)}post(t){return z.create(this,"POST",t)}put(t){return z.create(this,"PUT",t)}patch(t){return z.create(this,"PATCH",t)}delete(t){return z.create(this,"DELETE",t)}}const D=async(t,e)=>{try{return await t[e]()}catch(t){throw O.of("UNMARSHALING_PROBLEM",t)}},N=t=>null==t?[]:"string"==typeof t?new URLSearchParams(t):"function"==typeof t[Symbol.iterator]?t:Object.entries(t);class z{#k;#M;#R;#D;#N;#z;#I;#L;static create(t,e,s){const[r,i=""]=s.split("?");return new z(t,e,r,new URLSearchParams(i),new Headers,void 0,{},[])}constructor(t,e,s,r,i,n,a,l){this.#k=t,this.#M=e,this.#R=s,this.#D=r,this.#z=n,this.#N=i,this.#I=a,this.#L=l}headers(t){for(const[e,s]of N(t))null==s?this.#N.delete(e):this.#N.set(e,s);return this}header(t,e){return null==e?this.#N.delete(t):this.#N.set(t,e),this}params(t){for(const[e,s]of N(t))null==s?this.#D.delete(e):this.#D.set(e,s);return this}param(t,...e){if(this.#D.delete(t),0===e.length||null==e[0])return this;for(const s of e)this.#D.append(t,s);return this}body(t){return this.#z=t,this}json(t){return this.#N.set("Content-Type","application/json"),this.#z=JSON.stringify(t),this}multipart(t){const e=new FormData;return t(new I(e)),this.#z=e,this}options(t){for(const[e,s]of Object.entries(t))this.#I[e]=s;return this}option(t,e){return this.#I[t]=e,this}interceptors(t){for(const e of t)this.#L.push(e);return this}interceptor(t){return this.#L.push(t),this}async exchange(){const t=this.#D.size?`${this.#R}?${this.#D}`:this.#R,e={...this.#I,headers:this.#N,method:this.#M,body:this.#z};return await this.#k.exchange(t,e,this.#L)}async fetch(){const t=this.#D.size?`${this.#R}?${this.#D}`:this.#R,e={...this.#I,headers:this.#N,method:this.#M,body:this.#z};try{const s=await this.#k.exchange(t,e,this.#L);if(!s.ok)throw await O.fromResponse(s);return s}catch(t){if(t instanceof S)throw t;throw O.of("CONNECTION_PROBLEM",t)}}async fetchText(){const t=await this.fetch();return await D(t,"text")}async fetchJson(){const t=await this.fetch();return await D(t,"json")}async fetchBlob(){const t=await this.fetch();return await D(t,"blob")}async fetchArrayBuffer(){const t=await this.fetch();return await D(t,"arrayBuffer")}}class I{#F;constructor(t){this.#F=t}field(t,e){return this.#F.append(t,e),this}blob(t,e,s){return this.#F.append(t,e,s),this}blobs(t,e){for(const s of e)this.#F.append(t,s);return this}json(t,e,s){const r=new Blob([JSON.stringify(e)],{type:"application/json"});return this.#F.append(t,r,s),this}}var F=Object.freeze({__proto__:null,Base64:T,Failure:S,Hex:C,HttpClient:R,HttpClientError:O,MediaType:q});class $ extends Storage{static save(t,e){localStorage.setItem(t,JSON.stringify(e))}static load(t){const e=localStorage.getItem(t);if(null!==e)try{return JSON.parse(e)}catch{return void localStorage.removeItem(t)}}static remove(t){localStorage.removeItem(t)}static pop(t){const e=$.load(t);return $.remove(t),e}}class B extends Storage{static save(t,e){sessionStorage.setItem(t,JSON.stringify(e))}static load(t){const e=sessionStorage.getItem(t);if(null!==e)try{return JSON.parse(e)}catch{return void sessionStorage.removeItem(t)}}static remove(t){sessionStorage.removeItem(t)}static pop(t){const e=B.load(t);return B.remove(t),e}}class H{static save(t,e,s){$.save(t,{revision:e,data:s})}static load(t,e){const s=$.load(t);if(void 0!==s){if(s.revision===e)return s.data;$.remove(t)}}}class j{static save(t,e,s){B.save(t,{revision:e,data:s})}static load(t,e){const s=B.load(t);if(void 0!==s){if(s.revision===e)return s.data;B.remove(t)}}}class V{static async fireAsync(t,e,s){t.dispatchEvent(e);const r=e.async?.promises??[],i=s?.mode??"broadcast";if("pipeline"===i&&r.length>1)throw new Error(`[AsyncEvents] Event "${e.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${r.length} listeners were triggered on this element.`);if("delegate"===i&&1!==r.length)throw new Error(`[AsyncEvents] Event "${e.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(t,e,s,r){const i=async t=>{const e=t;e.async||(e.async={promises:[]});const{promise:r,resolve:i,reject:n}=Promise.withResolvers();e.async.promises.push(r);try{i(await s(e))}catch(t){n(t)}};return t.addEventListener(e,i,r),i}static asyncOff(t,e,s,r){t.removeEventListener(e,s,r)}static mixInto(...t){for(const e of t)Object.assign(e.prototype,{async fireAsync(t,e){return await V.fireAsync(this,t,e)},asyncOn(t,e,s){return V.asyncOn(this,t,e,s)},asyncOff(t,e,s){V.asyncOff(this,t,e,s)}})}}class U{static sleep(t){return new Promise(e=>setTimeout(e,t))}static DEBOUNCE_DEFAULT=0;static DEBOUNCE_IMMEDIATE=1;static debounce(t,e,s){const r=s??U.DEBOUNCE_DEFAULT;let i=null,n=[],a=0;const l=()=>{const s=performance.now()-a;t>s?i=setTimeout(l,t-s):(i=null,r!==U.DEBOUNCE_IMMEDIATE&&e(...n),null===i&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===i&&(i=setTimeout(l,t),r===U.DEBOUNCE_IMMEDIATE&&e(...n))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}static THROTTLE_DEFAULT=0;static THROTTLE_NO_LEADING=1;static THROTTLE_NO_TRAILING=2;static throttle(t,e,s){const r=s??U.THROTTLE_DEFAULT;let i=null,n=[],a=0;const l=()=>{a=r&U.THROTTLE_NO_LEADING?0:performance.now(),i=null,e(...n),null===i&&(n=[])};return[(...s)=>{const o=performance.now();!a&&r&U.THROTTLE_NO_LEADING&&(a=o);const u=0===a?0:t-(o-a);n=s,u<=0||u>t?(null!==i&&(clearTimeout(i),i=null),a=o,e(...n),null===i&&(n=[])):null!==i||r&U.THROTTLE_NO_TRAILING||(i=setTimeout(l,u))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}}class W{static flatten(t,e,s){return Object.keys(t).reduce((r,i)=>{const n=e.length?`${e}.${i}`:i;return s.has(n)||"object"!=typeof t[i]||null===t[i]?r[n]=t[i]:Object.assign(r,W.flatten(t[i],n,s)),r},{})}static providePath(t,e,s){const r=e.split(".").map(t=>/^[0-9]+$/.test(t)?+t:t);let i=t??{},n=null;for(let e=0;;++e){const a=r[e],l=r[e-1];if(Number.isInteger(a)&&!Array.isArray(i)&&(null!==n?n[l]=i=[]:t=i=[]),e===r.length-1)return i[a]=void 0!==s?s:a in i?i[a]:null,t;void 0===i[a]&&(i[a]={}),n=i,i=i[a]}}static extract(t){if("radio"===t.getAttribute("type")){if(!t.checked)return;return"boolean"===t.dataset.fulBindType?"true"===t.value:t.value}return"checkbox"===t.getAttribute("type")?t.checked:"boolean"===t.dataset.fulBindType?t.value?"true"===t.value:null:!("INPUT"!==t.tagName&&"SELECT"!==t.tagName&&"TEXTAREA"!==t.tagName||""!==t.value&&void 0!==t.value)?null:t.value}static extractFrom(t,e){let s={};for(const r of t.elements)!r.hasAttribute("name")||r.matches(":disabled")&&r!==e||(s=W.providePath(s,r.getAttribute("name"),W.extract(r)));return s}static mutate(t,e){"radio"!==t.getAttribute("type")?"checkbox"!==t.getAttribute("type")?t.value=e:t.checked=e:t.checked=null!=e&&t.getAttribute("value")===String(e)}static mutateIn(t,e){const s=Array.from(t.elements).map(t=>t.getAttribute("name")).filter(t=>t);for(const[r,i]of Object.entries(W.flatten(e,"",new Set(s))))for(const e of t.querySelectorAll(`[name='${CSS.escape(r)}']`))W.mutate(e,i)}static errors(t,e,s){const r=e.filter(t=>"FIELD_ERROR"===t.type||"INVALID_FORMAT"===t.type),i=e.filter(t=>"FIELD_ERROR"!==t.type&&"INVALID_FORMAT"!==t.type);t.querySelectorAll("[name]").forEach(t=>{t.setCustomValidity?.("")}),t.querySelectorAll("ful-errors").forEach(t=>{t.replaceChildren(),t.setAttribute("hidden","")}),r.forEach(e=>{const s=e.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let r=s.length;0!==r;--r){const i=s.slice(0,r).join("."),n=s.slice(r,s.length).join(".");t.querySelectorAll(`[name='${CSS.escape(i)}']`).forEach(t=>{t.setCustomValidity?.(e.reason,n)})}}),t.querySelectorAll("ful-errors").forEach(t=>{t.innerText=i.map(t=>t.reason).join("\n"),0!==i.length&&t.removeAttribute("hidden")}),0!==e.length&&s&&Array.from(t.querySelectorAll(":invalid")).sort((t,e)=>t.getBoundingClientRect().y-e.getBoundingClientRect().y)[0]?.focus()}}class G{#$;#B;#M;#H;#j;constructor(t,e,s,r,i){this.#$=t,this.#B=e,this.#M=s,this.#H=r,this.#j=i}prepare(t,e){return this.#H(t,e)}async submit(t,e){return await this.#$.request(this.#M,this.#B).json(t).fetch()}transform(t,e){return this.#j(t,e)}}class J{#H;#j;constructor(t,e){this.#H=t,this.#j=e}async prepare(t,e){return await this.#H(t,e)}async submit(t,e,s){return s}async transform(t,e){return await this.#j(t,e)}}class X{static create(t,e){const s=v.component("http-client"),r=t.hasAttribute("request-mapper")?v.component(t.getAttribute("request-mapper")):t=>t,i=t.hasAttribute("response-mapper")?v.component(t.getAttribute("response-mapper")):t=>t,n=t.getAttribute("action");if(!n)return new J(r,i);const a=t.getAttribute("method")??"POST";return new G(s,n,a,r,i)}}class Q extends E{form;render(){const t=document.createElement("form");this.form=t,t.setAttribute("novalidate",""),l.forward("form-",this,t),t.replaceChildren(...this.childNodes),t.addEventListener("submit",async t=>{t.preventDefault(),t.stopPropagation(),await this.submit(t.submitter??void 0)}),this.hasAttribute("clear-invalid-on-change")&&this.addEventListener("change",t=>{t.target.setCustomValidity?.("")}),this.replaceChildren(t)}async submit(t){let e,s;this.spinner(!0);try{const r=v.component(this.getAttribute("loader")??"loaders:form").create(this);e=W.extractFrom(this.form,t),s=await r.prepare(e,this);const i=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:t,values:e,request:s}});if(!this.dispatchEvent(i))return;this.errors=[];const n=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:i.detail.values,request:i.detail.request}});let a=await V.fireAsync(this,n,{mode:"pipeline"});s=n.detail.request,a=await r.submit(s,this,a);const l=await r.transform(a,this);this.dispatchEvent(new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,response:l}}))}catch(r){this.dispatchEvent(new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,exception:r}})),r instanceof S&&(this.errors=r.problems),console.warn("failed to submit form",this,"reason:",r)}finally{this.spinner(!1)}}reset(){this.form.reset()}#V=0;spinner(t){if(t){if(++this.#V,1!==this.#V)return}else if(this.#V=Math.max(0,this.#V-1),0!==this.#V)return;this.querySelectorAll("ful-spinner").forEach(e=>{e.hidden=!t}),this.querySelectorAll("input,button").forEach(e=>{const s=e;"submit"!==s.type&&"reset"!==s.type||(t?(s.dataset.wd=String(s.disabled),s.disabled=!0):(s.disabled="true"===s.dataset.wd,delete s.dataset.wd))})}set values(t){W.mutateIn(this.form,t)}get values(){return W.extractFrom(this.form)}set errors(t){W.errors(this.form,t,this.hasAttribute("scroll-on-error"))}}class Z extends E{static observed=["value","readonly:presence","required:presence","placeholder"];static slots=!0;static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <input data-tpl-if="type != \'textarea\'" class="form-control" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" class="form-control" placeholder=" " form=""></textarea>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';static formAssociated=!0;_input;_fieldError;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}_type(){return this.getAttribute("type")??"text"}_fragment(t,e){return this.template().withOverlay({type:t,slots:e}).render()}render({slots:t,observed:e,disabled:s,skipObservedSetup:r}){const i=this._type(),n=this._fragment(i,t);this._input=n.querySelector("input,textarea"),l.forward("input-",this,this._input),this._input.addEventListener("keydown",t=>{if("Enter"!==t.key||"textarea"===this._type())return;const e=this.internals.form;if(!e)return;const s=Array.from(e.querySelectorAll("button:not(:disabled), input:not(:disabled)")).find(t=>"submit"===t.type);e.requestSubmit(s)}),this._input.addEventListener("input",t=>{const e=this.getAttribute("mask");if(!e)return;const s=t=>t.replace(new RegExp(e,"g"),""),r=t.target.value,i=s(r);if(r===i)return;const n=t.target.selectionStart;if(t.target.value=i,null===n)return;const a=s(r.slice(0,n)).length;t.target.setSelectionRange(a,a)}),this._input.addEventListener("change",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))});const a=n.querySelector("label");if(a.addEventListener("click",()=>this.focus()),this._fieldError=n.querySelector("ful-field-error"),this._input.ariaDescribedByElements=[this._fieldError],this._input.ariaLabelledByElements=[a],this.replaceChildren(n),!r){const t=this;t.disabled=s,t.readonly=e.readonly,t.required=e.required,t.placeholder=e.placeholder,t.value=e.value}}get value(){const t=this.hasAttribute("uppercase"),e=this.hasAttribute("trim"),s=this._input.value,r=t?s.toUpperCase():s,i=e?r.trim():r;return""===i?null:i}set value(t){this._input.value=""===t?null:t}get readonly(){return this._input.readOnly}set readonly(t){this._input.readOnly=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get disabled(){return this._input.hasAttribute("disabled")}set disabled(t){l.toggle(this._input,"disabled",t),l.toggle(this,"disabled",t)}get required(){return"true"===this._input.getAttribute("aria-required")}set required(t){l.set(this._input,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}get placeholder(){const t=this._input.getAttribute("placeholder");return" "===t?null:t}set placeholder(t){l.set(this._input,"placeholder",t??" "),this.reflect(()=>{l.set(this,"placeholder",t)})}focus(t){this._input.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this._fieldError.innerText="");this.internals.setValidity({customError:!0}," "),this._fieldError.innerText=t}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}}class Y extends E{render(){const t=this.textContent.trim();if(""===t)return void this.replaceChildren(this.getAttribute("default")??"");const e=this.getAttribute("locale")??Intl.DateTimeFormat().resolvedOptions().locale,s=new Intl.DateTimeFormat(e,{year:"numeric",month:"numeric",day:"numeric"}),[r,i,n]=t.split("-").map(Number);this.replaceChildren(s.format(new Date(r,i-1,n)))}}class K extends E{render(){const t=this.textContent.trim();if(""===t)return void this.replaceChildren(this.getAttribute("default")??"");const e=this.getAttribute("locale")??Intl.DateTimeFormat().resolvedOptions().locale,s=new Intl.DateTimeFormat(e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1});this.replaceChildren(s.format(new Date(K.isoToLocal(t))))}static isoToLocal(t){const e=new Date(t),s=(t,e)=>String(e).padStart(t,"0");return`${`${e.getFullYear()}-${s(2,e.getMonth()+1)}-${s(2,e.getDate())}`}T${`${s(2,e.getHours())}:${s(2,e.getMinutes())}:${s(2,e.getSeconds())}.${s(3,e.getMilliseconds())}`}`}}class tt extends Z{static observed=["value","readonly:presence","required:presence","placeholder","min","max","step"];_type(){return"date"}render(t){const{observed:e}=t;super.render(t),this.step=e.step,this.min=e.min,this.max=e.max}get min(){const t=this._input.min;return""===t?null:t}set min(t){this._input.min=tt.#U(t)}get max(){const t=this._input.max;return""===t?null:t}set max(t){this._input.max=tt.#U(t)}get step(){const t=this._input.step;return""===t?null:t}set step(t){this._input.step=t??""}static#U(t){if(!t)return"";const e=t=>new Date(t.getTime()-6e4*t.getTimezoneOffset()).toISOString().split("T")[0];if("now"===t)return e(new Date);const s=/^([+-])(\d+)([dmy])$/.exec(t);if(!s)return t;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 t=n.getDate();n.setMonth(n.getMonth()+i*r),n.getDate()!==t&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+i*r)}return e(n)}}class et extends tt{_type(){return"time"}get min(){const t=this._input.min;return""===t?null:t}set min(t){this._input.min=this.#W(t)}get max(){const t=this._input.max;return""===t?null:t}set max(t){this._input.max=this.#W(t)}#W(t){if(!t)return"";const e=new Date;if("now"!==t){const s=/^([+-])(\d+)([hm])$/.exec(t);if(!s)return t;const r="-"===s[1]?-1:1,i=+s[2]*r;"h"===s[3]?e.setHours(e.getHours()+i):e.setMinutes(e.getMinutes()+i)}return et.#G(e,Number(this._input.step)||60)}static#G(t,e){const s=t=>String(t).padStart(2,"0"),r=3600*t.getHours()+60*t.getMinutes()+t.getSeconds(),i=Math.floor(r/e)*e,n=s(Math.floor(i/3600)),a=s(Math.floor(i%3600/60));return e%60==0?`${n}:${a}`:`${n}:${a}:${s(i%60)}`}}class st extends Z{static observed=["value","readonly:presence","required:presence","placeholder","min","max","step"];_type(){return"datetime-local"}render(t){const{observed:e}=t;super.render(t),this.min=e.min,this.max=e.max,this.step=e.step}get value(){const t=this._input.value;return""===t?null:new Date(t).toISOString()}set value(t){this._input.value=t?K.isoToLocal(t):""}get min(){const t=this._input.min;return""===t?null:new Date(t).toISOString()}set min(t){this._input.min=t?K.isoToLocal(t):""}get max(){const t=this._input.max;return""===t?null:new Date(t).toISOString()}set max(t){this._input.max=t?K.isoToLocal(t):""}get step(){const t=this._input.step;return""===t?null:t}set step(t){this._input.step=t??""}}class rt extends Z{static l10n={en:{dropzonelabel:"Click or drop your files here",unacceptablefiletype:"Only files of type {0} are supported",maxfilesizeexceeded:"Maximum supported file size is {0}",maxtotalsizeexceeded:"Maximum supported total file size is {0}",maxfilesexceeded:"Maximum files count exceeded"},it:{dropzonelabel:"Clicca o trascina i file qui",unacceptablefiletype:"Solo i file di tipo {0} sono supportati",maxfilesizeexceeded:"La dimensione massima di un file è di {0}",maxtotalsizeexceeded:"La dimensione massima complessiva dei file è di {0}",maxfilesexceeded:"Numero massimo di file superato"},es:{dropzonelabel:"Haz clic o arrastra tus archivos aquí",unacceptablefiletype:"Solo se admiten archivos de tipo {0}",maxfilesizeexceeded:"El tamaño máximo de archivo admitido es {0}",maxtotalsizeexceeded:"El tamaño total máximo admitido es {0}",maxfilesexceeded:"Se ha superado el número máximo de archivos"},fr:{dropzonelabel:"Cliquez ou déposez vos fichiers ici",unacceptablefiletype:"Seuls les fichiers de type {0} sont pris en charge",maxfilesizeexceeded:"La taille maximale de fichier prise en charge est {0}",maxtotalsizeexceeded:"La taille totale maximale prise en charge est {0}",maxfilesexceeded:"Nombre maximal de fichiers dépassé"}};static observed=["value","readonly:presence","required:presence","placeholder","accept:csv","multiple:presence","itemlist:presence","dropzone:presence","maxfiles:number","maxfilesize:number","maxtotalsize:number"];#J;#X;#Q;#Z;_type(){return"file"}static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <input class="form-control" data-tpl-type="type" placeholder=" " form="">\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\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(\'dropzonelabel\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings></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>{{ file.name }}</div>\n <div>{{ #bytes:format(file.size) }}</div>\n <button type="button" class="btn btn-sm btn-outline-danger bi bi-x-lg" alt="Rimuovi"></button>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};render(t){const{observed:e}=t;super.render({...t,skipObservedSetup:!0}),this.#X=this.querySelector("ful-item-list"),this.#Q=this.querySelector("[data-ref=dropzone]"),this.#Z=this.querySelector("ful-field-warnings"),this.accept=e.accept,this.multiple=e.multiple,this.itemlist=e.itemlist,this.dropzone=e.dropzone,this.maxfiles=e.maxfiles,this.maxfilesize=e.maxfilesize,this.maxtotalsize=e.maxtotalsize,this.disabled=t.disabled,this.readonly=e.readonly,this.required=e.required,this.placeholder=e.placeholder,this.value=e.value,this.#Z.addEventListener("animationend",t=>{t.target.remove()}),this.#X.addEventListener("click",t=>{if(!t.target.closest("button"))return;const e=[...this.#X.children].indexOf(t.target.closest("ful-item"));if(-1===e)return;const s=new DataTransfer;[...this.files].filter((t,s)=>s!==e).forEach(t=>{s.items.add(t)}),this.files=s.files}),this.#Q.addEventListener("click",t=>{this.querySelector("input")?.click()}),this.#Q.addEventListener("dragover",t=>{t.preventDefault()}),this.#Q.addEventListener("drop",t=>{t.preventDefault();const e=[...t.dataTransfer.items].filter(t=>"file"===t.kind);if(0===e.length)return;const s=new DataTransfer;e.forEach(t=>{s.items.add(t.getAsFile())}),this.files=s.files}),this._input.addEventListener("change",t=>{this.#Y()})}#K(t){return t>1048576?Math.round(t/1024/1024*100)/100+"MiB":t>1024?Math.round(t/1024*100)/100+"KiB":`${t}B`}#Y(){this.setCustomValidity(),this.#Z.replaceChildren(),this.#tt(),this.#et(),this.#st(),this.#rt(),this.template("items").withOverlay({files:this.files}).withModule("bytes",{format:this.#K}).renderTo(this.#X)}warning(t,e){this.template("warning").withOverlay({key:t,args:e}).appendTo(this.#Z)}#tt(){if(!this.#J.length)return;const t=[...this.files].filter(t=>!this.#J.some(e=>t.name.toLowerCase().endsWith(e.toLowerCase())));if(0===t.length)return;this.warning("unacceptablefiletype",this.#J.join(", "));const e=new DataTransfer;[...this.files].filter(e=>!t.includes(e)).forEach(t=>{e.items.add(t)}),this._input.files=e.files}#rt(){null!==this.#it&&(this.files.length<=this.#it||(this.warning("maxfilesexceeded"),this._input.files=(new DataTransfer).files))}#et(){if(null===this.#nt)return;const t=[...this.files].filter(t=>t.size>this.#nt);if(0===t.length)return;this.warning("maxfilesizeexceeded",this.#K(this.#nt));const e=new DataTransfer;[...this.files].filter(e=>!t.includes(e)).forEach(t=>{e.items.add(t)}),this._input.files=e.files}#st(){if(null===this.#at)return;[...this.files].reduce((t,e)=>t+e.size,0)<=this.#at||(this.warning("maxtotalsizeexceeded",this.#K(this.#at)),this._input.files=(new DataTransfer).files)}get accept(){return this.#J}set accept(t){this._input.accept=t.join(","),this.#J=t,this.reflect(()=>{this.setAttribute("accept",this._input.accept)})}get multiple(){return this._input.multiple}set multiple(t){this._input.multiple=t,this.reflect(()=>{l.toggle(this,"multiple",t)})}get files(){return this._input.files}set files(t){this._input.files=t,this.#Y()}get file(){return this.files[0]??null}set file(t){const e=new DataTransfer;t&&e.items.add(t),this.files=e.files}get value(){const t=Array.from(this._input.files).map(t=>t.name);return this.multiple?t:t[0]??null}set value(t){t||(this.files=(new DataTransfer).files)}get totalsize(){return Array.from(this.files).reduce((t,e)=>t+e.size,0)}#it;get maxfiles(){return this.#it}set maxfiles(t){this.#it=t,this.reflect(()=>{l.set(this,"maxfiles",t)})}#nt;get maxfilesize(){return this.#nt}set maxfilesize(t){this.#nt=t,this.reflect(()=>{l.set(this,"maxfilesize",t)})}#at;get maxtotalsize(){return this.#at}set maxtotalsize(t){this.#at=t,this.reflect(()=>{l.set(this,"maxtotalsize",t)})}#lt;get itemlist(){return this.#lt}set itemlist(t){this.#lt=t,this.reflect(()=>{l.toggle(this,"itemlist",t)})}#ot;get dropzone(){return this.#ot}set dropzone(t){this.#ot=t,this.reflect(()=>{l.toggle(this,"dropzone",t)})}}class it{#$;#B;#M;#j;#ut;#ct;#g;constructor({http:t,url:e,method:s,responseMapper:r,prefetch:i,revision:n}){this.#$=t,this.#B=e,this.#M=s,this.#j=r,this.#ut=i,this.#ct=n,this.#g=null}async prefetch(){this.#ut&&await this.#dt()}async exact(...t){return await this.#dt(),this.#g.filter(([e,s])=>t.some(t=>t==e))}async load(t){return await this.#dt(),this.#g.filter(([e,s])=>(s??"").toLowerCase().includes(t?.toLowerCase()))}async reconfigureUrl(t){this.#g=null,this.#B=t}async#dt(){if(null!==this.#g)return;const t=await it.#ht(this.#$,this.#M,this.#B,this.#ct);this.#g=this.#j(t)}static async#ht(t,e,s,r){const i=`${e}@${s}`;if(null!==r){const t=H.load(i,r);if(void 0!==t)return t}const n=await t.request(e,s).fetchJson();return null!==r&&H.save(i,r,n),n}}class nt{#$;#B;#M;#j;constructor({http:t,url:e,method:s,responseMapper:r}){this.#$=t,this.#B=e,this.#M=s,this.#j=r}async exact(...t){const e=await this.#$.request(this.#M,this.#B).param("k",...t).fetchJson();return this.#j(e)}async load(t){const e=await this.#$.request(this.#M,this.#B).param("s",t).fetchJson();return this.#j(e)}}class at{#g;constructor(t){this.#g=t}update(t){this.#g=t}exact(...t){return this.#g.filter(([e,s])=>t.some(t=>t==e))}load(t){return this.#g.filter(([e,s])=>(s??"").toLowerCase().includes(t?.toLowerCase()))}}class lt{static create(t,e){if(!t.hasAttribute("src")){const t=Array.from(e.options?.querySelectorAll("option")??[]).map(t=>[t.getAttribute("value")??t.innerText.trim(),t.innerText.trim()]);return new at(t)}const s=v.component("http-client"),r=lt.#pt(t);return"chunked"===t.getAttribute("mode")?new nt({http:s,url:t.getAttribute("src"),method:t.getAttribute("method")??"POST",responseMapper:r}):new it({http:s,url:t.getAttribute("src"),method:t.getAttribute("method")??"POST",responseMapper:r,prefetch:t.hasAttribute("preload"),revision:t.getAttribute("revision")})}static#pt(t){return t.hasAttribute("k-expr")&&t.hasAttribute("l-expr")?e=>v.evaluator().withOverlay(e).evaluateExpression(t.getAttribute("d-expr")??"self").map(e=>{const s=v.evaluator().withOverlay(e);return[s.evaluateExpression(t.getAttribute("k-expr")),s.evaluateExpression(t.getAttribute("l-expr")),s.evaluateExpression(t.getAttribute("m-expr")??"self")]}):t.hasAttribute("response-mapper")?v.component(t.getAttribute("response-mapper")):t=>t}}class ot extends E{static slots=!0;static template='\n <ful-spinner class="centered" hidden></ful-spinner>\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" data-tpl-aria-selected="index == 0 ? \'true\' : \'false\'">\n {{ label }}\n </li>\n '};#ft;#mt;#bt;#I=new Map;render({slots:t}){const e=this.template().render();this.#bt=a.isBlank(t.default)?this.template("options"):y.fromFragment(t.default),this.#ft=e.querySelector("ful-spinner"),this.#mt=e.querySelector("menu"),this.#mt.addEventListener("click",t=>{t.stopPropagation();const e=t.target.closest("li");e?this.#gt(e):this.hide()}),this.replaceChildren(e)}#vt(){return this.#mt?.querySelector("[selected]")??this.#mt?.firstElementChild??null}acceptSelection(){const t=this.#vt();t&&this.#gt(t)}update(t){if(void 0===t)throw new Error("null data");this.#I=new Map(t.map((t,e)=>[String(e),t]));const e=t.map(([t,e,s],r)=>({index:r,key:t,label:e,metadata:s}));this.#bt.withOverlay(e).renderTo(this.#mt)}#gt(t){const e=t.getAttribute("value"),s=this.#I.get(e);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:e,data:s}}))}hide(){this.setAttribute("hidden","")}get shown(){return!this.hasAttribute("hidden")}async show(t){this.removeAttribute("hidden"),this.#mt.setAttribute("hidden",""),this.#ft.removeAttribute("hidden");try{const e=await t();this.update(e)}catch(t){throw this.hide(),t}finally{this.#ft.setAttribute("hidden",""),this.#mt.removeAttribute("hidden")}}async moveOrShow(t,e){if(this.shown){const e=this.#vt(),s=e?.[(t?"next":"previous")+"ElementSibling"];return void(e&&s&&(e.removeAttribute("selected"),s.setAttribute("selected",""),s.scrollIntoView({block:"nearest",behavior:"smooth"})))}await this.show(e)}}class ut extends E{static observed=["value:csvm","readonly:presence","required:presence","itemlist:presence"];static slots=!0;static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group flex-nowrap" tabindex="-1">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <div class="ful-select-input-container">\n <div class="ful-select-input">\n <badges></badges>\n <input type="text" form="" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </div>\n <ful-dropdown hidden popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </div>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\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[0]">\n <div>{{ entry[1][0] }}</div>\n <button type="button" class="btn btn-sm btn-outline-danger bi bi-x-lg"></button>\n </ful-item>\n '};static formAssociated=!0;internals;#yt;#wt;#xt;#Et;#X;#At;#St;#Tt=new Map;#Ct=0;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}async render({slots:t,observed:e,disabled:s}){const r=this.getAttribute("name");this.#yt=v.component(this.getAttribute("loader")??"loaders:select").create(this,{options:t.options}),this.#At=this.hasAttribute("multiple");try{await(this.#yt.prefetch?.())}catch(t){console.warn("failed to prefetch select options",this,"reason:",t)}const i=this.template().withOverlay({slots:t,name:r}).render();this.#Et=i.querySelector("input"),this.#X=i.querySelector("ful-item-list"),l.forward("input-",this,this.#Et),this.#wt=i.querySelector("badges"),this.value=e.value,this.disabled=s,this.readonly=e.readonly,this.required=e.required,this.itemlist=e.itemlist,this.#xt=i.querySelector("ful-dropdown");const n=i.querySelector("label");n.addEventListener("click",()=>this.focus()),this.#St=i.querySelector("ful-field-error"),this.#Et.ariaDescribedByElements=[this.#St],this.#Et.ariaLabelledByElements=[n];const[a,o]=U.throttle(400,()=>{this.#Et.setAttribute("aria-expanded","true"),this.#xt.show(()=>this.#yt.load(this.#Et.value))});this.addEventListener("click",t=>{if(!t.target.matches("input")&&!this.disabled&&!this.readonly){if(this.#xt.shown)return this.#Et.setAttribute("aria-expanded","false"),void this.#xt.hide();this.#Et.focus(),a()}}),this.#X.addEventListener("click",t=>{if(t.stopPropagation(),!t.target.closest("button"))return;if(this.disabled||this.readonly)return;const e=[...this.#X.children].indexOf(t.target.closest("ful-item"));-1!==e&&(this.#Tt.delete(Array.from(this.#Tt.keys())[e]),this.#qt(),this.#Ot())}),this.#wt.addEventListener("click",t=>{if(t.stopPropagation(),this.disabled||this.readonly)return;const e=[...this.#wt.children].indexOf(t.target);-1!==e&&(this.#Tt.delete(Array.from(this.#Tt.keys())[e]),this.#qt(),this.#Ot())}),this.#Et.addEventListener("change",t=>{t.stopPropagation()}),this.#Et.addEventListener("blur",t=>{t.stopPropagation(),t.relatedTarget&&this.contains(t.relatedTarget)||(o(),this.#Et.setAttribute("aria-expanded","false"),this.#xt.hide(),this.#Et.value="")}),this.#Et.addEventListener("keydown",t=>{if(!this.disabled&&!this.readonly)switch(t.code){case"ArrowUp":t.preventDefault(),this.#Et.setAttribute("aria-expanded","true"),this.#xt.moveOrShow(!1,()=>this.#yt.load(this.#Et.value));break;case"ArrowDown":t.preventDefault(),this.#Et.setAttribute("aria-expanded","true"),this.#xt.moveOrShow(!0,()=>this.#yt.load(this.#Et.value));break;case"Escape":this.#Et.setAttribute("aria-expanded","false"),this.#xt.hide();break;case"Enter":if(!this.#xt.shown)return void this.#Pt();t.preventDefault(),this.#Et.setAttribute("aria-expanded","false"),this.#xt.acceptSelection(),this.#Et.value="";break;case"Backspace":this.#Tt.size&&0===this.#Et.selectionStart&&0===this.#Et.selectionEnd&&(this.#Tt.delete(Array.from(this.#Tt.keys()).pop()),this.#qt(),this.#Ot());break;case"Tab":this.#Et.setAttribute("aria-expanded","false"),this.#xt.hide(),o()}}),this.#Et.addEventListener("input",t=>{t.stopPropagation(),this.disabled||this.readonly||a()}),this.#xt.addEventListener("change",t=>{t.stopPropagation(),this.#At||this.#Tt.clear(),this.#Tt.set(t.detail.data[0],t.detail.data.slice(1)),this.#qt(),this.#Ot(),this.#Et.focus(),this.#Et.setAttribute("aria-expanded","false"),this.#xt.hide(),this.#Et.value=""}),this.replaceChildren(i)}async withLoader(t){return await t(this.#yt)}#Pt(){const t=this.internals.form;if(!t)return;const e=Array.from(t.querySelectorAll("button:not(:disabled), input:not(:disabled)"));t.requestSubmit(e.find(t=>"submit"===t.type))}#qt(){const t=[...this.#Tt.entries()].map(t=>({key:t[0],label:t[1][0],metadata:t[1].slice(1)})),e=this.#At?t:t[0]??null;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:e}}))}#Ot(){const t=Array.from(this.#Tt.entries()).map(([t,e])=>{const s=document.createElement("badge");return s.setAttribute("role","button"),s.setAttribute("value",t),s.innerText=e[0],s});this.#wt.replaceChildren(),this.#wt.append(...t),this.#X.replaceChildren(),this.template("items").withOverlay({entries:this.#Tt.entries()}).renderTo(this.#X)}set value(t){const e=null==t?[]:Array.isArray(t)?t:[t];this.#Tt=new Map(e.map(t=>[t,[t]])),this.#Ot();const s=++this.#Ct;0!==e.length&&this.#s(e,s)}async#s(t,e){const s=await this.#yt.exact(...t);if(e!==this.#Ct)return;const r=new Map(s.map(t=>[t[0],t.slice(1)]));for(const e of t)this.#Tt.has(e)&&(r.has(e)?this.#Tt.set(e,r.get(e)):this.#Tt.delete(e));this.#Ot()}get value(){return this.#At?[...this.#Tt.keys()]:[...this.#Tt.keys()][0]??null}get entry(){return this.#At?[...this.#Tt.entries()]:[...this.#Tt.entries()][0]??null}get disabled(){return this.#Et.hasAttribute("disabled")}set disabled(t){l.toggle(this.#Et,"disabled",t),l.toggle(this,"disabled",t)}get readonly(){return this.#Et.readOnly}set readonly(t){this.#Et.readOnly=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get required(){return"true"===this.#Et.getAttribute("aria-required")}set required(t){l.set(this.#Et,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}#lt;get itemlist(){return this.#lt}set itemlist(t){this.#lt=t,this.reflect(()=>{l.toggle(this,"itemlist",t)})}focus(t){this.#Et.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this.#St.innerText="");this.internals.setValidity({customError:!0}," "),this.#St.innerText=t}}class ct extends E{static observed=["value","readonly:presence","required:presence"];static slots=!0;static template='\n <fieldset>\n <legend class="form-label">\n {{{{ slots.default }}}}\n </legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <section>\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 </section>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';static formAssociated=!0;#Lt;#St;#_t;#kt;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="radiogroup"}render({slots:t,observed:e,disabled:s}){const r=this.getAttribute("name")??l.uid("ful-radiogroup"),i=Array.from(t.default.querySelectorAll("ful-radio")),n=i.map(t=>{const e=document.createElement("input");e.setAttribute("type","radio"),l.forward("input-",this,e),l.forward("",t,e),e.setAttribute("name",`${r}-ignore`),e.setAttribute("form",""),e.addEventListener("change",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))});return[e,a.fromChildNodes(t)]});i.forEach(t=>{t.remove()}),this.template().withOverlay({name:r,slots:t,inputsAndLabels:n}).renderTo(this),this.#Lt=this.firstElementChild,this.disabled=s,this.readonly=e.readonly,this.required=e.required,this.value=e.value,this.#St=this.querySelector("ful-field-error"),this.ariaDescribedByElements=[this.#St],this.#_t=this.querySelector("input[type=radio]"),this.#kt="boolean"===this.getAttribute("type")}get value(){const t=this.querySelector("input[type=radio]:checked");return t?this.#kt?"true"===t.value:t.value:null}set value(t){if(null===t)return void this.querySelectorAll("input[type=radio]").forEach(t=>{t.checked=!1});const e=this.querySelector(`input[type=radio][value=${CSS.escape(String(t))}]`);e&&(e.checked=!0)}get readonly(){return this.#Lt.inert}set readonly(t){this.#Lt.inert=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get disabled(){return this.#Lt.hasAttribute("disabled")}set disabled(t){l.toggle(this.#Lt,"disabled",t),l.toggle(this,"disabled",t)}get required(){return"true"===this.#Lt.getAttribute("aria-required")}set required(t){l.set(this.#Lt,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}focus(t){this.#_t.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this.#St.innerText="");this.internals.setValidity({customError:!0}," "),this.#St.innerText=t}}class dt extends E{static observed=["value:bool","readonly:presence","required:presence"];static slots=!0;static template='\n <div data-tpl-class="klass">\n <div class="input-container">\n <input class="form-check-input" type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="" placeholder=" ">\n </div>\n <div class="form-check-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n </div>\n <ful-field-error></ful-field-error>\n ';#Mt;#Et;#St;static formAssociated=!0;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}render({slots:t,observed:e,disabled:s}){const r="switch"===this.getAttribute("type"),i=r?"form-check form-switch":"form-check",n=this.template().withOverlay({slots:t,klass:i,isSwitch:r}).render();this.#Mt=n.firstElementChild,this.#Et=n.querySelector("input"),l.forward("input-",this,this.#Et),this.disabled=s,this.readonly=e.readonly,this.required=e.required,this.value=e.value,this.#Et.addEventListener("change",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))});const a=n.querySelector("label");a.addEventListener("click",()=>{this.focus(),this.disabled||this.readonly||(this.value=!this.value,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}})))}),this.#St=n.querySelector("ful-field-error"),this.#Et.ariaDescribedByElements=[this.#St],this.#Et.ariaLabelledByElements=[a],this.replaceChildren(n)}get value(){return this.#Et.checked}set value(t){this.#Et.checked=t}get readonly(){return this.#Mt.inert}set readonly(t){this.#Mt.inert=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get disabled(){return this.#Et.hasAttribute("disabled")}set disabled(t){l.toggle(this.#Et,"disabled",t),l.toggle(this,"disabled",t)}get required(){return"true"===this.#Et.getAttribute("aria-required")}set required(t){l.set(this.#Et,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}focus(t){this.#Et.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this.#St.innerText="");this.internals.setValidity({customError:!0}," "),this.#St.innerText=t}}class ht extends E{static slots=!0;static template='\n <div class="ful-spinner-wrapper" role="status">\n <div class="ful-spinner-text">{{{{ slots.default }}}}</div>\n <div class="ful-spinner-icon"></div>\n </div>\n ';render({slots:t}){this.template().withOverlay({slots:t}).renderTo(this)}}class pt extends E{static observed=["order"];#Rt;render({observed:t}){const e=this.getAttribute("sorter"),s=["asc","desc",null];this.order=t.order,this.addEventListener("click",()=>{const t=s[(s.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort-requested",{bubbles:!0,cancelable:!0,detail:{value:{sorter:e,order:t}}}))})}get order(){return this.#Rt||null}set order(t){this.#Rt=t||null,this.reflect(()=>{this.#Rt?this.setAttribute("order",t):this.removeAttribute("order")})}}class ft extends E{static observed=["total:number","current:number"];static l10n={en:{showing:"Page {0} of {1}",navigation:"Page navigation",previous:"Previous",next:"Next"},it:{showing:"Pagina {0} di {1}",navigation:"Navigazione pagine",previous:"Precedente",next:"Successivo"},es:{showing:"Página {0} de {1}",navigation:"Navegación de páginas",previous:"Anterior",next:"Siguiente"},fr:{showing:"Page {0} sur {1}",navigation:"Navigation des pages",previous:"Précédent",next:"Suivant"}};static config={prevIcon:"bi bi-chevron-left",nextIcon:"bi bi-chevron-right",reloadIcon:"bi bi-arrow-clockwise"};static template='\n <nav data-tpl-aria-label="#l10n:t(\'navigation\')" class="user-select-none">\n <ul class="pagination">\n <li class="page-item ms-auto me-2 pagination-index"> {{ #l10n:t(\'showing\', curr.label, total) }}</li>\n <li class="page-item me-2 reload"><a role="button"><i data-tpl-class="config.reloadIcon"></i></a></li>\n <li class="page-item prev">\n <a data-tpl-class="prev.enabled?\'page-link\':\'page-link disabled\'" data-tpl-aria-label="#l10n:t(\'previous\')" role="button" data-tpl-data-page="prev.index">\n <i aria-hidden="true" data-tpl-class="config.prevIcon"></i>\n </a>\n </li>\n <li class="page-item" data-tpl-each="pages" data-tpl-var="page">\n <a data-tpl-class="curr.index != page.index ? \'page-link\': \'page-link disabled\'" role="button" data-tpl-data-page="page.index" >\n {{ page.label }}\n </a>\n </li>\n <li class="page-item next">\n <a data-tpl-class="next.enabled?\'page-link\':\'page-link disabled\'" data-tpl-aria-label="#l10n:t(\'next\')" role="button" data-tpl-data-page="next.index">\n <i aria-hidden="true" data-tpl-class="config.nextIcon"></i>\n </a>\n </li>\n </ul>\n </nav>\n ';#Dt=0;#_=0;render({observed:t}){this.total=t.total??0,this.current=t.current??0,this.addEventListener("click",t=>{const e=t.target.closest("a");e&&!e.classList.contains("disabled")&&this.dispatchEvent(new CustomEvent("page-requested",{bubbles:!0,cancelable:!0,detail:{value:Number(e.dataset.page??this.#_)}}))})}update(t,e){const s=Number(this.getAttribute("pages")??"5"),r=t>0,i=t+1<e,n={index:r?t-1:null,enabled:r},a={index:t,label:t+1},l={index:i?t+1:null,enabled:i},o=Math.max(1,Math.min(s,e)),u=Math.max(0,Math.min(t-Math.floor((o-1)/2),e-o)),c=Array.from({length:o},(t,e)=>({index:u+e,label:u+e+1}));this.template().withOverlay({total:e,prev:n,curr:a,next:l,pages:c}).renderTo(this)}get total(){return this.#Dt}set total(t){this.#Dt=t,this.reflect(()=>{this.setAttribute("total",String(t)),this.update(this.#_??0,this.#Dt)})}get current(){return this.#_}set current(t){this.#_=t,this.reflect(()=>{this.setAttribute("current",String(t)),this.update(this.#_,this.#Dt??0)})}}class mt{static parse(t,e){const s=t?u.queryChildren(t,"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 t of s.getAttributeNames()){const e=s.getAttribute(t);r.setAttribute(t,e??""),i.setAttribute(t,e??"")}const n=u.queryChildrenAll(s,"column"),l=n.filter(t=>t.hasAttribute("order")).map(t=>({sorter:t.getAttribute("sorter"),order:t.getAttribute("order")}))[0]??null;for(var o of n){const t=u.queryChildren(o,"title"),e=o.getAttribute("sorter"),s=o.getAttribute("order"),n=t??document.createTextNode(o.getAttribute("title")??"");t?.remove(),o.removeAttribute("sorter"),o.removeAttribute("order"),o.removeAttribute("title");const a=e||s?(()=>{const t=document.createElement("ful-sorter");return e&&t.setAttribute("sorter",e),s&&t.setAttribute("order",s),t.append(n),t})():n,l=document.createElement("th"),c=document.createElement("td");for(const t of o.getAttributeNames()){const e=o.getAttribute(t);l.setAttribute(t,e??""),c.setAttribute(t,e??"")}l.append(a),c.append(...o.childNodes),r.append(l),i.append(c)}return{headersTemplate:e.withOverlay({inHeaders:!0,inRows:!1}).withFragment(a.from(r)),rowsTemplate:e.withOverlay({inHeaders:!1,inRows:!0}).withFragment(a.from(i)),sort:l,length:n.length}}}class bt{#g;constructor(t){this.#g=t}async load(t,e,s){const r=t.page*t.size,i=r+t.size;return{data:this.#g.slice(r,i),size:this.#g.length}}update(t){this.#g=t}}class gt{#$;#B;#M;constructor(t,e,s){this.#$=t,this.#B=e,this.#M=s}async load(t,e,s){const r=Object.entries(s).filter(([t,e])=>e);return await this.#$.request(this.#M,this.#B).param("page",t.page).param("size",t.size).param("sort",e?`${e.sorter},${e.order}`:null).param("filters",r.length>0?JSON.stringify(Object.fromEntries(r)):null).fetchJson()}}class vt{static create(t,e){const s=t.getAttribute("src");if(s){const e=v.component("http-client"),r=t.getAttribute("method")??"GET";return new gt(e,s,r)}return new bt([])}}class yt extends E{static slots=!0;static l10n={en:{initial:"Start searching to see results.",error:"Error while loading data:",nodata:"No elements found."},it:{initial:"Avvia la ricerca per visualizzare i risultati.",error:"Errore nel caricamento dei dati:",nodata:"Nessun elemento trovato."},es:{initial:"Inicia la búsqueda para ver los resultados.",error:"Error al cargar los datos:",nodata:"No se encontraron elementos."},fr:{initial:"Lancez la recherche pour voir les résultats.",error:"Erreur lors du chargement des données :",nodata:"Aucun élément trouvé."}};static config={searchIcon:"bi bi-search"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <div class="table-wrapper">\n <table class="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 <div>\n <p data-tpl-if="config.searchIcon"><i data-tpl-class="config.searchIcon"></i></p>\n {{{ #l10n:t(\'initial\') }}}\n </div>\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"></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 class="alert alert-danger">\n <p>{{ #l10n:t(\'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 </div>\n <ful-pagination current="0" total="1"></ful-pagination>\n ';static templates={row:'\n <tr data-tpl-if="pageResponse.data.length == 0">\n <td data-tpl-colspan="schema.length" class="text-center align-middle p-4">\n {{ #l10n:t(\'nodata\') }}\n </td>\n </tr>\n {{{{ schema.rowsTemplate.withOverlay({\'rows\': pageResponse.data}).render() }}}}\n '};#yt;#Nt;#z;#zt;#It;#Ft;#$t;#Bt;#Ht;async render({slots:t,observed:e}){const s=this.template(),r=mt.parse(t.schema,s),i=s.withOverlay({slots:t,schema:r}).render(),n=u.queryChildren(i,".table-wrapper").querySelector("table");l.forward("table-",this,n),this.#yt=v.component(this.getAttribute("loader")??"loaders:table").create(this),this.#Nt=r,this.#z=n.querySelector(":scope > tbody"),this.#zt=n.querySelector(":scope > tbody[data-ref=loading]"),this.#It=n.querySelector(":scope > tbody[data-ref=initial]"),this.#Ft=n.querySelector(":scope > tbody[data-ref=feedback]"),this.#$t=u.queryChildren(i,"ful-pagination"),this.replaceChildren(i);const a=this.querySelector("thead");r.headersTemplate.renderTo(a),this.#Bt=a.querySelectorAll("ful-sorter"),await x.waitForChildren(this);const o=u.queryChildren(this,"ful-form");this.#Ht={pageRequest:{page:0,size:this.getAttribute("page-size")?Number(this.getAttribute("page-size")):10},sortRequest:r.sort,filterRequest:o?.values??{}},o?.addEventListener("submit:success",async t=>{await this.load({page:0,size:this.#Ht.pageRequest.size},this.#Ht.sortRequest,t.detail.request)}),this.addEventListener("page-requested",async t=>{await this.load({page:t.detail.value,size:this.#Ht.pageRequest.size},this.#Ht.sortRequest,this.#Ht.filterRequest)}),this.addEventListener("sort-requested",async t=>{const e=t.detail.value.order?t.detail.value:null;await this.load(this.#Ht.pageRequest,e,this.#Ht.filterRequest),this.#Bt.forEach(t=>{t.order=null}),t.target.order=t.detail.value.order}),this.hasAttribute("autoload")&&this.reload()}async reload(){return await this.load(this.#Ht.pageRequest,this.#Ht.sortRequest,this.#Ht.filterRequest)}async load(t,e,s){this.#z.replaceChildren(),this.#zt.removeAttribute("hidden"),this.#Ft.setAttribute("hidden",""),this.#It.setAttribute("hidden","");try{const r=await this.#yt.load(t,e,s);this.#Ht={pageRequest:t,sortRequest:e,filterRequest:s},this.#Y(t,e,s,r)}catch(t){throw this.#zt.setAttribute("hidden",""),this.#Ft.removeAttribute("hidden"),t.problems?this.#Ft.querySelector("[data-ref=feedback-error]").textContent=t.problems.map(t=>`${t.reason}`):this.#Ft.querySelector("[data-ref=feedback-error]").textContent=t,t}}async withLoader(t){return await t(this.#yt)}async resetWithFilter(t){return await this.load({page:0,size:this.#Ht.pageRequest.size},this.#Ht.sortRequest,t)}#Y(t,e,s,r){this.#zt.setAttribute("hidden",""),this.#z.replaceChildren(this.template("row").withOverlay({schema:this.#Nt,pageRequest:t,filterRequest:s,pageResponse:r}).render()),this.#$t.current=t.page,this.#$t.total=Math.ceil(r.size/t.size)}}class wt extends Z{static observed=["value:json","readonly:presence","required:presence","placeholder"];static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <button data-ref="operator" class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" value="LTE" form="">&PrecedesSlantEqual;</button>\n <ul class="dropdown-menu">\n <li><a class="dropdown-item" role="button" value="EQ">=</a></li>\n <li><a class="dropdown-item" role="button" value="NEQ">&ne;</a></li>\n <li><a class="dropdown-item" role="button" value="LT">&prec;</a></li>\n <li><a class="dropdown-item" role="button" value="GT">&succ;</a></li>\n <li><a class="dropdown-item" role="button" value="LTE">&PrecedesSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="GTE">&SucceedsSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="BETWEEN">&LeftRightArrow;</a></li>\n </ul>\n <input data-ref="value1" type="datetime-local" class="form-control" form="">\n <input data-ref="value2" type="datetime-local" class="form-control" form="" hidden>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';#jt;#Vt;#Ut;render(t){super.render({...t,skipObservedSetup:!0}),this.#jt=this.querySelector("[data-ref=operator]"),this.#Vt=this.querySelector("[data-ref=value1]"),this.#Ut=this.querySelector("[data-ref=value2]"),this.#Ut.addEventListener("change",t=>{t.stopPropagation(),this.#Wt()}),this.disabled=t.disabled,this.readonly=t.observed.readonly,this.required=t.observed.required,this.placeholder=t.observed.placeholder,this.value=t.observed.value,this.addEventListener("click",t=>{const e=t.target;if(!e.matches("ul > li > a"))return;const s=e.closest("ul")?.previousElementSibling,r=e.getAttribute("value"),i=s.getAttribute("value");l.toggle(this.#Ut,"hidden","BETWEEN"!==r),s.setAttribute("value",r),s.innerHTML=e.innerHTML,i!==r&&this.#Wt()})}get value(){const t=this.#jt.getAttribute("value"),e="BETWEEN"===t?[this.#Vt.value,this.#Ut.value]:[this.#Vt.value];return e.some(t=>""===t)?void 0:[t,...e.map(t=>new Date(t).toISOString())]}set value(t){if(null==t)return this.#Vt.value="",void(this.#Ut.value="");const[e,...s]=t;this.#Gt(e),this.#Vt.value=s[0]?K.isoToLocal(s[0]):s[0],this.#Ut.value=s[1]?K.isoToLocal(s[1]):s[1]}#Gt(t){this.#jt.setAttribute("value",t);const e=Array.from(this.#jt.nextElementSibling?.querySelectorAll("li > a[value]")??[]).find(e=>e.getAttribute("value")===t);e&&(this.#jt.innerHTML=e.innerHTML),l.toggle(this.#Ut,"hidden","BETWEEN"!==t)}#Wt(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))}get readonly(){return super.readonly}set readonly(t){this.#Ut.readOnly=t,super.readonly=t}get disabled(){return super.disabled}set disabled(t){l.toggle(this.#Ut,"disabled",t),super.disabled=t}}class xt extends Z{static observed=["value:json","readonly:presence","required:presence","placeholder"];static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <button data-ref="operator" class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" value="EQ" form="">=</button>\n <ul class="dropdown-menu">\n <li><a class="dropdown-item" role="button" value="EQ">=</a></li>\n <li><a class="dropdown-item" role="button" value="NEQ">&ne;</a></li>\n <li><a class="dropdown-item" role="button" value="LT">&prec;</a></li>\n <li><a class="dropdown-item" role="button" value="GT">&succ;</a></li>\n <li><a class="dropdown-item" role="button" value="LTE">&PrecedesSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="GTE">&SucceedsSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="BETWEEN">&LeftRightArrow;</a></li>\n </ul>\n <input data-ref="value1" type="date" class="form-control" form="">\n <input data-ref="value2" type="date" class="form-control" form="" hidden>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';#jt;#Vt;#Ut;render(t){super.render({...t,skipObservedSetup:!0}),this.#jt=this.querySelector("[data-ref=operator]"),this.#Vt=this.querySelector("[data-ref=value1]"),this.#Ut=this.querySelector("[data-ref=value2]"),this.#Ut.addEventListener("change",t=>{t.stopPropagation(),this.#Wt()}),this.disabled=t.disabled,this.readonly=t.observed.readonly,this.required=t.observed.required,this.placeholder=t.observed.placeholder,this.value=t.observed.value,this.addEventListener("click",t=>{const e=t.target;if(!e.matches("ul > li > a"))return;const s=e.closest("ul")?.previousElementSibling,r=e.getAttribute("value"),i=s.getAttribute("value");l.toggle(this.#Ut,"hidden","BETWEEN"!==r),s.setAttribute("value",r),s.innerHTML=e.innerHTML,i!==r&&this.#Wt()})}get value(){const t=this.#jt.getAttribute("value"),e="BETWEEN"===t?[this.#Vt.value,this.#Ut.value]:[this.#Vt.value];return e.some(t=>""===t)?void 0:[t,...e]}set value(t){if(null==t)return this.#Vt.value="",void(this.#Ut.value="");const[e,...s]=t;this.#Gt(e),this.#Vt.value=s[0],this.#Ut.value=s[1]}#Gt(t){this.#jt.setAttribute("value",t);const e=Array.from(this.#jt.nextElementSibling?.querySelectorAll("li > a[value]")??[]).find(e=>e.getAttribute("value")===t);e&&(this.#jt.innerHTML=e.innerHTML),l.toggle(this.#Ut,"hidden","BETWEEN"!==t)}#Wt(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))}get readonly(){return super.readonly}set readonly(t){this.#Ut.readOnly=t,super.readonly=t}get disabled(){return super.disabled}set disabled(t){l.toggle(this.#Ut,"disabled",t),super.disabled=t}}class Et extends Z{static observed=["value:json","readonly:presence","required:presence","placeholder"];static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <button data-ref="operator" class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" value="CONTAINS" form="">&mldr;a&mldr;</button>\n <ul class="dropdown-menu">\n <li><a class="dropdown-item" role="button" value="CONTAINS">&mldr;a&mldr;</a></li>\n <li><a class="dropdown-item" role="button" value="STARTS_WITH">a&mldr;</a></li>\n <li><a class="dropdown-item" role="button" value="ENDS_WITH">&mldr;a</a></li>\n <li><a class="dropdown-item" role="button" value="EQ">=</a></li>\n </ul>\n <input data-ref="value" type="text" class="form-control" form="">\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';#jt;#Jt;#Xt="IGNORE_CASE";render(t){super.render({...t,skipObservedSetup:!0}),this.#jt=this.querySelector("[data-ref=operator]"),this.#Jt=this.querySelector("[data-ref=value]"),this.disabled=t.disabled,this.readonly=t.observed.readonly,this.required=t.observed.required,this.placeholder=t.observed.placeholder,this.value=t.observed.value,this.addEventListener("click",t=>{const e=t.target;if(!e.matches("ul > li > a"))return;const s=e.closest("ul")?.previousElementSibling,r=e.getAttribute("value"),i=s.getAttribute("value");s.setAttribute("value",r),s.innerHTML=e.innerHTML,i!==r&&this.#Wt()})}get value(){const t=this.#jt.getAttribute("value");return""===this.#Jt.value?void 0:[t,this.#Xt,this.#Jt.value]}set value(t){if(null==t)return void(this.#Jt.value="");const[e,s,r]=t;this.#Gt(e),this.#Xt=s??"IGNORE_CASE",this.#Jt.value=r}#Gt(t){this.#jt.setAttribute("value",t);const e=Array.from(this.#jt.nextElementSibling?.querySelectorAll("li > a[value]")??[]).find(e=>e.getAttribute("value")===t);e&&(this.#jt.innerHTML=e.innerHTML)}#Wt(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))}}class At{static t(t,...e){const s=this.l10n?.[this.language]?.[t]??this.l10n?.en?.[t]??t;return 0===e.length?s:s.replace(/{(\d+)}/g,(t,s)=>e[Number(s)])}static tl(t,e=[]){return At.t.apply(this,[t,...e])}}class St{configure(t){const e=R.builder().withCsrfToken().withRedirectOnUnauthorized("/").build();t.defineModule("l10n",At).defineComponent("http-client",e).defineElement("ful-spinner",ht).defineElement("ful-form",Q).defineElement("ful-checkbox",dt).defineElement("ful-input",Z).defineElement("ful-input-file",rt).defineElement("ful-local-date",Y).defineElement("ful-instant",K).defineElement("ful-input-local-date",tt).defineElement("ful-input-local-time",et).defineElement("ful-input-instant",st).defineElement("ful-radio-group",ct).defineElement("ful-table",yt).defineElement("ful-pagination",ft).defineElement("ful-sorter",pt).defineElement("ful-filter-instant",wt).defineElement("ful-filter-local-date",xt).defineElement("ful-filter-text",Et).defineElement("ful-select",ut).defineElement("ful-dropdown",ot).defineComponent("loaders:select",lt).defineComponent("loaders:form",X).defineComponent("loaders:table",vt).defineOverlay({language:navigator?.language?.split("-")?.[0]??"en"})}}var Tt=Object.freeze({__proto__:null,AsyncEvents:V,Bindings:W,Checkbox:dt,Dropdown:ot,Form:Q,FormLoader:X,Input:Z,InputFile:rt,InputInstant:st,InputLocalDate:tt,InputLocalTime:et,Instant:K,InstantFilter:wt,LocalDate:Y,LocalDateFilter:xt,LocalStorage:$,LocalizationModule:At,Pagination:ft,Plugin:St,RadioGroup:ct,Select:ut,SelectLoader:lt,SessionStorage:B,SortButton:pt,Spinner:ht,Table:yt,TableSchemaParser:mt,TextFilter:Et,Timing:U,VersionedLocalStorage:H,VersionedSessionStorage:j});"undefined"!=typeof window&&(window.ftl=A,window.httpc=F,window.ful=Tt);export{V as AsyncEvents,l as Attributes,T as Base64,W as Bindings,dt as Checkbox,ot as Dropdown,n as ExpressionEvaluator,i as Expressions,S as Failure,Q as Form,X as FormLoader,a as Fragments,C as Hex,R as HttpClient,O as HttpClientError,Z as Input,rt as InputFile,st as InputInstant,tt as InputLocalDate,et as InputLocalTime,K as Instant,wt as InstantFilter,o as LightSlots,Y as LocalDate,xt as LocalDateFilter,$ as LocalStorage,At as LocalizationModule,q as MediaType,u as Nodes,ft as Pagination,E as ParsedElement,St as Plugin,ct as RadioGroup,g as Registry,m as RenderError,x as Rendering,ut as Select,lt as SelectLoader,B as SessionStorage,pt as SortButton,ht as Spinner,yt as Table,mt as TableSchemaParser,f as Template,y as Templates,Et as TextFilter,U as Timing,H as VersionedLocalStorage,j as VersionedSessionStorage,v as registry};
1
+ const t={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")}};class e extends SyntaxError{constructor(t,e,s,r){super(t),this.expected=e,this.found=s,this.location=r,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let s=null;const r=t.find(t=>t.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 t=this.location.end,r="".padEnd(n.line.toString().length," "),l=s[i.line-1],o=(i.line===t.line?t.column:l.length+1)-i.column||1;e+="\n --\x3e "+a+"\n"+r+" |\n"+n.line+" | "+l+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(o,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function s(t){return t.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(t){return r?t.replace(r,t=>"\\u{"+s(t)+"}"):t}function n(t){return i(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+s(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+s(t)))}function a(t){return i(t.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,t=>"\\x0"+s(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+s(t)))}const l={literal:t=>'"'+n(t.text)+'"',class(t){const e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function o(t){return l[t.type](t)}return"Expected "+function(t){const e=t.map(o);if(e.sort(),e.length>0){let t=1;for(let s=1;s<e.length;s++)e[s-1]!==e[s]&&(e[t]=e[s],t++);e.length=t}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}(t)+" but "+function(t){return t?'"'+n(t)+'"':"end of input"}(e)+" found."}}function s(s,r){const i={},n=(r=void 0!==r?r:{}).grammarSource,a={TemplatedRoot:Te,ExpressionRoot:qe};let l=Te;const o="{{{{",u="}}}}",c="{{{",d="}}}",h="{{",p="}}",f="\\",m="{",b="?",g=":",v="?:",y="??",w="||",x="&&",E="!",A="?.",S=".",T="[",C="]",q="(",O=",",P=")",L="true",_="false",k="null",M="undefined",R="-",N="'",D='"',z="`",I="}",F="#",$="==",B="!=",H=">=",j=">",V="<=",U="<",W=/^[^\\{]/,G=/^[0-9]/,J=/^[^']/,X=/^[^"]/,Q=/^[^\\`{]/,Z=/^[a-zA-Z$_]/,K=/^[a-zA-Z$_0-9_]/,Y=/^[ \t\n\r]/,tt=ye("{{{{",!1),et=ye("}}}}",!1),st=ye("{{{",!1),rt=ye("}}}",!1),it=ye("{{",!1),nt=ye("}}",!1),at=we(["\\","{"],!0,!1,!1),lt=ye("\\",!1),ot={type:"any"},ut=ye("{",!1),ct=ye("?",!1),dt=ye(":",!1),ht=ye("?:",!1),pt=ye("??",!1),ft=ye("||",!1),mt=ye("&&",!1),bt=ye("!",!1),gt=xe("member"),vt=ye("?.",!1),yt=ye(".",!1),wt=xe("subscript"),xt=ye("[",!1),Et=ye("]",!1),At=xe("method-call"),St=ye("(",!1),Tt=ye(",",!1),Ct=ye(")",!1),qt=xe("module-function-call"),Ot=xe("boolean-literal"),Pt=ye("true",!1),Lt=ye("false",!1),_t=xe("null-literal"),kt=ye("null",!1),Mt=xe("undefined-literal"),Rt=ye("undefined",!1),Nt=xe("number-literal"),Dt=ye("-",!1),zt=we([["0","9"]],!1,!1,!1),It=xe("string-literal"),Ft=ye("'",!1),$t=we(["'"],!0,!1,!1),Bt=ye('"',!1),Ht=we(['"'],!0,!1,!1),jt=ye("`",!1),Vt=xe("tstring-expression"),Ut=ye("}",!1),Wt=xe("tstring-literal"),Gt=we(["\\","`","{"],!0,!1,!1),Jt=xe("array-literal"),Xt=xe("dict-literal"),Qt=xe("module-function"),Zt=ye("#",!1),Kt=we([["a","z"],["A","Z"],"$","_"],!1,!1,!1),Yt=we([["a","z"],["A","Z"],"$","_",["0","9"],"_"],!1,!1,!1),te=xe("symbol"),ee=ye("==",!1),se=ye("!=",!1),re=ye(">=",!1),ie=ye(">",!1),ne=ye("<=",!1),ae=ye("<",!1),le=we([" ","\t","\n","\r"],!1,!1,!1);function oe(t){return t}function ue(t,e,s){return{op:e,rhs:s}}function ce(t,e,s){return{op:e,rhs:s}}function de(t){return t}let he=0|r.peg$currPos;const pe=[{line:1,column:1}];let fe,me=he,be=r.peg$maxFailExpected||[],ge=0|r.peg$silentFails,ve={};if(r.startRule){if(!(r.startRule in a))throw new Error("Can't start parsing from rule \""+r.startRule+'".');l=a[r.startRule]}function ye(t,e){return{type:"literal",text:t,ignoreCase:e}}function we(t,e,s,r){return{type:"class",parts:t,inverted:e,ignoreCase:s,unicode:r}}function xe(t){return{type:"other",description:t}}function Ee(t){let e,r=pe[t];if(r)return r;if(t>=pe.length)e=pe.length-1;else for(e=t;!pe[--e];);for(r=pe[e],r={line:r.line,column:r.column};e<t;)10===s.charCodeAt(e)?(r.line++,r.column=1):r.column++,e++;return pe[t]=r,r}function Ae(t,e,s){const r=Ee(t),i=Ee(e);return{source:n,start:{offset:t,line:r.line,column:r.column},end:{offset:e,line:i.line,column:i.column}}}function Se(t){he<me||(he>me&&(me=he,be=[]),be.push(t))}function Te(){let t,e;const s=40*he+0,r=ve[s];if(r)return he=r.nextPos,r.result;for(t=[],e=Ce();e!==i;)t.push(e),e=Ce();return ve[s]={nextPos:he,result:t},t}function Ce(){let e,r,n,a,l;const b=40*he+1,g=ve[b];return g?(he=g.nextPos,g.result):(e=he,r=he,n=function(){let t;const e=40*he+2,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,4)===o?(t=o,he+=4):(t=i,0===ge&&Se(tt));return ve[e]={nextPos:he,result:t},t}(),n!==i?(a=qe(),a!==i?(l=function(){let t;const e=40*he+3,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,4)===u?(t=u,he+=4):(t=i,0===ge&&Se(et));return ve[e]={nextPos:he,result:t},t}(),l!==i?r=a:(he=r,r=i)):(he=r,r=i)):(he=r,r=i),r!==i&&(v=r,r={type:t.templated.ten,value:v}),e=r,e===i&&(e=he,r=he,n=function(){let t;const e=40*he+4,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,3)===c?(t=c,he+=3):(t=i,0===ge&&Se(st));return ve[e]={nextPos:he,result:t},t}(),n!==i?(a=qe(),a!==i?(l=function(){let t;const e=40*he+5,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,3)===d?(t=d,he+=3):(t=i,0===ge&&Se(rt));return ve[e]={nextPos:he,result:t},t}(),l!==i?r=a:(he=r,r=i)):(he=r,r=i)):(he=r,r=i),r!==i&&(r=function(e){return{type:t.templated.teh,value:e}}(r)),e=r,e===i&&(e=he,r=he,n=function(){let t;const e=40*he+6,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,2)===h?(t=h,he+=2):(t=i,0===ge&&Se(it));return ve[e]={nextPos:he,result:t},t}(),n!==i?(a=qe(),a!==i?(l=function(){let t;const e=40*he+7,r=ve[e];if(r)return he=r.nextPos,r.result;s.substr(he,2)===p?(t=p,he+=2):(t=i,0===ge&&Se(nt));return ve[e]={nextPos:he,result:t},t}(),l!==i?r=a:(he=r,r=i)):(he=r,r=i)):(he=r,r=i),r!==i&&(r=function(e){return{type:t.templated.tet,value:e}}(r)),e=r,e===i&&(e=he,r=function(){let t,e,r,n,a,l;const o=40*he+8,u=ve[o];if(u)return he=u.nextPos,u.result;t=he,e=[],r=he,n=[],a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at));if(a!==i)for(;a!==i;)n.push(a),a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at));else n=i;r=n!==i?s.substring(r,he):n;r===i&&(r=he,92===s.charCodeAt(he)?(n=f,he++):(n=i,0===ge&&Se(lt)),n!==i?(s.length>he?(a=s.charAt(he),he++):(a=i,0===ge&&Se(ot)),a!==i?r=a:(he=r,r=i)):(he=r,r=i),r===i&&(r=he,123===s.charCodeAt(he)?(n=m,he++):(n=i,0===ge&&Se(ut)),n!==i?(a=he,ge++,123===s.charCodeAt(he)?(l=m,he++):(l=i,0===ge&&Se(ut)),ge--,l===i?a=void 0:(he=a,a=i),a!==i?(n=[n,a],r=n):(he=r,r=i)):(he=r,r=i)));if(r!==i)for(;r!==i;){if(e.push(r),r=he,n=[],a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at)),a!==i)for(;a!==i;)n.push(a),a=s.charAt(he),W.test(a)?he++:(a=i,0===ge&&Se(at));else n=i;r=n!==i?s.substring(r,he):n,r===i&&(r=he,92===s.charCodeAt(he)?(n=f,he++):(n=i,0===ge&&Se(lt)),n!==i?(s.length>he?(a=s.charAt(he),he++):(a=i,0===ge&&Se(ot)),a!==i?r=oe(a):(he=r,r=i)):(he=r,r=i),r===i&&(r=he,123===s.charCodeAt(he)?(n=m,he++):(n=i,0===ge&&Se(ut)),n!==i?(a=he,ge++,123===s.charCodeAt(he)?(l=m,he++):(l=i,0===ge&&Se(ut)),ge--,l===i?a=void 0:(he=a,a=i),a!==i?(n=[n,a],r=n):(he=r,r=i)):(he=r,r=i)))}else e=i;e!==i&&(e=e.join(""));return t=e,ve[o]={nextPos:he,result:t},t}(),r!==i&&(r=function(e){return{type:t.templated.tel,value:e}}(r)),e=r))),ve[b]={nextPos:he,result:e},e);var v}function qe(){let t,e;const s=40*he+9,r=ve[s];return r?(he=r.nextPos,r.result):(t=he,Ve(),e=Oe(),e!==i?(Ve(),t=e):(he=t,t=i),ve[s]={nextPos:he,result:t},t)}function Oe(){let e,r,n,a,l,o;const u=40*he+10,c=ve[u];return c?(he=c.nextPos,c.result):(e=he,r=Pe(),r!==i?(Ve(),63===s.charCodeAt(he)?(n=b,he++):(n=i,0===ge&&Se(ct)),n!==i?(Ve(),a=Oe(),a!==i?(Ve(),58===s.charCodeAt(he)?(l=g,he++):(l=i,0===ge&&Se(dt)),l!==i?(Ve(),o=Oe(),o!==i?e={type:t.ter,cond:r,ifTrue:a,ifFalse:o}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=Pe()),ve[u]={nextPos:he,result:e},e)}function Pe(){let e,r,n,a;const l=40*he+11,o=ve[l];return o?(he=o.nextPos,o.result):(e=he,r=Le(),r!==i?(Ve(),s.substr(he,2)===v?(n=v,he+=2):(n=i,0===ge&&Se(ht)),n!==i?(Ve(),a=Pe(),a!==i?e={type:t.elv,cond:r,ifFalse:a}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=Le()),ve[l]={nextPos:he,result:e},e)}function Le(){let e,r,n,a;const l=40*he+12,o=ve[l];return o?(he=o.nextPos,o.result):(e=he,r=_e(),r!==i?(Ve(),s.substr(he,2)===y?(n=y,he+=2):(n=i,0===ge&&Se(pt)),n!==i?(Ve(),a=Le(),a!==i?e={type:t.nullc,lhs:r,rhs:a}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=_e()),ve[l]={nextPos:he,result:e},e)}function _e(){let e,r,n,a,l,o;const u=40*he+13,c=ve[u];if(c)return he=c.nextPos,c.result;if(e=he,r=ke(),r!==i){for(n=[],a=he,Ve(),s.substr(he,2)===w?(l=w,he+=2):(l=i,0===ge&&Se(ft)),l!==i?(Ve(),o=ke(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);a!==i;)n.push(a),a=he,Ve(),s.substr(he,2)===w?(l=w,he+=2):(l=i,0===ge&&Se(ft)),l!==i?(Ve(),o=ke(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);e=function(e,s){let r=e;for(const e of s)r={type:t.or,lhs:r,rhs:e};return r}(r,n)}else he=e,e=i;return ve[u]={nextPos:he,result:e},e}function ke(){let e,r,n,a,l,o;const u=40*he+14,c=ve[u];if(c)return he=c.nextPos,c.result;if(e=he,r=Me(),r!==i){for(n=[],a=he,Ve(),s.substr(he,2)===x?(l=x,he+=2):(l=i,0===ge&&Se(mt)),l!==i?(Ve(),o=Me(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);a!==i;)n.push(a),a=he,Ve(),s.substr(he,2)===x?(l=x,he+=2):(l=i,0===ge&&Se(mt)),l!==i?(Ve(),o=Me(),o!==i?a=o:(he=a,a=i)):(he=a,a=i);e=function(e,s){let r=e;for(const e of s)r={type:t.and,lhs:r,rhs:e};return r}(r,n)}else he=e,e=i;return ve[u]={nextPos:he,result:e},e}function Me(){let e,s,r,n,a,l;const o=40*he+15,u=ve[o];if(u)return he=u.nextPos,u.result;if(e=he,s=Re(),s!==i){for(r=[],n=he,Ve(),a=He(),a!==i?(Ve(),l=Re(),l!==i?n=ue(0,a,l):(he=n,n=i)):(he=n,n=i);n!==i;)r.push(n),n=he,Ve(),a=He(),a!==i?(Ve(),l=Re(),l!==i?n=ue(0,a,l):(he=n,n=i)):(he=n,n=i);e=function(e,s){let r=e;for(const e of s)r={type:t.eq,op:e.op,lhs:r,rhs:e.rhs};return r}(s,r)}else he=e,e=i;return ve[o]={nextPos:he,result:e},e}function Re(){let e,s,r,n,a,l;const o=40*he+16,u=ve[o];if(u)return he=u.nextPos,u.result;if(e=he,s=Ne(),s!==i){for(r=[],n=he,Ve(),a=je(),a!==i?(Ve(),l=Ne(),l!==i?n=ce(0,a,l):(he=n,n=i)):(he=n,n=i);n!==i;)r.push(n),n=he,Ve(),a=je(),a!==i?(Ve(),l=Ne(),l!==i?n=ce(0,a,l):(he=n,n=i)):(he=n,n=i);e=function(e,s){let r=e;for(const e of s)r={type:t.cmp,op:e.op,lhs:r,rhs:e.rhs};return r}(s,r)}else he=e,e=i;return ve[o]={nextPos:he,result:e},e}function Ne(){let e,r,n;const a=40*he+17,l=ve[a];return l?(he=l.nextPos,l.result):(e=he,33===s.charCodeAt(he)?(r=E,he++):(r=i,0===ge&&Se(bt)),r!==i?(Ve(),n=Ne(),n!==i?e={type:t.not,expr:n}:(he=e,e=i)):(he=e,e=i),e===i&&(e=function(){let e,s,r,n,a;const l=40*he+18,o=ve[l];if(o)return he=o.nextPos,o.result;if(e=he,s=ze(),s!==i){if(Ve(),r=[],n=he,a=De(),a!==i?(Ve(),n=a):(he=n,n=i),n!==i)for(;n!==i;)r.push(n),n=he,a=De(),a!==i?(Ve(),n=a):(he=n,n=i);else r=i;r!==i?e={type:t.access,lhs:s,rhs:r}:(he=e,e=i)}else he=e,e=i;e===i&&(e=ze());return ve[l]={nextPos:he,result:e},e}()),ve[a]={nextPos:he,result:e},e)}function De(){let e;const r=40*he+19,n=ve[r];return n?(he=n.nextPos,n.result):(e=function(){let e,r,n;const a=40*he+20,l=ve[a];if(l)return he=l.nextPos,l.result;ge++,e=he,s.substr(he,2)===A?(r=A,he+=2):(r=i,0===ge&&Se(vt));r===i&&(46===s.charCodeAt(he)?(r=S,he++):(r=i,0===ge&&Se(yt)));r!==i?(Ve(),n=Be(),n!==i?e={type:t.member,ns:"?."===r,rhs:n.value}:(he=e,e=i)):(he=e,e=i);ge--,e===i&&(r=i,0===ge&&Se(gt));return ve[a]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r,n,a,l;const o=40*he+21,u=ve[o];if(u)return he=u.nextPos,u.result;ge++,e=he,s.substr(he,2)===A?(r=A,he+=2):(r=i,0===ge&&Se(vt));r===i&&(r=null);91===s.charCodeAt(he)?(n=T,he++):(n=i,0===ge&&Se(xt));n!==i?(Ve(),a=Oe(),a!==i?(Ve(),93===s.charCodeAt(he)?(l=C,he++):(l=i,0===ge&&Se(Et)),l!==i?e={type:t.subscript,ns:null!==r,rhs:a}:(he=e,e=i)):(he=e,e=i)):(he=e,e=i);ge--,e===i&&(r=i,0===ge&&Se(wt));return ve[o]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r,n,a,l,o,u,c;const d=40*he+22,h=ve[d];if(h)return he=h.nextPos,h.result;ge++,e=he,s.substr(he,2)===A?(r=A,he+=2):(r=i,0===ge&&Se(vt));r===i&&(r=null);40===s.charCodeAt(he)?(n=q,he++):(n=i,0===ge&&Se(St));if(n!==i){for(Ve(),a=he,l=Oe(),l!==i?(o=Ve(),a=l):(he=a,a=i),a===i&&(a=null),l=[],o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);o!==i;)l.push(o),o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);41===s.charCodeAt(he)?(o=P,he++):(o=i,0===ge&&Se(Ct)),o!==i?(f=l,e={type:t.method,ns:null!==r,args:null===(p=a)?[]:[p,...f]}):(he=e,e=i)}else he=e,e=i;var p,f;ge--,e===i&&(r=i,0===ge&&Se(At));return ve[d]={nextPos:he,result:e},e}())),ve[r]={nextPos:he,result:e},e)}function ze(){let e,r,n,a;const l=40*he+23,o=ve[l];return o?(he=o.nextPos,o.result):(e=he,40===s.charCodeAt(he)?(r=q,he++):(r=i,0===ge&&Se(St)),r!==i?(Ve(),n=Oe(),n!==i?(Ve(),41===s.charCodeAt(he)?(a=P,he++):(a=i,0===ge&&Se(Ct)),a!==i?e=n:(he=e,e=i)):(he=e,e=i)):(he=e,e=i),e===i&&(e=function(){let e,r,n,a,l,o,u,c;const d=40*he+24,h=ve[d];if(h)return he=h.nextPos,h.result;if(ge++,e=he,r=function(){let e,r,n,a,l,o,u,c;const d=40*he+35,h=ve[d];if(h)return he=h.nextPos,h.result;ge++,e=he,35===s.charCodeAt(he)?(r=F,he++):(r=i,0===ge&&Se(Zt));if(r!==i){if(n=he,a=he,l=he,o=s.charAt(he),Z.test(o)?he++:(o=i,0===ge&&Se(Kt)),o!==i){for(u=[],c=s.charAt(he),K.test(c)?he++:(c=i,0===ge&&Se(Yt));c!==i;)u.push(c),c=s.charAt(he),K.test(c)?he++:(c=i,0===ge&&Se(Yt));o=[o,u],l=o}else he=l,l=i;if(a=l!==i?s.substring(a,he):l,a!==i?(58===s.charCodeAt(he)?(l=g,he++):(l=i,0===ge&&Se(dt)),l!==i?n=a:(he=n,n=i)):(he=n,n=i),n===i&&(n=null),a=he,l=he,o=s.charAt(he),Z.test(o)?he++:(o=i,0===ge&&Se(Kt)),o!==i){for(u=[],c=s.charAt(he),K.test(c)?he++:(c=i,0===ge&&Se(Yt));c!==i;)u.push(c),c=s.charAt(he),K.test(c)?he++:(c=i,0===ge&&Se(Yt));o=[o,u],l=o}else he=l,l=i;a=l!==i?s.substring(a,he):l,a!==i?e={type:t.function,module:n,value:a}:(he=e,e=i)}else he=e,e=i;ge--,e===i&&(r=i,0===ge&&Se(Qt));return ve[d]={nextPos:he,result:e},e}(),r!==i)if(40===s.charCodeAt(he)?(n=q,he++):(n=i,0===ge&&Se(St)),n!==i){for(Ve(),a=he,l=Oe(),l!==i?(o=Ve(),a=l):(he=a,a=i),a===i&&(a=null),l=[],o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);o!==i;)l.push(o),o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(Ve(),c=Oe(),c!==i?(Ve(),o=c):(he=o,o=i)):(he=o,o=i);41===s.charCodeAt(he)?(o=P,he++):(o=i,0===ge&&Se(Ct)),o!==i?e=function(e,s,r){const i=null===s?[]:[s,...r];return{type:t.call,value:e,args:i}}(r,a,l):(he=e,e=i)}else he=e,e=i;else he=e,e=i;ge--,e===i&&(r=i,0===ge&&Se(qt));return ve[d]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e;const r=40*he+25,n=ve[r];if(n)return he=n.nextPos,n.result;e=function(){let e,r,n,a,l,o,u,c,d,h;const p=40*he+29,f=ve[p];if(f)return he=f.nextPos,f.result;ge++,e=he,r=he,n=he,45===s.charCodeAt(he)?(a=R,he++):(a=i,0===ge&&Se(Dt));a===i&&(a=null);l=he,o=[],u=s.charAt(he),G.test(u)?he++:(u=i,0===ge&&Se(zt));if(u!==i)for(;u!==i;)o.push(u),u=s.charAt(he),G.test(u)?he++:(u=i,0===ge&&Se(zt));else o=i;if(o!==i){if(u=he,46===s.charCodeAt(he)?(c=S,he++):(c=i,0===ge&&Se(yt)),c!==i){for(d=[],h=s.charAt(he),G.test(h)?he++:(h=i,0===ge&&Se(zt));h!==i;)d.push(h),h=s.charAt(he),G.test(h)?he++:(h=i,0===ge&&Se(zt));c=[c,d],u=c}else he=u,u=i;u===i&&(u=null),o=[o,u],l=o}else he=l,l=i;if(l===i)if(l=he,46===s.charCodeAt(he)?(o=S,he++):(o=i,0===ge&&Se(yt)),o!==i){if(u=[],c=s.charAt(he),G.test(c)?he++:(c=i,0===ge&&Se(zt)),c!==i)for(;c!==i;)u.push(c),c=s.charAt(he),G.test(c)?he++:(c=i,0===ge&&Se(zt));else u=i;u!==i?(o=[o,u],l=o):(he=l,l=i)}else he=l,l=i;l!==i?(a=[a,l],n=a):(he=n,n=i);r=n!==i?s.substring(r,he):n;r!==i&&(r={type:t.literal,value:parseFloat(r)});e=r,ge--,e===i&&(r=i,0===ge&&Se(Nt));return ve[p]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r;const n=40*he+26,a=ve[n];if(a)return he=a.nextPos,a.result;ge++,e=he,s.substr(he,4)===L?(r=L,he+=4):(r=i,0===ge&&Se(Pt));r!==i&&(r={type:t.literal,value:!0});e=r,e===i&&(e=he,s.substr(he,5)===_?(r=_,he+=5):(r=i,0===ge&&Se(Lt)),r!==i&&(r={type:t.literal,value:!1}),e=r);ge--,e===i&&(r=i,0===ge&&Se(Ot));return ve[n]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r;const n=40*he+27,a=ve[n];if(a)return he=a.nextPos,a.result;ge++,e=he,s.substr(he,4)===k?(r=k,he+=4):(r=i,0===ge&&Se(kt));r!==i&&(r={type:t.literal,value:null});e=r,ge--,e===i&&(r=i,0===ge&&Se(_t));return ve[n]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r;const n=40*he+28,a=ve[n];if(a)return he=a.nextPos,a.result;ge++,e=he,s.substr(he,9)===M?(r=M,he+=9):(r=i,0===ge&&Se(Rt));r!==i&&(r={type:t.literal,value:void 0});e=r,ge--,e===i&&(r=i,0===ge&&Se(Mt));return ve[n]={nextPos:he,result:e},e}(),e===i&&(e=Ie(),e===i&&(e=function(){let e,r,n,a,l,o,u;const c=40*he+33,d=ve[c];if(d)return he=d.nextPos,d.result;ge++,e=he,91===s.charCodeAt(he)?(r=T,he++):(r=i,0===ge&&Se(xt));if(r!==i){for(Ve(),n=Oe(),n===i&&(n=null),Ve(),a=[],l=he,44===s.charCodeAt(he)?(o=O,he++):(o=i,0===ge&&Se(Tt)),o!==i?(Ve(),u=Oe(),u!==i?(Ve(),l=u):(he=l,l=i)):(he=l,l=i);l!==i;)a.push(l),l=he,44===s.charCodeAt(he)?(o=O,he++):(o=i,0===ge&&Se(Tt)),o!==i?(Ve(),u=Oe(),u!==i?(Ve(),l=u):(he=l,l=i)):(he=l,l=i);93===s.charCodeAt(he)?(l=C,he++):(l=i,0===ge&&Se(Et)),l!==i?e=function(e,s){const r=null===e?[]:[e,...s];return{type:t.array,value:r}}(n,a):(he=e,e=i)}else he=e,e=i;ge--,e===i&&(r=i,0===ge&&Se(Jt));return ve[c]={nextPos:he,result:e},e}(),e===i&&(e=function(){let e,r,n,a,l,o,u,c,d,h,p;const f=40*he+34,b=ve[f];if(b)return he=b.nextPos,b.result;ge++,e=he,123===s.charCodeAt(he)?(r=m,he++):(r=i,0===ge&&Se(ut));if(r!==i){for(Ve(),n=he,a=Ie(),a!==i?(l=Ve(),58===s.charCodeAt(he)?(o=g,he++):(o=i,0===ge&&Se(dt)),o!==i?(u=Ve(),c=Oe(),c!==i?n=[a,c]:(he=n,n=i)):(he=n,n=i)):(he=n,n=i),n===i&&(n=null),a=Ve(),l=[],o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(c=Ve(),d=Ie(),d!==i?(Ve(),58===s.charCodeAt(he)?(h=g,he++):(h=i,0===ge&&Se(dt)),h!==i?(Ve(),p=Oe(),p!==i?(Ve(),o=[d,p]):(he=o,o=i)):(he=o,o=i)):(he=o,o=i)):(he=o,o=i);o!==i;)l.push(o),o=he,44===s.charCodeAt(he)?(u=O,he++):(u=i,0===ge&&Se(Tt)),u!==i?(c=Ve(),d=Ie(),d!==i?(Ve(),58===s.charCodeAt(he)?(h=g,he++):(h=i,0===ge&&Se(dt)),h!==i?(Ve(),p=Oe(),p!==i?(Ve(),o=[d,p]):(he=o,o=i)):(he=o,o=i)):(he=o,o=i)):(he=o,o=i);125===s.charCodeAt(he)?(o=I,he++):(o=i,0===ge&&Se(Ut)),o!==i?(y=l,w=[],null!==(v=n)&&w.push(v),w.push.apply(w,y),e={type:t.dict,value:w}):(he=e,e=i)}else he=e,e=i;var v,y,w;ge--,e===i&&(r=i,0===ge&&Se(Xt));return ve[f]={nextPos:he,result:e},e}()))))));return ve[r]={nextPos:he,result:e},e}(),e===i&&(e=Be()))),ve[l]={nextPos:he,result:e},e)}function Ie(){let e,r,n,a,l;const o=40*he+30,u=ve[o];if(u)return he=u.nextPos,u.result;if(ge++,e=he,39===s.charCodeAt(he)?(r=N,he++):(r=i,0===ge&&Se(Ft)),r!==i){for(n=he,a=[],l=s.charAt(he),J.test(l)?he++:(l=i,0===ge&&Se($t));l!==i;)a.push(l),l=s.charAt(he),J.test(l)?he++:(l=i,0===ge&&Se($t));n=s.substring(n,he),39===s.charCodeAt(he)?(a=N,he++):(a=i,0===ge&&Se(Ft)),a!==i?e={type:t.literal,value:n}:(he=e,e=i)}else he=e,e=i;if(e===i){if(e=he,34===s.charCodeAt(he)?(r=D,he++):(r=i,0===ge&&Se(Bt)),r!==i){for(n=he,a=[],l=s.charAt(he),X.test(l)?he++:(l=i,0===ge&&Se(Ht));l!==i;)a.push(l),l=s.charAt(he),X.test(l)?he++:(l=i,0===ge&&Se(Ht));n=s.substring(n,he),34===s.charCodeAt(he)?(a=D,he++):(a=i,0===ge&&Se(Bt)),a!==i?e=function(e){return{type:t.literal,value:e}}(n):(he=e,e=i)}else he=e,e=i;if(e===i)if(e=he,96===s.charCodeAt(he)?(r=z,he++):(r=i,0===ge&&Se(jt)),r!==i){for(n=[],a=Fe(),a===i&&(a=$e());a!==i;)n.push(a),a=Fe(),a===i&&(a=$e());96===s.charCodeAt(he)?(a=z,he++):(a=i,0===ge&&Se(jt)),a!==i?e={type:t.tstring,parts:n}:(he=e,e=i)}else he=e,e=i}return ge--,e===i&&(r=i,0===ge&&Se(It)),ve[o]={nextPos:he,result:e},e}function Fe(){let t,e,r,n;const a=40*he+31,l=ve[a];return l?(he=l.nextPos,l.result):(ge++,t=he,123===s.charCodeAt(he)?(e=m,he++):(e=i,0===ge&&Se(ut)),e!==i?(Ve(),r=Oe(),r!==i?(Ve(),125===s.charCodeAt(he)?(n=I,he++):(n=i,0===ge&&Se(Ut)),n!==i?t=r:(he=t,t=i)):(he=t,t=i)):(he=t,t=i),ge--,t===i&&(e=i,0===ge&&Se(Vt)),ve[a]={nextPos:he,result:t},t)}function $e(){let e,r,n,a,l;const o=40*he+32,u=ve[o];if(u)return he=u.nextPos,u.result;if(ge++,e=he,r=[],n=he,a=[],l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt)),l!==i)for(;l!==i;)a.push(l),l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt));else a=i;if(n=a!==i?s.substring(n,he):a,n===i&&(n=he,92===s.charCodeAt(he)?(a=f,he++):(a=i,0===ge&&Se(lt)),a!==i?(s.length>he?(l=s.charAt(he),he++):(l=i,0===ge&&Se(ot)),l!==i?n=l:(he=n,n=i)):(he=n,n=i)),n!==i)for(;n!==i;){if(r.push(n),n=he,a=[],l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt)),l!==i)for(;l!==i;)a.push(l),l=s.charAt(he),Q.test(l)?he++:(l=i,0===ge&&Se(Gt));else a=i;n=a!==i?s.substring(n,he):a,n===i&&(n=he,92===s.charCodeAt(he)?(a=f,he++):(a=i,0===ge&&Se(lt)),a!==i?(s.length>he?(l=s.charAt(he),he++):(l=i,0===ge&&Se(ot)),l!==i?n=de(l):(he=n,n=i)):(he=n,n=i))}else r=i;return r!==i&&(r={type:t.literal,value:r.join("")}),e=r,e===i&&(e=he,123===s.charCodeAt(he)?(r=m,he++):(r=i,0===ge&&Se(ut)),r!==i&&(r={type:t.literal,value:r}),e=r),ge--,e===i&&(r=i,0===ge&&Se(Wt)),ve[o]={nextPos:he,result:e},e}function Be(){let e,r,n,a,l,o;const u=40*he+36,c=ve[u];if(c)return he=c.nextPos,c.result;if(ge++,e=he,r=he,n=he,a=s.charAt(he),Z.test(a)?he++:(a=i,0===ge&&Se(Kt)),a!==i){for(l=[],o=s.charAt(he),K.test(o)?he++:(o=i,0===ge&&Se(Yt));o!==i;)l.push(o),o=s.charAt(he),K.test(o)?he++:(o=i,0===ge&&Se(Yt));a=[a,l],n=a}else he=n,n=i;return r=n!==i?s.substring(r,he):n,r!==i&&(r={type:t.symbol,value:r}),e=r,ge--,e===i&&(r=i,0===ge&&Se(te)),ve[u]={nextPos:he,result:e},e}function He(){let t;const e=40*he+37,r=ve[e];return r?(he=r.nextPos,r.result):(s.substr(he,2)===$?(t=$,he+=2):(t=i,0===ge&&Se(ee)),t===i&&(s.substr(he,2)===B?(t=B,he+=2):(t=i,0===ge&&Se(se))),ve[e]={nextPos:he,result:t},t)}function je(){let t;const e=40*he+38,r=ve[e];return r?(he=r.nextPos,r.result):(s.substr(he,2)===H?(t=H,he+=2):(t=i,0===ge&&Se(re)),t===i&&(62===s.charCodeAt(he)?(t=j,he++):(t=i,0===ge&&Se(ie)),t===i&&(s.substr(he,2)===V?(t=V,he+=2):(t=i,0===ge&&Se(ne)),t===i&&(60===s.charCodeAt(he)?(t=U,he++):(t=i,0===ge&&Se(ae))))),ve[e]={nextPos:he,result:t},t)}function Ve(){let t,e;const r=40*he+39,n=ve[r];if(n)return he=n.nextPos,n.result;for(ge++,t=[],e=s.charAt(he),Y.test(e)?he++:(e=i,0===ge&&Se(le));e!==i;)t.push(e),e=s.charAt(he),Y.test(e)?he++:(e=i,0===ge&&Se(le));return ge--,ve[r]={nextPos:he,result:t},t}fe=l();const Ue=fe!==i&&he===s.length;function We(){throw fe!==i&&he<s.length&&Se({type:"end"}),t=be,r=me<s.length?function(t=he){const e=s.codePointAt(t);return void 0===e?"":String.fromCodePoint(e)}(me):null,n=me<s.length?Ae(me,me+1):Ae(me,me),new e(e.buildMessage(t,r),t,r,n);var t,r,n}return r.peg$library?{peg$result:fe,peg$currPos:he,peg$FAILED:i,peg$maxFailExpected:be,peg$maxFailPos:me,peg$success:Ue,peg$throw:Ue?void 0:We}:Ue?fe:void We()}class r{#t;#e;constructor(t,e){this.#t=t,this.#e=e}#s(t){if("self"===t)return this.#e[this.#e.length-1];for(let e=this.#e.length-1;e>=0;e--){const s=this.#e[e];if(null!=s&&("object"==typeof s||"function"==typeof s)&&t in s)return s[t]}}#r;#i(){return this.#r||(this.#r=new Proxy(this.#e,{get:(t,e)=>this.#s(e)})),this.#r}[t.and](t){return this.visit(t.lhs)&&this.visit(t.rhs)}[t.or](t){return this.visit(t.lhs)||this.visit(t.rhs)}[t.nullc](t){const e=this.visit(t.lhs);return null!=e?e:this.visit(t.rhs)}[t.not](t){return!this.visit(t.expr)}[t.eq](t){const e=this.visit(t.lhs)===this.visit(t.rhs);return"=="===t.op?e:!e}[t.cmp](t){const e=this.visit(t.lhs),s=this.visit(t.rhs);switch(t.op){case">":return e>s;case"<":return e<s;case">=":return e>=s;case"<=":return e<=s;default:throw new Error(`unknown cmp op ${t.op}`)}}[t.call](t){const e=t.value,s=null===e.module?this.#t:this.#t?.[e.module];if(!s)throw new Error(`Module "${e.module}" not found`);const r=s[e.value];if(!r)throw new Error(`Function "#${null===e.module?"":`${e.module}:`}${e.value}" not found`);const i=t.args.map(t=>this.visit(t));return r.apply(this.#i(),i)}[t.literal](t){return t.value}[t.tstring](t){let e="";const s=t.parts;for(let t=0,r=s.length;t<r;t++){const r=this.visit(s[t]);null!=r&&(e+=r)}return e}[t.symbol](t){return this.#s(t.value)}[t.dict](t){return Object.fromEntries(t.value.map(t=>[t[0].value,this.visit(t[1])]))}[t.array](t){return t.value.map(t=>this.visit(t))}[t.ter](t){return this.visit(t.cond)?this.visit(t.ifTrue):this.visit(t.ifFalse)}[t.elv](t){const e=this.visit(t.cond);return e||this.visit(t.ifFalse)}[t.access](e){let s,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 t.member:a=r[n.rhs];break;case t.subscript:a=r[this.visit(n.rhs)];break;case t.method:{if(!r)throw new Error(`Method missing "${e.rhs[i-1].rhs}"`);const t=n.args.map(t=>this.visit(t));a=r.apply(s,t);break}}s=r,r=a}return r}visit(t,...e){return this[t.type](t,...e)}visitRoot(e,s){return s?e.map(e=>{switch(e.type){case t.templated.tel:return{type:t.dom.t,value:e.value};case t.templated.tet:return{type:t.dom.t,value:this.visit(e.value)};case t.templated.teh:return{type:t.dom.h,value:this.visit(e.value)};case t.templated.ten:return{type:t.dom.n,value:this.visit(e.value)};default:throw new Error(`unknown node type ${e.type.toString()}`)}}):this.visit(e)}}class i{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static#n=new Map;static#a=1e3;static parse(t,e){const r=e?.toString()+t;if(!this.#n.has(r)){if(this.#n.size>=this.#a){const t=this.#n.keys().next().value;this.#n.delete(t)}this.#n.set(r,s(t,{startRule:e===i.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}return this.#n.get(r)}static evaluate(t,e,s,n){return new r(t,e).visitRoot(s,n===i.MODE_TEMPLATED)}static interpret(t,e,s,r){return i.evaluate(t,e,i.parse(s,r),r)}}class n{#t;#e;constructor(t,e){this.#t=t,this.#e=e}withModule(t,e){const s=t?{[t]:e}:e;return new n({...this.#t,...s},this.#e)}withOverlay(...t){return new n(this.#t,0===t.length?this.#e:[...this.#e,...t])}evaluate(t,e){return i.interpret(this.#t,this.#e,t,e)}evaluateExpression(t){return this.evaluate(t,i.MODE_EXPRESSION)}evaluateTemplated(t){return this.evaluate(t,i.MODE_TEMPLATED)}}class a{static fromHtml(...t){const e=document.createElement("template");return e.innerHTML=t.map(t=>t.trim()).join(""),document.adoptNode(e.content)}static toHtml(t){var e=document.createElement("template");return e.content.appendChild(t),e.innerHTML}static isBlank(t){return 0===t.childElementCount&&""===t.textContent.trim()}static from(...t){const e=new DocumentFragment;for(const s of t)e.appendChild(s);return e}static fromChildNodes(t){const e=new DocumentFragment;for(;t.firstChild;)e.appendChild(t.firstChild);return e}}class l{static id=0;static uid(t){return`${t}-${++l.id}`}static defaultValue(t,e,s){return t.hasAttribute(e)||t.setAttribute(e,s),t.getAttribute(e)}static forward(t,e,s){e.getAttributeNames().filter(e=>e.startsWith(t)).forEach(r=>{const i=r.substring(t.length);if("class"===i){const r=e.getAttribute(`${t}class`)?.split(/\s+/).filter(t=>t.length)??[];return void s.classList.add(...r)}s.setAttribute(i,e.getAttribute(r))})}static toggle(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}static flip(t,e){t.hasAttribute(e)?t.removeAttribute(e):t.setAttribute(e,"")}static set(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)}}class o{static from(t){const e=Array.from(t.children).filter(t=>t.matches("[slot]")).map(t=>{t.remove();const e=t.getAttribute("slot")||"unnamed";return t.removeAttribute("slot"),[e,o.slotFromNode(t)]}),s={};s.default=new DocumentFragment,s.default.append(...t.childNodes);for(const[t,r]of e)t in s||(s[t]=new DocumentFragment),s[t].append(r);return s}static slotFromNode(t){return t instanceof HTMLTemplateElement?document.adoptNode(t.content):t instanceof HTMLScriptElement&&""!==t.type&&"text/javascript"!==t.type?a.fromHtml(t.innerHTML):t}}class u{static isParsed(t){for(let e=t;e;e=e.parentNode)if(e.nextSibling)return!0;return!1}static waitParsed(t){return"complete"===t.ownerDocument.readyState||u.isParsed(t)?Promise.resolve(t):new Promise(e=>{const s=new AbortController,r=()=>{s.abort(),i.disconnect(),e(t)};t.ownerDocument.addEventListener("DOMContentLoaded",r,{signal:s.signal});const i=new MutationObserver(()=>{u.isParsed(t)&&r()}),n=t.parentNode;i.observe(n,{childList:!0})})}static queryChildren(t,e){for(const s of t.children)if(s.matches(e))return s;return null}static queryChildrenAll(t,e){const s=[];for(const r of t.children)r.matches(e)&&s.push(r);return s}}class c{#l=new Set;removed(t){return this.#l.has(t)}remove(t){t.replaceChildren?.(),Object.keys(t.dataset||{}).filter(t=>t.startsWith("tpl")).forEach(e=>{delete t.dataset[e]}),this.#l.add(t)}popData(t,e){const s=t.dataset[e];return delete t.dataset[e],s}prepend(t,e){t.parentNode.insertBefore(e,t)}append(t,e){t.parentNode.insertBefore(e,t.nextSibling)}replace(t,e){this.prepend(t,e),this.remove(t)}cleanup(){for(const t of this.#l)t.remove();this.#l.clear()}}class d{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplText","tplHtml","tplRemove","tplVerbatim"];static tplIf(t,e,s,r,n){i.interpret(r,n,e)||s.remove(t)}static tplWith(t,e,s,r,n){const a=i.interpret(r,n,e),l=s.popData(t,"tplVar"),o=new f(t,r,n).withOverlay(l?{[l]:a}:a).render();s.replace(t,o)}static tplEach(t,e,s,r,n){const a=s.popData(t,"tplVar"),l=new f(t,r,n),o=i.interpret(r,n,e);if(!o?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);for(const e of o)s.prepend(t,l.withOverlay(a?{[a]:e}:e).render());s.remove(t)}static tplWhen(t,e,s,r,n){i.interpret(r,n,e)||s.remove(t)}static tplVerbatim(t,e,s,r,i){const n=t.cloneNode(!0);s.replace(t,n)}static tplRemove(t,e,s,r,i){switch(e.toLowerCase()){case"tag":{const e=new DocumentFragment;for(;t.firstChild;)e.appendChild(t.firstChild);"tplVerbatim"in t.dataset?(s.popData(t,"tplVerbatim"),s.replace(t,e)):(s.append(t,e),s.remove(t));break}case"body":t.replaceChildren();break;case"all":s.remove(t)}}static tplText(t,e,s,r,n){const a=i.interpret(r,n,e),l=t.cloneNode();l.replaceChildren(null==a?"":a),s.replace(t,l)}static tplHtml(t,e,s,r,n){const a=i.interpret(r,n,e),l=t.cloneNode();l.innerHTML=null==a?"":a,s.replace(t,l)}static tplClassAppend(t,e,s,r,n){const a=i.interpret(r,n,e);if(!a)return;const l=(Array.isArray(a)?a:[a]).flatMap(t=>"string"==typeof t?t.split(" "):t).filter(Boolean);0!==l.length&&t.classList.add(...l)}static tplAttrAppend(t,e,s,r,n){const a=i.interpret(r,n,e);if(!a||0===a.length)return;(Array.isArray(a[0])?a:[a]).forEach(([e,s])=>{t.setAttribute(e,s)})}static textNode(e,s,r,n,l){for(const o of i.interpret(n,l,s,i.MODE_TEMPLATED))if(null!=o.value)switch(o.type){case t.dom.t:r.prepend(e,document.createTextNode(o.value));break;case t.dom.h:r.prepend(e,a.fromHtml(o.value));break;case t.dom.n:r.prepend(e,o.value)}r.remove(e)}}const h=new Map;function p(t){let e=h.get(t);return e||(h.size>=1e3&&h.delete(h.keys().next().value),e=t.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase(),h.set(t,e)),e}class f{static fromHtml(t,e,...s){return new f(a.fromHtml(t),e,s)}static fromSelector(t,e,...s){const r=document.querySelector(t);if(!(r instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");const i=document.adoptNode(r.content);return new f(i,e,s)}static fromTemplate(t,e,...s){const r=document.adoptNode(t.content);return new f(r,e,s)}static fromFragment(t,e,...s){return new f(t,e,s)}#o;#t;#e;constructor(t,e,s){this.#o=t,this.#t=e,this.#e=s}withContext({modules:t,data:e}){return new f(this.#o,t,e)}withContextFrom(t){return this.withContext(t.context())}withFragment(t){return new f(t,this.#t,this.#e)}withModule(t,e){const s=t?{[t]:e}:e;return new f(this.#o,{...this.#t,...s},this.#e)}withModules(t){return new f(this.#o,t,this.#e)}withData(t){return new f(this.#o,this.#t,t)}withOverlay(...t){return new f(this.#o,this.#t,0===t.length?this.#e:[...this.#e,...t])}evaluate(t,e,...s){return new n(this.#t,this.#e).withOverlay(...s).evaluate(t,e)}evaluator(){return new n(this.#t,this.#e)}render(){try{const t=new c,e=document.importNode(this.#o,!0),s=e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e:(()=>{const t=new DocumentFragment;return t.appendChild(e),t})(),r=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,f.#u);let n;for(;null!==(n=r.nextNode());){if(t.cleanup(),n.nodeType===Node.TEXT_NODE){try{d.textNode(n,n.nodeValue,t,this.#t,this.#e)}catch(t){throw new m("Error evaluating text node",n,t)}continue}const e=n;for(const s of d.ORDERED_COMMANDS){if(!(s in e.dataset))continue;const r=t.popData(e,s);try{d[s](e,r,t,this.#t,this.#e)}catch(t){throw new m(`Error evaluating command ${s}`,e,t)}if(t.removed(e))break}for(const s of Object.keys(e.dataset||{})){if(!s.startsWith("tpl"))continue;const r=p(s);try{const n=t.popData(e,s),a=i.interpret(this.#t,this.#e,n);if("boolean"==typeof a){l.toggle(e,r,a);continue}null!=a&&e.setAttribute(r,a)}catch(t){throw new m(`Error evaluating command ${s}`,e,t)}}}return t.cleanup(),s}catch(t){throw new m("Error rendering template",this.#o,t)}}renderTo(t){t.replaceChildren(this.render())}appendTo(t){t.appendChild(this.render())}renderToSelector(t){const e=document.querySelector(t);e&&this.renderTo(e)}appendToSelector(t){const e=document.querySelector(t);e&&this.appendTo(e)}static#u(t){if(t.nodeType===Node.TEXT_NODE)return t.nodeValue.includes("{{")&&t.nodeValue.includes("}}")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;for(const e of t.attributes)if(e.name.startsWith("data-tpl-"))return NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}}class m extends Error{constructor(t,e,s){super(`${t} in \`${m.stringify(e)}\``,{cause:s}),this.name="RenderError",this.node=e.cloneNode(!0)}static stringify(t){const e=document.createElement("template");return e.content.appendChild(m.#c(t.cloneNode(!0))),e.innerHTML}static#c(t){t.nodeType===Node.TEXT_NODE&&(t.nodeValue=t.nodeValue.trim());for(let e=0;e<t.childNodes.length;e++){const s=t.childNodes[e];s.nodeType===Node.TEXT_NODE?(s.nodeValue=s.nodeValue.trim(),0===s.nodeValue.length&&(t.removeChild(s),e--)):s.nodeType===Node.ELEMENT_NODE&&m.#c(s)}return t}}class b{#d=new Map;constructor(){document.addEventListener("DOMContentLoaded",async()=>{await this.settle(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1}))})}#h=new Map;enqueue(t){if(this.#d.has(t))return;const{promise:e,resolve:s}=Promise.withResolvers(),r=u.waitParsed(t).then(()=>t.upgrade()).finally(()=>{this.#d.delete(t),this.#h.delete(t),s()});this.#d.set(t,r),this.#h.set(t,e)}async settle(){for(;0!==this.#h.size;)await Promise.all(Array.from(this.#h.values()))}get entries(){return this.#d.entries()}}class g{#p={};#f=!1;#m={string:{unmarshal:(t,e,s)=>t,marshal:(t,e,s)=>null==t?null:String(t)},number:{unmarshal:(t,e,s)=>null===t?null:Number(t),marshal:(t,e,s)=>null==t?null:String(t)},presence:{unmarshal:(t,e,s)=>null!==t,marshal:(t,e,s)=>t?"":null},bool:{unmarshal:(t,e,s)=>"true"===t,marshal:(t,e,s)=>null==t?null:String(!0===t)},json:{unmarshal:(t,e,s)=>null===t?null:JSON.parse(t),marshal:(t,e,s)=>null==t?null:JSON.stringify(t)},csv:{unmarshal:(t,e,s)=>null===t?[]:t.split(",").map(t=>t.trim()).filter(t=>t),marshal:(t,e,s)=>null==t?null:t.join(",")},csvm:{unmarshal:(t,e,s)=>s.hasAttribute("multiple")?null===t?[]:t.split(",").map(t=>t.trim()).filter(t=>t):null===t||""===t?null:t,marshal:(t,e,s)=>s.hasAttribute("multiple")?null===t?null:t.join(","):null==t?null:String(t)}};#b={};#t;#g=[];#v=new b;defineElement(t,e){return this.#f?(this.#y(t,e),this):(this.#p[t]=e,this)}#y(t,e){const{observed:s,attributes:r,template:i,templates:n,slots:a,mappers:l}=e,o=(s??[]).map(t=>t.split(":")[0]),u=[...r??[],...s??[]].reduce((t,e)=>{const[s,r]=e.split(":"),i=r?.trim()??"string";if(!(i in this.#m)&&!(i in(l??{})))throw new Error(`unsupported attribute type: ${i}`);return t[s.trim()]=l?.[i]??this.#m[i],t},{}),c=Object.entries(Object.assign({},n,i?{default:i}:{})).map(([t,e])=>[t,f.fromHtml(e)]),d=Object.fromEntries(c);e.BITS={enqueue:t=>this.#v.enqueue(t),SLOTS:a,OBSERVED:o,ATTR_TO_MAPPER:u,TEMPLATES:d},customElements.define(t,e)}defineModule(t,e){const s=t?{[t]:e}:e;return this.#t={...this.#t,...s},this}defineModules(t){return this.#t=t,this}defineComponent(t,e){return this.#b[t]=e,this}defineData(...t){return this.#g=t,this}defineOverlay(...t){return this.#g=[...this.#g,...t],this}defineMapper(t,e){return this.#m[t]=e,this}plugin(t){return t.configure(this),this}configure(){for(const[t,e]of Object.entries(this.#p))this.#y(t,e),delete this.#p[t];return this.#f=!0,this}get upgrades(){return this.#v.entries}context(){return{modules:this.#t,data:this.#g}}evaluator(){return new n(this.#t,this.#g)}component(t){return this.#b[t]}}const v=new g;class y{static fromHtml(t){const{modules:e,data:s}=v.context();return f.fromHtml(t,e,...s)}static fromSelector(t){const{modules:e,data:s}=v.context();return f.fromSelector(t,e,...s)}static fromTemplate(t){const{modules:e,data:s}=v.context();return f.fromTemplate(t,e,...s)}static fromFragment(t){const{modules:e,data:s}=v.context();return f.fromFragment(t,e,...s)}}const w=async t=>{for(;;){const e=Array.from(v.upgrades).filter(([e])=>t(e)).map(([,t])=>t);if(0===e.length)return;await Promise.all(e)}};class x{static async waitFor(t){await w(e=>t.contains(e))}static async waitForChildren(t){await w(e=>t!==e&&t.contains(e))}}class E extends HTMLElement{static BITS={enqueue:t=>{},SLOTS:!1,OBSERVED:[],ATTR_TO_MAPPER:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}#w=!1;#x=0;#E(){return this.constructor.BITS}unmarshal(t,e){return this.#E().ATTR_TO_MAPPER[t].unmarshal(e,t,this)}marshal(t,e){return this.#E().ATTR_TO_MAPPER[t].marshal(e,t,this)}template(t){const{modules:e,data:s}=v.context();let r=this.#E().TEMPLATES[t??"default"].withData(s).withModules(e);for(const t of["l10n","config"]){const e=this.constructor[t];e&&(r=r.withOverlay({[t]:e}))}return r}connectedCallback(){this.#w||this.#E().enqueue(this)}attributeChangedCallback(t,e,s){this.#w&&e!==s&&(this.#x>0||(this[t]=this.unmarshal(t,s)))}async upgrade(){if(this.#w)return;this.#w=!0;const t=this.#E().SLOTS?o.from(this):void 0,e=Object.fromEntries(this.#E().OBSERVED.map(t=>[t,this.unmarshal(t,this.getAttribute(t))]));await this.render({slots:t,observed:e,disabled:this.hasAttribute("disabled")})}render(t){}reflect(t){++this.#x;try{t()}finally{--this.#x}}reflectTo(t,e){++this.#x;try{l.set(this,t,this.marshal(t,e))}finally{--this.#x}}}var A=Object.freeze({__proto__:null,Attributes:l,ExpressionEvaluator:n,Expressions:i,Fragments:a,LightSlots:o,Nodes:u,ParsedElement:E,Registry:g,RenderError:m,Rendering:x,Template:f,Templates:y,registry:v});class S extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new S(this.message,S.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:r,details:i})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:r,details:i}))}}class T{static encode(t,e){const s=e||T.URL_SAFE,r=t.byteLength,i=new Uint8Array(t);let n="";for(let t=0;t<r;t+=3){n+=s[i[t]>>2]+s[(3&i[t])<<4|i[t+1]>>4]+s[(15&i[t+1])<<2|i[t+2]>>6]+s[63&i[t+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(t,e){const s=e||T.URL_SAFE;let r=Math.floor(.75*t.length);for(let e=0;e!==t.length&&"="===t[t.length-e-1];++e)--r;const i=new Uint8Array(r);let n=0,a=0;for(;n<r;){const e=s.indexOf(t.charAt(a++)),l=s.indexOf(t.charAt(a++)),o=s.indexOf(t.charAt(a++)),u=s.indexOf(t.charAt(a++));if(i[n++]=e<<2|l>>4,n===r)break;if(i[n++]=(15&l)<<4|o>>2,n===r)break;i[n++]=(3&o)<<6|u}return i.buffer}}T.STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T.URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";class C{static decode(t){if(t.length%2!=0)throw new Error("invalid length");const e=t.length/2;return new Uint8Array(e).map((e,s)=>{const r=2*s,i=t.substring(r,r+2);return parseInt(i,16)})}static encode(t,e){return Array.from(t).map(t=>t.toString(16)).map(t=>e?t.toUpperCase():t).map(t=>t.padStart(2,"0")).join("")}}class q{#A;#S;constructor(t,e){this.#A=t,this.#S=e}get normalized(){return`${this.#A}/${this.#S}`}get type(){return this.#A}get subtype(){return this.#S}static parse(t){if(!t)return new q("unknown","unknown");const[e,s]=t.split(";"),[r,i]=e.trim().split("/");return new q(r.toLowerCase(),i?.toLowerCase())}}class O extends S{constructor(t,e,s,r){super(t,s,r),this.name="HttpClientError",this.status=e}dropping(t){return new O(this.message,this.status,S.dropProblemsContext(this.problems,t),this)}static of(t,e){return new O(e.message,0,[{type:t,context:null,reason:e.message,details:null}],e)}static async fromResponse(t){switch(q.parse(t.headers.get("Content-Type")).normalized){case"application/failures+json":{const e=await t.json(),s=`${t.status} ${t.statusText}: ${e.length} failures`;return new O(s,t.status,e)}case"application/problem+json":{const e=await t.json(),s=`${t.status} ${t.statusText}: ${e.title} ${e.detail}`;return new O(s,t.status,e.problems||[{type:"GENERIC_PROBLEM",context:null,reason:s,details:null}])}default:{const e=await t.text(),s=`${t.status} ${t.statusText}: ${e}`;return new O(s,t.status,[{type:"GENERIC_PROBLEM",context:null,reason:s,details:null}])}}}}class P{#T;#C;constructor(){this.#T=document.querySelector("meta[name='_csrf_header']")?.getAttribute("content"),this.#C=document.querySelector("meta[name='_csrf']")?.getAttribute("content")}async intercept(t,e,s){return this.#T&&this.#C&&e.headers.set(this.#T,this.#C),await s.proceed(t,e)}}class L{#q;constructor(t){this.#q=t}async intercept(t,e,s){const r=await s.proceed(t,e);return 401===r.status?(window.location.href=this.#q,new Promise(()=>{})):r}}class _{#O;constructor(){this.#O=[]}withCsrfToken(){return this.#O.push(new P),this}withRedirectOnUnauthorized(t){return this.#O.push(new L(t)),this}withInterceptors(...t){return this.#O.push(...t),this}build(){return new R(this.#O)}}class k{async intercept(t,e,s){return await fetch(t,e)}}class M{#O;#P;constructor(t,e){this.#O=t,this.#P=e}async proceed(t,e){const s=this.#O[this.#P];return await s.intercept(t,e,new M(this.#O,this.#P+1))}}class R{#O;static builder(){return new _}constructor(t){this.#O=t||[]}async exchange(t,e,s){const r=[...this.#O,...s||[],new k],i=new M(r,0),n=new URL(new Request(t).url);return await i.proceed(n,e??{})}request(t,e){return z.create(this,t,e)}get(t){return z.create(this,"GET",t)}head(t){return z.create(this,"HEAD",t)}post(t){return z.create(this,"POST",t)}put(t){return z.create(this,"PUT",t)}patch(t){return z.create(this,"PATCH",t)}delete(t){return z.create(this,"DELETE",t)}}const N=async(t,e)=>{try{return await t[e]()}catch(t){throw O.of("UNMARSHALING_PROBLEM",t)}},D=t=>null==t?[]:"string"==typeof t?new URLSearchParams(t):"function"==typeof t[Symbol.iterator]?t:Object.entries(t);class z{#L;#_;#k;#M;#R;#N;#D;#O;static create(t,e,s){const[r,i=""]=s.split("?");return new z(t,e,r,new URLSearchParams(i),new Headers,void 0,{},[])}constructor(t,e,s,r,i,n,a,l){this.#L=t,this.#_=e,this.#k=s,this.#M=r,this.#N=n,this.#R=i,this.#D=a,this.#O=l}headers(t){for(const[e,s]of D(t))null==s?this.#R.delete(e):this.#R.set(e,s);return this}header(t,e){return null==e?this.#R.delete(t):this.#R.set(t,e),this}params(t){for(const[e,s]of D(t))null==s?this.#M.delete(e):this.#M.set(e,s);return this}param(t,...e){if(this.#M.delete(t),0===e.length||null==e[0])return this;for(const s of e)this.#M.append(t,s);return this}body(t){return this.#N=t,this}json(t){return this.#R.set("Content-Type","application/json"),this.#N=JSON.stringify(t),this}multipart(t){const e=new FormData;return t(new I(e)),this.#N=e,this}options(t){for(const[e,s]of Object.entries(t))this.#D[e]=s;return this}option(t,e){return this.#D[t]=e,this}interceptors(t){for(const e of t)this.#O.push(e);return this}interceptor(t){return this.#O.push(t),this}async exchange(){const t=this.#M.size?`${this.#k}?${this.#M}`:this.#k,e={...this.#D,headers:this.#R,method:this.#_,body:this.#N};return await this.#L.exchange(t,e,this.#O)}async fetch(){const t=this.#M.size?`${this.#k}?${this.#M}`:this.#k,e={...this.#D,headers:this.#R,method:this.#_,body:this.#N};try{const s=await this.#L.exchange(t,e,this.#O);if(!s.ok)throw await O.fromResponse(s);return s}catch(t){if(t instanceof S)throw t;throw O.of("CONNECTION_PROBLEM",t)}}async fetchText(){const t=await this.fetch();return await N(t,"text")}async fetchJson(){const t=await this.fetch();return await N(t,"json")}async fetchBlob(){const t=await this.fetch();return await N(t,"blob")}async fetchArrayBuffer(){const t=await this.fetch();return await N(t,"arrayBuffer")}}class I{#z;constructor(t){this.#z=t}field(t,e){return this.#z.append(t,e),this}blob(t,e,s){return this.#z.append(t,e,s),this}blobs(t,e){for(const s of e)this.#z.append(t,s);return this}json(t,e,s){const r=new Blob([JSON.stringify(e)],{type:"application/json"});return this.#z.append(t,r,s),this}}var F=Object.freeze({__proto__:null,Base64:T,Failure:S,Hex:C,HttpClient:R,HttpClientError:O,MediaType:q});class $ extends Storage{static save(t,e){localStorage.setItem(t,JSON.stringify(e))}static load(t){const e=localStorage.getItem(t);if(null!==e)try{return JSON.parse(e)}catch{return void localStorage.removeItem(t)}}static remove(t){localStorage.removeItem(t)}static pop(t){const e=$.load(t);return $.remove(t),e}}class B extends Storage{static save(t,e){sessionStorage.setItem(t,JSON.stringify(e))}static load(t){const e=sessionStorage.getItem(t);if(null!==e)try{return JSON.parse(e)}catch{return void sessionStorage.removeItem(t)}}static remove(t){sessionStorage.removeItem(t)}static pop(t){const e=B.load(t);return B.remove(t),e}}class H{static save(t,e,s){$.save(t,{revision:e,data:s})}static load(t,e){const s=$.load(t);if(void 0!==s){if(s.revision===e)return s.data;$.remove(t)}}}class j{static save(t,e,s){B.save(t,{revision:e,data:s})}static load(t,e){const s=B.load(t);if(void 0!==s){if(s.revision===e)return s.data;B.remove(t)}}}class V{static async fireAsync(t,e,s){t.dispatchEvent(e);const r=e.async?.promises??[],i=s?.mode??"broadcast";if("pipeline"===i&&r.length>1)throw new Error(`[AsyncEvents] Event "${e.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${r.length} listeners were triggered on this element.`);if("delegate"===i&&1!==r.length)throw new Error(`[AsyncEvents] Event "${e.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(t,e,s,r){const i=async t=>{const e=t;e.async||(e.async={promises:[]});const{promise:r,resolve:i,reject:n}=Promise.withResolvers();e.async.promises.push(r);try{i(await s(e))}catch(t){n(t)}};return t.addEventListener(e,i,r),i}static asyncOff(t,e,s,r){t.removeEventListener(e,s,r)}static mixInto(...t){for(const e of t)Object.assign(e.prototype,{async fireAsync(t,e){return await V.fireAsync(this,t,e)},asyncOn(t,e,s){return V.asyncOn(this,t,e,s)},asyncOff(t,e,s){V.asyncOff(this,t,e,s)}})}}class U{static sleep(t){return new Promise(e=>setTimeout(e,t))}static DEBOUNCE_DEFAULT=0;static DEBOUNCE_IMMEDIATE=1;static debounce(t,e,s){const r=s??U.DEBOUNCE_DEFAULT;let i=null,n=[],a=0;const l=()=>{const s=performance.now()-a;t>s?i=setTimeout(l,t-s):(i=null,r!==U.DEBOUNCE_IMMEDIATE&&e(...n),null===i&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===i&&(i=setTimeout(l,t),r===U.DEBOUNCE_IMMEDIATE&&e(...n))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}static THROTTLE_DEFAULT=0;static THROTTLE_NO_LEADING=1;static THROTTLE_NO_TRAILING=2;static throttle(t,e,s){const r=s??U.THROTTLE_DEFAULT;let i=null,n=[],a=0;const l=()=>{a=r&U.THROTTLE_NO_LEADING?0:performance.now(),i=null,e(...n),null===i&&(n=[])};return[(...s)=>{const o=performance.now();!a&&r&U.THROTTLE_NO_LEADING&&(a=o);const u=0===a?0:t-(o-a);n=s,u<=0||u>t?(null!==i&&(clearTimeout(i),i=null),a=o,e(...n),null===i&&(n=[])):null!==i||r&U.THROTTLE_NO_TRAILING||(i=setTimeout(l,u))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}}class W{static flatten(t,e,s){return Object.keys(t).reduce((r,i)=>{const n=e.length?`${e}.${i}`:i;return s.has(n)||"object"!=typeof t[i]||null===t[i]?r[n]=t[i]:Object.assign(r,W.flatten(t[i],n,s)),r},{})}static providePath(t,e,s){const r=e.split(".").map(t=>/^[0-9]+$/.test(t)?+t:t);let i=t??{},n=null;for(let e=0;;++e){const a=r[e],l=r[e-1];if(Number.isInteger(a)&&!Array.isArray(i)&&(null!==n?n[l]=i=[]:t=i=[]),e===r.length-1)return i[a]=void 0!==s?s:a in i?i[a]:null,t;void 0===i[a]&&(i[a]={}),n=i,i=i[a]}}static extract(t){if("radio"===t.getAttribute("type")){if(!t.checked)return;return"boolean"===t.dataset.fulBindType?"true"===t.value:t.value}return"checkbox"===t.getAttribute("type")?t.checked:"boolean"===t.dataset.fulBindType?t.value?"true"===t.value:null:!("INPUT"!==t.tagName&&"SELECT"!==t.tagName&&"TEXTAREA"!==t.tagName||""!==t.value&&void 0!==t.value)?null:t.value}static extractFrom(t,e){let s={};for(const r of t.elements)!r.hasAttribute("name")||r.matches(":disabled")&&r!==e||(s=W.providePath(s,r.getAttribute("name"),W.extract(r)));return s}static mutate(t,e){"radio"!==t.getAttribute("type")?"checkbox"!==t.getAttribute("type")?t.value=e:t.checked=e:t.checked=null!=e&&t.getAttribute("value")===String(e)}static mutateIn(t,e){const s=Array.from(t.elements).map(t=>t.getAttribute("name")).filter(t=>t);for(const[r,i]of Object.entries(W.flatten(e,"",new Set(s))))for(const e of t.querySelectorAll(`[name='${CSS.escape(r)}']`))W.mutate(e,i)}static errors(t,e,s){const r=e.filter(t=>"FIELD_ERROR"===t.type||"INVALID_FORMAT"===t.type),i=e.filter(t=>"FIELD_ERROR"!==t.type&&"INVALID_FORMAT"!==t.type);t.querySelectorAll("[name]").forEach(t=>{t.setCustomValidity?.("")}),t.querySelectorAll("ful-errors").forEach(t=>{t.replaceChildren(),t.setAttribute("hidden","")}),r.forEach(e=>{const s=e.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let r=s.length;0!==r;--r){const i=s.slice(0,r).join("."),n=s.slice(r,s.length).join(".");t.querySelectorAll(`[name='${CSS.escape(i)}']`).forEach(t=>{t.setCustomValidity?.(e.reason,n)})}}),t.querySelectorAll("ful-errors").forEach(t=>{t.innerText=i.map(t=>t.reason).join("\n"),0!==i.length&&t.removeAttribute("hidden")}),0!==e.length&&s&&Array.from(t.querySelectorAll(":invalid")).sort((t,e)=>t.getBoundingClientRect().y-e.getBoundingClientRect().y)[0]?.focus()}}class G{#I;#F;#_;#$;#B;constructor(t,e,s,r,i){this.#I=t,this.#F=e,this.#_=s,this.#$=r,this.#B=i}prepare(t,e){return this.#$(t,e)}async submit(t,e){return await this.#I.request(this.#_,this.#F).json(t).fetch()}transform(t,e){return this.#B(t,e)}}class J{#$;#B;constructor(t,e){this.#$=t,this.#B=e}async prepare(t,e){return await this.#$(t,e)}async submit(t,e,s){return s}async transform(t,e){return await this.#B(t,e)}}class X{static create(t,e){const s=v.component("http-client"),r=t.hasAttribute("request-mapper")?v.component(t.getAttribute("request-mapper")):t=>t,i=t.hasAttribute("response-mapper")?v.component(t.getAttribute("response-mapper")):t=>t,n=t.getAttribute("action");if(!n)return new J(r,i);const a=t.getAttribute("method")??"POST";return new G(s,n,a,r,i)}}class Q extends E{form;render(){const t=document.createElement("form");this.form=t,t.setAttribute("novalidate",""),l.forward("form-",this,t),t.replaceChildren(...this.childNodes),t.addEventListener("submit",async t=>{t.preventDefault(),t.stopPropagation(),await this.submit(t.submitter??void 0)}),this.hasAttribute("clear-invalid-on-change")&&this.addEventListener("change",t=>{t.target.setCustomValidity?.("")}),this.replaceChildren(t)}async submit(t){let e,s;this.spinner(!0);try{const r=v.component(this.getAttribute("loader")??"loaders:form").create(this);e=W.extractFrom(this.form,t),s=await r.prepare(e,this);const i=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:t,values:e,request:s}});if(!this.dispatchEvent(i))return;this.errors=[];const n=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:i.detail.values,request:i.detail.request}});let a=await V.fireAsync(this,n,{mode:"pipeline"});s=n.detail.request,a=await r.submit(s,this,a);const l=await r.transform(a,this);this.dispatchEvent(new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,response:l}}))}catch(r){this.dispatchEvent(new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,exception:r}})),r instanceof S&&(this.errors=r.problems),console.warn("failed to submit form",this,"reason:",r)}finally{this.spinner(!1)}}reset(){this.form.reset()}#H=0;spinner(t){if(t){if(++this.#H,1!==this.#H)return}else if(this.#H=Math.max(0,this.#H-1),0!==this.#H)return;this.querySelectorAll("ful-spinner").forEach(e=>{e.hidden=!t}),this.querySelectorAll("input,button").forEach(e=>{const s=e;"submit"!==s.type&&"reset"!==s.type||(t?(s.dataset.wd=String(s.disabled),s.disabled=!0):(s.disabled="true"===s.dataset.wd,delete s.dataset.wd))})}set values(t){W.mutateIn(this.form,t)}get values(){return W.extractFrom(this.form)}set errors(t){W.errors(this.form,t,this.hasAttribute("scroll-on-error"))}}class Z extends E{static observed=["value","readonly:presence","required:presence","placeholder"];static slots=!0;static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <input data-tpl-if="type != \'textarea\'" class="form-control" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" class="form-control" placeholder=" " form=""></textarea>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';static formAssociated=!0;_input;_fieldError;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}_type(){return this.getAttribute("type")??"text"}_fragment(t,e){return this.template().withOverlay({type:t,slots:e}).render()}render({slots:t,observed:e,disabled:s,skipObservedSetup:r}){const i=this._type(),n=this._fragment(i,t);this._input=n.querySelector("input,textarea"),l.forward("input-",this,this._input),this._input.addEventListener("keydown",t=>{if("Enter"!==t.key||"textarea"===this._type())return;const e=this.internals.form;if(!e)return;const s=Array.from(e.querySelectorAll("button:not(:disabled), input:not(:disabled)")).find(t=>"submit"===t.type);e.requestSubmit(s)}),this._input.addEventListener("input",t=>{const e=this.getAttribute("mask");if(!e)return;const s=t=>t.replace(new RegExp(e,"g"),""),r=t.target.value,i=s(r);if(r===i)return;const n=t.target.selectionStart;if(t.target.value=i,null===n)return;const a=s(r.slice(0,n)).length;t.target.setSelectionRange(a,a)}),this._input.addEventListener("change",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))});const a=n.querySelector("label");if(a.addEventListener("click",()=>this.focus()),this._fieldError=n.querySelector("ful-field-error"),this._input.ariaDescribedByElements=[this._fieldError],this._input.ariaLabelledByElements=[a],this.replaceChildren(n),!r){const t=this;t.disabled=s,t.readonly=e.readonly,t.required=e.required,t.placeholder=e.placeholder,t.value=e.value}}get value(){const t=this.hasAttribute("uppercase"),e=this.hasAttribute("trim"),s=this._input.value,r=t?s.toUpperCase():s,i=e?r.trim():r;return""===i?null:i}set value(t){this._input.value=""===t?null:t}get readonly(){return this._input.readOnly}set readonly(t){this._input.readOnly=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get disabled(){return this.hasAttribute("disabled")}set disabled(t){l.toggle(this,"disabled",t),l.toggle(this._input,"disabled",t)}get required(){return"true"===this._input.getAttribute("aria-required")}set required(t){l.set(this._input,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}get placeholder(){const t=this._input.getAttribute("placeholder");return" "===t?null:t}set placeholder(t){l.set(this._input,"placeholder",t??" "),this.reflect(()=>{l.set(this,"placeholder",t)})}focus(t){this._input.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this._fieldError.innerText="");this.internals.setValidity({customError:!0}," "),this._fieldError.innerText=t}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}}class K extends E{render(){const t=this.textContent.trim();if(""===t)return void this.replaceChildren(this.getAttribute("default")??"");const e=this.getAttribute("locale")??Intl.DateTimeFormat().resolvedOptions().locale,s=new Intl.DateTimeFormat(e,{year:"numeric",month:"numeric",day:"numeric"}),[r,i,n]=t.split("-").map(Number);this.replaceChildren(s.format(new Date(r,i-1,n)))}}class Y extends E{render(){const t=this.textContent.trim();if(""===t)return void this.replaceChildren(this.getAttribute("default")??"");const e=this.getAttribute("locale")??Intl.DateTimeFormat().resolvedOptions().locale,s=new Intl.DateTimeFormat(e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1});this.replaceChildren(s.format(new Date(Y.isoToLocal(t))))}static isoToLocal(t){const e=new Date(t),s=(t,e)=>String(e).padStart(t,"0");return`${`${e.getFullYear()}-${s(2,e.getMonth()+1)}-${s(2,e.getDate())}`}T${`${s(2,e.getHours())}:${s(2,e.getMinutes())}:${s(2,e.getSeconds())}.${s(3,e.getMilliseconds())}`}`}}class tt extends Z{static observed=["value","readonly:presence","required:presence","placeholder","min","max","step"];_type(){return"date"}render(t){const{observed:e}=t;super.render(t),this.step=e.step,this.min=e.min,this.max=e.max}get min(){const t=this._input.min;return""===t?null:t}set min(t){this._input.min=tt.#j(t)}get max(){const t=this._input.max;return""===t?null:t}set max(t){this._input.max=tt.#j(t)}get step(){const t=this._input.step;return""===t?null:t}set step(t){this._input.step=t??""}static#j(t){if(!t)return"";const e=t=>new Date(t.getTime()-6e4*t.getTimezoneOffset()).toISOString().split("T")[0];if("now"===t)return e(new Date);const s=/^([+-])(\d+)([dmy])$/.exec(t);if(!s)return t;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 t=n.getDate();n.setMonth(n.getMonth()+i*r),n.getDate()!==t&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+i*r)}return e(n)}}class et extends tt{_type(){return"time"}get min(){const t=this._input.min;return""===t?null:t}set min(t){this._input.min=this.#V(t)}get max(){const t=this._input.max;return""===t?null:t}set max(t){this._input.max=this.#V(t)}#V(t){if(!t)return"";const e=new Date;if("now"!==t){const s=/^([+-])(\d+)([hm])$/.exec(t);if(!s)return t;const r="-"===s[1]?-1:1,i=+s[2]*r;"h"===s[3]?e.setHours(e.getHours()+i):e.setMinutes(e.getMinutes()+i)}return et.#U(e,Number(this._input.step)||60)}static#U(t,e){const s=t=>String(t).padStart(2,"0"),r=3600*t.getHours()+60*t.getMinutes()+t.getSeconds(),i=Math.floor(r/e)*e,n=s(Math.floor(i/3600)),a=s(Math.floor(i%3600/60));return e%60==0?`${n}:${a}`:`${n}:${a}:${s(i%60)}`}}class st extends Z{static observed=["value","readonly:presence","required:presence","placeholder","min","max","step"];_type(){return"datetime-local"}render(t){const{observed:e}=t;super.render(t),this.min=e.min,this.max=e.max,this.step=e.step}get value(){const t=this._input.value;return""===t?null:new Date(t).toISOString()}set value(t){this._input.value=t?Y.isoToLocal(t):""}get min(){const t=this._input.min;return""===t?null:new Date(t).toISOString()}set min(t){this._input.min=t?Y.isoToLocal(t):""}get max(){const t=this._input.max;return""===t?null:new Date(t).toISOString()}set max(t){this._input.max=t?Y.isoToLocal(t):""}get step(){const t=this._input.step;return""===t?null:t}set step(t){this._input.step=t??""}}class rt extends Z{static l10n={en:{dropzonelabel:"Click or drop your files here",unacceptablefiletype:"Only files of type {0} are supported",maxfilesizeexceeded:"Maximum supported file size is {0}",maxtotalsizeexceeded:"Maximum supported total file size is {0}",maxfilesexceeded:"Maximum files count exceeded"},it:{dropzonelabel:"Clicca o trascina i file qui",unacceptablefiletype:"Solo i file di tipo {0} sono supportati",maxfilesizeexceeded:"La dimensione massima di un file è di {0}",maxtotalsizeexceeded:"La dimensione massima complessiva dei file è di {0}",maxfilesexceeded:"Numero massimo di file superato"},es:{dropzonelabel:"Haz clic o arrastra tus archivos aquí",unacceptablefiletype:"Solo se admiten archivos de tipo {0}",maxfilesizeexceeded:"El tamaño máximo de archivo admitido es {0}",maxtotalsizeexceeded:"El tamaño total máximo admitido es {0}",maxfilesexceeded:"Se ha superado el número máximo de archivos"},fr:{dropzonelabel:"Cliquez ou déposez vos fichiers ici",unacceptablefiletype:"Seuls les fichiers de type {0} sont pris en charge",maxfilesizeexceeded:"La taille maximale de fichier prise en charge est {0}",maxtotalsizeexceeded:"La taille totale maximale prise en charge est {0}",maxfilesexceeded:"Nombre maximal de fichiers dépassé"}};static observed=["value","readonly:presence","required:presence","placeholder","accept:csv","multiple:presence","itemlist:presence","dropzone:presence","maxfiles:number","maxfilesize:number","maxtotalsize:number"];#W;#G;#J;#X;_type(){return"file"}static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <input class="form-control" data-tpl-type="type" placeholder=" " form="">\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\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(\'dropzonelabel\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings></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>{{ file.name }}</div>\n <div>{{ #bytes:format(file.size) }}</div>\n <button type="button" class="btn btn-sm btn-outline-danger bi bi-x-lg" alt="Rimuovi"></button>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};render(t){const{observed:e}=t;super.render({...t,skipObservedSetup:!0}),this.#G=this.querySelector("ful-item-list"),this.#J=this.querySelector("[data-ref=dropzone]"),this.#X=this.querySelector("ful-field-warnings"),this.accept=e.accept,this.multiple=e.multiple,this.itemlist=e.itemlist,this.dropzone=e.dropzone,this.maxfiles=e.maxfiles,this.maxfilesize=e.maxfilesize,this.maxtotalsize=e.maxtotalsize,this.disabled=t.disabled,this.readonly=e.readonly,this.required=e.required,this.placeholder=e.placeholder,this.value=e.value,this.#X.addEventListener("animationend",t=>{t.target.remove()}),this.#G.addEventListener("click",t=>{if(!t.target.closest("button"))return;const e=[...this.#G.children].indexOf(t.target.closest("ful-item"));if(-1===e)return;const s=new DataTransfer;[...this.files].filter((t,s)=>s!==e).forEach(t=>{s.items.add(t)}),this.files=s.files}),this.#J.addEventListener("click",t=>{this.querySelector("input")?.click()}),this.#J.addEventListener("dragover",t=>{t.preventDefault()}),this.#J.addEventListener("drop",t=>{t.preventDefault();const e=[...t.dataTransfer.items].filter(t=>"file"===t.kind);if(0===e.length)return;const s=new DataTransfer;e.forEach(t=>{s.items.add(t.getAsFile())}),this.files=s.files}),this._input.addEventListener("change",t=>{this.#Q()})}#Z(t){return t>1048576?Math.round(t/1024/1024*100)/100+"MiB":t>1024?Math.round(t/1024*100)/100+"KiB":`${t}B`}#Q(){this.setCustomValidity(),this.#X.replaceChildren(),this.#K(),this.#Y(),this.#tt(),this.#et(),this.template("items").withOverlay({files:this.files}).withModule("bytes",{format:this.#Z}).renderTo(this.#G)}warning(t,e){this.template("warning").withOverlay({key:t,args:e}).appendTo(this.#X)}#K(){if(!this.#W.length)return;const t=[...this.files].filter(t=>!this.#W.some(e=>t.name.toLowerCase().endsWith(e.toLowerCase())));if(0===t.length)return;this.warning("unacceptablefiletype",this.#W.join(", "));const e=new DataTransfer;[...this.files].filter(e=>!t.includes(e)).forEach(t=>{e.items.add(t)}),this._input.files=e.files}#et(){null!==this.#st&&(this.files.length<=this.#st||(this.warning("maxfilesexceeded"),this._input.files=(new DataTransfer).files))}#Y(){if(null===this.#rt)return;const t=[...this.files].filter(t=>t.size>this.#rt);if(0===t.length)return;this.warning("maxfilesizeexceeded",this.#Z(this.#rt));const e=new DataTransfer;[...this.files].filter(e=>!t.includes(e)).forEach(t=>{e.items.add(t)}),this._input.files=e.files}#tt(){if(null===this.#it)return;[...this.files].reduce((t,e)=>t+e.size,0)<=this.#it||(this.warning("maxtotalsizeexceeded",this.#Z(this.#it)),this._input.files=(new DataTransfer).files)}get accept(){return this.#W}set accept(t){this._input.accept=t.join(","),this.#W=t,this.reflect(()=>{this.setAttribute("accept",this._input.accept)})}get multiple(){return this._input.multiple}set multiple(t){this._input.multiple=t,this.reflect(()=>{l.toggle(this,"multiple",t)})}get files(){return this._input.files}set files(t){this._input.files=t,this.#Q()}get file(){return this.files[0]??null}set file(t){const e=new DataTransfer;t&&e.items.add(t),this.files=e.files}get value(){const t=Array.from(this._input.files).map(t=>t.name);return this.multiple?t:t[0]??null}set value(t){t||(this.files=(new DataTransfer).files)}get totalsize(){return Array.from(this.files).reduce((t,e)=>t+e.size,0)}#st;get maxfiles(){return this.#st}set maxfiles(t){this.#st=t,this.reflect(()=>{l.set(this,"maxfiles",t)})}#rt;get maxfilesize(){return this.#rt}set maxfilesize(t){this.#rt=t,this.reflect(()=>{l.set(this,"maxfilesize",t)})}#it;get maxtotalsize(){return this.#it}set maxtotalsize(t){this.#it=t,this.reflect(()=>{l.set(this,"maxtotalsize",t)})}#nt;get itemlist(){return this.#nt}set itemlist(t){this.#nt=t,this.reflect(()=>{l.toggle(this,"itemlist",t)})}#at;get dropzone(){return this.#at}set dropzone(t){this.#at=t,this.reflect(()=>{l.toggle(this,"dropzone",t)})}}class it{#I;#F;#_;#B;#lt;#ot;#g;constructor({http:t,url:e,method:s,responseMapper:r,prefetch:i,revision:n}){this.#I=t,this.#F=e,this.#_=s,this.#B=r,this.#lt=i,this.#ot=n,this.#g=null}async prefetch(){this.#lt&&await this.#ut()}async exact(...t){return await this.#ut(),this.#g.filter(([e,s])=>t.some(t=>t==e))}async load(t){return await this.#ut(),this.#g.filter(([e,s])=>(s??"").toLowerCase().includes(t?.toLowerCase()))}async reconfigureUrl(t){this.#g=null,this.#F=t}async#ut(){if(null!==this.#g)return;const t=await it.#ct(this.#I,this.#_,this.#F,this.#ot);this.#g=this.#B(t)}static async#ct(t,e,s,r){const i=`${e}@${s}`;if(null!==r){const t=H.load(i,r);if(void 0!==t)return t}const n=await t.request(e,s).fetchJson();return null!==r&&H.save(i,r,n),n}}class nt{#I;#F;#_;#B;constructor({http:t,url:e,method:s,responseMapper:r}){this.#I=t,this.#F=e,this.#_=s,this.#B=r}async exact(...t){const e=await this.#I.request(this.#_,this.#F).param("k",...t).fetchJson();return this.#B(e)}async load(t){const e=await this.#I.request(this.#_,this.#F).param("s",t).fetchJson();return this.#B(e)}}class at{#g;constructor(t){this.#g=t}update(t){this.#g=t}exact(...t){return this.#g.filter(([e,s])=>t.some(t=>t==e))}load(t){return this.#g.filter(([e,s])=>(s??"").toLowerCase().includes(t?.toLowerCase()))}}class lt{static create(t,e){if(!t.hasAttribute("src")){const t=Array.from(e.options?.querySelectorAll("option")??[]).map(t=>[t.getAttribute("value")??t.innerText.trim(),t.innerText.trim()]);return new at(t)}const s=v.component("http-client"),r=lt.#dt(t);return"chunked"===t.getAttribute("mode")?new nt({http:s,url:t.getAttribute("src"),method:t.getAttribute("method")??"POST",responseMapper:r}):new it({http:s,url:t.getAttribute("src"),method:t.getAttribute("method")??"POST",responseMapper:r,prefetch:t.hasAttribute("preload"),revision:t.getAttribute("revision")})}static#dt(t){return t.hasAttribute("k-expr")&&t.hasAttribute("l-expr")?e=>v.evaluator().withOverlay(e).evaluateExpression(t.getAttribute("d-expr")??"self").map(e=>{const s=v.evaluator().withOverlay(e);return[s.evaluateExpression(t.getAttribute("k-expr")),s.evaluateExpression(t.getAttribute("l-expr")),s.evaluateExpression(t.getAttribute("m-expr")??"self")]}):t.hasAttribute("response-mapper")?v.component(t.getAttribute("response-mapper")):t=>t}}class ot extends E{static slots=!0;static template='\n <ful-spinner class="centered" hidden></ful-spinner>\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" data-tpl-aria-selected="index == 0 ? \'true\' : \'false\'">\n {{ label }}\n </li>\n '};#ht;#pt;#ft;#D=new Map;render({slots:t}){const e=this.template().render();this.#ft=a.isBlank(t.default)?this.template("options"):y.fromFragment(t.default),this.#ht=e.querySelector("ful-spinner"),this.#pt=e.querySelector("menu"),this.#pt.addEventListener("click",t=>{t.stopPropagation();const e=t.target.closest("li");e?this.#mt(e):this.hide()}),this.replaceChildren(e)}#bt(){return this.#pt?.querySelector("[selected]")??this.#pt?.firstElementChild??null}acceptSelection(){const t=this.#bt();t&&this.#mt(t)}update(t){if(void 0===t)throw new Error("null data");this.#D=new Map(t.map((t,e)=>[String(e),t]));const e=t.map(([t,e,s],r)=>({index:r,key:t,label:e,metadata:s}));this.#ft.withOverlay(e).renderTo(this.#pt)}#mt(t){const e=t.getAttribute("value"),s=this.#D.get(e);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:e,data:s}}))}hide(){this.setAttribute("hidden","")}get shown(){return!this.hasAttribute("hidden")}async show(t){this.removeAttribute("hidden"),this.#pt.setAttribute("hidden",""),this.#ht.removeAttribute("hidden");try{const e=await t();this.update(e)}catch(t){throw this.hide(),t}finally{this.#ht.setAttribute("hidden",""),this.#pt.removeAttribute("hidden")}}async moveOrShow(t,e){if(this.shown){const e=this.#bt(),s=e?.[(t?"next":"previous")+"ElementSibling"];return void(e&&s&&(e.removeAttribute("selected"),s.setAttribute("selected",""),s.scrollIntoView({block:"nearest",behavior:"smooth"})))}await this.show(e)}}class ut extends E{static observed=["value:csvm","readonly:presence","required:presence","itemlist:presence"];static slots=!0;static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group flex-nowrap" tabindex="-1">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <div class="ful-select-input-container">\n <div class="ful-select-input">\n <badges></badges>\n <input type="text" form="" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </div>\n <ful-dropdown hidden popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </div>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\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[0]">\n <div>{{ entry[1][0] }}</div>\n <button type="button" class="btn btn-sm btn-outline-danger bi bi-x-lg"></button>\n </ful-item>\n '};static formAssociated=!0;internals;#gt;#vt;#yt;#wt;#G;#xt;#Et;#At=new Map;#St=0;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}async render({slots:t,observed:e,disabled:s}){const r=this.getAttribute("name");this.#gt=v.component(this.getAttribute("loader")??"loaders:select").create(this,{options:t.options}),this.#xt=this.hasAttribute("multiple");try{await(this.#gt.prefetch?.())}catch(t){console.warn("failed to prefetch select options",this,"reason:",t)}const i=this.template().withOverlay({slots:t,name:r}).render();this.#wt=i.querySelector("input"),this.#G=i.querySelector("ful-item-list"),l.forward("input-",this,this.#wt),this.#vt=i.querySelector("badges"),this.value=e.value,this.disabled=s,this.readonly=e.readonly,this.required=e.required,this.itemlist=e.itemlist,this.#yt=i.querySelector("ful-dropdown");const n=i.querySelector("label");n.addEventListener("click",()=>this.focus()),this.#Et=i.querySelector("ful-field-error"),this.#wt.ariaDescribedByElements=[this.#Et],this.#wt.ariaLabelledByElements=[n];const[a,o]=U.throttle(400,()=>{this.#wt.setAttribute("aria-expanded","true"),this.#yt.show(()=>this.#gt.load(this.#wt.value))});this.addEventListener("click",t=>{if(!t.target.matches("input")&&!this.matches(":disabled")&&!this.readonly){if(this.#yt.shown)return this.#wt.setAttribute("aria-expanded","false"),void this.#yt.hide();this.#wt.focus(),a()}}),this.#G.addEventListener("click",t=>{if(t.stopPropagation(),!t.target.closest("button"))return;if(this.matches(":disabled")||this.readonly)return;const e=[...this.#G.children].indexOf(t.target.closest("ful-item"));-1!==e&&(this.#At.delete(Array.from(this.#At.keys())[e]),this.#Tt(),this.#Ct())}),this.#vt.addEventListener("click",t=>{if(t.stopPropagation(),this.matches(":disabled")||this.readonly)return;const e=[...this.#vt.children].indexOf(t.target);-1!==e&&(this.#At.delete(Array.from(this.#At.keys())[e]),this.#Tt(),this.#Ct())}),this.#wt.addEventListener("change",t=>{t.stopPropagation()}),this.#wt.addEventListener("blur",t=>{t.stopPropagation(),t.relatedTarget&&this.contains(t.relatedTarget)||(o(),this.#wt.setAttribute("aria-expanded","false"),this.#yt.hide(),this.#wt.value="")}),this.#wt.addEventListener("keydown",t=>{if(!this.matches(":disabled")&&!this.readonly)switch(t.code){case"ArrowUp":t.preventDefault(),this.#wt.setAttribute("aria-expanded","true"),this.#yt.moveOrShow(!1,()=>this.#gt.load(this.#wt.value));break;case"ArrowDown":t.preventDefault(),this.#wt.setAttribute("aria-expanded","true"),this.#yt.moveOrShow(!0,()=>this.#gt.load(this.#wt.value));break;case"Escape":this.#wt.setAttribute("aria-expanded","false"),this.#yt.hide();break;case"Enter":if(!this.#yt.shown)return void this.#qt();t.preventDefault(),this.#wt.setAttribute("aria-expanded","false"),this.#yt.acceptSelection(),this.#wt.value="";break;case"Backspace":this.#At.size&&0===this.#wt.selectionStart&&0===this.#wt.selectionEnd&&(this.#At.delete(Array.from(this.#At.keys()).pop()),this.#Tt(),this.#Ct());break;case"Tab":this.#wt.setAttribute("aria-expanded","false"),this.#yt.hide(),o()}}),this.#wt.addEventListener("input",t=>{t.stopPropagation(),this.matches(":disabled")||this.readonly||a()}),this.#yt.addEventListener("change",t=>{t.stopPropagation(),this.#xt||this.#At.clear(),this.#At.set(this.#Ot(t.detail.data[0]),t.detail.data.slice(1)),this.#Tt(),this.#Ct(),this.#wt.focus(),this.#wt.setAttribute("aria-expanded","false"),this.#yt.hide(),this.#wt.value=""}),this.replaceChildren(i)}async withLoader(t){return await t(this.#gt)}#qt(){const t=this.internals.form;if(!t)return;const e=Array.from(t.querySelectorAll("button:not(:disabled), input:not(:disabled)"));t.requestSubmit(e.find(t=>"submit"===t.type))}#Tt(){const t=[...this.#At.entries()].map(t=>({key:t[0],label:t[1][0],metadata:t[1].slice(1)})),e=this.#xt?t:t[0]??null;this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:e}}))}#Ct(){const t=Array.from(this.#At.entries()).map(([t,e])=>{const s=document.createElement("badge");return s.setAttribute("role","button"),s.setAttribute("value",t),s.innerText=e[0],s});this.#vt.replaceChildren(),this.#vt.append(...t),this.#G.replaceChildren(),this.template("items").withOverlay({entries:this.#At.entries()}).renderTo(this.#G)}#Ot(t){switch(this.getAttribute("k-type")){case"number":{const e=""===t?Number.NaN:Number(t);return Number.isNaN(e)?t:e}case"boolean":return!0===t||"true"===t||!1!==t&&"false"!==t&&t;default:return String(t)}}set value(t){const e=(null==t?[]:Array.isArray(t)?t:[t]).map(t=>this.#Ot(t));this.#At=new Map(e.map(t=>[t,[t]])),this.#Ct();const s=++this.#St;0!==e.length&&this.#s(e,s)}async#s(t,e){const s=await this.#gt.exact(...t);if(e!==this.#St)return;const r=new Map(s.map(t=>[this.#Ot(t[0]),t.slice(1)]));for(const e of t)this.#At.has(e)&&(r.has(e)?this.#At.set(e,r.get(e)):this.#At.delete(e));this.#Ct()}get value(){return this.#xt?[...this.#At.keys()]:[...this.#At.keys()][0]??null}get entry(){return this.#xt?[...this.#At.entries()]:[...this.#At.entries()][0]??null}get disabled(){return this.hasAttribute("disabled")}set disabled(t){l.toggle(this,"disabled",t),l.toggle(this.#wt,"disabled",t)}get readonly(){return this.#wt.readOnly}set readonly(t){this.#wt.readOnly=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get required(){return"true"===this.#wt.getAttribute("aria-required")}set required(t){l.set(this.#wt,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}#nt;get itemlist(){return this.#nt}set itemlist(t){this.#nt=t,this.reflect(()=>{l.toggle(this,"itemlist",t)})}focus(t){this.#wt.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this.#Et.innerText="");this.internals.setValidity({customError:!0}," "),this.#Et.innerText=t}}class ct extends E{static observed=["value","readonly:presence","required:presence"];static slots=!0;static template='\n <fieldset>\n <legend class="form-label">\n {{{{ slots.default }}}}\n </legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <section>\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 </section>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';static formAssociated=!0;#Pt;#Et;#Lt;#_t;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="radiogroup"}render({slots:t,observed:e,disabled:s}){const r=this.getAttribute("name")??l.uid("ful-radiogroup"),i=Array.from(t.default.querySelectorAll("ful-radio")),n=i.map(t=>{const e=document.createElement("input");e.setAttribute("type","radio"),l.forward("input-",this,e),l.forward("",t,e),e.setAttribute("name",`${r}-ignore`),e.setAttribute("form",""),e.addEventListener("change",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))});return[e,a.fromChildNodes(t)]});i.forEach(t=>{t.remove()}),this.template().withOverlay({name:r,slots:t,inputsAndLabels:n}).renderTo(this),this.#Pt=this.firstElementChild,this.disabled=s,this.readonly=e.readonly,this.required=e.required,this.value=e.value,this.#Et=this.querySelector("ful-field-error"),this.ariaDescribedByElements=[this.#Et],this.#Lt=this.querySelector("input[type=radio]"),this.#_t="boolean"===this.getAttribute("type")}get value(){const t=this.querySelector("input[type=radio]:checked");return t?this.#_t?"true"===t.value:t.value:null}set value(t){if(null===t)return void this.querySelectorAll("input[type=radio]").forEach(t=>{t.checked=!1});const e=this.querySelector(`input[type=radio][value=${CSS.escape(String(t))}]`);e&&(e.checked=!0)}get readonly(){return this.#Pt.inert}set readonly(t){this.#Pt.inert=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get disabled(){return this.hasAttribute("disabled")}set disabled(t){l.toggle(this,"disabled",t),this.#Pt.disabled=t}get required(){return"true"===this.#Pt.getAttribute("aria-required")}set required(t){l.set(this.#Pt,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}focus(t){this.#Lt.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this.#Et.innerText="");this.internals.setValidity({customError:!0}," "),this.#Et.innerText=t}}class dt extends E{static observed=["value:bool","readonly:presence","required:presence"];static slots=!0;static template='\n <div data-tpl-class="klass">\n <div class="input-container">\n <input class="form-check-input" type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="" placeholder=" ">\n </div>\n <div class="form-check-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n </div>\n <ful-field-error></ful-field-error>\n ';#kt;#wt;#Et;static formAssociated=!0;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}render({slots:t,observed:e,disabled:s}){const r="switch"===this.getAttribute("type"),i=r?"form-check form-switch":"form-check",n=this.template().withOverlay({slots:t,klass:i,isSwitch:r}).render();this.#kt=n.firstElementChild,this.#wt=n.querySelector("input"),l.forward("input-",this,this.#wt),this.disabled=s,this.readonly=e.readonly,this.required=e.required,this.value=e.value,this.#wt.addEventListener("change",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))});const a=n.querySelector("label");a.addEventListener("click",()=>{this.focus(),this.matches(":disabled")||this.readonly||(this.value=!this.value,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}})))}),this.#Et=n.querySelector("ful-field-error"),this.#wt.ariaDescribedByElements=[this.#Et],this.#wt.ariaLabelledByElements=[a],this.replaceChildren(n)}get value(){return this.#wt.checked}set value(t){this.#wt.checked=t}get readonly(){return this.#kt.inert}set readonly(t){this.#kt.inert=t,this.reflect(()=>{l.toggle(this,"readonly",t)})}get disabled(){return this.hasAttribute("disabled")}set disabled(t){l.toggle(this,"disabled",t),l.toggle(this.#wt,"disabled",t)}get required(){return"true"===this.#wt.getAttribute("aria-required")}set required(t){l.set(this.#wt,"aria-required",t?"true":null),this.reflect(()=>{l.toggle(this,"required",t)})}focus(t){this.#wt.focus(t)}setCustomValidity(t){if(!t)return this.internals.setValidity({}),void(this.#Et.innerText="");this.internals.setValidity({customError:!0}," "),this.#Et.innerText=t}}class ht extends E{static slots=!0;static template='\n <div class="ful-spinner-wrapper" role="status">\n <div class="ful-spinner-text">{{{{ slots.default }}}}</div>\n <div class="ful-spinner-icon"></div>\n </div>\n ';render({slots:t}){this.template().withOverlay({slots:t}).renderTo(this)}}class pt extends E{static observed=["order"];#Mt;render({observed:t}){const e=this.getAttribute("sorter"),s=["asc","desc",null];this.order=t.order,this.addEventListener("click",()=>{const t=s[(s.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort-requested",{bubbles:!0,cancelable:!0,detail:{value:{sorter:e,order:t}}}))})}get order(){return this.#Mt||null}set order(t){this.#Mt=t||null,this.reflect(()=>{this.#Mt?this.setAttribute("order",t):this.removeAttribute("order")})}}class ft extends E{static observed=["total:number","current:number"];static l10n={en:{showing:"Page {0} of {1}",navigation:"Page navigation",previous:"Previous",next:"Next"},it:{showing:"Pagina {0} di {1}",navigation:"Navigazione pagine",previous:"Precedente",next:"Successivo"},es:{showing:"Página {0} de {1}",navigation:"Navegación de páginas",previous:"Anterior",next:"Siguiente"},fr:{showing:"Page {0} sur {1}",navigation:"Navigation des pages",previous:"Précédent",next:"Suivant"}};static config={prevIcon:"bi bi-chevron-left",nextIcon:"bi bi-chevron-right",reloadIcon:"bi bi-arrow-clockwise"};static template='\n <nav data-tpl-aria-label="#l10n:t(\'navigation\')" class="user-select-none">\n <ul class="pagination">\n <li class="page-item ms-auto me-2 pagination-index"> {{ #l10n:t(\'showing\', curr.label, total) }}</li>\n <li class="page-item me-2 reload"><a role="button"><i data-tpl-class="config.reloadIcon"></i></a></li>\n <li class="page-item prev">\n <a data-tpl-class="prev.enabled?\'page-link\':\'page-link disabled\'" data-tpl-aria-label="#l10n:t(\'previous\')" role="button" data-tpl-data-page="prev.index">\n <i aria-hidden="true" data-tpl-class="config.prevIcon"></i>\n </a>\n </li>\n <li class="page-item" data-tpl-each="pages" data-tpl-var="page">\n <a data-tpl-class="curr.index != page.index ? \'page-link\': \'page-link disabled\'" role="button" data-tpl-data-page="page.index" >\n {{ page.label }}\n </a>\n </li>\n <li class="page-item next">\n <a data-tpl-class="next.enabled?\'page-link\':\'page-link disabled\'" data-tpl-aria-label="#l10n:t(\'next\')" role="button" data-tpl-data-page="next.index">\n <i aria-hidden="true" data-tpl-class="config.nextIcon"></i>\n </a>\n </li>\n </ul>\n </nav>\n ';#Rt=0;#P=0;render({observed:t}){this.total=t.total??0,this.current=t.current??0,this.addEventListener("click",t=>{const e=t.target.closest("a");e&&!e.classList.contains("disabled")&&this.dispatchEvent(new CustomEvent("page-requested",{bubbles:!0,cancelable:!0,detail:{value:Number(e.dataset.page??this.#P)}}))})}update(t,e){const s=Number(this.getAttribute("pages")??"5"),r=t>0,i=t+1<e,n={index:r?t-1:null,enabled:r},a={index:t,label:t+1},l={index:i?t+1:null,enabled:i},o=Math.max(1,Math.min(s,e)),u=Math.max(0,Math.min(t-Math.floor((o-1)/2),e-o)),c=Array.from({length:o},(t,e)=>({index:u+e,label:u+e+1}));this.template().withOverlay({total:e,prev:n,curr:a,next:l,pages:c}).renderTo(this)}get total(){return this.#Rt}set total(t){this.#Rt=t,this.reflect(()=>{this.setAttribute("total",String(t)),this.update(this.#P??0,this.#Rt)})}get current(){return this.#P}set current(t){this.#P=t,this.reflect(()=>{this.setAttribute("current",String(t)),this.update(this.#P,this.#Rt??0)})}}class mt{static parse(t,e){const s=t?u.queryChildren(t,"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 t of s.getAttributeNames()){const e=s.getAttribute(t);r.setAttribute(t,e??""),i.setAttribute(t,e??"")}const n=u.queryChildrenAll(s,"column"),l=n.filter(t=>t.hasAttribute("order")).map(t=>({sorter:t.getAttribute("sorter"),order:t.getAttribute("order")}))[0]??null;for(var o of n){const t=u.queryChildren(o,"title"),e=o.getAttribute("sorter"),s=o.getAttribute("order"),n=t??document.createTextNode(o.getAttribute("title")??"");t?.remove(),o.removeAttribute("sorter"),o.removeAttribute("order"),o.removeAttribute("title");const a=e||s?(()=>{const t=document.createElement("ful-sorter");return e&&t.setAttribute("sorter",e),s&&t.setAttribute("order",s),t.append(n),t})():n,l=document.createElement("th"),c=document.createElement("td");for(const t of o.getAttributeNames()){const e=o.getAttribute(t);l.setAttribute(t,e??""),c.setAttribute(t,e??"")}l.append(a),c.append(...o.childNodes),r.append(l),i.append(c)}return{headersTemplate:e.withOverlay({inHeaders:!0,inRows:!1}).withFragment(a.from(r)),rowsTemplate:e.withOverlay({inHeaders:!1,inRows:!0}).withFragment(a.from(i)),sort:l,length:n.length}}}class bt{#g;constructor(t){this.#g=t}async load(t,e,s){const r=t.page*t.size,i=r+t.size;return{data:this.#g.slice(r,i),size:this.#g.length}}update(t){this.#g=t}}class gt{#I;#F;#_;constructor(t,e,s){this.#I=t,this.#F=e,this.#_=s}async load(t,e,s){const r=Object.entries(s).filter(([t,e])=>e);return await this.#I.request(this.#_,this.#F).param("page",t.page).param("size",t.size).param("sort",e?`${e.sorter},${e.order}`:null).param("filters",r.length>0?JSON.stringify(Object.fromEntries(r)):null).fetchJson()}}class vt{static create(t,e){const s=t.getAttribute("src");if(s){const e=v.component("http-client"),r=t.getAttribute("method")??"GET";return new gt(e,s,r)}return new bt([])}}class yt extends E{static slots=!0;static l10n={en:{initial:"Start searching to see results.",error:"Error while loading data:",nodata:"No elements found."},it:{initial:"Avvia la ricerca per visualizzare i risultati.",error:"Errore nel caricamento dei dati:",nodata:"Nessun elemento trovato."},es:{initial:"Inicia la búsqueda para ver los resultados.",error:"Error al cargar los datos:",nodata:"No se encontraron elementos."},fr:{initial:"Lancez la recherche pour voir les résultats.",error:"Erreur lors du chargement des données :",nodata:"Aucun élément trouvé."}};static config={searchIcon:"bi bi-search"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <div class="table-wrapper">\n <table class="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 <div>\n <p data-tpl-if="config.searchIcon"><i data-tpl-class="config.searchIcon"></i></p>\n {{{ #l10n:t(\'initial\') }}}\n </div>\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"></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 class="alert alert-danger">\n <p>{{ #l10n:t(\'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 </div>\n <ful-pagination current="0" total="1"></ful-pagination>\n ';static templates={row:'\n <tr data-tpl-if="pageResponse.data.length == 0">\n <td data-tpl-colspan="schema.length" class="text-center align-middle p-4">\n {{ #l10n:t(\'nodata\') }}\n </td>\n </tr>\n {{{{ schema.rowsTemplate.withOverlay({\'rows\': pageResponse.data}).render() }}}}\n '};#gt;#Nt;#N;#Dt;#zt;#It;#Ft;#$t;#Bt;async render({slots:t,observed:e}){const s=this.template(),r=mt.parse(t.schema,s),i=s.withOverlay({slots:t,schema:r}).render(),n=u.queryChildren(i,".table-wrapper").querySelector("table");l.forward("table-",this,n),this.#gt=v.component(this.getAttribute("loader")??"loaders:table").create(this),this.#Nt=r,this.#N=n.querySelector(":scope > tbody"),this.#Dt=n.querySelector(":scope > tbody[data-ref=loading]"),this.#zt=n.querySelector(":scope > tbody[data-ref=initial]"),this.#It=n.querySelector(":scope > tbody[data-ref=feedback]"),this.#Ft=u.queryChildren(i,"ful-pagination"),this.replaceChildren(i);const a=this.querySelector("thead");r.headersTemplate.renderTo(a),this.#$t=a.querySelectorAll("ful-sorter"),await x.waitForChildren(this);const o=u.queryChildren(this,"ful-form");this.#Bt={pageRequest:{page:0,size:this.getAttribute("page-size")?Number(this.getAttribute("page-size")):10},sortRequest:r.sort,filterRequest:o?.values??{}},o?.addEventListener("submit:success",async t=>{await this.load({page:0,size:this.#Bt.pageRequest.size},this.#Bt.sortRequest,t.detail.request)}),this.addEventListener("page-requested",async t=>{await this.load({page:t.detail.value,size:this.#Bt.pageRequest.size},this.#Bt.sortRequest,this.#Bt.filterRequest)}),this.addEventListener("sort-requested",async t=>{const e=t.detail.value.order?t.detail.value:null;await this.load(this.#Bt.pageRequest,e,this.#Bt.filterRequest),this.#$t.forEach(t=>{t.order=null}),t.target.order=t.detail.value.order}),this.hasAttribute("autoload")&&this.reload()}async reload(){return await this.load(this.#Bt.pageRequest,this.#Bt.sortRequest,this.#Bt.filterRequest)}async load(t,e,s){this.#N.replaceChildren(),this.#Dt.removeAttribute("hidden"),this.#It.setAttribute("hidden",""),this.#zt.setAttribute("hidden","");try{const r=await this.#gt.load(t,e,s);this.#Bt={pageRequest:t,sortRequest:e,filterRequest:s},this.#Q(t,e,s,r)}catch(t){throw this.#Dt.setAttribute("hidden",""),this.#It.removeAttribute("hidden"),t.problems?this.#It.querySelector("[data-ref=feedback-error]").textContent=t.problems.map(t=>`${t.reason}`):this.#It.querySelector("[data-ref=feedback-error]").textContent=t,t}}async withLoader(t){return await t(this.#gt)}async resetWithFilter(t){return await this.load({page:0,size:this.#Bt.pageRequest.size},this.#Bt.sortRequest,t)}#Q(t,e,s,r){this.#Dt.setAttribute("hidden",""),this.#N.replaceChildren(this.template("row").withOverlay({schema:this.#Nt,pageRequest:t,filterRequest:s,pageResponse:r}).render()),this.#Ft.current=t.page,this.#Ft.total=Math.ceil(r.size/t.size)}}class wt extends Z{static observed=["value:json","readonly:presence","required:presence","placeholder"];static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <button data-ref="operator" class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" value="LTE" form="">&PrecedesSlantEqual;</button>\n <ul class="dropdown-menu">\n <li><a class="dropdown-item" role="button" value="EQ">=</a></li>\n <li><a class="dropdown-item" role="button" value="NEQ">&ne;</a></li>\n <li><a class="dropdown-item" role="button" value="LT">&prec;</a></li>\n <li><a class="dropdown-item" role="button" value="GT">&succ;</a></li>\n <li><a class="dropdown-item" role="button" value="LTE">&PrecedesSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="GTE">&SucceedsSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="BETWEEN">&LeftRightArrow;</a></li>\n </ul>\n <input data-ref="value1" type="datetime-local" class="form-control" form="">\n <input data-ref="value2" type="datetime-local" class="form-control" form="" hidden>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';#Ht;#jt;#Vt;render(t){super.render({...t,skipObservedSetup:!0}),this.#Ht=this.querySelector("[data-ref=operator]"),this.#jt=this.querySelector("[data-ref=value1]"),this.#Vt=this.querySelector("[data-ref=value2]"),this.#Vt.addEventListener("change",t=>{t.stopPropagation(),this.#Ut()}),this.disabled=t.disabled,this.readonly=t.observed.readonly,this.required=t.observed.required,this.placeholder=t.observed.placeholder,this.value=t.observed.value,this.addEventListener("click",t=>{const e=t.target;if(!e.matches("ul > li > a"))return;const s=e.closest("ul")?.previousElementSibling,r=e.getAttribute("value"),i=s.getAttribute("value");l.toggle(this.#Vt,"hidden","BETWEEN"!==r),s.setAttribute("value",r),s.innerHTML=e.innerHTML,i!==r&&this.#Ut()})}get value(){const t=this.#Ht.getAttribute("value"),e="BETWEEN"===t?[this.#jt.value,this.#Vt.value]:[this.#jt.value];return e.some(t=>""===t)?void 0:[t,...e.map(t=>new Date(t).toISOString())]}set value(t){if(null==t)return this.#jt.value="",void(this.#Vt.value="");const[e,...s]=t;this.#Wt(e),this.#jt.value=s[0]?Y.isoToLocal(s[0]):s[0],this.#Vt.value=s[1]?Y.isoToLocal(s[1]):s[1]}#Wt(t){this.#Ht.setAttribute("value",t);const e=Array.from(this.#Ht.nextElementSibling?.querySelectorAll("li > a[value]")??[]).find(e=>e.getAttribute("value")===t);e&&(this.#Ht.innerHTML=e.innerHTML),l.toggle(this.#Vt,"hidden","BETWEEN"!==t)}#Ut(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))}get readonly(){return super.readonly}set readonly(t){this.#Vt.readOnly=t,super.readonly=t}get disabled(){return super.disabled}set disabled(t){super.disabled=t,l.toggle(this.#Vt,"disabled",t)}}class xt extends Z{static observed=["value:json","readonly:presence","required:presence","placeholder"];static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <button data-ref="operator" class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" value="EQ" form="">=</button>\n <ul class="dropdown-menu">\n <li><a class="dropdown-item" role="button" value="EQ">=</a></li>\n <li><a class="dropdown-item" role="button" value="NEQ">&ne;</a></li>\n <li><a class="dropdown-item" role="button" value="LT">&prec;</a></li>\n <li><a class="dropdown-item" role="button" value="GT">&succ;</a></li>\n <li><a class="dropdown-item" role="button" value="LTE">&PrecedesSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="GTE">&SucceedsSlantEqual;</a></li>\n <li><a class="dropdown-item" role="button" value="BETWEEN">&LeftRightArrow;</a></li>\n </ul>\n <input data-ref="value1" type="date" class="form-control" form="">\n <input data-ref="value2" type="date" class="form-control" form="" hidden>\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';#Ht;#jt;#Vt;render(t){super.render({...t,skipObservedSetup:!0}),this.#Ht=this.querySelector("[data-ref=operator]"),this.#jt=this.querySelector("[data-ref=value1]"),this.#Vt=this.querySelector("[data-ref=value2]"),this.#Vt.addEventListener("change",t=>{t.stopPropagation(),this.#Ut()}),this.disabled=t.disabled,this.readonly=t.observed.readonly,this.required=t.observed.required,this.placeholder=t.observed.placeholder,this.value=t.observed.value,this.addEventListener("click",t=>{const e=t.target;if(!e.matches("ul > li > a"))return;const s=e.closest("ul")?.previousElementSibling,r=e.getAttribute("value"),i=s.getAttribute("value");l.toggle(this.#Vt,"hidden","BETWEEN"!==r),s.setAttribute("value",r),s.innerHTML=e.innerHTML,i!==r&&this.#Ut()})}get value(){const t=this.#Ht.getAttribute("value"),e="BETWEEN"===t?[this.#jt.value,this.#Vt.value]:[this.#jt.value];return e.some(t=>""===t)?void 0:[t,...e]}set value(t){if(null==t)return this.#jt.value="",void(this.#Vt.value="");const[e,...s]=t;this.#Wt(e),this.#jt.value=s[0],this.#Vt.value=s[1]}#Wt(t){this.#Ht.setAttribute("value",t);const e=Array.from(this.#Ht.nextElementSibling?.querySelectorAll("li > a[value]")??[]).find(e=>e.getAttribute("value")===t);e&&(this.#Ht.innerHTML=e.innerHTML),l.toggle(this.#Vt,"hidden","BETWEEN"!==t)}#Ut(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))}get readonly(){return super.readonly}set readonly(t){this.#Vt.readOnly=t,super.readonly=t}get disabled(){return super.disabled}set disabled(t){super.disabled=t,l.toggle(this.#Vt,"disabled",t)}}class Et extends Z{static observed=["value:json","readonly:presence","required:presence","placeholder"];static template='\n <div class="form-label">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </div>\n <div class="input-group">\n <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>\n {{{{ slots.before }}}}\n <button data-ref="operator" class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" value="CONTAINS" form="">&mldr;a&mldr;</button>\n <ul class="dropdown-menu">\n <li><a class="dropdown-item" role="button" value="CONTAINS">&mldr;a&mldr;</a></li>\n <li><a class="dropdown-item" role="button" value="STARTS_WITH">a&mldr;</a></li>\n <li><a class="dropdown-item" role="button" value="ENDS_WITH">&mldr;a</a></li>\n <li><a class="dropdown-item" role="button" value="EQ">=</a></li>\n </ul>\n <input data-ref="value" type="text" class="form-control" form="">\n {{{{ slots.after }}}}\n <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>\n </div>\n <ful-field-error></ful-field-error>\n ';#Ht;#Gt;#Jt="IGNORE_CASE";render(t){super.render({...t,skipObservedSetup:!0}),this.#Ht=this.querySelector("[data-ref=operator]"),this.#Gt=this.querySelector("[data-ref=value]"),this.disabled=t.disabled,this.readonly=t.observed.readonly,this.required=t.observed.required,this.placeholder=t.observed.placeholder,this.value=t.observed.value,this.addEventListener("click",t=>{const e=t.target;if(!e.matches("ul > li > a"))return;const s=e.closest("ul")?.previousElementSibling,r=e.getAttribute("value"),i=s.getAttribute("value");s.setAttribute("value",r),s.innerHTML=e.innerHTML,i!==r&&this.#Ut()})}get value(){const t=this.#Ht.getAttribute("value");return""===this.#Gt.value?void 0:[t,this.#Jt,this.#Gt.value]}set value(t){if(null==t)return void(this.#Gt.value="");const[e,s,r]=t;this.#Wt(e),this.#Jt=s??"IGNORE_CASE",this.#Gt.value=r}#Wt(t){this.#Ht.setAttribute("value",t);const e=Array.from(this.#Ht.nextElementSibling?.querySelectorAll("li > a[value]")??[]).find(e=>e.getAttribute("value")===t);e&&(this.#Ht.innerHTML=e.innerHTML)}#Ut(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))}}class At{static t(t,...e){const s=this.l10n?.[this.language]?.[t]??this.l10n?.en?.[t]??t;return 0===e.length?s:s.replace(/{(\d+)}/g,(t,s)=>e[Number(s)])}static tl(t,e=[]){return At.t.apply(this,[t,...e])}}class St{configure(t){const e=R.builder().withCsrfToken().withRedirectOnUnauthorized("/").build();t.defineModule("l10n",At).defineComponent("http-client",e).defineElement("ful-spinner",ht).defineElement("ful-form",Q).defineElement("ful-checkbox",dt).defineElement("ful-input",Z).defineElement("ful-input-file",rt).defineElement("ful-local-date",K).defineElement("ful-instant",Y).defineElement("ful-input-local-date",tt).defineElement("ful-input-local-time",et).defineElement("ful-input-instant",st).defineElement("ful-radio-group",ct).defineElement("ful-table",yt).defineElement("ful-pagination",ft).defineElement("ful-sorter",pt).defineElement("ful-filter-instant",wt).defineElement("ful-filter-local-date",xt).defineElement("ful-filter-text",Et).defineElement("ful-select",ut).defineElement("ful-dropdown",ot).defineComponent("loaders:select",lt).defineComponent("loaders:form",X).defineComponent("loaders:table",vt).defineOverlay({language:navigator?.language?.split("-")?.[0]??"en"})}}var Tt=Object.freeze({__proto__:null,AsyncEvents:V,Bindings:W,Checkbox:dt,Dropdown:ot,Form:Q,FormLoader:X,Input:Z,InputFile:rt,InputInstant:st,InputLocalDate:tt,InputLocalTime:et,Instant:Y,InstantFilter:wt,LocalDate:K,LocalDateFilter:xt,LocalStorage:$,LocalizationModule:At,Pagination:ft,Plugin:St,RadioGroup:ct,Select:ut,SelectLoader:lt,SessionStorage:B,SortButton:pt,Spinner:ht,Table:yt,TableSchemaParser:mt,TextFilter:Et,Timing:U,VersionedLocalStorage:H,VersionedSessionStorage:j});"undefined"!=typeof window&&(window.ftl=A,window.httpc=F,window.ful=Tt);export{V as AsyncEvents,l as Attributes,T as Base64,W as Bindings,dt as Checkbox,ot as Dropdown,n as ExpressionEvaluator,i as Expressions,S as Failure,Q as Form,X as FormLoader,a as Fragments,C as Hex,R as HttpClient,O as HttpClientError,Z as Input,rt as InputFile,st as InputInstant,tt as InputLocalDate,et as InputLocalTime,Y as Instant,wt as InstantFilter,o as LightSlots,K as LocalDate,xt as LocalDateFilter,$ as LocalStorage,At as LocalizationModule,q as MediaType,u as Nodes,ft as Pagination,E as ParsedElement,St as Plugin,ct as RadioGroup,g as Registry,m as RenderError,x as Rendering,ut as Select,lt as SelectLoader,B as SessionStorage,pt as SortButton,ht as Spinner,yt as Table,mt as TableSchemaParser,f as Template,y as Templates,Et as TextFilter,U as Timing,H as VersionedLocalStorage,j as VersionedSessionStorage,v as registry};
2
2
  //# sourceMappingURL=fml.min.mjs.map