tosijs 1.3.1 → 1.3.4
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/index.js +6 -6
- package/dist/index.js.map +6 -6
- package/dist/main.js +6 -6
- package/dist/main.js.map +6 -6
- package/dist/module.js +6 -6
- package/dist/module.js.map +6 -6
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(()=>{var{defineProperty:Kn,getOwnPropertyNames:xf,getOwnPropertyDescriptor:yf}=Object,Lf=Object.prototype.hasOwnProperty;var Lo=new WeakMap,Tf=(n)=>{var o=Lo.get(n),f;if(o)return o;if(o=Kn({},"__esModule",{value:!0}),n&&typeof n==="object"||typeof n==="function")xf(n).map((i)=>!Lf.call(o,i)&&Kn(o,i,{get:()=>n[i],enumerable:!(f=yf(n,i))||f.enumerable}));return Lo.set(n,o),o};var sf=(n,o)=>{for(var f in o)Kn(n,f,{get:o[f],enumerable:!0,configurable:!0,set:(i)=>o[f]=()=>i})};var pf={};sf(pf,{xinValue:()=>Fo,xinProxy:()=>An,xinPath:()=>Xo,xin:()=>X,warnDeprecated:()=>q,version:()=>qn,vars:()=>Zn,varDefault:()=>wn,validateAgainstConstraints:()=>Un,updates:()=>tn,unobserve:()=>u,touchElement:()=>On,touch:()=>B,tosiValue:()=>H,tosiSetValue:()=>Co,tosiPath:()=>F,tosi:()=>yn,throttle:()=>mn,svgElements:()=>Gn,settings:()=>S,onThemePreferencesChange:()=>bo,onStylesheetChange:()=>Bo,on:()=>p,observe:()=>l,mathML:()=>Qn,makeComponent:()=>Tn,invertLuminance:()=>eo,initVars:()=>ho,hotReload:()=>Ef,getThemePreferences:()=>co,getListItem:()=>zn,getListInstance:()=>Wn,getListBinding:()=>rn,getCssVar:()=>$n,elements:()=>L,deprecated:()=>Cn,deleteListItem:()=>nf,debounce:()=>Yn,css:()=>V,boxedProxy:()=>Ln,boxed:()=>g,blueprintLoader:()=>wf,blueprint:()=>rf,bindings:()=>En,bind:()=>Q,StyleSheet:()=>Io,MoreMath:()=>Ko,Component:()=>W,Color:()=>x,BlueprintLoader:()=>jn,Blueprint:()=>sn});function z(n){if(n==null||typeof n!=="object")return n;if(n instanceof Set)return new Set(n);else if(Array.isArray(n))return n.map(z);let o={};for(let f in n){let i=n[f];if(n!=null&&typeof n==="object")o[f]=z(i);else o[f]=i}return o}var Sn="-xin-data",R=`.${Sn}`,Bn="-xin-event",In=`.${Bn}`,J=Symbol.for("xin-path"),U=Symbol.for("xin-value"),Vn="xinObserve",hn="xinBind",en="xinOn",a=Symbol("list-binding"),Hn=Symbol("list-instance"),Rn=new Map;function so(n,o){let f=Rn.get(n);if(f===void 0)f=new Set,Rn.set(n,f);f.add(o)}function Ho(n){return Rn.get(n)}var To=new Set;function q(n,o){if(!To.has(n))console.warn(o),To.add(n)}function Cn(n,o){let f=!1;return(...i)=>{if(!f)console.warn(o),f=!0;return n(...i)}}var F=(n)=>{return n&&n[J]||void 0};function H(n){if(typeof n==="object"&&n!==null){let o=n[U];return o!==void 0?o:n}return n}function Co(n,o){if(F(n)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");n[U]=o}var Xo=Cn(F,"xinPath is deprecated. Use tosiPath instead."),Fo=Cn(H,"xinValue is deprecated. Use tosiValue instead."),b=new WeakMap,O=new WeakMap;var P=(n)=>{let o=n.cloneNode();if(o instanceof Element){let f=O.get(n),i=b.get(n);if(f!=null)O.set(o,z(f));if(i!=null)b.set(o,z(i))}for(let f of Array.from(n instanceof HTMLTemplateElement?n.content.childNodes:n.childNodes))if(f instanceof Element||f instanceof DocumentFragment)o.appendChild(P(f));else o.appendChild(f.cloneNode());return o};var S={debug:!1,perf:!1};var Hf=(n)=>{try{return JSON.stringify(n)}catch(o){return"{has circular references}"}},bn=(...n)=>Error(n.map(Hf).join(" "));var Cf=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),Xf=0,Ff=()=>(parseInt("10000",36)+ ++Xf).toString(36).slice(-5),Df=()=>Cf()+Ff(),_n=Symbol("delete"),$o=Symbol("new-object"),Pn=Symbol("automatic-index");function Jo(n){if(n==="")return[];if(Array.isArray(n))return n;else{let o=[];while(n.length>0){let f=n.search(/\[[^\]]+\]/);if(f===-1){o.push(n.split("."));break}else{let i=n.slice(0,f);if(n=n.slice(f),i!=="")o.push(i.split("."));if(f=n.indexOf("]")+1,o.push(n.slice(1,f-1)),n.slice(f,f+1)===".")f+=1;n=n.slice(f)}}return o}}var A=new WeakMap;function Zo(n,o){if(A.get(n)===void 0)A.set(n,{});if(A.get(n)[o]===void 0)A.get(n)[o]={};let f=A.get(n)[o];if(o==="_auto_")n.forEach((i,c)=>{if(i[Pn]===void 0)i[Pn]=Df();f[i[Pn]+""]=c});else n.forEach((i,c)=>{f[j(i,o)+""]=c});return f}function Yf(n,o){if(A.get(n)===void 0||A.get(n)[o]===void 0)return Zo(n,o);else return A.get(n)[o]}function $f(n,o,f){f=f+"";let i=Yf(n,o)[f];if(i===void 0||j(n[i],o)+""!==f)i=Zo(n,o)[f];return i}function Jf(n,o,f){if(n[o]===void 0&&f!==void 0)n[o]=f;return n[o]}function Go(n,o,f,i){let c=o!==""?$f(n,o,f):f;if(i===_n)return n.splice(c,1),A.delete(n),Symbol("deleted");else if(i===$o){if(o===""&&n[c]===void 0)n[c]={}}else if(i!==void 0)if(c!==void 0)n[c]=i;else if(o!==""&&j(i,o)+""===f+"")n.push(i),c=n.length-1;else throw Error(`byIdPath insert failed at [${o}=${f}]`);return n[c]}function Do(n){if(!Array.isArray(n))throw bn("setByPath failed: expected array, found",n)}function Yo(n){if(n==null||!(n instanceof Object))throw bn("setByPath failed: expected Object, found",n)}function j(n,o){let f=Jo(o),i=n,c,m,E,r;for(c=0,m=f.length;i!==void 0&&c<m;c++){let w=f[c];if(Array.isArray(w))for(E=0,r=w.length;i!==void 0&&E<r;E++){let M=w[E];i=i[M]}else if(i.length===0){if(i=i[Number(w.slice(1))],w[0]!=="=")return}else if(w.includes("=")){let[M,...y]=w.split("=");i=Go(i,M,y.join("="))}else E=parseInt(w,10),i=i[E]}return i}function Qo(n,o,f){let i=n;if(o==="")throw Error("setByPath cannot be used to set the root object");let c=Jo(o);while(i!=null&&c.length>0){let m=c.shift();if(typeof m==="string"){let E=m.indexOf("=");if(E>-1){if(E===0)Yo(i);else Do(i);let r=m.slice(0,E),w=m.slice(E+1);if(i=Go(i,r,w,c.length>0?$o:f),c.length===0)return!0}else{Do(i);let r=parseInt(m,10);if(c.length>0)i=i[r];else{if(f!==_n){if(i[r]===f)return!1;i[r]=f}else i.splice(r,1);return!0}}}else if(Array.isArray(m)&&m.length>0){Yo(i);while(m.length>0){let E=m.shift();if(m.length>0||c.length>0)i=Jf(i,E,m.length>0?{}:[]);else{if(f!==_n){if(i[E]===f)return!1;i[E]=f}else{if(!Object.prototype.hasOwnProperty.call(i,E))return!1;delete i[E]}return!0}}}else throw Error(`setByPath failed, bad path ${o}`)}throw Error(`setByPath(${n}, ${o}, ${f}) failed`)}var ko=Symbol("observer should be removed"),Xn=[],Fn=[],pn=!1,Nn,gn;function Wo(n,o,f,i){let c=Ho(n);if(c===void 0)return[];let m=[];for(let E of c){let r=j(f,E);if(r!==void 0)m.push(`${n}[${E}=${r}]${i}`)}return m}class zo{description;test;callback;constructor(n,o){let f=typeof o==="string"?`"${o}"`:`function ${o.name}`,i;if(typeof n==="string")this.test=(c)=>typeof c==="string"&&c!==""&&(n.startsWith(c)||c.startsWith(n)),i=`test = "${n}"`;else if(n instanceof RegExp)this.test=n.test.bind(n),i=`test = "${n.toString()}"`;else if(n instanceof Function)this.test=n,i=`test = function ${n.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${i}, ${f}`,typeof o==="function")this.callback=o;else throw Error("expect callback to be a path or function");Xn.push(this)}}var tn=async()=>{if(Nn===void 0)return;await Nn},Zf=()=>{if(S.perf)console.time("xin async update");let n=Array.from(Fn);for(let o of n)Xn.filter((f)=>{let i;try{i=f.test(o)}catch(c){throw Error(`Listener ${f.description} threw "${c}" at "${o}"`)}if(i===ko)return u(f),!1;return i}).forEach((f)=>{let i;try{i=f.callback(o)}catch(c){console.error(`Listener ${f.description} threw "${c}" handling "${o}"`)}if(i===ko)u(f)});if(Fn.splice(0),pn=!1,typeof gn==="function")gn();if(S.perf)console.timeEnd("xin async update")},B=(n)=>{let o=typeof n==="string"?n:F(n);if(o===void 0)throw console.error("touch was called on an invalid target",n),Error("touch was called on an invalid target");if(pn===!1)Nn=new Promise((f)=>{gn=f}),pn=setTimeout(Zf);if(Fn.find((f)=>o.startsWith(f))==null)Fn.push(o)},I=(n,o)=>{return new zo(n,o)},u=(n)=>{let o=Xn.indexOf(n);if(o>-1)Xn.splice(o,1);else throw Error("unobserve failed, listener not found")};var nn={},ln=null,Oo=(n)=>{ln=n},Dn=()=>{if(ln===null)throw Error("xin proxy not initialized");return ln},vn=null,an=null,Uo=(n,o)=>{vn=n,an=o},on=()=>{if(vn===null)throw Error("bind not initialized");return vn},fn=()=>{if(an===null)throw Error("on not initialized");return an};var no=(n,o)=>{let f=new Event(o);n.dispatchEvent(f)},Ao=(n)=>{if(n instanceof HTMLInputElement)return n.type;else if(n instanceof HTMLSelectElement&&n.hasAttribute("multiple"))return"multi-select";else return"other"},jo=(n,o)=>{switch(Ao(n)){case"radio":n.checked=n.value===o;break;case"checkbox":n.checked=!!o;break;case"date":n.valueAsDate=new Date(o);break;case"multi-select":for(let f of Array.from(n.querySelectorAll("option")))f.selected=o[f.value];break;default:n.value=o}},uo=(n)=>{switch(Ao(n)){case"radio":{let o=n.parentElement?.querySelector(`[name="${n.name}"]:checked`);return o!=null?o.value:null}case"checkbox":return n.checked;case"date":return n.valueAsDate?.toISOString();case"multi-select":return Array.from(n.querySelectorAll("option")).reduce((o,f)=>{return o[f.value]=f.selected,o},{});default:return n.value}},{ResizeObserver:qo}=globalThis,cn=qo!=null?new qo((n)=>{for(let o of n){let f=o.target;no(f,"resize")}}):{observe(){},unobserve(){}},oo=(n,o,f=!0)=>{if(n!=null&&o!=null)if(typeof o==="string")n.textContent=o;else if(Array.isArray(o))o.forEach((i)=>{n.append(i instanceof Node&&f?P(i):i)});else if(o instanceof Node)n.append(f?P(o):o);else throw Error("expect text content or document node")};var Yn=(n,o=250)=>{let f;return(...i)=>{if(f!==void 0)clearTimeout(f);f=setTimeout(()=>{n(...i)},o)}},mn=(n,o=250)=>{let f,i=Date.now()-o,c=!1;return(...m)=>{if(clearTimeout(f),f=setTimeout(()=>{n(...m),i=Date.now()},o),!c&&Date.now()-i>=o){c=!0;try{n(...m),i=Date.now()}finally{c=!1}}}};var En={value:{toDOM:jo,fromDOM(n){return uo(n)}},text:{toDOM(n,o){n.textContent=o}},enabled:{toDOM(n,o){n.disabled=!o}},disabled:{toDOM(n,o){n.disabled=Boolean(o)}},list:{toDOM(n,o,f){rn(n,o,f).update(o)}}};function $(n){return n.replace(/[A-Z]/g,(o)=>{return`-${o.toLocaleLowerCase()}`})}function fo(n){return n.replace(/-([a-z])/g,(o,f)=>{return f.toLocaleUpperCase()})}var df=180/Math.PI,Gf=Math.PI/180;function G(n,o,f){return f<n?NaN:o<n?n:o>f?f:o}function K(n,o,f,i=!0){if(i)f=G(0,f,1);return f*(o-n)+n}var Ko={RADIANS_TO_DEGREES:df,DEGREES_TO_RADIANS:Gf,clamp:G,lerp:K};function $n(n,o=document.body){let f=getComputedStyle(o);if(n.endsWith(")")&&n.startsWith("var("))n=n.slice(4,-1);return f.getPropertyValue(n).trim()}var Qf=(n,o,f)=>{return(0.299*n+0.587*o+0.114*f)/255},_=(n)=>("00"+Math.round(Number(n)).toString(16)).slice(-2);class Ro{h;s;l;constructor(n,o,f){n/=255,o/=255,f/=255;let i=Math.max(n,o,f),c=i-Math.min(n,o,f),m=c!==0?i===n?(o-f)/c:i===o?2+(f-n)/c:4+(n-o)/c:0;this.h=60*m<0?60*m+360:60*m,this.s=c!==0?i<=0.5?c/(2*i-c):c/(2-(2*i-c)):0,this.l=(2*i-c)/2}}var t=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;class x{r;g;b;a;static fromVar(n,o=document.body){return x.fromCss($n(n,o))}static fromCss(n){let o=n;if(t instanceof HTMLSpanElement)t.style.color="black",t.style.color=n,document.body.appendChild(t),o=getComputedStyle(t).color,t.remove();let[f,i,c,m]=o.match(/[\d.]+/g)||["0","0","0","0"],E=o.startsWith("color(srgb")?255:1;return new x(Number(f)*E,Number(i)*E,Number(c)*E,m==null?1:Number(m))}static fromHsl(n,o,f,i=1){let c,m,E;if(o===0)c=m=E=f;else{let w=(D,Y,s)=>{if(s<0)s+=1;if(s>1)s-=1;if(s<0.16666666666666666)return D+(Y-D)*6*s;if(s<0.5)return Y;if(s<0.6666666666666666)return D+(Y-D)*(0.6666666666666666-s)*6;return D},M=f<0.5?f*(1+o):f+o-f*o,y=2*f-M,T=(n%360+360)%360/360;c=w(y,M,T+0.3333333333333333),m=w(y,M,T),E=w(y,M,T-0.3333333333333333)}let r=new x(c*255,m*255,E*255,i);return r.hslCached={h:(n%360+360)%360,s:o,l:f},r}static black=new x(0,0,0);static white=new x(255,255,255);constructor(n,o,f,i=1){this.r=G(0,n,255),this.g=G(0,o,255),this.b=G(0,f,255),this.a=G(0,i,1)}get inverse(){return new x(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:n,s:o,l:f}=this._hsl;return x.fromHsl(n,o,1-f,this.a)}get opaque(){return this.a===1?this:new x(this.r,this.g,this.b,1)}contrasting(n=1){return this.opaque.blend(this.brightness>0.5?x.black:x.white,n)}get rgb(){let{r:n,g:o,b:f}=this;return`rgb(${n.toFixed(0)},${o.toFixed(0)},${f.toFixed(0)})`}get rgba(){let{r:n,g:o,b:f,a:i}=this;return`rgba(${n.toFixed(0)},${o.toFixed(0)},${f.toFixed(0)},${i.toFixed(2)})`}get RGBA(){return[this.r/255,this.g/255,this.b/255,this.a]}get ARGB(){return[this.a,this.r/255,this.g/255,this.b/255]}hslCached;get _hsl(){if(this.hslCached==null)this.hslCached=new Ro(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:n,s:o,l:f}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(o*100).toFixed(0)}% ${(f*100).toFixed(0)}%)`}get hsla(){let{h:n,s:o,l:f}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(o*100).toFixed(0)}% ${(f*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let n=this.brightness*255;return new x(n,n,n)}get brightness(){return Qf(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+_(this.r)+_(this.g)+_(this.b):"#"+_(this.r)+_(this.g)+_(this.b)+_(Math.floor(255*this.a))}brighten(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,i+n*(1-i),1);return x.fromHsl(o,f,c,this.a)}darken(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,i*(1-n),1);return x.fromHsl(o,f,c,this.a)}saturate(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,f+n*(1-f),1);return x.fromHsl(o,c,i,this.a)}desaturate(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,f*(1-n),1);return x.fromHsl(o,c,i,this.a)}rotate(n){let{h:o,s:f,l:i}=this._hsl,c=(o+360+n)%360;return x.fromHsl(c,f,i,this.a)}opacity(n){let{h:o,s:f,l:i}=this._hsl;return x.fromHsl(o,f,i,n)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(n,o){return new x(K(this.r,n.r,o),K(this.g,n.g,o),K(this.b,n.b,o),K(this.a,n.a,o))}static blendHue(n,o,f){let i=(o-n+720)%360;if(i<180)return n+f*i;else return n-(360-i)*f}mix(n,o){let f=this._hsl,i=n._hsl;return x.fromHsl(f.s===0?i.h:i.s===0?f.h:x.blendHue(f.h,i.h,o),K(f.s,i.s,o),K(f.l,i.l,o),K(this.a,n.a,o))}colorMix(n,o){return x.fromCss(`color-mix(in hsl, ${this.html}, ${n.html} ${(o*100).toFixed(0)}%)`)}static computedColorStylesheet=null;static computedColors=new Map;static recomputeQueued=!1;static registerComputedColor(n,o,f,i){if(!x.computedColors.has(n))x.computedColors.set(n,{varName:o,scale:f,method:i}),x.queueRecompute()}static queueRecompute(){if(x.recomputeQueued)return;x.recomputeQueued=!0,queueMicrotask(()=>{x.recomputeQueued=!1,x.recomputeColors()})}static recomputeColors(){if(x.computedColors.size===0)return;let n=[];for(let[f,{varName:i,scale:c,method:m}]of x.computedColors)try{let E=x.fromVar(i),r;switch(m){case"b":r=c>0?E.brighten(c):E.darken(-c);break;case"s":r=c>0?E.saturate(c):E.desaturate(-c);break;case"h":r=E.rotate(c*100);break;case"o":r=E.opacity(c);break;default:continue}n.push(` ${f}: ${r.rgba};`)}catch(E){}if(n.length===0)return;let o=`:root {
|
|
1
|
+
(()=>{var{defineProperty:Kn,getOwnPropertyNames:yf,getOwnPropertyDescriptor:Lf}=Object,xf=Object.prototype.hasOwnProperty;var xo=new WeakMap,Tf=(n)=>{var o=xo.get(n),f;if(o)return o;if(o=Kn({},"__esModule",{value:!0}),n&&typeof n==="object"||typeof n==="function")yf(n).map((i)=>!xf.call(o,i)&&Kn(o,i,{get:()=>n[i],enumerable:!(f=Lf(n,i))||f.enumerable}));return xo.set(n,o),o};var sf=(n,o)=>{for(var f in o)Kn(n,f,{get:o[f],enumerable:!0,configurable:!0,set:(i)=>o[f]=()=>i})};var pf={};sf(pf,{xinValue:()=>Fo,xinProxy:()=>An,xinPath:()=>Xo,xin:()=>X,warnDeprecated:()=>q,version:()=>qn,vars:()=>Zn,varDefault:()=>wn,validateAgainstConstraints:()=>Un,updates:()=>tn,unobserve:()=>u,touchElement:()=>On,touch:()=>B,tosiValue:()=>H,tosiSetValue:()=>Co,tosiPath:()=>F,tosi:()=>Ln,throttle:()=>mn,svgElements:()=>Gn,settings:()=>S,onThemePreferencesChange:()=>Po,onStylesheetChange:()=>Bo,on:()=>p,observe:()=>l,mathML:()=>Qn,makeComponent:()=>Tn,invertLuminance:()=>bo,initVars:()=>eo,hotReload:()=>Ef,getThemePreferences:()=>co,getListItem:()=>zn,getListInstance:()=>Wn,getListBinding:()=>rn,getCssVar:()=>$n,elements:()=>x,deprecated:()=>Cn,deleteListItem:()=>nf,debounce:()=>Yn,css:()=>V,boxedProxy:()=>xn,boxed:()=>g,blueprintLoader:()=>wf,blueprint:()=>rf,bindings:()=>En,bind:()=>Q,StyleSheet:()=>Io,MoreMath:()=>Ko,Component:()=>W,Color:()=>y,BlueprintLoader:()=>jn,Blueprint:()=>sn});function z(n){if(n==null||typeof n!=="object")return n;if(n instanceof Set)return new Set(n);else if(Array.isArray(n))return n.map(z);let o={};for(let f in n){let i=n[f];if(n!=null&&typeof n==="object")o[f]=z(i);else o[f]=i}return o}var Sn="-xin-data",R=`.${Sn}`,Bn="-xin-event",In=`.${Bn}`,J=Symbol.for("xin-path"),U=Symbol.for("xin-value"),Vn="xinObserve",en="xinBind",bn="xinOn",a=Symbol("list-binding"),Hn=Symbol("list-instance"),Rn=new Map;function so(n,o){let f=Rn.get(n);if(f===void 0)f=new Set,Rn.set(n,f);f.add(o)}function Ho(n){return Rn.get(n)}var To=new Set;function q(n,o){if(!To.has(n))console.warn(o),To.add(n)}function Cn(n,o){let f=!1;return(...i)=>{if(!f)console.warn(o),f=!0;return n(...i)}}var F=(n)=>{return n&&n[J]||void 0};function H(n){if(typeof n==="object"&&n!==null){let o=n[U];return o!==void 0?o:n}return n}function Co(n,o){if(F(n)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");n[U]=o}var Xo=Cn(F,"xinPath is deprecated. Use tosiPath instead."),Fo=Cn(H,"xinValue is deprecated. Use tosiValue instead."),P=new WeakMap,O=new WeakMap;var _=(n)=>{let o=n.cloneNode();if(o instanceof Element){let f=O.get(n),i=P.get(n);if(f!=null)O.set(o,z(f));if(i!=null)P.set(o,z(i))}for(let f of Array.from(n instanceof HTMLTemplateElement?n.content.childNodes:n.childNodes))if(f instanceof Element||f instanceof DocumentFragment)o.appendChild(_(f));else o.appendChild(f.cloneNode());return o};var S={debug:!1,perf:!1};var Hf=(n)=>{try{return JSON.stringify(n)}catch(o){return"{has circular references}"}},Pn=(...n)=>Error(n.map(Hf).join(" "));var Cf=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),Xf=0,Ff=()=>(parseInt("10000",36)+ ++Xf).toString(36).slice(-5),Df=()=>Cf()+Ff(),hn=Symbol("delete"),$o=Symbol("new-object"),_n=Symbol("automatic-index");function Jo(n){if(n==="")return[];if(Array.isArray(n))return n;else{let o=[];while(n.length>0){let f=n.search(/\[[^\]]+\]/);if(f===-1){o.push(n.split("."));break}else{let i=n.slice(0,f);if(n=n.slice(f),i!=="")o.push(i.split("."));if(f=n.indexOf("]")+1,o.push(n.slice(1,f-1)),n.slice(f,f+1)===".")f+=1;n=n.slice(f)}}return o}}var A=new WeakMap;function Zo(n,o){if(A.get(n)===void 0)A.set(n,{});if(A.get(n)[o]===void 0)A.get(n)[o]={};let f=A.get(n)[o];if(o==="_auto_")n.forEach((i,c)=>{if(i[_n]===void 0)i[_n]=Df();f[i[_n]+""]=c});else n.forEach((i,c)=>{f[j(i,o)+""]=c});return f}function Yf(n,o){if(A.get(n)===void 0||A.get(n)[o]===void 0)return Zo(n,o);else return A.get(n)[o]}function $f(n,o,f){f=f+"";let i=Yf(n,o)[f];if(i===void 0||j(n[i],o)+""!==f)i=Zo(n,o)[f];return i}function Jf(n,o,f){if(n[o]===void 0&&f!==void 0)n[o]=f;return n[o]}function Go(n,o,f,i){let c=o!==""?$f(n,o,f):f;if(i===hn)return n.splice(c,1),A.delete(n),Symbol("deleted");else if(i===$o){if(o===""&&n[c]===void 0)n[c]={}}else if(i!==void 0)if(c!==void 0)n[c]=i;else if(o!==""&&j(i,o)+""===f+"")n.push(i),c=n.length-1;else throw Error(`byIdPath insert failed at [${o}=${f}]`);return n[c]}function Do(n){if(!Array.isArray(n))throw Pn("setByPath failed: expected array, found",n)}function Yo(n){if(n==null||!(n instanceof Object))throw Pn("setByPath failed: expected Object, found",n)}function j(n,o){let f=Jo(o),i=n,c,m,r,w;for(c=0,m=f.length;i!==void 0&&c<m;c++){let E=f[c];if(Array.isArray(E))for(r=0,w=E.length;i!==void 0&&r<w;r++){let M=E[r];i=i[M]}else if(i.length===0){if(i=i[Number(E.slice(1))],E[0]!=="=")return}else if(E.includes("=")){let[M,...L]=E.split("=");i=Go(i,M,L.join("="))}else r=parseInt(E,10),i=i[r]}return i}function Qo(n,o,f){let i=n;if(o==="")throw Error("setByPath cannot be used to set the root object");let c=Jo(o);while(i!=null&&c.length>0){let m=c.shift();if(typeof m==="string"){let r=m.indexOf("=");if(r>-1){if(r===0)Yo(i);else Do(i);let w=m.slice(0,r),E=m.slice(r+1);if(i=Go(i,w,E,c.length>0?$o:f),c.length===0)return!0}else{Do(i);let w=parseInt(m,10);if(c.length>0)i=i[w];else{if(f!==hn){if(i[w]===f)return!1;i[w]=f}else i.splice(w,1);return!0}}}else if(Array.isArray(m)&&m.length>0){Yo(i);while(m.length>0){let r=m.shift();if(m.length>0||c.length>0)i=Jf(i,r,m.length>0?{}:[]);else{if(f!==hn){if(i[r]===f)return!1;i[r]=f}else{if(!Object.prototype.hasOwnProperty.call(i,r))return!1;delete i[r]}return!0}}}else throw Error(`setByPath failed, bad path ${o}`)}throw Error(`setByPath(${n}, ${o}, ${f}) failed`)}var ko=Symbol("observer should be removed"),Xn=[],Fn=[],pn=!1,Nn,gn;function Wo(n,o,f,i){let c=Ho(n);if(c===void 0)return[];let m=[];for(let r of c){let w=j(f,r);if(w!==void 0)m.push(`${n}[${r}=${w}]${i}`)}return m}class zo{description;test;callback;constructor(n,o){let f=typeof o==="string"?`"${o}"`:`function ${o.name}`,i;if(typeof n==="string")this.test=(c)=>typeof c==="string"&&c!==""&&(n.startsWith(c)||c.startsWith(n)),i=`test = "${n}"`;else if(n instanceof RegExp)this.test=n.test.bind(n),i=`test = "${n.toString()}"`;else if(n instanceof Function)this.test=n,i=`test = function ${n.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${i}, ${f}`,typeof o==="function")this.callback=o;else throw Error("expect callback to be a path or function");Xn.push(this)}}var tn=async()=>{if(Nn===void 0)return;await Nn},Zf=()=>{if(S.perf)console.time("xin async update");let n=Array.from(Fn);Fn.length=0,pn=!1;for(let o of n)Xn.filter((f)=>{let i;try{i=f.test(o)}catch(c){throw Error(`Listener ${f.description} threw "${c}" at "${o}"`)}if(i===ko)return u(f),!1;return i}).forEach((f)=>{let i;try{i=f.callback(o)}catch(c){console.error(`Listener ${f.description} threw "${c}" handling "${o}"`)}if(i===ko)u(f)});if(typeof gn==="function")gn();if(S.perf)console.timeEnd("xin async update")},B=(n)=>{let o=typeof n==="string"?n:F(n);if(o===void 0)throw console.error("touch was called on an invalid target",n),Error("touch was called on an invalid target");if(pn===!1)Nn=new Promise((f)=>{gn=f}),pn=setTimeout(Zf);if(Fn.find((f)=>o.startsWith(f))==null)Fn.push(o)},I=(n,o)=>{return new zo(n,o)},u=(n)=>{let o=Xn.indexOf(n);if(o>-1)Xn.splice(o,1);else throw Error("unobserve failed, listener not found")};var nn={},ln=null,Oo=(n)=>{ln=n},Dn=()=>{if(ln===null)throw Error("xin proxy not initialized");return ln},vn=null,an=null,Uo=(n,o)=>{vn=n,an=o},on=()=>{if(vn===null)throw Error("bind not initialized");return vn},fn=()=>{if(an===null)throw Error("on not initialized");return an};var no=(n,o)=>{let f=new Event(o);n.dispatchEvent(f)},Ao=(n)=>{if(n instanceof HTMLInputElement)return n.type;else if(n instanceof HTMLSelectElement&&n.hasAttribute("multiple"))return"multi-select";else return"other"},jo=(n,o)=>{switch(Ao(n)){case"radio":n.checked=n.value===o;break;case"checkbox":n.checked=!!o;break;case"date":n.valueAsDate=new Date(o);break;case"multi-select":for(let f of Array.from(n.querySelectorAll("option")))f.selected=o[f.value];break;default:n.value=o}},uo=(n)=>{switch(Ao(n)){case"radio":{let o=n.parentElement?.querySelector(`[name="${n.name}"]:checked`);return o!=null?o.value:null}case"checkbox":return n.checked;case"date":return n.valueAsDate?.toISOString();case"multi-select":return Array.from(n.querySelectorAll("option")).reduce((o,f)=>{return o[f.value]=f.selected,o},{});default:return n.value}},{ResizeObserver:qo}=globalThis,cn=qo!=null?new qo((n)=>{for(let o of n){let f=o.target;no(f,"resize")}}):{observe(){},unobserve(){}},oo=(n,o,f=!0)=>{if(n!=null&&o!=null)if(typeof o==="string")n.textContent=o;else if(Array.isArray(o))o.forEach((i)=>{n.append(i instanceof Node&&f?_(i):i)});else if(o instanceof Node)n.append(f?_(o):o);else throw Error("expect text content or document node")};var Yn=(n,o=250)=>{let f;return(...i)=>{if(f!==void 0)clearTimeout(f);f=setTimeout(()=>{n(...i)},o)}},mn=(n,o=250)=>{let f,i=Date.now()-o,c=!1;return(...m)=>{if(clearTimeout(f),f=setTimeout(()=>{n(...m),i=Date.now()},o),!c&&Date.now()-i>=o){c=!0;try{n(...m),i=Date.now()}finally{c=!1}}}};var En={value:{toDOM:jo,fromDOM(n){return uo(n)}},text:{toDOM(n,o){n.textContent=o}},enabled:{toDOM(n,o){n.disabled=!o}},disabled:{toDOM(n,o){n.disabled=Boolean(o)}},list:{toDOM(n,o,f){rn(n,o,f).update(o)}}};function $(n){return n.replace(/[A-Z]/g,(o)=>{return`-${o.toLocaleLowerCase()}`})}function fo(n){return n.replace(/-([a-z])/g,(o,f)=>{return f.toLocaleUpperCase()})}var df=180/Math.PI,Gf=Math.PI/180;function G(n,o,f){return f<n?NaN:o<n?n:o>f?f:o}function K(n,o,f,i=!0){if(i)f=G(0,f,1);return f*(o-n)+n}var Ko={RADIANS_TO_DEGREES:df,DEGREES_TO_RADIANS:Gf,clamp:G,lerp:K};function $n(n,o=document.body){let f=getComputedStyle(o);if(n.endsWith(")")&&n.startsWith("var("))n=n.slice(4,-1);return f.getPropertyValue(n).trim()}var Qf=(n,o,f)=>{return(0.299*n+0.587*o+0.114*f)/255},h=(n)=>("00"+Math.round(Number(n)).toString(16)).slice(-2);class Ro{h;s;l;constructor(n,o,f){n/=255,o/=255,f/=255;let i=Math.max(n,o,f),c=i-Math.min(n,o,f),m=c!==0?i===n?(o-f)/c:i===o?2+(f-n)/c:4+(n-o)/c:0;this.h=60*m<0?60*m+360:60*m,this.s=c!==0?i<=0.5?c/(2*i-c):c/(2-(2*i-c)):0,this.l=(2*i-c)/2}}var t=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;class y{r;g;b;a;static fromVar(n,o=document.body){return y.fromCss($n(n,o))}static fromCss(n){let o=n.match(/^#([0-9a-fA-F]+)$/);if(o){let E=o[1];if(E.length===3)return new y(parseInt(E[0]+E[0],16),parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16));if(E.length===4)return new y(parseInt(E[0]+E[0],16),parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)/255);if(E.length===6)return new y(parseInt(E.slice(0,2),16),parseInt(E.slice(2,4),16),parseInt(E.slice(4,6),16));if(E.length===8)return new y(parseInt(E.slice(0,2),16),parseInt(E.slice(2,4),16),parseInt(E.slice(4,6),16),parseInt(E.slice(6,8),16)/255)}let f=n;if(t instanceof HTMLSpanElement)t.style.color="black",t.style.color=n,document.body.appendChild(t),f=getComputedStyle(t).color,t.remove();let[i,c,m,r]=f.match(/[\d.]+/g)||["0","0","0","0"],w=f.startsWith("color(srgb")?255:1;return new y(Number(i)*w,Number(c)*w,Number(m)*w,r==null?1:Number(r))}static fromHsl(n,o,f,i=1){let c,m,r;if(o===0)c=m=r=f;else{let E=(D,Y,s)=>{if(s<0)s+=1;if(s>1)s-=1;if(s<0.16666666666666666)return D+(Y-D)*6*s;if(s<0.5)return Y;if(s<0.6666666666666666)return D+(Y-D)*(0.6666666666666666-s)*6;return D},M=f<0.5?f*(1+o):f+o-f*o,L=2*f-M,T=(n%360+360)%360/360;c=E(L,M,T+0.3333333333333333),m=E(L,M,T),r=E(L,M,T-0.3333333333333333)}let w=new y(c*255,m*255,r*255,i);return w.hslCached={h:(n%360+360)%360,s:o,l:f},w}static black=new y(0,0,0);static white=new y(255,255,255);constructor(n,o,f,i=1){this.r=G(0,n,255),this.g=G(0,o,255),this.b=G(0,f,255),this.a=G(0,i,1)}get inverse(){return new y(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:n,s:o,l:f}=this._hsl;return y.fromHsl(n,o,1-f,this.a)}get opaque(){return this.a===1?this:new y(this.r,this.g,this.b,1)}contrasting(n=1){return this.opaque.blend(this.brightness>0.5?y.black:y.white,n)}get rgb(){let{r:n,g:o,b:f}=this;return`rgb(${n.toFixed(0)},${o.toFixed(0)},${f.toFixed(0)})`}get rgba(){let{r:n,g:o,b:f,a:i}=this;return`rgba(${n.toFixed(0)},${o.toFixed(0)},${f.toFixed(0)},${i.toFixed(2)})`}get RGBA(){return[this.r/255,this.g/255,this.b/255,this.a]}get ARGB(){return[this.a,this.r/255,this.g/255,this.b/255]}hslCached;get _hsl(){if(this.hslCached==null)this.hslCached=new Ro(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:n,s:o,l:f}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(o*100).toFixed(0)}% ${(f*100).toFixed(0)}%)`}get hsla(){let{h:n,s:o,l:f}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(o*100).toFixed(0)}% ${(f*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let n=this.brightness*255;return new y(n,n,n)}get brightness(){return Qf(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+h(this.r)+h(this.g)+h(this.b):"#"+h(this.r)+h(this.g)+h(this.b)+h(Math.floor(255*this.a))}brighten(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,i+n*(1-i),1);return y.fromHsl(o,f,c,this.a)}darken(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,i*(1-n),1);return y.fromHsl(o,f,c,this.a)}saturate(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,f+n*(1-f),1);return y.fromHsl(o,c,i,this.a)}desaturate(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,f*(1-n),1);return y.fromHsl(o,c,i,this.a)}rotate(n){let{h:o,s:f,l:i}=this._hsl,c=(o+360+n)%360;return y.fromHsl(c,f,i,this.a)}opacity(n){let{h:o,s:f,l:i}=this._hsl;return y.fromHsl(o,f,i,n)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(n,o){return new y(K(this.r,n.r,o),K(this.g,n.g,o),K(this.b,n.b,o),K(this.a,n.a,o))}static blendHue(n,o,f){let i=(o-n+720)%360;if(i<180)return n+f*i;else return n-(360-i)*f}mix(n,o){let f=this._hsl,i=n._hsl;return y.fromHsl(f.s===0?i.h:i.s===0?f.h:y.blendHue(f.h,i.h,o),K(f.s,i.s,o),K(f.l,i.l,o),K(this.a,n.a,o))}colorMix(n,o){return y.fromCss(`color-mix(in hsl, ${this.html}, ${n.html} ${(o*100).toFixed(0)}%)`)}static computedColorStylesheet=null;static computedColors=new Map;static recomputeQueued=!1;static registerComputedColor(n,o,f,i){if(!y.computedColors.has(n))y.computedColors.set(n,{varName:o,scale:f,method:i}),y.queueRecompute()}static queueRecompute(){if(y.recomputeQueued)return;y.recomputeQueued=!0,queueMicrotask(()=>{y.recomputeQueued=!1,y.recomputeColors()})}static recomputeColors(){if(y.computedColors.size===0)return;let n=[];for(let[f,{varName:i,scale:c,method:m}]of y.computedColors)try{let r=y.fromVar(i),w;switch(m){case"b":w=c>0?r.brighten(c):r.darken(-c);break;case"s":w=c>0?r.saturate(c):r.desaturate(-c);break;case"h":w=r.rotate(c*100);break;case"o":w=r.opacity(c);break;default:continue}n.push(` ${f}: ${w.rgba};`)}catch(r){}if(n.length===0)return;let o=`:root {
|
|
2
2
|
${n.join(`
|
|
3
3
|
`)}
|
|
4
|
-
}`;if(
|
|
4
|
+
}`;if(y.computedColorStylesheet===null)y.computedColorStylesheet=document.createElement("style"),y.computedColorStylesheet.id="tosijs-computed-colors",document.head.append(y.computedColorStylesheet);y.computedColorStylesheet.textContent=o}}var Jn=new Set,So=!1;function kf(){if(!So)So=!0,Jn.add(()=>y.queueRecompute())}function Bo(n){return Jn.add(n),()=>Jn.delete(n)}function Wf(){kf();for(let n of Jn)n()}function Io(n,o){let f=H(o),i=x.style(V(f));i.id=n,document.head.append(i);let c=F(o);if(c!==void 0)l(c,()=>{i.textContent=V(H(o)),Wf()})}var zf=/^(animation-iteration-count|column-count|flex(-grow|-shrink)?|font-weight|line-height|opacity|order|orphans|scale|tab-size|widows|z-index|zoom)$/,io=(n,o)=>{if(typeof o==="number"&&!zf.test(n))o=`${o}px`;if(n.startsWith("_"))if(n.startsWith("__"))n="--"+n.substring(2),o=`var(${n}-default, ${o})`;else n="--"+n.substring(1);return{prop:n,value:String(o)}},Of=(n,o,f)=>{if(f===void 0)return"";if(f instanceof y)f=f.html;let i=io(o,f);return`${n} ${i.prop}: ${i.value};`},Vo=(n,o,f="")=>{let i=$(n);if(typeof o==="object"&&!(o instanceof y)){let c=Object.keys(o).map((m)=>Vo(m,o[m],`${f} `)).join(`
|
|
5
5
|
`);return`${f} ${n} {
|
|
6
6
|
${c}
|
|
7
|
-
${f} }`}else return Of(f,i,o)},V=(n,o="")=>{return Object.keys(n).map((i)=>{let c=n[i];if(typeof c==="string"){if(i==="@import")return`@import url('${c}');`;throw Error("top-level string value only allowed for `@import`")}let m=Object.keys(c).map((
|
|
7
|
+
${f} }`}else return Of(f,i,o)},V=(n,o="")=>{return Object.keys(n).map((i)=>{let c=n[i];if(typeof c==="string"){if(i==="@import")return`@import url('${c}');`;throw Error("top-level string value only allowed for `@import`")}let m=Object.keys(c).map((r)=>Vo(r,c[r])).join(`
|
|
8
8
|
`);return`${o}${i} {
|
|
9
9
|
${m}
|
|
10
10
|
}`}).join(`
|
|
11
11
|
|
|
12
|
-
`)},ho=(n)=>{q("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let o={};for(let f of Object.keys(n)){let i=n[f],c=$(f);o[`--${c}`]=typeof i==="number"&&i!==0?String(i)+"px":i}return o},eo=(n)=>{let o={};for(let f of Object.keys(n)){let i=n[f];if(i instanceof x)o[f]=i.inverseLuminance;else if(typeof i==="string"&&i.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))o[f]=x.fromCss(i).inverseLuminance}return o},wn=new Proxy({},{get(n,o){if(n[o]===void 0){let f="--"+$(o);n[o]=(i)=>`var(${f}, ${i})`}return n[o]}}),Zn=new Proxy({},{get(n,o){if(o==="default")return wn;if(n[o]==null){o=$(o);let[,f,,i,c,m]=o.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",o],E=`--${f}`;if(c!=null){let r=i==null?Number(c)/100:-Number(c)/100;switch(m){case"b":case"s":case"h":case"o":{let w=`--${o}`;x.registerComputedColor(w,E,r,m),n[o]=`var(${w})`}break;case"":n[o]=`calc(var(${E}) * ${r})`;break;default:throw console.error(m),Error(`Unrecognized method ${m} for css variable ${E}`)}}else n[o]=`var(${E})`}return n[o]}});function co(){let n=(o)=>typeof matchMedia<"u"&&matchMedia(o).matches;return{colorScheme:n("(prefers-color-scheme: dark)")?"dark":"light",contrast:n("(prefers-contrast: more)")?"more":n("(prefers-contrast: less)")?"less":n("(prefers-contrast: custom)")?"custom":"no-preference",reducedMotion:n("(prefers-reduced-motion: reduce)"),reducedTransparency:n("(prefers-reduced-transparency: reduce)"),forcedColors:n("(forced-colors: active)")}}function bo(n){if(typeof matchMedia>"u")return()=>{};let o=["(prefers-color-scheme: dark)","(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-reduced-motion: reduce)","(prefers-reduced-transparency: reduce)","(forced-colors: active)"],f=()=>n(co()),i=o.map((c)=>matchMedia(c));for(let c of i)c.addEventListener("change",f);return()=>{for(let c of i)c.removeEventListener("change",f)}}var Po="http://www.w3.org/1998/Math/MathML",_o="http://www.w3.org/2000/svg";var dn={},po=(n,o,f)=>{let i=io($(o),f);if(i.prop.startsWith("--"))n.style.setProperty(i.prop,i.value);else n.style[o]=i.value},Uf=(n)=>{return{toDOM(o,f){po(o,n,f)}}},No=(n,o,f)=>{if(o==="style")if(typeof f==="object")for(let i of Object.keys(f))if(F(f[i]))Q(n,f[i],Uf(i));else po(n,i,f[i]);else n.setAttribute("style",f);else{let i=$(o),c=n.constructor.observedAttributes;if(c?.includes(o)||c?.includes(i))if(typeof f==="boolean")f?n.setAttribute(i,""):n.removeAttribute(i);else n.setAttribute(i,f);else if(n[o]!==void 0){let{MathMLElement:E}=globalThis;if(n instanceof SVGElement||E!==void 0&&n instanceof E)n.setAttribute(o,f);else n[o]=f}else if(i==="class")f.split(" ").forEach((E)=>{n.classList.add(E)});else if(n[i]!==void 0)n[i]=f;else if(typeof f==="boolean")f?n.setAttribute(i,""):n.removeAttribute(i);else n.setAttribute(i,f)}},qf=(n)=>{return{toDOM(o,f){No(o,n,f)}}},Af=(n,o,f)=>{if(o==="apply")f(n);else if(o.match(/^on[A-Z]/)!=null){let i=o.substring(2).toLowerCase();p(n,i,f)}else if(o==="bind")if((typeof f.binding==="string"?En[f.binding]:f.binding)!==void 0&&f.value!==void 0)Q(n,f.value,f.binding instanceof Function?{toDOM:f.binding}:f.binding);else throw Error("bad binding");else if(o.match(/^bind[A-Z]/)!=null){let i=o.substring(4,5).toLowerCase()+o.substring(5),c=En[i];if(c!==void 0)Q(n,f,c);else throw Error(`${o} is not allowed, bindings.${i} is not defined`)}else if(F(f))Q(n,f,qf(o));else No(n,o,f)},mo=(n,...o)=>{if(dn[n]===void 0){let[c,m]=n.split("|");if(m===void 0)dn[n]=globalThis.document.createElement(c);else dn[n]=globalThis.document.createElementNS(m,c)}let f=dn[n].cloneNode(),i={};for(let c of o)if(c instanceof Element||c instanceof DocumentFragment||typeof c==="string"||typeof c==="number")if(f instanceof HTMLTemplateElement)f.content.append(c);else f.append(c);else if(F(c))f.append(L.span({bindText:c}));else Object.assign(i,c);for(let c of Object.keys(i)){let m=i[c];Af(f,c,m)}return f},Eo=(...n)=>{let o=globalThis.document.createDocumentFragment();for(let f of n)o.append(f);return o},L=new Proxy({fragment:Eo},{get(n,o){if(o=o.replace(/[A-Z]/g,(f)=>`-${f.toLocaleLowerCase()}`),n[o]===void 0)n[o]=(...f)=>mo(o,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}}),Gn=new Proxy({fragment:Eo},{get(n,o){if(n[o]===void 0)n[o]=(...f)=>mo(`${o}|${_o}`,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}}),Qn=new Proxy({fragment:Eo},{get(n,o){if(n[o]===void 0)n[o]=(...f)=>mo(`${o}|${Po}`,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}});var jf=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],uf=!0,Kf=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,Rf=(n)=>Kf.test(n),h=(n="",o="")=>{if(n==="")return o;else if(o.match(/^\d+$/)!==null||o.includes("="))return`${n}[${o}]`;else return`${n}.${o}`},lo={};function ro(n,o){if(n!==null&&(typeof n==="object"||typeof n==="function"))return n;return new Proxy(lo,e(o,!0))}var kn=()=>new Proxy({},e("^",!0)),go=!1;function N(){if(!go)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use value, path, observe, bind, on, binding, listBinding instead."),go=!0}var to=(n)=>{return n===lo},e=(n,o)=>({get(f,i){if(to(f)){let r=()=>j(nn,n);switch(i){case"path":return n;case"value":return r();case"valueOf":case"toJSON":return()=>r();case Symbol.toPrimitive:return(w)=>{let M=r();if(w==="number")return Number(M);if(w==="string")return String(M);return M};case"toString":return()=>String(r());case"observe":return(w)=>{let M=I(n,w);return()=>u(M)};case"on":return(w,M)=>fn()(w,M,r());case"bind":return(w,M,y)=>{on()(w,n,M,y)};case"binding":return(w)=>({bind:{value:n,binding:w}});case"listBinding":return(w=({span:y})=>y({bindText:"^"}),M={})=>[{bindList:{value:n,...M}},L.template(w(L,kn()))];case U:case"xinValue":case"tosiValue":return N(),r();case J:case"xinPath":case"tosiPath":return N(),n;case Vn:case"tosiObserve":return N(),(w)=>{let M=I(n,w);return()=>u(M)};case en:case"tosiOn":return N(),(w,M)=>fn()(w,M,r());case hn:case"tosiBind":return N(),(w,M,y)=>{on()(w,n,M,y)};case"tosiBinding":return N(),(w)=>({bind:{value:n,binding:w}});case"tosiListBinding":return N(),(w=({span:y})=>y({bindText:"^"}),M={})=>[{bindList:{value:n,...M}},L.template(w(L,kn()))]}if(typeof i==="string"&&/^\d+$/.test(i)){let w=r();if(typeof w==="string")return w[parseInt(i,10)]}if(i==="length"){let w=r();if(typeof w==="string")return w.length}return}if(o&&!(i in f))switch(i){case"path":return n;case"value":return f.valueOf?f.valueOf():f;case"valueOf":case"toJSON":return()=>f.valueOf?f.valueOf():f;case"observe":return(r)=>{let w=I(n,r);return()=>u(w)};case"on":return(r,w)=>fn()(r,w,H(f));case"bind":return(r,w,M)=>{on()(r,n,w,M)};case"binding":return(r)=>({bind:{value:n,binding:r}});case"listBinding":return(r=({span:M})=>M({bindText:"^"}),w={})=>[{bindList:{value:n,...w}},L.template(r(L,kn()))]}switch(i){case J:case"xinPath":case"tosiPath":return n;case U:case"xinValue":case"tosiValue":return f.valueOf?f.valueOf():f;case Vn:case"xinObserve":case"tosiObserve":return(r)=>{let w=I(n,r);return()=>u(w)};case en:case"xinOn":case"tosiOn":return(r,w)=>fn()(r,w,H(f));case hn:case"xinBind":case"tosiBind":return(r,w,M)=>{on()(r,n,w,M)};case"tosiBinding":return(r)=>({bind:{value:n,binding:r}});case"tosiListBinding":return(r=({span:M})=>M({bindText:"^"}),w={})=>[{bindList:{value:n,...w}},L.template(r(L,kn()))]}if(typeof i==="symbol")return f[i];let c=Object.getOwnPropertyDescriptor(f,i);if(c&&!c.configurable&&!c.writable&&"value"in c)return c.value;let m=i,E=m.match(/^([^.[]+)\.(.+)$/)??m.match(/^([^\]]+)(\[.+)/)??m.match(/^(\[[^\]]+\])\.(.+)$/)??m.match(/^(\[[^\]]+\])\[(.+)$/);if(E!==null){let[,r,w]=E,M=h(n,r),y=j(f,r);return y!==null&&typeof y==="object"?new Proxy(y,e(M,o))[w]:y}if(m.startsWith("[")&&m.endsWith("]"))m=m.substring(1,m.length-1);if(!Array.isArray(f)&&f[m]!==void 0||Array.isArray(f)&&m.includes("=")){let r;if(m.includes("=")){let[w,M]=m.split("=");r=f.find((y)=>`${j(y,w)}`===M)}else r=f[m];if(r instanceof Object){let w=h(n,m);return new Proxy(r instanceof Function?r.bind(f):r,e(w,o))}else return o?ro(r,h(n,m)):r}else if(Array.isArray(f)){let r=f[m];return typeof r==="function"?(...w)=>{let M=w.map((T)=>H(T)),y=r.apply(f,M);if(jf.includes(m))B(n);if(y!=null&&typeof y==="object"){if(m==="find"||m==="findLast"||m==="at"){let T=f.indexOf(y);if(T!==-1)return new Proxy(y,e(h(n,String(T)),o))}}return y}:typeof r==="object"?new Proxy(r,e(h(n,m),o)):o?ro(r,h(n,m)):r}else return o?ro(f[m],h(n,m)):f[m]},set(f,i,c){c=H(c);let m=i===U||i==="xinValue"||i==="tosiValue"||i==="value"&&(to(f)||o),E=m?n:h(n,i);if(uf&&!Rf(E))throw Error(`setting invalid path ${E}`);if(H(X[E])!==c&&Qo(nn,E,c)){B(E);let w=n.match(/^(.+)\[(\d+)\]$/);if(w!==null){let[,M,y]=w,T=parseInt(y,10),D=m?"":`.${i}`,Y=Wo(M,T,f,D);for(let s of Y)B(s)}}return!0}}),l=(n,o)=>{let f=typeof o==="function"?o:X[o];if(typeof f!=="function")throw Error(`observe expects a function or path to a function, ${o} is neither`);return I(n,f)},X=new Proxy(nn,e("",!1));Oo(X);var g=new Proxy(nn,e("",!0));var Sf=16,Bf=100;function vo(n,o){let f=Array.from(n.querySelectorAll(R));if(n.matches(R))f.unshift(n);for(let i of f){let c=O.get(i);for(let m of c){if(m.path.startsWith("^"))m.path=`${o}${m.path.substring(1)}`;if(m.binding.toDOM!=null)m.binding.toDOM(i,X[m.path])}}}class ao{boundElement;listTop;listBottom;template;options;itemToElement;array=[];_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(n,o,f={}){if(this.boundElement=n,this.itemToElement=new WeakMap,f.idPath!=null){let i=F(o);if(i!=null)so(i,f.idPath)}if(n.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(n.children[0]instanceof HTMLTemplateElement){let i=n.children[0];if(i.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=P(i.content.children[0])}else this.template=n.children[0],this.template.remove();if(this.options=f,this.listTop=document.createElement("div"),this.listBottom=document.createElement("div"),this.listTop.classList.add("virtual-list-padding"),this.listBottom.classList.add("virtual-list-padding"),this.boundElement.append(this.listTop),this.boundElement.append(this.listBottom),f.virtual!=null)if(cn.observe(this.boundElement),this._update=mn(()=>{this.update(this.array,!0)},Sf),this.boundElement.addEventListener("resize",this._update),f.virtual.scrollContainer==="window")window.addEventListener("scroll",this._update),window.addEventListener("resize",this._update);else this.boundElement.addEventListener("scroll",this._update)}visibleSlice(){let{virtual:n,hiddenProp:o,visibleProp:f}=this.options,i=this.array;if(o!==void 0)i=i.filter((w)=>w[o]!==!0);if(f!==void 0)i=i.filter((w)=>w[f]===!0);if(this.options.filter&&this.needle!==void 0)i=this.options.filter(i,this.needle);let c=0,m=i.length-1,E=0,r=0;if(n!=null&&this.boundElement instanceof HTMLElement){let w=this.boundElement.offsetWidth,M=n.scrollContainer==="window",y,T;if(M){y=window.innerHeight;let C=this.boundElement.getBoundingClientRect();T=Math.max(0,-C.top)}else y=this.boundElement.offsetHeight,T=this.boundElement.scrollTop;let D=n.width!=null?Math.max(1,Math.floor(w/n.width)):n.visibleColumns??1,Y=Math.ceil(y/n.height)+(n.rowChunkSize||1),s=Math.ceil(i.length/D),v=D*Y,Z=Math.floor(T/n.height);if(Z>s-Y+1)Z=Math.max(0,s-Y+1);if(n.rowChunkSize)Z-=Z%n.rowChunkSize;c=Z*D,m=c+v-1,E=Z*n.height,r=Math.max((s-Y)*n.height-E,0)}return{items:i,firstItem:c,lastItem:m,topBuffer:E,bottomBuffer:r}}needle;filter=mn((n)=>{if(this.needle!==n)this.needle=n,this.update(this.array)},Bf);update(n,o){if(n==null)n=[];this.array=n;let{hiddenProp:f,visibleProp:i}=this.options,c=F(n),m=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",m.items.length===0);let E=this._previousSlice,{firstItem:r,lastItem:w,topBuffer:M,bottomBuffer:y}=m;if(f===void 0&&i===void 0&&o===!0&&E!=null&&r===E.firstItem&&w===E.lastItem&&M===E.topBuffer&&y===E.bottomBuffer)return;this._previousSlice=m;let T=0,D=0,Y=0;for(let C of Array.from(this.boundElement.children)){if(C===this.listTop||C===this.listBottom)continue;let k=C[Hn];if(k==null)C.remove();else{let d=m.items.indexOf(k);if(d<r||d>w)C.remove(),this.itemToElement.delete(k),T++}}this.listTop.style.height=String(M)+"px",this.listBottom.style.height=String(y)+"px";let s=[],{idPath:v}=this.options;for(let C=r;C<=w;C++){let k=m.items[C];if(k===void 0)continue;let d=this.itemToElement.get(H(k));if(d==null){if(Y++,d=P(this.template),typeof k==="object")this.itemToElement.set(H(k),d),d[Hn]=H(k);if(this.boundElement.insertBefore(d,this.listBottom),v!=null){let un=k[v],Mf=`${c}[${v}=${un}]`;vo(d,Mf)}else{let un=`${c}[${C}]`;vo(d,un)}}s.push(d)}let Z=null;for(let C of s){if(C.previousElementSibling!==Z)if(D++,Z?.nextElementSibling!=null)this.boundElement.insertBefore(C,Z.nextElementSibling);else this.boundElement.insertBefore(C,this.listBottom);Z=C}if(S.perf)console.log(c,"updated",{removed:T,created:Y,moved:D})}}var rn=(n,o,f)=>{let i=n[a];if(o&&i===void 0)i=new ao(n,o,f),n[a]=i;return i},Wn=(n)=>{let o;while(!(o=n[Hn])&&n&&n.parentElement)n=n.parentElement;return o?{element:n,item:o}:void 0},zn=(n)=>{let o=Wn(n);return o?o.item:void 0},nf=(n)=>{let o=Wn(n);if(!o)return console.error("deleteListItem failed, element is not part of a list instance",n),!1;let f=rn(o.element.parentElement);if(!f.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",n.parentElement,f),!1;let i=f.array.indexOf(o.item);if(i>-1)return f.array.splice(i,1),!0;return!1};var{document:Mn,MutationObserver:of}=globalThis,On=(n,o)=>{let f=O.get(n);if(f==null)return;for(let i of f){let{binding:c,options:m}=i,{path:E}=i,{toDOM:r}=c;if(r!=null){if(E.startsWith("^")){let w=zn(n);if(w!=null&&w[J]!=null)E=i.path=`${w[J]}${E.substring(1)}`;else throw console.error(`Cannot resolve relative binding ${E}`,n,"is not part of a list"),Error(`Cannot resolve relative binding ${E}`)}if(o==null||E.startsWith(o))r(n,Dn()[E],m)}}};if(of!=null)new of((o)=>{o.forEach((f)=>{Array.from(f.addedNodes).forEach((i)=>{if(i instanceof Element)Array.from(i.querySelectorAll(R)).forEach((c)=>On(c))})})}).observe(Mn.body,{subtree:!0,childList:!0});I(()=>!0,(n)=>{let o=Array.from(Mn.querySelectorAll(R));for(let f of o)On(f,n)});var ff=(n)=>{let o=n.target?.closest(R);while(o!=null){let f=O.get(o);for(let i of f){let{binding:c,path:m}=i,{fromDOM:E}=c;if(E!=null){let r;try{r=E(o,i.options)}catch(w){throw console.error("Cannot get value from",o,"via",i),Error("Cannot obtain value fromDOM")}if(r!=null){let w=Dn(),M=w[m];if(M==null)w[m]=r;else{let y=M[J]!=null?M[U]:M,T=r[J]!=null?r[U]:r;if(y!==T)w[m]=T}}}}o=o.parentElement.closest(R)}};if(globalThis.document!=null)Mn.body.addEventListener("change",ff,!0),Mn.body.addEventListener("input",ff,!0);function Q(n,o,f,i){if(n instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");let c;if(typeof o==="object"&&o[J]===void 0&&i===void 0){let{value:r}=o;c=typeof r==="string"?r:r[J],i=o,delete i.value}else c=typeof o==="string"?o:o[J];if(c==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:m}=f;n.classList?.add(Sn);let E=O.get(n);if(E==null)E=[],O.set(n,E);if(E.push({path:c,binding:f,options:i}),m!=null&&!c.startsWith("^"))B(c);if(i?.filter&&i?.needle)Q(n,i.needle,{toDOM(r,w){console.log({needle:w}),r[a]?.filter(w)}});return n}var cf=new Set,If=(n)=>{let o=n?.target?.closest(In),f=!1,i=new Proxy(n,{get(m,E){if(E==="stopPropagation")return()=>{n.stopPropagation(),f=!0};else{let r=m[E];return typeof r==="function"?r.bind(m):r}}}),c=new Set;while(!f&&o!=null){let E=b.get(o)[n.type]||c;for(let r of E){if(typeof r==="function")r(i);else{let w=Dn()[r];if(typeof w==="function")w(i);else throw Error(`no event handler found at path ${r}`)}if(f)continue}o=o.parentElement!=null?o.parentElement.closest(In):null}};function p(n,o,f){let i=b.get(n);if(n.classList.add(Bn),i==null)i={},b.set(n,i);if(!i[o])i[o]=new Set;if(i[o].add(f),!cf.has(o))cf.add(o),Mn.body.addEventListener(o,If,!0);return()=>{i[o].delete(f)}}Uo(Q,p);function Un(n,o){if(!n.internals)return;let f={},i="";if(n.hasAttribute("required")&&o==="")f.valueMissing=!0,i="Please fill out this field.";let c=n.getAttribute("minlength");if(c&&o.length<parseInt(c,10))f.tooShort=!0,i=`Please use at least ${c} characters.`;let m=n.getAttribute("maxlength");if(m&&o.length>parseInt(m,10))f.tooLong=!0,i=`Please use no more than ${m} characters.`;let E=n.getAttribute("pattern");if(E&&o!=="")try{if(!new RegExp(`^(?:${E})$`).test(o))f.patternMismatch=!0,i="Please match the requested format."}catch{}if(Object.keys(f).length>0)n.internals.setValidity(f,i,n);else n.internals.setValidity({})}var Vf=0;function wo(){return`custom-elt${(Vf++).toString(36)}`}var mf=0,Mo=null;function hf(){if(Mo===null)Mo=new MutationObserver((n)=>{let o=new Set;for(let f of n)if(f.type==="attributes"&&f.target instanceof W){let i=f.target,c=fo(f.attributeName);if(i._legacyTrackedAttrs?.has(c))o.add(i)}for(let f of o)f.queueRender(!1)});return Mo}var xn={};function ef(n,o){let f=xn[n],i=V(o).replace(/:host\b/g,n);xn[n]=f?f+`
|
|
13
|
-
`+i:i}function
|
|
12
|
+
`)},eo=(n)=>{q("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let o={};for(let f of Object.keys(n)){let i=n[f],c=$(f);o[`--${c}`]=typeof i==="number"&&i!==0?String(i)+"px":i}return o},bo=(n)=>{let o={};for(let f of Object.keys(n)){let i=n[f];if(i instanceof y)o[f]=i.inverseLuminance;else if(typeof i==="string"&&i.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))o[f]=y.fromCss(i).inverseLuminance}return o},wn=new Proxy({},{get(n,o){if(n[o]===void 0){let f="--"+$(o);n[o]=(i)=>`var(${f}, ${i})`}return n[o]}}),Zn=new Proxy({},{get(n,o){if(o==="default")return wn;if(n[o]==null){o=$(o);let[,f,,i,c,m]=o.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",o],r=`--${f}`;if(c!=null){let w=i==null?Number(c)/100:-Number(c)/100;switch(m){case"b":case"s":case"h":case"o":{let E=`--${o}`;y.registerComputedColor(E,r,w,m),n[o]=`var(${E})`}break;case"":n[o]=`calc(var(${r}) * ${w})`;break;default:throw console.error(m),Error(`Unrecognized method ${m} for css variable ${r}`)}}else n[o]=`var(${r})`}return n[o]}});function co(){let n=(o)=>typeof matchMedia<"u"&&matchMedia(o).matches;return{colorScheme:n("(prefers-color-scheme: dark)")?"dark":"light",contrast:n("(prefers-contrast: more)")?"more":n("(prefers-contrast: less)")?"less":n("(prefers-contrast: custom)")?"custom":"no-preference",reducedMotion:n("(prefers-reduced-motion: reduce)"),reducedTransparency:n("(prefers-reduced-transparency: reduce)"),forcedColors:n("(forced-colors: active)")}}function Po(n){if(typeof matchMedia>"u")return()=>{};let o=["(prefers-color-scheme: dark)","(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-reduced-motion: reduce)","(prefers-reduced-transparency: reduce)","(forced-colors: active)"],f=()=>n(co()),i=o.map((c)=>matchMedia(c));for(let c of i)c.addEventListener("change",f);return()=>{for(let c of i)c.removeEventListener("change",f)}}var _o="http://www.w3.org/1998/Math/MathML",ho="http://www.w3.org/2000/svg";var dn={},po=(n,o,f)=>{let i=io($(o),f);if(i.prop.startsWith("--"))n.style.setProperty(i.prop,i.value);else n.style[o]=i.value},Uf=(n)=>{return{toDOM(o,f){po(o,n,f)}}},No=(n,o,f)=>{if(o==="style")if(typeof f==="object")for(let i of Object.keys(f))if(F(f[i]))Q(n,f[i],Uf(i));else po(n,i,f[i]);else n.setAttribute("style",f);else{let i=$(o),c=n.constructor.observedAttributes;if(c?.includes(o)||c?.includes(i))if(typeof f==="boolean")f?n.setAttribute(i,""):n.removeAttribute(i);else n.setAttribute(i,f);else if(n[o]!==void 0){let{MathMLElement:r}=globalThis;if(n instanceof SVGElement||r!==void 0&&n instanceof r)n.setAttribute(o,f);else n[o]=f}else if(i==="class")f.split(" ").forEach((r)=>{n.classList.add(r)});else if(n[i]!==void 0)n[i]=f;else if(typeof f==="boolean")f?n.setAttribute(i,""):n.removeAttribute(i);else n.setAttribute(i,f)}},qf=(n)=>{return{toDOM(o,f){No(o,n,f)}}},Af=(n,o,f)=>{if(o==="apply")f(n);else if(o.match(/^on[A-Z]/)!=null){let i=o.substring(2).toLowerCase();p(n,i,f)}else if(o==="bind")if((typeof f.binding==="string"?En[f.binding]:f.binding)!==void 0&&f.value!==void 0)Q(n,f.value,f.binding instanceof Function?{toDOM:f.binding}:f.binding);else throw Error("bad binding");else if(o.match(/^bind[A-Z]/)!=null){let i=o.substring(4,5).toLowerCase()+o.substring(5),c=En[i];if(c!==void 0)Q(n,f,c);else throw Error(`${o} is not allowed, bindings.${i} is not defined`)}else if(F(f))Q(n,f,qf(o));else No(n,o,f)},mo=(n,...o)=>{if(dn[n]===void 0){let[c,m]=n.split("|");if(m===void 0)dn[n]=globalThis.document.createElement(c);else dn[n]=globalThis.document.createElementNS(m,c)}let f=dn[n].cloneNode(),i={};for(let c of o)if(c instanceof Element||c instanceof DocumentFragment||typeof c==="string"||typeof c==="number")if(f instanceof HTMLTemplateElement)f.content.append(c);else f.append(c);else if(F(c))f.append(x.span({bindText:c}));else Object.assign(i,c);for(let c of Object.keys(i)){let m=i[c];Af(f,c,m)}return f},Eo=(...n)=>{let o=globalThis.document.createDocumentFragment();for(let f of n)o.append(f);return o},x=new Proxy({fragment:Eo},{get(n,o){if(o=o.replace(/[A-Z]/g,(f)=>`-${f.toLocaleLowerCase()}`),n[o]===void 0)n[o]=(...f)=>mo(o,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}}),Gn=new Proxy({fragment:Eo},{get(n,o){if(n[o]===void 0)n[o]=(...f)=>mo(`${o}|${ho}`,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}}),Qn=new Proxy({fragment:Eo},{get(n,o){if(n[o]===void 0)n[o]=(...f)=>mo(`${o}|${_o}`,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}});var jf=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],uf=!0,Kf=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,Rf=(n)=>Kf.test(n),e=(n="",o="")=>{if(n==="")return o;else if(o.match(/^\d+$/)!==null||o.includes("="))return`${n}[${o}]`;else return`${n}.${o}`},lo={};function ro(n,o){if(n!==null&&(typeof n==="object"||typeof n==="function"))return n;return new Proxy(lo,b(o,!0))}var kn=()=>new Proxy({},b("^",!0)),go=!1;function N(){if(!go)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use value, path, observe, bind, on, binding, listBinding instead."),go=!0}var to=(n)=>{return n===lo},b=(n,o)=>({get(f,i){if(to(f)){let w=()=>j(nn,n);switch(i){case"path":return n;case"value":return w();case"valueOf":case"toJSON":return()=>w();case Symbol.toPrimitive:return(E)=>{let M=w();if(E==="number")return Number(M);if(E==="string")return String(M);return M};case"toString":return()=>String(w());case"observe":return(E)=>{let M=I(n,E);return()=>u(M)};case"on":return(E,M)=>fn()(E,M,w());case"bind":return(E,M,L)=>{on()(E,n,M,L)};case"binding":return(E)=>({bind:{value:n,binding:E}});case"listBinding":return(E=({span:L})=>L({bindText:"^"}),M={})=>[{bindList:{value:n,...M}},x.template(E(x,kn()))];case U:case"xinValue":case"tosiValue":return N(),w();case J:case"xinPath":case"tosiPath":return N(),n;case Vn:case"tosiObserve":return N(),(E)=>{let M=I(n,E);return()=>u(M)};case bn:case"tosiOn":return N(),(E,M)=>fn()(E,M,w());case en:case"tosiBind":return N(),(E,M,L)=>{on()(E,n,M,L)};case"tosiBinding":return N(),(E)=>({bind:{value:n,binding:E}});case"tosiListBinding":return N(),(E=({span:L})=>L({bindText:"^"}),M={})=>[{bindList:{value:n,...M}},x.template(E(x,kn()))]}if(typeof i==="string"&&/^\d+$/.test(i)){let E=w();if(typeof E==="string")return E[parseInt(i,10)]}if(i==="length"){let E=w();if(typeof E==="string")return E.length}return}if(o&&!(i in f))switch(i){case"path":return n;case"value":return f.valueOf?f.valueOf():f;case"valueOf":case"toJSON":return()=>f.valueOf?f.valueOf():f;case"observe":return(w)=>{let E=I(n,w);return()=>u(E)};case"on":return(w,E)=>fn()(w,E,H(f));case"bind":return(w,E,M)=>{on()(w,n,E,M)};case"binding":return(w)=>({bind:{value:n,binding:w}});case"listBinding":return(w=({span:M})=>M({bindText:"^"}),E={})=>[{bindList:{value:n,...E}},x.template(w(x,kn()))]}switch(i){case J:case"xinPath":case"tosiPath":return n;case U:case"xinValue":case"tosiValue":return f.valueOf?f.valueOf():f;case Vn:case"xinObserve":case"tosiObserve":return(w)=>{let E=I(n,w);return()=>u(E)};case bn:case"xinOn":case"tosiOn":return(w,E)=>fn()(w,E,H(f));case en:case"xinBind":case"tosiBind":return(w,E,M)=>{on()(w,n,E,M)};case"tosiBinding":return(w)=>({bind:{value:n,binding:w}});case"tosiListBinding":return(w=({span:M})=>M({bindText:"^"}),E={})=>[{bindList:{value:n,...E}},x.template(w(x,kn()))]}if(typeof i==="symbol")return f[i];let c=Object.getOwnPropertyDescriptor(f,i);if(c&&!c.configurable&&!c.writable&&"value"in c)return c.value;let m=i,r=m.match(/^([^.[]+)\.(.+)$/)??m.match(/^([^\]]+)(\[.+)/)??m.match(/^(\[[^\]]+\])\.(.+)$/)??m.match(/^(\[[^\]]+\])\[(.+)$/);if(r!==null){let[,w,E]=r,M=e(n,w),L=j(f,w);return L!==null&&typeof L==="object"?new Proxy(L,b(M,o))[E]:L}if(m.startsWith("[")&&m.endsWith("]"))m=m.substring(1,m.length-1);if(!Array.isArray(f)&&f[m]!==void 0||Array.isArray(f)&&m.includes("=")){let w;if(m.includes("=")){let[E,M]=m.split("=");w=f.find((L)=>`${j(L,E)}`===M)}else w=f[m];if(w instanceof Object){let E=e(n,m);return new Proxy(w instanceof Function?w.bind(f):w,b(E,o))}else return o?ro(w,e(n,m)):w}else if(Array.isArray(f)){let w=f[m];return typeof w==="function"?(...E)=>{let M=E.map((T)=>H(T)),L=w.apply(f,M);if(jf.includes(m))B(n);if(L!=null&&typeof L==="object"){if(m==="find"||m==="findLast"||m==="at"){let T=f.indexOf(L);if(T!==-1)return new Proxy(L,b(e(n,String(T)),o))}}return L}:typeof w==="object"?new Proxy(w,b(e(n,m),o)):o?ro(w,e(n,m)):w}else return o?ro(f[m],e(n,m)):f[m]},set(f,i,c){c=H(c);let m=i===U||i==="xinValue"||i==="tosiValue"||i==="value"&&(to(f)||o),r=m?n:e(n,i);if(uf&&!Rf(r))throw Error(`setting invalid path ${r}`);if(H(X[r])!==c&&Qo(nn,r,c)){B(r);let E=n.match(/^(.+)\[(\d+)\]$/);if(E!==null){let[,M,L]=E,T=parseInt(L,10),D=m?"":`.${i}`,Y=Wo(M,T,f,D);for(let s of Y)B(s)}}return!0}}),l=(n,o)=>{let f=typeof o==="function"?o:X[o];if(typeof f!=="function")throw Error(`observe expects a function or path to a function, ${o} is neither`);return I(n,f)},X=new Proxy(nn,b("",!1));Oo(X);var g=new Proxy(nn,b("",!0));var Sf=16,Bf=100;function vo(n,o){let f=Array.from(n.querySelectorAll(R));if(n.matches(R))f.unshift(n);for(let i of f){let c=O.get(i);for(let m of c){if(m.path.startsWith("^"))m.path=`${o}${m.path.substring(1)}`;if(m.binding.toDOM!=null)m.binding.toDOM(i,X[m.path])}}}class ao{boundElement;listTop;listBottom;template;options;itemToElement;array=[];_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(n,o,f={}){if(this.boundElement=n,this.itemToElement=new WeakMap,f.idPath!=null){let i=F(o);if(i!=null)so(i,f.idPath)}if(n.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(n.children[0]instanceof HTMLTemplateElement){let i=n.children[0];if(i.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=_(i.content.children[0])}else this.template=n.children[0],this.template.remove();if(this.options=f,this.listTop=document.createElement("div"),this.listBottom=document.createElement("div"),this.listTop.classList.add("virtual-list-padding"),this.listBottom.classList.add("virtual-list-padding"),this.boundElement.append(this.listTop),this.boundElement.append(this.listBottom),f.virtual!=null)if(cn.observe(this.boundElement),this._update=mn(()=>{this.update(this.array,!0)},Sf),this.boundElement.addEventListener("resize",this._update),f.virtual.scrollContainer==="window")window.addEventListener("scroll",this._update),window.addEventListener("resize",this._update);else this.boundElement.addEventListener("scroll",this._update)}visibleSlice(){let{virtual:n,hiddenProp:o,visibleProp:f}=this.options,i=this.array;if(o!==void 0)i=i.filter((E)=>E[o]!==!0);if(f!==void 0)i=i.filter((E)=>E[f]===!0);if(this.options.filter&&this.needle!==void 0)i=this.options.filter(i,this.needle);let c=0,m=i.length-1,r=0,w=0;if(n!=null&&this.boundElement instanceof HTMLElement){let E=this.boundElement.offsetWidth,M=n.scrollContainer==="window",L,T;if(M){L=window.innerHeight;let C=this.boundElement.getBoundingClientRect();T=Math.max(0,-C.top)}else L=this.boundElement.offsetHeight,T=this.boundElement.scrollTop;let D=n.width!=null?Math.max(1,Math.floor(E/n.width)):n.visibleColumns??1,Y=Math.ceil(L/n.height)+(n.rowChunkSize||1),s=Math.ceil(i.length/D),v=D*Y,Z=Math.floor(T/n.height);if(Z>s-Y+1)Z=Math.max(0,s-Y+1);if(n.rowChunkSize)Z-=Z%n.rowChunkSize;c=Z*D,m=c+v-1,r=Z*n.height,w=Math.max((s-Y)*n.height-r,0)}return{items:i,firstItem:c,lastItem:m,topBuffer:r,bottomBuffer:w}}needle;filter=mn((n)=>{if(this.needle!==n)this.needle=n,this.update(this.array)},Bf);update(n,o){if(n==null)n=[];this.array=n;let{hiddenProp:f,visibleProp:i}=this.options,c=F(n),m=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",m.items.length===0);let r=this._previousSlice,{firstItem:w,lastItem:E,topBuffer:M,bottomBuffer:L}=m;if(f===void 0&&i===void 0&&o===!0&&r!=null&&w===r.firstItem&&E===r.lastItem&&M===r.topBuffer&&L===r.bottomBuffer)return;this._previousSlice=m;let T=0,D=0,Y=0;for(let C of Array.from(this.boundElement.children)){if(C===this.listTop||C===this.listBottom)continue;let k=C[Hn];if(k==null)C.remove();else{let d=m.items.indexOf(k);if(d<w||d>E)C.remove(),this.itemToElement.delete(k),T++}}this.listTop.style.height=String(M)+"px",this.listBottom.style.height=String(L)+"px";let s=[],{idPath:v}=this.options;for(let C=w;C<=E;C++){let k=m.items[C];if(k===void 0)continue;let d=this.itemToElement.get(H(k));if(d==null){if(Y++,d=_(this.template),typeof k==="object")this.itemToElement.set(H(k),d),d[Hn]=H(k);if(this.boundElement.insertBefore(d,this.listBottom),v!=null){let un=k[v],Mf=`${c}[${v}=${un}]`;vo(d,Mf)}else{let un=`${c}[${C}]`;vo(d,un)}}s.push(d)}let Z=null;for(let C of s){if(C.previousElementSibling!==Z)if(D++,Z?.nextElementSibling!=null)this.boundElement.insertBefore(C,Z.nextElementSibling);else this.boundElement.insertBefore(C,this.listBottom);Z=C}if(S.perf)console.log(c,"updated",{removed:T,created:Y,moved:D})}}var rn=(n,o,f)=>{let i=n[a];if(o&&i===void 0)i=new ao(n,o,f),n[a]=i;return i},Wn=(n)=>{let o;while(!(o=n[Hn])&&n&&n.parentElement)n=n.parentElement;return o?{element:n,item:o}:void 0},zn=(n)=>{let o=Wn(n);return o?o.item:void 0},nf=(n)=>{let o=Wn(n);if(!o)return console.error("deleteListItem failed, element is not part of a list instance",n),!1;let f=rn(o.element.parentElement);if(!f.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",n.parentElement,f),!1;let i=f.array.indexOf(o.item);if(i>-1)return f.array.splice(i,1),!0;return!1};var{document:Mn,MutationObserver:of}=globalThis,On=(n,o)=>{let f=O.get(n);if(f==null)return;for(let i of f){let{binding:c,options:m}=i,{path:r}=i,{toDOM:w}=c;if(w!=null){if(r.startsWith("^")){let E=zn(n);if(E!=null&&E[J]!=null)r=i.path=`${E[J]}${r.substring(1)}`;else throw console.error(`Cannot resolve relative binding ${r}`,n,"is not part of a list"),Error(`Cannot resolve relative binding ${r}`)}if(o==null||r.startsWith(o))w(n,Dn()[r],m)}}};if(of!=null)new of((o)=>{o.forEach((f)=>{Array.from(f.addedNodes).forEach((i)=>{if(i instanceof Element)Array.from(i.querySelectorAll(R)).forEach((c)=>On(c))})})}).observe(Mn.body,{subtree:!0,childList:!0});I(()=>!0,(n)=>{let o=Array.from(Mn.querySelectorAll(R));for(let f of o)On(f,n)});var ff=(n)=>{let o=n.target?.closest(R);while(o!=null){let f=O.get(o);for(let i of f){let{binding:c,path:m}=i,{fromDOM:r}=c;if(r!=null){let w;try{w=r(o,i.options)}catch(E){throw console.error("Cannot get value from",o,"via",i),Error("Cannot obtain value fromDOM")}if(w!=null){let E=Dn(),M=E[m];if(M==null)E[m]=w;else{let L=M[J]!=null?M[U]:M,T=w[J]!=null?w[U]:w;if(L!==T)E[m]=T}}}}o=o.parentElement.closest(R)}};if(globalThis.document!=null)Mn.body.addEventListener("change",ff,!0),Mn.body.addEventListener("input",ff,!0);function Q(n,o,f,i){if(n instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");let c;if(typeof o==="object"&&o[J]===void 0&&i===void 0){let{value:w}=o;c=typeof w==="string"?w:w[J],i=o,delete i.value}else c=typeof o==="string"?o:o[J];if(c==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:m}=f;n.classList?.add(Sn);let r=O.get(n);if(r==null)r=[],O.set(n,r);if(r.push({path:c,binding:f,options:i}),m!=null&&!c.startsWith("^"))B(c);if(i?.filter&&i?.needle)Q(n,i.needle,{toDOM(w,E){console.log({needle:E}),w[a]?.filter(E)}});return n}var cf=new Set,If=(n)=>{let o=n?.target?.closest(In),f=!1,i=new Proxy(n,{get(m,r){if(r==="stopPropagation")return()=>{n.stopPropagation(),f=!0};else{let w=m[r];return typeof w==="function"?w.bind(m):w}}}),c=new Set;while(!f&&o!=null){let r=P.get(o)[n.type]||c;for(let w of r){if(typeof w==="function")w(i);else{let E=Dn()[w];if(typeof E==="function")E(i);else throw Error(`no event handler found at path ${w}`)}if(f)continue}o=o.parentElement!=null?o.parentElement.closest(In):null}};function p(n,o,f){let i=P.get(n);if(n.classList.add(Bn),i==null)i={},P.set(n,i);if(!i[o])i[o]=new Set;if(i[o].add(f),!cf.has(o))cf.add(o),Mn.body.addEventListener(o,If,!0);return()=>{i[o].delete(f)}}Uo(Q,p);function Un(n,o){if(!n.internals)return;let f={},i="";if(n.hasAttribute("required")&&o==="")f.valueMissing=!0,i="Please fill out this field.";let c=n.getAttribute("minlength");if(c&&o.length<parseInt(c,10))f.tooShort=!0,i=`Please use at least ${c} characters.`;let m=n.getAttribute("maxlength");if(m&&o.length>parseInt(m,10))f.tooLong=!0,i=`Please use no more than ${m} characters.`;let r=n.getAttribute("pattern");if(r&&o!=="")try{if(!new RegExp(`^(?:${r})$`).test(o))f.patternMismatch=!0,i="Please match the requested format."}catch{}if(Object.keys(f).length>0)n.internals.setValidity(f,i,n);else n.internals.setValidity({})}var Vf=0;function wo(){return`custom-elt${(Vf++).toString(36)}`}var mf=0,Mo=null;function ef(){if(Mo===null)Mo=new MutationObserver((n)=>{let o=new Set;for(let f of n)if(f.type==="attributes"&&f.target instanceof W){let i=f.target,c=fo(f.attributeName);if(i._legacyTrackedAttrs?.has(c))o.add(i)}for(let f of o)f.queueRender(!1)});return Mo}var yn={};function bf(n,o){let f=yn[n],i=V(o).replace(/:host\(([^)]+)\)/g,`${n}$1`).replace(/:host\b/g,n);yn[n]=f?f+`
|
|
13
|
+
`+i:i}function Pf(n){if(yn[n])document.head.append(x.style({id:n+"-component"},yn[n]));delete yn[n]}class W extends HTMLElement{static elements=x;static _elementCreator;static initAttributes;static formAssociated;internals;get validity(){return this.internals?.validity}get validationMessage(){return this.internals?.validationMessage??""}get willValidate(){return this.internals?.willValidate??!1}checkValidity(){return this.internals?.checkValidity()??!0}reportValidity(){return this.internals?.reportValidity()??!0}setCustomValidity(n){if(this.internals)if(n)this.internals.setValidity({customError:!0},n);else this.internals.setValidity({})}setValidity(n,o,f){this.internals?.setValidity(n,o,f)}setFormValue(n,o){this.internals?.setFormValue(n,o)}static get observedAttributes(){let n=this.initAttributes;if(n)return["hidden",...Object.keys(n).map($)];return["hidden"]}instanceId;styleNode;static styleSpec;static styleNode;content=x.slot();isSlotted;static _tagName=null;static get tagName(){return this._tagName}_legacyTrackedAttrs;_attrValues;_valueChanged=!1;static StyleNode(n){return console.warn("StyleNode is deprecated, just assign static styleSpec: XinStyleSheet to the class directly"),x.style(V(n))}static elementCreator(n={}){let o=this;if(o._elementCreator==null){let{tag:f,styleSpec:i}=n,c=n!=null?f:null;if(c==null)if(typeof o.name==="string"&&o.name!==""){if(c=$(o.name),c.startsWith("-"))c=c.slice(1)}else c=wo();if(customElements.get(c)!=null)console.warn(`${c} is already defined`);if(c.match(/\w+(-\w+)+/)==null)console.warn(`${c} is not a legal tag for a custom-element`),c=wo();while(customElements.get(c)!==void 0)c=wo();if(o._tagName=c,i!==void 0)bf(c,i);window.customElements.define(c,this,n),o._elementCreator=x[c]}return o._elementCreator}initAttributes(...n){if(q("initAttributes","initAttributes() is deprecated. Use static initAttributes = { ... } instead."),!this._legacyTrackedAttrs)this._legacyTrackedAttrs=new Set;for(let c of n)this._legacyTrackedAttrs.add(c);ef().observe(this,{attributes:!0});let f={},i={};n.forEach((c)=>{f[c]=z(this[c]);let m=$(c);Object.defineProperty(this,c,{enumerable:!1,get(){if(typeof f[c]==="boolean")return this.hasAttribute(m);else if(this.hasAttribute(m))return typeof f[c]==="number"?parseFloat(this.getAttribute(m)):this.getAttribute(m);else if(i[c]!==void 0)return i[c];else return f[c]},set(r){if(typeof f[c]==="boolean"){if(r!==this[c]){if(r)this.setAttribute(m,"");else this.removeAttribute(m);this.queueRender()}}else if(typeof f[c]==="number"){if(r!==parseFloat(this[c]))this.setAttribute(m,r),this.queueRender()}else if(typeof r==="object"||`${r}`!==`${this[c]}`){if(r===null||r===void 0||typeof r==="object")this.removeAttribute(m);else this.setAttribute(m,r);this.queueRender(),i[c]=r}}})})}initValue(){let n=Object.getOwnPropertyDescriptor(this,"value");if(n===void 0||n.get!==void 0||n.set!==void 0)return;let o=this.hasAttribute("value")?this.getAttribute("value"):z(this.value);delete this.value,Object.defineProperty(this,"value",{enumerable:!1,get(){return o},set(f){if(o!==f)o=f,this._valueChanged=!0,this.queueRender(!0)}})}_parts;get parts(){let n=this.shadowRoot!=null?this.shadowRoot:this;if(this._parts==null)this._parts=new Proxy({},{get(o,f){if(o[f]===void 0){let i=n.querySelector(`[part="${f}"]`);if(i==null)i=n.querySelector(f);if(i==null)throw Error(`elementRef "${f}" does not exist!`);i.removeAttribute("data-ref"),o[f]=i}return o[f]}});return this._parts}attributeChangedCallback(n,o,f){let i=fo(n);if(!this._legacyTrackedAttrs?.has(i))this.queueRender(!1)}constructor(){super();if(mf+=1,this.constructor.formAssociated&&typeof this.attachInternals==="function"&&!this.internals)this.internals=this.attachInternals();let n=this.constructor.initAttributes;if(n)this._setupAttributeAccessors(n);this.instanceId=`${this.tagName.toLocaleLowerCase()}-${mf}`,this._value=z(this.defaultValue)}_setupAttributeAccessors(n){if(!this._attrValues)this._attrValues=new Map;for(let o of Object.keys(n)){let f=$(o),i=n[o];if(o==="value"){console.warn(`${this.tagName}: 'value' cannot be an attribute. Use the Component value property instead.`);continue}if(typeof i==="object"&&i!==null){console.warn(`${this.tagName}: initAttributes.${o} is an object. Use a regular property instead.`);continue}let c=this,m=!1;while(c){let r=Object.getOwnPropertyDescriptor(c,o);if(r){if(!r.configurable||r.get||r.set){m=!0;break}break}c=Object.getPrototypeOf(c)}if(m)continue;Object.defineProperty(this,o,{enumerable:!1,get:()=>{if(typeof i==="boolean")return this.hasAttribute(f);else if(this.hasAttribute(f))return typeof i==="number"?parseFloat(this.getAttribute(f)):this.getAttribute(f);else if(this._attrValues.has(o))return this._attrValues.get(o);else return i},set:(r)=>{if(typeof i==="boolean"){if(r!==this[o]){if(r)this.setAttribute(f,"");else this.removeAttribute(f);this.queueRender()}}else if(typeof i==="number"){if(r!==parseFloat(this[o]))this.setAttribute(f,r),this.queueRender()}else if(typeof r==="object"||`${r}`!==`${this[o]}`){if(r===null||r===void 0||typeof r==="object")this.removeAttribute(f);else this.setAttribute(f,r);this.queueRender(),this._attrValues.set(o,r)}}})}}connectedCallback(){if(Pf(this.constructor.tagName),this.hydrate(),this.role!=null)this.setAttribute("role",this.role);if(this.constructor.formAssociated&&!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(this.onResize!==void 0){if(cn.observe(this),this._onResize==null)this._onResize=this.onResize.bind(this);this.addEventListener("resize",this._onResize)}if(this.value!=null&&this.getAttribute("value")!=null)this._value=this.getAttribute("value");if(this.internals&&this.value!==void 0)this.internals.setFormValue(this.value),this.validateValue();this.queueRender()}disconnectedCallback(){cn.unobserve(this)}formResetCallback(){if(this.value!==void 0)this.value=this.defaultValue??""}formDisabledCallback(n){if(n)this.setAttribute("disabled","");else this.removeAttribute("disabled")}formStateRestoreCallback(n){if(this.value!==void 0&&typeof n==="string")this.value=n}_changeQueued=!1;_renderQueued=!1;queueRender(n=!1){if(!this._hydrated)return;if(!this._changeQueued)this._changeQueued=n;if(!this._renderQueued)this._renderQueued=!0,requestAnimationFrame(()=>{if(this._changeQueued){if(no(this,"change"),this.internals&&this.value!==void 0)this.internals.setFormValue(this.value)}this._changeQueued=!1,this._renderQueued=!1,this.render()})}_hydrated=!1;hydrate(){if(!this._hydrated){this.initValue();let n=typeof this.content!=="function",o=typeof this.content==="function"?this.content(x):this.content,{styleSpec:f}=this.constructor,{styleNode:i}=this.constructor;if(f)i=this.constructor.styleNode=x.style(V(f)),delete this.constructor.styleNode;if(this.styleNode)console.warn(this,"styleNode is deprecrated, use static styleNode or statc styleSpec instead"),i=this.styleNode;if(i){let c=this.attachShadow({mode:"open"});c.appendChild(i.cloneNode(!0)),oo(c,o,n)}else if(o!==null){let c=Array.from(this.childNodes);oo(this,o,n),this.isSlotted=this.querySelector("slot,xin-slot")!==void 0;let m=Array.from(this.querySelectorAll("slot"));if(m.length>0)m.forEach(yo.replaceSlot);if(c.length>0){let r={"":this};Array.from(this.querySelectorAll("xin-slot")).forEach((w)=>{r[w.name]=w}),c.forEach((w)=>{let E=r[""],M=w instanceof Element?r[w.slot]:E;(M!==void 0?M:E).append(w)})}}this._hydrated=!0}}render(){if(this._valueChanged&&this.internals&&this.value!==void 0)this.internals.setFormValue(this.value),this.validateValue();this._valueChanged=!1}validateValue(){if(!this.internals||this.value===void 0)return;let n=typeof this.value==="string"?this.value:String(this.value);Un(this,n)}}class yo extends W{static initAttributes={name:""};content=null;static replaceSlot(n){let o=document.createElement("xin-slot");if(n.name!=="")o.setAttribute("name",n.name);n.replaceWith(o)}}var Lc=yo.elementCreator({tag:"xin-slot"});var Ef=(n=()=>!0)=>{let o=localStorage.getItem("xin-state");if(o!=null){let i=JSON.parse(o);for(let c of Object.keys(i).filter(n))if(X[c]!==void 0)Object.assign(X[c],i[c]);else X[c]=i[c]}let f=Yn(()=>{let i={},c=H(X);for(let m of Object.keys(c).filter(n))i[m]=c[m];localStorage.setItem("xin-state",JSON.stringify(i)),console.log("xin state saved to localStorage")},500);l(n,f)};var qn="1.3.4";function Ln(n){return Object.assign(g,n),g}function xn(n){return q("boxedProxy","boxedProxy is deprecated, please use tosi() instead"),Ln(n)}function An(n,o=!1){if(o)return q("xinProxy-boxed","xinProxy(..., true) is deprecated; use tosi(...) instead"),xn(n);return Object.keys(n).forEach((f)=>{X[f]=n[f]}),X}var _f={};async function Tn(n,o){let{type:f,styleSpec:i}=await o(n,{Color:y,Component:W,elements:x,svgElements:Gn,mathML:Qn,varDefault:wn,vars:Zn,xin:X,boxed:g,xinProxy:An,boxedProxy:xn,tosi:Ln,makeComponent:Tn,bind:Q,on:p,version:qn}),c={type:f,creator:f.elementCreator({tag:n,styleSpec:i})};return _f[n]=c,c}var Lo={},hf=(n)=>import(n);class sn extends W{static initAttributes={tag:"anon-elt",src:"",property:"default"};loaded;blueprintLoaded=(n)=>{};async packaged(){let{tag:n,src:o,property:f}=this,i=`${n}.${f}:${o}`;if(!this.loaded){if(Lo[i]===void 0)Lo[i]=hf(o).then((c)=>{let m=c[f];return Tn(n,m)});else console.log(`using cached ${n} with signature ${i}`);this.loaded=await Lo[i],this.blueprintLoaded(this.loaded)}return this.loaded}}var rf=sn.elementCreator({tag:"xin-blueprint",styleSpec:{":host":{display:"none"}}});class jn extends W{allLoaded=()=>{};constructor(){super()}async load(){let o=Array.from(this.querySelectorAll(sn.tagName)).filter((f)=>f.src).map((f)=>f.packaged());await Promise.all(o),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var wf=jn.elementCreator({tag:"xin-loader",styleSpec:{":host":{display:"none"}}});})();
|
|
14
14
|
|
|
15
|
-
//# debugId=
|
|
15
|
+
//# debugId=C5869E634A51F25B64756E2164756E21
|
|
16
16
|
//# sourceMappingURL=index.js.map
|