@optionfactory/fml 9.0.0-rc36 → 9.0.0-rc37
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.iife.js +16 -0
- package/dist/fml.iife.js.map +1 -1
- package/dist/fml.iife.min.js +1 -1
- package/dist/fml.iife.min.js.map +1 -1
- package/dist/ful.iife.js +16 -0
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +16 -0
- package/dist/ful.mjs.map +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
package/dist/fml.iife.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var fml=function(t){"use strict";class e{#t;#e=new Map;constructor(t){this.#t=t}getOrCompute(t,e){if(this.#e.has(t))return this.#e.get(t);const s=e(t);return this.#e.size>=this.#t&&this.#e.delete(this.#e.keys().next().value),this.#e.set(t,s),s}get size(){return this.#e.size}}const s={ter:Symbol("ternary"),elv:Symbol("elvis"),nullc:Symbol("null-coalescence"),or:Symbol("or"),and:Symbol("and"),eq:Symbol("eq"),cmp:Symbol("cmp"),not:Symbol("not"),access:Symbol("access"),member:Symbol("access-member"),subscript:Symbol("access-subscript"),method:Symbol("access-method-call"),call:Symbol("module-function-call"),tstring:Symbol("tstring"),literal:Symbol("literal"),array:Symbol("array-literal"),dict:Symbol("dict-literal"),function:Symbol("module-function"),symbol:Symbol("symbol"),templated:{ten:Symbol("templated-node"),teh:Symbol("templated-html"),tet:Symbol("templated-text"),tel:Symbol("templated-literal")},dom:{t:Symbol("text"),h:Symbol("html"),n:Symbol("node")}},i=new Map([["true",!0],["false",!1],["null",null],["undefined",void 0]]);class r extends SyntaxError{constructor(t,e,s,i){super(t),this.expected=e,this.found=s,this.location=i,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let s=null;const i=t.find(t=>t.source===this.location.source);i&&(s=i.text.split(/\r\n|\n|\r/g));const r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(s){const t=this.location.end,i="".padEnd(n.line.toString().length," "),o=s[r.line-1],l=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --\x3e "+a+"\n"+i+" |\n"+n.line+" | "+o+"\n"+i+" | "+"".padEnd(r.column-1," ")+"".padEnd(l,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function s(t){return t.codePointAt(0).toString(16).toUpperCase()}const i=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t,e){return function(t){return i?t.replace(i,t=>"\\u{"+s(t)+"}"):t}(t.replace(e,"\\$&").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 n(t){return r(t,/[\\"]/g)}function a(t){return r(t,/[\\\]^-]/g)}const o={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 l(t){return o[t.type](t)}return"Expected "+function(t){const e=t.map(l);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."}}const n=(t,e)=>{if("self"===e)return t[t.length-1];for(let s=t.length-1;s>=0;s--){const i=t[s];if(null!=i&&("object"==typeof i||"function"==typeof i)&&e in i)return i[e]}},a=Symbol("BOUND");class o{#s;#i;#r;constructor(t,e,s){this.#s=t,this.#i=e,this.#r=s??e.length}#n(t){return n(this.#i,t)}#a(t,e){const i=0===e?t.lhs:t.rhs[e-1];return i.type===s.symbol?i.value:i.type===s.member?i.rhs:null}#o;#l(){if(!this.#o){const t=t=>n(this.#i.slice(0,this.#r),t);this.#o=new Proxy(this.#i,{get:(e,s)=>s===a?t:this.#n(s)})}return this.#o}[s.and](t){return this.visit(t.lhs)&&this.visit(t.rhs)}[s.or](t){return this.visit(t.lhs)||this.visit(t.rhs)}[s.nullc](t){return this.visit(t.lhs)??this.visit(t.rhs)}[s.not](t){return!this.visit(t.expr)}[s.eq](t){const e=this.visit(t.lhs)===this.visit(t.rhs);return"=="===t.op?e:!e}[s.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}`)}}[s.call](t){const e=t.value,s=null===e.module?this.#s:this.#s?.[e.module];if(!s)throw new Error(`Module "${e.module}" not found`);const i=s[e.value];if(!i)throw new Error(`Function "#${null===e.module?"":`${e.module}:`}${e.value}" not found`);const r=t.args.map(t=>this.visit(t));return i.apply(this.#l(),r)}[s.literal](t){return t.value}[s.tstring](t){let e="";const s=t.parts;for(let t=0,i=s.length;t<i;t++){const i=this.visit(s[t]);null!=i&&(e+=i)}return e}[s.symbol](t){return this.#n(t.value)}[s.dict](t){return Object.fromEntries(t.value.map(t=>[this.visit(t[0]),this.visit(t[1])]))}[s.array](t){return t.value.map(t=>this.visit(t))}[s.ter](t){return this.visit(t.cond)?this.visit(t.ifTrue):this.visit(t.ifFalse)}[s.elv](t){return this.visit(t.cond)||this.visit(t.ifFalse)}[s.access](t){let e,i=this.visit(t.lhs);for(let r=0;r!==t.rhs.length;++r){const n=t.rhs[r];if(n.ns&&null==i)return;let a;switch(n.type){case s.member:a=i[n.rhs];break;case s.subscript:a=i[this.visit(n.rhs)];break;case s.method:{if(!i){const e=this.#a(t,r);throw new Error(null===e?"Method missing":`Method missing "${e}"`)}const s=n.args.map(t=>this.visit(t));a=i.apply(e,s);break}}e=i,i=a}return i}visit(t,...e){return this[t.type](t,...e)}visitRoot(t,e){return e?t.map(t=>{switch(t.type){case s.templated.tel:return{type:s.dom.t,value:t.value};case s.templated.tet:return{type:s.dom.t,value:this.visit(t.value)};case s.templated.teh:return{type:s.dom.h,value:this.visit(t.value)};case s.templated.ten:return{type:s.dom.n,value:this.visit(t.value)};default:throw new Error(`unknown node type ${t.type.toString()}`)}}):this.visit(t)}}class l{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static BOUND=a;static#u=new e(1e3);static parse(t,e){const n=e?.toString()+t;return this.#u.getOrCompute(n,()=>function(t,e){const n={},a=(e=void 0!==e?e:{}).grammarSource,o={TemplatedRoot:le,ExpressionRoot:ce};let l=le;const u="{{{{",c="}}}}",d="{{{",h="}}}",p="{{",f="}}",m="\\",g="{",b="?",v=":",y="?:",w="??",E="||",x="&&",A="!",S="?.",C=".",T="[",_="]",R="(",q=",",k=")",O="-",L="'",N='"',P="`",M="}",F="#",z="==",I="!=",D=">=",$=">",B="<=",j="<",H=se("{{{{",!1),V=se("}}}}",!1),W=se("{{{",!1),U=se("}}}",!1),G=se("{{",!1),Q=se("}}",!1),K=ie(["\\","{"],!0,!1,!1),J=se("\\",!1),X={type:"any"},Y=se("{",!1),Z=se("?",!1),tt=se(":",!1),et=se("?:",!1),st=se("??",!1),it=se("||",!1),rt=se("&&",!1),nt=se("!",!1),at=re("member"),ot=se("?.",!1),lt=se(".",!1),ut=re("subscript"),ct=se("[",!1),dt=se("]",!1),ht=re("method-call"),pt=se("(",!1),ft=se(",",!1),mt=se(")",!1),gt=re("module-function-call"),bt=re("number-literal"),vt=se("-",!1),yt=ie([["0","9"]],!1,!1,!1),wt=re("string-literal"),Et=se("'",!1),xt=ie(["'"],!0,!1,!1),At=se('"',!1),St=ie(['"'],!0,!1,!1),Ct=se("`",!1),Tt=re("tstring-expression"),_t=se("}",!1),Rt=re("tstring-literal"),qt=ie(["\\","`","{"],!0,!1,!1),kt=re("array-literal"),Ot=re("dict-literal"),Lt=re("module-function"),Nt=se("#",!1),Pt=ie([["a","z"],["A","Z"],"$","_"],!1,!1,!1),Mt=ie([["a","z"],["A","Z"],"$","_",["0","9"]],!1,!1,!1),Ft=re("identifier-or-keyword"),zt=se("==",!1),It=se("!=",!1),Dt=se(">=",!1),$t=se(">",!1),Bt=se("<=",!1),jt=se("<",!1),Ht=ie([" ","\t","\n","\r"],!1,!1,!1);function Vt(t){return t}function Wt(t,e,s){return{op:e,rhs:s}}function Ut(t,e,s){return{op:e,rhs:s}}function Gt(t){return t}let Qt=0|e.peg$currPos;const Kt=[{line:1,column:1}];let Jt,Xt,Yt=Qt,Zt=e.peg$maxFailExpected||[],te=0|e.peg$silentFails,ee=new Map;if(e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');l=o[e.startRule]}function se(t,e){return{type:"literal",text:t,ignoreCase:e}}function ie(t,e,s,i){return{type:"class",parts:t,inverted:e,ignoreCase:s,unicode:i}}function re(t){return{type:"other",description:t}}function ne(e){let s,i=Kt[e];if(i)return i;if(e>=Kt.length)s=Kt.length-1;else for(s=e;!Kt[--s];);for(i=Kt[s],i={line:i.line,column:i.column};s<e;)10===t.charCodeAt(s)?(i.line++,i.column=1):i.column++,s++;return Kt[e]=i,i}function ae(t,e,s){const i=ne(t),r=ne(e);return{source:a,start:{offset:t,line:i.line,column:i.column},end:{offset:e,line:r.line,column:r.column}}}function oe(t){Qt<Yt||(Qt>Yt&&(Yt=Qt,Zt=[]),Zt.push(t))}function le(){let t,e;const s=38*Qt+0,i=ee.get(s);if(i)return Qt=i.nextPos,i.result;for(t=[];e=ue(),e!==n;)t.push(e);return ee.set(s,{nextPos:Qt,result:t}),t}function ue(){let e,i,r,a,o;const l=38*Qt+1,b=ee.get(l);return b?(Qt=b.nextPos,b.result):(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+2,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,4)===u?(e=u,Qt+=4):(e=n,0===te&&oe(H)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+3,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,4)===c?(e=c,Qt+=4):(e=n,0===te&&oe(V)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(v=i,i={type:s.templated.ten,value:v}),e=i,e===n&&(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+4,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,3)===d?(e=d,Qt+=3):(e=n,0===te&&oe(W)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+5,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,3)===h?(e=h,Qt+=3):(e=n,0===te&&oe(U)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(i=function(t){return{type:s.templated.teh,value:t}}(i)),e=i,e===n&&(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+6,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===p?(e=p,Qt+=2):(e=n,0===te&&oe(G)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+7,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===f?(e=f,Qt+=2):(e=n,0===te&&oe(Q)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(i=function(t){return{type:s.templated.tet,value:t}}(i)),e=i,e===n&&(e=Qt,i=function(){let e,s,i,r,a,o,l;const u=38*Qt+8,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;for(e=Qt,s=[];;){for(i=Qt,r=[];a=t.charAt(Qt),""!==a&&(Xt=a.charCodeAt(0),92!==Xt&&123!==Xt)?Qt++:(a=n,0===te&&oe(K)),a!==n;)r.push(a);if(r.length<1&&(r=n),i=r!==n?t.substring(i,Qt):r,i===n&&(i=Qt,92===t.charCodeAt(Qt)?(r=m,Qt++):(r=n,0===te&&oe(J)),r!==n?(t.length>Qt?(a=t.charAt(Qt),Qt++):(a=n,0===te&&oe(X)),a!==n?i=Vt(a):(Qt=i,i=n)):(Qt=i,i=n),i===n&&(i=Qt,r=Qt,123===t.charCodeAt(Qt)?(a=g,Qt++):(a=n,0===te&&oe(Y)),a!==n?(o=Qt,te++,123===t.charCodeAt(Qt)?(l=g,Qt++):(l=n,0===te&&oe(Y)),te--,l===n?o=void 0:(Qt=o,o=n),o!==n?(a=[a,o],r=a):(Qt=r,r=n)):(Qt=r,r=n),i=r!==n?t.substring(i,Qt):r)),i===n)break;s.push(i)}return s.length<1&&(s=n),s!==n&&(s=s.join("")),e=s,ee.set(u,{nextPos:Qt,result:e}),e}(),i!==n&&(i=function(t){return{type:s.templated.tel,value:t}}(i)),e=i))),ee.set(l,{nextPos:Qt,result:e}),e);var v}function ce(){let t,e;const s=38*Qt+9,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t=Qt,_e(),e=de(),e!==n?(_e(),t=e):(Qt=t,t=n),ee.set(s,{nextPos:Qt,result:t}),t)}function de(){let e,i,r,a,o,l;const u=38*Qt+10,c=ee.get(u);return c?(Qt=c.nextPos,c.result):(e=Qt,i=he(),i!==n?(_e(),63===t.charCodeAt(Qt)?(r=b,Qt++):(r=n,0===te&&oe(Z)),r!==n?(_e(),a=de(),a!==n?(_e(),58===t.charCodeAt(Qt)?(o=v,Qt++):(o=n,0===te&&oe(tt)),o!==n?(_e(),l=de(),l!==n?e={type:s.ter,cond:i,ifTrue:a,ifFalse:l}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=he()),ee.set(u,{nextPos:Qt,result:e}),e)}function he(){let e,i,r,a;const o=38*Qt+11,l=ee.get(o);return l?(Qt=l.nextPos,l.result):(e=Qt,i=pe(),i!==n?(_e(),t.substr(Qt,2)===y?(r=y,Qt+=2):(r=n,0===te&&oe(et)),r!==n?(_e(),a=he(),a!==n?e={type:s.elv,cond:i,ifFalse:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=pe()),ee.set(o,{nextPos:Qt,result:e}),e)}function pe(){let e,i,r,a;const o=38*Qt+12,l=ee.get(o);return l?(Qt=l.nextPos,l.result):(e=Qt,i=fe(),i!==n?(_e(),t.substr(Qt,2)===w?(r=w,Qt+=2):(r=n,0===te&&oe(st)),r!==n?(_e(),a=pe(),a!==n?e={type:s.nullc,lhs:i,rhs:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=fe()),ee.set(o,{nextPos:Qt,result:e}),e)}function fe(){let e,i,r,a,o,l;const u=38*Qt+13,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;if(e=Qt,i=me(),i!==n){for(r=[];a=Qt,_e(),t.substr(Qt,2)===E?(o=E,Qt+=2):(o=n,0===te&&oe(it)),o!==n?(_e(),l=me(),l!==n?a=l:(Qt=a,a=n)):(Qt=a,a=n),a!==n;)r.push(a);e=function(t,e){let i=t;for(const t of e)i={type:s.or,lhs:i,rhs:t};return i}(i,r)}else Qt=e,e=n;return ee.set(u,{nextPos:Qt,result:e}),e}function me(){let e,i,r,a,o,l;const u=38*Qt+14,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;if(e=Qt,i=ge(),i!==n){for(r=[];a=Qt,_e(),t.substr(Qt,2)===x?(o=x,Qt+=2):(o=n,0===te&&oe(rt)),o!==n?(_e(),l=ge(),l!==n?a=l:(Qt=a,a=n)):(Qt=a,a=n),a!==n;)r.push(a);e=function(t,e){let i=t;for(const t of e)i={type:s.and,lhs:i,rhs:t};return i}(i,r)}else Qt=e,e=n;return ee.set(u,{nextPos:Qt,result:e}),e}function ge(){let t,e,i,r,a,o;const l=38*Qt+15,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(t=Qt,e=be(),e!==n){for(i=[];r=Qt,_e(),a=Ce(),a!==n?(_e(),o=be(),o!==n?r=Wt(0,a,o):(Qt=r,r=n)):(Qt=r,r=n),r!==n;)i.push(r);t=function(t,e){let i=t;for(const t of e)i={type:s.eq,op:t.op,lhs:i,rhs:t.rhs};return i}(e,i)}else Qt=t,t=n;return ee.set(l,{nextPos:Qt,result:t}),t}function be(){let t,e,i,r,a,o;const l=38*Qt+16,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(t=Qt,e=ve(),e!==n){for(i=[];r=Qt,_e(),a=Te(),a!==n?(_e(),o=ve(),o!==n?r=Ut(0,a,o):(Qt=r,r=n)):(Qt=r,r=n),r!==n;)i.push(r);t=function(t,e){let i=t;for(const t of e)i={type:s.cmp,op:t.op,lhs:i,rhs:t.rhs};return i}(e,i)}else Qt=t,t=n;return ee.set(l,{nextPos:Qt,result:t}),t}function ve(){let e,i,r;const a=38*Qt+17,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(e=Qt,33===t.charCodeAt(Qt)?(i=A,Qt++):(i=n,0===te&&oe(nt)),i!==n?(_e(),r=ve(),r!==n?e={type:s.not,expr:r}:(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=function(){let t,e,i,r,a;const o=38*Qt+18,l=ee.get(o);if(l)return Qt=l.nextPos,l.result;if(t=Qt,e=we(),e!==n){for(_e(),i=[];r=Qt,a=ye(),a!==n?(_e(),r=a):(Qt=r,r=n),r!==n;)i.push(r);i.length<1&&(i=n),i!==n?t={type:s.access,lhs:e,rhs:i}:(Qt=t,t=n)}else Qt=t,t=n;return t===n&&(t=we()),ee.set(o,{nextPos:Qt,result:t}),t}()),ee.set(a,{nextPos:Qt,result:e}),e)}function ye(){let e;const i=38*Qt+19,r=ee.get(i);return r?(Qt=r.nextPos,r.result):(e=function(){let e,i,r;const a=38*Qt+20,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(46===t.charCodeAt(Qt)?(i=C,Qt++):(i=n,0===te&&oe(lt))),i!==n?(_e(),r=Se(),r!==n?e={type:s.member,ns:"?."===i,rhs:r}:(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(at)),ee.set(a,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let e,i,r,a,o;const l=38*Qt+21,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(i=null),91===t.charCodeAt(Qt)?(r=T,Qt++):(r=n,0===te&&oe(ct)),r!==n?(_e(),a=de(),a!==n?(_e(),93===t.charCodeAt(Qt)?(o=_,Qt++):(o=n,0===te&&oe(dt)),o!==n?e={type:s.subscript,ns:null!==i,rhs:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(ut)),ee.set(l,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let e,i,r,a,o,l,u,c;const d=38*Qt+22,h=ee.get(d);if(h)return Qt=h.nextPos,h.result;if(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(i=null),40===t.charCodeAt(Qt)?(r=R,Qt++):(r=n,0===te&&oe(pt)),r!==n){for(_e(),a=Qt,o=de(),o!==n?(l=_e(),a=o):(Qt=a,a=n),a===n&&(a=null),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=q,Qt++):(u=n,0===te&&oe(ft)),u!==n?(_e(),c=de(),c!==n?(_e(),l=c):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);41===t.charCodeAt(Qt)?(l=k,Qt++):(l=n,0===te&&oe(mt)),l!==n?e=function(t,e,i){return{type:s.method,ns:null!==t,args:null===e?[]:[e,...i]}}(i,a,o):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(ht)),ee.set(d,{nextPos:Qt,result:e}),e}())),ee.set(i,{nextPos:Qt,result:e}),e)}function we(){let e,r,a,o;const l=38*Qt+23,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(e=Qt,40===t.charCodeAt(Qt)?(r=R,Qt++):(r=n,0===te&&oe(pt)),r!==n?(_e(),a=de(),a!==n?(_e(),41===t.charCodeAt(Qt)?(o=k,Qt++):(o=n,0===te&&oe(mt)),o!==n?e=a:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=function(){let e,i,r,a,o,l,u,c;const d=38*Qt+24,h=ee.get(d);if(h)return Qt=h.nextPos,h.result;if(te++,e=Qt,i=function(){let e,i,r,a,o;const l=38*Qt+32,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(te++,e=Qt,35===t.charCodeAt(Qt)?(i=F,Qt++):(i=n,0===te&&oe(Nt)),i!==n?(r=Qt,a=Se(),a!==n?(58===t.charCodeAt(Qt)?(o=v,Qt++):(o=n,0===te&&oe(tt)),o!==n?r=a:(Qt=r,r=n)):(Qt=r,r=n),r===n&&(r=null),a=Se(),a!==n?e={type:s.function,module:r,value:a}:(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(Lt)),ee.set(l,{nextPos:Qt,result:e}),e)}(),i!==n)if(40===t.charCodeAt(Qt)?(r=R,Qt++):(r=n,0===te&&oe(pt)),r!==n){for(_e(),a=Qt,o=de(),o!==n?(l=_e(),a=o):(Qt=a,a=n),a===n&&(a=null),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=q,Qt++):(u=n,0===te&&oe(ft)),u!==n?(_e(),c=de(),c!==n?(_e(),l=c):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);41===t.charCodeAt(Qt)?(l=k,Qt++):(l=n,0===te&&oe(mt)),l!==n?e=function(t,e,i){const r=null===e?[]:[e,...i];return{type:s.call,value:t,args:r}}(i,a,o):(Qt=e,e=n)}else Qt=e,e=n;else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(gt)),ee.set(d,{nextPos:Qt,result:e}),e}(),e===n&&(e=function(){let e;const i=38*Qt+25,r=ee.get(i);return r?(Qt=r.nextPos,r.result):(e=function(){let e,i,r,a,o,l,u,c,d,h;const p=38*Qt+26,f=ee.get(p);if(f)return Qt=f.nextPos,f.result;for(te++,e=Qt,i=Qt,r=Qt,45===t.charCodeAt(Qt)?(a=O,Qt++):(a=n,0===te&&oe(vt)),a===n&&(a=null),o=Qt,l=[];u=t.charAt(Qt),Xt=u.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(u=n,0===te&&oe(yt)),u!==n;)l.push(u);if(l.length<1&&(l=n),l!==n){if(u=Qt,46===t.charCodeAt(Qt)?(c=C,Qt++):(c=n,0===te&&oe(lt)),c!==n){for(d=[];h=t.charAt(Qt),Xt=h.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(h=n,0===te&&oe(yt)),h!==n;)d.push(h);c=[c,d],u=c}else Qt=u,u=n;u===n&&(u=null),l=[l,u],o=l}else Qt=o,o=n;if(o===n)if(o=Qt,46===t.charCodeAt(Qt)?(l=C,Qt++):(l=n,0===te&&oe(lt)),l!==n){for(u=[];c=t.charAt(Qt),Xt=c.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(c=n,0===te&&oe(yt)),c!==n;)u.push(c);u.length<1&&(u=n),u!==n?(l=[l,u],o=l):(Qt=o,o=n)}else Qt=o,o=n;return o!==n?(a=[a,o],r=a):(Qt=r,r=n),i=r!==n?t.substring(i,Qt):r,i!==n&&(i={type:s.literal,value:parseFloat(i)}),e=i,te--,e===n&&(i=n,0===te&&oe(bt)),ee.set(p,{nextPos:Qt,result:e}),e}(),e===n&&(e=Ee(),e===n&&(e=function(){let e,i,r,a,o,l,u;const c=38*Qt+30,d=ee.get(c);if(d)return Qt=d.nextPos,d.result;if(te++,e=Qt,91===t.charCodeAt(Qt)?(i=T,Qt++):(i=n,0===te&&oe(ct)),i!==n){for(_e(),r=de(),r===n&&(r=null),_e(),a=[];o=Qt,44===t.charCodeAt(Qt)?(l=q,Qt++):(l=n,0===te&&oe(ft)),l!==n?(_e(),u=de(),u!==n?(_e(),o=u):(Qt=o,o=n)):(Qt=o,o=n),o!==n;)a.push(o);93===t.charCodeAt(Qt)?(o=_,Qt++):(o=n,0===te&&oe(dt)),o!==n?e=function(t,e){const i=null===t?[]:[t,...e];return{type:s.array,value:i}}(r,a):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(kt)),ee.set(c,{nextPos:Qt,result:e}),e}(),e===n&&(e=function(){let e,i,r,a,o,l,u,c,d,h,p;const f=38*Qt+31,m=ee.get(f);if(m)return Qt=m.nextPos,m.result;if(te++,e=Qt,123===t.charCodeAt(Qt)?(i=g,Qt++):(i=n,0===te&&oe(Y)),i!==n){for(_e(),r=Qt,a=Ee(),a!==n?(o=_e(),58===t.charCodeAt(Qt)?(l=v,Qt++):(l=n,0===te&&oe(tt)),l!==n?(u=_e(),c=de(),c!==n?r=[a,c]:(Qt=r,r=n)):(Qt=r,r=n)):(Qt=r,r=n),r===n&&(r=null),a=_e(),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=q,Qt++):(u=n,0===te&&oe(ft)),u!==n?(c=_e(),d=Ee(),d!==n?(_e(),58===t.charCodeAt(Qt)?(h=v,Qt++):(h=n,0===te&&oe(tt)),h!==n?(_e(),p=de(),p!==n?(_e(),l=[d,p]):(Qt=l,l=n)):(Qt=l,l=n)):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);125===t.charCodeAt(Qt)?(l=M,Qt++):(l=n,0===te&&oe(_t)),l!==n?e=function(t,e){var i=[];return null!==t&&i.push(t),i.push.apply(i,e),{type:s.dict,value:i}}(r,o):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(Ot)),ee.set(f,{nextPos:Qt,result:e}),e}()))),ee.set(i,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let t,e;const r=38*Qt+34,a=ee.get(r);return a?(Qt=a.nextPos,a.result):(te++,t=Qt,e=Se(),e!==n&&(o=e,e=i.has(o)?{type:s.literal,value:i.get(o)}:{type:s.symbol,value:o}),t=e,te--,t===n&&(e=n,0===te&&oe(Ft)),ee.set(r,{nextPos:Qt,result:t}),t);var o}()))),ee.set(l,{nextPos:Qt,result:e}),e)}function Ee(){let e,i,r,a,o;const l=38*Qt+27,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(te++,e=Qt,39===t.charCodeAt(Qt)?(i=L,Qt++):(i=n,0===te&&oe(Et)),i!==n){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),39!==Xt)?Qt++:(o=n,0===te&&oe(xt)),o!==n;)a.push(o);r=t.substring(r,Qt),39===t.charCodeAt(Qt)?(a=L,Qt++):(a=n,0===te&&oe(Et)),a!==n?e={type:s.literal,value:r}:(Qt=e,e=n)}else Qt=e,e=n;if(e===n){if(e=Qt,34===t.charCodeAt(Qt)?(i=N,Qt++):(i=n,0===te&&oe(At)),i!==n){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),34!==Xt)?Qt++:(o=n,0===te&&oe(St)),o!==n;)a.push(o);r=t.substring(r,Qt),34===t.charCodeAt(Qt)?(a=N,Qt++):(a=n,0===te&&oe(At)),a!==n?e={type:s.literal,value:r}:(Qt=e,e=n)}else Qt=e,e=n;if(e===n)if(e=Qt,96===t.charCodeAt(Qt)?(i=P,Qt++):(i=n,0===te&&oe(Ct)),i!==n){for(r=[];a=xe(),a===n&&(a=Ae()),a!==n;)r.push(a);96===t.charCodeAt(Qt)?(a=P,Qt++):(a=n,0===te&&oe(Ct)),a!==n?e={type:s.tstring,parts:r}:(Qt=e,e=n)}else Qt=e,e=n}return te--,e===n&&(i=n,0===te&&oe(wt)),ee.set(l,{nextPos:Qt,result:e}),e}function xe(){let e,s,i,r;const a=38*Qt+28,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(te++,e=Qt,123===t.charCodeAt(Qt)?(s=g,Qt++):(s=n,0===te&&oe(Y)),s!==n?(_e(),i=de(),i!==n?(_e(),125===t.charCodeAt(Qt)?(r=M,Qt++):(r=n,0===te&&oe(_t)),r!==n?e=i:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(s=n,0===te&&oe(Tt)),ee.set(a,{nextPos:Qt,result:e}),e)}function Ae(){let e,i,r,a,o;const l=38*Qt+29,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;for(te++,e=Qt,i=[];;){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),92!==Xt&&96!==Xt&&123!==Xt)?Qt++:(o=n,0===te&&oe(qt)),o!==n;)a.push(o);if(a.length<1&&(a=n),r=a!==n?t.substring(r,Qt):a,r===n&&(r=Qt,92===t.charCodeAt(Qt)?(a=m,Qt++):(a=n,0===te&&oe(J)),a!==n?(t.length>Qt?(o=t.charAt(Qt),Qt++):(o=n,0===te&&oe(X)),o!==n?r=Gt(o):(Qt=r,r=n)):(Qt=r,r=n)),r===n)break;i.push(r)}return i.length<1&&(i=n),i!==n&&(i={type:s.literal,value:i.join("")}),e=i,e===n&&(e=Qt,123===t.charCodeAt(Qt)?(i=g,Qt++):(i=n,0===te&&oe(Y)),i!==n&&(i={type:s.literal,value:i}),e=i),te--,e===n&&(i=n,0===te&&oe(Rt)),ee.set(l,{nextPos:Qt,result:e}),e}function Se(){let e,s,i,r,a;const o=38*Qt+33,l=ee.get(o);if(l)return Qt=l.nextPos,l.result;if(e=Qt,s=Qt,i=t.charAt(Qt),Xt=i.charCodeAt(0),Xt>=97&&Xt<=122||Xt>=65&&Xt<=90||36===Xt||95===Xt?Qt++:(i=n,0===te&&oe(Pt)),i!==n){for(r=[];a=t.charAt(Qt),Xt=a.charCodeAt(0),Xt>=97&&Xt<=122||Xt>=65&&Xt<=90||36===Xt||95===Xt||Xt>=48&&Xt<=57?Qt++:(a=n,0===te&&oe(Mt)),a!==n;)r.push(a);i=[i,r],s=i}else Qt=s,s=n;return e=s!==n?t.substring(e,Qt):s,ee.set(o,{nextPos:Qt,result:e}),e}function Ce(){let e;const s=38*Qt+35,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===z?(e=z,Qt+=2):(e=n,0===te&&oe(zt)),e===n&&(t.substr(Qt,2)===I?(e=I,Qt+=2):(e=n,0===te&&oe(It))),ee.set(s,{nextPos:Qt,result:e}),e)}function Te(){let e;const s=38*Qt+36,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===D?(e=D,Qt+=2):(e=n,0===te&&oe(Dt)),e===n&&(62===t.charCodeAt(Qt)?(e=$,Qt++):(e=n,0===te&&oe($t)),e===n&&(t.substr(Qt,2)===B?(e=B,Qt+=2):(e=n,0===te&&oe(Bt)),e===n&&(60===t.charCodeAt(Qt)?(e=j,Qt++):(e=n,0===te&&oe(jt))))),ee.set(s,{nextPos:Qt,result:e}),e)}function _e(){let e,s;const i=38*Qt+37,r=ee.get(i);if(r)return Qt=r.nextPos,r.result;for(te++,e=[];s=t.charAt(Qt),Xt=s.charCodeAt(0),32===Xt||9===Xt||10===Xt||13===Xt?Qt++:(s=n,0===te&&oe(Ht)),s!==n;)e.push(s);return te--,ee.set(i,{nextPos:Qt,result:e}),e}Jt=l();const Re=Jt!==n&&Qt===t.length;function qe(){throw Jt!==n&&Qt<t.length&&oe({type:"end"}),e=Zt,s=Yt<t.length?function(e=Qt){const s=t.codePointAt(e);return void 0===s?"":String.fromCodePoint(s)}(Yt):null,i=Yt<t.length?ae(Yt,Yt+1):ae(Yt,Yt),new r(r.buildMessage(e,s),e,s,i);var e,s,i}return e.peg$library?{peg$result:Jt,peg$currPos:Qt,peg$FAILED:n,peg$maxFailExpected:Zt,peg$maxFailPos:Yt,peg$success:Re,peg$throw:Re?void 0:qe}:Re?Jt:void qe()}(t,{startRule:e===l.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}static evaluate(t,e,s,i,r){return new o(t,e,r).visitRoot(s,i===l.MODE_TEMPLATED)}static interpret(t,e,s,i,r){return l.evaluate(t,e,l.parse(s,i),i,r)}}class u{#s;#i;#r;constructor(t,e,s){this.#s=t,this.#i=e,this.#r=s??e.length}withModule(t,e){const s=t?{[t]:e}:e;return new u({...this.#s,...s},this.#i,this.#r)}withOverlay(...t){return new u(this.#s,0===t.length?this.#i:[...this.#i,...t],this.#r)}resolve(t){return n(this.#i,t)}evaluateExpression(t){return l.interpret(this.#s,this.#i,t,l.MODE_EXPRESSION,this.#r)}evaluateTemplated(t){return l.interpret(this.#s,this.#i,t,l.MODE_TEMPLATED,this.#r)}}class c{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 d{static id=0;static uid(t){return`${t}-${++d.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(i=>{const r=i.substring(t.length);if("class"===r){const i=e.getAttribute(`${t}class`)?.split(/\s+/).filter(t=>t.length)??[];return void s.classList.add(...i)}s.setAttribute(r,e.getAttribute(i))})}static set(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)}}class h{static from(t){for(const e of t.children)e.matches('[slot=""]')&&e.removeAttribute("slot");const e=Array.from(t.children).filter(t=>t.matches("[slot]")).map(t=>{t.remove();const e=t.getAttribute("slot");return t.removeAttribute("slot"),[e,h.slotFromNode(t)]}),s=Object.create(null);s.default=new DocumentFragment,s.default.append(...t.childNodes);for(const[t,i]of e)t in s||(s[t]=new DocumentFragment),s[t].append(i);return s}static slotFromNode(t){return t instanceof HTMLTemplateElement?document.adoptNode(t.content):t instanceof HTMLScriptElement&&"text/html"===t.type?c.fromHtml(t.innerHTML):t}}class p{static isParsed(t){for(let e=t;e;e=e.parentNode)if(e.nextSibling)return!0;return!1}static waitDomContentLoaded(t){if("loading"===t.readyState)return new Promise(e=>{t.addEventListener("DOMContentLoaded",()=>e(void 0),{once:!0})});if("complete"===t.readyState)return Promise.resolve();const e=t.defaultView;if(null===e)return Promise.resolve();const[s]=e.performance?.getEntriesByType("navigation")??[];return s?.domContentLoadedEventStart>0?Promise.resolve():new Promise(t=>{const s=()=>{e.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s),t(void 0)};e.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s)})}static waitParsed(t){return p.isParsed(t)||"loading"!==t.ownerDocument.readyState?Promise.resolve(t):new Promise(e=>{const s=new MutationObserver(()=>{p.isParsed(t)&&(s.disconnect(),e(t))});for(let e=t.parentNode;e;e=e.parentNode)s.observe(e,{childList:!0});p.waitDomContentLoaded(t.ownerDocument).then(()=>{s.disconnect(),e(t)})})}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 i of t.children)i.matches(e)&&s.push(i);return s}}class f{#c=new Set;removed(t){return this.#c.has(t)}remove(t){t.replaceChildren?.(),Object.keys(t.dataset||{}).filter(t=>t.startsWith("tpl")).forEach(e=>{delete t.dataset[e]}),this.#c.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.#c)t.remove();this.#c.clear()}}class m{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplRemove","tplVerbatim"];static tplIf(t,e,s,i){i.evaluateExpression(e)||s.remove(t)}static tplWith(t,e,s,i){const r=i.evaluateExpression(e),n=s.popData(t,"tplVar"),a=new v(t,i).withOverlay(n?{[n]:r}:r).render();s.replace(t,a)}static tplEach(t,e,s,i){const r=s.popData(t,"tplVar"),n=s.popData(t,"tplStat"),a=new v(t,i),o=i.evaluateExpression(e),l=null===o||"object"!=typeof o?void 0:Object.getPrototypeOf(o),u=o?.[Symbol.iterator]||l!==Object.prototype&&null!==l?null:Object.entries(o),c=o instanceof Map?[...o]:u,d=null===c?o:c.map(([t,e])=>({key:t,value:e}));if(!d?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);const h=n?d:null,p="number"==typeof h?.length?h.length:h?.size,f="number"==typeof p?p:null;let m=0;for(const e of d){const i=r?{[r]:e}:e,o={index:m,count:m+1,size:f,first:0===m,last:null===f?null:m===f-1,even:m%2==0,odd:m%2==1},l=n?[{[n]:o},i]:[i];s.prepend(t,a.withOverlay(...l).render()),++m}s.remove(t)}static tplWhen(t,e,s,i){i.evaluateExpression(e)||s.remove(t)}static tplVerbatim(t,e,s,i){const r=t.cloneNode(!0);s.replace(t,r)}static tplRemove(t,e,s,i){switch(e.toLowerCase()){case"tag":{const e=c.fromChildNodes(t);"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 tplClassAppend(t,e,s,i){const r=i.evaluateExpression(e);if(!r)return;const n=(Array.isArray(r)?r:[r]).flatMap(t=>"string"==typeof t?t.split(" "):t).filter(Boolean);0!==n.length&&t.classList.add(...n)}static tplAttrAppend(t,e,s,i){const r=i.evaluateExpression(e);r&&0!==r.length&&(Array.isArray(r[0])?r:[r]).forEach(([e,s])=>{null!=s&&t.setAttribute(e,s)})}static textNode(t,e,i,r){for(const n of r.evaluateTemplated(e))if(null!=n.value)switch(n.type){case s.dom.t:i.prepend(t,document.createTextNode(n.value));break;case s.dom.h:i.prepend(t,c.fromHtml("string"==typeof n.value?n.value:String(n.value)));break;case s.dom.n:if(!(n.value instanceof Node))throw new TypeError(`Expected a Node, got '${typeof n.value}'`);i.prepend(t,n.value)}i.remove(t)}}const g=new e(1e3);function b(t){return g.getOrCompute(t,t=>t.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase())}class v{static fromHtml(t,e,...s){return new v(c.fromHtml(t),new u(e,s))}static fromSelector(t,e,...s){const i=document.querySelector(t);if(!(i instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");return v.fromTemplate(i,e,...s)}static fromTemplate(t,e,...s){const i=document.adoptNode(t.content);return new v(i,new u(e,s))}static fromFragment(t,e,...s){return new v(t,new u(e,s))}#d;#h;constructor(t,e){this.#d=t,this.#h=e}withEvaluator(t){return new v(this.#d,t)}withFragment(t){return new v(t,this.#h)}withModule(t,e){return new v(this.#d,this.#h.withModule(t,e))}withOverlay(...t){return new v(this.#d,this.#h.withOverlay(...t))}evaluateExpression(t,...e){return this.#h.withOverlay(...e).evaluateExpression(t)}evaluateTemplated(t,...e){return this.#h.withOverlay(...e).evaluateTemplated(t)}evaluator(){return this.#h}render(){try{const t=new f,e=document.importNode(this.#d,!0),s=e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e:c.from(e),i=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,v.#p);let r;for(;null!==(r=i.nextNode());){if(t.cleanup(),r.nodeType===Node.TEXT_NODE){try{m.textNode(r,r.nodeValue,t,this.#h)}catch(t){throw y.wrap("Error evaluating text node",r,t)}continue}const e=r;for(const s of m.ORDERED_COMMANDS){if(!(s in e.dataset))continue;const i=t.popData(e,s);try{m[s](e,i,t,this.#h)}catch(t){throw y.wrap(`Error evaluating data-tpl-${b(s)}="${i}"`,e,t)}if(t.removed(e))break}for(const s of Object.keys(e.dataset||{})){if(!s.startsWith("tpl"))continue;const i=b(s),r=t.popData(e,s);try{const t=this.#h.evaluateExpression(r);if("boolean"==typeof t){e.toggleAttribute(i,t);continue}null!=t&&e.setAttribute(i,t)}catch(t){throw y.wrap(`Error evaluating data-tpl-${i}="${r}"`,e,t)}}}return t.cleanup(),s}catch(t){if(t instanceof y)throw t;throw new y("Error rendering template",this.#d,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#p(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 y extends Error{static FRAMES=3;#f;#m;truncated=!1;static wrap(t,e,s){return s instanceof y&&s.depth>=y.FRAMES?(s.truncated=!0,s):new y(t,e,s)}constructor(t,e,s){super(`${t} in \`${y.describe(e)}\``,{cause:s}),this.name="RenderError",this.#f=e,this.#m=(s instanceof y?s.depth:0)+1}get depth(){return this.#m}get node(){return this.#f}get html(){return y.stringify(this.#f)}static describe(t){if(t.nodeType===Node.TEXT_NODE)return y.#g(String(t.nodeValue).trim());if(t.nodeType===Node.ELEMENT_NODE){const e=t,s=Array.from(e.attributes,t=>` ${t.name}="${t.value}"`).join("");return y.#g(`<${e.localName}${s}>`)}const e=Array.from(t.childNodes).filter(t=>t.nodeType===Node.ELEMENT_NODE||String(t.nodeValue??"").trim().length>0).map(t=>y.describe(t));return y.#g(e.join(""))}static#g(t){return t.length>120?`${t.slice(0,120)}…`:t}static stringify(t){return c.toHtml(y.#b(t.cloneNode(!0)))}static#b(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&&y.#b(s)}return t}}class w{#v=new Map;#y;#w=new Promise(t=>{this.#y=t});#E=Promise.withResolvers();constructor(){Promise.all([p.waitDomContentLoaded(document),this.#E.promise]).then(()=>{this.#x()})}ready(){return this.#w}configured(){this.#E.resolve()}async#x(){await this.settled(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1})),this.#y()}enqueue(t){if(this.#v.has(t))return;const{promise:e,resolve:s}=Promise.withResolvers(),i=p.waitParsed(t).then(()=>t.upgrade()).finally(()=>{this.#v.delete(t),s()});this.#v.set(t,{upgrade:i,finished:e})}async#A(t,e){for(;;){const s=Array.from(this.#v).filter(([e])=>t(e)).map(([,t])=>e(t));if(0===s.length)return;await Promise.all(s)}}settled(){return this.#A(()=>!0,t=>t.finished)}upgraded(t){return this.#A(t,t=>t.upgrade)}whenUpgraded(t){return this.#v.get(t)?.upgrade}pending(){return Array.from(this.#v.keys())}}class E{#S={};#E=!1;#C={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(",")}};#T={};#s;#_=[];#h=new u(void 0,[]);#R=new w;defineElement(t,e){return this.#E?(this.#q(t,e),this):(this.#S[t]=e,this)}static declarationsOf(t){const e=[];for(let s=t;null!==s&&s!==HTMLElement;s=Object.getPrototypeOf(s))e.unshift(s);const s=t=>e.flatMap(e=>Object.getOwnPropertyDescriptor(e,t)?.value??[]);return{observed:s("observed"),attributes:s("attributes")}}static propertyOf(t){return t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}#q(t,e){const{observed:s,attributes:i}=E.declarationsOf(e),{template:r,templates:n,slots:a,mappers:o,config:l}=e,u=s.map(t=>t.split(":")[0]),c=[...new Set(u.reverse())].reverse(),d=[...i,...s].reduce((t,e)=>{const[s,i]=e.split(":"),r=i??"string";if(!(r in this.#C)&&!(r in(o??{})))throw new Error(`unsupported attribute type: ${r}`);return t[s]=o?.[r]??this.#C[r],t},{}),h=Object.entries(Object.assign({},n,r?{default:r}:{})).map(([t,e])=>[t,v.fromHtml(e)]),p=Object.fromEntries(h);e.BITS={registry:this,enqueue:t=>this.#R.enqueue(t),SLOTS:a,CONFIG:l,OBSERVED:c,DECLARED:[...new Set([...c,...i.map(t=>t.split(":")[0])])],ATTR_TO_MAPPER:d,ATTR_TO_PROPERTY:Object.fromEntries(c.map(t=>[t,E.propertyOf(t)])),TEMPLATES:p},customElements.define(t,e)}defineModule(t,e){const s=t?{[t]:e}:e;return this.#s={...this.#s,...s},this.#k(),this}defineModules(t){return this.#s=t,this.#k(),this}defineComponent(t,e){return this.#T[t]=e,this}defineData(...t){return this.#_=t,this.#k(),this}defineOverlay(...t){return this.#_=[...this.#_,...t],this.#k(),this}defineMapper(t,e){return this.#C[t]=e,this}plugin(t){return t.configure(this),this}configure(){for(const[t,e]of Object.entries(this.#S))this.#q(t,e),delete this.#S[t];return this.#E=!0,this.#R.configured(),this}settle(t){return this.#R.upgraded(t)}whenUpgraded(t){return this.#R.whenUpgraded(t)}pending(){return this.#R.pending()}ready(){return this.#R.ready()}#k(){this.#h=new u(this.#s,this.#_)}evaluator(){return this.#h}component(t){return this.#T[t]}}const x=new E;class A{static fromHtml(t){return v.fromHtml(t).withEvaluator(x.evaluator())}static fromSelector(t){return v.fromSelector(t).withEvaluator(x.evaluator())}static fromTemplate(t){return v.fromTemplate(t).withEvaluator(x.evaluator())}static fromFragment(t){return v.fromFragment(t).withEvaluator(x.evaluator())}}class S{static waitFor(t){return x.settle(e=>t.contains(e))}static waitForChildren(t){return x.settle(e=>t!==e&&t.contains(e))}}class C extends HTMLElement{static BITS={registry:x,enqueue:t=>{},SLOTS:!1,CONFIG:void 0,OBSERVED:[],DECLARED:[],ATTR_TO_MAPPER:{},ATTR_TO_PROPERTY:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}constructor(){super(),this.internals=this.attachInternals()}internals;#O=!1;#L=!1;#N=new Set;#P=null;#M={};#F(){return this.constructor.BITS}#z(t){const e=this.#F().ATTR_TO_MAPPER[t];if(!e)throw new Error(`${this.constructor.name} declares no attribute '${t}': declare it in static observed or static attributes, or read it with getAttribute`);return e}unmarshal(t,e){return this.#z(t).unmarshal(e,t,this)}marshal(t,e){return this.#z(t).marshal(e,t,this)}get _registry(){return this.#F().registry}component(t){return this.#F().registry.component(t)}template(t){const e=this.#F().TEMPLATES[t??"default"];if(!e)throw new Error(`no template named '${t??"default"}' on ${this.constructor.name}`);const s=e.withEvaluator(this.#F().registry.evaluator()),i=this.#F().CONFIG;return i?s.withOverlay({config:i}):s}connectedCallback(){this.#L||this.#F().enqueue(this)}attributeChangedCallback(t,e,s){e!==s&&(this.#N.has(t)||(this.#O?this[this.#F().ATTR_TO_PROPERTY[t]]=this.unmarshal(t,s):null!==this.#P&&t in this.#P&&(this.#P[t]=this.unmarshal(t,s))))}async upgrade(){if(this.#L)return;this.#L=!0;const t=this.#F().SLOTS?h.from(this):void 0,e=Object.fromEntries(this.#F().DECLARED.map(t=>[t,this.unmarshal(t,this.getAttribute(t))])),s=new Set(this.#F().OBSERVED);this.#M=Object.fromEntries(Object.entries(e).filter(([t])=>!s.has(t))),this.#P=e;try{await this.render({slots:t});const s=this.#F().ATTR_TO_PROPERTY;for(const t of this.#F().OBSERVED)this[s[t]]=e[t];this.#O=!0,this.internals.states.add("rendered")}finally{this.#P=null}}render(t){}declared(t){return t in this.#M?this.#M[t]:null!==this.#P&&t in this.#P?this.#P[t]:this.unmarshal(t,this.getAttribute(t))}get rendered(){return this.#O}reflectTo(t,e){const s=this.marshal(t,e);if(s!==this.getAttribute(t)){this.#N.add(t);try{d.set(this,t,s)}finally{this.#N.delete(t)}}}}const T=(t,e)=>{const s=t[l.BOUND];return"function"==typeof s?s(e):t[e]},_=/\{(\w+)\}/g,R=/\{(\d+)\}/g,q=t=>"object"==typeof t&&null!==t&&[Object.prototype,null].includes(Object.getPrototypeOf(t)),k=new Set,O=t=>{k.has(t)||(k.add(t),console.warn(`l10n: ${t}`))},L=new e(100),N=(t,e,s)=>{const i=`${t.name}|${e??""}|${void 0===s?"":JSON.stringify(s)}`;return L.getOrCompute(i,()=>new t(e,s))};class P{static t(t,...e){const s=T(this,"l10n")??{};let i=Object.hasOwn(s,t)?s[t]:void 0;if(void 0===i)return O(`missing message "${t}"`),t;const r=1===e.length&&q(e[0])?e[0]:null;if(q(i))if("number"!=typeof r?.count)O(`plural message "${t}" needs a numeric {count}`),i=i.other;else{const t=T(this,"locale")??navigator?.language??"en";i=i[N(Intl.PluralRules,t).select(r.count)]??i.other}return void 0===i||"object"==typeof i?(O(`plural message "${t}" has no "other" form`),t):r?i.replace(_,(e,s)=>Object.hasOwn(r,s)?String(r[s]):(O(`message "${t}" wants {${s}}`),e)):e.length>0?i.replace(R,(s,i)=>{const r=Number(i);return r>=e.length?(O(`message "${t}" wants {${i}}`),s):String(e[r])}):i}static date(t,e){return N(Intl.DateTimeFormat,T(this,"locale"),e).format(t)}static number(t,e){return N(Intl.NumberFormat,T(this,"locale"),e).format(t)}static bytes(t){const e=N(Intl.NumberFormat,T(this,"locale"),{maximumFractionDigits:2}).format;return t>=1073741824?`${e(t/1024/1024/1024)}GiB`:t>=1048576?`${e(t/1024/1024)}MiB`:t>=1024?`${e(t/1024)}KiB`:`${e(t)}B`}static failure(t){return Array.isArray(t?.problems)&&t.problems.length>0?t.problems.map(t=>{return e=t,("string"==typeof e?.reason&&""!==e.reason.trim()?e.reason:void 0)??P.t.call(this,"failure.no-reason");var e}).join("\n"):void 0!==t?.message?String(t.message):null==t?"":String(t)}static of(t={}){const e=t=>x.evaluator().resolve(t),s=s=>(...i)=>s.apply({l10n:e("l10n"),locale:t.locale??e("locale")},i);return{t:s(P.t),date:s(P.date),number:s(P.number),bytes:s(P.bytes),failure:s(P.failure)}}}var M=Object.freeze({__proto__:null,Attributes:d,BoundedCache:e,ExpressionEvaluator:u,Expressions:l,Fragments:c,LightSlots:h,Localization:P,Nodes:p,ParsedElement:C,Registry:E,RenderError:y,Rendering:S,Template:v,Templates:A,registry:x});class F extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new F(this.message,F.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:i,details:r})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:i,details:r}))}}class z{static STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static encode(t,e){const s=e||z.URL_SAFE,i=t.byteLength,r=new Uint8Array(t);let n="";for(let t=0;t<i;t+=3)n+=s[r[t]>>2]+s[(3&r[t])<<4|r[t+1]>>4]+s[(15&r[t+1])<<2|r[t+2]>>6]+s[63&r[t+2]];return i%3==2?n=n.substring(0,n.length-1):i%3==1&&(n=n.substring(0,n.length-2)),n}static decode(t,e){const s=e||z.URL_SAFE;let i=t.length;for(;i>0&&"="===t.charAt(i-1);)--i;const r=t.substring(0,i);if(t.length-i>2||r.includes("=")||0===r.length&&t.length>0)throw new Error("invalid padding");if(r.length%4==1)throw new Error("invalid length");for(const t of r)if(-1===s.indexOf(t))throw new Error(`invalid character '${t}'`);const n=Math.floor(.75*r.length),a=new Uint8Array(n);let o=0,l=0;for(;o<n;){const t=s.indexOf(r.charAt(l++)),e=s.indexOf(r.charAt(l++)),i=s.indexOf(r.charAt(l++)),u=s.indexOf(r.charAt(l++));if(a[o++]=t<<2|e>>4,o===n)break;if(a[o++]=(15&e)<<4|i>>2,o===n)break;a[o++]=(3&i)<<6|u}return a.buffer}}class I{static decode(t){if(t.length%2!=0)throw new Error("invalid length");if(!/^[0-9a-fA-F]*$/.test(t))throw new Error("invalid character");const e=t.length/2;return new Uint8Array(e).map((e,s)=>{const i=2*s,r=t.substring(i,i+2);return parseInt(r,16)})}static encode(t,e){let s=t;return t instanceof ArrayBuffer&&(s=new Uint8Array(t)),ArrayBuffer.isView(t)&&(s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),Array.from(s).map(t=>t.toString(16)).map(t=>e?t.toUpperCase():t).map(t=>t.padStart(2,"0")).join("")}}class D{#I;#D;constructor(t,e){this.#I=t,this.#D=e}get normalized(){return`${this.#I}/${this.#D}`}get type(){return this.#I}get subtype(){return this.#D}static parse(t){if(!t)return new D("unknown","unknown");const[e,s]=t.split(";"),[i,r]=e.trim().toLowerCase().split("/");return i&&r?new D(i,r):new D("unknown","unknown")}}class $ extends F{constructor(t,e,s,i){super(t,s,i),this.name="HttpClientError",this.status=e}dropping(t){return new $(this.message,this.status,F.dropProblemsContext(this.problems,t),this)}static problem(t,e){return{type:t,context:null,reason:e,details:null}}static of(t,e){const s=String(e?.message??e??"unknown failure");return new $(s,0,[$.problem(t,s)],e)}static async fromResponse(t){switch(D.parse(t.headers.get("Content-Type")).normalized){case"application/failures+json":{const e=await t.json().catch(()=>$.#$);if(e===$.#$)return $.#B(t);if(!Array.isArray(e))return $.#B(t,"does not decode as a failures array");if(0===e.length)return $.#B(t,"carries no failures");const s=`${t.status} ${t.statusText}: ${e.length} failures`;return new $(s,t.status,e)}case"application/problem+json":{const e=await t.json().catch(()=>$.#$);if(e===$.#$)return $.#B(t);if("object"!=typeof e||null===e||Array.isArray(e))return $.#B(t,"does not decode as a problem object");const s=[e.title,e.detail].filter(t=>null!=t).join(" "),i=s?`${t.status} ${t.statusText}: ${s}`:`${t.status} ${t.statusText}`;return new $(i,t.status,Array.isArray(e.problems)&&e.problems.length>0?e.problems:[$.problem("GENERIC_PROBLEM",i)])}default:return $.#j(t)}}static#$=Symbol("unreadable body");static#B(t,e="does not decode as json"){const s=D.parse(t.headers.get("Content-Type")).normalized,i=`${t.status} ${t.statusText}: the ${s} body ${e}`;return new $(i,t.status,[$.problem("GENERIC_PROBLEM",i)])}static async#j(t){const e=await t.text().catch(()=>null),s=null===e?`${t.status} ${t.statusText}: the body could not be read`:`${t.status} ${t.statusText}: ${e}`;return new $(s,t.status,[$.problem("GENERIC_PROBLEM",s)])}}const B=t=>globalThis.document?.querySelector(`meta[name="${t}"]`)?.getAttribute("content")??void 0;class j{async intercept(t,e,s){if(t.origin!==(globalThis.window?.location?.origin??t.origin))return await s.proceed(t,e);const i=B("_csrf_header"),r=B("_csrf");return i&&r&&e.headers.set(i,r),await s.proceed(t,e)}}class H{#H;constructor(t){this.#H=t}async intercept(t,e,s){const i=await s.proceed(t,e);return 401===i.status?(window.location.href=this.#H,new Promise(()=>{})):i}}class V{#V;constructor(){this.#V=[]}withCsrfToken(){return this.#V.push(new j),this}withRedirectOnUnauthorized(t){return this.#V.push(new H(t)),this}withInterceptors(...t){return this.#V.push(...t),this}build(){return new G([...this.#V])}}class W{async intercept(t,e,s){try{return await fetch(t,e)}catch(t){throw $.of("CONNECTION_PROBLEM",t)}}}class U{#V;#W;constructor(t,e){this.#V=t,this.#W=e}async proceed(t,e){const s=this.#V[this.#W];return await s.intercept(t,e,new U(this.#V,this.#W+1))}}class G{#V;static builder(){return new V}constructor(t){this.#V=t||[]}async exchange(t,e,s){const i=[...this.#V,...s||[],new W],r=new U(i,0),n=new URL(new Request(t).url),a={...e,headers:new Headers(e?.headers)};return await r.proceed(n,a)}request(t,e){return J.create(this,t,e)}get(t){return J.create(this,"GET",t)}head(t){return J.create(this,"HEAD",t)}post(t){return J.create(this,"POST",t)}put(t){return J.create(this,"PUT",t)}patch(t){return J.create(this,"PATCH",t)}delete(t){return J.create(this,"DELETE",t)}}const Q=async(t,e)=>{try{return await t[e]()}catch(t){throw $.of("UNMARSHALING_PROBLEM",t)}},K=t=>null==t?[]:"string"==typeof t?new URLSearchParams(t):"function"==typeof t[Symbol.iterator]?t:Object.entries(t);class J{#U;#G;#Q;#K;#J;#X;#Y;#V;#d;static create(t,e,s){const i=s.indexOf("#"),r=-1===i?"":s.slice(i),n=-1===i?s:s.slice(0,i),a=n.indexOf("?");return new J(t,e,-1===a?n:n.slice(0,a),new URLSearchParams(-1===a?"":n.slice(a+1)),new Headers,void 0,{},[],r)}constructor(t,e,s,i,r,n,a,o,l=""){this.#U=t,this.#G=e,this.#Q=s,this.#K=i,this.#X=n,this.#J=r,this.#Y=a,this.#V=o,this.#d=l}headers(t){for(const[e,s]of K(t))this.header(e,s);return this}header(t,e){return null==e?this.#J.delete(t):this.#J.set(t,e),this}params(t){for(const[e,s]of K(t))null==s?this.#K.delete(e):this.#K.set(e,s);return this}param(t,...e){this.#K.delete(t);for(const s of e.filter(t=>null!=t))this.#K.append(t,s);return this}body(t){return this.#X=t,this}json(t){if(void 0===t)return this;const e=JSON.stringify(t);return this.#J.set("Content-Type","application/json"),this.#X=e,this}multipart(t){const e=new FormData;return t(new X(e)),this.#X=e,this}options(t){for(const[e,s]of Object.entries(t))this.#Y[e]=s;return this}option(t,e){return this.#Y[t]=e,this}interceptors(t){for(const e of t)this.#V.push(e);return this}interceptor(t){return this.#V.push(t),this}async exchange(){const t=this.#K.size?`?${this.#K}`:"",e={...this.#Y,headers:this.#J,method:this.#G,body:this.#X};return await this.#U.exchange(`${this.#Q}${t}${this.#d}`,e,this.#V)}async fetch(){try{const t=await this.exchange();if(!t.ok)throw await $.fromResponse(t);return t}catch(t){if(t instanceof F)throw t;throw $.of("UNEXPECTED_PROBLEM",t)}}async fetchText(){const t=await this.fetch();return await Q(t,"text")}async fetchJson(){const t=await this.fetch();return 204===t.status?null:await Q(t,"json")}async fetchBlob(){const t=await this.fetch();return await Q(t,"blob")}async fetchArrayBuffer(){const t=await this.fetch();return await Q(t,"arrayBuffer")}}class X{#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 i=new Blob([JSON.stringify(e)],{type:"application/json"});return this.#Z.append(t,i,s),this}}var Y=Object.freeze({__proto__:null,Base64:z,Failure:F,Hex:I,HttpClient:G,HttpClientBuilder:V,HttpClientError:$,HttpInterceptorChain:U,HttpMultipartRequestCustomizer:X,HttpRequestBuilder:J,MediaType:D});const Z=t=>{const e=e=>{try{t().removeItem(e)}catch{}},s=s=>{let i;try{i=t().getItem(s)}catch{return}if(null!==i)try{return JSON.parse(i)}catch{return void e(s)}};return{save:(e,s)=>{t().setItem(e,JSON.stringify(s))},load:s,remove:e,pop:t=>{const i=s(t);return e(t),i}}},tt=t=>({save(e,s,i){t.save(e,{revision:s,data:i})},load(e,s){const i=t.load(e);if(null!=i&&"object"==typeof i&&i.revision===s)return i.data;t.remove(e)}}),et=Z(()=>localStorage),st=Z(()=>sessionStorage),it=tt(et),rt=tt(st);class nt{static async fireAsync(t,e,s){t.dispatchEvent(e);const i=e.async?.promises??[],r=s?.mode??"broadcast";if("pipeline"===r&&i.length>1||"delegate"===r&&1!==i.length)throw Promise.all(i).catch(()=>{}),new Error("pipeline"===r?`[AsyncEvents] Event "${e.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${i.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${e.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${i.length} were registered.`);return"broadcast"===r?Promise.all(i):Promise.resolve(i[0])}static asyncOn(t,e,s,i){const r=async t=>{const e=t;e.async||(e.async={promises:[]});const{promise:i,resolve:r,reject:n}=Promise.withResolvers();e.async.promises.push(i);try{r(await s(e))}catch(t){n(t)}};return t.addEventListener(e,r,i),r}static asyncOff(t,e,s,i){t.removeEventListener(e,s,i)}static mixInto(...t){for(const e of t)Object.assign(e.prototype,{async fireAsync(t,e){return await nt.fireAsync(this,t,e)},asyncOn(t,e,s){return nt.asyncOn(this,t,e,s)},asyncOff(t,e,s){nt.asyncOff(this,t,e,s)}})}}class at{static guard(t,e){window.addEventListener("beforeunload",e=>{t()&&e.preventDefault()},{signal:e})}}class ot{#tt=0;take(){return++this.#tt,this.hold()}hold(){const t=this.#tt,e=this;return{get stale(){return t!==e.#tt}}}invalidate(){++this.#tt}}const lt=t=>{for(let e=t.parentElement;e;e=e.parentElement)if("function"==typeof e.describedBy)return e;return null};class ut{static sleep(t){return new Promise(e=>setTimeout(e,t))}static debounce(t,e,s){const i=s?.immediate??!1;let r=null,n=[],a=0;const o=()=>{const s=performance.now()-a;t>s?r=setTimeout(o,t-s):(r=null,i||e(...n),null===r&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===r&&(r=setTimeout(o,t),i&&e(...n))},()=>{clearTimeout(r??void 0),r=null,n=[]}]}static throttle(t,e,s){const i=s?.leading??!0,r=s?.trailing??!0;let n=null,a=[],o=0;const l=()=>{o=i?performance.now():0,n=null,e(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();o||i||(o=u);const c=0===o?0:t-(u-o);a=s,c<=0||c>t?(null!==n&&(clearTimeout(n),n=null),o=u,e(...a),null===n&&(a=[])):null===n&&r&&(n=setTimeout(l,c))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class ct{static flatten(t,e,s){return Object.keys(t).reduce((i,r)=>{const n=e.length?`${e}.${r}`:r;return s.has(n)||"object"!=typeof t[r]||null===t[r]?i[n]=t[r]:Object.assign(i,ct.flatten(t[r],n,s)),i},{})}static#et=new Set(["__proto__","prototype","constructor"]);static providePath(t,e,s){const i=e.split(".").map(t=>/^[0-9]+$/.test(t)?+t:t);for(const t of i)if(ct.#et.has(t))throw new Error(`unsupported name segment '${t}' in '${e}'`);let r=t??{},n=null;for(let e=0;;++e){const a=i[e],o=i[e-1];if(Number.isInteger(a)&&!Array.isArray(r)&&(null!==n?n[o]=r=[]:t=r=[]),e===i.length-1)return r[a]=void 0!==s?s:a in r?r[a]:null,t;"object"==typeof r[a]&&null!==r[a]||(r[a]={}),n=r,r=r[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:"SELECT"===t.tagName&&t.multiple?Array.from(t.selectedOptions).map(t=>t.value):"INPUT"!==t.tagName&&"SELECT"!==t.tagName&&"TEXTAREA"!==t.tagName||""!==t.value&&void 0!==t.value?t.value:null}static#st(t){return"submit"===t.type||"reset"===t.type||"button"===t.type}static extractFrom(t,e){let s={};for(const i of t.elements)i.hasAttribute("name")&&(ct.#st(i)&&i!==e||i.matches(":disabled")&&i!==e||(s=ct.providePath(s,i.getAttribute("name"),ct.extract(i))));return s}static mutate(t,e){if("radio"!==t.getAttribute("type"))if("checkbox"!==t.getAttribute("type")){if("SELECT"===t.tagName&&t.multiple){const s=Array.isArray(e)?e.map(String):null==e?[]:[String(e)];return void Array.from(t.options).forEach(t=>{t.selected=s.includes(t.value)})}t.value=e}else t.checked=e;else t.checked=null!=e&&t.getAttribute("value")===String(e)}static mutateIn(t,e){const s=ct.#it(t);for(const[t,i]of Object.entries(ct.flatten(e,"",new Set(s.keys()))))for(const e of s.get(t)??[])ct.mutate(e,i)}static#it(t){const e=new Map;for(const s of t.elements){const t=s.getAttribute("name");if(!t)continue;const i=e.get(t);i?i.push(s):e.set(t,[s])}return e}static errors(t,e,s){const i=e=>e.closest("form")===t;Array.from(t.querySelectorAll("ful-field-error")).filter(i).forEach(t=>{t.setAttribute("aria-live",s?"off":"polite")});const r=t=>("FIELD_ERROR"===t.type||"INVALID_FORMAT"===t.type)&&t.context,n=e.filter(r),a=e.filter(t=>!r(t)),o=ct.#it(t);for(const t of o.values())t.forEach(t=>{t.setCustomValidity?.("")});const l=[],u=new Map;n.forEach(t=>{const e=t.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=e.length;0!==s;--s){const i=e.slice(0,s).join("."),r=(o.get(i)??[]).filter(t=>"function"==typeof t.setCustomValidity);if(0===r.length)continue;const n=e.slice(s).join(".");return void r.forEach(e=>{const s=u.get(e)??new Map;s.set(n,[...s.get(n)??[],t.reason]),u.set(e,s)})}l.push(t)});for(const[t,e]of u)for(const[s,i]of e)t.setCustomValidity(i.join("\n"),s);const c=[...a,...l];t.querySelectorAll("ful-errors").forEach(t=>{if(!i(t))return;const e=t;if(t.setAttribute("role","alert"),0===c.length)return t.replaceChildren(),void t.setAttribute("hidden","");t.removeAttribute("hidden"),e.innerText=c.map(t=>t.reason).join("\n")}),0!==e.length&&s&&Array.from(t.elements).filter(t=>"fieldset"!==t.localName&&t.matches(":invalid")).sort((t,e)=>t.getBoundingClientRect().y-e.getBoundingClientRect().y)[0]?.focus()}}class dt extends C{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#rt;#nt=null;#at;#ot=[];#lt=null;#ut;#ct;#dt;#ht=[];#pt=null;#ft=null;constructor(){super(),this.internals.role=this.constructor.ROLE}#mt(){return[this.#ct??this.#rt,...this.#ht].filter(t=>t)}#gt({fragment:t,control:e,error:s,label:i=null,described:r=null,claims:n=null,announces:a=e,freeze:o=null,also:l=[]}){if(this.#rt=e,this.#ut=s,this.#ct=n,this.#dt=a,this.#ht=l,o&&o.addEventListener("click",t=>{this.readonly&&t.preventDefault()},!0),this.#at=r??e,s&&(s.id=s.id||d.uid("ful-field-error"),this.#lt=s.id),this.#bt(),i&&dt.#vt(this,i,e),this.addEventListener("keydown",t=>{if("Enter"!==t.key||t.defaultPrevented||t.isComposing)return;const e=t.target;e.form!==this.form&&dt.#yt(e)&&this._requestSubmit()}),this.replaceChildren(t),null!==this.#nt){const t=this.#nt;this.#nt=null,e.focus(t)}if(null!==this.#ft){const{error:t,context:e}=this.#ft;this.#ft=null,this.setCustomValidity(t,e)}}static#yt(t){return t instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(t.type)}describedBy(t){return!!t&&(t.id||(t.id=d.uid("ful-described")),this.#ot.includes(t.id)||this.#ot.push(t.id),this.#bt(),!0)}#bt(){if(!this.#at)return;const t=[...this.#ot,this.#lt].filter(t=>t);t.length&&this.#at.setAttribute("aria-describedby",t.join(" "))}focus(t){this.#rt?this.#rt.focus(t):this.#nt=t??{}}setCustomValidity(t,e){if(this.#ut){if(d.set(this.#dt??this.#rt,"aria-invalid",t?"true":null),!t)return this.internals.setValidity({}),void(this.#ut.innerText="");this.internals.setValidity({customError:!0}," "),this.#ut.innerText=t}else this.#ft=t?{error:t,context:e}:null}get form(){return this.internals.form}_requestSubmit(){const t=this.form;if(!t)return;const e=t.querySelectorAll("button:not(:disabled), input:not(:disabled)");t.requestSubmit([...e].find(e=>"submit"===e.type&&e.form===t))}_notifyChange(t={}){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value,...t}}))}static#wt=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#vt(t,e,s){if(!dt.#wt.has(s.tagName)||"hidden"===s.getAttribute("type"))return e.id||(e.id=d.uid("ful-label")),s.setAttribute("aria-labelledby",e.id),void e.addEventListener("click",()=>t.focus());s.id||(s.id=d.uid("ful-control")),e.setAttribute("for",s.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}async upgrade(){if(await super.upgrade(),null===this.#pt)return;const{value:t}=this.#pt;this.#pt=null,this.value=t}_holdValue(t){this.#pt={value:t}}_heldValue(){return null===this.#pt?this.declared("value"):this.#pt.value}get value(){}set value(t){}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.reflectTo("disabled",t);for(const e of this.#mt())e.toggleAttribute("disabled",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){for(const e of this.#mt())e.readOnly=t;this.#dt&&d.set(this.#dt,"aria-readonly",t?"true":null),this.reflectTo("readonly",t)}get required(){return this.hasAttribute("required")}set required(t){this.#dt&&d.set(this.#dt,"aria-required",t?"true":null),this.reflectTo("required",t)}render(t){t.slots?.default&&c.isBlank(t.slots.default)&&t.slots.default.replaceChildren();const e=this._build(t);if(e instanceof Promise)return e.then(t=>this.#gt(t));this.#gt(e)}_build(t){throw new Error(`${this.constructor.name} must implement _build`)}}class ht{#Et;#xt;#G;#At;#St;constructor(t,e,s,i,r){this.#Et=t,this.#xt=e,this.#G=s,this.#At=i,this.#St=r}prepare(t,e){return this.#At(t,e)}async submit(t,e){return await this.#Et.request(this.#G,this.#xt).json(t).fetch()}transform(t,e){return this.#St(t,e)}}class pt{#At;#St;constructor(t,e){this.#At=t,this.#St=e}async prepare(t,e){return await this.#At(t,e)}async submit(t,e,s){return s}async transform(t,e){return await this.#St(t,e)}}class ft{static create(t,e){const s=t.component("http-client"),i=t.declared("request-mapper")?t.component(t.declared("request-mapper")):t=>t,r=t.declared("response-mapper")?t.component(t.declared("response-mapper")):t=>t,n=t.declared("action");if(!n)return new pt(i,r);const a=t.declared("method")??"POST";return new ht(s,n,a,i,r)}}const mt=t=>void 0!==t.form?t.form:t.constructor?.formAssociated?t.internals?.form:void 0;class gt extends C{static attributes=["action","method","loader","request-mapper","response-mapper","clear-invalid-on-change:presence","scroll-on-error:presence","autocomplete","track-changes:presence","guard-leave:presence"];form;render(){const t=document.createElement("form");this.form=t,t.setAttribute("novalidate",""),d.set(t,"autocomplete",this.declared("autocomplete")),d.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.addEventListener("click",t=>{const e=t.target;e.closest?.('[aria-disabled="true"]')&&(t.preventDefault(),t.stopImmediatePropagation())},!0),this.declared("clear-invalid-on-change")&&this.addEventListener("change",t=>{mt(t.target)===this.form&&t.target.setCustomValidity?.("")}),this.replaceChildren(t),this.#Ct=this.declared("track-changes")||this.declared("guard-leave"),this.#Ct&&(this.addEventListener("input",t=>this.#Tt(t.target)),this.addEventListener("change",t=>this.#Tt(t.target)),this.addEventListener("focusin",t=>this.#_t(t.target)),this.form.addEventListener("reset",t=>{if(t.target===this.form){for(const t of new Set([...this.#Rt.keys(),...this.#qt().keys()]))this.#kt.set(t,++this.#Ot);0===this.#Lt&&(this.#Lt=requestAnimationFrame(()=>this.#Nt()))}}),S.waitForChildren(this).catch(()=>{}).then(()=>this.commit()),this.#Pt())}connectedCallback(){super.connectedCallback(),this.#Ct&&this.#Pt()}disconnectedCallback(){this.#Mt?.abort(),this.#Mt=null}#Ft=!1;async submit(t){if(this.#Ft)return!1;let e,s,i;this.#Ft=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);e=ct.extractFrom(this.form,t);const n=this.#Ct?{saved:this.#qt(),upTo:this.#Ot}:null;s=await r.prepare(e,this);const a=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:t,values:e,request:s}});if(!this.dispatchEvent(a))return!1;this.errors=[];const o=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:a.detail.values,request:a.detail.request}});let l=await nt.fireAsync(this,o,{mode:"pipeline"});s=o.detail.request,l=await r.submit(s,this,l);const u=await r.transform(l,this);n&&this.#zt(n.saved,n.upTo),i=new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,response:u}})}catch(r){i=new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,exception:r}}),r instanceof F?this.errors=r.problems:console.warn("failed to submit form",this,"reason:",r)}finally{this.#Ft=!1,this.spinner(!1)}return this.dispatchEvent(i),"submit:success"===i.type}async save(t){return!(!this.#Ct||this.dirty)||await this.submit(t)&&!this.dirty}reset(){this.form.reset(),this.#Ct&&this.#Nt()}#Rt=new Map;#It=new Map;#kt=new Map;#Ot=0;#Dt=!1;#Lt=0;#Mt=null;#Ct=!1;get dirty(){if(!this.#Ct)return!1;for(const t of this.#kt.keys()){const e=this.#$t(t);if((this.#Rt.has(t)||"[]"!==e)&&(this.#Rt.get(t)??this.#It.get(t))!==e)return!0}return!1}commit(){this.#Ct&&this.#zt(this.#qt(),this.#Ot)}edited(...t){for(const e of t)this.#Tt(e)}#zt(t,e){this.#Rt=t;for(const[t,s]of this.#kt)s<=e&&this.#kt.delete(t);for(const e of this.#It.keys())t.has(e)&&this.#It.delete(e);this.#Nt()}#Bt(t){for(let e=t;e&&e!==this;e=e.parentElement)if(mt(e)===this.form&&e.hasAttribute("name"))return e.getAttribute("name");return null}#Tt(t){if(!this.#Ct)return;const e=this.#Bt(t);null!==e&&(this.#kt.set(e,++this.#Ot),0===this.#Lt&&(this.#Lt=requestAnimationFrame(()=>this.#Nt())))}#_t(t){const e=this.#Bt(t);null===e||this.#Rt.has(e)||this.#It.has(e)||this.#It.set(e,this.#$t(e))}#jt(){return Array.from(this.form.elements).filter(t=>t.hasAttribute("name")&&!["submit","reset","button"].includes(t.type)&&!t.matches(":disabled"))}#qt(){const t=new Map;for(const e of this.#jt()){const s=e.getAttribute("name");t.set(s,[...t.get(s)??[],ct.extract(e)])}return new Map(Array.from(t,([t,e])=>[t,JSON.stringify(e)]))}#$t(t){return JSON.stringify(this.#jt().filter(e=>e.getAttribute("name")===t).map(t=>ct.extract(t)))}#Nt(){cancelAnimationFrame(this.#Lt),this.#Lt=0;const t=this.dirty;this.querySelectorAll("button").forEach(e=>{const s=e;s.form===this.form&&"submit"===s.type&&s.toggleAttribute("data-ful-dirty",t)}),t!==this.#Dt&&(this.#Dt=t,t?this.internals.states.add("dirty"):this.internals.states.delete("dirty"),this.dispatchEvent(new CustomEvent("dirty:change",{bubbles:!0,cancelable:!1,detail:{dirty:t}})))}#Pt(){this.declared("guard-leave")&&!this.#Mt&&(this.#Mt=new AbortController,at.guard(()=>this.dirty,this.#Mt.signal))}#Ht=0;#Vt(t){if(d.defaultValue(t,"role","status"),t.hidden=!1,""!==t.textContent.trim())return;const e=document.createElement("span");e.className="ful-sr-only",e.dataset.ref="spinner-label",t.append(e),e.textContent=P.of().t("spinner.loading")}spinner(t){if(t){if(++this.#Ht,1!==this.#Ht)return}else if(this.#Ht=Math.max(0,this.#Ht-1),0!==this.#Ht)return;d.set(this,"aria-busy",t?"true":null),this.querySelectorAll("ful-spinner").forEach(e=>{if(e.closest("form")!==this.form)return;const s=e;t?this.#Vt(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(e=>{const s=e;if(s.form===this.form&&("submit"===s.type||"reset"===s.type))if(t)s.dataset.wd=s.getAttribute("aria-disabled")??"",s.setAttribute("aria-disabled","true");else{if(void 0===s.dataset.wd)return;d.set(s,"aria-disabled",s.dataset.wd||null),delete s.dataset.wd}})}set values(t){ct.mutateIn(this.form,t)}get values(){return ct.extractFrom(this.form)}set errors(t){ct.errors(this.form,t,this.declared("scroll-on-error"))}}const bt=new e(100),vt=(t,e)=>bt.getOrCompute(`${t}:${e}`,()=>{try{return new RegExp(e,"g")}catch(s){return console.warn(`invalid ${t} attribute`,e,s),null}}),yt={numeric:"numeric",decimal:"decimal"},wt=new Set(["date","time","datetime-local","month","week"]),Et={numeric:t=>t.replace(/\D/g,""),decimal:t=>{const e=t.replace(/[^\d.,]/g,""),s=e.search(/[.,]/);return-1===s?e:e.slice(0,s+1)+e.slice(s+1).replace(/[.,]/g,"")}};class xt extends dt{static observed=["placeholder"];static attributes=["type","v-type","keep","reject","uppercase:presence","trim:presence","unsigned:presence","autocomplete"];static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-if="type != \'textarea\'" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" placeholder=" " form=""></textarea>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_input;#Wt=[];#Ut=null;_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:t}){const e=this._type(),s=yt[e],i=s?"text":e,r=this.template().withOverlay({type:i,slots:t}).render();this.#Wt=[...r.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#Wt[0];const n=this.declared("autocomplete")??(this.closest("form")?.getAttribute("autocomplete")??null);const a=(t=>{const e=t.declared("keep"),s=t.declared("reject");if(null!==e&&null!==s&&console.warn("a ful-input declares both keep and reject: keep is applied, reject is ignored",t),null!==e){const t=vt("keep",e);return t&&(e=>(e.match(t)??[]).join(""))}if(null!==s){const t=vt("reject",s);return t&&(e=>e.replace(t,""))}return((t,e)=>{const s=Et[t];return s?e?s:t=>((t,e)=>(t.startsWith("-")?"-":"")+e(t))(t,s):null})(t._type(),t.declared("unsigned"))})(this);for(const t of this.#Wt)this.#Gt(t,s,n,a);return{fragment:r,control:this._input,error:r.querySelector("ful-field-error"),label:r.querySelector("label")}}#Gt(t,e,s,i){e&&d.set(t,"inputmode",e),d.set(t,"autocomplete",s);const r=t.id;d.forward("input-",this,t),t!==this._input&&d.set(t,"id",r||null),this.#Qt(t),t.addEventListener("input",()=>{if(!i)return;const e=t.value,s=i(e);if(e===s)return;const r=t.selectionStart;if(t.value=s,null===r)return;const n=i(e.slice(0,r)).length;t.setSelectionRange(n,n)})}#Qt(t){if(!wt.has(t.type))return void t.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});let e=!1;const s=()=>{e=!1;const t=JSON.stringify(this.value);t!==this.#Ut&&(this.#Ut=t,this._notifyChange())};t.addEventListener("focus",()=>{this.#Ut=JSON.stringify(this.value)}),t.addEventListener("keydown",t=>{"Enter"!==t.key||t.isComposing?e=!0:s()}),t.addEventListener("blur",s),t.addEventListener("change",t=>{t.stopPropagation(),e||s()})}get value(){const t=this.declared("uppercase"),e=this.declared("trim"),s=this._input?this._input.value:`${this._heldValue()??""}`,i=t?s.toUpperCase():s,r=e?i.trim():i;if(""===r)return null;const n="decimal"===this._type()?r.replaceAll(",","."):r;if("number"===this.declared("v-type")){const t=Number(n);return Number.isNaN(t)?n:t}return n}set value(t){this._input?(this._input.value=""===t||null==t?"":`${t}`,this.#Ut=JSON.stringify(this.value)):this._holdValue(t)}get placeholder(){const t=this._input.getAttribute("placeholder");return" "===t?null:t}set placeholder(t){for(const e of this.#Wt)d.set(e,"placeholder",t??" ");this.reflectTo("placeholder",t)}}const At=t=>""===t?null:t,St=t=>{const[e,s,i]=t.split("-").map(Number),r=new Date(0);return r.setFullYear(e,s-1,i),r.setHours(0,0,0,0),r.getFullYear()===e&&r.getMonth()===s-1&&r.getDate()===i?r:new Date(Number.NaN)};class Ct extends C{static attributes=["locale","default"];render(){const t=St(this.textContent.trim());if(Number.isNaN(t.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:e}=P.of({locale:this.declared("locale")??void 0});this.replaceChildren(e(t,{year:"numeric",month:"numeric",day:"numeric"}))}}class Tt extends C{static attributes=["locale","default"];render(){const t=this.textContent.trim(),e=""===t?null:new Date(Tt.isoToLocal(t));if(null===e||Number.isNaN(e.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=P.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#Kt(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?St(t):new Date(t)}static isoToLocal(t){const e=Tt.#Kt(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())}`}static localToIso(t){const e=Tt.#Kt(t);return Number.isNaN(e.getTime())?null:e.toISOString()}}class _t extends xt{static observed=["step","min","max"];_type(){return"date"}get min(){return At(this._input.min)}set min(t){this._input.min=_t.#Jt(t)}get max(){return At(this._input.max)}set max(t){this._input.max=_t.#Jt(t)}get step(){return At(this._input.step)}set step(t){this._input.step=t??""}static#Jt(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 i="-"===s[1]?-1:1,r=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+r*i);break;case"m":{const t=n.getDate();n.setMonth(n.getMonth()+r*i),n.getDate()!==t&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+r*i)}return e(n)}}class Rt extends _t{_type(){return"time"}get min(){return At(this._input.min)}set min(t){this._input.min=this.#Xt(t)}get max(){return At(this._input.max)}set max(t){this._input.max=this.#Xt(t)}#Xt(t){if(!t)return"";const e=new Date;if("now"!==t){const s=/^([+-])(\d+)([hm])$/.exec(t);if(!s)return t;const i="-"===s[1]?-1:1,r=+s[2]*i;"h"===s[3]?e.setHours(e.getHours()+r):e.setMinutes(e.getMinutes()+r)}return Rt.#Yt(e,Number(this._input.step)||60)}static#Yt(t,e){const s=t=>String(t).padStart(2,"0"),i=3600*t.getHours()+60*t.getMinutes()+t.getSeconds(),r=Math.floor(i/e)*e,n=s(Math.floor(r/3600)),a=s(Math.floor(r%3600/60));return e%60==0?`${n}:${a}`:`${n}:${a}:${s(r%60)}`}}class qt extends xt{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){if(!this._input){const t=this._heldValue();return Tt.localToIso(t?Tt.isoToLocal(t):"")}return Tt.localToIso(this._input.value)}set value(t){this._input?super.value=t?Tt.isoToLocal(t):"":this._holdValue(t)}get min(){return Tt.localToIso(this._input.min)}set min(t){this._input.min=t?Tt.isoToLocal(t):""}get max(){return Tt.localToIso(this._input.max)}set max(t){this._input.max=t?Tt.isoToLocal(t):""}get step(){return At(this._input.step)}set step(t){this._input.step=t??""}}class kt extends xt{static WARNING_TIMEOUT=5e3;static list(t=[]){const e=new DataTransfer;for(const s of t)e.items.add(s);return e.files}static observed=["placeholder","accept:csv","multiple:presence","item-list:presence","dropzone:presence","no-input:presence","max-files:number","max-file-size:number","max-total-size:number","value"];#Zt;#te;#ee;#se;#ie;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#re;_build(t){const e=super._build(t),s=e.fragment;return this.#te=s.querySelector("ful-item-list"),this.#re=t.slots?.items&&!c.isBlank(t.slots.items)?A.fromFragment(t.slots.items):null,this.#ee=s.querySelector("[data-ref=dropzone]"),this.#se=s.querySelector("ful-field-warnings"),this.#ie=s.querySelector("ful-control-group"),this.#se.addEventListener("animationend",t=>{t.target.remove()}),this.#te.addEventListener("click",t=>{if(!t.target.closest("button"))return;if(!this._interactive())return;const e=[...this.#te.children].indexOf(t.target.closest("ful-item"));-1!==e&&(this.files=kt.list([...this.files].filter((t,s)=>s!==e)),this._notifyChange())}),this.#ee.addEventListener("click",t=>{this._interactive()&&this._input.click()}),this.#ee.addEventListener("dragover",t=>{t.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#ee.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#ee.addEventListener("drop",t=>{if(t.preventDefault(),this.toggleAttribute("dragover",!1),!this._interactive())return;const e=[...t.dataTransfer.items].filter(t=>"file"===t.kind).map(t=>t.getAsFile()).filter(t=>null!==t);0===e.length||e.length>1&&!this.multiple||(this.files=kt.list(e),this._notifyChange())}),this._input.addEventListener("change",()=>{this.#ne()},{capture:!0}),{...e,freeze:this.#ie}}#ne(){this.setCustomValidity(),this.#se.replaceChildren(),this.#ae(),this.#oe(),this.#le(),this.#ue(),(this.#re??this.template("items")).withOverlay({files:this.files}).renderTo(this.#te)}warning(t,e){this.template("warning").withOverlay({key:t,args:e}).appendTo(this.#se);const s=this.#se.lastElementChild;setTimeout(()=>s.remove(),kt.WARNING_TIMEOUT)}#ce(t){const e=t.name.toLowerCase();return this.#Zt.some(s=>{const i=s.toLowerCase().split(";")[0].trim();return i.startsWith(".")?e.endsWith(i):i.endsWith("/*")?t.type.startsWith(`${i.slice(0,-1)}`):i.includes("/")&&t.type===i})}#ae(){if(!this.#Zt.length)return;const t=[...this.files].filter(t=>!this.#ce(t));0!==t.length&&(this.warning("files.unacceptable-file-type",{types:this.#Zt.join(", ")}),this._input.files=kt.list([...this.files].filter(e=>!t.includes(e))))}#ue(){null!==this.#de&&(this.files.length<=this.#de||(this.warning("files.max-files-exceeded",{count:this.#de}),this._input.files=kt.list()))}#oe(){if(null===this.#he)return;const t=[...this.files].filter(t=>t.size>this.#he);0!==t.length&&(this.warning("files.max-file-size-exceeded",{size:P.of().bytes(this.#he)}),this._input.files=kt.list([...this.files].filter(e=>!t.includes(e))))}#le(){null!==this.#pe&&([...this.files].reduce((t,e)=>t+e.size,0)<=this.#pe||(this.warning("files.max-total-size-exceeded",{size:P.of().bytes(this.#pe)}),this._input.files=kt.list()))}get accept(){return this.#Zt}set accept(t){this._input.accept=t.join(","),this.#Zt=t,this.reflectTo("accept",t)}get multiple(){return this._input?this._input.multiple:this.declared("multiple")}set multiple(t){this._input.multiple=t,this.reflectTo("multiple",t)}get files(){return this._input?this._input.files:kt.list()}set files(t){this._input.files=t,this.#ne()}get file(){return this.files[0]??null}set file(t){this.files=kt.list(t?[t]:[])}get value(){const t=Array.from(this.files).map(t=>t.name);return this.multiple?t:t[0]??null}set value(t){!t&&this._input&&(this.files=kt.list())}formResetCallback(){this.value=null}get totalSize(){return Array.from(this.files).reduce((t,e)=>t+e.size,0)}#de;get maxFiles(){return this.#de}set maxFiles(t){this.#de=t,this.reflectTo("max-files",t)}#he;get maxFileSize(){return this.#he}set maxFileSize(t){this.#he=t,this.reflectTo("max-file-size",t)}#pe;get maxTotalSize(){return this.#pe}set maxTotalSize(t){this.#pe=t,this.reflectTo("max-total-size",t)}#fe;get itemList(){return this.#fe}set itemList(t){this.#fe=t,this.reflectTo("item-list",t)}#me;get dropzone(){return this.#me}set dropzone(t){this.#me=t,this.reflectTo("dropzone",t)}#ge;get noInput(){return this.#ge}set noInput(t){this.#ge=t,this.reflectTo("no-input",t)}}const Ot=new Map;let Lt=0,Nt=!1;const Pt=(t,e,s)=>Math.min(Math.max(t,e),Math.max(e,s)),Mt=(t,e)=>{const{invoker:s,stretch:i}=e,r=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,o=n.clientHeight;t.style.removeProperty("margin");const l=getComputedStyle(t),u=parseFloat(l.marginTop)||0,c=parseFloat(l.marginRight)||0,d=parseFloat(l.marginBottom)||0,h=parseFloat(l.marginLeft)||0;if(t.style.right="auto",t.style.bottom="auto",t.style.margin="0",i){t.style.removeProperty("width"),t.style.removeProperty("min-width"),t.style.removeProperty("max-width");const e=Math.min(parseFloat(l.maxWidth)||a,a-16);t.style.minWidth=`${Math.min(r.width,a-16)}px`,t.style.maxWidth=`${e}px`;const s=t.getBoundingClientRect().width;t.style.left=`${Pt(r.left,8,a-s-8)}px`;const i=t.getBoundingClientRect().height,n=r.bottom+u,c=n+i<=o-8?n:r.top-d-i;return void(t.style.top=`${Pt(c,8,o-i-8)}px`)}const p=(t=>t.matches("ful-note, .ful-note, [placement]"))(t),f=p?t.getAttribute("placement")??"bottom":"bottom";t.style.removeProperty("max-width");const m=Math.min(parseFloat(l.maxWidth)||a,a-16);t.style.maxWidth=`${m}px`,t.style.left="8px";const g=t.getBoundingClientRect().width;let b="right"===f?r.right+h:"left"===f?r.left-c-g:p?r.left+r.width/2-g/2:r.left;b=Pt(b,8,a-g-8),t.style.left=`${b}px`,t.style.maxWidth=`${Math.min(m,a-8-b)}px`;const v=t.getBoundingClientRect().height,y="top"===f?r.top-d-v:"right"===f||"left"===f?r.top+r.height/2-v/2:r.bottom+u;t.style.top=`${Pt(y,8,o-v-8)}px`,p&&((t,e)=>{const s=e.getBoundingClientRect(),i=t.getBoundingClientRect();t.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-i.left-t.clientLeft+"px"),t.style.setProperty("--ful-note-callout-block",s.top+s.height/2-i.top-t.clientTop+"px")})(t,s)},Ft=()=>{Lt=0;for(const[t,e]of Ot)t.isConnected&&e.invoker.isConnected?Mt(t,e):Ot.delete(t)},zt=()=>{!Lt&&Ot.size>0&&(Lt=requestAnimationFrame(Ft))};class It{static wire(t,e,{prefix:s="ful-anchor",invoke:i=!1,expanded:r=!1,stretch:n=!1,handPlace:a=!1}={}){const o=d.uid(s);if(i)if(e.id=e.id||o,"button"===t.localName||"input"===t.localName)t.setAttribute("popovertarget",e.id);else{let s=!1;t.addEventListener("pointerdown",()=>{s=e.matches(":popover-open")},!0),t.addEventListener("click",()=>{const t=s&&!e.matches(":popover-open");s=!1,t||e.togglePopover()}),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.togglePopover())})}const l=`--${o}`;if(t.style.anchorName=l,e.style.positionAnchor=l,r&&(t.setAttribute("aria-expanded","false"),e.addEventListener("toggle",e=>{t.setAttribute("aria-expanded","open"===e.newState?"true":"false")})),!a&&CSS.supports("anchor-name: --ful-probe")&&CSS.supports("position-anchor: --ful-probe")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)")&&CSS.supports("width: anchor-size(width)"))return;const u={invoker:t,stretch:n};e.addEventListener("beforetoggle",t=>{"open"===t.newState&&((t,e)=>{t.style.visibility="hidden",queueMicrotask(()=>{t.matches(":popover-open")&&Mt(t,e),t.style.removeProperty("visibility")})})(e,u)}),e.addEventListener("toggle",t=>{"open"===t.newState?(Ot.set(e,u),Mt(e,u)):(Ot.delete(e),(t=>{for(const e of["top","left","right","bottom","margin","max-width","min-width","width","visibility","--ful-note-callout-inline","--ful-note-callout-block"])t.style.removeProperty(e)})(e))}),Nt||(Nt=!0,document.addEventListener("scroll",zt,!0),window.addEventListener("resize",zt))}static show(t,e,{flip:s=!1,gap:i=0}={}){return"function"!=typeof t.showPopover||t.matches(":popover-open")||t.showPopover(),(()=>{const r=e instanceof Element?e.getBoundingClientRect():e,n=document.documentElement,a=t.getBoundingClientRect(),o=r.bottom+i,l=r.top-i-a.height,u=s&&o+a.height>n.clientHeight-8&&l>=8?l:o;t.style.right="auto",t.style.bottom="auto",t.style.margin="0",t.style.left=`${Pt(r.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,t.style.top=`${Pt(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),t}}const Dt=(t,e)=>t.filter(({key:t})=>e.some(e=>String(e)===String(t))),$t=(t,e)=>t.filter(({label:t})=>(t??"").toLowerCase().includes(e?.toLowerCase()??""));class Bt{#Et;#xt;#G;#St;#be;#ve;#_=null;#ye=null;#we=new ot;constructor({http:t,url:e,method:s,responseMapper:i,prefetch:r,revision:n}){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i,this.#be=r,this.#ve=n}async prefetch(){this.#be&&await this.#Ee()}async exact(...t){return Dt(await this.#Ee(),t)}async load(t){return $t(await this.#Ee(),t)}async invalidate(){this.#we.invalidate(),this.#_=null,this.#ye=null}async#Ee(){if(null===this.#_){if(null===this.#ye){const t=this.#we.hold();this.#ye=Bt.#xe(this.#Et,this.#G,this.#xt,this.#ve).then(e=>{t.stale||(this.#_=this.#St(e))}).finally(()=>{t.stale||(this.#ye=null)})}await this.#ye}if(null===this.#_)throw new Error("superseded by an invalidation");return this.#_}static async#xe(t,e,s,i){const r=`${e}@${s}`;if(null!==i){const t=it.load(r,i);if(void 0!==t)return t}const n=await t.request(e,s).fetchJson();if(null!==i)try{it.save(r,i,n)}catch(t){console.warn("failed to cache the select options",t)}return n}}class jt{#Et;#xt;#G;#St;constructor({http:t,url:e,method:s,responseMapper:i}){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i}async invalidate(){}async exact(...t){const e=await this.#Et.request(this.#G,this.#xt).param("k",...t).fetchJson();return this.#St(e)}async load(t){const e=await this.#Et.request(this.#G,this.#xt).param("s",t).fetchJson();return this.#St(e)}}class Ht{#_;constructor(t){this.#_=t}update(t){this.#_=t}async invalidate(){}exact(...t){return Dt(this.#_,t)}load(t){return $t(this.#_,t)}}class Vt{static from({data:t,http:e,url:s,method:i="POST",mode:r,prefetch:n=!1,revision:a=null,responseMapper:o}){return s?"chunked"===r?new jt({http:e,url:s,method:i,responseMapper:o}):new Bt({http:e,url:s,method:i,responseMapper:o,prefetch:n,revision:a}):new Ht(t??[])}static create(t,e){if(!t.declared("src")){const t=Array.from(e.options?.querySelectorAll("option")??[]);return Vt.from({data:t.map(t=>({key:t.getAttribute("value")??t.innerText.trim(),label:t.innerText.trim(),metadata:void 0}))})}return Vt.from({http:t.component("http-client"),url:t.declared("src"),method:t.declared("method")??"POST",mode:t.declared("mode"),prefetch:t.declared("preload"),revision:Vt.#Ae(t),responseMapper:Vt.#Se(t)})}static#Ae(t){const e=t.declared("revision");if(""!==e)return e;const s=t.component("revision");return null==s?(console.warn("a valueless revision asks the registry for one, and no 'revision' component is defined: the vocabulary will not be cached",t),null):"function"==typeof s?s():s}static#Se(t){return t.declared("k-expr")&&t.declared("l-expr")?e=>t._registry.evaluator().withOverlay(e).evaluateExpression(t.declared("d-expr")??"self").map(e=>{const s=t._registry.evaluator().withOverlay(e);return{key:s.evaluateExpression(t.declared("k-expr")),label:s.evaluateExpression(t.declared("l-expr")),metadata:s.evaluateExpression(t.declared("m-expr")??"self")}}):t.declared("response-mapper")?t.component(t.declared("response-mapper")):t=>t.map(([t,e,s])=>({key:t,label:e,metadata:s}))}}class Wt extends C{static attributes=["listbox"];static slots=!0;static template='\n <ful-spinner class="centered" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <ful-empty data-ref="empty" aria-live="polite" hidden>{{ #l10n:t(\'dropdown.empty\') }}</ful-empty>\n <menu tabindex="-1" role="listbox" hidden></menu>\n ';static templates={options:'\n <li data-tpl-each="self" data-tpl-selected="index == 0" data-tpl-value="index" role="option">\n {{ label }}\n </li>\n '};#Ce;#Te;#_e;#Re;#Y=new Map;#qe=new ot;render({slots:t}){const e=this.template().render();this.#Re=c.isBlank(t.default)?this.template("options"):A.fromFragment(t.default),this.#Ce=e.querySelector("ful-spinner"),this.#_e=e.querySelector("[data-ref=empty]"),this.#Te=e.querySelector("menu"),this.#Te.id=this.declared("listbox")||d.uid("ful-listbox"),this.#Te.addEventListener("mousedown",t=>{t.target.closest("li")&&t.preventDefault()}),this.#Te.addEventListener("click",t=>{t.stopPropagation();const e=t.target.closest("li");e?e.matches('[aria-disabled="true"]')||this.#ke(e):this.hide()}),this.replaceChildren(e)}#Oe(){return!this.#Te||this.#Te.hidden?null:this.#Te.querySelector("li[selected]")??this.#Te.querySelector('li:not([aria-disabled="true"])')}#Le(t){if(t){for(const e of this.#Te.querySelectorAll("li"))e.toggleAttribute("selected",e===t);t.id||=d.uid("ful-option"),this.#Ne(t.id),t.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#Ne(null)}acceptSelection(){const t=this.#Oe();t&&!t.matches('[aria-disabled="true"]')&&this.#ke(t)}update(t,e=[]){if(void 0===t)throw new Error("null data");this.#Y=new Map(t.map((t,e)=>[String(e),t]));const s=t.map((t,e)=>({index:e,...t}));this.#Re.withOverlay(s).renderTo(this.#Te);for(const[s,i]of[...this.#Te.children].entries()){const r=t[s],n=e.some(t=>String(t)===String(r?.key));i.toggleAttribute("picked",n),i.setAttribute("aria-selected",n?"true":"false");const a=!!r?.metadata?.disabled;a?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),a&&r.metadata.reason?i.setAttribute("title",String(r.metadata.reason)):i.removeAttribute("title")}this.#_e.toggleAttribute("hidden",0!==t.length),this.#Te.toggleAttribute("hidden",0===t.length);const i=t.findIndex(({key:t})=>e.some(e=>String(e)===String(t)));this.#Le(i>=0?this.#Te.children[i]:this.#Te.querySelector('li[selected]:not([aria-disabled="true"])')??this.#Te.querySelector('li:not([aria-disabled="true"])'))}#ke(t){const e=t.getAttribute("value"),s=this.#Y.get(e);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:e,entry:s}}))}hide(){this.#qe.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#Ne(null)}#Ne(t){this.dispatchEvent(new CustomEvent("activechange",{bubbles:!1,cancelable:!1,detail:{id:t}}))}get shown(){return this.matches(":popover-open")}async show(t,e=[]){const s=this.#qe.take();this.matches(":popover-open")||this.showPopover(),this.#Te.setAttribute("hidden",""),this.#Ce.removeAttribute("hidden");try{const i=await t();if(s.stale)return;this.update(i,e)}catch(t){if(s.stale)return;throw this.hide(),t}finally{s.stale||this.#Ce.setAttribute("hidden","")}}async moveOrShow(t,e,s=[]){if(this.shown){const e=this.#Oe(),s=e?.[(t?"next":"previous")+"ElementSibling"],i=s?this.#Pe(s,t):null;return void(e&&i&&this.#Le(i))}await this.show(e,s)}#Pe(t,e){for(let s=t;s;s=s[(e?"next":"previous")+"ElementSibling"])if(!s.matches('[aria-disabled="true"]'))return s;return null}jump(t){if(this.#Te.hidden)return;const e=t?this.#Te.firstElementChild:this.#Te.lastElementChild,s=this.#Pe(e,t);s&&this.#Le(s)}page(t){const e=this.#Oe();if(!e)return;let s=e;for(let e=0;e!==this.#Me();++e){const e=this.#Pe(s[(t?"next":"previous")+"ElementSibling"],t);if(!e)break;s=e}this.#Le(s)}#Me(){const t=this.#Te.firstElementChild;return t&&0!==t.offsetHeight?Math.max(1,Math.trunc(this.#Te.clientHeight/t.offsetHeight)):1}}class Ut extends dt{static attributes=["name","loader","k-type","mode","preload:presence","revision","k-expr","l-expr","d-expr","m-expr","response-mapper"];static observed=["multiple:presence","item-list:presence","value:csv","src","method"];unmarshal(t,e){return"value"!==t||""!==e||this.hasAttribute("multiple")?super.unmarshal(t,e):[""]}static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-control>\n <input type="text" form="" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n <ful-dropdown popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </ful-control-group>\n <ful-item-list></ful-item-list>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="entries" data-tpl-var="entry" data-tpl-data-key="entry.key">\n <div><span>{{ entry.label }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'select.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n '};#Fe;#ze={src:null,method:null};#Y;#rt;#Ie;#De;#$e;#te;#re;#Be;#je=!1;#He=new Map;#Ve=new ot;#We=!1;#Ue;#Ge;_build({slots:t}){const e=this.declared("name");this.#Y=t.options,this.#Qe(),this.#Be=this.declared("multiple"),this.#Fe.prefetch?.()?.catch(t=>{console.warn("failed to prefetch select options",this,"reason:",t)});const s=this.template().withOverlay({slots:t,name:e}).render();this.#De=s.querySelector("ful-control > input"),this.#$e=s.querySelector("label"),this.#te=s.querySelector("ful-item-list"),this.#re=t.items&&!c.isBlank(t.items)?A.fromFragment(t.items):null,d.forward("input-",this,this.#De),this.#rt=s.querySelector("ful-control"),this.#Ie=s.querySelector("ful-dropdown");const i=d.uid("ful-listbox");this.#Ie.setAttribute("listbox",i),this.#De.setAttribute("aria-controls",i),this.#Ie.addEventListener("beforetoggle",t=>{const e="open"===t.newState;this.#De.setAttribute("aria-expanded",e?"true":"false"),e||this.#De.removeAttribute("aria-activedescendant")}),this.#Ie.addEventListener("activechange",t=>{d.set(this.#De,"aria-activedescendant",t.detail.id)});const r=s.querySelector("ful-control-group");return It.wire(r,this.#Ie,{prefix:"ful-select",stretch:!0}),[this.#Ue,this.#Ge]=ut.throttle(400,()=>this.#Ke()),this.#Je(),this.#Xe(),this.#Ye(),this.#Ze(),{fragment:s,control:this.#De,error:s.querySelector("ful-field-error"),label:this.#$e}}#Je(){this.addEventListener("click",t=>{if(!this._interactive()||this.#$e.contains(t.target))return;const e=t.target.closest('button, [role="button"], a[href], input, select, textarea');if(!e||e===this.#De){if(this.#Ie.shown)return this.#Ge(),void this.#ts();this.#De.focus(),this.#Ue()}}),this.#te.addEventListener("click",t=>{t.stopPropagation(),t.target.closest("button")&&this._interactive()&&this.#es([...this.#te.children].indexOf(t.target.closest("ful-item")))}),this.#rt.addEventListener("click",t=>{const e=t.target instanceof Element?t.target.closest("ful-badge"):null;e&&(t.stopPropagation(),this.#ss(e))})}#Xe(){this.addEventListener("keydown",t=>{const e=t.target instanceof Element?t.target.closest("ful-badge"):null;e?this.#is(t,e):"ArrowLeft"===t.code&&t.target===this.#De&&0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#rs().at(-1)?.focus()})}#Ye(){this.#De.addEventListener("change",t=>{t.stopPropagation()}),this.#De.addEventListener("focus",()=>{this.#We||this.#De.select()}),this.#De.addEventListener("blur",t=>{t.stopPropagation(),t.relatedTarget&&this.contains(t.relatedTarget)||(this.#Ge(),this.#ts(!0))}),this.#De.addEventListener("keydown",t=>{this._interactive()&&this.#ns(t)}),this.#De.addEventListener("input",t=>{t.stopPropagation(),this._interactive()&&(this.#We=!0,this.#Ue())})}#Ze(){this.#Ie.addEventListener("change",t=>{t.stopPropagation(),this.#Ge(),this._interactive()?(this.#Be||this.#He.clear(),this.#We=!1,this.#He.set(this.#as(t.detail.entry.key),t.detail.entry),this.#os(),this.#De.focus(),this.#Ie.hide(),this.#Be||this.#De.select()):this.#ts()})}async withLoader(t){return await t(this.#Fe)}async reload(){await(this.#Fe.invalidate?.()),await(this.#Fe.prefetch?.());const t=[...this.#He.keys()];0!==t.length&&await this.#n(t,this.#Ve.take()),this.#Ie.shown&&await this.#Ke()}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ls()&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ls()&&this.reload()}async reconfigure(t,{notify:e=!1}={}){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);this.#ls();const s=[...this.#He.keys()];await this.reload();const i=[...this.#He.keys()];e&&i.length!==s.length&&this._notifyChange({entry:this.entry})}#Qe(){this.#ze={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Fe=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#Y})}#ls(){return(this.getAttribute("src")!==this.#ze.src||this.getAttribute("method")!==this.#ze.method)&&(this.#Ge(),this.#ts(),this.#Qe(),!0)}#rs(){return Array.from(this.#rt.querySelectorAll(":scope > ful-badge"))}#ss(t){this._interactive()&&this.#es(this.#rs().indexOf(t))}#es(t){const e=Array.from(this.#He.keys())[t];void 0!==e&&(this.#He.delete(e),this.#os())}#is(t,e){switch(t.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":t.preventDefault(),this.#ss(e),this.#De.focus();break;case"ArrowLeft":t.preventDefault(),(this.#rs()[this.#rs().indexOf(e)-1]??this.#De).focus();break;case"ArrowRight":t.preventDefault(),(this.#rs()[this.#rs().indexOf(e)+1]??this.#De).focus();break;case"Escape":this.#De.focus()}}#ns(t){switch(t.code){case"ArrowUp":case"ArrowDown":t.preventDefault(),this.#us(t);break;case"Home":this.#Ie.shown&&(t.preventDefault(),this.#Ie.jump(!0));break;case"End":this.#Ie.shown&&(t.preventDefault(),this.#Ie.jump(!1));break;case"PageDown":case"PageUp":this.#Ie.shown&&(t.preventDefault(),this.#Ie.page("PageDown"===t.code));break;case"Escape":this.#Ge(),this.#ts();break;case"NumpadEnter":case"Enter":if(!this.#Ie.shown)return;t.preventDefault(),this.#Ge(),this.#We=!1,this.#cs(),this.#Ie.acceptSelection();break;case"Backspace":0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#es(this.#He.size-1);break;case"Tab":this.#Ge(),this.#ts(!0)}}#us(t){const e="ArrowDown"===t.code;t.altKey?e&&!this.#Ie.shown?this.#Ke():!e&&this.#Ie.shown&&(this.#Ge(),this.#ts()):this.#Ie.moveOrShow(e,()=>this.#Fe.load(this.#ds()),[...this.#He.keys()])}#ts(t=!1){this.#Ie.hide();const e=t&&this.#We&&!this.#Be&&""===this.#De.value&&0!==this.#He.size;this.#We=!1,e&&(this.#He.clear(),this.#os()),this.#cs()}#Ke(){return this.#Ie.show(()=>this.#Fe.load(this.#ds()),[...this.#He.keys()])}#ds(){return this.#We?this.#De.value:""}get query(){return this.#ds()}#cs(){const t=this.#He.values().next().value;this.#De.value=this.#Be?"":t?.label??""}#hs(){return[...this.#He.values()]}#os(){this.#ps(),this._notifyChange({entry:this.entry})}#ps(){const t=this.#Be?Array.from(this.#He.entries()).map(([t,e],s)=>{const i=document.createElement("ful-badge");return i.setAttribute("role","button"),i.setAttribute("tabindex",0===s?"0":"-1"),i.setAttribute("value",t),i.innerText=e.label,i}):[];for(const t of this.#rt.querySelectorAll(":scope > ful-badge"))t.remove();this.#De.before(...t),this.#We||this.#cs(),this.#te.replaceChildren(),(this.#re??this.template("items")).withOverlay({entries:this.#hs()}).renderTo(this.#te)}#as(t){switch(this.declared("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){if(!this.#rt)return void this._holdValue(t);const e=(null==t?[]:Array.isArray(t)?t:[t]).map(t=>this.#as(t)),s=this.#Be?e:e.slice(0,1);!this.#je&&s.some(t=>"string"==typeof t&&t.includes(","))&&(this.#je=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#He=new Map(s.map(t=>[t,{key:t,label:t,metadata:void 0}]));const i=this.#Ve.take();this.#ps(),0!==s.length&&this.#n(s,i)}async#n(t,e){const s=await this.#Fe.exact(...t);if(e.stale)return;const i=new Map(s.map(t=>[this.#as(t.key),t]));for(const e of t)this.#He.has(e)&&(i.has(e)?this.#He.set(e,i.get(e)):this.#He.delete(e));this.#ps()}get value(){if(!this.#rt){const t=[this._heldValue()??[]].flat().map(t=>this.#as(t));return this.multiple?t:t[0]??null}return this.#Be?[...this.#He.keys()]:[...this.#He.keys()][0]??null}get entry(){const t=this.#hs();return this.#Be?t:t[0]??null}get disabled(){return super.disabled}set disabled(t){super.disabled=t,t&&this.#Ie?.shown&&(this.#Ge(),this.#ts())}get readonly(){return super.readonly}set readonly(t){super.readonly=t,t&&this.#Ie?.shown&&(this.#Ge(),this.#ts())}#fe;get multiple(){return this.#Be??this.declared("multiple")}set multiple(t){this.#Be=t,this.reflectTo("multiple",t),t||(this.#He=new Map([...this.#He].slice(0,1))),this.#rt&&this.#ps()}get itemList(){return this.#fe}set itemList(t){this.#fe=t,this.reflectTo("item-list",t)}}class Gt extends dt{static attributes=["name","type"];static slots=!0;static ROLE="radiogroup";static template='\n <fieldset>\n <legend>{{{{ slots.default }}}}</legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <ful-radio-list>\n <div class="label-wrapper" data-tpl-each="inputsAndLabels" data-tpl-var="ial">\n <label>\n {{{{ ial[0] }}}}\n <div>{{{{ ial[1] }}}}</div>\n </label>\n </div>\n </ful-radio-list>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';#fs;#ms;#gs;_build({slots:t}){const e=d.uid(this.declared("name")??"ful-radiogroup"),s=Array.from(t.default.querySelectorAll("ful-radio")),i=s.map(t=>{const s=document.createElement("input");return s.setAttribute("type","radio"),d.forward("input-",this,s),d.forward("",t,s),s.setAttribute("name",`${e}-ignore`),s.setAttribute("form",""),s.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()}),[s,c.fromChildNodes(t)]});s.forEach(t=>{t.remove()}),c.isBlank(t.default)&&t.default.replaceChildren();const r=this.template().withOverlay({name:e,slots:t,inputsAndLabels:i}).render();return this.#fs=r.firstElementChild,this.#ms=r.querySelector("input[type=radio]"),this.#gs="boolean"===this.declared("type"),{fragment:r,control:this.#ms,error:r.querySelector("ful-field-error"),described:this,claims:this.#fs,announces:this,freeze:this.#fs}}get value(){if(!this.#fs){const t=this._heldValue(),e=null===t?null:this.querySelector(`ful-radio[value="${CSS.escape(String(t))}"]`),s=e?.getAttribute("value")??null;return null===s||"boolean"!==this.declared("type")?s:"true"===s}const t=this.querySelector("input[type=radio]:checked");return t?this.#gs?"true"===t.value:t.value:null}set value(t){if(!this.#fs)return void this._holdValue(t);const e=this.querySelectorAll("input[type=radio]"),s=()=>{e.forEach(t=>{t.checked=!1})};if(null===t)return void s();const i=this.querySelector(`input[type=radio][value="${CSS.escape(String(t))}"]`);null!==i?i.checked=!0:s()}}class Qt extends dt{static attributes=["type"];static observed=["value:bool"];static slots=!0;static template='\n <ful-choice data-tpl-switch="isSwitch">\n <input type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </ful-choice>\n <ful-field-error></ful-field-error>\n ';#bs;#De;_build({slots:t}){const e="switch"===this.declared("type"),s=this.template().withOverlay({slots:t,isSwitch:e}).render();this.#bs=s.firstElementChild,this.#De=s.querySelector("input"),d.forward("input-",this,this.#De),this.#De.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});const i=s.querySelector("label");return{fragment:s,control:this.#De,error:s.querySelector("ful-field-error"),label:i,freeze:this.#bs}}get value(){return this.#De?this.#De.checked:Boolean(this._heldValue())}set value(t){this.#De?this.#De.checked=t:this._holdValue(t)}}class Kt extends C{static attributes=["sorter"];static observed=["order"];#vs;render(){const t=this.declared("sorter"),e=["asc","desc",null];this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",()=>{const s=e[(e.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort:requested",{bubbles:!0,cancelable:!1,detail:{value:{sorter:t,order:s}}}))}),this.addEventListener("keydown",t=>{["Enter","NumpadEnter","Space"].includes(t.code)&&(t.preventDefault(),this.click())})}get order(){return this.#vs||null}set order(t){this.#vs=t||null,this.reflectTo("order",this.#vs);const e=this.closest("th");e&&d.set(e,"aria-sort",this.#vs?"asc"===this.#vs?"ascending":"descending":null)}}class Jt extends C{static observed=["total:number","current:number"];static attributes=["pages:number"];static config={prevIcon:"chevron-left",nextIcon:"chevron-right",reloadIcon:"arrow-clockwise"};static template='\n <ful-pagination-bar role="navigation" data-tpl-aria-label="#l10n:t(\'pagination.navigation\')">\n <ul>\n <li data-ref="index"> {{ #l10n:t(\'pagination.showing\', { \'current\': curr.label, \'total\': total }) }}</li>\n <li data-ref="reload"><button type="button" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button></li>\n <li data-ref="prev">\n <button type="button" data-tpl-disabled="prev.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.previous\')" data-tpl-data-page="prev.index">\n <ful-icon data-tpl-name="config.prevIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n <li data-ref="page" data-tpl-each="pages" data-tpl-var="page">\n <button type="button" data-tpl-aria-current="curr.index == page.index ? \'page\' : false" data-tpl-data-page="page.index" >\n {{ page.label }}\n </button>\n </li>\n <li data-ref="next">\n <button type="button" data-tpl-disabled="next.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.next\')" data-tpl-data-page="next.index">\n <ful-icon data-tpl-name="config.nextIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n </ul>\n </ful-pagination-bar>\n ';#ys=0;#W=0;render(){this.addEventListener("click",t=>{const e=t.target.closest("button");e&&!e.hasAttribute("disabled")&&"page"!==e.getAttribute("aria-current")&&this.dispatchEvent(new CustomEvent("page:requested",{bubbles:!0,cancelable:!1,detail:{value:Number(e.dataset.page??this.#W)}}))})}update({current:t,total:e}={}){void 0!==t&&(this.#W=t??0),void 0!==e&&(this.#ys=e??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#ys);const s=this.#W,i=this.#ys,r=this.declared("pages")??5,n=Math.max(i,1),a=s>0,o=s+1<n,l={index:a?s-1:null,enabled:a},u={index:s,label:s+1},c={index:o?s+1:null,enabled:o},d=Math.max(1,Math.min(r,n)),h=Math.max(0,Math.min(s-Math.floor((d-1)/2),n-d)),p=Array.from({length:d},(t,e)=>({index:h+e,label:h+e+1})),f=this.contains(document.activeElement)?document.activeElement.closest("li")?.getAttribute("data-ref"):null,m="page"===f?document.activeElement.dataset.page:null;if(this.template().withOverlay({total:n,prev:l,curr:u,next:c,pages:p}).renderTo(this),!f)return;const g=(null===m?null:this.querySelector(`li[data-ref=page] button[data-page="${m}"]`))??this.querySelector(`li[data-ref=${f}] button:not(:disabled)`)??this.querySelector("li[data-ref=page] button[aria-current=page]");g?.focus()}get total(){return this.#ys}set total(t){this.update({total:t})}get current(){return this.#W}set current(t){this.update({current:t})}}class Xt{static parse(t,e){const s=t?p.queryChildren(t,"schema"):null;if(!s)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const i=document.createElement("tr"),r=document.createElement("tr");r.setAttribute("data-tpl-each","rows");for(const t of s.getAttributeNames()){const e=s.getAttribute(t);i.setAttribute(t,e??""),r.setAttribute(t,e??"")}const n=p.queryChildrenAll(s,"column"),a=n.filter(t=>t.hasAttribute("order")&&t.hasAttribute("sorter")).map(t=>({sorter:t.getAttribute("sorter"),order:t.getAttribute("order")}))[0]??null;for(const t of n){const e=p.queryChildren(t,"title"),s=t.getAttribute("sorter"),n=t.getAttribute("order"),a=e??document.createTextNode(t.getAttribute("title")??"");e?.remove(),t.removeAttribute("sorter"),t.removeAttribute("order"),t.removeAttribute("title");const o=s||n?(()=>{const t=document.createElement("ful-sorter");return s&&t.setAttribute("sorter",s),n&&t.setAttribute("order",n),t.append(a),t})():a,l=document.createElement("th"),u=document.createElement("td");for(const e of t.getAttributeNames()){const s=t.getAttribute(e);l.setAttribute(e,s??""),u.setAttribute(e,s??"")}l.append(o),u.append(...t.childNodes),i.append(l),r.append(u)}return{headersTemplate:e.withOverlay({inHeaders:!0,inRows:!1}).withFragment(c.from(i)),rowsTemplate:e.withOverlay({inHeaders:!1,inRows:!0}).withFragment(c.from(r)),sort:a,length:n.length}}}class Yt{#_;constructor(t){this.#_=t}async load(t,e,s){const i=this.#ws(e),r=Number(t.size),n=t.page*r,a=n+r;return{data:i.slice(n,a),size:i.length}}#ws(t){if(!t?.sorter)return this.#_;const{sorter:e,order:s}=t,i="desc"===s?-1:1;return[...this.#_].sort((t,s)=>{const r=t?.[e],n=s?.[e];return r===n?0:null==r?1:null==n?-1:(r<n?-1:1)*i})}update(t){this.#_=t}}class Zt{#Et;#xt;#G;#St;constructor(t,e,s,i=t=>t){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i}async load(t,e,s){const i=Object.entries(s).filter(([t,e])=>e);return await this.#Et.request(this.#G,this.#xt).param("page",t.page).param("size",t.size).param("sort",e?`${e.sorter},${e.order}`:null).param("filters",i.length>0?JSON.stringify(Object.fromEntries(i)):null).fetchJson().then(t=>this.#St(t))}}class te{static create(t,e){const s=t.getAttribute("src");if(s){const e=t.component("http-client"),i=t.getAttribute("method")??"GET",r=t.hasAttribute("response-mapper")?t.component(t.getAttribute("response-mapper")):t=>t;return new Zt(e,s,i,r)}return new Yt([])}}class ee extends C{static attributes=["loader","autoload:presence","paging"];static observed=["page-size:number","src","method"];static slots=!0;static config={searchIcon:"search",emptyIcon:"inbox",reloadIcon:"arrow-clockwise"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <ful-table-wrapper>\n <table>\n <caption data-tpl-if="slots.caption">{{{{ slots.caption }}}}</caption>\n <thead></thead>\n <tbody data-tpl-if="virtual" data-ref="before" aria-hidden="true"><tr><td data-tpl-colspan="schema.length"></td></tr></tbody>\n <tbody></tbody>\n <tbody data-tpl-if="virtual" data-ref="after" aria-hidden="true"><tr><td data-tpl-colspan="schema.length"></td></tr></tbody>\n <tbody data-ref="initial">\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty>\n <ful-icon data-tpl-if="config.searchIcon" data-tpl-name="config.searchIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.initial\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="empty" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty data-tpl-if="slots.empty" data-ref="empty-authors"></ful-empty>\n <ful-empty data-tpl-if="!slots.empty">\n <ful-icon data-tpl-if="config.emptyIcon" data-tpl-name="config.emptyIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.no-data\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="loading" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-spinner class="big" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="feedback" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <div role="alert">\n <p>{{ #l10n:t(\'table.error\') }}</p>\n <div data-ref="feedback-error"></div>\n </div>\n </td>\n </tr>\n </tbody>\n <tfoot data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </tfoot>\n </table>\n </ful-table-wrapper>\n <ful-pagination data-tpl-if="!scrolled" current="0" total="1"></ful-pagination>\n <ful-table-status data-tpl-if="scrolled">\n <span data-ref="count"></span>\n <ful-spinner data-ref="appending" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <div data-ref="append-failure" role="alert" hidden>\n <span>{{ #l10n:t(\'table.error\') }} <span data-ref="append-error"></span></span>\n <button type="button" data-ref="retry">{{ #l10n:t(\'table.retry\') }}</button>\n </div>\n <button type="button" data-ref="reload" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button>\n </ful-table-status>\n ';static templates={row:"\n {{{{ schema.rowsTemplate.withOverlay({'rows': pageResponse.data}).render() }}}}\n "};#Fe;#Es;#X;#xs;#As;#_e;#Ss;#Cs;#Ts;#_s;#Rs;#qs;#ks=null;#Os=null;#Ls=[];#Ns={next:1,shown:0,total:0,last:0};#Ps=!1;#Ms=null;#Fs=null;#ys=0;#zs=0;#Is=null;#Ds=!1;#$s=void 0;#Bs={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#js=!1;#Hs={};#Vs=null;#Ws=!1;#Us=null;#Gs=new ot;#ze={src:null,method:null};get pageSize(){return this.#Bs.pageRequest.size}set pageSize(t){const e=Number(t??10);!Number.isFinite(e)||e<=0||e===this.#Bs.pageRequest.size||(this.#Bs={...this.#Bs,pageRequest:{page:0,size:e}},this.#js&&this.load(this.#Bs.pageRequest,this.#Bs.sortRequest,this.#Hs))}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ls()&&this.#js&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ls()&&this.#js&&this.reload()}async reconfigure(t){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);return this.#ls(),await this.reload()}#Qe(){this.#ze={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Fe=this.component(this.declared("loader")??"loaders:table").create(this)}#ls(){return(this.getAttribute("src")!==this.#ze.src||this.getAttribute("method")!==this.#ze.method)&&(this.#Qe(),this.#Bs={...this.#Bs,pageRequest:{...this.#Bs.pageRequest,page:0}},this.#Fs=null,!0)}async render({slots:t}){const e=this.template(),s=Xt.parse(t.schema,e),i=this.declared("paging"),r=e.withOverlay({slots:t,schema:s,scrolled:"infinite"===i||"virtual"===i,virtual:"virtual"===i}).render(),n=p.queryChildren(r,"ful-table-wrapper"),a=n.querySelector("table");d.forward("table-",this,a),this.#Qe(),this.#qs=n;const o=p.queryChildren(r,"ful-table-status");if(this.#Es=s,this.#X=a.querySelector(":scope > tbody:not([data-ref])"),this.#xs=a.querySelector(":scope > tbody[data-ref=loading]"),this.#As=a.querySelector(":scope > tbody[data-ref=initial]"),this.#_e=a.querySelector(":scope > tbody[data-ref=empty]"),this.#Ss=this.#_e.querySelector("ful-empty[data-ref=empty-authors]"),this.#Cs=t.empty&&!c.isBlank(t.empty)?A.fromFragment(t.empty):null,this.#Ts=a.querySelector(":scope > tbody[data-ref=feedback]"),this.#_s=p.queryChildren(r,"ful-pagination"),this.replaceChildren(r),"virtual"===i){const t=getComputedStyle(n).overflowY;this.#Ps="auto"===t||"scroll"===t,this.#Ps||console.warn('ful-table: paging="virtual" needs rows that scroll inside the table, as ful-fill makes them; this one appends its pages as paging="infinite" does')}if(o){const t=t=>o.querySelector(`[data-ref=${t}]`);this.#ks={count:t("count"),appending:t("appending"),failure:t("append-failure"),error:t("append-error")},t("reload").addEventListener("click",()=>this.reload()),t("retry").addEventListener("click",()=>{this.#Ps?(this.#Ds=!1,this.#Qs(!0)):this.#Ks()})}this.#Ps?(this.#Ms={before:a.querySelector(":scope > tbody[data-ref=before] td"),after:a.querySelector(":scope > tbody[data-ref=after] td")},n.addEventListener("scroll",()=>{this.#Js(),this.#Qs(!1)},{passive:!0}),new ResizeObserver(()=>{requestAnimationFrame(()=>{this.#Js(),this.#Qs(!1)})}).observe(n)):o&&(this.#Os=new IntersectionObserver(t=>{t.some(t=>t.isIntersecting&&this.#Ls.includes(t.target))&&this.#Ks()}));const l=this.querySelector("thead");s.headersTemplate.renderTo(l),new ResizeObserver(()=>{n.style.setProperty("--ful-table-header-height",`${l.getBoundingClientRect().height}px`)}).observe(l),this.#Rs=l.querySelectorAll("ful-sorter"),await S.waitForChildren(this);const u=p.queryChildren(this,"ful-form"),h=this.declared("page-size");this.#Bs={pageRequest:{page:0,size:Number.isFinite(h)&&h>0?h:10},sortRequest:s.sort,filterRequest:u?.values??{}},this.#Hs=this.#Bs.filterRequest,this.#Vs=u,u?.addEventListener("submit:success",async t=>{this.#Us=this.#Xs(0,t.detail.request),await this.#Us}),this.addEventListener("page:requested",async t=>{t.composedPath().find(t=>t instanceof ee)===this&&await this.#Xs(t.detail.value,this.#Hs)}),this.addEventListener("sort:requested",async t=>{if(t.composedPath().find(t=>t instanceof ee)!==this)return;const e=t.detail.value.order?t.detail.value:null;await this.load(this.#Bs.pageRequest,e,this.#Hs),this.#Bs.sortRequest===e&&(this.#Rs.forEach(t=>{t.order=null}),t.target.order=t.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){if(!this.#Vs||this.#Ws)return this.#Fs?await this.#Ys():await this.load(this.#Bs.pageRequest,this.#Bs.sortRequest,this.#Bs.filterRequest);await this.#Vs.submit()&&await this.#Us}async load(t,e,s){this.#js=!0,this.#Hs=s;const i=this.#Gs.take();let r;this.#Ls=[],this.#Os?.disconnect(),clearTimeout(this.#$s),this.#Is=null,this.#Ds=!1,this.#ks?.appending.setAttribute("hidden",""),this.#ks?.failure.setAttribute("hidden",""),this.#xs.toggleAttribute("hidden",this.#X.childElementCount>0),this.#Ts.setAttribute("hidden",""),this.#As.setAttribute("hidden",""),this.#_e.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const n=await this.#Fe.load(t,e,s);if(i.stale)return;if(r=Math.max(0,Math.ceil(n.size/t.size)-1),!Number.isFinite(r))throw new Error(`ful-table cannot page the loader's answer: it needs { data, size }, size being the total number of rows, and got a size of ${n.size} for pages of ${t.size}. A response of another shape needs a response-mapper`);if(t.page<=r){if(this.#Bs={pageRequest:t,sortRequest:e,filterRequest:s},this.#Ws=!0,this.#ne(t,e,s,n),await Promise.all([S.waitForChildren(this.#X),S.waitForChildren(this.#_e)]).catch(()=>{}),i.stale)return;return this.#Ps&&this.#Zs(),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:e,filterRequest:s,response:n}})),this.#ti(t.size),void this.#Qs(!1)}}catch(r){if(i.stale)return;throw this.#ei(r,{pageRequest:t,sortRequest:e,filterRequest:s}),r}return await this.load({page:r,size:t.size},e,s)}async withLoader(t){return await t(this.#Fe)}async resetWithFilter(t){return await this.#Xs(0,t)}#Xs(t,e){return this.load({page:t,size:this.#Bs.pageRequest.size},this.#Bs.sortRequest,e)}#ti(t){const{shown:e,total:s,last:i}=this.#Ns;if(!(this.#Os&&e<s&&0!==i))return;const r=[...this.#X.children];this.#Ls=r.slice(Math.max(0,r.length-Math.ceil(t/2)));for(const t of this.#Ls)this.#Os.observe(t)}async#Ks(){const t=this.#ks;this.#Ls=[],this.#Os?.disconnect();const{sortRequest:e,filterRequest:s}=this.#Bs,i={page:this.#Ns.next,size:this.#Bs.pageRequest.size},r=this.#Gs.take();t.failure.setAttribute("hidden",""),t.appending.removeAttribute("hidden");try{const n=await this.#Fe.load(i,e,s);if(r.stale)return;if(this.#X.append(this.template("row").withOverlay({schema:this.#Es,pageRequest:i,filterRequest:s,pageResponse:n}).render()),this.#Ns={next:i.page+1,shown:this.#Ns.shown+n.data.length,total:n.size,last:n.data.length},t.count.textContent=P.of().t("table.loaded",{loaded:this.#Ns.shown,total:this.#Ns.total}),await S.waitForChildren(this.#X).catch(()=>{}),r.stale)return;t.appending.setAttribute("hidden",""),this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:i,sortRequest:e,filterRequest:s,response:n}})),this.#ti(i.size)}catch(n){if(r.stale)return;t.appending.setAttribute("hidden",""),t.error.textContent=P.of().failure(n),t.failure.removeAttribute("hidden"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:i,sortRequest:e,filterRequest:s,exception:n}}))}}#si(t,e,s){const i=[...this.template("row").withOverlay({schema:this.#Es,pageRequest:t,filterRequest:e,pageResponse:s}).render().children];return this.#Ps&&i.forEach((e,s)=>{e.setAttribute("aria-rowindex",String(t.page*t.size+s+2))}),i}#ei(t,e){this.#xs.setAttribute("hidden",""),this.#X.replaceChildren(),this.#Fs=null,this.#ii(),this.#ks?.count.replaceChildren(),this.#Ts.removeAttribute("hidden"),this.#Ts.querySelector("[data-ref=feedback-error]").textContent=P.of().failure(t),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{...e,exception:t}}))}#Zs(){const t=this.#X.parentElement;t.setAttribute("aria-rowcount",String(this.#ys+1)),t.tHead?.rows[0]?.setAttribute("aria-rowindex","1");const e=this.#ks,s=this.#Fs;if(!s)return this.#ii(),void(e.count.textContent=P.of().t("table.loaded",{loaded:0,total:this.#ys}));const i=this.#Bs.pageRequest.size,r=s.first*i;e.count.textContent=P.of().t("table.range",{from:r+1,to:r+s.pages.get(s.first).length,total:this.#ys}),this.#ri()&&(this.#qs.scrollTop=r*this.#zs)}#ri(){if(this.#zs>0)return!0;const t=this.#X.childElementCount,e=this.#X.getBoundingClientRect().height;return 0!==t&&0!==e&&(this.#zs=e/t,this.#ni(),this.#ii(),!0)}#ni(){const t=this.#X.parentElement,e=[...t.tHead?.rows[0]?.cells??[]].map(t=>t.getBoundingClientRect().width),s=e.reduce((t,e)=>t+e,0),i=document.createElement("colgroup");i.setAttribute("data-ref","widths");for(const t of e){const e=document.createElement("col");e.style.width=t/s*100+"%",i.append(e)}t.insertBefore(i,t.tHead)}#ai(){this.#X.parentElement?.querySelector(":scope > colgroup[data-ref=widths]")?.remove()}#ii(){if(!this.#Ms)return;const t=this.#Fs,e=this.#Bs.pageRequest.size,s=t?t.first*e:0,i=t?Math.max(0,this.#ys-(t.last+1)*e):0;this.#Ms.before.style.height=s*this.#zs+"px",this.#Ms.after.style.height=i*this.#zs+"px"}#Js(){const t=this.#ks,e=this.#Bs.pageRequest.size,s=this.#qs.getBoundingClientRect(),i=s.top+(this.#X.parentElement?.querySelector(":scope > thead")?.getBoundingClientRect().height??0);let r=0,n=0;for(const[t,a]of this.#Fs?.pages??[])a.forEach((a,o)=>{const l=a.getBoundingClientRect();l.bottom>i&&l.top<s.bottom&&(r||=t*e+o+1,n=t*e+o+1)});r>0&&(t.count.textContent=P.of().t("table.range",{from:r,to:n,total:this.#ys}))}#oi(t){const e=this.#Bs.pageRequest.size*this.#zs,s=this.#qs.getBoundingClientRect(),i=s.top+s.height/2,r=this.#X.getBoundingClientRect();if(i<r.top)return Math.max(0,t.first-Math.ceil((r.top-i)/e));if(i>=r.bottom)return t.last+1+Math.floor((i-r.bottom)/e);let n=t.first;for(const[e,s]of t.pages)s.length>0&&s[0].getBoundingClientRect().top<=i&&(n=e);return n}#Qs(t){const e=this.#Fs,s=Math.ceil(this.#ys/this.#Bs.pageRequest.size);if(!e||this.#Is||this.#Ds||this.hasAttribute("aria-busy")||!this.#qs.isConnected||!(s>0)||!this.#ri())return;const i=Math.min(s-1,this.#oi(e));let r=Math.max(0,i-1),n=Math.min(s-1,i+1);const a=this.#X.contains(document.activeElement)?document.activeElement.closest("tr"):null,o=[...e.pages].find(([,t])=>a&&t.includes(a))?.[0];void 0!==o&&Math.max(n,o)-Math.min(r,o)<=4&&(r=Math.min(r,o),n=Math.max(n,o)),r===e.first&&n===e.last||(clearTimeout(this.#$s),t||!(n<e.first-1||r>e.last+1)?this.#li(e,r,n):this.#$s=setTimeout(()=>this.#Qs(!0),150))}async#li(t,e,s){const i=this.#ks,r=this.#Gs.hold();this.#Is=r;const{sortRequest:n,filterRequest:a}=this.#Bs,o=this.#Bs.pageRequest.size,l=Array.from({length:s-e+1},(t,s)=>e+s),u=l.filter(e=>!t.pages.has(e));i.failure.setAttribute("hidden",""),i.appending.removeAttribute("hidden");try{const c=await Promise.all(u.map(async t=>{const e={page:t,size:o};return{pageRequest:e,response:await this.#Fe.load(e,n,a)}}));if(r.stale)return;const d=l.filter(e=>t.pages.has(e)),h=this.#qs.getBoundingClientRect().top,p=d.flatMap(e=>t.pages.get(e)??[]).find(t=>t.getBoundingClientRect().bottom>h),f=p?.getBoundingClientRect().top??0;for(const[i,r]of t.pages)if(i<e||i>s)for(const t of r)t.remove();const m=new Map;for(const e of l){const s=c.find(t=>t.pageRequest.page===e);m.set(e,t.pages.get(e)??(s?this.#si(s.pageRequest,a,s.response):[]))}if(0===d.length?this.#X.replaceChildren(...[...m.values()].flat()):(this.#X.prepend(...l.filter(t=>t<d[0]).flatMap(t=>m.get(t)??[])),this.#X.append(...l.filter(t=>t>d.at(-1)).flatMap(t=>m.get(t)??[]))),this.#Fs={first:e,last:s,pages:m},this.#ys=c.at(-1)?.response.size??this.#ys,this.#X.parentElement?.setAttribute("aria-rowcount",String(this.#ys+1)),this.#ii(),p&&(this.#qs.scrollTop+=p.getBoundingClientRect().top-f),await S.waitForChildren(this.#X).catch(()=>{}),r.stale)return;p&&(this.#qs.scrollTop+=p.getBoundingClientRect().top-f),i.appending.setAttribute("hidden",""),this.#Js();for(const{pageRequest:t,response:e}of c)this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:n,filterRequest:a,response:e}}))}catch(t){if(r.stale)return;return this.#Ds=!0,i.appending.setAttribute("hidden",""),i.error.textContent=P.of().failure(t),i.failure.removeAttribute("hidden"),void this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:{page:u[0],size:o},sortRequest:n,filterRequest:a,exception:t}}))}finally{this.#Is===r&&(this.#Is=null)}this.#Qs(!1)}async#Ys(){const t=this.#Fs,e=this.#ks,{sortRequest:s,filterRequest:i}=this.#Bs,r=this.#Bs.pageRequest.size;this.#Hs=i;const n=this.#Gs.take();clearTimeout(this.#$s),this.#Is=null,this.#Ds=!1,e.appending.setAttribute("hidden",""),e.failure.setAttribute("hidden",""),this.setAttribute("aria-busy","true");const a=Array.from({length:t.last-t.first+1},(e,s)=>t.first+s);try{const e=await Promise.all(a.map(async t=>{const e={page:t,size:r};return{pageRequest:e,response:await this.#Fe.load(e,s,i)}}));if(n.stale)return;const o=e.at(-1).response.size,l=Math.ceil(o/r);if(!(t.first<l))return await this.load({page:0,size:r},s,i);const u=e.filter(t=>t.pageRequest.page<l),c=new Map(u.map(t=>[t.pageRequest.page,this.#si(t.pageRequest,i,t.response)]));if(this.#X.replaceChildren(...[...c.values()].flat()),this.#Fs={first:t.first,last:Math.min(t.last,l-1),pages:c},this.#ys=o,this.#X.parentElement?.setAttribute("aria-rowcount",String(o+1)),this.#ii(),await S.waitForChildren(this.#X).catch(()=>{}),n.stale)return;this.removeAttribute("aria-busy"),this.#Js();for(const{pageRequest:t,response:e}of u)this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:s,filterRequest:i,response:e}}));this.#Qs(!1)}catch(e){if(n.stale)return;throw this.#ei(e,{pageRequest:{page:t.first,size:r},sortRequest:s,filterRequest:i}),e}}#ne(t,e,s,i){this.#xs.setAttribute("hidden",""),this.#Ps&&(this.#zs=0,this.#ai());const r=this.#si(t,s,i);return this.#X.replaceChildren(...r),this.#_e.toggleAttribute("hidden",0!==i.data.length),this.#Cs&&0===i.data.length&&this.#Ss.replaceChildren(this.#Cs.withOverlay({schema:this.#Es,pageRequest:t,filterRequest:s,pageResponse:i}).render()),this.#Ps?(this.#qs.scrollTop=0,this.#ys=i.size,void(this.#Fs=r.length>0?{first:t.page,last:t.page,pages:new Map([[t.page,r]])}:null)):this.#ks?(this.#qs.scrollTop=0,this.#Ns={next:t.page+1,shown:i.data.length,total:i.size,last:i.data.length},void(this.#ks.count.textContent=P.of().t("table.loaded",{loaded:this.#Ns.shown,total:this.#Ns.total}))):void this.#_s.update({current:t.page,total:Math.ceil(i.size/t.size)})}}const se=(t,e,{items:s,current:i=()=>null})=>{let r="",n=0;e.addEventListener("beforetoggle",s=>{"closed"===s.newState&&e.contains(document.activeElement)&&t()?.focus()}),e.addEventListener("toggle",t=>{if("open"!==t.newState)return;const e=s();(i()??e[0])?.focus()}),e.addEventListener("keydown",e=>{const i=e.target,a=s(),o=a.find(t=>t===i||t.contains(i));if(!o)return;const l=a.indexOf(o);switch(e.code){case"ArrowDown":return e.preventDefault(),void a[(l+1)%a.length]?.focus();case"ArrowUp":return e.preventDefault(),void a[(l-1+a.length)%a.length]?.focus();case"Home":return e.preventDefault(),void a[0]?.focus();case"End":return e.preventDefault(),void a[a.length-1]?.focus();case"Enter":case"NumpadEnter":case"Space":return e.preventDefault(),o.click(),void t()?.focus();case"Escape":return void t()?.focus()}if(1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey)return;const u=Date.now();r=u-n>500?e.key:r+e.key,n=u;const c=r.toLowerCase(),d=[...c].every(t=>t===c[0]),h=d?c[0]:c,p=d?l+1:l,f=[...a.slice(p),...a.slice(0,p)].find(t=>(t.textContent??"").trim().toLowerCase().startsWith(h));f&&(e.preventDefault(),f.focus())})};class ie{static narrow(t,e){const s=(t??[]).filter(t=>e.includes(t));return s.length>0?s:[...e]}#ui;#Te;#ci;#di;#hi;#cs;#pi;#fi;#mi;#gi=!1;#bi=!1;constructor(t,{vocabulary:e,glyphs:s={},labelFor:i=t=>t,display:r=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#ui=t,this.#Te=t.nextElementSibling,this.#ci=e,this.#di=s,this.#hi=i,this.#cs=r??(t=>s[t]??t),this.#pi=n,this.#fi=a,this.#mi=[...e],this.#Te.addEventListener("click",t=>{const e=t.target.closest("li > a");if(!e||!this.#pi())return;const s=e.getAttribute("value"),i=this.value;this.value=s,this.#Te.hidePopover?.(),i!==s&&this.#fi(s)})}get allowed(){return this.#mi}set allowed(t){this.#mi=ie.narrow(t,this.#ci),this.#vi(),!this.#bi&&this.#mi.length>1&&(this.#gt(),this.#bi=!0),this.#yi(),this.pinned&&(this.value=this.#mi[0])}preferring(t){return null!==t&&this.#mi.includes(t)?t:this.#mi[0]}get pinned(){return this.#mi.length<2}set fixed(t){this.#ui.toggleAttribute("hidden",!!t)}get value(){return this.#ui.getAttribute("value")}set value(t){this.#ui.setAttribute("value",t),this.#ui.textContent=this.#cs(t),d.set(this.#ui,"aria-label",this.#hi(t)),this.#wi()}#wi(){const t=this.value;for(const e of this.#te())e.setAttribute("aria-checked",String(e.getAttribute("value")===t))}set claimed(t){this.#gi=t,this.#yi()}#vi(){this.#Te.replaceChildren(...this.#mi.map(t=>{const e=document.createElement("li");e.setAttribute("role","none");const s=document.createElement("a");s.setAttribute("role","menuitemradio"),s.setAttribute("tabindex","-1"),s.setAttribute("value",t);const i=this.#hi(t),r=this.#di[t]??t;if(i===t&&r===t)s.innerText=t;else{const t=document.createElement("span");t.innerText=r;const e=document.createElement("span");e.innerText=i,s.append(t,e)}return e.append(s),e})),this.#wi()}#yi(){const t=this.pinned;this.#ui.toggleAttribute("disabled",t||this.#gi),d.set(this.#ui,"aria-haspopup",t?null:"true"),d.set(this.#ui,"aria-expanded",t?null:"false"),t?this.#ui.removeAttribute("popovertarget"):this.#Te.id&&this.#ui.setAttribute("popovertarget",this.#Te.id)}#te(){return Array.from(this.#Te.querySelectorAll("li > a"),t=>t)}#gt(){It.wire(this.#ui,this.#Te,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),se(()=>this.#ui,this.#Te,{items:()=>this.#te(),current:()=>this.#te().find(t=>t.getAttribute("value")===this.value)})}}const re={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},ne=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],ae=[...ne,"CONTAINS","STARTS_WITH","ENDS_WITH"],oe=["IGNORE_CASE","CASE_SENSITIVE"],le={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:ue}=P.of(),ce=t=>ue(`filters.op.${t}`),de=t=>ue(`filters.sensitivity.${t}`),he=t=>ue(""===t?"filters.boolean.any":`filters.boolean.${t}`),pe=t=>t.querySelector(":scope > label")?.textContent.trim()||null,fe=(t,e,{singular:s,plural:i,vocabulary:r,fallback:n})=>{const a=t.declared(s);if(null===a)return;t.hasAttribute(i)&&console.warn(`${t.localName}: ${s} fixes what ${i} offers a menu for, the plural is ignored`,t);const o=r.includes(a);o||console.warn(`${t.localName}: '${a}' is not one of its ${i}, the default is pinned instead`,t),e.allowed=[o?a:n],e.fixed=!0},me=(t,e,s)=>{const i=s.filter(t=>null!=t&&""!=`${t}`);return 0===i.length?null:{label:t,operator:e,operands:i.map(t=>`${t}`)}};class ge extends xt{static observed=["value:json","operators:csv"];static attributes=["operator"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_container;_value1;_value2;_build(t){const e=super._build(t),s=e.fragment;return this._container=s.querySelector("ful-control-group"),this._value1=s.querySelector("[data-ref=value1]"),this._value2=s.querySelector("[data-ref=value2]"),this._operator=new ie(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:re,labelFor:ce,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),fe(this,this._operator,{singular:"operator",plural:"operators",vocabulary:this._vocabulary(),fallback:this._defaultOperator()}),{...e,freeze:this._container,also:[this._value2]}}_showDefaultOperator(){this._showOperator(this._operator.preferring(this._defaultOperator()))}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||this._showDefaultOperator()}_type(){return"text"}_serialize(t){return t}_deserialize(t){return t}_defaultOperator(){return"EQ"}_vocabulary(){return ne}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(t){null===this.declared("operator")&&(this._operator?(this._operator.allowed=t,null!==this._operator.value&&this._showOperator(this._operator.preferring(this._operator.value))):this._declaredOperators=ie.narrow(t,this._vocabulary()))}get value(){return this._operator?this._tuple():this._shownTuple(this._heldValue())}set value(t){this._operator?this._applyTuple(t):this._holdValue(t)}_shownTuple(t){if(null==t)return null;const[e,...s]=t,i=this.declared("operator"),r=this._vocabulary().includes(i),n=null===i?ie.narrow(this.declared("operators"),this._vocabulary()):[r?i:this._defaultOperator()],a=n.includes(e)?e:n[0],o=[s[0],s[1]].map(t=>`${t?this._deserialize(t):t??""}`),l="BETWEEN"===a?o:o.slice(0,1);return l.some(t=>""===t)?null:[a,...l.map(t=>this._serialize(t))]}_tuple(){const t=this._operator.value,e=this.#Ei();return e.some(t=>""===t)?null:[t,...e.map(t=>this._serialize(t))]}_applyTuple(t){if(null==t)return this._value1.value="",void(this._value2.value="");const[e,...s]=t;this._showOperator(this._operator.preferring(e)),this._value1.value=s[0]?this._deserialize(s[0]):s[0]??"",this._value2.value=s[1]?this._deserialize(s[1]):s[1]??""}_showOperator(t){this._operator.value=t,this._syncBetween()}_syncBetween(){this._value2.toggleAttribute("hidden","BETWEEN"!==this._operator.value)}get criterion(){return this._operator?me(pe(this),this._operator.value,this.#Ei()):null}#Ei(){return"BETWEEN"===this._operator.value?[this._value1.value,this._value2.value]:[this._value1.value]}get disabled(){return super.disabled}set disabled(t){super.disabled=t;for(const e of this._choices())e.claimed=t}_choices(){return[this._operator].filter(t=>t)}}class be extends ge{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(t){return Tt.localToIso(t)}_deserialize(t){return Tt.isoToLocal(t)}}class ve extends ge{_type(){return"date"}}class ye extends ge{_type(){return"number"}}class we extends ge{static observed=["sensitivities:csv"];static attributes=["sensitivity"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n <button data-ref="sensitivity" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_defaultOperator(){return"CONTAINS"}_vocabulary(){return ae}_sensitivityButton;_build(t){const e=super._build(t);return this._sensitivityButton=new ie(e.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:oe,glyphs:le,labelFor:de,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=oe[0],fe(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:oe,fallback:"IGNORE_CASE"}),e}_choices(){return[...super._choices(),this._sensitivityButton].filter(t=>t)}get _sensitivity(){return this._sensitivityButton.value}_declaredSensitivities;get sensitivities(){return this._sensitivityButton?this._sensitivityButton.allowed:this._declaredSensitivities}set sensitivities(t){if(null!==this.declared("sensitivity"))return;if(!this._sensitivityButton)return void(this._declaredSensitivities=ie.narrow(t,oe));const e=this._sensitivityButton.value;this._sensitivityButton.allowed=t,this._sensitivityButton.value=this._sensitivityButton.preferring(e)}get value(){if(!this._sensitivityButton){const t=this._heldValue(),e=null==t?null:this._shownTuple([t[0],...t.slice(2)]);if(null===e)return null;const s=this.declared("sensitivity"),i=null===s?ie.narrow(this.declared("sensitivities"),oe):[oe.includes(s)?s:"IGNORE_CASE"],r=i.includes(t[1])?t[1]:"IGNORE_CASE";return[e[0],i.includes(r)?r:i[0],...e.slice(1)]}const t=this._tuple();return null==t?null:[t[0],this._sensitivity,...t.slice(1)]}set value(t){this._sensitivityButton?null!=t?(this._sensitivityButton.allowed.includes(t[1])&&(this._sensitivityButton.value=t[1]),this._applyTuple([t[0],...t.slice(2)])):this._applyTuple(t):this._holdValue(t)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const Ee=["","true","false"],xe={true:"✓",false:"✗"};class Ae extends dt{static observed=["value:json","operators:csv"];static slots=!0;static OPERATORS=["EQ","NEQ"];static DEFAULT_OPERATOR="EQ";static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <button data-ref="value" type="button" form=""></button>\n <ul popover role="menu"></ul>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_value;_container;_build({slots:t}){const e=this.template().withOverlay({slots:t}).render();this._container=e.querySelector("ful-control-group");const s=e.querySelector("[data-ref=value]");return this._operator=new ie(e.querySelector("[data-ref=operator]"),{vocabulary:Ae.OPERATORS,glyphs:re,labelFor:ce,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new ie(s,{vocabulary:Ee,glyphs:xe,labelFor:he,display:he,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(Ae.DEFAULT_OPERATOR),this._value.allowed=null,this._value.value="",{fragment:e,control:s,error:e.querySelector("ful-field-error"),label:e.querySelector("label"),announces:null,freeze:this._container}}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(t){this._operator?(this._operator.allowed=t,null!==this._operator.value&&(this._operator.value=this._operator.preferring(this._operator.value))):this._declaredOperators=ie.narrow(t,this._vocabulary())}_vocabulary(){return Ae.OPERATORS}get value(){if(!this._value){const t=this._heldValue(),e=`${t?.[1]??""}`;if(""===e)return null;const s=ie.narrow(this.declared("operators"),this._vocabulary());return[s.includes(t[0])?t[0]:s[0],e]}return""===this._value.value?null:[this._operator.value,this._value.value]}set value(t){this._value?null!=t?(this._operator.value=this._operator.preferring(t[0]),this._value.value=t[1]??""):this._value.value="":this._holdValue(t)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(Ae.DEFAULT_OPERATOR))}get criterion(){if(!this._value)return null;const t=this._value.value;return me(pe(this),this._operator.value,[""===t?"":he(t)])}get disabled(){return super.disabled}set disabled(t){super.disabled=t;for(const e of[this._operator,this._value].filter(t=>t))e.claimed=t}}class Se extends Ut{static attributes=["operator"];#xi(){const t=super.value;return this.multiple?t:null==t?[]:[t]}get value(){const t=this.#xi();if(0===t.length)return null;const e=this.declared("operator");return e?[e,...t]:t}set value(t){const e=this.declared("operator");let s=null==t?[]:Array.isArray(t)?t:[t];e&&s[0]===e&&(s=s.slice(1)),super.value=this.multiple?s:s[0]??null}get criterion(){return me(pe(this),this.declared("operator"),[super.entry].flat().filter(t=>t).map(t=>t.label))}}class Ce extends C{static slots=!0;static attributes=["placement","icon","describes:presence"];static config={icon:"info-circle-fill"};static template='\n <span role="button" tabindex="0" class="ful-tip" data-ref="trigger" data-tpl-aria-label="#l10n:t(\'info.tooltip\')"><ful-icon data-tpl-name="icon ?? config.icon" aria-hidden="true"></ful-icon></span>\n <ful-note popover data-ref="content">{{{{ slots.default }}}}</ful-note>\n ';render({slots:t}){const e=this.template().withOverlay({slots:t,icon:this.declared("icon")}).render(),s=e.querySelector("[data-ref=trigger]"),i=e.querySelector("[data-ref=content]");It.wire(s,i,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),i.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(e),this.declared("describes")&&Ce.#bt(this,s,i)}static#bt(t,e,s){lt(t)?.describedBy(s)?e.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",t)}}class Te{#Ai=new WeakSet;#Si=new WeakSet;#ct=new WeakMap;async request(t,e,s,i){const r=!this.#Ai.has(e)&&!this.#Si.has(e),n={name:s,section:e,index:i,first:r},a=["section:requested",...null!=i?[`section:requested:#${i}`]:[],...s?[`section:requested:${s}`]:[]],o=[];for(const e of a){const s=new CustomEvent(e,{bubbles:!0,detail:n});t.dispatchEvent(s),o.push(...s.async?.promises??[])}if(0===o.length)return;r&&this.#Si.add(e);let l=this.#ct.get(e);l||(l=new ot,this.#ct.set(e,l));const u=l.take(),c=()=>!u.stale;e.querySelector(":scope > .ful-section-error")?.remove();const d=requestAnimationFrame(()=>{c()&&(e.toggleAttribute("loading",!0),e.setAttribute("aria-busy","true"))});try{const t=await Promise.all(o);return r&&this.#Ai.add(e),t}catch(t){throw c()&&this.#Ci(e,t),t}finally{r&&this.#Si.delete(e),cancelAnimationFrame(d),c()&&(e.toggleAttribute("loading",!1),e.removeAttribute("aria-busy"))}}#Ci(t,e){t.querySelector(":scope > .ful-section-error")?.remove();const s=document.createElement("div");s.className="ful-section-error",s.setAttribute("role","alert"),s.textContent=P.of().failure(e),t.prepend(s)}}class _e{#Ti;#_i;#Ri;#xs;#qi;#ki=new Te;#Oi=new ot;#Li=null;constructor(t,e,s){this.#Ti=t,this.#_i=e.querySelector("[data-ref=dialog]"),this.#Ri=e.querySelector(`[data-ref=${s}]`),this.#xs=e.querySelector("[data-ref=loading]"),this.#qi=e.querySelector("[data-ref=error]")}get dialog(){return this.#_i}get section(){return this.#Ri}get dirty(){return Array.from(this.#_i.querySelectorAll("ful-form")).some(t=>t.closest("dialog")===this.#_i&&t.dirty)}dismiss(t,e,s){return this.#Li?this.#Li:this.#Ti.dispatchEvent(t)?t.cancelable?s&&this.dirty?(this.#Li=s().then(t=>(t&&this.#_i.open&&e(),t)).finally(()=>{this.#Li=null}),this.#Li):(e(),Promise.resolve(!0)):Promise.resolve(!0):Promise.resolve(!1)}onBackdrop(t){const e=t=>{if(t.target!==this.#_i)return!1;const e=this.#_i.getBoundingClientRect();return t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom};let s=!1;this.#_i.addEventListener("mousedown",t=>{s=e(t)}),this.#_i.addEventListener("click",i=>{s&&e(i)&&t()})}onSubmitted(t){this.#Ri.addEventListener("submit:success",e=>{"ful-form"===e.target.localName&&e.target.parentElement===this.#Ri&&t(e.detail.response)})}restChrome(){this.#qi?.replaceChildren(),this.#qi?.setAttribute("hidden",""),this.#xs?.setAttribute("hidden",""),this.#Ri?.removeAttribute("hidden")}request(){return this.#ki.request(this.#Ti,this.#Ri,null,null).catch(()=>{})}async update(t,e){const s=this.#Oi.take();this.#Ri.replaceChildren(),this.restChrome(),this.#xs?.removeAttribute("hidden"),this.#Ri.setAttribute("hidden",""),e();try{const e=await t();return s.stale?null:(this.#Ri.replaceChildren(e),this.#xs?.setAttribute("hidden",""),this.#Ri.removeAttribute("hidden"),this.#Ri)}catch(t){throw s.stale||(this.#qi?.removeAttribute("hidden"),this.#qi&&(this.#qi.textContent=P.of().failure(t)),this.#xs?.setAttribute("hidden",""),this.#Ri.setAttribute("hidden","")),t}}}let Re=!1;const qe=()=>{Re||(Re=!0,document.addEventListener("click",t=>{const e=t.target.closest?.("[dialog-target]");e&&document.getElementById(e.getAttribute("dialog-target"))?.open?.()}))};class ke extends C{static attributes=["header","requires-answer:presence","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header || slots.header || !requiresAnswer" class="ful-dialog-header">\n {{{{ slots.header }}}}\n <h2 data-tpl-if="header">{{ header }}</h2>\n <button data-tpl-if="!requiresAnswer" type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'dialog.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <div data-ref="body" class="ful-dialog-body">{{{{ slots.default }}}}</div>\n <footer class="ful-dialog-footer"><button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons && !closeOnSubmit" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>{{{{ slots.buttons }}}}</footer>\n </dialog>\n ';#_i;#Ni;#Pi=[];#Mi=null;render({slots:t}){const e=this.declared("requires-answer"),s=this.declared("close-on-submit"),i=this.template().withOverlay({slots:t,header:this.declared("header")??"",requiresAnswer:e,closeOnSubmit:s}).render();this.#Ni=new _e(this,i,"body"),this.#_i=this.#Ni.dialog;const r=i.querySelector("h2");r&&(r.id||=d.uid("ful-dialog-title"),this.#_i.setAttribute("aria-labelledby",r.id)),this.#_i.addEventListener("close",()=>{const t=this.#Fi();this.dispatchEvent(new CustomEvent("close",{detail:t})),this.#zi(t)}),this.#_i.addEventListener("click",t=>{const e=t.target.closest("button[data-result]");e&&e.closest("dialog")===this.#_i&&this.#_i.close(e.dataset.result)}),e||this.#Ni.onBackdrop(()=>this.dismiss("backdrop")),i.querySelector("[data-ref=close]")?.addEventListener("click",()=>this.dismiss("button")),s&&this.#Ni.onSubmitted(t=>{this.#Mi={dismissed:!1,result:null,response:t},this.#_i.close("submitted")}),this.#_i.addEventListener("cancel",t=>{if(!t.cancelable)return this.#_i.returnValue="",void this.#Ii("escape",!1);t.preventDefault(),e||this.dismiss("escape")}),this.replaceChildren(i),qe()}#Fi(){if(this.#Mi)return this.#Mi;const t=this.#_i?.returnValue??"";return""===t?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:t,response:null}}#zi(t){const e=this.#Pi;this.#Pi=[];for(const s of e)s(t)}disconnectedCallback(){this.#zi(this.#Fi())}open(){return this.ask()}ask(){return this.#Di()&&(this.#Ni.restChrome(),this.#Ni.request()),new Promise(t=>{this.#Pi.push(t)})}async update(t){return await this.#Ni.update(t,()=>this.#Di())}refresh(){return this.#Ni.request()}dismiss(t){return this.#_i.open?this.#Ii(t,!0):Promise.resolve(!0)}#Ii(t,e){return this.#Ni.dismiss(new CustomEvent("dialog:dismiss",{cancelable:e,detail:{reason:t}}),()=>this.#_i.close(""),this.declared("guard-dismiss")?Oe:null)}close(t){this.#_i.close(t??"")}#Di(){return this.#_i.open&&!this.#_i.matches(":modal")&&this.#_i.removeAttribute("open"),!this.#_i.open&&(this.#_i.returnValue="",this.#Mi=null,this.#_i.showModal(),!0)}static async ask(t,e,s=[],{className:i}={}){const r=document.createElement("ful-dialog");if(r.setAttribute("header",t),i&&(r.className=i),"string"==typeof e?r.textContent=e:e&&r.append(e),s.length>0){const t=document.createElement("template");t.setAttribute("slot","buttons");for(const e of s){if(e instanceof Node){t.content.append(e);continue}const[s,i,r]=e,n=document.createElement("button");n.type="button",n.dataset.result=s,r&&(n.className=r),n.textContent=i,t.content.append(n)}r.append(t)}document.body.append(r);try{return await S.waitFor(r),await r.ask()}finally{r.remove()}}static async confirm(t,e,s={},i={}){const r=await ke.ask(t,e,[["cancel",s.cancel??P.of().t("dialog.cancel")],["confirm",s.confirm??P.of().t("dialog.confirm"),"ful-button"]],i);return!r.dismissed&&"confirm"===r.result}}const Oe=()=>{const t=P.of();return ke.confirm(t.t("dialog.discard.header"),t.t("dialog.discard.body"),{confirm:t.t("dialog.discard.confirm"),cancel:t.t("dialog.discard.cancel")})};class Le extends C{static attributes=["header","placement","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-drawer">\n <header>\n {{{{ slots.header }}}}\n <h2 data-ref="title">{{ title }}</h2>\n <button type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'drawer.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <section data-ref="content">{{{{ slots.default }}}}</section>\n </dialog>\n ';#_i;#$i;#Ni;#Mi=null;#Pi=[];#Bi=!1;#ji=new ot;render({slots:t}){const e=this.template().withOverlay({slots:t,title:this.declared("header")??""}).render();this.#Ni=new _e(this,e,"content"),this.#_i=this.#Ni.dialog,this.#$i=e.querySelector("[data-ref=title]"),this.#$i.id||=d.uid("ful-drawer-title"),this.#_i.setAttribute("aria-labelledby",this.#$i.id);const s=this.declared("placement");s&&this.#_i.setAttribute("placement",s),e.querySelector("[data-ref=close]").addEventListener("click",()=>this.dismiss("button")),this.#Ni.onBackdrop(()=>this.dismiss("backdrop")),this.#_i.addEventListener("cancel",t=>{if(!t.cancelable)return this.#Hi(),void this.#Ii("escape",!1);t.preventDefault(),this.dismiss("escape")}),this.#_i.addEventListener("click",t=>{const e=t.target.closest("button[data-result]");e&&e.closest("dialog")===this.#_i&&this.close(e.dataset.result)}),this.#_i.addEventListener("close",()=>{const t=this.#Fi();this.dispatchEvent(new CustomEvent("close",{detail:t})),this.#zi(t)}),this.declared("close-on-submit")&&this.#Ni.onSubmitted(t=>{this.#Mi={dismissed:!1,result:null,response:t},this.close()}),this.replaceChildren(e),qe()}get header(){return this.#$i.textContent}set header(t){this.#$i.textContent=t??""}async update(t,e){return this.header=t,await this.#Ni.update(e,()=>this.#Di())}refresh(){return this.#Ni.request()}#Fi(){return this.#Mi??{dismissed:!0,result:null,response:null}}#zi(t){const e=this.#Pi;this.#Pi=[];for(const s of e)s(t)}disconnectedCallback(){this.#zi(this.#Fi())}open(){return this.ask()}ask(){return this.#Di()&&(this.#Ni.restChrome(),this.#Ni.request()),new Promise(t=>{this.#Pi.push(t)})}dismiss(t){return this.#Bi||!this.#_i.open?Promise.resolve(!0):this.#Ii(t,!0)}#Ii(t,e){return this.#Ni.dismiss(new CustomEvent("drawer:dismiss",{cancelable:e,detail:{reason:t}}),()=>this.close(),this.declared("guard-dismiss")?Oe:null)}close(t){if(this.#Bi||!this.#_i.open)return;if(t&&(this.#Mi={dismissed:!1,result:t,response:null}),matchMedia("(prefers-reduced-motion: reduce)").matches)return void this.#_i.close();this.#_i.setAttribute("closing","");const e=this.#_i.getAnimations();if(0===e.length)return void this.#Vi();this.#Bi=!0;const s=this.#ji.take();Promise.allSettled(e.map(t=>t.finished)).then(()=>{s.stale||this.#Vi()})}#Vi(){this.#Hi(),this.#_i.close()}#Hi(){this.#Bi=!1,this.#ji.invalidate(),this.#_i.removeAttribute("closing")}#Di(){return this.#Bi&&(this.#Mi=null),this.#Hi(),this.#_i.open&&!this.#_i.matches(":modal")&&this.#_i.removeAttribute("open"),!this.#_i.open&&(this.#Mi=null,this.#_i.showModal(),!0)}}class Ne extends C{static attributes=["for"];#Wi=null;#Ui=null;#Gi=t=>{const e=t.target;this.#Ui=this.matches(":popover-open")&&this.#Wi?.contains(e)?this.#Wi:null};connectedCallback(){super.connectedCallback(),this.rendered&&!this.declared("for")&&document.addEventListener("pointerdown",this.#Gi,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this.#Gi,!0)}render(){const t=this.declared("for"),e=t?document.getElementById(t):null;if(t&&!e)throw new Error(`ful-menu names no invoker: for="${t}" must name an element already in the page when the menu upgrades`);this.setAttribute("role","menu"),this.hasAttribute("popover")||this.setAttribute("popover",""),e?(this.#Wi=e,e.setAttribute("aria-haspopup","menu"),It.wire(e,this,{prefix:"ful-menu",invoke:!0,expanded:!0})):this.#Qi(),se(()=>this.#Wi,this,{items:()=>this.items}),this.#wi(),this.addEventListener("click",t=>{const e=t.target;this.items.some(t=>t===e||t.contains(e))&&this.hidePopover()})}showFor(t){if(this.declared("for"))throw new Error("ful-menu: showFor serves a menu without for; a menu with for is opened by its invoker");const e=this.#Ui;if(this.#Ui=null,e===t)return;this.#Wi&&this.#Wi!==t&&this.#Wi.setAttribute("aria-expanded","false"),this.#Wi=t,t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","true"),this.style.margin="";const s=Number.parseFloat(getComputedStyle(this).marginBlockStart)||0,i=this.matches(":popover-open");It.show(this,t,{flip:!0,gap:s}),i&&this.items[0]?.focus()}get items(){return this.#wi().filter(t=>!t.hasAttribute("disabled")&&!t.hasAttribute("hidden"))}#Qi(){document.addEventListener("pointerdown",this.#Gi,!0),this.addEventListener("toggle",t=>{"closed"===t.newState&&this.#Wi?.setAttribute("aria-expanded","false")})}#wi(){const t=[...this.querySelectorAll(":scope > button, :scope > a[href]")];for(const e of t)e.hasAttribute("role")||e.setAttribute("role","menuitem"),e.tabIndex=-1;return t}}const Pe=["info","success","warning","error"],Me=new Set;let Fe=!1;class ze extends C{static attributes=["timeout:number"];#Ki;connectedCallback(){super.connectedCallback(),this.rendered&&Me.add(this)}disconnectedCallback(){Me.delete(this)}render(){this.#Ki=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",P.of().t("toast.region")),this.setAttribute("popover","manual"),Fe||(Fe=!0,document.addEventListener("show-toast",t=>{if(t.detail)for(const e of Me)e.show(t.detail.message,t.detail)})),Me.add(this)}show(t,e={}){const s=Pe.includes(e.severity)?e.severity:"info",i=document.createElement("ful-toast");i.classList.add(s),i.setAttribute("role","error"===s?"alert":"status");const r=document.createElement("div");r.textContent=P.of().failure(t);const n=document.createElement("button");n.type="button",n.setAttribute("aria-label",P.of().t("toast.dismiss"));const a=document.createElement("ful-icon");a.setAttribute("name","x-lg"),a.setAttribute("aria-hidden","true"),n.append(a),i.append(r);let o=e.timeout??this.#Ki,l=performance.now(),u=0;const c=()=>{clearTimeout(u),i.contains(document.activeElement)&&this.focus(),matchMedia("(prefers-reduced-motion: reduce)").matches?i.remove():(i.classList.add("ful-toast-out"),0===i.getAnimations().length&&i.remove())};if(e.action?.label){const t=document.createElement("button");t.type="button",t.className="ful-toast-action",t.textContent=String(e.action.label),t.addEventListener("click",()=>{e.action.onClick?.(),c()}),i.append(t)}i.append(n),i.addEventListener("animationend",()=>{i.classList.contains("ful-toast-out")&&i.remove()});let d=0;const h=()=>{0===d&&(clearTimeout(u),o=Math.max(0,o-(performance.now()-l))),++d},p=()=>{0!==d&&0===--d&&(l=performance.now(),u=setTimeout(c,o))};return i.addEventListener("mouseenter",h),i.addEventListener("mouseleave",p),i.addEventListener("focusin",h),i.addEventListener("focusout",p),n.addEventListener("click",c),this.append(i),this.#Ji(),u=setTimeout(c,o),i}#Ji(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class Ie extends C{static slots=!0;static observed=["active:number"];static template='\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-start" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.previous\')"><ful-icon name="chevron-left" aria-hidden="true"></ful-icon></button>\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-end" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.next\')"><ful-icon name="chevron-right" aria-hidden="true"></ful-icon></button>\n {{{{ slots.default }}}}\n ';#Xi;#Yi;#Zi;#tr=[];#er=[];#ki=new Te;#sr=0;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#Xi=e.querySelector("ful-tablist"),this.#Yi=e.querySelector('[data-ref="scroll-start"]'),this.#Zi=e.querySelector('[data-ref="scroll-end"]');const s=[this.#Xi,this.#Yi,this.#Zi],i=[...this.#Xi.children];this.#er=[...e.children].filter(t=>!s.includes(t)),i.length!==this.#er.length&&console.warn(`ful-tabs: ${i.length} tabs declared for ${this.#er.length} panels, the surplus is left alone`);const r=Math.min(i.length,this.#er.length);this.#tr=[];for(let t=0;t!==r;++t){const e=this.#er[t],s=document.createElement("button");s.type="button",s.role="tab",s.id=d.uid("ful-tab"),e.id||(e.id=d.uid("ful-tabpanel")),s.setAttribute("aria-controls",e.id),e.role="tabpanel",e.setAttribute("aria-labelledby",s.id),e.tabIndex=0,s.append(...i[t].childNodes),s.addEventListener("click",()=>{this.active=t}),i[t].replaceWith(s),this.#tr.push(s)}this.#Xi.addEventListener("keydown",t=>{const e=this.#sr;let s=null;"ArrowRight"===t.key?s=(e+1)%this.#tr.length:"ArrowLeft"===t.key?s=(e-1+this.#tr.length)%this.#tr.length:"Home"===t.key?s=0:"End"===t.key&&(s=this.#tr.length-1),null!==s&&s!==e&&(t.preventDefault(),this.active=s,this.#tr[s].focus())}),this.#Yi.addEventListener("click",()=>this.#ir(-1)),this.#Zi.addEventListener("click",()=>this.#ir(1)),this.#Xi.addEventListener("scroll",()=>this.#rr(),{passive:!0});let n=-1;const a=new ResizeObserver(()=>{this.#rr(),this.#Xi.clientWidth!==n&&(n=this.#Xi.clientWidth,this.#nr(this.#tr[this.#sr],"auto"))});a.observe(this.#Xi);for(const t of this.#tr)a.observe(t);this.replaceChildren(e)}#rr(){const t=this.#Xi,e=t.scrollWidth-t.clientWidth,s=Math.abs(t.scrollLeft);this.#Yi.hidden=s<=1,this.#Zi.hidden=s>=e-1,this.#Yi.style.blockSize=this.#Zi.style.blockSize=`${t.clientHeight}px`}#ar(){const t=this.#Xi.getBoundingClientRect(),e="rtl"===getComputedStyle(this.#Xi).direction,[s,i]=e?[this.#Zi,this.#Yi]:[this.#Yi,this.#Zi];return{left:t.left+s.offsetWidth,right:t.right-i.offsetWidth}}#ir(t){const{left:e,right:s}=this.#ar(),i=t>0!=("rtl"===getComputedStyle(this.#Xi).direction)?t=>t.getBoundingClientRect().right>s+1:t=>t.getBoundingClientRect().left<e-1,r=t>0?this.#tr.find(i):this.#tr.findLast(i);this.#nr(r,matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth")}#nr(t,e){if(!t)return;const{left:s,right:i}=this.#ar(),r=t.getBoundingClientRect();r.right>i?this.#Xi.scrollBy({left:Math.ceil(r.right-i),behavior:e}):r.left<s&&this.#Xi.scrollBy({left:Math.floor(r.left-s),behavior:e})}get active(){return this.#sr}refresh(t){const e=t instanceof Element?this.#er.indexOf(t):Number.isInteger(t)?t:NaN,s=this.#er[e];if(s)return this.#ki.request(this,s,null,e).catch(()=>{});console.warn(`ful-tabs: no panel answers to "${t}"`)}set active(t){const e=Math.min(Math.max(0,Number(t)||0),Math.max(0,this.#tr.length-1)),s=this.#sr;for(const[t,s]of this.#tr.entries())s.setAttribute("aria-selected",t===e?"true":"false"),s.tabIndex=t===e?0:-1,this.#er[t].hidden=t!==e;this.#sr=e,this.reflectTo("active",e),this.#nr(this.#tr[e],"auto"),this.rendered&&e!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:e,previous:s}})),this.#er.length>0&&(e!==s||!this.rendered)&&this.#ki.request(this,this.#er[e],null,e).catch(()=>{})}}class De extends C{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#ie;#or=!1;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#ie=e.querySelector("ful-accordion-group"),this.replaceChildren(e)}get exclusive(){return this.#or}set exclusive(t){this.#or=!0===t,this.reflectTo("exclusive",this.#or);const e=this.#or?d.uid("ful-accordion"):null;for(const t of this.#ie.querySelectorAll(":scope > details"))null===e?t.removeAttribute("name"):t.setAttribute("name",e)}}class $e extends C{static slots=!0;static observed=["progress"];static template="\n <ful-steps><ol data-tpl-aria-label=\"#l10n:t('wizard.progress')\">{{{{ slots.steps }}}}</ol></ful-steps>\n {{{{ slots.default }}}}\n ";#lr=[];#Ni=[];#ki=new Te;#ur=0;#cr;render({slots:t}){const e=this.template().withOverlay({slots:t}).render(),s=[...e.querySelector("ful-steps ol").children];this.#Ni=[...e.children].filter(t=>"ful-steps"!==t.localName),s.length!==this.#Ni.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#Ni.length} sections, the surplus is left alone`);const i=Math.min(s.length,this.#Ni.length);this.#lr=[];for(let t=0;t!==i;++t){const e=document.createElement("li");e.append(...s[t].childNodes),s[t].replaceWith(e),this.#lr.push(e),this.#Ni[t].tabIndex=-1}if(this.replaceChildren(e),i>0){const t=this.#Ni.findIndex(t=>"step"===t.getAttribute("aria-current"));this.#dr(-1===t?0:Math.min(t,i-1)),this.#hr(this.#ur).catch(()=>{})}}get index(){return this.#ur}get step(){return this.#Ni[this.#ur]?.getAttribute("data-step")??null}get progress(){return this.#cr}set progress(t){this.#cr=t,this.reflectTo("progress",t)}next(){return this.#pr(this.#ur+1)}prev(){return this.#pr(this.#ur-1)}move(t){const e=this.#Ni.findIndex(e=>e.getAttribute("data-step")===t);if(!(-1===e||e>=this.#lr.length))return this.#pr(e);console.warn(`ful-wizard: no section paired with a step carries data-step="${t}"`)}refresh(t){const e=t instanceof Element?this.#Ni.indexOf(t):this.#Ni.findIndex(e=>e.getAttribute("data-step")===t);if(!(-1===e||e>=this.#lr.length))return this.#hr(e).catch(()=>{});console.warn(`ful-wizard: no section answers to "${t}"`)}#hr(t){return this.#ki.request(this,this.#Ni[t],this.#Ni[t].getAttribute("data-step"),t)}#pr(t){const e=Math.min(Math.max(0,t),Math.max(0,this.#lr.length-1));if(e!==this.#ur)return this.#dr(e),this.#Ni[this.#ur].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#ur,step:this.step}})),this.#hr(e)}#dr(t){for(const[e,s]of this.#lr.entries())e===t?(s.setAttribute("aria-current","step"),this.#Ni[e].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#Ni[e].removeAttribute("aria-current"));this.#ur=t}}const Be={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","table.loaded":"Showing {loaded} of {total}","table.range":"Rows {from}-{to} of {total}","table.retry":"Retry","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","failure.no-reason":"Something went wrong","dialog.acknowledge":"Got it","dialog.close":"Close","dialog.confirm":"Confirm","dialog.cancel":"Cancel","dialog.discard.header":"Unsaved changes","dialog.discard.body":"There are unsaved changes: close anyway?","dialog.discard.confirm":"Close without saving","dialog.discard.cancel":"Keep editing","drawer.close":"Close","spinner.loading":"Loading…","tabs.previous":"Previous tabs","tabs.next":"Next tabs","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","table.loaded":"Mostrati {loaded} di {total}","table.range":"Righe {from}-{to} di {total}","table.retry":"Riprova","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","dialog.discard.header":"Modifiche non salvate","dialog.discard.body":"Ci sono modifiche non salvate: chiudere comunque?","dialog.discard.confirm":"Chiudi senza salvare","dialog.discard.cancel":"Continua a modificare","drawer.close":"Chiudi","spinner.loading":"Caricamento…","tabs.previous":"Schede precedenti","tabs.next":"Schede successive","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","table.loaded":"Mostrando {loaded} de {total}","table.range":"Filas {from}-{to} de {total}","table.retry":"Reintentar","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{one:"Se ha superado el número máximo de {count} archivo",other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","failure.no-reason":"Se ha producido un error","dialog.acknowledge":"Entendido","dialog.close":"Cerrar","dialog.confirm":"Confirmar","dialog.cancel":"Cancelar","dialog.discard.header":"Cambios sin guardar","dialog.discard.body":"Hay cambios sin guardar: ¿cerrar de todos modos?","dialog.discard.confirm":"Cerrar sin guardar","dialog.discard.cancel":"Seguir editando","drawer.close":"Cerrar","spinner.loading":"Cargando…","tabs.previous":"Pestañas anteriores","tabs.next":"Pestañas siguientes","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","table.loaded":"Affichage de {loaded} sur {total}","table.range":"Lignes {from} à {to} sur {total}","table.retry":"Réessayer","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","dialog.discard.header":"Modifications non enregistrées","dialog.discard.body":"Des modifications ne sont pas enregistrées : fermer quand même ?","dialog.discard.confirm":"Fermer sans enregistrer","dialog.discard.cancel":"Continuer à modifier","drawer.close":"Fermer","spinner.loading":"Chargement…","tabs.previous":"Onglets précédents","tabs.next":"Onglets suivants","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class je{#fr;#mr;#gr;constructor(t={}){const e=t.language||navigator?.language||"en";try{this.#fr=Intl.getCanonicalLocales(String(e).replaceAll("_","-"))[0]}catch{throw new RangeError(`Plugin: language '${e}' is not a language tag: pass a BCP-47 tag such as 'it' or 'it-IT', or leave it out for the browser's language`)}this.#mr=t.translations??{},this.#gr=t.httpClient??null}configure(t){const e=this.#gr??G.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#fr.split("-")[0],i={...Be.en,...Be[s],...this.#mr};t.defineModule("l10n",P).defineComponent("http-client",e).defineElement("ful-tooltip",Ce).defineElement("ful-dialog",ke).defineElement("ful-drawer",Le).defineElement("ful-menu",Ne).defineElement("ful-toasts",ze).defineElement("ful-tabs",Ie).defineElement("ful-accordion",De).defineElement("ful-wizard",$e).defineElement("ful-form",gt).defineElement("ful-checkbox",Qt).defineElement("ful-input",xt).defineElement("ful-input-file",kt).defineElement("ful-local-date",Ct).defineElement("ful-instant",Tt).defineElement("ful-input-local-date",_t).defineElement("ful-input-local-time",Rt).defineElement("ful-input-instant",qt).defineElement("ful-radio-group",Gt).defineElement("ful-table",ee).defineElement("ful-pagination",Jt).defineElement("ful-sorter",Kt).defineElement("ful-filter-instant",be).defineElement("ful-filter-local-date",ve).defineElement("ful-filter-number",ye).defineElement("ful-filter-boolean",Ae).defineElement("ful-filter-text",we).defineElement("ful-filter-in",Se).defineElement("ful-select",Ut).defineElement("ful-dropdown",Wt).defineComponent("loaders:select",Vt).defineComponent("loaders:form",ft).defineComponent("loaders:table",te).defineOverlay({l10n:i,locale:this.#fr})}}var He=Object.freeze({__proto__:null,Accordion:De,Anchors:It,AsyncEvents:nt,Bindings:ct,BooleanFilter:Ae,Checkbox:Qt,Claims:ot,CompareFilter:ge,Dialog:ke,Drawer:Le,Dropdown:Wt,Field:dt,Form:gt,FormLoader:ft,InFilter:Se,Input:xt,InputFile:kt,InputInstant:qt,InputLocalDate:_t,InputLocalTime:Rt,Instant:Tt,InstantFilter:be,LocalDate:Ct,LocalDateFilter:ve,LocalStorage:et,Menu:Ne,NumberFilter:ye,PageLeave:at,Pagination:Jt,Plugin:je,RadioGroup:Gt,Select:Ut,SelectLoader:Vt,SessionStorage:st,SortButton:Kt,Table:ee,TableLoader:te,Tabs:Ie,TextFilter:we,Timing:ut,Toasts:ze,Tooltip:Ce,VersionedLocalStorage:it,VersionedSessionStorage:rt,Wizard:$e,describable:lt});return"undefined"!=typeof window&&(window.ftl=M,window.httpc=Y,window.ful=He),t.Accordion=De,t.Anchors=It,t.AsyncEvents=nt,t.Attributes=d,t.Base64=z,t.Bindings=ct,t.BooleanFilter=Ae,t.BoundedCache=e,t.Checkbox=Qt,t.Claims=ot,t.CompareFilter=ge,t.Dialog=ke,t.Drawer=Le,t.Dropdown=Wt,t.ExpressionEvaluator=u,t.Expressions=l,t.Failure=F,t.Field=dt,t.Form=gt,t.FormLoader=ft,t.Fragments=c,t.Hex=I,t.HttpClient=G,t.HttpClientBuilder=V,t.HttpClientError=$,t.HttpInterceptorChain=U,t.HttpMultipartRequestCustomizer=X,t.HttpRequestBuilder=J,t.InFilter=Se,t.Input=xt,t.InputFile=kt,t.InputInstant=qt,t.InputLocalDate=_t,t.InputLocalTime=Rt,t.Instant=Tt,t.InstantFilter=be,t.LightSlots=h,t.LocalDate=Ct,t.LocalDateFilter=ve,t.LocalStorage=et,t.Localization=P,t.MediaType=D,t.Menu=Ne,t.Nodes=p,t.NumberFilter=ye,t.PageLeave=at,t.Pagination=Jt,t.ParsedElement=C,t.Plugin=je,t.RadioGroup=Gt,t.Registry=E,t.RenderError=y,t.Rendering=S,t.Select=Ut,t.SelectLoader=Vt,t.SessionStorage=st,t.SortButton=Kt,t.Table=ee,t.TableLoader=te,t.Tabs=Ie,t.Template=v,t.Templates=A,t.TextFilter=we,t.Timing=ut,t.Toasts=ze,t.Tooltip=Ce,t.VersionedLocalStorage=it,t.VersionedSessionStorage=rt,t.Wizard=$e,t.describable=lt,t.registry=x,t}({});
|
|
1
|
+
var fml=function(t){"use strict";class e{#t;#e=new Map;constructor(t){this.#t=t}getOrCompute(t,e){if(this.#e.has(t))return this.#e.get(t);const s=e(t);return this.#e.size>=this.#t&&this.#e.delete(this.#e.keys().next().value),this.#e.set(t,s),s}get size(){return this.#e.size}}const s={ter:Symbol("ternary"),elv:Symbol("elvis"),nullc:Symbol("null-coalescence"),or:Symbol("or"),and:Symbol("and"),eq:Symbol("eq"),cmp:Symbol("cmp"),not:Symbol("not"),access:Symbol("access"),member:Symbol("access-member"),subscript:Symbol("access-subscript"),method:Symbol("access-method-call"),call:Symbol("module-function-call"),tstring:Symbol("tstring"),literal:Symbol("literal"),array:Symbol("array-literal"),dict:Symbol("dict-literal"),function:Symbol("module-function"),symbol:Symbol("symbol"),templated:{ten:Symbol("templated-node"),teh:Symbol("templated-html"),tet:Symbol("templated-text"),tel:Symbol("templated-literal")},dom:{t:Symbol("text"),h:Symbol("html"),n:Symbol("node")}},i=new Map([["true",!0],["false",!1],["null",null],["undefined",void 0]]);class r extends SyntaxError{constructor(t,e,s,i){super(t),this.expected=e,this.found=s,this.location=i,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let s=null;const i=t.find(t=>t.source===this.location.source);i&&(s=i.text.split(/\r\n|\n|\r/g));const r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(s){const t=this.location.end,i="".padEnd(n.line.toString().length," "),o=s[r.line-1],l=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --\x3e "+a+"\n"+i+" |\n"+n.line+" | "+o+"\n"+i+" | "+"".padEnd(r.column-1," ")+"".padEnd(l,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function s(t){return t.codePointAt(0).toString(16).toUpperCase()}const i=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t,e){return function(t){return i?t.replace(i,t=>"\\u{"+s(t)+"}"):t}(t.replace(e,"\\$&").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 n(t){return r(t,/[\\"]/g)}function a(t){return r(t,/[\\\]^-]/g)}const o={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 l(t){return o[t.type](t)}return"Expected "+function(t){const e=t.map(l);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."}}const n=(t,e)=>{if("self"===e)return t[t.length-1];for(let s=t.length-1;s>=0;s--){const i=t[s];if(null!=i&&("object"==typeof i||"function"==typeof i)&&e in i)return i[e]}},a=Symbol("BOUND");class o{#s;#i;#r;constructor(t,e,s){this.#s=t,this.#i=e,this.#r=s??e.length}#n(t){return n(this.#i,t)}#a(t,e){const i=0===e?t.lhs:t.rhs[e-1];return i.type===s.symbol?i.value:i.type===s.member?i.rhs:null}#o;#l(){if(!this.#o){const t=t=>n(this.#i.slice(0,this.#r),t);this.#o=new Proxy(this.#i,{get:(e,s)=>s===a?t:this.#n(s)})}return this.#o}[s.and](t){return this.visit(t.lhs)&&this.visit(t.rhs)}[s.or](t){return this.visit(t.lhs)||this.visit(t.rhs)}[s.nullc](t){return this.visit(t.lhs)??this.visit(t.rhs)}[s.not](t){return!this.visit(t.expr)}[s.eq](t){const e=this.visit(t.lhs)===this.visit(t.rhs);return"=="===t.op?e:!e}[s.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}`)}}[s.call](t){const e=t.value,s=null===e.module?this.#s:this.#s?.[e.module];if(!s)throw new Error(`Module "${e.module}" not found`);const i=s[e.value];if(!i)throw new Error(`Function "#${null===e.module?"":`${e.module}:`}${e.value}" not found`);const r=t.args.map(t=>this.visit(t));return i.apply(this.#l(),r)}[s.literal](t){return t.value}[s.tstring](t){let e="";const s=t.parts;for(let t=0,i=s.length;t<i;t++){const i=this.visit(s[t]);null!=i&&(e+=i)}return e}[s.symbol](t){return this.#n(t.value)}[s.dict](t){return Object.fromEntries(t.value.map(t=>[this.visit(t[0]),this.visit(t[1])]))}[s.array](t){return t.value.map(t=>this.visit(t))}[s.ter](t){return this.visit(t.cond)?this.visit(t.ifTrue):this.visit(t.ifFalse)}[s.elv](t){return this.visit(t.cond)||this.visit(t.ifFalse)}[s.access](t){let e,i=this.visit(t.lhs);for(let r=0;r!==t.rhs.length;++r){const n=t.rhs[r];if(n.ns&&null==i)return;let a;switch(n.type){case s.member:a=i[n.rhs];break;case s.subscript:a=i[this.visit(n.rhs)];break;case s.method:{if(!i){const e=this.#a(t,r);throw new Error(null===e?"Method missing":`Method missing "${e}"`)}const s=n.args.map(t=>this.visit(t));a=i.apply(e,s);break}}e=i,i=a}return i}visit(t,...e){return this[t.type](t,...e)}visitRoot(t,e){return e?t.map(t=>{switch(t.type){case s.templated.tel:return{type:s.dom.t,value:t.value};case s.templated.tet:return{type:s.dom.t,value:this.visit(t.value)};case s.templated.teh:return{type:s.dom.h,value:this.visit(t.value)};case s.templated.ten:return{type:s.dom.n,value:this.visit(t.value)};default:throw new Error(`unknown node type ${t.type.toString()}`)}}):this.visit(t)}}class l{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static BOUND=a;static#u=new e(1e3);static parse(t,e){const n=e?.toString()+t;return this.#u.getOrCompute(n,()=>function(t,e){const n={},a=(e=void 0!==e?e:{}).grammarSource,o={TemplatedRoot:le,ExpressionRoot:ce};let l=le;const u="{{{{",c="}}}}",d="{{{",h="}}}",p="{{",f="}}",m="\\",g="{",b="?",v=":",y="?:",w="??",E="||",x="&&",A="!",S="?.",C=".",T="[",_="]",R="(",q=",",k=")",O="-",L="'",N='"',P="`",M="}",F="#",z="==",I="!=",D=">=",$=">",B="<=",j="<",H=se("{{{{",!1),V=se("}}}}",!1),W=se("{{{",!1),U=se("}}}",!1),G=se("{{",!1),Q=se("}}",!1),K=ie(["\\","{"],!0,!1,!1),J=se("\\",!1),X={type:"any"},Y=se("{",!1),Z=se("?",!1),tt=se(":",!1),et=se("?:",!1),st=se("??",!1),it=se("||",!1),rt=se("&&",!1),nt=se("!",!1),at=re("member"),ot=se("?.",!1),lt=se(".",!1),ut=re("subscript"),ct=se("[",!1),dt=se("]",!1),ht=re("method-call"),pt=se("(",!1),ft=se(",",!1),mt=se(")",!1),gt=re("module-function-call"),bt=re("number-literal"),vt=se("-",!1),yt=ie([["0","9"]],!1,!1,!1),wt=re("string-literal"),Et=se("'",!1),xt=ie(["'"],!0,!1,!1),At=se('"',!1),St=ie(['"'],!0,!1,!1),Ct=se("`",!1),Tt=re("tstring-expression"),_t=se("}",!1),Rt=re("tstring-literal"),qt=ie(["\\","`","{"],!0,!1,!1),kt=re("array-literal"),Ot=re("dict-literal"),Lt=re("module-function"),Nt=se("#",!1),Pt=ie([["a","z"],["A","Z"],"$","_"],!1,!1,!1),Mt=ie([["a","z"],["A","Z"],"$","_",["0","9"]],!1,!1,!1),Ft=re("identifier-or-keyword"),zt=se("==",!1),It=se("!=",!1),Dt=se(">=",!1),$t=se(">",!1),Bt=se("<=",!1),jt=se("<",!1),Ht=ie([" ","\t","\n","\r"],!1,!1,!1);function Vt(t){return t}function Wt(t,e,s){return{op:e,rhs:s}}function Ut(t,e,s){return{op:e,rhs:s}}function Gt(t){return t}let Qt=0|e.peg$currPos;const Kt=[{line:1,column:1}];let Jt,Xt,Yt=Qt,Zt=e.peg$maxFailExpected||[],te=0|e.peg$silentFails,ee=new Map;if(e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');l=o[e.startRule]}function se(t,e){return{type:"literal",text:t,ignoreCase:e}}function ie(t,e,s,i){return{type:"class",parts:t,inverted:e,ignoreCase:s,unicode:i}}function re(t){return{type:"other",description:t}}function ne(e){let s,i=Kt[e];if(i)return i;if(e>=Kt.length)s=Kt.length-1;else for(s=e;!Kt[--s];);for(i=Kt[s],i={line:i.line,column:i.column};s<e;)10===t.charCodeAt(s)?(i.line++,i.column=1):i.column++,s++;return Kt[e]=i,i}function ae(t,e,s){const i=ne(t),r=ne(e);return{source:a,start:{offset:t,line:i.line,column:i.column},end:{offset:e,line:r.line,column:r.column}}}function oe(t){Qt<Yt||(Qt>Yt&&(Yt=Qt,Zt=[]),Zt.push(t))}function le(){let t,e;const s=38*Qt+0,i=ee.get(s);if(i)return Qt=i.nextPos,i.result;for(t=[];e=ue(),e!==n;)t.push(e);return ee.set(s,{nextPos:Qt,result:t}),t}function ue(){let e,i,r,a,o;const l=38*Qt+1,b=ee.get(l);return b?(Qt=b.nextPos,b.result):(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+2,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,4)===u?(e=u,Qt+=4):(e=n,0===te&&oe(H)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+3,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,4)===c?(e=c,Qt+=4):(e=n,0===te&&oe(V)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(v=i,i={type:s.templated.ten,value:v}),e=i,e===n&&(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+4,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,3)===d?(e=d,Qt+=3):(e=n,0===te&&oe(W)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+5,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,3)===h?(e=h,Qt+=3):(e=n,0===te&&oe(U)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(i=function(t){return{type:s.templated.teh,value:t}}(i)),e=i,e===n&&(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+6,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===p?(e=p,Qt+=2):(e=n,0===te&&oe(G)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+7,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===f?(e=f,Qt+=2):(e=n,0===te&&oe(Q)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(i=function(t){return{type:s.templated.tet,value:t}}(i)),e=i,e===n&&(e=Qt,i=function(){let e,s,i,r,a,o,l;const u=38*Qt+8,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;for(e=Qt,s=[];;){for(i=Qt,r=[];a=t.charAt(Qt),""!==a&&(Xt=a.charCodeAt(0),92!==Xt&&123!==Xt)?Qt++:(a=n,0===te&&oe(K)),a!==n;)r.push(a);if(r.length<1&&(r=n),i=r!==n?t.substring(i,Qt):r,i===n&&(i=Qt,92===t.charCodeAt(Qt)?(r=m,Qt++):(r=n,0===te&&oe(J)),r!==n?(t.length>Qt?(a=t.charAt(Qt),Qt++):(a=n,0===te&&oe(X)),a!==n?i=Vt(a):(Qt=i,i=n)):(Qt=i,i=n),i===n&&(i=Qt,r=Qt,123===t.charCodeAt(Qt)?(a=g,Qt++):(a=n,0===te&&oe(Y)),a!==n?(o=Qt,te++,123===t.charCodeAt(Qt)?(l=g,Qt++):(l=n,0===te&&oe(Y)),te--,l===n?o=void 0:(Qt=o,o=n),o!==n?(a=[a,o],r=a):(Qt=r,r=n)):(Qt=r,r=n),i=r!==n?t.substring(i,Qt):r)),i===n)break;s.push(i)}return s.length<1&&(s=n),s!==n&&(s=s.join("")),e=s,ee.set(u,{nextPos:Qt,result:e}),e}(),i!==n&&(i=function(t){return{type:s.templated.tel,value:t}}(i)),e=i))),ee.set(l,{nextPos:Qt,result:e}),e);var v}function ce(){let t,e;const s=38*Qt+9,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t=Qt,_e(),e=de(),e!==n?(_e(),t=e):(Qt=t,t=n),ee.set(s,{nextPos:Qt,result:t}),t)}function de(){let e,i,r,a,o,l;const u=38*Qt+10,c=ee.get(u);return c?(Qt=c.nextPos,c.result):(e=Qt,i=he(),i!==n?(_e(),63===t.charCodeAt(Qt)?(r=b,Qt++):(r=n,0===te&&oe(Z)),r!==n?(_e(),a=de(),a!==n?(_e(),58===t.charCodeAt(Qt)?(o=v,Qt++):(o=n,0===te&&oe(tt)),o!==n?(_e(),l=de(),l!==n?e={type:s.ter,cond:i,ifTrue:a,ifFalse:l}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=he()),ee.set(u,{nextPos:Qt,result:e}),e)}function he(){let e,i,r,a;const o=38*Qt+11,l=ee.get(o);return l?(Qt=l.nextPos,l.result):(e=Qt,i=pe(),i!==n?(_e(),t.substr(Qt,2)===y?(r=y,Qt+=2):(r=n,0===te&&oe(et)),r!==n?(_e(),a=he(),a!==n?e={type:s.elv,cond:i,ifFalse:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=pe()),ee.set(o,{nextPos:Qt,result:e}),e)}function pe(){let e,i,r,a;const o=38*Qt+12,l=ee.get(o);return l?(Qt=l.nextPos,l.result):(e=Qt,i=fe(),i!==n?(_e(),t.substr(Qt,2)===w?(r=w,Qt+=2):(r=n,0===te&&oe(st)),r!==n?(_e(),a=pe(),a!==n?e={type:s.nullc,lhs:i,rhs:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=fe()),ee.set(o,{nextPos:Qt,result:e}),e)}function fe(){let e,i,r,a,o,l;const u=38*Qt+13,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;if(e=Qt,i=me(),i!==n){for(r=[];a=Qt,_e(),t.substr(Qt,2)===E?(o=E,Qt+=2):(o=n,0===te&&oe(it)),o!==n?(_e(),l=me(),l!==n?a=l:(Qt=a,a=n)):(Qt=a,a=n),a!==n;)r.push(a);e=function(t,e){let i=t;for(const t of e)i={type:s.or,lhs:i,rhs:t};return i}(i,r)}else Qt=e,e=n;return ee.set(u,{nextPos:Qt,result:e}),e}function me(){let e,i,r,a,o,l;const u=38*Qt+14,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;if(e=Qt,i=ge(),i!==n){for(r=[];a=Qt,_e(),t.substr(Qt,2)===x?(o=x,Qt+=2):(o=n,0===te&&oe(rt)),o!==n?(_e(),l=ge(),l!==n?a=l:(Qt=a,a=n)):(Qt=a,a=n),a!==n;)r.push(a);e=function(t,e){let i=t;for(const t of e)i={type:s.and,lhs:i,rhs:t};return i}(i,r)}else Qt=e,e=n;return ee.set(u,{nextPos:Qt,result:e}),e}function ge(){let t,e,i,r,a,o;const l=38*Qt+15,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(t=Qt,e=be(),e!==n){for(i=[];r=Qt,_e(),a=Ce(),a!==n?(_e(),o=be(),o!==n?r=Wt(0,a,o):(Qt=r,r=n)):(Qt=r,r=n),r!==n;)i.push(r);t=function(t,e){let i=t;for(const t of e)i={type:s.eq,op:t.op,lhs:i,rhs:t.rhs};return i}(e,i)}else Qt=t,t=n;return ee.set(l,{nextPos:Qt,result:t}),t}function be(){let t,e,i,r,a,o;const l=38*Qt+16,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(t=Qt,e=ve(),e!==n){for(i=[];r=Qt,_e(),a=Te(),a!==n?(_e(),o=ve(),o!==n?r=Ut(0,a,o):(Qt=r,r=n)):(Qt=r,r=n),r!==n;)i.push(r);t=function(t,e){let i=t;for(const t of e)i={type:s.cmp,op:t.op,lhs:i,rhs:t.rhs};return i}(e,i)}else Qt=t,t=n;return ee.set(l,{nextPos:Qt,result:t}),t}function ve(){let e,i,r;const a=38*Qt+17,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(e=Qt,33===t.charCodeAt(Qt)?(i=A,Qt++):(i=n,0===te&&oe(nt)),i!==n?(_e(),r=ve(),r!==n?e={type:s.not,expr:r}:(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=function(){let t,e,i,r,a;const o=38*Qt+18,l=ee.get(o);if(l)return Qt=l.nextPos,l.result;if(t=Qt,e=we(),e!==n){for(_e(),i=[];r=Qt,a=ye(),a!==n?(_e(),r=a):(Qt=r,r=n),r!==n;)i.push(r);i.length<1&&(i=n),i!==n?t={type:s.access,lhs:e,rhs:i}:(Qt=t,t=n)}else Qt=t,t=n;return t===n&&(t=we()),ee.set(o,{nextPos:Qt,result:t}),t}()),ee.set(a,{nextPos:Qt,result:e}),e)}function ye(){let e;const i=38*Qt+19,r=ee.get(i);return r?(Qt=r.nextPos,r.result):(e=function(){let e,i,r;const a=38*Qt+20,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(46===t.charCodeAt(Qt)?(i=C,Qt++):(i=n,0===te&&oe(lt))),i!==n?(_e(),r=Se(),r!==n?e={type:s.member,ns:"?."===i,rhs:r}:(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(at)),ee.set(a,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let e,i,r,a,o;const l=38*Qt+21,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(i=null),91===t.charCodeAt(Qt)?(r=T,Qt++):(r=n,0===te&&oe(ct)),r!==n?(_e(),a=de(),a!==n?(_e(),93===t.charCodeAt(Qt)?(o=_,Qt++):(o=n,0===te&&oe(dt)),o!==n?e={type:s.subscript,ns:null!==i,rhs:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(ut)),ee.set(l,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let e,i,r,a,o,l,u,c;const d=38*Qt+22,h=ee.get(d);if(h)return Qt=h.nextPos,h.result;if(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(i=null),40===t.charCodeAt(Qt)?(r=R,Qt++):(r=n,0===te&&oe(pt)),r!==n){for(_e(),a=Qt,o=de(),o!==n?(l=_e(),a=o):(Qt=a,a=n),a===n&&(a=null),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=q,Qt++):(u=n,0===te&&oe(ft)),u!==n?(_e(),c=de(),c!==n?(_e(),l=c):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);41===t.charCodeAt(Qt)?(l=k,Qt++):(l=n,0===te&&oe(mt)),l!==n?e=function(t,e,i){return{type:s.method,ns:null!==t,args:null===e?[]:[e,...i]}}(i,a,o):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(ht)),ee.set(d,{nextPos:Qt,result:e}),e}())),ee.set(i,{nextPos:Qt,result:e}),e)}function we(){let e,r,a,o;const l=38*Qt+23,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(e=Qt,40===t.charCodeAt(Qt)?(r=R,Qt++):(r=n,0===te&&oe(pt)),r!==n?(_e(),a=de(),a!==n?(_e(),41===t.charCodeAt(Qt)?(o=k,Qt++):(o=n,0===te&&oe(mt)),o!==n?e=a:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=function(){let e,i,r,a,o,l,u,c;const d=38*Qt+24,h=ee.get(d);if(h)return Qt=h.nextPos,h.result;if(te++,e=Qt,i=function(){let e,i,r,a,o;const l=38*Qt+32,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(te++,e=Qt,35===t.charCodeAt(Qt)?(i=F,Qt++):(i=n,0===te&&oe(Nt)),i!==n?(r=Qt,a=Se(),a!==n?(58===t.charCodeAt(Qt)?(o=v,Qt++):(o=n,0===te&&oe(tt)),o!==n?r=a:(Qt=r,r=n)):(Qt=r,r=n),r===n&&(r=null),a=Se(),a!==n?e={type:s.function,module:r,value:a}:(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(Lt)),ee.set(l,{nextPos:Qt,result:e}),e)}(),i!==n)if(40===t.charCodeAt(Qt)?(r=R,Qt++):(r=n,0===te&&oe(pt)),r!==n){for(_e(),a=Qt,o=de(),o!==n?(l=_e(),a=o):(Qt=a,a=n),a===n&&(a=null),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=q,Qt++):(u=n,0===te&&oe(ft)),u!==n?(_e(),c=de(),c!==n?(_e(),l=c):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);41===t.charCodeAt(Qt)?(l=k,Qt++):(l=n,0===te&&oe(mt)),l!==n?e=function(t,e,i){const r=null===e?[]:[e,...i];return{type:s.call,value:t,args:r}}(i,a,o):(Qt=e,e=n)}else Qt=e,e=n;else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(gt)),ee.set(d,{nextPos:Qt,result:e}),e}(),e===n&&(e=function(){let e;const i=38*Qt+25,r=ee.get(i);return r?(Qt=r.nextPos,r.result):(e=function(){let e,i,r,a,o,l,u,c,d,h;const p=38*Qt+26,f=ee.get(p);if(f)return Qt=f.nextPos,f.result;for(te++,e=Qt,i=Qt,r=Qt,45===t.charCodeAt(Qt)?(a=O,Qt++):(a=n,0===te&&oe(vt)),a===n&&(a=null),o=Qt,l=[];u=t.charAt(Qt),Xt=u.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(u=n,0===te&&oe(yt)),u!==n;)l.push(u);if(l.length<1&&(l=n),l!==n){if(u=Qt,46===t.charCodeAt(Qt)?(c=C,Qt++):(c=n,0===te&&oe(lt)),c!==n){for(d=[];h=t.charAt(Qt),Xt=h.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(h=n,0===te&&oe(yt)),h!==n;)d.push(h);c=[c,d],u=c}else Qt=u,u=n;u===n&&(u=null),l=[l,u],o=l}else Qt=o,o=n;if(o===n)if(o=Qt,46===t.charCodeAt(Qt)?(l=C,Qt++):(l=n,0===te&&oe(lt)),l!==n){for(u=[];c=t.charAt(Qt),Xt=c.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(c=n,0===te&&oe(yt)),c!==n;)u.push(c);u.length<1&&(u=n),u!==n?(l=[l,u],o=l):(Qt=o,o=n)}else Qt=o,o=n;return o!==n?(a=[a,o],r=a):(Qt=r,r=n),i=r!==n?t.substring(i,Qt):r,i!==n&&(i={type:s.literal,value:parseFloat(i)}),e=i,te--,e===n&&(i=n,0===te&&oe(bt)),ee.set(p,{nextPos:Qt,result:e}),e}(),e===n&&(e=Ee(),e===n&&(e=function(){let e,i,r,a,o,l,u;const c=38*Qt+30,d=ee.get(c);if(d)return Qt=d.nextPos,d.result;if(te++,e=Qt,91===t.charCodeAt(Qt)?(i=T,Qt++):(i=n,0===te&&oe(ct)),i!==n){for(_e(),r=de(),r===n&&(r=null),_e(),a=[];o=Qt,44===t.charCodeAt(Qt)?(l=q,Qt++):(l=n,0===te&&oe(ft)),l!==n?(_e(),u=de(),u!==n?(_e(),o=u):(Qt=o,o=n)):(Qt=o,o=n),o!==n;)a.push(o);93===t.charCodeAt(Qt)?(o=_,Qt++):(o=n,0===te&&oe(dt)),o!==n?e=function(t,e){const i=null===t?[]:[t,...e];return{type:s.array,value:i}}(r,a):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(kt)),ee.set(c,{nextPos:Qt,result:e}),e}(),e===n&&(e=function(){let e,i,r,a,o,l,u,c,d,h,p;const f=38*Qt+31,m=ee.get(f);if(m)return Qt=m.nextPos,m.result;if(te++,e=Qt,123===t.charCodeAt(Qt)?(i=g,Qt++):(i=n,0===te&&oe(Y)),i!==n){for(_e(),r=Qt,a=Ee(),a!==n?(o=_e(),58===t.charCodeAt(Qt)?(l=v,Qt++):(l=n,0===te&&oe(tt)),l!==n?(u=_e(),c=de(),c!==n?r=[a,c]:(Qt=r,r=n)):(Qt=r,r=n)):(Qt=r,r=n),r===n&&(r=null),a=_e(),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=q,Qt++):(u=n,0===te&&oe(ft)),u!==n?(c=_e(),d=Ee(),d!==n?(_e(),58===t.charCodeAt(Qt)?(h=v,Qt++):(h=n,0===te&&oe(tt)),h!==n?(_e(),p=de(),p!==n?(_e(),l=[d,p]):(Qt=l,l=n)):(Qt=l,l=n)):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);125===t.charCodeAt(Qt)?(l=M,Qt++):(l=n,0===te&&oe(_t)),l!==n?e=function(t,e){var i=[];return null!==t&&i.push(t),i.push.apply(i,e),{type:s.dict,value:i}}(r,o):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(Ot)),ee.set(f,{nextPos:Qt,result:e}),e}()))),ee.set(i,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let t,e;const r=38*Qt+34,a=ee.get(r);return a?(Qt=a.nextPos,a.result):(te++,t=Qt,e=Se(),e!==n&&(o=e,e=i.has(o)?{type:s.literal,value:i.get(o)}:{type:s.symbol,value:o}),t=e,te--,t===n&&(e=n,0===te&&oe(Ft)),ee.set(r,{nextPos:Qt,result:t}),t);var o}()))),ee.set(l,{nextPos:Qt,result:e}),e)}function Ee(){let e,i,r,a,o;const l=38*Qt+27,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(te++,e=Qt,39===t.charCodeAt(Qt)?(i=L,Qt++):(i=n,0===te&&oe(Et)),i!==n){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),39!==Xt)?Qt++:(o=n,0===te&&oe(xt)),o!==n;)a.push(o);r=t.substring(r,Qt),39===t.charCodeAt(Qt)?(a=L,Qt++):(a=n,0===te&&oe(Et)),a!==n?e={type:s.literal,value:r}:(Qt=e,e=n)}else Qt=e,e=n;if(e===n){if(e=Qt,34===t.charCodeAt(Qt)?(i=N,Qt++):(i=n,0===te&&oe(At)),i!==n){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),34!==Xt)?Qt++:(o=n,0===te&&oe(St)),o!==n;)a.push(o);r=t.substring(r,Qt),34===t.charCodeAt(Qt)?(a=N,Qt++):(a=n,0===te&&oe(At)),a!==n?e={type:s.literal,value:r}:(Qt=e,e=n)}else Qt=e,e=n;if(e===n)if(e=Qt,96===t.charCodeAt(Qt)?(i=P,Qt++):(i=n,0===te&&oe(Ct)),i!==n){for(r=[];a=xe(),a===n&&(a=Ae()),a!==n;)r.push(a);96===t.charCodeAt(Qt)?(a=P,Qt++):(a=n,0===te&&oe(Ct)),a!==n?e={type:s.tstring,parts:r}:(Qt=e,e=n)}else Qt=e,e=n}return te--,e===n&&(i=n,0===te&&oe(wt)),ee.set(l,{nextPos:Qt,result:e}),e}function xe(){let e,s,i,r;const a=38*Qt+28,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(te++,e=Qt,123===t.charCodeAt(Qt)?(s=g,Qt++):(s=n,0===te&&oe(Y)),s!==n?(_e(),i=de(),i!==n?(_e(),125===t.charCodeAt(Qt)?(r=M,Qt++):(r=n,0===te&&oe(_t)),r!==n?e=i:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(s=n,0===te&&oe(Tt)),ee.set(a,{nextPos:Qt,result:e}),e)}function Ae(){let e,i,r,a,o;const l=38*Qt+29,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;for(te++,e=Qt,i=[];;){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),92!==Xt&&96!==Xt&&123!==Xt)?Qt++:(o=n,0===te&&oe(qt)),o!==n;)a.push(o);if(a.length<1&&(a=n),r=a!==n?t.substring(r,Qt):a,r===n&&(r=Qt,92===t.charCodeAt(Qt)?(a=m,Qt++):(a=n,0===te&&oe(J)),a!==n?(t.length>Qt?(o=t.charAt(Qt),Qt++):(o=n,0===te&&oe(X)),o!==n?r=Gt(o):(Qt=r,r=n)):(Qt=r,r=n)),r===n)break;i.push(r)}return i.length<1&&(i=n),i!==n&&(i={type:s.literal,value:i.join("")}),e=i,e===n&&(e=Qt,123===t.charCodeAt(Qt)?(i=g,Qt++):(i=n,0===te&&oe(Y)),i!==n&&(i={type:s.literal,value:i}),e=i),te--,e===n&&(i=n,0===te&&oe(Rt)),ee.set(l,{nextPos:Qt,result:e}),e}function Se(){let e,s,i,r,a;const o=38*Qt+33,l=ee.get(o);if(l)return Qt=l.nextPos,l.result;if(e=Qt,s=Qt,i=t.charAt(Qt),Xt=i.charCodeAt(0),Xt>=97&&Xt<=122||Xt>=65&&Xt<=90||36===Xt||95===Xt?Qt++:(i=n,0===te&&oe(Pt)),i!==n){for(r=[];a=t.charAt(Qt),Xt=a.charCodeAt(0),Xt>=97&&Xt<=122||Xt>=65&&Xt<=90||36===Xt||95===Xt||Xt>=48&&Xt<=57?Qt++:(a=n,0===te&&oe(Mt)),a!==n;)r.push(a);i=[i,r],s=i}else Qt=s,s=n;return e=s!==n?t.substring(e,Qt):s,ee.set(o,{nextPos:Qt,result:e}),e}function Ce(){let e;const s=38*Qt+35,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===z?(e=z,Qt+=2):(e=n,0===te&&oe(zt)),e===n&&(t.substr(Qt,2)===I?(e=I,Qt+=2):(e=n,0===te&&oe(It))),ee.set(s,{nextPos:Qt,result:e}),e)}function Te(){let e;const s=38*Qt+36,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===D?(e=D,Qt+=2):(e=n,0===te&&oe(Dt)),e===n&&(62===t.charCodeAt(Qt)?(e=$,Qt++):(e=n,0===te&&oe($t)),e===n&&(t.substr(Qt,2)===B?(e=B,Qt+=2):(e=n,0===te&&oe(Bt)),e===n&&(60===t.charCodeAt(Qt)?(e=j,Qt++):(e=n,0===te&&oe(jt))))),ee.set(s,{nextPos:Qt,result:e}),e)}function _e(){let e,s;const i=38*Qt+37,r=ee.get(i);if(r)return Qt=r.nextPos,r.result;for(te++,e=[];s=t.charAt(Qt),Xt=s.charCodeAt(0),32===Xt||9===Xt||10===Xt||13===Xt?Qt++:(s=n,0===te&&oe(Ht)),s!==n;)e.push(s);return te--,ee.set(i,{nextPos:Qt,result:e}),e}Jt=l();const Re=Jt!==n&&Qt===t.length;function qe(){throw Jt!==n&&Qt<t.length&&oe({type:"end"}),e=Zt,s=Yt<t.length?function(e=Qt){const s=t.codePointAt(e);return void 0===s?"":String.fromCodePoint(s)}(Yt):null,i=Yt<t.length?ae(Yt,Yt+1):ae(Yt,Yt),new r(r.buildMessage(e,s),e,s,i);var e,s,i}return e.peg$library?{peg$result:Jt,peg$currPos:Qt,peg$FAILED:n,peg$maxFailExpected:Zt,peg$maxFailPos:Yt,peg$success:Re,peg$throw:Re?void 0:qe}:Re?Jt:void qe()}(t,{startRule:e===l.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}static evaluate(t,e,s,i,r){return new o(t,e,r).visitRoot(s,i===l.MODE_TEMPLATED)}static interpret(t,e,s,i,r){return l.evaluate(t,e,l.parse(s,i),i,r)}}class u{#s;#i;#r;constructor(t,e,s){this.#s=t,this.#i=e,this.#r=s??e.length}withModule(t,e){const s=t?{[t]:e}:e;return new u({...this.#s,...s},this.#i,this.#r)}withOverlay(...t){return new u(this.#s,0===t.length?this.#i:[...this.#i,...t],this.#r)}resolve(t){return n(this.#i,t)}evaluateExpression(t){return l.interpret(this.#s,this.#i,t,l.MODE_EXPRESSION,this.#r)}evaluateTemplated(t){return l.interpret(this.#s,this.#i,t,l.MODE_TEMPLATED,this.#r)}}class c{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 d{static id=0;static uid(t){return`${t}-${++d.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(i=>{const r=i.substring(t.length);if("class"===r){const i=e.getAttribute(`${t}class`)?.split(/\s+/).filter(t=>t.length)??[];return void s.classList.add(...i)}s.setAttribute(r,e.getAttribute(i))})}static set(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)}}class h{static from(t){for(const e of t.children)e.matches('[slot=""]')&&e.removeAttribute("slot");const e=Array.from(t.children).filter(t=>t.matches("[slot]")).map(t=>{t.remove();const e=t.getAttribute("slot");return t.removeAttribute("slot"),[e,h.slotFromNode(t)]}),s=Object.create(null);s.default=new DocumentFragment,s.default.append(...t.childNodes);for(const[t,i]of e)t in s||(s[t]=new DocumentFragment),s[t].append(i);return s}static slotFromNode(t){return t instanceof HTMLTemplateElement?document.adoptNode(t.content):t instanceof HTMLScriptElement&&"text/html"===t.type?c.fromHtml(t.innerHTML):t}}class p{static isParsed(t){for(let e=t;e;e=e.parentNode)if(e.nextSibling)return!0;return!1}static waitDomContentLoaded(t){if("loading"===t.readyState)return new Promise(e=>{t.addEventListener("DOMContentLoaded",()=>e(void 0),{once:!0})});if("complete"===t.readyState)return Promise.resolve();const e=t.defaultView;if(null===e)return Promise.resolve();const[s]=e.performance?.getEntriesByType("navigation")??[];return s?.domContentLoadedEventStart>0?Promise.resolve():new Promise(t=>{const s=()=>{e.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s),t(void 0)};e.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s)})}static waitParsed(t){return p.isParsed(t)||"loading"!==t.ownerDocument.readyState?Promise.resolve(t):new Promise(e=>{const s=new MutationObserver(()=>{p.isParsed(t)&&(s.disconnect(),e(t))});for(let e=t.parentNode;e;e=e.parentNode)s.observe(e,{childList:!0});p.waitDomContentLoaded(t.ownerDocument).then(()=>{s.disconnect(),e(t)})})}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 i of t.children)i.matches(e)&&s.push(i);return s}}class f{#c=new Set;removed(t){return this.#c.has(t)}remove(t){t.replaceChildren?.(),Object.keys(t.dataset||{}).filter(t=>t.startsWith("tpl")).forEach(e=>{delete t.dataset[e]}),this.#c.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.#c)t.remove();this.#c.clear()}}class m{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplRemove","tplVerbatim"];static tplIf(t,e,s,i){i.evaluateExpression(e)||s.remove(t)}static tplWith(t,e,s,i){const r=i.evaluateExpression(e),n=s.popData(t,"tplVar"),a=new v(t,i).withOverlay(n?{[n]:r}:r).render();s.replace(t,a)}static tplEach(t,e,s,i){const r=s.popData(t,"tplVar"),n=s.popData(t,"tplStat"),a=new v(t,i),o=i.evaluateExpression(e),l=null===o||"object"!=typeof o?void 0:Object.getPrototypeOf(o),u=o?.[Symbol.iterator]||l!==Object.prototype&&null!==l?null:Object.entries(o),c=o instanceof Map?[...o]:u,d=null===c?o:c.map(([t,e])=>({key:t,value:e}));if(!d?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);const h=n?d:null,p="number"==typeof h?.length?h.length:h?.size,f="number"==typeof p?p:null;let m=0;for(const e of d){const i=r?{[r]:e}:e,o={index:m,count:m+1,size:f,first:0===m,last:null===f?null:m===f-1,even:m%2==0,odd:m%2==1},l=n?[{[n]:o},i]:[i];s.prepend(t,a.withOverlay(...l).render()),++m}s.remove(t)}static tplWhen(t,e,s,i){i.evaluateExpression(e)||s.remove(t)}static tplVerbatim(t,e,s,i){const r=t.cloneNode(!0);s.replace(t,r)}static tplRemove(t,e,s,i){switch(e.toLowerCase()){case"tag":{const e=c.fromChildNodes(t);"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 tplClassAppend(t,e,s,i){const r=i.evaluateExpression(e);if(!r)return;const n=(Array.isArray(r)?r:[r]).flatMap(t=>"string"==typeof t?t.split(" "):t).filter(Boolean);0!==n.length&&t.classList.add(...n)}static tplAttrAppend(t,e,s,i){const r=i.evaluateExpression(e);r&&0!==r.length&&(Array.isArray(r[0])?r:[r]).forEach(([e,s])=>{null!=s&&t.setAttribute(e,s)})}static textNode(t,e,i,r){for(const n of r.evaluateTemplated(e))if(null!=n.value)switch(n.type){case s.dom.t:i.prepend(t,document.createTextNode(n.value));break;case s.dom.h:i.prepend(t,c.fromHtml("string"==typeof n.value?n.value:String(n.value)));break;case s.dom.n:if(!(n.value instanceof Node))throw new TypeError(`Expected a Node, got '${typeof n.value}'`);i.prepend(t,n.value)}i.remove(t)}}const g=new e(1e3);function b(t){return g.getOrCompute(t,t=>t.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase())}class v{static fromHtml(t,e,...s){return new v(c.fromHtml(t),new u(e,s))}static fromSelector(t,e,...s){const i=document.querySelector(t);if(!(i instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");return v.fromTemplate(i,e,...s)}static fromTemplate(t,e,...s){const i=document.adoptNode(t.content);return new v(i,new u(e,s))}static fromFragment(t,e,...s){return new v(t,new u(e,s))}#d;#h;constructor(t,e){this.#d=t,this.#h=e}withEvaluator(t){return new v(this.#d,t)}withFragment(t){return new v(t,this.#h)}withModule(t,e){return new v(this.#d,this.#h.withModule(t,e))}withOverlay(...t){return new v(this.#d,this.#h.withOverlay(...t))}evaluateExpression(t,...e){return this.#h.withOverlay(...e).evaluateExpression(t)}evaluateTemplated(t,...e){return this.#h.withOverlay(...e).evaluateTemplated(t)}evaluator(){return this.#h}render(){try{const t=new f,e=document.importNode(this.#d,!0),s=e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e:c.from(e),i=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,v.#p);let r;for(;null!==(r=i.nextNode());){if(t.cleanup(),r.nodeType===Node.TEXT_NODE){try{m.textNode(r,r.nodeValue,t,this.#h)}catch(t){throw y.wrap("Error evaluating text node",r,t)}continue}const e=r;for(const s of m.ORDERED_COMMANDS){if(!(s in e.dataset))continue;const i=t.popData(e,s);try{m[s](e,i,t,this.#h)}catch(t){throw y.wrap(`Error evaluating data-tpl-${b(s)}="${i}"`,e,t)}if(t.removed(e))break}for(const s of Object.keys(e.dataset||{})){if(!s.startsWith("tpl"))continue;const i=b(s),r=t.popData(e,s);try{const t=this.#h.evaluateExpression(r);if("boolean"==typeof t){e.toggleAttribute(i,t);continue}null!=t&&e.setAttribute(i,t)}catch(t){throw y.wrap(`Error evaluating data-tpl-${i}="${r}"`,e,t)}}}return t.cleanup(),s}catch(t){if(t instanceof y)throw t;throw new y("Error rendering template",this.#d,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#p(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 y extends Error{static FRAMES=3;#f;#m;truncated=!1;static wrap(t,e,s){return s instanceof y&&s.depth>=y.FRAMES?(s.truncated=!0,s):new y(t,e,s)}constructor(t,e,s){super(`${t} in \`${y.describe(e)}\``,{cause:s}),this.name="RenderError",this.#f=e,this.#m=(s instanceof y?s.depth:0)+1}get depth(){return this.#m}get node(){return this.#f}get html(){return y.stringify(this.#f)}static describe(t){if(t.nodeType===Node.TEXT_NODE)return y.#g(String(t.nodeValue).trim());if(t.nodeType===Node.ELEMENT_NODE){const e=t,s=Array.from(e.attributes,t=>` ${t.name}="${t.value}"`).join("");return y.#g(`<${e.localName}${s}>`)}const e=Array.from(t.childNodes).filter(t=>t.nodeType===Node.ELEMENT_NODE||String(t.nodeValue??"").trim().length>0).map(t=>y.describe(t));return y.#g(e.join(""))}static#g(t){return t.length>120?`${t.slice(0,120)}…`:t}static stringify(t){return c.toHtml(y.#b(t.cloneNode(!0)))}static#b(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&&y.#b(s)}return t}}class w{#v=new Map;#y;#w=new Promise(t=>{this.#y=t});#E=Promise.withResolvers();constructor(){Promise.all([p.waitDomContentLoaded(document),this.#E.promise]).then(()=>{this.#x()})}ready(){return this.#w}configured(){this.#E.resolve()}async#x(){await this.settled(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1})),this.#y()}enqueue(t){if(this.#v.has(t))return;const{promise:e,resolve:s}=Promise.withResolvers(),i=p.waitParsed(t).then(()=>t.upgrade()).finally(()=>{this.#v.delete(t),s()});this.#v.set(t,{upgrade:i,finished:e})}async#A(t,e){for(;;){const s=Array.from(this.#v).filter(([e])=>t(e)).map(([,t])=>e(t));if(0===s.length)return;await Promise.all(s)}}settled(){return this.#A(()=>!0,t=>t.finished)}upgraded(t){return this.#A(t,t=>t.upgrade)}whenUpgraded(t){return this.#v.get(t)?.upgrade}pending(){return Array.from(this.#v.keys())}}class E{#S={};#E=!1;#C={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(",")}};#T={};#s;#_=[];#h=new u(void 0,[]);#R=new w;defineElement(t,e){return this.#E?(this.#q(t,e),this):(this.#S[t]=e,this)}static declarationsOf(t){const e=[];for(let s=t;null!==s&&s!==HTMLElement;s=Object.getPrototypeOf(s))e.unshift(s);const s=t=>e.flatMap(e=>Object.getOwnPropertyDescriptor(e,t)?.value??[]);return{observed:s("observed"),attributes:s("attributes")}}static propertyOf(t){return t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}#q(t,e){const{observed:s,attributes:i}=E.declarationsOf(e),{template:r,templates:n,slots:a,mappers:o,config:l}=e,u=s.map(t=>t.split(":")[0]),c=[...new Set(u.reverse())].reverse(),d=[...i,...s].reduce((t,e)=>{const[s,i]=e.split(":"),r=i??"string";if(!(r in this.#C)&&!(r in(o??{})))throw new Error(`unsupported attribute type: ${r}`);return t[s]=o?.[r]??this.#C[r],t},{}),h=Object.entries(Object.assign({},n,r?{default:r}:{})).map(([t,e])=>[t,v.fromHtml(e)]),p=Object.fromEntries(h);e.BITS={registry:this,enqueue:t=>this.#R.enqueue(t),SLOTS:a,CONFIG:l,OBSERVED:c,DECLARED:[...new Set([...c,...i.map(t=>t.split(":")[0])])],ATTR_TO_MAPPER:d,ATTR_TO_PROPERTY:Object.fromEntries(c.map(t=>[t,E.propertyOf(t)])),TEMPLATES:p},customElements.define(t,e)}defineModule(t,e){const s=t?{[t]:e}:e;return this.#s={...this.#s,...s},this.#k(),this}defineModules(t){return this.#s=t,this.#k(),this}defineComponent(t,e){return this.#T[t]=e,this}defineData(...t){return this.#_=t,this.#k(),this}defineOverlay(...t){return this.#_=[...this.#_,...t],this.#k(),this}defineMapper(t,e){return this.#C[t]=e,this}plugin(t){return t.configure(this),this}configure(){for(const[t,e]of Object.entries(this.#S))this.#q(t,e),delete this.#S[t];return this.#E=!0,this.#R.configured(),this}settle(t){return this.#R.upgraded(t)}whenUpgraded(t){return this.#R.whenUpgraded(t)}pending(){return this.#R.pending()}ready(){return this.#R.ready()}#k(){this.#h=new u(this.#s,this.#_)}evaluator(){return this.#h}component(t){return this.#T[t]}}const x=new E;class A{static fromHtml(t){return v.fromHtml(t).withEvaluator(x.evaluator())}static fromSelector(t){return v.fromSelector(t).withEvaluator(x.evaluator())}static fromTemplate(t){return v.fromTemplate(t).withEvaluator(x.evaluator())}static fromFragment(t){return v.fromFragment(t).withEvaluator(x.evaluator())}}class S{static waitFor(t){return x.settle(e=>t.contains(e))}static waitForChildren(t){return x.settle(e=>t!==e&&t.contains(e))}}class C extends HTMLElement{static BITS={registry:x,enqueue:t=>{},SLOTS:!1,CONFIG:void 0,OBSERVED:[],DECLARED:[],ATTR_TO_MAPPER:{},ATTR_TO_PROPERTY:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}constructor(){super(),this.internals=this.attachInternals()}internals;#O=!1;#L=!1;#N=new Set;#P=null;#M={};#F(){return this.constructor.BITS}#z(t){const e=this.#F().ATTR_TO_MAPPER[t];if(!e)throw new Error(`${this.constructor.name} declares no attribute '${t}': declare it in static observed or static attributes, or read it with getAttribute`);return e}unmarshal(t,e){return this.#z(t).unmarshal(e,t,this)}marshal(t,e){return this.#z(t).marshal(e,t,this)}get _registry(){return this.#F().registry}component(t){return this.#F().registry.component(t)}template(t){const e=this.#F().TEMPLATES[t??"default"];if(!e)throw new Error(`no template named '${t??"default"}' on ${this.constructor.name}`);const s=e.withEvaluator(this.#F().registry.evaluator()),i=this.#F().CONFIG;return i?s.withOverlay({config:i}):s}connectedCallback(){this.#L||this.#F().enqueue(this)}attributeChangedCallback(t,e,s){e!==s&&(this.#N.has(t)||(this.#O?this[this.#F().ATTR_TO_PROPERTY[t]]=this.unmarshal(t,s):null!==this.#P&&t in this.#P&&(this.#P[t]=this.unmarshal(t,s))))}async upgrade(){if(this.#L)return;this.#L=!0;const t=this.#F().SLOTS?h.from(this):void 0,e=Object.fromEntries(this.#F().DECLARED.map(t=>[t,this.unmarshal(t,this.getAttribute(t))])),s=new Set(this.#F().OBSERVED);this.#M=Object.fromEntries(Object.entries(e).filter(([t])=>!s.has(t))),this.#P=e;try{await this.render({slots:t});const s=this.#F().ATTR_TO_PROPERTY;for(const t of this.#F().OBSERVED)this[s[t]]=e[t];this.#O=!0,this.internals.states.add("rendered")}finally{this.#P=null}}render(t){}declared(t){return t in this.#M?this.#M[t]:null!==this.#P&&t in this.#P?this.#P[t]:this.unmarshal(t,this.getAttribute(t))}get rendered(){return this.#O}reflectTo(t,e){const s=this.marshal(t,e);if(s!==this.getAttribute(t)){this.#N.add(t);try{d.set(this,t,s)}finally{this.#N.delete(t)}}}}const T=(t,e)=>{const s=t[l.BOUND];return"function"==typeof s?s(e):t[e]},_=/\{(\w+)\}/g,R=/\{(\d+)\}/g,q=t=>"object"==typeof t&&null!==t&&[Object.prototype,null].includes(Object.getPrototypeOf(t)),k=new Set,O=t=>{k.has(t)||(k.add(t),console.warn(`l10n: ${t}`))},L=new e(100),N=(t,e,s)=>{const i=`${t.name}|${e??""}|${void 0===s?"":JSON.stringify(s)}`;return L.getOrCompute(i,()=>new t(e,s))};class P{static t(t,...e){const s=T(this,"l10n")??{};let i=Object.hasOwn(s,t)?s[t]:void 0;if(void 0===i)return O(`missing message "${t}"`),t;const r=1===e.length&&q(e[0])?e[0]:null;if(q(i))if("number"!=typeof r?.count)O(`plural message "${t}" needs a numeric {count}`),i=i.other;else{const t=T(this,"locale")??navigator?.language??"en";i=i[N(Intl.PluralRules,t).select(r.count)]??i.other}return void 0===i||"object"==typeof i?(O(`plural message "${t}" has no "other" form`),t):r?i.replace(_,(e,s)=>Object.hasOwn(r,s)?String(r[s]):(O(`message "${t}" wants {${s}}`),e)):e.length>0?i.replace(R,(s,i)=>{const r=Number(i);return r>=e.length?(O(`message "${t}" wants {${i}}`),s):String(e[r])}):i}static date(t,e){return N(Intl.DateTimeFormat,T(this,"locale"),e).format(t)}static number(t,e){return N(Intl.NumberFormat,T(this,"locale"),e).format(t)}static bytes(t){const e=N(Intl.NumberFormat,T(this,"locale"),{maximumFractionDigits:2}).format;return t>=1073741824?`${e(t/1024/1024/1024)}GiB`:t>=1048576?`${e(t/1024/1024)}MiB`:t>=1024?`${e(t/1024)}KiB`:`${e(t)}B`}static failure(t){return Array.isArray(t?.problems)&&t.problems.length>0?t.problems.map(t=>{return e=t,("string"==typeof e?.reason&&""!==e.reason.trim()?e.reason:void 0)??P.t.call(this,"failure.no-reason");var e}).join("\n"):void 0!==t?.message?String(t.message):null==t?"":String(t)}static of(t={}){const e=t=>x.evaluator().resolve(t),s=s=>(...i)=>s.apply({l10n:e("l10n"),locale:t.locale??e("locale")},i);return{t:s(P.t),date:s(P.date),number:s(P.number),bytes:s(P.bytes),failure:s(P.failure)}}}var M=Object.freeze({__proto__:null,Attributes:d,BoundedCache:e,ExpressionEvaluator:u,Expressions:l,Fragments:c,LightSlots:h,Localization:P,Nodes:p,ParsedElement:C,Registry:E,RenderError:y,Rendering:S,Template:v,Templates:A,registry:x});class F extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new F(this.message,F.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:i,details:r})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:i,details:r}))}}class z{static STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static encode(t,e){const s=e||z.URL_SAFE,i=t.byteLength,r=new Uint8Array(t);let n="";for(let t=0;t<i;t+=3)n+=s[r[t]>>2]+s[(3&r[t])<<4|r[t+1]>>4]+s[(15&r[t+1])<<2|r[t+2]>>6]+s[63&r[t+2]];return i%3==2?n=n.substring(0,n.length-1):i%3==1&&(n=n.substring(0,n.length-2)),n}static decode(t,e){const s=e||z.URL_SAFE;let i=t.length;for(;i>0&&"="===t.charAt(i-1);)--i;const r=t.substring(0,i);if(t.length-i>2||r.includes("=")||0===r.length&&t.length>0)throw new Error("invalid padding");if(r.length%4==1)throw new Error("invalid length");for(const t of r)if(-1===s.indexOf(t))throw new Error(`invalid character '${t}'`);const n=Math.floor(.75*r.length),a=new Uint8Array(n);let o=0,l=0;for(;o<n;){const t=s.indexOf(r.charAt(l++)),e=s.indexOf(r.charAt(l++)),i=s.indexOf(r.charAt(l++)),u=s.indexOf(r.charAt(l++));if(a[o++]=t<<2|e>>4,o===n)break;if(a[o++]=(15&e)<<4|i>>2,o===n)break;a[o++]=(3&i)<<6|u}return a.buffer}}class I{static decode(t){if(t.length%2!=0)throw new Error("invalid length");if(!/^[0-9a-fA-F]*$/.test(t))throw new Error("invalid character");const e=t.length/2;return new Uint8Array(e).map((e,s)=>{const i=2*s,r=t.substring(i,i+2);return parseInt(r,16)})}static encode(t,e){let s=t;return t instanceof ArrayBuffer&&(s=new Uint8Array(t)),ArrayBuffer.isView(t)&&(s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),Array.from(s).map(t=>t.toString(16)).map(t=>e?t.toUpperCase():t).map(t=>t.padStart(2,"0")).join("")}}class D{#I;#D;constructor(t,e){this.#I=t,this.#D=e}get normalized(){return`${this.#I}/${this.#D}`}get type(){return this.#I}get subtype(){return this.#D}static parse(t){if(!t)return new D("unknown","unknown");const[e,s]=t.split(";"),[i,r]=e.trim().toLowerCase().split("/");return i&&r?new D(i,r):new D("unknown","unknown")}}class $ extends F{constructor(t,e,s,i){super(t,s,i),this.name="HttpClientError",this.status=e}dropping(t){return new $(this.message,this.status,F.dropProblemsContext(this.problems,t),this)}static problem(t,e){return{type:t,context:null,reason:e,details:null}}static of(t,e){const s=String(e?.message??e??"unknown failure");return new $(s,0,[$.problem(t,s)],e)}static async fromResponse(t){switch(D.parse(t.headers.get("Content-Type")).normalized){case"application/failures+json":{const e=await t.json().catch(()=>$.#$);if(e===$.#$)return $.#B(t);if(!Array.isArray(e))return $.#B(t,"does not decode as a failures array");if(0===e.length)return $.#B(t,"carries no failures");const s=`${t.status} ${t.statusText}: ${e.length} failures`;return new $(s,t.status,e)}case"application/problem+json":{const e=await t.json().catch(()=>$.#$);if(e===$.#$)return $.#B(t);if("object"!=typeof e||null===e||Array.isArray(e))return $.#B(t,"does not decode as a problem object");const s=[e.title,e.detail].filter(t=>null!=t).join(" "),i=s?`${t.status} ${t.statusText}: ${s}`:`${t.status} ${t.statusText}`;return new $(i,t.status,Array.isArray(e.problems)&&e.problems.length>0?e.problems:[$.problem("GENERIC_PROBLEM",i)])}default:return $.#j(t)}}static#$=Symbol("unreadable body");static#B(t,e="does not decode as json"){const s=D.parse(t.headers.get("Content-Type")).normalized,i=`${t.status} ${t.statusText}: the ${s} body ${e}`;return new $(i,t.status,[$.problem("GENERIC_PROBLEM",i)])}static async#j(t){const e=await t.text().catch(()=>null),s=null===e?`${t.status} ${t.statusText}: the body could not be read`:`${t.status} ${t.statusText}: ${e}`;return new $(s,t.status,[$.problem("GENERIC_PROBLEM",s)])}}const B=t=>globalThis.document?.querySelector(`meta[name="${t}"]`)?.getAttribute("content")??void 0;class j{async intercept(t,e,s){if(t.origin!==(globalThis.window?.location?.origin??t.origin))return await s.proceed(t,e);const i=B("_csrf_header"),r=B("_csrf");return i&&r&&e.headers.set(i,r),await s.proceed(t,e)}}class H{#H;constructor(t){this.#H=t}async intercept(t,e,s){const i=await s.proceed(t,e);return 401===i.status?(window.location.href=this.#H,new Promise(()=>{})):i}}class V{#V;constructor(){this.#V=[]}withCsrfToken(){return this.#V.push(new j),this}withRedirectOnUnauthorized(t){return this.#V.push(new H(t)),this}withInterceptors(...t){return this.#V.push(...t),this}build(){return new G([...this.#V])}}class W{async intercept(t,e,s){try{return await fetch(t,e)}catch(t){throw $.of("CONNECTION_PROBLEM",t)}}}class U{#V;#W;constructor(t,e){this.#V=t,this.#W=e}async proceed(t,e){const s=this.#V[this.#W];return await s.intercept(t,e,new U(this.#V,this.#W+1))}}class G{#V;static builder(){return new V}constructor(t){this.#V=t||[]}async exchange(t,e,s){const i=[...this.#V,...s||[],new W],r=new U(i,0),n=new URL(new Request(t).url),a={...e,headers:new Headers(e?.headers)};return await r.proceed(n,a)}request(t,e){return J.create(this,t,e)}get(t){return J.create(this,"GET",t)}head(t){return J.create(this,"HEAD",t)}post(t){return J.create(this,"POST",t)}put(t){return J.create(this,"PUT",t)}patch(t){return J.create(this,"PATCH",t)}delete(t){return J.create(this,"DELETE",t)}}const Q=async(t,e)=>{try{return await t[e]()}catch(t){throw $.of("UNMARSHALING_PROBLEM",t)}},K=t=>null==t?[]:"string"==typeof t?new URLSearchParams(t):"function"==typeof t[Symbol.iterator]?t:Object.entries(t);class J{#U;#G;#Q;#K;#J;#X;#Y;#V;#d;static create(t,e,s){const i=s.indexOf("#"),r=-1===i?"":s.slice(i),n=-1===i?s:s.slice(0,i),a=n.indexOf("?");return new J(t,e,-1===a?n:n.slice(0,a),new URLSearchParams(-1===a?"":n.slice(a+1)),new Headers,void 0,{},[],r)}constructor(t,e,s,i,r,n,a,o,l=""){this.#U=t,this.#G=e,this.#Q=s,this.#K=i,this.#X=n,this.#J=r,this.#Y=a,this.#V=o,this.#d=l}headers(t){for(const[e,s]of K(t))this.header(e,s);return this}header(t,e){return null==e?this.#J.delete(t):this.#J.set(t,e),this}params(t){for(const[e,s]of K(t))null==s?this.#K.delete(e):this.#K.set(e,s);return this}param(t,...e){this.#K.delete(t);for(const s of e.filter(t=>null!=t))this.#K.append(t,s);return this}body(t){return this.#X=t,this}json(t){if(void 0===t)return this;const e=JSON.stringify(t);return this.#J.set("Content-Type","application/json"),this.#X=e,this}multipart(t){const e=new FormData;return t(new X(e)),this.#X=e,this}options(t){for(const[e,s]of Object.entries(t))this.#Y[e]=s;return this}option(t,e){return this.#Y[t]=e,this}interceptors(t){for(const e of t)this.#V.push(e);return this}interceptor(t){return this.#V.push(t),this}async exchange(){const t=this.#K.size?`?${this.#K}`:"",e={...this.#Y,headers:this.#J,method:this.#G,body:this.#X};return await this.#U.exchange(`${this.#Q}${t}${this.#d}`,e,this.#V)}async fetch(){try{const t=await this.exchange();if(!t.ok)throw await $.fromResponse(t);return t}catch(t){if(t instanceof F)throw t;throw $.of("UNEXPECTED_PROBLEM",t)}}async fetchText(){const t=await this.fetch();return await Q(t,"text")}async fetchJson(){const t=await this.fetch();return 204===t.status?null:await Q(t,"json")}async fetchBlob(){const t=await this.fetch();return await Q(t,"blob")}async fetchArrayBuffer(){const t=await this.fetch();return await Q(t,"arrayBuffer")}}class X{#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 i=new Blob([JSON.stringify(e)],{type:"application/json"});return this.#Z.append(t,i,s),this}}var Y=Object.freeze({__proto__:null,Base64:z,Failure:F,Hex:I,HttpClient:G,HttpClientBuilder:V,HttpClientError:$,HttpInterceptorChain:U,HttpMultipartRequestCustomizer:X,HttpRequestBuilder:J,MediaType:D});const Z=t=>{const e=e=>{try{t().removeItem(e)}catch{}},s=s=>{let i;try{i=t().getItem(s)}catch{return}if(null!==i)try{return JSON.parse(i)}catch{return void e(s)}};return{save:(e,s)=>{t().setItem(e,JSON.stringify(s))},load:s,remove:e,pop:t=>{const i=s(t);return e(t),i}}},tt=t=>({save(e,s,i){t.save(e,{revision:s,data:i})},load(e,s){const i=t.load(e);if(null!=i&&"object"==typeof i&&i.revision===s)return i.data;t.remove(e)}}),et=Z(()=>localStorage),st=Z(()=>sessionStorage),it=tt(et),rt=tt(st);class nt{static async fireAsync(t,e,s){t.dispatchEvent(e);const i=e.async?.promises??[],r=s?.mode??"broadcast";if("pipeline"===r&&i.length>1||"delegate"===r&&1!==i.length)throw Promise.all(i).catch(()=>{}),new Error("pipeline"===r?`[AsyncEvents] Event "${e.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${i.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${e.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${i.length} were registered.`);return"broadcast"===r?Promise.all(i):Promise.resolve(i[0])}static asyncOn(t,e,s,i){const r=async t=>{const e=t;e.async||(e.async={promises:[]});const{promise:i,resolve:r,reject:n}=Promise.withResolvers();e.async.promises.push(i);try{r(await s(e))}catch(t){n(t)}};return t.addEventListener(e,r,i),r}static asyncOff(t,e,s,i){t.removeEventListener(e,s,i)}static mixInto(...t){for(const e of t)Object.assign(e.prototype,{async fireAsync(t,e){return await nt.fireAsync(this,t,e)},asyncOn(t,e,s){return nt.asyncOn(this,t,e,s)},asyncOff(t,e,s){nt.asyncOff(this,t,e,s)}})}}class at{static guard(t,e){window.addEventListener("beforeunload",e=>{t()&&e.preventDefault()},{signal:e})}}class ot{#tt=0;take(){return++this.#tt,this.hold()}hold(){const t=this.#tt,e=this;return{get stale(){return t!==e.#tt}}}invalidate(){++this.#tt}}const lt=t=>{for(let e=t.parentElement;e;e=e.parentElement)if("function"==typeof e.describedBy)return e;return null};class ut{static sleep(t){return new Promise(e=>setTimeout(e,t))}static debounce(t,e,s){const i=s?.immediate??!1;let r=null,n=[],a=0;const o=()=>{const s=performance.now()-a;t>s?r=setTimeout(o,t-s):(r=null,i||e(...n),null===r&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===r&&(r=setTimeout(o,t),i&&e(...n))},()=>{clearTimeout(r??void 0),r=null,n=[]}]}static throttle(t,e,s){const i=s?.leading??!0,r=s?.trailing??!0;let n=null,a=[],o=0;const l=()=>{o=i?performance.now():0,n=null,e(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();o||i||(o=u);const c=0===o?0:t-(u-o);a=s,c<=0||c>t?(null!==n&&(clearTimeout(n),n=null),o=u,e(...a),null===n&&(a=[])):null===n&&r&&(n=setTimeout(l,c))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class ct{static flatten(t,e,s){return Object.keys(t).reduce((i,r)=>{const n=e.length?`${e}.${r}`:r;return s.has(n)||"object"!=typeof t[r]||null===t[r]?i[n]=t[r]:Object.assign(i,ct.flatten(t[r],n,s)),i},{})}static#et=new Set(["__proto__","prototype","constructor"]);static providePath(t,e,s){const i=e.split(".").map(t=>/^[0-9]+$/.test(t)?+t:t);for(const t of i)if(ct.#et.has(t))throw new Error(`unsupported name segment '${t}' in '${e}'`);let r=t??{},n=null;for(let e=0;;++e){const a=i[e],o=i[e-1];if(Number.isInteger(a)&&!Array.isArray(r)&&(null!==n?n[o]=r=[]:t=r=[]),e===i.length-1)return r[a]=void 0!==s?s:a in r?r[a]:null,t;"object"==typeof r[a]&&null!==r[a]||(r[a]={}),n=r,r=r[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:"SELECT"===t.tagName&&t.multiple?Array.from(t.selectedOptions).map(t=>t.value):"INPUT"!==t.tagName&&"SELECT"!==t.tagName&&"TEXTAREA"!==t.tagName||""!==t.value&&void 0!==t.value?t.value:null}static#st(t){return"submit"===t.type||"reset"===t.type||"button"===t.type}static extractFrom(t,e){let s={};for(const i of t.elements)i.hasAttribute("name")&&(ct.#st(i)&&i!==e||i.matches(":disabled")&&i!==e||(s=ct.providePath(s,i.getAttribute("name"),ct.extract(i))));return s}static mutate(t,e){if("radio"!==t.getAttribute("type"))if("checkbox"!==t.getAttribute("type")){if("SELECT"===t.tagName&&t.multiple){const s=Array.isArray(e)?e.map(String):null==e?[]:[String(e)];return void Array.from(t.options).forEach(t=>{t.selected=s.includes(t.value)})}t.value=e}else t.checked=e;else t.checked=null!=e&&t.getAttribute("value")===String(e)}static mutateIn(t,e){const s=ct.#it(t);for(const[t,i]of Object.entries(ct.flatten(e,"",new Set(s.keys()))))for(const e of s.get(t)??[])ct.mutate(e,i)}static#it(t){const e=new Map;for(const s of t.elements){const t=s.getAttribute("name");if(!t)continue;const i=e.get(t);i?i.push(s):e.set(t,[s])}return e}static errors(t,e,s){const i=e=>e.closest("form")===t;Array.from(t.querySelectorAll("ful-field-error")).filter(i).forEach(t=>{t.setAttribute("aria-live",s?"off":"polite")});const r=t=>("FIELD_ERROR"===t.type||"INVALID_FORMAT"===t.type)&&t.context,n=e.filter(r),a=e.filter(t=>!r(t)),o=ct.#it(t);for(const t of o.values())t.forEach(t=>{t.setCustomValidity?.("")});const l=[],u=new Map;n.forEach(t=>{const e=t.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=e.length;0!==s;--s){const i=e.slice(0,s).join("."),r=(o.get(i)??[]).filter(t=>"function"==typeof t.setCustomValidity);if(0===r.length)continue;const n=e.slice(s).join(".");return void r.forEach(e=>{const s=u.get(e)??new Map;s.set(n,[...s.get(n)??[],t.reason]),u.set(e,s)})}l.push(t)});for(const[t,e]of u)for(const[s,i]of e)t.setCustomValidity(i.join("\n"),s);const c=[...a,...l];t.querySelectorAll("ful-errors").forEach(t=>{if(!i(t))return;const e=t;if(t.setAttribute("role","alert"),0===c.length)return t.replaceChildren(),void t.setAttribute("hidden","");t.removeAttribute("hidden"),e.innerText=c.map(t=>t.reason).join("\n")}),0!==e.length&&s&&Array.from(t.elements).filter(t=>"fieldset"!==t.localName&&t.matches(":invalid")).sort((t,e)=>t.getBoundingClientRect().y-e.getBoundingClientRect().y)[0]?.focus()}}class dt extends C{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#rt;#nt=null;#at;#ot=[];#lt=null;#ut;#ct;#dt;#ht=[];#pt=null;#ft=null;constructor(){super(),this.internals.role=this.constructor.ROLE}#mt(){return[this.#ct??this.#rt,...this.#ht].filter(t=>t)}#gt({fragment:t,control:e,error:s,label:i=null,described:r=null,claims:n=null,announces:a=e,freeze:o=null,also:l=[]}){if(this.#rt=e,this.#ut=s,this.#ct=n,this.#dt=a,this.#ht=l,o&&o.addEventListener("click",t=>{this.readonly&&t.preventDefault()},!0),this.#at=r??e,s&&(s.id=s.id||d.uid("ful-field-error"),this.#lt=s.id),this.#bt(),i&&dt.#vt(this,i,e),this.addEventListener("keydown",t=>{if("Enter"!==t.key||t.defaultPrevented||t.isComposing)return;const e=t.target;e.form!==this.form&&dt.#yt(e)&&this._requestSubmit()}),this.replaceChildren(t),null!==this.#nt){const t=this.#nt;this.#nt=null,e.focus(t)}if(null!==this.#ft){const{error:t,context:e}=this.#ft;this.#ft=null,this.setCustomValidity(t,e)}}static#yt(t){return t instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(t.type)}describedBy(t){return!!t&&(t.id||(t.id=d.uid("ful-described")),this.#ot.includes(t.id)||this.#ot.push(t.id),this.#bt(),!0)}#bt(){if(!this.#at)return;const t=[...this.#ot,this.#lt].filter(t=>t);t.length&&this.#at.setAttribute("aria-describedby",t.join(" "))}focus(t){this.#rt?this.#rt.focus(t):this.#nt=t??{}}setCustomValidity(t,e){if(this.#ut){if(d.set(this.#dt??this.#rt,"aria-invalid",t?"true":null),!t)return this.internals.setValidity({}),void(this.#ut.innerText="");this.internals.setValidity({customError:!0}," "),this.#ut.innerText=t}else this.#ft=t?{error:t,context:e}:null}get form(){return this.internals.form}_requestSubmit(){const t=this.form;if(!t)return;const e=t.querySelectorAll("button:not(:disabled), input:not(:disabled)");t.requestSubmit([...e].find(e=>"submit"===e.type&&e.form===t))}_notifyChange(t={}){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value,...t}}))}static#wt=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#vt(t,e,s){if(!dt.#wt.has(s.tagName)||"hidden"===s.getAttribute("type"))return e.id||(e.id=d.uid("ful-label")),s.setAttribute("aria-labelledby",e.id),void e.addEventListener("click",()=>t.focus());s.id||(s.id=d.uid("ful-control")),e.setAttribute("for",s.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}async upgrade(){if(await super.upgrade(),null===this.#pt)return;const{value:t}=this.#pt;this.#pt=null,this.value=t}_holdValue(t){this.#pt={value:t}}_heldValue(){return null===this.#pt?this.declared("value"):this.#pt.value}get value(){}set value(t){}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.reflectTo("disabled",t);for(const e of this.#mt())e.toggleAttribute("disabled",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){for(const e of this.#mt())e.readOnly=t;this.#dt&&d.set(this.#dt,"aria-readonly",t?"true":null),this.reflectTo("readonly",t)}get required(){return this.hasAttribute("required")}set required(t){this.#dt&&d.set(this.#dt,"aria-required",t?"true":null),this.reflectTo("required",t)}render(t){t.slots?.default&&c.isBlank(t.slots.default)&&t.slots.default.replaceChildren();const e=this._build(t);if(e instanceof Promise)return e.then(t=>this.#gt(t));this.#gt(e)}_build(t){throw new Error(`${this.constructor.name} must implement _build`)}}class ht{#Et;#xt;#G;#At;#St;constructor(t,e,s,i,r){this.#Et=t,this.#xt=e,this.#G=s,this.#At=i,this.#St=r}prepare(t,e){return this.#At(t,e)}async submit(t,e){return await this.#Et.request(this.#G,this.#xt).json(t).fetch()}transform(t,e){return this.#St(t,e)}}class pt{#At;#St;constructor(t,e){this.#At=t,this.#St=e}async prepare(t,e){return await this.#At(t,e)}async submit(t,e,s){return s}async transform(t,e){return await this.#St(t,e)}}class ft{static create(t,e){const s=t.component("http-client"),i=t.declared("request-mapper")?t.component(t.declared("request-mapper")):t=>t,r=t.declared("response-mapper")?t.component(t.declared("response-mapper")):t=>t,n=t.declared("action");if(!n)return new pt(i,r);const a=t.declared("method")??"POST";return new ht(s,n,a,i,r)}}const mt=t=>void 0!==t.form?t.form:t.constructor?.formAssociated?t.internals?.form:void 0;class gt extends C{static attributes=["action","method","loader","request-mapper","response-mapper","clear-invalid-on-change:presence","scroll-on-error:presence","autocomplete","track-changes:presence","guard-leave:presence"];form;render(){const t=document.createElement("form");this.form=t,t.setAttribute("novalidate",""),d.set(t,"autocomplete",this.declared("autocomplete")),d.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.addEventListener("click",t=>{const e=t.target;e.closest?.('[aria-disabled="true"]')&&(t.preventDefault(),t.stopImmediatePropagation())},!0),this.declared("clear-invalid-on-change")&&this.addEventListener("change",t=>{mt(t.target)===this.form&&t.target.setCustomValidity?.("")}),this.replaceChildren(t),this.#Ct=this.declared("track-changes")||this.declared("guard-leave"),this.#Ct&&(this.addEventListener("input",t=>this.#Tt(t.target)),this.addEventListener("change",t=>this.#Tt(t.target)),this.addEventListener("focusin",t=>this.#_t(t.target)),this.form.addEventListener("reset",t=>{if(t.target===this.form){for(const t of new Set([...this.#Rt.keys(),...this.#qt().keys()]))this.#kt.set(t,++this.#Ot);0===this.#Lt&&(this.#Lt=requestAnimationFrame(()=>this.#Nt()))}}),S.waitForChildren(this).catch(()=>{}).then(()=>this.commit()),this.#Pt())}connectedCallback(){super.connectedCallback(),this.#Ct&&this.#Pt()}disconnectedCallback(){this.#Mt?.abort(),this.#Mt=null}#Ft=!1;async submit(t){if(this.#Ft)return!1;let e,s,i;this.#Ft=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);e=ct.extractFrom(this.form,t);const n=this.#Ct?{saved:this.#qt(),upTo:this.#Ot}:null;s=await r.prepare(e,this);const a=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:t,values:e,request:s}});if(!this.dispatchEvent(a))return!1;this.errors=[];const o=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:a.detail.values,request:a.detail.request}});let l=await nt.fireAsync(this,o,{mode:"pipeline"});s=o.detail.request,l=await r.submit(s,this,l);const u=await r.transform(l,this);n&&this.#zt(n.saved,n.upTo),i=new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,response:u}})}catch(r){i=new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,exception:r}}),r instanceof F?this.errors=r.problems:console.warn("failed to submit form",this,"reason:",r)}finally{this.#Ft=!1,this.spinner(!1)}return this.dispatchEvent(i),"submit:success"===i.type}async save(t){return!(!this.#Ct||this.dirty)||await this.submit(t)&&!this.dirty}reset(){this.form.reset(),this.#Ct&&this.#Nt()}#Rt=new Map;#It=new Map;#kt=new Map;#Ot=0;#Dt=!1;#Lt=0;#Mt=null;#Ct=!1;get dirty(){if(!this.#Ct)return!1;for(const t of this.#kt.keys()){const e=this.#$t(t);if((this.#Rt.has(t)||"[]"!==e)&&(this.#Rt.get(t)??this.#It.get(t))!==e)return!0}return!1}commit(){this.#Ct&&this.#zt(this.#qt(),this.#Ot)}edited(...t){for(const e of t)this.#Tt(e)}#zt(t,e){this.#Rt=t;for(const[t,s]of this.#kt)s<=e&&this.#kt.delete(t);for(const e of this.#It.keys())t.has(e)&&this.#It.delete(e);this.#Nt()}#Bt(t){for(let e=t;e&&e!==this;e=e.parentElement)if(mt(e)===this.form&&e.hasAttribute("name"))return e.getAttribute("name");return null}#Tt(t){if(!this.#Ct)return;const e=this.#Bt(t);null!==e&&(this.#kt.set(e,++this.#Ot),0===this.#Lt&&(this.#Lt=requestAnimationFrame(()=>this.#Nt())))}#_t(t){const e=this.#Bt(t);null===e||this.#Rt.has(e)||this.#It.has(e)||this.#It.set(e,this.#$t(e))}#jt(){return Array.from(this.form.elements).filter(t=>t.hasAttribute("name")&&!["submit","reset","button"].includes(t.type)&&!t.matches(":disabled"))}#qt(){const t=new Map;for(const e of this.#jt()){const s=e.getAttribute("name");t.set(s,[...t.get(s)??[],ct.extract(e)])}return new Map(Array.from(t,([t,e])=>[t,JSON.stringify(e)]))}#$t(t){return JSON.stringify(this.#jt().filter(e=>e.getAttribute("name")===t).map(t=>ct.extract(t)))}#Nt(){cancelAnimationFrame(this.#Lt),this.#Lt=0;const t=this.dirty;this.querySelectorAll("button").forEach(e=>{const s=e;s.form===this.form&&"submit"===s.type&&s.toggleAttribute("data-ful-dirty",t)}),t!==this.#Dt&&(this.#Dt=t,t?this.internals.states.add("dirty"):this.internals.states.delete("dirty"),this.dispatchEvent(new CustomEvent("dirty:change",{bubbles:!0,cancelable:!1,detail:{dirty:t}})))}#Pt(){this.declared("guard-leave")&&!this.#Mt&&(this.#Mt=new AbortController,at.guard(()=>this.dirty,this.#Mt.signal))}#Ht=0;#Vt(t){if(d.defaultValue(t,"role","status"),t.hidden=!1,""!==t.textContent.trim())return;const e=document.createElement("span");e.className="ful-sr-only",e.dataset.ref="spinner-label",t.append(e),e.textContent=P.of().t("spinner.loading")}spinner(t){if(t){if(++this.#Ht,1!==this.#Ht)return}else if(this.#Ht=Math.max(0,this.#Ht-1),0!==this.#Ht)return;d.set(this,"aria-busy",t?"true":null),this.querySelectorAll("ful-spinner").forEach(e=>{if(e.closest("form")!==this.form)return;const s=e;t?this.#Vt(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(e=>{const s=e;if(s.form===this.form&&("submit"===s.type||"reset"===s.type))if(t)s.dataset.wd=s.getAttribute("aria-disabled")??"",s.setAttribute("aria-disabled","true");else{if(void 0===s.dataset.wd)return;d.set(s,"aria-disabled",s.dataset.wd||null),delete s.dataset.wd}})}set values(t){ct.mutateIn(this.form,t)}get values(){return ct.extractFrom(this.form)}set errors(t){ct.errors(this.form,t,this.declared("scroll-on-error"))}}const bt=new e(100),vt=(t,e)=>bt.getOrCompute(`${t}:${e}`,()=>{try{return new RegExp(e,"g")}catch(s){return console.warn(`invalid ${t} attribute`,e,s),null}}),yt={numeric:"numeric",decimal:"decimal"},wt=new Set(["date","time","datetime-local","month","week"]),Et={numeric:t=>t.replace(/\D/g,""),decimal:t=>{const e=t.replace(/[^\d.,]/g,""),s=e.search(/[.,]/);return-1===s?e:e.slice(0,s+1)+e.slice(s+1).replace(/[.,]/g,"")}};class xt extends dt{static observed=["placeholder"];static attributes=["type","v-type","keep","reject","uppercase:presence","trim:presence","unsigned:presence","autocomplete"];static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-if="type != \'textarea\'" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" placeholder=" " form=""></textarea>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_input;#Wt=[];#Ut=null;_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:t}){const e=this._type(),s=yt[e],i=s?"text":e,r=this.template().withOverlay({type:i,slots:t}).render();this.#Wt=[...r.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#Wt[0];const n=this.declared("autocomplete")??(this.closest("form")?.getAttribute("autocomplete")??null);const a=(t=>{const e=t.declared("keep"),s=t.declared("reject");if(null!==e&&null!==s&&console.warn("a ful-input declares both keep and reject: keep is applied, reject is ignored",t),null!==e){const t=vt("keep",e);return t&&(e=>(e.match(t)??[]).join(""))}if(null!==s){const t=vt("reject",s);return t&&(e=>e.replace(t,""))}return((t,e)=>{const s=Et[t];return s?e?s:t=>((t,e)=>(t.startsWith("-")?"-":"")+e(t))(t,s):null})(t._type(),t.declared("unsigned"))})(this);for(const t of this.#Wt)this.#Gt(t,s,n,a);return{fragment:r,control:this._input,error:r.querySelector("ful-field-error"),label:r.querySelector("label")}}#Gt(t,e,s,i){e&&d.set(t,"inputmode",e),d.set(t,"autocomplete",s);const r=t.id;d.forward("input-",this,t),t!==this._input&&d.set(t,"id",r||null),this.#Qt(t),t.addEventListener("input",()=>{if(!i)return;const e=t.value,s=i(e);if(e===s)return;const r=t.selectionStart;if(t.value=s,null===r)return;const n=i(e.slice(0,r)).length;t.setSelectionRange(n,n)})}#Qt(t){if(!wt.has(t.type))return void t.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});let e=!1;const s=()=>{e=!1;const t=JSON.stringify(this.value);t!==this.#Ut&&(this.#Ut=t,this._notifyChange())};t.addEventListener("focus",()=>{this.#Ut=JSON.stringify(this.value)}),t.addEventListener("keydown",t=>{"Enter"!==t.key||t.isComposing?e=!0:s()}),t.addEventListener("blur",s),t.addEventListener("change",t=>{t.stopPropagation(),e||s()})}get value(){const t=this.declared("uppercase"),e=this.declared("trim"),s=this._input?this._input.value:`${this._heldValue()??""}`,i=t?s.toUpperCase():s,r=e?i.trim():i;if(""===r)return null;const n="decimal"===this._type()?r.replaceAll(",","."):r;if("number"===this.declared("v-type")){const t=Number(n);return Number.isNaN(t)?n:t}return n}set value(t){this._input?(this._input.value=""===t||null==t?"":`${t}`,this.#Ut=JSON.stringify(this.value)):this._holdValue(t)}get placeholder(){const t=this._input.getAttribute("placeholder");return" "===t?null:t}set placeholder(t){for(const e of this.#Wt)d.set(e,"placeholder",t??" ");this.reflectTo("placeholder",t)}}const At=t=>""===t?null:t,St=t=>{const[e,s,i]=t.split("-").map(Number),r=new Date(0);return r.setFullYear(e,s-1,i),r.setHours(0,0,0,0),r.getFullYear()===e&&r.getMonth()===s-1&&r.getDate()===i?r:new Date(Number.NaN)};class Ct extends C{static attributes=["locale","default"];render(){const t=St(this.textContent.trim());if(Number.isNaN(t.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:e}=P.of({locale:this.declared("locale")??void 0});this.replaceChildren(e(t,{year:"numeric",month:"numeric",day:"numeric"}))}}class Tt extends C{static attributes=["locale","default"];render(){const t=this.textContent.trim(),e=""===t?null:new Date(Tt.isoToLocal(t));if(null===e||Number.isNaN(e.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=P.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#Kt(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?St(t):new Date(t)}static isoToLocal(t){const e=Tt.#Kt(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())}`}static localToIso(t){const e=Tt.#Kt(t);return Number.isNaN(e.getTime())?null:e.toISOString()}}class _t extends xt{static observed=["step","min","max"];_type(){return"date"}get min(){return At(this._input.min)}set min(t){this._input.min=_t.#Jt(t)}get max(){return At(this._input.max)}set max(t){this._input.max=_t.#Jt(t)}get step(){return At(this._input.step)}set step(t){this._input.step=t??""}static#Jt(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 i="-"===s[1]?-1:1,r=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+r*i);break;case"m":{const t=n.getDate();n.setMonth(n.getMonth()+r*i),n.getDate()!==t&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+r*i)}return e(n)}}class Rt extends _t{_type(){return"time"}get min(){return At(this._input.min)}set min(t){this._input.min=this.#Xt(t)}get max(){return At(this._input.max)}set max(t){this._input.max=this.#Xt(t)}#Xt(t){if(!t)return"";const e=new Date;if("now"!==t){const s=/^([+-])(\d+)([hm])$/.exec(t);if(!s)return t;const i="-"===s[1]?-1:1,r=+s[2]*i;"h"===s[3]?e.setHours(e.getHours()+r):e.setMinutes(e.getMinutes()+r)}return Rt.#Yt(e,Number(this._input.step)||60)}static#Yt(t,e){const s=t=>String(t).padStart(2,"0"),i=3600*t.getHours()+60*t.getMinutes()+t.getSeconds(),r=Math.floor(i/e)*e,n=s(Math.floor(r/3600)),a=s(Math.floor(r%3600/60));return e%60==0?`${n}:${a}`:`${n}:${a}:${s(r%60)}`}}class qt extends xt{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){if(!this._input){const t=this._heldValue();return Tt.localToIso(t?Tt.isoToLocal(t):"")}return Tt.localToIso(this._input.value)}set value(t){this._input?super.value=t?Tt.isoToLocal(t):"":this._holdValue(t)}get min(){return Tt.localToIso(this._input.min)}set min(t){this._input.min=t?Tt.isoToLocal(t):""}get max(){return Tt.localToIso(this._input.max)}set max(t){this._input.max=t?Tt.isoToLocal(t):""}get step(){return At(this._input.step)}set step(t){this._input.step=t??""}}class kt extends xt{static WARNING_TIMEOUT=5e3;static list(t=[]){const e=new DataTransfer;for(const s of t)e.items.add(s);return e.files}static observed=["placeholder","accept:csv","multiple:presence","item-list:presence","dropzone:presence","no-input:presence","max-files:number","max-file-size:number","max-total-size:number","value"];#Zt;#te;#ee;#se;#ie;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#re;_build(t){const e=super._build(t),s=e.fragment;return this.#te=s.querySelector("ful-item-list"),this.#re=t.slots?.items&&!c.isBlank(t.slots.items)?A.fromFragment(t.slots.items):null,this.#ee=s.querySelector("[data-ref=dropzone]"),this.#se=s.querySelector("ful-field-warnings"),this.#ie=s.querySelector("ful-control-group"),this.#se.addEventListener("animationend",t=>{t.target.remove()}),this.#te.addEventListener("click",t=>{if(!t.target.closest("button"))return;if(!this._interactive())return;const e=[...this.#te.children].indexOf(t.target.closest("ful-item"));-1!==e&&(this.files=kt.list([...this.files].filter((t,s)=>s!==e)),this._notifyChange())}),this.#ee.addEventListener("click",t=>{this._interactive()&&this._input.click()}),this.#ee.addEventListener("dragover",t=>{t.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#ee.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#ee.addEventListener("drop",t=>{if(t.preventDefault(),this.toggleAttribute("dragover",!1),!this._interactive())return;const e=[...t.dataTransfer.items].filter(t=>"file"===t.kind).map(t=>t.getAsFile()).filter(t=>null!==t);0===e.length||e.length>1&&!this.multiple||(this.files=kt.list(e),this._notifyChange())}),this._input.addEventListener("change",()=>{this.#ne()},{capture:!0}),{...e,freeze:this.#ie}}#ne(){this.setCustomValidity(),this.#se.replaceChildren(),this.#ae(),this.#oe(),this.#le(),this.#ue(),(this.#re??this.template("items")).withOverlay({files:this.files}).renderTo(this.#te)}warning(t,e){this.template("warning").withOverlay({key:t,args:e}).appendTo(this.#se);const s=this.#se.lastElementChild;setTimeout(()=>s.remove(),kt.WARNING_TIMEOUT)}#ce(t){const e=t.name.toLowerCase();return this.#Zt.some(s=>{const i=s.toLowerCase().split(";")[0].trim();return i.startsWith(".")?e.endsWith(i):i.endsWith("/*")?t.type.startsWith(`${i.slice(0,-1)}`):i.includes("/")&&t.type===i})}#ae(){if(!this.#Zt.length)return;const t=[...this.files].filter(t=>!this.#ce(t));0!==t.length&&(this.warning("files.unacceptable-file-type",{types:this.#Zt.join(", ")}),this._input.files=kt.list([...this.files].filter(e=>!t.includes(e))))}#ue(){null!==this.#de&&(this.files.length<=this.#de||(this.warning("files.max-files-exceeded",{count:this.#de}),this._input.files=kt.list()))}#oe(){if(null===this.#he)return;const t=[...this.files].filter(t=>t.size>this.#he);0!==t.length&&(this.warning("files.max-file-size-exceeded",{size:P.of().bytes(this.#he)}),this._input.files=kt.list([...this.files].filter(e=>!t.includes(e))))}#le(){null!==this.#pe&&([...this.files].reduce((t,e)=>t+e.size,0)<=this.#pe||(this.warning("files.max-total-size-exceeded",{size:P.of().bytes(this.#pe)}),this._input.files=kt.list()))}get accept(){return this.#Zt}set accept(t){this._input.accept=t.join(","),this.#Zt=t,this.reflectTo("accept",t)}get multiple(){return this._input?this._input.multiple:this.declared("multiple")}set multiple(t){this._input.multiple=t,this.reflectTo("multiple",t)}get files(){return this._input?this._input.files:kt.list()}set files(t){this._input.files=t,this.#ne()}get file(){return this.files[0]??null}set file(t){this.files=kt.list(t?[t]:[])}get value(){const t=Array.from(this.files).map(t=>t.name);return this.multiple?t:t[0]??null}set value(t){!t&&this._input&&(this.files=kt.list())}formResetCallback(){this.value=null}get totalSize(){return Array.from(this.files).reduce((t,e)=>t+e.size,0)}#de;get maxFiles(){return this.#de}set maxFiles(t){this.#de=t,this.reflectTo("max-files",t)}#he;get maxFileSize(){return this.#he}set maxFileSize(t){this.#he=t,this.reflectTo("max-file-size",t)}#pe;get maxTotalSize(){return this.#pe}set maxTotalSize(t){this.#pe=t,this.reflectTo("max-total-size",t)}#fe;get itemList(){return this.#fe}set itemList(t){this.#fe=t,this.reflectTo("item-list",t)}#me;get dropzone(){return this.#me}set dropzone(t){this.#me=t,this.reflectTo("dropzone",t)}#ge;get noInput(){return this.#ge}set noInput(t){this.#ge=t,this.reflectTo("no-input",t)}}const Ot=new Map;let Lt=0,Nt=!1;const Pt=(t,e,s)=>Math.min(Math.max(t,e),Math.max(e,s)),Mt=(t,e)=>{const{invoker:s,stretch:i}=e,r=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,o=n.clientHeight;t.style.removeProperty("margin");const l=getComputedStyle(t),u=parseFloat(l.marginTop)||0,c=parseFloat(l.marginRight)||0,d=parseFloat(l.marginBottom)||0,h=parseFloat(l.marginLeft)||0;if(t.style.right="auto",t.style.bottom="auto",t.style.margin="0",i){t.style.removeProperty("width"),t.style.removeProperty("min-width"),t.style.removeProperty("max-width");const e=Math.min(parseFloat(l.maxWidth)||a,a-16);t.style.minWidth=`${Math.min(r.width,a-16)}px`,t.style.maxWidth=`${e}px`;const s=t.getBoundingClientRect().width;t.style.left=`${Pt(r.left,8,a-s-8)}px`;const i=t.getBoundingClientRect().height,n=r.bottom+u,c=n+i<=o-8?n:r.top-d-i;return void(t.style.top=`${Pt(c,8,o-i-8)}px`)}const p=(t=>t.matches("ful-note, .ful-note, [placement]"))(t),f=p?t.getAttribute("placement")??"bottom":"bottom";t.style.removeProperty("max-width");const m=Math.min(parseFloat(l.maxWidth)||a,a-16);t.style.maxWidth=`${m}px`,t.style.left="8px";const g=t.getBoundingClientRect().width;let b="right"===f?r.right+h:"left"===f?r.left-c-g:p?r.left+r.width/2-g/2:r.left;b=Pt(b,8,a-g-8),t.style.left=`${b}px`,t.style.maxWidth=`${Math.min(m,a-8-b)}px`;const v=t.getBoundingClientRect().height,y="top"===f?r.top-d-v:"right"===f||"left"===f?r.top+r.height/2-v/2:r.bottom+u;t.style.top=`${Pt(y,8,o-v-8)}px`,p&&((t,e)=>{const s=e.getBoundingClientRect(),i=t.getBoundingClientRect();t.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-i.left-t.clientLeft+"px"),t.style.setProperty("--ful-note-callout-block",s.top+s.height/2-i.top-t.clientTop+"px")})(t,s)},Ft=()=>{Lt=0;for(const[t,e]of Ot)t.isConnected&&e.invoker.isConnected?Mt(t,e):Ot.delete(t)},zt=()=>{!Lt&&Ot.size>0&&(Lt=requestAnimationFrame(Ft))};class It{static wire(t,e,{prefix:s="ful-anchor",invoke:i=!1,expanded:r=!1,stretch:n=!1,handPlace:a=!1}={}){const o=d.uid(s);if(i)if(e.id=e.id||o,"button"===t.localName||"input"===t.localName)t.setAttribute("popovertarget",e.id);else{let s=!1;t.addEventListener("pointerdown",()=>{s=e.matches(":popover-open")},!0),t.addEventListener("click",()=>{const t=s&&!e.matches(":popover-open");s=!1,t||e.togglePopover()}),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.togglePopover())})}const l=`--${o}`;if(t.style.anchorName=l,e.style.positionAnchor=l,r&&(t.setAttribute("aria-expanded","false"),e.addEventListener("toggle",e=>{t.setAttribute("aria-expanded","open"===e.newState?"true":"false")})),!a&&CSS.supports("anchor-name: --ful-probe")&&CSS.supports("position-anchor: --ful-probe")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)")&&CSS.supports("width: anchor-size(width)"))return;const u={invoker:t,stretch:n};e.addEventListener("beforetoggle",t=>{"open"===t.newState&&((t,e)=>{t.style.visibility="hidden",queueMicrotask(()=>{t.matches(":popover-open")&&Mt(t,e),t.style.removeProperty("visibility")})})(e,u)}),e.addEventListener("toggle",t=>{"open"===t.newState?(Ot.set(e,u),Mt(e,u)):(Ot.delete(e),(t=>{for(const e of["top","left","right","bottom","margin","max-width","min-width","width","visibility","--ful-note-callout-inline","--ful-note-callout-block"])t.style.removeProperty(e)})(e))}),Nt||(Nt=!0,document.addEventListener("scroll",zt,!0),window.addEventListener("resize",zt))}static show(t,e,{flip:s=!1,gap:i=0}={}){return"function"!=typeof t.showPopover||t.matches(":popover-open")||t.showPopover(),(()=>{const r=e instanceof Element?e.getBoundingClientRect():e,n=document.documentElement,a=t.getBoundingClientRect(),o=r.bottom+i,l=r.top-i-a.height,u=s&&o+a.height>n.clientHeight-8&&l>=8?l:o;t.style.right="auto",t.style.bottom="auto",t.style.margin="0",t.style.left=`${Pt(r.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,t.style.top=`${Pt(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),t}}const Dt=(t,e)=>t.filter(({key:t})=>e.some(e=>String(e)===String(t))),$t=(t,e)=>t.filter(({label:t})=>(t??"").toLowerCase().includes(e?.toLowerCase()??""));class Bt{#Et;#xt;#G;#St;#be;#ve;#_=null;#ye=null;#we=new ot;constructor({http:t,url:e,method:s,responseMapper:i,prefetch:r,revision:n}){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i,this.#be=r,this.#ve=n}async prefetch(){this.#be&&await this.#Ee()}async exact(...t){return Dt(await this.#Ee(),t)}async load(t){return $t(await this.#Ee(),t)}async invalidate(){this.#we.invalidate(),this.#_=null,this.#ye=null}async#Ee(){if(null===this.#_){if(null===this.#ye){const t=this.#we.hold();this.#ye=Bt.#xe(this.#Et,this.#G,this.#xt,this.#ve).then(e=>{t.stale||(this.#_=this.#St(e))}).finally(()=>{t.stale||(this.#ye=null)})}await this.#ye}if(null===this.#_)throw new Error("superseded by an invalidation");return this.#_}static async#xe(t,e,s,i){const r=`${e}@${s}`;if(null!==i){const t=it.load(r,i);if(void 0!==t)return t}const n=await t.request(e,s).fetchJson();if(null!==i)try{it.save(r,i,n)}catch(t){console.warn("failed to cache the select options",t)}return n}}class jt{#Et;#xt;#G;#St;constructor({http:t,url:e,method:s,responseMapper:i}){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i}async invalidate(){}async exact(...t){const e=await this.#Et.request(this.#G,this.#xt).param("k",...t).fetchJson();return this.#St(e)}async load(t){const e=await this.#Et.request(this.#G,this.#xt).param("s",t).fetchJson();return this.#St(e)}}class Ht{#_;constructor(t){this.#_=t}update(t){this.#_=t}async invalidate(){}exact(...t){return Dt(this.#_,t)}load(t){return $t(this.#_,t)}}class Vt{static from({data:t,http:e,url:s,method:i="POST",mode:r,prefetch:n=!1,revision:a=null,responseMapper:o}){return s?"chunked"===r?new jt({http:e,url:s,method:i,responseMapper:o}):new Bt({http:e,url:s,method:i,responseMapper:o,prefetch:n,revision:a}):new Ht(t??[])}static create(t,e){if(!t.declared("src")){const t=Array.from(e.options?.querySelectorAll("option")??[]);return Vt.from({data:t.map(t=>({key:t.getAttribute("value")??t.innerText.trim(),label:t.innerText.trim(),metadata:void 0}))})}return Vt.from({http:t.component("http-client"),url:t.declared("src"),method:t.declared("method")??"POST",mode:t.declared("mode"),prefetch:t.declared("preload"),revision:Vt.#Ae(t),responseMapper:Vt.#Se(t)})}static#Ae(t){const e=t.declared("revision");if(""!==e)return e;const s=t.component("revision");return null==s?(console.warn("a valueless revision asks the registry for one, and no 'revision' component is defined: the vocabulary will not be cached",t),null):"function"==typeof s?s():s}static#Se(t){return t.declared("k-expr")&&t.declared("l-expr")?e=>t._registry.evaluator().withOverlay(e).evaluateExpression(t.declared("d-expr")??"self").map(e=>{const s=t._registry.evaluator().withOverlay(e);return{key:s.evaluateExpression(t.declared("k-expr")),label:s.evaluateExpression(t.declared("l-expr")),metadata:s.evaluateExpression(t.declared("m-expr")??"self")}}):t.declared("response-mapper")?t.component(t.declared("response-mapper")):t=>t.map(([t,e,s])=>({key:t,label:e,metadata:s}))}}class Wt extends C{static attributes=["listbox"];static slots=!0;static template='\n <ful-spinner class="centered" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <ful-empty data-ref="empty" aria-live="polite" hidden>{{ #l10n:t(\'dropdown.empty\') }}</ful-empty>\n <menu tabindex="-1" role="listbox" hidden></menu>\n ';static templates={options:'\n <li data-tpl-each="self" data-tpl-selected="index == 0" data-tpl-value="index" role="option">\n {{ label }}\n </li>\n '};#Ce;#Te;#_e;#Re;#Y=new Map;#qe=new ot;render({slots:t}){const e=this.template().render();this.#Re=c.isBlank(t.default)?this.template("options"):A.fromFragment(t.default),this.#Ce=e.querySelector("ful-spinner"),this.#_e=e.querySelector("[data-ref=empty]"),this.#Te=e.querySelector("menu"),this.#Te.id=this.declared("listbox")||d.uid("ful-listbox"),this.#Te.addEventListener("mousedown",t=>{t.target.closest("li")&&t.preventDefault()}),this.#Te.addEventListener("click",t=>{t.stopPropagation();const e=t.target.closest("li");e?e.matches('[aria-disabled="true"]')||this.#ke(e):this.hide()}),this.replaceChildren(e)}#Oe(){return!this.#Te||this.#Te.hidden?null:this.#Te.querySelector("li[selected]")??this.#Te.querySelector('li:not([aria-disabled="true"])')}#Le(t){if(t){for(const e of this.#Te.querySelectorAll("li"))e.toggleAttribute("selected",e===t);t.id||=d.uid("ful-option"),this.#Ne(t.id),t.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#Ne(null)}acceptSelection(){const t=this.#Oe();t&&!t.matches('[aria-disabled="true"]')&&this.#ke(t)}update(t,e=[]){if(void 0===t)throw new Error("null data");this.#Y=new Map(t.map((t,e)=>[String(e),t]));const s=t.map((t,e)=>({index:e,...t}));this.#Re.withOverlay(s).renderTo(this.#Te);for(const[s,i]of[...this.#Te.children].entries()){const r=t[s],n=e.some(t=>String(t)===String(r?.key));i.toggleAttribute("picked",n),i.setAttribute("aria-selected",n?"true":"false");const a=!!r?.metadata?.disabled;a?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),a&&r.metadata.reason?i.setAttribute("title",String(r.metadata.reason)):i.removeAttribute("title")}this.#_e.toggleAttribute("hidden",0!==t.length),this.#Te.toggleAttribute("hidden",0===t.length);const i=t.findIndex(({key:t})=>e.some(e=>String(e)===String(t)));this.#Le(i>=0?this.#Te.children[i]:this.#Te.querySelector('li[selected]:not([aria-disabled="true"])')??this.#Te.querySelector('li:not([aria-disabled="true"])'))}#ke(t){const e=t.getAttribute("value"),s=this.#Y.get(e);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:e,entry:s}}))}hide(){this.#qe.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#Ne(null)}#Ne(t){this.dispatchEvent(new CustomEvent("activechange",{bubbles:!1,cancelable:!1,detail:{id:t}}))}get shown(){return this.matches(":popover-open")}async show(t,e=[]){const s=this.#qe.take();this.matches(":popover-open")||this.showPopover(),this.#Te.setAttribute("hidden",""),this.#Ce.removeAttribute("hidden");try{const i=await t();if(s.stale)return;this.update(i,e)}catch(t){if(s.stale)return;throw this.hide(),t}finally{s.stale||this.#Ce.setAttribute("hidden","")}}async moveOrShow(t,e,s=[]){if(this.shown){const e=this.#Oe(),s=e?.[(t?"next":"previous")+"ElementSibling"],i=s?this.#Pe(s,t):null;return void(e&&i&&this.#Le(i))}await this.show(e,s)}#Pe(t,e){for(let s=t;s;s=s[(e?"next":"previous")+"ElementSibling"])if(!s.matches('[aria-disabled="true"]'))return s;return null}jump(t){if(this.#Te.hidden)return;const e=t?this.#Te.firstElementChild:this.#Te.lastElementChild,s=this.#Pe(e,t);s&&this.#Le(s)}page(t){const e=this.#Oe();if(!e)return;let s=e;for(let e=0;e!==this.#Me();++e){const e=this.#Pe(s[(t?"next":"previous")+"ElementSibling"],t);if(!e)break;s=e}this.#Le(s)}#Me(){const t=this.#Te.firstElementChild;return t&&0!==t.offsetHeight?Math.max(1,Math.trunc(this.#Te.clientHeight/t.offsetHeight)):1}}class Ut extends dt{static attributes=["name","loader","k-type","mode","preload:presence","revision","k-expr","l-expr","d-expr","m-expr","response-mapper"];static observed=["multiple:presence","item-list:presence","value:csv","src","method"];unmarshal(t,e){return"value"!==t||""!==e||this.hasAttribute("multiple")?super.unmarshal(t,e):[""]}static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-control>\n <input type="text" form="" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n <ful-dropdown popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </ful-control-group>\n <ful-item-list></ful-item-list>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="entries" data-tpl-var="entry" data-tpl-data-key="entry.key">\n <div><span>{{ entry.label }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'select.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n '};#Fe;#ze={src:null,method:null};#Y;#rt;#Ie;#De;#$e;#te;#re;#Be;#je=!1;#He=new Map;#Ve=new ot;#We=!1;#Ue;#Ge;_build({slots:t}){const e=this.declared("name");this.#Y=t.options,this.#Qe(),this.#Be=this.declared("multiple"),this.#Fe.prefetch?.()?.catch(t=>{console.warn("failed to prefetch select options",this,"reason:",t)});const s=this.template().withOverlay({slots:t,name:e}).render();this.#De=s.querySelector("ful-control > input"),this.#$e=s.querySelector("label"),this.#te=s.querySelector("ful-item-list"),this.#re=t.items&&!c.isBlank(t.items)?A.fromFragment(t.items):null,d.forward("input-",this,this.#De),this.#rt=s.querySelector("ful-control"),this.#Ie=s.querySelector("ful-dropdown");const i=d.uid("ful-listbox");this.#Ie.setAttribute("listbox",i),this.#De.setAttribute("aria-controls",i),this.#Ie.addEventListener("beforetoggle",t=>{const e="open"===t.newState;this.#De.setAttribute("aria-expanded",e?"true":"false"),e||this.#De.removeAttribute("aria-activedescendant")}),this.#Ie.addEventListener("activechange",t=>{d.set(this.#De,"aria-activedescendant",t.detail.id)});const r=s.querySelector("ful-control-group");return It.wire(r,this.#Ie,{prefix:"ful-select",stretch:!0}),[this.#Ue,this.#Ge]=ut.throttle(400,()=>this.#Ke()),this.#Je(),this.#Xe(),this.#Ye(),this.#Ze(),{fragment:s,control:this.#De,error:s.querySelector("ful-field-error"),label:this.#$e}}#Je(){this.addEventListener("click",t=>{if(!this._interactive()||this.#$e.contains(t.target))return;const e=t.target.closest('button, [role="button"], a[href], input, select, textarea');if(!e||e===this.#De){if(this.#Ie.shown)return this.#Ge(),void this.#ts();this.#De.focus(),this.#Ue()}}),this.#te.addEventListener("click",t=>{t.stopPropagation(),t.target.closest("button")&&this._interactive()&&this.#es([...this.#te.children].indexOf(t.target.closest("ful-item")))}),this.#rt.addEventListener("click",t=>{const e=t.target instanceof Element?t.target.closest("ful-badge"):null;e&&(t.stopPropagation(),this.#ss(e))})}#Xe(){this.addEventListener("keydown",t=>{const e=t.target instanceof Element?t.target.closest("ful-badge"):null;e?this.#is(t,e):"ArrowLeft"===t.code&&t.target===this.#De&&0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#rs().at(-1)?.focus()})}#Ye(){this.#De.addEventListener("change",t=>{t.stopPropagation()}),this.#De.addEventListener("focus",()=>{this.#We||this.#De.select()}),this.#De.addEventListener("blur",t=>{t.stopPropagation(),t.relatedTarget&&this.contains(t.relatedTarget)||(this.#Ge(),this.#ts(!0))}),this.#De.addEventListener("keydown",t=>{this._interactive()&&this.#ns(t)}),this.#De.addEventListener("input",t=>{t.stopPropagation(),this._interactive()&&(this.#We=!0,this.#Ue())})}#Ze(){this.#Ie.addEventListener("change",t=>{t.stopPropagation(),this.#Ge(),this._interactive()?(this.#Be||this.#He.clear(),this.#We=!1,this.#He.set(this.#as(t.detail.entry.key),t.detail.entry),this.#os(),this.#De.focus(),this.#Ie.hide(),this.#Be||this.#De.select()):this.#ts()})}async withLoader(t){return await t(this.#Fe)}async reload(){await(this.#Fe.invalidate?.()),await(this.#Fe.prefetch?.());const t=[...this.#He.keys()];0!==t.length&&await this.#n(t,this.#Ve.take()),this.#Ie.shown&&await this.#Ke()}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ls()&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ls()&&this.reload()}async reconfigure(t,{notify:e=!1}={}){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);this.#ls();const s=[...this.#He.keys()];await this.reload();const i=[...this.#He.keys()];e&&i.length!==s.length&&this._notifyChange({entry:this.entry})}#Qe(){this.#ze={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Fe=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#Y})}#ls(){return(this.getAttribute("src")!==this.#ze.src||this.getAttribute("method")!==this.#ze.method)&&(this.#Ge(),this.#ts(),this.#Qe(),!0)}#rs(){return Array.from(this.#rt.querySelectorAll(":scope > ful-badge"))}#ss(t){this._interactive()&&this.#es(this.#rs().indexOf(t))}#es(t){const e=Array.from(this.#He.keys())[t];void 0!==e&&(this.#He.delete(e),this.#os())}#is(t,e){switch(t.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":t.preventDefault(),this.#ss(e),this.#De.focus();break;case"ArrowLeft":t.preventDefault(),(this.#rs()[this.#rs().indexOf(e)-1]??this.#De).focus();break;case"ArrowRight":t.preventDefault(),(this.#rs()[this.#rs().indexOf(e)+1]??this.#De).focus();break;case"Escape":this.#De.focus()}}#ns(t){switch(t.code){case"ArrowUp":case"ArrowDown":t.preventDefault(),this.#us(t);break;case"Home":this.#Ie.shown&&(t.preventDefault(),this.#Ie.jump(!0));break;case"End":this.#Ie.shown&&(t.preventDefault(),this.#Ie.jump(!1));break;case"PageDown":case"PageUp":this.#Ie.shown&&(t.preventDefault(),this.#Ie.page("PageDown"===t.code));break;case"Escape":this.#Ge(),this.#ts();break;case"NumpadEnter":case"Enter":if(!this.#Ie.shown)return;t.preventDefault(),this.#Ge(),this.#We=!1,this.#cs(),this.#Ie.acceptSelection();break;case"Backspace":0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#es(this.#He.size-1);break;case"Tab":this.#Ge(),this.#ts(!0)}}#us(t){const e="ArrowDown"===t.code;t.altKey?e&&!this.#Ie.shown?this.#Ke():!e&&this.#Ie.shown&&(this.#Ge(),this.#ts()):this.#Ie.moveOrShow(e,()=>this.#Fe.load(this.#ds()),[...this.#He.keys()])}#ts(t=!1){this.#Ie.hide();const e=t&&this.#We&&!this.#Be&&""===this.#De.value&&0!==this.#He.size;this.#We=!1,e&&(this.#He.clear(),this.#os()),this.#cs()}#Ke(){return this.#Ie.show(()=>this.#Fe.load(this.#ds()),[...this.#He.keys()])}#ds(){return this.#We?this.#De.value:""}get query(){return this.#ds()}#cs(){const t=this.#He.values().next().value;this.#De.value=this.#Be?"":t?.label??""}#hs(){return[...this.#He.values()]}#os(){this.#ps(),this._notifyChange({entry:this.entry})}#ps(){const t=this.#Be?Array.from(this.#He.entries()).map(([t,e],s)=>{const i=document.createElement("ful-badge");return i.setAttribute("role","button"),i.setAttribute("tabindex",0===s?"0":"-1"),i.setAttribute("value",t),i.innerText=e.label,i}):[];for(const t of this.#rt.querySelectorAll(":scope > ful-badge"))t.remove();this.#De.before(...t),this.#We||this.#cs(),this.#te.replaceChildren(),(this.#re??this.template("items")).withOverlay({entries:this.#hs()}).renderTo(this.#te)}#as(t){switch(this.declared("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){if(!this.#rt)return void this._holdValue(t);const e=(null==t?[]:Array.isArray(t)?t:[t]).map(t=>this.#as(t)),s=this.#Be?e:e.slice(0,1);!this.#je&&s.some(t=>"string"==typeof t&&t.includes(","))&&(this.#je=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#He=new Map(s.map(t=>[t,{key:t,label:t,metadata:void 0}]));const i=this.#Ve.take();this.#ps(),0!==s.length&&this.#n(s,i)}async#n(t,e){const s=await this.#Fe.exact(...t);if(e.stale)return;const i=new Map(s.map(t=>[this.#as(t.key),t]));for(const e of t)this.#He.has(e)&&(i.has(e)?this.#He.set(e,i.get(e)):this.#He.delete(e));this.#ps()}get value(){if(!this.#rt){const t=[this._heldValue()??[]].flat().map(t=>this.#as(t));return this.multiple?t:t[0]??null}return this.#Be?[...this.#He.keys()]:[...this.#He.keys()][0]??null}get entry(){const t=this.#hs();return this.#Be?t:t[0]??null}get disabled(){return super.disabled}set disabled(t){super.disabled=t,t&&this.#Ie?.shown&&(this.#Ge(),this.#ts())}get readonly(){return super.readonly}set readonly(t){super.readonly=t,t&&this.#Ie?.shown&&(this.#Ge(),this.#ts())}#fe;get multiple(){return this.#Be??this.declared("multiple")}set multiple(t){this.#Be=t,this.reflectTo("multiple",t),t||(this.#He=new Map([...this.#He].slice(0,1))),this.#rt&&this.#ps()}get itemList(){return this.#fe}set itemList(t){this.#fe=t,this.reflectTo("item-list",t)}}class Gt extends dt{static attributes=["name","type"];static slots=!0;static ROLE="radiogroup";static template='\n <fieldset>\n <legend>{{{{ slots.default }}}}</legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <ful-radio-list>\n <div class="label-wrapper" data-tpl-each="inputsAndLabels" data-tpl-var="ial">\n <label>\n {{{{ ial[0] }}}}\n <div>{{{{ ial[1] }}}}</div>\n </label>\n </div>\n </ful-radio-list>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';#fs;#ms;#gs;_build({slots:t}){const e=d.uid(this.declared("name")??"ful-radiogroup"),s=Array.from(t.default.querySelectorAll("ful-radio")),i=s.map(t=>{const s=document.createElement("input");return s.setAttribute("type","radio"),d.forward("input-",this,s),d.forward("",t,s),s.setAttribute("name",`${e}-ignore`),s.setAttribute("form",""),s.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()}),[s,c.fromChildNodes(t)]});s.forEach(t=>{t.remove()}),c.isBlank(t.default)&&t.default.replaceChildren();const r=this.template().withOverlay({name:e,slots:t,inputsAndLabels:i}).render();return this.#fs=r.firstElementChild,this.#ms=r.querySelector("input[type=radio]"),this.#gs="boolean"===this.declared("type"),{fragment:r,control:this.#ms,error:r.querySelector("ful-field-error"),described:this,claims:this.#fs,announces:this,freeze:this.#fs}}get value(){if(!this.#fs){const t=this._heldValue(),e=null===t?null:this.querySelector(`ful-radio[value="${CSS.escape(String(t))}"]`),s=e?.getAttribute("value")??null;return null===s||"boolean"!==this.declared("type")?s:"true"===s}const t=this.querySelector("input[type=radio]:checked");return t?this.#gs?"true"===t.value:t.value:null}set value(t){if(!this.#fs)return void this._holdValue(t);const e=this.querySelectorAll("input[type=radio]"),s=()=>{e.forEach(t=>{t.checked=!1})};if(null===t)return void s();const i=this.querySelector(`input[type=radio][value="${CSS.escape(String(t))}"]`);null!==i?i.checked=!0:s()}}class Qt extends dt{static attributes=["type"];static observed=["value:bool"];static slots=!0;static template='\n <ful-choice data-tpl-switch="isSwitch">\n <input type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </ful-choice>\n <ful-field-error></ful-field-error>\n ';#bs;#De;_build({slots:t}){const e="switch"===this.declared("type"),s=this.template().withOverlay({slots:t,isSwitch:e}).render();this.#bs=s.firstElementChild,this.#De=s.querySelector("input"),d.forward("input-",this,this.#De),this.#De.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});const i=s.querySelector("label");return{fragment:s,control:this.#De,error:s.querySelector("ful-field-error"),label:i,freeze:this.#bs}}get value(){return this.#De?this.#De.checked:Boolean(this._heldValue())}set value(t){this.#De?this.#De.checked=t:this._holdValue(t)}}class Kt extends C{static attributes=["sorter"];static observed=["order"];#vs;render(){const t=this.declared("sorter"),e=["asc","desc",null];this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",()=>{const s=e[(e.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort:requested",{bubbles:!0,cancelable:!1,detail:{value:{sorter:t,order:s}}}))}),this.addEventListener("keydown",t=>{["Enter","NumpadEnter","Space"].includes(t.code)&&(t.preventDefault(),this.click())})}get order(){return this.#vs||null}set order(t){this.#vs=t||null,this.reflectTo("order",this.#vs);const e=this.closest("th");e&&d.set(e,"aria-sort",this.#vs?"asc"===this.#vs?"ascending":"descending":null)}}class Jt extends C{static observed=["total:number","current:number"];static attributes=["pages:number"];static config={prevIcon:"chevron-left",nextIcon:"chevron-right",reloadIcon:"arrow-clockwise"};static template='\n <ful-pagination-bar role="navigation" data-tpl-aria-label="#l10n:t(\'pagination.navigation\')">\n <ul>\n <li data-ref="index"> {{ #l10n:t(\'pagination.showing\', { \'current\': curr.label, \'total\': total }) }}</li>\n <li data-ref="reload"><button type="button" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button></li>\n <li data-ref="prev">\n <button type="button" data-tpl-disabled="prev.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.previous\')" data-tpl-data-page="prev.index">\n <ful-icon data-tpl-name="config.prevIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n <li data-ref="page" data-tpl-each="pages" data-tpl-var="page">\n <button type="button" data-tpl-aria-current="curr.index == page.index ? \'page\' : false" data-tpl-data-page="page.index" >\n {{ page.label }}\n </button>\n </li>\n <li data-ref="next">\n <button type="button" data-tpl-disabled="next.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.next\')" data-tpl-data-page="next.index">\n <ful-icon data-tpl-name="config.nextIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n </ul>\n </ful-pagination-bar>\n ';#ys=0;#W=0;render(){this.addEventListener("click",t=>{const e=t.target.closest("button");e&&!e.hasAttribute("disabled")&&"page"!==e.getAttribute("aria-current")&&this.dispatchEvent(new CustomEvent("page:requested",{bubbles:!0,cancelable:!1,detail:{value:Number(e.dataset.page??this.#W)}}))})}update({current:t,total:e}={}){void 0!==t&&(this.#W=t??0),void 0!==e&&(this.#ys=e??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#ys);const s=this.#W,i=this.#ys,r=this.declared("pages")??5,n=Math.max(i,1),a=s>0,o=s+1<n,l={index:a?s-1:null,enabled:a},u={index:s,label:s+1},c={index:o?s+1:null,enabled:o},d=Math.max(1,Math.min(r,n)),h=Math.max(0,Math.min(s-Math.floor((d-1)/2),n-d)),p=Array.from({length:d},(t,e)=>({index:h+e,label:h+e+1})),f=this.contains(document.activeElement)?document.activeElement.closest("li")?.getAttribute("data-ref"):null,m="page"===f?document.activeElement.dataset.page:null;if(this.template().withOverlay({total:n,prev:l,curr:u,next:c,pages:p}).renderTo(this),!f)return;const g=(null===m?null:this.querySelector(`li[data-ref=page] button[data-page="${m}"]`))??this.querySelector(`li[data-ref=${f}] button:not(:disabled)`)??this.querySelector("li[data-ref=page] button[aria-current=page]");g?.focus()}get total(){return this.#ys}set total(t){this.update({total:t})}get current(){return this.#W}set current(t){this.update({current:t})}}class Xt{static parse(t,e){const s=t?p.queryChildren(t,"schema"):null;if(!s)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const i=document.createElement("tr"),r=document.createElement("tr");r.setAttribute("data-tpl-each","rows");for(const t of s.getAttributeNames()){const e=s.getAttribute(t);i.setAttribute(t,e??""),r.setAttribute(t,e??"")}const n=p.queryChildrenAll(s,"column"),a=n.filter(t=>t.hasAttribute("order")&&t.hasAttribute("sorter")).map(t=>({sorter:t.getAttribute("sorter"),order:t.getAttribute("order")}))[0]??null;for(const t of n){const e=p.queryChildren(t,"title"),s=t.getAttribute("sorter"),n=t.getAttribute("order"),a=e??document.createTextNode(t.getAttribute("title")??"");e?.remove(),t.removeAttribute("sorter"),t.removeAttribute("order"),t.removeAttribute("title");const o=s||n?(()=>{const t=document.createElement("ful-sorter");return s&&t.setAttribute("sorter",s),n&&t.setAttribute("order",n),t.append(a),t})():a,l=document.createElement("th"),u=document.createElement("td");for(const e of t.getAttributeNames()){const s=t.getAttribute(e);l.setAttribute(e,s??""),u.setAttribute(e,s??"")}l.append(o),u.append(...t.childNodes),i.append(l),r.append(u)}return{headersTemplate:e.withOverlay({inHeaders:!0,inRows:!1}).withFragment(c.from(i)),rowsTemplate:e.withOverlay({inHeaders:!1,inRows:!0}).withFragment(c.from(r)),sort:a,length:n.length}}}class Yt{#_;constructor(t){this.#_=t}async load(t,e,s){const i=this.#ws(e),r=Number(t.size),n=t.page*r,a=n+r;return{data:i.slice(n,a),size:i.length}}#ws(t){if(!t?.sorter)return this.#_;const{sorter:e,order:s}=t,i="desc"===s?-1:1;return[...this.#_].sort((t,s)=>{const r=t?.[e],n=s?.[e];return r===n?0:null==r?1:null==n?-1:(r<n?-1:1)*i})}update(t){this.#_=t}}class Zt{#Et;#xt;#G;#St;constructor(t,e,s,i=t=>t){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i}async load(t,e,s){const i=Object.entries(s).filter(([t,e])=>e);return await this.#Et.request(this.#G,this.#xt).param("page",t.page).param("size",t.size).param("sort",e?`${e.sorter},${e.order}`:null).param("filters",i.length>0?JSON.stringify(Object.fromEntries(i)):null).fetchJson().then(t=>this.#St(t))}}class te{static create(t,e){const s=t.getAttribute("src");if(s){const e=t.component("http-client"),i=t.getAttribute("method")??"GET",r=t.hasAttribute("response-mapper")?t.component(t.getAttribute("response-mapper")):t=>t;return new Zt(e,s,i,r)}return new Yt([])}}class ee extends C{static attributes=["loader","autoload:presence","paging"];static observed=["page-size:number","src","method"];static slots=!0;static config={searchIcon:"search",emptyIcon:"inbox",reloadIcon:"arrow-clockwise"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <ful-table-wrapper>\n <table>\n <caption data-tpl-if="slots.caption">{{{{ slots.caption }}}}</caption>\n <thead></thead>\n <tbody data-tpl-if="virtual" data-ref="before" aria-hidden="true"><tr><td data-tpl-colspan="schema.length"></td></tr></tbody>\n <tbody></tbody>\n <tbody data-tpl-if="virtual" data-ref="after" aria-hidden="true"><tr><td data-tpl-colspan="schema.length"></td></tr></tbody>\n <tbody data-ref="initial">\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty>\n <ful-icon data-tpl-if="config.searchIcon" data-tpl-name="config.searchIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.initial\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="empty" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty data-tpl-if="slots.empty" data-ref="empty-authors"></ful-empty>\n <ful-empty data-tpl-if="!slots.empty">\n <ful-icon data-tpl-if="config.emptyIcon" data-tpl-name="config.emptyIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.no-data\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="loading" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-spinner class="big" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="feedback" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <div role="alert">\n <p>{{ #l10n:t(\'table.error\') }}</p>\n <div data-ref="feedback-error"></div>\n </div>\n </td>\n </tr>\n </tbody>\n <tfoot data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </tfoot>\n </table>\n </ful-table-wrapper>\n <ful-pagination data-tpl-if="!scrolled" current="0" total="1"></ful-pagination>\n <ful-table-status data-tpl-if="scrolled">\n <span data-ref="count"></span>\n <ful-spinner data-ref="appending" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <div data-ref="append-failure" role="alert" hidden>\n <span>{{ #l10n:t(\'table.error\') }} <span data-ref="append-error"></span></span>\n <button type="button" data-ref="retry">{{ #l10n:t(\'table.retry\') }}</button>\n </div>\n <button type="button" data-ref="reload" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button>\n </ful-table-status>\n ';static templates={row:"\n {{{{ schema.rowsTemplate.withOverlay({'rows': pageResponse.data}).render() }}}}\n "};#Fe;#Es;#X;#xs;#As;#_e;#Ss;#Cs;#Ts;#_s;#Rs;#qs;#ks=null;#Os=null;#Ls=[];#Ns={next:1,shown:0,total:0,last:0};#Ps=!1;#Ms=null;#Fs=null;#ys=0;#zs=0;#Is=null;#Ds=!1;#$s=void 0;#Bs={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#js=!1;#Hs={};#Vs=null;#Ws=!1;#Us=null;#Gs=new ot;#ze={src:null,method:null};get pageSize(){return this.#Bs.pageRequest.size}set pageSize(t){const e=Number(t??10);!Number.isFinite(e)||e<=0||e===this.#Bs.pageRequest.size||(this.#Bs={...this.#Bs,pageRequest:{page:0,size:e}},this.#js&&this.load(this.#Bs.pageRequest,this.#Bs.sortRequest,this.#Hs))}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ls()&&this.#js&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ls()&&this.#js&&this.reload()}async reconfigure(t){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);return this.#ls(),await this.reload()}#Qe(){this.#ze={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Fe=this.component(this.declared("loader")??"loaders:table").create(this)}#ls(){return(this.getAttribute("src")!==this.#ze.src||this.getAttribute("method")!==this.#ze.method)&&(this.#Qe(),this.#Bs={...this.#Bs,pageRequest:{...this.#Bs.pageRequest,page:0}},this.#Fs=null,!0)}async render({slots:t}){const e=this.template(),s=Xt.parse(t.schema,e),i=this.declared("paging"),r=e.withOverlay({slots:t,schema:s,scrolled:"infinite"===i||"virtual"===i,virtual:"virtual"===i}).render(),n=p.queryChildren(r,"ful-table-wrapper"),a=n.querySelector("table");d.forward("table-",this,a),this.#Qe(),this.#qs=n;const o=p.queryChildren(r,"ful-table-status");if(this.#Es=s,this.#X=a.querySelector(":scope > tbody:not([data-ref])"),this.#xs=a.querySelector(":scope > tbody[data-ref=loading]"),this.#As=a.querySelector(":scope > tbody[data-ref=initial]"),this.#_e=a.querySelector(":scope > tbody[data-ref=empty]"),this.#Ss=this.#_e.querySelector("ful-empty[data-ref=empty-authors]"),this.#Cs=t.empty&&!c.isBlank(t.empty)?A.fromFragment(t.empty):null,this.#Ts=a.querySelector(":scope > tbody[data-ref=feedback]"),this.#_s=p.queryChildren(r,"ful-pagination"),this.replaceChildren(r),"virtual"===i){const t=getComputedStyle(n).overflowY;this.#Ps="auto"===t||"scroll"===t,this.#Ps||console.warn('ful-table: paging="virtual" needs rows that scroll inside the table, as ful-fill makes them; this one appends its pages as paging="infinite" does')}if(o){const t=t=>o.querySelector(`[data-ref=${t}]`);this.#ks={count:t("count"),appending:t("appending"),failure:t("append-failure"),error:t("append-error")},t("reload").addEventListener("click",()=>this.reload()),t("retry").addEventListener("click",()=>{this.#Ps?(this.#Ds=!1,this.#Qs(!0)):this.#Ks()})}this.#Ps?(this.#Ms={before:a.querySelector(":scope > tbody[data-ref=before] td"),after:a.querySelector(":scope > tbody[data-ref=after] td")},n.addEventListener("scroll",()=>{this.#Js(),this.#Qs(!1)},{passive:!0}),new ResizeObserver(()=>{requestAnimationFrame(()=>{this.#Js(),this.#Qs(!1)})}).observe(n)):o&&(this.#Os=new IntersectionObserver(t=>{t.some(t=>t.isIntersecting&&this.#Ls.includes(t.target))&&this.#Ks()}));const l=this.querySelector("thead");s.headersTemplate.renderTo(l),new ResizeObserver(()=>{n.style.setProperty("--ful-table-header-height",`${l.getBoundingClientRect().height}px`)}).observe(l),this.#Rs=l.querySelectorAll("ful-sorter"),await S.waitForChildren(this);const u=p.queryChildren(this,"ful-form"),h=this.declared("page-size");this.#Bs={pageRequest:{page:0,size:Number.isFinite(h)&&h>0?h:10},sortRequest:s.sort,filterRequest:u?.values??{}},this.#Hs=this.#Bs.filterRequest,this.#Vs=u,u?.addEventListener("submit:success",async t=>{this.#Us=this.#Xs(0,t.detail.request),await this.#Us}),this.addEventListener("page:requested",async t=>{t.composedPath().find(t=>t instanceof ee)===this&&await this.#Xs(t.detail.value,this.#Hs)}),this.addEventListener("sort:requested",async t=>{if(t.composedPath().find(t=>t instanceof ee)!==this)return;const e=t.detail.value.order?t.detail.value:null;await this.load(this.#Bs.pageRequest,e,this.#Hs),this.#Bs.sortRequest===e&&(this.#Rs.forEach(t=>{t.order=null}),t.target.order=t.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){if(!this.#Vs||this.#Ws)return this.#Fs?await this.#Ys():await this.load(this.#Bs.pageRequest,this.#Bs.sortRequest,this.#Bs.filterRequest);await this.#Vs.submit()&&await this.#Us}async load(t,e,s){this.#js=!0,this.#Hs=s;const i=this.#Gs.take();let r;this.#Ls=[],this.#Os?.disconnect(),clearTimeout(this.#$s),this.#Is=null,this.#Ds=!1,this.#ks?.appending.setAttribute("hidden",""),this.#ks?.failure.setAttribute("hidden",""),this.#xs.toggleAttribute("hidden",this.#X.childElementCount>0),this.#Ts.setAttribute("hidden",""),this.#As.setAttribute("hidden",""),this.#_e.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const n=await this.#Fe.load(t,e,s);if(i.stale)return;if(r=Math.max(0,Math.ceil(n.size/t.size)-1),!Number.isFinite(r))throw new Error(`ful-table cannot page the loader's answer: it needs { data, size }, size being the total number of rows, and got a size of ${n.size} for pages of ${t.size}. A response of another shape needs a response-mapper`);if(t.page<=r){if(this.#Bs={pageRequest:t,sortRequest:e,filterRequest:s},this.#Ws=!0,this.#ne(t,e,s,n),await Promise.all([S.waitForChildren(this.#X),S.waitForChildren(this.#_e)]).catch(()=>{}),i.stale)return;return this.#Ps&&this.#Zs(),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:e,filterRequest:s,response:n}})),this.#ti(t.size),void this.#Qs(!1)}}catch(r){if(i.stale)return;throw this.#ei(r,{pageRequest:t,sortRequest:e,filterRequest:s}),r}return await this.load({page:r,size:t.size},e,s)}async withLoader(t){return await t(this.#Fe)}async resetWithFilter(t){return await this.#Xs(0,t)}#Xs(t,e){return this.load({page:t,size:this.#Bs.pageRequest.size},this.#Bs.sortRequest,e)}#ti(t){const{shown:e,total:s,last:i}=this.#Ns;if(!(this.#Os&&e<s&&0!==i))return;const r=[...this.#X.children];this.#Ls=r.slice(Math.max(0,r.length-Math.ceil(t/2)));for(const t of this.#Ls)this.#Os.observe(t)}async#Ks(){const t=this.#ks;this.#Ls=[],this.#Os?.disconnect();const{sortRequest:e,filterRequest:s}=this.#Bs,i={page:this.#Ns.next,size:this.#Bs.pageRequest.size},r=this.#Gs.take();t.failure.setAttribute("hidden",""),t.appending.removeAttribute("hidden");try{const n=await this.#Fe.load(i,e,s);if(r.stale)return;if(this.#X.append(this.template("row").withOverlay({schema:this.#Es,pageRequest:i,filterRequest:s,pageResponse:n}).render()),this.#Ns={next:i.page+1,shown:this.#Ns.shown+n.data.length,total:n.size,last:n.data.length},t.count.textContent=P.of().t("table.loaded",{loaded:this.#Ns.shown,total:this.#Ns.total}),await S.waitForChildren(this.#X).catch(()=>{}),r.stale)return;t.appending.setAttribute("hidden",""),this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:i,sortRequest:e,filterRequest:s,response:n}})),this.#ti(i.size)}catch(n){if(r.stale)return;t.appending.setAttribute("hidden",""),t.error.textContent=P.of().failure(n),t.failure.removeAttribute("hidden"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:i,sortRequest:e,filterRequest:s,exception:n}}))}}#si(t,e,s){const i=[...this.template("row").withOverlay({schema:this.#Es,pageRequest:t,filterRequest:e,pageResponse:s}).render().children];return this.#Ps&&i.forEach((e,s)=>{e.setAttribute("aria-rowindex",String(t.page*t.size+s+2))}),i}#ei(t,e){this.#xs.setAttribute("hidden",""),this.#X.replaceChildren(),this.#Fs=null,this.#ii(),this.#ks?.count.replaceChildren(),this.#Ts.removeAttribute("hidden"),this.#Ts.querySelector("[data-ref=feedback-error]").textContent=P.of().failure(t),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{...e,exception:t}}))}#Zs(){const t=this.#X.parentElement;t.setAttribute("aria-rowcount",String(this.#ys+1)),t.tHead?.rows[0]?.setAttribute("aria-rowindex","1");const e=this.#ks,s=this.#Fs;if(!s)return this.#ii(),void(e.count.textContent=P.of().t("table.loaded",{loaded:0,total:this.#ys}));const i=this.#Bs.pageRequest.size,r=s.first*i;e.count.textContent=P.of().t("table.range",{from:r+1,to:r+s.pages.get(s.first).length,total:this.#ys}),this.#ri()&&(this.#qs.scrollTop=r*this.#zs)}#ri(){if(this.#zs>0)return!0;const t=this.#X.childElementCount,e=this.#X.getBoundingClientRect().height;return 0!==t&&0!==e&&(this.#zs=e/t,this.#ni(),this.#ii(),!0)}#ni(){const t=this.#X.parentElement,e=[...t.tHead?.rows[0]?.cells??[]].map(t=>t.getBoundingClientRect().width),s=e.reduce((t,e)=>t+e,0),i=document.createElement("colgroup");i.setAttribute("data-ref","widths");for(const t of e){const e=document.createElement("col");e.style.width=t/s*100+"%",i.append(e)}t.insertBefore(i,t.tHead)}#ai(){[...this.#X.querySelectorAll(":scope > tr > *")].some(t=>t.scrollWidth>t.clientWidth+1)&&(this.#oi(),this.#ni())}#oi(){this.#X.parentElement?.querySelector(":scope > colgroup[data-ref=widths]")?.remove()}#ii(){if(!this.#Ms)return;const t=this.#Fs,e=this.#Bs.pageRequest.size,s=t?t.first*e:0,i=t?Math.max(0,this.#ys-(t.last+1)*e):0;this.#Ms.before.style.height=s*this.#zs+"px",this.#Ms.after.style.height=i*this.#zs+"px"}#Js(){const t=this.#ks,e=this.#Bs.pageRequest.size,s=this.#qs.getBoundingClientRect(),i=s.top+(this.#X.parentElement?.querySelector(":scope > thead")?.getBoundingClientRect().height??0);let r=0,n=0;for(const[t,a]of this.#Fs?.pages??[])a.forEach((a,o)=>{const l=a.getBoundingClientRect();l.bottom>i&&l.top<s.bottom&&(r||=t*e+o+1,n=t*e+o+1)});r>0&&(t.count.textContent=P.of().t("table.range",{from:r,to:n,total:this.#ys}))}#li(t){const e=this.#Bs.pageRequest.size*this.#zs,s=this.#qs.getBoundingClientRect(),i=s.top+s.height/2,r=this.#X.getBoundingClientRect();if(i<r.top)return Math.max(0,t.first-Math.ceil((r.top-i)/e));if(i>=r.bottom)return t.last+1+Math.floor((i-r.bottom)/e);let n=t.first;for(const[e,s]of t.pages)s.length>0&&s[0].getBoundingClientRect().top<=i&&(n=e);return n}#Qs(t){const e=this.#Fs,s=Math.ceil(this.#ys/this.#Bs.pageRequest.size);if(!e||this.#Is||this.#Ds||this.hasAttribute("aria-busy")||!this.#qs.isConnected||!(s>0)||!this.#ri())return;const i=Math.min(s-1,this.#li(e));let r=Math.max(0,i-1),n=Math.min(s-1,i+1);const a=this.#X.contains(document.activeElement)?document.activeElement.closest("tr"):null,o=[...e.pages].find(([,t])=>a&&t.includes(a))?.[0];void 0!==o&&Math.max(n,o)-Math.min(r,o)<=4&&(r=Math.min(r,o),n=Math.max(n,o)),r===e.first&&n===e.last||(clearTimeout(this.#$s),t||!(n<e.first-1||r>e.last+1)?this.#ui(e,r,n):this.#$s=setTimeout(()=>this.#Qs(!0),150))}async#ui(t,e,s){const i=this.#ks,r=this.#Gs.hold();this.#Is=r;const{sortRequest:n,filterRequest:a}=this.#Bs,o=this.#Bs.pageRequest.size,l=Array.from({length:s-e+1},(t,s)=>e+s),u=l.filter(e=>!t.pages.has(e));i.failure.setAttribute("hidden",""),i.appending.removeAttribute("hidden");try{const c=await Promise.all(u.map(async t=>{const e={page:t,size:o};return{pageRequest:e,response:await this.#Fe.load(e,n,a)}}));if(r.stale)return;const d=l.filter(e=>t.pages.has(e)),h=this.#qs.getBoundingClientRect().top,p=d.flatMap(e=>t.pages.get(e)??[]).find(t=>t.getBoundingClientRect().bottom>h),f=p?.getBoundingClientRect().top??0;for(const[i,r]of t.pages)if(i<e||i>s)for(const t of r)t.remove();const m=new Map;for(const e of l){const s=c.find(t=>t.pageRequest.page===e);m.set(e,t.pages.get(e)??(s?this.#si(s.pageRequest,a,s.response):[]))}if(0===d.length?this.#X.replaceChildren(...[...m.values()].flat()):(this.#X.prepend(...l.filter(t=>t<d[0]).flatMap(t=>m.get(t)??[])),this.#X.append(...l.filter(t=>t>d.at(-1)).flatMap(t=>m.get(t)??[]))),this.#Fs={first:e,last:s,pages:m},this.#ys=c.at(-1)?.response.size??this.#ys,this.#X.parentElement?.setAttribute("aria-rowcount",String(this.#ys+1)),this.#ii(),this.#ai(),p&&(this.#qs.scrollTop+=p.getBoundingClientRect().top-f),await S.waitForChildren(this.#X).catch(()=>{}),r.stale)return;this.#ai(),p&&(this.#qs.scrollTop+=p.getBoundingClientRect().top-f),i.appending.setAttribute("hidden",""),this.#Js();for(const{pageRequest:t,response:e}of c)this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:n,filterRequest:a,response:e}}))}catch(t){if(r.stale)return;return this.#Ds=!0,i.appending.setAttribute("hidden",""),i.error.textContent=P.of().failure(t),i.failure.removeAttribute("hidden"),void this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:{page:u[0],size:o},sortRequest:n,filterRequest:a,exception:t}}))}finally{this.#Is===r&&(this.#Is=null)}this.#Qs(!1)}async#Ys(){const t=this.#Fs,e=this.#ks,{sortRequest:s,filterRequest:i}=this.#Bs,r=this.#Bs.pageRequest.size;this.#Hs=i;const n=this.#Gs.take();clearTimeout(this.#$s),this.#Is=null,this.#Ds=!1,e.appending.setAttribute("hidden",""),e.failure.setAttribute("hidden",""),this.setAttribute("aria-busy","true");const a=Array.from({length:t.last-t.first+1},(e,s)=>t.first+s);try{const e=await Promise.all(a.map(async t=>{const e={page:t,size:r};return{pageRequest:e,response:await this.#Fe.load(e,s,i)}}));if(n.stale)return;const o=e.at(-1).response.size,l=Math.ceil(o/r);if(!(t.first<l))return await this.load({page:0,size:r},s,i);const u=e.filter(t=>t.pageRequest.page<l),c=new Map(u.map(t=>[t.pageRequest.page,this.#si(t.pageRequest,i,t.response)]));if(this.#X.replaceChildren(...[...c.values()].flat()),this.#Fs={first:t.first,last:Math.min(t.last,l-1),pages:c},this.#ys=o,this.#X.parentElement?.setAttribute("aria-rowcount",String(o+1)),this.#ii(),await S.waitForChildren(this.#X).catch(()=>{}),n.stale)return;this.#ai(),this.removeAttribute("aria-busy"),this.#Js();for(const{pageRequest:t,response:e}of u)this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:s,filterRequest:i,response:e}}));this.#Qs(!1)}catch(e){if(n.stale)return;throw this.#ei(e,{pageRequest:{page:t.first,size:r},sortRequest:s,filterRequest:i}),e}}#ne(t,e,s,i){this.#xs.setAttribute("hidden",""),this.#Ps&&(this.#zs=0,this.#oi());const r=this.#si(t,s,i);return this.#X.replaceChildren(...r),this.#_e.toggleAttribute("hidden",0!==i.data.length),this.#Cs&&0===i.data.length&&this.#Ss.replaceChildren(this.#Cs.withOverlay({schema:this.#Es,pageRequest:t,filterRequest:s,pageResponse:i}).render()),this.#Ps?(this.#qs.scrollTop=0,this.#ys=i.size,void(this.#Fs=r.length>0?{first:t.page,last:t.page,pages:new Map([[t.page,r]])}:null)):this.#ks?(this.#qs.scrollTop=0,this.#Ns={next:t.page+1,shown:i.data.length,total:i.size,last:i.data.length},void(this.#ks.count.textContent=P.of().t("table.loaded",{loaded:this.#Ns.shown,total:this.#Ns.total}))):void this.#_s.update({current:t.page,total:Math.ceil(i.size/t.size)})}}const se=(t,e,{items:s,current:i=()=>null})=>{let r="",n=0;e.addEventListener("beforetoggle",s=>{"closed"===s.newState&&e.contains(document.activeElement)&&t()?.focus()}),e.addEventListener("toggle",t=>{if("open"!==t.newState)return;const e=s();(i()??e[0])?.focus()}),e.addEventListener("keydown",e=>{const i=e.target,a=s(),o=a.find(t=>t===i||t.contains(i));if(!o)return;const l=a.indexOf(o);switch(e.code){case"ArrowDown":return e.preventDefault(),void a[(l+1)%a.length]?.focus();case"ArrowUp":return e.preventDefault(),void a[(l-1+a.length)%a.length]?.focus();case"Home":return e.preventDefault(),void a[0]?.focus();case"End":return e.preventDefault(),void a[a.length-1]?.focus();case"Enter":case"NumpadEnter":case"Space":return e.preventDefault(),o.click(),void t()?.focus();case"Escape":return void t()?.focus()}if(1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey)return;const u=Date.now();r=u-n>500?e.key:r+e.key,n=u;const c=r.toLowerCase(),d=[...c].every(t=>t===c[0]),h=d?c[0]:c,p=d?l+1:l,f=[...a.slice(p),...a.slice(0,p)].find(t=>(t.textContent??"").trim().toLowerCase().startsWith(h));f&&(e.preventDefault(),f.focus())})};class ie{static narrow(t,e){const s=(t??[]).filter(t=>e.includes(t));return s.length>0?s:[...e]}#ci;#Te;#di;#hi;#pi;#cs;#fi;#mi;#gi;#bi=!1;#vi=!1;constructor(t,{vocabulary:e,glyphs:s={},labelFor:i=t=>t,display:r=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#ci=t,this.#Te=t.nextElementSibling,this.#di=e,this.#hi=s,this.#pi=i,this.#cs=r??(t=>s[t]??t),this.#fi=n,this.#mi=a,this.#gi=[...e],this.#Te.addEventListener("click",t=>{const e=t.target.closest("li > a");if(!e||!this.#fi())return;const s=e.getAttribute("value"),i=this.value;this.value=s,this.#Te.hidePopover?.(),i!==s&&this.#mi(s)})}get allowed(){return this.#gi}set allowed(t){this.#gi=ie.narrow(t,this.#di),this.#yi(),!this.#vi&&this.#gi.length>1&&(this.#gt(),this.#vi=!0),this.#wi(),this.pinned&&(this.value=this.#gi[0])}preferring(t){return null!==t&&this.#gi.includes(t)?t:this.#gi[0]}get pinned(){return this.#gi.length<2}set fixed(t){this.#ci.toggleAttribute("hidden",!!t)}get value(){return this.#ci.getAttribute("value")}set value(t){this.#ci.setAttribute("value",t),this.#ci.textContent=this.#cs(t),d.set(this.#ci,"aria-label",this.#pi(t)),this.#Ei()}#Ei(){const t=this.value;for(const e of this.#te())e.setAttribute("aria-checked",String(e.getAttribute("value")===t))}set claimed(t){this.#bi=t,this.#wi()}#yi(){this.#Te.replaceChildren(...this.#gi.map(t=>{const e=document.createElement("li");e.setAttribute("role","none");const s=document.createElement("a");s.setAttribute("role","menuitemradio"),s.setAttribute("tabindex","-1"),s.setAttribute("value",t);const i=this.#pi(t),r=this.#hi[t]??t;if(i===t&&r===t)s.innerText=t;else{const t=document.createElement("span");t.innerText=r;const e=document.createElement("span");e.innerText=i,s.append(t,e)}return e.append(s),e})),this.#Ei()}#wi(){const t=this.pinned;this.#ci.toggleAttribute("disabled",t||this.#bi),d.set(this.#ci,"aria-haspopup",t?null:"true"),d.set(this.#ci,"aria-expanded",t?null:"false"),t?this.#ci.removeAttribute("popovertarget"):this.#Te.id&&this.#ci.setAttribute("popovertarget",this.#Te.id)}#te(){return Array.from(this.#Te.querySelectorAll("li > a"),t=>t)}#gt(){It.wire(this.#ci,this.#Te,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),se(()=>this.#ci,this.#Te,{items:()=>this.#te(),current:()=>this.#te().find(t=>t.getAttribute("value")===this.value)})}}const re={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},ne=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],ae=[...ne,"CONTAINS","STARTS_WITH","ENDS_WITH"],oe=["IGNORE_CASE","CASE_SENSITIVE"],le={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:ue}=P.of(),ce=t=>ue(`filters.op.${t}`),de=t=>ue(`filters.sensitivity.${t}`),he=t=>ue(""===t?"filters.boolean.any":`filters.boolean.${t}`),pe=t=>t.querySelector(":scope > label")?.textContent.trim()||null,fe=(t,e,{singular:s,plural:i,vocabulary:r,fallback:n})=>{const a=t.declared(s);if(null===a)return;t.hasAttribute(i)&&console.warn(`${t.localName}: ${s} fixes what ${i} offers a menu for, the plural is ignored`,t);const o=r.includes(a);o||console.warn(`${t.localName}: '${a}' is not one of its ${i}, the default is pinned instead`,t),e.allowed=[o?a:n],e.fixed=!0},me=(t,e,s)=>{const i=s.filter(t=>null!=t&&""!=`${t}`);return 0===i.length?null:{label:t,operator:e,operands:i.map(t=>`${t}`)}};class ge extends xt{static observed=["value:json","operators:csv"];static attributes=["operator"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_container;_value1;_value2;_build(t){const e=super._build(t),s=e.fragment;return this._container=s.querySelector("ful-control-group"),this._value1=s.querySelector("[data-ref=value1]"),this._value2=s.querySelector("[data-ref=value2]"),this._operator=new ie(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:re,labelFor:ce,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),fe(this,this._operator,{singular:"operator",plural:"operators",vocabulary:this._vocabulary(),fallback:this._defaultOperator()}),{...e,freeze:this._container,also:[this._value2]}}_showDefaultOperator(){this._showOperator(this._operator.preferring(this._defaultOperator()))}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||this._showDefaultOperator()}_type(){return"text"}_serialize(t){return t}_deserialize(t){return t}_defaultOperator(){return"EQ"}_vocabulary(){return ne}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(t){null===this.declared("operator")&&(this._operator?(this._operator.allowed=t,null!==this._operator.value&&this._showOperator(this._operator.preferring(this._operator.value))):this._declaredOperators=ie.narrow(t,this._vocabulary()))}get value(){return this._operator?this._tuple():this._shownTuple(this._heldValue())}set value(t){this._operator?this._applyTuple(t):this._holdValue(t)}_shownTuple(t){if(null==t)return null;const[e,...s]=t,i=this.declared("operator"),r=this._vocabulary().includes(i),n=null===i?ie.narrow(this.declared("operators"),this._vocabulary()):[r?i:this._defaultOperator()],a=n.includes(e)?e:n[0],o=[s[0],s[1]].map(t=>`${t?this._deserialize(t):t??""}`),l="BETWEEN"===a?o:o.slice(0,1);return l.some(t=>""===t)?null:[a,...l.map(t=>this._serialize(t))]}_tuple(){const t=this._operator.value,e=this.#xi();return e.some(t=>""===t)?null:[t,...e.map(t=>this._serialize(t))]}_applyTuple(t){if(null==t)return this._value1.value="",void(this._value2.value="");const[e,...s]=t;this._showOperator(this._operator.preferring(e)),this._value1.value=s[0]?this._deserialize(s[0]):s[0]??"",this._value2.value=s[1]?this._deserialize(s[1]):s[1]??""}_showOperator(t){this._operator.value=t,this._syncBetween()}_syncBetween(){this._value2.toggleAttribute("hidden","BETWEEN"!==this._operator.value)}get criterion(){return this._operator?me(pe(this),this._operator.value,this.#xi()):null}#xi(){return"BETWEEN"===this._operator.value?[this._value1.value,this._value2.value]:[this._value1.value]}get disabled(){return super.disabled}set disabled(t){super.disabled=t;for(const e of this._choices())e.claimed=t}_choices(){return[this._operator].filter(t=>t)}}class be extends ge{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(t){return Tt.localToIso(t)}_deserialize(t){return Tt.isoToLocal(t)}}class ve extends ge{_type(){return"date"}}class ye extends ge{_type(){return"number"}}class we extends ge{static observed=["sensitivities:csv"];static attributes=["sensitivity"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n <button data-ref="sensitivity" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_defaultOperator(){return"CONTAINS"}_vocabulary(){return ae}_sensitivityButton;_build(t){const e=super._build(t);return this._sensitivityButton=new ie(e.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:oe,glyphs:le,labelFor:de,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=oe[0],fe(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:oe,fallback:"IGNORE_CASE"}),e}_choices(){return[...super._choices(),this._sensitivityButton].filter(t=>t)}get _sensitivity(){return this._sensitivityButton.value}_declaredSensitivities;get sensitivities(){return this._sensitivityButton?this._sensitivityButton.allowed:this._declaredSensitivities}set sensitivities(t){if(null!==this.declared("sensitivity"))return;if(!this._sensitivityButton)return void(this._declaredSensitivities=ie.narrow(t,oe));const e=this._sensitivityButton.value;this._sensitivityButton.allowed=t,this._sensitivityButton.value=this._sensitivityButton.preferring(e)}get value(){if(!this._sensitivityButton){const t=this._heldValue(),e=null==t?null:this._shownTuple([t[0],...t.slice(2)]);if(null===e)return null;const s=this.declared("sensitivity"),i=null===s?ie.narrow(this.declared("sensitivities"),oe):[oe.includes(s)?s:"IGNORE_CASE"],r=i.includes(t[1])?t[1]:"IGNORE_CASE";return[e[0],i.includes(r)?r:i[0],...e.slice(1)]}const t=this._tuple();return null==t?null:[t[0],this._sensitivity,...t.slice(1)]}set value(t){this._sensitivityButton?null!=t?(this._sensitivityButton.allowed.includes(t[1])&&(this._sensitivityButton.value=t[1]),this._applyTuple([t[0],...t.slice(2)])):this._applyTuple(t):this._holdValue(t)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const Ee=["","true","false"],xe={true:"✓",false:"✗"};class Ae extends dt{static observed=["value:json","operators:csv"];static slots=!0;static OPERATORS=["EQ","NEQ"];static DEFAULT_OPERATOR="EQ";static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <button data-ref="value" type="button" form=""></button>\n <ul popover role="menu"></ul>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_value;_container;_build({slots:t}){const e=this.template().withOverlay({slots:t}).render();this._container=e.querySelector("ful-control-group");const s=e.querySelector("[data-ref=value]");return this._operator=new ie(e.querySelector("[data-ref=operator]"),{vocabulary:Ae.OPERATORS,glyphs:re,labelFor:ce,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new ie(s,{vocabulary:Ee,glyphs:xe,labelFor:he,display:he,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(Ae.DEFAULT_OPERATOR),this._value.allowed=null,this._value.value="",{fragment:e,control:s,error:e.querySelector("ful-field-error"),label:e.querySelector("label"),announces:null,freeze:this._container}}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(t){this._operator?(this._operator.allowed=t,null!==this._operator.value&&(this._operator.value=this._operator.preferring(this._operator.value))):this._declaredOperators=ie.narrow(t,this._vocabulary())}_vocabulary(){return Ae.OPERATORS}get value(){if(!this._value){const t=this._heldValue(),e=`${t?.[1]??""}`;if(""===e)return null;const s=ie.narrow(this.declared("operators"),this._vocabulary());return[s.includes(t[0])?t[0]:s[0],e]}return""===this._value.value?null:[this._operator.value,this._value.value]}set value(t){this._value?null!=t?(this._operator.value=this._operator.preferring(t[0]),this._value.value=t[1]??""):this._value.value="":this._holdValue(t)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(Ae.DEFAULT_OPERATOR))}get criterion(){if(!this._value)return null;const t=this._value.value;return me(pe(this),this._operator.value,[""===t?"":he(t)])}get disabled(){return super.disabled}set disabled(t){super.disabled=t;for(const e of[this._operator,this._value].filter(t=>t))e.claimed=t}}class Se extends Ut{static attributes=["operator"];#Ai(){const t=super.value;return this.multiple?t:null==t?[]:[t]}get value(){const t=this.#Ai();if(0===t.length)return null;const e=this.declared("operator");return e?[e,...t]:t}set value(t){const e=this.declared("operator");let s=null==t?[]:Array.isArray(t)?t:[t];e&&s[0]===e&&(s=s.slice(1)),super.value=this.multiple?s:s[0]??null}get criterion(){return me(pe(this),this.declared("operator"),[super.entry].flat().filter(t=>t).map(t=>t.label))}}class Ce extends C{static slots=!0;static attributes=["placement","icon","describes:presence"];static config={icon:"info-circle-fill"};static template='\n <span role="button" tabindex="0" class="ful-tip" data-ref="trigger" data-tpl-aria-label="#l10n:t(\'info.tooltip\')"><ful-icon data-tpl-name="icon ?? config.icon" aria-hidden="true"></ful-icon></span>\n <ful-note popover data-ref="content">{{{{ slots.default }}}}</ful-note>\n ';render({slots:t}){const e=this.template().withOverlay({slots:t,icon:this.declared("icon")}).render(),s=e.querySelector("[data-ref=trigger]"),i=e.querySelector("[data-ref=content]");It.wire(s,i,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),i.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(e),this.declared("describes")&&Ce.#bt(this,s,i)}static#bt(t,e,s){lt(t)?.describedBy(s)?e.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",t)}}class Te{#Si=new WeakSet;#Ci=new WeakSet;#ct=new WeakMap;async request(t,e,s,i){const r=!this.#Si.has(e)&&!this.#Ci.has(e),n={name:s,section:e,index:i,first:r},a=["section:requested",...null!=i?[`section:requested:#${i}`]:[],...s?[`section:requested:${s}`]:[]],o=[];for(const e of a){const s=new CustomEvent(e,{bubbles:!0,detail:n});t.dispatchEvent(s),o.push(...s.async?.promises??[])}if(0===o.length)return;r&&this.#Ci.add(e);let l=this.#ct.get(e);l||(l=new ot,this.#ct.set(e,l));const u=l.take(),c=()=>!u.stale;e.querySelector(":scope > .ful-section-error")?.remove();const d=requestAnimationFrame(()=>{c()&&(e.toggleAttribute("loading",!0),e.setAttribute("aria-busy","true"))});try{const t=await Promise.all(o);return r&&this.#Si.add(e),t}catch(t){throw c()&&this.#Ti(e,t),t}finally{r&&this.#Ci.delete(e),cancelAnimationFrame(d),c()&&(e.toggleAttribute("loading",!1),e.removeAttribute("aria-busy"))}}#Ti(t,e){t.querySelector(":scope > .ful-section-error")?.remove();const s=document.createElement("div");s.className="ful-section-error",s.setAttribute("role","alert"),s.textContent=P.of().failure(e),t.prepend(s)}}class _e{#_i;#Ri;#qi;#xs;#ki;#Oi=new Te;#Li=new ot;#Ni=null;constructor(t,e,s){this.#_i=t,this.#Ri=e.querySelector("[data-ref=dialog]"),this.#qi=e.querySelector(`[data-ref=${s}]`),this.#xs=e.querySelector("[data-ref=loading]"),this.#ki=e.querySelector("[data-ref=error]")}get dialog(){return this.#Ri}get section(){return this.#qi}get dirty(){return Array.from(this.#Ri.querySelectorAll("ful-form")).some(t=>t.closest("dialog")===this.#Ri&&t.dirty)}dismiss(t,e,s){return this.#Ni?this.#Ni:this.#_i.dispatchEvent(t)?t.cancelable?s&&this.dirty?(this.#Ni=s().then(t=>(t&&this.#Ri.open&&e(),t)).finally(()=>{this.#Ni=null}),this.#Ni):(e(),Promise.resolve(!0)):Promise.resolve(!0):Promise.resolve(!1)}onBackdrop(t){const e=t=>{if(t.target!==this.#Ri)return!1;const e=this.#Ri.getBoundingClientRect();return t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom};let s=!1;this.#Ri.addEventListener("mousedown",t=>{s=e(t)}),this.#Ri.addEventListener("click",i=>{s&&e(i)&&t()})}onSubmitted(t){this.#qi.addEventListener("submit:success",e=>{"ful-form"===e.target.localName&&e.target.parentElement===this.#qi&&t(e.detail.response)})}restChrome(){this.#ki?.replaceChildren(),this.#ki?.setAttribute("hidden",""),this.#xs?.setAttribute("hidden",""),this.#qi?.removeAttribute("hidden")}request(){return this.#Oi.request(this.#_i,this.#qi,null,null).catch(()=>{})}async update(t,e){const s=this.#Li.take();this.#qi.replaceChildren(),this.restChrome(),this.#xs?.removeAttribute("hidden"),this.#qi.setAttribute("hidden",""),e();try{const e=await t();return s.stale?null:(this.#qi.replaceChildren(e),this.#xs?.setAttribute("hidden",""),this.#qi.removeAttribute("hidden"),this.#qi)}catch(t){throw s.stale||(this.#ki?.removeAttribute("hidden"),this.#ki&&(this.#ki.textContent=P.of().failure(t)),this.#xs?.setAttribute("hidden",""),this.#qi.setAttribute("hidden","")),t}}}let Re=!1;const qe=()=>{Re||(Re=!0,document.addEventListener("click",t=>{const e=t.target.closest?.("[dialog-target]");e&&document.getElementById(e.getAttribute("dialog-target"))?.open?.()}))};class ke extends C{static attributes=["header","requires-answer:presence","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header || slots.header || !requiresAnswer" class="ful-dialog-header">\n {{{{ slots.header }}}}\n <h2 data-tpl-if="header">{{ header }}</h2>\n <button data-tpl-if="!requiresAnswer" type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'dialog.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <div data-ref="body" class="ful-dialog-body">{{{{ slots.default }}}}</div>\n <footer class="ful-dialog-footer"><button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons && !closeOnSubmit" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>{{{{ slots.buttons }}}}</footer>\n </dialog>\n ';#Ri;#Pi;#Mi=[];#Fi=null;render({slots:t}){const e=this.declared("requires-answer"),s=this.declared("close-on-submit"),i=this.template().withOverlay({slots:t,header:this.declared("header")??"",requiresAnswer:e,closeOnSubmit:s}).render();this.#Pi=new _e(this,i,"body"),this.#Ri=this.#Pi.dialog;const r=i.querySelector("h2");r&&(r.id||=d.uid("ful-dialog-title"),this.#Ri.setAttribute("aria-labelledby",r.id)),this.#Ri.addEventListener("close",()=>{const t=this.#zi();this.dispatchEvent(new CustomEvent("close",{detail:t})),this.#Ii(t)}),this.#Ri.addEventListener("click",t=>{const e=t.target.closest("button[data-result]");e&&e.closest("dialog")===this.#Ri&&this.#Ri.close(e.dataset.result)}),e||this.#Pi.onBackdrop(()=>this.dismiss("backdrop")),i.querySelector("[data-ref=close]")?.addEventListener("click",()=>this.dismiss("button")),s&&this.#Pi.onSubmitted(t=>{this.#Fi={dismissed:!1,result:null,response:t},this.#Ri.close("submitted")}),this.#Ri.addEventListener("cancel",t=>{if(!t.cancelable)return this.#Ri.returnValue="",void this.#Di("escape",!1);t.preventDefault(),e||this.dismiss("escape")}),this.replaceChildren(i),qe()}#zi(){if(this.#Fi)return this.#Fi;const t=this.#Ri?.returnValue??"";return""===t?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:t,response:null}}#Ii(t){const e=this.#Mi;this.#Mi=[];for(const s of e)s(t)}disconnectedCallback(){this.#Ii(this.#zi())}open(){return this.ask()}ask(){return this.#$i()&&(this.#Pi.restChrome(),this.#Pi.request()),new Promise(t=>{this.#Mi.push(t)})}async update(t){return await this.#Pi.update(t,()=>this.#$i())}refresh(){return this.#Pi.request()}dismiss(t){return this.#Ri.open?this.#Di(t,!0):Promise.resolve(!0)}#Di(t,e){return this.#Pi.dismiss(new CustomEvent("dialog:dismiss",{cancelable:e,detail:{reason:t}}),()=>this.#Ri.close(""),this.declared("guard-dismiss")?Oe:null)}close(t){this.#Ri.close(t??"")}#$i(){return this.#Ri.open&&!this.#Ri.matches(":modal")&&this.#Ri.removeAttribute("open"),!this.#Ri.open&&(this.#Ri.returnValue="",this.#Fi=null,this.#Ri.showModal(),!0)}static async ask(t,e,s=[],{className:i}={}){const r=document.createElement("ful-dialog");if(r.setAttribute("header",t),i&&(r.className=i),"string"==typeof e?r.textContent=e:e&&r.append(e),s.length>0){const t=document.createElement("template");t.setAttribute("slot","buttons");for(const e of s){if(e instanceof Node){t.content.append(e);continue}const[s,i,r]=e,n=document.createElement("button");n.type="button",n.dataset.result=s,r&&(n.className=r),n.textContent=i,t.content.append(n)}r.append(t)}document.body.append(r);try{return await S.waitFor(r),await r.ask()}finally{r.remove()}}static async confirm(t,e,s={},i={}){const r=await ke.ask(t,e,[["cancel",s.cancel??P.of().t("dialog.cancel")],["confirm",s.confirm??P.of().t("dialog.confirm"),"ful-button"]],i);return!r.dismissed&&"confirm"===r.result}}const Oe=()=>{const t=P.of();return ke.confirm(t.t("dialog.discard.header"),t.t("dialog.discard.body"),{confirm:t.t("dialog.discard.confirm"),cancel:t.t("dialog.discard.cancel")})};class Le extends C{static attributes=["header","placement","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-drawer">\n <header>\n {{{{ slots.header }}}}\n <h2 data-ref="title">{{ title }}</h2>\n <button type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'drawer.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <section data-ref="content">{{{{ slots.default }}}}</section>\n </dialog>\n ';#Ri;#Bi;#Pi;#Fi=null;#Mi=[];#ji=!1;#Hi=new ot;render({slots:t}){const e=this.template().withOverlay({slots:t,title:this.declared("header")??""}).render();this.#Pi=new _e(this,e,"content"),this.#Ri=this.#Pi.dialog,this.#Bi=e.querySelector("[data-ref=title]"),this.#Bi.id||=d.uid("ful-drawer-title"),this.#Ri.setAttribute("aria-labelledby",this.#Bi.id);const s=this.declared("placement");s&&this.#Ri.setAttribute("placement",s),e.querySelector("[data-ref=close]").addEventListener("click",()=>this.dismiss("button")),this.#Pi.onBackdrop(()=>this.dismiss("backdrop")),this.#Ri.addEventListener("cancel",t=>{if(!t.cancelable)return this.#Vi(),void this.#Di("escape",!1);t.preventDefault(),this.dismiss("escape")}),this.#Ri.addEventListener("click",t=>{const e=t.target.closest("button[data-result]");e&&e.closest("dialog")===this.#Ri&&this.close(e.dataset.result)}),this.#Ri.addEventListener("close",()=>{const t=this.#zi();this.dispatchEvent(new CustomEvent("close",{detail:t})),this.#Ii(t)}),this.declared("close-on-submit")&&this.#Pi.onSubmitted(t=>{this.#Fi={dismissed:!1,result:null,response:t},this.close()}),this.replaceChildren(e),qe()}get header(){return this.#Bi.textContent}set header(t){this.#Bi.textContent=t??""}async update(t,e){return this.header=t,await this.#Pi.update(e,()=>this.#$i())}refresh(){return this.#Pi.request()}#zi(){return this.#Fi??{dismissed:!0,result:null,response:null}}#Ii(t){const e=this.#Mi;this.#Mi=[];for(const s of e)s(t)}disconnectedCallback(){this.#Ii(this.#zi())}open(){return this.ask()}ask(){return this.#$i()&&(this.#Pi.restChrome(),this.#Pi.request()),new Promise(t=>{this.#Mi.push(t)})}dismiss(t){return this.#ji||!this.#Ri.open?Promise.resolve(!0):this.#Di(t,!0)}#Di(t,e){return this.#Pi.dismiss(new CustomEvent("drawer:dismiss",{cancelable:e,detail:{reason:t}}),()=>this.close(),this.declared("guard-dismiss")?Oe:null)}close(t){if(this.#ji||!this.#Ri.open)return;if(t&&(this.#Fi={dismissed:!1,result:t,response:null}),matchMedia("(prefers-reduced-motion: reduce)").matches)return void this.#Ri.close();this.#Ri.setAttribute("closing","");const e=this.#Ri.getAnimations();if(0===e.length)return void this.#Wi();this.#ji=!0;const s=this.#Hi.take();Promise.allSettled(e.map(t=>t.finished)).then(()=>{s.stale||this.#Wi()})}#Wi(){this.#Vi(),this.#Ri.close()}#Vi(){this.#ji=!1,this.#Hi.invalidate(),this.#Ri.removeAttribute("closing")}#$i(){return this.#ji&&(this.#Fi=null),this.#Vi(),this.#Ri.open&&!this.#Ri.matches(":modal")&&this.#Ri.removeAttribute("open"),!this.#Ri.open&&(this.#Fi=null,this.#Ri.showModal(),!0)}}class Ne extends C{static attributes=["for"];#Ui=null;#Gi=null;#Qi=t=>{const e=t.target;this.#Gi=this.matches(":popover-open")&&this.#Ui?.contains(e)?this.#Ui:null};connectedCallback(){super.connectedCallback(),this.rendered&&!this.declared("for")&&document.addEventListener("pointerdown",this.#Qi,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this.#Qi,!0)}render(){const t=this.declared("for"),e=t?document.getElementById(t):null;if(t&&!e)throw new Error(`ful-menu names no invoker: for="${t}" must name an element already in the page when the menu upgrades`);this.setAttribute("role","menu"),this.hasAttribute("popover")||this.setAttribute("popover",""),e?(this.#Ui=e,e.setAttribute("aria-haspopup","menu"),It.wire(e,this,{prefix:"ful-menu",invoke:!0,expanded:!0})):this.#Ki(),se(()=>this.#Ui,this,{items:()=>this.items}),this.#Ei(),this.addEventListener("click",t=>{const e=t.target;this.items.some(t=>t===e||t.contains(e))&&this.hidePopover()})}showFor(t){if(this.declared("for"))throw new Error("ful-menu: showFor serves a menu without for; a menu with for is opened by its invoker");const e=this.#Gi;if(this.#Gi=null,e===t)return;this.#Ui&&this.#Ui!==t&&this.#Ui.setAttribute("aria-expanded","false"),this.#Ui=t,t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","true"),this.style.margin="";const s=Number.parseFloat(getComputedStyle(this).marginBlockStart)||0,i=this.matches(":popover-open");It.show(this,t,{flip:!0,gap:s}),i&&this.items[0]?.focus()}get items(){return this.#Ei().filter(t=>!t.hasAttribute("disabled")&&!t.hasAttribute("hidden"))}#Ki(){document.addEventListener("pointerdown",this.#Qi,!0),this.addEventListener("toggle",t=>{"closed"===t.newState&&this.#Ui?.setAttribute("aria-expanded","false")})}#Ei(){const t=[...this.querySelectorAll(":scope > button, :scope > a[href]")];for(const e of t)e.hasAttribute("role")||e.setAttribute("role","menuitem"),e.tabIndex=-1;return t}}const Pe=["info","success","warning","error"],Me=new Set;let Fe=!1;class ze extends C{static attributes=["timeout:number"];#Ji;connectedCallback(){super.connectedCallback(),this.rendered&&Me.add(this)}disconnectedCallback(){Me.delete(this)}render(){this.#Ji=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",P.of().t("toast.region")),this.setAttribute("popover","manual"),Fe||(Fe=!0,document.addEventListener("show-toast",t=>{if(t.detail)for(const e of Me)e.show(t.detail.message,t.detail)})),Me.add(this)}show(t,e={}){const s=Pe.includes(e.severity)?e.severity:"info",i=document.createElement("ful-toast");i.classList.add(s),i.setAttribute("role","error"===s?"alert":"status");const r=document.createElement("div");r.textContent=P.of().failure(t);const n=document.createElement("button");n.type="button",n.setAttribute("aria-label",P.of().t("toast.dismiss"));const a=document.createElement("ful-icon");a.setAttribute("name","x-lg"),a.setAttribute("aria-hidden","true"),n.append(a),i.append(r);let o=e.timeout??this.#Ji,l=performance.now(),u=0;const c=()=>{clearTimeout(u),i.contains(document.activeElement)&&this.focus(),matchMedia("(prefers-reduced-motion: reduce)").matches?i.remove():(i.classList.add("ful-toast-out"),0===i.getAnimations().length&&i.remove())};if(e.action?.label){const t=document.createElement("button");t.type="button",t.className="ful-toast-action",t.textContent=String(e.action.label),t.addEventListener("click",()=>{e.action.onClick?.(),c()}),i.append(t)}i.append(n),i.addEventListener("animationend",()=>{i.classList.contains("ful-toast-out")&&i.remove()});let d=0;const h=()=>{0===d&&(clearTimeout(u),o=Math.max(0,o-(performance.now()-l))),++d},p=()=>{0!==d&&0===--d&&(l=performance.now(),u=setTimeout(c,o))};return i.addEventListener("mouseenter",h),i.addEventListener("mouseleave",p),i.addEventListener("focusin",h),i.addEventListener("focusout",p),n.addEventListener("click",c),this.append(i),this.#Xi(),u=setTimeout(c,o),i}#Xi(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class Ie extends C{static slots=!0;static observed=["active:number"];static template='\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-start" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.previous\')"><ful-icon name="chevron-left" aria-hidden="true"></ful-icon></button>\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-end" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.next\')"><ful-icon name="chevron-right" aria-hidden="true"></ful-icon></button>\n {{{{ slots.default }}}}\n ';#Yi;#Zi;#tr;#er=[];#sr=[];#Oi=new Te;#ir=0;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#Yi=e.querySelector("ful-tablist"),this.#Zi=e.querySelector('[data-ref="scroll-start"]'),this.#tr=e.querySelector('[data-ref="scroll-end"]');const s=[this.#Yi,this.#Zi,this.#tr],i=[...this.#Yi.children];this.#sr=[...e.children].filter(t=>!s.includes(t)),i.length!==this.#sr.length&&console.warn(`ful-tabs: ${i.length} tabs declared for ${this.#sr.length} panels, the surplus is left alone`);const r=Math.min(i.length,this.#sr.length);this.#er=[];for(let t=0;t!==r;++t){const e=this.#sr[t],s=document.createElement("button");s.type="button",s.role="tab",s.id=d.uid("ful-tab"),e.id||(e.id=d.uid("ful-tabpanel")),s.setAttribute("aria-controls",e.id),e.role="tabpanel",e.setAttribute("aria-labelledby",s.id),e.tabIndex=0,s.append(...i[t].childNodes),s.addEventListener("click",()=>{this.active=t}),i[t].replaceWith(s),this.#er.push(s)}this.#Yi.addEventListener("keydown",t=>{const e=this.#ir;let s=null;"ArrowRight"===t.key?s=(e+1)%this.#er.length:"ArrowLeft"===t.key?s=(e-1+this.#er.length)%this.#er.length:"Home"===t.key?s=0:"End"===t.key&&(s=this.#er.length-1),null!==s&&s!==e&&(t.preventDefault(),this.active=s,this.#er[s].focus())}),this.#Zi.addEventListener("click",()=>this.#rr(-1)),this.#tr.addEventListener("click",()=>this.#rr(1)),this.#Yi.addEventListener("scroll",()=>this.#nr(),{passive:!0});let n=-1;const a=new ResizeObserver(()=>{this.#nr(),this.#Yi.clientWidth!==n&&(n=this.#Yi.clientWidth,this.#ar(this.#er[this.#ir],"auto"))});a.observe(this.#Yi);for(const t of this.#er)a.observe(t);this.replaceChildren(e)}#nr(){const t=this.#Yi,e=t.scrollWidth-t.clientWidth,s=Math.abs(t.scrollLeft);this.#Zi.hidden=s<=1,this.#tr.hidden=s>=e-1,this.#Zi.style.blockSize=this.#tr.style.blockSize=`${t.clientHeight}px`}#or(){const t=this.#Yi.getBoundingClientRect(),e="rtl"===getComputedStyle(this.#Yi).direction,[s,i]=e?[this.#tr,this.#Zi]:[this.#Zi,this.#tr];return{left:t.left+s.offsetWidth,right:t.right-i.offsetWidth}}#rr(t){const{left:e,right:s}=this.#or(),i=t>0!=("rtl"===getComputedStyle(this.#Yi).direction)?t=>t.getBoundingClientRect().right>s+1:t=>t.getBoundingClientRect().left<e-1,r=t>0?this.#er.find(i):this.#er.findLast(i);this.#ar(r,matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth")}#ar(t,e){if(!t)return;const{left:s,right:i}=this.#or(),r=t.getBoundingClientRect();r.right>i?this.#Yi.scrollBy({left:Math.ceil(r.right-i),behavior:e}):r.left<s&&this.#Yi.scrollBy({left:Math.floor(r.left-s),behavior:e})}get active(){return this.#ir}refresh(t){const e=t instanceof Element?this.#sr.indexOf(t):Number.isInteger(t)?t:NaN,s=this.#sr[e];if(s)return this.#Oi.request(this,s,null,e).catch(()=>{});console.warn(`ful-tabs: no panel answers to "${t}"`)}set active(t){const e=Math.min(Math.max(0,Number(t)||0),Math.max(0,this.#er.length-1)),s=this.#ir;for(const[t,s]of this.#er.entries())s.setAttribute("aria-selected",t===e?"true":"false"),s.tabIndex=t===e?0:-1,this.#sr[t].hidden=t!==e;this.#ir=e,this.reflectTo("active",e),this.#ar(this.#er[e],"auto"),this.rendered&&e!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:e,previous:s}})),this.#sr.length>0&&(e!==s||!this.rendered)&&this.#Oi.request(this,this.#sr[e],null,e).catch(()=>{})}}class De extends C{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#ie;#lr=!1;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#ie=e.querySelector("ful-accordion-group"),this.replaceChildren(e)}get exclusive(){return this.#lr}set exclusive(t){this.#lr=!0===t,this.reflectTo("exclusive",this.#lr);const e=this.#lr?d.uid("ful-accordion"):null;for(const t of this.#ie.querySelectorAll(":scope > details"))null===e?t.removeAttribute("name"):t.setAttribute("name",e)}}class $e extends C{static slots=!0;static observed=["progress"];static template="\n <ful-steps><ol data-tpl-aria-label=\"#l10n:t('wizard.progress')\">{{{{ slots.steps }}}}</ol></ful-steps>\n {{{{ slots.default }}}}\n ";#ur=[];#Pi=[];#Oi=new Te;#cr=0;#dr;render({slots:t}){const e=this.template().withOverlay({slots:t}).render(),s=[...e.querySelector("ful-steps ol").children];this.#Pi=[...e.children].filter(t=>"ful-steps"!==t.localName),s.length!==this.#Pi.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#Pi.length} sections, the surplus is left alone`);const i=Math.min(s.length,this.#Pi.length);this.#ur=[];for(let t=0;t!==i;++t){const e=document.createElement("li");e.append(...s[t].childNodes),s[t].replaceWith(e),this.#ur.push(e),this.#Pi[t].tabIndex=-1}if(this.replaceChildren(e),i>0){const t=this.#Pi.findIndex(t=>"step"===t.getAttribute("aria-current"));this.#hr(-1===t?0:Math.min(t,i-1)),this.#pr(this.#cr).catch(()=>{})}}get index(){return this.#cr}get step(){return this.#Pi[this.#cr]?.getAttribute("data-step")??null}get progress(){return this.#dr}set progress(t){this.#dr=t,this.reflectTo("progress",t)}next(){return this.#fr(this.#cr+1)}prev(){return this.#fr(this.#cr-1)}move(t){const e=this.#Pi.findIndex(e=>e.getAttribute("data-step")===t);if(!(-1===e||e>=this.#ur.length))return this.#fr(e);console.warn(`ful-wizard: no section paired with a step carries data-step="${t}"`)}refresh(t){const e=t instanceof Element?this.#Pi.indexOf(t):this.#Pi.findIndex(e=>e.getAttribute("data-step")===t);if(!(-1===e||e>=this.#ur.length))return this.#pr(e).catch(()=>{});console.warn(`ful-wizard: no section answers to "${t}"`)}#pr(t){return this.#Oi.request(this,this.#Pi[t],this.#Pi[t].getAttribute("data-step"),t)}#fr(t){const e=Math.min(Math.max(0,t),Math.max(0,this.#ur.length-1));if(e!==this.#cr)return this.#hr(e),this.#Pi[this.#cr].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#cr,step:this.step}})),this.#pr(e)}#hr(t){for(const[e,s]of this.#ur.entries())e===t?(s.setAttribute("aria-current","step"),this.#Pi[e].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#Pi[e].removeAttribute("aria-current"));this.#cr=t}}const Be={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","table.loaded":"Showing {loaded} of {total}","table.range":"Rows {from}-{to} of {total}","table.retry":"Retry","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","failure.no-reason":"Something went wrong","dialog.acknowledge":"Got it","dialog.close":"Close","dialog.confirm":"Confirm","dialog.cancel":"Cancel","dialog.discard.header":"Unsaved changes","dialog.discard.body":"There are unsaved changes: close anyway?","dialog.discard.confirm":"Close without saving","dialog.discard.cancel":"Keep editing","drawer.close":"Close","spinner.loading":"Loading…","tabs.previous":"Previous tabs","tabs.next":"Next tabs","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","table.loaded":"Mostrati {loaded} di {total}","table.range":"Righe {from}-{to} di {total}","table.retry":"Riprova","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","dialog.discard.header":"Modifiche non salvate","dialog.discard.body":"Ci sono modifiche non salvate: chiudere comunque?","dialog.discard.confirm":"Chiudi senza salvare","dialog.discard.cancel":"Continua a modificare","drawer.close":"Chiudi","spinner.loading":"Caricamento…","tabs.previous":"Schede precedenti","tabs.next":"Schede successive","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","table.loaded":"Mostrando {loaded} de {total}","table.range":"Filas {from}-{to} de {total}","table.retry":"Reintentar","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{one:"Se ha superado el número máximo de {count} archivo",other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","failure.no-reason":"Se ha producido un error","dialog.acknowledge":"Entendido","dialog.close":"Cerrar","dialog.confirm":"Confirmar","dialog.cancel":"Cancelar","dialog.discard.header":"Cambios sin guardar","dialog.discard.body":"Hay cambios sin guardar: ¿cerrar de todos modos?","dialog.discard.confirm":"Cerrar sin guardar","dialog.discard.cancel":"Seguir editando","drawer.close":"Cerrar","spinner.loading":"Cargando…","tabs.previous":"Pestañas anteriores","tabs.next":"Pestañas siguientes","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","table.loaded":"Affichage de {loaded} sur {total}","table.range":"Lignes {from} à {to} sur {total}","table.retry":"Réessayer","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","dialog.discard.header":"Modifications non enregistrées","dialog.discard.body":"Des modifications ne sont pas enregistrées : fermer quand même ?","dialog.discard.confirm":"Fermer sans enregistrer","dialog.discard.cancel":"Continuer à modifier","drawer.close":"Fermer","spinner.loading":"Chargement…","tabs.previous":"Onglets précédents","tabs.next":"Onglets suivants","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class je{#mr;#gr;#br;constructor(t={}){const e=t.language||navigator?.language||"en";try{this.#mr=Intl.getCanonicalLocales(String(e).replaceAll("_","-"))[0]}catch{throw new RangeError(`Plugin: language '${e}' is not a language tag: pass a BCP-47 tag such as 'it' or 'it-IT', or leave it out for the browser's language`)}this.#gr=t.translations??{},this.#br=t.httpClient??null}configure(t){const e=this.#br??G.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#mr.split("-")[0],i={...Be.en,...Be[s],...this.#gr};t.defineModule("l10n",P).defineComponent("http-client",e).defineElement("ful-tooltip",Ce).defineElement("ful-dialog",ke).defineElement("ful-drawer",Le).defineElement("ful-menu",Ne).defineElement("ful-toasts",ze).defineElement("ful-tabs",Ie).defineElement("ful-accordion",De).defineElement("ful-wizard",$e).defineElement("ful-form",gt).defineElement("ful-checkbox",Qt).defineElement("ful-input",xt).defineElement("ful-input-file",kt).defineElement("ful-local-date",Ct).defineElement("ful-instant",Tt).defineElement("ful-input-local-date",_t).defineElement("ful-input-local-time",Rt).defineElement("ful-input-instant",qt).defineElement("ful-radio-group",Gt).defineElement("ful-table",ee).defineElement("ful-pagination",Jt).defineElement("ful-sorter",Kt).defineElement("ful-filter-instant",be).defineElement("ful-filter-local-date",ve).defineElement("ful-filter-number",ye).defineElement("ful-filter-boolean",Ae).defineElement("ful-filter-text",we).defineElement("ful-filter-in",Se).defineElement("ful-select",Ut).defineElement("ful-dropdown",Wt).defineComponent("loaders:select",Vt).defineComponent("loaders:form",ft).defineComponent("loaders:table",te).defineOverlay({l10n:i,locale:this.#mr})}}var He=Object.freeze({__proto__:null,Accordion:De,Anchors:It,AsyncEvents:nt,Bindings:ct,BooleanFilter:Ae,Checkbox:Qt,Claims:ot,CompareFilter:ge,Dialog:ke,Drawer:Le,Dropdown:Wt,Field:dt,Form:gt,FormLoader:ft,InFilter:Se,Input:xt,InputFile:kt,InputInstant:qt,InputLocalDate:_t,InputLocalTime:Rt,Instant:Tt,InstantFilter:be,LocalDate:Ct,LocalDateFilter:ve,LocalStorage:et,Menu:Ne,NumberFilter:ye,PageLeave:at,Pagination:Jt,Plugin:je,RadioGroup:Gt,Select:Ut,SelectLoader:Vt,SessionStorage:st,SortButton:Kt,Table:ee,TableLoader:te,Tabs:Ie,TextFilter:we,Timing:ut,Toasts:ze,Tooltip:Ce,VersionedLocalStorage:it,VersionedSessionStorage:rt,Wizard:$e,describable:lt});return"undefined"!=typeof window&&(window.ftl=M,window.httpc=Y,window.ful=He),t.Accordion=De,t.Anchors=It,t.AsyncEvents=nt,t.Attributes=d,t.Base64=z,t.Bindings=ct,t.BooleanFilter=Ae,t.BoundedCache=e,t.Checkbox=Qt,t.Claims=ot,t.CompareFilter=ge,t.Dialog=ke,t.Drawer=Le,t.Dropdown=Wt,t.ExpressionEvaluator=u,t.Expressions=l,t.Failure=F,t.Field=dt,t.Form=gt,t.FormLoader=ft,t.Fragments=c,t.Hex=I,t.HttpClient=G,t.HttpClientBuilder=V,t.HttpClientError=$,t.HttpInterceptorChain=U,t.HttpMultipartRequestCustomizer=X,t.HttpRequestBuilder=J,t.InFilter=Se,t.Input=xt,t.InputFile=kt,t.InputInstant=qt,t.InputLocalDate=_t,t.InputLocalTime=Rt,t.Instant=Tt,t.InstantFilter=be,t.LightSlots=h,t.LocalDate=Ct,t.LocalDateFilter=ve,t.LocalStorage=et,t.Localization=P,t.MediaType=D,t.Menu=Ne,t.Nodes=p,t.NumberFilter=ye,t.PageLeave=at,t.Pagination=Jt,t.ParsedElement=C,t.Plugin=je,t.RadioGroup=Gt,t.Registry=E,t.RenderError=y,t.Rendering=S,t.Select=Ut,t.SelectLoader=Vt,t.SessionStorage=st,t.SortButton=Kt,t.Table=ee,t.TableLoader=te,t.Tabs=Ie,t.Template=v,t.Templates=A,t.TextFilter=we,t.Timing=ut,t.Toasts=ze,t.Tooltip=Ce,t.VersionedLocalStorage=it,t.VersionedSessionStorage=rt,t.Wizard=$e,t.describable=lt,t.registry=x,t}({});
|
|
2
2
|
//# sourceMappingURL=fml.iife.min.js.map
|