@ixfx/components 0.15.4 → 0.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.d.ts +307 -5
- package/bundle/index.js +283 -114
- package/dist/ac-text.d.ts +1 -1
- package/dist/{ac-token-Cq7lsYf-.d.ts → ac-token-qEs3FsQv.d.ts} +1 -1
- package/dist/ac-token.d.ts +1 -1
- package/dist/colour-picker.d.ts +1 -1
- package/dist/crumbs.d.ts +1 -1
- package/dist/{data-grid-Dx3l3dxw.js → data-grid-C1sZX6n9.js} +37 -9
- package/dist/{data-grid-CbiubdG2.d.ts → data-grid-D7qzmMMp.d.ts} +14 -7
- package/dist/data-grid.d.ts +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/{detail-list-ClkMV0SN.d.ts → detail-list-CKIKlszv.d.ts} +3 -3
- package/dist/detail-list.d.ts +2 -2
- package/dist/{flat-list-0xTZdXzh.d.ts → flat-list-DXMyDiSH.d.ts} +2 -2
- package/dist/flat-list.d.ts +1 -1
- package/dist/{grid-list-BnWJUIBC.d.ts → grid-list-0e7snW6t.d.ts} +1 -1
- package/dist/grid-list.d.ts +1 -1
- package/dist/{grouped-item-lister-Bhyo-dkH.d.ts → grouped-item-lister-DETte0Dh.d.ts} +1 -1
- package/dist/grouped-item-lister.d.ts +1 -1
- package/dist/{icon-DR_3rSyZ.d.ts → icon-CDGprSdE.d.ts} +1 -1
- package/dist/icons.d.ts +2 -2
- package/dist/incr-search.d.ts +1 -1
- package/dist/{index-garxxqgV.d.ts → index-CYndvTWH.d.ts} +1 -1
- package/dist/{index-BUB5SICW.d.ts → index-CoqtMSd9.d.ts} +1 -1
- package/dist/{index-BAuqR9El.d.ts → index-DEVyVIn8.d.ts} +1 -1
- package/dist/{index-Bz3loIAf.d.ts → index-DN2BWctP.d.ts} +1 -1
- package/dist/{index-cnaRPQPp.d.ts → index-DxyyVqzA.d.ts} +2 -2
- package/dist/{index-BPTuCRGb.d.ts → index-KN2MW_xD.d.ts} +1 -1
- package/dist/{index-CJ5fshD3.d.ts → index-UvnoZUAo.d.ts} +1 -1
- package/dist/index.d.ts +56 -20
- package/dist/index.js +3 -2
- package/dist/{labelled-input-base-Dp_9KP0G.d.ts → labelled-input-base-DiTme1JO.d.ts} +1 -1
- package/dist/labelled-radial-input.d.ts +2 -2
- package/dist/labelled-range-input.d.ts +1 -1
- package/dist/labelled-slider-input.d.ts +1 -1
- package/dist/list-group-header.d.ts +1 -1
- package/dist/{menu-item-B0zqw2xp.d.ts → menu-item-bF6narIz.d.ts} +1 -1
- package/dist/menu.d.ts +2 -2
- package/dist/miller.d.ts +1 -1
- package/dist/panel.d.ts +1 -1
- package/dist/{split-layout-C5SYbDrq.d.ts → split-layout-JK3xWVX2.d.ts} +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/sunburst-tree.d.ts +2 -0
- package/dist/sunburst-tree.js +2 -0
- package/dist/sunbursttree-list--Z0uyh8O.d.ts +266 -0
- package/dist/sunbursttree-list-yXwS-uEI.js +1337 -0
- package/dist/{tab-list-wC0xNz1b.d.ts → tab-list-Df371rqw.d.ts} +1 -1
- package/dist/tabs.d.ts +1 -1
- package/dist/{titlebar-B5zSTZnF.d.ts → titlebar-Tqu-VvMU.d.ts} +1 -1
- package/dist/titlebar.d.ts +1 -1
- package/dist/tree.d.ts +1 -1
- package/dist/{vertical-list-B8FoU-pU.d.ts → vertical-list-D8MksoTp.d.ts} +1 -1
- package/dist/vertical-list.d.ts +1 -1
- package/docs-user/README.md +1 -0
- package/docs-user/data-grid.md +11 -4
- package/docs-user/index.json +7 -2
- package/docs-user/llms.txt +1 -0
- package/docs-user/sunburst-tree.md +193 -0
- package/docs-user/tree.md +1 -1
- package/llms.txt +1 -0
- package/package.json +5 -1
package/bundle/index.js
CHANGED
|
@@ -678,12 +678,12 @@ import{t as e}from"./rolldown-runtime-CEoa-xHZ.js";import{LitElement as n,css as
|
|
|
678
678
|
* Licensed under BSD 3-Clause
|
|
679
679
|
*/
|
|
680
680
|
const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t`,383:`s`,384:`b`,385:`B`,387:`b`,390:`O`,392:`c`,393:`D`,394:`D`,396:`d`,398:`E`,400:`E`,402:`f`,403:`G`,407:`I`,409:`k`,410:`l`,412:`M`,413:`N`,414:`n`,415:`O`,421:`p`,427:`t`,429:`t`,430:`T`,434:`V`,436:`y`,438:`z`,477:`e`,485:`g`,544:`N`,545:`d`,549:`z`,564:`l`,565:`n`,566:`t`,567:`j`,570:`A`,571:`C`,572:`c`,573:`L`,574:`T`,575:`s`,576:`z`,579:`B`,580:`U`,581:`V`,582:`E`,583:`e`,584:`J`,585:`j`,586:`Q`,587:`q`,588:`R`,589:`r`,590:`Y`,591:`y`,592:`a`,593:`a`,595:`b`,596:`o`,597:`c`,598:`d`,599:`d`,600:`e`,603:`e`,604:`e`,605:`e`,606:`e`,607:`j`,608:`g`,609:`g`,610:`G`,613:`h`,614:`h`,616:`i`,618:`I`,619:`l`,620:`l`,621:`l`,623:`m`,624:`m`,625:`m`,626:`n`,627:`n`,628:`N`,629:`o`,633:`r`,634:`r`,635:`r`,636:`r`,637:`r`,638:`r`,639:`r`,640:`R`,641:`R`,642:`s`,647:`t`,648:`t`,649:`u`,651:`v`,652:`v`,653:`w`,654:`y`,655:`Y`,656:`z`,657:`z`,663:`c`,665:`B`,666:`e`,667:`G`,668:`H`,669:`j`,670:`k`,671:`L`,672:`q`,686:`h`,867:`a`,868:`e`,869:`i`,870:`o`,871:`u`,872:`c`,873:`d`,874:`h`,875:`m`,876:`r`,877:`t`,878:`v`,879:`x`,7424:`A`,7427:`B`,7428:`C`,7429:`D`,7431:`E`,7432:`e`,7433:`i`,7434:`J`,7435:`K`,7436:`L`,7437:`M`,7438:`N`,7439:`O`,7440:`O`,7441:`o`,7442:`o`,7443:`o`,7446:`o`,7447:`o`,7448:`P`,7449:`R`,7450:`R`,7451:`T`,7452:`U`,7453:`u`,7454:`u`,7455:`m`,7456:`V`,7457:`W`,7458:`Z`,7522:`i`,7523:`r`,7524:`u`,7525:`v`,7834:`a`,7835:`s`,8305:`i`,8341:`h`,8342:`k`,8343:`l`,8344:`m`,8345:`n`,8346:`p`,8347:`s`,8348:`t`,8580:`c`};for(let e=`̀`.codePointAt(0);e<=`ͯ`.codePointAt(0);++e){let n=String.fromCodePoint(e);for(let e of`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`){let r=(e+n).normalize().codePointAt(0);r>126&&(Me[r]=e)}}const Ne={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(let e of Object.keys(Ne)){let n=e.toUpperCase();for(let r=Ne[e][0];r<=Ne[e][1];++r)Me[r]=r%2==0?n:e}function Pe(e){if(e<192||e>8580)return e;let n=Me[e];return n===void 0?e:n.codePointAt(0)}function Fe(e){return e}function Ie(e){return e}function Le(e,n){return e>n?e:n}const Re=e=>e.split(``).map(e=>e.codePointAt(0)),ze=new Set(` \f
|
|
681
|
-
\r \v\xA0 \u2028\u2029 `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)ze.add(e);const Be=``.codePointAt(0),Ve=`A`.codePointAt(0),He=`Z`.codePointAt(0),Ue=`a`.codePointAt(0),We=`z`.codePointAt(0),Ge=`0`.codePointAt(0),Ke=`9`.codePointAt(0);function qe(e,n,r){return r?e:n-e-1}function Je(e){return e?new Set:null}function Ye(e,n,r){if(n!==null&&n.i16.length>e+r){let i=n.i16.subarray(e,e+r);return[e+r,i]}return[e,new Int16Array(r)]}function Xe(e,n,r){if(n!==null&&n.i32.length>e+r){let i=n.i32.subarray(e,e+r);return[e+r,i]}return[e,new Int32Array(r)]}function Ze(e){return e>=Ue&&e<=We?1:e>=Ve&&e<=He?2:e>=Ge&&e<=Ke?4:0}function Qe(e){let n=String.fromCodePoint(e);return n===n.toUpperCase()?n===n.toLowerCase()?n.match(/\p{Number}/gu)===null?n.match(/\p{Letter}/gu)===null?0:3:4:2:1}function $e(e){return e<=Be?Ze(e):Qe(e)}function et(e,n){return e===0&&n!==0?8:e===1&&n===2||e!==4&&n===4?7:n===0?8:0}function tt(e,n){return n===0?8:et($e(e[n-1]),$e(e[n]))}function nt(e,n,r,i){let a=e.slice(i),o=a.indexOf(r);if(o===0)return i;if(!n&&r>=Ue&&r<=We){o>0&&(a=a.slice(0,o));let e=a.indexOf(r-32);e>=0&&(o=e)}return o<0?-1:i+o}function rt(e){for(let n of e)if(n>=128)return!1;return!0}function it(e,n,r){if(!rt(e))return 0;if(!rt(n))return-1;let i=0,a=0;for(let o=0;o<n.length;o++){if(a=nt(e,r,n[o],a),a<0)return-1;o===0&&a>0&&(i=a-1),a++}return i}const at=(e,n,r,i,a,o,s)=>{let c=a.length;if(c===0)return[{start:0,end:0,score:0},Je(o)];let l=i.length;if(s!==null&&l*c>s.i16.length)return st(e,n,r,i,a,o);let u=it(i,a,e);if(u<0)return[{start:-1,end:-1,score:0},null];let d=0,f=0,p=null,m=null,h=null,g=null;[d,p]=Ye(d,s,l),[d,m]=Ye(d,s,l),[d,h]=Ye(d,s,l),[f,g]=Xe(f,s,c);let[,_]=Xe(f,s,l);for(let e=0;e<_.length;e++)_[e]=i[e];let v=Fe(0),y=0,b=0,x=0,S=a[0],ee=a[0],te=Fe(0),ne=0,re=!1,ie=_.subarray(u),ae=p.subarray(u).subarray(0,ie.length),oe=m.subarray(u).subarray(0,ie.length),se=h.subarray(u).subarray(0,ie.length);for(let[i,o]of ie.entries()){let s=null;o<=Be?(s=Ze(o),!e&&s===2&&(o+=32)):(s=Qe(o),!e&&s===2&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0)),n&&(o=Pe(o))),ie[i]=o;let l=et(ne,s);if(se[i]=l,ne=s,o===ee&&(b<c&&(g[b]=Ie(u+i),b++,ee=a[Math.min(b,c-1)]),x=u+i),o===S){let e=16+l*2;if(ae[i]=e,oe[i]=1,c===1&&(r&&e>v||!r&&e>=v)&&(v=e,y=u+i,r&&l===8))break;re=!1}else ae[i]=Le(re?te+-1:te+-3,0),oe[i]=0,re=!0;te=ae[i]}if(b!==c)return[{start:-1,end:-1,score:0},null];if(c===1){let e={start:y,end:y+1,score:v};if(!o)return[e,null];let n=new Set;return n.add(y),[e,n]}let C=g[0],ce=x-C+1,le=null;[d,le]=Ye(d,s,ce*c);{let e=p.subarray(C,x+1);for(let[n,r]of e.entries())le[n]=r}let[,ue]=Ye(d,s,ce*c);{let e=m.subarray(C,x+1);for(let[n,r]of e.entries())ue[n]=r}let w=g.subarray(1),de=a.slice(1).slice(0,w.length);for(let[e,n]of w.entries()){let i=!1,a=de[e],o=e+1,s=o*ce,l=_.subarray(n,x+1),u=h.subarray(n).subarray(0,l.length),d=ue.subarray(s+n-C).subarray(0,l.length),f=ue.subarray(s+n-C-1-ce).subarray(0,l.length),p=le.subarray(s+n-C).subarray(0,l.length),m=le.subarray(s+n-C-1-ce).subarray(0,l.length),g=le.subarray(s+n-C-1).subarray(0,l.length);g[0]=0;for(let[e,s]of l.entries()){let l=e+n,_=0,b=0,x=0;if(b=i?g[e]+-1:g[e]+-3,a===s){_=m[e]+16;let n=u[e];x=f[e]+1,n===8?x=1:x>1&&(n=Le(n,Le(4,h[l-x+1]))),_+n<b?(_+=u[e],x=0):_+=n}d[e]=x,i=_<b;let S=Le(Le(_,b),0);o===c-1&&(r&&S>v||!r&&S>=v)&&(v=S,y=l),p[e]=S}}let fe=Je(o),pe=C;if(o&&fe!==null){let e=c-1;pe=y;let n=!0;for(;;){let r=e*ce,i=pe-C,a=le[r+i],o=0,s=0;if(e>0&&pe>=g[e]&&(o=le[r-ce+i-1]),pe>g[e]&&(s=le[r+i-1]),a>o&&(a>s||a===s&&n)){if(fe.add(pe),e===0)break;e--}n=ue[r+i]>1||r+ce+i+1<ue.length&&ue[r+ce+i+1]>0,pe--}}return[{start:pe,end:y+1,score:v},fe]};function ot(e,n,r,i,a,o,s){let c=0,l=0,u=!1,d=0,f=Fe(0),p=Je(s),m=0;a>0&&(m=$e(r[a-1]));for(let h=a;h<o;h++){let a=r[h],o=$e(a);if(e||(a>=Ve&&a<=He?a+=32:a>Be&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0))),n&&(a=Pe(a)),a===i[c]){s&&p!==null&&p.add(h),l+=16;let e=et(m,o);d===0?f=e:(e===8&&(f=e),e=Le(Le(e,f),4)),l+=c===0?e*2:e,u=!1,d++,c++}else l+=u?-1:-3,u=!0,d=0,f=0;m=o}return[l,p]}const st=(e,n,r,i,a,o,s)=>{if(a.length===0)return[{start:0,end:0,score:0},null];if(it(i,a,e)<0)return[{start:-1,end:-1,score:0},null];let c=0,l=-1,u=-1,d=i.length,f=a.length;for(let o=0;o<d;o++){let s=i[qe(o,d,r)];e||(s>=Ve&&s<=He?s+=32:s>Be&&(s=String.fromCodePoint(s).toLowerCase().codePointAt(0))),n&&(s=Pe(s));let p=a[qe(c,f,r)];if(s===p&&(l<0&&(l=o),c++,c===f)){u=o+1;break}}if(l>=0&&u>=0){c--;for(let n=u-1;n>=l;n--){let o=i[qe(n,d,r)];e||(o>=Ve&&o<=He?o+=32:o>Be&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0)));let s=a[qe(c,f,r)];if(o===s&&(c--,c<0)){l=n;break}}if(!r){let e=l;l=d-u,u=d-e}let[s,p]=ot(e,n,i,a,l,u,o);return[{start:l,end:u,score:s},p]}return[{start:-1,end:-1,score:0},null]},ct=(e,n,r,i,a,o,s)=>{if(a.length===0)return[{start:0,end:0,score:0},null];let c=i.length,l=a.length;if(c<l||it(i,a,e)<0)return[{start:-1,end:-1,score:0},null];let u=0,d=-1,f=Fe(0),p=Fe(-1);for(let o=0;o<c;o++){let s=qe(o,c,r),m=i[s];e||(m>=Ve&&m<=He?m+=32:m>Be&&(m=String.fromCodePoint(m).toLowerCase().codePointAt(0))),n&&(m=Pe(m));let h=qe(u,l,r);if(a[h]===m){if(h===0&&(f=tt(i,s)),u++,u===l){if(f>p&&(d=o,p=f),f===8)break;o-=u-1,u=0,f=0}}else o-=u,u=0,f=0}if(d>=0){let o=0,s=0;r?(o=d-l+1,s=d+1):(o=c-(d+1),s=c-(d-l+1));let[u]=ot(e,n,i,a,o,s,!1);return[{start:o,end:s,score:u},null]}return[{start:-1,end:-1,score:0},null]};function lt(e,n){return{i16:new Int16Array(e),i32:new Int32Array(n)}}const ut=lt(102400,2048),dt=(e,n,r)=>{let i=!1;switch(n){case`smart-case`:e.toLowerCase()!==e&&(i=!0);break;case`case-sensitive`:i=!0;break;case`case-insensitive`:e=e.toLowerCase(),i=!1}let a=Re(e);return r&&(a=a.map(Pe)),{queryRunes:a,caseSensitive:i}};function ft(e,n){let r=Object.keys(e).map(e=>parseInt(e,10)).sort((e,n)=>n-e),i=[];for(let a of r)if(i=i.concat(e[a]),i.length>=n)break;return i}function pt(e,n,r){return i=>{let a=this.runesList[i];if(n.length>a.length)return;let[o,s]=this.algoFn(r,this.opts.normalize,this.opts.forward,a,n,!0,ut);if(o.start===-1)return;if(this.opts.fuzzy===!1){s=new Set;for(let e=o.start;e<o.end;++e)s.add(e)}let c=this.opts.sort?o.score:0;e[c]===void 0&&(e[c]=[]),e[c].push({item:this.items[i],...o,positions:s??new Set})}}function mt(e){let{queryRunes:n,caseSensitive:r}=dt(e,this.opts.casing,this.opts.normalize),i={},a=pt.bind(this)(i,n,r);for(let e=0,n=this.runesList.length;e<n;++e)a(e);return ft(i,this.opts.limit)}const ht={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var gt=class{constructor(e,...n){switch(this.opts={...ht,...n[0]},this.items=e,this.runesList=e.map(e=>Re(this.opts.selector(e).normalize())),this.algoFn=ct,this.opts.fuzzy){case`v2`:this.algoFn=at;break;case`v1`:this.algoFn=st}}};const _t={...ht,match:mt};var vt=class extends gt{constructor(e,...n){super(e,...n),this.opts={..._t,...n[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(yt):(e=e.normalize(),bt(this.opts.match.bind(this)(e),this.opts))}};({...ht});const yt=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function bt(e,n){if(n.sort){let{selector:r}=n;e.sort((e,i)=>{if(e.score===i.score)for(let a of n.tiebreakers){let n=a(e,i,r);if(n!==0)return n}return 0})}return Number.isFinite(n.limit)&&e.splice(n.limit),e}var xt=class{constructor(e,...n){this.finder=new vt(e,...n),this.find=this.finder.find.bind(this.finder)}};function St(e){if(typeof e==`string`)return e;let n=e;return typeof n.label==`string`?n.label:typeof n.key==`string`?n.key:typeof n.value==`string`?n.value:String(e)}function Ct(e,n={}){let r=new xt(e,{selector:n.selector??St,...n.fzf??{}});return{find:n=>n.trim()?r.find(n).map(e=>({item:e.item,positions:e.positions,score:e.score})):e.map(e=>({item:e,positions:new Set,score:0})),items:e}}function wt(e,n={}){let r=Ct(e,{selector:n.selector??(e=>e.label)});return(e,n)=>new Promise((i,a)=>{if(n.aborted){a(new DOMException(`Aborted`,`AbortError`));return}let o=r.find(e).map(e=>({...e.item,positions:e.positions}));if(n.aborted){a(new DOMException(`Aborted`,`AbortError`));return}i(o)})}function Tt(e,n){let r=new Map;for(let n of e)r.set(n.item,n.positions);return Object.freeze({query:n,results:Object.freeze([...e]),positionsByItem:r})}function Et(e={}){let n=e.items??[],r=``,i=Ct(n,{selector:e.selector,fzf:e.fzf}),a=Tt(i.find(r),r),o=!1,s=new Set;e.onChange&&s.add(e.onChange);let c=e=>{for(let n of s)n(e)},l=async(e,n)=>{if(await Promise.resolve(),n?.aborted||o)return a;let r=i.find(e);return n?.aborted||o?a:(a=Tt(r,e),c(a),a)};return{get state(){return a},async setItems(a,o){n=a,i=Ct(n,{selector:e.selector,fzf:e.fzf}),await l(r,o)},async setQuery(e,n){return r=e,l(e,n)},async clearQuery(){r=``,await l(``,void 0)},onChange(e){return s.add(e),e(a),()=>{s.delete(e)}},dispose(){o=!0,s.clear(),n=[]}}}const Dt=`incr-search-highlight`;var Ot=class{#e;#t;#n;#r;#i=new Map;constructor(e,n){this.#e=e,this.#t=n,this.#n=Et({selector:n.selector,fzf:n.fzf})}connect(){this.disconnect();let e=this.#e.getNodes();for(let n of e)this.#i.set(this.#t.selector(n),n);this.#n.setItems(e),this.#t.input&&(this.#t.input.addEventListener(`input`,this.#a),this.#t.input.addEventListener(`keydown`,this.#o)),this.#r=this.#n.onChange(e=>this.#s(e))}disconnect(){this.#r&&=(this.#r(),void 0),this.#t.input&&(this.#t.input.removeEventListener(`input`,this.#a),this.#t.input.removeEventListener(`keydown`,this.#o)),this.#e.filterPredicate=void 0,re({key:this.#t.highlightKey??Dt}),this.#i.clear()}async setQuery(e){await this.#n.setQuery(e)}async clearQuery(){await this.#n.clearQuery()}#a=()=>{let e=this.#t.input?.value??``;this.setQuery(e)};#o=e=>{e.key===`Escape`&&this.#t.input&&(this.#t.input.value=``,this.clearQuery())};#s(e){let n=new Set(e.results.map(e=>e.item.node.item.key)),r=e.query.trim().length>0;this.#e.filterPredicate=r&&n.size>0?(e,r)=>n.has(e.item.key):void 0;let i=this.#t.highlightKey??Dt;if(!this.#e.shadowRoot)return;if(!e.query.trim()){re({key:i});return}let a=this.#t.labelSelector??`.tree-label`;ne(ie(this.#e.shadowRoot,a,e.positionsByItem,e=>{let n=e.textContent??``;return this.#i.get(n)},e=>e.textContent??``),{key:i})}};function kt(e,n){return{getItems:()=>Array.from({length:n.rawCount()},(e,r)=>({key:n.rawKeyAt(r),index:r})),getLabel:e=>n.rawSearchTextAt(e.index),getKey:e=>e.key,focusItem:n=>{n&&e.focusKey(n.key)},activateItem:r=>{n.onActivate?n.onActivate(r.key):e.focusKey(r.key)},selectItems:n=>{e.selectKeys(n.map(e=>e.key))},applyFilter:e=>{n.onFilterChange?.(e)},highlightRoot:n.getHighlightRoot,highlightSelector:`.cell .caption`,highlightKeyOf:e=>e.closest(`.cell`)?.getAttribute(`data-key`)??void 0,highlightText:e=>e.textContent??``,highlightKey:`grid-list-search`}}function D(e){return e.getAttribute(`data-key`)??e.getAttribute(`data-value`)??void 0}var At=class{#e;#t;#n=new Map;#r=!0;#i;constructor(e,n=`[data-key]`){this.#e=e,this.#t=n,this.#i=new MutationObserver(()=>{this.#r=!0}),this.#i.observe(e,{childList:!0,subtree:!0})}get(e){return this.#r&&this.#a(),this.#n.get(e)}invalidate(){this.#r=!0}dispose(){this.#i.disconnect(),this.#n.clear()}#a(){this.#n.clear();for(let e of this.#e.querySelectorAll(this.#t)){let n=D(e);n!==void 0&&!this.#n.has(n)&&this.#n.set(n,e)}this.#r=!1}};function jt(e){return e.getAttribute(`data-search-label`)??e.textContent?.trim()??``}function Mt(e,n={}){let r=n.itemSelector??`:scope > *`,i=n.getLabel??jt,a=n.getKey??(e=>D(e)??jt(e)),o=new Set,s=n.observeContainer??!0,c=()=>n.getAllItems?n.getAllItems():Array.from(e.querySelectorAll(r));return{getItems:c,getLabel:i,getKey:a,focusItem:n=>{n&&e.focusKey(a(n))},activateItem:n=>{let r=a(n);e.activateKey?e.activateKey(r):n.dispatchEvent(new MouseEvent(`click`,{bubbles:!0,composed:!0}))},selectItems:n=>{e.selectKeys(n.map(a))},applyFilter:e=>{if(e===void 0){for(let e of o)e.hidden=!1;o.clear();return}for(let n of c())e.has(a(n))?o.delete(n)&&(n.hidden=!1):(n.hidden=!0,o.add(n))},highlightRoot:()=>e,highlightSelector:r,highlightKeyOf:e=>a(e),highlightText:i,highlightKey:n.highlightKey,container:s?()=>e:void 0}}const Nt=e=>e.textContent?.trim()??``;function Pt(e){return e.getAttribute(`data-key`)??e.getAttribute(`data-value`)??e.textContent?.trim()??``}function Ft(e){let{container:n,itemSelector:r,getLabel:i=Nt,getKey:a=Pt,labelSelector:o,highlightKey:s}=e,c=new Map,l=Et({selector:e=>e.label,fzf:e.fzf}),u=e=>{let n=new Set(e.results.map(e=>e.item.key)),r=e.query.trim().length>0;for(let[e,i]of c)i.hidden=r?!n.has(e):!1},d=e=>{if(!e.query.trim()){re({key:s});return}ne(ie(n,o??r,e.positionsByItem,n=>{let r=a(n);return e.results.find(e=>e.item.key===r)?.item},e=>i(e)),{key:s})},f=l.onChange(n=>{u(n),d(n),e.onChange?.(n)}),p=!1,m=()=>{p||(p=!0,Promise.resolve().then(()=>{p=!1,c=new Map;let e=n.querySelectorAll(r),o=[];for(let n of e){let e=a(n);c.set(e,n),o.push({key:e,label:i(n)})}l.setItems(o)}))},h=new MutationObserver(()=>m());return h.observe(n,{childList:!0,subtree:!1}),m(),{async setQuery(e,n){await l.setQuery(e,n)},async clearQuery(){await l.clearQuery()},refresh:m,onChange(e){return l.onChange(e)},dispose(){h.disconnect(),f(),l.dispose(),re({key:s})}}}const It={navigate:`list.search.navigate`,select:`list.search.select`,filter:`list.search.filter`},Lt={navigate:{label:`Find`,description:`Type to move the cursor to the best match`},select:{label:`Find & Select`,description:`Type to select every matching item`},filter:{label:`Filter`,description:`Type to hide items that don't match`}};function Rt(e,n,r={}){let i=e=>r.idPrefix?`${r.idPrefix}.search.${e}`:It[e],a=[];for(let r of n.registeredModes){let o=i(r);e.has(o)||(e.register({id:o,label:Lt[r].label,description:Lt[r].description,execute:()=>n.open(r)}),a.push(o))}return()=>{for(let n of a)e.unregister(n)}}const zt=[`navigate`,`select`,`filter`],Bt=`list-search-input`;var Vt=class{#e;#t;#n;#r;#i;#a;#o;#s=new Map;#c=!1;#l=`filter`;#u=``;#d=0;#f=[];#p=!1;constructor(e,n){this.#e=e,this.#t=n.adapter;let r=new Set(n.modes??zt);this.#n=zt.filter(e=>r.has(e)),this.#l=this.#n[0]??`filter`,this.#r=n.placeholder??`Search…`,this.#i=Et({selector:e=>e.label,fzf:n.fzf}),this.#a=this.#i.onChange(e=>this.#x(e)),e.addController(this)}get enabled(){return this.#n.length>0}get registeredModes(){return this.#n}setModes(e){let n=new Set(e);this.#n=zt.filter(e=>n.has(e)),this.#n.includes(this.#l)||(this.#c&&this.close(),this.#l=this.#n[0]??`filter`),this.#e.requestUpdate()}get isOpen(){return this.#c}get mode(){return this.#l}get query(){return this.#u}get matchCount(){return this.#f.length}get matchIndex(){return this.#d}hostConnected(){let e=this.#t.container?.();e&&(this.#o=new MutationObserver(()=>this.refresh()),this.#o.observe(e,{childList:!0,subtree:!1})),this.refresh()}hostDisconnected(){this.#o?.disconnect(),this.#o=void 0,this.#c&&this.#w(),this.#c=!1,this.#a?.(),this.#a=void 0,this.#i.dispose()}open(e){this.enabled&&(this.#l=this.#n.includes(e)?e:this.#n[0],this.#c=!0,this.#u=``,this.#d=0,this.#f=[],this.refresh(),this.#i.setQuery(``),this.#e.requestUpdate(),this.#e.updateComplete.then(()=>this.#m()))}close(){this.#c&&(this.#c=!1,this.#w(),this.#u=``,this.#f=[],this.#i.clearQuery(),this.#e.requestUpdate(),this.#e.focus())}setQuery(e){this.#u=e,this.#d=0,this.#i.setQuery(e)}switchMode(e){!this.#n.includes(e)||e===this.#l||(this.#l===`filter`&&this.#p&&(this.#t.applyFilter(void 0),this.#p=!1),this.#l=e,this.#S(),this.#e.requestUpdate(),this.#e.updateComplete.then(()=>this.#m()))}selectMatches(){this.#n.includes(`select`)&&(this.#t.selectItems(this.#y()),this.#e.requestUpdate())}nextMatch(){this.#_(1)}prevMatch(){this.#_(-1)}commit(){if(this.#l===`navigate`){let e=this.#v(this.#f[this.#d]);e&&(this.#t.activateItem?this.#t.activateItem(e):this.#t.focusItem(e))}this.close()}refresh(){this.#s.clear();let e=[];for(let n of this.#t.getItems()){let r=this.#t.getKey(n);this.#s.set(r,n),e.push({key:r,label:this.#t.getLabel(n)})}this.#i.setItems(e)}repaintHighlights(){this.#C()}renderField(){if(!this.enabled)return a;let e=this.#u.trim().length>0,n=this.#n.filter(e=>e!==this.#l),r=this.#n.includes(`select`)&&this.#l!==`select`;return i`
|
|
681
|
+
\r \v\xA0 \u2028\u2029 `.split(``).map(e=>e.codePointAt(0)));for(let e=` `.codePointAt(0);e<=` `.codePointAt(0);e++)ze.add(e);const Be=``.codePointAt(0),Ve=`A`.codePointAt(0),He=`Z`.codePointAt(0),Ue=`a`.codePointAt(0),We=`z`.codePointAt(0),Ge=`0`.codePointAt(0),Ke=`9`.codePointAt(0);function qe(e,n,r){return r?e:n-e-1}function Je(e){return e?new Set:null}function Ye(e,n,r){if(n!==null&&n.i16.length>e+r){let i=n.i16.subarray(e,e+r);return[e+r,i]}return[e,new Int16Array(r)]}function Xe(e,n,r){if(n!==null&&n.i32.length>e+r){let i=n.i32.subarray(e,e+r);return[e+r,i]}return[e,new Int32Array(r)]}function Ze(e){return e>=Ue&&e<=We?1:e>=Ve&&e<=He?2:e>=Ge&&e<=Ke?4:0}function Qe(e){let n=String.fromCodePoint(e);return n===n.toUpperCase()?n===n.toLowerCase()?n.match(/\p{Number}/gu)===null?n.match(/\p{Letter}/gu)===null?0:3:4:2:1}function $e(e){return e<=Be?Ze(e):Qe(e)}function et(e,n){return e===0&&n!==0?8:e===1&&n===2||e!==4&&n===4?7:n===0?8:0}function tt(e,n){return n===0?8:et($e(e[n-1]),$e(e[n]))}function nt(e,n,r,i){let a=e.slice(i),o=a.indexOf(r);if(o===0)return i;if(!n&&r>=Ue&&r<=We){o>0&&(a=a.slice(0,o));let e=a.indexOf(r-32);e>=0&&(o=e)}return o<0?-1:i+o}function rt(e){for(let n of e)if(n>=128)return!1;return!0}function it(e,n,r){if(!rt(e))return 0;if(!rt(n))return-1;let i=0,a=0;for(let o=0;o<n.length;o++){if(a=nt(e,r,n[o],a),a<0)return-1;o===0&&a>0&&(i=a-1),a++}return i}const at=(e,n,r,i,a,o,s)=>{let c=a.length;if(c===0)return[{start:0,end:0,score:0},Je(o)];let l=i.length;if(s!==null&&l*c>s.i16.length)return st(e,n,r,i,a,o);let u=it(i,a,e);if(u<0)return[{start:-1,end:-1,score:0},null];let d=0,f=0,p=null,m=null,h=null,g=null;[d,p]=Ye(d,s,l),[d,m]=Ye(d,s,l),[d,h]=Ye(d,s,l),[f,g]=Xe(f,s,c);let[,_]=Xe(f,s,l);for(let e=0;e<_.length;e++)_[e]=i[e];let v=Fe(0),y=0,b=0,x=0,S=a[0],ee=a[0],te=Fe(0),ne=0,re=!1,ie=_.subarray(u),ae=p.subarray(u).subarray(0,ie.length),oe=m.subarray(u).subarray(0,ie.length),se=h.subarray(u).subarray(0,ie.length);for(let[i,o]of ie.entries()){let s=null;o<=Be?(s=Ze(o),!e&&s===2&&(o+=32)):(s=Qe(o),!e&&s===2&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0)),n&&(o=Pe(o))),ie[i]=o;let l=et(ne,s);if(se[i]=l,ne=s,o===ee&&(b<c&&(g[b]=Ie(u+i),b++,ee=a[Math.min(b,c-1)]),x=u+i),o===S){let e=16+l*2;if(ae[i]=e,oe[i]=1,c===1&&(r&&e>v||!r&&e>=v)&&(v=e,y=u+i,r&&l===8))break;re=!1}else ae[i]=Le(re?te+-1:te+-3,0),oe[i]=0,re=!0;te=ae[i]}if(b!==c)return[{start:-1,end:-1,score:0},null];if(c===1){let e={start:y,end:y+1,score:v};if(!o)return[e,null];let n=new Set;return n.add(y),[e,n]}let C=g[0],ce=x-C+1,le=null;[d,le]=Ye(d,s,ce*c);{let e=p.subarray(C,x+1);for(let[n,r]of e.entries())le[n]=r}let[,ue]=Ye(d,s,ce*c);{let e=m.subarray(C,x+1);for(let[n,r]of e.entries())ue[n]=r}let w=g.subarray(1),de=a.slice(1).slice(0,w.length);for(let[e,n]of w.entries()){let i=!1,a=de[e],o=e+1,s=o*ce,l=_.subarray(n,x+1),u=h.subarray(n).subarray(0,l.length),d=ue.subarray(s+n-C).subarray(0,l.length),f=ue.subarray(s+n-C-1-ce).subarray(0,l.length),p=le.subarray(s+n-C).subarray(0,l.length),m=le.subarray(s+n-C-1-ce).subarray(0,l.length),g=le.subarray(s+n-C-1).subarray(0,l.length);g[0]=0;for(let[e,s]of l.entries()){let l=e+n,_=0,b=0,x=0;if(b=i?g[e]+-1:g[e]+-3,a===s){_=m[e]+16;let n=u[e];x=f[e]+1,n===8?x=1:x>1&&(n=Le(n,Le(4,h[l-x+1]))),_+n<b?(_+=u[e],x=0):_+=n}d[e]=x,i=_<b;let S=Le(Le(_,b),0);o===c-1&&(r&&S>v||!r&&S>=v)&&(v=S,y=l),p[e]=S}}let fe=Je(o),pe=C;if(o&&fe!==null){let e=c-1;pe=y;let n=!0;for(;;){let r=e*ce,i=pe-C,a=le[r+i],o=0,s=0;if(e>0&&pe>=g[e]&&(o=le[r-ce+i-1]),pe>g[e]&&(s=le[r+i-1]),a>o&&(a>s||a===s&&n)){if(fe.add(pe),e===0)break;e--}n=ue[r+i]>1||r+ce+i+1<ue.length&&ue[r+ce+i+1]>0,pe--}}return[{start:pe,end:y+1,score:v},fe]};function ot(e,n,r,i,a,o,s){let c=0,l=0,u=!1,d=0,f=Fe(0),p=Je(s),m=0;a>0&&(m=$e(r[a-1]));for(let h=a;h<o;h++){let a=r[h],o=$e(a);if(e||(a>=Ve&&a<=He?a+=32:a>Be&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0))),n&&(a=Pe(a)),a===i[c]){s&&p!==null&&p.add(h),l+=16;let e=et(m,o);d===0?f=e:(e===8&&(f=e),e=Le(Le(e,f),4)),l+=c===0?e*2:e,u=!1,d++,c++}else l+=u?-1:-3,u=!0,d=0,f=0;m=o}return[l,p]}const st=(e,n,r,i,a,o,s)=>{if(a.length===0)return[{start:0,end:0,score:0},null];if(it(i,a,e)<0)return[{start:-1,end:-1,score:0},null];let c=0,l=-1,u=-1,d=i.length,f=a.length;for(let o=0;o<d;o++){let s=i[qe(o,d,r)];e||(s>=Ve&&s<=He?s+=32:s>Be&&(s=String.fromCodePoint(s).toLowerCase().codePointAt(0))),n&&(s=Pe(s));let p=a[qe(c,f,r)];if(s===p&&(l<0&&(l=o),c++,c===f)){u=o+1;break}}if(l>=0&&u>=0){c--;for(let n=u-1;n>=l;n--){let o=i[qe(n,d,r)];e||(o>=Ve&&o<=He?o+=32:o>Be&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0)));let s=a[qe(c,f,r)];if(o===s&&(c--,c<0)){l=n;break}}if(!r){let e=l;l=d-u,u=d-e}let[s,p]=ot(e,n,i,a,l,u,o);return[{start:l,end:u,score:s},p]}return[{start:-1,end:-1,score:0},null]},ct=(e,n,r,i,a,o,s)=>{if(a.length===0)return[{start:0,end:0,score:0},null];let c=i.length,l=a.length;if(c<l||it(i,a,e)<0)return[{start:-1,end:-1,score:0},null];let u=0,d=-1,f=Fe(0),p=Fe(-1);for(let o=0;o<c;o++){let s=qe(o,c,r),m=i[s];e||(m>=Ve&&m<=He?m+=32:m>Be&&(m=String.fromCodePoint(m).toLowerCase().codePointAt(0))),n&&(m=Pe(m));let h=qe(u,l,r);if(a[h]===m){if(h===0&&(f=tt(i,s)),u++,u===l){if(f>p&&(d=o,p=f),f===8)break;o-=u-1,u=0,f=0}}else o-=u,u=0,f=0}if(d>=0){let o=0,s=0;r?(o=d-l+1,s=d+1):(o=c-(d+1),s=c-(d-l+1));let[u]=ot(e,n,i,a,o,s,!1);return[{start:o,end:s,score:u},null]}return[{start:-1,end:-1,score:0},null]};function lt(e,n){return{i16:new Int16Array(e),i32:new Int32Array(n)}}const ut=lt(102400,2048),dt=(e,n,r)=>{let i=!1;switch(n){case`smart-case`:e.toLowerCase()!==e&&(i=!0);break;case`case-sensitive`:i=!0;break;case`case-insensitive`:e=e.toLowerCase(),i=!1}let a=Re(e);return r&&(a=a.map(Pe)),{queryRunes:a,caseSensitive:i}};function ft(e,n){let r=Object.keys(e).map(e=>parseInt(e,10)).sort((e,n)=>n-e),i=[];for(let a of r)if(i=i.concat(e[a]),i.length>=n)break;return i}function pt(e,n,r){return i=>{let a=this.runesList[i];if(n.length>a.length)return;let[o,s]=this.algoFn(r,this.opts.normalize,this.opts.forward,a,n,!0,ut);if(o.start===-1)return;if(this.opts.fuzzy===!1){s=new Set;for(let e=o.start;e<o.end;++e)s.add(e)}let c=this.opts.sort?o.score:0;e[c]===void 0&&(e[c]=[]),e[c].push({item:this.items[i],...o,positions:s??new Set})}}function mt(e){let{queryRunes:n,caseSensitive:r}=dt(e,this.opts.casing,this.opts.normalize),i={},a=pt.bind(this)(i,n,r);for(let e=0,n=this.runesList.length;e<n;++e)a(e);return ft(i,this.opts.limit)}const ht={limit:1/0,selector:e=>e,casing:`smart-case`,normalize:!0,fuzzy:`v2`,tiebreakers:[],sort:!0,forward:!0};var gt=class{constructor(e,...n){switch(this.opts={...ht,...n[0]},this.items=e,this.runesList=e.map(e=>Re(this.opts.selector(e).normalize())),this.algoFn=ct,this.opts.fuzzy){case`v2`:this.algoFn=at;break;case`v1`:this.algoFn=st}}};const _t={...ht,match:mt};var vt=class extends gt{constructor(e,...n){super(e,...n),this.opts={..._t,...n[0]}}find(e){return e.length===0||this.items.length===0?this.items.slice(0,this.opts.limit).map(yt):(e=e.normalize(),bt(this.opts.match.bind(this)(e),this.opts))}};({...ht});const yt=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function bt(e,n){if(n.sort){let{selector:r}=n;e.sort((e,i)=>{if(e.score===i.score)for(let a of n.tiebreakers){let n=a(e,i,r);if(n!==0)return n}return 0})}return Number.isFinite(n.limit)&&e.splice(n.limit),e}var xt=class{constructor(e,...n){this.finder=new vt(e,...n),this.find=this.finder.find.bind(this.finder)}};function St(e){if(typeof e==`string`)return e;let n=e;return typeof n.label==`string`?n.label:typeof n.key==`string`?n.key:typeof n.value==`string`?n.value:String(e)}function Ct(e,n={}){let r=new xt(e,{selector:n.selector??St,...n.fzf??{}});return{find:n=>n.trim()?r.find(n).map(e=>({item:e.item,positions:e.positions,score:e.score})):e.map(e=>({item:e,positions:new Set,score:0})),items:e}}function wt(e,n={}){let r=Ct(e,{selector:n.selector??(e=>e.label)});return(e,n)=>new Promise((i,a)=>{if(n.aborted){a(new DOMException(`Aborted`,`AbortError`));return}let o=r.find(e).map(e=>({...e.item,positions:e.positions}));if(n.aborted){a(new DOMException(`Aborted`,`AbortError`));return}i(o)})}function Tt(e,n){let r=new Map;for(let n of e)r.set(n.item,n.positions);return Object.freeze({query:n,results:Object.freeze([...e]),positionsByItem:r})}function Et(e={}){let n=e.items??[],r=``,i=Ct(n,{selector:e.selector,fzf:e.fzf}),a=Tt(i.find(r),r),o=!1,s=new Set;e.onChange&&s.add(e.onChange);let c=e=>{for(let n of s)n(e)},l=async(e,n)=>{if(await Promise.resolve(),n?.aborted||o)return a;let r=i.find(e);return n?.aborted||o?a:(a=Tt(r,e),c(a),a)};return{get state(){return a},async setItems(a,o){n=a,i=Ct(n,{selector:e.selector,fzf:e.fzf}),await l(r,o)},async setQuery(e,n){return r=e,l(e,n)},async clearQuery(){r=``,await l(``,void 0)},onChange(e){return s.add(e),e(a),()=>{s.delete(e)}},dispose(){o=!0,s.clear(),n=[]}}}const Dt=`incr-search-highlight`;var Ot=class{#e;#t;#n;#r;#i=new Map;constructor(e,n){this.#e=e,this.#t=n,this.#n=Et({selector:n.selector,fzf:n.fzf})}connect(){this.disconnect();let e=this.#e.getNodes();for(let n of e)this.#i.set(this.#t.selector(n),n);this.#n.setItems(e),this.#t.input&&(this.#t.input.addEventListener(`input`,this.#a),this.#t.input.addEventListener(`keydown`,this.#o)),this.#r=this.#n.onChange(e=>this.#s(e))}disconnect(){this.#r&&=(this.#r(),void 0),this.#t.input&&(this.#t.input.removeEventListener(`input`,this.#a),this.#t.input.removeEventListener(`keydown`,this.#o)),this.#e.filterPredicate=void 0,re({key:this.#t.highlightKey??Dt}),this.#i.clear()}async setQuery(e){await this.#n.setQuery(e)}async clearQuery(){await this.#n.clearQuery()}#a=()=>{let e=this.#t.input?.value??``;this.setQuery(e)};#o=e=>{e.key===`Escape`&&this.#t.input&&(this.#t.input.value=``,this.clearQuery())};#s(e){let n=new Set(e.results.map(e=>e.item.node.item.key)),r=e.query.trim().length>0;this.#e.filterPredicate=r&&n.size>0?(e,r)=>n.has(e.item.key):void 0;let i=this.#t.highlightKey??Dt;if(!this.#e.shadowRoot)return;if(!e.query.trim()){re({key:i});return}let a=this.#t.labelSelector??`.tree-label`;ne(ie(this.#e.shadowRoot,a,e.positionsByItem,e=>{let n=e.textContent??``;return this.#i.get(n)},e=>e.textContent??``),{key:i})}};function kt(e,n){return{getItems:()=>Array.from({length:n.rawCount()},(e,r)=>({key:n.rawKeyAt(r),index:r})),getLabel:e=>n.rawSearchTextAt(e.index),getKey:e=>e.key,focusItem:n=>{n&&e.focusKey(n.key)},activateItem:r=>{n.onActivate?n.onActivate(r.key):e.focusKey(r.key)},selectItems:n=>{e.selectKeys(n.map(e=>e.key))},applyFilter:e=>{n.onFilterChange?.(e)},highlightRoot:n.getHighlightRoot,highlightSelector:`.cell .caption`,highlightKeyOf:e=>e.closest(`.cell`)?.getAttribute(`data-key`)??void 0,highlightText:e=>e.textContent??``,highlightKey:`grid-list-search`}}function D(e){return e.getAttribute(`data-key`)??e.getAttribute(`data-value`)??void 0}var At=class{#e;#t;#n=new Map;#r=!0;#i;constructor(e,n=`[data-key]`){this.#e=e,this.#t=n,this.#i=new MutationObserver(()=>{this.#r=!0}),this.#i.observe(e,{childList:!0,subtree:!0})}get(e){return this.#r&&this.#a(),this.#n.get(e)}invalidate(){this.#r=!0}dispose(){this.#i.disconnect(),this.#n.clear()}#a(){this.#n.clear();for(let e of this.#e.querySelectorAll(this.#t)){let n=D(e);n!==void 0&&!this.#n.has(n)&&this.#n.set(n,e)}this.#r=!1}};function jt(e){return e.getAttribute(`data-search-label`)??e.textContent?.trim()??``}function Mt(e,n={}){let r=n.itemSelector??`:scope > *`,i=n.getLabel??jt,a=n.getKey??(e=>D(e)??jt(e)),o=new Set,s=n.observeContainer??!0,c=()=>n.getAllItems?n.getAllItems():Array.from(e.querySelectorAll(r));return{getItems:c,getLabel:i,getKey:a,focusItem:n=>{n&&e.focusKey(a(n))},activateItem:n=>{let r=a(n);e.activateKey?e.activateKey(r):n.dispatchEvent(new MouseEvent(`click`,{bubbles:!0,composed:!0}))},selectItems:n=>{e.selectKeys(n.map(a))},applyFilter:e=>{if(e===void 0){for(let e of o)e.hidden=!1;o.clear();return}for(let n of c())e.has(a(n))?o.delete(n)&&(n.hidden=!1):(n.hidden=!0,o.add(n))},highlightRoot:()=>e,highlightSelector:r,highlightKeyOf:e=>a(e),highlightText:i,highlightKey:n.highlightKey,container:s?()=>e:void 0}}const Nt=e=>e.textContent?.trim()??``;function Pt(e){return e.getAttribute(`data-key`)??e.getAttribute(`data-value`)??e.textContent?.trim()??``}function Ft(e){let{container:n,itemSelector:r,getLabel:i=Nt,getKey:a=Pt,labelSelector:o,highlightKey:s}=e,c=new Map,l=Et({selector:e=>e.label,fzf:e.fzf}),u=e=>{let n=new Set(e.results.map(e=>e.item.key)),r=e.query.trim().length>0;for(let[e,i]of c)i.hidden=r?!n.has(e):!1},d=e=>{if(!e.query.trim()){re({key:s});return}ne(ie(n,o??r,e.positionsByItem,n=>{let r=a(n);return e.results.find(e=>e.item.key===r)?.item},e=>i(e)),{key:s})},f=l.onChange(n=>{u(n),d(n),e.onChange?.(n)}),p=!1,m=()=>{p||(p=!0,Promise.resolve().then(()=>{p=!1,c=new Map;let e=n.querySelectorAll(r),o=[];for(let n of e){let e=a(n);c.set(e,n),o.push({key:e,label:i(n)})}l.setItems(o)}))},h=new MutationObserver(()=>m());return h.observe(n,{childList:!0,subtree:!1}),m(),{async setQuery(e,n){await l.setQuery(e,n)},async clearQuery(){await l.clearQuery()},refresh:m,onChange(e){return l.onChange(e)},dispose(){h.disconnect(),f(),l.dispose(),re({key:s})}}}const It={navigate:`list.search.navigate`,select:`list.search.select`,filter:`list.search.filter`},Lt={navigate:{label:`Find`,description:`Type to move the cursor to the best match`},select:{label:`Find & Select`,description:`Type to select every matching item`},filter:{label:`Filter`,description:`Type to hide items that don't match`}};function Rt(e,n,r={}){let i=e=>r.idPrefix?`${r.idPrefix}.search.${e}`:It[e],a=[];for(let r of n.registeredModes){let o=i(r);e.has(o)||(e.register({id:o,label:Lt[r].label,description:Lt[r].description,execute:()=>n.open(r)}),a.push(o))}return()=>{for(let n of a)e.unregister(n)}}const O=[`navigate`,`select`,`filter`],zt=`list-search-input`;var Bt=class{#e;#t;#n;#r;#i;#a;#o;#s=new Map;#c=!1;#l=`filter`;#u=``;#d=0;#f=[];#p=!1;constructor(e,n){this.#e=e,this.#t=n.adapter;let r=new Set(n.modes??O);this.#n=O.filter(e=>r.has(e)),this.#l=this.#n[0]??`filter`,this.#r=n.placeholder??`Search…`,this.#i=Et({selector:e=>e.label,fzf:n.fzf}),this.#a=this.#i.onChange(e=>this.#x(e)),e.addController(this)}get enabled(){return this.#n.length>0}get registeredModes(){return this.#n}setModes(e){let n=new Set(e);this.#n=O.filter(e=>n.has(e)),this.#n.includes(this.#l)||(this.#c&&this.close(),this.#l=this.#n[0]??`filter`),this.#e.requestUpdate()}get isOpen(){return this.#c}get mode(){return this.#l}get query(){return this.#u}get matchCount(){return this.#f.length}get matchIndex(){return this.#d}hostConnected(){let e=this.#t.container?.();e&&(this.#o=new MutationObserver(()=>this.refresh()),this.#o.observe(e,{childList:!0,subtree:!1})),this.refresh()}hostDisconnected(){this.#o?.disconnect(),this.#o=void 0,this.#c&&this.#w(),this.#c=!1,this.#a?.(),this.#a=void 0,this.#i.dispose()}open(e){this.enabled&&(this.#l=this.#n.includes(e)?e:this.#n[0],this.#c=!0,this.#u=``,this.#d=0,this.#f=[],this.refresh(),this.#i.setQuery(``),this.#e.requestUpdate(),this.#e.updateComplete.then(()=>this.#m()))}close(){this.#c&&(this.#c=!1,this.#w(),this.#u=``,this.#f=[],this.#i.clearQuery(),this.#e.requestUpdate(),this.#e.focus())}setQuery(e){this.#u=e,this.#d=0,this.#i.setQuery(e)}switchMode(e){!this.#n.includes(e)||e===this.#l||(this.#l===`filter`&&this.#p&&(this.#t.applyFilter(void 0),this.#p=!1),this.#l=e,this.#S(),this.#e.requestUpdate(),this.#e.updateComplete.then(()=>this.#m()))}selectMatches(){this.#n.includes(`select`)&&(this.#t.selectItems(this.#y()),this.#e.requestUpdate())}nextMatch(){this.#_(1)}prevMatch(){this.#_(-1)}commit(){if(this.#l===`navigate`){let e=this.#v(this.#f[this.#d]);e&&(this.#t.activateItem?this.#t.activateItem(e):this.#t.focusItem(e))}this.close()}refresh(){this.#s.clear();let e=[];for(let n of this.#t.getItems()){let r=this.#t.getKey(n);this.#s.set(r,n),e.push({key:r,label:this.#t.getLabel(n)})}this.#i.setItems(e)}repaintHighlights(){this.#C()}renderField(){if(!this.enabled)return a;let e=this.#u.trim().length>0,n=this.#n.filter(e=>e!==this.#l),r=this.#n.includes(`select`)&&this.#l!==`select`;return i`
|
|
682
682
|
<div class="list-search" part="search" ?hidden=${!this.#c}>
|
|
683
683
|
<div class="list-search-row">
|
|
684
684
|
<span class="list-search-mode">${this.#l}</span>
|
|
685
685
|
<input
|
|
686
|
-
class=${
|
|
686
|
+
class=${zt}
|
|
687
687
|
type="text"
|
|
688
688
|
part="search-input"
|
|
689
689
|
placeholder=${this.#r}
|
|
@@ -705,7 +705,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
705
705
|
</div>
|
|
706
706
|
`:a}
|
|
707
707
|
</div>
|
|
708
|
-
`}#m(){this.#e.renderRoot?.querySelector(`.${
|
|
708
|
+
`}#m(){this.#e.renderRoot?.querySelector(`.${zt}`)?.focus()}#h=e=>{this.setQuery(e.target.value)};#g=e=>{switch(e.key){case`Escape`:e.preventDefault(),e.stopPropagation(),this.close();break;case`Enter`:e.preventDefault(),e.stopPropagation(),this.commit();break;case`ArrowDown`:this.#l===`navigate`&&(e.preventDefault(),this.nextMatch());break;case`ArrowUp`:this.#l===`navigate`&&(e.preventDefault(),this.prevMatch())}};#_(e){if(this.#f.length===0)return;let n=this.#f.length;this.#d=(this.#d+e+n)%n,this.#l===`navigate`&&this.#t.focusItem(this.#v(this.#f[this.#d])),this.#e.requestUpdate()}#v(e){return e?this.#s.get(e.item.key):void 0}#y(){return this.#f.map(e=>this.#v(e)).filter(e=>e!==void 0)}get#b(){return this.#t.highlightKey??`incr-search-highlight`}#x(e){if(!this.#c)return;let n=e.query.trim().length>0;this.#f=n?[...e.results]:[],this.#d>=this.#f.length&&(this.#d=0),this.#S(),this.#e.requestUpdate()}#S(){if(!(this.#u.trim().length>0)){this.#p&&=(this.#t.applyFilter(void 0),!1),this.#C();return}switch(this.#l){case`navigate`:this.#t.focusItem(this.#v(this.#f[this.#d]));break;case`select`:this.#t.selectItems(this.#y());break;case`filter`:this.#t.applyFilter(new Set(this.#f.map(e=>e.item.key))),this.#p=!0}this.#C()}#C(){let e=this.#t.highlightRoot?.(),n=this.#t.highlightSelector,r=this.#t.highlightKeyOf;if(!e||!n||!r)return;if(this.#u.trim().length===0){re({key:this.#b});return}let i=this.#i.state,a=new Map(i.results.map(e=>[e.item.key,e.item])),o=ie(e,n,i.positionsByItem,e=>{let n=r(e);return n===void 0?void 0:a.get(n)},this.#t.highlightText??(e=>e.textContent??``));try{ne(o,{key:this.#b})}catch{re({key:this.#b})}}#w(){this.#p&&=(this.#t.applyFilter(void 0),!1),re({key:this.#b})}};const Vt=r`
|
|
709
709
|
.list-search {
|
|
710
710
|
position: absolute;
|
|
711
711
|
top: var(--list-search-inset, 8px);
|
|
@@ -796,7 +796,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
796
796
|
.list-search-icon-btn:hover {
|
|
797
797
|
color: inherit;
|
|
798
798
|
}
|
|
799
|
-
`;function
|
|
799
|
+
`;function Ht(e){for(let n of e.childNodes)if(n.nodeType===Node.TEXT_NODE&&(n.textContent??``).trim().length>0)return n.textContent??``;return e.textContent??``}function Ut(e,n={}){return{getItems:()=>e.getNodes(),getLabel:n.getLabel??(e=>e.node.item.label),getKey:e=>e.node.item.key,focusItem:n=>{n&&e.revealKey(n.node.item.key)},activateItem:n=>{e.revealKey(n.node.item.key),e.select(n.node)},selectItems:n=>{e.selectMany(n.map(e=>e.node))},applyFilter:n=>{e.filterPredicate=n===void 0?void 0:e=>n.has(e.item.key)},highlightRoot:()=>e.shadowRoot,highlightSelector:n.labelSelector??`.tree-label`,highlightText:Ht,highlightKeyOf:e=>e.closest(`[data-key]`)?.dataset.key,highlightKey:n.highlightKey}}const Wt=e=>e.split(/[\s,;]+/);function Gt(e){let n=new Map;return{get:e=>n.get(e),set:(r,i)=>{n.has(r)&&n.delete(r),n.set(r,i),n.size>e&&n.delete(n.keys().next().value)},has:e=>n.has(e),clear:()=>n.clear()}}let Kt=class extends n{#e;#t;#n;#r;#i;constructor(){super(),this.placeholder=``,this.cacheSize=20,this.debounceMs=150,this.strict=!1,this.allowDuplicates=!1,this._tokens=[],this._draft=``,this._isOpen=!1,this._tickled=new oe(this,{getItems:()=>this.#e.items.map((e,n)=>({id:n,enabled:!0}))}),this.#e=new je(this,void 0,{clearOnRequest:!0,onError:e=>console.error(`[ixfx-ac-token] completionProvider error:`,e)}),this.#t=Gt(20),this.#i=[],this.#o=e=>{e.target.closest(`.token-chip`)||this.shadowRoot?.querySelector(`input.draft`)?.focus()},this.#s=()=>{this._selectedTokenIndex=void 0,this.#S(this._draft)},this.#c=()=>{setTimeout(()=>{this._isOpen=!1,this._tickled.clearTickled(),this._selectedTokenIndex=void 0},120)},this.#l=e=>{let n=e.target.value;this._selectedTokenIndex=void 0;let r=(this.tokenizer??Wt)(n);if(r.length>1){for(let e=0;e<r.length-1;e++){let n=r[e].trim();n&&this.#g({label:n})}this._draft=r[r.length-1]??``}else this._draft=n;this.#S(this._draft)},this.#u=e=>{let n=e.target;if((e.metaKey||e.ctrlKey)&&e.key===`a`){e.preventDefault();let n=[...this._tokens.map(e=>e.label),this._draft.trim()].filter(Boolean);navigator.clipboard.writeText(n.join(` `)).catch(()=>{});return}if(this._selectedTokenIndex!==void 0&&e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey){e.preventDefault(),this.#h(e.key);return}this.#d(e,n)},this.#f=e=>{e.preventDefault();let n=e.clipboardData?.getData(`text/plain`)??``;if(!n)return;let r=(this.tokenizer??Wt)(this._draft+n).filter(Boolean);if(r.length!==0){if(r.length===1)this._draft=r[0];else{for(let e=0;e<r.length-1;e++){let n=r[e].trim();n&&this.#g({label:n})}this._draft=r[r.length-1]??``}this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`input.draft`)?.setSelectionRange(this._draft.length,this._draft.length)}),this.#S(this._draft)}},this.#p=(e,n)=>{e.preventDefault(),this.#v(n)},this.#m=(e,n)=>{if(e.button!==0)return;e.preventDefault();let r=e.currentTarget,i=e.clientY,a=!1;r.setPointerCapture(e.pointerId);let o=()=>{r.removeEventListener(`pointermove`,s),r.removeEventListener(`pointerup`,c)},s=e=>{Math.abs(e.clientY-i)>28&&(a=!0,r.releasePointerCapture(e.pointerId),o(),this.#_(n),this.shadowRoot?.querySelector(`input.draft`)?.focus())},c=()=>{o(),a||(this._selectedTokenIndex=this._selectedTokenIndex===n?void 0:n,this.shadowRoot?.querySelector(`input.draft`)?.focus())};r.addEventListener(`pointermove`,s),r.addEventListener(`pointerup`,c)},this.#t=Gt(this.cacheSize)}get tokens(){return this._tokens}set tokens(e){this._tokens=[...e],this.#y()}setTokens(e){this._tokens=[...e]}get value(){return this._tokens.map(e=>e.label).join(`, `)}connectedCallback(){super.connectedCallback(),this.#a()}disconnectedCallback(){super.disconnectedCallback(),this.#n!==void 0&&(clearTimeout(this.#n),this.#n=void 0)}updated(e){(e.has(`completionProvider`)||e.has(`cacheSize`))&&(this.#t=Gt(this.cacheSize)),e.has(`completionProvider`)&&this.#a(),this.#e.items!==this.#i&&(this.#i=this.#e.items,this.#e.items.length>0?this._tickled.setTickled(0):this._tickled.clearTickled())}#a(){let e=this.getAttribute(`data-tokens`);if(!e||this.completionProvider){this.#r=void 0;return}let n=e.trim().split(/[\s,;]+/).filter(Boolean).map(e=>({label:e}));this.#r=wt(n)}#o;#s;#c;#l;#u;#d(e,n){switch(e.key){case`ArrowLeft`:n.selectionStart===0&&n.selectionEnd===0&&(e.preventDefault(),this._selectedTokenIndex===void 0?this._tokens.length>0&&(this._selectedTokenIndex=this._tokens.length-1):this._selectedTokenIndex>0&&this._selectedTokenIndex--);break;case`ArrowRight`:this._selectedTokenIndex!==void 0&&(e.preventDefault(),this._selectedTokenIndex<this._tokens.length-1?this._selectedTokenIndex++:this._selectedTokenIndex=void 0);break;case`Backspace`:n.selectionStart===0&&n.selectionEnd===0&&(e.preventDefault(),this._selectedTokenIndex===void 0?this._tokens.length>0&&this.#_(this._tokens.length-1):this.#_(this._selectedTokenIndex));break;case`Enter`:{let n=this._tickled.tickledId;this._isOpen&&n!==void 0&&this.#e.items[n]?(e.preventDefault(),this.#v(this.#e.items[n])):!this.strict&&this._draft.trim()&&(e.preventDefault(),this.#g({label:this._draft.trim()}),this._draft=``,this.#x());break}case`ArrowDown`:if(!this._isOpen)return;e.preventDefault(),this._tickled.handleKeyboardNavigation(`next`),this.#w();break;case`ArrowUp`:if(!this._isOpen)return;e.preventDefault(),this._tickled.handleKeyboardNavigation(`previous`),this.#w();break;case`Escape`:e.preventDefault(),this.#x(),this._selectedTokenIndex=void 0}}#f;#p;#m;#h(e){let n=this._selectedTokenIndex;if(n===void 0)return;let r=this._tokens[n];if(!r)return;let i=r.label+e;this.#_(n),this._selectedTokenIndex=void 0,this._draft=i,this.updateComplete.then(()=>{let e=this.shadowRoot?.querySelector(`input.draft`);e&&e.setSelectionRange(e.value.length,e.value.length)}),this.#S(i)}#g(e){let n=this._tokens.length;this._tokens=[...this._tokens,e],this.dispatchEvent(new CustomEvent(`ac-token-add`,{detail:{item:e,index:n},bubbles:!0,composed:!0})),this.#y()}#_(e){let n=this._tokens[e];n&&(this._tokens=this._tokens.filter((n,r)=>r!==e),this._selectedTokenIndex!==void 0&&(this._selectedTokenIndex===e?this._selectedTokenIndex=void 0:this._selectedTokenIndex>e&&this._selectedTokenIndex--),this.dispatchEvent(new CustomEvent(`ac-token-remove`,{detail:{item:n,index:e},bubbles:!0,composed:!0})),this.#y())}#v(e){this.#g(e),this._draft=``,this.#x()}#y(){this.dispatchEvent(new CustomEvent(`ac-token-change`,{detail:{tokens:this._tokens},bubbles:!0,composed:!0}))}#b(e){if(this.allowDuplicates)return e;let n=new Set(this._tokens.map(e=>e.label));return e.filter(e=>!n.has(e.label))}#x(){this._isOpen=!1,this._tickled.clearTickled()}#S(e){let n=this.#C();if(!n){this._isOpen=!1;return}this.#n!==void 0&&clearTimeout(this.#n),this._isOpen=!0,this.#n=setTimeout(()=>{this.#e.provider=n,this.#e.request(e)},this.debounceMs)}#C(){let e=this.completionProvider??this.#r;if(e)return(n,r)=>{let i=this.#t.get(n);if(i!==void 0)return this.#b(i);let a=e(n,r);return Symbol.asyncIterator in new Object(a)?a:Array.isArray(a)?(this.#t.set(n,a),this.#b(a)):a.then(e=>(r.aborted||this.#t.set(n,e),this.#b(e)))}}#w(){this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`.item.tickled`)?.scrollIntoView({block:`nearest`})})}#T(e,n){let r=this._selectedTokenIndex===n,o=r?void 0:this.tokenStyle?.(e);return i`
|
|
800
800
|
<span
|
|
801
801
|
class="token-chip ${r?`selected`:``}"
|
|
802
802
|
style=${h({background:o?.background,color:o?.color,"border-color":o?.borderColor})}
|
|
@@ -1022,7 +1022,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
1022
1022
|
color: var(--surface-muted-text);
|
|
1023
1023
|
font-style: italic;
|
|
1024
1024
|
}
|
|
1025
|
-
`]}};E([d({type:Object})],
|
|
1025
|
+
`]}};E([d({type:Object})],Kt.prototype,`completionProvider`,void 0),E([d({type:Object})],Kt.prototype,`tokenizer`,void 0),E([d({attribute:!1})],Kt.prototype,`tokenStyle`,void 0),E([d({type:String})],Kt.prototype,`placeholder`,void 0),E([d({type:Number,attribute:`cache-size`})],Kt.prototype,`cacheSize`,void 0),E([d({type:Number,attribute:`debounce-ms`})],Kt.prototype,`debounceMs`,void 0),E([d({type:Boolean})],Kt.prototype,`strict`,void 0),E([d({type:Boolean,attribute:`allow-duplicates`})],Kt.prototype,`allowDuplicates`,void 0),E([m()],Kt.prototype,`_tokens`,void 0),E([m()],Kt.prototype,`_draft`,void 0),E([m()],Kt.prototype,`_selectedTokenIndex`,void 0),E([m()],Kt.prototype,`_isOpen`,void 0),Kt=E([T(`ixfx-ac-token`)],Kt);var qt=class{commands=new Map;invokeListeners=new Set;options;constructor(e={}){this.options=e}register(e){if(this.commands.has(e.id))throw Error(`Command "${e.id}" already registered`);this.commands.set(e.id,e)}unregister(e){return this.commands.delete(e)}invoke(e,n){let r=this.commands.get(e);if(!r)return this.options.onCommandNotFound?.(e),!1;try{r.execute(n)}catch(n){return this.options.onInvokeError?.(e,n,`execute`),!1}try{this.options.onInvoke?.(e,n)}catch(n){this.options.onInvokeError?.(e,n,`on-invoke`)}try{for(let r of this.invokeListeners)r(e,n)}catch(n){this.options.onInvokeError?.(e,n,`listener`)}return!0}addOnInvokeHandler(e){return this.invokeListeners.add(e),()=>this.invokeListeners.delete(e)}get(e){return this.commands.get(e)}getAll(){return Array.from(this.commands.values())}getEnabled(e){return this.getAll().filter(n=>!n.enabledWhen||n.enabledWhen(e))}has(e){return this.commands.has(e)}};function Jt(e={}){return new qt(e)}new class{bindings=[];active=!0;element=null;eventHandlers=new Set;modeGetter=null;setModeGetter(e){this.modeGetter=e}bind(e){if(!e.nonExclusive&&this.hasOverlap(e))throw Error(`Key binding for "${e.key}" with modifiers "${this.formatModifiers(e.modifiers)}" already exists`);this.bindings.push(e)}unbind(e,n){this.bindings=this.bindings.filter(r=>!(r.key===e&&this.setsEqual(r.modifiers,n)))}setActive(e){this.active=e}onKeyEvent(e){return this.eventHandlers.add(e),()=>{this.eventHandlers.delete(e)}}attach(e){this.element=e,e.addEventListener(`keydown`,this.handleKeydown.bind(this))}detach(){this.element&&=(this.element.removeEventListener(`keydown`,this.handleKeydown.bind(this)),null)}getBindings(){return this.bindings}handleKeydown(e){if(!this.active||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)return;let n=this.getModifiers(e),r=this.getInputContext(e),i=this.findBinding(e.key,n,this.modeGetter?.(),r);if(i){e.preventDefault();let a=this.toModifiers(n);this.eventHandlers.forEach(e=>e(i.commandId,a,r))}}getInputContext(e){let n=document.activeElement,r=n instanceof HTMLElement?n:null;return{source:`keyboard`,element:r,commandContext:r?.dataset?.commandContext}}getModifiers(e){let n=new Set;return e.ctrlKey&&n.add(`ctrl`),e.shiftKey&&n.add(`shift`),e.altKey&&n.add(`alt`),e.metaKey&&n.add(`meta`),n}findBinding(e,n,r,i){let a=[];for(let i of this.bindings)i.key.toLowerCase()===e.toLowerCase()&&this.isSubset(i.modifiers,n)&&(i.mode&&i.mode!==`all`&&i.mode!==r||a.push(i));return this.pickBestBinding(a,i)}pickBestBinding(e,n){if(e.length===0)return;let r=n?.commandContext?e.filter(e=>this.matchesCommandContext(e.commandContext,n.commandContext)):[],i=r.length>0?r:e,a=i[0];if(a){for(let e of i)e.modifiers.size>a.modifiers.size&&(a=e);return a}}matchesCommandContext(e,n){if(!e||!n)return!1;if(e.endsWith(`*`)){let r=e.slice(0,-1);return n.startsWith(r)}return e===n}hasOverlap(e){for(let n of this.bindings)if(n.key.toLowerCase()===e.key.toLowerCase()&&n.mode===e.mode&&this.setsEqual(n.modifiers,e.modifiers))return!0;return!1}formatModifiers(e){return e.size===0?`none`:Array.from(e.values()).sort().join(`+`)}isSubset(e,n){for(let r of e)if(!n.has(r))return!1;return!0}setsEqual(e,n){if(e.size!==n.size)return!1;for(let r of e)if(!n.has(r))return!1;return!0}toModifiers(e){return{ctrl:e.has(`ctrl`),shift:e.has(`shift`),alt:e.has(`alt`),meta:e.has(`meta`)}}},new class{initialized=!1;async init(){this.initialized||=!0}destroy(){this.initialized=!1}isSupported(){return`requestMIDIAccess`in navigator}};const Yt=r`
|
|
1026
1026
|
.ixfx-handle {
|
|
1027
1027
|
/* Bridge: public --ixfx-handle-* (element or ancestor) → internal alias → fallback. */
|
|
1028
1028
|
--_handle-color: var(--ixfx-handle-color, var(--surface-3-text));
|
|
@@ -1590,7 +1590,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
1590
1590
|
transition: none;
|
|
1591
1591
|
}
|
|
1592
1592
|
}
|
|
1593
|
-
`;let
|
|
1593
|
+
`;let Xt=class extends n{constructor(...e){super(...e),this.title=``,this.iconName=``,this.orientation=`horizontal`,this.variant=`titlebar`,this.closable=!1,this.collapsible=!1,this.collapsed=!1,this.toggleInteraction=`implicit`}_onToggleClick(){this.collapsible&&(this.collapsed=!this.collapsed,this.dispatchEvent(new CustomEvent(`toggle`,{detail:{collapsed:this.collapsed},bubbles:!0,composed:!0})))}_onCloseClick(){this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0}))}_getCaretIcon(){return`chevron-down`}render(){let e=this._getCaretIcon(),n=this.orientation===`vertical`,r=this.collapsible&&this.toggleInteraction!==`disabled`,o=this.collapsible&&this.toggleInteraction===`implicit`,s=n?this.collapsed?``:`-90deg`:this.collapsed?`-90deg`:``,c=this.variant===`tree`;return i`
|
|
1594
1594
|
<div
|
|
1595
1595
|
class="bar"
|
|
1596
1596
|
role="toolbar"
|
|
@@ -1914,7 +1914,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
1914
1914
|
width: 1em;
|
|
1915
1915
|
height: 1em;
|
|
1916
1916
|
}
|
|
1917
|
-
`]}};E([d({type:String})],
|
|
1917
|
+
`]}};E([d({type:String})],Xt.prototype,`title`,void 0),E([d({type:String,attribute:`icon-name`})],Xt.prototype,`iconName`,void 0),E([d({type:String,attribute:`orientation`,reflect:!0})],Xt.prototype,`orientation`,void 0),E([d({type:String,attribute:`variant`,reflect:!0})],Xt.prototype,`variant`,void 0),E([d({type:Boolean})],Xt.prototype,`closable`,void 0),E([d({type:Boolean,reflect:!0})],Xt.prototype,`collapsible`,void 0),E([d({type:Boolean,reflect:!0})],Xt.prototype,`collapsed`,void 0),E([d({type:String,attribute:`toggle-interaction`})],Xt.prototype,`toggleInteraction`,void 0),Xt=E([T(`ixfx-titlebar`)],Xt);function Zt(e,n){return`${e.trim()}.${n}`}function Qt(e,n,r){return Math.min(r,Math.max(n,e))}let $t=class extends n{constructor(...e){super(...e),this.open=!1,this.height=320,this.minHeight=160,this.dismissThreshold=96,this.maxHeightRatio=.85,this.label=`Drawer`,this.iconName=``,this.closable=!0,this.collapsible=!0,this.maintainHandle=!1,this.name=``,this.#e=0,this.#t=0,this.#n=!1,this.#a=``,this.#o=[],this.#m=e=>{if(e.button!==0)return;e.preventDefault();let n=e.currentTarget;if(n.setPointerCapture(e.pointerId),!this.open){this.#n=!1,this.#e=e.clientY,this.#t=this.dismissThreshold,n.addEventListener(`pointermove`,this.#v),n.addEventListener(`pointerup`,this.#y,{once:!0}),n.addEventListener(`pointercancel`,this.#y,{once:!0});return}this.#e=e.clientY,this.#t=this.#u(),this._dragHeight=this.#t,this.toggleAttribute(`resizing`,!0),n.addEventListener(`pointermove`,this.#h),n.addEventListener(`pointerup`,this.#g,{once:!0}),n.addEventListener(`pointercancel`,this.#g,{once:!0})},this.#h=e=>{this._dragHeight=Qt(this.#t+this.#e-e.clientY,0,this.#l())},this.#g=e=>{let n=e.currentTarget;n.removeEventListener(`pointermove`,this.#h),n.removeEventListener(`pointerup`,this.#g),n.removeEventListener(`pointercancel`,this.#g),n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),this.toggleAttribute(`resizing`,!1);let r=this._dragHeight??this.height;if(this._dragHeight=void 0,r<this.dismissThreshold){this.close();return}this.#p(r)},this.#_=e=>{if(!this.open){(e.key===`ArrowUp`||e.key===`Enter`||e.key===` `||e.key===`Home`||e.key===`End`)&&(e.preventDefault(),this.show());return}let n=e.shiftKey?64:16;e.key===`ArrowUp`?(e.preventDefault(),this.#p(this.height+n)):e.key===`ArrowDown`?(e.preventDefault(),this.height-n<this.dismissThreshold?this.close():this.#p(this.height-n)):e.key===`Home`?(e.preventDefault(),this.#p(this.minHeight)):e.key===`End`&&(e.preventDefault(),this.#p(this.#l()))},this.#v=e=>{let n=this.#e-e.clientY;if(!this.#n){if(n<4)return;this.#n=!0,this.show(),this.toggleAttribute(`resizing`,!0)}this._dragHeight=Qt(this.#t+this.#e-e.clientY,0,this.#l())},this.#y=e=>{let n=e.currentTarget;if(n.removeEventListener(`pointermove`,this.#v),n.removeEventListener(`pointerup`,this.#y),n.removeEventListener(`pointercancel`,this.#y),n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),!this.#n){this.show();return}this.#n=!1,this.toggleAttribute(`resizing`,!1);let r=this._dragHeight??this.height;if(this._dragHeight=void 0,r<this.dismissThreshold){this.close();return}this.#p(r)},this.#b=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.close())}}static{this.styles=[w,Yt,r`
|
|
1918
1918
|
:host {
|
|
1919
1919
|
--bottom-drawer-background: color-mix(in srgb, var(--surface-2) 84%, transparent);
|
|
1920
1920
|
--bottom-drawer-border: 1px solid color-mix(in srgb, var(--surface-2-text) 14%, transparent);
|
|
@@ -2060,7 +2060,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2060
2060
|
transition-duration: 0s;
|
|
2061
2061
|
}
|
|
2062
2062
|
}
|
|
2063
|
-
`]}#e;#t;#n;#r;#i;#a;#o;connectedCallback(){super.connectedCallback(),this.#s()}disconnectedCallback(){super.disconnectedCallback(),this.#c(),this.#r!==void 0&&(this.registry===this.#r&&(this.registry=void 0),this.#r=void 0)}updated(e){super.updated(e),(e.has(`name`)||e.has(`registry`))&&this.#s()}show(){this.open=!0}close(){this.open&&(this.open=!1,this.dispatchEvent(new CustomEvent(`drawer-close`,{bubbles:!0,composed:!0})))}toggle(){this.open?this.close():this.show()}#s(){let e=this.name.trim(),n=this.registry??this.#r;if(e!==``&&this.isConnected&&n!==void 0&&this.#i===n&&this.#a===e||(this.#c(),e===``||!this.isConnected))return;let r=this.registry??(this.#r??=
|
|
2063
|
+
`]}#e;#t;#n;#r;#i;#a;#o;connectedCallback(){super.connectedCallback(),this.#s()}disconnectedCallback(){super.disconnectedCallback(),this.#c(),this.#r!==void 0&&(this.registry===this.#r&&(this.registry=void 0),this.#r=void 0)}updated(e){super.updated(e),(e.has(`name`)||e.has(`registry`))&&this.#s()}show(){this.open=!0}close(){this.open&&(this.open=!1,this.dispatchEvent(new CustomEvent(`drawer-close`,{bubbles:!0,composed:!0})))}toggle(){this.open?this.close():this.show()}#s(){let e=this.name.trim(),n=this.registry??this.#r;if(e!==``&&this.isConnected&&n!==void 0&&this.#i===n&&this.#a===e||(this.#c(),e===``||!this.isConnected))return;let r=this.registry??(this.#r??=Jt());this.#r!==void 0&&r!==this.#r&&(this.#r=void 0),this.registry===void 0&&(this.registry=r);let i=[],a=[{command:`expand`,label:`Expand ${this.label}`,description:`Open the ${this.label} drawer`,execute:()=>this.show()},{command:`collapse`,label:`Collapse ${this.label}`,description:`Close the ${this.label} drawer`,execute:()=>this.close()},{command:`toggle`,label:`Toggle ${this.label}`,description:`Open the ${this.label} drawer if closed, close it if open`,execute:()=>this.toggle()}];for(let{command:n,label:o,description:s,execute:c}of a){let a=Zt(e,n);r.has(a)||(r.register({id:a,label:o,description:s,execute:c}),i.push(a))}this.#i=r,this.#a=e,this.#o=i}#c(){if(this.#i!==void 0){for(let e of this.#o)this.#i.unregister(e);this.#i=void 0,this.#a=``,this.#o=[]}}_onTitlebarToggle(e){e.stopPropagation(),e.detail.collapsed?this.close():this.open=!0}_onTitlebarClose(e){e.stopPropagation(),this.close()}render(){let e=this.#u(),n=this.#l(),r=this.#f(e),a=this.open?e*(1-r)+20*r:20,o=this.maintainHandle&&this.open?1:this.#d(e);return i`
|
|
2064
2064
|
<section
|
|
2065
2065
|
class="drawer"
|
|
2066
2066
|
style=${`--bottom-drawer-height: ${a}px; --bottom-drawer-opacity: ${o}; --m: ${r}`}
|
|
@@ -2094,7 +2094,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2094
2094
|
</ixfx-titlebar>
|
|
2095
2095
|
<div class="body" ?inert=${!this.open}><slot></slot></div>
|
|
2096
2096
|
</section>
|
|
2097
|
-
`}#l(){let e=this.clientHeight||this.height;return Math.max(this.minHeight,e
|
|
2097
|
+
`}#l(){let e=this.clientHeight||this.height;return Math.max(this.minHeight,e*Qt(this.maxHeightRatio,0,1))}#u(){return Qt(this._dragHeight??this.height,0,this.#l())}#d(e){if(this._dragHeight===void 0||e>=this.minHeight)return 1;let n=this.minHeight-this.dismissThreshold;return n<=0?+(e>=this.dismissThreshold):Qt((e-this.dismissThreshold)/n,0,1)}#f(e){if(!this.open)return+!!this.maintainHandle;if(this._dragHeight===void 0||!this.maintainHandle)return 0;let n=this.minHeight-this.dismissThreshold;return n<=0?+(e<this.dismissThreshold):Qt((this.minHeight-e)/n,0,1)}#p(e){this.height=Qt(e,this.minHeight,this.#l()),this.dispatchEvent(new CustomEvent(`drawer-resize`,{detail:{height:this.height},bubbles:!0,composed:!0}))}#m;#h;#g;#_;#v;#y;#b};E([d({type:Boolean,reflect:!0})],$t.prototype,`open`,void 0),E([d({type:Number})],$t.prototype,`height`,void 0),E([d({type:Number,attribute:`min-height`})],$t.prototype,`minHeight`,void 0),E([d({type:Number,attribute:`dismiss-threshold`})],$t.prototype,`dismissThreshold`,void 0),E([d({type:Number,attribute:`max-height-ratio`})],$t.prototype,`maxHeightRatio`,void 0),E([d({type:String})],$t.prototype,`label`,void 0),E([d({type:String,attribute:`icon-name`})],$t.prototype,`iconName`,void 0),E([d({type:Boolean})],$t.prototype,`closable`,void 0),E([d({type:Boolean})],$t.prototype,`collapsible`,void 0),E([d({type:Boolean,attribute:`maintain-handle`,reflect:!0})],$t.prototype,`maintainHandle`,void 0),E([d({type:String})],$t.prototype,`name`,void 0),E([d({attribute:!1})],$t.prototype,`registry`,void 0),E([m()],$t.prototype,`_dragHeight`,void 0),$t=E([T(`ixfx-bottom-drawer`)],$t);const en=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>`,tn=`<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="m9 18 6-6-6-6"/></svg>`,nn=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>`,rn=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`;function an(){_e(`chevron-down`,en),_e(`chevron-right`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>`),_e(`caret-right`,tn),_e(`check`,nn),_e(`close`,rn),_e(`file`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>`),_e(`folder`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`),_e(`search`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`),_e(`add`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`),_e(`error`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>`),_e(`folder-up`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 9V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1"/><path d="M12 10v6"/><path d="m9 13 3-3 3 3"/></svg>`),_e(`info`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>`),_e(`warning`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>`),_e(`chevron-up`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 15-6-6-6 6"/></svg>`),_e(`chevron-left`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>`),_e(`ellipsis-vertical`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>`),_e(`ellipsis`,`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="19" cy="12" r="1"/></svg>`)}an();const on=r`
|
|
2098
2098
|
:host {
|
|
2099
2099
|
--prominence-idle-opacity: 0.6;
|
|
2100
2100
|
--prominence-idle-saturate: 0.4;
|
|
@@ -2103,8 +2103,8 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2103
2103
|
--prominence-disabled-opacity: 0.3;
|
|
2104
2104
|
--prominence-disabled-saturate: 0.1;
|
|
2105
2105
|
}
|
|
2106
|
-
`,
|
|
2107
|
-
${
|
|
2106
|
+
`,sn=r`
|
|
2107
|
+
${on}
|
|
2108
2108
|
|
|
2109
2109
|
:host {
|
|
2110
2110
|
filter:
|
|
@@ -2134,7 +2134,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2134
2134
|
pointer-events: none;
|
|
2135
2135
|
}
|
|
2136
2136
|
`;r`
|
|
2137
|
-
${
|
|
2137
|
+
${on}
|
|
2138
2138
|
|
|
2139
2139
|
.prominence {
|
|
2140
2140
|
filter:
|
|
@@ -2162,7 +2162,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2162
2162
|
saturate(var(--prominence-disabled-saturate));
|
|
2163
2163
|
pointer-events: none;
|
|
2164
2164
|
}
|
|
2165
|
-
`;const
|
|
2165
|
+
`;const cn=r`
|
|
2166
2166
|
:host {
|
|
2167
2167
|
display: inline-flex;
|
|
2168
2168
|
max-width: 100%;
|
|
@@ -2266,7 +2266,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2266
2266
|
outline: var(--ixfx-button-toggle-outline-width, 2px) solid var(--ixfx-button-toggle-outline-color, oklch(from var(--accent, #666) l c calc(h + 130)));
|
|
2267
2267
|
outline-offset: var(--ixfx-button-toggle-outline-offset, 2px);
|
|
2268
2268
|
}
|
|
2269
|
-
`;let
|
|
2269
|
+
`;let ln=class extends n{constructor(...e){super(...e),this.disabled=!1,this.hideIcon=!1,this.hideLabel=!1,this.hasIcon=!1,this.subtle=!1,this.toggleable=!1,this.value=!1,this.type=`button`,this.#e=this.attachInternals?.(),this.#t=!1,this.#n=()=>{if(this.disabled||this.#t)return;this.toggleable&&(this.value=!this.value,this.dispatchEvent(new CustomEvent(`toggle`,{detail:{value:this.value},bubbles:!0,composed:!0})));let e=this.#e?.form??this.closest(`form`);this.type===`submit`?e?.requestSubmit():this.type===`reset`&&e?.reset()}}static{this.formAssociated=!0}#e;#t;formDisabledCallback(e){this.#t=e,this.requestUpdate()}#n;_renderIcon(){return this.hideIcon||!this.icon?a:this.icon.startsWith(`<svg`)?i`<span class="button-icon">${g(this.icon)}</span>`:xe(this.icon)?i`<ixfx-icon class="button-icon" name="${this.icon}"></ixfx-icon>`:a}render(){this.hasIcon=!this.hideIcon&&!!this.icon;let e=this.hideLabel?a:i`<span class="button-label"><slot></slot></span>`;return i`<button ?disabled=${this.disabled||this.#t} @click=${this.#n}>${this._renderIcon()}${e}</button>`}static{this.styles=[sn,cn]}};E([d({type:Boolean})],ln.prototype,`disabled`,void 0),E([d({type:String})],ln.prototype,`icon`,void 0),E([d({type:Boolean,attribute:`hide-icon`,reflect:!0})],ln.prototype,`hideIcon`,void 0),E([d({type:Boolean,attribute:`hide-label`,reflect:!0})],ln.prototype,`hideLabel`,void 0),E([d({type:Boolean,attribute:`has-icon`,reflect:!0})],ln.prototype,`hasIcon`,void 0),E([d({type:Boolean,reflect:!0})],ln.prototype,`subtle`,void 0),E([d({type:Boolean,reflect:!0})],ln.prototype,`toggleable`,void 0),E([d({type:Boolean,reflect:!0})],ln.prototype,`value`,void 0),E([d({type:String,reflect:!0})],ln.prototype,`type`,void 0),ln=E([T(`ixfx-button`)],ln);let un=class extends n{constructor(...e){super(...e),this.value=``,this.orientation=`horizontal`,this.items=[],this.name=``,this.mode=`compact`,this.checked=!1,this.valueOff=``,this.iconName=``,this.iconNameOff=``,this.hideLabels=!1,this._computedItems=[],this._icons=new Map}get _isSingleToggle(){return this._computedItems.length===0&&!!this.textContent?.trim()}get _singleToggleIconName(){return!this.iconName&&!this.iconNameOff?null:this.checked?this.iconName:this.iconNameOff||this.iconName}firstUpdated(){this.#e()}updated(e){if(e.has(`checked`)){let e=this.shadowRoot?.querySelector(`.radio-toggle-input`);if(e&&e.checked!==this.checked){e.checked=this.checked;let n=this.checked?this.value||`on`:this.valueOff||void 0;this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this.checked,value:n},bubbles:!0,composed:!0}))}}if(e.has(`value`)&&!this._isSingleToggle){let e=this.shadowRoot?.querySelectorAll(`.radio-input`);if(e)for(let n of e)n.checked!==(n.value===this.value)&&(n.checked=n.value===this.value)}}#e(){let e=this.querySelectorAll(`option`),n=new Map;e.length>0?(this._computedItems=Array.from(e,e=>{let r=document.createElement(`div`);r.innerHTML=e.innerHTML;let i=r.querySelector(`svg`);return i&&n.set(e.getAttribute(`value`)||``,i.outerHTML),{value:e.getAttribute(`value`)||``,label:e.textContent?.trim()||``,disabled:e.hasAttribute(`disabled`),iconName:e.getAttribute(`icon-name`)||void 0,iconNameOff:e.getAttribute(`icon-name-off`)||void 0}}),this._icons=n):this._computedItems=[...this.items]}#t(e){e.stopImmediatePropagation();let n=e.target;this.value=n.value,this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:!0,value:n.value},bubbles:!0,composed:!0}))}#n(e){e.stopImmediatePropagation();let n=e.target;this.checked=n.checked;let r=this.checked?this.value||`on`:this.valueOff||void 0;this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this.checked,value:r},bubbles:!0,composed:!0}))}render(){if(this._isSingleToggle){let e=this._singleToggleIconName,n=e||this.hideLabels?i`<ixfx-icon class="radio-icon" name="${e||`check`}"></ixfx-icon>`:null,r=this.hideLabels?null:i`<span class="radio-label" data-text="${this.textContent?.trim()}">${this.textContent?.trim()}</span>`;return i`
|
|
2270
2270
|
<label class="radio-item ${this.checked?`selected`:``}">
|
|
2271
2271
|
<input
|
|
2272
2272
|
type="checkbox"
|
|
@@ -2296,7 +2296,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2296
2296
|
</label>
|
|
2297
2297
|
`})}
|
|
2298
2298
|
</div>
|
|
2299
|
-
`}static{this.styles=[w,
|
|
2299
|
+
`}static{this.styles=[w,sn,r`
|
|
2300
2300
|
:host {
|
|
2301
2301
|
display: inline-flex;
|
|
2302
2302
|
min-width: min-content;
|
|
@@ -2453,7 +2453,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2453
2453
|
.radio-group.compact.horizontal .radio-item {
|
|
2454
2454
|
padding: var(--compact-padding, 0.5rem);
|
|
2455
2455
|
}
|
|
2456
|
-
`]}};E([d({type:String})],dn.prototype,`value`,void 0),E([d({type:String})],dn.prototype,`orientation`,void 0),E([d({type:Array})],dn.prototype,`items`,void 0),E([d({type:String})],dn.prototype,`name`,void 0),E([d({type:String})],dn.prototype,`mode`,void 0),E([d({type:Boolean})],dn.prototype,`checked`,void 0),E([d({type:String,attribute:`value-off`})],dn.prototype,`valueOff`,void 0),E([d({type:String,attribute:`icon-name`})],dn.prototype,`iconName`,void 0),E([d({type:String,attribute:`icon-name-off`})],dn.prototype,`iconNameOff`,void 0),E([d({type:Boolean,attribute:`hide-labels`})],dn.prototype,`hideLabels`,void 0),E([m()],dn.prototype,`_computedItems`,void 0),E([m()],dn.prototype,`_icons`,void 0),E([f(`slot`)],dn.prototype,`_slot`,void 0),dn=E([T(`ixfx-radio-group`)],dn);const fn=`(none)`;function pn(e){return e===``?fn:e}function mn(e){return String(e??``)}function hn(e,n,r,i){return mn(typeof e==`string`?i(n,e):e(n,r))}function gn(e,n,r){let i=new Map;for(let r=0;r<e.length;r++){let a=n(e[r],r),o=i.get(a);o?o.items.push(e[r]):i.set(a,{key:a,items:[e[r]],firstIndex:r})}return[...i.values()].map(e=>({key:e.key,items:e.items,firstIndex:e.firstIndex,label:r?r(e.key,e.items):pn(e.key)}))}function _n(e,n){let r=new Set(e);return r.has(n)?r.delete(n):r.add(n),r}function vn(e){let n=e.item;if(typeof n!=`object`||!n||n instanceof Element)return;let r=n.item;return typeof r==`object`&&r?r:void 0}function yn(e){let n=e.metrics.rowHeight;return n!==void 0&&Number.isFinite(n)?Math.max(24,Math.min(36,Math.round(n))):28}function bn(e,n){let r=be(e);if(!r)return;let i=document.createElement(`span`);if(i.setAttribute(`data-icon`,``),i.setAttribute(`aria-hidden`,`true`),i.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:1.1em;height:1.1em;${n?`color:${n};`:``}`,r.kind===`svg`){i.innerHTML=r.svg;let e=i.querySelector(`svg`);e&&(e.style.width=`100%`,e.style.height=`100%`)}else{let e=Ce();e&&(i.style.fontFamily=e),i.textContent=r.char}return i}function xn(e,n){let r=yn(e),i=e.origin??e.selected[0],a=vn(i),o=typeof a?.label==`string`&&a.label.length>0?a.label:n(i),s=typeof a?.icon==`string`?a.icon:void 0,c=typeof a?.iconColor==`string`?a.iconColor:void 0,l=document.createElement(`div`);l.setAttribute(`data-preview`,`row`),l.setAttribute(`part`,`drag-preview`),l.style.cssText=`position:fixed;top:-9999px;left:-9999px;display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;height:${r}px;max-width:280px;padding:0 10px 0 8px;background:var(--surface-4, #333);color:var(--surface-4-text, #fff);border:1px solid var(--border-subtle, #555);border-radius:var(--radius-m, 8px);box-shadow:0 4px 16px rgba(0,0,0,0.3);font-family:system-ui,sans-serif;font-size:13px;white-space:nowrap;z-index:999999;pointer-events:none;`;let u=s?bn(s,c):void 0;u&&l.appendChild(u);let d=document.createElement(`span`);d.setAttribute(`data-caption`,``),d.style.cssText=`min-width:0;overflow:hidden;text-overflow:ellipsis;`,d.textContent=o,l.appendChild(d);let f=e.selected.length;if(f>1){let e=document.createElement(`span`);e.setAttribute(`data-count`,``),e.style.cssText=`flex-shrink:0;min-width:18px;height:18px;padding:0 5px;box-sizing:border-box;border-radius:9px;background:var(--accent, #4da3ff);color:var(--accent-text, #fff);font-size:11px;font-weight:600;line-height:18px;text-align:center;`,e.textContent=String(f),l.appendChild(e)}return{element:l,hotspot:{x:14,y:Math.round(r/2)},dispose:()=>{}}}const Sn=1024;function Cn(e,n,r){try{return e.getPropertyValue(n)?.trim()||r}catch{return r}}function wn(e){try{let n=e.font?.trim();if(n)return n}catch{}return`12px system-ui, sans-serif`}function Tn(e){let n=e.element??(e.item instanceof Element?e.item:void 0);if(n){let e=n.getAttribute(`data-label`)??n.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??n.getAttribute(`data-search-label`)??n.querySelector(`.cell`)?.textContent?.trim();if(e)return e.slice(0,80)}let r=e.item;if(typeof r==`string`&&r.length>0)return r.slice(0,80);if(typeof r==`object`&&r&&!(r instanceof Element)){let e=r;for(let n of[`label`,`name`,`title`,`text`]){let r=e[n];if(typeof r==`string`&&r.length>0)return r.slice(0,80)}}if(n){let e=n.textContent?.trim();if(e)return e.slice(0,80)}return e.key}function En(e){let n=e.trim().at(0);return n?n.toLocaleUpperCase():`?`}function Dn(e){if(e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement)return e.clientWidth>0&&e.clientHeight>0;if(e instanceof ImageBitmap)return e.width>0&&e.height>0;if(`naturalWidth`in e&&`naturalHeight`in e){let n=e;return n.naturalWidth>0&&n.naturalHeight>0}return!0}function On(e,n){if(n)try{let r=n(e);if(r&&Dn(r))return r}catch{}return kn(e)}function kn(e){let n=e.element??(e.item instanceof Element?e.item:void 0);if(!(!n||typeof n.querySelector!=`function`)){if(n instanceof HTMLImageElement)return n.complete&&n.naturalWidth>0?n:void 0;try{let e=n.querySelector(`img`);if(e instanceof HTMLImageElement&&e.complete&&e.naturalWidth>0)return e}catch{}}}function An(e){return e.itemSize!==void 0&&Number.isFinite(e.itemSize)?Math.max(48,Math.min(96,Math.round(e.itemSize))):72}function jn(e){let n=e.rowHeight;return n!==void 0&&Number.isFinite(n)?Math.max(24,Math.min(36,Math.round(n))):28}function Mn(e,n,r,i){let a=e.createElement(`div`);if(a.setAttribute(`data-thumb`,``),a.style.cssText=`width:${i}px;height:${i}px;border-radius:4px;overflow:hidden;background:var(--surface-5, rgba(128,128,128,0.25));flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:${Math.round(i*.4)}px;font-weight:600;`,r instanceof HTMLImageElement)try{let e=r.cloneNode(!0);e.style.cssText=`width:100%;height:100%;object-fit:cover;`,e.removeAttribute(`id`),a.appendChild(e)}catch{a.textContent=En(n)}else a.textContent=En(n);return a}function Nn(e,n,r){let i=document,a=An(e.metrics),o=i.createElement(`div`);o.setAttribute(`data-preview`,`cards`),o.setAttribute(`part`,`drag-preview`),o.style.cssText=`position:fixed;top:-9999px;left:-9999px;display:flex;flex-direction:row;gap:6px;padding:8px;background:var(--surface-4, #333);color:var(--surface-4-text, #fff);border:1px solid var(--border-subtle, #555);border-radius:var(--radius-m, 8px);box-shadow:0 4px 16px rgba(0,0,0,0.3);font-family:system-ui,sans-serif;font-size:11px;max-width:320px;z-index:999999;pointer-events:none;`;let s=e.selected.length;for(let e=0;e<s;e++){let s=i.createElement(`div`);s.setAttribute(`data-card`,``),s.style.cssText=`display:flex;flex-direction:column;gap:4px;align-items:center;width:${a}px;`,s.appendChild(Mn(i,n[e],r[e],Math.round(a*.72)));let c=i.createElement(`span`);c.setAttribute(`data-caption`,``),c.style.cssText=`max-width:${a}px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:0.9;`,c.textContent=n[e],s.appendChild(c),o.appendChild(s)}return o}function Pn(e,n,r){let i=document,a=jn(e.metrics),o=Math.round(a*.78),s=i.createElement(`div`);s.setAttribute(`data-preview`,`list`),s.setAttribute(`part`,`drag-preview`),s.style.cssText=`position:fixed;top:-9999px;left:-9999px;display:flex;flex-direction:column;gap:4px;padding:8px;background:var(--surface-4, #333);color:var(--surface-4-text, #fff);border:1px solid var(--border-subtle, #555);border-radius:var(--radius-m, 8px);box-shadow:0 4px 16px rgba(0,0,0,0.3);font-family:system-ui,sans-serif;font-size:12px;width:220px;max-width:220px;z-index:999999;pointer-events:none;`;let c=i.createElement(`div`);c.setAttribute(`data-header`,``),c.style.cssText=`font-weight:600;padding-bottom:4px;border-bottom:1px solid var(--border-subtle, #555);margin-bottom:4px;`,c.textContent=`${e.selected.length} items`,s.appendChild(c);for(let e=0;e<Math.min(5,n.length);e++){let c=i.createElement(`div`);c.setAttribute(`data-row`,``),c.style.cssText=`display:flex;align-items:center;gap:6px;height:${a}px;overflow:hidden;`,c.appendChild(Mn(i,n[e],r[e],o));let l=i.createElement(`span`);l.setAttribute(`data-caption`,``),l.style.cssText=`flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`,l.textContent=n[e],c.appendChild(l),s.appendChild(c)}if(n.length>5){let e=i.createElement(`div`);e.setAttribute(`data-more`,``),e.style.cssText=`opacity:0.6;text-align:center;`,e.textContent=`+${n.length-5} more`,s.appendChild(e)}return s}function Fn(e){let n=Cn(e,`--surface-4`,`#333333`),r=Cn(e,`--surface-4-text`,`#ffffff`),i=Cn(e,`--border-subtle`,`#555555`),a=Cn(e,`--accent`,`#4da3ff`),o=Cn(e,`--radius-m`,`8`);return{bg:n,fg:r,subtle:i,accent:a,radius:Number.parseFloat(o)||8,font:wn(e)}}function In(e,n,r){let i=Math.max(1,Math.min(3,typeof devicePixelRatio==`number`&&devicePixelRatio>0?devicePixelRatio:1)),a=Sn/Math.max(1,n),o=Sn/Math.max(1,r);return i=Math.min(i,a,o),e.width=Math.max(1,Math.round(n*i)),e.height=Math.max(1,Math.round(r*i)),e.style.width=`${n}px`,e.style.height=`${r}px`,{scale:i,dpr:i}}function Ln(e,n,r,i,a,o){let s=Math.max(0,Math.min(o,i/2,a/2));if(typeof e.roundRect==`function`){e.beginPath(),e.roundRect(n,r,i,a,s);return}e.beginPath(),e.moveTo(n+s,r),e.arcTo(n+i,r,n+i,r+a,s),e.arcTo(n+i,r+a,n,r+a,s),e.arcTo(n,r+a,n,r,s),e.arcTo(n,r,n+i,r,s),e.closePath()}function Rn(e,n,r,i,a,o,s,c){e.save(),e.scale(n,n),Ln(e,0,0,s,c,r.radius),e.fillStyle=r.bg,e.fill(),e.strokeStyle=r.subtle,e.lineWidth=1,e.stroke(),e.clip();let l=Math.round(o*.72);e.font=r.font,e.textBaseline=`middle`;for(let n=0;n<i.length;n++){let s=8+n*(o+6),c=s+(o-l)/2;Ln(e,c,8,l,l,4),e.fillStyle=r.subtle,e.globalAlpha=.35,e.fill(),e.globalAlpha=1;let u=a[n];if(u)try{e.save(),e.clip(),e.drawImage(u,c,8,l,l),e.restore()}catch{}else e.fillStyle=r.fg,e.globalAlpha=.9,e.font=`600 ${Math.round(l*.4)}px system-ui, sans-serif`,e.textAlign=`center`,e.fillText(En(i[n]),c+l/2,8+l/2+1),e.globalAlpha=1,e.textAlign=`left`,e.font=r.font;e.fillStyle=r.fg,e.globalAlpha=.9,e.font=r.font;let d=i[n].length>12?`${i[n].slice(0,11)}…`:i[n],f=e.measureText(d).width;e.fillText(d,s+(o-Math.min(o,f))/2,8+l+10,o),e.globalAlpha=1}e.restore()}function zn(e,n,r,i,a,o,s,c){e.save(),e.scale(n,n),Ln(e,0,0,s,c,r.radius),e.fillStyle=r.bg,e.fill(),e.strokeStyle=r.subtle,e.lineWidth=1,e.stroke(),e.clip(),e.fillStyle=r.fg,e.font=`600 ${r.font}`,e.textBaseline=`middle`,e.fillText(`${i.length} items`,8,16,s-16),e.strokeStyle=r.subtle,e.beginPath(),e.moveTo(8,28),e.lineTo(s-8,28),e.stroke();let l=Math.round(o*.78),u=Math.min(5,i.length);e.font=r.font;for(let n=0;n<u;n++){let c=32+n*o;Ln(e,8,c+(o-l)/2,l,l,4),e.fillStyle=r.subtle,e.globalAlpha=.35,e.fill(),e.globalAlpha=1;let u=a[n];if(u)try{e.save(),e.clip(),e.drawImage(u,8,c+(o-l)/2,l,l),e.restore()}catch{}else e.fillStyle=r.fg,e.font=`600 ${Math.round(l*.45)}px system-ui, sans-serif`,e.textAlign=`center`,e.fillText(En(i[n]),8+l/2,c+o/2+1),e.textAlign=`left`,e.font=r.font;e.fillStyle=r.fg,e.globalAlpha=.92;let d=s-16-l-6;e.fillText(i[n],8+l+6,c+o/2+1,Math.max(8,d)),e.globalAlpha=1}i.length>5&&(e.fillStyle=r.fg,e.globalAlpha=.6,e.textAlign=`center`,e.fillText(`+${i.length-5} more`,s/2,c-8-6,s-16),e.textAlign=`left`,e.globalAlpha=1),e.restore()}function Bn(e){let n=e;if(n.source===`tree-list`)return xn(n,Tn);let r=n.selected,i=r.map(e=>Tn(e)),a=r.map(e=>On(e,n.resolveDragPreviewSource)),o=r.length<=5,s,c,l;if(o){let e=An(n.metrics);c=r.length*e+Math.max(0,r.length-1)*6+16,l=Math.round(e*.72)+22+16,s=Nn(n,i,a)}else{let e=jn(n.metrics),o=Math.min(5,r.length),u=r.length>5?18:0;c=236,l=40+o*e+u,s=Pn(n,i,a)}let u;try{let e=document.createElement(`canvas`),r=e.getContext(`2d`);if(r){let{scale:s}=In(e,c,l),d=Fn(n.hostStyle);o?Rn(r,s,d,i,a,An(n.metrics),c,l):zn(r,s,d,i,a,jn(n.metrics),c,l),u=e}}catch{u=void 0}return{element:s,hotspot:{x:16,y:16},...u?{canvas:u}:{},dispose:()=>{}}}const Vn=[`mouse`,`pen`];var Hn=class{#e;#t;#n;#r;#i=0;#a=0;#o=0;#s=0;#c=0;#l=0;#u={shiftKey:!1,ctrlKey:!1,metaKey:!1};#d=!1;#f=!1;#p=new Set;#m=`replace`;#h=new Set;#g=0;constructor(e,n){this.#e=e,this.#t=n,e.addController(this)}get isDragging(){return this.#d||this.#f}get isActive(){return this.#d}hostConnected(){this.#v(),window.addEventListener(`pointermove`,this.#w),window.addEventListener(`pointerup`,this.#O),window.addEventListener(`pointercancel`,this.#k)}hostDisconnected(){this.#y(),window.removeEventListener(`pointermove`,this.#w),window.removeEventListener(`pointerup`,this.#O),window.removeEventListener(`pointercancel`,this.#k),this.#M(),this.#N()}hostUpdated(){(this.#_()??this.#e)!==this.#n&&this.#v()}#_(){try{return this.#t.getSurface()}catch{return}}#v(){let e=this.#_()??this.#e;e!==this.#n&&(this.#y(),this.#n=e,e.addEventListener(`pointerdown`,this.#S))}#y(){this.#n?.removeEventListener(`pointerdown`,this.#S),this.#n=void 0}#b(){return this.#t.pointerTypes??Vn}#x(){return this.#t.threshold??4}#S=e=>{if(e.button!==0||!this.#b().includes(e.pointerType))return;let n=!1;try{n=this.#t.isEnabled()}catch{return}if(!n)return;let r=e.target;if(r instanceof Element&&typeof r.closest==`function`&&r.closest(`input,button,a,select,textarea,[contenteditable]`))return;if(this.#t.shouldStart)try{if(!this.#t.shouldStart(e))return}catch{return}let i=(this.#_()??this.#e).getBoundingClientRect();this.#r=e.pointerId,this.#i=e.clientX,this.#a=e.clientY,this.#c=e.clientX,this.#l=e.clientY,this.#o=Math.min(Math.max(e.clientX-i.left,0),Math.max(0,i.width)),this.#s=Math.min(Math.max(e.clientY-i.top,0),Math.max(0,i.height)),this.#d=!1,this.#f=!1,this.#p=new Set,this.#m=`replace`,this.#u={shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey}};#C(e){return e.metaKey||e.ctrlKey?`invert`:e.shiftKey?`add`:`replace`}#w=e=>{if(this.#r===void 0||e.pointerId!==this.#r)return;this.#c=e.clientX,this.#l=e.clientY,this.#u={shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey};let n=Math.hypot(e.clientX-this.#i,e.clientY-this.#a);if(!this.#d){if(n<this.#x())return;this.#d=!0;try{this.#p=new Set(this.#t.getBaseSelection())}catch{this.#p=new Set}let r=this.#_()??this.#e;try{typeof r.setPointerCapture==`function`&&r.setPointerCapture(e.pointerId)}catch{}}try{e.preventDefault?.()}catch{}this.#D(),this.#A()};#T(){let e=this.#_()??this.#e;try{return e.getBoundingClientRect()}catch{return}}#E(){let e=this.#T();if(!e)return;let n=Math.min(Math.max(this.#c-e.left,0),Math.max(0,e.width)),r=Math.min(Math.max(this.#l-e.top,0),Math.max(0,e.height));return{x:Math.min(this.#o,n),y:Math.min(this.#s,r),width:Math.abs(n-this.#o),height:Math.abs(r-this.#s)}}#D(){let e=this.#E();if(!e)return;let n=[];try{n=this.#t.hitTest(e)}catch{n=[]}let r=this.#C(this.#u);this.#m=r;let i=new Set(n),a;if(r===`add`)a=new Set([...this.#p,...i]);else if(r===`invert`){let e=new Set(this.#p);for(let n of i)e.has(n)?e.delete(n):e.add(n);a=e}else a=i;this.#h=a;try{this.#t.onPreview(a,e)}catch{}}#O=e=>{if(this.#r===void 0||e.pointerId!==this.#r)return;this.#u={shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey};let n=this.#d,r=this.#_()??this.#e;try{typeof r.hasPointerCapture==`function`&&typeof r.releasePointerCapture==`function`&&r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId)}catch{}if(this.#M(),this.#r=void 0,!n){this.#N();return}this.#d=!1;let i=this.#h;try{this.#t.onCommit(i,{additive:this.#m!==`replace`})}catch{}try{this.#t.onPreview(new Set,void 0)}catch{}this.#h=new Set,this.#f=!0,window.setTimeout(()=>{this.#f=!1},0)};#k=e=>{if(this.#r!==void 0&&e.pointerId===this.#r){this.#M(),this.#r=void 0,this.#d=!1,this.#h=new Set;try{this.#t.onPreview(new Set,void 0)}catch{}this.#f=!1}};#A(){!this.#t.autoScroll||this.#g!==0||(this.#g=requestAnimationFrame(this.#j))}#j=()=>{if(this.#g=0,!this.#d||this.#r===void 0)return;let e=this.#T();if(!e)return;let n=this.#c-e.left,r=this.#l-e.top,i=0,a=0;if(n<28?i=-Math.ceil(16*(1-Math.max(0,n)/28)):n>e.width-28&&(i=Math.ceil(16*(1-Math.max(0,e.width-n)/28))),r<28?a=-Math.ceil(16*(1-Math.max(0,r)/28)):r>e.height-28&&(a=Math.ceil(16*(1-Math.max(0,e.height-r)/28))),i===0&&a===0)return;let o=this.#t.autoScroll;if(o){try{o(i,a)}catch{}this.#D(),this.#g=requestAnimationFrame(this.#j)}};#M(){this.#g!==0&&(cancelAnimationFrame(this.#g),this.#g=0)}#N(){this.#d=!1,this.#f=!1,this.#p=new Set,this.#m=`replace`,this.#h=new Set}};const Un=200;function Wn(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}const Gn=r`
|
|
2456
|
+
`]}};E([d({type:String})],un.prototype,`value`,void 0),E([d({type:String})],un.prototype,`orientation`,void 0),E([d({type:Array})],un.prototype,`items`,void 0),E([d({type:String})],un.prototype,`name`,void 0),E([d({type:String})],un.prototype,`mode`,void 0),E([d({type:Boolean})],un.prototype,`checked`,void 0),E([d({type:String,attribute:`value-off`})],un.prototype,`valueOff`,void 0),E([d({type:String,attribute:`icon-name`})],un.prototype,`iconName`,void 0),E([d({type:String,attribute:`icon-name-off`})],un.prototype,`iconNameOff`,void 0),E([d({type:Boolean,attribute:`hide-labels`})],un.prototype,`hideLabels`,void 0),E([m()],un.prototype,`_computedItems`,void 0),E([m()],un.prototype,`_icons`,void 0),E([f(`slot`)],un.prototype,`_slot`,void 0),un=E([T(`ixfx-radio-group`)],un);const dn=`(none)`;function fn(e){return e===``?dn:e}function pn(e){return String(e??``)}function mn(e,n,r,i){return pn(typeof e==`string`?i(n,e):e(n,r))}function hn(e,n,r){let i=new Map;for(let r=0;r<e.length;r++){let a=n(e[r],r),o=i.get(a);o?o.items.push(e[r]):i.set(a,{key:a,items:[e[r]],firstIndex:r})}return[...i.values()].map(e=>({key:e.key,items:e.items,firstIndex:e.firstIndex,label:r?r(e.key,e.items):fn(e.key)}))}function gn(e,n){let r=new Set(e);return r.has(n)?r.delete(n):r.add(n),r}function _n(e){let n=e.item;if(typeof n!=`object`||!n||n instanceof Element)return;let r=n.item;return typeof r==`object`&&r?r:void 0}function vn(e){let n=e.metrics.rowHeight;return n!==void 0&&Number.isFinite(n)?Math.max(24,Math.min(36,Math.round(n))):28}function yn(e,n){let r=be(e);if(!r)return;let i=document.createElement(`span`);if(i.setAttribute(`data-icon`,``),i.setAttribute(`aria-hidden`,`true`),i.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:1.1em;height:1.1em;${n?`color:${n};`:``}`,r.kind===`svg`){i.innerHTML=r.svg;let e=i.querySelector(`svg`);e&&(e.style.width=`100%`,e.style.height=`100%`)}else{let e=Ce();e&&(i.style.fontFamily=e),i.textContent=r.char}return i}function bn(e,n){let r=vn(e),i=e.origin??e.selected[0],a=_n(i),o=typeof a?.label==`string`&&a.label.length>0?a.label:n(i),s=typeof a?.icon==`string`?a.icon:void 0,c=typeof a?.iconColor==`string`?a.iconColor:void 0,l=document.createElement(`div`);l.setAttribute(`data-preview`,`row`),l.setAttribute(`part`,`drag-preview`),l.style.cssText=`position:fixed;top:-9999px;left:-9999px;display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;height:${r}px;max-width:280px;padding:0 10px 0 8px;background:var(--surface-4, #333);color:var(--surface-4-text, #fff);border:1px solid var(--border-subtle, #555);border-radius:var(--radius-m, 8px);box-shadow:0 4px 16px rgba(0,0,0,0.3);font-family:system-ui,sans-serif;font-size:13px;white-space:nowrap;z-index:999999;pointer-events:none;`;let u=s?yn(s,c):void 0;u&&l.appendChild(u);let d=document.createElement(`span`);d.setAttribute(`data-caption`,``),d.style.cssText=`min-width:0;overflow:hidden;text-overflow:ellipsis;`,d.textContent=o,l.appendChild(d);let f=e.selected.length;if(f>1){let e=document.createElement(`span`);e.setAttribute(`data-count`,``),e.style.cssText=`flex-shrink:0;min-width:18px;height:18px;padding:0 5px;box-sizing:border-box;border-radius:9px;background:var(--accent, #4da3ff);color:var(--accent-text, #fff);font-size:11px;font-weight:600;line-height:18px;text-align:center;`,e.textContent=String(f),l.appendChild(e)}return{element:l,hotspot:{x:14,y:Math.round(r/2)},dispose:()=>{}}}const xn=1024;function Sn(e,n,r){try{return e.getPropertyValue(n)?.trim()||r}catch{return r}}function Cn(e){try{let n=e.font?.trim();if(n)return n}catch{}return`12px system-ui, sans-serif`}function wn(e){let n=e.element??(e.item instanceof Element?e.item:void 0);if(n){let e=n.getAttribute(`data-label`)??n.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??n.getAttribute(`data-search-label`)??n.querySelector(`.cell`)?.textContent?.trim();if(e)return e.slice(0,80)}let r=e.item;if(typeof r==`string`&&r.length>0)return r.slice(0,80);if(typeof r==`object`&&r&&!(r instanceof Element)){let e=r;for(let n of[`label`,`name`,`title`,`text`]){let r=e[n];if(typeof r==`string`&&r.length>0)return r.slice(0,80)}}if(n){let e=n.textContent?.trim();if(e)return e.slice(0,80)}return e.key}function Tn(e){let n=e.trim().at(0);return n?n.toLocaleUpperCase():`?`}function En(e){if(e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement)return e.clientWidth>0&&e.clientHeight>0;if(e instanceof ImageBitmap)return e.width>0&&e.height>0;if(`naturalWidth`in e&&`naturalHeight`in e){let n=e;return n.naturalWidth>0&&n.naturalHeight>0}return!0}function Dn(e,n){if(n)try{let r=n(e);if(r&&En(r))return r}catch{}return On(e)}function On(e){let n=e.element??(e.item instanceof Element?e.item:void 0);if(!(!n||typeof n.querySelector!=`function`)){if(n instanceof HTMLImageElement)return n.complete&&n.naturalWidth>0?n:void 0;try{let e=n.querySelector(`img`);if(e instanceof HTMLImageElement&&e.complete&&e.naturalWidth>0)return e}catch{}}}function kn(e){return e.itemSize!==void 0&&Number.isFinite(e.itemSize)?Math.max(48,Math.min(96,Math.round(e.itemSize))):72}function An(e){let n=e.rowHeight;return n!==void 0&&Number.isFinite(n)?Math.max(24,Math.min(36,Math.round(n))):28}function jn(e,n,r,i){let a=e.createElement(`div`);if(a.setAttribute(`data-thumb`,``),a.style.cssText=`width:${i}px;height:${i}px;border-radius:4px;overflow:hidden;background:var(--surface-5, rgba(128,128,128,0.25));flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:${Math.round(i*.4)}px;font-weight:600;`,r instanceof HTMLImageElement)try{let e=r.cloneNode(!0);e.style.cssText=`width:100%;height:100%;object-fit:cover;`,e.removeAttribute(`id`),a.appendChild(e)}catch{a.textContent=Tn(n)}else a.textContent=Tn(n);return a}function Mn(e,n,r){let i=document,a=kn(e.metrics),o=i.createElement(`div`);o.setAttribute(`data-preview`,`cards`),o.setAttribute(`part`,`drag-preview`),o.style.cssText=`position:fixed;top:-9999px;left:-9999px;display:flex;flex-direction:row;gap:6px;padding:8px;background:var(--surface-4, #333);color:var(--surface-4-text, #fff);border:1px solid var(--border-subtle, #555);border-radius:var(--radius-m, 8px);box-shadow:0 4px 16px rgba(0,0,0,0.3);font-family:system-ui,sans-serif;font-size:11px;max-width:320px;z-index:999999;pointer-events:none;`;let s=e.selected.length;for(let e=0;e<s;e++){let s=i.createElement(`div`);s.setAttribute(`data-card`,``),s.style.cssText=`display:flex;flex-direction:column;gap:4px;align-items:center;width:${a}px;`,s.appendChild(jn(i,n[e],r[e],Math.round(a*.72)));let c=i.createElement(`span`);c.setAttribute(`data-caption`,``),c.style.cssText=`max-width:${a}px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:0.9;`,c.textContent=n[e],s.appendChild(c),o.appendChild(s)}return o}function Nn(e,n,r){let i=document,a=An(e.metrics),o=Math.round(a*.78),s=i.createElement(`div`);s.setAttribute(`data-preview`,`list`),s.setAttribute(`part`,`drag-preview`),s.style.cssText=`position:fixed;top:-9999px;left:-9999px;display:flex;flex-direction:column;gap:4px;padding:8px;background:var(--surface-4, #333);color:var(--surface-4-text, #fff);border:1px solid var(--border-subtle, #555);border-radius:var(--radius-m, 8px);box-shadow:0 4px 16px rgba(0,0,0,0.3);font-family:system-ui,sans-serif;font-size:12px;width:220px;max-width:220px;z-index:999999;pointer-events:none;`;let c=i.createElement(`div`);c.setAttribute(`data-header`,``),c.style.cssText=`font-weight:600;padding-bottom:4px;border-bottom:1px solid var(--border-subtle, #555);margin-bottom:4px;`,c.textContent=`${e.selected.length} items`,s.appendChild(c);for(let e=0;e<Math.min(5,n.length);e++){let c=i.createElement(`div`);c.setAttribute(`data-row`,``),c.style.cssText=`display:flex;align-items:center;gap:6px;height:${a}px;overflow:hidden;`,c.appendChild(jn(i,n[e],r[e],o));let l=i.createElement(`span`);l.setAttribute(`data-caption`,``),l.style.cssText=`flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`,l.textContent=n[e],c.appendChild(l),s.appendChild(c)}if(n.length>5){let e=i.createElement(`div`);e.setAttribute(`data-more`,``),e.style.cssText=`opacity:0.6;text-align:center;`,e.textContent=`+${n.length-5} more`,s.appendChild(e)}return s}function Pn(e){let n=Sn(e,`--surface-4`,`#333333`),r=Sn(e,`--surface-4-text`,`#ffffff`),i=Sn(e,`--border-subtle`,`#555555`),a=Sn(e,`--accent`,`#4da3ff`),o=Sn(e,`--radius-m`,`8`);return{bg:n,fg:r,subtle:i,accent:a,radius:Number.parseFloat(o)||8,font:Cn(e)}}function Fn(e,n,r){let i=Math.max(1,Math.min(3,typeof devicePixelRatio==`number`&&devicePixelRatio>0?devicePixelRatio:1)),a=xn/Math.max(1,n),o=xn/Math.max(1,r);return i=Math.min(i,a,o),e.width=Math.max(1,Math.round(n*i)),e.height=Math.max(1,Math.round(r*i)),e.style.width=`${n}px`,e.style.height=`${r}px`,{scale:i,dpr:i}}function In(e,n,r,i,a,o){let s=Math.max(0,Math.min(o,i/2,a/2));if(typeof e.roundRect==`function`){e.beginPath(),e.roundRect(n,r,i,a,s);return}e.beginPath(),e.moveTo(n+s,r),e.arcTo(n+i,r,n+i,r+a,s),e.arcTo(n+i,r+a,n,r+a,s),e.arcTo(n,r+a,n,r,s),e.arcTo(n,r,n+i,r,s),e.closePath()}function Ln(e,n,r,i,a,o,s,c){e.save(),e.scale(n,n),In(e,0,0,s,c,r.radius),e.fillStyle=r.bg,e.fill(),e.strokeStyle=r.subtle,e.lineWidth=1,e.stroke(),e.clip();let l=Math.round(o*.72);e.font=r.font,e.textBaseline=`middle`;for(let n=0;n<i.length;n++){let s=8+n*(o+6),c=s+(o-l)/2;In(e,c,8,l,l,4),e.fillStyle=r.subtle,e.globalAlpha=.35,e.fill(),e.globalAlpha=1;let u=a[n];if(u)try{e.save(),e.clip(),e.drawImage(u,c,8,l,l),e.restore()}catch{}else e.fillStyle=r.fg,e.globalAlpha=.9,e.font=`600 ${Math.round(l*.4)}px system-ui, sans-serif`,e.textAlign=`center`,e.fillText(Tn(i[n]),c+l/2,8+l/2+1),e.globalAlpha=1,e.textAlign=`left`,e.font=r.font;e.fillStyle=r.fg,e.globalAlpha=.9,e.font=r.font;let d=i[n].length>12?`${i[n].slice(0,11)}…`:i[n],f=e.measureText(d).width;e.fillText(d,s+(o-Math.min(o,f))/2,8+l+10,o),e.globalAlpha=1}e.restore()}function Rn(e,n,r,i,a,o,s,c){e.save(),e.scale(n,n),In(e,0,0,s,c,r.radius),e.fillStyle=r.bg,e.fill(),e.strokeStyle=r.subtle,e.lineWidth=1,e.stroke(),e.clip(),e.fillStyle=r.fg,e.font=`600 ${r.font}`,e.textBaseline=`middle`,e.fillText(`${i.length} items`,8,16,s-16),e.strokeStyle=r.subtle,e.beginPath(),e.moveTo(8,28),e.lineTo(s-8,28),e.stroke();let l=Math.round(o*.78),u=Math.min(5,i.length);e.font=r.font;for(let n=0;n<u;n++){let c=32+n*o;In(e,8,c+(o-l)/2,l,l,4),e.fillStyle=r.subtle,e.globalAlpha=.35,e.fill(),e.globalAlpha=1;let u=a[n];if(u)try{e.save(),e.clip(),e.drawImage(u,8,c+(o-l)/2,l,l),e.restore()}catch{}else e.fillStyle=r.fg,e.font=`600 ${Math.round(l*.45)}px system-ui, sans-serif`,e.textAlign=`center`,e.fillText(Tn(i[n]),8+l/2,c+o/2+1),e.textAlign=`left`,e.font=r.font;e.fillStyle=r.fg,e.globalAlpha=.92;let d=s-16-l-6;e.fillText(i[n],8+l+6,c+o/2+1,Math.max(8,d)),e.globalAlpha=1}i.length>5&&(e.fillStyle=r.fg,e.globalAlpha=.6,e.textAlign=`center`,e.fillText(`+${i.length-5} more`,s/2,c-8-6,s-16),e.textAlign=`left`,e.globalAlpha=1),e.restore()}function zn(e){let n=e;if(n.source===`tree-list`)return bn(n,wn);let r=n.selected,i=r.map(e=>wn(e)),a=r.map(e=>Dn(e,n.resolveDragPreviewSource)),o=r.length<=5,s,c,l;if(o){let e=kn(n.metrics);c=r.length*e+Math.max(0,r.length-1)*6+16,l=Math.round(e*.72)+22+16,s=Mn(n,i,a)}else{let e=An(n.metrics),o=Math.min(5,r.length),u=r.length>5?18:0;c=236,l=40+o*e+u,s=Nn(n,i,a)}let u;try{let e=document.createElement(`canvas`),r=e.getContext(`2d`);if(r){let{scale:s}=Fn(e,c,l),d=Pn(n.hostStyle);o?Ln(r,s,d,i,a,kn(n.metrics),c,l):Rn(r,s,d,i,a,An(n.metrics),c,l),u=e}}catch{u=void 0}return{element:s,hotspot:{x:16,y:16},...u?{canvas:u}:{},dispose:()=>{}}}const Bn=[`mouse`,`pen`];var Vn=class{#e;#t;#n;#r;#i=0;#a=0;#o=0;#s=0;#c=0;#l=0;#u={shiftKey:!1,ctrlKey:!1,metaKey:!1};#d=!1;#f=!1;#p=new Set;#m=`replace`;#h=new Set;#g=0;constructor(e,n){this.#e=e,this.#t=n,e.addController(this)}get isDragging(){return this.#d||this.#f}get isActive(){return this.#d}hostConnected(){this.#v(),window.addEventListener(`pointermove`,this.#w),window.addEventListener(`pointerup`,this.#O),window.addEventListener(`pointercancel`,this.#k)}hostDisconnected(){this.#y(),window.removeEventListener(`pointermove`,this.#w),window.removeEventListener(`pointerup`,this.#O),window.removeEventListener(`pointercancel`,this.#k),this.#M(),this.#N()}hostUpdated(){(this.#_()??this.#e)!==this.#n&&this.#v()}#_(){try{return this.#t.getSurface()}catch{return}}#v(){let e=this.#_()??this.#e;e!==this.#n&&(this.#y(),this.#n=e,e.addEventListener(`pointerdown`,this.#S))}#y(){this.#n?.removeEventListener(`pointerdown`,this.#S),this.#n=void 0}#b(){return this.#t.pointerTypes??Bn}#x(){return this.#t.threshold??4}#S=e=>{if(e.button!==0||!this.#b().includes(e.pointerType))return;let n=!1;try{n=this.#t.isEnabled()}catch{return}if(!n)return;let r=e.target;if(r instanceof Element&&typeof r.closest==`function`&&r.closest(`input,button,a,select,textarea,[contenteditable]`))return;if(this.#t.shouldStart)try{if(!this.#t.shouldStart(e))return}catch{return}let i=(this.#_()??this.#e).getBoundingClientRect();this.#r=e.pointerId,this.#i=e.clientX,this.#a=e.clientY,this.#c=e.clientX,this.#l=e.clientY,this.#o=Math.min(Math.max(e.clientX-i.left,0),Math.max(0,i.width)),this.#s=Math.min(Math.max(e.clientY-i.top,0),Math.max(0,i.height)),this.#d=!1,this.#f=!1,this.#p=new Set,this.#m=`replace`,this.#u={shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey}};#C(e){return e.metaKey||e.ctrlKey?`invert`:e.shiftKey?`add`:`replace`}#w=e=>{if(this.#r===void 0||e.pointerId!==this.#r)return;this.#c=e.clientX,this.#l=e.clientY,this.#u={shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey};let n=Math.hypot(e.clientX-this.#i,e.clientY-this.#a);if(!this.#d){if(n<this.#x())return;this.#d=!0;try{this.#p=new Set(this.#t.getBaseSelection())}catch{this.#p=new Set}let r=this.#_()??this.#e;try{typeof r.setPointerCapture==`function`&&r.setPointerCapture(e.pointerId)}catch{}}try{e.preventDefault?.()}catch{}this.#D(),this.#A()};#T(){let e=this.#_()??this.#e;try{return e.getBoundingClientRect()}catch{return}}#E(){let e=this.#T();if(!e)return;let n=Math.min(Math.max(this.#c-e.left,0),Math.max(0,e.width)),r=Math.min(Math.max(this.#l-e.top,0),Math.max(0,e.height));return{x:Math.min(this.#o,n),y:Math.min(this.#s,r),width:Math.abs(n-this.#o),height:Math.abs(r-this.#s)}}#D(){let e=this.#E();if(!e)return;let n=[];try{n=this.#t.hitTest(e)}catch{n=[]}let r=this.#C(this.#u);this.#m=r;let i=new Set(n),a;if(r===`add`)a=new Set([...this.#p,...i]);else if(r===`invert`){let e=new Set(this.#p);for(let n of i)e.has(n)?e.delete(n):e.add(n);a=e}else a=i;this.#h=a;try{this.#t.onPreview(a,e)}catch{}}#O=e=>{if(this.#r===void 0||e.pointerId!==this.#r)return;this.#u={shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey};let n=this.#d,r=this.#_()??this.#e;try{typeof r.hasPointerCapture==`function`&&typeof r.releasePointerCapture==`function`&&r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId)}catch{}if(this.#M(),this.#r=void 0,!n){this.#N();return}this.#d=!1;let i=this.#h;try{this.#t.onCommit(i,{additive:this.#m!==`replace`})}catch{}try{this.#t.onPreview(new Set,void 0)}catch{}this.#h=new Set,this.#f=!0,window.setTimeout(()=>{this.#f=!1},0)};#k=e=>{if(this.#r!==void 0&&e.pointerId===this.#r){this.#M(),this.#r=void 0,this.#d=!1,this.#h=new Set;try{this.#t.onPreview(new Set,void 0)}catch{}this.#f=!1}};#A(){!this.#t.autoScroll||this.#g!==0||(this.#g=requestAnimationFrame(this.#j))}#j=()=>{if(this.#g=0,!this.#d||this.#r===void 0)return;let e=this.#T();if(!e)return;let n=this.#c-e.left,r=this.#l-e.top,i=0,a=0;if(n<28?i=-Math.ceil(16*(1-Math.max(0,n)/28)):n>e.width-28&&(i=Math.ceil(16*(1-Math.max(0,e.width-n)/28))),r<28?a=-Math.ceil(16*(1-Math.max(0,r)/28)):r>e.height-28&&(a=Math.ceil(16*(1-Math.max(0,e.height-r)/28))),i===0&&a===0)return;let o=this.#t.autoScroll;if(o){try{o(i,a)}catch{}this.#D(),this.#g=requestAnimationFrame(this.#j)}};#M(){this.#g!==0&&(cancelAnimationFrame(this.#g),this.#g=0)}#N(){this.#d=!1,this.#f=!1,this.#p=new Set,this.#m=`replace`,this.#h=new Set}};const Hn=200;function Un(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}const Wn=r`
|
|
2457
2457
|
@keyframes ixfx-list-item-in {
|
|
2458
2458
|
from { opacity: 0; }
|
|
2459
2459
|
to { opacity: 1; }
|
|
@@ -2462,7 +2462,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2462
2462
|
from { opacity: 1; }
|
|
2463
2463
|
to { opacity: 0; }
|
|
2464
2464
|
}
|
|
2465
|
-
`;function Kn(e,n){let r=e.getBoundingClientRect();return n===`inline`?r.width:r.height}function qn(e,n){if(n!==void 0)return n;let r=getComputedStyle(e).getPropertyValue(`--ixfx-list-item-move-duration`).trim();if(r){let e=Number.parseFloat(r);if(!Number.isNaN(e))return r.endsWith(`ms`)?e:r.endsWith(`s`)?e*1e3:e}return 200}function Jn(e){let n=e===`inline`?`width`:`height`,r=e===`inline`?`minWidth`:`minHeight`;return{[n]:`0px`,[r]:`0px`,opacity:0,overflow:`hidden`}}function Yn(e,n){let r=n===`inline`?`width`:`height`,i=n===`inline`?`minWidth`:`minHeight`;return{[r]:`${e}px`,[i]:`0px`,opacity:1,overflow:`hidden`}}function Xn(e,n={}){if(Wn())return;let{axis:r=`block`,easing:i=`ease`}=n,a=qn(e,n.duration),o=Kn(e,r);if(!(o<=0))return e.animate([Jn(r),Yn(o,r)],{duration:a,easing:i})}function Zn(e,n){return Object.assign(e,{animation:n})}function Qn(e,n={}){if(Wn())return;let{axis:r=`block`,easing:i=`ease`}=n,a=qn(e,n.duration),o=Kn(e,r);if(!(o<=0))return e.animate([Yn(o,r),Jn(r)],{duration:a,easing:i,fill:`forwards`})}function $n(e,n={}){let r=Qn(e,n);return r?Zn(r.finished.then(()=>void 0,()=>void 0),r):Zn(Promise.resolve(),void 0)}var er=class{#e;#t;#n=!1;#r;#i=!1;#a=new WeakSet;#o;constructor(e,n){this.#e=e,this.#t=n,e.addController(this)}get isDragging(){return this.#n}get draggableAttr(){try{return this.#t.isEnabled()?`true`:`false`}catch{return`false`}}refreshDraggable(){try{this.#t.syncLightDomDraggable?.()}catch{}}hostConnected(){this.#c(),this.#o??=new MutationObserver(()=>this.refreshDraggable());try{this.#o.observe(this.#e,{childList:!0,subtree:!0})}catch{}this.refreshDraggable()}hostUpdated(){this.#c()}hostDisconnected(){this.#l();try{this.#o?.disconnect()}catch{}this.#n=!1}#s(){return this.#e.renderRoot??this.#e}#c(){let e=this.#s();e!==this.#r&&(this.#l(),this.#r=e,e.addEventListener(`dragstart`,this.#u,{capture:!0}),e.addEventListener(`dragend`,this.#d,{capture:!0})),this.#i||(this.#i=!0,this.#e.addEventListener(`dragstart`,this.#u,{capture:!0}),this.#e.addEventListener(`dragend`,this.#d,{capture:!0}))}#l(){this.#r?.removeEventListener(`dragstart`,this.#u,{capture:!0}),this.#r?.removeEventListener(`dragend`,this.#d,{capture:!0}),this.#r=void 0,this.#i&&(this.#i=!1,this.#e.removeEventListener(`dragstart`,this.#u,{capture:!0}),this.#e.removeEventListener(`dragend`,this.#d,{capture:!0}))}#u=e=>{if(!(e instanceof DragEvent)||this.#a.has(e))return;if(this.#t.shouldStart){let n=!0;try{n=this.#t.shouldStart(e)}catch{n=!1}if(!n){try{e.preventDefault()}catch{}return}}let n=!1;try{n=this.#t.isEnabled()}catch{return}if(!n)return;let r;try{r=this.#t.resolveEventToKey(e.target)}catch{return}if(r&&this.#a.add(e),!r)return;let i;try{i=this.#t.prepareSelection(r)}catch{return}if(!i||i.selected.length===0)return;let{origin:a,selected:o}=i,s;try{s=getComputedStyle(this.#e)}catch{s=document.createElement(`div`).style}let c={};try{c=this.#t.getMetrics()??{}}catch{c={}}let l;try{l=this.#t.getDragPreviewSourceResolver?.()}catch{l=void 0}let u={source:this.#t.source,origin:a,selected:o,metrics:c,hostStyle:s,...l?{resolveDragPreviewSource:l}:{}},d;try{d=this.#t.getRenderer()}catch{d=void 0}let f;try{f=d?d(u):Bn(u)}catch{f=Bn(u)}try{document.body.appendChild(f.element)}catch{}let p={key:a.key,index:a.index,item:a.item,selectedKeys:o.map(e=>e.key),selected:o,preview:f},m=!0;try{m=this.#t.dispatch(p)}catch{m=!0}if(m){if(e.dataTransfer){try{(e.dataTransfer.effectAllowed===`none`||e.dataTransfer.effectAllowed===`uninitialized`)&&(e.dataTransfer.effectAllowed=`copyMove`)}catch{}try{this.#t.writeDataTransfer?.(e.dataTransfer,p)}catch{}}let n=f.hotspot??{x:16,y:16};try{e.dataTransfer?.setDragImage(f.element,n.x,n.y)}catch{}this.#n=!0;try{this.#t.onActiveChange(!0,a.key)}catch{}}else try{e.preventDefault()}catch{}requestAnimationFrame(()=>{try{f.element.remove()}catch{}try{f.dispose?.()}catch{}})};#d=()=>{if(this.#n){this.#n=!1;try{this.#t.onActiveChange(!1)}catch{}try{this.#t.onEnd()}catch{}}}};function tr(e){return e===`checked`||e===`sticky`||e===`vscode`||e===`standard`}var nr=class{#e;#t=new Set;#n;constructor(e){this.#e=e}get selected(){return this.#t}get selectedKeys(){let e=this.#e.getKey,n=new Set;if(e)for(let r of this.#t){let i=e(r);i!==void 0&&n.add(i)}return n}get anchor(){return this.#n}canSelectAll(){return this.canSelectMultiple()&&this.#e.getModes().selectionMode!==`none`}canSelectMultiple(){let{selectionMode:e,interactionMode:n}=this.#e.getModes();return e===`multiple`||tr(n)}replace(e){this.#e.getModes().selectionMode!==`none`&&this.#e.isSelectable(e)&&(this.#n=e,this.#s(new Set([e])))}toggle(e){let{selectionMode:n,interactionMode:r}=this.#e.getModes();if(!this.#e.isSelectable(e)||n===`none`&&r!==`checked`&&r!==`sticky`)return;let i=new Set(this.#t);if(i.has(e))i.delete(e);else{if(this.canSelectMultiple()||i.clear(),this.#i()){let n=this.#a(e);for(let e of[...i])this.#a(e)!==n&&i.delete(e)}i.add(e)}this.#s(i)}rangeTo(e){if(this.#e.getModes().selectionMode===`none`)return;if(this.#n===void 0){this.replace(e);return}let n=this.#e.getOrderedItems(),r=n.indexOf(this.#n),i=n.indexOf(e);if(r===-1||i===-1){this.replace(e);return}if(this.#i()){let r=this.#a(this.#n);if(r!==this.#a(e)){this.replace(e);return}let i=n.filter(e=>this.#a(e)===r),a=i.indexOf(this.#n),o=i.indexOf(e);if(a===-1||o===-1){this.replace(e);return}this.#s(new Set(i.slice(Math.min(a,o),Math.max(a,o)+1).filter(e=>this.#e.isSelectable(e))));return}let a=Math.min(r,i),o=Math.max(r,i);this.#s(new Set(n.slice(a,o+1).filter(e=>this.#e.isSelectable(e))))}clear(){this.#t.size!==0&&this.#s(new Set)}selectAll(){let e=this.#e.getOrderedItems();if(e.length===0)return;if(this.#i()){let n=(this.#n===void 0?null:this.#a(this.#n))??this.#e.getFallbackGroupKey?.()??null;n!==null&&(e=e.filter(e=>this.#a(e)===n))}let n=new Set(e.filter(e=>this.#e.isSelectable(e)));n.size!==0&&this.#s(n)}selectMany(e){let{selectionMode:n}=this.#e.getModes();if(n!==`multiple`)throw Error(`selectMany requires selectionMode="multiple" (current: "${n}")`);let r=this.#o(new Set([...e].filter(e=>this.#e.isSelectable(e))));r.size!==0&&(this.#n=[...r].at(-1),this.#s(r))}canDragSelect(){return this.#e.getModes().selectionMode!==`none`&&this.#r()}applyDragSelection(e){if(!this.canDragSelect())return;let n=this.#o(new Set([...e].filter(e=>this.#e.isSelectable(e))));(n.size!==0||this.#t.size!==0)&&(this.#n=[...n].at(-1),this.#s(n))}deselect(e){if(!this.#t.has(e))return;let n=new Set(this.#t);n.delete(e),this.#s(n)}#r(){let{selectionMode:e,interactionMode:n}=this.#e.getModes();return e===`multiple`||n===`checked`||n===`sticky`||n===`vscode`}selectKeys(e,n){if(this.#e.getModes().selectionMode===`none`)return;let r=new Set;for(let i of new Set(e)){let e=n(i);e!==void 0&&this.#e.isSelectable(e)&&r.add(e)}if(!this.#r()&&r.size>1){let e=[...r].at(-1);r=e===void 0?new Set:new Set([e])}this.#n=[...r].at(-1),this.#s(r)}addKeys(e,n){if(!this.#r())return;let r=new Set(this.#t),i=!1;for(let a of new Set(e)){let e=n(a);e!==void 0&&!r.has(e)&&this.#e.isSelectable(e)&&(r.add(e),i=!0)}i&&this.#s(r)}removeKeys(e,n){if(this.#t.size===0)return;let r=new Set(this.#t),i=!1;for(let a of new Set(e)){let e=n(a);e!==void 0&&r.delete(e)&&(i=!0)}i&&this.#s(r)}handleClick(e,n){let{selectionMode:r,interactionMode:i}=this.#e.getModes();if(i!==`manual`&&(r!==`none`||i===`checked`||i===`sticky`))switch(i){case`implicit`:this.replace(e);break;case`standard`:case`vscode`:n.ctrlKey||n.metaKey?(r===`multiple`||i===`vscode`)&&this.toggle(e):n.shiftKey&&(r===`multiple`||i===`vscode`)?this.rangeTo(e):this.replace(e);break;case`checked`:break;case`sticky`:this.toggle(e)}}handleSpace(e){let n=this.#e.getModes().interactionMode;n!==`manual`&&(n===`implicit`?this.replace(e):this.toggle(e))}clearAnchor(){this.#n=void 0}remap(e){this.#t.size!==0&&(this.#t=new Set([...this.#t].map(e)))}reset(){this.#t=new Set,this.#n=void 0}seed(e,n){this.#t=new Set(e),this.#n=n}#i(){return this.#e.getGroupKey!==void 0&&!(this.#e.crossGroupSelection?.()??!1)}#a(e){return this.#e.getGroupKey?.(e)??null}#o(e){if(!this.#i()||e.size===0)return new Set(e);let n=this.#e.getOrderedItems().find(n=>e.has(n))??[...e][0],r=this.#a(n);return new Set([...e].filter(e=>this.#a(e)===r))}#s(e){let n=this.#t;this.#t=e,this.#e.onChange(e,n)}},rr=class{constructor(e,n,r){this.handleKeyDown=e=>{if(this.disableKeyboardNavigation())return;let{key:n}=e;switch([`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Enter`,`Escape`].includes(n)&&this.tickled.setInputMode(`keyboard`),n){case`ArrowDown`:e.preventDefault(),this.#e();break;case`ArrowUp`:e.preventDefault(),this.#t();break;case`ArrowRight`:e.preventDefault(),this.#n();break;case`ArrowLeft`:e.preventDefault(),this.#r();break;case`Enter`:e.preventDefault(),this.#i();break;case`Escape`:e.preventDefault(),this.callbacks.onEscape?.()}},this.host=e,this.tickled=n,this.callbacks=r.callbacks,this.disableKeyboardNavigation=r.disableKeyboardNavigation??(()=>!1),e.addController(this)}hostConnected(){}hostDisconnected(){}#e(){this.tickled.handleKeyboardNavigation(`next`)}#t(){this.tickled.handleKeyboardNavigation(`previous`)}#n(){let e=this.tickled.tickledId;if(e&&!this.callbacks.isLeaf(e)){if(!this.callbacks.isExpanded(e))this.callbacks.onExpand(e),this.tickled.setTickled(e);else{let n=this.callbacks.getItems(),r=n.findIndex(n=>n.id===e);if(r!==-1&&r+1<n.length){let e=n[r+1];e.enabled!==!1&&this.tickled.setTickled(e.id)}}}}#r(){let e=this.tickled.tickledId;if(e){if(this.callbacks.isLeaf(e)){let n=this.callbacks.getParentId?.(e);n&&(this.tickled.setTickled(n),this.callbacks.isExpanded(n)&&this.callbacks.onCollapse(n))}else if(this.callbacks.isExpanded(e))this.callbacks.onCollapse(e);else{let n=this.callbacks.getParentId?.(e);n&&this.tickled.setTickled(n)}}}#i(){let e=this.tickled.tickledId;e&&(this.callbacks.onActivate(e),this.callbacks.onSelect?.(e))}};let ir=class extends n{constructor(...e){super(...e),this.tickled=new oe(this,{getItems:()=>this._getMenuItems().map((e,n)=>({id:n,enabled:!e.hasAttribute(`disabled`)})),onTickle:e=>{let n=this._getMenuItems();if(e!==void 0){let r=n[e];r.tabIndex=0,r.focus({preventScroll:!0})}},onStateChange:()=>{this._syncTickledClasses()}}),this._handleMouseOver=e=>{let n=this._getMenuItems(),r=e.composedPath(),i=n.findIndex(e=>r.includes(e));if(i!==-1){let a=n[i],o=r.indexOf(a);r.slice(0,o).some(e=>e instanceof Element&&e.tagName===`IXFX-MENU-CONTAINER`)||this.tickled.handlePointerEnter(i),e.stopPropagation()}},this._handleKeydown=e=>{let n=this._getMenuItems();if(n.length!==0)switch(e.key){case`ArrowDown`:e.preventDefault(),e.stopPropagation(),this._focusNext(n,1);break;case`ArrowUp`:e.preventDefault(),e.stopPropagation(),this._focusNext(n,-1);break;case`Home`:e.preventDefault(),e.stopPropagation(),this._focusItem(n,0);break;case`End`:e.preventDefault(),e.stopPropagation(),this._focusItem(n,n.length-1);break;case`Enter`:case` `:e.preventDefault(),e.stopPropagation(),this._activateFocusedItem(n)}}}static{this.styles=[de,w,se,r`
|
|
2465
|
+
`;function Gn(e,n){let r=e.getBoundingClientRect();return n===`inline`?r.width:r.height}function Kn(e,n){if(n!==void 0)return n;let r=getComputedStyle(e).getPropertyValue(`--ixfx-list-item-move-duration`).trim();if(r){let e=Number.parseFloat(r);if(!Number.isNaN(e))return r.endsWith(`ms`)?e:r.endsWith(`s`)?e*1e3:e}return 200}function qn(e){let n=e===`inline`?`width`:`height`,r=e===`inline`?`minWidth`:`minHeight`;return{[n]:`0px`,[r]:`0px`,opacity:0,overflow:`hidden`}}function Jn(e,n){let r=n===`inline`?`width`:`height`,i=n===`inline`?`minWidth`:`minHeight`;return{[r]:`${e}px`,[i]:`0px`,opacity:1,overflow:`hidden`}}function Yn(e,n={}){if(Un())return;let{axis:r=`block`,easing:i=`ease`}=n,a=Kn(e,n.duration),o=Gn(e,r);if(!(o<=0))return e.animate([qn(r),Jn(o,r)],{duration:a,easing:i})}function Xn(e,n){return Object.assign(e,{animation:n})}function Zn(e,n={}){if(Un())return;let{axis:r=`block`,easing:i=`ease`}=n,a=Kn(e,n.duration),o=Gn(e,r);if(!(o<=0))return e.animate([Jn(o,r),qn(r)],{duration:a,easing:i,fill:`forwards`})}function Qn(e,n={}){let r=Zn(e,n);return r?Xn(r.finished.then(()=>void 0,()=>void 0),r):Xn(Promise.resolve(),void 0)}var $n=class{#e;#t;#n=!1;#r;#i=!1;#a=new WeakSet;#o;constructor(e,n){this.#e=e,this.#t=n,e.addController(this)}get isDragging(){return this.#n}get draggableAttr(){try{return this.#t.isEnabled()?`true`:`false`}catch{return`false`}}refreshDraggable(){try{this.#t.syncLightDomDraggable?.()}catch{}}hostConnected(){this.#c(),this.#o??=new MutationObserver(()=>this.refreshDraggable());try{this.#o.observe(this.#e,{childList:!0,subtree:!0})}catch{}this.refreshDraggable()}hostUpdated(){this.#c()}hostDisconnected(){this.#l();try{this.#o?.disconnect()}catch{}this.#n=!1}#s(){return this.#e.renderRoot??this.#e}#c(){let e=this.#s();e!==this.#r&&(this.#l(),this.#r=e,e.addEventListener(`dragstart`,this.#u,{capture:!0}),e.addEventListener(`dragend`,this.#d,{capture:!0})),this.#i||(this.#i=!0,this.#e.addEventListener(`dragstart`,this.#u,{capture:!0}),this.#e.addEventListener(`dragend`,this.#d,{capture:!0}))}#l(){this.#r?.removeEventListener(`dragstart`,this.#u,{capture:!0}),this.#r?.removeEventListener(`dragend`,this.#d,{capture:!0}),this.#r=void 0,this.#i&&(this.#i=!1,this.#e.removeEventListener(`dragstart`,this.#u,{capture:!0}),this.#e.removeEventListener(`dragend`,this.#d,{capture:!0}))}#u=e=>{if(!(e instanceof DragEvent)||this.#a.has(e))return;if(this.#t.shouldStart){let n=!0;try{n=this.#t.shouldStart(e)}catch{n=!1}if(!n){try{e.preventDefault()}catch{}return}}let n=!1;try{n=this.#t.isEnabled()}catch{return}if(!n)return;let r;try{r=this.#t.resolveEventToKey(e.target)}catch{return}if(r&&this.#a.add(e),!r)return;let i;try{i=this.#t.prepareSelection(r)}catch{return}if(!i||i.selected.length===0)return;let{origin:a,selected:o}=i,s;try{s=getComputedStyle(this.#e)}catch{s=document.createElement(`div`).style}let c={};try{c=this.#t.getMetrics()??{}}catch{c={}}let l;try{l=this.#t.getDragPreviewSourceResolver?.()}catch{l=void 0}let u={source:this.#t.source,origin:a,selected:o,metrics:c,hostStyle:s,...l?{resolveDragPreviewSource:l}:{}},d;try{d=this.#t.getRenderer()}catch{d=void 0}let f;try{f=d?d(u):zn(u)}catch{f=zn(u)}try{document.body.appendChild(f.element)}catch{}let p={key:a.key,index:a.index,item:a.item,selectedKeys:o.map(e=>e.key),selected:o,preview:f},m=!0;try{m=this.#t.dispatch(p)}catch{m=!0}if(m){if(e.dataTransfer){try{(e.dataTransfer.effectAllowed===`none`||e.dataTransfer.effectAllowed===`uninitialized`)&&(e.dataTransfer.effectAllowed=`copyMove`)}catch{}try{this.#t.writeDataTransfer?.(e.dataTransfer,p)}catch{}}let n=f.hotspot??{x:16,y:16};try{e.dataTransfer?.setDragImage(f.element,n.x,n.y)}catch{}this.#n=!0;try{this.#t.onActiveChange(!0,a.key)}catch{}}else try{e.preventDefault()}catch{}requestAnimationFrame(()=>{try{f.element.remove()}catch{}try{f.dispose?.()}catch{}})};#d=()=>{if(this.#n){this.#n=!1;try{this.#t.onActiveChange(!1)}catch{}try{this.#t.onEnd()}catch{}}}};function er(e){return e===`checked`||e===`sticky`||e===`vscode`||e===`standard`}var tr=class{#e;#t=new Set;#n;constructor(e){this.#e=e}get selected(){return this.#t}get selectedKeys(){let e=this.#e.getKey,n=new Set;if(e)for(let r of this.#t){let i=e(r);i!==void 0&&n.add(i)}return n}get anchor(){return this.#n}canSelectAll(){return this.canSelectMultiple()&&this.#e.getModes().selectionMode!==`none`}canSelectMultiple(){let{selectionMode:e,interactionMode:n}=this.#e.getModes();return e===`multiple`||er(n)}replace(e){this.#e.getModes().selectionMode!==`none`&&this.#e.isSelectable(e)&&(this.#n=e,this.#s(new Set([e])))}toggle(e){let{selectionMode:n,interactionMode:r}=this.#e.getModes();if(!this.#e.isSelectable(e)||n===`none`&&r!==`checked`&&r!==`sticky`)return;let i=new Set(this.#t);if(i.has(e))i.delete(e);else{if(this.canSelectMultiple()||i.clear(),this.#i()){let n=this.#a(e);for(let e of[...i])this.#a(e)!==n&&i.delete(e)}i.add(e)}this.#s(i)}rangeTo(e){if(this.#e.getModes().selectionMode===`none`)return;if(this.#n===void 0){this.replace(e);return}let n=this.#e.getOrderedItems(),r=n.indexOf(this.#n),i=n.indexOf(e);if(r===-1||i===-1){this.replace(e);return}if(this.#i()){let r=this.#a(this.#n);if(r!==this.#a(e)){this.replace(e);return}let i=n.filter(e=>this.#a(e)===r),a=i.indexOf(this.#n),o=i.indexOf(e);if(a===-1||o===-1){this.replace(e);return}this.#s(new Set(i.slice(Math.min(a,o),Math.max(a,o)+1).filter(e=>this.#e.isSelectable(e))));return}let a=Math.min(r,i),o=Math.max(r,i);this.#s(new Set(n.slice(a,o+1).filter(e=>this.#e.isSelectable(e))))}clear(){this.#t.size!==0&&this.#s(new Set)}selectAll(){let e=this.#e.getOrderedItems();if(e.length===0)return;if(this.#i()){let n=(this.#n===void 0?null:this.#a(this.#n))??this.#e.getFallbackGroupKey?.()??null;n!==null&&(e=e.filter(e=>this.#a(e)===n))}let n=new Set(e.filter(e=>this.#e.isSelectable(e)));n.size!==0&&this.#s(n)}selectMany(e){let{selectionMode:n}=this.#e.getModes();if(n!==`multiple`)throw Error(`selectMany requires selectionMode="multiple" (current: "${n}")`);let r=this.#o(new Set([...e].filter(e=>this.#e.isSelectable(e))));r.size!==0&&(this.#n=[...r].at(-1),this.#s(r))}canDragSelect(){return this.#e.getModes().selectionMode!==`none`&&this.#r()}applyDragSelection(e){if(!this.canDragSelect())return;let n=this.#o(new Set([...e].filter(e=>this.#e.isSelectable(e))));(n.size!==0||this.#t.size!==0)&&(this.#n=[...n].at(-1),this.#s(n))}deselect(e){if(!this.#t.has(e))return;let n=new Set(this.#t);n.delete(e),this.#s(n)}#r(){let{selectionMode:e,interactionMode:n}=this.#e.getModes();return e===`multiple`||n===`checked`||n===`sticky`||n===`vscode`}selectKeys(e,n){if(this.#e.getModes().selectionMode===`none`)return;let r=new Set;for(let i of new Set(e)){let e=n(i);e!==void 0&&this.#e.isSelectable(e)&&r.add(e)}if(!this.#r()&&r.size>1){let e=[...r].at(-1);r=e===void 0?new Set:new Set([e])}this.#n=[...r].at(-1),this.#s(r)}addKeys(e,n){if(!this.#r())return;let r=new Set(this.#t),i=!1;for(let a of new Set(e)){let e=n(a);e!==void 0&&!r.has(e)&&this.#e.isSelectable(e)&&(r.add(e),i=!0)}i&&this.#s(r)}removeKeys(e,n){if(this.#t.size===0)return;let r=new Set(this.#t),i=!1;for(let a of new Set(e)){let e=n(a);e!==void 0&&r.delete(e)&&(i=!0)}i&&this.#s(r)}handleClick(e,n){let{selectionMode:r,interactionMode:i}=this.#e.getModes();if(i!==`manual`&&(r!==`none`||i===`checked`||i===`sticky`))switch(i){case`implicit`:this.replace(e);break;case`standard`:case`vscode`:n.ctrlKey||n.metaKey?(r===`multiple`||i===`vscode`)&&this.toggle(e):n.shiftKey&&(r===`multiple`||i===`vscode`)?this.rangeTo(e):this.replace(e);break;case`checked`:break;case`sticky`:this.toggle(e)}}handleSpace(e){let n=this.#e.getModes().interactionMode;n!==`manual`&&(n===`implicit`?this.replace(e):this.toggle(e))}clearAnchor(){this.#n=void 0}remap(e){this.#t.size!==0&&(this.#t=new Set([...this.#t].map(e)))}reset(){this.#t=new Set,this.#n=void 0}seed(e,n){this.#t=new Set(e),this.#n=n}#i(){return this.#e.getGroupKey!==void 0&&!(this.#e.crossGroupSelection?.()??!1)}#a(e){return this.#e.getGroupKey?.(e)??null}#o(e){if(!this.#i()||e.size===0)return new Set(e);let n=this.#e.getOrderedItems().find(n=>e.has(n))??[...e][0],r=this.#a(n);return new Set([...e].filter(e=>this.#a(e)===r))}#s(e){let n=this.#t;this.#t=e,this.#e.onChange(e,n)}},nr=class{constructor(e,n,r){this.handleKeyDown=e=>{if(this.disableKeyboardNavigation())return;let{key:n}=e;switch([`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Enter`,`Escape`].includes(n)&&this.tickled.setInputMode(`keyboard`),n){case`ArrowDown`:e.preventDefault(),this.#e();break;case`ArrowUp`:e.preventDefault(),this.#t();break;case`ArrowRight`:e.preventDefault(),this.#n();break;case`ArrowLeft`:e.preventDefault(),this.#r();break;case`Enter`:e.preventDefault(),this.#i();break;case`Escape`:e.preventDefault(),this.callbacks.onEscape?.()}},this.host=e,this.tickled=n,this.callbacks=r.callbacks,this.disableKeyboardNavigation=r.disableKeyboardNavigation??(()=>!1),e.addController(this)}hostConnected(){}hostDisconnected(){}#e(){this.tickled.handleKeyboardNavigation(`next`)}#t(){this.tickled.handleKeyboardNavigation(`previous`)}#n(){let e=this.tickled.tickledId;if(e&&!this.callbacks.isLeaf(e)){if(!this.callbacks.isExpanded(e))this.callbacks.onExpand(e),this.tickled.setTickled(e);else{let n=this.callbacks.getItems(),r=n.findIndex(n=>n.id===e);if(r!==-1&&r+1<n.length){let e=n[r+1];e.enabled!==!1&&this.tickled.setTickled(e.id)}}}}#r(){let e=this.tickled.tickledId;if(e){if(this.callbacks.isLeaf(e)){let n=this.callbacks.getParentId?.(e);n&&(this.tickled.setTickled(n),this.callbacks.isExpanded(n)&&this.callbacks.onCollapse(n))}else if(this.callbacks.isExpanded(e))this.callbacks.onCollapse(e);else{let n=this.callbacks.getParentId?.(e);n&&this.tickled.setTickled(n)}}}#i(){let e=this.tickled.tickledId;e&&(this.callbacks.onActivate(e),this.callbacks.onSelect?.(e))}};let rr=class extends n{constructor(...e){super(...e),this.tickled=new oe(this,{getItems:()=>this._getMenuItems().map((e,n)=>({id:n,enabled:!e.hasAttribute(`disabled`)})),onTickle:e=>{let n=this._getMenuItems();if(e!==void 0){let r=n[e];r.tabIndex=0,r.focus({preventScroll:!0})}},onStateChange:()=>{this._syncTickledClasses()}}),this._handleMouseOver=e=>{let n=this._getMenuItems(),r=e.composedPath(),i=n.findIndex(e=>r.includes(e));if(i!==-1){let a=n[i],o=r.indexOf(a);r.slice(0,o).some(e=>e instanceof Element&&e.tagName===`IXFX-MENU-CONTAINER`)||this.tickled.handlePointerEnter(i),e.stopPropagation()}},this._handleKeydown=e=>{let n=this._getMenuItems();if(n.length!==0)switch(e.key){case`ArrowDown`:e.preventDefault(),e.stopPropagation(),this._focusNext(n,1);break;case`ArrowUp`:e.preventDefault(),e.stopPropagation(),this._focusNext(n,-1);break;case`Home`:e.preventDefault(),e.stopPropagation(),this._focusItem(n,0);break;case`End`:e.preventDefault(),e.stopPropagation(),this._focusItem(n,n.length-1);break;case`Enter`:case` `:e.preventDefault(),e.stopPropagation(),this._activateFocusedItem(n)}}}static{this.styles=[de,w,se,r`
|
|
2466
2466
|
:host {
|
|
2467
2467
|
display: block;
|
|
2468
2468
|
}
|
|
@@ -2497,7 +2497,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2497
2497
|
>
|
|
2498
2498
|
<slot @slotchange=${this._updateIconSections}></slot>
|
|
2499
2499
|
</div>
|
|
2500
|
-
`}_getMenuItems(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return[];let n=[`IXFX-MENU-SEPARATOR`,`IXFX-MENU-HEADER`],r=[];for(let i of e.assignedElements({flatten:!0})){if(n.includes(i.tagName)||i.hasAttribute(`disabled`))continue;let e=i.getAttribute(`role`);if(e!==`none`&&e!==`presentation`){if(i.tagName===`IXFX-MENU-RADIO-GROUP`){let e=i.shadowRoot?.querySelector(`slot`);for(let n of e?.assignedElements({flatten:!0})??[])n.hasAttribute(`disabled`)||r.push(n)}else r.push(i)}}return r}_syncTickledClasses(){let e=this._getMenuItems();e.forEach((e,n)=>{if(this.tickled.isTickled(n)){e.classList.add(`tickled`),e.tabIndex=0;let n=e.shadowRoot?.querySelector(`.item`);n&&(n.style.background=`rgba(0, 0, 0, 0.06)`,n.style.borderColor=`var(--accent)`,n.style.color=`inherit`)}else{e.classList.remove(`tickled`),e.tabIndex=-1;let n=e.shadowRoot?.querySelector(`.item`);n&&(n.style.background=``,n.style.borderColor=``,n.style.color=``)}}),this.tickled.inputMode===`keyboard`&&this.tickled.tickledId!==void 0&&e[this.tickled.tickledId]?.focus()}focusFirst(){this.tickled.handleKeyboardNavigation(`first`)}_focusNext(e,n){e.length!==0&&this.tickled.handleKeyboardNavigation(n>0?`next`:`previous`)}_focusItem(e,n){if(e.length===0)return;let r=Math.max(0,Math.min(n,e.length-1));this.tickled.handleKeyboardNavigation(r)}_activateFocusedItem(e){let n=this.tickled.tickledId;if(n===void 0)return;let r=e[n];if(!r)return;let i=r.tagName;if(i!==`IXFX-MENU-SUB-TRIGGER`){if(i===`IXFX-MENU-CHECK-ITEM`){let e=r;e.checked=!e.checked,e.dispatchEvent(new CustomEvent(`command`,{detail:{command:e.command,checked:e.checked},bubbles:!0,composed:!0}));return}if(i===`IXFX-MENU-RADIO-ITEM`){r.dispatchEvent(new CustomEvent(`radio-select`,{detail:{value:r.value},bubbles:!0,composed:!0}));return}if(i===`IXFX-MENU-ITEM`){let e=r.command;e&&r.dispatchEvent(new CustomEvent(`command`,{detail:{command:e},bubbles:!0,composed:!0}));return}r.click()}}};E([d({type:String,attribute:`anchor`})],
|
|
2500
|
+
`}_getMenuItems(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return[];let n=[`IXFX-MENU-SEPARATOR`,`IXFX-MENU-HEADER`],r=[];for(let i of e.assignedElements({flatten:!0})){if(n.includes(i.tagName)||i.hasAttribute(`disabled`))continue;let e=i.getAttribute(`role`);if(e!==`none`&&e!==`presentation`){if(i.tagName===`IXFX-MENU-RADIO-GROUP`){let e=i.shadowRoot?.querySelector(`slot`);for(let n of e?.assignedElements({flatten:!0})??[])n.hasAttribute(`disabled`)||r.push(n)}else r.push(i)}}return r}_syncTickledClasses(){let e=this._getMenuItems();e.forEach((e,n)=>{if(this.tickled.isTickled(n)){e.classList.add(`tickled`),e.tabIndex=0;let n=e.shadowRoot?.querySelector(`.item`);n&&(n.style.background=`rgba(0, 0, 0, 0.06)`,n.style.borderColor=`var(--accent)`,n.style.color=`inherit`)}else{e.classList.remove(`tickled`),e.tabIndex=-1;let n=e.shadowRoot?.querySelector(`.item`);n&&(n.style.background=``,n.style.borderColor=``,n.style.color=``)}}),this.tickled.inputMode===`keyboard`&&this.tickled.tickledId!==void 0&&e[this.tickled.tickledId]?.focus()}focusFirst(){this.tickled.handleKeyboardNavigation(`first`)}_focusNext(e,n){e.length!==0&&this.tickled.handleKeyboardNavigation(n>0?`next`:`previous`)}_focusItem(e,n){if(e.length===0)return;let r=Math.max(0,Math.min(n,e.length-1));this.tickled.handleKeyboardNavigation(r)}_activateFocusedItem(e){let n=this.tickled.tickledId;if(n===void 0)return;let r=e[n];if(!r)return;let i=r.tagName;if(i!==`IXFX-MENU-SUB-TRIGGER`){if(i===`IXFX-MENU-CHECK-ITEM`){let e=r;e.checked=!e.checked,e.dispatchEvent(new CustomEvent(`command`,{detail:{command:e.command,checked:e.checked},bubbles:!0,composed:!0}));return}if(i===`IXFX-MENU-RADIO-ITEM`){r.dispatchEvent(new CustomEvent(`radio-select`,{detail:{value:r.value},bubbles:!0,composed:!0}));return}if(i===`IXFX-MENU-ITEM`){let e=r.command;e&&r.dispatchEvent(new CustomEvent(`command`,{detail:{command:e},bubbles:!0,composed:!0}));return}r.click()}}};E([d({type:String,attribute:`anchor`})],rr.prototype,`anchor`,void 0),E([d({attribute:!1})],rr.prototype,`registry`,void 0),E([d({attribute:!1})],rr.prototype,`keyboardManager`,void 0),E([f(`.popover`)],rr.prototype,`_popover`,void 0),rr=E([T(`ixfx-menu-container`)],rr);var ir;let ar=class extends n{static{ir=this}constructor(...e){super(...e),this.mode=`trigger`,this.label=``,this.iconName=``,this.placement=`bottom-start`,this.tabStop=!0,this._isOpen=!1,this._hasMenu=!1,this._hasTriggerSlot=!1,this._hasContextTarget=!1,this._anchorName=`--mt-${ir._count++}`,this._clickListener=this._handleClickOutside.bind(this),this._focusBeforeOpen=null,this._mouseHeld=!1,this._openOnRelease=!1,this._handlePopoverToggle=e=>{e.newState===`closed`&&(this._isOpen=!1,document.removeEventListener(`click`,this._clickListener),this.dispatchEvent(new CustomEvent(`menu-trigger-close`,{bubbles:!0,composed:!0})))},this._handleKeydown=e=>{this._isOpen&&(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closeMenu(),this._restoreFocus()):e.key===`Tab`&&(this._closeMenu(),this._restoreFocus()))},this._handleRelease=()=>{let e=this._openOnRelease;this._removeReleaseListeners(),e&&setTimeout(()=>this._openMenu(),0)}}static{this._count=0}connectedCallback(){super.connectedCallback(),document.addEventListener(`keydown`,this._handleKeydown),this.addEventListener(`command`,this._handleCommand),this.addEventListener(`radio-change`,this._handleRadioChange)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`keydown`,this._handleKeydown),this.removeEventListener(`command`,this._handleCommand),this.removeEventListener(`radio-change`,this._handleRadioChange),document.removeEventListener(`click`,this._clickListener),this._removeReleaseListeners()}firstUpdated(){this.style.setProperty(`--anchor-name`,this._anchorName),this._popup.addEventListener(`toggle`,this._handlePopoverToggle),this.updateComplete.then(()=>{let e=this.shadowRoot?.querySelector(`slot[name="menu"]`);e&&e.assignedElements({flatten:!0}).length>0&&(this._hasMenu=!0,this._propagateContext());let n=this.shadowRoot?.querySelector(`slot[name="context-target"]`);n&&(this._hasContextTarget=n.assignedElements({flatten:!0}).length>0),this._updatePosition()})}updated(e){(e.has(`registry`)||e.has(`keyboardManager`))&&this._propagateContext(),(e.has(`mode`)||e.has(`_hasContextTarget`))&&this.toggleAttribute(`has-context-target`,this.mode===`context`&&this._hasContextTarget),e.has(`mode`)&&this._updatePosition()}_updatePosition(){let e={"bottom-start":{insetArea:`block-end span-inline-start`},"bottom-end":{insetArea:`block-end span-inline-end`},"right-start":{insetArea:`inline-end span-block-start`}}[this.placement];this._popup.style.insetArea=e.insetArea,this._popup.style.positionAnchor=this._anchorName;let n={"bottom-start":{top:`anchor(bottom)`,left:`anchor(left)`,right:`auto`},"bottom-end":{top:`anchor(bottom)`,left:`auto`,right:`anchor(left)`},"right-start":{top:`anchor(top)`,left:`anchor(right)`,right:`auto`}}[this.placement];this._popup.style.top=n.top,this._popup.style.left=n.left,this._popup.style.right=n.right}_propagateContext(){let e=(this.shadowRoot?.querySelector(`slot[name="menu"]`))?.assignedElements({flatten:!0})??[];for(let n of e)`registry`in n&&(n.registry=this.registry),`keyboardManager`in n&&(n.keyboardManager=this.keyboardManager)}_handleSlotChange(e){let n=e.target.assignedElements({flatten:!0});this._hasMenu=n.length>0,this._propagateContext()}_handleTriggerSlotChange(e){let n=e.target;this._hasTriggerSlot=n.assignedElements({flatten:!0}).length>0}_handleContextTargetSlotChange(e){let n=e.target;this._hasContextTarget=n.assignedElements({flatten:!0}).length>0}get isOpen(){return this._isOpen}openMenu(){this._openMenu()}closeMenu(){this._closeMenu()}focusTrigger(){this._triggerBtn?.focus()}_openMenu(){if(!(this._isOpen||!this._popup?.popover)){this._focusBeforeOpen=or();try{this._popup.showPopover({source:this}),this._isOpen=!0,document.addEventListener(`click`,this._clickListener),this.dispatchEvent(new CustomEvent(`menu-trigger-open`,{bubbles:!0,composed:!0})),requestAnimationFrame(()=>{this._getMenuContainer()?.focusFirst()})}catch(e){console.warn(`showPopover failed:`,e)}}}_closeMenu(){if(this._isOpen){if(this._popup?.popover)try{this._popup.hidePopover()}catch{}this._isOpen=!1,document.removeEventListener(`click`,this._clickListener)}}_handleTriggerClick(e){this.mode!==`context`&&(e.stopPropagation(),this._isOpen?(this._closeMenu(),this._triggerBtn?.focus()):this._openMenu())}_handleClickOutside(e){if(!this.contains(e.target)&&this._popup?.popover&&this._popup.hasAttribute(`open`))try{this._popup.hidePopover()}catch{}}_getMenuContainer(){return((this.shadowRoot?.querySelector(`slot[name="menu"]`))?.assignedElements({flatten:!0})??[]).find(e=>e.tagName===`IXFX-MENU-CONTAINER`)??null}_restoreFocus(){if(this._triggerBtn){this._triggerBtn.focus();return}let e=this._focusBeforeOpen;this._focusBeforeOpen=null,e?.isConnected&&e!==document.body?e.focus():this.focus()}_handleCommand(e){if(this._popup?.popover)try{this._popup.hidePopover()}catch{}this.dispatchEvent(new CustomEvent(`menu-command`,{detail:e.detail,bubbles:!0,composed:!0}))}_handleRadioChange(e){if(this._popup?.popover)try{this._popup.hidePopover()}catch{}this.dispatchEvent(new CustomEvent(`menu-command`,{detail:{command:e.detail.name,value:e.detail.value},bubbles:!0,composed:!0}))}_handlePointerDown(e){this.mode===`context`&&e.pointerType===`mouse`&&(this._mouseHeld=!0,document.addEventListener(`pointerup`,this._handleRelease,{capture:!0,once:!0}),document.addEventListener(`pointercancel`,this._handleRelease,{capture:!0,once:!0}))}_removeReleaseListeners(){document.removeEventListener(`pointerup`,this._handleRelease,{capture:!0}),document.removeEventListener(`pointercancel`,this._handleRelease,{capture:!0}),this._mouseHeld=!1,this._openOnRelease=!1}_handleContextMenu(e){if(this.mode===`context`){if(e.preventDefault(),this._popup.style.top=`${e.clientY}px`,this._popup.style.left=`${e.clientX}px`,this._popup.style.position=`fixed`,this._popup.style.positionAnchor=`none`,this._mouseHeld){this._openOnRelease=!0;return}this._openMenu()}}static{this.styles=[w,de,r`
|
|
2501
2501
|
:host {
|
|
2502
2502
|
display: inline-block;
|
|
2503
2503
|
position: relative;
|
|
@@ -2611,7 +2611,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2611
2611
|
>
|
|
2612
2612
|
<slot name="menu" @slotchange=${this._handleSlotChange}></slot>
|
|
2613
2613
|
</div>
|
|
2614
|
-
`}};E([d({type:String,reflect:!0})],
|
|
2614
|
+
`}};E([d({type:String,reflect:!0})],ar.prototype,`mode`,void 0),E([d({type:String})],ar.prototype,`label`,void 0),E([d({type:String,attribute:`icon-name`})],ar.prototype,`iconName`,void 0),E([d({attribute:!1})],ar.prototype,`registry`,void 0),E([d({attribute:!1})],ar.prototype,`keyboardManager`,void 0),E([d({type:String})],ar.prototype,`placement`,void 0),E([d({type:Boolean,attribute:`tab-stop`})],ar.prototype,`tabStop`,void 0),E([m()],ar.prototype,`_isOpen`,void 0),E([m()],ar.prototype,`_hasMenu`,void 0),E([m()],ar.prototype,`_hasTriggerSlot`,void 0),E([m()],ar.prototype,`_hasContextTarget`,void 0),E([f(`.trigger-btn`)],ar.prototype,`_triggerBtn`,void 0),E([f(`.popup`)],ar.prototype,`_popup`,void 0),ar=ir=E([T(`ixfx-menu-trigger`)],ar);function or(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement?e:null}let sr=class extends n{constructor(...e){super(...e),this.command=``,this.commandArgs=``,this.label=``,this.disabled=!1,this.iconName=``,this._hasChildren=!1,this._hoverTimeout=null}disconnectedCallback(){super.disconnectedCallback(),this._hoverTimeout&&clearTimeout(this._hoverTimeout)}_handleSlotChange(){let e=this._slot?.assignedElements()??[];this._hasChildren=e.length>0}_handleMouseEnter(){this.disabled||!this._hasChildren||!this.submenuPopover||(this._hoverTimeout&&clearTimeout(this._hoverTimeout),this._hoverTimeout=window.setTimeout(()=>{this._showSubmenu()},150))}_handleMouseLeave(){this._hoverTimeout&&=(clearTimeout(this._hoverTimeout),null),this._hideSubmenu()}_showSubmenu(){if(this.submenuPopover?.popover)try{this.submenuPopover.showPopover()}catch(e){console.warn(`showPopover failed:`,e)}}_hideSubmenu(){if(this.submenuPopover?.popover)try{this.submenuPopover.hidePopover()}catch(e){console.warn(`hidePopover failed:`,e)}}handleClick(){this.disabled||this.dispatchEvent(new CustomEvent(`command`,{detail:{command:this.command,args:this.commandArgs},bubbles:!0,composed:!0}))}_resolvedLabel(){return this.label?this.label:this.registry&&this.command?this.registry.get(this.command)?.label??``:``}_resolvedIcon(){return this.iconName?this.iconName:this.registry&&this.command?this.registry.get(this.command)?.icon??null:null}willUpdate(e){super.willUpdate(e);let n=this._resolvedIcon();n&&!this.iconName?this.setAttribute(`data-icon-section`,``):!n&&!this.iconName&&this.removeAttribute(`data-icon-section`)}updated(e){super.updated(e)}_getShortcut(){if(!this.keyboardManager||!this.command)return null;let e=(this.keyboardManager.getBindings?.()??[]).find(e=>e.commandId===this.command);if(!e)return null;let n=Array.from(e.modifiers??[],e=>({ctrl:`⌃`,shift:`⇧`,alt:`⌥`,meta:`⌘`})[e]??e),r=e.key?.length===1?e.key.toUpperCase():e.key;return[...n,r].join(``)}static{this.styles=[w,C,r`
|
|
2615
2615
|
:host {
|
|
2616
2616
|
display: block;
|
|
2617
2617
|
}
|
|
@@ -2692,7 +2692,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2692
2692
|
${this._hasChildren?i`<span class="arrow"><ixfx-icon name="chevron-right"></ixfx-icon></span>`:null}
|
|
2693
2693
|
</div>
|
|
2694
2694
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
2695
|
-
`}};E([d({type:String})],
|
|
2695
|
+
`}};E([d({type:String})],sr.prototype,`command`,void 0),E([d({type:String,attribute:`command-args`})],sr.prototype,`commandArgs`,void 0),E([d({type:String})],sr.prototype,`label`,void 0),E([d({type:Boolean})],sr.prototype,`disabled`,void 0),E([d({type:String,attribute:`icon-name`})],sr.prototype,`iconName`,void 0),E([d({attribute:!1})],sr.prototype,`registry`,void 0),E([d({attribute:!1})],sr.prototype,`keyboardManager`,void 0),E([d({attribute:!1})],sr.prototype,`submenuPopover`,void 0),E([m()],sr.prototype,`_hasChildren`,void 0),E([f(`slot`)],sr.prototype,`_slot`,void 0),sr=E([T(`ixfx-menu-item`)],sr);let cr=class extends ln{constructor(...e){super(...e),this.mode=`default`,this.defaultValue=``,this._selectedCommand=``,this._selectedLabel=``,this._selectedIcon=``,this._switcherItems=[],this._dynamicItems=[],this._loadingItems=!1,this._menuHasItems=!1,this._onDefaultMenuSlotChange=e=>{let n=e.target;this._menuHasItems=n.assignedElements({flatten:!0}).length>0},this._onSwitcherSlotChange=e=>{if(this.itemsProvider)return;let n=e.target;this._applySwitcherItems(n.assignedElements({flatten:!0}).filter(e=>e.tagName===`IXFX-MENU-ITEM`).map(e=>({command:e.getAttribute(`command`)??``,label:e.getAttribute(`label`)??e.textContent?.trim()??``,icon:e.getAttribute(`icon-name`)??``})))},this._handleSwitcherMenuCommand=e=>{if(this.mode!==`switcher`)return;e.stopPropagation();let{command:n}=e.detail,r=this._switcherItems.find(e=>e.command===n);r&&(this._selectedCommand=r.command,this._selectedLabel=r.label,this._selectedIcon=r.icon,this.dispatchEvent(new CustomEvent(`menu-command`,{detail:e.detail,bubbles:!0,composed:!0})))},this._handleSwitcherPrimaryClick=()=>{this._selectedCommand&&this.dispatchEvent(new CustomEvent(`menu-command`,{detail:{command:this._selectedCommand},bubbles:!0,composed:!0}))},this._handleCaretClick=async e=>{if(e.stopPropagation(),this._menuTrigger?.isOpen){this._menuTrigger.closeMenu();return}if(this.itemsProvider){this._loadingItems=!0;try{let e=this.itemsProvider(),n=e instanceof Promise?await e:e;this.mode===`switcher`?this._applySwitcherItems(n.map(e=>({command:e.command,label:e.label,icon:e.icon??``}))):this._dynamicItems=n}finally{this._loadingItems=!1}await this.updateComplete}this._menuTrigger?.openMenu()},this._handlePrimaryKeyDown=e=>{e.key===`ArrowDown`&&(e.preventDefault(),this._menuTrigger?.openMenu())},this._handleCaretKeyDown=e=>{e.key===`ArrowDown`&&(e.preventDefault(),this._menuTrigger?.openMenu())}}disconnectedCallback(){super.disconnectedCallback(),this._menuTrigger?.removeEventListener(`menu-command`,this._handleSwitcherMenuCommand)}firstUpdated(){this.updateComplete.then(()=>{this._menuTrigger?.addEventListener(`menu-command`,this._handleSwitcherMenuCommand)})}updated(e){super.updated(e),(e.has(`items`)||e.has(`mode`))&&this.items&&!this.itemsProvider&&this._applyItems(this.items)}_applyItems(e){this.mode===`switcher`?this._applySwitcherItems(e.map(e=>({command:e.command,label:e.label,icon:e.icon??``}))):(this._dynamicItems=[...e],this._menuHasItems=e.length>0)}selectCommand(e){let n=this._switcherItems.find(n=>n.command===e);return n?(this._selectedCommand=n.command,this._selectedLabel=n.label,this._selectedIcon=n.icon,!0):!1}invoke(){if(this.disabled)return!1;let e=this.shadowRoot?.querySelector(`.split button.primary`);return e?this.mode===`switcher`&&this._selectedCommand?(this.dispatchEvent(new CustomEvent(`menu-command`,{detail:{command:this._selectedCommand},bubbles:!0,composed:!0})),!0):(e.dispatchEvent(new MouseEvent(`click`,{bubbles:!0})),!0):!1}get _caretHasContent(){return this.itemsProvider||this.items&&this.items.length>0?!0:this.mode===`switcher`?this._switcherItems.length>1:this._menuHasItems}_applySwitcherItems(e){if(this._switcherItems=e,!this._selectedCommand&&e.length>0){let n=this.defaultValue?e.find(e=>e.command===this.defaultValue)??e[0]:e[0];this._selectedCommand=n.command,this._selectedLabel=n.label,this._selectedIcon=n.icon}}render(){return this.mode===`switcher`?this._renderSwitcher():this._renderDefault()}_renderCaret(e,n){let r=!this._caretHasContent;return i`
|
|
2696
2696
|
<button
|
|
2697
2697
|
slot="trigger"
|
|
2698
2698
|
class="caret"
|
|
@@ -2758,7 +2758,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2758
2758
|
</ixfx-menu-container>
|
|
2759
2759
|
</ixfx-menu-trigger>
|
|
2760
2760
|
</div>
|
|
2761
|
-
`}static{this.styles=[w,cn,
|
|
2761
|
+
`}static{this.styles=[w,sn,cn,r`
|
|
2762
2762
|
:host {
|
|
2763
2763
|
display: inline-flex;
|
|
2764
2764
|
max-width: 100%;
|
|
@@ -2896,7 +2896,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
2896
2896
|
display: inline-flex;
|
|
2897
2897
|
align-items: stretch;
|
|
2898
2898
|
}
|
|
2899
|
-
`]}};E([d({attribute:!1})],
|
|
2899
|
+
`]}};E([d({attribute:!1})],cr.prototype,`registry`,void 0),E([d({attribute:!1})],cr.prototype,`keyboardManager`,void 0),E([d({type:String})],cr.prototype,`mode`,void 0),E([d({type:String,attribute:`default-value`})],cr.prototype,`defaultValue`,void 0),E([d({attribute:!1})],cr.prototype,`itemsProvider`,void 0),E([d({attribute:!1})],cr.prototype,`items`,void 0),E([f(`ixfx-menu-trigger`)],cr.prototype,`_menuTrigger`,void 0),E([m()],cr.prototype,`_selectedCommand`,void 0),E([m()],cr.prototype,`_selectedLabel`,void 0),E([m()],cr.prototype,`_selectedIcon`,void 0),E([m()],cr.prototype,`_switcherItems`,void 0),E([m()],cr.prototype,`_dynamicItems`,void 0),E([m()],cr.prototype,`_loadingItems`,void 0),E([m()],cr.prototype,`_menuHasItems`,void 0),cr=E([T(`ixfx-split-button`)],cr);let lr=class extends n{constructor(...e){super(...e),this.checked=!1,this.disabled=!1,this.indeterminate=!1,this.readonly=!1,this.label=``,this.name=``,this.value=``,this.#e=e=>{let n=e.target;this.checked=n.checked,this.indeterminate=!1,this.dispatchEvent(new CustomEvent(`change`,{detail:{checked:this.checked},bubbles:!0,composed:!0}))}}static{this.styles=[sn,w,r`
|
|
2900
2900
|
:host {
|
|
2901
2901
|
/* Box */
|
|
2902
2902
|
--box-size: 18px;
|
|
@@ -3082,7 +3082,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3082
3082
|
<span class="box"></span>
|
|
3083
3083
|
${this.label?i`<span class="label">${this.label}</span>`:``}
|
|
3084
3084
|
</label>
|
|
3085
|
-
`}};E([d({type:Boolean})],
|
|
3085
|
+
`}};E([d({type:Boolean})],lr.prototype,`checked`,void 0),E([d({type:Boolean})],lr.prototype,`disabled`,void 0),E([d({type:Boolean})],lr.prototype,`indeterminate`,void 0),E([d({type:Boolean,reflect:!0})],lr.prototype,`readonly`,void 0),E([d({type:String})],lr.prototype,`label`,void 0),E([d({type:String})],lr.prototype,`name`,void 0),E([d({type:String})],lr.prototype,`value`,void 0),lr=E([T(`ixfx-checkbox`)],lr);function ur(e,n){return e.label.localeCompare(n.label,void 0,{sensitivity:`base`})}function dr(e){let n=e.filter(e=>e.checked!==`false`).toSorted(ur),r=e.filter(e=>e.checked===`false`).toSorted(ur);return[...n,...r]}function fr(e){return e===`true`?`false`:`true`}function pr(e){return e.filter(e=>e.checked!==`false`).toSorted(ur)}function mr(e){let n=e.filter(e=>e.checked===`true`).toSorted(ur).map(e=>e.label),r=e.some(e=>e.checked===`indeterminate`)?[`(varies)`]:[];return[...n,...r]}function hr(e){return mr(e).join(`, `)}function gr(e,n){return e.map(e=>e.value===n?{...e,checked:fr(e.checked)}:e)}function _r(e,n,r){let i=r.toLocaleLowerCase(),a=e.length;for(let r=1;r<=a;r++){let o=(n+r+a)%a;if(e[o].toLocaleLowerCase().startsWith(i))return o}return-1}function vr(e,n){let r=new Map(e.map(e=>[e.value,e.checked]));return n.filter(e=>r.get(e.value)!==e.checked)}function yr(e,n,r){return{width:Math.min(Math.max(e.width,n.width),Math.max(r.width,n.width)),height:Math.min(Math.max(e.height,n.height),Math.max(r.height,n.height))}}let br=0,xr=class extends n{constructor(...e){super(...e),this.items=[],this.multiline=!1,this.itemsInert=!1,this.itemDisplay=`checkbox`,this.orientation=`horizontal`,this.placeholder=``,this.disabled=!1,this._open=!1,this._draft=[],this._order=[],this.#e=`--checked-select-anchor-${br++}`,this.#t=new oe(this,{getItems:()=>this._order.map((e,n)=>({id:n}))}),this.#s=(e,n)=>{if(e.stopPropagation(),this._open)return;let r=gr(this.items,n);this.#o(r,vr(this.items,r)),this.#c(n)},this.#u=e=>{let n=e.composedPath(),r=this.#r,i=this.#n;r&&n.includes(r)||i&&n.includes(i)||this.cancel()},this.#d=e=>{if(e.target.closest?.(`ixfx-checkbox`))return;let n=e.composedPath()[0];n.classList?.contains(`rest-items`)&&e instanceof MouseEvent&&(e.offsetX>n.clientWidth||e.offsetY>n.clientHeight)||(this._open?this.commit():this.open())},this.#f=e=>{this._open||e.target!==e.currentTarget||(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),this.open())},this.#h=e=>{let n=this.#a();switch(e.key){case`ArrowDown`:e.preventDefault(),this.#t.handleKeyboardNavigation(`next`),this.#g();return;case`ArrowUp`:e.preventDefault(),this.#t.handleKeyboardNavigation(`previous`),this.#g();return;case`Home`:e.preventDefault(),this.#t.handleKeyboardNavigation(`first`),this.#g();return;case`End`:e.preventDefault(),this.#t.handleKeyboardNavigation(`last`),this.#g();return;case` `:{e.preventDefault();let r=n[this.#t.tickledId??-1];r&&this.#p(r.value);return}case`Enter`:e.preventDefault(),this.commit();return;case`Escape`:e.preventDefault(),this.cancel();return;case`Tab`:this.cancel();return}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let r=_r(n.map(e=>e.label),this.#t.tickledId??-1,e.key);r>=0&&(this.#t.handleKeyboardNavigation(r),this.#g())}},this.#_=e=>{let n=this.shadowRoot?.querySelector(`.frame`),r=e.currentTarget;if(!n)return;e.preventDefault();let i=n.getBoundingClientRect(),a=e.clientX,o=e.clientY,s=getComputedStyle(this),c={width:Number.parseFloat(s.getPropertyValue(`--checked-select-min-width`))||128,height:Number.parseFloat(s.getPropertyValue(`--checked-select-min-height`))||80},l={width:window.innerWidth-i.left-8,height:window.innerHeight-i.top-8};r.setPointerCapture?.(e.pointerId),r.setAttribute(`data-active`,``);let u=e=>{this._size=yr({width:i.width+e.clientX-a,height:i.height+e.clientY-o},c,l)},d=()=>{r.removeAttribute(`data-active`),r.removeEventListener(`pointermove`,u),r.removeEventListener(`pointerup`,d),r.removeEventListener(`pointercancel`,d),this.#i?.focus()};r.addEventListener(`pointermove`,u),r.addEventListener(`pointerup`,d),r.addEventListener(`pointercancel`,d)}}static{this.styles=[w,Yt,se,C,r`
|
|
3086
3086
|
:host {
|
|
3087
3087
|
--checked-select-gap: var(--space-m);
|
|
3088
3088
|
--checked-select-padding: var(--space-s) var(--space-m);
|
|
@@ -3269,7 +3269,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3269
3269
|
.resize-zone .ixfx-handle {
|
|
3270
3270
|
--ixfx-handle-spot-size: 10px;
|
|
3271
3271
|
}
|
|
3272
|
-
`]}#e;#t;get isOpen(){return this._open}get#n(){return this.shadowRoot?.querySelector(`.rest`)??null}get#r(){return this.shadowRoot?.querySelector(`.popup`)??null}get#i(){return this.shadowRoot?.querySelector(`.listbox`)??null}#a(){let e=new Map(this._draft.map(e=>[e.value,e]));return this._order.flatMap(n=>e.get(n)??[])}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`pointerdown`,this.#u,!0)}willUpdate(e){super.willUpdate(e),e.has(`disabled`)&&this.disabled&&this._open&&this.cancel()}async open(){this._open||this.disabled||(this._draft=this.items,this._order=
|
|
3272
|
+
`]}#e;#t;get isOpen(){return this._open}get#n(){return this.shadowRoot?.querySelector(`.rest`)??null}get#r(){return this.shadowRoot?.querySelector(`.popup`)??null}get#i(){return this.shadowRoot?.querySelector(`.listbox`)??null}#a(){let e=new Map(this._draft.map(e=>[e.value,e]));return this._order.flatMap(n=>e.get(n)??[])}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`pointerdown`,this.#u,!0)}willUpdate(e){super.willUpdate(e),e.has(`disabled`)&&this.disabled&&this._open&&this.cancel()}async open(){this._open||this.disabled||(this._draft=this.items,this._order=dr(this.items).map(e=>e.value),this._size=void 0,this._open=!0,this._order.length>0&&this.#t.handleKeyboardNavigation(`first`),document.addEventListener(`pointerdown`,this.#u,!0),await this.updateComplete,this.#r?.showPopover?.(),this.#i?.focus())}commit(){if(!this._open)return;let e=vr(this.items,this._draft),n=this._draft;this.#l(),e.length!==0&&this.#o(n,e)}#o(e,n){this.items=e,this.dispatchEvent(new CustomEvent(`change`,{detail:{items:e,changed:n},bubbles:!0,composed:!0}))}#s;async#c(e){await this.updateComplete,(this.shadowRoot?.querySelector(`.rest ixfx-checkbox[data-value="${CSS.escape(e)}"]`)??this.#n)?.focus()}cancel(){this._open&&this.#l()}#l(){document.removeEventListener(`pointerdown`,this.#u,!0),this.#r?.hidePopover?.(),this._open=!1,this._draft=[],this.#t.clearTickled(),this.#n?.focus()}#u;#d;#f;#p(e){this._draft=gr(this._draft,e)}#m(e,n){this.#t.setTickled(n),this.#p(e)}#h;async#g(){await this.updateComplete;let e=this.#t.tickledId;this.shadowRoot?.querySelector(`[data-index="${e}"]`)?.scrollIntoView?.({block:`nearest`})}#_;#v(){let e=pr(this.items);return e.length===0?i`<span class="placeholder">${this.placeholder}</span>`:this.itemDisplay===`text`?this.orientation===`vertical`?mr(this.items).map(e=>i`<span class="rest-text">${e}</span>`):i`<span class="rest-text">${hr(this.items)}</span>`:_(e,e=>e.value,e=>i`
|
|
3273
3273
|
<ixfx-checkbox
|
|
3274
3274
|
?readonly=${this.itemsInert}
|
|
3275
3275
|
data-value=${e.value}
|
|
@@ -3293,7 +3293,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3293
3293
|
.checked=${e.checked===`true`}
|
|
3294
3294
|
.indeterminate=${e.checked===`indeterminate`}
|
|
3295
3295
|
></ixfx-checkbox>
|
|
3296
|
-
</div>`}render(){let e=this._open?this.#a():[],n=this.#t.tickledId,r=this._size?`width: ${this._size.width}px;`:``,o=this._size?`height: ${this._size.height}px; max-height: none;`:``,s=
|
|
3296
|
+
</div>`}render(){let e=this._open?this.#a():[],n=this.#t.tickledId,r=this._size?`width: ${this._size.width}px;`:``,o=this._size?`height: ${this._size.height}px; max-height: none;`:``,s=pr(this.items).map(e=>e.label).join(`, `);return i`
|
|
3297
3297
|
<div
|
|
3298
3298
|
class="rest"
|
|
3299
3299
|
role="combobox"
|
|
@@ -3328,16 +3328,16 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3328
3328
|
</div>
|
|
3329
3329
|
</div>
|
|
3330
3330
|
</div>
|
|
3331
|
-
`}};E([d({type:Array})],Sr.prototype,`items`,void 0),E([d({type:Boolean,reflect:!0})],Sr.prototype,`multiline`,void 0),E([d({type:Boolean,attribute:`items-inert`,reflect:!0})],Sr.prototype,`itemsInert`,void 0),E([d({type:String,attribute:`item-display`,reflect:!0})],Sr.prototype,`itemDisplay`,void 0),E([d({type:String,reflect:!0})],Sr.prototype,`orientation`,void 0),E([d({type:String})],Sr.prototype,`placeholder`,void 0),E([d({type:Boolean,reflect:!0})],Sr.prototype,`disabled`,void 0),E([m()],Sr.prototype,`_open`,void 0),E([m()],Sr.prototype,`_draft`,void 0),E([m()],Sr.prototype,`_order`,void 0),E([m()],Sr.prototype,`_size`,void 0),Sr=E([T(`ixfx-checked-select`)],Sr);var Cr=Object.defineProperty,wr=(e,n)=>{let r={};for(var i in e)Cr(r,i,{get:e[i],enumerable:!0});return n||Cr(r,Symbol.toStringTag,{value:`Module`}),r},Tr=Object.defineProperty,Er=(e,n)=>{let r={};for(var i in e)Tr(r,i,{get:e[i],enumerable:!0});return n||Tr(r,Symbol.toStringTag,{value:`Module`}),r};function Dr(e){return typeof e==`string`?e:e instanceof Error?e.message:String(e)}function Or(...e){let n=e.filter(e=>kr(e));if(n.length===0)return;let r=n.map(e=>Mr(e));throw Error(r.join(`, `))}function O(...e){for(let n of e){if(n===void 0)continue;if(typeof n==`boolean`){if(n)continue;throw Ar.fromString(`Guard failed: false result`)}let e=typeof n==`object`?n:n();if(e!==void 0&&!e.success)throw jr(e)}return!0}function kr(e){return typeof e!=`object`||!e?!1:!e.success}var Ar=class e extends Error{cause;constructor(e,n){super(e),this.cause=n}static fromError(n,r){let i=n.message,a=n.stack,o=n.name,s=new e(i,r);return s.stack=a,s.name=`IxfxError(${o})`,s}static fromString(n,r){let i=new e(n,r);return i.name=`IxfxError`,i}};function jr(e){return typeof e.error==`string`?Ar.fromString(e.error,e.info):e.error instanceof Error?Ar.fromError(e.error,e.info):Ar.fromString(JSON.stringify(e.error),e.info)}function Mr(e){return e.error instanceof Error?Dr(e.error):typeof e.error==`string`?e.error:JSON.stringify(e.error)}function Nr(e,n){return{success:!1,error:e,info:n}}function Pr(...e){let n;for(let r of e){if(typeof r==`boolean`){if(r)continue;return{success:!1,error:`Guard failed: false result`}}if(n=typeof r==`object`?r:r(),n!==void 0&&!n.success)return n}if(!n)throw Error(`No results`);return n}const k=(e,n=``,r=`?`,i)=>{if(e===null)return{success:!1,error:`Parameter '${r}' is null`,info:i};if(e===void 0)return{success:!1,error:`Parameter '${r}' is undefined`,info:i};if(Number.isNaN(e))return{success:!1,error:`Parameter '${r}' is NaN`,info:i};if(typeof e!=`number`)return{success:!1,error:`Parameter '${r}' is not a number (${JSON.stringify(e)})`,info:i};switch(n){case`finite`:if(!Number.isFinite(e))return{success:!1,error:`Parameter '${r} must be finite (Got: ${e})`,info:i};break;case`positive`:if(e<0)return{success:!1,error:`Parameter '${r}' must be at least zero (${e})`,info:i};break;case`negative`:if(e>0)return{success:!1,error:`Parameter '${r}' must be zero or lower (${e})`,info:i};break;case`aboveZero`:if(e<=0)return{success:!1,error:`Parameter '${r}' must be above zero (${e})`,info:i};break;case`belowZero`:if(e>=0)return{success:!1,error:`Parameter '${r}' must be below zero (${e})`,info:i};break;case`percentage`:if(e>1||e<0)return{success:!1,error:`Parameter '${r}' must be in percentage range (0 to 1). (${e})`,info:i};break;case`nonZero`:if(e===0)return{success:!1,error:`Parameter '${r}' must non-zero. (${e})`,info:i};break;case`bipolar`:if(e>1||e<-1)return{success:!1,error:`Parameter '${r}' must be in bipolar percentage range (-1 to 1). (${e})`,info:i}}return{success:!0,value:e,info:i}},Fr=(e,n=`?`,r)=>k(e,`percentage`,n,r),Ir=(e,n=``,r=`?`)=>Pr(k(e,n,r),()=>Number.isInteger(e)?{success:!0,value:e}:{success:!1,error:`Param '${r}' is not an integer`}),Lr=(e,n,r,i=`?`)=>typeof e==`number`?Number.isNaN(e)?{success:!1,error:`Param '${i}' is not within range ${n}-${r}. Got: NaN`}:Number.isFinite(e)?e<n?{success:!1,error:`Param '${i}' is below range ${n}-${r}. Got: ${e}`}:e>r?{success:!1,error:`Param '${i}' is above range ${n}-${r}. Got: ${e}`}:{success:!0,value:e}:{success:!1,error:`Param '${i}' is not within range ${n}-${r}. Got: infinite`}:{success:!1,error:`Param '${i}' is not a number type. Got type: '${typeof e}' value: '${JSON.stringify(e)}'`},Rr=(e,n=`?`)=>e===void 0?{success:!1,error:`${n} param is undefined`}:e===null?{success:!1,error:`${n} param is null`}:{success:!0,value:e},zr=(e,n=`?`)=>e===void 0?{success:!1,error:`Param '${n}' is undefined. Expected: function.`}:e===null?{success:!1,error:`Param '${n}' is null. Expected: function.`}:typeof e==`function`?{success:!0,value:e}:{success:!1,error:`Param '${n}' is type '${typeof e}'. Expected: function`};function Br(e,n=``,r=`?`){return typeof e==`string`?n===`non-empty`&&e.length===0?{success:!1,error:`Param '${r} is empty`}:{success:!0,value:e}:{success:!1,error:`Param '${r} is not type string. Got: ${typeof e}`}}function Vr(e){return j(e)&&e.z!==null?!1:e.x===null&&e.y===null}function Hr(e){return j(e)&&!Number.isNaN(e.z)?!1:Number.isNaN(e.x)||Number.isNaN(e.y)}function Ur(e,n=`Point`,r=``){if(e===void 0)return Nr(`'${n}' is undefined. Expected {x,y} got ${JSON.stringify(e)}`,r);if(e===null)return Nr(`'${n}' is null. Expected {x,y} got ${JSON.stringify(e)}`,r);if(typeof e!=`object`)return Nr(`'${n}' is type '${typeof e}'. Expected object.`,r);if(e.x===void 0)return Nr(`'${n}.x' is undefined. Expected {x,y} got ${JSON.stringify(e)}`,r);if(e.y===void 0)return Nr(`'${n}.y' is undefined. Expected {x,y} got ${JSON.stringify(e)}`,r);if(typeof e.x!=`number`)return Nr(`'${n}.x' must be a number. Got ${typeof e.x}`,r);if(typeof e.y!=`number`)return Nr(`'${n}.y' must be a number. Got ${typeof e.y}`,r);if(e.z!==void 0){if(typeof e.z!=`number`)return Nr(`${n}.z must be a number. Got: ${typeof e.z}`,r);if(Number.isNaN(e.z))return Nr(`'${n}.z' is NaN. Got: ${JSON.stringify(e)}`,r)}return e.x===null?Nr(`'${n}.x' is null`,r):e.y===null?Nr(`'${n}.y' is null`,r):Number.isNaN(e.x)?Nr(`'${n}.x' is NaN`,r):Number.isNaN(e.y)?Nr(`'${n}.y' is NaN`,r):{success:!0,value:e}}function A(e,n=`Point`,r){O(Ur(e,n,r))}function Wr(e,n=`pt`){return A(e,n),O(k(e.x,`nonZero`,`${n}.x`),k(e.y,`nonZero`,`${n}.y`),()=>{if(e.z!==void 0)return k(e.z,`nonZero`,`${n}.z`)}),!0}function Gr(e){return e!=null&&e.x!==void 0&&e.y!==void 0}function j(e){return e!=null&&e.x!==void 0&&e.y!==void 0&&e.z!==void 0}function Kr(e){return j(e)&&e.z!==0?!1:e.x===0&&e.y===0}function qr(e){return j(e)&&!Number.isNaN(e.z)?!1:Number.isNaN(e.x)&&Number.isNaN(e.y)}function Jr(...e){for(let n of e){if(n===void 0)continue;if(typeof n==`boolean`){if(n)continue;throw Yr.fromString(`Guard failed: false result`)}let e=typeof n==`object`?n:n();if(e!==void 0&&!e.success)throw Xr(e)}return!0}var Yr=class e extends Error{cause;constructor(e,n){super(e),this.cause=n}static fromError(n,r){let i=n.message,a=n.stack,o=n.name,s=new e(i,r);return s.stack=a,s.name=`IxfxError(${o})`,s}static fromString(n,r){let i=new e(n,r);return i.name=`IxfxError`,i}};function Xr(e){return typeof e.error==`string`?Yr.fromString(e.error,e.info):e.error instanceof Error?Yr.fromError(e.error,e.info):Yr.fromString(JSON.stringify(e.error),e.info)}const Zr=(e,n=`?`)=>Array.isArray(e)?{success:!0,value:e}:{success:!1,error:`Parameter '${n}' is expected to be an array'`},Qr=(e,n=`?`)=>e===void 0?{success:!1,error:`Param '${n}' is undefined. Expected: function.`}:e===null?{success:!1,error:`Param '${n}' is null. Expected: function.`}:typeof e==`function`?{success:!0,value:e}:{success:!1,error:`Param '${n}' is type '${typeof e}'. Expected: function`},$r=(e,n)=>e===n,ei=e=>{Jr(Zr(e,`array`));for(let n=0;n<e.length;n++)for(let r=0;r<e.length;r++)if(n!==r&&e[n]===e[r])return!0;return!1};function*ti(e){if(Jr(Zr(e,`values`)),e.length<2)throw Error(`Array needs to have at least two entries. Length: ${e.length}`);for(let n=1;n<e.length;n++)yield[e[n-1],e[n]]}const ni=(e,n,r=$r)=>{if(Jr(Zr(e,`sourceArray`),Qr(r,`comparer`)),Array.isArray(n)){let i=[];for(let a of e)n.some(e=>r(a,e))||i.push(a);return i}return e.filter(e=>!r(e,n))},ri=(e,n=`ignore`)=>{let r=0,i=e[0].length;for(let a=0;a<i;a++){let i=0;for(let[r,o]of e.entries()){let e=o[a];if(Number.isNaN(e)||!Number.isFinite(e)){if(n===`treat-as-zero`)e=0;else if(n===`error`)throw TypeError(`Invalid number at index ${a},${r}`)}r===0?i=e:i*=e}r+=i}return r};function ii(e,n=0,r=1){if(Number.isNaN(e))throw Error(`Param 'value' is NaN`);if(Number.isNaN(n))throw Error(`Param 'min' is NaN`);if(Number.isNaN(r))throw Error(`Param 'max' is NaN`);return e<n?n:e>r?r:e}function ai(e=0,n=1){if(Number.isNaN(e))throw Error(`Param 'min' is NaN`);if(Number.isNaN(n))throw Error(`Param 'max' is NaN`);return r=>r>n?n:r<e?e:r}const oi=(e,n=0,r=1)=>{if(O(k(e,``,`min`),k(n,``,`min`),k(r,``,`max`)),e===n||e===r)return n;for(;(e<=n||e>=r)&&e!==r&&e!==n;)e>r?e=n+(e-r):e<n&&(e=r-(n-e));return e};Math.PI*2;function si(e,n,r,i){let a,o=`clamp`,s=e=>(a&&(e=a(e)),o===void 0||o===`clamp`?e=ii(e):o===`wrap`&&(e>1?e%=1:e<0&&(e=1+e%1)),e),c=(e,n,r)=>(O(k(n,``,`a`),k(r,``,`b`),k(e,``,`amount`)),e=s(e),(1-e)*n+e*r),l=(e={})=>{if(e.transform!==void 0){if(typeof e.transform!=`function`)throw Error(`Param 'transform' is expected to be a function. Got: ${typeof e.transform}`);a=e.transform}o=e.limits??`clamp`},u=(e,n,r)=>(1-e)*n+e*r;if(typeof e!=`number`)throw TypeError(`First param is expected to be a number. Got: ${typeof e}`);if(typeof n==`number`){let a,o;if(r===void 0||typeof r==`object`)return a=e,o=n,l(r),e=>c(e,a,o);if(typeof r==`number`)return a=n,o=r,l(i),c(e,a,o);throw Error(`Values for 'a' and 'b' not defined`)}if(n===void 0||typeof n==`object`){let r=s(e);return l(n),O(k(r,``,`amount`)),(e,n)=>u(r,e,n)}}function ci(e,n,r){O(Ir(e,`positive`,`decimalPlaces`));let i=typeof n==`boolean`?n:r??!1,a;if(e===0)a=Math.round;else{let n=10**e;a=i?e=>Math.ceil(e*n)/n:e=>Math.floor(e*n)/n}return typeof n==`number`?a(n):a}Math.PI*2;const li=(e=3)=>{O(k(e,`aboveZero`,`scaling`));let n=0,r=0;return i=>(k(i,``,`v`).success&&i!==void 0&&(r++,n+=(i-n)/Math.min(r,e)),n)},ui=(e,n,r=!0)=>{let i=n.toString(),a=i.indexOf(`.`),o=1;a>=0&&(o=10*i.substring(a+1).length,n=Math.floor(o*n),e*=o),O(k(e,``,`v`),Ir(n,``,`every`));let s=e/n,c=s%1;return s=Math.floor(s),(c===.5&&r||c>.5)&&s++,n*s/o},di=(e,n,r,i,a,o)=>fi(n,r,i,a,o)(e),fi=(e,n,r,i,a,o)=>{O(k(e,`finite`,`inMin`),k(n,`finite`,`inMax`));let s=i??1,c=r??0,l=o?ai(r,i):void 0;return r=>{if(e===n)return s;let i=(r-e)/(n-e);a!==void 0&&(i=a(i));let o=i*(s-c)+c;return l?l(o):o}},pi=(e,n,r,i,a,o)=>(a===void 0&&(a=1),i===void 0&&(i=0),n===r?a:ii(di(e,n,r,i,a,o),i,a)),mi=()=>({min:2**53-1,max:-(2**53-1)}),hi=(e=mi())=>{let{min:n,max:r}=e;return{seen:e=>(typeof e==`number`&&!Number.isNaN(e)&&Number.isFinite(e)&&(n=Math.min(n,e),r=Math.max(r,e)),{min:n,max:r}),reset:()=>(n=2**53-1,r=-(2**53-1),{min:n,max:r}),get range(){return{min:n,max:r}},get min(){return n},get max(){return r}}},gi=Math.PI*2,_i=(e,n=`mean`)=>{let r=0,i=0,a=NaN,o=0;if(n!==`mean`)throw Error(`Unknown averaging kind: '${n}' expected: 'mean'`);for(let n of e){if(r+=n.x,i+=n.y,`z`in n&&n.z!==void 0)a+=n.z;else if(Number.isNaN(a))throw Error(`List of points should all have Z property, or none`);o++}return r/=o,i/=o,Number.isNaN(a)?{x:r,y:i}:{x:r,y:i,z:a/o}};function vi(e,n={}){let r,i,a;switch(e){case`moving-average-light`:{let e=n.scaling??3;r=li(e),i=li(e),a=li(e);break}default:throw Error(`Unknown averaging kind '${e}'. Expected: 'moving-average-light'`)}return e=>{let n=r(e.x),o=i(e.y);if(j(e)){let r=a(e.z);return Object.freeze({x:n,y:o,z:r})}return Object.freeze({x:n,y:o})}}function yi(e){return Array.isArray(e)?e.map(e=>Math.PI/180*e):Math.PI/180*e}function bi(e){return e*1.111111}function xi(e,n=!0){return n?e*.9%360:e*.9}function Si(e){return e*63.6619772368}function Ci(e){return e*.0157079633}function wi(e){return Array.isArray(e)?e.map(e=>e*180/Math.PI):e*180/Math.PI}function Ti(e){if(Ei(e))return e;if(typeof e==`number`)return{value:e,unit:`deg`};e=e.toLowerCase();let n=`deg`,r=NaN;if(e.endsWith(`grad`)?(r=Number.parseFloat(e.substring(0,e.length-4)),n=`grad`):e.endsWith(`rad`)?(r=Number.parseFloat(e.substring(0,e.length-3)),n=`rad`):e.endsWith(`turn`)?(r=Number.parseFloat(e.substring(0,e.length-4)),n=`turn`):e.endsWith(`deg`)?(r=Number.parseFloat(e.substring(0,e.length-3)),n=`deg`):r=Number.parseFloat(e),Number.isNaN(r)){if(e===`n`)return{value:90,unit:`deg`};if(e===`e`)return{value:0,unit:`deg`};if(e===`s`)return{value:270,unit:`deg`};if(e===`w`)return{value:180,unit:`deg`};if(e===`ne`)return{value:45,unit:`deg`};if(e===`se`)return{value:315,unit:`deg`};if(e===`sw`)return{value:225,unit:`deg`};if(e===`nw`)return{value:135,unit:`deg`};throw Error(`Invalid angle (bad value?): '${e}'. If using cardinals, use: 'n', 'se', etc.`)}if(n.length===0)throw Error(`Invalid angle (no unit)`);return{value:r,unit:n}}function Ei(e){return typeof e==`object`&&`unit`in e&&`value`in e&&typeof e.unit==`string`&&typeof e.value==`number`}function Di(e,n){let r=typeof e==`object`?e:Ti(e);switch(n){case`deg`:if(r.unit===`deg`)return r;if(r.unit===`rad`)return{value:wi(r.value),unit:`deg`};if(r.unit===`grad`)return{value:xi(r.value),unit:`deg`};if(r.unit===`turn`)return{value:Oi(r.value),unit:`deg`};throw Error(`Unknown unit: ${r.unit}`);case`grad`:if(r.unit===`deg`)return{value:bi(r.value),unit:`grad`};if(r.unit===`rad`)return{value:Si(r.value),unit:`grad`};if(r.unit===`grad`)return r;if(r.unit===`turn`)return{value:Si(Ai(r.value)),unit:`grad`};throw Error(`Unknown unit: ${r.unit}`);case`rad`:if(r.unit===`deg`)return{value:yi(r.value),unit:`rad`};if(r.unit===`rad`)return r;if(r.unit===`grad`)return{value:Ci(r.value),unit:`rad`};if(r.unit===`turn`)return{value:Ai(r.value),unit:`rad`};throw Error(`Unknown unit: ${r.unit}`);case`turn`:if(r.unit===`deg`)return{value:ji(r.value),unit:`turn`};if(r.unit===`rad`)return{value:Mi(r.value),unit:`turn`};if(r.unit===`grad`)return{value:Mi(Ci(r.value)),unit:`turn`};if(r.unit===`turn`)return r;throw Error(`Unknown unit: ${r.unit}`);default:throw Error(`Destination unit unknown ('${n}). Expects: deg, grad, rad or turn`)}}function Oi(e,n=!0){return n?e*360%360:e*360}function ki(e){return e%=gi,e<0?e+gi:e}function Ai(e){return e*gi}function ji(e){return e/360}function Mi(e){return e/gi}function Ni(e,n,r,i,a,o){if(j(e)&&j(n)||Gr(e)&&Gr(n))return[e,n];if(j(e)){let a={x:n,y:r,z:i};if(!j(a))throw Error(`Expected x, y & z parameters`);return[e,a]}if(Gr(e)){let i={x:n,y:r};if(!Gr(i))throw Error(`Expected x & y parameters`);return[e,i]}if(a!==void 0&&i!==void 0){let s={x:e,y:n,z:r},c={x:i,y:a,z:o};if(!j(s))throw Error(`Expected x,y,z for first point`);if(!j(c))throw Error(`Expected x,y,z for second point`);return[s,c]}let s={x:e,y:n},c={x:r,y:i};if(!Gr(s))throw Error(`Expected x,y for first point`);if(!Gr(c))throw Error(`Expected x,y for second point`);return[s,c]}function Pi(e,n,r){if(e===void 0)return{x:0,y:0};if(Array.isArray(e)){if(e.length===0)return Object.freeze({x:0,y:0});if(e.length===1)return Object.freeze({x:e[0],y:0});if(e.length===2)return Object.freeze({x:e[0],y:e[1]});if(e.length===3)return Object.freeze({x:e[0],y:e[1],z:e[2]});throw Error(`Expected array to be 1-3 elements in length. Got ${e.length}.`)}if(Gr(e))return e;if(typeof e!=`number`||typeof n!=`number`)throw TypeError(`Expected point or x,y as parameters. Got: a: ${JSON.stringify(e)} b: ${JSON.stringify(n)}`);return Object.freeze(typeof r==`number`?{x:e,y:n,z:r}:{x:e,y:n})}function Fi(e,n,r,i){let a=Pi(n,r,i);return A(a,`b`),A(e,`a`),j(a)&&j(e)?Math.hypot(a.x-e.x,a.y-e.y,a.z-e.z):Math.hypot(a.x-e.x,a.y-e.y)}function Ii(e,n,r){let i=Pi(n,r);return A(i,`b`),A(e,`a`),Math.hypot(i.x-e.x,i.y-e.y)}function Li(e,n,r,i,a,o){let[s,c]=Ni(e,n,r,i,a,o);A(s,`a`),A(c,`b`);let l={x:s.x-c.x,y:s.y-c.y};return(j(s)||j(c))&&(l.z=(s.z??0)-(c.z??0)),Object.freeze(l)}const Ri=(e,n=Math.round)=>(A(e,`pt`),Object.freeze({x:n(e.x),y:n(e.y)})),zi=e=>{A(e,`pt`);let n={...e};return delete n.z,Object.freeze(n)},Bi=(e,n=0)=>(A(e,`pt`),Object.freeze({...e,z:n}));function Vi(e,n){if(e===void 0)return`(undefined)`;if(e===null)return`(null)`;A(e,`pt`);let r=n?e.x.toFixed(n):e.x,i=n?e.y.toFixed(n):e.y;return e.z===void 0?`(${r},${i})`:`(${r},${i},${n?e.z.toFixed(n):e.z})`}const Hi=e=>e.distance!==void 0&&e.angleRadian!==void 0,Ui=(e,n)=>Object.freeze({...e,angleRadian:e.angleRadian+n}),Wi={x:0,y:0},Gi={x:1,y:1},Ki={x:0,y:0,z:0},qi={x:1,y:1,z:1},Ji=(e,n,r)=>{if(Hi(e)){if(n===void 0&&(n=Wi),Gr(n))return Xi(e.distance,e.angleRadian,n);throw Error(`Expecting (Coord, Point). Second parameter is not a point`)}if(typeof e==`object`)throw TypeError(`First param is an object, but not a Coord: ${JSON.stringify(e)}`);if(typeof e==`number`&&typeof n==`number`){if(r===void 0&&(r=Wi),!Gr(r))throw Error(`Expecting (number, number, Point). Point param wrong type`);return Xi(e,n,r)}throw TypeError(`Expecting parameters of (number, number). Got: (${typeof e}, ${typeof n}, ${typeof r}). a: ${JSON.stringify(e)}`)},Yi=(e,n,r={})=>{if(typeof e!=`object`)throw TypeError(`Param 'point' wrong. Expecting a Point, got: ${typeof e}`);let i=r.fullCircle??!0;typeof n==`object`&&(e=Li(e,n));let a=Math.atan2(e.y,e.x);i&&(a=ki(a));let o=Math.hypot(e.x,e.y);typeof r.digits==`number`&&(a=parseFloat(a.toFixed(r.digits)),o=parseFloat(o.toFixed(r.digits)));let s={...e,angleRadian:a,distance:o};return delete s.x,delete s.y,Object.freeze(s)},Xi=(e,n,r=Wi)=>(A(r),Object.freeze({x:r.x+e*Math.cos(n),y:r.y+e*Math.sin(n)})),Zi=(e,n,r)=>(A(e,`a`),n===void 0?Math.atan2(e.y,e.x):(A(n,`b`),r===void 0?Math.atan2(n.y-e.y,n.x-e.x):(A(r,`c`),Math.atan2(n.y-e.y,n.x-e.x)-Math.atan2(r.y-e.y,r.x-e.x)))),Qi=(e,n,r)=>{let i=Zi(e,n,r);return i<0?i+gi:i},$i=(e,n,r)=>{let i=Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2),a=Math.sqrt((n.x-r.x)**2+(n.y-r.y)**2),o=Math.sqrt((r.x-e.x)**2+(r.y-e.y)**2);return Math.acos((a*a+i*i-o*o)/(2*a*i))},ea=(e,n)=>(A(e,`a`),A(n,`b`),e=Object.freeze({...e}),n=Object.freeze({...n}),Object.freeze({a:e,b:n})),ta=(e,n,r,i)=>{if(e.y>r.y)throw Error(`topLeft.y greater than bottomRight.y`);if(e.y>i.y)throw Error(`topLeft.y greater than bottomLeft.y`);let a=n.x-e.x,o=r.x-i.x,s=Math.abs(i.y-e.y),c=Math.abs(r.y-n.y);return{x:Math.min(e.x,i.x),y:Math.min(n.y,e.y),width:Math.max(a,o),height:Math.max(s,c)}};function na(e,...n){if(n.length===0)throw Error(`No points provided`);let r=n[0];for(let i of n)r=(j(r)&&j(i),e(r,i));return r}const ra=(...e)=>{let n=na((e,n)=>e.x<n.x?e:n,...e),r=na((e,n)=>e.x>n.x?e:n,...e),i=na((e,n)=>e.y<n.y?e:n,...e),a=na((e,n)=>e.y>n.y?e:n,...e);return ta({x:n.x,y:i.y},{x:r.x,y:i.y},{x:r.x,y:a.y},{x:n.x,y:a.y})},ia=(...e)=>{let n=ra(...e),r=na((e,n)=>e.z<n.z?e:n,...e),i=na((e,n)=>e.z>n.z?e:n,...e);return{...n,z:r.z,depth:i.z-r.z}};function aa(e){return!(e===void 0||e.a===void 0||e.b===void 0||!Gr(e.a)||!Gr(e.b))}function oa(e){return Array.isArray(e)?!e.some(e=>!aa(e)):!1}function sa(e,n=`line`){return e===void 0?{success:!1,error:`${n} undefined`}:e.a===void 0?{success:!1,error:`${n}.a undefined. Expected {a:Point, b:Point}. Got: ${JSON.stringify(e)}`}:e.b===void 0?{success:!1,error:`${n}.b undefined. Expected {a:Point, b:Point} Got: ${JSON.stringify(e)}`}:{success:!0,value:!0}}const ca=(e,n)=>{let r;if(aa(e))n=e.b,r=e.a;else if(r=e,n===void 0)throw Error(`Since first parameter is not a line, two points are expected. Got a: ${JSON.stringify(r)} b: ${JSON.stringify(n)}`);return A(r,`a`),A(r,`b`),[r,n]};function la(e,n,r){if(oa(e)){let r=typeof n==`boolean`&&n;return e.reduce((e,n)=>la(n,r)+e,0)}if(e===void 0)throw TypeError(`Parameter 'aOrLine' is undefined`);let[i,a]=typeof n==`object`?ca(e,n):ca(e),o=a.x-i.x,s=a.y-i.y;if(!(typeof n==`boolean`?n:typeof r==`boolean`&&r)&&i.z!==void 0&&a.z!==void 0){let e=a.z-i.z;return Math.hypot(o,s,e)}return Math.hypot(o,s)}function ua(e,n,r,i){typeof r==`boolean`&&(i=r,r=void 0),O(i?k(e,``,`amount`):Fr(e,`amount`));let[a,o]=ca(n,r);return da({a,b:o},i)(e)}function da(e,n=!1){O(sa(e));let r=la(e),{a:i,b:a}=e;return e=>{O(n?k(e,``,`amount`):Fr(e,`amount`));let o=r*(1-e);if(r===0&&o===0)return Object.freeze({...a});let s=a.x-o*(a.x-i.x)/r,c=a.y-o*(a.y-i.y)/r;return Object.freeze({...a,x:s,y:c})}}const fa=(e,n=`Dimension`)=>{if(e===void 0)throw Error(`${n} is undefined`);if(Number.isNaN(e))throw Error(`${n} is NaN`);if(e<0)throw Error(`${n} cannot be negative`)},pa=(e,n=`rect`)=>{if(e===void 0)throw Error(`{$name} undefined`);ha(e)&&A(e,n),fa(e.width,n+`.width`),fa(e.height,n+`.height`)},ma=(e,n=`rect`)=>{if(!ha(e))throw Error(`Expected ${n} to have x,y`);pa(e,n)},ha=e=>e.x!==void 0&&e.y!==void 0,ga=e=>e!==void 0&&e.width!==void 0&&e.height!==void 0,_a=e=>ga(e)&&ha(e);function va(e,n,r){return fa(n,`width`),fa(r,`height`),A(e,`origin`),{x:e.x,y:e.y,width:n,height:r}}const ya=e=>e.quadratic!==void 0,ba=e=>e.cubic1!==void 0&&e.cubic2!==void 0,{abs:xa,cos:Sa,sin:Ca,acos:wa,atan2:Ta,sqrt:Ea,pow:Da}=Math;function Oa(e){return e<0?-Da(-e,1/3):Da(e,1/3)}const ka=Math.PI,Aa=2*ka,ja=ka/2,Ma=2**53-1||9007199254740991,Na=-(2**53-1)||-9007199254740991,Pa={x:0,y:0,z:0},M={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){let r=n(e),i=r.x*r.x+r.y*r.y;return r.z!==void 0&&(i+=r.z*r.z),Ea(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];let i=n.length-1;if(e===1)return n[i].t=1,n[i];let a=1-e,o=n;if(i===0)return n[0].t=e,n[0];if(i===1){let n={x:a*o[0].x+e*o[1].x,y:a*o[0].y+e*o[1].y,t:e};return r&&(n.z=a*o[0].z+e*o[1].z),n}if(i<4){let n=a*a,s=e*e,c,l,u,d=0;i===2?(o=[o[0],o[1],o[2],Pa],c=n,l=a*e*2,u=s):i===3&&(c=n*a,l=n*e*3,u=a*s*3,d=e*s);let f={x:c*o[0].x+l*o[1].x+u*o[2].x+d*o[3].x,y:c*o[0].y+l*o[1].y+u*o[2].y+d*o[3].y,t:e};return r&&(f.z=c*o[0].z+l*o[1].z+u*o[2].z+d*o[3].z),f}let s=JSON.parse(JSON.stringify(n));for(;s.length>1;){for(let n=0;n<s.length-1;n++)s[n]={x:s[n].x+(s[n+1].x-s[n].x)*e,y:s[n].y+(s[n+1].y-s[n].y)*e},s[n].z!==void 0&&(s[n].z=s[n].z+(s[n+1].z-s[n].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,n,r,i){let a=1-e,o=r,s=n,c=o[0],l=o[1],u=o[2],d=o[3],f;if(c*=a,l*=e,s.length===2)return f=c+l,{x:(c*s[0].x+l*s[1].x)/f,y:(c*s[0].y+l*s[1].y)/f,z:i?(c*s[0].z+l*s[1].z)/f:!1,t:e};if(c*=a,l*=2*a,u*=e*e,s.length===3)return f=c+l+u,{x:(c*s[0].x+l*s[1].x+u*s[2].x)/f,y:(c*s[0].y+l*s[1].y+u*s[2].y)/f,z:i?(c*s[0].z+l*s[1].z+u*s[2].z)/f:!1,t:e};if(c*=a,l*=1.5*a,u*=3*a,d*=e*e*e,s.length===4)return f=c+l+u+d,{x:(c*s[0].x+l*s[1].x+u*s[2].x+d*s[3].x)/f,y:(c*s[0].y+l*s[1].y+u*s[2].y+d*s[3].y)/f,z:i?(c*s[0].z+l*s[1].z+u*s[2].z+d*s[3].z)/f:!1,t:e}},derive:function(e,n){let r=[];for(let i=e,a=i.length,o=a-1;a>1;a--,o--){let e=[];for(let r=0,a;r<o;r++)a={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},n&&(a.z=o*(i[r+1].z-i[r].z)),e.push(a);r.push(e),i=e}return r},between:function(e,n,r){return n<=e&&e<=r||M.approximately(e,n)||M.approximately(e,r)},approximately:function(e,n,r){return xa(e-n)<=(r||1e-6)},length:function(e){let n=.5,r=M.Tvalues.length,i=0;for(let a=0,o;a<r;a++)o=n*M.Tvalues[a]+n,i+=M.Cvalues[a]*M.arcfn(o,e);return n*i},map:function(e,n,r,i,a){let o=r-n;return i+(a-i)*((e-n)/o)},lerp:function(e,n,r){let i={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(i.z=n.z+e*(r.z-n.z)),i},pointToString:function(e){let n=e.x+`/`+e.y;return e.z!==void 0&&(n+=`/`+e.z),n},pointsToString:function(e){return`[`+e.map(M.pointToString).join(`, `)+`]`},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){let i=n.x-e.x,a=n.y-e.y,o=r.x-e.x,s=r.y-e.y;return Ta(i*s-a*o,i*o+a*s)},round:function(e,n){let r=``+e,i=r.indexOf(`.`);return parseFloat(r.substring(0,i+1+n))},dist:function(e,n){let r=e.x-n.x,i=e.y-n.y;return Ea(r*r+i*i)},closest:function(e,n){let r=Da(2,63),i,a;return e.forEach(function(e,o){a=M.dist(n,e),a<r&&(r=a,i=o)}),{mdist:r,mpos:i}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(e===void 0)e=.5;else if(e===0||e===1)return e;let r=Da(e,n)+Da(1-e,n);return xa((r-1)/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(e===void 0)e=.5;else if(e===0||e===1)return e;let r=Da(1-e,n);return r/(Da(e,n)+r)},lli8:function(e,n,r,i,a,o,s,c){let l=(e*i-n*r)*(a-s)-(e-r)*(a*c-o*s),u=(e*i-n*r)*(o-c)-(n-i)*(a*c-o*s),d=(e-r)*(o-c)-(n-i)*(a-s);return d!=0&&{x:l/d,y:u/d}},lli4:function(e,n,r,i){let a=e.x,o=e.y,s=n.x,c=n.y,l=r.x,u=r.y,d=i.x,f=i.y;return M.lli8(a,o,s,c,l,u,d,f)},lli:function(e,n){return M.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new Wa(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=Ma,r=Ma,i=Na,a=Na;return e.forEach(function(e){let o=e.bbox();n>o.x.min&&(n=o.x.min),r>o.y.min&&(r=o.y.min),i<o.x.max&&(i=o.x.max),a<o.y.max&&(a=o.y.max)}),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:r,mid:(r+a)/2,max:a,size:a-r}}},shapeintersections:function(e,n,r,i,a){if(!M.bboxoverlap(n,i))return[];let o=[],s=[e.startcap,e.forward,e.back,e.endcap],c=[r.startcap,r.forward,r.back,r.endcap];return s.forEach(function(n){n.virtual||c.forEach(function(i){if(i.virtual)return;let s=n.intersects(i,a);s.length>0&&(s.c1=n,s.c2=i,s.s1=e,s.s2=r,o.push(s))})}),o},makeshape:function(e,n,r){let i=n.points.length,a=e.points.length,o=M.makeline(n.points[i-1],e.points[0]),s=M.makeline(e.points[a-1],n.points[0]),c={startcap:o,forward:e,back:n,endcap:s,bbox:M.findbbox([o,e,n,s])};return c.intersections=function(e){return M.shapeintersections(c,c.bbox,e,e.bbox,r)},c},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=Ma,a=Na,o,s;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let c=0,l=r.length;c<l;c++)o=r[c],s=e.get(o),s[n]<i&&(i=s[n]),s[n]>a&&(a=s[n]);return{min:i,mid:(i+a)/2,max:a,size:a-i}},align:function(e,n){let r=n.p1.x,i=n.p1.y,a=-Ta(n.p2.y-i,n.p2.x-r);return e.map(function(e){return{x:(e.x-r)*Sa(a)-(e.y-i)*Ca(a),y:(e.x-r)*Ca(a)+(e.y-i)*Sa(a)}})},roots:function(e,n){n||={p1:{x:0,y:0},p2:{x:1,y:0}};let r=e.length-1,i=M.align(e,n),a=function(e){return 0<=e&&e<=1};if(r===2){let e=i[0].y,n=i[1].y,r=i[2].y,o=e-2*n+r;if(o!==0){let i=-Ea(n*n-e*r),s=-e+n;return[-(i+s)/o,-(-i+s)/o].filter(a)}return n!==r&&o===0?[(2*n-r)/(2*n-2*r)].filter(a):[]}let o=i[0].y,s=i[1].y,c=i[2].y,l=i[3].y,u=-o+3*s-3*c+l,d=3*o-6*s+3*c,f=-3*o+3*s,p=o;if(M.approximately(u,0)){if(M.approximately(d,0))return M.approximately(f,0)?[]:[-p/f].filter(a);let e=Ea(f*f-4*d*p),n=2*d;return[(e-f)/n,(-f-e)/n].filter(a)}d/=u,f/=u,p/=u;let m=(3*f-d*d)/3,h=m/3,g=(2*d*d*d-9*d*f+27*p)/27,_=g/2,v=_*_+h*h*h,y,b,x,S,ee;if(v<0){let e=-m/3,n=Ea(e*e*e),r=-g/(2*n),i=wa(r<-1?-1:r>1?1:r),o=2*Oa(n);return x=o*Sa(i/3)-d/3,S=o*Sa((i+Aa)/3)-d/3,ee=o*Sa((i+2*Aa)/3)-d/3,[x,S,ee].filter(a)}if(v===0)return y=_<0?Oa(-_):-Oa(_),x=2*y-d/3,S=-y-d/3,[x,S].filter(a);{let e=Ea(v);return y=Oa(-_+e),b=Oa(_+e),[y-b-d/3].filter(a)}},droots:function(e){if(e.length===3){let n=e[0],r=e[1],i=e[2],a=n-2*r+i;if(a!==0){let e=-Ea(r*r-n*i),o=-n+r;return[-(e+o)/a,-(-e+o)/a]}return r!==i&&a===0?[(2*r-i)/(2*(r-i))]:[]}if(e.length===2){let n=e[0],r=e[1];return n===r?[]:[n/(n-r)]}return[]},curvature:function(e,n,r,i,a){let o,s,c,l,u=0,d=0,f=M.compute(e,n),p=M.compute(e,r),m=f.x*f.x+f.y*f.y;if(i?(o=Ea(Da(f.y*p.z-p.y*f.z,2)+Da(f.z*p.x-p.z*f.x,2)+Da(f.x*p.y-p.x*f.y,2)),s=Da(m+f.z*f.z,3/2)):(o=f.x*p.y-f.y*p.x,s=Da(m,3/2)),o===0||s===0)return{k:0,r:0};if(u=o/s,d=s/o,!a){let a=M.curvature(e-.001,n,r,i,!0).k,o=M.curvature(e+.001,n,r,i,!0).k;l=(o-u+(u-a))/2,c=(xa(o-u)+xa(u-a))/2}return{k:u,r:d,dk:l,adk:c}},inflections:function(e){if(e.length<4)return[];let n=M.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,a=n[1].x*n[2].y,o=n[3].x*n[2].y,s=18*(-3*r+2*i+3*a-o),c=18*(3*r-i-3*a),l=18*(a-r);if(M.approximately(s,0)){if(!M.approximately(c,0)){let e=-l/c;if(0<=e&&e<=1)return[e]}return[]}let u=2*s;if(M.approximately(u,0))return[];let d=c*c-4*s*l;if(d<0)return[];let f=Math.sqrt(d);return[(f-c)/u,-(c+f)/u].filter(function(e){return 0<=e&&e<=1})},bboxoverlap:function(e,n){let r=[`x`,`y`],i=r.length;for(let a=0,o,s,c,l;a<i;a++)if(o=r[a],s=e[o].mid,c=n[o].mid,l=(e[o].size+n[o].size)/2,xa(s-c)>=l)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){let i=e.bbox(),a=n.bbox(),o=1e5,s=r||.5;if(i.x.size+i.y.size<s&&a.x.size+a.y.size<s)return[(o*(e._t1+e._t2)/2|0)/o+`/`+(o*(n._t1+n._t2)/2|0)/o];let c=e.split(.5),l=n.split(.5),u=[{left:c.left,right:l.left},{left:c.left,right:l.right},{left:c.right,right:l.right},{left:c.right,right:l.left}];u=u.filter(function(e){return M.bboxoverlap(e.left.bbox(),e.right.bbox())});let d=[];return u.length===0?d:(u.forEach(function(e){d=d.concat(M.pairiteration(e.left,e.right,s))}),d=d.filter(function(e,n){return d.indexOf(e)===n}),d)},getccenter:function(e,n,r){let i=n.x-e.x,a=n.y-e.y,o=r.x-n.x,s=r.y-n.y,c=i*Sa(ja)-a*Ca(ja),l=i*Ca(ja)+a*Sa(ja),u=o*Sa(ja)-s*Ca(ja),d=o*Ca(ja)+s*Sa(ja),f=(e.x+n.x)/2,p=(e.y+n.y)/2,m=(n.x+r.x)/2,h=(n.y+r.y)/2,g=f+c,_=p+l,v=m+u,y=h+d,b=M.lli8(f,p,g,_,m,h,v,y),x=M.dist(b,e),S=Ta(e.y-b.y,e.x-b.x),ee=Ta(n.y-b.y,n.x-b.x),te=Ta(r.y-b.y,r.x-b.x),ne;return S<te?((S>ee||ee>te)&&(S+=Aa),S>te&&(ne=te,te=S,S=ne)):te<ee&&ee<S?(ne=te,te=S,S=ne):te+=Aa,b.s=S,b.e=te,b.r=x,b},numberSort:function(e,n){return e-n}};var Fa=class e{constructor(e){this.curves=[],this._3d=!1,e&&(this.curves=e,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return`[`+this.curves.map(function(e){return M.pointsToString(e.points)}).join(`, `)+`]`}addCurve(e){this.curves.push(e),this._3d=this._3d||e._3d}length(){return this.curves.map(function(e){return e.length()}).reduce(function(e,n){return e+n})}curve(e){return this.curves[e]}bbox(){let e=this.curves;for(var n=e[0].bbox(),r=1;r<e.length;r++)M.expandbox(n,e[r].bbox());return n}offset(n){let r=[];return this.curves.forEach(function(e){r.push(...e.offset(n))}),new e(r)}};const{abs:Ia,min:La,max:Ra,cos:za,sin:Ba,acos:Va,sqrt:Ha}=Math,Ua=Math.PI;var Wa=class e{constructor(e){let n=e&&e.forEach?e:Array.from(arguments).slice(),r=!1;if(typeof n[0]==`object`){r=n.length;let e=[];n.forEach(function(n){[`x`,`y`,`z`].forEach(function(r){n[r]!==void 0&&e.push(n[r])})}),n=e}let i=!1,a=n.length;if(r){if(r>4){if(arguments.length!==1)throw Error(`Only new Bezier(point[]) is accepted for 4th and higher order curves`);i=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw Error(`Only new Bezier(point[]) is accepted for 4th and higher order curves`);let o=this._3d=!i&&(a===9||a===12)||e&&e[0]&&e[0].z!==void 0,s=this.points=[];for(let e=0,r=o?3:2;e<a;e+=r){var c={x:n[e],y:n[e+1]};o&&(c.z=n[e+2]),s.push(c)}let l=this.order=s.length-1,u=this.dims=[`x`,`y`];o&&u.push(`z`),this.dimlen=u.length;let d=M.align(s,{p1:s[0],p2:s[l]}),f=M.dist(s[0],s[l]);this._linear=d.reduce((e,n)=>e+Ia(n.y),0)<f/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,i,a){return a===void 0&&(a=.5),a===0?new e(r,r,i):a===1?new e(n,r,r):new e(n,e.getABC(2,n,r,i,a).A,i)}static cubicFromPoints(n,r,i,a,o){a===void 0&&(a=.5);let s=e.getABC(3,n,r,i,a);o===void 0&&(o=M.dist(r,s.C));let c=o*(1-a)/a,l=M.dist(n,i),u=(i.x-n.x)/l,d=(i.y-n.y)/l,f=o*u,p=o*d,m=c*u,h=c*d,g={x:r.x-f,y:r.y-p},_={x:r.x+m,y:r.y+h},v=s.A,y={x:v.x+(g.x-v.x)/(1-a),y:v.y+(g.y-v.y)/(1-a)},b={x:v.x+(_.x-v.x)/a,y:v.y+(_.y-v.y)/a};return new e(n,{x:n.x+(y.x-n.x)/a,y:n.y+(y.y-n.y)/a},{x:i.x+(b.x-i.x)/(1-a),y:i.y+(b.y-i.y)/(1-a)},i)}static getUtils(){return M}getUtils(){return e.getUtils()}static get PolyBezier(){return Fa}valueOf(){return this.toString()}toString(){return M.pointsToString(this.points)}toSVG(){if(this._3d)return!1;let e=this.points,n=[`M`,e[0].x,e[0].y,this.order===2?`Q`:`C`];for(let r=1,i=e.length;r<i;r++)n.push(e[r].x),n.push(e[r].y);return n.join(` `)}setRatios(e){if(e.length!==this.points.length)throw Error(`incorrect number of ratio values`);this.ratios=e,this._lut=[]}verify(){let e=this.coordDigest();e!==this._print&&(this._print=e,this.update())}coordDigest(){return this.points.map(function(e,n){return``+n+e.x+e.y+(e.z?e.z:0)}).join(``)}update(){this._lut=[],this.dpoints=M.derive(this.points,this._3d),this.computedirection()}computedirection(){let e=this.points;this.clockwise=M.angle(e[0],e[this.order],e[1])>0}length(){return M.length(this.derivative.bind(this))}static getABC(e=2,n,r,i,a=.5){let o=M.projectionratio(a,e),s=1-o,c={x:o*n.x+s*i.x,y:o*n.y+s*i.y},l=M.abcratio(a,e);return{A:{x:r.x+(r.x-c.x)/l,y:r.y+(r.y-c.y)/l},B:r,C:c,S:n,E:i}}getABC(n,r){r||=this.get(n);let i=this.points[0],a=this.points[this.order];return e.getABC(this.order,i,r,a,n)}getLUT(e){if(this.verify(),e||=100,this._lut.length===e+1)return this._lut;this._lut=[],e++,this._lut=[];for(let n=0,r,i;n<e;n++)i=n/(e-1),r=this.compute(i),r.t=i,this._lut.push(r);return this._lut}on(e,n){n||=5;let r=this.getLUT(),i=[];for(let a=0,o,s=0;a<r.length;a++)o=r[a],M.dist(o,e)<n&&(i.push(o),s+=a/r.length);return i.length?t/=i.length:!1}project(e){let n=this.getLUT(),r=n.length-1,i=M.closest(n,e),a=i.mpos,o=(a-1)/r,s=(a+1)/r,c=.1/r,l=i.mdist,u=o,d=u,f;l+=1;for(let n;u<s+c;u+=c)f=this.compute(u),n=M.dist(e,f),n<l&&(l=n,d=u);return d=d<0?0:d>1?1:d,f=this.compute(d),f.t=d,f.d=l,f}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?M.computeWithRatios(e,this.points,this.ratios,this._3d):M.compute(e,this.points,this._3d,this.ratios)}raise(){let n=this.points,r=[n[0]],i=n.length;for(let e=1,a,o;e<i;e++)a=n[e],o=n[e-1],r[e]={x:(i-e)/i*a.x+e/i*o.x,y:(i-e)/i*a.y+e/i*o.y};return r[i]=n[i-1],new e(r)}derivative(e){return M.compute(e,this.dpoints[0],this._3d)}dderivative(e){return M.compute(e,this.dpoints[1],this._3d)}align(){let n=this.points;return new e(M.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(e){return M.curvature(e,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return M.inflections(this.points)}normal(e){return this._3d?this.__normal3(e):this.__normal2(e)}__normal2(e){let n=this.derivative(e),r=Ha(n.x*n.x+n.y*n.y);return{t:e,x:-n.y/r,y:n.x/r}}__normal3(e){let n=this.derivative(e),r=this.derivative(e+.01),i=Ha(n.x*n.x+n.y*n.y+n.z*n.z),a=Ha(r.x*r.x+r.y*r.y+r.z*r.z);n.x/=i,n.y/=i,n.z/=i,r.x/=a,r.y/=a,r.z/=a;let o={x:r.y*n.z-r.z*n.y,y:r.z*n.x-r.x*n.z,z:r.x*n.y-r.y*n.x},s=Ha(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;let c=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:e,x:c[0]*n.x+c[1]*n.y+c[2]*n.z,y:c[3]*n.x+c[4]*n.y+c[5]*n.z,z:c[6]*n.x+c[7]*n.y+c[8]*n.z}}hull(e){let n=this.points,r=[],i=[],a=0;for(i[a++]=n[0],i[a++]=n[1],i[a++]=n[2],this.order===3&&(i[a++]=n[3]);n.length>1;){r=[];for(let o=0,s,c=n.length-1;o<c;o++)s=M.lerp(e,n[o],n[o+1]),i[a++]=s,r.push(s);n=r}return i}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;let i=this.hull(n),a={left:this.order===2?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:this.order===2?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return a.left._t1=M.map(0,0,1,this._t1,this._t2),a.left._t2=M.map(n,0,1,this._t1,this._t2),a.right._t1=M.map(n,0,1,this._t1,this._t2),a.right._t2=M.map(1,0,1,this._t1,this._t2),r?(r=M.map(r,n,1,0,1),a.right.split(r).left):a}extrema(){let e={},n=[];return this.dims.forEach(function(r){let i=function(e){return e[r]},a=this.dpoints[0].map(i);e[r]=M.droots(a),this.order===3&&(a=this.dpoints[1].map(i),e[r]=e[r].concat(M.droots(a))),e[r]=e[r].filter(function(e){return e>=0&&e<=1}),n=n.concat(e[r].sort(M.numberSort))}.bind(this)),e.values=n.sort(M.numberSort).filter(function(e,r){return n.indexOf(e)===r}),e}bbox(){let e=this.extrema(),n={};return this.dims.forEach(function(r){n[r]=M.getminmax(this,r,e[r])}.bind(this)),n}overlaps(e){let n=this.bbox(),r=e.bbox();return M.bboxoverlap(n,r)}offset(n,r){if(r!==void 0){let e=this.get(n),i=this.normal(n),a={c:e,n:i,x:e.x+i.x*r,y:e.y+i.y*r};return this._3d&&(a.z=e.z+i.z*r),a}if(this._linear){let r=this.normal(0);return[new e(this.points.map(function(e){let i={x:e.x+n*r.x,y:e.y+n*r.y};return e.z&&r.z&&(i.z=e.z+n*r.z),i}))]}return this.reduce().map(function(e){return e._linear?e.offset(n)[0]:e.scale(n)})}simple(){if(this.order===3){let e=M.angle(this.points[0],this.points[3],this.points[1]),n=M.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&n<0||e<0&&n>0)return!1}let e=this.normal(0),n=this.normal(1),r=e.x*n.x+e.y*n.y;return this._3d&&(r+=e.z*n.z),Ia(Va(r))<Ua/3}reduce(){let e,n=0,r=0,i=.01,a,o=[],s=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),n=c[0],e=1;e<c.length;e++)r=c[e],a=this.split(n,r),a._t1=n,a._t2=r,o.push(a),n=r;return o.forEach(function(e){for(n=0,r=0;r<=1;)for(r=n+i;r<=1.01;r+=i)if(a=e.split(n,r),!a.simple()){if(r-=i,Ia(n-r)<i)return[];a=e.split(n,r),a._t1=M.map(n,0,1,e._t1,e._t2),a._t2=M.map(r,0,1,e._t1,e._t2),s.push(a),n=r;break}n<1&&(a=e.split(n,1),a._t1=M.map(n,0,1,e._t1,e._t2),a._t2=e._t2,s.push(a))}),s}translate(n,r,i){i=typeof i==`number`?i:r;let a=this.order,o=this.points.map((e,n)=>(1-n/a)*r+n/a*i);return new e(this.points.map((e,r)=>({x:e.x+n.x*o[r],y:e.y+n.y*o[r]})))}scale(n){let r=this.order,i=!1;if(typeof n==`function`&&(i=n),i&&r===2)return this.raise().scale(i);let a=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);let s=i?i(0):n,c=i?i(1):n,l=[this.offset(0,10),this.offset(1,10)],u=[],d=M.lli4(l[0],l[0].c,l[1],l[1].c);if(!d)throw Error(`cannot scale this curve. Try reducing it first.`);return[0,1].forEach(function(e){let n=u[e*r]=M.copy(o[e*r]);n.x+=(e?c:s)*l[e].n.x,n.y+=(e?c:s)*l[e].n.y}),i?([0,1].forEach(function(e){if(!(r===2&&e)){var s=o[e+1],c={x:s.x-d.x,y:s.y-d.y},l=i?i((e+1)/r):n;i&&!a&&(l=-l);var f=Ha(c.x*c.x+c.y*c.y);c.x/=f,c.y/=f,u[e+1]={x:s.x+l*c.x,y:s.y+l*c.y}}}),new e(u)):([0,1].forEach(e=>{if(r===2&&e)return;let n=u[e*r],i=this.derivative(e),a={x:n.x+i.x,y:n.y+i.y};u[e+1]=M.lli4(n,a,d,o[e+1])}),new e(u))}outline(n,r,i,a){if(r=r===void 0?n:r,this._linear){let o=this.normal(0),s=this.points[0],c=this.points[this.points.length-1],l,u,d;i===void 0&&(i=n,a=r),l={x:s.x+o.x*n,y:s.y+o.y*n},d={x:c.x+o.x*i,y:c.y+o.y*i},u={x:(l.x+d.x)/2,y:(l.y+d.y)/2};let f=[l,u,d];l={x:s.x-o.x*r,y:s.y-o.y*r},d={x:c.x-o.x*a,y:c.y-o.y*a},u={x:(l.x+d.x)/2,y:(l.y+d.y)/2};let p=[d,u,l],m=M.makeline(p[2],f[0]),h=M.makeline(f[2],p[0]);return new Fa([m,new e(f),h,new e(p)])}let o=this.reduce(),s=o.length,c=[],l=[],u,d=0,f=this.length(),p=i!==void 0&&a!==void 0;function m(e,n,r,i,a){return function(o){let s=i/r,c=(i+a)/r,l=n-e;return M.map(o,0,1,e+s*l,e+c*l)}}o.forEach(function(e){let o=e.length();p?(c.push(e.scale(m(n,i,f,d,o))),l.push(e.scale(m(-r,-a,f,d,o)))):(c.push(e.scale(n)),l.push(e.scale(-r))),d+=o}),l=l.map(function(e){return u=e.points,e.points=u[3]?[u[3],u[2],u[1],u[0]]:[u[2],u[1],u[0]],e}).reverse();let h=c[0].points[0],g=c[s-1].points[c[s-1].points.length-1],_=l[s-1].points[l[s-1].points.length-1],v=l[0].points[0],y=M.makeline(_,h),b=M.makeline(g,v);return new Fa([y].concat(c,[b],l))}outlineshapes(e,n,r){n||=e;let i=this.outline(e,n).curves,a=[];for(let e=1,n=i.length;e<n/2;e++){let o=M.makeshape(i[e],i[n-e],r);o.startcap.virtual=e>1,o.endcap.virtual=e<n/2-1,a.push(o)}return a}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof e&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(e){let n=La(e.p1.x,e.p2.x),r=La(e.p1.y,e.p2.y),i=Ra(e.p1.x,e.p2.x),a=Ra(e.p1.y,e.p2.y);return M.roots(this.points,e).filter(e=>{var o=this.get(e);return M.between(o.x,n,i)&&M.between(o.y,r,a)})}selfintersects(e){let n=this.reduce(),r=n.length-2,i=[];for(let a=0,o,s,c;a<r;a++)s=n.slice(a,a+1),c=n.slice(a+2),o=this.curveintersects(s,c,e),i.push(...o);return i}curveintersects(e,n,r){let i=[];e.forEach(function(e){n.forEach(function(n){e.overlaps(n)&&i.push({left:e,right:n})})});let a=[];return i.forEach(function(e){let n=M.pairiteration(e.left,e.right,r);n.length>0&&(a=a.concat(n))}),a}arcs(e){return e||=.5,this._iterate(e,[])}_error(e,n,r,i){let a=(i-r)/4,o=this.get(r+a),s=this.get(i-a),c=M.dist(e,n),l=M.dist(e,o),u=M.dist(e,s);return Ia(l-c)+Ia(u-c)}_iterate(e,n){let r=0,i=1,a;do{a=0,i=1;let o=this.get(r),s,c,l,u,d=!1,f=!1,p,m=i,h=1,g=0;do if(f=d,u=l,m=(r+i)/2,g++,s=this.get(m),c=this.get(i),l=M.getccenter(o,s,c),l.interval={start:r,end:i},d=this._error(l,o,r,i)<=e,p=f&&!d,p||(h=i),d){if(i>=1){if(l.interval.end=h=1,u=l,i>1){let e={x:l.x+l.r*za(l.e),y:l.y+l.r*Ba(l.e)};l.e+=M.angle({x:l.x,y:l.y},e,this.get(1))}break}i+=(i-r)/2}else i=m;while(!p&&a++<100);if(a>=100)break;u||=l,n.push(u),r=h}while(i<1);return n}},Ga=Er({cubic:()=>Xa,interpolator:()=>qa,isCubicBezier:()=>ba,isQuadraticBezier:()=>ya,quadratic:()=>Qa,quadraticSimple:()=>Ka,quadraticToSvgString:()=>Ja,toPath:()=>Ya});const Ka=(e,n,r=0)=>{if(Number.isNaN(r))throw Error(`bend is NaN`);if(r<-1||r>1)throw Error(`Expects bend range of -1 to 1`);let i=ua(.5,e,n),a=i;return a=n.y<e.y?r>0?{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y)}:{x:Math.max(e.x,n.x),y:Math.max(e.y,n.y)}:r>0?{x:Math.max(e.x,n.x),y:Math.min(e.y,n.y)}:{x:Math.min(e.x,n.x),y:Math.max(e.y,n.y)},Qa(e,n,ua(Math.abs(r),i,a))},qa=e=>{let n=ba(e)?new Wa(e.a.x,e.a.y,e.cubic1.x,e.cubic1.y,e.cubic2.x,e.cubic2.y,e.b.x,e.b.y):new Wa(e.a,e.quadratic,e.b);return e=>n.compute(e)},Ja=(e,n,r)=>[`M ${e.x} ${e.y} Q ${r.x} ${r.y} ${n.x} ${n.y}`],Ya=e=>{if(ba(e))return Za(e);if(ya(e))return $a(e);throw Error(`Unknown bezier type`)},Xa=(e,n,r,i)=>({a:Object.freeze(e),b:Object.freeze(n),cubic1:Object.freeze(r),cubic2:Object.freeze(i)}),Za=e=>{let{a:n,cubic1:r,cubic2:i,b:a}=e,o=new Wa(n,r,i,a);return Object.freeze({...e,length:()=>o.length(),interpolate:e=>o.compute(e),nearest:e=>{throw Error(`not implemented`)},bbox:()=>{let{x:e,y:n}=o.bbox(),r=e.size,i=n.size;if(r===void 0||i===void 0)throw Error(`x.size not present on calculated bbox`);return va({x:e.min,y:n.min},r,i)},relativePosition:(e,n)=>{throw Error(`Not implemented`)},distanceToPoint:e=>{throw Error(`Not implemented`)},toSvgString:()=>[`brrup`],kind:`bezier/cubic`})},Qa=(e,n,r)=>({a:Object.freeze(e),b:Object.freeze(n),quadratic:Object.freeze(r)}),$a=e=>{let{a:n,b:r,quadratic:i}=e,a=new Wa(n,i,r);return Object.freeze({...e,length:()=>a.length(),interpolate:e=>a.compute(e),nearest:e=>{throw Error(`not implemented`)},bbox:()=>{let{x:e,y:n}=a.bbox(),r=e.size,i=n.size;if(r===void 0||i===void 0)throw Error(`x.size not present on calculated bbox`);return va({x:e.min,y:n.min},r,i)},distanceToPoint:e=>{throw Error(`Not implemented`)},relativePosition:(e,n)=>{throw Error(`Not implemented`)},toString:()=>a.toString(),toSvgString:()=>Ja(n,r,i),kind:`bezier/quadratic`})},eo=(e,n=`circle`)=>{if(io(e)&&A(e,`circle`),Number.isNaN(e.radius))throw Error(`${n}.radius is NaN`);if(e.radius<=0)throw Error(`${n}.radius must be greater than zero`)},to=(e,n=`circle`)=>{if(!io(e))throw Error(`Expected a positioned circle with x,y`);eo(e,n)},no=e=>e.x!==void 0&&e.y!==void 0,ro=e=>e.radius!==void 0,io=e=>ro(e)&&no(e);function ao(e,n,r,i,a,o){let[s,c]=Ni(e,n,r,i,a,o);A(s,`a`),A(c,`b`);let l={x:s.x+c.x,y:s.y+c.y};return(j(s)||j(c))&&(l.z=(s.z??0)+(c.z??0)),Object.freeze(l)}const oo=(e,n)=>(to(e,`a`),io(n)&&to(n,`b`),Fi(e,n)),so=(e,n)=>{if(to(e,`a`),io(n))return Math.max(0,oo(e,n)-e.radius-n.radius);if(Gr(n)){let r=Fi(e,n);return r<e.radius?0:r}throw Error(`Second parameter invalid type`)};function co(e,n,r,i,a,o){let[s,c]=Ni(e,n,r,i,a,o);A(s,`a`),A(c,`b`);let l={x:s.x*c.x,y:s.y*c.y};return(j(s)||j(c))&&(l.z=(s.z??0)*(c.z??0)),Object.freeze(l)}const lo=(e,n)=>j(e)?Object.freeze({...e,x:e.x*n,y:e.y*n,z:e.z*n}):Object.freeze({...e,x:e.x*n,y:e.y*n}),uo=(...e)=>{if(e===void 0)throw Error(`parameter 'p' is undefined`);if(e.length<2)return!0;for(let n=1;n<e.length;n++)if(e[n].x!==e[0].x||e[n].y!==e[0].y)return!1;return!0};function fo(e,n){return e.x<n.x&&e.y<n.y?-2:e.x>n.x&&e.y>n.y?2:e.x<n.x||e.y<n.y?-1:e.x>n.x||e.y>n.y?1:e.x===n.x&&e.x===n.y?0:NaN}function po(e,n){return e.y<n.y?-1:e.y>n.y?1:e.x<n.x?-1:+(e.x>n.x)}function mo(e,n){let r=po(e,n)<=0?e:n;return{topLeft:r,bottomRight:r===e?n:e}}function ho(e,n){return e.x===n.x?0:e.x<n.x?-1:1}function go(e,n){return e.y===n.y?0:e.y<n.y?-1:1}function _o(e,n){return e.z===n.z?0:e.z<n.z?-1:1}const vo=(e,n=null,r=new WeakSet,i=``)=>{if(e===null)return e;if(typeof e!=`object`)throw TypeError(`Param 'value' must be an object. Got type: ${typeof e}`);r.add(e);let a=Object.entries(e);for(let e of a)if(e[1]!==null&&typeof e[1]==`object`){if(r.has(e[1])){e[1]=n;continue}e[1]=vo(e[1],n,r,`${e[0]}.`)}return Object.fromEntries(a)};function yo(e){return typeof e==`string`?e:JSON.stringify(e)}function bo(e){if(e===null)return`null`;if(typeof e==`boolean`||typeof e==`number`)return e.toString();if(typeof e==`string`)return e;if(typeof e==`symbol`)throw TypeError(`Symbol cannot be converted to string`);try{return JSON.stringify(e)}catch(n){if(typeof e==`object`)return JSON.stringify(vo(e,`(circular)`));throw n}}function xo(e){return typeof e==`string`?e:JSON.stringify(e,(e,n)=>n instanceof Object&&!Array.isArray(n)?Object.keys(n).sort().reduce((e,r)=>(e[r]=n[r],e),{}):n)}const So=(e,n)=>e===n;function Co(e,n){return e===n||yo(e)===yo(n)}function wo(e,n){return e===n||xo(e)===xo(n)}function To(e,n){return e===n?0:e>n?1:-1}function Eo(e,n){if(e===void 0&&n===void 0)return 0;if(e===void 0)return 1;if(n===void 0)return-1;let r=bo(e),i=bo(n);return r<i?-1:+(r>i)}function Do(e,n){return typeof e==`number`&&typeof n==`number`?To(e,n):Eo(e,n)}const Oo=(e,n)=>(r,i)=>{let a=e.get(r);return a===void 0?(a=n(r,i),e.set(r,a),a):a};var ko=Object.defineProperty,Ao=(e,n)=>{let r={};for(var i in e)ko(r,i,{get:e[i],enumerable:!0});return n||ko(r,Symbol.toStringTag,{value:`Module`}),r};function jo(e,n=15){if(O(Ir(n,`aboveZero`,`maxLength`)),typeof e!=`string`)throw Error(`Parameter 'source' is not a string`);if(e.length>n&&e.length>3){if(n>15){let r=Math.round((n-2)/2);return`${e.slice(0,r)}...${e.slice(-r)}`}return`${e.slice(0,n)}...`}return e}function Mo(e,n=20){return e===void 0?`(undefined)`:e===null?`(null)`:jo(JSON.stringify(e),n)}function No(e){return typeof e==`number`||typeof e==`string`||typeof e==`bigint`||typeof e==`boolean`}const Po=(e,n=0,r={})=>{let i=Fo(n,0);O(Ir(i,`positive`,`interval`));let a=r.fireBeforeWait??!1,o=r.onStartCalled,s=r.signal,c=!1,l=`idle`,u=0,d=0,f=performance.now(),p=n??0,m=!1,h,g=()=>{h!==void 0&&(globalThis.clearTimeout(h),h=void 0,u=0,f=NaN)},_=e=>{i===0?typeof requestAnimationFrame>`u`?h=globalThis.setTimeout(e,0):(h=void 0,requestAnimationFrame(e)):h=globalThis.setTimeout(e,i)},v=()=>{m||(m=!0,l!==`idle`&&(l=`idle`,g()))},y=async()=>{if(s?.aborted&&(l=`idle`),l===`idle`)return;l=`running`,u++,d++;let n=e(u,performance.now()-f),r=typeof n==`object`?await n:n;if(!m){if(l=`scheduled`,r!==void 0&&!r){v();return}m||_(y)}},b=()=>{if(c)throw Error(`Disposed`);if(m=!1,o!==void 0)switch(o(u,performance.now()-f)){case`cancel`:v();return;case`reset`:x();return;case`dispose`:c=!0,v();return}l===`idle`&&(u=0,f=performance.now(),l=`scheduled`,a?y():_(y))},x=()=>{if(c)throw Error(`Disposed`);m=!1,u=0,f=NaN,l!==`idle`&&v(),b()};return{start:b,reset:x,cancel:v,get interval(){return p},get runState(){return l},get startCountTotal(){return d},get startCount(){return u},set interval(e){let n=Fo(e,0);O(Ir(n,`positive`,`interval`)),i=n,p=e},get isDisposed(){return c},get elapsedMs(){return performance.now()-f}}};function Fo(e,n){if(Io(e)){if(typeof e==`number`)return e;let n=e.millis??0;return n+=(e.hours??0)*60*60*1e3,n+=(e.mins??0)*60*1e3,n+=(e.secs??0)*1e3,n}if(n!==void 0)return n;throw Error(`Not a valid interval: ${JSON.stringify(e)}`)}function Io(e){if(e==null)return!1;if(typeof e==`number`)return!(Number.isNaN(e)||!Number.isFinite(e));if(typeof e!=`object`)return!1;let n=`millis`in e,r=`secs`in e,i=`mins`in e,a=`hours`in e;return n&&!k(e.millis).success||r&&!k(e.secs).success||i&&!k(e.mins).success||a&&!k(e.hours).success?!1:!!(n||r||a||i)}(typeof window>`u`||!(`requestAnimationFrame`in window))&&typeof window>`u`&&(globalThis.requestAnimationFrame=e=>{setTimeout(e,1)});var Lo=class{#e=new Map;get(e){let n=this.#e.get(e);return n?[...n]:[]}size(e){let n=this.#e.get(e);return n?n.length:0}*iterateKey(e){let n=this.#e.get(e);n&&(yield*n.values())}*iterateValues(){for(let e of this.#e.keys())yield*this.iterateKey(e)}*iterateKeys(){yield*this.#e.keys()}addKeyedValues(e,...n){let r=this.#e.get(e);r||(r=[],this.#e.set(e,r)),r.push(...n)}deleteKeyValue(e,n){let r=this.#e.get(e);if(!r)return!1;let i=r.filter(e=>e!==n);return i.length!==r.length&&(this.#e.set(e,i),!0)}clear(){this.#e.clear()}},Ro=class{#e=new Lo;#t=!1;dispose(){this.#t||this.clearEventListeners()}get isDisposed(){return this.#t}fireEvent(e,n){if(this.#t)throw Error(`Disposed`);for(let r of this.#e.iterateKey(e))r(n,this)}addEventListener(e,n){if(this.#t)throw Error(`Disposed`);this.#e.addKeyedValues(e,n)}removeEventListener(e,n){this.#t||this.#e.deleteKeyValue(e,n)}clearEventListeners(){this.#t||this.#e.clear()}};function zo(e,n,r){pa(e,`rect`);let i=0,a=0;if(typeof n==`number`){if(r===void 0)throw Error(`x and y coordinate needed`);i=n,a=r}else i=n.x,a=n.y;if(ha(e)){if(i-e.x>e.width||i<e.x||a-e.y>e.height||a<e.y)return!1}else if(i>e.width||i<0||a>e.height||a<0)return!1;return!0}function Bo(e,n){if(ma(e,`rect`),A(n,`pt`),zo(e,n))return 0;let r=Math.max(e.x-n.x,0,n.x-e.x+e.width),i=Math.max(e.y-n.y,0,n.y-e.y+e.height);return Math.hypot(r,i)}const Vo=(...e)=>{let n=[],r=e[0];for(let i=1;i<e.length;i++)n.push(ea(r,e[i])),r=e[i];return n},Ho=(e,n,r)=>{let i=n.length+r.length,a=e.discardPolicy??`additions`,o=e.capacity??i,s=i-o;switch(e.debug&&console.log(`Stack.push: stackLen: ${n.length} potentialLen: ${i} toRemove: ${s} policy: ${a}`),a){case`additions`:return e.debug&&console.log(`Stack.push:DiscardAdditions: stackLen: ${n.length} slice: ${i-o} toAddLen: ${r.length}`),n.length===e.capacity?n:[...n,...r.slice(0,r.length-s)];case`newer`:{if(r.length>=o)return r.slice(r.length-o);let e=o-r.length;return[...n.slice(0,e),...r]}case`older`:return[...n,...r].slice(s);default:throw Error(`Unknown discard policy ${a}`)}},Uo=(e,n,...r)=>{let i=n.length+r.length;return e.capacity&&i>e.capacity?Ho(e,n,r):[...n,...r]},Wo=(e,n)=>{if(n.length===0)throw Error(`Stack is empty`);return n.slice(0,-1)},Go=(e,n)=>n.at(-1),Ko=(e,n)=>n.length===0,qo=(e,n)=>e.capacity?n.length>=e.capacity:!1;var Jo=class{opts;data;constructor(e={},n=[]){this.opts=e,this.data=n}push(...e){return e.length===0||(this.data=Uo(this.opts,this.data,...e)),this.data.length}forEach(e){this.data.forEach(e)}forEachFromTop(e){[...this.data].reverse().forEach(e)}pop(){let e=Go(this.opts,this.data);return this.data=Wo(this.opts,this.data),e}get isEmpty(){return Ko(this.opts,this.data)}get isFull(){return qo(this.opts,this.data)}get peek(){return Go(this.opts,this.data)}get length(){return this.data.length}};const Yo=(e,n)=>{e.debug&&console.log(`queue:${n}`)},Xo=(e,n,r)=>{let i=n.length+r.length,a=e.capacity??i,o=i-a,s=e.discardPolicy??`additions`;switch(s){case`additions`:return n.length===0?r.slice(0,r.length-o):n.length===e.capacity?n:[...n,...r.slice(0,o-1)];case`newer`:if(o>=n.length)return n.length===0?[...r.slice(0,a-1),r.at(-1)]:r.slice(Math.max(0,r.length-a),Math.min(r.length,a)+1);{let e=Math.max(1,r.length-n.length),i=r.slice(r.length-e,r.length);return[...n.slice(0,Math.min(n.length,a-1)),...i]}case`older`:return[...n,...r].slice(o);default:throw Error(`Unknown overflow policy ${s}`)}},Zo=(e,n,...r)=>{if(e===void 0)throw Error(`opts parameter undefined`);let i=n.length+r.length,a=e.capacity&&i>e.capacity,o=a?Xo(e,n,r):[...n,...r];if(e.capacity&&o.length!==e.capacity&&a)throw Error(`Bug! Expected return to be at capacity. Return len: ${o.length} capacity: ${e.capacity} opts: ${JSON.stringify(e)}`);if(!e.capacity&&o.length!==i)throw Error(`Bug! Return length not expected. Return len: ${o.length} expected: ${i} opts: ${JSON.stringify(e)}`);return o},Qo=(e,n)=>{if(n.length===0)throw Error(`Queue is empty`);return n.slice(1)},$o=(e,n)=>n[0],es=(e,n)=>n.length===0,ts=(e,n)=>e.capacity?n.length>=e.capacity:!1;var ns=class extends Ro{options;data;eq;constructor(e={},n=[]){if(super(),e===void 0)throw Error(`opts parameter undefined`);this.options=e,this.data=n,this.eq=e.eq??So}clear(){let e=[...this.data];this.data=[],this.fireEvent(`removed`,{finalData:this.data,removed:e}),this.onClear()}onClear(){}at(e){if(e>=this.data.length)throw Error(`Index outside bounds of queue`);let n=this.data.at(e);if(n===void 0)throw Error(`Index appears to be outside range of queue`);return n}enqueue(...e){this.data=Zo(this.options,this.data,...e);let n=this.data.length;return this.onEnqueue(this.data,e),n}onEnqueue(e,n){this.fireEvent(`enqueue`,{added:n,finalData:e})}dequeue(){let e=$o(this.options,this.data);if(e!==void 0)return this.data=Qo(this.options,this.data),this.fireEvent(`dequeue`,{removed:e,finalData:this.data}),this.onRemoved([e],this.data),e}onRemoved(e,n){this.fireEvent(`removed`,{removed:e,finalData:n})}removeWhere(e){let n=this.data.length,r=this.data.filter(n=>e(n));return r.length===0?0:(this.data=this.data.filter(n=>!e(n)),this.onRemoved(r,this.data),n-this.data.length)}toArray(){return[...this.data]}get isEmpty(){return es(this.options,this.data)}get isFull(){return ts(this.options,this.data)}get length(){return this.data.length}get peek(){return $o(this.options,this.data)}};function rs(e={},...n){return new ns({...e},[...n])}const is=e=>typeof e!=`object`||!e?!1:Symbol.asyncIterator in e;function as(e){let n;for(let r of e)n=r;return n}function*os(e,n=(e,n)=>e>n){let r;for(let i of e){if(r===void 0){r=i,yield r;continue}n(i,r)&&(r=i,yield r)}return r}function*ss(e,n=(e,n)=>e>n){let r;for(let i of e)r===void 0&&(r=i,yield r),n(r,i)&&(r=i,yield r)}async function cs(e,n={}){let r=n.abort,i;for await(let n of e){if(r?.aborted)return;i=n}return i}async function*ls(e,n=((e,n)=>e>n)){let r;for await(let i of e){if(r===void 0){r=i,yield r;continue}n(i,r)&&(r=i,yield i)}}async function*us(e,n=(e,n)=>e>n){let r;for await(let i of e){if(r===void 0){r=i,yield r;continue}n(r,i)&&(r=i,yield i)}return r}function ds(e,n=(e,n)=>e>n){return is(e)?us(e,n):ss(e,n)}function fs(e,n=(e,n)=>e>n){return is(e)?ls(e,n):os(e,n)}function ps(e){return is(e)?cs(e):as(e)}var ms=class extends ns{constructor(e={}){e.eq===void 0&&(e={...e,eq:(e,n)=>So(e.item,n.item)}),super(e)}enqueueWithPriority(e,n){O(k(n,`positive`)),super.enqueue({item:e,priority:n})}changePriority(e,n,r=!1,i){if(e===void 0)throw Error(`Item cannot be undefined`);let a;for(let n of this.data)if(i){if(i(n.item,e)){a=n;break}}else if(this.eq(n,{item:e,priority:0})){a=n;break}if(a===void 0&&!r)throw Error(`Item not found in priority queue. Item: ${JSON.stringify(e)}`);a!==void 0&&this.removeWhere(e=>a===e),this.enqueueWithPriority(e,n)}dequeueMax(){let e=ps(fs(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return this.removeWhere(n=>n===e),e.item}dequeueMin(){let e=ps(fs(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return this.removeWhere(n=>n.item===e),e.item}peekMax(){let e=ps(fs(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return e.item}peekMin(){let e=ps(ds(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return e.item}};function hs(e={}){return new ms(e)}var gs=class e{opts;#e;constructor(e={},n=[]){if(e===void 0)throw Error(`opts parameter undefined`);this.opts=e,this.#e=n}forEach(e){for(let n=this.#e.length-1;n>=0;n--)e(this.#e[n])}forEachFromFront(e){this.#e.forEach(n=>{e(n)})}enqueue(...n){return new e(this.opts,Zo(this.opts,this.#e,...n))}dequeue(){return new e(this.opts,Qo(this.opts,this.#e))}get isEmpty(){return es(this.opts,this.#e)}get isFull(){return ts(this.opts,this.#e)}get length(){return this.#e.length}get peek(){return $o(this.opts,this.#e)}toArray(){return[...this.#e]}};const _s=(e={},...n)=>(e={...e},new gs(e,[...n]));var vs=Ao({PriorityMutable:()=>ms,QueueImmutable:()=>gs,QueueMutable:()=>ns,debug:()=>Yo,dequeue:()=>Qo,enqueue:()=>Zo,immutable:()=>_s,isEmpty:()=>es,isFull:()=>ts,mutable:()=>rs,peek:()=>$o,priority:()=>hs,trimQueue:()=>Xo});const ys=(e,n,r=wo,i)=>{let a=Ss(e,n,r),o=xs(e,n,r),s={valueChanged:!a,a:e,b:n,added:o.added,removed:o.removed,childChanged:!1},c={value:s,childrenStore:[],parent:i},l=o.identical.map(e=>ys(e[0],e[1],r,c)),u=bs(s)||l.some(e=>bs(e.value));return fc(c,l),c.toString=()=>ws(c,0),c.value.childChanged=u,Rs(c),c},bs=e=>e!==void 0&&!!(e.valueChanged||e.childChanged||e.added.length>0||e.removed.length>0),xs=(e,n,r=wo)=>{let i=[...e.children()],a=[...n.children()],o=[],s=[];for(let e of i){let n=-1;for(let[i,s]of a.entries())if(Ss(e,s,r)){o.push([e,s]),n=i;break}n===-1?s.push(e):a.splice(n,1)}return{added:[...a],identical:o,removed:s}},Ss=(e,n,r)=>!!(e.getIdentity()===n.getIdentity()||r(e.getValue(),n.getValue())),Cs=e=>JSON.stringify(e.getValue()),ws=(e,n=0)=>{if(e===void 0)return`(undefined)`;let r=Ts(e.value,n);for(let i of e.childrenStore)r+=ws(i,n+2);return r},Ts=(e,n)=>{let r=` `.repeat(n);if(e===void 0)return`${r}(undefined)`;let i=[];if(i.push(`a: ${Cs(e.a)} b: ${Cs(e.b)}`),e.valueChanged?i.push(`Value changed. Child changed: ${e.childChanged}`):i.push(`Value unchanged. Child changed: ${e.childChanged}`),e.added.length>0){i.push(`Added:`);for(let n of e.added)i.push(` - `+Cs(n))}if(e.removed.length>0){i.push(`Removed: ${e.removed.length}`);for(let n of e.removed)i.push(` - `+Cs(n))}return i.push(`----
|
|
3331
|
+
`}};E([d({type:Array})],xr.prototype,`items`,void 0),E([d({type:Boolean,reflect:!0})],xr.prototype,`multiline`,void 0),E([d({type:Boolean,attribute:`items-inert`,reflect:!0})],xr.prototype,`itemsInert`,void 0),E([d({type:String,attribute:`item-display`,reflect:!0})],xr.prototype,`itemDisplay`,void 0),E([d({type:String,reflect:!0})],xr.prototype,`orientation`,void 0),E([d({type:String})],xr.prototype,`placeholder`,void 0),E([d({type:Boolean,reflect:!0})],xr.prototype,`disabled`,void 0),E([m()],xr.prototype,`_open`,void 0),E([m()],xr.prototype,`_draft`,void 0),E([m()],xr.prototype,`_order`,void 0),E([m()],xr.prototype,`_size`,void 0),xr=E([T(`ixfx-checked-select`)],xr);var Sr=Object.defineProperty,Cr=(e,n)=>{let r={};for(var i in e)Sr(r,i,{get:e[i],enumerable:!0});return n||Sr(r,Symbol.toStringTag,{value:`Module`}),r},wr=Object.defineProperty,Tr=(e,n)=>{let r={};for(var i in e)wr(r,i,{get:e[i],enumerable:!0});return n||wr(r,Symbol.toStringTag,{value:`Module`}),r};function Er(e){return typeof e==`string`?e:e instanceof Error?e.message:String(e)}function Dr(...e){let n=e.filter(e=>Or(e));if(n.length===0)return;let r=n.map(e=>jr(e));throw Error(r.join(`, `))}function k(...e){for(let n of e){if(n===void 0)continue;if(typeof n==`boolean`){if(n)continue;throw kr.fromString(`Guard failed: false result`)}let e=typeof n==`object`?n:n();if(e!==void 0&&!e.success)throw Ar(e)}return!0}function Or(e){return typeof e!=`object`||!e?!1:!e.success}var kr=class e extends Error{cause;constructor(e,n){super(e),this.cause=n}static fromError(n,r){let i=n.message,a=n.stack,o=n.name,s=new e(i,r);return s.stack=a,s.name=`IxfxError(${o})`,s}static fromString(n,r){let i=new e(n,r);return i.name=`IxfxError`,i}};function Ar(e){return typeof e.error==`string`?kr.fromString(e.error,e.info):e.error instanceof Error?kr.fromError(e.error,e.info):kr.fromString(JSON.stringify(e.error),e.info)}function jr(e){return e.error instanceof Error?Er(e.error):typeof e.error==`string`?e.error:JSON.stringify(e.error)}function Mr(e,n){return{success:!1,error:e,info:n}}function Nr(...e){let n;for(let r of e){if(typeof r==`boolean`){if(r)continue;return{success:!1,error:`Guard failed: false result`}}if(n=typeof r==`object`?r:r(),n!==void 0&&!n.success)return n}if(!n)throw Error(`No results`);return n}const A=(e,n=``,r=`?`,i)=>{if(e===null)return{success:!1,error:`Parameter '${r}' is null`,info:i};if(e===void 0)return{success:!1,error:`Parameter '${r}' is undefined`,info:i};if(Number.isNaN(e))return{success:!1,error:`Parameter '${r}' is NaN`,info:i};if(typeof e!=`number`)return{success:!1,error:`Parameter '${r}' is not a number (${JSON.stringify(e)})`,info:i};switch(n){case`finite`:if(!Number.isFinite(e))return{success:!1,error:`Parameter '${r} must be finite (Got: ${e})`,info:i};break;case`positive`:if(e<0)return{success:!1,error:`Parameter '${r}' must be at least zero (${e})`,info:i};break;case`negative`:if(e>0)return{success:!1,error:`Parameter '${r}' must be zero or lower (${e})`,info:i};break;case`aboveZero`:if(e<=0)return{success:!1,error:`Parameter '${r}' must be above zero (${e})`,info:i};break;case`belowZero`:if(e>=0)return{success:!1,error:`Parameter '${r}' must be below zero (${e})`,info:i};break;case`percentage`:if(e>1||e<0)return{success:!1,error:`Parameter '${r}' must be in percentage range (0 to 1). (${e})`,info:i};break;case`nonZero`:if(e===0)return{success:!1,error:`Parameter '${r}' must non-zero. (${e})`,info:i};break;case`bipolar`:if(e>1||e<-1)return{success:!1,error:`Parameter '${r}' must be in bipolar percentage range (-1 to 1). (${e})`,info:i}}return{success:!0,value:e,info:i}},Pr=(e,n=`?`,r)=>A(e,`percentage`,n,r),Fr=(e,n=``,r=`?`)=>Nr(A(e,n,r),()=>Number.isInteger(e)?{success:!0,value:e}:{success:!1,error:`Param '${r}' is not an integer`}),Ir=(e,n,r,i=`?`)=>typeof e==`number`?Number.isNaN(e)?{success:!1,error:`Param '${i}' is not within range ${n}-${r}. Got: NaN`}:Number.isFinite(e)?e<n?{success:!1,error:`Param '${i}' is below range ${n}-${r}. Got: ${e}`}:e>r?{success:!1,error:`Param '${i}' is above range ${n}-${r}. Got: ${e}`}:{success:!0,value:e}:{success:!1,error:`Param '${i}' is not within range ${n}-${r}. Got: infinite`}:{success:!1,error:`Param '${i}' is not a number type. Got type: '${typeof e}' value: '${JSON.stringify(e)}'`},Lr=(e,n=`?`)=>e===void 0?{success:!1,error:`${n} param is undefined`}:e===null?{success:!1,error:`${n} param is null`}:{success:!0,value:e},Rr=(e,n=`?`)=>e===void 0?{success:!1,error:`Param '${n}' is undefined. Expected: function.`}:e===null?{success:!1,error:`Param '${n}' is null. Expected: function.`}:typeof e==`function`?{success:!0,value:e}:{success:!1,error:`Param '${n}' is type '${typeof e}'. Expected: function`};function zr(e,n=``,r=`?`){return typeof e==`string`?n===`non-empty`&&e.length===0?{success:!1,error:`Param '${r} is empty`}:{success:!0,value:e}:{success:!1,error:`Param '${r} is not type string. Got: ${typeof e}`}}function Br(e){return M(e)&&e.z!==null?!1:e.x===null&&e.y===null}function Vr(e){return M(e)&&!Number.isNaN(e.z)?!1:Number.isNaN(e.x)||Number.isNaN(e.y)}function Hr(e,n=`Point`,r=``){if(e===void 0)return Mr(`'${n}' is undefined. Expected {x,y} got ${JSON.stringify(e)}`,r);if(e===null)return Mr(`'${n}' is null. Expected {x,y} got ${JSON.stringify(e)}`,r);if(typeof e!=`object`)return Mr(`'${n}' is type '${typeof e}'. Expected object.`,r);if(e.x===void 0)return Mr(`'${n}.x' is undefined. Expected {x,y} got ${JSON.stringify(e)}`,r);if(e.y===void 0)return Mr(`'${n}.y' is undefined. Expected {x,y} got ${JSON.stringify(e)}`,r);if(typeof e.x!=`number`)return Mr(`'${n}.x' must be a number. Got ${typeof e.x}`,r);if(typeof e.y!=`number`)return Mr(`'${n}.y' must be a number. Got ${typeof e.y}`,r);if(e.z!==void 0){if(typeof e.z!=`number`)return Mr(`${n}.z must be a number. Got: ${typeof e.z}`,r);if(Number.isNaN(e.z))return Mr(`'${n}.z' is NaN. Got: ${JSON.stringify(e)}`,r)}return e.x===null?Mr(`'${n}.x' is null`,r):e.y===null?Mr(`'${n}.y' is null`,r):Number.isNaN(e.x)?Mr(`'${n}.x' is NaN`,r):Number.isNaN(e.y)?Mr(`'${n}.y' is NaN`,r):{success:!0,value:e}}function j(e,n=`Point`,r){k(Hr(e,n,r))}function Ur(e,n=`pt`){return j(e,n),k(A(e.x,`nonZero`,`${n}.x`),A(e.y,`nonZero`,`${n}.y`),()=>{if(e.z!==void 0)return A(e.z,`nonZero`,`${n}.z`)}),!0}function Wr(e){return e!=null&&e.x!==void 0&&e.y!==void 0}function M(e){return e!=null&&e.x!==void 0&&e.y!==void 0&&e.z!==void 0}function Gr(e){return M(e)&&e.z!==0?!1:e.x===0&&e.y===0}function Kr(e){return M(e)&&!Number.isNaN(e.z)?!1:Number.isNaN(e.x)&&Number.isNaN(e.y)}function qr(...e){for(let n of e){if(n===void 0)continue;if(typeof n==`boolean`){if(n)continue;throw Jr.fromString(`Guard failed: false result`)}let e=typeof n==`object`?n:n();if(e!==void 0&&!e.success)throw Yr(e)}return!0}var Jr=class e extends Error{cause;constructor(e,n){super(e),this.cause=n}static fromError(n,r){let i=n.message,a=n.stack,o=n.name,s=new e(i,r);return s.stack=a,s.name=`IxfxError(${o})`,s}static fromString(n,r){let i=new e(n,r);return i.name=`IxfxError`,i}};function Yr(e){return typeof e.error==`string`?Jr.fromString(e.error,e.info):e.error instanceof Error?Jr.fromError(e.error,e.info):Jr.fromString(JSON.stringify(e.error),e.info)}const Xr=(e,n=`?`)=>Array.isArray(e)?{success:!0,value:e}:{success:!1,error:`Parameter '${n}' is expected to be an array'`},Zr=(e,n=`?`)=>e===void 0?{success:!1,error:`Param '${n}' is undefined. Expected: function.`}:e===null?{success:!1,error:`Param '${n}' is null. Expected: function.`}:typeof e==`function`?{success:!0,value:e}:{success:!1,error:`Param '${n}' is type '${typeof e}'. Expected: function`},Qr=(e,n)=>e===n,$r=e=>{qr(Xr(e,`array`));for(let n=0;n<e.length;n++)for(let r=0;r<e.length;r++)if(n!==r&&e[n]===e[r])return!0;return!1};function*ei(e){if(qr(Xr(e,`values`)),e.length<2)throw Error(`Array needs to have at least two entries. Length: ${e.length}`);for(let n=1;n<e.length;n++)yield[e[n-1],e[n]]}const ti=(e,n,r=Qr)=>{if(qr(Xr(e,`sourceArray`),Zr(r,`comparer`)),Array.isArray(n)){let i=[];for(let a of e)n.some(e=>r(a,e))||i.push(a);return i}return e.filter(e=>!r(e,n))},ni=(e,n=`ignore`)=>{let r=0,i=e[0].length;for(let a=0;a<i;a++){let i=0;for(let[r,o]of e.entries()){let e=o[a];if(Number.isNaN(e)||!Number.isFinite(e)){if(n===`treat-as-zero`)e=0;else if(n===`error`)throw TypeError(`Invalid number at index ${a},${r}`)}r===0?i=e:i*=e}r+=i}return r};function ri(e,n=0,r=1){if(Number.isNaN(e))throw Error(`Param 'value' is NaN`);if(Number.isNaN(n))throw Error(`Param 'min' is NaN`);if(Number.isNaN(r))throw Error(`Param 'max' is NaN`);return e<n?n:e>r?r:e}function ii(e=0,n=1){if(Number.isNaN(e))throw Error(`Param 'min' is NaN`);if(Number.isNaN(n))throw Error(`Param 'max' is NaN`);return r=>r>n?n:r<e?e:r}const ai=(e,n=0,r=1)=>{if(k(A(e,``,`min`),A(n,``,`min`),A(r,``,`max`)),e===n||e===r)return n;for(;(e<=n||e>=r)&&e!==r&&e!==n;)e>r?e=n+(e-r):e<n&&(e=r-(n-e));return e};Math.PI*2;function oi(e,n,r,i){let a,o=`clamp`,s=e=>(a&&(e=a(e)),o===void 0||o===`clamp`?e=ri(e):o===`wrap`&&(e>1?e%=1:e<0&&(e=1+e%1)),e),c=(e,n,r)=>(k(A(n,``,`a`),A(r,``,`b`),A(e,``,`amount`)),e=s(e),(1-e)*n+e*r),l=(e={})=>{if(e.transform!==void 0){if(typeof e.transform!=`function`)throw Error(`Param 'transform' is expected to be a function. Got: ${typeof e.transform}`);a=e.transform}o=e.limits??`clamp`},u=(e,n,r)=>(1-e)*n+e*r;if(typeof e!=`number`)throw TypeError(`First param is expected to be a number. Got: ${typeof e}`);if(typeof n==`number`){let a,o;if(r===void 0||typeof r==`object`)return a=e,o=n,l(r),e=>c(e,a,o);if(typeof r==`number`)return a=n,o=r,l(i),c(e,a,o);throw Error(`Values for 'a' and 'b' not defined`)}if(n===void 0||typeof n==`object`){let r=s(e);return l(n),k(A(r,``,`amount`)),(e,n)=>u(r,e,n)}}function si(e,n,r){k(Fr(e,`positive`,`decimalPlaces`));let i=typeof n==`boolean`?n:r??!1,a;if(e===0)a=Math.round;else{let n=10**e;a=i?e=>Math.ceil(e*n)/n:e=>Math.floor(e*n)/n}return typeof n==`number`?a(n):a}Math.PI*2;const ci=(e=3)=>{k(A(e,`aboveZero`,`scaling`));let n=0,r=0;return i=>(A(i,``,`v`).success&&i!==void 0&&(r++,n+=(i-n)/Math.min(r,e)),n)},li=(e,n,r=!0)=>{let i=n.toString(),a=i.indexOf(`.`),o=1;a>=0&&(o=10*i.substring(a+1).length,n=Math.floor(o*n),e*=o),k(A(e,``,`v`),Fr(n,``,`every`));let s=e/n,c=s%1;return s=Math.floor(s),(c===.5&&r||c>.5)&&s++,n*s/o},ui=(e,n,r,i,a,o)=>di(n,r,i,a,o)(e),di=(e,n,r,i,a,o)=>{k(A(e,`finite`,`inMin`),A(n,`finite`,`inMax`));let s=i??1,c=r??0,l=o?ii(r,i):void 0;return r=>{if(e===n)return s;let i=(r-e)/(n-e);a!==void 0&&(i=a(i));let o=i*(s-c)+c;return l?l(o):o}},fi=(e,n,r,i,a,o)=>(a===void 0&&(a=1),i===void 0&&(i=0),n===r?a:ri(ui(e,n,r,i,a,o),i,a)),pi=()=>({min:2**53-1,max:-(2**53-1)}),mi=(e=pi())=>{let{min:n,max:r}=e;return{seen:e=>(typeof e==`number`&&!Number.isNaN(e)&&Number.isFinite(e)&&(n=Math.min(n,e),r=Math.max(r,e)),{min:n,max:r}),reset:()=>(n=2**53-1,r=-(2**53-1),{min:n,max:r}),get range(){return{min:n,max:r}},get min(){return n},get max(){return r}}},hi=Math.PI*2,gi=(e,n=`mean`)=>{let r=0,i=0,a=NaN,o=0;if(n!==`mean`)throw Error(`Unknown averaging kind: '${n}' expected: 'mean'`);for(let n of e){if(r+=n.x,i+=n.y,`z`in n&&n.z!==void 0)a+=n.z;else if(Number.isNaN(a))throw Error(`List of points should all have Z property, or none`);o++}return r/=o,i/=o,Number.isNaN(a)?{x:r,y:i}:{x:r,y:i,z:a/o}};function _i(e,n={}){let r,i,a;switch(e){case`moving-average-light`:{let e=n.scaling??3;r=ci(e),i=ci(e),a=ci(e);break}default:throw Error(`Unknown averaging kind '${e}'. Expected: 'moving-average-light'`)}return e=>{let n=r(e.x),o=i(e.y);if(M(e)){let r=a(e.z);return Object.freeze({x:n,y:o,z:r})}return Object.freeze({x:n,y:o})}}function vi(e){return Array.isArray(e)?e.map(e=>Math.PI/180*e):Math.PI/180*e}function yi(e){return e*1.111111}function bi(e,n=!0){return n?e*.9%360:e*.9}function xi(e){return e*63.6619772368}function Si(e){return e*.0157079633}function Ci(e){return Array.isArray(e)?e.map(e=>e*180/Math.PI):e*180/Math.PI}function wi(e){if(Ti(e))return e;if(typeof e==`number`)return{value:e,unit:`deg`};e=e.toLowerCase();let n=`deg`,r=NaN;if(e.endsWith(`grad`)?(r=Number.parseFloat(e.substring(0,e.length-4)),n=`grad`):e.endsWith(`rad`)?(r=Number.parseFloat(e.substring(0,e.length-3)),n=`rad`):e.endsWith(`turn`)?(r=Number.parseFloat(e.substring(0,e.length-4)),n=`turn`):e.endsWith(`deg`)?(r=Number.parseFloat(e.substring(0,e.length-3)),n=`deg`):r=Number.parseFloat(e),Number.isNaN(r)){if(e===`n`)return{value:90,unit:`deg`};if(e===`e`)return{value:0,unit:`deg`};if(e===`s`)return{value:270,unit:`deg`};if(e===`w`)return{value:180,unit:`deg`};if(e===`ne`)return{value:45,unit:`deg`};if(e===`se`)return{value:315,unit:`deg`};if(e===`sw`)return{value:225,unit:`deg`};if(e===`nw`)return{value:135,unit:`deg`};throw Error(`Invalid angle (bad value?): '${e}'. If using cardinals, use: 'n', 'se', etc.`)}if(n.length===0)throw Error(`Invalid angle (no unit)`);return{value:r,unit:n}}function Ti(e){return typeof e==`object`&&`unit`in e&&`value`in e&&typeof e.unit==`string`&&typeof e.value==`number`}function Ei(e,n){let r=typeof e==`object`?e:wi(e);switch(n){case`deg`:if(r.unit===`deg`)return r;if(r.unit===`rad`)return{value:Ci(r.value),unit:`deg`};if(r.unit===`grad`)return{value:bi(r.value),unit:`deg`};if(r.unit===`turn`)return{value:Di(r.value),unit:`deg`};throw Error(`Unknown unit: ${r.unit}`);case`grad`:if(r.unit===`deg`)return{value:yi(r.value),unit:`grad`};if(r.unit===`rad`)return{value:xi(r.value),unit:`grad`};if(r.unit===`grad`)return r;if(r.unit===`turn`)return{value:xi(ki(r.value)),unit:`grad`};throw Error(`Unknown unit: ${r.unit}`);case`rad`:if(r.unit===`deg`)return{value:vi(r.value),unit:`rad`};if(r.unit===`rad`)return r;if(r.unit===`grad`)return{value:Si(r.value),unit:`rad`};if(r.unit===`turn`)return{value:ki(r.value),unit:`rad`};throw Error(`Unknown unit: ${r.unit}`);case`turn`:if(r.unit===`deg`)return{value:Ai(r.value),unit:`turn`};if(r.unit===`rad`)return{value:ji(r.value),unit:`turn`};if(r.unit===`grad`)return{value:ji(Si(r.value)),unit:`turn`};if(r.unit===`turn`)return r;throw Error(`Unknown unit: ${r.unit}`);default:throw Error(`Destination unit unknown ('${n}). Expects: deg, grad, rad or turn`)}}function Di(e,n=!0){return n?e*360%360:e*360}function Oi(e){return e%=hi,e<0?e+hi:e}function ki(e){return e*hi}function Ai(e){return e/360}function ji(e){return e/hi}function Mi(e,n,r,i,a,o){if(M(e)&&M(n)||Wr(e)&&Wr(n))return[e,n];if(M(e)){let a={x:n,y:r,z:i};if(!M(a))throw Error(`Expected x, y & z parameters`);return[e,a]}if(Wr(e)){let i={x:n,y:r};if(!Wr(i))throw Error(`Expected x & y parameters`);return[e,i]}if(a!==void 0&&i!==void 0){let s={x:e,y:n,z:r},c={x:i,y:a,z:o};if(!M(s))throw Error(`Expected x,y,z for first point`);if(!M(c))throw Error(`Expected x,y,z for second point`);return[s,c]}let s={x:e,y:n},c={x:r,y:i};if(!Wr(s))throw Error(`Expected x,y for first point`);if(!Wr(c))throw Error(`Expected x,y for second point`);return[s,c]}function Ni(e,n,r){if(e===void 0)return{x:0,y:0};if(Array.isArray(e)){if(e.length===0)return Object.freeze({x:0,y:0});if(e.length===1)return Object.freeze({x:e[0],y:0});if(e.length===2)return Object.freeze({x:e[0],y:e[1]});if(e.length===3)return Object.freeze({x:e[0],y:e[1],z:e[2]});throw Error(`Expected array to be 1-3 elements in length. Got ${e.length}.`)}if(Wr(e))return e;if(typeof e!=`number`||typeof n!=`number`)throw TypeError(`Expected point or x,y as parameters. Got: a: ${JSON.stringify(e)} b: ${JSON.stringify(n)}`);return Object.freeze(typeof r==`number`?{x:e,y:n,z:r}:{x:e,y:n})}function Pi(e,n,r,i){let a=Ni(n,r,i);return j(a,`b`),j(e,`a`),M(a)&&M(e)?Math.hypot(a.x-e.x,a.y-e.y,a.z-e.z):Math.hypot(a.x-e.x,a.y-e.y)}function Fi(e,n,r){let i=Ni(n,r);return j(i,`b`),j(e,`a`),Math.hypot(i.x-e.x,i.y-e.y)}function Ii(e,n,r,i,a,o){let[s,c]=Mi(e,n,r,i,a,o);j(s,`a`),j(c,`b`);let l={x:s.x-c.x,y:s.y-c.y};return(M(s)||M(c))&&(l.z=(s.z??0)-(c.z??0)),Object.freeze(l)}const Li=(e,n=Math.round)=>(j(e,`pt`),Object.freeze({x:n(e.x),y:n(e.y)})),Ri=e=>{j(e,`pt`);let n={...e};return delete n.z,Object.freeze(n)},zi=(e,n=0)=>(j(e,`pt`),Object.freeze({...e,z:n}));function Bi(e,n){if(e===void 0)return`(undefined)`;if(e===null)return`(null)`;j(e,`pt`);let r=n?e.x.toFixed(n):e.x,i=n?e.y.toFixed(n):e.y;return e.z===void 0?`(${r},${i})`:`(${r},${i},${n?e.z.toFixed(n):e.z})`}const Vi=e=>e.distance!==void 0&&e.angleRadian!==void 0,Hi=(e,n)=>Object.freeze({...e,angleRadian:e.angleRadian+n}),Ui={x:0,y:0},Wi={x:1,y:1},Gi={x:0,y:0,z:0},Ki={x:1,y:1,z:1},qi=(e,n,r)=>{if(Vi(e)){if(n===void 0&&(n=Ui),Wr(n))return Yi(e.distance,e.angleRadian,n);throw Error(`Expecting (Coord, Point). Second parameter is not a point`)}if(typeof e==`object`)throw TypeError(`First param is an object, but not a Coord: ${JSON.stringify(e)}`);if(typeof e==`number`&&typeof n==`number`){if(r===void 0&&(r=Ui),!Wr(r))throw Error(`Expecting (number, number, Point). Point param wrong type`);return Yi(e,n,r)}throw TypeError(`Expecting parameters of (number, number). Got: (${typeof e}, ${typeof n}, ${typeof r}). a: ${JSON.stringify(e)}`)},Ji=(e,n,r={})=>{if(typeof e!=`object`)throw TypeError(`Param 'point' wrong. Expecting a Point, got: ${typeof e}`);let i=r.fullCircle??!0;typeof n==`object`&&(e=Ii(e,n));let a=Math.atan2(e.y,e.x);i&&(a=Oi(a));let o=Math.hypot(e.x,e.y);typeof r.digits==`number`&&(a=parseFloat(a.toFixed(r.digits)),o=parseFloat(o.toFixed(r.digits)));let s={...e,angleRadian:a,distance:o};return delete s.x,delete s.y,Object.freeze(s)},Yi=(e,n,r=Ui)=>(j(r),Object.freeze({x:r.x+e*Math.cos(n),y:r.y+e*Math.sin(n)})),Xi=(e,n,r)=>(j(e,`a`),n===void 0?Math.atan2(e.y,e.x):(j(n,`b`),r===void 0?Math.atan2(n.y-e.y,n.x-e.x):(j(r,`c`),Math.atan2(n.y-e.y,n.x-e.x)-Math.atan2(r.y-e.y,r.x-e.x)))),Zi=(e,n,r)=>{let i=Xi(e,n,r);return i<0?i+hi:i},Qi=(e,n,r)=>{let i=Math.sqrt((n.x-e.x)**2+(n.y-e.y)**2),a=Math.sqrt((n.x-r.x)**2+(n.y-r.y)**2),o=Math.sqrt((r.x-e.x)**2+(r.y-e.y)**2);return Math.acos((a*a+i*i-o*o)/(2*a*i))},$i=(e,n)=>(j(e,`a`),j(n,`b`),e=Object.freeze({...e}),n=Object.freeze({...n}),Object.freeze({a:e,b:n})),ea=(e,n,r,i)=>{if(e.y>r.y)throw Error(`topLeft.y greater than bottomRight.y`);if(e.y>i.y)throw Error(`topLeft.y greater than bottomLeft.y`);let a=n.x-e.x,o=r.x-i.x,s=Math.abs(i.y-e.y),c=Math.abs(r.y-n.y);return{x:Math.min(e.x,i.x),y:Math.min(n.y,e.y),width:Math.max(a,o),height:Math.max(s,c)}};function ta(e,...n){if(n.length===0)throw Error(`No points provided`);let r=n[0];for(let i of n)r=(M(r)&&M(i),e(r,i));return r}const na=(...e)=>{let n=ta((e,n)=>e.x<n.x?e:n,...e),r=ta((e,n)=>e.x>n.x?e:n,...e),i=ta((e,n)=>e.y<n.y?e:n,...e),a=ta((e,n)=>e.y>n.y?e:n,...e);return ea({x:n.x,y:i.y},{x:r.x,y:i.y},{x:r.x,y:a.y},{x:n.x,y:a.y})},ra=(...e)=>{let n=na(...e),r=ta((e,n)=>e.z<n.z?e:n,...e),i=ta((e,n)=>e.z>n.z?e:n,...e);return{...n,z:r.z,depth:i.z-r.z}};function ia(e){return!(e===void 0||e.a===void 0||e.b===void 0||!Wr(e.a)||!Wr(e.b))}function aa(e){return Array.isArray(e)?!e.some(e=>!ia(e)):!1}function oa(e,n=`line`){return e===void 0?{success:!1,error:`${n} undefined`}:e.a===void 0?{success:!1,error:`${n}.a undefined. Expected {a:Point, b:Point}. Got: ${JSON.stringify(e)}`}:e.b===void 0?{success:!1,error:`${n}.b undefined. Expected {a:Point, b:Point} Got: ${JSON.stringify(e)}`}:{success:!0,value:!0}}const sa=(e,n)=>{let r;if(ia(e))n=e.b,r=e.a;else if(r=e,n===void 0)throw Error(`Since first parameter is not a line, two points are expected. Got a: ${JSON.stringify(r)} b: ${JSON.stringify(n)}`);return j(r,`a`),j(r,`b`),[r,n]};function ca(e,n,r){if(aa(e)){let r=typeof n==`boolean`&&n;return e.reduce((e,n)=>ca(n,r)+e,0)}if(e===void 0)throw TypeError(`Parameter 'aOrLine' is undefined`);let[i,a]=typeof n==`object`?sa(e,n):sa(e),o=a.x-i.x,s=a.y-i.y;if(!(typeof n==`boolean`?n:typeof r==`boolean`&&r)&&i.z!==void 0&&a.z!==void 0){let e=a.z-i.z;return Math.hypot(o,s,e)}return Math.hypot(o,s)}function la(e,n,r,i){typeof r==`boolean`&&(i=r,r=void 0),k(i?A(e,``,`amount`):Pr(e,`amount`));let[a,o]=sa(n,r);return ua({a,b:o},i)(e)}function ua(e,n=!1){k(oa(e));let r=ca(e),{a:i,b:a}=e;return e=>{k(n?A(e,``,`amount`):Pr(e,`amount`));let o=r*(1-e);if(r===0&&o===0)return Object.freeze({...a});let s=a.x-o*(a.x-i.x)/r,c=a.y-o*(a.y-i.y)/r;return Object.freeze({...a,x:s,y:c})}}const da=(e,n=`Dimension`)=>{if(e===void 0)throw Error(`${n} is undefined`);if(Number.isNaN(e))throw Error(`${n} is NaN`);if(e<0)throw Error(`${n} cannot be negative`)},fa=(e,n=`rect`)=>{if(e===void 0)throw Error(`{$name} undefined`);ma(e)&&j(e,n),da(e.width,n+`.width`),da(e.height,n+`.height`)},pa=(e,n=`rect`)=>{if(!ma(e))throw Error(`Expected ${n} to have x,y`);fa(e,n)},ma=e=>e.x!==void 0&&e.y!==void 0,ha=e=>e!==void 0&&e.width!==void 0&&e.height!==void 0,ga=e=>ha(e)&&ma(e);function _a(e,n,r){return da(n,`width`),da(r,`height`),j(e,`origin`),{x:e.x,y:e.y,width:n,height:r}}const va=e=>e.quadratic!==void 0,ya=e=>e.cubic1!==void 0&&e.cubic2!==void 0,{abs:ba,cos:xa,sin:Sa,acos:Ca,atan2:wa,sqrt:Ta,pow:Ea}=Math;function Da(e){return e<0?-Ea(-e,1/3):Ea(e,1/3)}const Oa=Math.PI,ka=2*Oa,Aa=Oa/2,ja=2**53-1||9007199254740991,Ma=-(2**53-1)||-9007199254740991,Na={x:0,y:0,z:0},N={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){let r=n(e),i=r.x*r.x+r.y*r.y;return r.z!==void 0&&(i+=r.z*r.z),Ta(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];let i=n.length-1;if(e===1)return n[i].t=1,n[i];let a=1-e,o=n;if(i===0)return n[0].t=e,n[0];if(i===1){let n={x:a*o[0].x+e*o[1].x,y:a*o[0].y+e*o[1].y,t:e};return r&&(n.z=a*o[0].z+e*o[1].z),n}if(i<4){let n=a*a,s=e*e,c,l,u,d=0;i===2?(o=[o[0],o[1],o[2],Na],c=n,l=a*e*2,u=s):i===3&&(c=n*a,l=n*e*3,u=a*s*3,d=e*s);let f={x:c*o[0].x+l*o[1].x+u*o[2].x+d*o[3].x,y:c*o[0].y+l*o[1].y+u*o[2].y+d*o[3].y,t:e};return r&&(f.z=c*o[0].z+l*o[1].z+u*o[2].z+d*o[3].z),f}let s=JSON.parse(JSON.stringify(n));for(;s.length>1;){for(let n=0;n<s.length-1;n++)s[n]={x:s[n].x+(s[n+1].x-s[n].x)*e,y:s[n].y+(s[n+1].y-s[n].y)*e},s[n].z!==void 0&&(s[n].z=s[n].z+(s[n+1].z-s[n].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,n,r,i){let a=1-e,o=r,s=n,c=o[0],l=o[1],u=o[2],d=o[3],f;if(c*=a,l*=e,s.length===2)return f=c+l,{x:(c*s[0].x+l*s[1].x)/f,y:(c*s[0].y+l*s[1].y)/f,z:i?(c*s[0].z+l*s[1].z)/f:!1,t:e};if(c*=a,l*=2*a,u*=e*e,s.length===3)return f=c+l+u,{x:(c*s[0].x+l*s[1].x+u*s[2].x)/f,y:(c*s[0].y+l*s[1].y+u*s[2].y)/f,z:i?(c*s[0].z+l*s[1].z+u*s[2].z)/f:!1,t:e};if(c*=a,l*=1.5*a,u*=3*a,d*=e*e*e,s.length===4)return f=c+l+u+d,{x:(c*s[0].x+l*s[1].x+u*s[2].x+d*s[3].x)/f,y:(c*s[0].y+l*s[1].y+u*s[2].y+d*s[3].y)/f,z:i?(c*s[0].z+l*s[1].z+u*s[2].z+d*s[3].z)/f:!1,t:e}},derive:function(e,n){let r=[];for(let i=e,a=i.length,o=a-1;a>1;a--,o--){let e=[];for(let r=0,a;r<o;r++)a={x:o*(i[r+1].x-i[r].x),y:o*(i[r+1].y-i[r].y)},n&&(a.z=o*(i[r+1].z-i[r].z)),e.push(a);r.push(e),i=e}return r},between:function(e,n,r){return n<=e&&e<=r||N.approximately(e,n)||N.approximately(e,r)},approximately:function(e,n,r){return ba(e-n)<=(r||1e-6)},length:function(e){let n=.5,r=N.Tvalues.length,i=0;for(let a=0,o;a<r;a++)o=n*N.Tvalues[a]+n,i+=N.Cvalues[a]*N.arcfn(o,e);return n*i},map:function(e,n,r,i,a){let o=r-n;return i+(a-i)*((e-n)/o)},lerp:function(e,n,r){let i={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(i.z=n.z+e*(r.z-n.z)),i},pointToString:function(e){let n=e.x+`/`+e.y;return e.z!==void 0&&(n+=`/`+e.z),n},pointsToString:function(e){return`[`+e.map(N.pointToString).join(`, `)+`]`},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){let i=n.x-e.x,a=n.y-e.y,o=r.x-e.x,s=r.y-e.y;return wa(i*s-a*o,i*o+a*s)},round:function(e,n){let r=``+e,i=r.indexOf(`.`);return parseFloat(r.substring(0,i+1+n))},dist:function(e,n){let r=e.x-n.x,i=e.y-n.y;return Ta(r*r+i*i)},closest:function(e,n){let r=Ea(2,63),i,a;return e.forEach(function(e,o){a=N.dist(n,e),a<r&&(r=a,i=o)}),{mdist:r,mpos:i}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(e===void 0)e=.5;else if(e===0||e===1)return e;let r=Ea(e,n)+Ea(1-e,n);return ba((r-1)/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(e===void 0)e=.5;else if(e===0||e===1)return e;let r=Ea(1-e,n);return r/(Ea(e,n)+r)},lli8:function(e,n,r,i,a,o,s,c){let l=(e*i-n*r)*(a-s)-(e-r)*(a*c-o*s),u=(e*i-n*r)*(o-c)-(n-i)*(a*c-o*s),d=(e-r)*(o-c)-(n-i)*(a-s);return d!=0&&{x:l/d,y:u/d}},lli4:function(e,n,r,i){let a=e.x,o=e.y,s=n.x,c=n.y,l=r.x,u=r.y,d=i.x,f=i.y;return N.lli8(a,o,s,c,l,u,d,f)},lli:function(e,n){return N.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new Ua(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=ja,r=ja,i=Ma,a=Ma;return e.forEach(function(e){let o=e.bbox();n>o.x.min&&(n=o.x.min),r>o.y.min&&(r=o.y.min),i<o.x.max&&(i=o.x.max),a<o.y.max&&(a=o.y.max)}),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:r,mid:(r+a)/2,max:a,size:a-r}}},shapeintersections:function(e,n,r,i,a){if(!N.bboxoverlap(n,i))return[];let o=[],s=[e.startcap,e.forward,e.back,e.endcap],c=[r.startcap,r.forward,r.back,r.endcap];return s.forEach(function(n){n.virtual||c.forEach(function(i){if(i.virtual)return;let s=n.intersects(i,a);s.length>0&&(s.c1=n,s.c2=i,s.s1=e,s.s2=r,o.push(s))})}),o},makeshape:function(e,n,r){let i=n.points.length,a=e.points.length,o=N.makeline(n.points[i-1],e.points[0]),s=N.makeline(e.points[a-1],n.points[0]),c={startcap:o,forward:e,back:n,endcap:s,bbox:N.findbbox([o,e,n,s])};return c.intersections=function(e){return N.shapeintersections(c,c.bbox,e,e.bbox,r)},c},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=ja,a=Ma,o,s;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let c=0,l=r.length;c<l;c++)o=r[c],s=e.get(o),s[n]<i&&(i=s[n]),s[n]>a&&(a=s[n]);return{min:i,mid:(i+a)/2,max:a,size:a-i}},align:function(e,n){let r=n.p1.x,i=n.p1.y,a=-wa(n.p2.y-i,n.p2.x-r);return e.map(function(e){return{x:(e.x-r)*xa(a)-(e.y-i)*Sa(a),y:(e.x-r)*Sa(a)+(e.y-i)*xa(a)}})},roots:function(e,n){n||={p1:{x:0,y:0},p2:{x:1,y:0}};let r=e.length-1,i=N.align(e,n),a=function(e){return 0<=e&&e<=1};if(r===2){let e=i[0].y,n=i[1].y,r=i[2].y,o=e-2*n+r;if(o!==0){let i=-Ta(n*n-e*r),s=-e+n;return[-(i+s)/o,-(-i+s)/o].filter(a)}return n!==r&&o===0?[(2*n-r)/(2*n-2*r)].filter(a):[]}let o=i[0].y,s=i[1].y,c=i[2].y,l=i[3].y,u=-o+3*s-3*c+l,d=3*o-6*s+3*c,f=-3*o+3*s,p=o;if(N.approximately(u,0)){if(N.approximately(d,0))return N.approximately(f,0)?[]:[-p/f].filter(a);let e=Ta(f*f-4*d*p),n=2*d;return[(e-f)/n,(-f-e)/n].filter(a)}d/=u,f/=u,p/=u;let m=(3*f-d*d)/3,h=m/3,g=(2*d*d*d-9*d*f+27*p)/27,_=g/2,v=_*_+h*h*h,y,b,x,S,ee;if(v<0){let e=-m/3,n=Ta(e*e*e),r=-g/(2*n),i=Ca(r<-1?-1:r>1?1:r),o=2*Da(n);return x=o*xa(i/3)-d/3,S=o*xa((i+ka)/3)-d/3,ee=o*xa((i+2*ka)/3)-d/3,[x,S,ee].filter(a)}if(v===0)return y=_<0?Da(-_):-Da(_),x=2*y-d/3,S=-y-d/3,[x,S].filter(a);{let e=Ta(v);return y=Da(-_+e),b=Da(_+e),[y-b-d/3].filter(a)}},droots:function(e){if(e.length===3){let n=e[0],r=e[1],i=e[2],a=n-2*r+i;if(a!==0){let e=-Ta(r*r-n*i),o=-n+r;return[-(e+o)/a,-(-e+o)/a]}return r!==i&&a===0?[(2*r-i)/(2*(r-i))]:[]}if(e.length===2){let n=e[0],r=e[1];return n===r?[]:[n/(n-r)]}return[]},curvature:function(e,n,r,i,a){let o,s,c,l,u=0,d=0,f=N.compute(e,n),p=N.compute(e,r),m=f.x*f.x+f.y*f.y;if(i?(o=Ta(Ea(f.y*p.z-p.y*f.z,2)+Ea(f.z*p.x-p.z*f.x,2)+Ea(f.x*p.y-p.x*f.y,2)),s=Ea(m+f.z*f.z,3/2)):(o=f.x*p.y-f.y*p.x,s=Ea(m,3/2)),o===0||s===0)return{k:0,r:0};if(u=o/s,d=s/o,!a){let a=N.curvature(e-.001,n,r,i,!0).k,o=N.curvature(e+.001,n,r,i,!0).k;l=(o-u+(u-a))/2,c=(ba(o-u)+ba(u-a))/2}return{k:u,r:d,dk:l,adk:c}},inflections:function(e){if(e.length<4)return[];let n=N.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,a=n[1].x*n[2].y,o=n[3].x*n[2].y,s=18*(-3*r+2*i+3*a-o),c=18*(3*r-i-3*a),l=18*(a-r);if(N.approximately(s,0)){if(!N.approximately(c,0)){let e=-l/c;if(0<=e&&e<=1)return[e]}return[]}let u=2*s;if(N.approximately(u,0))return[];let d=c*c-4*s*l;if(d<0)return[];let f=Math.sqrt(d);return[(f-c)/u,-(c+f)/u].filter(function(e){return 0<=e&&e<=1})},bboxoverlap:function(e,n){let r=[`x`,`y`],i=r.length;for(let a=0,o,s,c,l;a<i;a++)if(o=r[a],s=e[o].mid,c=n[o].mid,l=(e[o].size+n[o].size)/2,ba(s-c)>=l)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){let i=e.bbox(),a=n.bbox(),o=1e5,s=r||.5;if(i.x.size+i.y.size<s&&a.x.size+a.y.size<s)return[(o*(e._t1+e._t2)/2|0)/o+`/`+(o*(n._t1+n._t2)/2|0)/o];let c=e.split(.5),l=n.split(.5),u=[{left:c.left,right:l.left},{left:c.left,right:l.right},{left:c.right,right:l.right},{left:c.right,right:l.left}];u=u.filter(function(e){return N.bboxoverlap(e.left.bbox(),e.right.bbox())});let d=[];return u.length===0?d:(u.forEach(function(e){d=d.concat(N.pairiteration(e.left,e.right,s))}),d=d.filter(function(e,n){return d.indexOf(e)===n}),d)},getccenter:function(e,n,r){let i=n.x-e.x,a=n.y-e.y,o=r.x-n.x,s=r.y-n.y,c=i*xa(Aa)-a*Sa(Aa),l=i*Sa(Aa)+a*xa(Aa),u=o*xa(Aa)-s*Sa(Aa),d=o*Sa(Aa)+s*xa(Aa),f=(e.x+n.x)/2,p=(e.y+n.y)/2,m=(n.x+r.x)/2,h=(n.y+r.y)/2,g=f+c,_=p+l,v=m+u,y=h+d,b=N.lli8(f,p,g,_,m,h,v,y),x=N.dist(b,e),S=wa(e.y-b.y,e.x-b.x),ee=wa(n.y-b.y,n.x-b.x),te=wa(r.y-b.y,r.x-b.x),ne;return S<te?((S>ee||ee>te)&&(S+=ka),S>te&&(ne=te,te=S,S=ne)):te<ee&&ee<S?(ne=te,te=S,S=ne):te+=ka,b.s=S,b.e=te,b.r=x,b},numberSort:function(e,n){return e-n}};var Pa=class e{constructor(e){this.curves=[],this._3d=!1,e&&(this.curves=e,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return`[`+this.curves.map(function(e){return N.pointsToString(e.points)}).join(`, `)+`]`}addCurve(e){this.curves.push(e),this._3d=this._3d||e._3d}length(){return this.curves.map(function(e){return e.length()}).reduce(function(e,n){return e+n})}curve(e){return this.curves[e]}bbox(){let e=this.curves;for(var n=e[0].bbox(),r=1;r<e.length;r++)N.expandbox(n,e[r].bbox());return n}offset(n){let r=[];return this.curves.forEach(function(e){r.push(...e.offset(n))}),new e(r)}};const{abs:Fa,min:Ia,max:La,cos:Ra,sin:za,acos:Ba,sqrt:Va}=Math,Ha=Math.PI;var Ua=class e{constructor(e){let n=e&&e.forEach?e:Array.from(arguments).slice(),r=!1;if(typeof n[0]==`object`){r=n.length;let e=[];n.forEach(function(n){[`x`,`y`,`z`].forEach(function(r){n[r]!==void 0&&e.push(n[r])})}),n=e}let i=!1,a=n.length;if(r){if(r>4){if(arguments.length!==1)throw Error(`Only new Bezier(point[]) is accepted for 4th and higher order curves`);i=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw Error(`Only new Bezier(point[]) is accepted for 4th and higher order curves`);let o=this._3d=!i&&(a===9||a===12)||e&&e[0]&&e[0].z!==void 0,s=this.points=[];for(let e=0,r=o?3:2;e<a;e+=r){var c={x:n[e],y:n[e+1]};o&&(c.z=n[e+2]),s.push(c)}let l=this.order=s.length-1,u=this.dims=[`x`,`y`];o&&u.push(`z`),this.dimlen=u.length;let d=N.align(s,{p1:s[0],p2:s[l]}),f=N.dist(s[0],s[l]);this._linear=d.reduce((e,n)=>e+Fa(n.y),0)<f/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,i,a){return a===void 0&&(a=.5),a===0?new e(r,r,i):a===1?new e(n,r,r):new e(n,e.getABC(2,n,r,i,a).A,i)}static cubicFromPoints(n,r,i,a,o){a===void 0&&(a=.5);let s=e.getABC(3,n,r,i,a);o===void 0&&(o=N.dist(r,s.C));let c=o*(1-a)/a,l=N.dist(n,i),u=(i.x-n.x)/l,d=(i.y-n.y)/l,f=o*u,p=o*d,m=c*u,h=c*d,g={x:r.x-f,y:r.y-p},_={x:r.x+m,y:r.y+h},v=s.A,y={x:v.x+(g.x-v.x)/(1-a),y:v.y+(g.y-v.y)/(1-a)},b={x:v.x+(_.x-v.x)/a,y:v.y+(_.y-v.y)/a};return new e(n,{x:n.x+(y.x-n.x)/a,y:n.y+(y.y-n.y)/a},{x:i.x+(b.x-i.x)/(1-a),y:i.y+(b.y-i.y)/(1-a)},i)}static getUtils(){return N}getUtils(){return e.getUtils()}static get PolyBezier(){return Pa}valueOf(){return this.toString()}toString(){return N.pointsToString(this.points)}toSVG(){if(this._3d)return!1;let e=this.points,n=[`M`,e[0].x,e[0].y,this.order===2?`Q`:`C`];for(let r=1,i=e.length;r<i;r++)n.push(e[r].x),n.push(e[r].y);return n.join(` `)}setRatios(e){if(e.length!==this.points.length)throw Error(`incorrect number of ratio values`);this.ratios=e,this._lut=[]}verify(){let e=this.coordDigest();e!==this._print&&(this._print=e,this.update())}coordDigest(){return this.points.map(function(e,n){return``+n+e.x+e.y+(e.z?e.z:0)}).join(``)}update(){this._lut=[],this.dpoints=N.derive(this.points,this._3d),this.computedirection()}computedirection(){let e=this.points;this.clockwise=N.angle(e[0],e[this.order],e[1])>0}length(){return N.length(this.derivative.bind(this))}static getABC(e=2,n,r,i,a=.5){let o=N.projectionratio(a,e),s=1-o,c={x:o*n.x+s*i.x,y:o*n.y+s*i.y},l=N.abcratio(a,e);return{A:{x:r.x+(r.x-c.x)/l,y:r.y+(r.y-c.y)/l},B:r,C:c,S:n,E:i}}getABC(n,r){r||=this.get(n);let i=this.points[0],a=this.points[this.order];return e.getABC(this.order,i,r,a,n)}getLUT(e){if(this.verify(),e||=100,this._lut.length===e+1)return this._lut;this._lut=[],e++,this._lut=[];for(let n=0,r,i;n<e;n++)i=n/(e-1),r=this.compute(i),r.t=i,this._lut.push(r);return this._lut}on(e,n){n||=5;let r=this.getLUT(),i=[];for(let a=0,o,s=0;a<r.length;a++)o=r[a],N.dist(o,e)<n&&(i.push(o),s+=a/r.length);return i.length?t/=i.length:!1}project(e){let n=this.getLUT(),r=n.length-1,i=N.closest(n,e),a=i.mpos,o=(a-1)/r,s=(a+1)/r,c=.1/r,l=i.mdist,u=o,d=u,f;l+=1;for(let n;u<s+c;u+=c)f=this.compute(u),n=N.dist(e,f),n<l&&(l=n,d=u);return d=d<0?0:d>1?1:d,f=this.compute(d),f.t=d,f.d=l,f}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?N.computeWithRatios(e,this.points,this.ratios,this._3d):N.compute(e,this.points,this._3d,this.ratios)}raise(){let n=this.points,r=[n[0]],i=n.length;for(let e=1,a,o;e<i;e++)a=n[e],o=n[e-1],r[e]={x:(i-e)/i*a.x+e/i*o.x,y:(i-e)/i*a.y+e/i*o.y};return r[i]=n[i-1],new e(r)}derivative(e){return N.compute(e,this.dpoints[0],this._3d)}dderivative(e){return N.compute(e,this.dpoints[1],this._3d)}align(){let n=this.points;return new e(N.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(e){return N.curvature(e,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return N.inflections(this.points)}normal(e){return this._3d?this.__normal3(e):this.__normal2(e)}__normal2(e){let n=this.derivative(e),r=Va(n.x*n.x+n.y*n.y);return{t:e,x:-n.y/r,y:n.x/r}}__normal3(e){let n=this.derivative(e),r=this.derivative(e+.01),i=Va(n.x*n.x+n.y*n.y+n.z*n.z),a=Va(r.x*r.x+r.y*r.y+r.z*r.z);n.x/=i,n.y/=i,n.z/=i,r.x/=a,r.y/=a,r.z/=a;let o={x:r.y*n.z-r.z*n.y,y:r.z*n.x-r.x*n.z,z:r.x*n.y-r.y*n.x},s=Va(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;let c=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:e,x:c[0]*n.x+c[1]*n.y+c[2]*n.z,y:c[3]*n.x+c[4]*n.y+c[5]*n.z,z:c[6]*n.x+c[7]*n.y+c[8]*n.z}}hull(e){let n=this.points,r=[],i=[],a=0;for(i[a++]=n[0],i[a++]=n[1],i[a++]=n[2],this.order===3&&(i[a++]=n[3]);n.length>1;){r=[];for(let o=0,s,c=n.length-1;o<c;o++)s=N.lerp(e,n[o],n[o+1]),i[a++]=s,r.push(s);n=r}return i}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;let i=this.hull(n),a={left:this.order===2?new e([i[0],i[3],i[5]]):new e([i[0],i[4],i[7],i[9]]),right:this.order===2?new e([i[5],i[4],i[2]]):new e([i[9],i[8],i[6],i[3]]),span:i};return a.left._t1=N.map(0,0,1,this._t1,this._t2),a.left._t2=N.map(n,0,1,this._t1,this._t2),a.right._t1=N.map(n,0,1,this._t1,this._t2),a.right._t2=N.map(1,0,1,this._t1,this._t2),r?(r=N.map(r,n,1,0,1),a.right.split(r).left):a}extrema(){let e={},n=[];return this.dims.forEach(function(r){let i=function(e){return e[r]},a=this.dpoints[0].map(i);e[r]=N.droots(a),this.order===3&&(a=this.dpoints[1].map(i),e[r]=e[r].concat(N.droots(a))),e[r]=e[r].filter(function(e){return e>=0&&e<=1}),n=n.concat(e[r].sort(N.numberSort))}.bind(this)),e.values=n.sort(N.numberSort).filter(function(e,r){return n.indexOf(e)===r}),e}bbox(){let e=this.extrema(),n={};return this.dims.forEach(function(r){n[r]=N.getminmax(this,r,e[r])}.bind(this)),n}overlaps(e){let n=this.bbox(),r=e.bbox();return N.bboxoverlap(n,r)}offset(n,r){if(r!==void 0){let e=this.get(n),i=this.normal(n),a={c:e,n:i,x:e.x+i.x*r,y:e.y+i.y*r};return this._3d&&(a.z=e.z+i.z*r),a}if(this._linear){let r=this.normal(0);return[new e(this.points.map(function(e){let i={x:e.x+n*r.x,y:e.y+n*r.y};return e.z&&r.z&&(i.z=e.z+n*r.z),i}))]}return this.reduce().map(function(e){return e._linear?e.offset(n)[0]:e.scale(n)})}simple(){if(this.order===3){let e=N.angle(this.points[0],this.points[3],this.points[1]),n=N.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&n<0||e<0&&n>0)return!1}let e=this.normal(0),n=this.normal(1),r=e.x*n.x+e.y*n.y;return this._3d&&(r+=e.z*n.z),Fa(Ba(r))<Ha/3}reduce(){let e,n=0,r=0,i=.01,a,o=[],s=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),n=c[0],e=1;e<c.length;e++)r=c[e],a=this.split(n,r),a._t1=n,a._t2=r,o.push(a),n=r;return o.forEach(function(e){for(n=0,r=0;r<=1;)for(r=n+i;r<=1.01;r+=i)if(a=e.split(n,r),!a.simple()){if(r-=i,Fa(n-r)<i)return[];a=e.split(n,r),a._t1=N.map(n,0,1,e._t1,e._t2),a._t2=N.map(r,0,1,e._t1,e._t2),s.push(a),n=r;break}n<1&&(a=e.split(n,1),a._t1=N.map(n,0,1,e._t1,e._t2),a._t2=e._t2,s.push(a))}),s}translate(n,r,i){i=typeof i==`number`?i:r;let a=this.order,o=this.points.map((e,n)=>(1-n/a)*r+n/a*i);return new e(this.points.map((e,r)=>({x:e.x+n.x*o[r],y:e.y+n.y*o[r]})))}scale(n){let r=this.order,i=!1;if(typeof n==`function`&&(i=n),i&&r===2)return this.raise().scale(i);let a=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);let s=i?i(0):n,c=i?i(1):n,l=[this.offset(0,10),this.offset(1,10)],u=[],d=N.lli4(l[0],l[0].c,l[1],l[1].c);if(!d)throw Error(`cannot scale this curve. Try reducing it first.`);return[0,1].forEach(function(e){let n=u[e*r]=N.copy(o[e*r]);n.x+=(e?c:s)*l[e].n.x,n.y+=(e?c:s)*l[e].n.y}),i?([0,1].forEach(function(e){if(!(r===2&&e)){var s=o[e+1],c={x:s.x-d.x,y:s.y-d.y},l=i?i((e+1)/r):n;i&&!a&&(l=-l);var f=Va(c.x*c.x+c.y*c.y);c.x/=f,c.y/=f,u[e+1]={x:s.x+l*c.x,y:s.y+l*c.y}}}),new e(u)):([0,1].forEach(e=>{if(r===2&&e)return;let n=u[e*r],i=this.derivative(e),a={x:n.x+i.x,y:n.y+i.y};u[e+1]=N.lli4(n,a,d,o[e+1])}),new e(u))}outline(n,r,i,a){if(r=r===void 0?n:r,this._linear){let o=this.normal(0),s=this.points[0],c=this.points[this.points.length-1],l,u,d;i===void 0&&(i=n,a=r),l={x:s.x+o.x*n,y:s.y+o.y*n},d={x:c.x+o.x*i,y:c.y+o.y*i},u={x:(l.x+d.x)/2,y:(l.y+d.y)/2};let f=[l,u,d];l={x:s.x-o.x*r,y:s.y-o.y*r},d={x:c.x-o.x*a,y:c.y-o.y*a},u={x:(l.x+d.x)/2,y:(l.y+d.y)/2};let p=[d,u,l],m=N.makeline(p[2],f[0]),h=N.makeline(f[2],p[0]);return new Pa([m,new e(f),h,new e(p)])}let o=this.reduce(),s=o.length,c=[],l=[],u,d=0,f=this.length(),p=i!==void 0&&a!==void 0;function m(e,n,r,i,a){return function(o){let s=i/r,c=(i+a)/r,l=n-e;return N.map(o,0,1,e+s*l,e+c*l)}}o.forEach(function(e){let o=e.length();p?(c.push(e.scale(m(n,i,f,d,o))),l.push(e.scale(m(-r,-a,f,d,o)))):(c.push(e.scale(n)),l.push(e.scale(-r))),d+=o}),l=l.map(function(e){return u=e.points,e.points=u[3]?[u[3],u[2],u[1],u[0]]:[u[2],u[1],u[0]],e}).reverse();let h=c[0].points[0],g=c[s-1].points[c[s-1].points.length-1],_=l[s-1].points[l[s-1].points.length-1],v=l[0].points[0],y=N.makeline(_,h),b=N.makeline(g,v);return new Pa([y].concat(c,[b],l))}outlineshapes(e,n,r){n||=e;let i=this.outline(e,n).curves,a=[];for(let e=1,n=i.length;e<n/2;e++){let o=N.makeshape(i[e],i[n-e],r);o.startcap.virtual=e>1,o.endcap.virtual=e<n/2-1,a.push(o)}return a}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof e&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(e){let n=Ia(e.p1.x,e.p2.x),r=Ia(e.p1.y,e.p2.y),i=La(e.p1.x,e.p2.x),a=La(e.p1.y,e.p2.y);return N.roots(this.points,e).filter(e=>{var o=this.get(e);return N.between(o.x,n,i)&&N.between(o.y,r,a)})}selfintersects(e){let n=this.reduce(),r=n.length-2,i=[];for(let a=0,o,s,c;a<r;a++)s=n.slice(a,a+1),c=n.slice(a+2),o=this.curveintersects(s,c,e),i.push(...o);return i}curveintersects(e,n,r){let i=[];e.forEach(function(e){n.forEach(function(n){e.overlaps(n)&&i.push({left:e,right:n})})});let a=[];return i.forEach(function(e){let n=N.pairiteration(e.left,e.right,r);n.length>0&&(a=a.concat(n))}),a}arcs(e){return e||=.5,this._iterate(e,[])}_error(e,n,r,i){let a=(i-r)/4,o=this.get(r+a),s=this.get(i-a),c=N.dist(e,n),l=N.dist(e,o),u=N.dist(e,s);return Fa(l-c)+Fa(u-c)}_iterate(e,n){let r=0,i=1,a;do{a=0,i=1;let o=this.get(r),s,c,l,u,d=!1,f=!1,p,m=i,h=1,g=0;do if(f=d,u=l,m=(r+i)/2,g++,s=this.get(m),c=this.get(i),l=N.getccenter(o,s,c),l.interval={start:r,end:i},d=this._error(l,o,r,i)<=e,p=f&&!d,p||(h=i),d){if(i>=1){if(l.interval.end=h=1,u=l,i>1){let e={x:l.x+l.r*Ra(l.e),y:l.y+l.r*za(l.e)};l.e+=N.angle({x:l.x,y:l.y},e,this.get(1))}break}i+=(i-r)/2}else i=m;while(!p&&a++<100);if(a>=100)break;u||=l,n.push(u),r=h}while(i<1);return n}},Wa=Tr({cubic:()=>Ya,interpolator:()=>Ka,isCubicBezier:()=>ya,isQuadraticBezier:()=>va,quadratic:()=>Za,quadraticSimple:()=>Ga,quadraticToSvgString:()=>qa,toPath:()=>Ja});const Ga=(e,n,r=0)=>{if(Number.isNaN(r))throw Error(`bend is NaN`);if(r<-1||r>1)throw Error(`Expects bend range of -1 to 1`);let i=la(.5,e,n),a=i;return a=n.y<e.y?r>0?{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y)}:{x:Math.max(e.x,n.x),y:Math.max(e.y,n.y)}:r>0?{x:Math.max(e.x,n.x),y:Math.min(e.y,n.y)}:{x:Math.min(e.x,n.x),y:Math.max(e.y,n.y)},Za(e,n,la(Math.abs(r),i,a))},Ka=e=>{let n=ya(e)?new Ua(e.a.x,e.a.y,e.cubic1.x,e.cubic1.y,e.cubic2.x,e.cubic2.y,e.b.x,e.b.y):new Ua(e.a,e.quadratic,e.b);return e=>n.compute(e)},qa=(e,n,r)=>[`M ${e.x} ${e.y} Q ${r.x} ${r.y} ${n.x} ${n.y}`],Ja=e=>{if(ya(e))return Xa(e);if(va(e))return Qa(e);throw Error(`Unknown bezier type`)},Ya=(e,n,r,i)=>({a:Object.freeze(e),b:Object.freeze(n),cubic1:Object.freeze(r),cubic2:Object.freeze(i)}),Xa=e=>{let{a:n,cubic1:r,cubic2:i,b:a}=e,o=new Ua(n,r,i,a);return Object.freeze({...e,length:()=>o.length(),interpolate:e=>o.compute(e),nearest:e=>{throw Error(`not implemented`)},bbox:()=>{let{x:e,y:n}=o.bbox(),r=e.size,i=n.size;if(r===void 0||i===void 0)throw Error(`x.size not present on calculated bbox`);return _a({x:e.min,y:n.min},r,i)},relativePosition:(e,n)=>{throw Error(`Not implemented`)},distanceToPoint:e=>{throw Error(`Not implemented`)},toSvgString:()=>[`brrup`],kind:`bezier/cubic`})},Za=(e,n,r)=>({a:Object.freeze(e),b:Object.freeze(n),quadratic:Object.freeze(r)}),Qa=e=>{let{a:n,b:r,quadratic:i}=e,a=new Ua(n,i,r);return Object.freeze({...e,length:()=>a.length(),interpolate:e=>a.compute(e),nearest:e=>{throw Error(`not implemented`)},bbox:()=>{let{x:e,y:n}=a.bbox(),r=e.size,i=n.size;if(r===void 0||i===void 0)throw Error(`x.size not present on calculated bbox`);return _a({x:e.min,y:n.min},r,i)},distanceToPoint:e=>{throw Error(`Not implemented`)},relativePosition:(e,n)=>{throw Error(`Not implemented`)},toString:()=>a.toString(),toSvgString:()=>qa(n,r,i),kind:`bezier/quadratic`})},$a=(e,n=`circle`)=>{if(ro(e)&&j(e,`circle`),Number.isNaN(e.radius))throw Error(`${n}.radius is NaN`);if(e.radius<=0)throw Error(`${n}.radius must be greater than zero`)},eo=(e,n=`circle`)=>{if(!ro(e))throw Error(`Expected a positioned circle with x,y`);$a(e,n)},to=e=>e.x!==void 0&&e.y!==void 0,no=e=>e.radius!==void 0,ro=e=>no(e)&&to(e);function io(e,n,r,i,a,o){let[s,c]=Mi(e,n,r,i,a,o);j(s,`a`),j(c,`b`);let l={x:s.x+c.x,y:s.y+c.y};return(M(s)||M(c))&&(l.z=(s.z??0)+(c.z??0)),Object.freeze(l)}const ao=(e,n)=>(eo(e,`a`),ro(n)&&eo(n,`b`),Pi(e,n)),oo=(e,n)=>{if(eo(e,`a`),ro(n))return Math.max(0,ao(e,n)-e.radius-n.radius);if(Wr(n)){let r=Pi(e,n);return r<e.radius?0:r}throw Error(`Second parameter invalid type`)};function so(e,n,r,i,a,o){let[s,c]=Mi(e,n,r,i,a,o);j(s,`a`),j(c,`b`);let l={x:s.x*c.x,y:s.y*c.y};return(M(s)||M(c))&&(l.z=(s.z??0)*(c.z??0)),Object.freeze(l)}const co=(e,n)=>M(e)?Object.freeze({...e,x:e.x*n,y:e.y*n,z:e.z*n}):Object.freeze({...e,x:e.x*n,y:e.y*n}),lo=(...e)=>{if(e===void 0)throw Error(`parameter 'p' is undefined`);if(e.length<2)return!0;for(let n=1;n<e.length;n++)if(e[n].x!==e[0].x||e[n].y!==e[0].y)return!1;return!0};function uo(e,n){return e.x<n.x&&e.y<n.y?-2:e.x>n.x&&e.y>n.y?2:e.x<n.x||e.y<n.y?-1:e.x>n.x||e.y>n.y?1:e.x===n.x&&e.x===n.y?0:NaN}function fo(e,n){return e.y<n.y?-1:e.y>n.y?1:e.x<n.x?-1:+(e.x>n.x)}function po(e,n){let r=fo(e,n)<=0?e:n;return{topLeft:r,bottomRight:r===e?n:e}}function mo(e,n){return e.x===n.x?0:e.x<n.x?-1:1}function ho(e,n){return e.y===n.y?0:e.y<n.y?-1:1}function go(e,n){return e.z===n.z?0:e.z<n.z?-1:1}const _o=(e,n=null,r=new WeakSet,i=``)=>{if(e===null)return e;if(typeof e!=`object`)throw TypeError(`Param 'value' must be an object. Got type: ${typeof e}`);r.add(e);let a=Object.entries(e);for(let e of a)if(e[1]!==null&&typeof e[1]==`object`){if(r.has(e[1])){e[1]=n;continue}e[1]=_o(e[1],n,r,`${e[0]}.`)}return Object.fromEntries(a)};function vo(e){return typeof e==`string`?e:JSON.stringify(e)}function yo(e){if(e===null)return`null`;if(typeof e==`boolean`||typeof e==`number`)return e.toString();if(typeof e==`string`)return e;if(typeof e==`symbol`)throw TypeError(`Symbol cannot be converted to string`);try{return JSON.stringify(e)}catch(n){if(typeof e==`object`)return JSON.stringify(_o(e,`(circular)`));throw n}}function bo(e){return typeof e==`string`?e:JSON.stringify(e,(e,n)=>n instanceof Object&&!Array.isArray(n)?Object.keys(n).sort().reduce((e,r)=>(e[r]=n[r],e),{}):n)}const xo=(e,n)=>e===n;function So(e,n){return e===n||vo(e)===vo(n)}function Co(e,n){return e===n||bo(e)===bo(n)}function wo(e,n){return e===n?0:e>n?1:-1}function To(e,n){if(e===void 0&&n===void 0)return 0;if(e===void 0)return 1;if(n===void 0)return-1;let r=yo(e),i=yo(n);return r<i?-1:+(r>i)}function Eo(e,n){return typeof e==`number`&&typeof n==`number`?wo(e,n):To(e,n)}const Do=(e,n)=>(r,i)=>{let a=e.get(r);return a===void 0?(a=n(r,i),e.set(r,a),a):a};var Oo=Object.defineProperty,ko=(e,n)=>{let r={};for(var i in e)Oo(r,i,{get:e[i],enumerable:!0});return n||Oo(r,Symbol.toStringTag,{value:`Module`}),r};function Ao(e,n=15){if(k(Fr(n,`aboveZero`,`maxLength`)),typeof e!=`string`)throw Error(`Parameter 'source' is not a string`);if(e.length>n&&e.length>3){if(n>15){let r=Math.round((n-2)/2);return`${e.slice(0,r)}...${e.slice(-r)}`}return`${e.slice(0,n)}...`}return e}function jo(e,n=20){return e===void 0?`(undefined)`:e===null?`(null)`:Ao(JSON.stringify(e),n)}function Mo(e){return typeof e==`number`||typeof e==`string`||typeof e==`bigint`||typeof e==`boolean`}const No=(e,n=0,r={})=>{let i=Po(n,0);k(Fr(i,`positive`,`interval`));let a=r.fireBeforeWait??!1,o=r.onStartCalled,s=r.signal,c=!1,l=`idle`,u=0,d=0,f=performance.now(),p=n??0,m=!1,h,g=()=>{h!==void 0&&(globalThis.clearTimeout(h),h=void 0,u=0,f=NaN)},_=e=>{i===0?typeof requestAnimationFrame>`u`?h=globalThis.setTimeout(e,0):(h=void 0,requestAnimationFrame(e)):h=globalThis.setTimeout(e,i)},v=()=>{m||(m=!0,l!==`idle`&&(l=`idle`,g()))},y=async()=>{if(s?.aborted&&(l=`idle`),l===`idle`)return;l=`running`,u++,d++;let n=e(u,performance.now()-f),r=typeof n==`object`?await n:n;if(!m){if(l=`scheduled`,r!==void 0&&!r){v();return}m||_(y)}},b=()=>{if(c)throw Error(`Disposed`);if(m=!1,o!==void 0)switch(o(u,performance.now()-f)){case`cancel`:v();return;case`reset`:x();return;case`dispose`:c=!0,v();return}l===`idle`&&(u=0,f=performance.now(),l=`scheduled`,a?y():_(y))},x=()=>{if(c)throw Error(`Disposed`);m=!1,u=0,f=NaN,l!==`idle`&&v(),b()};return{start:b,reset:x,cancel:v,get interval(){return p},get runState(){return l},get startCountTotal(){return d},get startCount(){return u},set interval(e){let n=Po(e,0);k(Fr(n,`positive`,`interval`)),i=n,p=e},get isDisposed(){return c},get elapsedMs(){return performance.now()-f}}};function Po(e,n){if(Fo(e)){if(typeof e==`number`)return e;let n=e.millis??0;return n+=(e.hours??0)*60*60*1e3,n+=(e.mins??0)*60*1e3,n+=(e.secs??0)*1e3,n}if(n!==void 0)return n;throw Error(`Not a valid interval: ${JSON.stringify(e)}`)}function Fo(e){if(e==null)return!1;if(typeof e==`number`)return!(Number.isNaN(e)||!Number.isFinite(e));if(typeof e!=`object`)return!1;let n=`millis`in e,r=`secs`in e,i=`mins`in e,a=`hours`in e;return n&&!A(e.millis).success||r&&!A(e.secs).success||i&&!A(e.mins).success||a&&!A(e.hours).success?!1:!!(n||r||a||i)}(typeof window>`u`||!(`requestAnimationFrame`in window))&&typeof window>`u`&&(globalThis.requestAnimationFrame=e=>{setTimeout(e,1)});var Io=class{#e=new Map;get(e){let n=this.#e.get(e);return n?[...n]:[]}size(e){let n=this.#e.get(e);return n?n.length:0}*iterateKey(e){let n=this.#e.get(e);n&&(yield*n.values())}*iterateValues(){for(let e of this.#e.keys())yield*this.iterateKey(e)}*iterateKeys(){yield*this.#e.keys()}addKeyedValues(e,...n){let r=this.#e.get(e);r||(r=[],this.#e.set(e,r)),r.push(...n)}deleteKeyValue(e,n){let r=this.#e.get(e);if(!r)return!1;let i=r.filter(e=>e!==n);return i.length!==r.length&&(this.#e.set(e,i),!0)}clear(){this.#e.clear()}},Lo=class{#e=new Io;#t=!1;dispose(){this.#t||this.clearEventListeners()}get isDisposed(){return this.#t}fireEvent(e,n){if(this.#t)throw Error(`Disposed`);for(let r of this.#e.iterateKey(e))r(n,this)}addEventListener(e,n){if(this.#t)throw Error(`Disposed`);this.#e.addKeyedValues(e,n)}removeEventListener(e,n){this.#t||this.#e.deleteKeyValue(e,n)}clearEventListeners(){this.#t||this.#e.clear()}};function Ro(e,n,r){fa(e,`rect`);let i=0,a=0;if(typeof n==`number`){if(r===void 0)throw Error(`x and y coordinate needed`);i=n,a=r}else i=n.x,a=n.y;if(ma(e)){if(i-e.x>e.width||i<e.x||a-e.y>e.height||a<e.y)return!1}else if(i>e.width||i<0||a>e.height||a<0)return!1;return!0}function zo(e,n){if(pa(e,`rect`),j(n,`pt`),Ro(e,n))return 0;let r=Math.max(e.x-n.x,0,n.x-e.x+e.width),i=Math.max(e.y-n.y,0,n.y-e.y+e.height);return Math.hypot(r,i)}const Bo=(...e)=>{let n=[],r=e[0];for(let i=1;i<e.length;i++)n.push($i(r,e[i])),r=e[i];return n},Vo=(e,n,r)=>{let i=n.length+r.length,a=e.discardPolicy??`additions`,o=e.capacity??i,s=i-o;switch(e.debug&&console.log(`Stack.push: stackLen: ${n.length} potentialLen: ${i} toRemove: ${s} policy: ${a}`),a){case`additions`:return e.debug&&console.log(`Stack.push:DiscardAdditions: stackLen: ${n.length} slice: ${i-o} toAddLen: ${r.length}`),n.length===e.capacity?n:[...n,...r.slice(0,r.length-s)];case`newer`:{if(r.length>=o)return r.slice(r.length-o);let e=o-r.length;return[...n.slice(0,e),...r]}case`older`:return[...n,...r].slice(s);default:throw Error(`Unknown discard policy ${a}`)}},Ho=(e,n,...r)=>{let i=n.length+r.length;return e.capacity&&i>e.capacity?Vo(e,n,r):[...n,...r]},Uo=(e,n)=>{if(n.length===0)throw Error(`Stack is empty`);return n.slice(0,-1)},Wo=(e,n)=>n.at(-1),Go=(e,n)=>n.length===0,Ko=(e,n)=>e.capacity?n.length>=e.capacity:!1;var qo=class{opts;data;constructor(e={},n=[]){this.opts=e,this.data=n}push(...e){return e.length===0||(this.data=Ho(this.opts,this.data,...e)),this.data.length}forEach(e){this.data.forEach(e)}forEachFromTop(e){[...this.data].reverse().forEach(e)}pop(){let e=Wo(this.opts,this.data);return this.data=Uo(this.opts,this.data),e}get isEmpty(){return Go(this.opts,this.data)}get isFull(){return Ko(this.opts,this.data)}get peek(){return Wo(this.opts,this.data)}get length(){return this.data.length}};const Jo=(e,n)=>{e.debug&&console.log(`queue:${n}`)},Yo=(e,n,r)=>{let i=n.length+r.length,a=e.capacity??i,o=i-a,s=e.discardPolicy??`additions`;switch(s){case`additions`:return n.length===0?r.slice(0,r.length-o):n.length===e.capacity?n:[...n,...r.slice(0,o-1)];case`newer`:if(o>=n.length)return n.length===0?[...r.slice(0,a-1),r.at(-1)]:r.slice(Math.max(0,r.length-a),Math.min(r.length,a)+1);{let e=Math.max(1,r.length-n.length),i=r.slice(r.length-e,r.length);return[...n.slice(0,Math.min(n.length,a-1)),...i]}case`older`:return[...n,...r].slice(o);default:throw Error(`Unknown overflow policy ${s}`)}},Xo=(e,n,...r)=>{if(e===void 0)throw Error(`opts parameter undefined`);let i=n.length+r.length,a=e.capacity&&i>e.capacity,o=a?Yo(e,n,r):[...n,...r];if(e.capacity&&o.length!==e.capacity&&a)throw Error(`Bug! Expected return to be at capacity. Return len: ${o.length} capacity: ${e.capacity} opts: ${JSON.stringify(e)}`);if(!e.capacity&&o.length!==i)throw Error(`Bug! Return length not expected. Return len: ${o.length} expected: ${i} opts: ${JSON.stringify(e)}`);return o},Zo=(e,n)=>{if(n.length===0)throw Error(`Queue is empty`);return n.slice(1)},Qo=(e,n)=>n[0],$o=(e,n)=>n.length===0,es=(e,n)=>e.capacity?n.length>=e.capacity:!1;var ts=class extends Lo{options;data;eq;constructor(e={},n=[]){if(super(),e===void 0)throw Error(`opts parameter undefined`);this.options=e,this.data=n,this.eq=e.eq??xo}clear(){let e=[...this.data];this.data=[],this.fireEvent(`removed`,{finalData:this.data,removed:e}),this.onClear()}onClear(){}at(e){if(e>=this.data.length)throw Error(`Index outside bounds of queue`);let n=this.data.at(e);if(n===void 0)throw Error(`Index appears to be outside range of queue`);return n}enqueue(...e){this.data=Xo(this.options,this.data,...e);let n=this.data.length;return this.onEnqueue(this.data,e),n}onEnqueue(e,n){this.fireEvent(`enqueue`,{added:n,finalData:e})}dequeue(){let e=Qo(this.options,this.data);if(e!==void 0)return this.data=Zo(this.options,this.data),this.fireEvent(`dequeue`,{removed:e,finalData:this.data}),this.onRemoved([e],this.data),e}onRemoved(e,n){this.fireEvent(`removed`,{removed:e,finalData:n})}removeWhere(e){let n=this.data.length,r=this.data.filter(n=>e(n));return r.length===0?0:(this.data=this.data.filter(n=>!e(n)),this.onRemoved(r,this.data),n-this.data.length)}toArray(){return[...this.data]}get isEmpty(){return $o(this.options,this.data)}get isFull(){return es(this.options,this.data)}get length(){return this.data.length}get peek(){return Qo(this.options,this.data)}};function ns(e={},...n){return new ts({...e},[...n])}const rs=e=>typeof e!=`object`||!e?!1:Symbol.asyncIterator in e;function is(e){let n;for(let r of e)n=r;return n}function*as(e,n=(e,n)=>e>n){let r;for(let i of e){if(r===void 0){r=i,yield r;continue}n(i,r)&&(r=i,yield r)}return r}function*os(e,n=(e,n)=>e>n){let r;for(let i of e)r===void 0&&(r=i,yield r),n(r,i)&&(r=i,yield r)}async function ss(e,n={}){let r=n.abort,i;for await(let n of e){if(r?.aborted)return;i=n}return i}async function*cs(e,n=((e,n)=>e>n)){let r;for await(let i of e){if(r===void 0){r=i,yield r;continue}n(i,r)&&(r=i,yield i)}}async function*ls(e,n=(e,n)=>e>n){let r;for await(let i of e){if(r===void 0){r=i,yield r;continue}n(r,i)&&(r=i,yield i)}return r}function us(e,n=(e,n)=>e>n){return rs(e)?ls(e,n):os(e,n)}function ds(e,n=(e,n)=>e>n){return rs(e)?cs(e,n):as(e,n)}function fs(e){return rs(e)?ss(e):is(e)}var ps=class extends ts{constructor(e={}){e.eq===void 0&&(e={...e,eq:(e,n)=>xo(e.item,n.item)}),super(e)}enqueueWithPriority(e,n){k(A(n,`positive`)),super.enqueue({item:e,priority:n})}changePriority(e,n,r=!1,i){if(e===void 0)throw Error(`Item cannot be undefined`);let a;for(let n of this.data)if(i){if(i(n.item,e)){a=n;break}}else if(this.eq(n,{item:e,priority:0})){a=n;break}if(a===void 0&&!r)throw Error(`Item not found in priority queue. Item: ${JSON.stringify(e)}`);a!==void 0&&this.removeWhere(e=>a===e),this.enqueueWithPriority(e,n)}dequeueMax(){let e=fs(ds(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return this.removeWhere(n=>n===e),e.item}dequeueMin(){let e=fs(ds(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return this.removeWhere(n=>n.item===e),e.item}peekMax(){let e=fs(ds(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return e.item}peekMin(){let e=fs(us(this.data,(e,n)=>e.priority>=n.priority));if(e!==void 0)return e.item}};function ms(e={}){return new ps(e)}var hs=class e{opts;#e;constructor(e={},n=[]){if(e===void 0)throw Error(`opts parameter undefined`);this.opts=e,this.#e=n}forEach(e){for(let n=this.#e.length-1;n>=0;n--)e(this.#e[n])}forEachFromFront(e){this.#e.forEach(n=>{e(n)})}enqueue(...n){return new e(this.opts,Xo(this.opts,this.#e,...n))}dequeue(){return new e(this.opts,Zo(this.opts,this.#e))}get isEmpty(){return $o(this.opts,this.#e)}get isFull(){return es(this.opts,this.#e)}get length(){return this.#e.length}get peek(){return Qo(this.opts,this.#e)}toArray(){return[...this.#e]}};const gs=(e={},...n)=>(e={...e},new hs(e,[...n]));var _s=ko({PriorityMutable:()=>ps,QueueImmutable:()=>hs,QueueMutable:()=>ts,debug:()=>Jo,dequeue:()=>Zo,enqueue:()=>Xo,immutable:()=>gs,isEmpty:()=>$o,isFull:()=>es,mutable:()=>ns,peek:()=>Qo,priority:()=>ms,trimQueue:()=>Yo});const vs=(e,n,r=Co,i)=>{let a=xs(e,n,r),o=bs(e,n,r),s={valueChanged:!a,a:e,b:n,added:o.added,removed:o.removed,childChanged:!1},c={value:s,childrenStore:[],parent:i},l=o.identical.map(e=>vs(e[0],e[1],r,c)),u=ys(s)||l.some(e=>ys(e.value));return dc(c,l),c.toString=()=>Cs(c,0),c.value.childChanged=u,Ls(c),c},ys=e=>e!==void 0&&!!(e.valueChanged||e.childChanged||e.added.length>0||e.removed.length>0),bs=(e,n,r=Co)=>{let i=[...e.children()],a=[...n.children()],o=[],s=[];for(let e of i){let n=-1;for(let[i,s]of a.entries())if(xs(e,s,r)){o.push([e,s]),n=i;break}n===-1?s.push(e):a.splice(n,1)}return{added:[...a],identical:o,removed:s}},xs=(e,n,r)=>!!(e.getIdentity()===n.getIdentity()||r(e.getValue(),n.getValue())),Ss=e=>JSON.stringify(e.getValue()),Cs=(e,n=0)=>{if(e===void 0)return`(undefined)`;let r=ws(e.value,n);for(let i of e.childrenStore)r+=Cs(i,n+2);return r},ws=(e,n)=>{let r=` `.repeat(n);if(e===void 0)return`${r}(undefined)`;let i=[];if(i.push(`a: ${Ss(e.a)} b: ${Ss(e.b)}`),e.valueChanged?i.push(`Value changed. Child changed: ${e.childChanged}`):i.push(`Value unchanged. Child changed: ${e.childChanged}`),e.added.length>0){i.push(`Added:`);for(let n of e.added)i.push(` - `+Ss(n))}if(e.removed.length>0){i.push(`Removed: ${e.removed.length}`);for(let n of e.removed)i.push(` - `+Ss(n))}return i.push(`----
|
|
3332
3332
|
`),i.map(e=>r+e).join(`
|
|
3333
|
-
`)};var
|
|
3334
|
-
`)}`:r}function*
|
|
3335
|
-
`;return n}const
|
|
3336
|
-
`+o.map(e=>
|
|
3337
|
-
`):a},
|
|
3338
|
-
`;for(let i of e.childrenStore)r+=vc(i,n+1);return r};function*yc(e,n={}){O(Rr(e,`node`));let r=n.filter??`none`,i=e=>r===`none`?[!0,No(e)]:r===`leaves`&&No(e)?[!0,!0]:r===`branches`&&!No(e)?[!0,!1]:[!1,No(e)];if(Array.isArray(e))for(let[n,r]of e.entries()){let e=i(r);e[0]&&(yield{name:n.toString(),_kind:`entry`,sourceValue:r,leafValue:e[1]?r:void 0})}else if(typeof e==`object`){let n=`entries`in e?e.entries():Object.entries(e);for(let[e,r]of n){let[n,a]=i(r);n&&(yield{name:e,_kind:`entry`,sourceValue:r,leafValue:a?r:void 0})}}}function*bc(e,n={},r=[]){for(let i of yc(e,n))yield{...i,ancestors:[...r],_kind:`entry-ancestors`},yield*bc(i.sourceValue,n,[...r,i.name])}function xc(e,n){for(let r of yc(n))if(r.name===e)return r}function Sc(e,n,r={}){let i=as(Cc(e,n,r));if(!i)throw Error(`Could not trace path: ${e} `);return i}function*Cc(e,n,r={}){O(Rr(e,`path`),Rr(n,`node`));let i=r.separator??`.`,a=e.split(i),o=[];for(let e of a){let r=xc(e,n);if(!r){yield{name:e,sourceValue:void 0,leafValue:void 0,ancestors:o,_kind:`entry-ancestors`};return}n=r.sourceValue,yield{...r,ancestors:[...o],_kind:`entry-ancestors`},o.push(e)}}const wc=(e,n={},r=[],i)=>{let a=n.name??`object`,o={*children(){for(let{name:i,sourceValue:s,leafValue:c}of yc(e,n))yield wc(s,{...n,name:i},[...r,a],o)},getParent(){return i},getValue(){return{name:a,sourceValue:e,ancestors:r,_kind:`entry-static`}},getIdentity(){return e}};return o},Tc=(e,n)=>js(Ec(e,n)),Ec=(e,n={})=>Dc(e,(n.valuesAtLeaves??!1?e=>{if(No(e))return e}:e=>e)(e),n,[]),Dc=(e,n,r={},i)=>{let a=r.name??`object_ci`,o=ic({name:a,sourceValue:n,ancestors:[...i],_kind:`entry-static`});i=[...i,a];for(let n of yc(e,r)){let e=r.valuesAtLeaves?n.leafValue:n.sourceValue;nc(Dc(n.sourceValue,e,{...r,name:n.name},i),o)}return o},Oc=(e,n={})=>Os(Ec(e,n));function kc(e,n=``){return`name`in e&&`leafValue`in e&&`sourceValue`in e?{name:e.name,_kind:`entry`,leafValue:e.leafValue,sourceValue:e.sourceValue}:`name`in e?{name:e.name,leafValue:e,sourceValue:e,_kind:`entry`}:{name:n,leafValue:e,sourceValue:e,_kind:`entry`}}function Ac(e){return`value`in e}function jc(e){return`values`in e&&Array.isArray(e.values)}var Mc=Ao({Pathed:()=>Nc,addValueByPath:()=>Pc,children:()=>Bc,childrenLengthByPath:()=>zc,clearValuesByPath:()=>Rc,findAnyChildByValue:()=>Kc,hasValue:()=>qc,parent:()=>Uc,parentValues:()=>Wc,removeValueByPath:()=>Lc,siblings:()=>Vc,siblingsValues:()=>Hc,toStringDeep:()=>$c,valueByPath:()=>Jc,valuesByPath:()=>Zc}),Nc=class{#e;#t;constructor(e={}){this.#t={separator:`.`,startsWithSeparator:!1,duplicates:`overwrite`,...e}}add(e,n){Or(this.validate(n));let r=Pc(e,n,this.#t,this.#e);this.#e===void 0&&(this.#e=Js(r))}validate(e){return this.#t.startsWithSeparator&&!e.startsWith(this.#t.separator)?{success:!1,error:`Path must start with separator when 'startsWithSeparator' is enabled. Got: ${e}`}:{success:!0,value:e}}prettyPrint(){return this.#e===void 0?`(empty)`:pc(this.#e)}remove(e){return Or(this.validate(e)),this.#e!==void 0&&Lc(e,this.#e,this.#t)}hasPath(e){return Or(this.validate(e)),this.#e!==void 0&&Xc(e,this.#e,this.#t)!==void 0}getNode(e){if(Or(this.validate(e)),this.#e!==void 0)return Xc(e,this.#e,this.#t)}getValue(e){if(Or(this.validate(e)),this.#e!==void 0)return Jc(e,this.#e,this.#t)}getPath(e,n){if(this.#e===void 0)return``;let r=[];n&&e.value&&r.push(e.value?.label);for(let n of Wc(e))r.unshift(n.label);let i=r.join(this.#t.separator);return this.#t.startsWithSeparator&&(i.startsWith(this.#t.separator)||(i=this.#t.separator+i),!i.endsWith(this.#t.separator)&&(e.childrenStore.length>0||!n)&&(i+=this.#t.separator)),i}childrenLength(e){if(Or(this.validate(e)),this.#e===void 0)return NaN;let n=Xc(e,this.#e,this.#t);return n===void 0?NaN:n.childrenStore.length}getValues(e){if(Or(this.validate(e)),this.#e!==void 0)return Zc(e,this.#e,this.#t)}clearValues(e){return Or(this.validate(e)),this.#e!==void 0&&Rc(e,this.#e,this.#t)}*children(e){Or(this.validate(e)),this.#e!==void 0&&(yield*Bc(e,this.#e,this.#t))}*siblings(e){Or(this.validate(e)),this.#e!==void 0&&(yield*Vc(e,this.#e,this.#t))}*siblingsValues(e){Or(this.validate(e)),this.#e!==void 0&&(yield*Hc(e,this.#e,this.#t))}parent(e){if(Or(this.validate(e)),this.#e!==void 0)return Uc(e,this.#e,this.#t)}get separator(){return this.#t.separator}get root(){return this.#e}};function Pc(e,n,r,i){let a=r.separator,o=r.duplicates,s=n.split(a),c=0;for(let n of s){let r=c===s.length-1,a=Gc(n,i);if(a===void 0)i=sc({value:r?e:void 0,label:n},i);else if(i=a,r)switch(o){case`ignore`:break;case`allow`:{let r=Yc(i);i.value={values:[...r,e],label:n};break}case`overwrite`:i.value={value:e,label:n};break}else i=a;c++}if(i===void 0)throw Error(`Could not create tree`);return i}function Fc(e){return e.value===void 0?!0:`values`in e.value?e.value.values.length===0:`value`in e.value?e.value.value===void 0:!0}function Ic(e){if(e.childrenStore.length>0||!Fc(e))return;let n=e.parent;n&&(Ms(e),Ic(n))}function Lc(e,n,r){if(n===void 0)return!1;let i=Xc(e,n,r);return i!==void 0&&(i.value=void 0,Ic(i),!0)}function Rc(e,n,r){if(n===void 0)return!1;let i=Xc(e,n,r);return i!==void 0&&(i.value={label:i.value?.label??``,value:void 0},!0)}function zc(e,n,r){if(n===void 0)return NaN;let i=Xc(e,n,r);return i===void 0?NaN:i.childrenStore.length}function*Bc(e,n,r){if(n===void 0)return;let i=Xc(e,n,r);if(i!==void 0)for(let e of i.childrenStore)yield e}function*Vc(e,n,r){if(n===void 0)return;let i=Xc(e,n,r);if(i===void 0)return;let a=i.parent;if(a!==void 0){for(let e of a.childrenStore)if(e!==i){if(e===void 0)throw TypeError(`Unexpected undefined child node`);yield e}}}function*Hc(e,n,r){for(let i of Vc(e,n,r))i.value!==void 0&&(yield i.value)}function Uc(e,n,r){if(n===void 0)return;let i=Xc(e,n,r);if(i!==void 0)return i.parent}function*Wc(e){for(let n of Vs(e))n.value!==void 0&&(yield n.value)}function Gc(e,n){if(n!==void 0){if(e===void 0)throw Error(`Parameter 'label' cannot be undefined`);if(n.value?.label===e)return n;for(let r of n.childrenStore)if(r.value?.label===e)return r}}function Kc(e,n,r=2**53-1,i=Co){if(n===void 0)throw TypeError(`Param 'node' is undefined`);if(!(r<=0)){if(e===void 0)throw Error(`Param 'value' cannot be undefined`);for(let r of n.childrenStore)if(qc(e,r,i))return r;for(let a of n.childrenStore){let n=Kc(e,a,r-1,i);if(n!==void 0)return n}}}function qc(e,n,r=So){if(n.value===void 0)return!1;if(Ac(n.value)){if(r(n.value.value,e))return!0}else if(jc(n.value)){for(let i of n.value.values)if(r(i,e))return!0}return!1}function Jc(e,n,r={}){let i=Zc(e,n,r);if(i!==void 0&&i.length!==0){if(i.length>1)throw Error(`Multiple values at path. Use getValues instead`);return i[0]}}function Yc(e){return e.value===void 0?[]:`values`in e.value?e.value.values:`value`in e.value?e.value.value===void 0?[]:[e.value.value]:[]}function Xc(e,n,r){e.endsWith(r.separator)&&r.startsWithSeparator&&(e=e.slice(0,-r.separator.length));let i=e.split(r.separator),a=n;for(let e of i)if(a=Gc(e,a),a===void 0)return;return a}function Zc(e,n,r={}){let i=r.separator??`.`,a=e.split(i),o=n;for(let e of a)if(o=Gc(e,o),o===void 0)return;return Yc(o)}function Qc(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`string`?`"${e}"`:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.length===0?`[]`:`[ ${e.map(Qc).join(`, `)} ]`:typeof e==`object`?`{ ${Object.entries(e).map(([e,n])=>`${e}: ${Qc(n)}`).join(`, `)} }`:String(e)}function $c(e){let n=e.value?.label??`?`,r=e.value===void 0?void 0:`values`in e.value?e.value.values:`value`in e.value?e.value.value:void 0,i=e.childrenStore.map(e=>$c(e)),a=i.length===0?`[]`:`[ ${i.join(`, `)} ]`;return`{ label: "${n}", value: ${Qc(r)}, children: ${a} }`}var el=Ao({breadthFirst:()=>vl,childrenLength:()=>tl,couldAddChild:()=>cl,depthFirst:()=>_l,find:()=>yl,findAnyChildByValue:()=>hl,findAnyParentByValue:()=>il,findByValue:()=>bl,findChildByValue:()=>gl,findParentByValue:()=>sl,followValue:()=>xl,hasAnyChild:()=>ll,hasAnyChildValue:()=>ul,hasAnyParent:()=>nl,hasAnyParentValue:()=>rl,hasChild:()=>dl,hasChildValue:()=>fl,hasParent:()=>al,hasParentValue:()=>ol,parents:()=>ml,siblings:()=>pl,toString:()=>Cl,toStringDeep:()=>Sl});const tl=e=>[...e.children()].length,nl=(e,n,r)=>al(e,n,r,2**53-1),rl=(e,n,r)=>{if(e===void 0)throw TypeError(`Param 'child' is undefined`);return ol(e,n,r,2**53-1)},il=(e,n,r)=>sl(e,n,r,2**53-1),al=(e,n,r=So,i=0)=>{if(i<0)return!1;let a=ku(e),o=ku(n),s=a?e.getParent():e.parent;return s===void 0?!1:r(s,n)||r(a?s.getIdentity():s.value,o?n.getIdentity():n.value)?!0:al(s,n,r,i-1)},ol=(e,n,r=So,i=0)=>{if(e===void 0)throw Error(`Param 'child' is undefined`);if(i<0)return!1;let a=`getParent`in e?e.getParent():e.parent;return a===void 0?!1:r(`getValue`in a?a.getValue():a.value,n)?!0:ol(a,n,r,i-1)},sl=(e,n,r=So,i=0)=>{if(i<0)return;let a=`getParent`in e?e.getParent():e.parent;if(a!==void 0)return r(`getValue`in a?a.getValue():a.value,n)?a:sl(a,n,r,i-1)},cl=(e,n,r=So)=>{if(r(e,n))throw Error(`Child equals parent`);if(ll(e,n,r))throw Error(`Circular. Parent already has child`);if(ll(n,e,r))throw Error(`Prospective child has parent as child relation`)},ll=(e,n,r=So)=>dl(e,n,r,2**53-1),ul=(e,n,r=So)=>fl(e,n,r,2**53-1),dl=(e,n,r=So,i=0)=>{if(i<0)return!1;if(r(e,n))return!0;let a=`getIdentity`in e?e.getIdentity():e.value,o=`getIdentity`in n?n.getIdentity():n.value;if(r(a,o))return!0;for(let a of vl(e,i)){let e=`getIdentity`in a?a.getIdentity():a.value;if(r(a,n)||r(e,o))return!0}return!1},fl=(e,n,r=So,i=0)=>{if(i<0)return!1;if(r(e.getValue(),n))return!0;for(let a of vl(e,i))if(r(a.getValue(),n))return!0;return!1};function*pl(e){let n=e.getParent();if(n!==void 0)for(let r of n.children())r!==e&&(yield r)}function*ml(e){if(ku(e)){let n=e.getParent();for(;n!==void 0;)yield n,n=n.getParent()}else{let n=e.parent;for(;n!==void 0;)yield n,n=n.parent}}function hl(e,n,r=So){return gl(e,n,r,2**53-1)}function gl(e,n,r=So,i=0){if(i<0)return;let a=ku(e);if(a){if(r(e.getValue(),n))return e}else if(r(e.value,n))return e;for(let o of vl(e,i))if(a){if(r(o.getValue(),n))return o}else if(r(o.value,n))return o}function*_l(e){if(!e)return;let n=new Jo,r=e;for(;r;){let e=ku(r)?[...r.children()]:[...r.childrenStore];if(n.push(...e),n.isEmpty)break;r=n.pop(),r&&(yield r)}}function*vl(e,n=2**53-1){if(!e)return;let r=(ku(e),new ns),i=e;for(;i;){if(n<0)return;if(i!==void 0){let e=`childrenStore`in i?i.childrenStore:i.children();for(let n of e)yield n,r.enqueue(n)}i=r.dequeue(),n--}}function yl(e,n,r=`breadth`){if(n(e))return e;let i=r===`breadth`?vl:_l;for(let r of i(e))if(n(r))return r}function bl(e,n,r=`breadth`){if(n(e.getValue()))return e;let i=r===`breadth`?vl:_l;for(let r of i(e))if(n(r.getValue()))return r}function*xl(e,n,r=1){for(let i of e.children())n(i.getValue(),r)&&(yield i.getValue(),yield*xl(i,n,r+1))}function Sl(e,n=0){if(e===void 0)return`(undefined)`;if(e===null)return`(null)`;let r=e.getValue(),i=typeof r;Array.isArray(r)&&(i=`array`);let a=` `.repeat(n)+`value: ${JSON.stringify(r)} (${i})\n`;for(let r of e.children())a+=Sl(r,n+1);return a}function Cl(...e){let n=``;for(let r of e){let e=r.getValue(),i=Mo(e),a=[...r.children()],o=r.getParent(),s=typeof e;Array.isArray(e)&&(s=`array`),n+=`value: ${i} (${s}) kids: ${a.length} parented: ${o?`y`:`n`}\n`}return n}var wl=Ao({addLeft:()=>Jl,addRight:()=>Yl,balanceFactor:()=>Gl,breadthFirst:()=>su,createNode:()=>Zl,depthFirst:()=>ou,find:()=>nu,fromArray:()=>cu,getLeft:()=>Dl,getRight:()=>Ol,grandparent:()=>Ll,hasLeft:()=>kl,hasRight:()=>Al,height:()=>Wl,inOrder:()=>ru,isLeaf:()=>jl,isParentLeftChild:()=>Rl,isParentRightChild:()=>zl,leftSubtreeHeightFn:()=>Kl,parentChildSide:()=>Bl,postOrder:()=>au,preOrder:()=>iu,removeNode:()=>Pl,rightSubtreeHeightFn:()=>ql,root:()=>Xl,rootWrapped:()=>tu,setLeft:()=>Ml,setRight:()=>Nl,sibling:()=>Fl,toArray:()=>lu,toStringDeep:()=>uu,uncle:()=>Il,wrap:()=>eu});const Tl=e=>e.childrenStore[0],El=e=>e.childrenStore[1],Dl=e=>Tl(e),Ol=e=>El(e),kl=e=>Tl(e)!==void 0,Al=e=>El(e)!==void 0,jl=e=>!kl(e)&&!Al(e),Ml=(e,n)=>{let r=Tl(e);r&&(r.parent=void 0);let i=[...e.childrenStore];if(n===void 0&&i.length<=1){e.childrenStore=[];return}if(n===void 0){i[0]=void 0,e.childrenStore=i;return}i.length===0?i.push(n):i[0]=n,e.childrenStore=i,n.parent=e},Nl=(e,n)=>{let r=El(e);r&&(r.parent=void 0);let i=[...e.childrenStore];if(n===void 0){i.length>=2&&(i[1]=void 0,e.childrenStore=i[0]===void 0?[]:i);return}i.length===0?i.push(void 0,n):i.length===1?i.push(n):i[1]=n,e.childrenStore=i,n.parent=e},Pl=e=>{let n=e.parent;n&&(n.childrenStore[0]===e?Ml(n,void 0):n.childrenStore[1]===e&&Nl(n,void 0))},Fl=e=>{let n=e.parent;if(!n)return;let r=Tl(n),i=El(n);if(r===e)return i;if(i===e)return r},Il=e=>{let n=e.parent;if(n)return Fl(n)},Ll=e=>{let n=e.parent;if(n)return n.parent},Rl=e=>{let n=e.parent;return n?Tl(n)===e:!1},zl=e=>{let n=e.parent;return n?El(n)===e:!1},Bl=e=>e.parent?Rl(e)?`left`:`right`:`neutral`,Vl=e=>{let n=Tl(e);return n?Ul(n)+1:0},Hl=e=>{let n=El(e);return n?Ul(n)+1:0},Ul=e=>Math.max(Vl(e),Hl(e)),Wl=e=>Ul(e),Gl=e=>Vl(e)-Hl(e),Kl=Vl,ql=Hl,Jl=(e,n)=>{let r=Tl(n);r&&(r.parent=void 0);let i={value:e,parent:n,childrenStore:[]},a=[...n.childrenStore];return a.length===0?a.push(i):a[0]=(a.length,i),n.childrenStore=a,i},Yl=(e,n)=>{let r=El(n);r&&(r.parent=void 0);let i={value:e,parent:n,childrenStore:[]},a=[...n.childrenStore];return a.length===0?(a.push(void 0),a.push(i)):a.length===1?a.push(i):a[1]=i,n.childrenStore=a,i},Xl=e=>ic(e),Zl=(e,n)=>sc(e,n),Ql=e=>`node`in e?e.node:e,$l=e=>eu(e),eu=e=>({node:e,get left(){let n=Tl(e);return n?$l(n):void 0},get right(){let n=El(e);return n?$l(n):void 0},set left(n){Ml(e,n?Ql(n):void 0)},set right(n){Nl(e,n?Ql(n):void 0)},get parentChildSide(){return Bl(e)},get isParentLeftChild(){return Rl(e)},get isParentRightChild(){return zl(e)},get isLeaf(){return jl(e)},get sibling(){let n=Fl(e);return n?$l(n):void 0},get uncle(){let n=Il(e);return n?$l(n):void 0},get grandparent(){let n=Ll(e);return n?$l(n):void 0},get leftSubtreeHeight(){return Vl(e)},get rightSubtreeHeight(){return Hl(e)},get height(){return Wl(e)},get balanceFactor(){return Gl(e)},has(n){return nu(e,n)!==void 0},addLeft(n){return $l(Jl(n,e))},addRight(n){return $l(Yl(n,e))},setLeft(n){Ml(e,Ql(n))},setRight(n){Nl(e,Ql(n))},remove(){Pl(e)}}),tu=e=>eu(ic(e)),nu=(e,n)=>{for(let r of su(e))if(r.value===n)return r};function*ru(e){let n=Tl(e);n&&(yield*ru(n)),yield e;let r=El(e);r&&(yield*ru(r))}function*iu(e){yield e;let n=Tl(e);n&&(yield*iu(n));let r=El(e);r&&(yield*iu(r))}function*au(e){let n=Tl(e);n&&(yield*au(n));let r=El(e);r&&(yield*au(r)),yield e}function*ou(e){let n=Tl(e),r=El(e);n&&(yield*ou(n)),r&&(yield*ou(r)),yield e}function*su(e){yield e;let n=[];for(n.push(...e.childrenStore.filter(e=>e!==void 0&&e.value!==void 0));n.length>0;){let e=n.shift();yield e,n.push(...e.childrenStore.filter(e=>e!==void 0&&e.value!==void 0))}}const cu=e=>{if(e.length===0)return;let n=ic(e[0]),r=(n,i)=>{let a=2*n+1,o=2*n+2;a<e.length&&(Jl(e[a],i),r(a,Tl(i))),o<e.length&&(Yl(e[o],i),r(o,El(i)))};return r(0,n),n},lu=e=>{let n=[];for(let r of su(e))r.value!==void 0&&n.push(r.value);return n},uu=(e,n=0)=>{let r=e.value===void 0?`-`:JSON.stringify(e.value),i=` `.repeat(n),a=Tl(e),o=El(e),s=`${i}${r}`;return(a||o)&&(s+=`
|
|
3339
|
-
`,a&&(s+=`${i} L: ${
|
|
3340
|
-
`)),o&&(s+=`${i} R: ${uu(o,n+1)}`)),s};var du=Ao({Bst:()=>fu,create:()=>Cu,find:()=>hu,fromArray:()=>wu,has:()=>mu,inOrder:()=>yu,insert:()=>pu,max:()=>_u,min:()=>gu,postOrder:()=>xu,preOrder:()=>bu,remove:()=>vu,root:()=>Tu,valuesInOrder:()=>Su}),fu=class{root;comparer;constructor(e=Do){this.comparer=e,this.root=Xl()}insert(e){return this.root=pu(this.root,e,this.comparer),this.root}has(e){return mu(this.root,e,this.comparer)}find(e){return hu(this.root,e,this.comparer)}remove(e){let n=vu(this.root,e,this.comparer);return n&&(this.root=n),n!==void 0}min(){return gu(this.root)}max(){return _u(this.root)}inOrder(){return yu(this.root)}preOrder(){return bu(this.root)}postOrder(){return xu(this.root)}valuesInOrder(){return Su(this.root)}toArrayInOrder(){return Array.from(this.valuesInOrder())}};const pu=(e,n,r=Do)=>{if(e.value===void 0)return e.value=n,e;let i=e;for(;;){let e=r(n,i.value);if(e<0){let e=Dl(i);if(e)i=e;else{Jl(n,i);break}}else if(e>0){let e=Ol(i);if(e)i=e;else{Yl(n,i);break}}else break}return e},mu=(e,n,r=Do)=>hu(e,n,r)!==void 0,hu=(e,n,r=Do)=>{if(!e||e.value===void 0)return;let i=r(n,e.value);if(i===0)return e;if(i<0){let i=Dl(e);return i?hu(i,n,r):void 0}{let i=Ol(e);return i?hu(i,n,r):void 0}},gu=e=>{if(!e||e.value===void 0)return;let n=e;for(;Dl(n);)n=Dl(n);return n},_u=e=>{if(!e||e.value===void 0)return;let n=e;for(;Ol(n);)n=Ol(n);return n},vu=(e,n,r=Do)=>{if(!e||e.value===void 0)return;let i=hu(e,n,r);if(!i)return;let a=Dl(i),o=Ol(i);if(!a&&!o)i===e?(e.value=void 0,e.childrenStore=[]):Pl(i);else if(!a){if(i===e){e.value=o.value,e.childrenStore=o.childrenStore;for(let n of e.childrenStore)n&&(n.parent=e)}else{let e=i.parent;Dl(e)===i?Ml(e,o):Nl(e,o)}}else if(o){let e=gu(o);i.value=e.value;let n=e.parent,r=Ol(e);Dl(n)===e?Ml(n,r):Nl(n,r)}else if(i===e){e.value=a.value,e.childrenStore=a.childrenStore;for(let n of e.childrenStore)n&&(n.parent=e)}else{let e=i.parent;Dl(e)===i?Ml(e,a):Nl(e,a)}return e};function*yu(e){if(!e)return;let n=Dl(e);n&&(yield*yu(n)),yield e;let r=Ol(e);r&&(yield*yu(r))}function*bu(e){if(!e)return;yield e;let n=Dl(e);n&&(yield*bu(n));let r=Ol(e);r&&(yield*bu(r))}function*xu(e){if(!e)return;let n=Dl(e);n&&(yield*xu(n));let r=Ol(e);r&&(yield*xu(r)),yield e}function*Su(e){for(let n of yu(e))n.value!==void 0&&(yield n.value)}const Cu=e=>new fu(e),wu=(e,n=Do)=>{let r=new fu(n);for(let n of e)r.insert(n);return r},Tu=()=>Xl();var Eu=Ao({BinarySearchTree:()=>du,BinaryTree:()=>wl,FromObject:()=>hc,Mutable:()=>Es,Pathed:()=>Mc,Traverse:()=>el,compare:()=>ys,isMultiValue:()=>jc,isSingleValue:()=>Ac,isTraversable:()=>ku,isTreeNode:()=>Ou,toTraversable:()=>Du});const Du=e=>{if(ku(e))return e;if(Ou(e))return uc(e);if(typeof e==`object`)return wc(e);throw Error(`Parameter 'node' not convertible`)},Ou=e=>!!(`parent`in e&&`childrenStore`in e&&`value`in e&&Array.isArray(e.childrenStore)),ku=e=>`children`in e&&`getParent`in e&&`getValue`in e&&`getIdentity`in e;(class e extends Ro{static shared=new e;_loop;_queue;constructor(){super(),this._queue=vs.mutable(),this._loop=Po(()=>this.processQueue(),100)}enqueue(e){let n=this._queue.enqueue(e);return this._loop.runState===`idle`&&(this.fireEvent(`started`,{}),this._loop.start()),n}async processQueue(){let e=this._queue.dequeue();if(e===void 0)return this.fireEvent(`empty`,{}),!1;try{let n=await e();this.fireEvent(`progress`,{task:e,remaining:this._queue.length,result:n})}catch(n){this.fireEvent(`error`,{error:n,task:e})}return!0}clear(){this._queue.length!==0&&(this._queue.clear(),this._loop.cancel(),this.fireEvent(`empty`,{}))}get isEmpty(){return this._queue.isEmpty}get length(){return this._queue.length}get runState(){return this._loop.runState}});function Au(e,n={}){let r=Fo(e);if(!r)throw Error(`Param 'duration' not valid`);let i={clampValue:n.clampValue,wrapValue:n.wrapValue,timer:n.timer??Fu()},a;return()=>(a??=Pu(r,i),a.elapsed)}function ju(e,n={}){let r={...n,timer:Iu()},i;return()=>(i??=Pu(e,r),i.elapsed)}const Mu=()=>({elapsed:1,isDone:!0,reset(){},mod(e){}}),Nu=()=>({elapsed:0,isDone:!1,reset(){},mod(){}}),Pu=(e,n={})=>{if(!Number.isFinite(e))return Mu();if(Number.isNaN(e))return Nu();let r=n.clampValue??!1,i=n.wrapValue??!1;if(r&&i)throw Error(`clampValue and wrapValue cannot both be enabled`);let a=1,o=n.timer??Fu(),s=0,c=n=>{s=n;let o=n/(e*a);return r?o=ii(o):i&&o>=1&&(o%=1),o};return{mod(e){a=e},get isDone(){return c(s)>=1},get elapsed(){return c(o.elapsed)},reset:()=>{o.reset()}}},Fu=()=>{let e=performance.now();return{reset:()=>{e=performance.now()},get elapsed(){return performance.now()-e}}},Iu=()=>{let e=0;return{reset:()=>{e=0},get peek(){return e},get elapsed(){return++e}}},Lu=(e,n)=>{if(typeof e!=`function`)throw Error(`Param 'fn' should be a function. Got: ${typeof e}`);let r=1;return{get elapsed(){return n.elapsed},get isDone(){return n.isDone},get runState(){return n.isDone?`idle`:`scheduled`},get startCount(){return r},get startCountTotal(){return r},compute:()=>{let r=n.elapsed;return e(r)},reset:()=>{n.reset(),r++}}};var Ru=class{seenCount;storeIntermediate;resetAfterSamples;sampleLimit;id;debug;constructor(e={}){this.id=e.id??`tracker`,this.debug=e.debug??!1,this.sampleLimit=e.sampleLimit??-1,this.resetAfterSamples=e.resetAfterSamples??-1,this.storeIntermediate=e.storeIntermediate??(this.sampleLimit>-1||this.resetAfterSamples>-1),this.seenCount=0,this.debug&&console.log(`TrackerBase: sampleLimit: ${this.sampleLimit} resetAfter: ${this.resetAfterSamples} store: ${this.storeIntermediate}`)}reset(){this.seenCount=0,this.onReset()}seen(...e){this.resetAfterSamples>0&&this.seenCount>this.resetAfterSamples?this.reset():this.sampleLimit>0&&this.seenCount>this.sampleLimit*2&&(this.seenCount=this.trimStore(this.sampleLimit),this.onTrimmed(`resize`)),this.seenCount+=e.length;let n=this.filterData(e);return this.computeResults(n)}},zu=class extends Ru{values;constructor(e={}){super(e),this.values=[]}onTrimmed(e){}trimStore(e){return e>=this.values.length||(this.values=this.values.slice(-e)),this.values.length}onReset(){this.values=[]}filterData(e){let n=e.map(e=>`at`in e?e:{...e,at:Date.now()}),r=n.at(-1);if(this.storeIntermediate)this.values.push(...n);else switch(this.values.length){case 0:this.values.push(r);break;case 1:this.values.push(r);break;case 2:this.values[1]=r;break}return n}get last(){return this.values.length===1?this.values[0]:this.values.at(-1)}get initial(){return this.values.at(0)}get size(){return this.values.length}get elapsed(){if(this.values.length===0)throw Error(`No values seen yet`);return Date.now()-this.values[0].at}get timespan(){let e=this.initial,n=this.last;return!e||!n?NaN:n.at-e.at}},Bu=class{store;gog;constructor(e){this.store=new Map,this.gog=Oo(this.store,e)}get size(){return this.store.size}has(e){return this.store.has(e)}seen(e,...n){return this.getTrackedValue(e,...n).seen(...n)}getTrackedValue(e,...n){if(e===null)throw Error(`id parameter cannot be null`);if(e===void 0)throw Error(`id parameter cannot be undefined`);return this.gog(e,n[0])}delete(e){this.store.delete(e)}reset(){this.store=new Map}*ids(){yield*this.store.keys()}*tracked(){yield*this.store.values()}*trackedByAge(){let e=[...this.store.values()];e.sort((e,n)=>{let r=e.elapsed,i=n.elapsed;return r===i?0:r>i?-1:1});for(let n of e)yield n}*valuesByAge(){for(let e of this.trackedByAge())yield e.last}*last(){for(let e of this.store.values())yield e.last}*initialValues(){for(let e of this.store.values())yield e.initial}get(e){return this.store.get(e)}};function Vu(e,n,r,i){if(Gr(e)){if(typeof n==`number`&&r!==void 0)O(k(n,`positive`,`width`),k(r,`positive`,`height`));else{if(!ga(n))throw Error(`Expected second parameter to be a rect`);r=n.height,n=n.width}return Object.freeze({x:e.x/n,y:e.y/r})}if(O(k(e,`positive`,`x`)),typeof n!=`number`)throw TypeError(`Expecting second parameter to be a number (width)`);if(typeof r!=`number`)throw TypeError(`Expecting third parameter to be a number (height)`);if(O(k(n,`positive`,`y`)),O(k(r,`positive`,`width`)),i===void 0)throw Error(`Expected height parameter`);return O(k(i,`positive`,`height`)),Object.freeze({x:e/r,y:n/i})}function Hu(e,n,r,i,a,o){let[s,c]=Ni(e,n,r,i,a,o);if(A(s,`a`),A(c,`b`),c.x===0)throw TypeError(`Cannot divide by zero (b.x is 0)`);if(c.y===0)throw TypeError(`Cannot divide by zero (b.y is 0)`);let l={x:s.x/c.x,y:s.y/c.y};if(j(s)||j(c)){if(c.z===0)throw TypeError(`Cannot divide by zero (b.z is 0)`);l.z=(s.z??0)/(c.z??0)}return Object.freeze(l)}function Uu(e,n,r){let i=Pi(e,n,r);return Wr(i,`divisor`),(e,n,r)=>{let a=Pi(e,n,r);return a.z===void 0?Object.freeze({x:a.x/i.x,y:a.y/i.y}):Object.freeze({x:a.x/i.x,y:a.y/i.y,z:a.z/(i.z??1)})}}function Wu(e){if(j(e))return Object.freeze({...e,x:Math.abs(e.x),y:Math.abs(e.y),z:Math.abs(e.z)});if(Gr(e))return Object.freeze({...e,x:Math.abs(e.x),y:Math.abs(e.y)});throw TypeError(`Param 'pt' is not a point`)}function Gu(e,n){return A(e,`pt`),j(e)?Object.freeze({...e,x:n(e.x,`x`),y:n(e.y,`y`),z:n(e.z,`z`)}):Object.freeze({...e,x:n(e.x,`x`),y:n(e.y,`y`)})}const Ku=(...e)=>{if(!Array.isArray(e))throw Error(`Expected list of points`);let n=e.reduce((e,n)=>{if(n===void 0)return e;if(Array.isArray(n))throw TypeError(`'points' list contains an array. Did you mean: centroid(...myPoints)?`);if(!Gr(n))throw Error(`'points' contains something which is not a point: ${JSON.stringify(n)}`);return{x:e.x+n.x,y:e.y+n.y}},{x:0,y:0});return Object.freeze({x:n.x/e.length,y:n.y/e.length})};function qu(e,n=0,r=1){return j(e)?Object.freeze({x:ii(e.x,n,r),y:ii(e.y,n,r),z:ii(e.z,n,r)}):Object.freeze({x:ii(e.x,n,r),y:ii(e.y,n,r)})}const Ju=(...e)=>{let n=[...e].sort(ho);if(n.length===1)return n;let r=e=>{let n=[];for(let r of e){for(;n.length>=2;){let e=n.at(-1),i=n.at(-2);if((e.x-i.x)*(r.y-i.y)>=(e.y-i.y)*(r.x-i.x))n.pop();else break}n.push(r)}return n.pop(),n},i=r(n),a=r(n.reverse());return i.length===1&&a.length===1&&uo(a[0],i[0])?i:[...i,...a]},Yu=(e,n)=>{if(_a(n))return Bo(n,e);if(io(n))return so(n,e);if(Gr(n))return Fi(e,n);throw Error(`Unknown shape`)},Xu=(e,n)=>{if(_a(n))return Bo(n,e);if(io(n))return so(n,e);if(Gr(n))return Fi(e,n);throw Error(`Unknown shape`)},Zu=e=>[e.x,e.y],Qu=(...e)=>ri(e.map(e=>Zu(e)));function $u(e,n){return e.x*n.y-e.y*n.x}function ed(e,n,r,i){return e*i-n*r}function td(e,n,r){if(Array.isArray(e)){if(e.length===3)return Object.freeze({x:e[0],y:e[1],z:e[2]});if(e.length===2)return Object.freeze({x:e[0],y:e[1]});throw Error(`Expected array of length two or three, got ${e.length}`)}if(e===void 0)throw Error(`Requires an array of [x,y] or x,y parameters at least`);if(Number.isNaN(e))throw Error(`x is NaN`);if(n===void 0)throw Error(`Param 'y' is missing`);if(Number.isNaN(n))throw Error(`y is NaN`);return Object.freeze(r===void 0?{x:e,y:n}:{x:e,y:n,z:r})}const nd=e=>{if(typeof e!=`string`)throw TypeError(`Param 'str' ought to be a string. Got: ${typeof e}`);let n=e.indexOf(`,`),r=Number.parseFloat(e.substring(0,n)),i=e.indexOf(`,`,n+1);return i>0?{x:r,y:Number.parseFloat(e.substring(n+1,i-n+2)),z:Number.parseFloat(e.substring(i+1))}:{x:r,y:Number.parseFloat(e.substring(n+1))}},rd=(...e)=>{let n=[];if(Array.isArray(e[0]))for(let r of e){if(r.length%2!=0)throw Error(`coords array should be even-numbered`);n.push(Object.freeze({x:r[0],y:r[1]}))}else{if(e.length%2!=0)throw Error(`Expected even number of elements: [x,y,x,y...]`);for(let r=0;r<e.length;r+=2)n.push(Object.freeze({x:e[r],y:e[r+1]}))}return n};function id(e,n,r,i=!1){return ua(e,n,r,i)}const ad=(e,n,r=!1)=>da({a:e,b:n},r),od=(e,n=`both`)=>{switch(n){case`both`:return j(e)?Object.freeze({...e,x:e.x*-1,y:e.y*-1,z:e.z*-1}):Object.freeze({...e,x:e.x*-1,y:e.y*-1});case`x`:return Object.freeze({...e,x:e.x*-1});case`y`:return Object.freeze({...e,y:e.y*-1});case`z`:if(j(e))return Object.freeze({...e,z:e.z*-1});throw Error(`pt parameter is missing z`);default:throw Error(`Unknown what parameter. Expecting 'both', 'x' or 'y'`)}},sd=(e,n=1,r=0)=>{let i=Fi(e),a=1;return i>n?a=n/i:i<r&&(a=r/i),a===1?e:co(e,a,a)},cd=(...e)=>na((e,n)=>e.x<=n.x?e:n,...e),ld=(...e)=>na((e,n)=>e.x>=n.x?e:n,...e),ud=(e,n)=>{if(Gr(e)&&(n=e.y,e=e.x),n===void 0)throw Error(`Expected y`);return Math.hypot(e,n)},dd=(e,n)=>{let r=Pi(e,n),i=ud(r);return i===0?Wi:Object.freeze({...r,x:r.x/i,y:r.y/i})},fd=(e,...n)=>pd(...n)(e),pd=(...e)=>n=>e.reduce((e,n)=>n(e),n),md=Object.freeze({x:0,y:0}),hd=Math.PI*2,gd=Math.PI;function _d(e,n=``,r=md){e=Li(e,r);let i=Math.atan2(e.y,e.x);return n===`unipolar`&&i<0?i+=hd:n===`bipolar`&&(i>gd?i-=hd:i<=-gd&&(i+=hd)),Object.freeze({distance:Fi(e),angleRadian:i})}function vd(e){return Li(e.b,e.a)}function yd(e){return O(sa(e,`line`)),_d(Li(e.b,e.a))}const bd=(e,n)=>{let r=Pi(e,n),i=0,a=0,o=0,s=performance.now(),c=r;return(e,n)=>{let l=Pi(e,n);i+=l.x,a+=l.y,o++;let u=Fi(l,r),d=Fi(l,c),f=performance.now(),p=d/(f-s);return s=f,c=l,Object.freeze({angle:Zi(l,r),distanceFromStart:u,distanceFromLast:d,speed:p,centroid:Ku(l,r),average:{x:i/o,y:a/o}})}},xd=Object.freeze({x:NaN,y:NaN}),Sd=Object.freeze({x:NaN,y:NaN,z:NaN});var Cd=class extends zu{initialRelation;markRelation;lastResult;constructor(e={}){super(e)}onTrimmed(e){this.initialRelation=void 0}onReset(){super.onReset(),this.lastResult=void 0,this.initialRelation=void 0,this.markRelation=void 0}mark(){this.markRelation=bd(this.last)}computeResults(e){let n=this.last,r=this.values.at(-2);if(this.initialRelation===void 0&&this.initial)this.initialRelation=bd(this.initial);else if(this.initialRelation===void 0)throw Error(`Bug: No initialRelation, and this.inital is undefined?`);let i=bd(r===void 0?n:r),a=this.initialRelation(n),o=this.markRelation===void 0?void 0:this.markRelation(n),s=r===void 0?0:la(r,n,!0)/(n.at-r.at),c={fromInitial:a,fromLast:{...i(n),speed:s},fromMark:o,values:[...this.values]};return this.lastResult=c,c}get line(){return this.values.length===1?[]:Vo(...this.values)}get vectorPolar(){return yd(this.lineStartEnd)}get vectorCartesian(){return vd(this.lineStartEnd)}get lineStartEnd(){let e=this.initial;return this.values.length<2||!e?zd:{a:e,b:this.last}}distanceFromStart(e=!1){let n=this.initial;return this.values.length>=2&&n!==void 0?e?Ii(n,this.last):Fi(n,this.last):0}speedFromStart(e=!1){let n=this.lengthTotal(e),r=this.timespan;return Number.isNaN(r)||n===0?0:Math.abs(n)/r}speedFromLast(e=!1){let n=this.lastResult;return n?n.fromLast.speed:0}difference(){let e=this.initial;return this.values.length>=2&&e!==void 0?Li(this.last,e):xd}angleFromStart(){let e=this.initial;if(e!==void 0&&this.values.length>2)return Zi(e,this.last)}lengthTotal(e=!1){if(this.values.length===1)return 0;let n=this.line;return la(n,e)}lengthAverage(e=!1){return this.lengthTotal(e)/this.values.length}get x(){return this.last.x}get y(){return this.last.y}get z(){return this.last.z}},wd=class extends Bu{constructor(e={}){super((n,r)=>{if(r===void 0)throw Error(`Requires start point`);let i=new Cd({...e,id:n});return i.seen(r),i})}get(e){return super.get(e)}},Td=class extends Cd{seenEvent(e){if(`getCoalescedEvents`in e){let n=e.getCoalescedEvents().map(e=>({x:e.clientX,y:e.clientY}));return this.seen(...n)}return this.seen({x:e.clientX,y:e.clientY})}},Ed=class extends Bu{constructor(e={}){super((n,r)=>{if(r===void 0)throw Error(`Requires start point`);let i=new Td({...e,id:n});return i.seen(r),i})}get(e){return super.get(e)}seenEvent(e){if(`getCoalescedEvents`in e){let n=e.getCoalescedEvents().map(e=>super.seen(e.pointerId.toString(),e));return Promise.all(n)}return Promise.all([super.seen(e.pointerId.toString(),e)])}};const Dd=(e,n,r)=>{let i=Li(e,n),a=Li(r,n);return j(i)&&j(a)?(i.x*a.x+i.y*a.y+i.z*a.z)/(a.x*a.x+a.y*a.y+a.z*a.z):(i.x*a.x+i.y*a.y)/(a.x*a.x+a.y*a.y)},Od=(e,n,r)=>({x:Math.cos(r)*n+e.x,y:Math.sin(r)*n+e.y});function kd(e,n,r=!0){if(A(e,`pt`),A(n,`snap`),j(e)){if(!j(n))throw TypeError(`Param 'snap' is missing 'z' field`);return Object.freeze({x:ui(e.x,n.x,r),y:ui(e.y,n.y,r),z:ui(e.z,n.z,r)})}return Object.freeze({x:ui(e.x,n.x,r),y:ui(e.y,n.y,r)})}const Ad=e=>(e===void 0&&(e=Math.random),Object.freeze({x:e(),y:e()})),jd=e=>(e===void 0&&(e=Math.random),Object.freeze({x:e(),y:e(),z:e()})),Md=(e,n,r)=>{r===void 0&&(r={x:0,y:0});let i=r;for(let r of e)i=n(r,i);return i};function Nd(e,n,r){r===void 0&&(r={x:0,y:0}),A(r,`origin`),O(k(n,``,`amountRadian`));let i=Array.isArray(e);if(n===0)return e;i||(e=[e]);let a=e;for(let[e,n]of a.entries())A(n,`pt[${e}]`);let o=a.map(e=>Yi(e,r)).map(e=>Ui(e,n)).map(e=>Ji(e,r));return i?o:o[0]}const Pd=(e,n)=>{let r=[[Math.cos(n),-Math.sin(n)],[Math.sin(n),Math.cos(n)]],i=[];for(let[n,a]of e.entries())i[n]=[r[0][0]*a[0]+r[0][1]*a[1],r[1][0]*a[0]+r[1][1]*a[1]];return i},Fd=(e,n,r)=>{let i=Pi(e,n);return r??=n,r??=2,Object.freeze({...i,x:ci(r,i.x),y:ci(r,i.y)})},Id=(e,n,r)=>{A(e,`a`),A(n,`b`),typeof r==`number`?(O(k(r,`positive`,`maxRange`)),r={x:r,y:r}):A(r,`maxRange`);let i=Math.abs(n.x-e.x),a=Math.abs(n.y-e.y);return i<=r.x&&a<=r.y},Ld=(e,n,r)=>(n===void 0&&(n={x:1,y:1}),r===void 0&&(r={x:0,y:0}),A(e,`pt`),A(n,`ptMax`),A(r,`ptMin`),Object.freeze({x:oi(e.x,r.x,n.x),y:oi(e.y,r.y,n.y)}));var Rd=Er({Empty:()=>Wi,Empty3d:()=>Ki,Placeholder:()=>xd,Placeholder3d:()=>Sd,PointTracker:()=>Cd,PointsTracker:()=>wd,Unit:()=>Gi,Unit3d:()=>qi,UserPointerTracker:()=>Td,UserPointersTracker:()=>Ed,abs:()=>Wu,angleRadian:()=>Zi,angleRadianCircle:()=>Qi,angleRadianThreePoint:()=>$i,apply:()=>Gu,average:()=>_i,averager:()=>vi,bbox:()=>ra,bbox3d:()=>ia,centroid:()=>Ku,clamp:()=>qu,clampMagnitude:()=>sd,compare:()=>fo,compareByX:()=>ho,compareByY:()=>go,compareByZ:()=>_o,compareRowwise:()=>po,convexHull:()=>Ju,cross:()=>$u,crossProductRaw:()=>ed,distance:()=>Fi,distance2d:()=>Ii,distanceToCenter:()=>Yu,distanceToExterior:()=>Xu,divide:()=>Hu,divider:()=>Uu,dotProduct:()=>Qu,findMinimum:()=>na,from:()=>td,fromNumbers:()=>rd,fromString:()=>nd,getAsBounds:()=>mo,getPointParameter:()=>Pi,getTwoPointParameters:()=>Ni,guard:()=>A,guardNonZeroPoint:()=>Wr,interpolate:()=>id,interpolator:()=>ad,invert:()=>od,isEmpty:()=>Kr,isEqual:()=>uo,isNaN:()=>Hr,isNull:()=>Vr,isPlaceholder:()=>qr,isPoint:()=>Gr,isPoint3d:()=>j,leftmost:()=>cd,multiply:()=>co,multiplyScalar:()=>lo,normalise:()=>dd,normaliseByRect:()=>Vu,pipeline:()=>pd,pipelineApply:()=>fd,pointTest:()=>Ur,progressBetween:()=>Dd,project:()=>Od,quantiseEvery:()=>kd,random:()=>Ad,random3d:()=>jd,reduce:()=>Md,relation:()=>bd,rightmost:()=>ld,rotate:()=>Nd,rotatePointArray:()=>Pd,round:()=>Fd,subtract:()=>Li,sum:()=>ao,to2d:()=>zi,to3d:()=>Bi,toArray:()=>Zu,toIntegerValues:()=>Ri,toString:()=>Vi,withinRange:()=>Id,wrap:()=>Ld});const zd=Object.freeze({a:Object.freeze({x:0,y:0}),b:Object.freeze({x:0,y:0})});Object.freeze({a:Object.freeze({x:NaN,y:NaN}),b:Object.freeze({x:NaN,y:NaN})});var Bd=Object.defineProperty,Vd=(e,n,r)=>n in e?Bd(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,Hd=(e,n)=>{for(var r in n)Bd(e,r,{get:n[r],enumerable:!0})},Ud=(e,n,r)=>Vd(e,typeof n==`symbol`?n:n+``,r),Wd={hsl:[`h`,`s`,`l`],oklab:[`l`,`a`,`b`],oklch:[`l`,`c`,`h`],rgb:[`r`,`g`,`b`]},Gd=[`hsl`,`oklab`,`oklch`,`rgb`],Kd=Math.PI/180,qd={l:[.3963377773761749,.2158037573099136],m:[-.1055613458156586,-.0638541728258133],s:[-.0894841775298119,-1.2914855480194092]},Jd={l:[.4122214708,.5363325363,.0514459929],m:[.2119034982,.6806995451,.1073969566],s:[.0883024619,.2817188376,.6299787005]},Yd={l:[.2104542553,.793617785,.0040720468],a:[1.9779984951,2.428592205,.4505937099],b:[.0259040371,.7827717662,.808675766]},Xd={r:[4.076741636075958,-3.307711539258063,.2309699031821043],g:[-1.2684379732850315,2.609757349287688,-.341319376002657],b:[-.0041960761386756,-.7034186179359362,1.7076146940746117]},Zd=5,Qd=180/Math.PI,N={alpha:`alpha must be a number between 0 and 1`,alphaAdjustment:`alpha must be a number between -1 and 1`,amount:`amount must be a number between 0 and 100`,colorRequired:`color is required`,degreesRange:`degrees must be a number between -360 and 360`,hueArgs:`point, chroma and h are required`,hueRange:`hue must be a number between 0 and 360`,input:`input is required`,inputHex:`input is required and must be a hex`,inputNumber:`input is required and must be a number`,inputString:`input is required and must be a string`,invalid:`invalid input`,invalidColor:`invalid color`,invalidCSS:`invalid CSS string`,invalidHex:`invalid hex`,invalidKey:`invalid key`,invalidModel:`invalid model`,invalidRange:`color value out of range`,left:`left is required and must be a string`,lightnessRange:`lightness must be a number between 0 and 1`,options:`invalid options`,paletteSize:`palette size must be at least 2`,ratioRange:`ratio must be a number between 0 and 1`,right:`right is required and must be a string`,threshold:`threshold must be a number between 0 and 255`,thresholdNormalized:`threshold must be a number between 0 and 1`};function P(e,n){if(e)return;let r=Error(n||`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);throw r.name=`colorizr`,r}var $d={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,grey:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},ef=/^#(?:[\da-f]{3,4}|[\da-f]{6,8})$/i;function tf(e){return Array.isArray(e)&&e.length===6}function nf(e){return F(e)?ef.test(e):!1}function rf(e){if(!uf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`h`?n>=0&&n<=360:e===`alpha`?n>=0&&n<=1:Wd.hsl.includes(e)&&n>=0&&n<=100)}function af(e){if(!uf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`l`?n>=0&&n<=100:e===`alpha`?n>=0&&n<=1:Wd.oklab.includes(e)&&n>=-1&&n<=1)}function of(e){if(!uf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`l`?n>=0&&n<=100:e===`alpha`?n>=0&&n<=1:Wd.oklch.includes(e)&&n>=0&&n<=(e===`h`?360:1))}function sf(e){return F(e)&&Object.keys($d).includes(e.toLowerCase())}function cf(e){return typeof e==`number`&&!Number.isNaN(e)}function lf(e,n,r){return cf(e)&&e>=n&&e<=r}function uf(e){if(!e)return!1;let{toString:n}=Object.prototype,r=Object.getPrototypeOf(e);return n.call(e)===`[object Object]`&&(r===null||r===Object.getPrototypeOf({}))}function df(e){if(!uf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`alpha`?n>=0&&n<=1:Wd.rgb.includes(e)&&n>=0&&n<=255)}function F(e,n=!0){let r=typeof e==`string`;return n?r&&!!e.trim().length:r}function ff(e){return rf(e)||df(e)||af(e)||of(e)}function pf(e){P(nf(e),N.inputHex);let n=e.replace(`#`,``);if(n.length===3||n.length===4){let e=[...n];n=``,e.forEach(e=>{n+=`${e}${e}`})}let r=`#${n}`;return P(nf(r),N.invalidHex),r}function I(e,n){P(ff(e),N.invalid);let r=n;return r===void 0||(r>1&&(r/=100),r===1)?e:{...e,alpha:r}}function mf(e,n=0,r=100){return Math.min(Math.max(e,n),r)}function hf(e,n){P(cf(e),N.inputNumber);let r=e+n;return r>360&&(r%=360),r<0&&(r+=360),Math.abs(r)}function gf(e){if(!Array.isArray(e))return e.alpha}function _f(e,n,r){switch(P(cf(e),N.inputNumber),P(Gd.includes(n),`${N.invalidModel}${n?`: ${n}`:``}`),P(Wd[n].includes(r),`${N.invalidKey}${r?`: ${r}`:``}`),n){case`hsl`:return P(Wd.hsl.includes(r),N.invalidKey),[`l`,`s`].includes(r)?mf(e):mf(e,0,360);case`rgb`:return P(Wd.rgb.includes(r),N.invalidKey),mf(e,0,255);default:throw Error(`Invalid inputs`)}}function vf(e,n){let r=Wd[n],i={hsl:rf,oklab:af,oklch:of,rgb:df};P(uf(e)||Array.isArray(e),N.invalid);let a=Array.isArray(e)?{[r[0]]:e[0],[r[1]]:e[1],[r[2]]:e[2]}:e;return P(i[n](a),`${N.invalidColor}: ${n}`),a}function yf(e,n=Zd,r=!0){let i=new Map(Object.entries(e));for(let[e,a]of i.entries())i.set(e,bf(a,n,r));return Object.fromEntries(i)}function bf(e,n=2,r=!0){if(!cf(e)||e===0)return 0;if(r){let r=10**n;return Math.round(e*r)/r}let i=Math.abs(Math.ceil(Math.log(Math.abs(e))/Math.LN10));i===0?i=2:i>n&&(i=n);let a=n-(i<0?0:i);a<=1&&n>1?a=2:(a>n||a===0)&&(a=n);let o=10**a;return Math.round(e*o)/o}function xf(e,n){return P(nf(e),N.inputHex),P(lf(n,0,1),N.alpha),n>=1?wf(e):`${wf(e)}${Sf(n)}`}function Sf(e){P(cf(e),N.inputNumber);let n=e;return e>1&&(n/=100),Math.round(n*255).toString(16).padStart(2,`0`)}function Cf(e){P(nf(e),N.inputString);let n=e.substring(7,9);return n?bf(parseInt(n,16)/255):1}function wf(e){return P(nf(e),N.inputHex),e.length===5?e.substring(0,4):e.substring(0,7)}function Tf(e){P(nf(e),N.inputHex);let n=pf(e).slice(1),r=Cf(e);return I({r:parseInt(n.charAt(0)+n.charAt(1),16),g:parseInt(n.charAt(2)+n.charAt(3),16),b:parseInt(n.charAt(4)+n.charAt(5),16)},r)}var Ef={};Hd(Ef,{hex2hsl:()=>Of,hex2oklab:()=>Nf,hex2oklch:()=>Rf,hex2rgb:()=>Tf,hsl2hex:()=>Hf,hsl2oklab:()=>Uf,hsl2oklch:()=>Wf,hsl2rgb:()=>Bf,oklab2hex:()=>Jf,oklab2hsl:()=>Yf,oklab2oklch:()=>If,oklab2rgb:()=>qf,oklch2hex:()=>ep,oklch2hsl:()=>tp,oklch2oklab:()=>Qf,oklch2rgb:()=>$f,rgb2hex:()=>Vf,rgb2hsl:()=>Df,rgb2oklab:()=>Mf,rgb2oklch:()=>Lf});function Df(e){let n=vf(e,`rgb`),r=gf(e),i=_f(n.r,`rgb`,`r`)/255,a=_f(n.g,`rgb`,`g`)/255,o=_f(n.b,`rgb`,`b`)/255,s=Math.min(i,a,o),c=Math.max(i,a,o),l=c-s,u=0,d,f=(c+s)/2,p;switch(c){case i:p=l?(a-o)/l:0,u=60*p;break;case a:p=(o-i)/l,u=60*p+120;break;case o:p=(i-a)/l,u=60*p+240}return u<0&&(u=360+u),d=s===c?0:f<.5?l/(2*f):l/(2-2*f),I({h:Math.abs(+(u%360).toFixed(2)),s:+(d*100).toFixed(2),l:+(f*100).toFixed(2)},r)}function Of(e){P(nf(e),N.inputHex);let n=Cf(e);return I(Df(Tf(e)),n)}var{cbrt:kf,sign:Af}=Math;function jf(e){let n=Math.abs(e);return n<.04045?e/12.92:(Af(e)||1)*((n+.055)/1.055)**2.4}function Mf(e,n=Zd){let r=vf(e,`rgb`),i=gf(e),[a,o,s]=[jf(r.r/255),jf(r.g/255),jf(r.b/255)],c=kf(Jd.l[0]*a+Jd.l[1]*o+Jd.l[2]*s),l=kf(Jd.m[0]*a+Jd.m[1]*o+Jd.m[2]*s),u=kf(Jd.s[0]*a+Jd.s[1]*o+Jd.s[2]*s);return I(yf({l:Yd.l[0]*c+Yd.l[1]*l-Yd.l[2]*u,a:Yd.a[0]*c-Yd.a[1]*l+Yd.a[2]*u,b:Yd.b[0]*c+Yd.b[1]*l-Yd.b[2]*u},n),i)}function Nf(e,n){P(nf(e),N.inputHex);let r=Cf(e);return I(Mf(Tf(e),n),r)}var{atan2:Pf,sqrt:Ff}=Math;function If(e,n){let{l:r,a:i,b:a}=yf(vf(e,`oklab`)),o=gf(e),s=Ff(i**2+a**2),c=(Pf(a,i)*Qd+360)%360;return bf(s*1e4)===0&&(c=0),I(yf({l:r,c:s,h:c},n),o)}function Lf(e,n){let r=vf(e,`rgb`),i=gf(e);return I(If(Mf(r,n),n),i)}function Rf(e,n){P(nf(e),N.inputHex);let r=Cf(e);return I(Lf(Tf(e),n),r)}function zf(e,n,r){P(cf(e)&&cf(n)&&cf(r),N.hueArgs);let i=r;return i<0&&(i+=1),i>1&&--i,bf(i<1/6?e+(n-e)*6*i:i<1/2?n:i<2/3?e+(n-e)*(2/3-i)*6:e,4)}function Bf(e){let n=vf(e,`hsl`),r=gf(e),i=bf(n.h)/360,a=bf(n.s)/100,o=bf(n.l)/100,s,c,l,u,d;return a===0?(s=o,c=o,l=o):(d=o<.5?o*(1+a):o+a-o*a,u=2*o-d,s=zf(u,d,i+1/3),c=zf(u,d,i),l=zf(u,d,i-1/3)),I({r:Math.round(s*255),g:Math.round(c*255),b:Math.round(l*255)},r)}function Vf(e){let n=vf(e,`rgb`),r=gf(e),i=`#${[n.r,n.g,n.b].map(e=>`0${Math.floor(e).toString(16)}`.slice(-2)).join(``)}`;return r!==void 0&&r<1?xf(i,r):i}function Hf(e){let n=vf(e,`hsl`),r=gf(e),i=Vf(Bf(n));return r!==void 0&&r<1?xf(i,r):i}function Uf(e,n){let r=vf(e,`hsl`),i=gf(e);return I(Mf(Bf(r),n),i)}function Wf(e,n){let r=vf(e,`hsl`),i=gf(e);return I(Lf(Bf(r),n),i)}var{abs:Gf}=Math;function Kf(e){let n=Gf(e);return n>.0031308?(e<0?-1:1)*(n**(1/2.4)*1.055-.055):e*12.92}function qf(e,n=0){let{l:r,a:i,b:a}=vf(e,`oklab`),o=gf(e),s=(r+qd.l[0]*i+qd.l[1]*a)**3,c=(r+qd.m[0]*i+qd.m[1]*a)**3,l=(r+qd.s[0]*i+qd.s[1]*a)**3,u=255*Kf(Xd.r[0]*s+Xd.r[1]*c+Xd.r[2]*l),d=255*Kf(Xd.g[0]*s+Xd.g[1]*c+Xd.g[2]*l),f=255*Kf(Xd.b[0]*s+Xd.b[1]*c+Xd.b[2]*l);return I({r:mf(bf(u,n),0,255),g:mf(bf(d,n),0,255),b:mf(bf(f,n),0,255)},o)}function Jf(e){let n=vf(e,`oklab`),r=gf(e),i=Vf(qf(n));return r!==void 0&&r<1?xf(i,r):i}function Yf(e){let n=vf(e,`oklab`),r=gf(e);return I(Df(qf(n)),r)}var{sin:Xf,cos:Zf}=Math;function Qf(e,n){let{l:r,c:i,h:a}=vf(e,`oklch`),o=gf(e);return(Number.isNaN(a)||a<0)&&(a=0),I(yf({l:r,a:i*Zf(a*Kd),b:i*Xf(a*Kd)},n),o)}function $f(e,n=0){let r=vf(e,`oklch`),i=gf(e);return I(qf(Qf(r),n),i)}function ep(e){let n=vf(e,`oklch`),r=gf(e),i=Vf($f(n));return r!==void 0&&r<1?xf(i,r):i}function tp(e){let n=vf(e,`oklch`),r=gf(e);return I(Df($f(n)),r)}var np=`(rgb|hsl|oklab|oklch)a?`,rp=`(?:\\s*[,/]\\s*|\\s+)`,ip=`(none|[\\d%.-]+(?:deg|grad|rad|turn)?)`,ap=RegExp(`${np}\\s*\\(\\s*${ip}${rp}${ip}${rp}${ip}(?:${rp}${ip})?\\s*\\)`,`i`);function op(e){let n=parseFloat(e),r;return r=e.endsWith(`grad`)?n*.9:e.endsWith(`rad`)?180/Math.PI*n:e.endsWith(`turn`)?n*360:n,Math.round(r*1e5)/1e5}function sp(e){if(P(F(e),N.inputString),nf(e)){let n=Wd.rgb,{r,g:i,b:a}=Tf(e),o=Cf(e);return{model:`rgb`,[n[0]]:r,[n[1]]:i,[n[2]]:a,alpha:o<1?o:void 0}}let n=ap.exec(e);P(tf(n),N.invalidCSS);let r=n[1],i=Wd[r],a=n[5]?parseFloat(n[5]):1;a>1&&(a/=100);let o=(e,n)=>{if(e===`none`)return 0;if(r===`hsl`&&n===0||r===`oklch`&&n===2)return op(e);let i=parseFloat(e);if(!e.includes(`%`))return i;if(r===`oklch`){if(n===1)return i*.4/100}else if(r===`oklab`&&(n===1||n===2))return i*.4/100;return i},s=[o(n[2],0),o(n[3],1),o(n[4],2)];return r===`oklab`?(P(s[1]>=-.4&&s[1]<=.4,N.invalidRange),P(s[2]>=-.4&&s[2]<=.4,N.invalidRange)):r===`oklch`&&P(s[1]>=0&&s[1]<=.4,N.invalidRange),{model:r,[i[0]]:s[0],[i[1]]:s[1],[i[2]]:s[2],alpha:a<1?a:void 0}}var cp={oklab:Yf,oklch:tp,rgb:Df},lp={hsl:Uf,oklch:Qf,rgb:Mf},up={hsl:Wf,oklab:If,rgb:Lf},dp={hsl:Bf,oklab:qf,oklch:$f},fp={hsl:Hf,oklab:Jf,oklch:ep,rgb:Vf},pp={hsl:Of,oklab:Nf,oklch:Rf,rgb:Tf},mp={hsl:cp,oklab:lp,oklch:up,rgb:dp};function hp(e,n){let{alpha:r,model:i,...a}=sp(e);[`oklab`,`oklch`].includes(i)&&a.l>1&&(a.l=bf(a.l/100,Zd));let o=Object.values(a);if(n===`hex`){let e=r?Sf(r):``;return`${fp[i](o)}${e}`}let s=mp[n]?.[i];return I(s?s(o):a,r)}function gp(e,n){let r=Cf(e);return n===`hex`?`${wf(e)}${r===1?``:Sf(r)}`:I(pp[n](e),r)}function L(e,n){P(F(e),N.inputString);let r=sf(e)?$d[e.toLowerCase()]:e,i=n??(nf(r)?`hex`:sp(r).model);return nf(r)?gp(r,i):hp(r,i)}var _p=2.4,vp=.56,yp=.57,bp=.65,xp=.62,Sp=.2126729,Cp=.7151522,wp=.072175,Tp=.022,Ep=1.414,Dp=1.14,Op=1.14,kp=.027,Ap=.027,jp=.1,Mp=5e-4;function Np(e){return e>Tp?e:e+(Tp-e)**Ep}function Pp(e,n,r){return Sp*(e/255)**_p+Cp*(n/255)**_p+wp*(r/255)**_p}function Fp(e,n){P(F(e),N.inputString),P(F(n),N.inputString);let r=Tf(L(e,`hex`)),i=Tf(L(n,`hex`)),a=Np(Pp(i.r,i.g,i.b)),o=Np(Pp(r.r,r.g,r.b));if(Math.abs(o-a)<Mp)return 0;let s=o>a?(o**vp-a**yp)*Dp:(o**bp-a**xp)*Op;return Math.abs(s)<jp?0:bf(s>0?(s-kp)*100:(s+Ap)*100,5)}function Ip(e,n,r=Zd){P(F(e),N.left),P(F(n),N.right);let i=L(e,`rgb`),a=L(n,`rgb`),o=(i.r*299+i.g*587+i.b*114)/1e3,s=(a.r*299+a.g*587+a.b*114)/1e3;return bf(Math.abs(s-o),r)}function Lp(e){P(F(e),N.inputString);let{r:n,g:r,b:i}=L(e,`rgb`);return bf((Math.max(n,r,i)-Math.min(n,r,i))/255,4)}function Rp(e,n){P(F(e),N.left),P(F(n),N.right);let r=L(e,`rgb`),i=L(n,`rgb`);return Math.max(r.r,i.r)-Math.min(r.r,i.r)+(Math.max(r.g,i.g)-Math.min(r.g,i.g))+(Math.max(r.b,i.b)-Math.min(r.b,i.b))}function zp(e){P(F(e),N.inputString);let{r:n,g:r,b:i}=L(e,`rgb`),a=[n/255,r/255,i/255];for(let e=0;e<a.length;e++)a[e]<=.04045?a[e]/=12.92:a[e]=((a[e]+.055)/1.055)**2.4;return bf(.2126*a[0]+.7152*a[1]+.0722*a[2],4)}function Bp(e,n){P(F(e),N.left),P(F(n),N.right);let r=zp(e),i=zp(n);return bf(r>=i?(r+.05)/(i+.05):(i+.05)/(r+.05))}function Vp(e,n){P(F(e),N.left),P(F(n),N.right);let r=Rp(e,n),i=Bp(e,n),a=Ip(e,n),o=a>=125,s=r>=500,c=0;return o&&s?c=2:(o||s)&&(c=1),{brightnessDifference:a,colorDifference:r,compliant:c,contrast:i,largeAA:i>=3,largeAAA:i>=4.5,normalAA:i>=4.5,normalAAA:i>=7}}function Hp(e){if(nf(e)||sf(e))return`hex`;if(rf(e))return`hsl`;if(af(e))return`oklab`;if(of(e))return`oklch`;if(df(e))return`rgb`;throw Error(N.invalid)}function Up(e,n){let r=sf(e)?$d[e.toLowerCase()]:e,i=Hp(r);if(i===n)return r;let a=Ef[`${i}2${n}`];if(!a)throw Error(`Converter not found for ${i} to ${n}`);return a(r)}function Wp(e,n={}){P(nf(e)||ff(e),N.invalid);let{alpha:r,format:i=`hex`,precision:a=Zd,separator:o=` `}=n,s=r&&r!==1?`${bf(r*100)}%`:null,c=[],l=o;switch(i){case`hsl`:{let{h:n,s:r,l:i}=Up(e,`hsl`);c=[n,`${r}%`,`${i}%`];break}case`oklab`:{l=` `;let{l:n,a:r,b:i}=yf(Up(e,`oklab`),a);c=[`${bf(n*100,a)}%`,r,i];break}case`oklch`:{l=` `;let{l:n,c:r,h:i}=yf(Up(e,`oklch`),a);c=[`${bf(n*100,a)}%`,r,i];break}case`rgb`:{let{r:n,g:r,b:i}=Up(e,`rgb`);c=[n,r,i];break}default:{let n=wf(Up(e,`hex`));return r&&r!==1?`${n}${Sf(r)}`:n}}return`${i}(${c.join(l)}${s?` / ${s}`:``})`}function Gp(e,n,r){return(i,a)=>{P(F(i),N.inputString),P(lf(a,0,100),N.amount);let o=L(i,`hsl`),s=nf(i)||sf(i)?`hex`:sp(i).model;return Wp({...o,[e]:mf(o[e]+(n===`+`?a:-a),0,100)},{format:r??s})}}function Kp(e,n,r){return Gp(`l`,`-`,r)(e,n)}function qp(e,n,r){return Gp(`s`,`-`,r)(e,n)}function Jp(e,n){P(F(e),N.inputString);let r=nf(e)||sf(e)?`hex`:sp(e).model,i=L(e,`oklch`);return Wp({...i,c:0},{format:n??r,alpha:i.alpha})}function Yp(e,n,r){P(F(e),N.inputString),P(lf(n,-360,360),N.degreesRange);let i=L(e,`hsl`),a=nf(e)||sf(e)?`hex`:sp(e).model;return Wp({...i,h:hf(i.h,n)},{format:r??a})}function Xp(e){P(F(e),N.inputString);let n=nf(e)||sf(e)?`hex`:sp(e).model;return Wp(Yp(L(e,`hex`),180),{format:n})}function Zp(e,n,r){return Gp(`l`,`+`,r)(e,n)}function Qp(e,n,r,i,a){if(r<1e-4)return n;if(i<1e-4)return e;let o=n-e;o>180?o-=360:o<-180&&(o+=360);let s=e+o*a;return s<0?s+=360:s>=360&&(s-=360),s}function $p(e,n,r=.5,i){P(F(e),N.inputString),P(F(n),N.inputString),P(lf(r,0,1),N.ratioRange);let a=nf(e)||sf(e)?`hex`:sp(e).model,o=L(e,`oklch`),s=L(n,`oklch`),c=o.l+(s.l-o.l)*r,l=o.c+(s.c-o.c)*r,u=Qp(o.h,s.h,o.c,s.c,r),d=o.alpha??1,f=d+((s.alpha??1)-d)*r;return Wp({l:c,c:l,h:u},{format:i??a,alpha:f<1?f:void 0})}function em(e){P(!!e,N.input);let n={};if(F(e)){let{alpha:r=1}=sp(e),i=nf(e)?`hex`:sp(e).model;n.hex=xf(L(e,`hex`),r),n.hsl=I(L(e,`hsl`),r),n.oklab=I(L(e,`oklab`),r),n.oklch=I(L(e,`oklch`),r),n.rgb=I(L(e,`rgb`),r),n.alpha=r,n.type=i}else if(uf(e)){let{alpha:r=1}=e;if(rf(e))n.hsl={h:_f(e.h,`hsl`,`h`),s:_f(e.s,`hsl`,`s`),l:_f(e.l,`hsl`,`l`)},n.rgb=Bf(n.hsl),n.oklab=Uf(n.hsl),n.oklch=Wf(n.hsl),n.type=`hsl`;else if(af(e))n.hsl=Yf(e),n.oklab=e,n.oklch=If(e),n.rgb=qf(e),n.type=`oklab`;else if(of(e))n.hsl=tp(e),n.oklab=Qf(e),n.oklch=e,n.rgb=$f(e),n.type=`oklch`;else if(df(e))n.rgb={r:_f(e.r,`rgb`,`r`),g:_f(e.g,`rgb`,`g`),b:_f(e.b,`rgb`,`b`)},n.hsl=Df(n.rgb),n.oklab=Mf(n.rgb),n.oklch=Lf(n.rgb),n.type=`rgb`;else throw Error(`invalid color`);n.hex=xf(Hf(n.hsl),r),n.hsl=I(n.hsl,r),n.oklab=I(n.oklab,r),n.oklch=I(n.oklch,r),n.rgb=I(n.rgb,r),n.alpha=r}else throw Error(N.input);return n}function tm(e,n,r){P(F(e),N.inputString),P(lf(n,0,1),N.alpha);let i=nf(e)||sf(e)?`hex`:sp(e).model;return Wp(L(e,`rgb`),{format:r??i,alpha:n})}function nm(e){if(P(F(e),N.inputString),nf(e))return Cf(e);if(Object.keys($d).includes(e))return 1;let{alpha:n}=sp(e);return n||1}function rm(e,n,r,i){return e>=n?r:i}function im(e,n={}){let{darkColor:r=`#000000`,lightColor:i=`#ffffff`,method:a=`yiq`,threshold:o}=n;switch(P(F(e),N.inputString),a){case`yiq`:{let n=o??128;P(n>=0&&n<=255,N.threshold);let{r:a,g:s,b:c}=Tf(L(e,`hex`));return(a*299+s*587+c*114)/1e3>=n?r:i}case`wcag`:{let n=o??.5;return P(n>=0&&n<=1,N.thresholdNormalized),zp(e)>=n?r:i}case`contrast`:return rm(Bp(r,e),Bp(i,e),r,i);case`oklab`:{let n=o??.5;P(n>=0&&n<=1,N.thresholdNormalized);let{l:a}=Nf(L(e,`hex`));return a>=n?r:i}case`apca`:return rm(Math.abs(Fp(e,r)),Math.abs(Fp(e,i)),r,i);default:throw Error(`Unknown method: ${a}`)}}function am(e,n,r){return Gp(`s`,`+`,r)(e,n)}function om(e,n,r){return P(F(e),N.inputString),P(lf(n,-1,1),N.alphaAdjustment),Wp(L(e,`oklab`),{format:r,alpha:bf(mf(nm(e)-n,0,1))})}var sm=class{constructor(e,n={}){Ud(this,`alpha`),Ud(this,`hex`),Ud(this,`hsl`),Ud(this,`oklab`),Ud(this,`oklch`),Ud(this,`rgb`),Ud(this,`type`),P(!!e,N.colorRequired);let{alpha:r,hex:i,hsl:a,oklab:o,oklch:s,rgb:c,type:l}=em(e);this.hex=i,this.hsl=a,this.oklab=o,this.oklch=s,this.rgb=c,this.alpha=r,this.type=n.format??l}get css(){return this.currentColor}get red(){return this.rgb.r}get green(){return this.rgb.g}get blue(){return this.rgb.b}get hue(){return this.hsl.h}get saturation(){return this.hsl.s}get lightness(){return this.hsl.l}get luminance(){return zp(this.currentColor)}get chroma(){return Lp(this.currentColor)}get opacity(){return nm(this.currentColor)}get readableColor(){return im(this.currentColor)}get currentColor(){return Wp(this[this.type],{format:this.type,alpha:this.alpha})}brightnessDifference(e){return Ip(this.currentColor,e)}colorDifference(e){return Rp(this.currentColor,e)}compare(e){return Vp(this.currentColor,e)}contrast(e){return Bp(this.currentColor,e)}format(e,n){return Wp(this.rgb,{alpha:this.alpha,format:e,precision:n})}lighten(e){return Zp(this.currentColor,e)}darken(e){return Kp(this.currentColor,e)}saturate(e){return am(this.currentColor,e)}desaturate(e){return qp(this.currentColor,e)}grayscale(){return Jp(this.currentColor)}invert(){return Xp(this.currentColor)}mix(e,n){return $p(this.currentColor,e,n)}opacify(e=.9){return tm(this.currentColor,e,this.type)}rotate(e){return Yp(this.currentColor,e)}transparentize(e=.1){return om(this.currentColor,e,this.type)}};function cm(e,n){return Wp(L(e,n),{format:n})}function lm(e){return!(typeof e!=`object`||!(`h`in e)||!(`s`in e)||!(`l`in e)||!(`unit`in e)||!(`space`in e)||e.space!==`hsl`)}function um(e){return typeof e!=`object`||!(`r`in e)||!(`g`in e)||!(`b`in e)||!(`space`in e)||!(`unit`in e)?!1:e.space===`srgb`}function dm(e){if(typeof e!=`object`)throw TypeError(`Param 'v' is expected to be an object, got: ${typeof e}`);if(`r`in e&&`g`in e&&`b`in e){if(!(`unit`in e)){if(e.r<=1&&e.g<=1&&e.b<=1)e.unit=`scalar`;else if(e.r>255&&e.g<=255&&e.b<=255)return;else e.unit=`8bit`}return`space`in e||(e.space=`srgb`),e}}function fm(e){if(`h`in e&&`s`in e&&`l`in e){if(!(`unit`in e)){if(e.s<=1&&e.l<=1)e.unit=`scalar`;else if(e.s>100||e.l>100)return;else e.unit=`absolute`}return`space`in e||(e.space=`hsl`),e}}function pm(e){return typeof e!=`object`||!(`l`in e)||!(`c`in e)||!(`h`in e)||!(`unit`in e)||!(`space`in e)?!1:e.space===`lch`||e.space===`oklch`}function mm(e){return typeof e==`string`||typeof e==`object`&&!!(lm(e)||pm(e)||um(e))}function hm(e,n,r=1){let i=-1,a=-1;n<e?(i=n-e,a=r-(e-n)):(i=n-e,a=i-r);let o=a>0?a:i,s=a>0?i:a;if(Math.abs(i)<Math.abs(a)){let e=a;a=i,i=e}return{long:i,short:a,forward:o,backward:s}}function gm(e){let n=e=>{let n=Math.floor(e).toString(16);return n.length===1?`0${n}`:n},r=`#${n(e.r)}${n(e.g)}${n(e.b)}`;return e.alpha!==void 0&&e.alpha!==255&&(r+=n(e.alpha)),r}function _m(e){return e%=1,e<0?(1-Math.abs(e))%1:e}var vm=wr({absolute:()=>Pm,changeLightness:()=>bm,fromCss:()=>wm,fromHexString:()=>Cm,generateScalar:()=>km,guard:()=>jm,interpolator:()=>Mm,parseCssHslFunction:()=>Fm,scalar:()=>Nm,toAbsolute:()=>Om,toCssString:()=>Tm,toHexString:()=>Em,toLibraryRgb:()=>Im,toScalar:()=>Am,withOpacity:()=>ym});function ym(e,n){switch(e.unit){case`absolute`:return{...e,opacity:n((e.opacity??100)/100,e)*100};case`scalar`:return{...e,opacity:n(e.opacity??1,e)}}}function bm(e,n){let r=0;if(n.pdelta!==void 0)r=e.l+e.l*n.pdelta;else if(n.delta!==void 0)r=n.delta+e.l;else if(n.fixed!==void 0){if(n.fixed<0)throw TypeError(`Cannot use negative value with 'fixed'`);r=n.fixed}else throw TypeError(`Parameter 'amount' is missing 'delta/pdelta/fixed' properties`);return{...e,l:xm(e,r,`l`)}}function xm(e,n,r){return e.unit===`scalar`?n>1?n=1:n<0&&(n=0):n>100?n=100:n<0&&(n=0),n}const Sm=Object.freeze({h:0,s:0,l:0,opacity:0,unit:`absolute`,space:`hsl`});function Cm(e,n={}){return Dm(Of(e),n)}function wm(e,n={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);if(e.startsWith(`#`))return Cm(e,n);if(e.startsWith(`--`))try{e=bh(e)}catch(r){if(n.fallbackString!==void 0&&(e=n.fallbackString),n.fallbackColour!==void 0)return n.fallbackColour;throw r}if(e===`transparent`)return Sm;if(xh[e]!==void 0)return Cm(xh[e],n);if(e.startsWith(`rgb(`))return Dm(th(e),n);if(!e.startsWith(`hsl(`))try{e=cm(e,`hsl`)}catch(r){if(n.fallbackString)e=n.fallbackString;else throw r}try{let r=Fm(e);return n.scalar?Am(r):Om(r)}catch(e){if(n.fallbackColour)return n.fallbackColour;throw e}}function Tm(e){let n=Om(e),r=`hsl(${n.h}deg ${n.s}% ${n.l}%`;return`opacity`in n&&n.opacity!==void 0&&n.opacity<100&&(r+=` / ${n.opacity}%`),r+=`)`,r}function Em(e){return gm(Im(e))}function Dm(e,n={}){if(e==null&&n.fallbackColour)return n.fallbackColour;let r=n.scalar??!0;return O(Lr(e.h,0,360,`h`),Lr(e.s,0,100,`s`),Lr(e.l,0,100,`l`),Fr(e.alpha??1,`alpha`)),r?Nm(e.h/360,e.s/100,e.l/100,e.alpha??1):Pm(e.h,e.s,e.l,(e.alpha??1)*100)}function Om(e){if(typeof e==`string`)return wm(e,{scalar:!1});if(um(e))return Om(Dm(th(e),{scalar:!1}));let n=e;return jm(n),n.unit===`absolute`?n:{h:n.h*360,s:n.s*100,l:n.l*100,opacity:(n.opacity??1)*100,unit:`absolute`,space:`hsl`}}function km(e,n=1,r=.5,i=1){typeof e==`string`&&e.startsWith(`--`)&&(e=getComputedStyle(document.body).getPropertyValue(e).trim());let a=Ti(e);if(n>1)throw TypeError(`Param 'saturation' must be between 0..1`);if(r>1)throw TypeError(`Param 'lightness' must be between 0..1`);if(i>1)throw TypeError(`Param 'opacity' must be between 0..1`);return{h:Di(a,`deg`).value/360,s:n,l:r,opacity:i,unit:`scalar`,space:`hsl`}}function Am(e){if(typeof e==`string`)return wm(e,{scalar:!0});if(um(e))return Am(Dm(th(e),{scalar:!0}));let n=e;return jm(n),n.unit===`scalar`?n:{h:n.h/360,s:n.s/100,l:n.l/100,opacity:(n.opacity??1)/100,unit:`scalar`,space:`hsl`}}function jm(e){let{h:n,s:r,l:i,opacity:a,space:o,unit:s}=e;if(o!==`hsl`)throw Error(`Space is expected to be 'hsl'. Got: ${o}`);if(s===`absolute`)O(k(n,`finite`,`h`),Lr(r,0,100,`s`),Lr(i,0,100,`l`),()=>{if(typeof a==`number`)return Lr(a,0,100,`opacity`)});else if(s===`scalar`)O(k(n,`percentage`,`h`),k(r,`percentage`,`s`),k(i,`percentage`,`l`),()=>{if(typeof a==`number`)return k(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${s}`)}function Mm(e,n,r=`shorter`){e=Am(e),n=Am(n);let i=e.opacity??1,a=hm(e.h,n.h,1),o=r===`longer`?a.long:a.short,s=n.s-e.s,c=n.l-e.l,l=(n.opacity??1)-i;return n=>{n=ii(n);let r=si(n,0,Math.abs(o));r=o<0?e.h-r:e.h+r;let a=si(n,0,s),u=si(n,0,c),d=si(n,0,l);return Nm(_m(r),a+e.s,u+e.l,d+i)}}function Nm(e=.5,n=1,r=.5,i=1){let a={unit:`scalar`,space:`hsl`,h:e,s:n,l:r,opacity:i};return jm(a),a}function Pm(e=200,n=100,r=50,i=100){let a={unit:`absolute`,space:`hsl`,h:e,s:n,l:r,opacity:i};return jm(a),a}function Fm(e){if(e.startsWith(`hsla`))throw Error(`hsla() is not supported`);if(!e.startsWith(`hsl(`))throw Error(`Expected hsl(..) CSS colour`);let n=e.indexOf(`(`),r=e.indexOf(`)`);if(r<n)throw Error(`Is hsl() not terminated? Missing ')'`);let i=e.substring(n+1,r).split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=!1;i[0].endsWith(`%`)&&(a=!0),i[1].endsWith(`%`)&&i[2].endsWith(`%`)&&(a=!0);let o=(e,n)=>{if(e===`none`)return 0;if(e.endsWith(`%`))return Number.parseFloat(e.substring(0,e.length-1))/100;e.endsWith(`deg`)&&n===0&&(e=e.substring(0,e.length-3));let r=Number.parseFloat(e);return n===0?r/360:n===3?r:r/100},s=(e,n)=>{if(e===`none`)return 0;if(e.endsWith(`%`)){let r=Number.parseFloat(e.substring(0,e.length-1));return n===0?r*360:r}return e.endsWith(`deg`)&&n===0?Number.parseFloat(e.substring(0,e.length-3)):Number.parseFloat(e)};return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a?Nm(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`100%`,3)):Pm(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`100%`,3))}function Im(e){return typeof e==`string`?Im(wm(e,{scalar:!1})):(e=Om(e),{...Bf({h:e.h,s:e.s,l:e.l}),alpha:(e.opacity??100)/100*255})}var Lm=wr({changeLightness:()=>Ym,eightBit:()=>Zm,fromCss:()=>Vm,fromHexString:()=>zm,guard:()=>Jm,interpolator:()=>eh,lightness:()=>Xm,parseCssRgbFunction:()=>$m,scalar:()=>Qm,to8bit:()=>Km,toCssString:()=>Um,toHexString:()=>Hm,toLibraryHsl:()=>th,toScalar:()=>qm,withOpacity:()=>Rm});function Rm(e,n){switch(e.unit){case`8bit`:return{...e,opacity:n((e.opacity??255)/255,e)*255};case`scalar`:return{...e,opacity:n(e.opacity??1,e)}}}function zm(e,n=!0){return Gm(Tf(e),{scalar:n})}const Bm=Object.freeze({r:0,g:0,b:0,opacity:0,unit:`8bit`,space:`srgb`});function Vm(e,n={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);let r=n.scalar??!0;if(e.startsWith(`#`))return zm(e,r);if(e===`transparent`)return Bm;if(xh[e]!==void 0)return zm(xh[e],r);if(e.startsWith(`hsl(`))return Gm(Im(e),n);if(!e.startsWith(`rgb(`))try{e=cm(e,`rgb`)}catch(r){if(n.fallbackString)e=n.fallbackString;else throw r}try{let n=$m(e);return r?qm(n):Km(n)}catch(e){if(n.fallbackColour)return n.fallbackColour;throw e}}function Hm(e){return gm(Wm(e))}function Um(e){switch(Jm(e),e.unit){case`8bit`:return e.opacity===void 0||e.opacity===255?`rgb(${e.r} ${e.g} ${e.b})`:`rgb(${e.r} ${e.g} ${e.b} / ${(e.opacity??255)/255})`;case`scalar`:return e.opacity===void 0||e.opacity===1?`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}%)`:`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}% / ${(e.opacity??1)*100}%)`;default:throw Error(`Unknown unit: ${e.unit}`)}}function Wm(e){let n=Km(e);return{r:n.r,g:n.g,b:n.b,alpha:n.opacity}}function Gm(e,n={}){return n.scalar?{r:e.r/255,g:e.g/255,b:e.b/255,opacity:e.alpha??1,unit:`scalar`,space:`srgb`}:{r:e.r,g:e.g,b:e.b,opacity:e.alpha??255,unit:`8bit`,space:`srgb`}}function Km(e){return typeof e==`string`?Vm(e,{scalar:!1}):lm(e)?Km(Gm(Im(e),{scalar:!1})):(Jm(e),e.unit===`8bit`?e:{r:e.r*255,g:e.g*255,b:e.b*255,opacity:(e.opacity??1)*255,unit:`8bit`,space:`srgb`})}function qm(e){return typeof e==`string`?Vm(e,{scalar:!0}):lm(e)?qm(Gm(Im(e),{scalar:!0})):(Jm(e),e.unit===`scalar`?e:{r:e.r/255,g:e.g/255,b:e.b/255,opacity:(e.opacity??1)/255,unit:`scalar`,space:`srgb`})}function Jm(e){let{r:n,g:r,b:i,opacity:a,space:o,unit:s}=e;if(o!==`srgb`)throw Error(`Space is expected to be 'srgb'. Got: ${o}`);if(s===`8bit`)O(Lr(n,0,255,`r`),Lr(r,0,255,`g`),Lr(i,0,255,`b`),()=>{if(typeof a==`number`)return Lr(a,0,255,`opacity`)});else if(s===`scalar`)O(k(n,`percentage`,`r`),k(r,`percentage`,`g`),k(i,`percentage`,`b`),()=>{if(typeof a==`number`)return k(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be '8bit' or 'scalar'. Got: ${s}`)}function Ym(e,n){let r=0,i=new sm(Um(e)),a=e.unit===`scalar`;if(n.pdelta!==void 0)r=i.oklab.l+i.oklab.l*n.pdelta;else if(n.delta!==void 0)r=i.oklab.l+n.delta;else if(n.fixed!==void 0){if(n.fixed<0)throw TypeError(`Amount cannot be negative when using 'fixed'`);r=n.fixed}else throw TypeError(`Parameter 'amount' is missing 'pdelta/delta/fixed' properties`);return r<0?r=0:r>1&&(r=1),Gm(qf({a:i.oklab.a,b:i.oklab.b,l:r,alpha:i.oklab.alpha}),{scalar:a})}function Xm(e){return new sm(Um(e)).oklab.l}function Zm(e=100,n=100,r=100,i=255){let a={unit:`8bit`,space:`srgb`,r:e,g:n,b:r,opacity:i};return Jm(a),a}function Qm(e=.5,n=.5,r=.5,i=1){let a={unit:`scalar`,space:`srgb`,r:e,g:n,b:r,opacity:i};return Jm(a),a}function $m(e){if(e.startsWith(`rgba`))throw Error(`RGBA is not supported`);if(!e.startsWith(`rgb(`))throw Error(`Expected rgb(..) CSS colour`);let n=e.indexOf(`(`),r=e.indexOf(`)`);if(r<n)throw Error(`Is rgb() not terminated? Missing ')'`);let i=e.substring(n+1,r).split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=0;for(let e of i)e.endsWith(`%`)&&a++;let o=(e,n)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100:n<3?Number.parseFloat(e)/255:Number.parseFloat(e),s=(e,n)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100*255:n<3?Number.parseFloat(e):Number.parseFloat(e)*255;return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a>1?Qm(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`1`,3)):Zm(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`1`,3))}function eh(e,n){let r=qm(e),i=qm(n),a=r.opacity??1,o=(i.opacity??1)-a,s=i.r-r.r,c=i.g-r.g,l=i.b-r.b;return e=>(e=ii(e),Qm(r.r+si(e,0,s),r.g+si(e,0,c),r.b+si(e,0,l),a+si(e,0,o)))}function th(e){return typeof e==`string`?th(Vm(e,{scalar:!1})):(e=Km(e),{...Df({r:e.r,g:e.g,b:e.b}),alpha:(e.opacity??255)/255})}var nh=wr({OKLCH_CHROMA_MAX:()=>rh,absolute:()=>vh,fromCss:()=>ch,fromHexString:()=>oh,fromLibrary:()=>ah,generateScalar:()=>mh,guard:()=>ih,interpolator:()=>gh,scalar:()=>_h,toAbsolute:()=>lh,toCssString:()=>fh,toHexString:()=>ph,toScalar:()=>uh,withOpacity:()=>hh});const rh=.4;function ih(e){let{l:n,c:r,h:i,opacity:a,space:o,unit:s}=e;if(o!==`oklch`)throw Error(`Space is expected to be 'oklch'. Got: ${o}`);if(s===`absolute`)O(Fr(n,`l`),()=>{if(typeof r==`number`)return Lr(r,0,rh,`c`)},()=>{if(typeof i==`number`)return Lr(i,0,360,`h`)},Fr(a??1,`opacity`));else if(s===`scalar`)O(Fr(n,`l`),Fr(r,`c`),Fr(i,`h`),Fr(e.opacity??1,`opacity`));else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${s}`)}function ah(e,n={}){if(e==null&&n.fallbackColour)return n.fallbackColour;let r=n.scalar??!0;return O(Fr(e.l,`l`),Fr(e.c,`c`),Lr(e.h,0,360,`h`),Fr(e.alpha??1,`alpha`)),r?_h(e.l,e.c/rh,e.h/360,e.alpha??1):vh(e.l,e.c,e.h,e.alpha??1)}function oh(e,n={}){return ah(Rf(e),n)}const sh=Object.freeze({l:0,c:0,h:0,opacity:0,unit:`absolute`,space:`oklch`});function ch(e,n={}){if(e=e.toLowerCase(),e.startsWith(`#`))return oh(e,n);if(e===`transparent`)return sh;if(xh[e]!==void 0)return oh(xh[e],n);if(e.startsWith(`rgb(`)){let r=Km($m(e));return ah(Lf({r:r.r,g:r.g,b:r.b}),n)}if(!e.startsWith(`hsl(`)&&!e.startsWith(`oklch(`))try{e=cm(e,`oklch`)}catch(r){if(n.fallbackString)e=n.fallbackString;else throw r}let r=new sm(e).oklch;return ah(r,n)}function lh(e){return typeof e==`string`?lh(ch(e,{scalar:!0})):(ih(e),e.unit===`absolute`?e:{space:`oklch`,unit:`absolute`,l:e.l,c:e.c*rh,h:e.h*360,opacity:e.opacity})}function uh(e){if(typeof e==`string`)return uh(ch(e,{scalar:!0}));let n=e;return ih(n),n.unit===`scalar`?n:{l:n.l,c:n.c/rh,h:n.h/360,opacity:n.opacity??1,unit:`scalar`,space:`oklch`}}function dh(e){let n=lh(e);return{l:n.l,c:n.c,h:n.h,alpha:n.opacity}}function fh(e,n=3){ih(e);let{l:r,c:i,h:a,opacity:o}=e,s=``;switch(e.unit){case`absolute`:s=`oklch(${(r*100).toFixed(n)}% ${i.toFixed(n)} ${a.toFixed(n)}`;break;case`scalar`:s=`oklch(${r.toFixed(n)} ${(i*rh).toFixed(n)} ${(a*360).toFixed(n)}`}return o!==void 0&&o!==1&&(s+=` / ${o.toFixed(n)}`),s+=`)`,s}function ph(e){return gm($f(dh(e)))}function mh(e,n=1,r=.5,i=1){if(typeof e==`string`&&e.startsWith(`--`)&&(e=getComputedStyle(document.body).getPropertyValue(e).trim()),r>1)throw TypeError(`Param 'lightness' must be between 0..1`);if(n>1)throw TypeError(`Param 'chroma' must be between 0..1`);let a=Di(Ti(e),`deg`).value/360;if(i>1)throw TypeError(`Param 'opacity' must be between 0..1`);return{l:r,c:n,h:a,opacity:i,unit:`scalar`,space:`oklch`}}function hh(e,n){switch(e.unit){case`absolute`:return{...e,opacity:n((e.opacity??100)/100,e)*100};case`scalar`:return{...e,opacity:n(e.opacity??1,e)}}}function gh(e,n,r=`shorter`){e=uh(e),n=uh(n);let i=e.opacity??1,a=hm(e.h,n.h,1),o=r===`longer`?a.long:a.short,s=n.c-e.c,c=n.l-e.l,l=(n.opacity??1)-i;return n=>{n=ii(n);let r=si(n,0,Math.abs(o));r=o<0?e.h-r:e.h+r;let a=si(n,0,s),u=si(n,0,c),d=si(n,0,l);return _h(u+e.l,a+e.c,_m(r),d+i)}}function _h(e=.7,n=.1,r=.5,i=1){let a={unit:`scalar`,space:`oklch`,l:e,c:n,h:r,opacity:i};return ih(a),a}function vh(e,n,r,i=1){let a={space:`oklch`,unit:`absolute`,opacity:i,l:e,c:n,h:r};return ih(a),a}const yh=e=>{if(e.startsWith(`#`))return zm(e,!0);if(e.startsWith(`--`)){let n=getComputedStyle(document.body).getPropertyValue(e).trim();if(n.length===0||n===null)throw Error(`Variable missing: ${e}`);return yh(n)}let n=e.toLowerCase();if(xh[n]!==void 0)return zm(xh[n],!0);if(n.startsWith(`hsl(`))return wm(e,{scalar:!0});if(n.startsWith(`rgb(`))return Vm(e,{scalar:!0});if(n.startsWith(`oklch(`))return ch(e,{scalar:!0});throw Error(`String colour is not a hex colour, CSS variable nor well-defined colour. Input: '${e}'`)};function bh(e,n){if(e.startsWith(`--`)){let r=getComputedStyle(document.body).getPropertyValue(e).trim();if(r.length===0||r===null){if(n!==void 0)return n;throw Error(`CSS variable missing: '${e}'`)}return bh(r)}return xh[e]===void 0?e:xh[e]}const xh=Object.freeze({aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`,transparent:`#00000000`});function Sh(e,n){if(n===`hsl-scalar`){if(typeof e==`string`||lm(e)||um(e))return Am(e)}else if(n===`hsl-absolute`){if(typeof e==`string`||lm(e))return Om(e)}else if(n===`oklch-scalar`){if(typeof e==`string`||pm(e))return uh(e)}else if(n===`oklch-absolute`){if(typeof e==`string`||pm(e))return lh(e)}else if(n===`srgb-8bit`){if(typeof e==`string`||um(e))return Km(e)}else if(n===`srgb-scalar`){if(typeof e==`string`||um(e))return qm(e)}else throw Error(`Destination '${n}' not supported for input: ${JSON.stringify(e)}`);return Sh(Th(e),n)}function Ch(e,n){return Th(Sh(e,n))}function wh(e,n){if(n===`oklch`)return Sh(e,`oklch-scalar`);if(n===`srgb`)return Sh(e,`srgb-scalar`);if(n===`hsl`)return Sh(e,`hsl-scalar`);throw Error(`Unknown destination: '${n}'`)}function Th(e){if(typeof e==`string`)return e;if(lm(e))return Tm(e);if(um(e))return Um(e);if(pm(e))return fh(e);let n=dm(e);if(n)return Um(n);let r=fm(e);if(r)return Tm(r);throw Error(`Unknown colour format: '${JSON.stringify(e)}'`)}function Eh(e){if(lm(e))return Em(e);if(um(e))return Hm(e);if(pm(e))return ph(e);if(typeof e==`string`)return e.startsWith(`#`)?e:Hm(Sh(e,`srgb-8bit`));let n=dm(e);if(n)return Hm(n);let r=fm(e);if(r)return Em(r);throw Error(`Unknown colour format: '${JSON.stringify(e)}'`)}function Dh(e){return new sm(Th(e))}function Oh(e){switch(e.space){case`hsl`:jm(e);break;case`srgb`:Jm(e);break;case`oklch`:ih(e);break;default:throw Error(`Unsupported colour space: '${e.space}'`)}}function kh(e){if(!mm(e))throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc. Got: ${JSON.stringify(e)}`);let n;if(n=typeof e==`string`?yh(e):e,n===void 0)throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc.`);return Oh(n),n}function Ah(...e){for(let n of e)if(n!=null)try{return Th(kh(n))}catch{}return`rebeccapurple`}function jh(e,n){let{r,g:i,b:a}=e,o=e.opacity??1;e.unit===`8bit`&&(r/=255,i/=255,a/=255);let s=Math.max(r,i,a),c=Math.min(r,i,a),l=(s+c)/2,u=l,d=l;if(s===c)return n?Nm(0,0,0,o):Pm(0,0,0,o);let f=s-c;switch(u=d>=.5?f/(2-(s+c)):f/(s+c),s){case r:l=((i-a)/f+0)*60;break;case i:l=((a-r)/f+2)*60;break;case a:l=((r-i)/f+4)*60}return n?Nm(l/360,u,d,o):Pm(l,u*100,d*100,o)}const Mh=(e,n=.5,r=.75,i=1)=>(O(k(e,`positive`,`index`),k(n,`percentage`,`saturation`),k(r,`percentage`,`lightness`),k(i,`percentage`,`alpha`)),Tm(Nm(e*137.508%360/360,n,r,i))),Nh=(e=Math.random)=>e()*360;function Ph(e,n={}){let r=n.direction??`shorter`,i=n.destination??`oklch-scalar`,a=n.space??`oklch`,o=Fh(e,a),s=o.map(e=>Rh(e[0],e[1],{space:a,direction:r,destination:i})),c=e.map(e=>Sh(e,i));return e=>{if(e>=1)return c.at(-1);if(e<=0)return c.at(0);let n=pi(e,0,1,0,o.length),r=Math.floor(n),i=n-r,a=s[r];return a(i)}}function Fh(e,n=`hsl`){if(!Array.isArray(e))throw Error(`Param 'colours' is not an array as expected. Got: ${typeof e}`);if(e.length<2)throw Error(`Param 'colours' should be at least two in length. Got: ${e.length}`);return[...ti(e.map(e=>wh(e,n)))]}function Ih(e){return`linear-gradient(to right, ${e.map(e=>Th(e)).join(`, `)})`}function Lh(e,n,r={}){let i=Rh(e,n,r);return e=>Th(i(e))}function Rh(e,n,r={}){let i=r.space??`oklch`,a=r.direction??`shorter`,o=r.destination??`oklch-scalar`,s;switch(i){case`hsl`:{let r=Mm(Sh(e,`hsl-scalar`),Sh(n,`hsl-scalar`),a);s=e=>Sh(r(e),o);break}case`srgb`:{let r=eh(Sh(e,`srgb-scalar`),Sh(n,`srgb-scalar`));s=e=>Sh(r(e),o);break}default:{let r=gh(Sh(e,`oklch-scalar`),Sh(n,`oklch-scalar`),a);s=e=>Sh(r(e),o)}}return e=>s(e)}function zh(e,n={}){let r=n.direction??`shorter`,i=n.space??`oklch`,a=Fh(e,i),o=0;if(typeof n.stepsBetween==`number`){if(o=n.stepsBetween,o<1)throw Error(`Param 'stepsBetween' must be at least 1`)}else if(typeof n.stepsTotal==`number`){if(n.stepsTotal<=e.length)throw Error(`Param 'stepsTotal' must be greater than number of provided colour stops (${e.length}) +1 per stop`);let r=n.stepsTotal-e.length;o=Math.floor(r/a.length)}let s=a.map(e=>{let n=Bh(e[0],e[1],{steps:o,space:i,direction:r,exclusive:!0});return n.push(e[1]),n}),c=a[0];return s.unshift([c[0]]),s.flat().map(e=>Th(e))}function Bh(e,n,r={}){let i=r.exclusive??!1,a=r.steps??5,o=r.space??`oklch`,s=r.direction??`shorter`;if(!i&&a<2)throw Error(`Param 'steps' should be at least 2 when 'exclusive' is false`);if(i&&a<1)throw Error(`Param 'steps' should be at least 1 when 'exlusive' is true`);let c=wh(e,o),l=wh(n,o),u;switch(o){case`hsl`:u=Mm(c,l,s);break;case`oklch`:u=gh(c,l,s);break;case`srgb`:u=eh(c,l);break;default:throw Error(`Colour space '${o}' not supported for interpolation.`)}if(!u)throw Error(`Could not create interpolator for space: ${o}`);let d=0,f=0,p=1;i?(d=1/(a+1),f=d,p=1-d):d=1/(a-1);let m=[];for(let e=f;e<=p;e+=d)m.push(u(e));return m}function Vh(e,n){return Hh(e,e=>ii(e*n))}function Hh(e,n){let r=kh(e),i;switch(r.space){case`hsl`:i=ym(r,n);break;case`srgb`:i=Rm(r,n);break;case`oklch`:i=hh(r,n);break;default:throw Error(`Unknown space: '${r.space}'. Expected hsl, srgb, oklch`)}if(!i)throw Error(`Is colour in correct form?`);return typeof e==`string`?Th(i):i}function Uh(e,n){let r=kh(e);return r.opacity=n,typeof e==`string`?Th(r):r}function Wh(e){return e.r<<16|e.g<<8|e.b}function Gh(e){if(e>16777215)throw TypeError(`Param 'colour' is out of range. Expected max value of 16_777_215, got ${e}`);return{r:e>>16&255,g:e>>8&255,b:e&255,unit:`8bit`,space:`srgb`}}function Kh(e){let n=e.r>>3&31,r=e.g>>2&63,i=e.b>>3&31;return n<<11|r<<5|i}function qh(e){if(e>65535)throw TypeError(`Param 'colour' is out of range. Expected max: 65_535. Got: ${e}`);return{r:(e>>11&31)<<3,g:(e>>5&63)<<2,b:(e&31)<<3,unit:`8bit`,space:`srgb`}}var Jh=wr({eightBit:()=>Yh,fromCss:()=>tg,fromHexString:()=>eg,fromSrgTo8bit:()=>Zh,guard:()=>rg,scalar:()=>Xh,to8bit:()=>$h,toHexString:()=>ig,toScalar:()=>ng,toSrgb8bit:()=>Qh});function Yh(e=100,n=100,r=100,i=255){let a={unit:`8bit`,space:`ycbcr`,y:e,cb:n,cr:r,opacity:i};return rg(a),a}function Xh(e=.5,n=.5,r=.5,i=1){let a={unit:`scalar`,space:`ycbcr`,y:e,cb:n,cr:r,opacity:i};return rg(a),a}function Zh(e){let{r:n,g:r,b:i,opacity:a}=Km(e);return Yh(.299*n+.587*r+.114*i+0,-.169*n+-.331*r+.5*i+128,.5*n+-.419*r+-.081*i+128,a)}function Qh(e){let{y:n,cb:r,cr:i,opacity:a}=$h(e);return{unit:`8bit`,space:`srgb`,r:1*n+0*(r-128)+1.4*(i-128),g:1*n+-.343*(r-128)+-.711*(i-128),b:1*n+1.765*(r-128)+0*(i-128),opacity:a}}function $h(e){if(rg(e),e.unit===`8bit`)return e;let{y:n,cb:r,cr:i,opacity:a}=e;return Yh(n*255,r*255,i*255,typeof a==`number`?a*255:255)}function eg(e,n={}){return Zh(zm(e,!1))}function tg(e,n={}){let r=n.scalar??!1,i=Vm(e,{fallbackString:n.fallbackString,scalar:!1,ensureSafe:n.ensureSafe});return r?ng(Zh(i)):Zh(i)}function ng(e){if(typeof e==`string`)return tg(e,{scalar:!0});if(lm(e)||um(e))return ng(Zh(qm(e)));if(rg(e),e.unit===`scalar`)return e;let{y:n,cb:r,cr:i,opacity:a}=e;return Xh(n/255,r/255,i/255,typeof a==`number`?a/255:1)}function rg(e){let{y:n,cb:r,cr:i,opacity:a,space:o,unit:s}=e;if(o!==`ycbcr`)throw Error(`Space is expected to be 'ycbcr'. Got: ${o}`);if(s===`8bit`)O(Lr(n,0,255,`y`),Lr(r,0,255,`cb`),Lr(i,0,255,`cr`),()=>{if(typeof a==`number`)return Lr(a,0,255,`opacity`)});else if(s===`scalar`)O(k(n,`percentage`,`y`),k(r,`percentage`,`cb`),k(i,`percentage`,`cr`),()=>{if(typeof a==`number`)return k(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be '8bit' or 'scalar'. Got: ${s}`)}function ig(e){return Hm(Qh(e))}var ag=wr({HslSpace:()=>vm,OklchSpace:()=>nh,SrgbSpace:()=>Lm,YCbCrSpace:()=>Jh,convert:()=>Sh,convertScalar:()=>wh,convertToString:()=>Ch,createSteps:()=>Bh,cssDefinedHexColours:()=>xh,cssLinearGradient:()=>Ih,decodeRgbFrom16Bit565:()=>qh,decodeRgbFrom24Bit:()=>Gh,encodeRgbTo16Bit565:()=>Kh,encodeRgbTo24Bit:()=>Wh,fromCssColour:()=>yh,goldenAngleColour:()=>Mh,guard:()=>Oh,interpolator:()=>Ph,interpolatorDual:()=>Rh,interpolatorDualToString:()=>Lh,isColourish:()=>mm,isHsl:()=>lm,isOkLch:()=>pm,isRgb:()=>um,multiplyOpacity:()=>Vh,randomHue:()=>Nh,resolveCss:()=>bh,rgbToHsl:()=>jh,scale:()=>zh,setOpacity:()=>Uh,toColour:()=>kh,toCssColour:()=>Th,toHexColour:()=>Eh,toLibraryColour:()=>Dh,toStringFirst:()=>Ah,tryParseObjectToHsl:()=>fm,tryParseObjectToRgb:()=>dm,withOpacity:()=>Hh});const og={l:[0,1],c:[0,.4],h:[0,360],a:[0,1]},sg={l:og.l,c:og.c,h:og.h,a:og.a};function cg(e,n,r,i=1){return i<1?`oklch(${e} ${n} ${r} / ${i})`:`oklch(${e} ${n} ${r})`}function lg(e,n){e!=null&&(e.value=n)}var ug=class extends n{constructor(...e){super(...e),this.label=``,this.min=0,this.max=1,this.value=0,this.step=.01,this.precision=0,this.dragSensitivity=1,this.miniWidthThreshold=120,this.miniHeightThreshold=45,this.displayTextLogic=`transient`,this._isMini=!1,this._isDragging=!1,this._debounceTimer=void 0,this._handleNumberChange=e=>{let n=e.detail?.value??String(this.value),r=Number.parseFloat(n);this.value=r,this._syncValue(r),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:n},bubbles:!0,composed:!0}))},this._handleInputChange=e=>{let n=e.detail?.value??this.value;this.value=n,clearTimeout(this._debounceTimer),this._debounceTimer=window.setTimeout(()=>{this._isDragging=!1},300),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:String(n)},bubbles:!0,composed:!0}))},this._handleSliderInput=e=>{let n=e.detail?.value??this.value;console.log(`[LABELLED-INPUT] _handleSliderInput called`,{value:n,composedPath:e.composedPath()}),this.value=n,this._isDragging=!0,clearTimeout(this._debounceTimer),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:n},bubbles:!0,composed:!0}))}}get formatter(){return this._formatter??(e=>e)}set formatter(e){this._formatter=e}get hasCustomFormatter(){return this._formatter!==void 0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(e=>this._handleResize(e)),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=void 0}_handleResize(e){let{width:n,height:r}=e[0].contentRect,i=getComputedStyle(this).getPropertyValue(`--mini`).trim();if(i===`1`){this._isMini=!0;return}if(i===`0`){this._isMini=!1;return}this._isMini=n<this.miniWidthThreshold||r<this.miniHeightThreshold}_syncValue(e){let n=this.renderRoot?.querySelector(this.inputSelector);n&&lg(n,e);let r=this.renderRoot?.querySelector(`ixfx-editable-number`);r&&(lg(r,e),r._requestDisplayUpdate?.())}_renderEditableNumber(){return this._isMini?a:i`
|
|
3333
|
+
`)};var Ts=ko({add:()=>tc,addValue:()=>nc,asDynamicTraversable:()=>lc,breadthFirst:()=>Fs,children:()=>Rs,childrenLength:()=>sc,childrenValues:()=>zs,compare:()=>Es,computeMaxDepth:()=>$s,createNode:()=>oc,depthFirst:()=>Ps,findAnyChildByValue:()=>Ks,findChildByValue:()=>Us,findParentsValue:()=>Zs,followValue:()=>pc,fromPlainObject:()=>ic,getRoot:()=>qs,hasAnyChild:()=>Gs,hasAnyParent:()=>Js,hasChild:()=>Hs,hasParent:()=>Qs,nodeDepth:()=>Vs,parents:()=>Bs,parentsValues:()=>Ys,queryByValue:()=>Ws,queryParentsValue:()=>Xs,remove:()=>js,removeValuelessNodesFromChild:()=>Ms,root:()=>rc,rootWrapped:()=>ac,setChildren:()=>dc,siblings:()=>Ns,stripParentage:()=>Ds,throwTreeTest:()=>Ls,toStringDeep:()=>fc,treeTest:()=>Is,value:()=>cc,wrap:()=>As});function Es(e,n,r){return vs(lc(e),lc(n),r)}function Ds(e){return{value:e.value,childrenStore:e.childrenStore.map(e=>Ds(e))}}const Os=e=>`wraps`in e?e.wraps:e,ks=e=>`wraps`in e?e:As(e);function As(e){return{*children(){for(let n of e.childrenStore)yield As(n)},getValue:()=>e.value,getIdentity:()=>e,*queryValue(n){for(let r of Ws(n,Os(e)))yield As(r)},*queryParentsValue(e,n,r){for(let i of Xs(Os(e),n,r))yield As(i)},*parentsValues(e){yield*Ys(Os(e))},findParentsValue(e,n,r){let i=Zs(e,n,r);if(i!==void 0)return As(i)},getParent:()=>e.parent===void 0?void 0:As(e.parent),hasParent:n=>Qs(e,Os(n)),hasAnyParent:n=>Js(e,Os(n)),hasChild:n=>Hs(Os(n),e),hasAnyChild:n=>Gs(Os(n),e),remove:()=>{js(e)},addValue:n=>As(nc(n,e)),add:n=>(tc(Os(n),e),ks(n)),wraps:e}}function js(e){let n=e.parent;if(n===void 0)return!1;e.parent=void 0;let r=n.childrenStore.length;return n.childrenStore=ti(n.childrenStore,e),r!==n.childrenStore.length}function Ms(e){if(e.value!==void 0)return!1;let n=e.parent;if(!n)return!1;let r=[...Ns(e)];return js(e),r.length!==0||Ms(n)}function*Ns(e,n=xo){let r=e.parent;if(r!==void 0)for(let i of r.childrenStore)n(i,e)||(yield i)}function*Ps(e){if(!rc)return;let n=new qo;n.push(...e.childrenStore);let r=n.pop();for(;r&&(yield r,r&&n.push(...r.childrenStore),!n.isEmpty);)r=n.pop()}function*Fs(e){if(!e)return;let n=new ts;n.enqueue(...e.childrenStore);let r=n.dequeue();for(;r&&(yield r,r&&n.enqueue(...r.childrenStore),!n.isEmpty);)r=n.dequeue()}function Is(e,n=[]){if(e.parent===e)return[!1,`Root has itself as parent`,e];if(n.includes(e))return[!1,`Same node instance is appearing further in tree`,e];if(n.push(e),$r(e.childrenStore))return[!1,`Children list contains duplicates`,e];for(let r of e.childrenStore){if(r.parent!==e)return[!1,`Member of childrenStore does not have .parent set`,r];if(Gs(e,r))return[!1,`Child has parent as its own child`,r];let i=Is(r,n);if(!i[0])return i}return[!0,``,e]}function Ls(e){let n=Is(e);if(!n[0])throw Error(`${n[1]} Node: ${jo(n[2].value,30)}`,{cause:n[2]})}function*Rs(e){for(let n of e.childrenStore)yield n}function*zs(e){for(let n of e.childrenStore)n.value!==void 0&&(yield n.value)}function*Bs(e){let n=e.parent;for(;n;)yield n,n=n.parent}function Vs(e){return[...Bs(e)].length}function Hs(e,n,r=xo){for(let i of n.childrenStore)if(r(i,e))return!0;return!1}function Us(e,n,r=xo){for(let i of n.childrenStore)if(r(e,i.value))return i}function*Ws(e,n,r=xo){for(let i of n.childrenStore)r(e,i.value)&&(yield i)}function Gs(e,n){for(let r of Fs(n))if(r===e)return!0;return!1}function Ks(e,n,r=xo){for(let i of Fs(n))if(r(i.value,e))return i}function qs(e){return e.parent?qs(e.parent):e}function Js(e,n){for(let r of Bs(e))if(r===n)return!0;return!1}function*Ys(e){for(let n of Bs(e))n.value!==void 0&&(yield n.value);return!1}function*Xs(e,n,r=xo){for(let i of Bs(e))i.value!==void 0&&r(i.value,n)&&(yield i);return!1}function Zs(e,n,r=xo){return[...Xs(e,n,r)][0]}function Qs(e,n){return e.parent===n}function $s(e){return ec(e,0)}function ec(e,n=0){let r=n;for(let i of e.childrenStore)r=Math.max(r,ec(i,n+1));return r}function tc(e,n){uc(e,n);let r=e.parent;n.childrenStore=[...n.childrenStore,e],e.parent=n,r&&(r.childrenStore=ti(r.childrenStore,e))}function nc(e,n){return oc(e,n)}function rc(e){return oc(e)}function ic(e,n=``,r,i=[]){let a=Object.entries(e);r=r===void 0?rc():nc({label:n,value:e},r);for(let e of a){let n=e[1];i.includes(n)||(i.push(n),typeof e[1]==`object`?ic(n,e[0],r,i):nc({label:e[0],value:n},r))}return r}function ac(e){return As(oc(e))}function oc(e,n){let r={childrenStore:[],parent:n,value:e};return n!==void 0&&(n.childrenStore=[...n.childrenStore,r]),r}function sc(e){return e.childrenStore.length}function cc(e){return e.value}function lc(e){return{*children(){for(let n of e.childrenStore)yield lc(n)},getParent(){if(e.parent!==void 0)return lc(e.parent)},getValue(){return e.value},getIdentity(){return e}}}function uc(e,n){if(n===e)throw Error(`Cannot add self as child`);if(e.parent!==n){if(Js(n,e))throw Error(`Child contains parent (1)`,{cause:e});if(Js(e,n))throw Error(`Parent already contains child`,{cause:e});if(Gs(n,e))throw Error(`Child contains parent (2)`,{cause:e})}}function dc(e,n){for(let r of n)uc(r,e);e.childrenStore=[...n];for(let r of n)r.parent=e}function fc(e,n=0){let r=`${` `.repeat(n)} + ${e.value?JSON.stringify(e.value):`-`}`;return e.childrenStore.length>0?`${r}\n${e.childrenStore.map(e=>fc(e,n+1)).join(`
|
|
3334
|
+
`)}`:r}function*pc(e,n,r=1){for(let i of e.childrenStore){let e=i.value;e!==void 0&&n(e,r)&&(yield i.value,yield*pc(i,n,r+1))}}var mc=ko({asDynamicTraversable:()=>Cc,children:()=>vc,create:()=>Tc,createSimplified:()=>Dc,createWrapped:()=>wc,depthFirst:()=>yc,getByPath:()=>xc,prettyPrint:()=>gc,prettyPrintEntries:()=>hc,toStringDeep:()=>_c,traceByPath:()=>Sc});function hc(e){if(e.length===0)return`(empty)`;let n=``;for(let[r,i]of e.entries())n+=` `.repeat(r),n+=i.name+` = `+JSON.stringify(i.leafValue)+`
|
|
3335
|
+
`;return n}const gc=(e,n=0,r={})=>{k(Lr(e,`node`));let i=Oc(e,r.name??`node`),a=`${` `.repeat(n)} + name: ${i.name} value: ${JSON.stringify(i.leafValue)}`,o=[...vc(e,r)];return o.length>0?a+`
|
|
3336
|
+
`+o.map(e=>gc(e.leafValue,n+1,{...r,name:e.name})).join(`
|
|
3337
|
+
`):a},_c=(e,n=0)=>{let r=` `.repeat(n)+` ${e.value?.name}`;if(e.value!==void 0){if(`sourceValue`in e.value&&`leafValue`in e.value){let n=jo(e.value.sourceValue,20),i=jo(e.value.leafValue,20);n=n===i?``:`source: `+n,r+=` = ${i} ${n}`}else`sourceValue`in e.value&&e.value.sourceValue!==void 0&&(r+=` = ${e.value.sourceValue}`);`ancestors`in e.value&&(r+=` (ancestors: ${e.value.ancestors.join(`, `)})`)}r+=`
|
|
3338
|
+
`;for(let i of e.childrenStore)r+=_c(i,n+1);return r};function*vc(e,n={}){k(Lr(e,`node`));let r=n.filter??`none`,i=e=>r===`none`?[!0,Mo(e)]:r===`leaves`&&Mo(e)?[!0,!0]:r===`branches`&&!Mo(e)?[!0,!1]:[!1,Mo(e)];if(Array.isArray(e))for(let[n,r]of e.entries()){let e=i(r);e[0]&&(yield{name:n.toString(),_kind:`entry`,sourceValue:r,leafValue:e[1]?r:void 0})}else if(typeof e==`object`){let n=`entries`in e?e.entries():Object.entries(e);for(let[e,r]of n){let[n,a]=i(r);n&&(yield{name:e,_kind:`entry`,sourceValue:r,leafValue:a?r:void 0})}}}function*yc(e,n={},r=[]){for(let i of vc(e,n))yield{...i,ancestors:[...r],_kind:`entry-ancestors`},yield*yc(i.sourceValue,n,[...r,i.name])}function bc(e,n){for(let r of vc(n))if(r.name===e)return r}function xc(e,n,r={}){let i=is(Sc(e,n,r));if(!i)throw Error(`Could not trace path: ${e} `);return i}function*Sc(e,n,r={}){k(Lr(e,`path`),Lr(n,`node`));let i=r.separator??`.`,a=e.split(i),o=[];for(let e of a){let r=bc(e,n);if(!r){yield{name:e,sourceValue:void 0,leafValue:void 0,ancestors:o,_kind:`entry-ancestors`};return}n=r.sourceValue,yield{...r,ancestors:[...o],_kind:`entry-ancestors`},o.push(e)}}const Cc=(e,n={},r=[],i)=>{let a=n.name??`object`,o={*children(){for(let{name:i,sourceValue:s,leafValue:c}of vc(e,n))yield Cc(s,{...n,name:i},[...r,a],o)},getParent(){return i},getValue(){return{name:a,sourceValue:e,ancestors:r,_kind:`entry-static`}},getIdentity(){return e}};return o},wc=(e,n)=>As(Tc(e,n)),Tc=(e,n={})=>Ec(e,(n.valuesAtLeaves??!1?e=>{if(Mo(e))return e}:e=>e)(e),n,[]),Ec=(e,n,r={},i)=>{let a=r.name??`object_ci`,o=rc({name:a,sourceValue:n,ancestors:[...i],_kind:`entry-static`});i=[...i,a];for(let n of vc(e,r)){let e=r.valuesAtLeaves?n.leafValue:n.sourceValue;tc(Ec(n.sourceValue,e,{...r,name:n.name},i),o)}return o},Dc=(e,n={})=>Ds(Tc(e,n));function Oc(e,n=``){return`name`in e&&`leafValue`in e&&`sourceValue`in e?{name:e.name,_kind:`entry`,leafValue:e.leafValue,sourceValue:e.sourceValue}:`name`in e?{name:e.name,leafValue:e,sourceValue:e,_kind:`entry`}:{name:n,leafValue:e,sourceValue:e,_kind:`entry`}}function kc(e){return`value`in e}function Ac(e){return`values`in e&&Array.isArray(e.values)}var jc=ko({Pathed:()=>Mc,addValueByPath:()=>Nc,children:()=>zc,childrenLengthByPath:()=>Rc,clearValuesByPath:()=>Lc,findAnyChildByValue:()=>Gc,hasValue:()=>Kc,parent:()=>Hc,parentValues:()=>Uc,removeValueByPath:()=>Ic,siblings:()=>Bc,siblingsValues:()=>Vc,toStringDeep:()=>Qc,valueByPath:()=>qc,valuesByPath:()=>Xc}),Mc=class{#e;#t;constructor(e={}){this.#t={separator:`.`,startsWithSeparator:!1,duplicates:`overwrite`,...e}}add(e,n){Dr(this.validate(n));let r=Nc(e,n,this.#t,this.#e);this.#e===void 0&&(this.#e=qs(r))}validate(e){return this.#t.startsWithSeparator&&!e.startsWith(this.#t.separator)?{success:!1,error:`Path must start with separator when 'startsWithSeparator' is enabled. Got: ${e}`}:{success:!0,value:e}}prettyPrint(){return this.#e===void 0?`(empty)`:fc(this.#e)}remove(e){return Dr(this.validate(e)),this.#e!==void 0&&Ic(e,this.#e,this.#t)}hasPath(e){return Dr(this.validate(e)),this.#e!==void 0&&Yc(e,this.#e,this.#t)!==void 0}getNode(e){if(Dr(this.validate(e)),this.#e!==void 0)return Yc(e,this.#e,this.#t)}getValue(e){if(Dr(this.validate(e)),this.#e!==void 0)return qc(e,this.#e,this.#t)}getPath(e,n){if(this.#e===void 0)return``;let r=[];n&&e.value&&r.push(e.value?.label);for(let n of Uc(e))r.unshift(n.label);let i=r.join(this.#t.separator);return this.#t.startsWithSeparator&&(i.startsWith(this.#t.separator)||(i=this.#t.separator+i),!i.endsWith(this.#t.separator)&&(e.childrenStore.length>0||!n)&&(i+=this.#t.separator)),i}childrenLength(e){if(Dr(this.validate(e)),this.#e===void 0)return NaN;let n=Yc(e,this.#e,this.#t);return n===void 0?NaN:n.childrenStore.length}getValues(e){if(Dr(this.validate(e)),this.#e!==void 0)return Xc(e,this.#e,this.#t)}clearValues(e){return Dr(this.validate(e)),this.#e!==void 0&&Lc(e,this.#e,this.#t)}*children(e){Dr(this.validate(e)),this.#e!==void 0&&(yield*zc(e,this.#e,this.#t))}*siblings(e){Dr(this.validate(e)),this.#e!==void 0&&(yield*Bc(e,this.#e,this.#t))}*siblingsValues(e){Dr(this.validate(e)),this.#e!==void 0&&(yield*Vc(e,this.#e,this.#t))}parent(e){if(Dr(this.validate(e)),this.#e!==void 0)return Hc(e,this.#e,this.#t)}get separator(){return this.#t.separator}get root(){return this.#e}};function Nc(e,n,r,i){let a=r.separator,o=r.duplicates,s=n.split(a),c=0;for(let n of s){let r=c===s.length-1,a=Wc(n,i);if(a===void 0)i=oc({value:r?e:void 0,label:n},i);else if(i=a,r)switch(o){case`ignore`:break;case`allow`:{let r=Jc(i);i.value={values:[...r,e],label:n};break}case`overwrite`:i.value={value:e,label:n};break}else i=a;c++}if(i===void 0)throw Error(`Could not create tree`);return i}function Pc(e){return e.value===void 0?!0:`values`in e.value?e.value.values.length===0:`value`in e.value?e.value.value===void 0:!0}function Fc(e){if(e.childrenStore.length>0||!Pc(e))return;let n=e.parent;n&&(js(e),Fc(n))}function Ic(e,n,r){if(n===void 0)return!1;let i=Yc(e,n,r);return i!==void 0&&(i.value=void 0,Fc(i),!0)}function Lc(e,n,r){if(n===void 0)return!1;let i=Yc(e,n,r);return i!==void 0&&(i.value={label:i.value?.label??``,value:void 0},!0)}function Rc(e,n,r){if(n===void 0)return NaN;let i=Yc(e,n,r);return i===void 0?NaN:i.childrenStore.length}function*zc(e,n,r){if(n===void 0)return;let i=Yc(e,n,r);if(i!==void 0)for(let e of i.childrenStore)yield e}function*Bc(e,n,r){if(n===void 0)return;let i=Yc(e,n,r);if(i===void 0)return;let a=i.parent;if(a!==void 0){for(let e of a.childrenStore)if(e!==i){if(e===void 0)throw TypeError(`Unexpected undefined child node`);yield e}}}function*Vc(e,n,r){for(let i of Bc(e,n,r))i.value!==void 0&&(yield i.value)}function Hc(e,n,r){if(n===void 0)return;let i=Yc(e,n,r);if(i!==void 0)return i.parent}function*Uc(e){for(let n of Bs(e))n.value!==void 0&&(yield n.value)}function Wc(e,n){if(n!==void 0){if(e===void 0)throw Error(`Parameter 'label' cannot be undefined`);if(n.value?.label===e)return n;for(let r of n.childrenStore)if(r.value?.label===e)return r}}function Gc(e,n,r=2**53-1,i=So){if(n===void 0)throw TypeError(`Param 'node' is undefined`);if(!(r<=0)){if(e===void 0)throw Error(`Param 'value' cannot be undefined`);for(let r of n.childrenStore)if(Kc(e,r,i))return r;for(let a of n.childrenStore){let n=Gc(e,a,r-1,i);if(n!==void 0)return n}}}function Kc(e,n,r=xo){if(n.value===void 0)return!1;if(kc(n.value)){if(r(n.value.value,e))return!0}else if(Ac(n.value)){for(let i of n.value.values)if(r(i,e))return!0}return!1}function qc(e,n,r={}){let i=Xc(e,n,r);if(i!==void 0&&i.length!==0){if(i.length>1)throw Error(`Multiple values at path. Use getValues instead`);return i[0]}}function Jc(e){return e.value===void 0?[]:`values`in e.value?e.value.values:`value`in e.value?e.value.value===void 0?[]:[e.value.value]:[]}function Yc(e,n,r){e.endsWith(r.separator)&&r.startsWithSeparator&&(e=e.slice(0,-r.separator.length));let i=e.split(r.separator),a=n;for(let e of i)if(a=Wc(e,a),a===void 0)return;return a}function Xc(e,n,r={}){let i=r.separator??`.`,a=e.split(i),o=n;for(let e of a)if(o=Wc(e,o),o===void 0)return;return Jc(o)}function Zc(e){return e===void 0?`undefined`:e===null?`null`:typeof e==`string`?`"${e}"`:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.length===0?`[]`:`[ ${e.map(Zc).join(`, `)} ]`:typeof e==`object`?`{ ${Object.entries(e).map(([e,n])=>`${e}: ${Zc(n)}`).join(`, `)} }`:String(e)}function Qc(e){let n=e.value?.label??`?`,r=e.value===void 0?void 0:`values`in e.value?e.value.values:`value`in e.value?e.value.value:void 0,i=e.childrenStore.map(e=>Qc(e)),a=i.length===0?`[]`:`[ ${i.join(`, `)} ]`;return`{ label: "${n}", value: ${Zc(r)}, children: ${a} }`}var $c=ko({breadthFirst:()=>_l,childrenLength:()=>el,couldAddChild:()=>sl,depthFirst:()=>gl,find:()=>vl,findAnyChildByValue:()=>ml,findAnyParentByValue:()=>rl,findByValue:()=>yl,findChildByValue:()=>hl,findParentByValue:()=>ol,followValue:()=>bl,hasAnyChild:()=>cl,hasAnyChildValue:()=>ll,hasAnyParent:()=>tl,hasAnyParentValue:()=>nl,hasChild:()=>ul,hasChildValue:()=>dl,hasParent:()=>il,hasParentValue:()=>al,parents:()=>pl,siblings:()=>fl,toString:()=>Sl,toStringDeep:()=>xl});const el=e=>[...e.children()].length,tl=(e,n,r)=>il(e,n,r,2**53-1),nl=(e,n,r)=>{if(e===void 0)throw TypeError(`Param 'child' is undefined`);return al(e,n,r,2**53-1)},rl=(e,n,r)=>ol(e,n,r,2**53-1),il=(e,n,r=xo,i=0)=>{if(i<0)return!1;let a=Ou(e),o=Ou(n),s=a?e.getParent():e.parent;return s===void 0?!1:r(s,n)||r(a?s.getIdentity():s.value,o?n.getIdentity():n.value)?!0:il(s,n,r,i-1)},al=(e,n,r=xo,i=0)=>{if(e===void 0)throw Error(`Param 'child' is undefined`);if(i<0)return!1;let a=`getParent`in e?e.getParent():e.parent;return a===void 0?!1:r(`getValue`in a?a.getValue():a.value,n)?!0:al(a,n,r,i-1)},ol=(e,n,r=xo,i=0)=>{if(i<0)return;let a=`getParent`in e?e.getParent():e.parent;if(a!==void 0)return r(`getValue`in a?a.getValue():a.value,n)?a:ol(a,n,r,i-1)},sl=(e,n,r=xo)=>{if(r(e,n))throw Error(`Child equals parent`);if(cl(e,n,r))throw Error(`Circular. Parent already has child`);if(cl(n,e,r))throw Error(`Prospective child has parent as child relation`)},cl=(e,n,r=xo)=>ul(e,n,r,2**53-1),ll=(e,n,r=xo)=>dl(e,n,r,2**53-1),ul=(e,n,r=xo,i=0)=>{if(i<0)return!1;if(r(e,n))return!0;let a=`getIdentity`in e?e.getIdentity():e.value,o=`getIdentity`in n?n.getIdentity():n.value;if(r(a,o))return!0;for(let a of _l(e,i)){let e=`getIdentity`in a?a.getIdentity():a.value;if(r(a,n)||r(e,o))return!0}return!1},dl=(e,n,r=xo,i=0)=>{if(i<0)return!1;if(r(e.getValue(),n))return!0;for(let a of _l(e,i))if(r(a.getValue(),n))return!0;return!1};function*fl(e){let n=e.getParent();if(n!==void 0)for(let r of n.children())r!==e&&(yield r)}function*pl(e){if(Ou(e)){let n=e.getParent();for(;n!==void 0;)yield n,n=n.getParent()}else{let n=e.parent;for(;n!==void 0;)yield n,n=n.parent}}function ml(e,n,r=xo){return hl(e,n,r,2**53-1)}function hl(e,n,r=xo,i=0){if(i<0)return;let a=Ou(e);if(a){if(r(e.getValue(),n))return e}else if(r(e.value,n))return e;for(let o of _l(e,i))if(a){if(r(o.getValue(),n))return o}else if(r(o.value,n))return o}function*gl(e){if(!e)return;let n=new qo,r=e;for(;r;){let e=Ou(r)?[...r.children()]:[...r.childrenStore];if(n.push(...e),n.isEmpty)break;r=n.pop(),r&&(yield r)}}function*_l(e,n=2**53-1){if(!e)return;let r=(Ou(e),new ts),i=e;for(;i;){if(n<0)return;if(i!==void 0){let e=`childrenStore`in i?i.childrenStore:i.children();for(let n of e)yield n,r.enqueue(n)}i=r.dequeue(),n--}}function vl(e,n,r=`breadth`){if(n(e))return e;let i=r===`breadth`?_l:gl;for(let r of i(e))if(n(r))return r}function yl(e,n,r=`breadth`){if(n(e.getValue()))return e;let i=r===`breadth`?_l:gl;for(let r of i(e))if(n(r.getValue()))return r}function*bl(e,n,r=1){for(let i of e.children())n(i.getValue(),r)&&(yield i.getValue(),yield*bl(i,n,r+1))}function xl(e,n=0){if(e===void 0)return`(undefined)`;if(e===null)return`(null)`;let r=e.getValue(),i=typeof r;Array.isArray(r)&&(i=`array`);let a=` `.repeat(n)+`value: ${JSON.stringify(r)} (${i})\n`;for(let r of e.children())a+=xl(r,n+1);return a}function Sl(...e){let n=``;for(let r of e){let e=r.getValue(),i=jo(e),a=[...r.children()],o=r.getParent(),s=typeof e;Array.isArray(e)&&(s=`array`),n+=`value: ${i} (${s}) kids: ${a.length} parented: ${o?`y`:`n`}\n`}return n}var Cl=ko({addLeft:()=>ql,addRight:()=>Jl,balanceFactor:()=>Wl,breadthFirst:()=>ou,createNode:()=>Xl,depthFirst:()=>au,find:()=>tu,fromArray:()=>su,getLeft:()=>El,getRight:()=>Dl,grandparent:()=>Il,hasLeft:()=>Ol,hasRight:()=>kl,height:()=>Ul,inOrder:()=>nu,isLeaf:()=>Al,isParentLeftChild:()=>Ll,isParentRightChild:()=>Rl,leftSubtreeHeightFn:()=>Gl,parentChildSide:()=>zl,postOrder:()=>iu,preOrder:()=>ru,removeNode:()=>Nl,rightSubtreeHeightFn:()=>Kl,root:()=>Yl,rootWrapped:()=>eu,setLeft:()=>jl,setRight:()=>Ml,sibling:()=>Pl,toArray:()=>cu,toStringDeep:()=>lu,uncle:()=>Fl,wrap:()=>$l});const wl=e=>e.childrenStore[0],Tl=e=>e.childrenStore[1],El=e=>wl(e),Dl=e=>Tl(e),Ol=e=>wl(e)!==void 0,kl=e=>Tl(e)!==void 0,Al=e=>!Ol(e)&&!kl(e),jl=(e,n)=>{let r=wl(e);r&&(r.parent=void 0);let i=[...e.childrenStore];if(n===void 0&&i.length<=1){e.childrenStore=[];return}if(n===void 0){i[0]=void 0,e.childrenStore=i;return}i.length===0?i.push(n):i[0]=n,e.childrenStore=i,n.parent=e},Ml=(e,n)=>{let r=Tl(e);r&&(r.parent=void 0);let i=[...e.childrenStore];if(n===void 0){i.length>=2&&(i[1]=void 0,e.childrenStore=i[0]===void 0?[]:i);return}i.length===0?i.push(void 0,n):i.length===1?i.push(n):i[1]=n,e.childrenStore=i,n.parent=e},Nl=e=>{let n=e.parent;n&&(n.childrenStore[0]===e?jl(n,void 0):n.childrenStore[1]===e&&Ml(n,void 0))},Pl=e=>{let n=e.parent;if(!n)return;let r=wl(n),i=Tl(n);if(r===e)return i;if(i===e)return r},Fl=e=>{let n=e.parent;if(n)return Pl(n)},Il=e=>{let n=e.parent;if(n)return n.parent},Ll=e=>{let n=e.parent;return n?wl(n)===e:!1},Rl=e=>{let n=e.parent;return n?Tl(n)===e:!1},zl=e=>e.parent?Ll(e)?`left`:`right`:`neutral`,Bl=e=>{let n=wl(e);return n?Hl(n)+1:0},Vl=e=>{let n=Tl(e);return n?Hl(n)+1:0},Hl=e=>Math.max(Bl(e),Vl(e)),Ul=e=>Hl(e),Wl=e=>Bl(e)-Vl(e),Gl=Bl,Kl=Vl,ql=(e,n)=>{let r=wl(n);r&&(r.parent=void 0);let i={value:e,parent:n,childrenStore:[]},a=[...n.childrenStore];return a.length===0?a.push(i):a[0]=(a.length,i),n.childrenStore=a,i},Jl=(e,n)=>{let r=Tl(n);r&&(r.parent=void 0);let i={value:e,parent:n,childrenStore:[]},a=[...n.childrenStore];return a.length===0?(a.push(void 0),a.push(i)):a.length===1?a.push(i):a[1]=i,n.childrenStore=a,i},Yl=e=>rc(e),Xl=(e,n)=>oc(e,n),Zl=e=>`node`in e?e.node:e,Ql=e=>$l(e),$l=e=>({node:e,get left(){let n=wl(e);return n?Ql(n):void 0},get right(){let n=Tl(e);return n?Ql(n):void 0},set left(n){jl(e,n?Zl(n):void 0)},set right(n){Ml(e,n?Zl(n):void 0)},get parentChildSide(){return zl(e)},get isParentLeftChild(){return Ll(e)},get isParentRightChild(){return Rl(e)},get isLeaf(){return Al(e)},get sibling(){let n=Pl(e);return n?Ql(n):void 0},get uncle(){let n=Fl(e);return n?Ql(n):void 0},get grandparent(){let n=Il(e);return n?Ql(n):void 0},get leftSubtreeHeight(){return Bl(e)},get rightSubtreeHeight(){return Vl(e)},get height(){return Ul(e)},get balanceFactor(){return Wl(e)},has(n){return tu(e,n)!==void 0},addLeft(n){return Ql(ql(n,e))},addRight(n){return Ql(Jl(n,e))},setLeft(n){jl(e,Zl(n))},setRight(n){Ml(e,Zl(n))},remove(){Nl(e)}}),eu=e=>$l(rc(e)),tu=(e,n)=>{for(let r of ou(e))if(r.value===n)return r};function*nu(e){let n=wl(e);n&&(yield*nu(n)),yield e;let r=Tl(e);r&&(yield*nu(r))}function*ru(e){yield e;let n=wl(e);n&&(yield*ru(n));let r=Tl(e);r&&(yield*ru(r))}function*iu(e){let n=wl(e);n&&(yield*iu(n));let r=Tl(e);r&&(yield*iu(r)),yield e}function*au(e){let n=wl(e),r=Tl(e);n&&(yield*au(n)),r&&(yield*au(r)),yield e}function*ou(e){yield e;let n=[];for(n.push(...e.childrenStore.filter(e=>e!==void 0&&e.value!==void 0));n.length>0;){let e=n.shift();yield e,n.push(...e.childrenStore.filter(e=>e!==void 0&&e.value!==void 0))}}const su=e=>{if(e.length===0)return;let n=rc(e[0]),r=(n,i)=>{let a=2*n+1,o=2*n+2;a<e.length&&(ql(e[a],i),r(a,wl(i))),o<e.length&&(Jl(e[o],i),r(o,Tl(i)))};return r(0,n),n},cu=e=>{let n=[];for(let r of ou(e))r.value!==void 0&&n.push(r.value);return n},lu=(e,n=0)=>{let r=e.value===void 0?`-`:JSON.stringify(e.value),i=` `.repeat(n),a=wl(e),o=Tl(e),s=`${i}${r}`;return(a||o)&&(s+=`
|
|
3339
|
+
`,a&&(s+=`${i} L: ${lu(a,n+1)}`,o&&(s+=`
|
|
3340
|
+
`)),o&&(s+=`${i} R: ${lu(o,n+1)}`)),s};var uu=ko({Bst:()=>du,create:()=>Su,find:()=>mu,fromArray:()=>Cu,has:()=>pu,inOrder:()=>vu,insert:()=>fu,max:()=>gu,min:()=>hu,postOrder:()=>bu,preOrder:()=>yu,remove:()=>_u,root:()=>wu,valuesInOrder:()=>xu}),du=class{root;comparer;constructor(e=Eo){this.comparer=e,this.root=Yl()}insert(e){return this.root=fu(this.root,e,this.comparer),this.root}has(e){return pu(this.root,e,this.comparer)}find(e){return mu(this.root,e,this.comparer)}remove(e){let n=_u(this.root,e,this.comparer);return n&&(this.root=n),n!==void 0}min(){return hu(this.root)}max(){return gu(this.root)}inOrder(){return vu(this.root)}preOrder(){return yu(this.root)}postOrder(){return bu(this.root)}valuesInOrder(){return xu(this.root)}toArrayInOrder(){return Array.from(this.valuesInOrder())}};const fu=(e,n,r=Eo)=>{if(e.value===void 0)return e.value=n,e;let i=e;for(;;){let e=r(n,i.value);if(e<0){let e=El(i);if(e)i=e;else{ql(n,i);break}}else if(e>0){let e=Dl(i);if(e)i=e;else{Jl(n,i);break}}else break}return e},pu=(e,n,r=Eo)=>mu(e,n,r)!==void 0,mu=(e,n,r=Eo)=>{if(!e||e.value===void 0)return;let i=r(n,e.value);if(i===0)return e;if(i<0){let i=El(e);return i?mu(i,n,r):void 0}{let i=Dl(e);return i?mu(i,n,r):void 0}},hu=e=>{if(!e||e.value===void 0)return;let n=e;for(;El(n);)n=El(n);return n},gu=e=>{if(!e||e.value===void 0)return;let n=e;for(;Dl(n);)n=Dl(n);return n},_u=(e,n,r=Eo)=>{if(!e||e.value===void 0)return;let i=mu(e,n,r);if(!i)return;let a=El(i),o=Dl(i);if(!a&&!o)i===e?(e.value=void 0,e.childrenStore=[]):Nl(i);else if(!a){if(i===e){e.value=o.value,e.childrenStore=o.childrenStore;for(let n of e.childrenStore)n&&(n.parent=e)}else{let e=i.parent;El(e)===i?jl(e,o):Ml(e,o)}}else if(o){let e=hu(o);i.value=e.value;let n=e.parent,r=Dl(e);El(n)===e?jl(n,r):Ml(n,r)}else if(i===e){e.value=a.value,e.childrenStore=a.childrenStore;for(let n of e.childrenStore)n&&(n.parent=e)}else{let e=i.parent;El(e)===i?jl(e,a):Ml(e,a)}return e};function*vu(e){if(!e)return;let n=El(e);n&&(yield*vu(n)),yield e;let r=Dl(e);r&&(yield*vu(r))}function*yu(e){if(!e)return;yield e;let n=El(e);n&&(yield*yu(n));let r=Dl(e);r&&(yield*yu(r))}function*bu(e){if(!e)return;let n=El(e);n&&(yield*bu(n));let r=Dl(e);r&&(yield*bu(r)),yield e}function*xu(e){for(let n of vu(e))n.value!==void 0&&(yield n.value)}const Su=e=>new du(e),Cu=(e,n=Eo)=>{let r=new du(n);for(let n of e)r.insert(n);return r},wu=()=>Yl();var Tu=ko({BinarySearchTree:()=>uu,BinaryTree:()=>Cl,FromObject:()=>mc,Mutable:()=>Ts,Pathed:()=>jc,Traverse:()=>$c,compare:()=>vs,isMultiValue:()=>Ac,isSingleValue:()=>kc,isTraversable:()=>Ou,isTreeNode:()=>Du,toTraversable:()=>Eu});const Eu=e=>{if(Ou(e))return e;if(Du(e))return lc(e);if(typeof e==`object`)return Cc(e);throw Error(`Parameter 'node' not convertible`)},Du=e=>!!(`parent`in e&&`childrenStore`in e&&`value`in e&&Array.isArray(e.childrenStore)),Ou=e=>`children`in e&&`getParent`in e&&`getValue`in e&&`getIdentity`in e;(class e extends Lo{static shared=new e;_loop;_queue;constructor(){super(),this._queue=_s.mutable(),this._loop=No(()=>this.processQueue(),100)}enqueue(e){let n=this._queue.enqueue(e);return this._loop.runState===`idle`&&(this.fireEvent(`started`,{}),this._loop.start()),n}async processQueue(){let e=this._queue.dequeue();if(e===void 0)return this.fireEvent(`empty`,{}),!1;try{let n=await e();this.fireEvent(`progress`,{task:e,remaining:this._queue.length,result:n})}catch(n){this.fireEvent(`error`,{error:n,task:e})}return!0}clear(){this._queue.length!==0&&(this._queue.clear(),this._loop.cancel(),this.fireEvent(`empty`,{}))}get isEmpty(){return this._queue.isEmpty}get length(){return this._queue.length}get runState(){return this._loop.runState}});function ku(e,n={}){let r=Po(e);if(!r)throw Error(`Param 'duration' not valid`);let i={clampValue:n.clampValue,wrapValue:n.wrapValue,timer:n.timer??Pu()},a;return()=>(a??=Nu(r,i),a.elapsed)}function Au(e,n={}){let r={...n,timer:Fu()},i;return()=>(i??=Nu(e,r),i.elapsed)}const ju=()=>({elapsed:1,isDone:!0,reset(){},mod(e){}}),Mu=()=>({elapsed:0,isDone:!1,reset(){},mod(){}}),Nu=(e,n={})=>{if(!Number.isFinite(e))return ju();if(Number.isNaN(e))return Mu();let r=n.clampValue??!1,i=n.wrapValue??!1;if(r&&i)throw Error(`clampValue and wrapValue cannot both be enabled`);let a=1,o=n.timer??Pu(),s=0,c=n=>{s=n;let o=n/(e*a);return r?o=ri(o):i&&o>=1&&(o%=1),o};return{mod(e){a=e},get isDone(){return c(s)>=1},get elapsed(){return c(o.elapsed)},reset:()=>{o.reset()}}},Pu=()=>{let e=performance.now();return{reset:()=>{e=performance.now()},get elapsed(){return performance.now()-e}}},Fu=()=>{let e=0;return{reset:()=>{e=0},get peek(){return e},get elapsed(){return++e}}},Iu=(e,n)=>{if(typeof e!=`function`)throw Error(`Param 'fn' should be a function. Got: ${typeof e}`);let r=1;return{get elapsed(){return n.elapsed},get isDone(){return n.isDone},get runState(){return n.isDone?`idle`:`scheduled`},get startCount(){return r},get startCountTotal(){return r},compute:()=>{let r=n.elapsed;return e(r)},reset:()=>{n.reset(),r++}}};var Lu=class{seenCount;storeIntermediate;resetAfterSamples;sampleLimit;id;debug;constructor(e={}){this.id=e.id??`tracker`,this.debug=e.debug??!1,this.sampleLimit=e.sampleLimit??-1,this.resetAfterSamples=e.resetAfterSamples??-1,this.storeIntermediate=e.storeIntermediate??(this.sampleLimit>-1||this.resetAfterSamples>-1),this.seenCount=0,this.debug&&console.log(`TrackerBase: sampleLimit: ${this.sampleLimit} resetAfter: ${this.resetAfterSamples} store: ${this.storeIntermediate}`)}reset(){this.seenCount=0,this.onReset()}seen(...e){this.resetAfterSamples>0&&this.seenCount>this.resetAfterSamples?this.reset():this.sampleLimit>0&&this.seenCount>this.sampleLimit*2&&(this.seenCount=this.trimStore(this.sampleLimit),this.onTrimmed(`resize`)),this.seenCount+=e.length;let n=this.filterData(e);return this.computeResults(n)}},Ru=class extends Lu{values;constructor(e={}){super(e),this.values=[]}onTrimmed(e){}trimStore(e){return e>=this.values.length||(this.values=this.values.slice(-e)),this.values.length}onReset(){this.values=[]}filterData(e){let n=e.map(e=>`at`in e?e:{...e,at:Date.now()}),r=n.at(-1);if(this.storeIntermediate)this.values.push(...n);else switch(this.values.length){case 0:this.values.push(r);break;case 1:this.values.push(r);break;case 2:this.values[1]=r;break}return n}get last(){return this.values.length===1?this.values[0]:this.values.at(-1)}get initial(){return this.values.at(0)}get size(){return this.values.length}get elapsed(){if(this.values.length===0)throw Error(`No values seen yet`);return Date.now()-this.values[0].at}get timespan(){let e=this.initial,n=this.last;return!e||!n?NaN:n.at-e.at}},zu=class{store;gog;constructor(e){this.store=new Map,this.gog=Do(this.store,e)}get size(){return this.store.size}has(e){return this.store.has(e)}seen(e,...n){return this.getTrackedValue(e,...n).seen(...n)}getTrackedValue(e,...n){if(e===null)throw Error(`id parameter cannot be null`);if(e===void 0)throw Error(`id parameter cannot be undefined`);return this.gog(e,n[0])}delete(e){this.store.delete(e)}reset(){this.store=new Map}*ids(){yield*this.store.keys()}*tracked(){yield*this.store.values()}*trackedByAge(){let e=[...this.store.values()];e.sort((e,n)=>{let r=e.elapsed,i=n.elapsed;return r===i?0:r>i?-1:1});for(let n of e)yield n}*valuesByAge(){for(let e of this.trackedByAge())yield e.last}*last(){for(let e of this.store.values())yield e.last}*initialValues(){for(let e of this.store.values())yield e.initial}get(e){return this.store.get(e)}};function Bu(e,n,r,i){if(Wr(e)){if(typeof n==`number`&&r!==void 0)k(A(n,`positive`,`width`),A(r,`positive`,`height`));else{if(!ha(n))throw Error(`Expected second parameter to be a rect`);r=n.height,n=n.width}return Object.freeze({x:e.x/n,y:e.y/r})}if(k(A(e,`positive`,`x`)),typeof n!=`number`)throw TypeError(`Expecting second parameter to be a number (width)`);if(typeof r!=`number`)throw TypeError(`Expecting third parameter to be a number (height)`);if(k(A(n,`positive`,`y`)),k(A(r,`positive`,`width`)),i===void 0)throw Error(`Expected height parameter`);return k(A(i,`positive`,`height`)),Object.freeze({x:e/r,y:n/i})}function Vu(e,n,r,i,a,o){let[s,c]=Mi(e,n,r,i,a,o);if(j(s,`a`),j(c,`b`),c.x===0)throw TypeError(`Cannot divide by zero (b.x is 0)`);if(c.y===0)throw TypeError(`Cannot divide by zero (b.y is 0)`);let l={x:s.x/c.x,y:s.y/c.y};if(M(s)||M(c)){if(c.z===0)throw TypeError(`Cannot divide by zero (b.z is 0)`);l.z=(s.z??0)/(c.z??0)}return Object.freeze(l)}function Hu(e,n,r){let i=Ni(e,n,r);return Ur(i,`divisor`),(e,n,r)=>{let a=Ni(e,n,r);return a.z===void 0?Object.freeze({x:a.x/i.x,y:a.y/i.y}):Object.freeze({x:a.x/i.x,y:a.y/i.y,z:a.z/(i.z??1)})}}function Uu(e){if(M(e))return Object.freeze({...e,x:Math.abs(e.x),y:Math.abs(e.y),z:Math.abs(e.z)});if(Wr(e))return Object.freeze({...e,x:Math.abs(e.x),y:Math.abs(e.y)});throw TypeError(`Param 'pt' is not a point`)}function Wu(e,n){return j(e,`pt`),M(e)?Object.freeze({...e,x:n(e.x,`x`),y:n(e.y,`y`),z:n(e.z,`z`)}):Object.freeze({...e,x:n(e.x,`x`),y:n(e.y,`y`)})}const Gu=(...e)=>{if(!Array.isArray(e))throw Error(`Expected list of points`);let n=e.reduce((e,n)=>{if(n===void 0)return e;if(Array.isArray(n))throw TypeError(`'points' list contains an array. Did you mean: centroid(...myPoints)?`);if(!Wr(n))throw Error(`'points' contains something which is not a point: ${JSON.stringify(n)}`);return{x:e.x+n.x,y:e.y+n.y}},{x:0,y:0});return Object.freeze({x:n.x/e.length,y:n.y/e.length})};function Ku(e,n=0,r=1){return M(e)?Object.freeze({x:ri(e.x,n,r),y:ri(e.y,n,r),z:ri(e.z,n,r)}):Object.freeze({x:ri(e.x,n,r),y:ri(e.y,n,r)})}const qu=(...e)=>{let n=[...e].sort(mo);if(n.length===1)return n;let r=e=>{let n=[];for(let r of e){for(;n.length>=2;){let e=n.at(-1),i=n.at(-2);if((e.x-i.x)*(r.y-i.y)>=(e.y-i.y)*(r.x-i.x))n.pop();else break}n.push(r)}return n.pop(),n},i=r(n),a=r(n.reverse());return i.length===1&&a.length===1&&lo(a[0],i[0])?i:[...i,...a]},Ju=(e,n)=>{if(ga(n))return zo(n,e);if(ro(n))return oo(n,e);if(Wr(n))return Pi(e,n);throw Error(`Unknown shape`)},Yu=(e,n)=>{if(ga(n))return zo(n,e);if(ro(n))return oo(n,e);if(Wr(n))return Pi(e,n);throw Error(`Unknown shape`)},Xu=e=>[e.x,e.y],Zu=(...e)=>ni(e.map(e=>Xu(e)));function Qu(e,n){return e.x*n.y-e.y*n.x}function $u(e,n,r,i){return e*i-n*r}function ed(e,n,r){if(Array.isArray(e)){if(e.length===3)return Object.freeze({x:e[0],y:e[1],z:e[2]});if(e.length===2)return Object.freeze({x:e[0],y:e[1]});throw Error(`Expected array of length two or three, got ${e.length}`)}if(e===void 0)throw Error(`Requires an array of [x,y] or x,y parameters at least`);if(Number.isNaN(e))throw Error(`x is NaN`);if(n===void 0)throw Error(`Param 'y' is missing`);if(Number.isNaN(n))throw Error(`y is NaN`);return Object.freeze(r===void 0?{x:e,y:n}:{x:e,y:n,z:r})}const td=e=>{if(typeof e!=`string`)throw TypeError(`Param 'str' ought to be a string. Got: ${typeof e}`);let n=e.indexOf(`,`),r=Number.parseFloat(e.substring(0,n)),i=e.indexOf(`,`,n+1);return i>0?{x:r,y:Number.parseFloat(e.substring(n+1,i-n+2)),z:Number.parseFloat(e.substring(i+1))}:{x:r,y:Number.parseFloat(e.substring(n+1))}},nd=(...e)=>{let n=[];if(Array.isArray(e[0]))for(let r of e){if(r.length%2!=0)throw Error(`coords array should be even-numbered`);n.push(Object.freeze({x:r[0],y:r[1]}))}else{if(e.length%2!=0)throw Error(`Expected even number of elements: [x,y,x,y...]`);for(let r=0;r<e.length;r+=2)n.push(Object.freeze({x:e[r],y:e[r+1]}))}return n};function rd(e,n,r,i=!1){return la(e,n,r,i)}const id=(e,n,r=!1)=>ua({a:e,b:n},r),ad=(e,n=`both`)=>{switch(n){case`both`:return M(e)?Object.freeze({...e,x:e.x*-1,y:e.y*-1,z:e.z*-1}):Object.freeze({...e,x:e.x*-1,y:e.y*-1});case`x`:return Object.freeze({...e,x:e.x*-1});case`y`:return Object.freeze({...e,y:e.y*-1});case`z`:if(M(e))return Object.freeze({...e,z:e.z*-1});throw Error(`pt parameter is missing z`);default:throw Error(`Unknown what parameter. Expecting 'both', 'x' or 'y'`)}},od=(e,n=1,r=0)=>{let i=Pi(e),a=1;return i>n?a=n/i:i<r&&(a=r/i),a===1?e:so(e,a,a)},sd=(...e)=>ta((e,n)=>e.x<=n.x?e:n,...e),cd=(...e)=>ta((e,n)=>e.x>=n.x?e:n,...e),ld=(e,n)=>{if(Wr(e)&&(n=e.y,e=e.x),n===void 0)throw Error(`Expected y`);return Math.hypot(e,n)},ud=(e,n)=>{let r=Ni(e,n),i=ld(r);return i===0?Ui:Object.freeze({...r,x:r.x/i,y:r.y/i})},dd=(e,...n)=>fd(...n)(e),fd=(...e)=>n=>e.reduce((e,n)=>n(e),n),pd=Object.freeze({x:0,y:0}),md=Math.PI*2,hd=Math.PI;function gd(e,n=``,r=pd){e=Ii(e,r);let i=Math.atan2(e.y,e.x);return n===`unipolar`&&i<0?i+=md:n===`bipolar`&&(i>hd?i-=md:i<=-hd&&(i+=md)),Object.freeze({distance:Pi(e),angleRadian:i})}function _d(e){return Ii(e.b,e.a)}function vd(e){return k(oa(e,`line`)),gd(Ii(e.b,e.a))}const yd=(e,n)=>{let r=Ni(e,n),i=0,a=0,o=0,s=performance.now(),c=r;return(e,n)=>{let l=Ni(e,n);i+=l.x,a+=l.y,o++;let u=Pi(l,r),d=Pi(l,c),f=performance.now(),p=d/(f-s);return s=f,c=l,Object.freeze({angle:Xi(l,r),distanceFromStart:u,distanceFromLast:d,speed:p,centroid:Gu(l,r),average:{x:i/o,y:a/o}})}},bd=Object.freeze({x:NaN,y:NaN}),xd=Object.freeze({x:NaN,y:NaN,z:NaN});var Sd=class extends Ru{initialRelation;markRelation;lastResult;constructor(e={}){super(e)}onTrimmed(e){this.initialRelation=void 0}onReset(){super.onReset(),this.lastResult=void 0,this.initialRelation=void 0,this.markRelation=void 0}mark(){this.markRelation=yd(this.last)}computeResults(e){let n=this.last,r=this.values.at(-2);if(this.initialRelation===void 0&&this.initial)this.initialRelation=yd(this.initial);else if(this.initialRelation===void 0)throw Error(`Bug: No initialRelation, and this.inital is undefined?`);let i=yd(r===void 0?n:r),a=this.initialRelation(n),o=this.markRelation===void 0?void 0:this.markRelation(n),s=r===void 0?0:ca(r,n,!0)/(n.at-r.at),c={fromInitial:a,fromLast:{...i(n),speed:s},fromMark:o,values:[...this.values]};return this.lastResult=c,c}get line(){return this.values.length===1?[]:Bo(...this.values)}get vectorPolar(){return vd(this.lineStartEnd)}get vectorCartesian(){return _d(this.lineStartEnd)}get lineStartEnd(){let e=this.initial;return this.values.length<2||!e?Rd:{a:e,b:this.last}}distanceFromStart(e=!1){let n=this.initial;return this.values.length>=2&&n!==void 0?e?Fi(n,this.last):Pi(n,this.last):0}speedFromStart(e=!1){let n=this.lengthTotal(e),r=this.timespan;return Number.isNaN(r)||n===0?0:Math.abs(n)/r}speedFromLast(e=!1){let n=this.lastResult;return n?n.fromLast.speed:0}difference(){let e=this.initial;return this.values.length>=2&&e!==void 0?Ii(this.last,e):bd}angleFromStart(){let e=this.initial;if(e!==void 0&&this.values.length>2)return Xi(e,this.last)}lengthTotal(e=!1){if(this.values.length===1)return 0;let n=this.line;return ca(n,e)}lengthAverage(e=!1){return this.lengthTotal(e)/this.values.length}get x(){return this.last.x}get y(){return this.last.y}get z(){return this.last.z}},Cd=class extends zu{constructor(e={}){super((n,r)=>{if(r===void 0)throw Error(`Requires start point`);let i=new Sd({...e,id:n});return i.seen(r),i})}get(e){return super.get(e)}},wd=class extends Sd{seenEvent(e){if(`getCoalescedEvents`in e){let n=e.getCoalescedEvents().map(e=>({x:e.clientX,y:e.clientY}));return this.seen(...n)}return this.seen({x:e.clientX,y:e.clientY})}},Td=class extends zu{constructor(e={}){super((n,r)=>{if(r===void 0)throw Error(`Requires start point`);let i=new wd({...e,id:n});return i.seen(r),i})}get(e){return super.get(e)}seenEvent(e){if(`getCoalescedEvents`in e){let n=e.getCoalescedEvents().map(e=>super.seen(e.pointerId.toString(),e));return Promise.all(n)}return Promise.all([super.seen(e.pointerId.toString(),e)])}};const Ed=(e,n,r)=>{let i=Ii(e,n),a=Ii(r,n);return M(i)&&M(a)?(i.x*a.x+i.y*a.y+i.z*a.z)/(a.x*a.x+a.y*a.y+a.z*a.z):(i.x*a.x+i.y*a.y)/(a.x*a.x+a.y*a.y)},Dd=(e,n,r)=>({x:Math.cos(r)*n+e.x,y:Math.sin(r)*n+e.y});function Od(e,n,r=!0){if(j(e,`pt`),j(n,`snap`),M(e)){if(!M(n))throw TypeError(`Param 'snap' is missing 'z' field`);return Object.freeze({x:li(e.x,n.x,r),y:li(e.y,n.y,r),z:li(e.z,n.z,r)})}return Object.freeze({x:li(e.x,n.x,r),y:li(e.y,n.y,r)})}const kd=e=>(e===void 0&&(e=Math.random),Object.freeze({x:e(),y:e()})),Ad=e=>(e===void 0&&(e=Math.random),Object.freeze({x:e(),y:e(),z:e()})),jd=(e,n,r)=>{r===void 0&&(r={x:0,y:0});let i=r;for(let r of e)i=n(r,i);return i};function Md(e,n,r){r===void 0&&(r={x:0,y:0}),j(r,`origin`),k(A(n,``,`amountRadian`));let i=Array.isArray(e);if(n===0)return e;i||(e=[e]);let a=e;for(let[e,n]of a.entries())j(n,`pt[${e}]`);let o=a.map(e=>Ji(e,r)).map(e=>Hi(e,n)).map(e=>qi(e,r));return i?o:o[0]}const Nd=(e,n)=>{let r=[[Math.cos(n),-Math.sin(n)],[Math.sin(n),Math.cos(n)]],i=[];for(let[n,a]of e.entries())i[n]=[r[0][0]*a[0]+r[0][1]*a[1],r[1][0]*a[0]+r[1][1]*a[1]];return i},Pd=(e,n,r)=>{let i=Ni(e,n);return r??=n,r??=2,Object.freeze({...i,x:si(r,i.x),y:si(r,i.y)})},Fd=(e,n,r)=>{j(e,`a`),j(n,`b`),typeof r==`number`?(k(A(r,`positive`,`maxRange`)),r={x:r,y:r}):j(r,`maxRange`);let i=Math.abs(n.x-e.x),a=Math.abs(n.y-e.y);return i<=r.x&&a<=r.y},Id=(e,n,r)=>(n===void 0&&(n={x:1,y:1}),r===void 0&&(r={x:0,y:0}),j(e,`pt`),j(n,`ptMax`),j(r,`ptMin`),Object.freeze({x:ai(e.x,r.x,n.x),y:ai(e.y,r.y,n.y)}));var Ld=Tr({Empty:()=>Ui,Empty3d:()=>Gi,Placeholder:()=>bd,Placeholder3d:()=>xd,PointTracker:()=>Sd,PointsTracker:()=>Cd,Unit:()=>Wi,Unit3d:()=>Ki,UserPointerTracker:()=>wd,UserPointersTracker:()=>Td,abs:()=>Uu,angleRadian:()=>Xi,angleRadianCircle:()=>Zi,angleRadianThreePoint:()=>Qi,apply:()=>Wu,average:()=>gi,averager:()=>_i,bbox:()=>na,bbox3d:()=>ra,centroid:()=>Gu,clamp:()=>Ku,clampMagnitude:()=>od,compare:()=>uo,compareByX:()=>mo,compareByY:()=>ho,compareByZ:()=>go,compareRowwise:()=>fo,convexHull:()=>qu,cross:()=>Qu,crossProductRaw:()=>$u,distance:()=>Pi,distance2d:()=>Fi,distanceToCenter:()=>Ju,distanceToExterior:()=>Yu,divide:()=>Vu,divider:()=>Hu,dotProduct:()=>Zu,findMinimum:()=>ta,from:()=>ed,fromNumbers:()=>nd,fromString:()=>td,getAsBounds:()=>po,getPointParameter:()=>Ni,getTwoPointParameters:()=>Mi,guard:()=>j,guardNonZeroPoint:()=>Ur,interpolate:()=>rd,interpolator:()=>id,invert:()=>ad,isEmpty:()=>Gr,isEqual:()=>lo,isNaN:()=>Vr,isNull:()=>Br,isPlaceholder:()=>Kr,isPoint:()=>Wr,isPoint3d:()=>M,leftmost:()=>sd,multiply:()=>so,multiplyScalar:()=>co,normalise:()=>ud,normaliseByRect:()=>Bu,pipeline:()=>fd,pipelineApply:()=>dd,pointTest:()=>Hr,progressBetween:()=>Ed,project:()=>Dd,quantiseEvery:()=>Od,random:()=>kd,random3d:()=>Ad,reduce:()=>jd,relation:()=>yd,rightmost:()=>cd,rotate:()=>Md,rotatePointArray:()=>Nd,round:()=>Pd,subtract:()=>Ii,sum:()=>io,to2d:()=>Ri,to3d:()=>zi,toArray:()=>Xu,toIntegerValues:()=>Li,toString:()=>Bi,withinRange:()=>Fd,wrap:()=>Id});const Rd=Object.freeze({a:Object.freeze({x:0,y:0}),b:Object.freeze({x:0,y:0})});Object.freeze({a:Object.freeze({x:NaN,y:NaN}),b:Object.freeze({x:NaN,y:NaN})});var zd=Object.defineProperty,Bd=(e,n,r)=>n in e?zd(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,Vd=(e,n)=>{for(var r in n)zd(e,r,{get:n[r],enumerable:!0})},Hd=(e,n,r)=>Bd(e,typeof n==`symbol`?n:n+``,r),Ud={hsl:[`h`,`s`,`l`],oklab:[`l`,`a`,`b`],oklch:[`l`,`c`,`h`],rgb:[`r`,`g`,`b`]},Wd=[`hsl`,`oklab`,`oklch`,`rgb`],Gd=Math.PI/180,Kd={l:[.3963377773761749,.2158037573099136],m:[-.1055613458156586,-.0638541728258133],s:[-.0894841775298119,-1.2914855480194092]},qd={l:[.4122214708,.5363325363,.0514459929],m:[.2119034982,.6806995451,.1073969566],s:[.0883024619,.2817188376,.6299787005]},Jd={l:[.2104542553,.793617785,.0040720468],a:[1.9779984951,2.428592205,.4505937099],b:[.0259040371,.7827717662,.808675766]},Yd={r:[4.076741636075958,-3.307711539258063,.2309699031821043],g:[-1.2684379732850315,2.609757349287688,-.341319376002657],b:[-.0041960761386756,-.7034186179359362,1.7076146940746117]},Xd=5,Zd=180/Math.PI,P={alpha:`alpha must be a number between 0 and 1`,alphaAdjustment:`alpha must be a number between -1 and 1`,amount:`amount must be a number between 0 and 100`,colorRequired:`color is required`,degreesRange:`degrees must be a number between -360 and 360`,hueArgs:`point, chroma and h are required`,hueRange:`hue must be a number between 0 and 360`,input:`input is required`,inputHex:`input is required and must be a hex`,inputNumber:`input is required and must be a number`,inputString:`input is required and must be a string`,invalid:`invalid input`,invalidColor:`invalid color`,invalidCSS:`invalid CSS string`,invalidHex:`invalid hex`,invalidKey:`invalid key`,invalidModel:`invalid model`,invalidRange:`color value out of range`,left:`left is required and must be a string`,lightnessRange:`lightness must be a number between 0 and 1`,options:`invalid options`,paletteSize:`palette size must be at least 2`,ratioRange:`ratio must be a number between 0 and 1`,right:`right is required and must be a string`,threshold:`threshold must be a number between 0 and 255`,thresholdNormalized:`threshold must be a number between 0 and 1`};function F(e,n){if(e)return;let r=Error(n||`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);throw r.name=`colorizr`,r}var Qd={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,grey:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},$d=/^#(?:[\da-f]{3,4}|[\da-f]{6,8})$/i;function ef(e){return Array.isArray(e)&&e.length===6}function tf(e){return I(e)?$d.test(e):!1}function nf(e){if(!lf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`h`?n>=0&&n<=360:e===`alpha`?n>=0&&n<=1:Ud.hsl.includes(e)&&n>=0&&n<=100)}function rf(e){if(!lf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`l`?n>=0&&n<=100:e===`alpha`?n>=0&&n<=1:Ud.oklab.includes(e)&&n>=-1&&n<=1)}function af(e){if(!lf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`l`?n>=0&&n<=100:e===`alpha`?n>=0&&n<=1:Ud.oklch.includes(e)&&n>=0&&n<=(e===`h`?360:1))}function of(e){return I(e)&&Object.keys(Qd).includes(e.toLowerCase())}function sf(e){return typeof e==`number`&&!Number.isNaN(e)}function cf(e,n,r){return sf(e)&&e>=n&&e<=r}function lf(e){if(!e)return!1;let{toString:n}=Object.prototype,r=Object.getPrototypeOf(e);return n.call(e)===`[object Object]`&&(r===null||r===Object.getPrototypeOf({}))}function uf(e){if(!lf(e))return!1;let n=Object.entries(e);return!!n.length&&n.every(([e,n])=>e===`alpha`?n>=0&&n<=1:Ud.rgb.includes(e)&&n>=0&&n<=255)}function I(e,n=!0){let r=typeof e==`string`;return n?r&&!!e.trim().length:r}function df(e){return nf(e)||uf(e)||rf(e)||af(e)}function ff(e){F(tf(e),P.inputHex);let n=e.replace(`#`,``);if(n.length===3||n.length===4){let e=[...n];n=``,e.forEach(e=>{n+=`${e}${e}`})}let r=`#${n}`;return F(tf(r),P.invalidHex),r}function L(e,n){F(df(e),P.invalid);let r=n;return r===void 0||(r>1&&(r/=100),r===1)?e:{...e,alpha:r}}function pf(e,n=0,r=100){return Math.min(Math.max(e,n),r)}function mf(e,n){F(sf(e),P.inputNumber);let r=e+n;return r>360&&(r%=360),r<0&&(r+=360),Math.abs(r)}function hf(e){if(!Array.isArray(e))return e.alpha}function gf(e,n,r){switch(F(sf(e),P.inputNumber),F(Wd.includes(n),`${P.invalidModel}${n?`: ${n}`:``}`),F(Ud[n].includes(r),`${P.invalidKey}${r?`: ${r}`:``}`),n){case`hsl`:return F(Ud.hsl.includes(r),P.invalidKey),[`l`,`s`].includes(r)?pf(e):pf(e,0,360);case`rgb`:return F(Ud.rgb.includes(r),P.invalidKey),pf(e,0,255);default:throw Error(`Invalid inputs`)}}function _f(e,n){let r=Ud[n],i={hsl:nf,oklab:rf,oklch:af,rgb:uf};F(lf(e)||Array.isArray(e),P.invalid);let a=Array.isArray(e)?{[r[0]]:e[0],[r[1]]:e[1],[r[2]]:e[2]}:e;return F(i[n](a),`${P.invalidColor}: ${n}`),a}function vf(e,n=Xd,r=!0){let i=new Map(Object.entries(e));for(let[e,a]of i.entries())i.set(e,yf(a,n,r));return Object.fromEntries(i)}function yf(e,n=2,r=!0){if(!sf(e)||e===0)return 0;if(r){let r=10**n;return Math.round(e*r)/r}let i=Math.abs(Math.ceil(Math.log(Math.abs(e))/Math.LN10));i===0?i=2:i>n&&(i=n);let a=n-(i<0?0:i);a<=1&&n>1?a=2:(a>n||a===0)&&(a=n);let o=10**a;return Math.round(e*o)/o}function bf(e,n){return F(tf(e),P.inputHex),F(cf(n,0,1),P.alpha),n>=1?Cf(e):`${Cf(e)}${xf(n)}`}function xf(e){F(sf(e),P.inputNumber);let n=e;return e>1&&(n/=100),Math.round(n*255).toString(16).padStart(2,`0`)}function Sf(e){F(tf(e),P.inputString);let n=e.substring(7,9);return n?yf(parseInt(n,16)/255):1}function Cf(e){return F(tf(e),P.inputHex),e.length===5?e.substring(0,4):e.substring(0,7)}function wf(e){F(tf(e),P.inputHex);let n=ff(e).slice(1),r=Sf(e);return L({r:parseInt(n.charAt(0)+n.charAt(1),16),g:parseInt(n.charAt(2)+n.charAt(3),16),b:parseInt(n.charAt(4)+n.charAt(5),16)},r)}var Tf={};Vd(Tf,{hex2hsl:()=>Df,hex2oklab:()=>Mf,hex2oklch:()=>Lf,hex2rgb:()=>wf,hsl2hex:()=>Vf,hsl2oklab:()=>Hf,hsl2oklch:()=>Uf,hsl2rgb:()=>zf,oklab2hex:()=>qf,oklab2hsl:()=>Jf,oklab2oklch:()=>Ff,oklab2rgb:()=>Kf,oklch2hex:()=>$f,oklch2hsl:()=>ep,oklch2oklab:()=>Zf,oklch2rgb:()=>Qf,rgb2hex:()=>Bf,rgb2hsl:()=>Ef,rgb2oklab:()=>jf,rgb2oklch:()=>If});function Ef(e){let n=_f(e,`rgb`),r=hf(e),i=gf(n.r,`rgb`,`r`)/255,a=gf(n.g,`rgb`,`g`)/255,o=gf(n.b,`rgb`,`b`)/255,s=Math.min(i,a,o),c=Math.max(i,a,o),l=c-s,u=0,d,f=(c+s)/2,p;switch(c){case i:p=l?(a-o)/l:0,u=60*p;break;case a:p=(o-i)/l,u=60*p+120;break;case o:p=(i-a)/l,u=60*p+240}return u<0&&(u=360+u),d=s===c?0:f<.5?l/(2*f):l/(2-2*f),L({h:Math.abs(+(u%360).toFixed(2)),s:+(d*100).toFixed(2),l:+(f*100).toFixed(2)},r)}function Df(e){F(tf(e),P.inputHex);let n=Sf(e);return L(Ef(wf(e)),n)}var{cbrt:Of,sign:kf}=Math;function Af(e){let n=Math.abs(e);return n<.04045?e/12.92:(kf(e)||1)*((n+.055)/1.055)**2.4}function jf(e,n=Xd){let r=_f(e,`rgb`),i=hf(e),[a,o,s]=[Af(r.r/255),Af(r.g/255),Af(r.b/255)],c=Of(qd.l[0]*a+qd.l[1]*o+qd.l[2]*s),l=Of(qd.m[0]*a+qd.m[1]*o+qd.m[2]*s),u=Of(qd.s[0]*a+qd.s[1]*o+qd.s[2]*s);return L(vf({l:Jd.l[0]*c+Jd.l[1]*l-Jd.l[2]*u,a:Jd.a[0]*c-Jd.a[1]*l+Jd.a[2]*u,b:Jd.b[0]*c+Jd.b[1]*l-Jd.b[2]*u},n),i)}function Mf(e,n){F(tf(e),P.inputHex);let r=Sf(e);return L(jf(wf(e),n),r)}var{atan2:Nf,sqrt:Pf}=Math;function Ff(e,n){let{l:r,a:i,b:a}=vf(_f(e,`oklab`)),o=hf(e),s=Pf(i**2+a**2),c=(Nf(a,i)*Zd+360)%360;return yf(s*1e4)===0&&(c=0),L(vf({l:r,c:s,h:c},n),o)}function If(e,n){let r=_f(e,`rgb`),i=hf(e);return L(Ff(jf(r,n),n),i)}function Lf(e,n){F(tf(e),P.inputHex);let r=Sf(e);return L(If(wf(e),n),r)}function Rf(e,n,r){F(sf(e)&&sf(n)&&sf(r),P.hueArgs);let i=r;return i<0&&(i+=1),i>1&&--i,yf(i<1/6?e+(n-e)*6*i:i<1/2?n:i<2/3?e+(n-e)*(2/3-i)*6:e,4)}function zf(e){let n=_f(e,`hsl`),r=hf(e),i=yf(n.h)/360,a=yf(n.s)/100,o=yf(n.l)/100,s,c,l,u,d;return a===0?(s=o,c=o,l=o):(d=o<.5?o*(1+a):o+a-o*a,u=2*o-d,s=Rf(u,d,i+1/3),c=Rf(u,d,i),l=Rf(u,d,i-1/3)),L({r:Math.round(s*255),g:Math.round(c*255),b:Math.round(l*255)},r)}function Bf(e){let n=_f(e,`rgb`),r=hf(e),i=`#${[n.r,n.g,n.b].map(e=>`0${Math.floor(e).toString(16)}`.slice(-2)).join(``)}`;return r!==void 0&&r<1?bf(i,r):i}function Vf(e){let n=_f(e,`hsl`),r=hf(e),i=Bf(zf(n));return r!==void 0&&r<1?bf(i,r):i}function Hf(e,n){let r=_f(e,`hsl`),i=hf(e);return L(jf(zf(r),n),i)}function Uf(e,n){let r=_f(e,`hsl`),i=hf(e);return L(If(zf(r),n),i)}var{abs:Wf}=Math;function Gf(e){let n=Wf(e);return n>.0031308?(e<0?-1:1)*(n**(1/2.4)*1.055-.055):e*12.92}function Kf(e,n=0){let{l:r,a:i,b:a}=_f(e,`oklab`),o=hf(e),s=(r+Kd.l[0]*i+Kd.l[1]*a)**3,c=(r+Kd.m[0]*i+Kd.m[1]*a)**3,l=(r+Kd.s[0]*i+Kd.s[1]*a)**3,u=255*Gf(Yd.r[0]*s+Yd.r[1]*c+Yd.r[2]*l),d=255*Gf(Yd.g[0]*s+Yd.g[1]*c+Yd.g[2]*l),f=255*Gf(Yd.b[0]*s+Yd.b[1]*c+Yd.b[2]*l);return L({r:pf(yf(u,n),0,255),g:pf(yf(d,n),0,255),b:pf(yf(f,n),0,255)},o)}function qf(e){let n=_f(e,`oklab`),r=hf(e),i=Bf(Kf(n));return r!==void 0&&r<1?bf(i,r):i}function Jf(e){let n=_f(e,`oklab`),r=hf(e);return L(Ef(Kf(n)),r)}var{sin:Yf,cos:Xf}=Math;function Zf(e,n){let{l:r,c:i,h:a}=_f(e,`oklch`),o=hf(e);return(Number.isNaN(a)||a<0)&&(a=0),L(vf({l:r,a:i*Xf(a*Gd),b:i*Yf(a*Gd)},n),o)}function Qf(e,n=0){let r=_f(e,`oklch`),i=hf(e);return L(Kf(Zf(r),n),i)}function $f(e){let n=_f(e,`oklch`),r=hf(e),i=Bf(Qf(n));return r!==void 0&&r<1?bf(i,r):i}function ep(e){let n=_f(e,`oklch`),r=hf(e);return L(Ef(Qf(n)),r)}var tp=`(rgb|hsl|oklab|oklch)a?`,np=`(?:\\s*[,/]\\s*|\\s+)`,rp=`(none|[\\d%.-]+(?:deg|grad|rad|turn)?)`,ip=RegExp(`${tp}\\s*\\(\\s*${rp}${np}${rp}${np}${rp}(?:${np}${rp})?\\s*\\)`,`i`);function ap(e){let n=parseFloat(e),r;return r=e.endsWith(`grad`)?n*.9:e.endsWith(`rad`)?180/Math.PI*n:e.endsWith(`turn`)?n*360:n,Math.round(r*1e5)/1e5}function op(e){if(F(I(e),P.inputString),tf(e)){let n=Ud.rgb,{r,g:i,b:a}=wf(e),o=Sf(e);return{model:`rgb`,[n[0]]:r,[n[1]]:i,[n[2]]:a,alpha:o<1?o:void 0}}let n=ip.exec(e);F(ef(n),P.invalidCSS);let r=n[1],i=Ud[r],a=n[5]?parseFloat(n[5]):1;a>1&&(a/=100);let o=(e,n)=>{if(e===`none`)return 0;if(r===`hsl`&&n===0||r===`oklch`&&n===2)return ap(e);let i=parseFloat(e);if(!e.includes(`%`))return i;if(r===`oklch`){if(n===1)return i*.4/100}else if(r===`oklab`&&(n===1||n===2))return i*.4/100;return i},s=[o(n[2],0),o(n[3],1),o(n[4],2)];return r===`oklab`?(F(s[1]>=-.4&&s[1]<=.4,P.invalidRange),F(s[2]>=-.4&&s[2]<=.4,P.invalidRange)):r===`oklch`&&F(s[1]>=0&&s[1]<=.4,P.invalidRange),{model:r,[i[0]]:s[0],[i[1]]:s[1],[i[2]]:s[2],alpha:a<1?a:void 0}}var sp={oklab:Jf,oklch:ep,rgb:Ef},cp={hsl:Hf,oklch:Zf,rgb:jf},lp={hsl:Uf,oklab:Ff,rgb:If},up={hsl:zf,oklab:Kf,oklch:Qf},dp={hsl:Vf,oklab:qf,oklch:$f,rgb:Bf},fp={hsl:Df,oklab:Mf,oklch:Lf,rgb:wf},pp={hsl:sp,oklab:cp,oklch:lp,rgb:up};function mp(e,n){let{alpha:r,model:i,...a}=op(e);[`oklab`,`oklch`].includes(i)&&a.l>1&&(a.l=yf(a.l/100,Xd));let o=Object.values(a);if(n===`hex`){let e=r?xf(r):``;return`${dp[i](o)}${e}`}let s=pp[n]?.[i];return L(s?s(o):a,r)}function hp(e,n){let r=Sf(e);return n===`hex`?`${Cf(e)}${r===1?``:xf(r)}`:L(fp[n](e),r)}function R(e,n){F(I(e),P.inputString);let r=of(e)?Qd[e.toLowerCase()]:e,i=n??(tf(r)?`hex`:op(r).model);return tf(r)?hp(r,i):mp(r,i)}var gp=2.4,_p=.56,vp=.57,yp=.65,bp=.62,xp=.2126729,Sp=.7151522,Cp=.072175,wp=.022,Tp=1.414,Ep=1.14,Dp=1.14,Op=.027,kp=.027,Ap=.1,jp=5e-4;function Mp(e){return e>wp?e:e+(wp-e)**Tp}function Np(e,n,r){return xp*(e/255)**gp+Sp*(n/255)**gp+Cp*(r/255)**gp}function Pp(e,n){F(I(e),P.inputString),F(I(n),P.inputString);let r=wf(R(e,`hex`)),i=wf(R(n,`hex`)),a=Mp(Np(i.r,i.g,i.b)),o=Mp(Np(r.r,r.g,r.b));if(Math.abs(o-a)<jp)return 0;let s=o>a?(o**_p-a**vp)*Ep:(o**yp-a**bp)*Dp;return Math.abs(s)<Ap?0:yf(s>0?(s-Op)*100:(s+kp)*100,5)}function Fp(e,n,r=Xd){F(I(e),P.left),F(I(n),P.right);let i=R(e,`rgb`),a=R(n,`rgb`),o=(i.r*299+i.g*587+i.b*114)/1e3,s=(a.r*299+a.g*587+a.b*114)/1e3;return yf(Math.abs(s-o),r)}function Ip(e){F(I(e),P.inputString);let{r:n,g:r,b:i}=R(e,`rgb`);return yf((Math.max(n,r,i)-Math.min(n,r,i))/255,4)}function Lp(e,n){F(I(e),P.left),F(I(n),P.right);let r=R(e,`rgb`),i=R(n,`rgb`);return Math.max(r.r,i.r)-Math.min(r.r,i.r)+(Math.max(r.g,i.g)-Math.min(r.g,i.g))+(Math.max(r.b,i.b)-Math.min(r.b,i.b))}function Rp(e){F(I(e),P.inputString);let{r:n,g:r,b:i}=R(e,`rgb`),a=[n/255,r/255,i/255];for(let e=0;e<a.length;e++)a[e]<=.04045?a[e]/=12.92:a[e]=((a[e]+.055)/1.055)**2.4;return yf(.2126*a[0]+.7152*a[1]+.0722*a[2],4)}function zp(e,n){F(I(e),P.left),F(I(n),P.right);let r=Rp(e),i=Rp(n);return yf(r>=i?(r+.05)/(i+.05):(i+.05)/(r+.05))}function Bp(e,n){F(I(e),P.left),F(I(n),P.right);let r=Lp(e,n),i=zp(e,n),a=Fp(e,n),o=a>=125,s=r>=500,c=0;return o&&s?c=2:(o||s)&&(c=1),{brightnessDifference:a,colorDifference:r,compliant:c,contrast:i,largeAA:i>=3,largeAAA:i>=4.5,normalAA:i>=4.5,normalAAA:i>=7}}function Vp(e){if(tf(e)||of(e))return`hex`;if(nf(e))return`hsl`;if(rf(e))return`oklab`;if(af(e))return`oklch`;if(uf(e))return`rgb`;throw Error(P.invalid)}function Hp(e,n){let r=of(e)?Qd[e.toLowerCase()]:e,i=Vp(r);if(i===n)return r;let a=Tf[`${i}2${n}`];if(!a)throw Error(`Converter not found for ${i} to ${n}`);return a(r)}function Up(e,n={}){F(tf(e)||df(e),P.invalid);let{alpha:r,format:i=`hex`,precision:a=Xd,separator:o=` `}=n,s=r&&r!==1?`${yf(r*100)}%`:null,c=[],l=o;switch(i){case`hsl`:{let{h:n,s:r,l:i}=Hp(e,`hsl`);c=[n,`${r}%`,`${i}%`];break}case`oklab`:{l=` `;let{l:n,a:r,b:i}=vf(Hp(e,`oklab`),a);c=[`${yf(n*100,a)}%`,r,i];break}case`oklch`:{l=` `;let{l:n,c:r,h:i}=vf(Hp(e,`oklch`),a);c=[`${yf(n*100,a)}%`,r,i];break}case`rgb`:{let{r:n,g:r,b:i}=Hp(e,`rgb`);c=[n,r,i];break}default:{let n=Cf(Hp(e,`hex`));return r&&r!==1?`${n}${xf(r)}`:n}}return`${i}(${c.join(l)}${s?` / ${s}`:``})`}function Wp(e,n,r){return(i,a)=>{F(I(i),P.inputString),F(cf(a,0,100),P.amount);let o=R(i,`hsl`),s=tf(i)||of(i)?`hex`:op(i).model;return Up({...o,[e]:pf(o[e]+(n===`+`?a:-a),0,100)},{format:r??s})}}function Gp(e,n,r){return Wp(`l`,`-`,r)(e,n)}function Kp(e,n,r){return Wp(`s`,`-`,r)(e,n)}function qp(e,n){F(I(e),P.inputString);let r=tf(e)||of(e)?`hex`:op(e).model,i=R(e,`oklch`);return Up({...i,c:0},{format:n??r,alpha:i.alpha})}function Jp(e,n,r){F(I(e),P.inputString),F(cf(n,-360,360),P.degreesRange);let i=R(e,`hsl`),a=tf(e)||of(e)?`hex`:op(e).model;return Up({...i,h:mf(i.h,n)},{format:r??a})}function Yp(e){F(I(e),P.inputString);let n=tf(e)||of(e)?`hex`:op(e).model;return Up(Jp(R(e,`hex`),180),{format:n})}function Xp(e,n,r){return Wp(`l`,`+`,r)(e,n)}function Zp(e,n,r,i,a){if(r<1e-4)return n;if(i<1e-4)return e;let o=n-e;o>180?o-=360:o<-180&&(o+=360);let s=e+o*a;return s<0?s+=360:s>=360&&(s-=360),s}function Qp(e,n,r=.5,i){F(I(e),P.inputString),F(I(n),P.inputString),F(cf(r,0,1),P.ratioRange);let a=tf(e)||of(e)?`hex`:op(e).model,o=R(e,`oklch`),s=R(n,`oklch`),c=o.l+(s.l-o.l)*r,l=o.c+(s.c-o.c)*r,u=Zp(o.h,s.h,o.c,s.c,r),d=o.alpha??1,f=d+((s.alpha??1)-d)*r;return Up({l:c,c:l,h:u},{format:i??a,alpha:f<1?f:void 0})}function $p(e){F(!!e,P.input);let n={};if(I(e)){let{alpha:r=1}=op(e),i=tf(e)?`hex`:op(e).model;n.hex=bf(R(e,`hex`),r),n.hsl=L(R(e,`hsl`),r),n.oklab=L(R(e,`oklab`),r),n.oklch=L(R(e,`oklch`),r),n.rgb=L(R(e,`rgb`),r),n.alpha=r,n.type=i}else if(lf(e)){let{alpha:r=1}=e;if(nf(e))n.hsl={h:gf(e.h,`hsl`,`h`),s:gf(e.s,`hsl`,`s`),l:gf(e.l,`hsl`,`l`)},n.rgb=zf(n.hsl),n.oklab=Hf(n.hsl),n.oklch=Uf(n.hsl),n.type=`hsl`;else if(rf(e))n.hsl=Jf(e),n.oklab=e,n.oklch=Ff(e),n.rgb=Kf(e),n.type=`oklab`;else if(af(e))n.hsl=ep(e),n.oklab=Zf(e),n.oklch=e,n.rgb=Qf(e),n.type=`oklch`;else if(uf(e))n.rgb={r:gf(e.r,`rgb`,`r`),g:gf(e.g,`rgb`,`g`),b:gf(e.b,`rgb`,`b`)},n.hsl=Ef(n.rgb),n.oklab=jf(n.rgb),n.oklch=If(n.rgb),n.type=`rgb`;else throw Error(`invalid color`);n.hex=bf(Vf(n.hsl),r),n.hsl=L(n.hsl,r),n.oklab=L(n.oklab,r),n.oklch=L(n.oklch,r),n.rgb=L(n.rgb,r),n.alpha=r}else throw Error(P.input);return n}function em(e,n,r){F(I(e),P.inputString),F(cf(n,0,1),P.alpha);let i=tf(e)||of(e)?`hex`:op(e).model;return Up(R(e,`rgb`),{format:r??i,alpha:n})}function tm(e){if(F(I(e),P.inputString),tf(e))return Sf(e);if(Object.keys(Qd).includes(e))return 1;let{alpha:n}=op(e);return n||1}function nm(e,n,r,i){return e>=n?r:i}function rm(e,n={}){let{darkColor:r=`#000000`,lightColor:i=`#ffffff`,method:a=`yiq`,threshold:o}=n;switch(F(I(e),P.inputString),a){case`yiq`:{let n=o??128;F(n>=0&&n<=255,P.threshold);let{r:a,g:s,b:c}=wf(R(e,`hex`));return(a*299+s*587+c*114)/1e3>=n?r:i}case`wcag`:{let n=o??.5;return F(n>=0&&n<=1,P.thresholdNormalized),Rp(e)>=n?r:i}case`contrast`:return nm(zp(r,e),zp(i,e),r,i);case`oklab`:{let n=o??.5;F(n>=0&&n<=1,P.thresholdNormalized);let{l:a}=Mf(R(e,`hex`));return a>=n?r:i}case`apca`:return nm(Math.abs(Pp(e,r)),Math.abs(Pp(e,i)),r,i);default:throw Error(`Unknown method: ${a}`)}}function im(e,n,r){return Wp(`s`,`+`,r)(e,n)}function am(e,n,r){return F(I(e),P.inputString),F(cf(n,-1,1),P.alphaAdjustment),Up(R(e,`oklab`),{format:r,alpha:yf(pf(tm(e)-n,0,1))})}var om=class{constructor(e,n={}){Hd(this,`alpha`),Hd(this,`hex`),Hd(this,`hsl`),Hd(this,`oklab`),Hd(this,`oklch`),Hd(this,`rgb`),Hd(this,`type`),F(!!e,P.colorRequired);let{alpha:r,hex:i,hsl:a,oklab:o,oklch:s,rgb:c,type:l}=$p(e);this.hex=i,this.hsl=a,this.oklab=o,this.oklch=s,this.rgb=c,this.alpha=r,this.type=n.format??l}get css(){return this.currentColor}get red(){return this.rgb.r}get green(){return this.rgb.g}get blue(){return this.rgb.b}get hue(){return this.hsl.h}get saturation(){return this.hsl.s}get lightness(){return this.hsl.l}get luminance(){return Rp(this.currentColor)}get chroma(){return Ip(this.currentColor)}get opacity(){return tm(this.currentColor)}get readableColor(){return rm(this.currentColor)}get currentColor(){return Up(this[this.type],{format:this.type,alpha:this.alpha})}brightnessDifference(e){return Fp(this.currentColor,e)}colorDifference(e){return Lp(this.currentColor,e)}compare(e){return Bp(this.currentColor,e)}contrast(e){return zp(this.currentColor,e)}format(e,n){return Up(this.rgb,{alpha:this.alpha,format:e,precision:n})}lighten(e){return Xp(this.currentColor,e)}darken(e){return Gp(this.currentColor,e)}saturate(e){return im(this.currentColor,e)}desaturate(e){return Kp(this.currentColor,e)}grayscale(){return qp(this.currentColor)}invert(){return Yp(this.currentColor)}mix(e,n){return Qp(this.currentColor,e,n)}opacify(e=.9){return em(this.currentColor,e,this.type)}rotate(e){return Jp(this.currentColor,e)}transparentize(e=.1){return am(this.currentColor,e,this.type)}};function sm(e,n){return Up(R(e,n),{format:n})}function cm(e){return!(typeof e!=`object`||!(`h`in e)||!(`s`in e)||!(`l`in e)||!(`unit`in e)||!(`space`in e)||e.space!==`hsl`)}function lm(e){return typeof e!=`object`||!(`r`in e)||!(`g`in e)||!(`b`in e)||!(`space`in e)||!(`unit`in e)?!1:e.space===`srgb`}function um(e){if(typeof e!=`object`)throw TypeError(`Param 'v' is expected to be an object, got: ${typeof e}`);if(`r`in e&&`g`in e&&`b`in e){if(!(`unit`in e)){if(e.r<=1&&e.g<=1&&e.b<=1)e.unit=`scalar`;else if(e.r>255&&e.g<=255&&e.b<=255)return;else e.unit=`8bit`}return`space`in e||(e.space=`srgb`),e}}function dm(e){if(`h`in e&&`s`in e&&`l`in e){if(!(`unit`in e)){if(e.s<=1&&e.l<=1)e.unit=`scalar`;else if(e.s>100||e.l>100)return;else e.unit=`absolute`}return`space`in e||(e.space=`hsl`),e}}function fm(e){return typeof e!=`object`||!(`l`in e)||!(`c`in e)||!(`h`in e)||!(`unit`in e)||!(`space`in e)?!1:e.space===`lch`||e.space===`oklch`}function pm(e){return typeof e==`string`||typeof e==`object`&&!!(cm(e)||fm(e)||lm(e))}function mm(e,n,r=1){let i=-1,a=-1;n<e?(i=n-e,a=r-(e-n)):(i=n-e,a=i-r);let o=a>0?a:i,s=a>0?i:a;if(Math.abs(i)<Math.abs(a)){let e=a;a=i,i=e}return{long:i,short:a,forward:o,backward:s}}function hm(e){let n=e=>{let n=Math.floor(e).toString(16);return n.length===1?`0${n}`:n},r=`#${n(e.r)}${n(e.g)}${n(e.b)}`;return e.alpha!==void 0&&e.alpha!==255&&(r+=n(e.alpha)),r}function gm(e){return e%=1,e<0?(1-Math.abs(e))%1:e}var _m=Cr({absolute:()=>Nm,changeLightness:()=>ym,fromCss:()=>Cm,fromHexString:()=>Sm,generateScalar:()=>Om,guard:()=>Am,interpolator:()=>jm,parseCssHslFunction:()=>Pm,scalar:()=>Mm,toAbsolute:()=>Dm,toCssString:()=>wm,toHexString:()=>Tm,toLibraryRgb:()=>Fm,toScalar:()=>km,withOpacity:()=>vm});function vm(e,n){switch(e.unit){case`absolute`:return{...e,opacity:n((e.opacity??100)/100,e)*100};case`scalar`:return{...e,opacity:n(e.opacity??1,e)}}}function ym(e,n){let r=0;if(n.pdelta!==void 0)r=e.l+e.l*n.pdelta;else if(n.delta!==void 0)r=n.delta+e.l;else if(n.fixed!==void 0){if(n.fixed<0)throw TypeError(`Cannot use negative value with 'fixed'`);r=n.fixed}else throw TypeError(`Parameter 'amount' is missing 'delta/pdelta/fixed' properties`);return{...e,l:bm(e,r,`l`)}}function bm(e,n,r){return e.unit===`scalar`?n>1?n=1:n<0&&(n=0):n>100?n=100:n<0&&(n=0),n}const xm=Object.freeze({h:0,s:0,l:0,opacity:0,unit:`absolute`,space:`hsl`});function Sm(e,n={}){return Em(Df(e),n)}function Cm(e,n={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);if(e.startsWith(`#`))return Sm(e,n);if(e.startsWith(`--`))try{e=yh(e)}catch(r){if(n.fallbackString!==void 0&&(e=n.fallbackString),n.fallbackColour!==void 0)return n.fallbackColour;throw r}if(e===`transparent`)return xm;if(bh[e]!==void 0)return Sm(bh[e],n);if(e.startsWith(`rgb(`))return Em(eh(e),n);if(!e.startsWith(`hsl(`))try{e=sm(e,`hsl`)}catch(r){if(n.fallbackString)e=n.fallbackString;else throw r}try{let r=Pm(e);return n.scalar?km(r):Dm(r)}catch(e){if(n.fallbackColour)return n.fallbackColour;throw e}}function wm(e){let n=Dm(e),r=`hsl(${n.h}deg ${n.s}% ${n.l}%`;return`opacity`in n&&n.opacity!==void 0&&n.opacity<100&&(r+=` / ${n.opacity}%`),r+=`)`,r}function Tm(e){return hm(Fm(e))}function Em(e,n={}){if(e==null&&n.fallbackColour)return n.fallbackColour;let r=n.scalar??!0;return k(Ir(e.h,0,360,`h`),Ir(e.s,0,100,`s`),Ir(e.l,0,100,`l`),Pr(e.alpha??1,`alpha`)),r?Mm(e.h/360,e.s/100,e.l/100,e.alpha??1):Nm(e.h,e.s,e.l,(e.alpha??1)*100)}function Dm(e){if(typeof e==`string`)return Cm(e,{scalar:!1});if(lm(e))return Dm(Em(eh(e),{scalar:!1}));let n=e;return Am(n),n.unit===`absolute`?n:{h:n.h*360,s:n.s*100,l:n.l*100,opacity:(n.opacity??1)*100,unit:`absolute`,space:`hsl`}}function Om(e,n=1,r=.5,i=1){typeof e==`string`&&e.startsWith(`--`)&&(e=getComputedStyle(document.body).getPropertyValue(e).trim());let a=wi(e);if(n>1)throw TypeError(`Param 'saturation' must be between 0..1`);if(r>1)throw TypeError(`Param 'lightness' must be between 0..1`);if(i>1)throw TypeError(`Param 'opacity' must be between 0..1`);return{h:Ei(a,`deg`).value/360,s:n,l:r,opacity:i,unit:`scalar`,space:`hsl`}}function km(e){if(typeof e==`string`)return Cm(e,{scalar:!0});if(lm(e))return km(Em(eh(e),{scalar:!0}));let n=e;return Am(n),n.unit===`scalar`?n:{h:n.h/360,s:n.s/100,l:n.l/100,opacity:(n.opacity??1)/100,unit:`scalar`,space:`hsl`}}function Am(e){let{h:n,s:r,l:i,opacity:a,space:o,unit:s}=e;if(o!==`hsl`)throw Error(`Space is expected to be 'hsl'. Got: ${o}`);if(s===`absolute`)k(A(n,`finite`,`h`),Ir(r,0,100,`s`),Ir(i,0,100,`l`),()=>{if(typeof a==`number`)return Ir(a,0,100,`opacity`)});else if(s===`scalar`)k(A(n,`percentage`,`h`),A(r,`percentage`,`s`),A(i,`percentage`,`l`),()=>{if(typeof a==`number`)return A(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${s}`)}function jm(e,n,r=`shorter`){e=km(e),n=km(n);let i=e.opacity??1,a=mm(e.h,n.h,1),o=r===`longer`?a.long:a.short,s=n.s-e.s,c=n.l-e.l,l=(n.opacity??1)-i;return n=>{n=ri(n);let r=oi(n,0,Math.abs(o));r=o<0?e.h-r:e.h+r;let a=oi(n,0,s),u=oi(n,0,c),d=oi(n,0,l);return Mm(gm(r),a+e.s,u+e.l,d+i)}}function Mm(e=.5,n=1,r=.5,i=1){let a={unit:`scalar`,space:`hsl`,h:e,s:n,l:r,opacity:i};return Am(a),a}function Nm(e=200,n=100,r=50,i=100){let a={unit:`absolute`,space:`hsl`,h:e,s:n,l:r,opacity:i};return Am(a),a}function Pm(e){if(e.startsWith(`hsla`))throw Error(`hsla() is not supported`);if(!e.startsWith(`hsl(`))throw Error(`Expected hsl(..) CSS colour`);let n=e.indexOf(`(`),r=e.indexOf(`)`);if(r<n)throw Error(`Is hsl() not terminated? Missing ')'`);let i=e.substring(n+1,r).split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=!1;i[0].endsWith(`%`)&&(a=!0),i[1].endsWith(`%`)&&i[2].endsWith(`%`)&&(a=!0);let o=(e,n)=>{if(e===`none`)return 0;if(e.endsWith(`%`))return Number.parseFloat(e.substring(0,e.length-1))/100;e.endsWith(`deg`)&&n===0&&(e=e.substring(0,e.length-3));let r=Number.parseFloat(e);return n===0?r/360:n===3?r:r/100},s=(e,n)=>{if(e===`none`)return 0;if(e.endsWith(`%`)){let r=Number.parseFloat(e.substring(0,e.length-1));return n===0?r*360:r}return e.endsWith(`deg`)&&n===0?Number.parseFloat(e.substring(0,e.length-3)):Number.parseFloat(e)};return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a?Mm(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`100%`,3)):Nm(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`100%`,3))}function Fm(e){return typeof e==`string`?Fm(Cm(e,{scalar:!1})):(e=Dm(e),{...zf({h:e.h,s:e.s,l:e.l}),alpha:(e.opacity??100)/100*255})}var Im=Cr({changeLightness:()=>Jm,eightBit:()=>Xm,fromCss:()=>Bm,fromHexString:()=>Rm,guard:()=>qm,interpolator:()=>$m,lightness:()=>Ym,parseCssRgbFunction:()=>Qm,scalar:()=>Zm,to8bit:()=>Gm,toCssString:()=>Hm,toHexString:()=>Vm,toLibraryHsl:()=>eh,toScalar:()=>Km,withOpacity:()=>Lm});function Lm(e,n){switch(e.unit){case`8bit`:return{...e,opacity:n((e.opacity??255)/255,e)*255};case`scalar`:return{...e,opacity:n(e.opacity??1,e)}}}function Rm(e,n=!0){return Wm(wf(e),{scalar:n})}const zm=Object.freeze({r:0,g:0,b:0,opacity:0,unit:`8bit`,space:`srgb`});function Bm(e,n={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);let r=n.scalar??!0;if(e.startsWith(`#`))return Rm(e,r);if(e===`transparent`)return zm;if(bh[e]!==void 0)return Rm(bh[e],r);if(e.startsWith(`hsl(`))return Wm(Fm(e),n);if(!e.startsWith(`rgb(`))try{e=sm(e,`rgb`)}catch(r){if(n.fallbackString)e=n.fallbackString;else throw r}try{let n=Qm(e);return r?Km(n):Gm(n)}catch(e){if(n.fallbackColour)return n.fallbackColour;throw e}}function Vm(e){return hm(Um(e))}function Hm(e){switch(qm(e),e.unit){case`8bit`:return e.opacity===void 0||e.opacity===255?`rgb(${e.r} ${e.g} ${e.b})`:`rgb(${e.r} ${e.g} ${e.b} / ${(e.opacity??255)/255})`;case`scalar`:return e.opacity===void 0||e.opacity===1?`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}%)`:`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}% / ${(e.opacity??1)*100}%)`;default:throw Error(`Unknown unit: ${e.unit}`)}}function Um(e){let n=Gm(e);return{r:n.r,g:n.g,b:n.b,alpha:n.opacity}}function Wm(e,n={}){return n.scalar?{r:e.r/255,g:e.g/255,b:e.b/255,opacity:e.alpha??1,unit:`scalar`,space:`srgb`}:{r:e.r,g:e.g,b:e.b,opacity:e.alpha??255,unit:`8bit`,space:`srgb`}}function Gm(e){return typeof e==`string`?Bm(e,{scalar:!1}):cm(e)?Gm(Wm(Fm(e),{scalar:!1})):(qm(e),e.unit===`8bit`?e:{r:e.r*255,g:e.g*255,b:e.b*255,opacity:(e.opacity??1)*255,unit:`8bit`,space:`srgb`})}function Km(e){return typeof e==`string`?Bm(e,{scalar:!0}):cm(e)?Km(Wm(Fm(e),{scalar:!0})):(qm(e),e.unit===`scalar`?e:{r:e.r/255,g:e.g/255,b:e.b/255,opacity:(e.opacity??1)/255,unit:`scalar`,space:`srgb`})}function qm(e){let{r:n,g:r,b:i,opacity:a,space:o,unit:s}=e;if(o!==`srgb`)throw Error(`Space is expected to be 'srgb'. Got: ${o}`);if(s===`8bit`)k(Ir(n,0,255,`r`),Ir(r,0,255,`g`),Ir(i,0,255,`b`),()=>{if(typeof a==`number`)return Ir(a,0,255,`opacity`)});else if(s===`scalar`)k(A(n,`percentage`,`r`),A(r,`percentage`,`g`),A(i,`percentage`,`b`),()=>{if(typeof a==`number`)return A(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be '8bit' or 'scalar'. Got: ${s}`)}function Jm(e,n){let r=0,i=new om(Hm(e)),a=e.unit===`scalar`;if(n.pdelta!==void 0)r=i.oklab.l+i.oklab.l*n.pdelta;else if(n.delta!==void 0)r=i.oklab.l+n.delta;else if(n.fixed!==void 0){if(n.fixed<0)throw TypeError(`Amount cannot be negative when using 'fixed'`);r=n.fixed}else throw TypeError(`Parameter 'amount' is missing 'pdelta/delta/fixed' properties`);return r<0?r=0:r>1&&(r=1),Wm(Kf({a:i.oklab.a,b:i.oklab.b,l:r,alpha:i.oklab.alpha}),{scalar:a})}function Ym(e){return new om(Hm(e)).oklab.l}function Xm(e=100,n=100,r=100,i=255){let a={unit:`8bit`,space:`srgb`,r:e,g:n,b:r,opacity:i};return qm(a),a}function Zm(e=.5,n=.5,r=.5,i=1){let a={unit:`scalar`,space:`srgb`,r:e,g:n,b:r,opacity:i};return qm(a),a}function Qm(e){if(e.startsWith(`rgba`))throw Error(`RGBA is not supported`);if(!e.startsWith(`rgb(`))throw Error(`Expected rgb(..) CSS colour`);let n=e.indexOf(`(`),r=e.indexOf(`)`);if(r<n)throw Error(`Is rgb() not terminated? Missing ')'`);let i=e.substring(n+1,r).split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=0;for(let e of i)e.endsWith(`%`)&&a++;let o=(e,n)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100:n<3?Number.parseFloat(e)/255:Number.parseFloat(e),s=(e,n)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100*255:n<3?Number.parseFloat(e):Number.parseFloat(e)*255;return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a>1?Zm(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`1`,3)):Xm(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`1`,3))}function $m(e,n){let r=Km(e),i=Km(n),a=r.opacity??1,o=(i.opacity??1)-a,s=i.r-r.r,c=i.g-r.g,l=i.b-r.b;return e=>(e=ri(e),Zm(r.r+oi(e,0,s),r.g+oi(e,0,c),r.b+oi(e,0,l),a+oi(e,0,o)))}function eh(e){return typeof e==`string`?eh(Bm(e,{scalar:!1})):(e=Gm(e),{...Ef({r:e.r,g:e.g,b:e.b}),alpha:(e.opacity??255)/255})}var th=Cr({OKLCH_CHROMA_MAX:()=>nh,absolute:()=>_h,fromCss:()=>sh,fromHexString:()=>ah,fromLibrary:()=>ih,generateScalar:()=>ph,guard:()=>rh,interpolator:()=>hh,scalar:()=>gh,toAbsolute:()=>ch,toCssString:()=>dh,toHexString:()=>fh,toScalar:()=>lh,withOpacity:()=>mh});const nh=.4;function rh(e){let{l:n,c:r,h:i,opacity:a,space:o,unit:s}=e;if(o!==`oklch`)throw Error(`Space is expected to be 'oklch'. Got: ${o}`);if(s===`absolute`)k(Pr(n,`l`),()=>{if(typeof r==`number`)return Ir(r,0,nh,`c`)},()=>{if(typeof i==`number`)return Ir(i,0,360,`h`)},Pr(a??1,`opacity`));else if(s===`scalar`)k(Pr(n,`l`),Pr(r,`c`),Pr(i,`h`),Pr(e.opacity??1,`opacity`));else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${s}`)}function ih(e,n={}){if(e==null&&n.fallbackColour)return n.fallbackColour;let r=n.scalar??!0;return k(Pr(e.l,`l`),Pr(e.c,`c`),Ir(e.h,0,360,`h`),Pr(e.alpha??1,`alpha`)),r?gh(e.l,e.c/nh,e.h/360,e.alpha??1):_h(e.l,e.c,e.h,e.alpha??1)}function ah(e,n={}){return ih(Lf(e),n)}const oh=Object.freeze({l:0,c:0,h:0,opacity:0,unit:`absolute`,space:`oklch`});function sh(e,n={}){if(e=e.toLowerCase(),e.startsWith(`#`))return ah(e,n);if(e===`transparent`)return oh;if(bh[e]!==void 0)return ah(bh[e],n);if(e.startsWith(`rgb(`)){let r=Gm(Qm(e));return ih(If({r:r.r,g:r.g,b:r.b}),n)}if(!e.startsWith(`hsl(`)&&!e.startsWith(`oklch(`))try{e=sm(e,`oklch`)}catch(r){if(n.fallbackString)e=n.fallbackString;else throw r}let r=new om(e).oklch;return ih(r,n)}function ch(e){return typeof e==`string`?ch(sh(e,{scalar:!0})):(rh(e),e.unit===`absolute`?e:{space:`oklch`,unit:`absolute`,l:e.l,c:e.c*nh,h:e.h*360,opacity:e.opacity})}function lh(e){if(typeof e==`string`)return lh(sh(e,{scalar:!0}));let n=e;return rh(n),n.unit===`scalar`?n:{l:n.l,c:n.c/nh,h:n.h/360,opacity:n.opacity??1,unit:`scalar`,space:`oklch`}}function uh(e){let n=ch(e);return{l:n.l,c:n.c,h:n.h,alpha:n.opacity}}function dh(e,n=3){rh(e);let{l:r,c:i,h:a,opacity:o}=e,s=``;switch(e.unit){case`absolute`:s=`oklch(${(r*100).toFixed(n)}% ${i.toFixed(n)} ${a.toFixed(n)}`;break;case`scalar`:s=`oklch(${r.toFixed(n)} ${(i*nh).toFixed(n)} ${(a*360).toFixed(n)}`}return o!==void 0&&o!==1&&(s+=` / ${o.toFixed(n)}`),s+=`)`,s}function fh(e){return hm(Qf(uh(e)))}function ph(e,n=1,r=.5,i=1){if(typeof e==`string`&&e.startsWith(`--`)&&(e=getComputedStyle(document.body).getPropertyValue(e).trim()),r>1)throw TypeError(`Param 'lightness' must be between 0..1`);if(n>1)throw TypeError(`Param 'chroma' must be between 0..1`);let a=Ei(wi(e),`deg`).value/360;if(i>1)throw TypeError(`Param 'opacity' must be between 0..1`);return{l:r,c:n,h:a,opacity:i,unit:`scalar`,space:`oklch`}}function mh(e,n){switch(e.unit){case`absolute`:return{...e,opacity:n((e.opacity??100)/100,e)*100};case`scalar`:return{...e,opacity:n(e.opacity??1,e)}}}function hh(e,n,r=`shorter`){e=lh(e),n=lh(n);let i=e.opacity??1,a=mm(e.h,n.h,1),o=r===`longer`?a.long:a.short,s=n.c-e.c,c=n.l-e.l,l=(n.opacity??1)-i;return n=>{n=ri(n);let r=oi(n,0,Math.abs(o));r=o<0?e.h-r:e.h+r;let a=oi(n,0,s),u=oi(n,0,c),d=oi(n,0,l);return gh(u+e.l,a+e.c,gm(r),d+i)}}function gh(e=.7,n=.1,r=.5,i=1){let a={unit:`scalar`,space:`oklch`,l:e,c:n,h:r,opacity:i};return rh(a),a}function _h(e,n,r,i=1){let a={space:`oklch`,unit:`absolute`,opacity:i,l:e,c:n,h:r};return rh(a),a}const vh=e=>{if(e.startsWith(`#`))return Rm(e,!0);if(e.startsWith(`--`)){let n=getComputedStyle(document.body).getPropertyValue(e).trim();if(n.length===0||n===null)throw Error(`Variable missing: ${e}`);return vh(n)}let n=e.toLowerCase();if(bh[n]!==void 0)return Rm(bh[n],!0);if(n.startsWith(`hsl(`))return Cm(e,{scalar:!0});if(n.startsWith(`rgb(`))return Bm(e,{scalar:!0});if(n.startsWith(`oklch(`))return sh(e,{scalar:!0});throw Error(`String colour is not a hex colour, CSS variable nor well-defined colour. Input: '${e}'`)};function yh(e,n){if(e.startsWith(`--`)){let r=getComputedStyle(document.body).getPropertyValue(e).trim();if(r.length===0||r===null){if(n!==void 0)return n;throw Error(`CSS variable missing: '${e}'`)}return yh(r)}return bh[e]===void 0?e:bh[e]}const bh=Object.freeze({aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`,transparent:`#00000000`});function xh(e,n){if(n===`hsl-scalar`){if(typeof e==`string`||cm(e)||lm(e))return km(e)}else if(n===`hsl-absolute`){if(typeof e==`string`||cm(e))return Dm(e)}else if(n===`oklch-scalar`){if(typeof e==`string`||fm(e))return lh(e)}else if(n===`oklch-absolute`){if(typeof e==`string`||fm(e))return ch(e)}else if(n===`srgb-8bit`){if(typeof e==`string`||lm(e))return Gm(e)}else if(n===`srgb-scalar`){if(typeof e==`string`||lm(e))return Km(e)}else throw Error(`Destination '${n}' not supported for input: ${JSON.stringify(e)}`);return xh(wh(e),n)}function Sh(e,n){return wh(xh(e,n))}function Ch(e,n){if(n===`oklch`)return xh(e,`oklch-scalar`);if(n===`srgb`)return xh(e,`srgb-scalar`);if(n===`hsl`)return xh(e,`hsl-scalar`);throw Error(`Unknown destination: '${n}'`)}function wh(e){if(typeof e==`string`)return e;if(cm(e))return wm(e);if(lm(e))return Hm(e);if(fm(e))return dh(e);let n=um(e);if(n)return Hm(n);let r=dm(e);if(r)return wm(r);throw Error(`Unknown colour format: '${JSON.stringify(e)}'`)}function Th(e){if(cm(e))return Tm(e);if(lm(e))return Vm(e);if(fm(e))return fh(e);if(typeof e==`string`)return e.startsWith(`#`)?e:Vm(xh(e,`srgb-8bit`));let n=um(e);if(n)return Vm(n);let r=dm(e);if(r)return Tm(r);throw Error(`Unknown colour format: '${JSON.stringify(e)}'`)}function Eh(e){return new om(wh(e))}function Dh(e){switch(e.space){case`hsl`:Am(e);break;case`srgb`:qm(e);break;case`oklch`:rh(e);break;default:throw Error(`Unsupported colour space: '${e.space}'`)}}function Oh(e){if(!pm(e))throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc. Got: ${JSON.stringify(e)}`);let n;if(n=typeof e==`string`?vh(e):e,n===void 0)throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc.`);return Dh(n),n}function kh(...e){for(let n of e)if(n!=null)try{return wh(Oh(n))}catch{}return`rebeccapurple`}function Ah(e,n){let{r,g:i,b:a}=e,o=e.opacity??1;e.unit===`8bit`&&(r/=255,i/=255,a/=255);let s=Math.max(r,i,a),c=Math.min(r,i,a),l=(s+c)/2,u=l,d=l;if(s===c)return n?Mm(0,0,0,o):Nm(0,0,0,o);let f=s-c;switch(u=d>=.5?f/(2-(s+c)):f/(s+c),s){case r:l=((i-a)/f+0)*60;break;case i:l=((a-r)/f+2)*60;break;case a:l=((r-i)/f+4)*60}return n?Mm(l/360,u,d,o):Nm(l,u*100,d*100,o)}const jh=(e,n=.5,r=.75,i=1)=>(k(A(e,`positive`,`index`),A(n,`percentage`,`saturation`),A(r,`percentage`,`lightness`),A(i,`percentage`,`alpha`)),wm(Mm(e*137.508%360/360,n,r,i))),Mh=(e=Math.random)=>e()*360;function Nh(e,n={}){let r=n.direction??`shorter`,i=n.destination??`oklch-scalar`,a=n.space??`oklch`,o=Ph(e,a),s=o.map(e=>Lh(e[0],e[1],{space:a,direction:r,destination:i})),c=e.map(e=>xh(e,i));return e=>{if(e>=1)return c.at(-1);if(e<=0)return c.at(0);let n=fi(e,0,1,0,o.length),r=Math.floor(n),i=n-r,a=s[r];return a(i)}}function Ph(e,n=`hsl`){if(!Array.isArray(e))throw Error(`Param 'colours' is not an array as expected. Got: ${typeof e}`);if(e.length<2)throw Error(`Param 'colours' should be at least two in length. Got: ${e.length}`);return[...ei(e.map(e=>Ch(e,n)))]}function Fh(e){return`linear-gradient(to right, ${e.map(e=>wh(e)).join(`, `)})`}function Ih(e,n,r={}){let i=Lh(e,n,r);return e=>wh(i(e))}function Lh(e,n,r={}){let i=r.space??`oklch`,a=r.direction??`shorter`,o=r.destination??`oklch-scalar`,s;switch(i){case`hsl`:{let r=jm(xh(e,`hsl-scalar`),xh(n,`hsl-scalar`),a);s=e=>xh(r(e),o);break}case`srgb`:{let r=$m(xh(e,`srgb-scalar`),xh(n,`srgb-scalar`));s=e=>xh(r(e),o);break}default:{let r=hh(xh(e,`oklch-scalar`),xh(n,`oklch-scalar`),a);s=e=>xh(r(e),o)}}return e=>s(e)}function Rh(e,n={}){let r=n.direction??`shorter`,i=n.space??`oklch`,a=Ph(e,i),o=0;if(typeof n.stepsBetween==`number`){if(o=n.stepsBetween,o<1)throw Error(`Param 'stepsBetween' must be at least 1`)}else if(typeof n.stepsTotal==`number`){if(n.stepsTotal<=e.length)throw Error(`Param 'stepsTotal' must be greater than number of provided colour stops (${e.length}) +1 per stop`);let r=n.stepsTotal-e.length;o=Math.floor(r/a.length)}let s=a.map(e=>{let n=zh(e[0],e[1],{steps:o,space:i,direction:r,exclusive:!0});return n.push(e[1]),n}),c=a[0];return s.unshift([c[0]]),s.flat().map(e=>wh(e))}function zh(e,n,r={}){let i=r.exclusive??!1,a=r.steps??5,o=r.space??`oklch`,s=r.direction??`shorter`;if(!i&&a<2)throw Error(`Param 'steps' should be at least 2 when 'exclusive' is false`);if(i&&a<1)throw Error(`Param 'steps' should be at least 1 when 'exlusive' is true`);let c=Ch(e,o),l=Ch(n,o),u;switch(o){case`hsl`:u=jm(c,l,s);break;case`oklch`:u=hh(c,l,s);break;case`srgb`:u=$m(c,l);break;default:throw Error(`Colour space '${o}' not supported for interpolation.`)}if(!u)throw Error(`Could not create interpolator for space: ${o}`);let d=0,f=0,p=1;i?(d=1/(a+1),f=d,p=1-d):d=1/(a-1);let m=[];for(let e=f;e<=p;e+=d)m.push(u(e));return m}function Bh(e,n){return Vh(e,e=>ri(e*n))}function Vh(e,n){let r=Oh(e),i;switch(r.space){case`hsl`:i=vm(r,n);break;case`srgb`:i=Lm(r,n);break;case`oklch`:i=mh(r,n);break;default:throw Error(`Unknown space: '${r.space}'. Expected hsl, srgb, oklch`)}if(!i)throw Error(`Is colour in correct form?`);return typeof e==`string`?wh(i):i}function Hh(e,n){let r=Oh(e);return r.opacity=n,typeof e==`string`?wh(r):r}function Uh(e){return e.r<<16|e.g<<8|e.b}function Wh(e){if(e>16777215)throw TypeError(`Param 'colour' is out of range. Expected max value of 16_777_215, got ${e}`);return{r:e>>16&255,g:e>>8&255,b:e&255,unit:`8bit`,space:`srgb`}}function Gh(e){let n=e.r>>3&31,r=e.g>>2&63,i=e.b>>3&31;return n<<11|r<<5|i}function Kh(e){if(e>65535)throw TypeError(`Param 'colour' is out of range. Expected max: 65_535. Got: ${e}`);return{r:(e>>11&31)<<3,g:(e>>5&63)<<2,b:(e&31)<<3,unit:`8bit`,space:`srgb`}}var qh=Cr({eightBit:()=>Jh,fromCss:()=>eg,fromHexString:()=>$h,fromSrgTo8bit:()=>Xh,guard:()=>ng,scalar:()=>Yh,to8bit:()=>Qh,toHexString:()=>rg,toScalar:()=>tg,toSrgb8bit:()=>Zh});function Jh(e=100,n=100,r=100,i=255){let a={unit:`8bit`,space:`ycbcr`,y:e,cb:n,cr:r,opacity:i};return ng(a),a}function Yh(e=.5,n=.5,r=.5,i=1){let a={unit:`scalar`,space:`ycbcr`,y:e,cb:n,cr:r,opacity:i};return ng(a),a}function Xh(e){let{r:n,g:r,b:i,opacity:a}=Gm(e);return Jh(.299*n+.587*r+.114*i+0,-.169*n+-.331*r+.5*i+128,.5*n+-.419*r+-.081*i+128,a)}function Zh(e){let{y:n,cb:r,cr:i,opacity:a}=Qh(e);return{unit:`8bit`,space:`srgb`,r:1*n+0*(r-128)+1.4*(i-128),g:1*n+-.343*(r-128)+-.711*(i-128),b:1*n+1.765*(r-128)+0*(i-128),opacity:a}}function Qh(e){if(ng(e),e.unit===`8bit`)return e;let{y:n,cb:r,cr:i,opacity:a}=e;return Jh(n*255,r*255,i*255,typeof a==`number`?a*255:255)}function $h(e,n={}){return Xh(Rm(e,!1))}function eg(e,n={}){let r=n.scalar??!1,i=Bm(e,{fallbackString:n.fallbackString,scalar:!1,ensureSafe:n.ensureSafe});return r?tg(Xh(i)):Xh(i)}function tg(e){if(typeof e==`string`)return eg(e,{scalar:!0});if(cm(e)||lm(e))return tg(Xh(Km(e)));if(ng(e),e.unit===`scalar`)return e;let{y:n,cb:r,cr:i,opacity:a}=e;return Yh(n/255,r/255,i/255,typeof a==`number`?a/255:1)}function ng(e){let{y:n,cb:r,cr:i,opacity:a,space:o,unit:s}=e;if(o!==`ycbcr`)throw Error(`Space is expected to be 'ycbcr'. Got: ${o}`);if(s===`8bit`)k(Ir(n,0,255,`y`),Ir(r,0,255,`cb`),Ir(i,0,255,`cr`),()=>{if(typeof a==`number`)return Ir(a,0,255,`opacity`)});else if(s===`scalar`)k(A(n,`percentage`,`y`),A(r,`percentage`,`cb`),A(i,`percentage`,`cr`),()=>{if(typeof a==`number`)return A(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be '8bit' or 'scalar'. Got: ${s}`)}function rg(e){return Vm(Zh(e))}var ig=Cr({HslSpace:()=>_m,OklchSpace:()=>th,SrgbSpace:()=>Im,YCbCrSpace:()=>qh,convert:()=>xh,convertScalar:()=>Ch,convertToString:()=>Sh,createSteps:()=>zh,cssDefinedHexColours:()=>bh,cssLinearGradient:()=>Fh,decodeRgbFrom16Bit565:()=>Kh,decodeRgbFrom24Bit:()=>Wh,encodeRgbTo16Bit565:()=>Gh,encodeRgbTo24Bit:()=>Uh,fromCssColour:()=>vh,goldenAngleColour:()=>jh,guard:()=>Dh,interpolator:()=>Nh,interpolatorDual:()=>Lh,interpolatorDualToString:()=>Ih,isColourish:()=>pm,isHsl:()=>cm,isOkLch:()=>fm,isRgb:()=>lm,multiplyOpacity:()=>Bh,randomHue:()=>Mh,resolveCss:()=>yh,rgbToHsl:()=>Ah,scale:()=>Rh,setOpacity:()=>Hh,toColour:()=>Oh,toCssColour:()=>wh,toHexColour:()=>Th,toLibraryColour:()=>Eh,toStringFirst:()=>kh,tryParseObjectToHsl:()=>dm,tryParseObjectToRgb:()=>um,withOpacity:()=>Vh});const ag={l:[0,1],c:[0,.4],h:[0,360],a:[0,1]},og={l:ag.l,c:ag.c,h:ag.h,a:ag.a};function sg(e,n,r,i=1){return i<1?`oklch(${e} ${n} ${r} / ${i})`:`oklch(${e} ${n} ${r})`}function cg(e,n){e!=null&&(e.value=n)}var lg=class extends n{constructor(...e){super(...e),this.label=``,this.min=0,this.max=1,this.value=0,this.step=.01,this.precision=0,this.dragSensitivity=1,this.miniWidthThreshold=120,this.miniHeightThreshold=45,this.displayTextLogic=`transient`,this._isMini=!1,this._isDragging=!1,this._debounceTimer=void 0,this._handleNumberChange=e=>{let n=e.detail?.value??String(this.value),r=Number.parseFloat(n);this.value=r,this._syncValue(r),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:n},bubbles:!0,composed:!0}))},this._handleInputChange=e=>{let n=e.detail?.value??this.value;this.value=n,clearTimeout(this._debounceTimer),this._debounceTimer=window.setTimeout(()=>{this._isDragging=!1},300),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:String(n)},bubbles:!0,composed:!0}))},this._handleSliderInput=e=>{let n=e.detail?.value??this.value;console.log(`[LABELLED-INPUT] _handleSliderInput called`,{value:n,composedPath:e.composedPath()}),this.value=n,this._isDragging=!0,clearTimeout(this._debounceTimer),this.dispatchEvent(new CustomEvent(`input`,{detail:{value:n},bubbles:!0,composed:!0}))}}get formatter(){return this._formatter??(e=>e)}set formatter(e){this._formatter=e}get hasCustomFormatter(){return this._formatter!==void 0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(e=>this._handleResize(e)),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=void 0}_handleResize(e){let{width:n,height:r}=e[0].contentRect,i=getComputedStyle(this).getPropertyValue(`--mini`).trim();if(i===`1`){this._isMini=!0;return}if(i===`0`){this._isMini=!1;return}this._isMini=n<this.miniWidthThreshold||r<this.miniHeightThreshold}_syncValue(e){let n=this.renderRoot?.querySelector(this.inputSelector);n&&cg(n,e);let r=this.renderRoot?.querySelector(`ixfx-editable-number`);r&&(cg(r,e),r._requestDisplayUpdate?.())}_renderEditableNumber(){return this._isMini?a:i`
|
|
3341
3341
|
<ixfx-editable-number
|
|
3342
3342
|
class="number"
|
|
3343
3343
|
mode="label"
|
|
@@ -3353,7 +3353,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3353
3353
|
.formatter=${this._formatter}
|
|
3354
3354
|
@change=${this._handleNumberChange}
|
|
3355
3355
|
></ixfx-editable-number>
|
|
3356
|
-
`}updated(e){super.updated(e),e.has(`value`)&&this._syncValue(this.value)}};E([d()],
|
|
3356
|
+
`}updated(e){super.updated(e),e.has(`value`)&&this._syncValue(this.value)}};E([d()],lg.prototype,`label`,void 0),E([d({type:Number})],lg.prototype,`min`,void 0),E([d({type:Number})],lg.prototype,`max`,void 0),E([d({type:Number})],lg.prototype,`value`,void 0),E([d({type:Number})],lg.prototype,`step`,void 0),E([d({type:Number})],lg.prototype,`precision`,void 0),E([d({type:Number,attribute:`drag-sensitivity`})],lg.prototype,`dragSensitivity`,void 0),E([d({type:Number,attribute:`mini-width-threshold`})],lg.prototype,`miniWidthThreshold`,void 0),E([d({type:Number,attribute:`mini-height-threshold`})],lg.prototype,`miniHeightThreshold`,void 0),E([d({attribute:`display-text-logic`})],lg.prototype,`displayTextLogic`,void 0),E([m()],lg.prototype,`_isMini`,void 0),E([m()],lg.prototype,`_isDragging`,void 0),E([m()],lg.prototype,`_formatter`,void 0);let ug=class extends lg{constructor(...e){super(...e),this.inputSelector=`ixfx-range-input`,this.orientation=`horizontal`,this.tooltip=!1,this.noTooltip=!1,this.tooltipOrientation=`top`,this.lighttouch=!1,this.switchHeight=80}_renderEditableNumber(){return this._isMini?i``:i`
|
|
3357
3357
|
<ixfx-editable-number
|
|
3358
3358
|
class="number"
|
|
3359
3359
|
mode="label"
|
|
@@ -3460,7 +3460,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3460
3460
|
width: 100%;
|
|
3461
3461
|
height: 100%;
|
|
3462
3462
|
}
|
|
3463
|
-
`}};E([d({type:String})],
|
|
3463
|
+
`}};E([d({type:String})],ug.prototype,`orientation`,void 0),E([d({type:Boolean})],ug.prototype,`tooltip`,void 0),E([d({type:Boolean,attribute:`no-tooltip`})],ug.prototype,`noTooltip`,void 0),E([d({type:String,attribute:`tooltip-orientation`})],ug.prototype,`tooltipOrientation`,void 0),E([d({type:Boolean})],ug.prototype,`lighttouch`,void 0),E([d({type:Number,attribute:`switch-height`})],ug.prototype,`switchHeight`,void 0),ug=E([T(`ixfx-labelled-range-input`)],ug);let z=class extends n{constructor(...e){super(...e),this.l=.7,this.c=.15,this.h=180,this.a=1,this.hidePreview=!1,this.hideH=!1,this.hideL=!1,this.hideC=!1,this.showA=!1,this.horizontal=!1,this.slidersVertical=!1,this.hideTooltips=!1,this._valueAttr=null,this.rangeLAttr=null,this.rangeCAttr=null,this.rangeHAttr=null,this.rangeAAttr=null,this._ranges={l:og.l,c:og.c,h:og.h,a:og.a},this._defaultL=this.l,this._defaultC=this.c,this._defaultH=this.h,this._defaultA=this.a,this._userInitiated=new Set,this._onInput=(e,n)=>{let r=e.detail;this._userInitiated.add(n),this[n]=r.value,this._dispatchInput(),e.stopPropagation()},this._onChange=(e,n)=>{let r=e.detail;this._userInitiated.add(n);let i=typeof r.value==`string`?Number.parseFloat(r.value):r.value;switch(n){case`l`:this.l=i;break;case`c`:this.c=i;break;case`h`:this.h=i;break;case`a`:this.a=i}e.stopPropagation(),this.requestUpdate(),this._dispatchChange()}}get value(){return sg(this.l,this.c,this.h,this.a)}set value(e){let n=ig.convert(e,`oklch-absolute`);this.l=n.l,this.c=n.c,this.h=n.h,this.a=n.opacity??1,this._valueAttr=e}setColour(e){let n=ig.convert(e,`oklch-absolute`);this.l=n.l,this.c=n.c,this.h=n.h,this.a=n.opacity??1}get rangeL(){return[this._ranges.l[0],this._ranges.l[1]]}set rangeL(e){this._applyRangeInput(`l`,e)}get rangeC(){return[this._ranges.c[0],this._ranges.c[1]]}set rangeC(e){this._applyRangeInput(`c`,e)}get rangeH(){return[this._ranges.h[0],this._ranges.h[1]]}set rangeH(e){this._applyRangeInput(`h`,e)}get rangeA(){return[this._ranges.a[0],this._ranges.a[1]]}set rangeA(e){this._applyRangeInput(`a`,e)}setRangeL(e){this.rangeL=e}setRangeC(e){this.rangeC=e}setRangeH(e){this.rangeH=e}setRangeA(e){this.rangeA=e}willUpdate(e){e.has(`rangeLAttr`)&&this._setRangeFromAttribute(`l`,this.rangeLAttr),e.has(`rangeCAttr`)&&this._setRangeFromAttribute(`c`,this.rangeCAttr),e.has(`rangeHAttr`)&&this._setRangeFromAttribute(`h`,this.rangeHAttr),e.has(`rangeAAttr`)&&this._setRangeFromAttribute(`a`,this.rangeAAttr),super.willUpdate(e)}_applyRangeInput(e,n){let r=this._coerceRangeInput(e,n);r&&this._setRange(e,r)}_coerceRangeInput(e,n){if(!Array.isArray(n)||n.length<2)return null;let[r,i]=n;return!Number.isFinite(r)||!Number.isFinite(i)?null:this._normalizeRange(e,[r,i])}_setRangeFromAttribute(e,n){if(n===null){this._setRange(e,og[e]);return}let r=this._parseRangeString(e,n);r&&this._setRange(e,r)}_setRange(e,n){let r=this._normalizeRange(e,n),i=this._ranges[e];if(i[0]!==r[0]||i[1]!==r[1]){switch(this._ranges={...this._ranges,[e]:r},e){case`l`:this.l=this._clampToRange(`l`,this.l);break;case`c`:this.c=this._clampToRange(`c`,this.c);break;case`h`:this.h=this._clampToRange(`h`,this.h);break;case`a`:this.a=this._clampToRange(`a`,this.a)}this.requestUpdate()}}_getRange(e){return this._ranges[e]??og[e]}_parseRangeString(e,n){let r=n.trim().split(`-`,2);if(r.length!==2)return null;let i=Number(r[0].trim()),a=Number(r[1].trim());return!Number.isFinite(i)||!Number.isFinite(a)?null:this._normalizeRange(e,[i,a])}_normalizeRange(e,n){let r=og[e],[i,a]=n,o=Math.min(Math.min(i,a),r[1]),s=Math.max(Math.max(i,a),r[0]);return[Math.max(o,r[0]),Math.min(s,r[1])]}_clampToRange(e,n){let[r,i]=this._getRange(e);return Math.min(Math.max(n,r),i)}render(){let e=(e,n,r,o,s,c,l)=>c?a:i`
|
|
3464
3464
|
<ixfx-labelled-range-input
|
|
3465
3465
|
id="slider-${e}"
|
|
3466
3466
|
label="${n}"
|
|
@@ -3627,13 +3627,13 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3627
3627
|
min-height: 1.8em;
|
|
3628
3628
|
}
|
|
3629
3629
|
}
|
|
3630
|
-
`]}};E([d({type:Number})],
|
|
3630
|
+
`]}};E([d({type:Number})],z.prototype,`l`,void 0),E([d({type:Number})],z.prototype,`c`,void 0),E([d({type:Number})],z.prototype,`h`,void 0),E([d({type:Number})],z.prototype,`a`,void 0),E([d({type:Boolean,attribute:`hide-preview`,reflect:!0})],z.prototype,`hidePreview`,void 0),E([d({type:Boolean,attribute:`hide-h`,reflect:!0})],z.prototype,`hideH`,void 0),E([d({type:Boolean,attribute:`hide-l`,reflect:!0})],z.prototype,`hideL`,void 0),E([d({type:Boolean,attribute:`hide-c`,reflect:!0})],z.prototype,`hideC`,void 0),E([d({type:Boolean,attribute:`show-a`})],z.prototype,`showA`,void 0),E([d({type:Boolean,attribute:`horizontal`,reflect:!0})],z.prototype,`horizontal`,void 0),E([d({type:Boolean,attribute:`sliders-vertical`,reflect:!0})],z.prototype,`slidersVertical`,void 0),E([d({type:Boolean,attribute:`hide-tooltips`,reflect:!0})],z.prototype,`hideTooltips`,void 0),E([d({type:String,attribute:`value`})],z.prototype,`_valueAttr`,void 0),E([d({type:String,attribute:`range-l`})],z.prototype,`rangeLAttr`,void 0),E([d({type:String,attribute:`range-c`})],z.prototype,`rangeCAttr`,void 0),E([d({type:String,attribute:`range-h`})],z.prototype,`rangeHAttr`,void 0),E([d({type:String,attribute:`range-a`})],z.prototype,`rangeAAttr`,void 0),E([f(`#slider-l`)],z.prototype,`_sliderL`,void 0),E([f(`#slider-c`)],z.prototype,`_sliderC`,void 0),E([f(`#slider-h`)],z.prototype,`_sliderH`,void 0),E([f(`#slider-a`)],z.prototype,`_sliderA`,void 0),E([f(`.preview`)],z.prototype,`_previewEl`,void 0),z=E([T(`ixfx-colour-picker`)],z);let dg=0;const fg={small:{width:130,height:100},medium:{width:100,height:155},large:{width:200,height:180},huge:{width:290,height:240}};function pg(e,n,r,i){return i<1?`
|
|
3631
3631
|
linear-gradient(oklch(${e} ${n} ${r} / ${i}), oklch(${e} ${n} ${r} / ${i})),
|
|
3632
3632
|
repeating-conic-gradient(
|
|
3633
3633
|
var(--surface-2) 0% 25%,
|
|
3634
3634
|
var(--surface-4) 0% 50%
|
|
3635
3635
|
) 50% / 8px 8px
|
|
3636
|
-
`:
|
|
3636
|
+
`:sg(e,n,r)}let mg=class extends n{constructor(){super(),this.mode=`fluid`,this.l=.7,this.c=.15,this.h=180,this.a=1,this.showPreview=!1,this.hideH=!1,this.hideL=!1,this.hideC=!1,this.showA=!1,this.horizontal=!1,this.size=`medium`,this._isOpen=!1,this._everOpened=!1,this._hasAction=!1,this._pendingL=this.l,this._pendingC=this.c,this._pendingH=this.h,this._pendingA=this.a,this._savedL=this.l,this._savedC=this.c,this._savedH=this.h,this._savedA=this.a,this._pendingConfirmed=!1,this._onPopoverToggle=e=>{let n=e;this._isOpen=n.newState===`open`,n.newState===`open`?(this._savedL=this.l,this._savedC=this.c,this._savedH=this.h,this._savedA=this.a,this._pendingL=this.l,this._pendingC=this.c,this._pendingH=this.h,this._pendingA=this.a,this._pendingConfirmed=!1):this.mode===`confirm`&&!this._pendingConfirmed&&this._pickerEl?.setColour(sg(this._savedL,this._savedC,this._savedH,this._savedA))},this._onPickerInput=e=>{e.stopPropagation();let n=e.detail;if(this.mode===`confirm`){this._pendingL=n.l,this._pendingC=n.c,this._pendingH=n.h,this._pendingA=n.a??1;return}this.l=n.l,this.c=n.c,this.h=n.h,this.a=n.a??1,this._dispatchInput()},this._onPickerChange=e=>{e.stopPropagation();let n=e.detail;if(this.mode===`confirm`){this._pendingL=n.l,this._pendingC=n.c,this._pendingH=n.h,this._pendingA=n.a??1;return}this.l=n.l,this.c=n.c,this.h=n.h,this.a=n.a??1,this._dispatchChange()},this._onConfirm=()=>{this.l=this._pendingL,this.c=this._pendingC,this.h=this._pendingH,this.a=this._pendingA,this._pendingConfirmed=!0,this._dispatchChange();try{this._popupEl.hidePopover()}catch{}},this._onActionSlotChange=e=>{this._hasAction=e.target.assignedNodes().length>0},this._onSwatchClick=async()=>{this._everOpened||(this._everOpened=!0,await this.updateComplete);try{this._popupEl.showPopover()}catch{}};let e=++dg;this._uid=`cp-popup-${e}`,this._anchorName=`--cp-popup-anchor-${e}`,this._popupId=`cp-popup-panel-${e}`}get value(){return sg(this.l,this.c,this.h,this.a)}set value(e){this.setColour(e)}get _innerHidePreview(){return this.mode===`fluid`&&!this.showPreview}get _pickerDimensions(){return fg[this.size]??fg.medium}setColour(e){let n=ig.convert(e,`oklch-absolute`);this.l=n.l,this.c=n.c,this.h=n.h,this.a=n.opacity??1}firstUpdated(e){super.firstUpdated(e),this._applyAnchorPositioning(),this._updateSwatchBackground()}updated(e){super.updated(e),(e.has(`l`)||e.has(`c`)||e.has(`h`)||e.has(`a`))&&this._updateSwatchBackground()}_applyAnchorPositioning(){let e=this.shadowRoot?.querySelector(`.swatch`);e&&e.style.setProperty(`anchor-name`,this._anchorName),this._popupEl&&this._popupEl.style.setProperty(`position-anchor`,this._anchorName)}_updateSwatchBackground(){let e=this.shadowRoot?.querySelector(`.swatch`);e&&(e.style.background=pg(this.l,this.c,this.h,this.a))}close(){try{this._popupEl.hidePopover()}catch{}}_dispatchInput(){let e={l:this.l,c:this.c,h:this.h,a:this.a,unit:`scalar`,space:`oklch`};this.dispatchEvent(new CustomEvent(`input`,{detail:e,bubbles:!0,composed:!0}))}_dispatchChange(){let e={l:this.l,c:this.c,h:this.h,a:this.a,unit:`scalar`,space:`oklch`};this.dispatchEvent(new CustomEvent(`change`,{detail:e,bubbles:!0,composed:!0}))}render(){return i`
|
|
3637
3637
|
<button
|
|
3638
3638
|
class="swatch"
|
|
3639
3639
|
@click=${this._onSwatchClick}
|
|
@@ -3671,7 +3671,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3671
3671
|
<slot name="action" @slotchange=${this._onActionSlotChange}></slot>
|
|
3672
3672
|
${this.mode===`confirm`?i`
|
|
3673
3673
|
<button class="confirm-btn" @click=${this._onConfirm} aria-label="Confirm colour" title="Confirm colour">
|
|
3674
|
-
${g(
|
|
3674
|
+
${g(nn)}
|
|
3675
3675
|
</button>
|
|
3676
3676
|
`:a}
|
|
3677
3677
|
</div>
|
|
@@ -3824,7 +3824,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3824
3824
|
outline: 2px solid var(--accent, oklch(60% 0.15 140));
|
|
3825
3825
|
outline-offset: 2px;
|
|
3826
3826
|
}
|
|
3827
|
-
`]}};E([d({type:String})],
|
|
3827
|
+
`]}};E([d({type:String})],mg.prototype,`mode`,void 0),E([d({type:Number})],mg.prototype,`l`,void 0),E([d({type:Number})],mg.prototype,`c`,void 0),E([d({type:Number})],mg.prototype,`h`,void 0),E([d({type:Number})],mg.prototype,`a`,void 0),E([d({type:Boolean,attribute:`show-preview`})],mg.prototype,`showPreview`,void 0),E([d({type:Boolean,attribute:`hide-h`,reflect:!0})],mg.prototype,`hideH`,void 0),E([d({type:Boolean,attribute:`hide-l`,reflect:!0})],mg.prototype,`hideL`,void 0),E([d({type:Boolean,attribute:`hide-c`,reflect:!0})],mg.prototype,`hideC`,void 0),E([d({type:Boolean,attribute:`show-a`})],mg.prototype,`showA`,void 0),E([d({type:Boolean,attribute:`horizontal`})],mg.prototype,`horizontal`,void 0),E([d({type:String})],mg.prototype,`size`,void 0),E([m()],mg.prototype,`_isOpen`,void 0),E([m()],mg.prototype,`_everOpened`,void 0),E([m()],mg.prototype,`_hasAction`,void 0),E([f(`.popup`)],mg.prototype,`_popupEl`,void 0),E([f(`ixfx-colour-picker`)],mg.prototype,`_pickerEl`,void 0),mg=E([T(`ixfx-colour-picker-popup`)],mg);async function hg(e,n){if(Array.isArray(e))return e;if(Symbol.asyncIterator in new Object(e)){let r=[];for await(let i of e){if(n.aborted)return r;i.replace&&(r.length=0),r.push(...i.items)}return r}return e}function gg(e,n){if(e.item.key===n)return e;for(let r of e.children??[]){let e=gg(r,n);if(e)return e}}function _g(e,n,r=void 0){for(let i of e.children??[]){if(i.item.key===n)return r===void 0?e:r;let a=_g(i,n,i);if(a)return a}}function vg(e,n,r){let i=gg(e,n);return i!==void 0&&gg(i,r)!==void 0}function yg(e,n){return e.children?{...e,children:e.children.filter(e=>!n.has(e.item.key)).map(e=>yg(e,n))}:e}function bg(e,n){return n===void 0?e.children??[]:gg(e,n)?.children??[]}function xg(e,n,r){return n===void 0||e.item.key===n?{...e,children:r}:e.children?{...e,children:e.children.map(e=>xg(e,n,r))}:e}function Sg(e,n,r){return Math.max(n,Math.min(r,e))}function Cg(e,n){let r=new Set(n);return n.filter(n=>{let i=_g(e,n);for(;i;){if(r.has(i.item.key))return!1;i=_g(e,i.item.key)}return!0})}function wg(e,n){let{target:r,source:i}=n,a,o=new Set;if(i===`internal`){let i=Cg(e,[...n.draggedKeys]);if(i.length===0)return e;if(r.parentKey!==void 0){for(let n of i)if(vg(e,n,r.parentKey))return e}if(r.position!==`inside`){for(let n of i)if(vg(e,n,r.referenceKey))return e}let s=i.map(n=>gg(e,n));if(s.includes(void 0))return e;a=s,o=new Set(i)}else if(a=(n.dragged??[]).map(e=>({...e})),a.length===0)return e;let s=o.size>0?yg(e,o):e,c,l;if(r.position===`inside`){if(gg(s,r.referenceKey)===void 0)return e;c=r.referenceKey;let n=bg(s,c);l=Sg(r.index,0,n.length)}else{c=_g(s,r.referenceKey)?.item.key;let n=bg(s,c).findIndex(e=>e.item.key===r.referenceKey);if(n<0)return e;l=r.position===`before`?n:n+1}let u=[...bg(s,c)],d=[...u.slice(0,l),...a,...u.slice(l)];return xg(s,c,d)}function Tg(e,n,r=n===`inside`?2**53-1:0){return{referenceKey:e,position:n,index:r,parentKey:n===`inside`?e:void 0,depth:0}}function Eg(e,n,r){return e.item.key===n?r(e):e.children?{item:e.item,children:e.children.map(e=>Eg(e,n,r))}:e}function Dg(e,n,r){return Eg(e,n,e=>({item:e.item,children:[...e.children??[],r]}))}function Og(e,n){return e.children?{item:e.item,children:e.children.filter(e=>e.item.key!==n).map(e=>Og(e,n))}:e}function kg(e,n,r,i){return Eg(e,n,e=>{let n=e.children??[],a=Math.max(0,Math.min(i,n.length));return{item:e.item,children:[...n.slice(0,a),r,...n.slice(a)]}})}function Ag(e){return e.children??[]}var jg=class{#e;#t;#n=new Map;#r=new Set;constructor(e){this.#e=e.root,this.#t=e.loadChildren}get root(){return this.#e}setRoot(e){this.#e=e,this.#n.clear(),this.#i({type:`root`,root:e})}async getChildren(e,n,r){let i=e.item.key;if(this.#n.has(i))return this.#n.get(i);if(!this.#t)return[];let a=[...await hg(this.#t({node:e,depth:n},r),r)];return r.aborted||this.#n.set(i,a),a}invalidate(e){this.#n.delete(e),this.#i({type:`invalidate`,key:e})}addNode(e,n){return this.#e=Dg(this.#e,e,n),this.#i({type:`root`,root:this.#e}),this.#e}removeNode(e){return this.#n.delete(e),this.#e=Og(this.#e,e),this.#i({type:`root`,root:this.#e}),this.#e}updateItem(e,n){return this.#e=Eg(this.#e,e,e=>({item:{...e.item,...n},children:e.children})),this.#i({type:`root`,root:this.#e}),this.#e}moveNode(e,n,r){let i=wg(this.#e,{source:`internal`,draggedKeys:[e],target:Tg(n,`inside`,r??2**53-1)});return i!==this.#e&&(this.#e=i,this.#i({type:`root`,root:this.#e})),this.#e}moveNodeRelative(e,n,r){let i=wg(this.#e,{source:`internal`,draggedKeys:[e],target:Tg(n,r)});return i!==this.#e&&(this.#e=i,this.#i({type:`root`,root:this.#e})),this.#e}applyDrop(e){let n=wg(this.#e,e);return n!==this.#e&&(this.#e=n,this.#i({type:`root`,root:this.#e})),this.#e}insertNode(e,n,r){if(e===void 0){let e=Ag(this.#e),i=Math.max(0,Math.min(r??e.length,e.length));this.#e={...this.#e,children:[...e.slice(0,i),n,...e.slice(i)]}}else this.#e=r===void 0?Dg(this.#e,e,n):kg(this.#e,e,n,r);return this.#i({type:`root`,root:this.#e}),this.#e}_subscribe(e){return this.#r.add(e),()=>this.#r.delete(e)}#i(e){for(let n of this.#r)n(e)}};function Mg(e){let n=`scroll-fade-${e}`,i=`--${n}-start`,a=`--${n}-end`,o=`--${n}-timeline`,s=`${n}-fade`,l=e===`x`?`to right`:`to bottom`;return r`
|
|
3828
3828
|
@property ${c(i)} {
|
|
3829
3829
|
syntax: '<length>';
|
|
3830
3830
|
inherits: false;
|
|
@@ -3857,7 +3857,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
3857
3857
|
black calc(100% - var(--scroll-fade-inset-end, 0px))
|
|
3858
3858
|
);
|
|
3859
3859
|
}
|
|
3860
|
-
`}const
|
|
3860
|
+
`}const Ng=`narrowed-text-highlight`;let Pg=class extends n{constructor(...e){super(...e),this.selectionMode=`single`,this.requiredSelection=!1,this.orientation=`horizontal`,this.nowrap=!1,this.separator=` `,this.preserveFilter=!1,this.value=``,this.registry=void 0,this._query=``,this._computedItems=[],this._filteredItems=[],this._isFocused=!1,this._selectedValues=new Set,this._search=Et({selector:e=>e.label??e.value}),this.tickled=new oe(this,{getItems:()=>this._filteredItems.map((e,n)=>({id:n,enabled:!0})),onTickle:e=>{if(e===void 0||!this.shadowRoot)return;let n=this.shadowRoot.querySelector(`.items`);if(!n)return;let r=n.querySelectorAll(`.item`)[e];r&&r.scrollIntoView({block:`nearest`,inline:`nearest`})}}),this.#e=()=>{this._updateComputedItems()},this.#t=e=>{let n=e.target;this._query=n.value,this._query.trim()&&this._filteredItems.length>0?this.tickled.setTickled(0):this.tickled.clearTickled(),this._updateFilteredItems()},this.#n=e=>{if(this._filteredItems.length!==0)switch(e.key){case`Tab`:e.shiftKey&&(e.preventDefault(),this.dispatchEvent(new CustomEvent(`narrowed-text-shift-tab`,{bubbles:!0,composed:!0})));return;case`ArrowRight`:{if(this.orientation!==`horizontal`)return;let n=this.tickled.tickledId,r=this._filteredItems.length-1;if(n!==void 0&&n>=r)return;e.preventDefault(),this.tickled.handleKeyboardNavigation(`next`);break}case`ArrowLeft`:{if(this.orientation!==`horizontal`)return;let n=this.tickled.tickledId;if(n!==void 0&&n<=0)return;e.preventDefault(),this.tickled.handleKeyboardNavigation(`previous`);break}case`ArrowDown`:{if(this.orientation!==`vertical`)return;let n=this.tickled.tickledId,r=this._filteredItems.length-1;if(n!==void 0&&n>=r)return;e.preventDefault(),this.tickled.handleKeyboardNavigation(`next`);break}case`ArrowUp`:{if(this.orientation!==`vertical`)return;let n=this.tickled.tickledId;if(n!==void 0&&n<=0)return;e.preventDefault(),this.tickled.handleKeyboardNavigation(`previous`);break}case`Enter`:{e.preventDefault();let n=this._filteredItems[this.tickled.tickledId??-1];n&&(this._selectItem(n,!1),this._query=``,this._updateFilteredItems());break}case` `:e.preventDefault(),this.tickled.tickledId!==void 0&&this._filteredItems[this.tickled.tickledId]&&this._selectItem(this._filteredItems[this.tickled.tickledId],!1);break;case`Escape`:e.preventDefault(),this._query=``,this.tickled.clearTickled(),this._updateFilteredItems()}},this.#r=()=>{this._isFocused=!0,this._query.trim()&&this._filteredItems.length>0&&this.tickled.setTickled(0)},this.#i=()=>{let e=this.shadowRoot?.querySelector(`.search-input`);e&&requestAnimationFrame(()=>{e.focus()})},this.#a=()=>{this._isFocused=!1,this.tickled.clearTickled(),this.dispatchEvent(new CustomEvent(`narrowed-text-blur`,{bubbles:!0,composed:!0}))},this.#o=()=>{(this.shadowRoot?.querySelector(`.search-input`))?.focus()},this.#s=e=>{let n=e.target;n.classList.contains(`item`)||n.closest(`.item`)||(this.shadowRoot?.querySelector(`.search-input`))?.focus()}}get selected(){return this.selectionMode===`single`?this._selectedValues.values().next().value??``:[...this._selectedValues]}set selected(e){this.selectionMode===`single`?(this._selectedValues.clear(),e&&this._selectedValues.add(e)):(this._selectedValues.clear(),Array.isArray(e)&&e.forEach(e=>this._selectedValues.add(e))),this._updateFilteredItems()}selectAll(){let e=this._filteredItems;if(e.length!==0){if(this.selectionMode===`single`)this._selectedValues.clear(),this._selectedValues.add(e[0].value);else{this._selectedValues.clear();for(let n of e)this._selectedValues.add(n.value)}this._updateValueFromSelected(),this._updateFilteredItems(),this.dispatchEvent(new CustomEvent(`change`,{detail:{item:void 0,query:this._query,selected:this._computedItems.filter(e=>this._selectedValues.has(e.value))},bubbles:!0,composed:!0}))}}deselectAll(){this.requiredSelection&&this._selectedValues.size<=1||this._selectedValues.size!==0&&(this._selectedValues.clear(),this._updateValueFromSelected(),this._updateFilteredItems(),this.dispatchEvent(new CustomEvent(`change`,{detail:{item:void 0,query:this._query,selected:[]},bubbles:!0,composed:!0})))}connectedCallback(){super.connectedCallback(),this._unsubSearch=this._search.onChange(e=>{let n=e.results.map(e=>e.item);for(let e of this._computedItems)this._selectedValues.has(e.value)&&!n.includes(e)&&n.push(e);this._filteredItems=n,this._searchState=e,this.requestUpdate()}),this.addEventListener(`narrowed-text-init`,()=>this.#i());let e=this._ownedRegistry=Jt();e.register({id:`select-all`,label:`Select All`,description:`Select every currently-filtered item (or first in single mode)`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e}disconnectedCallback(){super.disconnectedCallback(),this._unsubSearch?.(),this._search.dispose(),re({key:Ng}),this.removeEventListener(`narrowed-text-init`,()=>this.#i()),this._ownedRegistry&&(this._ownedRegistry.unregister(`select-all`),this._ownedRegistry.unregister(`deselect-all`),this._ownedRegistry=void 0,this.registry=void 0)}firstUpdated(){this._updateComputedItems()}updated(e){e.has(`value`)&&this._updateSelectedFromValue(),this._applyHighlights()}#e;_updateComputedItems(){let e=this.querySelectorAll(`[data-value]`),n=[];e.forEach(e=>{let r=e.getAttribute(`data-value`)??``,i=e.getAttribute(`data-label`)??e.textContent?.trim()??r,a=e.getAttribute(`data-description`)??void 0,o=e.getAttribute(`data-icon-name`)??void 0;n.push({value:r,label:i,description:a,iconName:o})}),this._computedItems=n,this._search.setItems(n)}_updateSelectedFromValue(){if(this.selectionMode===`single`)this._selectedValues.clear(),this.value&&this._selectedValues.add(this.value);else{let e=this.value.split(`,`).filter(e=>e.trim());this._selectedValues.clear(),e.forEach(e=>this._selectedValues.add(e.trim()))}this._updateFilteredItems()}_updateFilteredItems(){this._search.setQuery(this._query)}_applyHighlights(){if(!this._query.trim()||!this._searchState||!this.shadowRoot){re({key:Ng});return}ne(ie(this.shadowRoot,`.item-label`,this._searchState.positionsByItem,e=>{let n=e.getAttribute(`data-item-value`);return this._computedItems.find(e=>e.value===n)},e=>{let n=e.getAttribute(`data-item-value`),r=this._computedItems.find(e=>e.value===n);return r?.label??r?.value??``}),{key:Ng})}#t;#n;#r;#i;focus(){let e=this.shadowRoot?.querySelector(`.search-input`);e?e.focus():super.focus()}blur(){let e=this.shadowRoot?.querySelector(`.search-input`);e?e.blur():super.blur()}setContents(e){for(;this.firstChild;)this.firstChild.remove();for(let n of e){let e=document.createElement(`span`);e.setAttribute(`data-value`,n.value),n.label!==void 0&&e.setAttribute(`data-label`,n.label),n.description!==void 0&&e.setAttribute(`data-description`,n.description),n.iconName!==void 0&&e.setAttribute(`data-icon-name`,n.iconName),this.appendChild(e)}this._selectedValues.clear();let n=e.filter(e=>e.selected).map(e=>e.value);for(let e of n)this._selectedValues.add(e);n.length>0&&this.requestUpdate()}deleteItem(e){let n=this.querySelector(`[data-value="${CSS.escape(e)}"]`);return n?(n.remove(),this._selectedValues.delete(e),!0):!1}#a;#o;#s;#c(e){this._selectItem(e);let n=this._filteredItems.findIndex(n=>n.value===e.value);n>=0&&this.tickled.handlePointerEnter(n),(this.shadowRoot?.querySelector(`.search-input`))?.focus()}_selectItem(e,n=!0){this.selectionMode===`single`?this._selectedValues.has(e.value)&&!this.requiredSelection?this._selectedValues.clear():(this._selectedValues.clear(),this._selectedValues.add(e.value)):this._selectedValues.has(e.value)?(!this.requiredSelection||this._selectedValues.size>1)&&this._selectedValues.delete(e.value):this._selectedValues.add(e.value),this._updateValueFromSelected(),this._updateFilteredItems();let r=this._computedItems.filter(e=>this._selectedValues.has(e.value));this.dispatchEvent(new CustomEvent(`change`,{detail:{item:e,query:this._query,selected:r},bubbles:!0,composed:!0})),n&&!this.preserveFilter&&this._query&&(this._query=``,this._updateFilteredItems())}_updateValueFromSelected(){this.value=this.selectionMode===`single`?[...this._selectedValues][0]??``:[...this._selectedValues].join(`,`)}#l(e,n){let r=this.tickled.isTickled(n),o=this._selectedValues.has(e.value),s=e.label??e.value;return i`
|
|
3861
3861
|
<div
|
|
3862
3862
|
class="item ${r?`tickled`:``} ${o?`selected`:``}"
|
|
3863
3863
|
part="item"
|
|
@@ -4038,21 +4038,21 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
4038
4038
|
border-radius: 2px;
|
|
4039
4039
|
padding: 0 1px;
|
|
4040
4040
|
}
|
|
4041
|
-
`]}};E([d({type:String,attribute:`selection-mode`})],
|
|
4041
|
+
`]}};E([d({type:String,attribute:`selection-mode`})],Pg.prototype,`selectionMode`,void 0),E([d({type:Boolean,attribute:`required-selection`})],Pg.prototype,`requiredSelection`,void 0),E([d({type:String,attribute:`orientation`})],Pg.prototype,`orientation`,void 0),E([d({type:Boolean,attribute:`nowrap`})],Pg.prototype,`nowrap`,void 0),E([d({type:String,attribute:`separator`})],Pg.prototype,`separator`,void 0),E([d({type:String,attribute:`width`})],Pg.prototype,`width`,void 0),E([d({type:String,attribute:`height`})],Pg.prototype,`height`,void 0),E([d({type:Boolean,attribute:`preserve-filter`})],Pg.prototype,`preserveFilter`,void 0),E([d({type:String})],Pg.prototype,`value`,void 0),E([d({attribute:!1})],Pg.prototype,`registry`,void 0),E([m()],Pg.prototype,`_query`,void 0),E([m()],Pg.prototype,`_computedItems`,void 0),E([m()],Pg.prototype,`_filteredItems`,void 0),E([m()],Pg.prototype,`_isFocused`,void 0),E([f(`slot`)],Pg.prototype,`_slot`,void 0),Pg=E([T(`ixfx-narrowed-text`)],Pg);function Fg(e){return[...e].sort((e,n)=>(e.item.label??``).localeCompare(n.item.label??``))}let Ig=class extends n{constructor(...e){super(...e),this._selectedNodes=new Set,this.exclusivity=`none`,this.selectionFilter=`leaf`,this._openIdx=-1,this._isFocused=!1,this._menuOpen=!1,this._focusOnNarrowedText=!1,this.inputMode=``,this.noTruncate=!1,this.showSuggestions=!1,this.leadingCaret=!1,this.caretEmbedded=!0,this.hideRoot=!1,this.padEnding=!1,this.withUp=!1,this.#n=``,this.#r=!1,this.#i=null,this.tickled=new oe(this,{getItems:()=>this.#a(),onTickle:e=>{e!==void 0&&this.#o(e)}}),this.#u=()=>{this._isFocused=!0},this.#d=()=>{this._isFocused=!1},this.#p=()=>{this.#f()?.focus()},this.#g=()=>{document.removeEventListener(`keydown`,this.#_,{capture:!0}),this.#i=null,this.#r=!1,requestAnimationFrame(()=>{this.#f()?.focus()})},this.#_=e=>{if(!(!this.#i?.querySelector(`ixfx-menu-container`)||!this.#i?.isOpen))switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault(),e.stopPropagation(),this.#i.closeMenu();let n=this.root,r=this.selectedNode;if(!n||!r)break;let i=this.#a().length,a=this.tickled.tickledId??-1;e.key===`ArrowLeft`?a>0&&this.tickled.handleKeyboardNavigation(`previous`):a<i-1&&this.tickled.handleKeyboardNavigation(`next`);break}}},this.#v=e=>{let n=this.root,r=this.selectedNode;if(!n||!r)return;let i=this.#a().length,a=this.tickled.tickledId??-1;switch(e.key){case`ArrowRight`:e.preventDefault(),a<i-1?this.tickled.handleKeyboardNavigation(`next`):a===i-1&&this.#l()&&this.#b();break;case`ArrowLeft`:e.preventDefault(),a>0&&this.tickled.handleKeyboardNavigation(`previous`);break;case`ArrowDown`:case`ArrowUp`:if(this.tickled.tickledId!==void 0){if(e.preventDefault(),this.#i?.isOpen){let n=this.#i.querySelector(`ixfx-menu-container`)?.shadowRoot?.querySelector(`.popover`);n&&n.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0}))}else this.#m()}break;case`Enter`:case` `:e.preventDefault(),this.#y();break;case`Escape`:e.preventDefault(),this._menuOpen=!1,this.tickled.clearTickled(),this.blur();break;case`Tab`:if(e.shiftKey)break;a===i-1&&this.#l()&&(e.preventDefault(),this.#b())}},this.#S=()=>{this._focusOnNarrowedText=!1,this.#x()},this.#C=()=>{this._focusOnNarrowedText=!1,this.#x()},this.#w=!1,this.#T=e=>{let n=e;if(n.deltaX!==0||n.deltaY!==0){e.preventDefault(),this.#w||(this.#w=!0,this.tickled.clearTickled());let r=this.#f();r&&(r.scrollLeft+=n.deltaX+n.deltaY),clearTimeout(this.#E),this.#E=setTimeout(()=>{this.#w=!1},150)}},this.#F=void 0}get selectedNodes(){return this._selectedNodes}#e;#t;#n;#r;#i;#a(){let e=this.root,n=this.selectedNode;if(!e||!n)return[];let r=this.#k(e,n)??[e],i=[];if(this.caretEmbedded)r.forEach((e,n)=>{i.push({id:n,enabled:!0})}),this.#l()&&i.push({id:r.length,enabled:!0});else{let e=0;r.forEach((n,a)=>{let o=a===r.length-1,s=n.item.isLeaf!==!0&&(n.children===void 0||n.children.length>0),c=this.leadingCaret&&(a>0||this.hideRoot)&&s,l=!this.leadingCaret&&s||this.leadingCaret&&o&&s;c&&i.push({id:e++,enabled:!0}),i.push({id:e++,enabled:!0}),l&&i.push({id:e++,enabled:!0})})}return i}#o(e){this.tickled.inputMode===`keyboard`&&this.#s(e)}#s(e){let n=this.root,r=this.selectedNode;if(!n||!r)return;let i=this.#k(n,r)??[n],a=null;a=this.caretEmbedded&&this.#l()&&e===i.length?this.shadowRoot?.querySelector(`ixfx-narrowed-text`)??null:this.shadowRoot?.querySelectorAll(`.crumb-segment`)[e]??null,a?.scrollIntoView({inline:`nearest`,block:`nearest`,behavior:`smooth`})}#c(){let e=this.selectedNode;if(e===void 0)return!1;let n=this.#e===e;return(e.children??[]).length>0||n}#l(){return this.showSuggestions&&this.#c()}#u;#d;#f(){return this.shadowRoot?.querySelector(`.host-container`)??null}#p;#m(){let e=this.tickled.tickledId;if(e===void 0)return;let n=this.root,r=this.selectedNode;if(!n||!r)return;let i=this.#k(n,r)??[n];if(this.caretEmbedded&&this.#l()&&e===i.length){this.#b();return}let a=(this.shadowRoot?.querySelectorAll(`.crumb-segment`))?.[e]?.querySelector(`.caret ixfx-menu-trigger`);a&&(this.#r=!0,this.#i=a,document.addEventListener(`keydown`,this.#_,{capture:!0}),a.openMenu(),this.#h())}#h(){let e=this.tickled.inputMode;requestAnimationFrame(()=>{let n=this.#i?.querySelector(`ixfx-menu-container`);n&&n.setAttribute(`data-input-mode`,e)})}#g;#_;#v;#y(){let e=this.tickled.tickledId;if(e===void 0)return;let n=this.root,r=this.selectedNode;if(!n||!r)return;let i=this.#k(n,r)??[n];if(this.caretEmbedded&&this.#l()&&e===i.length){this.#b();return}(this.shadowRoot?.querySelector(`.crumb-segment[data-segment-id="${e}"]`))?.click()}#b(){let e=this.shadowRoot?.querySelector(`ixfx-narrowed-text`);e&&(this._menuOpen=!1,this._focusOnNarrowedText=!0,e.focus())}#x(){this._focusOnNarrowedText=!1;let e=this.#f();e&&e.focus()}#S;#C;select(e){this.#M(e)}deselect(e){}clearSelection(){this.root&&this.#M(this.root)}selectAll(){}deselectAll(){}getNodes(){if(!this.root)return[];let e=[],n=(r,i)=>{if(e.push({node:r,depth:i}),r.children)for(let e of r.children)n(e,i+1)};for(let e of this.root.children??[])n(e,0);return e}updated(e){if(e.has(`model`)){this.#t?.(),this.#t=void 0;let e=this.model;e&&(this.root=e.root,this.#t=e._subscribe(e=>{e.type===`root`&&(this.root=e.root,this.requestUpdate())}))}this.#D(e)}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,this.#p),this.addEventListener(`wheel`,this.#T,{passive:!1})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`click`,this.#p),this.removeEventListener(`wheel`,this.#T),this.#t?.(),this.#t=void 0,document.removeEventListener(`keydown`,this.#_,{capture:!0}),this.#i=null}firstUpdated(){let e=this.#f();e&&(e.scrollLeft=e.scrollWidth-e.clientWidth)}#w;#T;#E;#D(e){if(!this.shadowRoot)return;let n=this.shadowRoot.querySelector(`.horiz-select-items`);if(!n)return;let r=n.querySelector(`ul`);if(!r)return;let i=this.shadowRoot.querySelector(`ixfx-menu-trigger`);if(i){r.getBoundingClientRect().width>n.getBoundingClientRect().width?i.style.display=`inline-flex`:i.style.display=`none`;for(let e of r.querySelectorAll(`li`))if((e.getAttribute(`data-key`)??``)===this.#n){this.#O(e);break}}}#O(e){let n=e.offsetLeft,r=e.parentElement;if(!r)return;n-=r.offsetLeft;let i=r.parentElement;if(!i)return;i.scroll({left:n,top:0,behavior:`smooth`});let a=i.parentElement;a&&(a.style.minWidth=`${e.getBoundingClientRect().width}px`)}#k(e,n,r=[]){let i=[...r,e];if(e===n)return i;if(e.children)for(let r of e.children){let e=this.#k(r,n,i);if(e)return e}}#A(e){this.shadowRoot&&this.shadowRoot.querySelectorAll(`.crumb-segment`)[e]?.scrollIntoView({block:`nearest`,inline:`start`})}#j(){if(!this.padEnding||!this.shadowRoot)return;let e=this.shadowRoot.querySelector(`.host-container`),n=this.shadowRoot.querySelector(`.trailing`);if(!e||!n)return;let r=this.shadowRoot.querySelectorAll(`.crumb-segment`),i=r[r.length-1];if(!i)return;let a=e.getBoundingClientRect().width,o=i.getBoundingClientRect().width;o<a?(n.style.width=`${a-o-5}px`,requestAnimationFrame(()=>{e.scrollWidth<=e.clientWidth?e.style.setProperty(`--scroll-fade-x-start`,`0px`,`important`):e.style.removeProperty(`--scroll-fade-x-start`)})):n.style.width=``}#M(e){let n=this.selectedNode;this.#n=n?n.item?.key??``:``;let r=n?new Set([n]):new Set;if(this.selectedNode=e,this._selectedNodes=new Set([e]),this.root){let n=this.#k(this.root,e);if(n){let e=this.hideRoot&&n.length>1?n.length-2:n.length-1;requestAnimationFrame(()=>{this.#j();let n=this.#f();n&&(n.scrollLeft=0),this.#A(e)})}}this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set([e]),previous:r},bubbles:!0,composed:!0}))}#N(e,n){this._openIdx=-1,this.#M(e),this.#A(n),this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}#P(e,n,r){let i=e.detail.command;if(this.leadingCaret){let e=n.children?.find(e=>e.item.key===i);if(e){this.#L(e,r+1);return}if(this.#F){let e=this.#F.find(e=>e.item.key===i);e&&this.#L(e,r),this.#F=void 0;return}}let a=n.children?.find(e=>e.item.key===i);a&&this.#L(a,r+1)}#F;#I(e,n){if(n===0){if(!this.hideRoot||!this.root)return[];let e=Fg(this.root.children??[]);return this.#F=e,e.map(e=>i`
|
|
4042
4042
|
<ixfx-menu-item
|
|
4043
4043
|
label="${e.item.label}"
|
|
4044
4044
|
command="${e.item.key}"
|
|
4045
4045
|
icon-name="${e.item.icon??a}"
|
|
4046
4046
|
@click=${()=>{this.#L(e,n)}}
|
|
4047
4047
|
></ixfx-menu-item>
|
|
4048
|
-
`)}let r=e[n-1],o=
|
|
4048
|
+
`)}let r=e[n-1],o=Fg(r.children??[]);return this.#F=o,o.map(e=>i`
|
|
4049
4049
|
<ixfx-menu-item
|
|
4050
4050
|
label="${e.item.label}"
|
|
4051
4051
|
command="${e.item.key}"
|
|
4052
4052
|
icon-name="${e.item.icon??a}"
|
|
4053
4053
|
@click=${()=>{this.#L(e,n)}}
|
|
4054
4054
|
></ixfx-menu-item>
|
|
4055
|
-
`)}#L(e,n){this._openIdx=-1,this.#M(e),this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}#R(){let e=this.root,n=this.selectedNode;if(!e||!n)return;let r=this.#k(e,n);if(!r||r.length<=1)return;let i=r[r.length-2];this.#M(i)}navigateTo(e){if(!this.root?.children)return!1;let n=this.root;for(let r of e){let e=n?.children?.find(e=>e.item.key===r);if(!e)return!1;n=e}return n&&n!==this.root&&this.#M(n),!0}navigateToNode(e){if(!this.root)return!1;let n=this.#z(this.root.children??[],e);return n?this.navigateTo(n):!1}revealKey(e){return this.navigateToNode(n=>n.item.key===e)}selectMany(e){let n=[...e].at(-1);n?this.select(n):this.clearSelection()}#z(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#z(i.children,n,e);if(r)return r}}}render(){let e=this.root,n=this.selectedNode;if(!e||!n)return i``;this.inputMode=this.tickled.inputMode;let r=this.#k(e,n)??[e];this.hideRoot&&r.length>1&&(r=r.slice(1)),this.#c();let o=(this.#k(e,n)??[e]).length<=1,s=[],c=0;return r.forEach((e,n)=>{let o=n===r.length-1,l=this.#e===e,u=this._openIdx===n,d=e.item.isLeaf!==!0&&(e.children===void 0||e.children.length>0),f=this.tickled.isTickled(n),p=this.leadingCaret&&(n>0||this.hideRoot)&&d,m=!this.leadingCaret&&d||this.leadingCaret&&o&&d,h=p?this.#I(r,n):[],g=
|
|
4055
|
+
`)}#L(e,n){this._openIdx=-1,this.#M(e),this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}#R(){let e=this.root,n=this.selectedNode;if(!e||!n)return;let r=this.#k(e,n);if(!r||r.length<=1)return;let i=r[r.length-2];this.#M(i)}navigateTo(e){if(!this.root?.children)return!1;let n=this.root;for(let r of e){let e=n?.children?.find(e=>e.item.key===r);if(!e)return!1;n=e}return n&&n!==this.root&&this.#M(n),!0}navigateToNode(e){if(!this.root)return!1;let n=this.#z(this.root.children??[],e);return n?this.navigateTo(n):!1}revealKey(e){return this.navigateToNode(n=>n.item.key===e)}selectMany(e){let n=[...e].at(-1);n?this.select(n):this.clearSelection()}#z(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#z(i.children,n,e);if(r)return r}}}render(){let e=this.root,n=this.selectedNode;if(!e||!n)return i``;this.inputMode=this.tickled.inputMode;let r=this.#k(e,n)??[e];this.hideRoot&&r.length>1&&(r=r.slice(1)),this.#c();let o=(this.#k(e,n)??[e]).length<=1,s=[],c=0;return r.forEach((e,n)=>{let o=n===r.length-1,l=this.#e===e,u=this._openIdx===n,d=e.item.isLeaf!==!0&&(e.children===void 0||e.children.length>0),f=this.tickled.isTickled(n),p=this.leadingCaret&&(n>0||this.hideRoot)&&d,m=!this.leadingCaret&&d||this.leadingCaret&&o&&d,h=p?this.#I(r,n):[],g=Fg(e.children??[]).map(e=>i`
|
|
4056
4056
|
<ixfx-menu-item
|
|
4057
4057
|
label="${e.item.label}"
|
|
4058
4058
|
command="${e.item.key}"
|
|
@@ -4165,11 +4165,11 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
4165
4165
|
@narrowed-text-blur=${this.#S}
|
|
4166
4166
|
@narrowed-text-shift-tab=${this.#C}
|
|
4167
4167
|
>
|
|
4168
|
-
${
|
|
4168
|
+
${Fg(r).map(e=>i`
|
|
4169
4169
|
<span data-value="${e.item.key}" data-label="${e.item.label}"></span>
|
|
4170
4170
|
`)}
|
|
4171
4171
|
</ixfx-narrowed-text>
|
|
4172
|
-
`}#V(e){e.stopPropagation();let n=e.detail,r=this.selectedNode;if(!r?.children)return;let i=r.children.find(e=>e.item.key===n.item.value);if(i){let e=this.root?this.#k(this.root,r)?.length??1:1;this.#L(i,e)}}#H(){return`var(--child-options-width, 50ch)`}static{this.styles=[w,se,C,
|
|
4172
|
+
`}#V(e){e.stopPropagation();let n=e.detail,r=this.selectedNode;if(!r?.children)return;let i=r.children.find(e=>e.item.key===n.item.value);if(i){let e=this.root?this.#k(this.root,r)?.length??1:1;this.#L(i,e)}}#H(){return`var(--child-options-width, 50ch)`}static{this.styles=[w,se,C,Mg(`x`),r`
|
|
4173
4173
|
:host {
|
|
4174
4174
|
--crumb-item-bg: var(--item-bg, transparent);
|
|
4175
4175
|
--crumb-item-bg-tickled: var(--item-bg-tickled);
|
|
@@ -4428,7 +4428,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
4428
4428
|
user-select: none;
|
|
4429
4429
|
scroll-snap-align: start;
|
|
4430
4430
|
}
|
|
4431
|
-
`]}};E([d({type:Object})],z.prototype,`root`,void 0),E([d({attribute:!1})],z.prototype,`model`,void 0),E([d({type:Object})],z.prototype,`selectedNode`,void 0),E([m()],z.prototype,`_selectedNodes`,void 0),E([d({attribute:!1})],z.prototype,`loadChildren`,void 0),E([d({attribute:!1})],z.prototype,`filterPredicate`,void 0),E([d({reflect:!0,attribute:`exclusivity`})],z.prototype,`exclusivity`,void 0),E([d({reflect:!0,attribute:`selection-filter`})],z.prototype,`selectionFilter`,void 0),E([m()],z.prototype,`_openIdx`,void 0),E([m()],z.prototype,`_isFocused`,void 0),E([m()],z.prototype,`_menuOpen`,void 0),E([m()],z.prototype,`_focusOnNarrowedText`,void 0),E([d({reflect:!0,attribute:`input-mode`})],z.prototype,`inputMode`,void 0),E([d({type:Boolean,reflect:!0,attribute:`no-truncate`})],z.prototype,`noTruncate`,void 0),E([d({type:Boolean,reflect:!0,attribute:`show-suggestions`})],z.prototype,`showSuggestions`,void 0),E([d({type:Boolean,reflect:!0,attribute:`leading-caret`})],z.prototype,`leadingCaret`,void 0),E([d({type:Boolean,reflect:!0,attribute:`caret-embedded`})],z.prototype,`caretEmbedded`,void 0),E([d({type:Boolean,reflect:!0,attribute:`hide-root`})],z.prototype,`hideRoot`,void 0),E([d({type:Boolean,reflect:!0,attribute:`pad-ending`})],z.prototype,`padEnding`,void 0),E([d({type:Boolean,reflect:!0,attribute:`with-up`})],z.prototype,`withUp`,void 0),z=E([T(`ixfx-crumb-navigation`)],z);var Lg=class{#e=null;#t;#n;#r;#i;constructor(e={}){this.#n=e.separator??`/`,this.#r=e.onQuery,this.#i=e.sortCompare,this.#t=new Eu.Pathed.Pathed({separator:this.#n}),e.paths&&this.addPaths(e.paths)}get separator(){return this.#n}addPath(e){let n=e.split(this.#n).filter(e=>e.length>0);for(let e=0;e<n.length;e++){let r=n.slice(0,e+1).join(this.#n),i={label:n[e]};this.#t.add(i,r)}}addPaths(e){for(let n of e)this.addPath(n)}addSegment(e,n){this.#t.add(e,n)}addSegments(e){for(let{path:n,segment:r}of e)this.addSegment(r,n)}getIcon(e){let n=this.#t.getValue(e);if(n!==void 0)return typeof n==`object`&&n&&`value`in n?n.value?.icon:n.icon}getPath(){return this.#e?.getPath()??``}setPath(e){this.#e?.setPath(e)}#a=e=>this.getIcon(e.join(this.#n));connect(e){this.#e=e,e.separator=this.#n,e.siblingLookup=this.#o.bind(this),e.segmentIconLookup||=this.#a}disconnect(){this.#e&&=(this.#e.siblingLookup=void 0,this.#e.segmentIconLookup===this.#a&&(this.#e.segmentIconLookup=void 0),null)}async#o(e,n,r){let i=e.join(this.#n),a=[...this.#t.children(i)];if(a.length>0){let e=a.map(e=>e.value).filter(e=>e!==void 0).map(e=>`value`in e?e.value??{label:e.label}:{label:e.label});return this.#i?[...e].sort(this.#i):e}if(this.#r){let n=await this.#r(e),a=this.#i?[...n].sort(this.#i):n;for(let e of a){let n=i.length>0?`${i}${this.#n}${e.label}`:e.label;this.#t.add(e,n)}return r.aborted?[]:a}return[]}};const Rg=/[^\w-]/g;let zg=class extends n{constructor(...e){super(...e),this.path=``,this.separator=`/`,this.pathRoot=``,this.hintPrevious=!1,this._openIdx=null,this._editing=!1,this._cachedSiblings=new Map,this._leafSegmentIndex=null,this._confirmedLeafIndices=new Set,this._dropdownActiveIndex=-1,this._editingCancelled=!1,this._editStartIndex=null,this._openCumPath=null,this._dragCumPath=null,this._dropCumPath=null,this._hintSegments=null,this.#n=Math.random().toString(36).slice(2,8),this.#r=0,this.#o=e=>{e.newState===`closed`&&this._openIdx!==null&&(this._openIdx=null,this._dropdownActiveIndex=-1,this.#s())},this.#M=e=>{if(this._openIdx===null)return;let n=this._cachedSiblings.get(this._openCumPath??String(this._openIdx))??[];if(!n.length){e.key===`Escape`&&(e.preventDefault(),this.#a());return}switch(e.key){case`ArrowDown`:e.preventDefault(),this._dropdownActiveIndex=(this._dropdownActiveIndex+1)%n.length,this.#N();break;case`ArrowUp`:e.preventDefault(),this._dropdownActiveIndex=this._dropdownActiveIndex<=0?n.length-1:this._dropdownActiveIndex-1,this.#N();break;case`Enter`:this._dropdownActiveIndex>=0&&(e.preventDefault(),this.#A(this._openIdx,n[this._dropdownActiveIndex]));break;case`Escape`:e.preventDefault(),this.#a()}},this.#K=e=>{this._editing||[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Enter`].includes(e.key)||(this._editing=!0)}}#e;#t;#n;#r;#i(e){return`--cp-${this.#n}-${e.replaceAll(this.separator,`-`).replaceAll(` `,`-`).replace(Rg,`-`)}`}#a(){if(this._openIdx!==null){this._openIdx=null,this._openCumPath=null,this._dropdownActiveIndex=-1,this.#s();let e=this.shadowRoot?.querySelector(`.crumb-dropdown`);try{e?.hidePopover()}catch{}}}#o;updated(e){if(this._editing){let e=this.shadowRoot?.querySelector(`ixfx-ac-text`);if(e instanceof n){let n=this.path;if(this._editStartIndex!==null){let r=this.#c()[this._editStartIndex],i=this.path.indexOf(r);e.focusWithValue(n,i)}else e.focusWithValue(n)}}e.has(`_openIdx`)&&this._openIdx!==null&&this.updateComplete.then(()=>{let e=this.shadowRoot?.querySelector(`.crumb-dropdown`);if(e){e.style.setProperty(`position-anchor`,this.#i(this._openCumPath??String(this._openIdx)));try{e.showPopover()}catch{}e.focus()}})}#s(){this.#e&&(this.#e.abort(),this.#e=void 0,this.#t=void 0)}#c(){let e=this.path;return this.pathRoot.length>0&&e.startsWith(this.pathRoot)?e.slice(this.pathRoot.length).split(this.separator).filter(e=>e.length>0):this.path.split(this.separator).filter(e=>e.length>0)}#l(){return this.pathRoot.length===0?[]:this.pathRoot.split(this.separator).filter(e=>e.length>0)}#u(e,n){let r=this.#c(),i=this.#l();return n?i.slice(0,e+1).join(this.separator):[...i,...r.slice(0,e+1)].join(this.separator)}#d(e,n){let r=this.#l();return n?r.slice(0,e+1):[...r,...this.#c().slice(0,e+1)]}#f(e){try{let n=this.segmentDragLookup?.(e,e.length-1);return n==null?[]:Array.isArray(n)?[...n]:[n]}catch{return[]}}#p(){return Date.now()<this.#r||this._dragCumPath!==null}#m(e,n){return e.length<=n.length&&e.every((e,r)=>e===n[r])}#h(e,n){if(!this.hintPrevious)return;let r=this._hintSegments;r!==null&&this.#m(n,r)||(this._hintSegments=e)}#g(e,n){let r=this.segmentIconLookup?.(e,n);if(typeof r==`string`&&r.length>0)return r;let i=e[n];if(i===void 0)return;let a=e.slice(0,n).join(this.separator);return this._cachedSiblings.get(a)?.find(e=>e.label===i)?.icon}setPath(e){this.#s(),this.pathRoot.length>0&&!e.startsWith(this.pathRoot)&&(e=this.pathRoot),e!==this.path&&(this.path=e,this._cachedSiblings=new Map,this._openIdx=null,this._leafSegmentIndex=null,this._confirmedLeafIndices=new Set)}invalidateSiblings(){this._cachedSiblings=new Map,this._leafSegmentIndex=null,this._confirmedLeafIndices=new Set}getPath(){return this.path}#_(e,n){if(n.preventDefault(),n.stopPropagation(),this._openIdx===e){this.#a();return}let r=n.currentTarget.dataset.cumulative;this._openIdx=e,this._openCumPath=r??null,this._dropdownActiveIndex=-1;let i=this.#c(),a=this.#l(),o=r?r.split(this.separator).filter(e=>e.length>0):e===-1?a:i.slice(0,e+1),s=r??String(e);if(!this._cachedSiblings.has(s)&&this.siblingLookup){this.#s();let n=new AbortController;this.#e=n,this.#t=e,this.siblingLookup(o,e,n.signal).then(e=>{n.signal.aborted||(this._cachedSiblings.set(s,e),e.length===0&&this._confirmedLeafIndices.add(r??``),this.#e=void 0,this.#t=void 0,this.requestUpdate())}).catch(e=>{e.name!==`AbortError`&&console.error(`Sibling lookup failed:`,e),this.#e=void 0,this.#t=void 0}),this.dispatchEvent(new CustomEvent(`expand`,{detail:{index:e,segments:o,path:o.join(this.separator),signal:n.signal},bubbles:!0,composed:!0}))}this.requestUpdate()}#v(e,n,r){this.#a();let i=e.length-1,a=r.dataTransfer,o={index:i,label:e[i]??``,pathSegments:e,parentPath:e.slice(0,-1).join(this.separator),fullPath:e.join(this.separator),dataTransfer:a},s=new CustomEvent(`crumb-drag-start`,{detail:o,bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(s)){r.preventDefault();return}if(this._dragCumPath=n,this.toggleAttribute(`data-native-dragging`,!0),a){try{(a.effectAllowed===`none`||a.effectAllowed===`uninitialized`)&&(a.effectAllowed=`copyMove`)}catch{}try{for(let n of this.#f(e))a.setData(n.type,n.data);a.types.includes(`text/plain`)||a.setData(`text/plain`,o.fullPath)}catch{}}}#y(){this._dragCumPath=null,this._dropCumPath=null,this.toggleAttribute(`data-native-dragging`,!1),this.#r=Date.now()+150}#b(e,n){this.parseExternalDrop&&n.dataTransfer&&(n.preventDefault(),this._dropCumPath!==e&&(this._dropCumPath=e))}#x(e,n){this.parseExternalDrop&&this._dropCumPath===e&&(this._dropCumPath=null)}#S(e,n){if(!this.parseExternalDrop)return;n.preventDefault(),n.stopPropagation(),this._dropCumPath=null;let r=n.dataTransfer;if(!r)return;let i;try{i=this.parseExternalDrop(r)}catch(e){console.error(`parseExternalDrop failed:`,e);return}if(i===void 0)return;let a=e.length-1;this.dispatchEvent(new CustomEvent(`crumb-drop`,{detail:{index:a,label:e[a]??``,pathSegments:e,parentPath:e.slice(0,-1).join(this.separator),fullPath:e.join(this.separator),data:i,dataTransfer:r},bubbles:!0,composed:!0}))}#C(){let e=this.#c();if(e.length>0){let n=e.length-1;return{cumPath:this.#u(n,!1),fullPathSegments:this.#d(n,!1)}}let n=this.#l();if(n.length>0){let e=n.length-1;return{cumPath:this.#u(e,!0),fullPathSegments:this.#d(e,!0)}}}#w(e){return!!e.target?.closest?.(`.seg:not(.seg-virtual)`)}#T(e){if(!this.parseExternalDrop||!e.dataTransfer||this.#w(e))return;let n=this.#C();n&&(e.preventDefault(),this._dropCumPath!==n.cumPath&&(this._dropCumPath=n.cumPath))}#E(e){if(!this.parseExternalDrop||this.#w(e))return;let n=this.#C();n&&this._dropCumPath===n.cumPath&&(this._dropCumPath=null)}#D(e){if(!this.parseExternalDrop||this.#w(e))return;let n=this.#C();n&&this.#S(n.fullPathSegments,e)}#O(e,n){if(this.#p())return;n.preventDefault(),n.stopPropagation(),this.#a();let r=this.#c(),i=r.slice(0,e+1);this.#h(r,i);let a=this.path.startsWith(this.separator),o=i.join(this.separator);this.path=a?this.separator+o:o,this._cachedSiblings=new Map,this._leafSegmentIndex=null;let s=i.slice(0,-1).join(this.separator);this.dispatchEvent(new CustomEvent(`navigate`,{detail:{index:e,label:i[e],parentPath:s,fullPath:o},bubbles:!0,composed:!0}))}#k(e,n){if(this.#p())return;n.preventDefault(),n.stopPropagation(),this.#a();let r=this._hintSegments;if(!r)return;let i=r.slice(0,e+1),a=this.path.startsWith(this.separator),o=i.join(this.separator);this.path=a?this.separator+o:o,this._cachedSiblings=new Map,this._leafSegmentIndex=null;let s=i.slice(0,-1).join(this.separator);this.dispatchEvent(new CustomEvent(`navigate`,{detail:{index:e,label:i[e],parentPath:s,fullPath:o},bubbles:!0,composed:!0}))}#A(e,n){let r=this._openCumPath;this.#a();let i=this.#c(),a=this.#l(),o;o=r?[...r.split(this.separator).filter(e=>e.length>0),n.label]:this.pathRoot.length>0&&e<a.length?[...a.slice(0,e+1),n.label]:[...a,...i.slice(0,e+1-a.length),n.label];let s=this.path.startsWith(this.separator),c=o.join(this.separator);this.path=s?this.separator+c:c,this._cachedSiblings=new Map;let l=n.isLeaf?o.length-1:null;this._leafSegmentIndex=l,n.isLeaf&&this._confirmedLeafIndices.add(r??``);let u=o.slice(0,-1).join(this.separator);this.dispatchEvent(new CustomEvent(`navigate`,{detail:{index:e,label:n.label,parentPath:u,fullPath:c},bubbles:!0,composed:!0}))}#j(e,n,r){r.preventDefault(),r.stopPropagation(),this.#A(e,n)}#M;#N(){this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`.crumb-option.active`)?.scrollIntoView({block:`nearest`})})}#P(e){let n=this._cachedSiblings.get(this._openCumPath??String(e))??[],r=this.#t===e;return i`
|
|
4431
|
+
`]}};E([d({type:Object})],Ig.prototype,`root`,void 0),E([d({attribute:!1})],Ig.prototype,`model`,void 0),E([d({type:Object})],Ig.prototype,`selectedNode`,void 0),E([m()],Ig.prototype,`_selectedNodes`,void 0),E([d({attribute:!1})],Ig.prototype,`loadChildren`,void 0),E([d({attribute:!1})],Ig.prototype,`filterPredicate`,void 0),E([d({reflect:!0,attribute:`exclusivity`})],Ig.prototype,`exclusivity`,void 0),E([d({reflect:!0,attribute:`selection-filter`})],Ig.prototype,`selectionFilter`,void 0),E([m()],Ig.prototype,`_openIdx`,void 0),E([m()],Ig.prototype,`_isFocused`,void 0),E([m()],Ig.prototype,`_menuOpen`,void 0),E([m()],Ig.prototype,`_focusOnNarrowedText`,void 0),E([d({reflect:!0,attribute:`input-mode`})],Ig.prototype,`inputMode`,void 0),E([d({type:Boolean,reflect:!0,attribute:`no-truncate`})],Ig.prototype,`noTruncate`,void 0),E([d({type:Boolean,reflect:!0,attribute:`show-suggestions`})],Ig.prototype,`showSuggestions`,void 0),E([d({type:Boolean,reflect:!0,attribute:`leading-caret`})],Ig.prototype,`leadingCaret`,void 0),E([d({type:Boolean,reflect:!0,attribute:`caret-embedded`})],Ig.prototype,`caretEmbedded`,void 0),E([d({type:Boolean,reflect:!0,attribute:`hide-root`})],Ig.prototype,`hideRoot`,void 0),E([d({type:Boolean,reflect:!0,attribute:`pad-ending`})],Ig.prototype,`padEnding`,void 0),E([d({type:Boolean,reflect:!0,attribute:`with-up`})],Ig.prototype,`withUp`,void 0),Ig=E([T(`ixfx-crumb-navigation`)],Ig);var Lg=class{#e=null;#t;#n;#r;#i;constructor(e={}){this.#n=e.separator??`/`,this.#r=e.onQuery,this.#i=e.sortCompare,this.#t=new Tu.Pathed.Pathed({separator:this.#n}),e.paths&&this.addPaths(e.paths)}get separator(){return this.#n}addPath(e){let n=e.split(this.#n).filter(e=>e.length>0);for(let e=0;e<n.length;e++){let r=n.slice(0,e+1).join(this.#n),i={label:n[e]};this.#t.add(i,r)}}addPaths(e){for(let n of e)this.addPath(n)}addSegment(e,n){this.#t.add(e,n)}addSegments(e){for(let{path:n,segment:r}of e)this.addSegment(r,n)}getIcon(e){let n=this.#t.getValue(e);if(n!==void 0)return typeof n==`object`&&n&&`value`in n?n.value?.icon:n.icon}getPath(){return this.#e?.getPath()??``}setPath(e){this.#e?.setPath(e)}#a=e=>this.getIcon(e.join(this.#n));connect(e){this.#e=e,e.separator=this.#n,e.siblingLookup=this.#o.bind(this),e.segmentIconLookup||=this.#a}disconnect(){this.#e&&=(this.#e.siblingLookup=void 0,this.#e.segmentIconLookup===this.#a&&(this.#e.segmentIconLookup=void 0),null)}async#o(e,n,r){let i=e.join(this.#n),a=[...this.#t.children(i)];if(a.length>0){let e=a.map(e=>e.value).filter(e=>e!==void 0).map(e=>`value`in e?e.value??{label:e.label}:{label:e.label});return this.#i?[...e].sort(this.#i):e}if(this.#r){let n=await this.#r(e),a=this.#i?[...n].sort(this.#i):n;for(let e of a){let n=i.length>0?`${i}${this.#n}${e.label}`:e.label;this.#t.add(e,n)}return r.aborted?[]:a}return[]}};const Rg=/[^\w-]/g;let zg=class extends n{constructor(...e){super(...e),this.path=``,this.separator=`/`,this.pathRoot=``,this.hintPrevious=!1,this._openIdx=null,this._editing=!1,this._cachedSiblings=new Map,this._leafSegmentIndex=null,this._confirmedLeafIndices=new Set,this._dropdownActiveIndex=-1,this._editingCancelled=!1,this._editStartIndex=null,this._openCumPath=null,this._dragCumPath=null,this._dropCumPath=null,this._hintSegments=null,this.#n=Math.random().toString(36).slice(2,8),this.#r=0,this.#o=e=>{e.newState===`closed`&&this._openIdx!==null&&(this._openIdx=null,this._dropdownActiveIndex=-1,this.#s())},this.#M=e=>{if(this._openIdx===null)return;let n=this._cachedSiblings.get(this._openCumPath??String(this._openIdx))??[];if(!n.length){e.key===`Escape`&&(e.preventDefault(),this.#a());return}switch(e.key){case`ArrowDown`:e.preventDefault(),this._dropdownActiveIndex=(this._dropdownActiveIndex+1)%n.length,this.#N();break;case`ArrowUp`:e.preventDefault(),this._dropdownActiveIndex=this._dropdownActiveIndex<=0?n.length-1:this._dropdownActiveIndex-1,this.#N();break;case`Enter`:this._dropdownActiveIndex>=0&&(e.preventDefault(),this.#A(this._openIdx,n[this._dropdownActiveIndex]));break;case`Escape`:e.preventDefault(),this.#a()}},this.#K=e=>{this._editing||[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Enter`].includes(e.key)||(this._editing=!0)}}#e;#t;#n;#r;#i(e){return`--cp-${this.#n}-${e.replaceAll(this.separator,`-`).replaceAll(` `,`-`).replace(Rg,`-`)}`}#a(){if(this._openIdx!==null){this._openIdx=null,this._openCumPath=null,this._dropdownActiveIndex=-1,this.#s();let e=this.shadowRoot?.querySelector(`.crumb-dropdown`);try{e?.hidePopover()}catch{}}}#o;updated(e){if(this._editing){let e=this.shadowRoot?.querySelector(`ixfx-ac-text`);if(e instanceof n){let n=this.path;if(this._editStartIndex!==null){let r=this.#c()[this._editStartIndex],i=this.path.indexOf(r);e.focusWithValue(n,i)}else e.focusWithValue(n)}}e.has(`_openIdx`)&&this._openIdx!==null&&this.updateComplete.then(()=>{let e=this.shadowRoot?.querySelector(`.crumb-dropdown`);if(e){e.style.setProperty(`position-anchor`,this.#i(this._openCumPath??String(this._openIdx)));try{e.showPopover()}catch{}e.focus()}})}#s(){this.#e&&(this.#e.abort(),this.#e=void 0,this.#t=void 0)}#c(){let e=this.path;return this.pathRoot.length>0&&e.startsWith(this.pathRoot)?e.slice(this.pathRoot.length).split(this.separator).filter(e=>e.length>0):this.path.split(this.separator).filter(e=>e.length>0)}#l(){return this.pathRoot.length===0?[]:this.pathRoot.split(this.separator).filter(e=>e.length>0)}#u(e,n){let r=this.#c(),i=this.#l();return n?i.slice(0,e+1).join(this.separator):[...i,...r.slice(0,e+1)].join(this.separator)}#d(e,n){let r=this.#l();return n?r.slice(0,e+1):[...r,...this.#c().slice(0,e+1)]}#f(e){try{let n=this.segmentDragLookup?.(e,e.length-1);return n==null?[]:Array.isArray(n)?[...n]:[n]}catch{return[]}}#p(){return Date.now()<this.#r||this._dragCumPath!==null}#m(e,n){return e.length<=n.length&&e.every((e,r)=>e===n[r])}#h(e,n){if(!this.hintPrevious)return;let r=this._hintSegments;r!==null&&this.#m(n,r)||(this._hintSegments=e)}#g(e,n){let r=this.segmentIconLookup?.(e,n);if(typeof r==`string`&&r.length>0)return r;let i=e[n];if(i===void 0)return;let a=e.slice(0,n).join(this.separator);return this._cachedSiblings.get(a)?.find(e=>e.label===i)?.icon}setPath(e){this.#s(),this.pathRoot.length>0&&!e.startsWith(this.pathRoot)&&(e=this.pathRoot),e!==this.path&&(this.path=e,this._cachedSiblings=new Map,this._openIdx=null,this._leafSegmentIndex=null,this._confirmedLeafIndices=new Set)}invalidateSiblings(){this._cachedSiblings=new Map,this._leafSegmentIndex=null,this._confirmedLeafIndices=new Set}getPath(){return this.path}#_(e,n){if(n.preventDefault(),n.stopPropagation(),this._openIdx===e){this.#a();return}let r=n.currentTarget.dataset.cumulative;this._openIdx=e,this._openCumPath=r??null,this._dropdownActiveIndex=-1;let i=this.#c(),a=this.#l(),o=r?r.split(this.separator).filter(e=>e.length>0):e===-1?a:i.slice(0,e+1),s=r??String(e);if(!this._cachedSiblings.has(s)&&this.siblingLookup){this.#s();let n=new AbortController;this.#e=n,this.#t=e,this.siblingLookup(o,e,n.signal).then(e=>{n.signal.aborted||(this._cachedSiblings.set(s,e),e.length===0&&this._confirmedLeafIndices.add(r??``),this.#e=void 0,this.#t=void 0,this.requestUpdate())}).catch(e=>{e.name!==`AbortError`&&console.error(`Sibling lookup failed:`,e),this.#e=void 0,this.#t=void 0}),this.dispatchEvent(new CustomEvent(`expand`,{detail:{index:e,segments:o,path:o.join(this.separator),signal:n.signal},bubbles:!0,composed:!0}))}this.requestUpdate()}#v(e,n,r){this.#a();let i=e.length-1,a=r.dataTransfer,o={index:i,label:e[i]??``,pathSegments:e,parentPath:e.slice(0,-1).join(this.separator),fullPath:e.join(this.separator),dataTransfer:a},s=new CustomEvent(`crumb-drag-start`,{detail:o,bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(s)){r.preventDefault();return}if(this._dragCumPath=n,this.toggleAttribute(`data-native-dragging`,!0),a){try{(a.effectAllowed===`none`||a.effectAllowed===`uninitialized`)&&(a.effectAllowed=`copyMove`)}catch{}try{for(let n of this.#f(e))a.setData(n.type,n.data);a.types.includes(`text/plain`)||a.setData(`text/plain`,o.fullPath)}catch{}}}#y(){this._dragCumPath=null,this._dropCumPath=null,this.toggleAttribute(`data-native-dragging`,!1),this.#r=Date.now()+150}#b(e,n){this.parseExternalDrop&&n.dataTransfer&&(n.preventDefault(),this._dropCumPath!==e&&(this._dropCumPath=e))}#x(e,n){this.parseExternalDrop&&this._dropCumPath===e&&(this._dropCumPath=null)}#S(e,n){if(!this.parseExternalDrop)return;n.preventDefault(),n.stopPropagation(),this._dropCumPath=null;let r=n.dataTransfer;if(!r)return;let i;try{i=this.parseExternalDrop(r)}catch(e){console.error(`parseExternalDrop failed:`,e);return}if(i===void 0)return;let a=e.length-1;this.dispatchEvent(new CustomEvent(`crumb-drop`,{detail:{index:a,label:e[a]??``,pathSegments:e,parentPath:e.slice(0,-1).join(this.separator),fullPath:e.join(this.separator),data:i,dataTransfer:r},bubbles:!0,composed:!0}))}#C(){let e=this.#c();if(e.length>0){let n=e.length-1;return{cumPath:this.#u(n,!1),fullPathSegments:this.#d(n,!1)}}let n=this.#l();if(n.length>0){let e=n.length-1;return{cumPath:this.#u(e,!0),fullPathSegments:this.#d(e,!0)}}}#w(e){return!!e.target?.closest?.(`.seg:not(.seg-virtual)`)}#T(e){if(!this.parseExternalDrop||!e.dataTransfer||this.#w(e))return;let n=this.#C();n&&(e.preventDefault(),this._dropCumPath!==n.cumPath&&(this._dropCumPath=n.cumPath))}#E(e){if(!this.parseExternalDrop||this.#w(e))return;let n=this.#C();n&&this._dropCumPath===n.cumPath&&(this._dropCumPath=null)}#D(e){if(!this.parseExternalDrop||this.#w(e))return;let n=this.#C();n&&this.#S(n.fullPathSegments,e)}#O(e,n){if(this.#p())return;n.preventDefault(),n.stopPropagation(),this.#a();let r=this.#c(),i=r.slice(0,e+1);this.#h(r,i);let a=this.path.startsWith(this.separator),o=i.join(this.separator);this.path=a?this.separator+o:o,this._cachedSiblings=new Map,this._leafSegmentIndex=null;let s=i.slice(0,-1).join(this.separator);this.dispatchEvent(new CustomEvent(`navigate`,{detail:{index:e,label:i[e],parentPath:s,fullPath:o},bubbles:!0,composed:!0}))}#k(e,n){if(this.#p())return;n.preventDefault(),n.stopPropagation(),this.#a();let r=this._hintSegments;if(!r)return;let i=r.slice(0,e+1),a=this.path.startsWith(this.separator),o=i.join(this.separator);this.path=a?this.separator+o:o,this._cachedSiblings=new Map,this._leafSegmentIndex=null;let s=i.slice(0,-1).join(this.separator);this.dispatchEvent(new CustomEvent(`navigate`,{detail:{index:e,label:i[e],parentPath:s,fullPath:o},bubbles:!0,composed:!0}))}#A(e,n){let r=this._openCumPath;this.#a();let i=this.#c(),a=this.#l(),o;o=r?[...r.split(this.separator).filter(e=>e.length>0),n.label]:this.pathRoot.length>0&&e<a.length?[...a.slice(0,e+1),n.label]:[...a,...i.slice(0,e+1-a.length),n.label];let s=this.path.startsWith(this.separator),c=o.join(this.separator);this.path=s?this.separator+c:c,this._cachedSiblings=new Map;let l=n.isLeaf?o.length-1:null;this._leafSegmentIndex=l,n.isLeaf&&this._confirmedLeafIndices.add(r??``);let u=o.slice(0,-1).join(this.separator);this.dispatchEvent(new CustomEvent(`navigate`,{detail:{index:e,label:n.label,parentPath:u,fullPath:c},bubbles:!0,composed:!0}))}#j(e,n,r){r.preventDefault(),r.stopPropagation(),this.#A(e,n)}#M;#N(){this.updateComplete.then(()=>{this.shadowRoot?.querySelector(`.crumb-option.active`)?.scrollIntoView({block:`nearest`})})}#P(e){let n=this._cachedSiblings.get(this._openCumPath??String(e))??[],r=this.#t===e;return i`
|
|
4432
4432
|
${r?i`<span class="loading-spinner"></span>`:a}
|
|
4433
4433
|
${n.length===0&&!r?i`<span class="crumb-option crumb-option-label">No items</span>`:n.map((n,r)=>i`
|
|
4434
4434
|
<div class="crumb-option ${r===this._dropdownActiveIndex?`active`:``}"
|
|
@@ -4532,7 +4532,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
4532
4532
|
${this.#P(this._openIdx)}
|
|
4533
4533
|
</div>
|
|
4534
4534
|
`}
|
|
4535
|
-
`}static{this.styles=[
|
|
4535
|
+
`}static{this.styles=[sn,w,de,Mg(`x`),r`
|
|
4536
4536
|
:host {
|
|
4537
4537
|
--text-highlight: var(--accent);
|
|
4538
4538
|
--separator: var(--surface-muted-text);
|
|
@@ -4765,7 +4765,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
4765
4765
|
font-variant-numeric: tabular-nums;
|
|
4766
4766
|
white-space: pre;
|
|
4767
4767
|
}
|
|
4768
|
-
`]}#e;#t;#n;#r;constructor(){super(),this.automap=!1,this.#e=new Map,this.#t=new Map,this.#n=new Map,this._container=document.createElement(`section`)}connectedCallback(){super.connectedCallback(),this.renderRoot.append(this._container)}configure(e){this.#e.clear();for(let[n,r,i]of e)this.#e.set(n,{style:r,options:i});this._container.innerHTML=``,this.#t.clear(),this.#n.clear(),this.#r!==void 0&&this.#i(this.#r)}formatValue(e,n={}){if(e===null)return`(null)`;if(e===void 0)return`(undefined)`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`string`)return`"${e}"`;if(typeof e==`number`){let r=e;if(n.roundNumbers!==void 0&&(r=
|
|
4768
|
+
`]}#e;#t;#n;#r;constructor(){super(),this.automap=!1,this.#e=new Map,this.#t=new Map,this.#n=new Map,this._container=document.createElement(`section`)}connectedCallback(){super.connectedCallback(),this.renderRoot.append(this._container)}configure(e){this.#e.clear();for(let[n,r,i]of e)this.#e.set(n,{style:r,options:i});this._container.innerHTML=``,this.#t.clear(),this.#n.clear(),this.#r!==void 0&&this.#i(this.#r)}formatValue(e,n={}){if(e===null)return`(null)`;if(e===void 0)return`(undefined)`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`string`)return`"${e}"`;if(typeof e==`number`){let r=e;if(n.roundNumbers!==void 0&&(r=si(n.roundNumbers,e)),n.precision!==void 0)return r.toFixed(n.precision);let i=r.toFixed(2);return r>=0?` ${i}`:i}return JSON.stringify(e)}displayData(e){if(e===null){this.innerHTML=``;return}this.#i(e)}updateData(e){this.#r=e,this.#i(e),this.previousValue=e}getOrCreate(e,n){let r=this.renderRoot.querySelector(`#${e}`);if(r!==null)return r;let i=document.createElement(`div`);return i.id=e,n&&n(i),this._container.append(i),i}#i(e){let n=new Set;this.#a(e,``,n),this.#y(n)}#a(e,n,r){for(let[i,a]of Object.entries(e)){let e=n?`${n}.${i}`:i;r.add(e);let o=this.#e.get(e);if(o!==void 0){if(o.style!==`hide`){let n=this.#c(e,i);this.#l(n,e,o.style,a,o.options)}continue}if(typeof a==`object`&&a&&!Array.isArray(a)){if(this.#o(e))this.#a(a,e,r);else if(this.automap){let n=this.#c(e,i);this.#v(n,a,!0)}else{let n=this.#c(e,i);this.#v(n,a)}}else{let n=this.#s(a);if(n!==void 0){let r=this.#c(e,i);this.#l(r,e,n,a,void 0)}else{let n=this.#c(e,i);this.#_(n,this.formatValue(a))}}}}#o(e){let n=e?`${e}.`:``;for(let e of this.#e.keys())if(e.startsWith(n))return!0;return!1}#s(e){if(this.automap){if(typeof e==`boolean`)return`led`;if(typeof e==`number`)return`plot`}}#c(e,n){let r=`path-${e}`,i=this.renderRoot.querySelector(`#${CSS.escape(r)}`);if(i!==null)return i;i=document.createElement(`div`),i.id=r,i.classList.add(`row`);let a=document.createElement(`label`);return a.textContent=n,i.append(a),this._container.append(i),i}#l(e,n,r,i,a){let o=this.#u(r,i);if(o===null)return;let s=this.#d(e,o);s!==null&&this.#f(s,o,r,n,i,a)}#u(e,n){switch(e){case`hide`:return null;case`led`:return`ixfx-led`;case`plot`:return typeof n==`number`?`ixfx-plot-single-axis`:typeof n==`object`&&n?`ixfx-plot-multi-axis`:`span`;case`plot-xy`:return`ixfx-plot-xy-axis`;case`plot-heat`:case`plot-histogram`:return`ixfx-plot-histogram`;case`time-elapsed`:return`span`}}#d(e,n){let r=e.querySelector(`:scope > [data-renderer]`);if(r!==null){if(r.tagName.toLowerCase()===n)return r;r.remove()}let i=document.createElement(n);return i.dataset.renderer=``,n.startsWith(`ixfx-plot`)&&(i.style.height=`1.4em`,n===`ixfx-plot-xy-axis`?i.style.width=`1.4em`:i.style.width=`5em`),e.append(i),i}#f(e,n,r,i,a,o){let s=this.#t.get(i)!==a;switch(r){case`led`:this.#p(e,i,a,o);break;case`plot`:if(typeof a==`number`)s&&e.add(a);else if(typeof a==`object`&&a&&s){if(Array.isArray(a)){let n={};a.forEach((e,r)=>{typeof e==`number`&&(n[String(r)]=e)}),Object.keys(n).length>0&&e.addData(n)}else e.addData(a)}this.#h(e,r,o);break;case`plot-xy`:s&&this.#m(e,a),this.#h(e,r,o);break;case`plot-heat`:e.style.setProperty(`--plot-histogram-bar-length`,`1`);case`plot-histogram`:typeof a==`number`&&s&&e.add(a),this.#h(e,r,o);break;case`time-elapsed`:e.textContent=this.#g(a)}this.#t.set(i,a)}#p(e,n,r,i){let a=e;if(typeof r==`boolean`)a.lit=r,a.value=+!!r;else if(typeof r==`number`){let e=this.#n.get(n);e===void 0&&(e=mi(),this.#n.set(n,e));let i=e.seen(r),o=i.max===i.min?.5:(r-i.min)/(i.max-i.min);a.value=o,a.lit=o>.3}i?.color!==void 0&&(a.color=i.color)}#m(e,n){let r=e;if(Array.isArray(n)&&n.length>=2)r.add(n[0],n[1]);else if(typeof n==`object`&&n){let e=n;if(`x`in e&&`y`in e)r.add(e.x,e.y);else{let n=Object.entries(e).filter(([e,n])=>typeof n==`number`);n.length>=2&&r.add(n[0][1],n[1][1])}}}#h(e,n,r){if(r===void 0)return;let i=e;typeof r.capacity==`number`&&(i.capacity=r.capacity),typeof r.resolution==`number`&&(i.resolution=r.resolution),typeof r.drawStyle==`string`&&(i.drawStyle=r.drawStyle),typeof r.orientation==`string`&&(i.orientation=r.orientation),typeof r.layout==`string`&&(i.layout=r.layout)}#g(e){let n;if(e instanceof Date)n=e.getTime();else if(typeof e==`number`)n=e>0xe8d4a51000?e:Date.now();else if(typeof e==`string`)n=new Date(e).getTime();else return String(e);if(Number.isNaN(n))return String(e);let r=Date.now()-n,i=Math.abs(r);return i<1e3?`${i}ms`:i<6e4?`${(i/1e3).toFixed(1)}s`:i<36e5?`${(i/6e4).toFixed(1)}mins`:i<864e5?`${(i/36e5).toFixed(1)}h`:`${(i/864e5).toFixed(1)}d`}#_(e,n){let r=e.querySelector(`:scope > .value`);r===null&&(r=document.createElement(`span`),r.classList.add(`value`),e.append(r)),r.textContent=n}#v(e,n,r=!1){let i=e.querySelector(`:scope > ixfx-data-display`);i===null&&(i=document.createElement(`ixfx-data-display`),e.append(i)),i.automap=r,i.updateData(n)}#y(e){let n=this._container.querySelectorAll(`[id^="path-"]`);for(let r of n){let n=r.id.slice(5);e.has(n)||(r.remove(),this.#n.delete(n),this.#t.delete(n))}}};E([d({type:Boolean})],Bg.prototype,`automap`,void 0),Bg=E([T(`ixfx-data-display`)],Bg);function Vg(e){return e==null||e===!1||e===``}function Hg(e){return typeof e==`string`&&e.length>0?e:void 0}let Ug=!1;function Wg(){if(Ug)return;Ug=!0;let e=document.createElement(`style`);e.textContent=`
|
|
4769
4769
|
.ixfx-drag-ghost {
|
|
4770
4770
|
position: fixed;
|
|
4771
4771
|
top: 0;
|
|
@@ -5068,7 +5068,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
5068
5068
|
}
|
|
5069
5069
|
`}render(){return i`
|
|
5070
5070
|
<slot @slotchange=${this.handleSlotChange} @radio-select=${this.handleRadioSelect}></slot>
|
|
5071
|
-
`}};E([d({type:String})],c_.prototype,`name`,void 0),E([d({type:String})],c_.prototype,`value`,void 0),E([m()],c_.prototype,`slottedElements`,void 0),c_=E([T(`ixfx-menu-radio-group`)],c_);var l_=e({MenuBar:()=>qg,MenuCheckItem:()=>Jg,MenuCommandController:()=>Yg,MenuContainer:()=>
|
|
5071
|
+
`}};E([d({type:String})],c_.prototype,`name`,void 0),E([d({type:String})],c_.prototype,`value`,void 0),E([m()],c_.prototype,`slottedElements`,void 0),c_=E([T(`ixfx-menu-radio-group`)],c_);var l_=e({MenuBar:()=>qg,MenuCheckItem:()=>Jg,MenuCommandController:()=>Yg,MenuContainer:()=>rr,MenuHeader:()=>$g,MenuItem:()=>sr,MenuRadioGroup:()=>c_,MenuRadioItem:()=>s_,MenuSeparator:()=>Qg,MenuSubTrigger:()=>Zg,MenuTrigger:()=>ar,menuFromTree:()=>t_,menuFromTreeToElements:()=>o_});const u_=`cubic-bezier(0.25, 0.46, 0.45, 0.94)`;let d_=class extends n{constructor(...e){super(...e),this.direction=`end`,this.disabled=!1,this.mode=`hover`,this._isOverflowing=!1,this._isHovering=!1,this._loopActive=!1,this._loopAtEnd=!1,this._overflow=0,this._resizeObserver=null,this._loopTimer=0,this._onMouseEnter=()=>{this._isHovering=!0},this._onMouseLeave=()=>{this._isHovering=!1},this._measure=()=>{if(this._isHovering||this._loopAtEnd)return;let e=this._textEl;if(!e)return;this._overflow=Math.max(0,e.scrollWidth-e.clientWidth);let n=this._overflow>0;this.classList.toggle(`is-overflowing`,n),n!==this._isOverflowing&&(this._isOverflowing=n),this._loopActive&&this.mode===`loop`&&!this.disabled&&n&&this._loopTimer===0&&this._scheduleLoopPan(300),!n&&this._loopAtEnd&&(this._loopAtEnd=!1,this.requestUpdate())}}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(()=>this._measure()),this.addEventListener(`mouseenter`,this._onMouseEnter),this.addEventListener(`mouseleave`,this._onMouseLeave)}disconnectedCallback(){super.disconnectedCallback(),this._clearLoopTimer(),this._loopActive=!1,this._loopAtEnd=!1,this._resizeObserver?.disconnect(),this._resizeObserver=null,this.removeEventListener(`mouseenter`,this._onMouseEnter),this.removeEventListener(`mouseleave`,this._onMouseLeave)}firstUpdated(){this._measure(),this._resizeObserver?.observe(this),document.fonts?.ready.then(()=>this._measure()),this.mode===`loop`&&this.startLoop()}updated(e){e.has(`mode`)&&(this.mode===`loop`?this.startLoop():this.stopLoop()),e.has(`disabled`)&&this.disabled&&this.stopLoop(),this._measure()}get looping(){return this._loopActive}startLoop(){this.disabled||this._prefersReducedMotion()||(this._loopActive=!0,this._loopAtEnd=!1,this.requestUpdate(),this._isOverflowing&&this._loopTimer===0&&this._scheduleLoopPan(300))}stopLoop(){!this._loopActive&&!this._loopAtEnd&&this._loopTimer===0||(this._clearLoopTimer(),this._loopActive=!1,this._loopAtEnd=!1,this.requestUpdate())}_prefersReducedMotion(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}_panDuration(){return Math.max(1.5,(this._overflow+4)/45)}_clearLoopTimer(){this._loopTimer!==0&&(clearTimeout(this._loopTimer),this._loopTimer=0)}_scheduleLoopPan(e){this._clearLoopTimer(),this._loopTimer=window.setTimeout(()=>{if(this._loopTimer=0,!this._loopActive||this.disabled||!this._isOverflowing)return;this._loopAtEnd=!0,this.requestUpdate();let e=this._panDuration()*1e3+2e3;this._loopTimer=window.setTimeout(()=>{this._loopTimer=0,this._loopActive&&(this._loopAtEnd=!1,this.requestUpdate(),this._scheduleLoopPan(700))},e)},e)}_textStyle(){if(!this._isOverflowing)return``;let e=this._overflow+4,n=Math.max(1.5,e/45),r=this.direction===`end`,i=r?0:-e,a=r?-e:0;return this._loopActive&&this.mode===`loop`?this._loopAtEnd?[`transform: translateX(${a}px)`,`transition: transform ${n}s ${u_}`,`overflow: visible`,`text-overflow: clip`].join(`; `):[`transform: translateX(${i}px)`,`transition: transform 400ms ${u_}`,r?``:`overflow: visible; text-overflow: clip`].filter(Boolean).join(`; `):this._isHovering?[`transform: translateX(${a}px)`,`transition: transform ${n}s ${u_} 300ms`,`overflow: visible`,`text-overflow: clip`].join(`; `):[`transform: translateX(${i}px)`,`transition: transform 400ms ${u_}`,r?``:`overflow: visible; text-overflow: clip`].filter(Boolean).join(`; `)}render(){let e={"is-overflowing":this._isOverflowing,"is-hovering":this._isHovering};return i`
|
|
5072
5072
|
<span class="text ${v(e)}" part="text" style=${this._textStyle()}>
|
|
5073
5073
|
<slot @slotchange=${this._measure}></slot>
|
|
5074
5074
|
</span>
|
|
@@ -5104,7 +5104,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
5104
5104
|
transform: none !important;
|
|
5105
5105
|
}
|
|
5106
5106
|
}
|
|
5107
|
-
`]}};E([d({type:String,attribute:`direction`})],d_.prototype,`direction`,void 0),E([d({type:Boolean,attribute:`disabled`})],d_.prototype,`disabled`,void 0),E([d({type:String,attribute:`mode`,reflect:!0})],d_.prototype,`mode`,void 0),E([m()],d_.prototype,`_isOverflowing`,void 0),E([m()],d_.prototype,`_isHovering`,void 0),E([m()],d_.prototype,`_loopActive`,void 0),E([m()],d_.prototype,`_loopAtEnd`,void 0),E([f(`.text`)],d_.prototype,`_textEl`,void 0),d_=E([T(`ixfx-pan-text`)],d_);const f_={textColor:void 0,icon:void 0,iconColor:void 0,badge:void 0};function p_(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function m_(e,n){return e!==void 0&&e.length===n.length&&e.every((e,r)=>e===n[r])}let B=class extends n{constructor(...e){super(...e),this.columns=[],this.rows=[],this.selectionMode=`single`,this.interactionMode=`standard`,this.sortState=null,this.rowHeight=28,this.getRowKey=(e,n)=>e.key??e.id??String(n),this.editable=!1,this.editability=`user`,this.cellOverflow=`ellipsis`,this.zebraStripes=!1,this.groupBy=null,this.allowGrouping=!1,this.crossGroupSelection=!1,this.columnMenu=`none`,this.textColorColumn=``,this.iconColumn=``,this.badgeColumn=``,this.itemsDraggable=!1,this.columnButtonIcon=`ellipsis`,this._columnFormatters=new Map,this._resizingColKey=void 0,this._animatingColKeys=new Set,this._selectedKeys=new Set,this._scrollTop=0,this._scrollLeft=0,this._viewportH=300,this._viewportW=600,this._collapsedGroups=new Set,this._editing=null,this._editingRow=null,this._lastClick=null,this._lastClickedCell=null,this._editValue=``,this._tickled=new oe(this,{getItems:()=>this.#p??=this._flat.map(e=>({id:e.key,enabled:e.type===`row`})),onStateChange:()=>this.requestUpdate(),hoverDisabled:()=>this.#a.isDragging}),this.#t=!1,this.#r=0,this.#i=new WeakMap,this.#a=new
|
|
5107
|
+
`]}};E([d({type:String,attribute:`direction`})],d_.prototype,`direction`,void 0),E([d({type:Boolean,attribute:`disabled`})],d_.prototype,`disabled`,void 0),E([d({type:String,attribute:`mode`,reflect:!0})],d_.prototype,`mode`,void 0),E([m()],d_.prototype,`_isOverflowing`,void 0),E([m()],d_.prototype,`_isHovering`,void 0),E([m()],d_.prototype,`_loopActive`,void 0),E([m()],d_.prototype,`_loopAtEnd`,void 0),E([f(`.text`)],d_.prototype,`_textEl`,void 0),d_=E([T(`ixfx-pan-text`)],d_);const f_={textColor:void 0,icon:void 0,iconColor:void 0,badge:void 0};function p_(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function m_(e,n){return e!==void 0&&e.length===n.length&&e.every((e,r)=>e===n[r])}let B=class extends n{constructor(...e){super(...e),this.columns=[],this.rows=[],this.selectionMode=`single`,this.interactionMode=`standard`,this.sortState=null,this.rowHeight=28,this.getRowKey=(e,n)=>e.key??e.id??String(n),this.editable=!1,this.editability=`user`,this.cellOverflow=`ellipsis`,this.zebraStripes=!1,this.groupBy=null,this.allowGrouping=!1,this.crossGroupSelection=!1,this.columnMenu=`none`,this.textColorColumn=``,this.iconColumn=``,this.badgeColumn=``,this.itemsDraggable=!1,this.columnButtonIcon=`ellipsis`,this._columnFormatters=new Map,this._resizingColKey=void 0,this._animatingColKeys=new Set,this._selectedKeys=new Set,this._scrollTop=0,this._scrollLeft=0,this._viewportH=300,this._viewportW=600,this._collapsedGroups=new Set,this._editing=null,this._editingRow=null,this._lastClick=null,this._lastClickedCell=null,this._editValue=``,this._tickled=new oe(this,{getItems:()=>this.#p??=this._flat.map(e=>({id:e.key,enabled:e.type===`row`})),onStateChange:()=>this.requestUpdate(),hoverDisabled:()=>this.#a.isDragging}),this.#t=!1,this.#r=0,this.#i=new WeakMap,this.#a=new $n(this,{source:`data-grid`,isEnabled:()=>this.itemsDraggable&&this.selectionMode!==`none`&&this._flat.some(e=>e.type===`row`),resolveEventToKey:e=>{if(e instanceof Element&&!e.closest?.(`.header-cell`))return(e.closest?.(`.row`))?.dataset.key},prepareSelection:e=>this.#o(e),getMetrics:()=>({rowHeight:this.rowHeight}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>this.dispatchEvent(new CustomEvent(`list-native-drag-start`,{detail:e,bubbles:!0,composed:!0,cancelable:!0})),onActiveChange:(e,n)=>{if(this.#t=e,this.#n=e?n:void 0,this.toggleAttribute(`data-native-dragging`,e),e){let e=this._selectedKeys.size;this.setAttribute(`aria-label`,e<=1?`Dragging 1 item`:`Dragging ${e} items`)}else this.removeAttribute(`aria-label`);this.requestUpdate()},onEnd:()=>{this.#t=!1,this.#n=void 0,this.toggleAttribute(`data-native-dragging`,!1),this.removeAttribute(`aria-label`),this.#s()}}),this._sortedRows=[],this._flat=[],this._flatKeys=[],this.#c=new Map,this.#l=0,this.#u=-1,this.#g=new Map,this.search=new Bt(this,{adapter:this.#v()}),this.#x=[],this.#S=new Set,this.#C=0,this.#w=!1,this._visibleColumns=[],this._colOffsets=[],this._colWidthSum=0,this._raf=0,this.#T=0,this.#O=0,this._drag=null,this._onFocusOut=e=>{if(this._suppressBlurCommit||this.editability===`immediate`||!this._editing&&!this._editingRow)return;let n=e.relatedTarget;n&&this.contains(n)||(this._editing=null,this._editingRow=null,this.requestUpdate())},this._onScroll=e=>{let n=e.target;cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>{let e=this.#R(2);this._scrollTop=n.scrollTop,this._scrollLeft=n.scrollLeft;let r=this.#R(2);(e.start!==r.start||e.end!==r.end)&&this.requestUpdate(),cancelAnimationFrame(this.#T),this.#T=0,this.#V()})},this._onKeyDown=e=>{if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`){if(this.selectionMode===`multiple`||this.interactionMode===`checked`||this.interactionMode===`sticky`||this.interactionMode===`vscode`||this.interactionMode===`standard`){e.preventDefault();let n=new Set(this._selectedKeys);if(this.groupBy&&!this.crossGroupSelection&&this._anchorKey){let e=this._getGroupKey(this._getRowForKey(this._anchorKey)??{key:this._anchorKey});this._selectedKeys=new Set(this._flat.filter(n=>n.type===`row`&&this._getGroupKey(n.row)===e).map(e=>e.key))}else this._selectedKeys=new Set(this._flat.filter(e=>e.type===`row`).map(e=>e.key));this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:n},bubbles:!0,composed:!0}))}return}if(this._editing&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){if(this.shadowRoot?.activeElement?.tagName===`SELECT`)return;e.preventDefault();let n=this._editing,r=e.key===`ArrowDown`?1:-1,i=n.colKey;this._suppressBlurCommit=!0,this._commitEdit();let a=this._flat.filter(e=>e.type===`row`).map(e=>e.key),o=a.indexOf(n.rowKey),s=o+r;for(;s>=0&&s<a.length;){let e=a[s],n=this.#F(e)?.row,c=this._visibleColumns.find(e=>e.key===i);if(n&&c&&this._isEditable(n,c)){this._startEdit(e,i),this._tickled.handleKeyboardNavigation(s>o?`next`:`previous`),this._scrollRowIntoView(e);break}s+=r}(s<0||s>=a.length)&&(this._tickled.handleKeyboardNavigation(r>0?`next`:`previous`),this._tickled.tickledId&&this._scrollRowIntoView(this._tickled.tickledId)),requestAnimationFrame(()=>{this._suppressBlurCommit=!1});return}switch((e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)&&(e.preventDefault(),this._tickled.setInputMode(`keyboard`)),e.key){case`ArrowDown`:this._tickled.handleKeyboardNavigation(`next`),this._tickled.tickledId&&this._scrollRowIntoView(this._tickled.tickledId),this.interactionMode===`implicit`&&this._tickled.tickledId&&this._replaceSelection(this._tickled.tickledId),e.shiftKey&&(this.interactionMode===`standard`||this.interactionMode===`vscode`)&&this._tickled.tickledId&&this._rangeSelectTo(this._tickled.tickledId);break;case`ArrowUp`:this._tickled.handleKeyboardNavigation(`previous`),this._tickled.tickledId&&this._scrollRowIntoView(this._tickled.tickledId),this.interactionMode===`implicit`&&this._tickled.tickledId&&this._replaceSelection(this._tickled.tickledId),e.shiftKey&&(this.interactionMode===`standard`||this.interactionMode===`vscode`)&&this._tickled.tickledId&&this._rangeSelectTo(this._tickled.tickledId);break;case`Home`:this._tickled.handleKeyboardNavigation(`first`),this._tickled.tickledId&&this._scrollRowIntoView(this._tickled.tickledId);break;case`End`:this._tickled.handleKeyboardNavigation(`last`),this._tickled.tickledId&&this._scrollRowIntoView(this._tickled.tickledId);break;case`Enter`:{let n=this._tickled.tickledId;if(!n)break;if(e.preventDefault(),!this._editing&&this.editability===`user`){let e=this.#F(n);if(e){let r=e.row;if(this._lastClickedCell?.rowKey===n){let e=this._visibleColumns.find(e=>e.key===this._lastClickedCell.colKey);if(e&&this._isEditable(r,e)){this._startEdit(n,e.key);break}}let i=this._visibleColumns.find(e=>this._isEditable(r,e));if(i){this._startEdit(n,i.key);break}}}if(!this._editing){let e=this.#F(n),r=e?.idx??-1;if(this._selectedKeys.has(n)){this._activateRow(n,e?.row,r);break}this.interactionMode!==`manual`&&this.interactionMode!==`checked`&&this._replaceSelection(n),this.dispatchEvent(new CustomEvent(`datagrid-cell-click`,{detail:{rowKey:n,colKey:``,rowIndex:r,colIndex:-1},bubbles:!0,composed:!0}))}break}case` `:{if(this._editing){if((this.columns.find(e=>e.key===this._editing.colKey)?.dataType??`text`)===`boolean`){e.preventDefault();let n=this.editability===`immediate`,r=this._editing.rowKey,i=this._editing.colKey,a=this.shadowRoot?.activeElement,o;if(a?.type===`checkbox`)o=!a.checked,a.checked=o;else{let e=this.#F(r)?.row;o=!(this._editValue===``?e?.[i]:this._editValue)}n?this._commitImmediate(r,i,o):(this._editValue=o,this._commitEdit())}break}let n=this._tickled.tickledId;if(!n)break;e.preventDefault(),this.interactionMode===`checked`||this.interactionMode===`sticky`||this.interactionMode===`standard`||this.interactionMode===`vscode`||this.interactionMode===`manual`?this._toggleSelection(n):this._replaceSelection(n);break}case`Escape`:if(this._editing||this._editingRow)e.preventDefault(),this._editing=null,this._editingRow=null,this.requestUpdate();else if(this._selectedKeys.size){e.preventDefault();let n=new Set(this._selectedKeys);this._selectedKeys=new Set,this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set,previous:n},bubbles:!0,composed:!0}))}}},this._suppressBlurCommit=!1}static{this.styles=[w,Yt,se,C,Wn,Vt,Mg(`x`),Mg(`y`),r`
|
|
5108
5108
|
:host {
|
|
5109
5109
|
--data-grid-row-height: 28px;
|
|
5110
5110
|
--data-grid-header-height: 32px;
|
|
@@ -5312,7 +5312,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
5312
5312
|
.group-row .divider { flex: 1; height: 1px; background: var(--border); margin-left: var(--space-s); }
|
|
5313
5313
|
.group-row .count { opacity: 0.6; font-weight: 400; font-size: 0.9em; }
|
|
5314
5314
|
|
|
5315
|
-
`]}#e;#t;#n;#r;#i;#a;#o(e){let n=this._flat.filter(e=>e.type===`row`);if(!n.some(n=>n.key===e))return;this._selectedKeys.has(e)||this._replaceSelection(e);let r=[],i=0;for(let e of n){if(!this._selectedKeys.has(e.key)){i++;continue}let n=this.renderRoot.querySelector(`.row[data-key="${CSS.escape(e.key)}"]`)??void 0;r.push({key:e.key,index:i,item:e.row,...n?{element:n}:{}}),i++}let a=r.find(n=>n.key===e);if(a)return{origin:a,selected:r}}#s(){this.#r&&clearTimeout(this.#r),this.#r=window.setTimeout(()=>{this.#r=0},0)}#c;#l;#u;#d;#f;#p;#m;#h;#g;get registry(){return this.#m}#_(e){if(this.rowSearchText)return this.rowSearchText(e);let n=e;return this._visibleColumns.map(e=>String(n[e.key]??``)).join(` `)}#v(){return{getItems:()=>(this.#g.clear(),this._sortedRows.forEach((e,n)=>this.#g.set(e,this.getRowKey(e,n))),this._sortedRows),getLabel:e=>this.#_(e),getKey:e=>this.#g.get(e)??String(this._sortedRows.indexOf(e)),focusItem:e=>{if(e===void 0)return;let n=this.#g.get(e);n!==void 0&&this.tickleRow(n)},selectItems:e=>{this.selectKeys(e.map(e=>this.#g.get(e)).filter(e=>e!==void 0))},applyFilter:e=>{this.filterPredicate=e===void 0?void 0:n=>{let r=this.#g.get(n);return r===void 0||e.has(r)}}}}#y(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#b(){this.#m&&(this.search.setModes(this.#y()),this.#h?.(),this.#h=Rt(this.#m,this.search))}#x;#S;#C;#w;#T;#E;#D;#O;#k;connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.#m??=Yt(),this.#b(),this.#k=Kg(()=>this._viewportEl??void 0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),cancelAnimationFrame(this._raf),cancelAnimationFrame(this.#T),this.#T=0,this.#h?.(),this.#h=void 0,this.#m=void 0,this.#C&&=(clearTimeout(this.#C),0),this.#r&&=(clearTimeout(this.#r),0),this.#e?.disconnect(),this.#e=void 0,this.#k?.(),this.#k=void 0}dispatch(e,n){this.#m?.invoke(e,n)}firstUpdated(){this.#e=new ResizeObserver(()=>this.#A()),this.#e.observe(this._viewportEl),this.#A()}#A(){if(!this._viewportEl)return;let e=this._viewportEl,n=e.clientWidth,r=this.#L();if(n<=0||r<=0)return;let i=e.parentElement;i.style.setProperty(`--data-grid-scrollbar-width`,`${e.offsetWidth-n}px`),i.style.setProperty(`--data-grid-viewport-width`,`${n}px`),(n!==this._viewportW||r!==this._viewportH)&&(this._viewportW=n,this._viewportH=r,this.#B())}refreshLayout(){this.#A(),this.requestUpdate()}updated(e){super.updated(e),(e.has(`rows`)||e.has(`sortState`)||e.has(`columns`)||e.has(`groupBy`)||e.has(`groupLabel`)||e.has(`filterPredicate`)||e.has(`rowHeight`))&&this.#B(),(e.has(`_editing`)||e.has(`_editingRow`))&&this.updateComplete.then(()=>{let e=null;if(this._editing?e=`.row[data-key="${this._editing.rowKey}"] .cell[data-col="${this._editing.colKey}"] input, .row[data-key="${this._editing.rowKey}"] .cell[data-col="${this._editing.colKey}"] select`:this._editingRow&&(e=`.row[data-key="${this._editingRow}"] .cell input, .row[data-key="${this._editingRow}"] .cell select`),!e)return;let n=this.renderRoot.querySelector(e);n?.focus(),n instanceof HTMLInputElement&&n.type===`text`&&n.select()})}willUpdate(e){super.willUpdate(e),this.setAttribute(`data-input-mode`,this._tickled.inputMode),e.has(`searchModes`)&&this.#b(),this.#j(),this._visibleColumns=this.columns.filter(e=>e.visible!==!1);let n=0;this._colOffsets=this._visibleColumns.map(e=>{let r=n;return n+=e.width??150,r}),this._colWidthSum=n,this.interactionMode===`checked`&&(this._colWidthSum+=28),this.#l!==this.#u&&(this.#u=this.#l,this.#N())}#j(){let e=[this.rows,this.sortState,this.columns],n=[this.filterPredicate,this.groupBy,this.groupLabel,this._collapsedGroups,this.getRowKey],r=!m_(this.#d,e);r&&(this.#d=e,this._sortedRows=this._applySort([...this.rows])),(r||!m_(this.#f,n))&&(this.#f=n,this._rebuildFlat())}#M(){this.#d=[this.rows,this.sortState,this.columns],this.#f=[this.filterPredicate,this.groupBy,this.groupLabel,this._collapsedGroups,this.getRowKey]}#N(){let e=this._flatKeys,n=this.#x;if(this.#x=e.slice(),!this.#w){this.#w=!0;return}if(n.length===0||e.length===0){this.#S.clear();return}let r=new Set(n),i=e.filter(e=>!r.has(e)),a=n.length-(e.length-i.length);i.length===e.length||i.length===0&&a===0||(this.#S=new Set(i),this.toggleAttribute(`reflowing`,!0),this.#C&&clearTimeout(this.#C),this.#C=window.setTimeout(()=>{this.#C=0,this.#S.clear(),this.toggleAttribute(`reflowing`,!1),this.requestUpdate()},320))}_getGroupKey(e){return this.groupBy?typeof this.groupBy==`string`?String(e[this.groupBy]??``):String(this.groupBy(e)):null}_rebuildFlat(){let e=this.filterPredicate,n=[];for(let r=0;r<this._sortedRows.length;r++)(!e||e(this._sortedRows[r]))&&n.push(r);let r=[],i=[],a=e=>{let n=this._sortedRows[e],a=this.getRowKey(n,e);r.push({type:`row`,key:a,row:n,idx:e}),i.push(a)};if(!this.groupBy)n.forEach(a);else{let e=new Map;for(let r of n){let n=this._getGroupKey(this._sortedRows[r])??``,i=e.get(n);i?i.push(r):e.set(n,[r])}for(let[n,o]of e){let e=this.groupLabel?this.groupLabel(n,o.map(e=>this._sortedRows[e])):n,s=`__group__${n}`;r.push({type:`group`,key:s,label:e,count:o.length}),i.push(s),this._collapsedGroups.has(n)||o.forEach(a)}}this._flat=r,this._flatKeys=i,this.#P()}#P(){this.#c.clear(),this._flat.forEach((e,n)=>this.#c.set(e.key,n)),this.#l++,this.#p=void 0}#F(e){let n=this.#c.get(e),r=n===void 0?void 0:this._flat[n];if(r?.type===`row`)return r;let i=this._sortedRows.findIndex((n,r)=>this.getRowKey(n,r)===e);return i<0?void 0:{row:this._sortedRows[i],idx:i}}_toggleGroup(e){let n=new Set(this._collapsedGroups);n.has(e)?n.delete(e):n.add(e),this._collapsedGroups=n}_applySort(e){if(!this.sortState)return e;let n=this.columns.find(e=>e.key===this.sortState.key);if(!n)return e;let r=this.sortState.direction===`asc`?1:-1;if(n.sortFn)return e.sort((e,i)=>r*n.sortFn(e,i));let i=n.dataType??`text`;return e.sort((e,a)=>{let o=e[n.key],s=a[n.key];return o===s?0:i===`number`?r*(o-s):i===`boolean`?r*(!!o==!!s?0:o?1:-1):r*String(o).localeCompare(String(s))})}_onHeaderClick(e,n){if(e.sortable===!1)return;if(n){let e=n.composedPath()[0];if(e&&this.#i.get(e)){this.#i.delete(e);return}}let r=this.sortState,i=null;i=!r||r.key!==e.key?{key:e.key,direction:`asc`}:r.direction===`asc`?{key:e.key,direction:`desc`}:null,this.sortState=i,this.dispatchEvent(new CustomEvent(`datagrid-sort`,{detail:{sort:i,previous:r},bubbles:!0,composed:!0}))}_onHeaderPointerUp(e,n){let r=!1,i=new CustomEvent(`datagrid-header-pointerup`,{detail:{key:e.key,column:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&(r=!0),r&&this.#i.set(n,!0)}_onColButtonClick(e,n){n.stopPropagation();let r=e.button===!1?this.columnButtonIcon:typeof e.button==`object`&&e.button.icon?e.button.icon:this.columnButtonIcon,i=n.currentTarget,a=new CustomEvent(`datagrid-header-button-click`,{detail:{key:e.key,column:e,icon:r,clientX:n.clientX,clientY:n.clientY,anchorElement:i},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(a),a.defaultPrevented&&this.#i.set(n,!0)}_onRowClick(e,n,r){if(!(this.#a.isDragging||this.#r!==0)&&!(n&&n.selectable===!1)&&(this.selectionMode!==`none`||this.interactionMode===`checked`||this.interactionMode===`sticky`)&&this.interactionMode!==`manual`){if(this.interactionMode===`implicit`){this._replaceSelection(e);return}if(this.interactionMode!==`checked`){if(this.interactionMode===`sticky`){this._toggleSelection(e);return}r.ctrlKey||r.metaKey?(this.selectionMode===`multiple`||this.interactionMode===`vscode`)&&this._toggleSelection(e):r.shiftKey&&(this.selectionMode===`multiple`||this.interactionMode===`vscode`)?this._rangeSelectTo(e):this._replaceSelection(e)}}}_onCheckboxClick(e,n){n.stopPropagation(),this._onRowClick(e,null,n)}_onVisibilityToggle(e,n){e.visible=n,this.columns=[...this.columns],this.dispatchEvent(new CustomEvent(`datagrid-column-visibility`,{detail:{key:e.key,visible:n},bubbles:!0,composed:!0}))}_beginHeaderDrag(e,n,r){e.stopPropagation();let i=e.currentTarget.closest(`.header-cell`)??e.currentTarget;this._drag={pointerId:e.pointerId,from:r,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,gap:void 0,sourceCol:n};let a=e=>{if(!this._drag||e.pointerId!==this._drag.pointerId)return;let r=e.clientX-this._drag.startX,a=e.clientY-this._drag.startY;if(!this._drag.active){if(Math.hypot(r,a)<5)return;this._drag.active=!0;let o=document.createElement(`span`);o.textContent=n.label;try{this._drag.ghost=Gg({anchor:i,content:o}),this._drag.ghost.move(e.clientX,e.clientY)}catch{}try{this._headerRowEl?.setPointerCapture(e.pointerId)}catch{}}this._drag.ghost?.move(e.clientX,e.clientY);let o=e.clientX-(this._headerRowEl?.getBoundingClientRect().left??0),s=this._drag.from,c=1/0;for(let e=0;e<this._visibleColumns.length;e++){if(e===this._drag.from)continue;let n=this._colOffsets[e],r=n+(this._visibleColumns[e].width??150),i=(n+r)/2,a=o<i?n:r,l=o<i?e:e+1,u=Math.abs(o-a);u<c&&(c=u,s=l>this._drag.from?l-1:l)}if(this._visibleColumns.length>0){let e=this._colOffsets[this._colOffsets.length-1]+(this._visibleColumns[this._visibleColumns.length-1].width??150),n=Math.abs(o-e);n<c&&(c=n,s=this._visibleColumns.length-1,this._drag.from===this._visibleColumns.length-1?s=this._drag.from:s>=this._drag.from&&(s=this._visibleColumns.length-1))}let l=this._visibleColumns.length-1,u=s;u<0&&(u=0),u>l&&(u=l),this._drag.gap=u,this.requestUpdate()},o=e=>{if(!this._drag||e.pointerId!==this._drag.pointerId)return;let n=this._drag.active,r=this._drag.from,i=this._drag.gap;this._drag.ghost?.destroy();try{this._headerRowEl?.releasePointerCapture(e.pointerId)}catch{}window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),this._drag=null,this.requestUpdate(),n&&i!==void 0&&i!==r&&this._onReorderDrag(r,i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)}_onReorderDrag(e,n){if(e===n)return;let r=[...this.columns],i=r.filter(e=>e.visible!==!1),a=r.filter(e=>e.visible===!1),[o]=i.splice(e,1);i.splice(n,0,o),this.columns=[...i,...a],this.dispatchEvent(new CustomEvent(`datagrid-column-reorder`,{detail:{from:e,to:n,columns:[...this.columns]},bubbles:!0,composed:!0}))}_scrollRowIntoView(e){let n=this.#c.get(e);if(n===void 0||!this._viewportEl)return;let r=this.rowHeight,i=(n>0&&this._flat[n-1].type===`group`?n-1:n)*r,a=(n+1)*r,o=this._viewportEl.scrollTop,s=this.#L(),c=o;i<o?c=i:a>o+s&&(c=a-s),c!==o&&(this._viewportEl.scrollTop=c,this._scrollTop=c,this.requestUpdate())}_getRowForKey(e){let n=this.#c.get(e),r=n===void 0?void 0:this._flat[n];return r?.type===`row`?r.row:void 0}get selectedKeys(){return this._selectedKeys}set selectedKeys(e){this.selectKeys(e)}selectKeys(e){let n=new Set([...e].filter(e=>this._getRowForKey(e)!==void 0)),r=this.selectionMode===`multiple`||this.interactionMode===`checked`||this.interactionMode===`sticky`||this.interactionMode===`vscode`;if(this.selectionMode===`none`)n=new Set;else if(!r&&n.size>1){let e=[...n].at(-1);n=e===void 0?new Set:new Set([e])}let i=new Set(this._selectedKeys);i.size===n.size&&[...n].every(e=>i.has(e))||(this._selectedKeys=n,this._anchorKey=[...n].at(-1),this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(n),previous:i},bubbles:!0,composed:!0})))}get tickledKey(){return this._tickled.tickledId}tickleRow(e){!this.#c.has(e)||e.startsWith(`__group__`)||(this._tickled.focus(e),this._scrollRowIntoView(e))}appendRows(e){if(e.length===0)return;let n=this.rows.length,r=this._sortedRows.length===n&&m_(this.#d,[this.rows,this.sortState,this.columns]);if(this.rows=[...this.rows,...e],!r)return;let i=this.rows.slice(n);this._sortedRows=[...this._sortedRows,...i],this.#I(i,n),this.#M(),this.sortState!=null&&(cancelAnimationFrame(this.#O),this.#O=requestAnimationFrame(()=>{this.#d=void 0,this.requestUpdate()}))}#I(e,n){if(this.groupBy){this._rebuildFlat();return}for(let r=0;r<e.length;r++){let i=n+r;if(this.filterPredicate&&!this.filterPredicate(e[r]))continue;let a=this.getRowKey(e[r],i);this._flat.push({type:`row`,key:a,row:e[r],idx:i}),this._flatKeys.push(a),this.#c.set(a,this._flat.length-1)}this.#l++,this.#p=void 0}_replaceSelection(e){if(this.selectionMode===`none`)return;let n=new Set(this._selectedKeys);if(this.groupBy&&!this.crossGroupSelection){let r=this._getGroupKey(this._getRowForKey(e)??{key:e});[...n].filter(e=>this._getGroupKey(this._getRowForKey(e)??{key:e})===r),this._selectedKeys=new Set([e])}else this._selectedKeys=new Set([e]);this._anchorKey=e,this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:n},bubbles:!0,composed:!0}))}_toggleSelection(e){let n=new Set(this._selectedKeys),r=new Set(this._selectedKeys);if(r.has(e))r.delete(e);else{if(this.groupBy&&!this.crossGroupSelection){let n=this._getGroupKey(this._getRowForKey(e)??{key:e});for(let e of[...r])this._getGroupKey(this._getRowForKey(e)??{key:e})!==n&&r.delete(e)}this.selectionMode!==`multiple`&&this.interactionMode!==`checked`&&this.interactionMode!==`sticky`&&r.clear(),r.add(e)}this._selectedKeys=r,this._anchorKey=e,this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:n},bubbles:!0,composed:!0}))}_rangeSelectTo(e){if(!this._anchorKey){this._replaceSelection(e);return}let n=this._flat.filter(e=>e.type===`row`).map(e=>e.key),r=n.indexOf(this._anchorKey),i=n.indexOf(e);if(r<0||i<0){this._replaceSelection(e);return}if(this.groupBy&&!this.crossGroupSelection){let r=this._getGroupKey(this._getRowForKey(this._anchorKey)??{key:this._anchorKey});if(r!==this._getGroupKey(this._getRowForKey(e)??{key:e})){this._replaceSelection(e);return}let i=n.filter(e=>this._getGroupKey(this._getRowForKey(e)??{key:e})===r),a=i.indexOf(this._anchorKey),o=i.indexOf(e);if(a<0||o<0){this._replaceSelection(e);return}let s=Math.min(a,o),c=Math.max(a,o),l=new Set(this._selectedKeys);this._selectedKeys=new Set(i.slice(s,c+1)),this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:l},bubbles:!0,composed:!0}));return}let a=Math.min(r,i),o=Math.max(r,i),s=new Set(this._selectedKeys);this._selectedKeys=new Set(n.slice(a,o+1)),this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:s},bubbles:!0,composed:!0}))}_isEditable(e,n){return this.editability===`disabled`?!1:typeof this.editable==`function`?this.editable(e,n):this.editable===!0?n.editable!==!1:!!n.editable}_isTextEditor(e){let n=e.editor;return!n||n===`auto`}_isCellEditing(e,n){return this.editability===`immediate`&&this._isEditable(this.#F(e)?.row??{},this.columns.find(e=>e.key===n))?!0:this._editingRow===e?this._isEditable(this.#F(e)?.row??{},this.columns.find(e=>e.key===n)):this._editing?.rowKey===e&&this._editing?.colKey===n}_activateRow(e,n,r){this.dispatchEvent(new CustomEvent(`datagrid-row-activate`,{detail:{rowKey:e,row:n,rowIndex:r},bubbles:!0,composed:!0}))}_startEdit(e,n){if(this.editability===`disabled`)return;let r=this.#F(e)?.row;if(!r)return;let i=this.columns.find(e=>e.key===n);!i||!this._isEditable(r,i)||(this._editing={rowKey:e,colKey:n},this._editingRow=null,this._editValue=r[n])}startEdit(e,n){this._startEdit(e,n)}startRowEdit(e){this.editability!==`disabled`&&this.#F(e)?.row&&(this._editing=null,this._editingRow=e,this.requestUpdate())}stopEdit(){this._editing=null,this._editingRow=null}setColumnFormatter(e,n,r){if(!n){this._columnFormatters.delete(e),this.requestUpdate();return}if(typeof n==`string`){let i=r?.digits??(n===`integer`?0:2);n===`fixed`?this._columnFormatters.set(e,e=>typeof e==`number`&&Number.isFinite(e)?e.toFixed(i):String(e??``)):n===`percentage`?this._columnFormatters.set(e,e=>typeof e==`number`&&Number.isFinite(e)?`${e.toFixed(i)}%`:String(e??``)):n===`integer`&&this._columnFormatters.set(e,e=>typeof e==`number`&&Number.isFinite(e)?Math.round(e).toString():String(e??``))}else this._columnFormatters.set(e,n);this.requestUpdate()}_formatValue(e,n,r){let i=this._columnFormatters.get(n.key);return i?i(e):n.formatter?n.formatter(e,r,n):this.globalFormatter?this.globalFormatter(e,n.key,r):e}_cellLook(e,n){if(this.textColorColumn===``&&this.iconColumn===``&&this.badgeColumn===``)return f_;let r=typeof e==`object`&&e?e:{},i=n===this.textColorColumn?Hg(r.textColor):void 0,a=n===this.iconColumn&&!Vg(r.icon)?r.icon:void 0,o=a===void 0?void 0:Hg(r.iconColor),s=n===this.badgeColumn&&!Vg(r.badge)?r.badge:void 0;return i===void 0&&a===void 0&&s===void 0?f_:{textColor:i,icon:a,iconColor:o,badge:s}}_handleCellSecondClick(e,n){if(this.editability!==`user`)return;let r=Date.now();this._lastClick&&this._lastClick.key===e&&this._lastClick.col===n.key&&r-this._lastClick.time<700&&r-this._lastClick.time>150?(this._startEdit(e,n.key),this._lastClick=null):this._lastClick={key:e,col:n.key,time:r}}_commitEdit(e=!1){if(!this._editing&&!e)return;let n=this._editing;if(!n)return;let{rowKey:r,colKey:i}=n,a=this.#F(r)?.row;if(!a){this._editing=null;return}let o=a[i],s=this._editValue,c=this.columns.find(e=>e.key===i);c?.editor&&typeof c.editor==`function`||(a[i]=s,this.rows=[...this.rows]),this._editing=null,this.dispatchEvent(new CustomEvent(`datagrid-cell-edit`,{detail:{rowKey:r,colKey:i,oldValue:o,newValue:s},bubbles:!0,composed:!0}))}_tabToNext(e,n,r){let i=this.#F(e)?.row;if(!i)return;let a=this._visibleColumns,o=a.findIndex(e=>e.key===n)+r;for(;o>=0&&o<a.length;){if(this._isEditable(i,a[o])){this._editing&&this._commitEdit(),this._suppressBlurCommit=!0,this._startEdit(e,a[o].key),requestAnimationFrame(()=>{this._suppressBlurCommit=!1});return}o+=r}this._editing&&this._commitEdit(),this._editing=null,this.requestUpdate()}_commitImmediate(e,n,r){let i=this.#F(e)?.row;if(!i)return;let a=i[n];a!==r&&(i[n]=r,this.rows=[...this.rows],this.dispatchEvent(new CustomEvent(`datagrid-cell-edit`,{detail:{rowKey:e,colKey:n,oldValue:a,newValue:r},bubbles:!0,composed:!0})))}_measureAutoWidth(e){let n=getComputedStyle(this),r=`${n.fontSize} ${n.fontFamily}`,i=document.createElement(`canvas`).getContext(`2d`),a=e=>i?(i.font=r,Math.ceil(i.measureText(e).width)):e.length*8,o=a(e.label)+40;for(let n of this.rows){let r=n[e.key];if(r==null||r===``)continue;let i=a(String(this._formatValue(r,e,n)))+24;i>o&&(o=i)}let s=e.minWidth??40,c=e.maxWidth??600;return Math.max(s,Math.min(c,o))}_autoSizeColumn(e){let n=this._measureAutoWidth(e);e.width=n,this.requestUpdate(),this.dispatchEvent(new CustomEvent(`datagrid-column-resize`,{detail:{key:e.key,width:n},bubbles:!0,composed:!0}))}autoSizeColumn(e){let n=this.columns.find(n=>n.key===e);if(!n||n.resizable===!1||n.renderer)return!1;let r=this._measureAutoWidth(n);return(n.width??150)===r||(this._animatingColKeys=new Set(this._animatingColKeys).add(e),requestAnimationFrame(()=>{n.width=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(`datagrid-column-resize`,{detail:{key:e,width:r},bubbles:!0,composed:!0})),window.setTimeout(()=>{let n=new Set(this._animatingColKeys);n.delete(e),this._animatingColKeys=n},this._columnResizeAnimationMs())}),!0)}_columnResizeAnimationMs(){let e=getComputedStyle(this).getPropertyValue(`--data-grid-column-resize-duration`).trim(),n=e.endsWith(`ms`)?Number.parseFloat(e):e.endsWith(`s`)?Number.parseFloat(e)*1e3:Number.parseFloat(e);return(Number.isFinite(n)&&n>0?n:180)+30}_onResizePointerDown(e,n){e.preventDefault(),e.stopPropagation();let r=e.clientX,i=n.width??150;this._resizingColKey=n.key;let a=e=>{n.width=Math.max(n.minWidth??40,Math.min(n.maxWidth??600,i+e.clientX-r)),this.requestUpdate()},o=e=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),this._resizingColKey=void 0;let s=Math.max(n.minWidth??40,Math.min(n.maxWidth??600,i+e.clientX-r));this.dispatchEvent(new CustomEvent(`datagrid-column-resize`,{detail:{key:n.key,width:s},bubbles:!0,composed:!0}))};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)}#L(){return this._viewportEl.clientHeight-(this._headerRowEl?.offsetHeight??0)}#R(e){let n=this.rowHeight;return{start:Math.max(0,Math.floor(this._scrollTop/n)-e),end:Math.min(this._flat.length,Math.ceil((this._scrollTop+this._viewportH)/n)+e)}}getVisibleRange(){let{start:e,end:n}=this.#R(2);return{startRow:e,endRow:n,startCol:this._findFirstVisibleCol(this._scrollLeft),endCol:this._findLastVisibleCol(this._scrollLeft+this._viewportW)}}renderedKeys(){let{startRow:e,endRow:n}=this.getVisibleRange();return this._flat.slice(e,n).filter(e=>e.type===`row`).map(e=>e.key)}#z(){let{start:e,end:n}=this.#R(0);return this._flat.slice(e,n).filter(e=>e.type===`row`).map(e=>e.key)}#B(){this.#T===0&&(this.#T=requestAnimationFrame(()=>{this.#T=0,this.#V()}))}#V(){let e=this.renderedKeys(),n=this.#z();p_(this.#E,e)&&p_(this.#D,n)||(this.#E=e,this.#D=n,this.dispatchEvent(new CustomEvent(`datagrid-viewport-change`,{detail:{renderedKeys:e,visibleKeys:n},bubbles:!0,composed:!0})))}_findFirstVisibleCol(e){let n=0,r=this._colOffsets.length-1,i=0;for(;n<=r;){let a=n+r>>1;this._colOffsets[a]<=e?(i=a,n=a+1):r=a-1}return i}_findLastVisibleCol(e){for(let n=0;n<this._colOffsets.length;n++)if(this._colOffsets[n]>e)return n;return this._colOffsets.length}render(){let e=this.rowHeight,{start:n,end:r}=this.#R(2),o=this._flat.slice(n,r).map((e,r)=>({entry:e,absIdx:n+r})),s=this._editing?.rowKey??this._editingRow,c=s?this.#c.get(s):void 0;c!==void 0&&(c>=n&&c<r&&o.splice(c-n,1),o.unshift({entry:this._flat[c],absIdx:c}));let l=this.interactionMode===`checked`;return i`
|
|
5315
|
+
`]}#e;#t;#n;#r;#i;#a;#o(e){let n=this._flat.filter(e=>e.type===`row`);if(!n.some(n=>n.key===e))return;this._selectedKeys.has(e)||this._replaceSelection(e);let r=[],i=0;for(let e of n){if(!this._selectedKeys.has(e.key)){i++;continue}let n=this.renderRoot.querySelector(`.row[data-key="${CSS.escape(e.key)}"]`)??void 0;r.push({key:e.key,index:i,item:e.row,...n?{element:n}:{}}),i++}let a=r.find(n=>n.key===e);if(a)return{origin:a,selected:r}}#s(){this.#r&&clearTimeout(this.#r),this.#r=window.setTimeout(()=>{this.#r=0},0)}#c;#l;#u;#d;#f;#p;#m;#h;#g;get registry(){return this.#m}#_(e){if(this.rowSearchText)return this.rowSearchText(e);let n=e;return this._visibleColumns.map(e=>String(n[e.key]??``)).join(` `)}#v(){return{getItems:()=>(this.#g.clear(),this._sortedRows.forEach((e,n)=>this.#g.set(e,this.getRowKey(e,n))),this._sortedRows),getLabel:e=>this.#_(e),getKey:e=>this.#g.get(e)??String(this._sortedRows.indexOf(e)),focusItem:e=>{if(e===void 0)return;let n=this.#g.get(e);n!==void 0&&this.tickleRow(n)},selectItems:e=>{this.selectKeys(e.map(e=>this.#g.get(e)).filter(e=>e!==void 0))},applyFilter:e=>{this.filterPredicate=e===void 0?void 0:n=>{let r=this.#g.get(n);return r===void 0||e.has(r)}}}}#y(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#b(){this.#m&&(this.search.setModes(this.#y()),this.#h?.(),this.#h=Rt(this.#m,this.search))}#x;#S;#C;#w;#T;#E;#D;#O;#k;connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.#m??=Jt(),this.#b(),this.#k=Kg(()=>this._viewportEl??void 0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),cancelAnimationFrame(this._raf),cancelAnimationFrame(this.#T),this.#T=0,this.#h?.(),this.#h=void 0,this.#m=void 0,this.#C&&=(clearTimeout(this.#C),0),this.#r&&=(clearTimeout(this.#r),0),this.#e?.disconnect(),this.#e=void 0,this.#k?.(),this.#k=void 0}dispatch(e,n){this.#m?.invoke(e,n)}firstUpdated(){this.#e=new ResizeObserver(()=>this.#A()),this.#e.observe(this._viewportEl),this.#A()}#A(){if(!this._viewportEl)return;let e=this._viewportEl,n=e.clientWidth,r=this.#L();if(n<=0||r<=0)return;let i=e.parentElement;i.style.setProperty(`--data-grid-scrollbar-width`,`${e.offsetWidth-n}px`),i.style.setProperty(`--data-grid-viewport-width`,`${n}px`),(n!==this._viewportW||r!==this._viewportH)&&(this._viewportW=n,this._viewportH=r,this.#B())}refreshLayout(){this.#A(),this.requestUpdate()}updated(e){super.updated(e),(e.has(`rows`)||e.has(`sortState`)||e.has(`columns`)||e.has(`groupBy`)||e.has(`groupLabel`)||e.has(`filterPredicate`)||e.has(`rowHeight`))&&this.#B(),(e.has(`_editing`)||e.has(`_editingRow`))&&this.updateComplete.then(()=>{let e=null;if(this._editing?e=`.row[data-key="${this._editing.rowKey}"] .cell[data-col="${this._editing.colKey}"] input, .row[data-key="${this._editing.rowKey}"] .cell[data-col="${this._editing.colKey}"] select`:this._editingRow&&(e=`.row[data-key="${this._editingRow}"] .cell input, .row[data-key="${this._editingRow}"] .cell select`),!e)return;let n=this.renderRoot.querySelector(e);n?.focus(),n instanceof HTMLInputElement&&n.type===`text`&&n.select()})}willUpdate(e){super.willUpdate(e),this.setAttribute(`data-input-mode`,this._tickled.inputMode),e.has(`searchModes`)&&this.#b(),this.#j(),this._visibleColumns=this.columns.filter(e=>e.visible!==!1);let n=0;this._colOffsets=this._visibleColumns.map(e=>{let r=n;return n+=e.width??150,r}),this._colWidthSum=n,this.interactionMode===`checked`&&(this._colWidthSum+=28),this.#l!==this.#u&&(this.#u=this.#l,this.#N())}#j(){let e=[this.rows,this.sortState,this.columns],n=[this.filterPredicate,this.groupBy,this.groupLabel,this._collapsedGroups,this.getRowKey],r=!m_(this.#d,e);r&&(this.#d=e,this._sortedRows=this._applySort([...this.rows])),(r||!m_(this.#f,n))&&(this.#f=n,this._rebuildFlat())}#M(){this.#d=[this.rows,this.sortState,this.columns],this.#f=[this.filterPredicate,this.groupBy,this.groupLabel,this._collapsedGroups,this.getRowKey]}#N(){let e=this._flatKeys,n=this.#x;if(this.#x=e.slice(),!this.#w){this.#w=!0;return}if(n.length===0||e.length===0){this.#S.clear();return}let r=new Set(n),i=e.filter(e=>!r.has(e)),a=n.length-(e.length-i.length);i.length===e.length||i.length===0&&a===0||(this.#S=new Set(i),this.toggleAttribute(`reflowing`,!0),this.#C&&clearTimeout(this.#C),this.#C=window.setTimeout(()=>{this.#C=0,this.#S.clear(),this.toggleAttribute(`reflowing`,!1),this.requestUpdate()},320))}_getGroupKey(e){return this.groupBy?typeof this.groupBy==`string`?String(e[this.groupBy]??``):String(this.groupBy(e)):null}_rebuildFlat(){let e=this.filterPredicate,n=[];for(let r=0;r<this._sortedRows.length;r++)(!e||e(this._sortedRows[r]))&&n.push(r);let r=[],i=[],a=e=>{let n=this._sortedRows[e],a=this.getRowKey(n,e);r.push({type:`row`,key:a,row:n,idx:e}),i.push(a)};if(!this.groupBy)n.forEach(a);else{let e=new Map;for(let r of n){let n=this._getGroupKey(this._sortedRows[r])??``,i=e.get(n);i?i.push(r):e.set(n,[r])}for(let[n,o]of e){let e=this.groupLabel?this.groupLabel(n,o.map(e=>this._sortedRows[e])):n,s=`__group__${n}`;r.push({type:`group`,key:s,label:e,count:o.length}),i.push(s),this._collapsedGroups.has(n)||o.forEach(a)}}this._flat=r,this._flatKeys=i,this.#P()}#P(){this.#c.clear(),this._flat.forEach((e,n)=>this.#c.set(e.key,n)),this.#l++,this.#p=void 0}#F(e){let n=this.#c.get(e),r=n===void 0?void 0:this._flat[n];if(r?.type===`row`)return r;let i=this._sortedRows.findIndex((n,r)=>this.getRowKey(n,r)===e);return i<0?void 0:{row:this._sortedRows[i],idx:i}}_toggleGroup(e){let n=new Set(this._collapsedGroups);n.has(e)?n.delete(e):n.add(e),this._collapsedGroups=n}_applySort(e){if(!this.sortState)return e;let n=this.columns.find(e=>e.key===this.sortState.key);if(!n)return e;let r=this.sortState.direction===`asc`?1:-1;if(n.sortFn)return e.sort((e,i)=>r*n.sortFn(e,i));let i=n.dataType??`text`;return e.sort((e,a)=>{let o=e[n.key],s=a[n.key];return o===s?0:i===`number`?r*(o-s):i===`boolean`?r*(!!o==!!s?0:o?1:-1):r*String(o).localeCompare(String(s))})}_onHeaderClick(e,n){if(e.sortable===!1)return;if(n){let e=n.composedPath()[0];if(e&&this.#i.get(e)){this.#i.delete(e);return}}let r=this.sortState,i=null;i=!r||r.key!==e.key?{key:e.key,direction:`asc`}:r.direction===`asc`?{key:e.key,direction:`desc`}:null,this.sortState=i,this.dispatchEvent(new CustomEvent(`datagrid-sort`,{detail:{sort:i,previous:r},bubbles:!0,composed:!0}))}_onHeaderPointerUp(e,n){let r=!1,i=new CustomEvent(`datagrid-header-pointerup`,{detail:{key:e.key,column:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&(r=!0),r&&this.#i.set(n,!0)}_onColButtonClick(e,n){n.stopPropagation();let r=e.button===!1?this.columnButtonIcon:typeof e.button==`object`&&e.button.icon?e.button.icon:this.columnButtonIcon,i=n.currentTarget,a=new CustomEvent(`datagrid-header-button-click`,{detail:{key:e.key,column:e,icon:r,clientX:n.clientX,clientY:n.clientY,anchorElement:i},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(a),a.defaultPrevented&&this.#i.set(n,!0)}_onRowClick(e,n,r){if(!(this.#a.isDragging||this.#r!==0)&&!(n&&n.selectable===!1)&&(this.selectionMode!==`none`||this.interactionMode===`checked`||this.interactionMode===`sticky`)&&this.interactionMode!==`manual`){if(this.interactionMode===`implicit`){this._replaceSelection(e);return}if(this.interactionMode!==`checked`){if(this.interactionMode===`sticky`){this._toggleSelection(e);return}r.ctrlKey||r.metaKey?(this.selectionMode===`multiple`||this.interactionMode===`vscode`)&&this._toggleSelection(e):r.shiftKey&&(this.selectionMode===`multiple`||this.interactionMode===`vscode`)?this._rangeSelectTo(e):this._replaceSelection(e)}}}_onCheckboxClick(e,n){n.stopPropagation(),this._onRowClick(e,null,n)}_onVisibilityToggle(e,n){e.visible=n,this.columns=[...this.columns],this.dispatchEvent(new CustomEvent(`datagrid-column-visibility`,{detail:{key:e.key,visible:n},bubbles:!0,composed:!0}))}_beginHeaderDrag(e,n,r){e.stopPropagation();let i=e.currentTarget.closest(`.header-cell`)??e.currentTarget;this._drag={pointerId:e.pointerId,from:r,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,gap:void 0,sourceCol:n};let a=e=>{if(!this._drag||e.pointerId!==this._drag.pointerId)return;let r=e.clientX-this._drag.startX,a=e.clientY-this._drag.startY;if(!this._drag.active){if(Math.hypot(r,a)<5)return;this._drag.active=!0;let o=document.createElement(`span`);o.textContent=n.label;try{this._drag.ghost=Gg({anchor:i,content:o}),this._drag.ghost.move(e.clientX,e.clientY)}catch{}try{this._headerRowEl?.setPointerCapture(e.pointerId)}catch{}}this._drag.ghost?.move(e.clientX,e.clientY);let o=e.clientX-(this._headerRowEl?.getBoundingClientRect().left??0),s=this._drag.from,c=1/0;for(let e=0;e<this._visibleColumns.length;e++){if(e===this._drag.from)continue;let n=this._colOffsets[e],r=n+(this._visibleColumns[e].width??150),i=(n+r)/2,a=o<i?n:r,l=o<i?e:e+1,u=Math.abs(o-a);u<c&&(c=u,s=l>this._drag.from?l-1:l)}if(this._visibleColumns.length>0){let e=this._colOffsets[this._colOffsets.length-1]+(this._visibleColumns[this._visibleColumns.length-1].width??150),n=Math.abs(o-e);n<c&&(c=n,s=this._visibleColumns.length-1,this._drag.from===this._visibleColumns.length-1?s=this._drag.from:s>=this._drag.from&&(s=this._visibleColumns.length-1))}let l=this._visibleColumns.length-1,u=s;u<0&&(u=0),u>l&&(u=l),this._drag.gap=u,this.requestUpdate()},o=e=>{if(!this._drag||e.pointerId!==this._drag.pointerId)return;let n=this._drag.active,r=this._drag.from,i=this._drag.gap;this._drag.ghost?.destroy();try{this._headerRowEl?.releasePointerCapture(e.pointerId)}catch{}window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),this._drag=null,this.requestUpdate(),n&&i!==void 0&&i!==r&&this._onReorderDrag(r,i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)}_onReorderDrag(e,n){if(e===n)return;let r=[...this.columns],i=r.filter(e=>e.visible!==!1),a=r.filter(e=>e.visible===!1),[o]=i.splice(e,1);i.splice(n,0,o),this.columns=[...i,...a],this.dispatchEvent(new CustomEvent(`datagrid-column-reorder`,{detail:{from:e,to:n,columns:[...this.columns]},bubbles:!0,composed:!0}))}_scrollRowIntoView(e){let n=this.#c.get(e);if(n===void 0||!this._viewportEl)return;let r=this.rowHeight,i=(n>0&&this._flat[n-1].type===`group`?n-1:n)*r,a=(n+1)*r,o=this._viewportEl.scrollTop,s=this.#L(),c=o;i<o?c=i:a>o+s&&(c=a-s),c!==o&&(this._viewportEl.scrollTop=c,this._scrollTop=c,this.requestUpdate())}_getRowForKey(e){let n=this.#c.get(e),r=n===void 0?void 0:this._flat[n];return r?.type===`row`?r.row:void 0}get selectedKeys(){return this._selectedKeys}set selectedKeys(e){this.selectKeys(e)}selectKeys(e){let n=new Set([...e].filter(e=>this._getRowForKey(e)!==void 0)),r=this.selectionMode===`multiple`||this.interactionMode===`checked`||this.interactionMode===`sticky`||this.interactionMode===`vscode`;if(this.selectionMode===`none`)n=new Set;else if(!r&&n.size>1){let e=[...n].at(-1);n=e===void 0?new Set:new Set([e])}let i=new Set(this._selectedKeys);i.size===n.size&&[...n].every(e=>i.has(e))||(this._selectedKeys=n,this._anchorKey=[...n].at(-1),this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(n),previous:i},bubbles:!0,composed:!0})))}get tickledKey(){return this._tickled.tickledId}tickleRow(e){!this.#c.has(e)||e.startsWith(`__group__`)||(this._tickled.focus(e),this._scrollRowIntoView(e))}appendRows(e){if(e.length===0)return;let n=this.rows.length,r=this._sortedRows.length===n&&m_(this.#d,[this.rows,this.sortState,this.columns]);if(this.rows=[...this.rows,...e],!r)return;let i=this.rows.slice(n);this._sortedRows=[...this._sortedRows,...i],this.#I(i,n),this.#M(),this.sortState!=null&&(cancelAnimationFrame(this.#O),this.#O=requestAnimationFrame(()=>{this.#d=void 0,this.requestUpdate()}))}#I(e,n){if(this.groupBy){this._rebuildFlat();return}for(let r=0;r<e.length;r++){let i=n+r;if(this.filterPredicate&&!this.filterPredicate(e[r]))continue;let a=this.getRowKey(e[r],i);this._flat.push({type:`row`,key:a,row:e[r],idx:i}),this._flatKeys.push(a),this.#c.set(a,this._flat.length-1)}this.#l++,this.#p=void 0}_replaceSelection(e){if(this.selectionMode===`none`)return;let n=new Set(this._selectedKeys);if(this.groupBy&&!this.crossGroupSelection){let r=this._getGroupKey(this._getRowForKey(e)??{key:e});[...n].filter(e=>this._getGroupKey(this._getRowForKey(e)??{key:e})===r),this._selectedKeys=new Set([e])}else this._selectedKeys=new Set([e]);this._anchorKey=e,this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:n},bubbles:!0,composed:!0}))}_toggleSelection(e){let n=new Set(this._selectedKeys),r=new Set(this._selectedKeys);if(r.has(e))r.delete(e);else{if(this.groupBy&&!this.crossGroupSelection){let n=this._getGroupKey(this._getRowForKey(e)??{key:e});for(let e of[...r])this._getGroupKey(this._getRowForKey(e)??{key:e})!==n&&r.delete(e)}this.selectionMode!==`multiple`&&this.interactionMode!==`checked`&&this.interactionMode!==`sticky`&&r.clear(),r.add(e)}this._selectedKeys=r,this._anchorKey=e,this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:n},bubbles:!0,composed:!0}))}_rangeSelectTo(e){if(!this._anchorKey){this._replaceSelection(e);return}let n=this._flat.filter(e=>e.type===`row`).map(e=>e.key),r=n.indexOf(this._anchorKey),i=n.indexOf(e);if(r<0||i<0){this._replaceSelection(e);return}if(this.groupBy&&!this.crossGroupSelection){let r=this._getGroupKey(this._getRowForKey(this._anchorKey)??{key:this._anchorKey});if(r!==this._getGroupKey(this._getRowForKey(e)??{key:e})){this._replaceSelection(e);return}let i=n.filter(e=>this._getGroupKey(this._getRowForKey(e)??{key:e})===r),a=i.indexOf(this._anchorKey),o=i.indexOf(e);if(a<0||o<0){this._replaceSelection(e);return}let s=Math.min(a,o),c=Math.max(a,o),l=new Set(this._selectedKeys);this._selectedKeys=new Set(i.slice(s,c+1)),this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:l},bubbles:!0,composed:!0}));return}let a=Math.min(r,i),o=Math.max(r,i),s=new Set(this._selectedKeys);this._selectedKeys=new Set(n.slice(a,o+1)),this.dispatchEvent(new CustomEvent(`datagrid-select`,{detail:{selectedKeys:new Set(this._selectedKeys),previous:s},bubbles:!0,composed:!0}))}_isEditable(e,n){return this.editability===`disabled`?!1:typeof this.editable==`function`?this.editable(e,n):this.editable===!0?n.editable!==!1:!!n.editable}_isTextEditor(e){let n=e.editor;return!n||n===`auto`}_isCellEditing(e,n){return this.editability===`immediate`&&this._isEditable(this.#F(e)?.row??{},this.columns.find(e=>e.key===n))?!0:this._editingRow===e?this._isEditable(this.#F(e)?.row??{},this.columns.find(e=>e.key===n)):this._editing?.rowKey===e&&this._editing?.colKey===n}_activateRow(e,n,r){this.dispatchEvent(new CustomEvent(`datagrid-row-activate`,{detail:{rowKey:e,row:n,rowIndex:r},bubbles:!0,composed:!0}))}_startEdit(e,n){if(this.editability===`disabled`)return;let r=this.#F(e)?.row;if(!r)return;let i=this.columns.find(e=>e.key===n);!i||!this._isEditable(r,i)||(this._editing={rowKey:e,colKey:n},this._editingRow=null,this._editValue=r[n])}startEdit(e,n){this._startEdit(e,n)}startRowEdit(e){this.editability!==`disabled`&&this.#F(e)?.row&&(this._editing=null,this._editingRow=e,this.requestUpdate())}stopEdit(){this._editing=null,this._editingRow=null}setColumnFormatter(e,n,r){if(!n){this._columnFormatters.delete(e),this.requestUpdate();return}if(typeof n==`string`){let i=r?.digits??(n===`integer`?0:2);n===`fixed`?this._columnFormatters.set(e,e=>typeof e==`number`&&Number.isFinite(e)?e.toFixed(i):String(e??``)):n===`percentage`?this._columnFormatters.set(e,e=>typeof e==`number`&&Number.isFinite(e)?`${e.toFixed(i)}%`:String(e??``)):n===`integer`&&this._columnFormatters.set(e,e=>typeof e==`number`&&Number.isFinite(e)?Math.round(e).toString():String(e??``))}else this._columnFormatters.set(e,n);this.requestUpdate()}_formatValue(e,n,r){let i=this._columnFormatters.get(n.key);return i?i(e):n.formatter?n.formatter(e,r,n):this.globalFormatter?this.globalFormatter(e,n.key,r):e}_cellLook(e,n){if(this.textColorColumn===``&&this.iconColumn===``&&this.badgeColumn===``)return f_;let r=typeof e==`object`&&e?e:{},i=n===this.textColorColumn?Hg(r.textColor):void 0,a=n===this.iconColumn&&!Vg(r.icon)?r.icon:void 0,o=a===void 0?void 0:Hg(r.iconColor),s=n===this.badgeColumn&&!Vg(r.badge)?r.badge:void 0;return i===void 0&&a===void 0&&s===void 0?f_:{textColor:i,icon:a,iconColor:o,badge:s}}_handleCellSecondClick(e,n){if(this.editability!==`user`)return;let r=Date.now();this._lastClick&&this._lastClick.key===e&&this._lastClick.col===n.key&&r-this._lastClick.time<700&&r-this._lastClick.time>150?(this._startEdit(e,n.key),this._lastClick=null):this._lastClick={key:e,col:n.key,time:r}}_commitEdit(e=!1){if(!this._editing&&!e)return;let n=this._editing;if(!n)return;let{rowKey:r,colKey:i}=n,a=this.#F(r)?.row;if(!a){this._editing=null;return}let o=a[i],s=this._editValue,c=this.columns.find(e=>e.key===i);c?.editor&&typeof c.editor==`function`||(a[i]=s,this.rows=[...this.rows]),this._editing=null,this.dispatchEvent(new CustomEvent(`datagrid-cell-edit`,{detail:{rowKey:r,colKey:i,oldValue:o,newValue:s},bubbles:!0,composed:!0}))}_tabToNext(e,n,r){let i=this.#F(e)?.row;if(!i)return;let a=this._visibleColumns,o=a.findIndex(e=>e.key===n)+r;for(;o>=0&&o<a.length;){if(this._isEditable(i,a[o])){this._editing&&this._commitEdit(),this._suppressBlurCommit=!0,this._startEdit(e,a[o].key),requestAnimationFrame(()=>{this._suppressBlurCommit=!1});return}o+=r}this._editing&&this._commitEdit(),this._editing=null,this.requestUpdate()}_commitImmediate(e,n,r){let i=this.#F(e)?.row;if(!i)return;let a=i[n];a!==r&&(i[n]=r,this.rows=[...this.rows],this.dispatchEvent(new CustomEvent(`datagrid-cell-edit`,{detail:{rowKey:e,colKey:n,oldValue:a,newValue:r},bubbles:!0,composed:!0})))}_measureAutoWidth(e){let n=getComputedStyle(this),r=`${n.fontSize} ${n.fontFamily}`,i=document.createElement(`canvas`).getContext(`2d`),a=e=>i?(i.font=r,Math.ceil(i.measureText(e).width)):e.length*8,o=e.fixedExtraWidth??0,s=a(e.label)+40;for(let n of this.rows){if(e.measure){s=Math.max(s,e.measure(n,e)+24);continue}let r=n[e.key];if(r==null||r===``)continue;let i=a(String(this._formatValue(r,e,n)))+24+o;i>s&&(s=i)}let c=e.minWidth??40,l=e.maxWidth??600;return Math.max(c,Math.min(l,s))}_autoSizeColumn(e){let n=this._measureAutoWidth(e);e.width=n,this.requestUpdate(),this.dispatchEvent(new CustomEvent(`datagrid-column-resize`,{detail:{key:e.key,width:n},bubbles:!0,composed:!0}))}autoSizeColumn(e){let n=this.columns.find(n=>n.key===e);if(!n||n.resizable===!1||n.renderer&&!n.measure&&n.fixedExtraWidth===void 0)return!1;let r=this._measureAutoWidth(n);return(n.width??150)===r||(this._animatingColKeys=new Set(this._animatingColKeys).add(e),requestAnimationFrame(()=>{n.width=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(`datagrid-column-resize`,{detail:{key:e,width:r},bubbles:!0,composed:!0})),window.setTimeout(()=>{let n=new Set(this._animatingColKeys);n.delete(e),this._animatingColKeys=n},this._columnResizeAnimationMs())}),!0)}_columnResizeAnimationMs(){let e=getComputedStyle(this).getPropertyValue(`--data-grid-column-resize-duration`).trim(),n=e.endsWith(`ms`)?Number.parseFloat(e):e.endsWith(`s`)?Number.parseFloat(e)*1e3:Number.parseFloat(e);return(Number.isFinite(n)&&n>0?n:180)+30}_onResizePointerDown(e,n){e.preventDefault(),e.stopPropagation();let r=e.clientX,i=n.width??150;this._resizingColKey=n.key;let a=e=>{n.width=Math.max(n.minWidth??40,Math.min(n.maxWidth??600,i+e.clientX-r)),this.requestUpdate()},o=e=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),this._resizingColKey=void 0;let s=Math.max(n.minWidth??40,Math.min(n.maxWidth??600,i+e.clientX-r));this.dispatchEvent(new CustomEvent(`datagrid-column-resize`,{detail:{key:n.key,width:s},bubbles:!0,composed:!0}))};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)}#L(){return this._viewportEl.clientHeight-(this._headerRowEl?.offsetHeight??0)}#R(e){let n=this.rowHeight;return{start:Math.max(0,Math.floor(this._scrollTop/n)-e),end:Math.min(this._flat.length,Math.ceil((this._scrollTop+this._viewportH)/n)+e)}}getVisibleRange(){let{start:e,end:n}=this.#R(2);return{startRow:e,endRow:n,startCol:this._findFirstVisibleCol(this._scrollLeft),endCol:this._findLastVisibleCol(this._scrollLeft+this._viewportW)}}renderedKeys(){let{startRow:e,endRow:n}=this.getVisibleRange();return this._flat.slice(e,n).filter(e=>e.type===`row`).map(e=>e.key)}#z(){let{start:e,end:n}=this.#R(0);return this._flat.slice(e,n).filter(e=>e.type===`row`).map(e=>e.key)}#B(){this.#T===0&&(this.#T=requestAnimationFrame(()=>{this.#T=0,this.#V()}))}#V(){let e=this.renderedKeys(),n=this.#z();p_(this.#E,e)&&p_(this.#D,n)||(this.#E=e,this.#D=n,this.dispatchEvent(new CustomEvent(`datagrid-viewport-change`,{detail:{renderedKeys:e,visibleKeys:n},bubbles:!0,composed:!0})))}_findFirstVisibleCol(e){let n=0,r=this._colOffsets.length-1,i=0;for(;n<=r;){let a=n+r>>1;this._colOffsets[a]<=e?(i=a,n=a+1):r=a-1}return i}_findLastVisibleCol(e){for(let n=0;n<this._colOffsets.length;n++)if(this._colOffsets[n]>e)return n;return this._colOffsets.length}render(){let e=this.rowHeight,{start:n,end:r}=this.#R(2),o=this._flat.slice(n,r).map((e,r)=>({entry:e,absIdx:n+r})),s=this._editing?.rowKey??this._editingRow,c=s?this.#c.get(s):void 0;c!==void 0&&(c>=n&&c<r&&o.splice(c-n,1),o.unshift({entry:this._flat[c],absIdx:c}));let l=this.interactionMode===`checked`;return i`
|
|
5316
5316
|
<div class="grid ${this.columnMenu===`auto`?`has-actions`:``}" role="grid" aria-rowcount=${this._flat.length+1} aria-colcount=${this._visibleColumns.length} aria-multiselectable=${this.selectionMode===`multiple`?`true`:`false`}>
|
|
5317
5317
|
<div class="viewport scroll-fade-y" @scroll=${this._onScroll}>
|
|
5318
5318
|
<div class="header-row scroll-fade-x" role="row" aria-rowindex="1">
|
|
@@ -5349,17 +5349,23 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
5349
5349
|
`})}
|
|
5350
5350
|
</div>
|
|
5351
5351
|
</div>
|
|
5352
|
-
${this.#
|
|
5352
|
+
${this.#W()}
|
|
5353
5353
|
${this.search.renderField()}
|
|
5354
5354
|
</div>
|
|
5355
|
-
`}#H(){return this.
|
|
5355
|
+
`}#H(e){return i`<ixfx-menu-check-item command="col:${e.key}" label=${e.label} ?checked=${e.visible!==!1}></ixfx-menu-check-item>`}#U(){let e=new Map,n=[];for(let r of this.columns){if(r.group===void 0||r.group===``){n.push(r);continue}e.set(r.group,[...e.get(r.group)??[],r])}return i`
|
|
5356
|
+
${_(n,e=>e.key,e=>this.#H(e))}
|
|
5357
|
+
${_([...e],([e])=>e,([e,n])=>i`
|
|
5358
|
+
<ixfx-menu-sub-trigger label=${e}>
|
|
5359
|
+
<ixfx-menu-container slot="submenu">
|
|
5360
|
+
${_(n,e=>e.key,e=>this.#H(e))}
|
|
5361
|
+
</ixfx-menu-container>
|
|
5362
|
+
</ixfx-menu-sub-trigger>
|
|
5363
|
+
`)}`}#W(){return this.columnMenu===`auto`?i`
|
|
5356
5364
|
<div class="header-actions">
|
|
5357
5365
|
<ixfx-menu-trigger label="⚙" placement="bottom-end" @menu-command=${e=>{let n=e.detail.command,r=e.detail.checked,i=e.detail.value;if(n?.startsWith(`col:`)){let i=n.slice(4),a=this.columns.find(e=>e.key===i);a&&this._onVisibilityToggle(a,!!r),e.stopPropagation();return}if(n===`groupBy`){let n=i??``;this.groupBy=n||null,this._collapsedGroups=new Set,this.dispatchEvent(new CustomEvent(`datagrid-group-change`,{detail:{groupBy:this.groupBy},bubbles:!0,composed:!0})),e.stopPropagation()}}}>
|
|
5358
5366
|
<ixfx-menu-container slot="menu">
|
|
5359
5367
|
<ixfx-menu-header label="Columns"></ixfx-menu-header>
|
|
5360
|
-
${
|
|
5361
|
-
<ixfx-menu-check-item command="col:${e.key}" label=${e.label} ?checked=${e.visible!==!1}></ixfx-menu-check-item>
|
|
5362
|
-
`)}
|
|
5368
|
+
${this.#U()}
|
|
5363
5369
|
${this.allowGrouping?i`
|
|
5364
5370
|
<ixfx-menu-separator></ixfx-menu-separator>
|
|
5365
5371
|
<ixfx-menu-header label="Group by"></ixfx-menu-header>
|
|
@@ -5604,7 +5610,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
5604
5610
|
<span class="label" part="label">${this.label}</span>
|
|
5605
5611
|
<span class="count" part="count">(${this.count})</span>
|
|
5606
5612
|
<span class="divider" part="divider"></span>
|
|
5607
|
-
`}};E([d({type:String,reflect:!0})],S_.prototype,`label`,void 0),E([d({type:Number,reflect:!0})],S_.prototype,`count`,void 0),E([d({type:Boolean,reflect:!0})],S_.prototype,`collapsed`,void 0),E([d({type:String,reflect:!0})],S_.prototype,`orientation`,void 0),S_=E([T(`ixfx-list-group-header`)],S_);const C_=`:scope > li`,w_=`data-ixfx-group-header`,T_=`data-group-collapsed`,E_=new Set([`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]);function D_(e,n,r){return r.width>0&&r.height>0&&e>=r.left&&e<r.right&&n>=r.top&&n<r.bottom}function O_(e,n,r){if(e instanceof Text){if(!e.textContent?.trim())return!1;let i=document.createRange();return i.selectNodeContents(e),Array.from(i.getClientRects()).some(e=>D_(n,r,e))}return!(e instanceof Element)||e.hasAttribute(`data-drag-select-blank`)?!1:e.hasAttribute(`data-drag-select-content`)?D_(n,r,e.getBoundingClientRect()):Array.from(e.childNodes).some(e=>O_(e,n,r))?!0:e.childNodes.length===0&&D_(n,r,e.getBoundingClientRect())}function k_(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function A_(e,n){if(e.size!==n.size)return!1;for(let r of e)if(!n.has(r))return!1;return!0}function j_(e,n,r){for(let i of e)n.has(i)||i.removeAttribute(r);for(let i of n)e.has(i)||i.setAttribute(r,``)}const M_=[`hidden`,T_,`not-checked`,`data-key`,`data-value`];function N_(e,n){return n.type===`childList`?n.target===e:n.target.parentElement===e}function P_(e,n,r){let i=e=>{let n=e;for(;n&&!r(n);)n=n.nextElementSibling;return n},a=i(e.firstElementChild);for(let r of n){if(r===a){a=i(a.nextElementSibling);continue}e.insertBefore(r,a)}}let V=class extends n{constructor(...e){super(...e),this.selectionMode=`single`,this.interactionMode=`standard`,this.sort=`none`,this.sortBy=``,this.items=[],this.displayProperty=``,this.iconProperty=``,this.iconColorProperty=``,this.textColorProperty=``,this.badgeProperty=``,this.keyProperty=``,this.itemWrap=`stop`,this.itemsDraggable=!1,this.groupBy=null,this.crossGroupSelection=!1,this._collapsedGroups=new Set,this.#e=new WeakMap,this.#t=new WeakMap,this.#n=g_,this.#r=!0,this.#i=!1,this.#p=new Set,this.#m=new Set,this.#h=!0,this.#g=!1,this.#_=!1,this.#v=0,this.#y=0,this.#w=new WeakSet,this.#T=[],this.#E=new Map,this.#D=[],this.#O=new Map,this.#k=new WeakMap,this.#A=0,this.#j=!1,this.#M=!1,this.#N=!1,this.#F=0,this.#I=new je(this),this.selection=new nr({getOrderedItems:()=>this._getVisibleItems(),isSelectable:e=>this._isCheckable(e),getModes:()=>({selectionMode:this.selectionMode,interactionMode:this.interactionMode}),getKey:D,getGroupKey:e=>this.#E.get(e)??null,crossGroupSelection:()=>this.crossGroupSelection,getFallbackGroupKey:()=>{let e=this.tickled.tickledId;return e?this.#E.get(e)??null:null},onChange:(e,n)=>{this._syncItemStates(),this._dispatch(`list-select`,{selected:e,previous:n,selectedKeys:this.selection.selectedKeys})}}),this.tickled=new oe(this,{getItems:()=>{let e=this._getVisibleItems();return this.#l??=e.map(e=>({id:e,enabled:!e.hasAttribute(`not-checked`)})),this.#l},onTickle:e=>{e!==void 0&&this._dispatch(`list-tickle`,{item:e})},onStateChange:()=>this._syncItemStates(),itemWrap:this.itemWrap,hoverDisabled:()=>this.#G.isDragging||this.#V.isDragging}),this.#L=!1,this.#R=0,this.#z=!1,this.#B=()=>{this.#z=!1},this.#V=new er(this,{source:`detail-list`,isEnabled:()=>this.itemsDraggable&&this.selectionMode!==`none`&&this._getVisibleItems().length>0,resolveEventToKey:e=>{if(!(e instanceof Element))return;let n=e.closest?.(`li`);if(!(!n||!this.contains(n)))return D(n)},prepareSelection:e=>this.#H(e),getMetrics:()=>({}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>this._dispatchCancelable(`list-native-drag-start`,e),onActiveChange:(e,n)=>{this.#L=e,this.toggleAttribute(`data-native-dragging`,e);for(let r of this.querySelectorAll(`li`))r.toggleAttribute(`data-drag-origin`,e&&n!==void 0&&D(r)===n);if(e){let e=this.selection.selected.size;this.setAttribute(`aria-label`,e<=1?`Dragging 1 item`:`Dragging ${e} items`)}else this.removeAttribute(`aria-label`);this.requestUpdate()},onEnd:()=>{this.#L=!1,this.toggleAttribute(`data-native-dragging`,!1),this.removeAttribute(`aria-label`);for(let e of this.querySelectorAll(`li`))e.removeAttribute(`data-drag-origin`);this.#U()},syncLightDomDraggable:()=>this._syncNativeDraggable(),shouldStart:()=>!this.#z}),this.#G=new Hn(this,{getSurface:()=>this.renderRoot.querySelector(`.container`),isEnabled:()=>this.selection.canDragSelect()&&this._getVisibleItems().length>0&&!this.hasAttribute(`disable-drag-select`),hitTest:e=>this.#q(e),getBaseSelection:()=>this.selection.selected,onPreview:(e,n)=>{this.#W=n;for(let n of this._getVisibleItems())n.toggleAttribute(`data-marquee`,e.has(n));this.requestUpdate()},onCommit:e=>{this.selection.applyDragSelection(e);for(let e of this._getVisibleItems())e.removeAttribute(`data-marquee`);this.#W=void 0,this.requestUpdate()},autoScroll:(e,n)=>{this._listEl&&(this._listEl.scrollLeft+=e)},shouldStart:e=>!this.#ve(e.composedPath())&&(this.#z=this.itemsDraggable&&this.#K(e),!this.itemsDraggable||this.#z)}),this.search=new Vt(this,{adapter:Mt(this,{itemSelector:C_,getLabel:e=>e.getAttribute(`data-search-label`)??e.textContent?.trim()??``,highlightKey:`detail-list-search`})}),this.#Ue=()=>{this.#y===0&&(this.#y=requestAnimationFrame(()=>{this.#y=0,this.#Ke()}))},this._onPointerOver=e=>{let n=this._findListItem(e.composedPath());n&&this.tickled.handlePointerEnter(n)},this._onPointerLeave=e=>{this.tickled.handlePointerLeave(e)},this._endKeyboardNav=()=>{this.removeAttribute(`data-keyboard-nav`)},this._onKeyDown=e=>{if(!this.search.isOpen){if((e.ctrlKey||e.metaKey)&&e.key===`a`){this.selection.canSelectAll()&&(e.preventDefault(),this.selection.selectAll());return}switch(E_.has(e.key)&&!this.hasAttribute(`data-keyboard-nav`)&&this.setAttribute(`data-keyboard-nav`,``),e.key){case`ArrowDown`:if(e.preventDefault(),this.#Ae(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`ArrowUp`:if(e.preventDefault(),this.#je(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`ArrowRight`:e.preventDefault(),this.#Ne();break;case`ArrowLeft`:e.preventDefault(),this.#Pe();break;case`Home`:e.preventDefault(),this.#Ee(this.#Oe());break;case`End`:e.preventDefault(),this.#Ee(this.#ke());break;case`Enter`:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this._dispatch(`list-item-click`,{item:n}),this._activateItem(n));break}case` `:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.selection.handleSpace(n));break}case`Escape`:this.selection.clear()}}},this._onClick=e=>{if(this.#G.isDragging||this.#V.isDragging||this.#R!==0)return;let n=e.composedPath(),r=this.#ve(n);if(r){this.toggleGroup(r.dataset.groupKey??``);return}let i=this._findListItem(n);i&&(this.focus(),this._dispatch(`list-item-click`,{item:i}),this.selection.handleClick(i,e))},this._onDblClick=e=>{let n=this._findListItem(e.composedPath());n&&this._activateItem(n)},this._onWheel=e=>{e.preventDefault();let n=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;this._listEl.scrollLeft+=n}}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H(e){let n=this._getVisibleItems(),r=n.find(n=>D(n)===e);if(!r||!this._isCheckable(r))return;this.selection.selected.has(r)||this.selection.replace(r);let i=[];n.forEach((n,r)=>{if(!this.selection.selected.has(n))return;let a=D(n)??e;i.push({key:a,index:r,item:this.#e.get(n)??n,element:n})});let a=i.find(n=>n.key===e);if(a)return{origin:a,selected:i}}_syncNativeDraggable(){if(this.isConnected&&!(!this.itemsDraggable&&!this.#_)){this.#_=this.itemsDraggable;for(let e of this.querySelectorAll(`li`))e instanceof HTMLElement&&(e.draggable=this.itemsDraggable&&this._isCheckable(e))}}#U(){this.#R&&clearTimeout(this.#R),this.#R=window.setTimeout(()=>{this.#R=0},0)}#W;#G;#K(e){let n=e.composedPath(),r=this._findListItem(n);if(!r)return!1;for(let e of n){if(e===r)break;if(e instanceof Element){if(e.matches(`input, button, a, select, textarea, [contenteditable], .ixfx-list-checkbox, [role="checkbox"]`))return!1;if(e.hasAttribute(`data-drag-select-blank`))return!0;if(e.hasAttribute(`data-drag-select-content`))return!1}}return!Array.from(r.childNodes).some(n=>O_(n,e.clientX,e.clientY))}#q(e){let n=this.renderRoot.querySelector(`.container`);if(!n)return[];let r=n.getBoundingClientRect(),i=e.x,a=e.y,o=e.x+e.width,s=e.y+e.height,c=[];for(let e of this._getVisibleItems()){let n=e.getBoundingClientRect(),l=n.left-r.left,u=n.top-r.top;l<=o&&l+n.width>=i&&u<=s&&u+n.height>=a&&c.push(e)}return c}#J(e){return`left:${e.x}px;top:${e.y}px;width:${Math.max(0,e.width)}px;height:${Math.max(0,e.height)}px`}#Y;#X;get registry(){return this.#Y}#Z(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#Q(){this.#Y&&(this.search.setModes(this.#Z()),this.#X?.(),this.#X=Rt(this.#Y,this.search))}connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.addEventListener(`pointerover`,this._onPointerOver),this.addEventListener(`pointerleave`,this._onPointerLeave),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`pointermove`,this._endKeyboardNav),this.addEventListener(`pointerdown`,this._endKeyboardNav),this.addEventListener(`click`,this._onClick),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`wheel`,this._onWheel),window.addEventListener(`pointerup`,this.#B),window.addEventListener(`pointercancel`,this.#B),this.#S=new ResizeObserver(()=>this.#ye()),this.#S.observe(this),this.#C=new MutationObserver(e=>{this.#He(e),this.#$(e),this.#ye(),this.#de()}),this.#C.observe(this,{childList:!0,subtree:!1,attributeFilter:[`hidden`]});for(let e of this.querySelectorAll(C_))this.#w.add(e);this.#a=new MutationObserver(e=>{e.some(e=>N_(this,e))&&this.#Le()}),this.#a.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:M_}),this.#Le(),this.#Y??=Yt(),this.#Q(),this.#de()}#$(e){if(!this.isConnected)return;let n=[];for(let r of e)for(let e of r.addedNodes)!(e instanceof HTMLElement)||e.parentElement!==this||e.localName!==`li`||this.#w.has(e)||(this.#w.add(e),n.push(e));if(n.length===0)return;let r=this.#Fe().length;if(!(n.length>=r)){for(let e of n)Xn(e);window.setTimeout(()=>this.#ye(),230)}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerover`,this._onPointerOver),this.removeEventListener(`pointerleave`,this._onPointerLeave),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`pointermove`,this._endKeyboardNav),this.removeEventListener(`pointerdown`,this._endKeyboardNav),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`wheel`,this._onWheel),window.removeEventListener(`pointerup`,this.#B),window.removeEventListener(`pointercancel`,this.#B),this.#z=!1,cancelAnimationFrame(this.#v),cancelAnimationFrame(this.#y),this.#y=0,this.#S?.disconnect(),this.#S=void 0,this.#C?.disconnect(),this.#C=void 0,this.#P?.disconnect(),this.#P=void 0,this.#a?.disconnect(),this.#a=void 0,this.#Le(),this.#X?.(),this.#X=void 0,this.#Y=void 0,this.#R&&=(clearTimeout(this.#R),0)}firstUpdated(){this.#Ve(),this.filterPredicate&&this.#se(),this.#be(),this.#We(),this._syncNativeDraggable()}willUpdate(e){super.willUpdate(e),e.has(`groupBy`)&&this.hasUpdated&&(this._collapsedGroups.size>0&&(this._collapsedGroups=new Set),this.#N=!0)}updated(e){if(super.updated(e),(e.has(`groupBy`)||e.has(`groupLabel`)||e.has(`_collapsedGroups`))&&(this.#de(),this.#N&&(this.#N=!1,this._dispatch(`list-group-change`,{groupBy:this.groupBy}))),e.has(`searchModes`)&&this.#Q(),e.has(`provider`)){this.#T=[],this.#F=0,this.#I.provider=this.provider,queueMicrotask(()=>{this.provider&&this.#I.request(void 0)});return}let n=e.has(`displayProperty`)||e.has(`formatter`)||e.has(`iconProperty`)||e.has(`iconColorProperty`)||e.has(`textColorProperty`)||e.has(`badgeProperty`)||e.has(`keyProperty`);(e.has(`items`)||n)&&this.provider===void 0&&this.items.length>0&&this.#te(this.items,!n),this.#oe(),(e.has(`sort`)||e.has(`sortBy`)||e.has(`sortComparator`))&&this.#ce(),e.has(`filterPredicate`)&&(this.#se(),this.#ye(),this.#de()),e.has(`interactionMode`)?(this.selection.clearAnchor(),this.#h=!0,this._syncItemStates(),this._syncNativeDraggable()):e.has(`checkboxRenderer`)&&this.interactionMode===`checked`&&this._syncCheckboxes(),e.has(`itemsDraggable`)&&(this._syncNativeDraggable(),this.#V.refreshDraggable())}get selectedItem(){return[...this.selection.selected].at(-1)}get selectedItems(){return this.selection.selected}refreshLayout(){this.#be(),this.#We()}addItem(e,n){let r;if(typeof e==`string`){let n=document.createElement(`li`);this._setLabel(n,e),r=n}else r=e;n?.notChecked&&r.setAttribute(`not-checked`,``),this.appendChild(r),this.#ze(r),this.sort!==`none`&&this.#ce(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#de()}removeItem(e){return this.selection.deselect(e),$n(e).then(()=>{e.remove(),this.#de(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#ye()})}removeItems(e){return Promise.all([...e].map(e=>this.removeItem(e))).then(()=>void 0)}clearItems(){this.replaceChildren(),this.#O.clear(),this.#de(),this.selection.reset(),this.#T=[],this.#F=0,this._syncItemStates()}setItems(e){this.clearItems();for(let n of e)this.appendChild(n),this.#ze(n);this.sort!==`none`&&this.#ce(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#de()}getItemData(e){return this.#e.get(e)}visibleKeys(){let e=this._listEl;if(!e)return[];let n=e.scrollLeft,r=n+e.getBoundingClientRect().width,i=[];for(let a of x_(this._getVisibleItems(),__(e),n,r)){let e=D(a);e!==void 0&&i.push(e)}return i}dispatch(e,n){this.#Y?.invoke(e,n)}select(e){this.selection.replace(e)}selectMany(e){this.selection.selectMany(e)}deselect(e){this.selection.deselect(e)}clearSelection(){this.selection.clear()}selectAll(){this.selection.canSelectAll()&&this.selection.selectAll()}get selectedKeys(){return this.selection.selectedKeys}get tickledKey(){let e=this.tickled.tickledId;return e?D(e):void 0}selectKeys(e){this.selection.selectKeys(e,e=>this.#ee(e))}addSelectedKeys(e){this.selection.addKeys(e,e=>this.#ee(e))}removeSelectedKeys(e){this.selection.removeKeys(e,e=>this.#ee(e))}focusKey(e){let n=this.#ee(e);n&&(this.tickled.focus(n),n.scrollIntoView({block:`nearest`,inline:`nearest`}))}#ee(e){if(!this.#d){let e=new Map;for(let n of this.#Fe()){let r=D(n);r!==void 0&&!e.has(r)&&e.set(r,n)}this.#d=e}return this.#d.get(e)}*selectedFilter(e){let n=n=>{switch(e){case`selected`:return n.hasAttribute(`data-selected`);case`checked`:return n.hasAttribute(`data-checked`);case`either`:return n.hasAttribute(`data-selected`)||n.hasAttribute(`data-checked`)}};for(let e of this.querySelectorAll(C_))e.hidden||n(e)&&(yield e)}#te(e,n=!1){let r=e=>e.getAttribute(`data-key`)??e.getAttribute(`data-search-label`)??null,i=new Set([...this.selection.selected].map(r).filter(e=>e!==null)),a=this.selection.anchor?r(this.selection.anchor):null;if(n?this.#ne(e):this.replaceChildren(...e.map((e,n)=>this.#re(e,n))),i.size>0||a!==null){let e=[],n;for(let o of this.querySelectorAll(C_)){let s=r(o);s!==null&&i.has(s)&&e.push(o),s!==null&&s===a&&(n=o)}this.selection.seed(e,n)}this.sort!==`none`&&this.#ce(),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates(),this.#ye(),this.#de()}#ne(e){let n=new Map;for(let e of this.#Fe())this.#e.has(e)&&!n.has(this.#e.get(e))&&n.set(this.#e.get(e),e);let r=e.map((e,r)=>{let i=n.get(e);return i&&(!this.formatter||this.#t.get(i)===r)?(n.delete(e),i):this.#re(e,r)}),i=new Set(r);for(let e of this.#Fe())i.has(e)||e.remove();if(this.#ue()){for(let e of r)this.#k.set(e,this.#A++);this.append(...r.filter(e=>e.parentElement!==this)),this.#de();return}P_(this,r,e=>e.localName===`li`)}#re(e,n){let r=document.createElement(`li`);this.#e.set(r,e),this.#t.set(r,n);let i=this.formatter?this.formatter(e,n):this.displayProperty?this.#ie(e,this.displayProperty):e,a=this.#ae(e,this.textColorProperty),o=this.#ae(e,this.iconColorProperty);if(o!==void 0&&r.setAttribute(`data-icon-color`,o),typeof i==`string`){let n=this._setLabel(r,i);if(a!==void 0&&(n.style.color=a),this.iconProperty){let n=this.#ie(e,this.iconProperty);typeof n==`string`&&n.length>0&&r.setAttribute(`data-icon`,n)}}else i instanceof Node&&(r.appendChild(i),a!==void 0&&(r.style.color=a));if(this.keyProperty){let n=this.#ie(e,this.keyProperty);n!=null&&r.setAttribute(`data-key`,String(n))}return this.#ze(r),this.#Be(r,this.#ie(e,this.badgeProperty)),r}#ie(e,n){if(!(typeof e!=`object`||!e||!(n in e)))return e[n]}#ae(e,n){return n?Hg(this.#ie(e,n)):void 0}#oe(){if(this.provider===void 0)return;let e=this.#I.items;if(e===this.#T)return;let n=0;for(;n<this.#T.length&&n<e.length&&this.#T[n]===e[n];)n++;if(n===this.#T.length&&n<=e.length){let r=e.slice(n);for(let e of r)this.appendChild(this.#re(e,this.#F++));this.sort!==`none`&&(cancelAnimationFrame(this.#v),this.#v=requestAnimationFrame(()=>this.#ce())),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates(),this.#ye(),this.#de()}else this.#F=0,this.#te(e);this.#T=e}#se(){if(!this.filterPredicate){for(let e of this.querySelectorAll(C_))e.removeAttribute(`hidden`);return}for(let e of this.querySelectorAll(C_))this.filterPredicate(e)?e.removeAttribute(`hidden`):e.setAttribute(`hidden`,``)}#ce(){if(this.sort===`none`)return;let e=[...this.querySelectorAll(C_)];if(!(e.length<2)){if(this.#ue()){this.#de();return}P_(this,this.#le(e),e=>e.localName===`li`),this.#ye(),this.#de()}}#le(e){let n=this.sort===`descending`?-1:1,r=e.map(e=>({element:e,data:this.getItemData(e),label:e.getAttribute(`data-search-label`)??e.textContent?.trim()??``})),i=new Intl.Collator(void 0,{numeric:!0}),a;if(this.sortComparator){let e=this.sortComparator;a=(n,i)=>e(r[n],r[i])}else if(this.sortBy){let e=this.sortBy,n=r.map(n=>{let r=this.#ie(n.data,e);return typeof r==`number`?r:r==null?``:String(r)});a=(e,r)=>{let a=n[e],o=n[r];return typeof a==`number`&&typeof o==`number`?a-o:i.compare(String(a),String(o))}}else a=(e,n)=>i.compare(r[e].label,r[n].label);let o=e.map((e,n)=>n);return o.sort((e,r)=>a(e,r)*n||e-r),o.map(n=>e[n])}#ue(){return this.groupBy!==null&&this.groupBy!==void 0&&this.groupBy!==``}#de(){this.#M||!this.#ue()&&!this.#j||(this.#M=!0,queueMicrotask(()=>{this.#M=!1,this.#ge()}))}#fe(e,n){return this.#ie(this.getItemData(e),n)??e.getAttribute(`data-${n}`)}#pe(e){let n=this.groupBy;return mn(typeof n==`string`?this.#fe(e,n):n(this.getItemData(e),e))}#me(e){return!e.hidden&&(!this.filterPredicate||this.filterPredicate(e))}#he(e){let n=this.#O.get(e);return n||(n=document.createElement(`ixfx-list-group-header`),n.setAttribute(w_,``),n.dataset.groupKey=e,this.#O.set(e,n)),n}#ge(){let e=this.#ue();if(!e&&!this.#j)return;let n=this.#Fe();for(let e of n)this.#k.has(e)||this.#k.set(e,this.#A++);let r=n.toSorted((e,n)=>this.#k.get(e)-this.#k.get(n));this.sort!==`none`&&r.length>1&&(r=this.#le(r));let i=[],a=[],o=new Map,s=new Set;if(e){let e=this.groupLabel,n=gn(r,e=>this.#pe(e),e?(n,r)=>e(n,r.map(e=>this.getItemData(e)??e)):void 0);for(let e of n){let n=e.items.filter(e=>this.#me(e)).length,r=n>0&&this._collapsedGroups.has(e.key);if(n>0){let o=this.#he(e.key);o.label=e.label,o.count=n,o.collapsed=r,s.add(e.key),i.push(o),a.push({key:e.key,label:e.label,count:n,collapsed:this._collapsedGroups.has(e.key)})}for(let n of e.items)o.set(n,e.key),n.toggleAttribute(T_,r),i.push(n)}}else{for(let e of r)e.removeAttribute(T_);i.push(...r)}for(let[e,n]of this.#O)s.has(e)||(n.remove(),this.#O.delete(e));this.#E=o,this.#D=a,this.#j=e,P_(this,i,e=>e.localName===`li`||e.hasAttribute(w_)),this.tickled.tickledId?.hasAttribute(T_)&&this.tickled.focus(void 0),this.#_e(e),this.#ye()}#_e(e){if(!e){this.#P?.disconnect(),this.#P=void 0;return}this.#P||!this.isConnected||(this.#P=new MutationObserver(()=>this.#de()),this.#P.observe(this,{subtree:!0,attributes:!0,attributeFilter:[`hidden`]}))}get groups(){return this.#D}setGroupCollapsed(e,n){if(this._collapsedGroups.has(e)===n)return;let r=new Set(this._collapsedGroups);n?r.add(e):r.delete(e),this._collapsedGroups=r,this._dispatch(`list-group-toggle`,{groupKey:e,collapsed:n})}toggleGroup(e){this.setGroupCollapsed(e,!this._collapsedGroups.has(e))}collapseAllGroups(){for(let e of this.#D)this.setGroupCollapsed(e.key,!0)}expandAllGroups(){for(let e of[...this._collapsedGroups])this.setGroupCollapsed(e,!1)}#ve(e){for(let n of e){if(n===this)break;if(n instanceof HTMLElement&&n.parentElement===this&&n.hasAttribute(w_))return n}}#ye(){this.#r=!0,!this.#i&&(this.#i=!0,requestAnimationFrame(()=>{this.#i=!1,this.#Ke()}))}#be(){this.#r=!1,this.#n=this.isConnected&&this._listEl?v_(this._getVisibleItems(),__(this._listEl)):g_}#xe(){let e=this._getVisibleItems();if(this.#r||!this._listEl)return this.#be(),this.#n;let n=this.tickled.tickledId,r=[e[0],n&&this.#n.positions.has(n)?n:void 0,e.at(-1)];return y_(this.#n,r,__(this._listEl))||this.#be(),this.#n}#Se(e){let n=this.#n.positions.get(e);return n===void 0&&(this.#be(),n=this.#n.positions.get(e)),n}#Ce(e){return this.#n.columns[e]?.items}#we(e,n){return this.#Ce(e)?.[n]}#Te(){let{columns:e}=this.#xe();return{cols:e.length,rows:Math.max(0,...e.map(e=>e.items.length))}}#Ee(e){e&&(this.tickled.handleKeyboardNavigation(e),this.tickled.tickledId?.scrollIntoView({block:`nearest`,inline:`nearest`}))}#De(e,n,r,i){let{cols:a}=this.#Te(),o=this._getVisibleItems().length+1,s=r===0?e:e+r,c=i===0?n:n+i,l=!1;for(let u=0;u<o;u++){let o=this.#Ce(s)?.length??0;if(c<0||c>=o){if(r!==0||l){if(this.itemWrap===`wrap`)r<0?s=a-1:r>0&&(s=0),l=!0;else return}if(i>0){if(s+1<a)s+=1,c=0,l=!0;else if(this.itemWrap===`wrap`)s=0,c=0,l=!0;else return}else if(i<0){if(s-1>=0)--s,c=(this.#Ce(s)?.length??1)-1,l=!0;else if(this.itemWrap===`wrap`)s=a-1,c=(this.#Ce(s)?.length??1)-1,l=!0;else return}else if(r!==0){let e=this.#Ce(s)?.length??0;c>=e&&e>0&&(c=e-1)}if(s===e&&c===n+i)return;continue}let u=this.#we(s,c);if(u&&this._isCheckable(u))return u;c+=i}}#Oe(){return this._getVisibleItems().find(e=>this._isCheckable(e))}#ke(){let e=this._getVisibleItems();for(let n=e.length-1;n>=0;n--)if(this._isCheckable(e[n]))return e[n]}#Ae(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#Oe());return}let n=this.#De(e.col,e.row,0,1);n&&this.#Ee(n)}#je(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#ke());return}let n=this.#De(e.col,e.row,0,-1);n&&this.#Ee(n)}#Me(e,n){if(this.#D.length===0)return this.#De(e.col,e.row,n,0);let r=this.#Ce(e.col+n),i=this.tickled.tickledId,a=i?this.#n.tops.get(i):void 0;if(!r||a===void 0)return;let o,s=1/0;for(let e of r){if(!this._isCheckable(e))continue;let n=Math.abs((this.#n.tops.get(e)??1/0)-a);n<s&&(o=e,s=n)}return o}#Ne(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#Oe());return}let n=this.#Me(e,1);n?this.#Ee(n):this.itemWrap===`wrap`&&this.#Ee(this.#Oe())}#Pe(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#Oe());return}let n=this.#Me(e,-1);n?this.#Ee(n):this.itemWrap===`wrap`&&this.#Ee(this.#ke())}_getVisibleItems(){return this.#Ie(),this.#c!==this.filterPredicate&&(this.#Re(),this.#c=this.filterPredicate),this.#s??=this.#Fe().filter(e=>!(e.hidden||e.hasAttribute(T_)||this.filterPredicate&&!this.filterPredicate(e))),this.#s}#Fe(){return this.#Ie(),this.#o??=[...this.querySelectorAll(C_)],this.#o}#Ie(){if(!this.#a){this.#Le();return}this.#a.takeRecords().some(e=>N_(this,e))&&this.#Le()}#Le(){this.#o=void 0,this.#d=void 0,this.#h=!0,this.#Re()}#Re(){this.#s=void 0,this.#l=void 0,this.#u=void 0,this.#r=!0}async fitColumnWidth(){await this.updateComplete;let e=this._getVisibleItems();if(e.length===0)return 0;let n=this.style.getPropertyValue(`--detail-list-column-width`),r=this.style.getPropertyPriority(`--detail-list-column-width`);this.style.setProperty(`--detail-list-column-width`,`max-content`);let i=Math.ceil(Math.max(...e.map(e=>e.getBoundingClientRect().width)));return n?this.style.setProperty(`--detail-list-column-width`,n,r):this.style.removeProperty(`--detail-list-column-width`),this.style.setProperty(`--detail-list-column-width`,`${i}px`),this.#ye(),i}_isCheckable(e){return this.interactionMode!==`checked`||!e.hasAttribute(`not-checked`)}_setLabel(e,n){let r=document.createElement(`span`);return r.style.cssText=`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0`,r.textContent=n,e.appendChild(r),e.setAttribute(`data-search-label`,n),r}#ze(e){let n=e.getAttribute(`data-icon`);if(!n||e.firstElementChild?.tagName===`IXFX-ICON`)return;let r=document.createElement(`ixfx-icon`);r.setAttribute(`name`,n),r.style.marginInlineEnd=`var(--detail-list-icon-gap, 6px)`,r.style.flexShrink=`0`;let i=e.getAttribute(`data-icon-color`);i&&(r.style.color=i),e.prepend(r)}#Be(e,n){if(Vg(n))return;let r=e.querySelector(`:scope > .item-badge`);r||(r=document.createElement(`span`),r.className=`item-badge`,r.style.cssText=`flex-shrink:0;display:inline-flex;align-items:center;margin-inline-start:auto;padding-inline-start:var(--detail-list-badge-gap,8px)`,e.appendChild(r)),r.replaceChildren(),n instanceof Node?r.appendChild(n):o(n,r)}#Ve(){for(let e of this.#Fe())this.#ze(e)}#He(e){for(let n of e)for(let e of n.addedNodes)e instanceof HTMLLIElement&&e.parentElement===this&&this.#ze(e)}_syncItemStates(){let e=this.selection.selected,n=this.interactionMode===`checked`?new Set([...e].filter(e=>!e.hasAttribute(`not-checked`))):new Set,r=this.tickled.tickledId,i=this.#h||!A_(this.#p,e)||!A_(this.#m,n);if(this.#h){for(let i of this.#Fe())i.toggleAttribute(`data-tickled`,i===r),i.toggleAttribute(`data-selected`,e.has(i)),i.toggleAttribute(`data-checked`,n.has(i));this.#h=!1}else r!==this.#f&&(this.#f?.removeAttribute(`data-tickled`),r?.setAttribute(`data-tickled`,``)),j_(this.#p,e,`data-selected`),j_(this.#m,n,`data-checked`);this.#f=r,this.#p=new Set(e),this.#m=n,this.dataset.inputMode!==this.tickled.inputMode&&(this.dataset.inputMode=this.tickled.inputMode),i&&this._syncCheckboxes()}_syncCheckboxes(){let e=this.interactionMode===`checked`,n=typeof this.checkboxRenderer==`function`;if(!(!e&&!this.#g)){this.#g=e;for(let r of this.querySelectorAll(`li`)){let i=r.querySelector(`.ixfx-list-checkbox`);if(!e){i&&i.remove();continue}if(r.hasAttribute(`not-checked`)){i&&i.remove();continue}let a=i?.classList.contains(`ixfx-list-checkbox-custom`)??!1;i&&a!==n&&i.remove();let s=r.querySelector(`.ixfx-list-checkbox`);if(!s){if(n){let e=this.checkboxRenderer,n=e.margin??`0`,i=e.width??`24px`;s=this._createCustomCheckbox(r,n,i)}else s=this._createNativeCheckboxCell(r);r.prepend(s)}let c=this.selection.selected.has(r);if(n){if(s.setAttribute(`aria-checked`,String(c)),s.toggleAttribute(`data-checked`,c),this.checkboxRenderer){let e=typeof this.checkboxRenderer==`function`?this.checkboxRenderer:this.checkboxRenderer.renderer;o(e(c),s)}}else{let e=s.querySelector(`input.ixfx-list-checkbox`);e&&(e.checked=c)}}}}_createNativeCheckboxCell(e){let n=document.createElement(`span`);n.className=`ixfx-list-checkbox ixfx-list-checkbox-native`,n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:18px;margin:0 6px 0 0;cursor:pointer;pointer-events:auto`,n.tabIndex=-1,n.setAttribute(`role`,`checkbox`),n.setAttribute(`part`,`checkbox`),n.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)});let r=document.createElement(`input`);return r.type=`checkbox`,r.className=`ixfx-list-checkbox`,r.style.cssText=`pointer-events:none;cursor:pointer;margin:0`,n.appendChild(r),n}_createCustomCheckbox(e,n,r){let i=document.createElement(`span`);return i.className=`ixfx-list-checkbox ixfx-list-checkbox-custom`,i.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:${r};margin:${n};cursor:pointer;pointer-events:auto`,i.tabIndex=-1,i.setAttribute(`role`,`checkbox`),i.setAttribute(`part`,`checkbox`),i.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)}),i}_findListItem(e){for(let n of e)if(n instanceof Element){if(n===this)break;if(n.parentElement===this&&n.matches(`li`))return n}}_dispatch(e,n){this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0}))}_dispatchCancelable(e,n){return this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}#Ue;#We(){this.#y===0&&(this.#y=requestAnimationFrame(()=>{this.#y=0,this.#Ke()}))}#Ge(){let e=this._getVisibleItems();return this.#u??=e.flatMap(e=>{let n=D(e);return n===void 0?[]:[n]}),this.#u}#Ke(){let e=this.#Ge(),n=this.visibleKeys();k_(this.#b,e)&&k_(this.#x,n)||(this.#b=e,this.#x=n,this._dispatch(`detail-list-viewport-change`,{renderedKeys:e,visibleKeys:n}))}_activateItem(e){this.interactionMode!==`manual`&&this.selection.replace(e),this._dispatch(`list-activate`,{item:e})}static{this.styles=[w,Ng(`x`),Ht,r`
|
|
5613
|
+
`}};E([d({type:String,reflect:!0})],S_.prototype,`label`,void 0),E([d({type:Number,reflect:!0})],S_.prototype,`count`,void 0),E([d({type:Boolean,reflect:!0})],S_.prototype,`collapsed`,void 0),E([d({type:String,reflect:!0})],S_.prototype,`orientation`,void 0),S_=E([T(`ixfx-list-group-header`)],S_);const C_=`:scope > li`,w_=`data-ixfx-group-header`,T_=`data-group-collapsed`,E_=new Set([`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]);function D_(e,n,r){return r.width>0&&r.height>0&&e>=r.left&&e<r.right&&n>=r.top&&n<r.bottom}function O_(e,n,r){if(e instanceof Text){if(!e.textContent?.trim())return!1;let i=document.createRange();return i.selectNodeContents(e),Array.from(i.getClientRects()).some(e=>D_(n,r,e))}return!(e instanceof Element)||e.hasAttribute(`data-drag-select-blank`)?!1:e.hasAttribute(`data-drag-select-content`)?D_(n,r,e.getBoundingClientRect()):Array.from(e.childNodes).some(e=>O_(e,n,r))?!0:e.childNodes.length===0&&D_(n,r,e.getBoundingClientRect())}function k_(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function A_(e,n){if(e.size!==n.size)return!1;for(let r of e)if(!n.has(r))return!1;return!0}function j_(e,n,r){for(let i of e)n.has(i)||i.removeAttribute(r);for(let i of n)e.has(i)||i.setAttribute(r,``)}const M_=[`hidden`,T_,`not-checked`,`data-key`,`data-value`];function N_(e,n){return n.type===`childList`?n.target===e:n.target.parentElement===e}function P_(e,n,r){let i=e=>{let n=e;for(;n&&!r(n);)n=n.nextElementSibling;return n},a=i(e.firstElementChild);for(let r of n){if(r===a){a=i(a.nextElementSibling);continue}e.insertBefore(r,a)}}let V=class extends n{constructor(...e){super(...e),this.selectionMode=`single`,this.interactionMode=`standard`,this.sort=`none`,this.sortBy=``,this.items=[],this.displayProperty=``,this.iconProperty=``,this.iconColorProperty=``,this.textColorProperty=``,this.badgeProperty=``,this.keyProperty=``,this.itemWrap=`stop`,this.itemsDraggable=!1,this.groupBy=null,this.crossGroupSelection=!1,this._collapsedGroups=new Set,this.#e=new WeakMap,this.#t=new WeakMap,this.#n=g_,this.#r=!0,this.#i=!1,this.#p=new Set,this.#m=new Set,this.#h=!0,this.#g=!1,this.#_=!1,this.#v=0,this.#y=0,this.#w=new WeakSet,this.#T=[],this.#E=new Map,this.#D=[],this.#O=new Map,this.#k=new WeakMap,this.#A=0,this.#j=!1,this.#M=!1,this.#N=!1,this.#F=0,this.#I=new je(this),this.selection=new tr({getOrderedItems:()=>this._getVisibleItems(),isSelectable:e=>this._isCheckable(e),getModes:()=>({selectionMode:this.selectionMode,interactionMode:this.interactionMode}),getKey:D,getGroupKey:e=>this.#E.get(e)??null,crossGroupSelection:()=>this.crossGroupSelection,getFallbackGroupKey:()=>{let e=this.tickled.tickledId;return e?this.#E.get(e)??null:null},onChange:(e,n)=>{this._syncItemStates(),this._dispatch(`list-select`,{selected:e,previous:n,selectedKeys:this.selection.selectedKeys})}}),this.tickled=new oe(this,{getItems:()=>{let e=this._getVisibleItems();return this.#l??=e.map(e=>({id:e,enabled:!e.hasAttribute(`not-checked`)})),this.#l},onTickle:e=>{e!==void 0&&this._dispatch(`list-tickle`,{item:e})},onStateChange:()=>this._syncItemStates(),itemWrap:this.itemWrap,hoverDisabled:()=>this.#G.isDragging||this.#V.isDragging}),this.#L=!1,this.#R=0,this.#z=!1,this.#B=()=>{this.#z=!1},this.#V=new $n(this,{source:`detail-list`,isEnabled:()=>this.itemsDraggable&&this.selectionMode!==`none`&&this._getVisibleItems().length>0,resolveEventToKey:e=>{if(!(e instanceof Element))return;let n=e.closest?.(`li`);if(!(!n||!this.contains(n)))return D(n)},prepareSelection:e=>this.#H(e),getMetrics:()=>({}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>this._dispatchCancelable(`list-native-drag-start`,e),onActiveChange:(e,n)=>{this.#L=e,this.toggleAttribute(`data-native-dragging`,e);for(let r of this.querySelectorAll(`li`))r.toggleAttribute(`data-drag-origin`,e&&n!==void 0&&D(r)===n);if(e){let e=this.selection.selected.size;this.setAttribute(`aria-label`,e<=1?`Dragging 1 item`:`Dragging ${e} items`)}else this.removeAttribute(`aria-label`);this.requestUpdate()},onEnd:()=>{this.#L=!1,this.toggleAttribute(`data-native-dragging`,!1),this.removeAttribute(`aria-label`);for(let e of this.querySelectorAll(`li`))e.removeAttribute(`data-drag-origin`);this.#U()},syncLightDomDraggable:()=>this._syncNativeDraggable(),shouldStart:()=>!this.#z}),this.#G=new Vn(this,{getSurface:()=>this.renderRoot.querySelector(`.container`),isEnabled:()=>this.selection.canDragSelect()&&this._getVisibleItems().length>0&&!this.hasAttribute(`disable-drag-select`),hitTest:e=>this.#q(e),getBaseSelection:()=>this.selection.selected,onPreview:(e,n)=>{this.#W=n;for(let n of this._getVisibleItems())n.toggleAttribute(`data-marquee`,e.has(n));this.requestUpdate()},onCommit:e=>{this.selection.applyDragSelection(e);for(let e of this._getVisibleItems())e.removeAttribute(`data-marquee`);this.#W=void 0,this.requestUpdate()},autoScroll:(e,n)=>{this._listEl&&(this._listEl.scrollLeft+=e)},shouldStart:e=>!this.#ve(e.composedPath())&&(this.#z=this.itemsDraggable&&this.#K(e),!this.itemsDraggable||this.#z)}),this.search=new Bt(this,{adapter:Mt(this,{itemSelector:C_,getLabel:e=>e.getAttribute(`data-search-label`)??e.textContent?.trim()??``,highlightKey:`detail-list-search`})}),this.#Ue=()=>{this.#y===0&&(this.#y=requestAnimationFrame(()=>{this.#y=0,this.#Ke()}))},this._onPointerOver=e=>{let n=this._findListItem(e.composedPath());n&&this.tickled.handlePointerEnter(n)},this._onPointerLeave=e=>{this.tickled.handlePointerLeave(e)},this._endKeyboardNav=()=>{this.removeAttribute(`data-keyboard-nav`)},this._onKeyDown=e=>{if(!this.search.isOpen){if((e.ctrlKey||e.metaKey)&&e.key===`a`){this.selection.canSelectAll()&&(e.preventDefault(),this.selection.selectAll());return}switch(E_.has(e.key)&&!this.hasAttribute(`data-keyboard-nav`)&&this.setAttribute(`data-keyboard-nav`,``),e.key){case`ArrowDown`:if(e.preventDefault(),this.#Ae(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`ArrowUp`:if(e.preventDefault(),this.#je(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`ArrowRight`:e.preventDefault(),this.#Ne();break;case`ArrowLeft`:e.preventDefault(),this.#Pe();break;case`Home`:e.preventDefault(),this.#Ee(this.#Oe());break;case`End`:e.preventDefault(),this.#Ee(this.#ke());break;case`Enter`:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this._dispatch(`list-item-click`,{item:n}),this._activateItem(n));break}case` `:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.selection.handleSpace(n));break}case`Escape`:this.selection.clear()}}},this._onClick=e=>{if(this.#G.isDragging||this.#V.isDragging||this.#R!==0)return;let n=e.composedPath(),r=this.#ve(n);if(r){this.toggleGroup(r.dataset.groupKey??``);return}let i=this._findListItem(n);i&&(this.focus(),this._dispatch(`list-item-click`,{item:i}),this.selection.handleClick(i,e))},this._onDblClick=e=>{let n=this._findListItem(e.composedPath());n&&this._activateItem(n)},this._onWheel=e=>{e.preventDefault();let n=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;this._listEl.scrollLeft+=n}}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H(e){let n=this._getVisibleItems(),r=n.find(n=>D(n)===e);if(!r||!this._isCheckable(r))return;this.selection.selected.has(r)||this.selection.replace(r);let i=[];n.forEach((n,r)=>{if(!this.selection.selected.has(n))return;let a=D(n)??e;i.push({key:a,index:r,item:this.#e.get(n)??n,element:n})});let a=i.find(n=>n.key===e);if(a)return{origin:a,selected:i}}_syncNativeDraggable(){if(this.isConnected&&!(!this.itemsDraggable&&!this.#_)){this.#_=this.itemsDraggable;for(let e of this.querySelectorAll(`li`))e instanceof HTMLElement&&(e.draggable=this.itemsDraggable&&this._isCheckable(e))}}#U(){this.#R&&clearTimeout(this.#R),this.#R=window.setTimeout(()=>{this.#R=0},0)}#W;#G;#K(e){let n=e.composedPath(),r=this._findListItem(n);if(!r)return!1;for(let e of n){if(e===r)break;if(e instanceof Element){if(e.matches(`input, button, a, select, textarea, [contenteditable], .ixfx-list-checkbox, [role="checkbox"]`))return!1;if(e.hasAttribute(`data-drag-select-blank`))return!0;if(e.hasAttribute(`data-drag-select-content`))return!1}}return!Array.from(r.childNodes).some(n=>O_(n,e.clientX,e.clientY))}#q(e){let n=this.renderRoot.querySelector(`.container`);if(!n)return[];let r=n.getBoundingClientRect(),i=e.x,a=e.y,o=e.x+e.width,s=e.y+e.height,c=[];for(let e of this._getVisibleItems()){let n=e.getBoundingClientRect(),l=n.left-r.left,u=n.top-r.top;l<=o&&l+n.width>=i&&u<=s&&u+n.height>=a&&c.push(e)}return c}#J(e){return`left:${e.x}px;top:${e.y}px;width:${Math.max(0,e.width)}px;height:${Math.max(0,e.height)}px`}#Y;#X;get registry(){return this.#Y}#Z(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#Q(){this.#Y&&(this.search.setModes(this.#Z()),this.#X?.(),this.#X=Rt(this.#Y,this.search))}connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.addEventListener(`pointerover`,this._onPointerOver),this.addEventListener(`pointerleave`,this._onPointerLeave),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`pointermove`,this._endKeyboardNav),this.addEventListener(`pointerdown`,this._endKeyboardNav),this.addEventListener(`click`,this._onClick),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`wheel`,this._onWheel),window.addEventListener(`pointerup`,this.#B),window.addEventListener(`pointercancel`,this.#B),this.#S=new ResizeObserver(()=>this.#ye()),this.#S.observe(this),this.#C=new MutationObserver(e=>{this.#He(e),this.#$(e),this.#ye(),this.#de()}),this.#C.observe(this,{childList:!0,subtree:!1,attributeFilter:[`hidden`]});for(let e of this.querySelectorAll(C_))this.#w.add(e);this.#a=new MutationObserver(e=>{e.some(e=>N_(this,e))&&this.#Le()}),this.#a.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:M_}),this.#Le(),this.#Y??=Jt(),this.#Q(),this.#de()}#$(e){if(!this.isConnected)return;let n=[];for(let r of e)for(let e of r.addedNodes)!(e instanceof HTMLElement)||e.parentElement!==this||e.localName!==`li`||this.#w.has(e)||(this.#w.add(e),n.push(e));if(n.length===0)return;let r=this.#Fe().length;if(!(n.length>=r)){for(let e of n)Yn(e);window.setTimeout(()=>this.#ye(),230)}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerover`,this._onPointerOver),this.removeEventListener(`pointerleave`,this._onPointerLeave),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`pointermove`,this._endKeyboardNav),this.removeEventListener(`pointerdown`,this._endKeyboardNav),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`wheel`,this._onWheel),window.removeEventListener(`pointerup`,this.#B),window.removeEventListener(`pointercancel`,this.#B),this.#z=!1,cancelAnimationFrame(this.#v),cancelAnimationFrame(this.#y),this.#y=0,this.#S?.disconnect(),this.#S=void 0,this.#C?.disconnect(),this.#C=void 0,this.#P?.disconnect(),this.#P=void 0,this.#a?.disconnect(),this.#a=void 0,this.#Le(),this.#X?.(),this.#X=void 0,this.#Y=void 0,this.#R&&=(clearTimeout(this.#R),0)}firstUpdated(){this.#Ve(),this.filterPredicate&&this.#se(),this.#be(),this.#We(),this._syncNativeDraggable()}willUpdate(e){super.willUpdate(e),e.has(`groupBy`)&&this.hasUpdated&&(this._collapsedGroups.size>0&&(this._collapsedGroups=new Set),this.#N=!0)}updated(e){if(super.updated(e),(e.has(`groupBy`)||e.has(`groupLabel`)||e.has(`_collapsedGroups`))&&(this.#de(),this.#N&&(this.#N=!1,this._dispatch(`list-group-change`,{groupBy:this.groupBy}))),e.has(`searchModes`)&&this.#Q(),e.has(`provider`)){this.#T=[],this.#F=0,this.#I.provider=this.provider,queueMicrotask(()=>{this.provider&&this.#I.request(void 0)});return}let n=e.has(`displayProperty`)||e.has(`formatter`)||e.has(`iconProperty`)||e.has(`iconColorProperty`)||e.has(`textColorProperty`)||e.has(`badgeProperty`)||e.has(`keyProperty`);(e.has(`items`)||n)&&this.provider===void 0&&this.items.length>0&&this.#te(this.items,!n),this.#oe(),(e.has(`sort`)||e.has(`sortBy`)||e.has(`sortComparator`))&&this.#ce(),e.has(`filterPredicate`)&&(this.#se(),this.#ye(),this.#de()),e.has(`interactionMode`)?(this.selection.clearAnchor(),this.#h=!0,this._syncItemStates(),this._syncNativeDraggable()):e.has(`checkboxRenderer`)&&this.interactionMode===`checked`&&this._syncCheckboxes(),e.has(`itemsDraggable`)&&(this._syncNativeDraggable(),this.#V.refreshDraggable())}get selectedItem(){return[...this.selection.selected].at(-1)}get selectedItems(){return this.selection.selected}refreshLayout(){this.#be(),this.#We()}addItem(e,n){let r;if(typeof e==`string`){let n=document.createElement(`li`);this._setLabel(n,e),r=n}else r=e;n?.notChecked&&r.setAttribute(`not-checked`,``),this.appendChild(r),this.#ze(r),this.sort!==`none`&&this.#ce(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#de()}removeItem(e){return this.selection.deselect(e),Qn(e).then(()=>{e.remove(),this.#de(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#ye()})}removeItems(e){return Promise.all([...e].map(e=>this.removeItem(e))).then(()=>void 0)}clearItems(){this.replaceChildren(),this.#O.clear(),this.#de(),this.selection.reset(),this.#T=[],this.#F=0,this._syncItemStates()}setItems(e){this.clearItems();for(let n of e)this.appendChild(n),this.#ze(n);this.sort!==`none`&&this.#ce(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#de()}getItemData(e){return this.#e.get(e)}visibleKeys(){let e=this._listEl;if(!e)return[];let n=e.scrollLeft,r=n+e.getBoundingClientRect().width,i=[];for(let a of x_(this._getVisibleItems(),__(e),n,r)){let e=D(a);e!==void 0&&i.push(e)}return i}dispatch(e,n){this.#Y?.invoke(e,n)}select(e){this.selection.replace(e)}selectMany(e){this.selection.selectMany(e)}deselect(e){this.selection.deselect(e)}clearSelection(){this.selection.clear()}selectAll(){this.selection.canSelectAll()&&this.selection.selectAll()}get selectedKeys(){return this.selection.selectedKeys}get tickledKey(){let e=this.tickled.tickledId;return e?D(e):void 0}selectKeys(e){this.selection.selectKeys(e,e=>this.#ee(e))}addSelectedKeys(e){this.selection.addKeys(e,e=>this.#ee(e))}removeSelectedKeys(e){this.selection.removeKeys(e,e=>this.#ee(e))}focusKey(e){let n=this.#ee(e);n&&(this.tickled.focus(n),n.scrollIntoView({block:`nearest`,inline:`nearest`}))}#ee(e){if(!this.#d){let e=new Map;for(let n of this.#Fe()){let r=D(n);r!==void 0&&!e.has(r)&&e.set(r,n)}this.#d=e}return this.#d.get(e)}*selectedFilter(e){let n=n=>{switch(e){case`selected`:return n.hasAttribute(`data-selected`);case`checked`:return n.hasAttribute(`data-checked`);case`either`:return n.hasAttribute(`data-selected`)||n.hasAttribute(`data-checked`)}};for(let e of this.querySelectorAll(C_))e.hidden||n(e)&&(yield e)}#te(e,n=!1){let r=e=>e.getAttribute(`data-key`)??e.getAttribute(`data-search-label`)??null,i=new Set([...this.selection.selected].map(r).filter(e=>e!==null)),a=this.selection.anchor?r(this.selection.anchor):null;if(n?this.#ne(e):this.replaceChildren(...e.map((e,n)=>this.#re(e,n))),i.size>0||a!==null){let e=[],n;for(let o of this.querySelectorAll(C_)){let s=r(o);s!==null&&i.has(s)&&e.push(o),s!==null&&s===a&&(n=o)}this.selection.seed(e,n)}this.sort!==`none`&&this.#ce(),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates(),this.#ye(),this.#de()}#ne(e){let n=new Map;for(let e of this.#Fe())this.#e.has(e)&&!n.has(this.#e.get(e))&&n.set(this.#e.get(e),e);let r=e.map((e,r)=>{let i=n.get(e);return i&&(!this.formatter||this.#t.get(i)===r)?(n.delete(e),i):this.#re(e,r)}),i=new Set(r);for(let e of this.#Fe())i.has(e)||e.remove();if(this.#ue()){for(let e of r)this.#k.set(e,this.#A++);this.append(...r.filter(e=>e.parentElement!==this)),this.#de();return}P_(this,r,e=>e.localName===`li`)}#re(e,n){let r=document.createElement(`li`);this.#e.set(r,e),this.#t.set(r,n);let i=this.formatter?this.formatter(e,n):this.displayProperty?this.#ie(e,this.displayProperty):e,a=this.#ae(e,this.textColorProperty),o=this.#ae(e,this.iconColorProperty);if(o!==void 0&&r.setAttribute(`data-icon-color`,o),typeof i==`string`){let n=this._setLabel(r,i);if(a!==void 0&&(n.style.color=a),this.iconProperty){let n=this.#ie(e,this.iconProperty);typeof n==`string`&&n.length>0&&r.setAttribute(`data-icon`,n)}}else i instanceof Node&&(r.appendChild(i),a!==void 0&&(r.style.color=a));if(this.keyProperty){let n=this.#ie(e,this.keyProperty);n!=null&&r.setAttribute(`data-key`,String(n))}return this.#ze(r),this.#Be(r,this.#ie(e,this.badgeProperty)),r}#ie(e,n){if(!(typeof e!=`object`||!e||!(n in e)))return e[n]}#ae(e,n){return n?Hg(this.#ie(e,n)):void 0}#oe(){if(this.provider===void 0)return;let e=this.#I.items;if(e===this.#T)return;let n=0;for(;n<this.#T.length&&n<e.length&&this.#T[n]===e[n];)n++;if(n===this.#T.length&&n<=e.length){let r=e.slice(n);for(let e of r)this.appendChild(this.#re(e,this.#F++));this.sort!==`none`&&(cancelAnimationFrame(this.#v),this.#v=requestAnimationFrame(()=>this.#ce())),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates(),this.#ye(),this.#de()}else this.#F=0,this.#te(e);this.#T=e}#se(){if(!this.filterPredicate){for(let e of this.querySelectorAll(C_))e.removeAttribute(`hidden`);return}for(let e of this.querySelectorAll(C_))this.filterPredicate(e)?e.removeAttribute(`hidden`):e.setAttribute(`hidden`,``)}#ce(){if(this.sort===`none`)return;let e=[...this.querySelectorAll(C_)];if(!(e.length<2)){if(this.#ue()){this.#de();return}P_(this,this.#le(e),e=>e.localName===`li`),this.#ye(),this.#de()}}#le(e){let n=this.sort===`descending`?-1:1,r=e.map(e=>({element:e,data:this.getItemData(e),label:e.getAttribute(`data-search-label`)??e.textContent?.trim()??``})),i=new Intl.Collator(void 0,{numeric:!0}),a;if(this.sortComparator){let e=this.sortComparator;a=(n,i)=>e(r[n],r[i])}else if(this.sortBy){let e=this.sortBy,n=r.map(n=>{let r=this.#ie(n.data,e);return typeof r==`number`?r:r==null?``:String(r)});a=(e,r)=>{let a=n[e],o=n[r];return typeof a==`number`&&typeof o==`number`?a-o:i.compare(String(a),String(o))}}else a=(e,n)=>i.compare(r[e].label,r[n].label);let o=e.map((e,n)=>n);return o.sort((e,r)=>a(e,r)*n||e-r),o.map(n=>e[n])}#ue(){return this.groupBy!==null&&this.groupBy!==void 0&&this.groupBy!==``}#de(){this.#M||!this.#ue()&&!this.#j||(this.#M=!0,queueMicrotask(()=>{this.#M=!1,this.#ge()}))}#fe(e,n){return this.#ie(this.getItemData(e),n)??e.getAttribute(`data-${n}`)}#pe(e){let n=this.groupBy;return pn(typeof n==`string`?this.#fe(e,n):n(this.getItemData(e),e))}#me(e){return!e.hidden&&(!this.filterPredicate||this.filterPredicate(e))}#he(e){let n=this.#O.get(e);return n||(n=document.createElement(`ixfx-list-group-header`),n.setAttribute(w_,``),n.dataset.groupKey=e,this.#O.set(e,n)),n}#ge(){let e=this.#ue();if(!e&&!this.#j)return;let n=this.#Fe();for(let e of n)this.#k.has(e)||this.#k.set(e,this.#A++);let r=n.toSorted((e,n)=>this.#k.get(e)-this.#k.get(n));this.sort!==`none`&&r.length>1&&(r=this.#le(r));let i=[],a=[],o=new Map,s=new Set;if(e){let e=this.groupLabel,n=hn(r,e=>this.#pe(e),e?(n,r)=>e(n,r.map(e=>this.getItemData(e)??e)):void 0);for(let e of n){let n=e.items.filter(e=>this.#me(e)).length,r=n>0&&this._collapsedGroups.has(e.key);if(n>0){let o=this.#he(e.key);o.label=e.label,o.count=n,o.collapsed=r,s.add(e.key),i.push(o),a.push({key:e.key,label:e.label,count:n,collapsed:this._collapsedGroups.has(e.key)})}for(let n of e.items)o.set(n,e.key),n.toggleAttribute(T_,r),i.push(n)}}else{for(let e of r)e.removeAttribute(T_);i.push(...r)}for(let[e,n]of this.#O)s.has(e)||(n.remove(),this.#O.delete(e));this.#E=o,this.#D=a,this.#j=e,P_(this,i,e=>e.localName===`li`||e.hasAttribute(w_)),this.tickled.tickledId?.hasAttribute(T_)&&this.tickled.focus(void 0),this.#_e(e),this.#ye()}#_e(e){if(!e){this.#P?.disconnect(),this.#P=void 0;return}this.#P||!this.isConnected||(this.#P=new MutationObserver(()=>this.#de()),this.#P.observe(this,{subtree:!0,attributes:!0,attributeFilter:[`hidden`]}))}get groups(){return this.#D}setGroupCollapsed(e,n){if(this._collapsedGroups.has(e)===n)return;let r=new Set(this._collapsedGroups);n?r.add(e):r.delete(e),this._collapsedGroups=r,this._dispatch(`list-group-toggle`,{groupKey:e,collapsed:n})}toggleGroup(e){this.setGroupCollapsed(e,!this._collapsedGroups.has(e))}collapseAllGroups(){for(let e of this.#D)this.setGroupCollapsed(e.key,!0)}expandAllGroups(){for(let e of[...this._collapsedGroups])this.setGroupCollapsed(e,!1)}#ve(e){for(let n of e){if(n===this)break;if(n instanceof HTMLElement&&n.parentElement===this&&n.hasAttribute(w_))return n}}#ye(){this.#r=!0,!this.#i&&(this.#i=!0,requestAnimationFrame(()=>{this.#i=!1,this.#Ke()}))}#be(){this.#r=!1,this.#n=this.isConnected&&this._listEl?v_(this._getVisibleItems(),__(this._listEl)):g_}#xe(){let e=this._getVisibleItems();if(this.#r||!this._listEl)return this.#be(),this.#n;let n=this.tickled.tickledId,r=[e[0],n&&this.#n.positions.has(n)?n:void 0,e.at(-1)];return y_(this.#n,r,__(this._listEl))||this.#be(),this.#n}#Se(e){let n=this.#n.positions.get(e);return n===void 0&&(this.#be(),n=this.#n.positions.get(e)),n}#Ce(e){return this.#n.columns[e]?.items}#we(e,n){return this.#Ce(e)?.[n]}#Te(){let{columns:e}=this.#xe();return{cols:e.length,rows:Math.max(0,...e.map(e=>e.items.length))}}#Ee(e){e&&(this.tickled.handleKeyboardNavigation(e),this.tickled.tickledId?.scrollIntoView({block:`nearest`,inline:`nearest`}))}#De(e,n,r,i){let{cols:a}=this.#Te(),o=this._getVisibleItems().length+1,s=r===0?e:e+r,c=i===0?n:n+i,l=!1;for(let u=0;u<o;u++){let o=this.#Ce(s)?.length??0;if(c<0||c>=o){if(r!==0||l){if(this.itemWrap===`wrap`)r<0?s=a-1:r>0&&(s=0),l=!0;else return}if(i>0){if(s+1<a)s+=1,c=0,l=!0;else if(this.itemWrap===`wrap`)s=0,c=0,l=!0;else return}else if(i<0){if(s-1>=0)--s,c=(this.#Ce(s)?.length??1)-1,l=!0;else if(this.itemWrap===`wrap`)s=a-1,c=(this.#Ce(s)?.length??1)-1,l=!0;else return}else if(r!==0){let e=this.#Ce(s)?.length??0;c>=e&&e>0&&(c=e-1)}if(s===e&&c===n+i)return;continue}let u=this.#we(s,c);if(u&&this._isCheckable(u))return u;c+=i}}#Oe(){return this._getVisibleItems().find(e=>this._isCheckable(e))}#ke(){let e=this._getVisibleItems();for(let n=e.length-1;n>=0;n--)if(this._isCheckable(e[n]))return e[n]}#Ae(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#Oe());return}let n=this.#De(e.col,e.row,0,1);n&&this.#Ee(n)}#je(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#ke());return}let n=this.#De(e.col,e.row,0,-1);n&&this.#Ee(n)}#Me(e,n){if(this.#D.length===0)return this.#De(e.col,e.row,n,0);let r=this.#Ce(e.col+n),i=this.tickled.tickledId,a=i?this.#n.tops.get(i):void 0;if(!r||a===void 0)return;let o,s=1/0;for(let e of r){if(!this._isCheckable(e))continue;let n=Math.abs((this.#n.tops.get(e)??1/0)-a);n<s&&(o=e,s=n)}return o}#Ne(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#Oe());return}let n=this.#Me(e,1);n?this.#Ee(n):this.itemWrap===`wrap`&&this.#Ee(this.#Oe())}#Pe(){this.#xe();let e=this.tickled.tickledId?this.#Se(this.tickled.tickledId):void 0;if(!e){this.#Ee(this.#Oe());return}let n=this.#Me(e,-1);n?this.#Ee(n):this.itemWrap===`wrap`&&this.#Ee(this.#ke())}_getVisibleItems(){return this.#Ie(),this.#c!==this.filterPredicate&&(this.#Re(),this.#c=this.filterPredicate),this.#s??=this.#Fe().filter(e=>!(e.hidden||e.hasAttribute(T_)||this.filterPredicate&&!this.filterPredicate(e))),this.#s}#Fe(){return this.#Ie(),this.#o??=[...this.querySelectorAll(C_)],this.#o}#Ie(){if(!this.#a){this.#Le();return}this.#a.takeRecords().some(e=>N_(this,e))&&this.#Le()}#Le(){this.#o=void 0,this.#d=void 0,this.#h=!0,this.#Re()}#Re(){this.#s=void 0,this.#l=void 0,this.#u=void 0,this.#r=!0}async fitColumnWidth(){await this.updateComplete;let e=this._getVisibleItems();if(e.length===0)return 0;let n=this.style.getPropertyValue(`--detail-list-column-width`),r=this.style.getPropertyPriority(`--detail-list-column-width`);this.style.setProperty(`--detail-list-column-width`,`max-content`);let i=Math.ceil(Math.max(...e.map(e=>e.getBoundingClientRect().width)));return n?this.style.setProperty(`--detail-list-column-width`,n,r):this.style.removeProperty(`--detail-list-column-width`),this.style.setProperty(`--detail-list-column-width`,`${i}px`),this.#ye(),i}_isCheckable(e){return this.interactionMode!==`checked`||!e.hasAttribute(`not-checked`)}_setLabel(e,n){let r=document.createElement(`span`);return r.style.cssText=`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0`,r.textContent=n,e.appendChild(r),e.setAttribute(`data-search-label`,n),r}#ze(e){let n=e.getAttribute(`data-icon`);if(!n||e.firstElementChild?.tagName===`IXFX-ICON`)return;let r=document.createElement(`ixfx-icon`);r.setAttribute(`name`,n),r.style.marginInlineEnd=`var(--detail-list-icon-gap, 6px)`,r.style.flexShrink=`0`;let i=e.getAttribute(`data-icon-color`);i&&(r.style.color=i),e.prepend(r)}#Be(e,n){if(Vg(n))return;let r=e.querySelector(`:scope > .item-badge`);r||(r=document.createElement(`span`),r.className=`item-badge`,r.style.cssText=`flex-shrink:0;display:inline-flex;align-items:center;margin-inline-start:auto;padding-inline-start:var(--detail-list-badge-gap,8px)`,e.appendChild(r)),r.replaceChildren(),n instanceof Node?r.appendChild(n):o(n,r)}#Ve(){for(let e of this.#Fe())this.#ze(e)}#He(e){for(let n of e)for(let e of n.addedNodes)e instanceof HTMLLIElement&&e.parentElement===this&&this.#ze(e)}_syncItemStates(){let e=this.selection.selected,n=this.interactionMode===`checked`?new Set([...e].filter(e=>!e.hasAttribute(`not-checked`))):new Set,r=this.tickled.tickledId,i=this.#h||!A_(this.#p,e)||!A_(this.#m,n);if(this.#h){for(let i of this.#Fe())i.toggleAttribute(`data-tickled`,i===r),i.toggleAttribute(`data-selected`,e.has(i)),i.toggleAttribute(`data-checked`,n.has(i));this.#h=!1}else r!==this.#f&&(this.#f?.removeAttribute(`data-tickled`),r?.setAttribute(`data-tickled`,``)),j_(this.#p,e,`data-selected`),j_(this.#m,n,`data-checked`);this.#f=r,this.#p=new Set(e),this.#m=n,this.dataset.inputMode!==this.tickled.inputMode&&(this.dataset.inputMode=this.tickled.inputMode),i&&this._syncCheckboxes()}_syncCheckboxes(){let e=this.interactionMode===`checked`,n=typeof this.checkboxRenderer==`function`;if(!(!e&&!this.#g)){this.#g=e;for(let r of this.querySelectorAll(`li`)){let i=r.querySelector(`.ixfx-list-checkbox`);if(!e){i&&i.remove();continue}if(r.hasAttribute(`not-checked`)){i&&i.remove();continue}let a=i?.classList.contains(`ixfx-list-checkbox-custom`)??!1;i&&a!==n&&i.remove();let s=r.querySelector(`.ixfx-list-checkbox`);if(!s){if(n){let e=this.checkboxRenderer,n=e.margin??`0`,i=e.width??`24px`;s=this._createCustomCheckbox(r,n,i)}else s=this._createNativeCheckboxCell(r);r.prepend(s)}let c=this.selection.selected.has(r);if(n){if(s.setAttribute(`aria-checked`,String(c)),s.toggleAttribute(`data-checked`,c),this.checkboxRenderer){let e=typeof this.checkboxRenderer==`function`?this.checkboxRenderer:this.checkboxRenderer.renderer;o(e(c),s)}}else{let e=s.querySelector(`input.ixfx-list-checkbox`);e&&(e.checked=c)}}}}_createNativeCheckboxCell(e){let n=document.createElement(`span`);n.className=`ixfx-list-checkbox ixfx-list-checkbox-native`,n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:18px;margin:0 6px 0 0;cursor:pointer;pointer-events:auto`,n.tabIndex=-1,n.setAttribute(`role`,`checkbox`),n.setAttribute(`part`,`checkbox`),n.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)});let r=document.createElement(`input`);return r.type=`checkbox`,r.className=`ixfx-list-checkbox`,r.style.cssText=`pointer-events:none;cursor:pointer;margin:0`,n.appendChild(r),n}_createCustomCheckbox(e,n,r){let i=document.createElement(`span`);return i.className=`ixfx-list-checkbox ixfx-list-checkbox-custom`,i.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:${r};margin:${n};cursor:pointer;pointer-events:auto`,i.tabIndex=-1,i.setAttribute(`role`,`checkbox`),i.setAttribute(`part`,`checkbox`),i.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)}),i}_findListItem(e){for(let n of e)if(n instanceof Element){if(n===this)break;if(n.parentElement===this&&n.matches(`li`))return n}}_dispatch(e,n){this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0}))}_dispatchCancelable(e,n){return this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}#Ue;#We(){this.#y===0&&(this.#y=requestAnimationFrame(()=>{this.#y=0,this.#Ke()}))}#Ge(){let e=this._getVisibleItems();return this.#u??=e.flatMap(e=>{let n=D(e);return n===void 0?[]:[n]}),this.#u}#Ke(){let e=this.#Ge(),n=this.visibleKeys();k_(this.#b,e)&&k_(this.#x,n)||(this.#b=e,this.#x=n,this._dispatch(`detail-list-viewport-change`,{renderedKeys:e,visibleKeys:n}))}_activateItem(e){this.interactionMode!==`manual`&&this.selection.replace(e),this._dispatch(`list-activate`,{item:e})}static{this.styles=[w,Mg(`x`),Vt,r`
|
|
5608
5614
|
:host {
|
|
5609
5615
|
display: block;
|
|
5610
5616
|
position: relative;
|
|
@@ -5822,7 +5828,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
5822
5828
|
data-shape=${r?`vertical`:`horizontal`}
|
|
5823
5829
|
></span>
|
|
5824
5830
|
</div>
|
|
5825
|
-
`}static{this.styles=[w,
|
|
5831
|
+
`}static{this.styles=[w,Yt,r`
|
|
5826
5832
|
:host {
|
|
5827
5833
|
display: block;
|
|
5828
5834
|
width: 100%;
|
|
@@ -5952,7 +5958,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
5952
5958
|
<div class="list-toolbar ${this.orientation}" part="list-toolbar">
|
|
5953
5959
|
<slot name="toolbar" @slotchange=${this.#c}></slot>
|
|
5954
5960
|
</div>
|
|
5955
|
-
</div>`}#o;#s(){this.#e=(this.shadowRoot?.querySelector(`slot:not([name])`))?.assignedElements({flatten:!0})??[]}#c;firstUpdated(){this.updateComplete.then(()=>{this.#s(),this.#p(),this.#u(),this.#d(),this.#c()})}updated(e){if(super.updated(e),this.classList.toggle(`scrollable`,this.scrollable),e.has(`dragMode`)&&this.toggleAttribute(`drag-mode`,this.dragMode!==`off`),e.has(`hideLabels`)&&this.#u(),e.has(`labelNogrow`)&&this.#d(),e.has(`orientation`)||e.has(`flip`))for(let e of this.#e)e.setAttribute(`indicator-edge`,this.#f)}connectedCallback(){super.connectedCallback(),_y()}#l(e){let n=py(this);if(n===void 0){e();return}this.style.setProperty(`--ixfx-tab-indicator-name`,this.#t);let r=yy(this.#t,n,e),i=()=>this.style.removeProperty(`--ixfx-tab-indicator-name`);r.finished.then(i,i)}#u(){for(let e of this.#e)this.hideLabels?e.setAttribute(`hide-labels`,``):e.removeAttribute(`hide-labels`)}#d(){for(let e of this.#e)this.labelNogrow?e.setAttribute(`label-nogrow`,``):e.removeAttribute(`label-nogrow`)}get#f(){return this.#i?this.flip?`left`:`right`:this.flip?`top`:`bottom`}#p(){for(let e of this.#e)e.setAttribute(`indicator-edge`,this.#f),e.style.setProperty(`--indicator-color-bottom`,`transparent`),e.style.setProperty(`--indicator-color-top`,`transparent`),e.style.setProperty(`--indicator-color-left`,`transparent`),e.style.setProperty(`--indicator-color-right`,`transparent`),e.hasAttribute(`selected`)&&(this.orientation===`horizontal`&&!this.flip?e.style.setProperty(`--indicator-color-bottom`,`var(--accent)`):this.orientation===`horizontal`&&this.flip?e.style.setProperty(`--indicator-color-top`,`var(--accent)`):this.#i&&!this.flip?e.style.setProperty(`--indicator-color-right`,`var(--accent)`):this.#i&&this.flip&&e.style.setProperty(`--indicator-color-left`,`var(--accent)`))}#m;#h;#g;getSelectedElement(){for(let e of this.#e)if(this.#_(e))return e;let e=this.shadowRoot?.querySelector(`slot`);if(e){let n=e.assignedElements({flatten:!0});for(let e of n)if(this.#_(e))return e}}#_(e){return e.getAttribute(`selected`)!==null&&e.hasAttribute(`selected`)}selectElement(e){let n=this.getSelectedElement();n&&(n.removeAttribute(`selected`),n.style.setProperty(`--indicator-color-bottom`,`transparent`),n.style.setProperty(`--indicator-color-top`,`transparent`),n.style.setProperty(`--indicator-color-left`,`transparent`),n.style.setProperty(`--indicator-color-right`,`transparent`)),e.setAttribute(`selected`,``),this.orientation===`horizontal`&&!this.flip?e.style.setProperty(`--indicator-color-bottom`,`var(--accent)`):this.orientation===`horizontal`&&this.flip?e.style.setProperty(`--indicator-color-top`,`var(--accent)`):this.#i&&!this.flip?e.style.setProperty(`--indicator-color-right`,`var(--accent)`):this.#i&&this.flip&&e.style.setProperty(`--indicator-color-left`,`var(--accent)`)}#v(){let e=!1;for(let n of this.#e)if(this.#_(n)&&!e)e=!0;else if(e){this.#l(()=>this.selectElement(n));break}}#y(){let e;for(let n of this.#e)if(this.#_(n)&&e){let n=e;this.#l(()=>this.selectElement(n))}else e=n}#b;#x(e){if(this.dragMode===`off`)return null;let n=e.composedPath(),r=null;for(let e of n)if(e instanceof HTMLElement){if(e.classList.contains(`close-btn`)||e.classList.contains(`toolbar`))return null;!r&&e.tagName===`IXFX-TAB-LIST-ITEM`&&(r=e)}return r}#S;#C;#w;#T;#E(){this.#w!==null&&(cancelAnimationFrame(this.#w),this.#w=null),this.#C=null}#D;#O;#k;#A(e){let n=this.#n;if(!(!n||n.active)){try{this.#L?.setPointerCapture(e.pointerId)}catch{}n.active=!0,n.source.setAttribute(`drag-source`,``),n.ghost=this.#P(n.source),n.ghost&&n.ghost.move(e.clientX,e.clientY)}}#j(){let e=this.#n;e&&(e.source.removeAttribute(`drag-source`),e.gapIndex!==void 0&&(e.gapIndex=void 0,this.requestUpdate()))}#M(e){let n=this.#n;if(n){this.#E(),n.ghost?.destroy(),n.ghost=null,this.#n=null,window.removeEventListener(`pointermove`,this.#T),window.removeEventListener(`pointerup`,this.#O),window.removeEventListener(`pointercancel`,this.#k);try{this.#L?.releasePointerCapture(e)}catch{}this.requestUpdate()}}#N(e,n,r){e.removeAttribute(`drag-source`);let i=this.#e.filter(n=>n!==e),a=r===void 0?i.length:Math.max(0,Math.min(r,i.length)),o=e.parentNode;if(!o)return;let s=i[a]??null;o.insertBefore(e,s);let c=Array.prototype.indexOf.call(o.children,e);c!==n&&(this.#e=(this.shadowRoot?.querySelector(`slot`))?.assignedElements({flatten:!0})??[],this.#p(),this.#r=!0,this.dispatchEvent(new CustomEvent(`reorder`,{bubbles:!0,detail:{id:e.id,fromIndex:n,toIndex:c}})))}#P(e){let n=document.createElement(`span`);n.style.display=`inline-flex`,n.style.alignItems=`center`,n.style.gap=`var(--space-xs, 4px)`,n.style.minWidth=`0`;let r=e.iconName;if(r){let e=document.createElement(`ixfx-icon`);e.name=r,n.appendChild(e)}let i=document.createElement(`span`);i.textContent=(e.textContent??``).trim(),i.style.overflow=`hidden`,i.style.textOverflow=`ellipsis`,i.style.whiteSpace=`nowrap`,n.appendChild(i);try{return Gg({anchor:e,content:n})}catch{return null}}#F(e,n){let r=this.#n;if(!r)return;let i=this.#e.filter(e=>e!==r.source);if(i.length===0)return 0;let a=!this.#i,o=0,s=1/0;for(let r=0;r<i.length;r++){let c=i[r].getBoundingClientRect(),l=a?c.left:c.top,u=a?c.right:c.bottom,d=(l+u)/2,f=a?e:n,p=Math.abs(f-l);Math.abs(f-d);let m=Math.abs(f-u);f<d?p<s&&(s=p,o=r):m<s&&(s=m,o=r+1)}return o}#I(){let e=this.#n;if(!e?.active||e.gapIndex===void 0)return;let n=this.#e.filter(n=>n!==e.source);if(n.length===0)return;let r=!this.#i,i=this.#L?.getBoundingClientRect();if(!i)return;let a=Math.max(0,Math.min(e.gapIndex,n.length)),o=null;if(o=a<n.length?n[a].getBoundingClientRect():n[n.length-1].getBoundingClientRect(),r){let e=(a<n.length?o.left:o.right)-i.left,r=i.height;return`transform: translate(${e-1}px, 0px); width: 2px; height: ${r}px;`}{let e=(a<n.length?o.top:o.bottom)-i.top,r=i.width;return`transform: translate(0px, ${e-1}px); width: ${r}px; height: 2px;`}}get#L(){return this.shadowRoot?.getElementById(`container`)??null}static{this.styles=[w,
|
|
5961
|
+
</div>`}#o;#s(){this.#e=(this.shadowRoot?.querySelector(`slot:not([name])`))?.assignedElements({flatten:!0})??[]}#c;firstUpdated(){this.updateComplete.then(()=>{this.#s(),this.#p(),this.#u(),this.#d(),this.#c()})}updated(e){if(super.updated(e),this.classList.toggle(`scrollable`,this.scrollable),e.has(`dragMode`)&&this.toggleAttribute(`drag-mode`,this.dragMode!==`off`),e.has(`hideLabels`)&&this.#u(),e.has(`labelNogrow`)&&this.#d(),e.has(`orientation`)||e.has(`flip`))for(let e of this.#e)e.setAttribute(`indicator-edge`,this.#f)}connectedCallback(){super.connectedCallback(),_y()}#l(e){let n=py(this);if(n===void 0){e();return}this.style.setProperty(`--ixfx-tab-indicator-name`,this.#t);let r=yy(this.#t,n,e),i=()=>this.style.removeProperty(`--ixfx-tab-indicator-name`);r.finished.then(i,i)}#u(){for(let e of this.#e)this.hideLabels?e.setAttribute(`hide-labels`,``):e.removeAttribute(`hide-labels`)}#d(){for(let e of this.#e)this.labelNogrow?e.setAttribute(`label-nogrow`,``):e.removeAttribute(`label-nogrow`)}get#f(){return this.#i?this.flip?`left`:`right`:this.flip?`top`:`bottom`}#p(){for(let e of this.#e)e.setAttribute(`indicator-edge`,this.#f),e.style.setProperty(`--indicator-color-bottom`,`transparent`),e.style.setProperty(`--indicator-color-top`,`transparent`),e.style.setProperty(`--indicator-color-left`,`transparent`),e.style.setProperty(`--indicator-color-right`,`transparent`),e.hasAttribute(`selected`)&&(this.orientation===`horizontal`&&!this.flip?e.style.setProperty(`--indicator-color-bottom`,`var(--accent)`):this.orientation===`horizontal`&&this.flip?e.style.setProperty(`--indicator-color-top`,`var(--accent)`):this.#i&&!this.flip?e.style.setProperty(`--indicator-color-right`,`var(--accent)`):this.#i&&this.flip&&e.style.setProperty(`--indicator-color-left`,`var(--accent)`))}#m;#h;#g;getSelectedElement(){for(let e of this.#e)if(this.#_(e))return e;let e=this.shadowRoot?.querySelector(`slot`);if(e){let n=e.assignedElements({flatten:!0});for(let e of n)if(this.#_(e))return e}}#_(e){return e.getAttribute(`selected`)!==null&&e.hasAttribute(`selected`)}selectElement(e){let n=this.getSelectedElement();n&&(n.removeAttribute(`selected`),n.style.setProperty(`--indicator-color-bottom`,`transparent`),n.style.setProperty(`--indicator-color-top`,`transparent`),n.style.setProperty(`--indicator-color-left`,`transparent`),n.style.setProperty(`--indicator-color-right`,`transparent`)),e.setAttribute(`selected`,``),this.orientation===`horizontal`&&!this.flip?e.style.setProperty(`--indicator-color-bottom`,`var(--accent)`):this.orientation===`horizontal`&&this.flip?e.style.setProperty(`--indicator-color-top`,`var(--accent)`):this.#i&&!this.flip?e.style.setProperty(`--indicator-color-right`,`var(--accent)`):this.#i&&this.flip&&e.style.setProperty(`--indicator-color-left`,`var(--accent)`)}#v(){let e=!1;for(let n of this.#e)if(this.#_(n)&&!e)e=!0;else if(e){this.#l(()=>this.selectElement(n));break}}#y(){let e;for(let n of this.#e)if(this.#_(n)&&e){let n=e;this.#l(()=>this.selectElement(n))}else e=n}#b;#x(e){if(this.dragMode===`off`)return null;let n=e.composedPath(),r=null;for(let e of n)if(e instanceof HTMLElement){if(e.classList.contains(`close-btn`)||e.classList.contains(`toolbar`))return null;!r&&e.tagName===`IXFX-TAB-LIST-ITEM`&&(r=e)}return r}#S;#C;#w;#T;#E(){this.#w!==null&&(cancelAnimationFrame(this.#w),this.#w=null),this.#C=null}#D;#O;#k;#A(e){let n=this.#n;if(!(!n||n.active)){try{this.#L?.setPointerCapture(e.pointerId)}catch{}n.active=!0,n.source.setAttribute(`drag-source`,``),n.ghost=this.#P(n.source),n.ghost&&n.ghost.move(e.clientX,e.clientY)}}#j(){let e=this.#n;e&&(e.source.removeAttribute(`drag-source`),e.gapIndex!==void 0&&(e.gapIndex=void 0,this.requestUpdate()))}#M(e){let n=this.#n;if(n){this.#E(),n.ghost?.destroy(),n.ghost=null,this.#n=null,window.removeEventListener(`pointermove`,this.#T),window.removeEventListener(`pointerup`,this.#O),window.removeEventListener(`pointercancel`,this.#k);try{this.#L?.releasePointerCapture(e)}catch{}this.requestUpdate()}}#N(e,n,r){e.removeAttribute(`drag-source`);let i=this.#e.filter(n=>n!==e),a=r===void 0?i.length:Math.max(0,Math.min(r,i.length)),o=e.parentNode;if(!o)return;let s=i[a]??null;o.insertBefore(e,s);let c=Array.prototype.indexOf.call(o.children,e);c!==n&&(this.#e=(this.shadowRoot?.querySelector(`slot`))?.assignedElements({flatten:!0})??[],this.#p(),this.#r=!0,this.dispatchEvent(new CustomEvent(`reorder`,{bubbles:!0,detail:{id:e.id,fromIndex:n,toIndex:c}})))}#P(e){let n=document.createElement(`span`);n.style.display=`inline-flex`,n.style.alignItems=`center`,n.style.gap=`var(--space-xs, 4px)`,n.style.minWidth=`0`;let r=e.iconName;if(r){let e=document.createElement(`ixfx-icon`);e.name=r,n.appendChild(e)}let i=document.createElement(`span`);i.textContent=(e.textContent??``).trim(),i.style.overflow=`hidden`,i.style.textOverflow=`ellipsis`,i.style.whiteSpace=`nowrap`,n.appendChild(i);try{return Gg({anchor:e,content:n})}catch{return null}}#F(e,n){let r=this.#n;if(!r)return;let i=this.#e.filter(e=>e!==r.source);if(i.length===0)return 0;let a=!this.#i,o=0,s=1/0;for(let r=0;r<i.length;r++){let c=i[r].getBoundingClientRect(),l=a?c.left:c.top,u=a?c.right:c.bottom,d=(l+u)/2,f=a?e:n,p=Math.abs(f-l);Math.abs(f-d);let m=Math.abs(f-u);f<d?p<s&&(s=p,o=r):m<s&&(s=m,o=r+1)}return o}#I(){let e=this.#n;if(!e?.active||e.gapIndex===void 0)return;let n=this.#e.filter(n=>n!==e.source);if(n.length===0)return;let r=!this.#i,i=this.#L?.getBoundingClientRect();if(!i)return;let a=Math.max(0,Math.min(e.gapIndex,n.length)),o=null;if(o=a<n.length?n[a].getBoundingClientRect():n[n.length-1].getBoundingClientRect(),r){let e=(a<n.length?o.left:o.right)-i.left,r=i.height;return`transform: translate(${e-1}px, 0px); width: 2px; height: ${r}px;`}{let e=(a<n.length?o.top:o.bottom)-i.top,r=i.width;return`transform: translate(0px, ${e-1}px); width: ${r}px; height: 2px;`}}get#L(){return this.shadowRoot?.getElementById(`container`)??null}static{this.styles=[w,Mg(`x`),Mg(`y`),r`
|
|
5956
5962
|
:host {
|
|
5957
5963
|
display: inline-block;
|
|
5958
5964
|
--activated-colour: var(--accent);
|
|
@@ -6139,7 +6145,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
6139
6145
|
</div>
|
|
6140
6146
|
`:a}
|
|
6141
6147
|
</div>
|
|
6142
|
-
`}_onCloseClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})),this.remove()}static{this.styles=[w,
|
|
6148
|
+
`}_onCloseClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0})),this.remove()}static{this.styles=[w,sn,r`
|
|
6143
6149
|
:host {
|
|
6144
6150
|
--selected-tab-color: var(--ixfx-selected-tab-color, var(--surface-2-text));
|
|
6145
6151
|
--selected-tab-icon-color: var(--ixfx-selected-tab-icon-color, var(--accent));
|
|
@@ -6488,7 +6494,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
6488
6494
|
.closeable=${r?.closable??!1}
|
|
6489
6495
|
@close=${()=>this.removePanel(n)}
|
|
6490
6496
|
>${r?.title??n}</ixfx-tab-list-item>
|
|
6491
|
-
`}_stripCaretRect(e,n,r){let i=Array.from(e.querySelectorAll(Oy));if(i.length===0)return;let a=Math.max(0,Math.min(n??i.length,i.length)),o=a<i.length?i[a].getBoundingClientRect().left:i[i.length-1].getBoundingClientRect().right,s=e.getBoundingClientRect();return{x:o-r.left-1,y:s.top-r.top,w:2,h:s.height}}static{this.styles=[w,
|
|
6497
|
+
`}_stripCaretRect(e,n,r){let i=Array.from(e.querySelectorAll(Oy));if(i.length===0)return;let a=Math.max(0,Math.min(n??i.length,i.length)),o=a<i.length?i[a].getBoundingClientRect().left:i[i.length-1].getBoundingClientRect().right,s=e.getBoundingClientRect();return{x:o-r.left-1,y:s.top-r.top,w:2,h:s.height}}static{this.styles=[w,Yt,r`
|
|
6492
6498
|
:host {
|
|
6493
6499
|
display: block;
|
|
6494
6500
|
width: 100%;
|
|
@@ -6768,7 +6774,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
6768
6774
|
@beforeinput=${this._handleBeforeInput}
|
|
6769
6775
|
@input=${this._stopNativeInput}
|
|
6770
6776
|
></div>
|
|
6771
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerUp),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._interceptClick,{capture:!0}),this.addEventListener(`mouseenter`,this._handleMouseEnter),this.addEventListener(`mouseleave`,this._handleMouseLeave)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerUp),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._interceptClick),this.removeEventListener(`mouseenter`,this._handleMouseEnter),this.removeEventListener(`mouseleave`,this._handleMouseLeave)}get _contentEl(){return this.renderRoot?.querySelector(`.number`)??void 0}firstUpdated(e){super.firstUpdated(e),this.displayTextLogic===`show`&&(this._showModeWaitingToHide=!0),this._updateValueCss(this._normalizedValue()),this._requestDisplayUpdate()}_onUserInteraction(){if(this.displayTextLogic===`show`&&!this._editing){this._clearTransientTimer(),this._showModeWaitingToHide=!1,this._requestDisplayUpdate(),this._transientTimer=window.setTimeout(()=>{this._showModeWaitingToHide=!0,this._requestDisplayUpdate()},this.disappearDelay);return}if(this.displayTextLogic===`transient`&&!this._editing){this._clearTransientTimer(),this._transientShowingValue=!0,this._requestDisplayUpdate(),this._transientTimer=window.setTimeout(()=>{this._hovering||(this._transientShowingValue=!1,this._requestDisplayUpdate())},this.disappearDelay);return}super._onUserInteraction()}_onValueChange(){this.displayTextLogic!==`show`||this._editing||(this._clearTransientTimer(),this._showModeWaitingToHide=!1,this._requestDisplayUpdate(),this._transientTimer=window.setTimeout(()=>{this._showModeWaitingToHide=!0,this._requestDisplayUpdate()},this.disappearDelay))}updated(e){super.updated(e),this._editing||this._updateValueCss(this._normalizedValue())}_updateValueCss(e){this.style.setProperty(`--value`,String(e));let n=0,r=e;if(this.linearStyle===`bipolar`?e<=.5?(n=e,r=.5):(n=.5,r=e):this.linearStyle===`unipolar`&&(n=.5-e*.5,r=.5+e*.5),this.style.setProperty(`--value-start`,String(n)),this.style.setProperty(`--value-end`,String(r)),this.fillStyle===`circular`&&this.circularStyle===`offset`){let n=this.offsetHeight,r=this.offsetWidth,i=n/2-2,a=r-2,o=2+i+e*(a-2-2*i);this.style.setProperty(`--radius`,`${i}px`),this.style.setProperty(`--value-center-px`,`${o}px`),this.style.setProperty(`--component-width-px`,`${r}px`),this.style.setProperty(`--component-height-px`,`${n}px`)}}_getDisplayText(){if(this._shouldUseDisplayText())return this.displayText??``;if(this.#n){let e=this.step===void 0?this.#i.toFixed(this.precision):this._formatNumber(this.#i);return this.formatter?this.formatter(e):e}if(this.formatter){let e=Number.parseFloat(this.value);return this.formatter(Number.isNaN(e)?this.value:String(e))}return this._formatDisplay()}_tryCommit(){let e=this.renderRoot?.querySelector(`.number`);if(e){let n=Number.parseFloat(e.textContent?.trim()??``);Number.isNaN(n)||(e.textContent=this._formatNumber(this._clamp(this._snap(n))))}super._tryCommit()}_handleArrowKey(e){let n=(this.max??100)-(this.min??0);if(n===0)return!1;let r=Ky(n,this.stops,this.step,e.shiftKey),i=0,a=!1;switch(e.key){case`ArrowUp`:case`ArrowRight`:i=r,a=!0;break;case`ArrowDown`:case`ArrowLeft`:i=-r,a=!0;break;case`Home`:i=-(this._parseValue()-(this.min??0)),a=!0;break;case`End`:i=(this.max??0)-this._parseValue(),a=!0}return a?(e.preventDefault(),this._applyDelta(i),!0):!1}_applyDelta(e){let n=this.value,r=this._parseValue(),i=this._clamp(this._snap(r+e)),a=this.step===void 0?i.toFixed(this.precision):this._formatNumber(i);this.value=a,this._requestDisplayUpdate(),this._updateValueCss(this._normalizedValue(i)),a!==n&&this.dispatchEvent(new CustomEvent(`input`,{detail:{value:a},bubbles:!0,composed:!0})),requestAnimationFrame(()=>{this.value!==n&&this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.value},bubbles:!0,composed:!0}))})}_shouldHandleWheel(){return!this._editing&&super._shouldHandleWheel()}_applyWheelDelta(e,n){let r=(this.max??100)-(this.min??0);if(r===0)return;let i=Ky(r,this.stops,this.step,n.shiftKey);this._applyDelta(e*i)}_parseValue(){return Number.parseFloat(this.value)||0}_formatDisplay(){let e=Number.parseFloat(this.value);if(Number.isNaN(e))return this.value;if(this.precision!==void 0)return e.toFixed(this.precision);let n=this.value.indexOf(`.`),r=n>=0?this.value.length-n-1:0;return e.toFixed(r)}_clamp(e){return this.min!==void 0&&(e=Math.max(this.min,e)),this.max!==void 0&&(e=Math.min(this.max,e)),e}_snap(e){if(this.stops&&this.stops>1){let n=this.min??0,r=((this.max??100)-n)/this.stops;return Math.round((e-n)/r)*r+n}return this.step?Math.round(e/this.step)*this.step:e}_inferDecimals(e){if(this.step!==void 0){let e=String(this.step),n=e.indexOf(`.`);return n>=0?e.length-n-1:0}let n=String(e??this._parseValue()),r=n.indexOf(`.`);return r>=0?n.length-r-1:0}_formatNumber(e){return e.toFixed(this._inferDecimals(e))}_normalizedValue(e=this._parseValue()){return this.min===void 0||this.max===void 0||this.max===this.min?0:Math.max(0,Math.min(1,(e-this.min)/(this.max-this.min)))}static{this.styles=[w,
|
|
6777
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerUp),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._interceptClick,{capture:!0}),this.addEventListener(`mouseenter`,this._handleMouseEnter),this.addEventListener(`mouseleave`,this._handleMouseLeave)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerUp),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._interceptClick),this.removeEventListener(`mouseenter`,this._handleMouseEnter),this.removeEventListener(`mouseleave`,this._handleMouseLeave)}get _contentEl(){return this.renderRoot?.querySelector(`.number`)??void 0}firstUpdated(e){super.firstUpdated(e),this.displayTextLogic===`show`&&(this._showModeWaitingToHide=!0),this._updateValueCss(this._normalizedValue()),this._requestDisplayUpdate()}_onUserInteraction(){if(this.displayTextLogic===`show`&&!this._editing){this._clearTransientTimer(),this._showModeWaitingToHide=!1,this._requestDisplayUpdate(),this._transientTimer=window.setTimeout(()=>{this._showModeWaitingToHide=!0,this._requestDisplayUpdate()},this.disappearDelay);return}if(this.displayTextLogic===`transient`&&!this._editing){this._clearTransientTimer(),this._transientShowingValue=!0,this._requestDisplayUpdate(),this._transientTimer=window.setTimeout(()=>{this._hovering||(this._transientShowingValue=!1,this._requestDisplayUpdate())},this.disappearDelay);return}super._onUserInteraction()}_onValueChange(){this.displayTextLogic!==`show`||this._editing||(this._clearTransientTimer(),this._showModeWaitingToHide=!1,this._requestDisplayUpdate(),this._transientTimer=window.setTimeout(()=>{this._showModeWaitingToHide=!0,this._requestDisplayUpdate()},this.disappearDelay))}updated(e){super.updated(e),this._editing||this._updateValueCss(this._normalizedValue())}_updateValueCss(e){this.style.setProperty(`--value`,String(e));let n=0,r=e;if(this.linearStyle===`bipolar`?e<=.5?(n=e,r=.5):(n=.5,r=e):this.linearStyle===`unipolar`&&(n=.5-e*.5,r=.5+e*.5),this.style.setProperty(`--value-start`,String(n)),this.style.setProperty(`--value-end`,String(r)),this.fillStyle===`circular`&&this.circularStyle===`offset`){let n=this.offsetHeight,r=this.offsetWidth,i=n/2-2,a=r-2,o=2+i+e*(a-2-2*i);this.style.setProperty(`--radius`,`${i}px`),this.style.setProperty(`--value-center-px`,`${o}px`),this.style.setProperty(`--component-width-px`,`${r}px`),this.style.setProperty(`--component-height-px`,`${n}px`)}}_getDisplayText(){if(this._shouldUseDisplayText())return this.displayText??``;if(this.#n){let e=this.step===void 0?this.#i.toFixed(this.precision):this._formatNumber(this.#i);return this.formatter?this.formatter(e):e}if(this.formatter){let e=Number.parseFloat(this.value);return this.formatter(Number.isNaN(e)?this.value:String(e))}return this._formatDisplay()}_tryCommit(){let e=this.renderRoot?.querySelector(`.number`);if(e){let n=Number.parseFloat(e.textContent?.trim()??``);Number.isNaN(n)||(e.textContent=this._formatNumber(this._clamp(this._snap(n))))}super._tryCommit()}_handleArrowKey(e){let n=(this.max??100)-(this.min??0);if(n===0)return!1;let r=Ky(n,this.stops,this.step,e.shiftKey),i=0,a=!1;switch(e.key){case`ArrowUp`:case`ArrowRight`:i=r,a=!0;break;case`ArrowDown`:case`ArrowLeft`:i=-r,a=!0;break;case`Home`:i=-(this._parseValue()-(this.min??0)),a=!0;break;case`End`:i=(this.max??0)-this._parseValue(),a=!0}return a?(e.preventDefault(),this._applyDelta(i),!0):!1}_applyDelta(e){let n=this.value,r=this._parseValue(),i=this._clamp(this._snap(r+e)),a=this.step===void 0?i.toFixed(this.precision):this._formatNumber(i);this.value=a,this._requestDisplayUpdate(),this._updateValueCss(this._normalizedValue(i)),a!==n&&this.dispatchEvent(new CustomEvent(`input`,{detail:{value:a},bubbles:!0,composed:!0})),requestAnimationFrame(()=>{this.value!==n&&this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.value},bubbles:!0,composed:!0}))})}_shouldHandleWheel(){return!this._editing&&super._shouldHandleWheel()}_applyWheelDelta(e,n){let r=(this.max??100)-(this.min??0);if(r===0)return;let i=Ky(r,this.stops,this.step,n.shiftKey);this._applyDelta(e*i)}_parseValue(){return Number.parseFloat(this.value)||0}_formatDisplay(){let e=Number.parseFloat(this.value);if(Number.isNaN(e))return this.value;if(this.precision!==void 0)return e.toFixed(this.precision);let n=this.value.indexOf(`.`),r=n>=0?this.value.length-n-1:0;return e.toFixed(r)}_clamp(e){return this.min!==void 0&&(e=Math.max(this.min,e)),this.max!==void 0&&(e=Math.min(this.max,e)),e}_snap(e){if(this.stops&&this.stops>1){let n=this.min??0,r=((this.max??100)-n)/this.stops;return Math.round((e-n)/r)*r+n}return this.step?Math.round(e/this.step)*this.step:e}_inferDecimals(e){if(this.step!==void 0){let e=String(this.step),n=e.indexOf(`.`);return n>=0?e.length-n-1:0}let n=String(e??this._parseValue()),r=n.indexOf(`.`);return r>=0?n.length-r-1:0}_formatNumber(e){return e.toFixed(this._inferDecimals(e))}_normalizedValue(e=this._parseValue()){return this.min===void 0||this.max===void 0||this.max===this.min?0:Math.max(0,Math.min(1,(e-this.min)/(this.max-this.min)))}static{this.styles=[w,sn,...Uy.styles,r`
|
|
6772
6778
|
:host {
|
|
6773
6779
|
font-size: var(--text-s,11px);
|
|
6774
6780
|
--value: 0;
|
|
@@ -6924,7 +6930,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
6924
6930
|
:host([fill-style="circular"]:not([circular-style])) {
|
|
6925
6931
|
aspect-ratio: 1;
|
|
6926
6932
|
}
|
|
6927
|
-
`]}};E([d({type:Number})],Jy.prototype,`min`,void 0),E([d({type:Number})],Jy.prototype,`max`,void 0),E([d({type:Number})],Jy.prototype,`step`,void 0),E([d({type:Number})],Jy.prototype,`stops`,void 0),E([d({type:Number,attribute:`drag-sensitivity`})],Jy.prototype,`dragSensitivity`,void 0),E([d({attribute:`fill-style`})],Jy.prototype,`fillStyle`,void 0),E([d({attribute:`linear-style`})],Jy.prototype,`linearStyle`,void 0),E([d({attribute:`circular-style`})],Jy.prototype,`circularStyle`,void 0),E([d({type:Boolean,attribute:`no-drag`})],Jy.prototype,`noDrag`,void 0),E([d({type:Number})],Jy.prototype,`precision`,void 0),Jy=E([T(`ixfx-editable-number`)],Jy);const Yy=`li:not([data-virtual-spacer]), [data-list-item]:not([data-virtual-spacer])`;function Xy(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}let W=class extends n{constructor(...e){super(...e),this.selectionMode=`single`,this.interactionMode=`standard`,this.itemWrap=`stop`,this.itemsDraggable=!1,this.keyProperty=``,this.virtualize=!1,this.itemHeight=0,this.itemsDroppable=!1,this.#e=new Map,this.#t=new Set,this.#n=new WeakMap,this.#i=new WeakSet,this.#a=[],this.#o=document.createDocumentFragment(),this.#s=0,this.#c=0,this.#l=[],this.#u=!1,this.#d=0,this.#_=0,this.#v=!1,this.selection=new nr({getOrderedItems:()=>this.#J(),isSelectable:e=>this._isCheckable(e),getModes:()=>({selectionMode:this.selectionMode,interactionMode:this.interactionMode}),getKey:D,onChange:(e,n)=>{this._syncItemStates(),this._dispatch(`list-select`,{selected:e,previous:n,selectedKeys:this.selection.selectedKeys})}}),this.tickled=(e=>new oe(e,{getItems:()=>e.#J().map(e=>({id:e,enabled:!e.hasAttribute(`not-checked`)})),onTickle:e=>{e!==void 0&&this._dispatch(`list-tickle`,{item:e})},onStateChange:()=>this._syncItemStates(),get itemWrap(){return e.itemWrap},hoverDisabled:()=>this.#T.isDragging||this.#x.isDragging}))(this),this.#y=!1,this.#b=0,this.#x=new er(this,{source:`vertical-list`,isEnabled:()=>this.itemsDraggable&&this.selectionMode!==`none`&&this._getVisibleItems().length>0,resolveEventToKey:e=>{if(!(e instanceof Element))return;let n=e.closest?.(Yy);if(!(!n||!this.contains(n)||this.#t.has(n)))return D(n)},prepareSelection:e=>this.#S(e),getMetrics:()=>({}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>this._dispatchCancelable(`list-native-drag-start`,e),onActiveChange:(e,n)=>{this.#y=e,this.toggleAttribute(`data-native-dragging`,e);for(let r of this._getVisibleItems())r.toggleAttribute(`data-drag-origin`,e&&n!==void 0&&D(r)===n);if(e){let e=this.selection.selected.size;this.setAttribute(`aria-label`,e<=1?`Dragging 1 item`:`Dragging ${e} items`)}else this.removeAttribute(`aria-label`);this.requestUpdate()},onEnd:()=>{this.#y=!1,this.toggleAttribute(`data-native-dragging`,!1),this.removeAttribute(`aria-label`);for(let e of this._getVisibleItems())e.removeAttribute(`data-drag-origin`);if(this.#q())for(let e of this.#a)e.removeAttribute(`data-drag-origin`);this.#C()},syncLightDomDraggable:()=>this._syncNativeDraggable()}),this.#T=new Hn(this,{getSurface:()=>this.renderRoot.querySelector(`.container`),isEnabled:()=>!this.#q()&&this.selection.canDragSelect()&&this._getVisibleItems().length>0&&!this.hasAttribute(`disable-drag-select`),hitTest:e=>this.#E(e),getBaseSelection:()=>this.selection.selected,onPreview:(e,n)=>{this.#w=n;for(let n of this._getVisibleItems())n.toggleAttribute(`data-marquee`,e.has(n));this.requestUpdate()},onCommit:e=>{this.selection.applyDragSelection(e);for(let e of this._getVisibleItems())e.removeAttribute(`data-marquee`);this.#w=void 0,this.requestUpdate()},autoScroll:(e,n)=>{let r=this.renderRoot.querySelector(`ul`);r&&(r.scrollTop+=n)}}),this.search=new Vt(this,{adapter:Mt(this,{itemSelector:Yy,getLabel:e=>e.getAttribute(`data-search-label`)??e.textContent?.trim()??``,highlightKey:`vertical-list-search`,getAllItems:()=>this.#J(),observeContainer:!1})}),this.#ae=()=>{this.#d===0&&(this.#d=requestAnimationFrame(()=>{this.#d=0,this.#oe(),this.#ue()}))},this._onPointerOver=e=>{let n=this._findListItem(e.composedPath());n&&this.tickled.handlePointerEnter(n)},this._onPointerLeave=e=>{this.tickled.handlePointerLeave(e)},this._onKeyDown=e=>{if(!(this.search.isOpen||this.#_e(e))){if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){let n=this.tickled.tickledId;if(n){e.preventDefault();let r=n.getBoundingClientRect();this.#he(n,r.left,r.bottom)}return}if((e.ctrlKey||e.metaKey)&&e.key===`a`){this.selection.canSelectAll()&&(e.preventDefault(),this.selection.selectAll());return}switch(e.key){case`ArrowDown`:if(e.preventDefault(),this.tickled.handleKeyboardNavigation(`next`),this.#P(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`ArrowUp`:if(e.preventDefault(),this.tickled.handleKeyboardNavigation(`previous`),this.#P(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`Home`:e.preventDefault(),this.tickled.handleKeyboardNavigation(`first`),this.#P();break;case`End`:e.preventDefault(),this.tickled.handleKeyboardNavigation(`last`),this.#P();break;case`PageDown`:e.preventDefault(),this.#I(1);break;case`PageUp`:e.preventDefault(),this.#I(-1);break;case`Enter`:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this._dispatch(`list-item-click`,{item:n}),this._activateItem(n));break}case` `:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.selection.handleSpace(n));break}case`Escape`:this.selection.clear()}}},this._onClick=e=>{if(this.#_e(e)||this.#T.isDragging||this.#x.isDragging||this.#b!==0)return;let n=this._findListItem(e.composedPath());n&&(this._dispatch(`list-item-click`,{item:n}),this.selection.handleClick(n,e))},this._onDblClick=e=>{if(this.#_e(e))return;let n=this._findListItem(e.composedPath());n&&this._activateItem(n)},this._onDragOver=e=>{let n=e.dataTransfer;if(!this.itemsDroppable||!n||this.#_e(e))return;let r=this._findListItem(e.composedPath());if(this.canDrop&&!this.canDrop(r,n)){this.#fe();return}if(this.#de&&this.#de.item!==r&&this.#fe(),this.#de={item:r},this._dispatchCancelable(`list-drag-over`,{key:r?D(r):void 0,item:r,dataTransfer:n})){this.#me(void 0,!1);return}e.preventDefault(),n.dropEffect===`none`&&(n.dropEffect=`copy`),this.#me(r,!0)},this._onDragLeave=e=>{let n=e.relatedTarget;n instanceof Node&&this.contains(n)||this.#fe()},this._onDrop=e=>{let n=e.dataTransfer;if(!this.itemsDroppable||!n||this.#_e(e))return;let r=this._findListItem(e.composedPath());if(this.canDrop&&!this.canDrop(r,n)){this.#fe();return}e.preventDefault(),this.#de=void 0,this.#me(void 0,!1),this._dispatch(`list-drop`,{key:r?D(r):void 0,item:r,dataTransfer:n})},this._onContextMenu=e=>{if(this.#_e(e))return;let n=this._findListItem(e.composedPath());n&&(this.#he(n,e.clientX,e.clientY)||e.preventDefault())}}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S(e){let n=this.#L(e);if(!n||!this._isCheckable(n))return;this.selection.selected.has(n)||this.selection.replace(n);let r=this.#J(),i=[];r.forEach(n=>{if(!this.selection.selected.has(n))return;let r=this.#Y(n);i.push({key:D(n)??e,index:r,item:n,element:n})});let a=i.find(n=>n.key===e);if(a)return{origin:a,selected:i}}_syncNativeDraggable(){if(this.isConnected)for(let e of this.querySelectorAll(Yy))this.#t.has(e)||e instanceof HTMLElement&&(e.draggable=this.itemsDraggable&&this._isCheckable(e))}#C(){this.#b&&clearTimeout(this.#b),this.#b=window.setTimeout(()=>{this.#b=0},0)}#w;#T;#E(e){let n=this.renderRoot.querySelector(`.container`);if(!n)return[];let r=n.getBoundingClientRect(),i=e.x,a=e.y,o=e.x+e.width,s=e.y+e.height,c=[];for(let e of this._getVisibleItems()){let n=e.getBoundingClientRect(),l=n.left-r.left,u=n.top-r.top;l<=o&&l+n.width>=i&&u<=s&&u+n.height>=a&&c.push(e)}return c}#D(e){return`left:${e.x}px;top:${e.y}px;width:${Math.max(0,e.width)}px;height:${Math.max(0,e.height)}px`}#O;#k;get registry(){return this.#O}#A(){let e=this.searchModes?.trim(),n;if(e===void 0)n=[...zt];else{let r=new Set(e.split(/\s+/));n=zt.filter(e=>r.has(e))}return this.#q()?n.filter(e=>e!==`filter`):n}#j(){this.#O&&(this.search.setModes(this.#A()),this.#k?.(),this.#k=Rt(this.#O,this.search))}connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.addEventListener(`pointerover`,this._onPointerOver),this.addEventListener(`pointerleave`,this._onPointerLeave),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`dragover`,this._onDragOver),this.addEventListener(`dragleave`,this._onDragLeave),this.addEventListener(`drop`,this._onDrop),this.addEventListener(`contextmenu`,this._onContextMenu);for(let e of this.querySelectorAll(Yy))this.#i.add(e);this.#r??=new MutationObserver(e=>this.#M(e)),this.#r.observe(this,{childList:!0}),this.#O??=Yt(),this.#j(),this.#ie()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerover`,this._onPointerOver),this.removeEventListener(`pointerleave`,this._onPointerLeave),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`dragover`,this._onDragOver),this.removeEventListener(`dragleave`,this._onDragLeave),this.removeEventListener(`drop`,this._onDrop),this.removeEventListener(`contextmenu`,this._onContextMenu),this.#fe(),this.#ge=void 0,this.#r?.disconnect(),this.#f?.disconnect(),this.#f=void 0,this.#d!==0&&(cancelAnimationFrame(this.#d),this.#d=0),this.#k?.(),this.#k=void 0,this.#O=void 0,this.#b&&=(clearTimeout(this.#b),0)}firstUpdated(){this.#ie()}#M(e){if(!this.isConnected)return;if(this.#q()){this.#oe(this.#$(e)),this.#le();return}let n=[];for(let r of e)for(let e of r.addedNodes)!(e instanceof HTMLElement)||e.parentElement!==this||e.matches(Yy)&&(this.#i.has(e)||this.#e.has(e)||this.#t.has(e)||(this.#i.add(e),n.push(e)));if(this.#le(),n.length!==0&&!this.#N(n.length))for(let e of n)Xn(e)}#N(e){return e>=this.querySelectorAll(Yy).length}updated(e){if(super.updated(e),e.has(`searchModes`)&&this.#j(),e.has(`virtualize`)||e.has(`itemHeight`)){let n=(e.has(`virtualize`)?e.get(`virtualize`):this.virtualize)===!0&&((e.has(`itemHeight`)?e.get(`itemHeight`):this.itemHeight)??0)>0;if(this.#q()){if(!n){this.#o=document.createDocumentFragment(),this.#a=[...this.querySelectorAll(Yy)];for(let e of this.#a)this.#i.add(e);this.#l=[]}this.#oe(!0)}else n?this.#ce():this.virtualize&&!this.#v&&(this.#v=!0,console.warn(`ixfx-vertical-list: virtualize needs item-height > 0 — running non-virtualized.`));this.#j()}if((e.has(`items`)||e.has(`formatter`)||e.has(`keyProperty`)||e.has(`icon`)||e.has(`iconColor`)||e.has(`textColor`)||e.has(`badge`))&&this.items!==void 0&&(this.#u?this.#u=!1:this.#q()?this.#K():this.#R()),e.has(`interactionMode`)){this.selection.clearAnchor();let n=this.selection.selected,r=e.get(`interactionMode`)===`checked`?new Map(this.#e):null;if(this._syncCheckboxes(),n.size>0){if(r&&r.size>0)this.selection.remap(e=>r.get(e)??e);else if(this.#e.size>0){let e=new Map([...this.#e].map(([e,n])=>[n,e]));this.selection.remap(n=>e.get(n)??n)}}this._syncItemStates()}else e.has(`checkboxRenderer`)&&this.interactionMode===`checked`&&this._syncCheckboxes();(e.has(`itemsDraggable`)||e.has(`interactionMode`))&&(this._syncNativeDraggable(),this.#x.refreshDraggable())}get selectedItem(){return[...this.selection.selected].at(-1)}get selectedItems(){return this.selection.selected}addItem(e,n){let r;if(typeof e==`string`){let n=document.createElement(`li`);n.textContent=e,r=n}else r=e;if(n?.notChecked&&r.setAttribute(`not-checked`,``),this.appendChild(r),this.#q()){this.#oe(!0);return}this.interactionMode===`checked`&&this._syncCheckboxes(),this.search.refresh()}removeItem(e){return this.selection.deselect(e),this.#q()?(e.parentNode===this?$n(e):Object.assign(Promise.resolve(),{animation:void 0})).then(()=>{let n=this.#Y(e);n>=0&&this.#a.splice(n,1),this.#Z(e),e.remove(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#oe(!0)}):$n(e).then(()=>{e.remove(),this.interactionMode===`checked`&&this._syncCheckboxes()})}removeItems(e){return Promise.all([...e].map(e=>this.removeItem(e))).then(()=>void 0)}clearItems(){this.#e.clear(),this.#q()&&(this.#a=[],this.#o=document.createDocumentFragment(),this.#l=[]),this.replaceChildren(),this.selection.reset(),this._syncItemStates(),this.search.refresh(),this.#q()&&this.#oe(!0)}setItems(e){if(this.#q()){this.#e.clear(),this.#o=document.createDocumentFragment(),this.#l=[],this.#a=[...e];for(let e of this.#a)this.#i.add(e);this.selection.reset(),this.search.refresh(),this.#oe(!0);return}for(let n of e)this.appendChild(n);this.interactionMode===`checked`&&this._syncCheckboxes(),this.search.refresh()}dispatch(e,n){this.#O?.invoke(e,n)}select(e){this.selection.replace(e)}selectMany(e){this.selection.selectMany(e)}deselect(e){this.selection.deselect(e)}clearSelection(){this.selection.clear()}selectAll(){this.selection.canSelectAll()&&this.selection.selectAll()}get selectedKeys(){return this.selection.selectedKeys}get tickledKey(){let e=this.tickled.tickledId;return e?D(e):void 0}selectKeys(e){this.selection.selectKeys(e,e=>this.#L(e))}addSelectedKeys(e){this.selection.addKeys(e,e=>this.#L(e))}removeSelectedKeys(e){this.selection.removeKeys(e,e=>this.#L(e))}focusKey(e){if(this.#q()){let n=this.#a.findIndex(n=>D(n)===e);if(n<0)return;let r=this.renderRoot.querySelector(`ul`);if(r){let e=this.itemHeight,i=r.clientHeight,a=n*e,o=(n+1)*e,s=r.scrollTop,c=i,l=s;a<s?l=a:o>s+c&&(l=o-c),l!==s&&(r.scrollTop=l),this.#oe(!0)}}let n=this.#L(e);!n||n.parentNode!==this||(this.tickled.focus(n),n.scrollIntoView({block:`nearest`,inline:`nearest`}))}#P(){let e=this.tickled.tickledId,n=e?D(e):void 0;n!==void 0&&this.focusKey(n)}#F(){let e=this.#te();if(!e)return 1;let n=e.clientHeight;if(this.#q())return Math.max(1,Math.floor(n/this.itemHeight));let r=this.querySelector(`li[data-key]`);if(!r)return 1;let i=r.offsetHeight||this.itemHeight;return Math.max(1,Math.floor(n/i))}#I(e){let n=this.#F(),r=this.#J().filter(e=>!e.hasAttribute(`not-checked`));if(r.length===0)return;let i=this.tickled.tickledId?D(this.tickled.tickledId):void 0,a=i===void 0?-1:r.findIndex(e=>D(e)===i),o=e===1?n-1:0,s=a<0?o:a+e*n;this.tickled.handleKeyboardNavigation(r[Math.min(r.length-1,Math.max(0,s))]),this.#P()}#L(e){if(this.#q())return this.#a.find(n=>D(n)===e);for(let n of this.querySelectorAll(Yy))if(!this.#t.has(n)&&D(n)===e)return n}getItemByKey(e){return this.#L(e)}visibleKeys(){let e=this.renderRoot.querySelector(`ul`);if(!e)return[];let n=e.getBoundingClientRect(),r=[];for(let e of this._getVisibleItems()){let i=D(e);if(i===void 0)continue;let a=e.getBoundingClientRect();a.bottom>n.top&&a.top<n.bottom&&r.push(i)}return r}renderedKeys(){if(!this.#q()){let e=[];for(let n of this._getVisibleItems()){let r=D(n);r!==void 0&&e.push(r)}return e}let e=[];for(let n=this.#s;n<this.#c;n++){let r=this.#a[n];if(!r)continue;let i=D(r);i!==void 0&&e.push(i)}return e}*selectedFilter(e){let n=this.#q()?this.#a:this.querySelectorAll(Yy),r=e=>this.interactionMode===`checked`&&!(this.#e.get(e)??e).hasAttribute(`not-checked`)&&this.selection.selected.has(e);for(let i of n)if(!(!this.#q()&&this.#t.has(i))&&!i.hidden)switch(e){case`selected`:this.selection.selected.has(i)&&(yield i);break;case`checked`:r(i)&&(yield i);break;case`either`:(this.selection.selected.has(i)||r(i))&&(yield i)}}getItemData(e){return this.#n.get(e)}updateItem(e,n){if(this.items===void 0)return;let r=this.getItemByKey(e);if(!r||!this.#n.has(r))return;let i=this.#G(r),a=this.formatter?this.formatter(n,i):n;if(r instanceof HTMLLIElement){for(let e of[...r.childNodes])e.remove();this.#B(r,a,n,i),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates()}else a instanceof Element&&this.#H(a)&&(a.tagName!==`LI`&&!a.hasAttribute(`data-list-item`)&&a.setAttribute(`data-list-item`,``),this.#U(a,n),this.#n.set(a,n),this.#n.delete(r),this.selection.remap(e=>e===r?a:e),this.#q()&&this.#X(r,a),r.replaceWith(a),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates());if(this.keyProperty){let r=this.items.findIndex(n=>this.#W(n,this.keyProperty)!==void 0&&String(this.#W(n,this.keyProperty))===e);if(r>=0){let e=[...this.items];e[r]=n,this.#u=!0,this.items=e}}}#R(){let e=this.items??[],n=e=>e.getAttribute(`data-key`),r=new Set([...this.selection.selected].map(n).filter(e=>e!==null)),i=this.selection.anchor?n(this.selection.anchor):null;if(this.#e.clear(),this.replaceChildren(...e.map((e,n)=>this.#z(e,n))),r.size>0||i!==null){let e=[],a;for(let o of this.querySelectorAll(Yy)){let s=n(o);s!==null&&r.has(s)&&e.push(o),s!==null&&s===i&&(a=o)}this.selection.seed(e,a)}this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates(),this._syncNativeDraggable(),this.#x.refreshDraggable()}#z(e,n){let r=this.formatter?this.formatter(e,n):e;if(r instanceof Element&&this.#H(r))return r.tagName!==`LI`&&!r.hasAttribute(`data-list-item`)&&r.setAttribute(`data-list-item`,``),this.#U(r,e),this.#n.set(r,e),r;let i=document.createElement(`li`);return this.#B(i,r,e,n),i}#B(e,n,r,i){typeof n==`string`?e.textContent=n:n instanceof Node?e.appendChild(n):this.formatter&&n!=null&&o(n,e),this.#V(e,r,i),this.#U(e,r),this.#n.set(e,r)}#V(e,n,r){let i=Hg(this.textColor?.(n,r));i===void 0?e.style.removeProperty(`color`):e.style.color=i;let a=this.icon?.(n,r);if(!Vg(a)){let i=document.createElement(`span`);i.className=`item-icon`,i.style.cssText=`flex:none;display:inline-flex;align-items:center;justify-content:center;overflow:hidden;margin-inline-end:var(--list-item-icon-gap,6px);width:var(--list-item-icon-size,1em);height:var(--list-item-icon-size,1em)`;let s=Hg(this.iconColor?.(n,r));s!==void 0&&(i.style.color=s),a instanceof Node?i.appendChild(a):o(a,i),e.prepend(i)}let s=this.badge?.(n,r);if(!Vg(s)){let n=document.createElement(`span`);n.className=`item-badge`,n.style.cssText=`flex:none;display:inline-flex;align-items:center;margin-inline-start:auto;padding-inline-start:var(--list-item-badge-gap,8px)`,s instanceof Node?n.appendChild(s):o(s,n),e.appendChild(n)}}#H(e){return e.tagName===`LI`||e.hasAttribute(`data-list-item`)||e.tagName.includes(`-`)}#U(e,n){if(!this.keyProperty)return;let r=this.#W(n,this.keyProperty);r!=null&&e.setAttribute(`data-key`,String(r))}#W(e,n){if(!(typeof e!=`object`||!e||!(n in e)))return e[n]}#G(e){if(this.#q())return this.#Y(e);let n=0;for(let r of this.querySelectorAll(Yy)){if(r===e)return n;this.#n.has(r)&&n++}return n}#K(){let e=this.items??[],n=e=>e.getAttribute(`data-key`),r=new Set([...this.selection.selected].map(n).filter(e=>e!==null)),i=this.selection.anchor?n(this.selection.anchor):null;this.#e.clear(),this.#o=document.createDocumentFragment(),this.#l=[],this.#a=e.map((e,n)=>this.#z(e,n));for(let e of this.#a)this.#i.add(e);if(r.size>0||i!==null){let e=[],a;for(let o of this.#a){let s=n(o);s!==null&&r.has(s)&&e.push(o),s!==null&&s===i&&(a=o)}this.selection.seed(e,a)}this.#oe(!0)}#q(){return this.virtualize&&this.itemHeight>0}#J(){return this.#q()?this.#a.filter(e=>!(e.hidden||this.filterPredicate&&!this.filterPredicate(e))):this._getVisibleItems()}#Y(e){let n=this.#a.indexOf(e);if(n>=0)return n;if(this.#t.has(e)){for(let[n,r]of this.#e)if(r===e)return this.#a.indexOf(n)}return-1}#X(e,n){let r=this.#a.indexOf(e);r>=0&&(this.#a[r]=n)}#Z(e){if(this.#e.has(e)){let n=this.#e.get(e);this.#e.delete(e),n&&this.#t.delete(n)}if(this.#t.has(e)){for(let[n,r]of this.#e)if(r===e){this.#e.delete(n);break}this.#t.delete(e)}}#Q(e){let n=0,r=e.previousElementSibling;for(;r;){if(r===this.#h)return this.#s+n;if(r===this.#g)return this.#a.length;r.matches(Yy)&&n++,r=r.previousElementSibling}return n}#$(e){let n=!1,r=[];for(let i of e){for(let e of i.addedNodes){if(!(e instanceof Element)||e.parentNode!==this||e.hasAttribute(`data-virtual-spacer`)||!e.matches(Yy))continue;let i=this.#Y(e);if(i<0){let i=Math.min(this.#Q(e),this.#a.length);this.#a.splice(i,0,e),r.push(e),n=!0}else if(this.#Q(e)!==i){let r=Math.min(this.#Q(e),this.#a.length-1);this.#a.splice(i,1),this.#a.splice(r,0,e),n=!0}}for(let e of i.removedNodes){if(!(e instanceof Element)||e.hasAttribute(`data-virtual-spacer`))continue;let r=this.#Y(e);r<0||e.parentNode!==this.#o&&e.parentNode!==this&&(this.#a.splice(r,1),n=!0)}}if(r.length>0){if(this.#N(r.length))for(let e of r)this.#i.add(e);else this.#l.push(...r)}return n&&this.interactionMode===`checked`&&this._syncCheckboxes(),n&&this.search.refresh(),n}#ee(){let e=this.#r?.takeRecords()??[];return e.length>0&&this.#$(e)}#te(){return this.renderRoot.querySelector(`ul`)}#ne(e){if(!e)return this.#_;let n=e.clientHeight||e.getBoundingClientRect().height||0;return n>0&&(this.#_=n),this.#_}#re(){if(this.#h&&this.#g)return;let e=()=>{let e=document.createElement(`li`);return e.setAttribute(`data-virtual-spacer`,``),e.setAttribute(`aria-hidden`,`true`),e};this.#h=e(),this.#g=e()}#ie(){let e=this.#te();e&&(this.#f??=new ResizeObserver(()=>{this.#oe(),this.#le()}),this.#f.observe(e))}#ae;#oe(e=!1){if(!this.#q()||!this.isConnected)return;let n=this.#ee()||e;this.#ie();let r=this.#a.length,i=this.#te(),a=this.itemHeight,o=this.#ne(i),s=Math.max(0,r*a-o),c=Math.min(Math.max(0,i?i.scrollTop:0),s);i&&Math.abs(i.scrollTop-c)>.5&&(i.scrollTop=c);let l=Math.floor(c/a),u=Math.ceil((c+o)/a),d=r===0?0:Math.max(0,l-3),f=Math.min(r,u+3);if(!n&&d===this.#s&&f===this.#c)return;if(r===0)this.#a.length>0&&this.#o.append(...this.#a),this.replaceChildren();else{this.#re();let e=this.#h,n=this.#g;if(!e||!n)return;e.style.height=`${d*a}px`,n.style.height=`${Math.max(0,(r-f)*a)}px`;let i=this.#a.slice(d,f),o=[...this.#a.slice(0,d),...this.#a.slice(f)];o.length>0&&this.#o.append(...o),this.replaceChildren(e,...i,n)}this.#s=d,this.#c=f,this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates();let p=this.#J().length;for(let e=d;e<f;e++){let n=this.#a[e];n&&this.#se(n,e+1,p)}let m=this.#l;this.#l=[];for(let e of m)this.#i.add(e),e.parentNode===this&&Xn(e);this.search.repaintHighlights()}#se(e,n,r){e instanceof HTMLElement&&(e.draggable=this.itemsDraggable&&this._isCheckable(e)&&!e.hasAttribute(`data-editing`),n!==void 0&&r!==void 0&&(e.setAttribute(`aria-setsize`,String(r)),e.setAttribute(`aria-posinset`,String(n)),(!e.hasAttribute(`role`)||e.hasAttribute(`data-aria-role`))&&(e.setAttribute(`role`,`option`),e.setAttribute(`data-aria-role`,``),e.setAttribute(`aria-selected`,String(this.selection.selected.has(e)))))),e.removeAttribute(`data-marquee`),e.removeAttribute(`data-drag-origin`),e.removeAttribute(`data-drop-target`)}#ce(){for(let e of this.#a)this.#i.add(e);this.#a.length>0?this.replaceChildren(...this.#a):this.replaceChildren(),this.#o=document.createDocumentFragment(),this.#h=void 0,this.#g=void 0,this.#s=0,this.#c=0,this.#l=[],this._syncCheckboxes(),this._syncItemStates(),this._syncNativeDraggable(),this.#x.refreshDraggable(),this.#le()}#le(){this.#d===0&&(this.#d=requestAnimationFrame(()=>{this.#d=0,this.#oe(),this.#ue()}))}#ue(){let e=this.renderedKeys(),n=this.visibleKeys();Xy(this.#p,e)&&Xy(this.#m,n)||(this.#p=e,this.#m=n,this._dispatch(`vertical-list-viewport-change`,{renderedKeys:e,visibleKeys:n}))}_getVisibleItems(){return Array.from(this.querySelectorAll(Yy)).filter(e=>!(this.#t.has(e)||e.hidden||this.filterPredicate&&!this.filterPredicate(e)))}_isCheckable(e){return this.interactionMode!==`checked`||!(this.#e.get(e)??e).hasAttribute(`not-checked`)}_syncItemStates(){for(let e of this.querySelectorAll(Yy)){if(this.#t.has(e))continue;let n=this.#e.get(e)??e;e.toggleAttribute(`data-tickled`,this.tickled.isTickled(e)),e.toggleAttribute(`data-selected`,this.selection.selected.has(e)),e.hasAttribute(`data-aria-role`)&&e.setAttribute(`aria-selected`,String(this.selection.selected.has(e))),this.interactionMode===`checked`?e.toggleAttribute(`data-checked`,!n.hasAttribute(`not-checked`)&&this.selection.selected.has(e)):e.removeAttribute(`data-checked`)}this.dataset.inputMode=this.tickled.inputMode,this._syncCheckboxes()}_syncCheckboxes(){let e=this.interactionMode===`checked`,n=typeof this.checkboxRenderer==`function`,r=this.#q()?[this,this.#o]:[this];if(e)for(let e of r)for(let n of Array.from(e.children)){if(!n.hasAttribute(`data-list-item`)||n.parentNode!==e)continue;let r=document.createElement(`li`);r.className=`ixfx-custom-row`;let i=n.getAttribute(`data-key`),a=n.getAttribute(`data-search-label`);i!==null&&r.setAttribute(`data-key`,i),a!==null&&r.setAttribute(`data-search-label`,a),n.removeAttribute(`data-list-item`),e.insertBefore(r,n),r.appendChild(n),this.#e.set(r,n),this.#t.add(n),this.#n.has(n)&&this.#n.set(r,this.#n.get(n)),this.#q()&&this.#X(n,r)}else{for(let[e,n]of this.#e){if(e.parentNode!==this&&e.parentNode!==this.#o)continue;n.setAttribute(`data-list-item`,``);let r=e.parentNode;r&&r.insertBefore(n,e),e.remove(),this.#n.delete(e),this.#q()&&this.#X(e,n)}this.#e.clear(),this.#t.clear()}for(let r of this.querySelectorAll(`li`)){let i=r.querySelector(`.ixfx-list-checkbox`);if(!e){i&&i.remove();continue}if((this.#e.get(r)??r).hasAttribute(`not-checked`)){i&&i.remove();continue}let a=i?.classList.contains(`ixfx-list-checkbox-custom`)??!1;i&&a!==n&&i.remove();let s=r.querySelector(`.ixfx-list-checkbox`);if(!s){if(n){let e=this.checkboxRenderer,n=e.margin??`0`,i=e.width??`24px`;s=this._createCustomCheckbox(r,n,i)}else s=this._createNativeCheckboxCell(r);r.prepend(s)}let c=this.selection.selected.has(r);if(n){if(s.setAttribute(`aria-checked`,String(c)),s.toggleAttribute(`data-checked`,c),this.checkboxRenderer){let e=typeof this.checkboxRenderer==`function`?this.checkboxRenderer:this.checkboxRenderer.renderer;o(e(c),s)}}else{let e=s.querySelector(`input.ixfx-list-checkbox`);e&&(e.checked=c)}}}_createNativeCheckboxCell(e){let n=document.createElement(`span`);n.className=`ixfx-list-checkbox ixfx-list-checkbox-native`,n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:18px;margin:0 6px 0 0;cursor:pointer;pointer-events:auto`,n.tabIndex=-1,n.setAttribute(`role`,`checkbox`),n.setAttribute(`part`,`checkbox`),n.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)});let r=document.createElement(`input`);return r.type=`checkbox`,r.className=`ixfx-list-checkbox`,r.style.cssText=`pointer-events:none;cursor:pointer;margin:0`,n.appendChild(r),n}_createCustomCheckbox(e,n,r){let i=document.createElement(`span`);return i.className=`ixfx-list-checkbox ixfx-list-checkbox-custom`,i.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:${r};margin:${n};cursor:pointer;pointer-events:auto`,i.tabIndex=-1,i.setAttribute(`role`,`checkbox`),i.setAttribute(`part`,`checkbox`),i.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)}),i}_findListItem(e){for(let n of e)if(n instanceof Element){if(n===this)break;if(n.parentElement===this&&n.matches(Yy))return n}}_dispatch(e,n){this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0}))}_dispatchCancelable(e,n){return this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}_activateItem(e){this.interactionMode!==`manual`&&this.selection.replace(e),this._dispatch(`list-activate`,{item:e})}activateKey(e){let n=this.#L(e);n&&this._activateItem(n)}#de;#fe(){let e=this.#de;this.#de=void 0,this.#me(void 0,!1),e&&this._dispatch(`list-drag-leave`,{key:e.item?D(e.item):void 0})}#pe;#me(e,n){this.#pe?.removeAttribute(`data-drop-target`),this.#pe=n?e:void 0,this.toggleAttribute(`data-drop-target`,n&&e===void 0),n&&e&&e.setAttribute(`data-drop-target`,``)}#he(e,n,r){return!this.selection.selected.has(e)&&this.interactionMode!==`manual`&&this._isCheckable(e)&&this.selection.replace(e),this._dispatchCancelable(`list-context-menu`,{key:D(e),item:e,x:n,y:r,selectedKeys:this.selection.selectedKeys})}#ge;get editingKey(){return this.#ge?.key}#_e(e){return this.#ge!==void 0&&e.composedPath().includes(this.#ge.label)}beginEdit(e){this.#ve();let n=this.editValidator;if(!n)return!1;let r=this.#L(e);if(!(r instanceof HTMLElement)||r.parentNode!==this)return!1;let i=r.querySelector(`[data-edit-label]`)??r,a=i.getAttribute(`data-edit-value`)??i.textContent?.trim()??``,o=document.createElement(`ixfx-editable-label`);o.mode=`label`,o.value=a,o.validator=r=>n(r,e),o.style.cssText=`flex:1;min-width:0;--label-align:left;--label-padding:0 var(--space-xs,3px)`;let s={key:e,row:r,container:i,saved:[...i.childNodes],label:o,committed:void 0,refocus:!1};this.#ge=s,o.addEventListener(`change`,e=>{e.stopPropagation(),s.committed=e.detail.value}),o.addEventListener(`input`,e=>e.stopPropagation()),o.addEventListener(`keydown`,e=>{s.refocus=e.key===`Enter`||e.key===`Escape`});for(let e of[`pointerdown`,`dragstart`])o.addEventListener(e,e=>e.stopPropagation());return o.addEventListener(`focusout`,()=>this.#ve()),i.replaceChildren(o),r.setAttribute(`data-editing`,``),r.draggable=!1,r.scrollIntoView({block:`nearest`,inline:`nearest`}),o.updateComplete.then(()=>{this.#ge===s&&o.shadowRoot?.querySelector(`.content`)?.click()}),!0}#ve(){let e=this.#ge;e&&(this.#ge=void 0,e.container.isConnected&&e.container.replaceChildren(...e.saved),e.row.removeAttribute(`data-editing`),this.#se(e.row),e.refocus&&this.focus(),e.committed===void 0?this._dispatch(`list-edit-cancel`,{key:e.key}):this._dispatch(`list-edit-commit`,{key:e.key,value:e.committed}))}static{this.styles=[w,Ng(`y`),Ht,r`
|
|
6933
|
+
`]}};E([d({type:Number})],Jy.prototype,`min`,void 0),E([d({type:Number})],Jy.prototype,`max`,void 0),E([d({type:Number})],Jy.prototype,`step`,void 0),E([d({type:Number})],Jy.prototype,`stops`,void 0),E([d({type:Number,attribute:`drag-sensitivity`})],Jy.prototype,`dragSensitivity`,void 0),E([d({attribute:`fill-style`})],Jy.prototype,`fillStyle`,void 0),E([d({attribute:`linear-style`})],Jy.prototype,`linearStyle`,void 0),E([d({attribute:`circular-style`})],Jy.prototype,`circularStyle`,void 0),E([d({type:Boolean,attribute:`no-drag`})],Jy.prototype,`noDrag`,void 0),E([d({type:Number})],Jy.prototype,`precision`,void 0),Jy=E([T(`ixfx-editable-number`)],Jy);const Yy=`li:not([data-virtual-spacer]), [data-list-item]:not([data-virtual-spacer])`;function Xy(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}let W=class extends n{constructor(...e){super(...e),this.selectionMode=`single`,this.interactionMode=`standard`,this.itemWrap=`stop`,this.itemsDraggable=!1,this.keyProperty=``,this.virtualize=!1,this.itemHeight=0,this.itemsDroppable=!1,this.#e=new Map,this.#t=new Set,this.#n=new WeakMap,this.#i=new WeakSet,this.#a=[],this.#o=document.createDocumentFragment(),this.#s=0,this.#c=0,this.#l=[],this.#u=!1,this.#d=0,this.#_=0,this.#v=!1,this.selection=new tr({getOrderedItems:()=>this.#J(),isSelectable:e=>this._isCheckable(e),getModes:()=>({selectionMode:this.selectionMode,interactionMode:this.interactionMode}),getKey:D,onChange:(e,n)=>{this._syncItemStates(),this._dispatch(`list-select`,{selected:e,previous:n,selectedKeys:this.selection.selectedKeys})}}),this.tickled=(e=>new oe(e,{getItems:()=>e.#J().map(e=>({id:e,enabled:!e.hasAttribute(`not-checked`)})),onTickle:e=>{e!==void 0&&this._dispatch(`list-tickle`,{item:e})},onStateChange:()=>this._syncItemStates(),get itemWrap(){return e.itemWrap},hoverDisabled:()=>this.#T.isDragging||this.#x.isDragging}))(this),this.#y=!1,this.#b=0,this.#x=new $n(this,{source:`vertical-list`,isEnabled:()=>this.itemsDraggable&&this.selectionMode!==`none`&&this._getVisibleItems().length>0,resolveEventToKey:e=>{if(!(e instanceof Element))return;let n=e.closest?.(Yy);if(!(!n||!this.contains(n)||this.#t.has(n)))return D(n)},prepareSelection:e=>this.#S(e),getMetrics:()=>({}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>this._dispatchCancelable(`list-native-drag-start`,e),onActiveChange:(e,n)=>{this.#y=e,this.toggleAttribute(`data-native-dragging`,e);for(let r of this._getVisibleItems())r.toggleAttribute(`data-drag-origin`,e&&n!==void 0&&D(r)===n);if(e){let e=this.selection.selected.size;this.setAttribute(`aria-label`,e<=1?`Dragging 1 item`:`Dragging ${e} items`)}else this.removeAttribute(`aria-label`);this.requestUpdate()},onEnd:()=>{this.#y=!1,this.toggleAttribute(`data-native-dragging`,!1),this.removeAttribute(`aria-label`);for(let e of this._getVisibleItems())e.removeAttribute(`data-drag-origin`);if(this.#q())for(let e of this.#a)e.removeAttribute(`data-drag-origin`);this.#C()},syncLightDomDraggable:()=>this._syncNativeDraggable()}),this.#T=new Vn(this,{getSurface:()=>this.renderRoot.querySelector(`.container`),isEnabled:()=>!this.#q()&&this.selection.canDragSelect()&&this._getVisibleItems().length>0&&!this.hasAttribute(`disable-drag-select`),hitTest:e=>this.#E(e),getBaseSelection:()=>this.selection.selected,onPreview:(e,n)=>{this.#w=n;for(let n of this._getVisibleItems())n.toggleAttribute(`data-marquee`,e.has(n));this.requestUpdate()},onCommit:e=>{this.selection.applyDragSelection(e);for(let e of this._getVisibleItems())e.removeAttribute(`data-marquee`);this.#w=void 0,this.requestUpdate()},autoScroll:(e,n)=>{let r=this.renderRoot.querySelector(`ul`);r&&(r.scrollTop+=n)}}),this.search=new Bt(this,{adapter:Mt(this,{itemSelector:Yy,getLabel:e=>e.getAttribute(`data-search-label`)??e.textContent?.trim()??``,highlightKey:`vertical-list-search`,getAllItems:()=>this.#J(),observeContainer:!1})}),this.#ae=()=>{this.#d===0&&(this.#d=requestAnimationFrame(()=>{this.#d=0,this.#oe(),this.#ue()}))},this._onPointerOver=e=>{let n=this._findListItem(e.composedPath());n&&this.tickled.handlePointerEnter(n)},this._onPointerLeave=e=>{this.tickled.handlePointerLeave(e)},this._onKeyDown=e=>{if(!(this.search.isOpen||this.#_e(e))){if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){let n=this.tickled.tickledId;if(n){e.preventDefault();let r=n.getBoundingClientRect();this.#he(n,r.left,r.bottom)}return}if((e.ctrlKey||e.metaKey)&&e.key===`a`){this.selection.canSelectAll()&&(e.preventDefault(),this.selection.selectAll());return}switch(e.key){case`ArrowDown`:if(e.preventDefault(),this.tickled.handleKeyboardNavigation(`next`),this.#P(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`ArrowUp`:if(e.preventDefault(),this.tickled.handleKeyboardNavigation(`previous`),this.#P(),e.shiftKey&&this.interactionMode===`vscode`){let e=this.tickled.tickledId;e&&this.selection.rangeTo(e)}break;case`Home`:e.preventDefault(),this.tickled.handleKeyboardNavigation(`first`),this.#P();break;case`End`:e.preventDefault(),this.tickled.handleKeyboardNavigation(`last`),this.#P();break;case`PageDown`:e.preventDefault(),this.#I(1);break;case`PageUp`:e.preventDefault(),this.#I(-1);break;case`Enter`:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this._dispatch(`list-item-click`,{item:n}),this._activateItem(n));break}case` `:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.selection.handleSpace(n));break}case`Escape`:this.selection.clear()}}},this._onClick=e=>{if(this.#_e(e)||this.#T.isDragging||this.#x.isDragging||this.#b!==0)return;let n=this._findListItem(e.composedPath());n&&(this._dispatch(`list-item-click`,{item:n}),this.selection.handleClick(n,e))},this._onDblClick=e=>{if(this.#_e(e))return;let n=this._findListItem(e.composedPath());n&&this._activateItem(n)},this._onDragOver=e=>{let n=e.dataTransfer;if(!this.itemsDroppable||!n||this.#_e(e))return;let r=this._findListItem(e.composedPath());if(this.canDrop&&!this.canDrop(r,n)){this.#fe();return}if(this.#de&&this.#de.item!==r&&this.#fe(),this.#de={item:r},this._dispatchCancelable(`list-drag-over`,{key:r?D(r):void 0,item:r,dataTransfer:n})){this.#me(void 0,!1);return}e.preventDefault(),n.dropEffect===`none`&&(n.dropEffect=`copy`),this.#me(r,!0)},this._onDragLeave=e=>{let n=e.relatedTarget;n instanceof Node&&this.contains(n)||this.#fe()},this._onDrop=e=>{let n=e.dataTransfer;if(!this.itemsDroppable||!n||this.#_e(e))return;let r=this._findListItem(e.composedPath());if(this.canDrop&&!this.canDrop(r,n)){this.#fe();return}e.preventDefault(),this.#de=void 0,this.#me(void 0,!1),this._dispatch(`list-drop`,{key:r?D(r):void 0,item:r,dataTransfer:n})},this._onContextMenu=e=>{if(this.#_e(e))return;let n=this._findListItem(e.composedPath());n&&(this.#he(n,e.clientX,e.clientY)||e.preventDefault())}}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S(e){let n=this.#L(e);if(!n||!this._isCheckable(n))return;this.selection.selected.has(n)||this.selection.replace(n);let r=this.#J(),i=[];r.forEach(n=>{if(!this.selection.selected.has(n))return;let r=this.#Y(n);i.push({key:D(n)??e,index:r,item:n,element:n})});let a=i.find(n=>n.key===e);if(a)return{origin:a,selected:i}}_syncNativeDraggable(){if(this.isConnected)for(let e of this.querySelectorAll(Yy))this.#t.has(e)||e instanceof HTMLElement&&(e.draggable=this.itemsDraggable&&this._isCheckable(e))}#C(){this.#b&&clearTimeout(this.#b),this.#b=window.setTimeout(()=>{this.#b=0},0)}#w;#T;#E(e){let n=this.renderRoot.querySelector(`.container`);if(!n)return[];let r=n.getBoundingClientRect(),i=e.x,a=e.y,o=e.x+e.width,s=e.y+e.height,c=[];for(let e of this._getVisibleItems()){let n=e.getBoundingClientRect(),l=n.left-r.left,u=n.top-r.top;l<=o&&l+n.width>=i&&u<=s&&u+n.height>=a&&c.push(e)}return c}#D(e){return`left:${e.x}px;top:${e.y}px;width:${Math.max(0,e.width)}px;height:${Math.max(0,e.height)}px`}#O;#k;get registry(){return this.#O}#A(){let e=this.searchModes?.trim(),n;if(e===void 0)n=[...O];else{let r=new Set(e.split(/\s+/));n=O.filter(e=>r.has(e))}return this.#q()?n.filter(e=>e!==`filter`):n}#j(){this.#O&&(this.search.setModes(this.#A()),this.#k?.(),this.#k=Rt(this.#O,this.search))}connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.addEventListener(`pointerover`,this._onPointerOver),this.addEventListener(`pointerleave`,this._onPointerLeave),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`dragover`,this._onDragOver),this.addEventListener(`dragleave`,this._onDragLeave),this.addEventListener(`drop`,this._onDrop),this.addEventListener(`contextmenu`,this._onContextMenu);for(let e of this.querySelectorAll(Yy))this.#i.add(e);this.#r??=new MutationObserver(e=>this.#M(e)),this.#r.observe(this,{childList:!0}),this.#O??=Jt(),this.#j(),this.#ie()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerover`,this._onPointerOver),this.removeEventListener(`pointerleave`,this._onPointerLeave),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`dragover`,this._onDragOver),this.removeEventListener(`dragleave`,this._onDragLeave),this.removeEventListener(`drop`,this._onDrop),this.removeEventListener(`contextmenu`,this._onContextMenu),this.#fe(),this.#ge=void 0,this.#r?.disconnect(),this.#f?.disconnect(),this.#f=void 0,this.#d!==0&&(cancelAnimationFrame(this.#d),this.#d=0),this.#k?.(),this.#k=void 0,this.#O=void 0,this.#b&&=(clearTimeout(this.#b),0)}firstUpdated(){this.#ie()}#M(e){if(!this.isConnected)return;if(this.#q()){this.#oe(this.#$(e)),this.#le();return}let n=[];for(let r of e)for(let e of r.addedNodes)!(e instanceof HTMLElement)||e.parentElement!==this||e.matches(Yy)&&(this.#i.has(e)||this.#e.has(e)||this.#t.has(e)||(this.#i.add(e),n.push(e)));if(this.#le(),n.length!==0&&!this.#N(n.length))for(let e of n)Yn(e)}#N(e){return e>=this.querySelectorAll(Yy).length}updated(e){if(super.updated(e),e.has(`searchModes`)&&this.#j(),e.has(`virtualize`)||e.has(`itemHeight`)){let n=(e.has(`virtualize`)?e.get(`virtualize`):this.virtualize)===!0&&((e.has(`itemHeight`)?e.get(`itemHeight`):this.itemHeight)??0)>0;if(this.#q()){if(!n){this.#o=document.createDocumentFragment(),this.#a=[...this.querySelectorAll(Yy)];for(let e of this.#a)this.#i.add(e);this.#l=[]}this.#oe(!0)}else n?this.#ce():this.virtualize&&!this.#v&&(this.#v=!0,console.warn(`ixfx-vertical-list: virtualize needs item-height > 0 — running non-virtualized.`));this.#j()}if((e.has(`items`)||e.has(`formatter`)||e.has(`keyProperty`)||e.has(`icon`)||e.has(`iconColor`)||e.has(`textColor`)||e.has(`badge`))&&this.items!==void 0&&(this.#u?this.#u=!1:this.#q()?this.#K():this.#R()),e.has(`interactionMode`)){this.selection.clearAnchor();let n=this.selection.selected,r=e.get(`interactionMode`)===`checked`?new Map(this.#e):null;if(this._syncCheckboxes(),n.size>0){if(r&&r.size>0)this.selection.remap(e=>r.get(e)??e);else if(this.#e.size>0){let e=new Map([...this.#e].map(([e,n])=>[n,e]));this.selection.remap(n=>e.get(n)??n)}}this._syncItemStates()}else e.has(`checkboxRenderer`)&&this.interactionMode===`checked`&&this._syncCheckboxes();(e.has(`itemsDraggable`)||e.has(`interactionMode`))&&(this._syncNativeDraggable(),this.#x.refreshDraggable())}get selectedItem(){return[...this.selection.selected].at(-1)}get selectedItems(){return this.selection.selected}addItem(e,n){let r;if(typeof e==`string`){let n=document.createElement(`li`);n.textContent=e,r=n}else r=e;if(n?.notChecked&&r.setAttribute(`not-checked`,``),this.appendChild(r),this.#q()){this.#oe(!0);return}this.interactionMode===`checked`&&this._syncCheckboxes(),this.search.refresh()}removeItem(e){return this.selection.deselect(e),this.#q()?(e.parentNode===this?Qn(e):Object.assign(Promise.resolve(),{animation:void 0})).then(()=>{let n=this.#Y(e);n>=0&&this.#a.splice(n,1),this.#Z(e),e.remove(),this.interactionMode===`checked`&&this._syncCheckboxes(),this.#oe(!0)}):Qn(e).then(()=>{e.remove(),this.interactionMode===`checked`&&this._syncCheckboxes()})}removeItems(e){return Promise.all([...e].map(e=>this.removeItem(e))).then(()=>void 0)}clearItems(){this.#e.clear(),this.#q()&&(this.#a=[],this.#o=document.createDocumentFragment(),this.#l=[]),this.replaceChildren(),this.selection.reset(),this._syncItemStates(),this.search.refresh(),this.#q()&&this.#oe(!0)}setItems(e){if(this.#q()){this.#e.clear(),this.#o=document.createDocumentFragment(),this.#l=[],this.#a=[...e];for(let e of this.#a)this.#i.add(e);this.selection.reset(),this.search.refresh(),this.#oe(!0);return}for(let n of e)this.appendChild(n);this.interactionMode===`checked`&&this._syncCheckboxes(),this.search.refresh()}dispatch(e,n){this.#O?.invoke(e,n)}select(e){this.selection.replace(e)}selectMany(e){this.selection.selectMany(e)}deselect(e){this.selection.deselect(e)}clearSelection(){this.selection.clear()}selectAll(){this.selection.canSelectAll()&&this.selection.selectAll()}get selectedKeys(){return this.selection.selectedKeys}get tickledKey(){let e=this.tickled.tickledId;return e?D(e):void 0}selectKeys(e){this.selection.selectKeys(e,e=>this.#L(e))}addSelectedKeys(e){this.selection.addKeys(e,e=>this.#L(e))}removeSelectedKeys(e){this.selection.removeKeys(e,e=>this.#L(e))}focusKey(e){if(this.#q()){let n=this.#a.findIndex(n=>D(n)===e);if(n<0)return;let r=this.renderRoot.querySelector(`ul`);if(r){let e=this.itemHeight,i=r.clientHeight,a=n*e,o=(n+1)*e,s=r.scrollTop,c=i,l=s;a<s?l=a:o>s+c&&(l=o-c),l!==s&&(r.scrollTop=l),this.#oe(!0)}}let n=this.#L(e);!n||n.parentNode!==this||(this.tickled.focus(n),n.scrollIntoView({block:`nearest`,inline:`nearest`}))}#P(){let e=this.tickled.tickledId,n=e?D(e):void 0;n!==void 0&&this.focusKey(n)}#F(){let e=this.#te();if(!e)return 1;let n=e.clientHeight;if(this.#q())return Math.max(1,Math.floor(n/this.itemHeight));let r=this.querySelector(`li[data-key]`);if(!r)return 1;let i=r.offsetHeight||this.itemHeight;return Math.max(1,Math.floor(n/i))}#I(e){let n=this.#F(),r=this.#J().filter(e=>!e.hasAttribute(`not-checked`));if(r.length===0)return;let i=this.tickled.tickledId?D(this.tickled.tickledId):void 0,a=i===void 0?-1:r.findIndex(e=>D(e)===i),o=e===1?n-1:0,s=a<0?o:a+e*n;this.tickled.handleKeyboardNavigation(r[Math.min(r.length-1,Math.max(0,s))]),this.#P()}#L(e){if(this.#q())return this.#a.find(n=>D(n)===e);for(let n of this.querySelectorAll(Yy))if(!this.#t.has(n)&&D(n)===e)return n}getItemByKey(e){return this.#L(e)}visibleKeys(){let e=this.renderRoot.querySelector(`ul`);if(!e)return[];let n=e.getBoundingClientRect(),r=[];for(let e of this._getVisibleItems()){let i=D(e);if(i===void 0)continue;let a=e.getBoundingClientRect();a.bottom>n.top&&a.top<n.bottom&&r.push(i)}return r}renderedKeys(){if(!this.#q()){let e=[];for(let n of this._getVisibleItems()){let r=D(n);r!==void 0&&e.push(r)}return e}let e=[];for(let n=this.#s;n<this.#c;n++){let r=this.#a[n];if(!r)continue;let i=D(r);i!==void 0&&e.push(i)}return e}*selectedFilter(e){let n=this.#q()?this.#a:this.querySelectorAll(Yy),r=e=>this.interactionMode===`checked`&&!(this.#e.get(e)??e).hasAttribute(`not-checked`)&&this.selection.selected.has(e);for(let i of n)if(!(!this.#q()&&this.#t.has(i))&&!i.hidden)switch(e){case`selected`:this.selection.selected.has(i)&&(yield i);break;case`checked`:r(i)&&(yield i);break;case`either`:(this.selection.selected.has(i)||r(i))&&(yield i)}}getItemData(e){return this.#n.get(e)}updateItem(e,n){if(this.items===void 0)return;let r=this.getItemByKey(e);if(!r||!this.#n.has(r))return;let i=this.#G(r),a=this.formatter?this.formatter(n,i):n;if(r instanceof HTMLLIElement){for(let e of[...r.childNodes])e.remove();this.#B(r,a,n,i),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates()}else a instanceof Element&&this.#H(a)&&(a.tagName!==`LI`&&!a.hasAttribute(`data-list-item`)&&a.setAttribute(`data-list-item`,``),this.#U(a,n),this.#n.set(a,n),this.#n.delete(r),this.selection.remap(e=>e===r?a:e),this.#q()&&this.#X(r,a),r.replaceWith(a),this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates());if(this.keyProperty){let r=this.items.findIndex(n=>this.#W(n,this.keyProperty)!==void 0&&String(this.#W(n,this.keyProperty))===e);if(r>=0){let e=[...this.items];e[r]=n,this.#u=!0,this.items=e}}}#R(){let e=this.items??[],n=e=>e.getAttribute(`data-key`),r=new Set([...this.selection.selected].map(n).filter(e=>e!==null)),i=this.selection.anchor?n(this.selection.anchor):null;if(this.#e.clear(),this.replaceChildren(...e.map((e,n)=>this.#z(e,n))),r.size>0||i!==null){let e=[],a;for(let o of this.querySelectorAll(Yy)){let s=n(o);s!==null&&r.has(s)&&e.push(o),s!==null&&s===i&&(a=o)}this.selection.seed(e,a)}this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates(),this._syncNativeDraggable(),this.#x.refreshDraggable()}#z(e,n){let r=this.formatter?this.formatter(e,n):e;if(r instanceof Element&&this.#H(r))return r.tagName!==`LI`&&!r.hasAttribute(`data-list-item`)&&r.setAttribute(`data-list-item`,``),this.#U(r,e),this.#n.set(r,e),r;let i=document.createElement(`li`);return this.#B(i,r,e,n),i}#B(e,n,r,i){typeof n==`string`?e.textContent=n:n instanceof Node?e.appendChild(n):this.formatter&&n!=null&&o(n,e),this.#V(e,r,i),this.#U(e,r),this.#n.set(e,r)}#V(e,n,r){let i=Hg(this.textColor?.(n,r));i===void 0?e.style.removeProperty(`color`):e.style.color=i;let a=this.icon?.(n,r);if(!Vg(a)){let i=document.createElement(`span`);i.className=`item-icon`,i.style.cssText=`flex:none;display:inline-flex;align-items:center;justify-content:center;overflow:hidden;margin-inline-end:var(--list-item-icon-gap,6px);width:var(--list-item-icon-size,1em);height:var(--list-item-icon-size,1em)`;let s=Hg(this.iconColor?.(n,r));s!==void 0&&(i.style.color=s),a instanceof Node?i.appendChild(a):o(a,i),e.prepend(i)}let s=this.badge?.(n,r);if(!Vg(s)){let n=document.createElement(`span`);n.className=`item-badge`,n.style.cssText=`flex:none;display:inline-flex;align-items:center;margin-inline-start:auto;padding-inline-start:var(--list-item-badge-gap,8px)`,s instanceof Node?n.appendChild(s):o(s,n),e.appendChild(n)}}#H(e){return e.tagName===`LI`||e.hasAttribute(`data-list-item`)||e.tagName.includes(`-`)}#U(e,n){if(!this.keyProperty)return;let r=this.#W(n,this.keyProperty);r!=null&&e.setAttribute(`data-key`,String(r))}#W(e,n){if(!(typeof e!=`object`||!e||!(n in e)))return e[n]}#G(e){if(this.#q())return this.#Y(e);let n=0;for(let r of this.querySelectorAll(Yy)){if(r===e)return n;this.#n.has(r)&&n++}return n}#K(){let e=this.items??[],n=e=>e.getAttribute(`data-key`),r=new Set([...this.selection.selected].map(n).filter(e=>e!==null)),i=this.selection.anchor?n(this.selection.anchor):null;this.#e.clear(),this.#o=document.createDocumentFragment(),this.#l=[],this.#a=e.map((e,n)=>this.#z(e,n));for(let e of this.#a)this.#i.add(e);if(r.size>0||i!==null){let e=[],a;for(let o of this.#a){let s=n(o);s!==null&&r.has(s)&&e.push(o),s!==null&&s===i&&(a=o)}this.selection.seed(e,a)}this.#oe(!0)}#q(){return this.virtualize&&this.itemHeight>0}#J(){return this.#q()?this.#a.filter(e=>!(e.hidden||this.filterPredicate&&!this.filterPredicate(e))):this._getVisibleItems()}#Y(e){let n=this.#a.indexOf(e);if(n>=0)return n;if(this.#t.has(e)){for(let[n,r]of this.#e)if(r===e)return this.#a.indexOf(n)}return-1}#X(e,n){let r=this.#a.indexOf(e);r>=0&&(this.#a[r]=n)}#Z(e){if(this.#e.has(e)){let n=this.#e.get(e);this.#e.delete(e),n&&this.#t.delete(n)}if(this.#t.has(e)){for(let[n,r]of this.#e)if(r===e){this.#e.delete(n);break}this.#t.delete(e)}}#Q(e){let n=0,r=e.previousElementSibling;for(;r;){if(r===this.#h)return this.#s+n;if(r===this.#g)return this.#a.length;r.matches(Yy)&&n++,r=r.previousElementSibling}return n}#$(e){let n=!1,r=[];for(let i of e){for(let e of i.addedNodes){if(!(e instanceof Element)||e.parentNode!==this||e.hasAttribute(`data-virtual-spacer`)||!e.matches(Yy))continue;let i=this.#Y(e);if(i<0){let i=Math.min(this.#Q(e),this.#a.length);this.#a.splice(i,0,e),r.push(e),n=!0}else if(this.#Q(e)!==i){let r=Math.min(this.#Q(e),this.#a.length-1);this.#a.splice(i,1),this.#a.splice(r,0,e),n=!0}}for(let e of i.removedNodes){if(!(e instanceof Element)||e.hasAttribute(`data-virtual-spacer`))continue;let r=this.#Y(e);r<0||e.parentNode!==this.#o&&e.parentNode!==this&&(this.#a.splice(r,1),n=!0)}}if(r.length>0){if(this.#N(r.length))for(let e of r)this.#i.add(e);else this.#l.push(...r)}return n&&this.interactionMode===`checked`&&this._syncCheckboxes(),n&&this.search.refresh(),n}#ee(){let e=this.#r?.takeRecords()??[];return e.length>0&&this.#$(e)}#te(){return this.renderRoot.querySelector(`ul`)}#ne(e){if(!e)return this.#_;let n=e.clientHeight||e.getBoundingClientRect().height||0;return n>0&&(this.#_=n),this.#_}#re(){if(this.#h&&this.#g)return;let e=()=>{let e=document.createElement(`li`);return e.setAttribute(`data-virtual-spacer`,``),e.setAttribute(`aria-hidden`,`true`),e};this.#h=e(),this.#g=e()}#ie(){let e=this.#te();e&&(this.#f??=new ResizeObserver(()=>{this.#oe(),this.#le()}),this.#f.observe(e))}#ae;#oe(e=!1){if(!this.#q()||!this.isConnected)return;let n=this.#ee()||e;this.#ie();let r=this.#a.length,i=this.#te(),a=this.itemHeight,o=this.#ne(i),s=Math.max(0,r*a-o),c=Math.min(Math.max(0,i?i.scrollTop:0),s);i&&Math.abs(i.scrollTop-c)>.5&&(i.scrollTop=c);let l=Math.floor(c/a),u=Math.ceil((c+o)/a),d=r===0?0:Math.max(0,l-3),f=Math.min(r,u+3);if(!n&&d===this.#s&&f===this.#c)return;if(r===0)this.#a.length>0&&this.#o.append(...this.#a),this.replaceChildren();else{this.#re();let e=this.#h,n=this.#g;if(!e||!n)return;e.style.height=`${d*a}px`,n.style.height=`${Math.max(0,(r-f)*a)}px`;let i=this.#a.slice(d,f),o=[...this.#a.slice(0,d),...this.#a.slice(f)];o.length>0&&this.#o.append(...o),this.replaceChildren(e,...i,n)}this.#s=d,this.#c=f,this.interactionMode===`checked`&&this._syncCheckboxes(),this._syncItemStates();let p=this.#J().length;for(let e=d;e<f;e++){let n=this.#a[e];n&&this.#se(n,e+1,p)}let m=this.#l;this.#l=[];for(let e of m)this.#i.add(e),e.parentNode===this&&Yn(e);this.search.repaintHighlights()}#se(e,n,r){e instanceof HTMLElement&&(e.draggable=this.itemsDraggable&&this._isCheckable(e)&&!e.hasAttribute(`data-editing`),n!==void 0&&r!==void 0&&(e.setAttribute(`aria-setsize`,String(r)),e.setAttribute(`aria-posinset`,String(n)),(!e.hasAttribute(`role`)||e.hasAttribute(`data-aria-role`))&&(e.setAttribute(`role`,`option`),e.setAttribute(`data-aria-role`,``),e.setAttribute(`aria-selected`,String(this.selection.selected.has(e)))))),e.removeAttribute(`data-marquee`),e.removeAttribute(`data-drag-origin`),e.removeAttribute(`data-drop-target`)}#ce(){for(let e of this.#a)this.#i.add(e);this.#a.length>0?this.replaceChildren(...this.#a):this.replaceChildren(),this.#o=document.createDocumentFragment(),this.#h=void 0,this.#g=void 0,this.#s=0,this.#c=0,this.#l=[],this._syncCheckboxes(),this._syncItemStates(),this._syncNativeDraggable(),this.#x.refreshDraggable(),this.#le()}#le(){this.#d===0&&(this.#d=requestAnimationFrame(()=>{this.#d=0,this.#oe(),this.#ue()}))}#ue(){let e=this.renderedKeys(),n=this.visibleKeys();Xy(this.#p,e)&&Xy(this.#m,n)||(this.#p=e,this.#m=n,this._dispatch(`vertical-list-viewport-change`,{renderedKeys:e,visibleKeys:n}))}_getVisibleItems(){return Array.from(this.querySelectorAll(Yy)).filter(e=>!(this.#t.has(e)||e.hidden||this.filterPredicate&&!this.filterPredicate(e)))}_isCheckable(e){return this.interactionMode!==`checked`||!(this.#e.get(e)??e).hasAttribute(`not-checked`)}_syncItemStates(){for(let e of this.querySelectorAll(Yy)){if(this.#t.has(e))continue;let n=this.#e.get(e)??e;e.toggleAttribute(`data-tickled`,this.tickled.isTickled(e)),e.toggleAttribute(`data-selected`,this.selection.selected.has(e)),e.hasAttribute(`data-aria-role`)&&e.setAttribute(`aria-selected`,String(this.selection.selected.has(e))),this.interactionMode===`checked`?e.toggleAttribute(`data-checked`,!n.hasAttribute(`not-checked`)&&this.selection.selected.has(e)):e.removeAttribute(`data-checked`)}this.dataset.inputMode=this.tickled.inputMode,this._syncCheckboxes()}_syncCheckboxes(){let e=this.interactionMode===`checked`,n=typeof this.checkboxRenderer==`function`,r=this.#q()?[this,this.#o]:[this];if(e)for(let e of r)for(let n of Array.from(e.children)){if(!n.hasAttribute(`data-list-item`)||n.parentNode!==e)continue;let r=document.createElement(`li`);r.className=`ixfx-custom-row`;let i=n.getAttribute(`data-key`),a=n.getAttribute(`data-search-label`);i!==null&&r.setAttribute(`data-key`,i),a!==null&&r.setAttribute(`data-search-label`,a),n.removeAttribute(`data-list-item`),e.insertBefore(r,n),r.appendChild(n),this.#e.set(r,n),this.#t.add(n),this.#n.has(n)&&this.#n.set(r,this.#n.get(n)),this.#q()&&this.#X(n,r)}else{for(let[e,n]of this.#e){if(e.parentNode!==this&&e.parentNode!==this.#o)continue;n.setAttribute(`data-list-item`,``);let r=e.parentNode;r&&r.insertBefore(n,e),e.remove(),this.#n.delete(e),this.#q()&&this.#X(e,n)}this.#e.clear(),this.#t.clear()}for(let r of this.querySelectorAll(`li`)){let i=r.querySelector(`.ixfx-list-checkbox`);if(!e){i&&i.remove();continue}if((this.#e.get(r)??r).hasAttribute(`not-checked`)){i&&i.remove();continue}let a=i?.classList.contains(`ixfx-list-checkbox-custom`)??!1;i&&a!==n&&i.remove();let s=r.querySelector(`.ixfx-list-checkbox`);if(!s){if(n){let e=this.checkboxRenderer,n=e.margin??`0`,i=e.width??`24px`;s=this._createCustomCheckbox(r,n,i)}else s=this._createNativeCheckboxCell(r);r.prepend(s)}let c=this.selection.selected.has(r);if(n){if(s.setAttribute(`aria-checked`,String(c)),s.toggleAttribute(`data-checked`,c),this.checkboxRenderer){let e=typeof this.checkboxRenderer==`function`?this.checkboxRenderer:this.checkboxRenderer.renderer;o(e(c),s)}}else{let e=s.querySelector(`input.ixfx-list-checkbox`);e&&(e.checked=c)}}}_createNativeCheckboxCell(e){let n=document.createElement(`span`);n.className=`ixfx-list-checkbox ixfx-list-checkbox-native`,n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:18px;margin:0 6px 0 0;cursor:pointer;pointer-events:auto`,n.tabIndex=-1,n.setAttribute(`role`,`checkbox`),n.setAttribute(`part`,`checkbox`),n.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)});let r=document.createElement(`input`);return r.type=`checkbox`,r.className=`ixfx-list-checkbox`,r.style.cssText=`pointer-events:none;cursor:pointer;margin:0`,n.appendChild(r),n}_createCustomCheckbox(e,n,r){let i=document.createElement(`span`);return i.className=`ixfx-list-checkbox ixfx-list-checkbox-custom`,i.style.cssText=`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:${r};margin:${n};cursor:pointer;pointer-events:auto`,i.tabIndex=-1,i.setAttribute(`role`,`checkbox`),i.setAttribute(`part`,`checkbox`),i.addEventListener(`click`,n=>{n.stopPropagation(),this.selection.toggle(e)}),i}_findListItem(e){for(let n of e)if(n instanceof Element){if(n===this)break;if(n.parentElement===this&&n.matches(Yy))return n}}_dispatch(e,n){this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0}))}_dispatchCancelable(e,n){return this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}_activateItem(e){this.interactionMode!==`manual`&&this.selection.replace(e),this._dispatch(`list-activate`,{item:e})}activateKey(e){let n=this.#L(e);n&&this._activateItem(n)}#de;#fe(){let e=this.#de;this.#de=void 0,this.#me(void 0,!1),e&&this._dispatch(`list-drag-leave`,{key:e.item?D(e.item):void 0})}#pe;#me(e,n){this.#pe?.removeAttribute(`data-drop-target`),this.#pe=n?e:void 0,this.toggleAttribute(`data-drop-target`,n&&e===void 0),n&&e&&e.setAttribute(`data-drop-target`,``)}#he(e,n,r){return!this.selection.selected.has(e)&&this.interactionMode!==`manual`&&this._isCheckable(e)&&this.selection.replace(e),this._dispatchCancelable(`list-context-menu`,{key:D(e),item:e,x:n,y:r,selectedKeys:this.selection.selectedKeys})}#ge;get editingKey(){return this.#ge?.key}#_e(e){return this.#ge!==void 0&&e.composedPath().includes(this.#ge.label)}beginEdit(e){this.#ve();let n=this.editValidator;if(!n)return!1;let r=this.#L(e);if(!(r instanceof HTMLElement)||r.parentNode!==this)return!1;let i=r.querySelector(`[data-edit-label]`)??r,a=i.getAttribute(`data-edit-value`)??i.textContent?.trim()??``,o=document.createElement(`ixfx-editable-label`);o.mode=`label`,o.value=a,o.validator=r=>n(r,e),o.style.cssText=`flex:1;min-width:0;--label-align:left;--label-padding:0 var(--space-xs,3px)`;let s={key:e,row:r,container:i,saved:[...i.childNodes],label:o,committed:void 0,refocus:!1};this.#ge=s,o.addEventListener(`change`,e=>{e.stopPropagation(),s.committed=e.detail.value}),o.addEventListener(`input`,e=>e.stopPropagation()),o.addEventListener(`keydown`,e=>{s.refocus=e.key===`Enter`||e.key===`Escape`});for(let e of[`pointerdown`,`dragstart`])o.addEventListener(e,e=>e.stopPropagation());return o.addEventListener(`focusout`,()=>this.#ve()),i.replaceChildren(o),r.setAttribute(`data-editing`,``),r.draggable=!1,r.scrollIntoView({block:`nearest`,inline:`nearest`}),o.updateComplete.then(()=>{this.#ge===s&&o.shadowRoot?.querySelector(`.content`)?.click()}),!0}#ve(){let e=this.#ge;e&&(this.#ge=void 0,e.container.isConnected&&e.container.replaceChildren(...e.saved),e.row.removeAttribute(`data-editing`),this.#se(e.row),e.refocus&&this.focus(),e.committed===void 0?this._dispatch(`list-edit-cancel`,{key:e.key}):this._dispatch(`list-edit-commit`,{key:e.key,value:e.committed}))}static{this.styles=[w,Mg(`y`),Vt,r`
|
|
6928
6934
|
:host {
|
|
6929
6935
|
display: block;
|
|
6930
6936
|
position: relative;
|
|
@@ -7126,7 +7132,7 @@ const Me={216:`O`,223:`s`,248:`o`,273:`d`,295:`h`,305:`i`,320:`l`,322:`l`,359:`t
|
|
|
7126
7132
|
style=${s?`color:${s}`:a}
|
|
7127
7133
|
@pointerdown=${e=>e.stopPropagation()}
|
|
7128
7134
|
@click=${e=>this.#m(e,n)}
|
|
7129
|
-
>›</span>`:a}`}}#e;#t;#n;#r;#i;#a;#o;#s;get list(){return this.renderRoot.querySelector(`ixfx-vertical-list`)??void 0}get registry(){return this.list?.registry}dispatch(e,n){this.list?.dispatch(e,n)}beginEdit(e){let n=this.#p(e);return!this.validateEdit||!n?.item.editable?!1:this.list?.beginEdit(e)??!1}get currentNode(){return eb(this.#c,this.path).at(-1)}get selectedNodes(){return this.#a}get#c(){return this.model?.root??this.root}navigateTo(e){return eb(this.#c,e).length===e.length+1&&(this.#l(e,`jump`),!0)}navigateInto(e){let n=this.currentNode?.children?.find(n=>n.item.key===e);return!n||!Zy(n)?!1:(this.#l([...this.path,e],`into`),!0)}navigateUp(){return this.path.length!==0&&(this.#i=this.path.at(-1),this.#l(this.path.slice(0,-1),`up`),!0)}#l(e,n){Qy(e,this.path)||(this.#r=this.path,this.#o=n,this.list?.search.close(),this.list?.clearSelection(),this.path=e)}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=void 0,this.#t?.abort(),this.#n=void 0}willUpdate(e){e.has(`model`)&&(this.#e?.(),this.#e=this.model?._subscribe(e=>{if(e.type===`invalidate`&&e.key===this.currentNode?.item.key){let e=this.currentNode;e&&(e.children=void 0)}this.requestUpdate(),this.#u(!0)}));let n=eb(this.#c,this.path).length-1;this.#c&&n<this.path.length&&(this.path=this.path.slice(0,n)),[`root`,`model`,`path`,`branchOrder`,`sort`,`filterPredicate`,`loadChildren`].some(n=>e.has(n))&&this.#u(e.has(`root`)||e.has(`model`)||e.has(`loadChildren`))}updated(e){if(e.has(`path`)&&!Qy(this.path,this.#r)&&this.#c){let e=this.currentNode;if(e){let n=this.#r;this.#r=this.path,this.dispatchEvent(new CustomEvent(`flat-list-navigate`,{detail:{path:this.path,previousPath:n,node:e,direction:this.#o},bubbles:!0,composed:!0})),this.#o=`jump`}}e.has(`_rows`)&&this.#j(),(e.has(`_rows`)||e.has(`markedKey`))&&this.#A()}#u(e){let n=this.currentNode;if(!n){this._rows=[];return}if(n.children===void 0&&(this.model||this.loadChildren)&&(e||this.#n!==n)){this.#f(n);return}this.#d(n)}#d(e){let n=this.filterPredicate,r=this.path.length,i=nb((e.children??[]).filter(e=>!n||n(e,r)),this.branchOrder,this.sort);$y(i,this._rows)||(this._rows=i)}async#f(e){this.#t?.abort();let n=new AbortController;this.#t=n,this.#n=e,this._loading=!0,this._rows=[];try{let r=this.path.length,i=this.model?await this.model.getChildren(e,r,n.signal):[...await
|
|
7135
|
+
>›</span>`:a}`}}#e;#t;#n;#r;#i;#a;#o;#s;get list(){return this.renderRoot.querySelector(`ixfx-vertical-list`)??void 0}get registry(){return this.list?.registry}dispatch(e,n){this.list?.dispatch(e,n)}beginEdit(e){let n=this.#p(e);return!this.validateEdit||!n?.item.editable?!1:this.list?.beginEdit(e)??!1}get currentNode(){return eb(this.#c,this.path).at(-1)}get selectedNodes(){return this.#a}get#c(){return this.model?.root??this.root}navigateTo(e){return eb(this.#c,e).length===e.length+1&&(this.#l(e,`jump`),!0)}navigateInto(e){let n=this.currentNode?.children?.find(n=>n.item.key===e);return!n||!Zy(n)?!1:(this.#l([...this.path,e],`into`),!0)}navigateUp(){return this.path.length!==0&&(this.#i=this.path.at(-1),this.#l(this.path.slice(0,-1),`up`),!0)}#l(e,n){Qy(e,this.path)||(this.#r=this.path,this.#o=n,this.list?.search.close(),this.list?.clearSelection(),this.path=e)}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=void 0,this.#t?.abort(),this.#n=void 0}willUpdate(e){e.has(`model`)&&(this.#e?.(),this.#e=this.model?._subscribe(e=>{if(e.type===`invalidate`&&e.key===this.currentNode?.item.key){let e=this.currentNode;e&&(e.children=void 0)}this.requestUpdate(),this.#u(!0)}));let n=eb(this.#c,this.path).length-1;this.#c&&n<this.path.length&&(this.path=this.path.slice(0,n)),[`root`,`model`,`path`,`branchOrder`,`sort`,`filterPredicate`,`loadChildren`].some(n=>e.has(n))&&this.#u(e.has(`root`)||e.has(`model`)||e.has(`loadChildren`))}updated(e){if(e.has(`path`)&&!Qy(this.path,this.#r)&&this.#c){let e=this.currentNode;if(e){let n=this.#r;this.#r=this.path,this.dispatchEvent(new CustomEvent(`flat-list-navigate`,{detail:{path:this.path,previousPath:n,node:e,direction:this.#o},bubbles:!0,composed:!0})),this.#o=`jump`}}e.has(`_rows`)&&this.#j(),(e.has(`_rows`)||e.has(`markedKey`))&&this.#A()}#u(e){let n=this.currentNode;if(!n){this._rows=[];return}if(n.children===void 0&&(this.model||this.loadChildren)&&(e||this.#n!==n)){this.#f(n);return}this.#d(n)}#d(e){let n=this.filterPredicate,r=this.path.length,i=nb((e.children??[]).filter(e=>!n||n(e,r)),this.branchOrder,this.sort);$y(i,this._rows)||(this._rows=i)}async#f(e){this.#t?.abort();let n=new AbortController;this.#t=n,this.#n=e,this._loading=!0,this._rows=[];try{let r=this.path.length,i=this.model?await this.model.getChildren(e,r,n.signal):[...await hg(this.loadChildren({node:e,depth:r},n.signal),n.signal)];if(n.signal.aborted)return;e.children=[...i]}catch{if(n.signal.aborted)return;e.children=[]}this.#n=void 0,this._loading=!1,e===this.currentNode&&this.#d(e)}#p(e){return e===void 0?void 0:this._rows.find(n=>n.key===e)?.node}#m(e,n){e.stopPropagation(),this.navigateInto(n.item.key)}#h(e){return e?this.#p(e.getAttribute(`data-key`)??void 0):this.currentNode}#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;#k;async#A(){let e=this.list;if(!e)return;await e.updateComplete,this.#k?.removeAttribute(`data-marked`);let n=this.markedKey;this.#k=n===void 0?void 0:e.getItemByKey(n),this.#k?.setAttribute(`data-marked`,``)}async#j(){let e=this.list;if(!e)return;let n=this.matches(`:focus-within`);await e.updateComplete;let r=this.#s,i=this.#i??r??this._rows[0]?.key;this.#s=void 0,this.#i=void 0,r&&e.selectKeys([r]),i!==void 0&&e.focusKey(i),n&&e.focus()}#M;#N;#P(e,n){let{node:r}=e,o=Hg(r.item.textColor),s=n&&r.item.editable===!0;return i`<span class="label" data-edit-label=${s?``:a} data-edit-value=${s?r.item.label:a} style=${o?`color:${o}`:a}>${r.item.label}</span>`}#F;#I;render(){let e=this.#c;return i`
|
|
7130
7136
|
<div class="crumbs" part="crumbs">
|
|
7131
7137
|
<ixfx-crumb-navigation
|
|
7132
7138
|
.root=${e}
|
|
@@ -7502,7 +7508,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
7502
7508
|
grid-column: 2 / -1;
|
|
7503
7509
|
}
|
|
7504
7510
|
}
|
|
7505
|
-
`;let ob=class extends n{constructor(...e){super(...e),this.label=``}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this._observer=new MutationObserver(()=>this._sync())}firstUpdated(){this._fieldset=this.querySelector(`fieldset`)??void 0,this._fieldset&&(this._observer?.observe(this,{childList:!0,subtree:!0}),this._sync())}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}_sync(){this._moveChildren(),this._updatePairs()}_updatePairs(){if(!this._fieldset)return;let e=Array.from(this._fieldset.querySelectorAll(`:scope > ixfx-form-row`)).map(e=>e.querySelectorAll(`:scope > ixfx-form-part`).length),n=Math.max(1,...e);this._fieldset.style.setProperty(`--ixfx-form-pairs`,String(n))}_moveChildren(){this._fieldset&&Array.from(this.children).filter(e=>e.tagName!==`FIELDSET`).forEach(e=>{this._fieldset.appendChild(e)})}render(){return i`<fieldset><legend>${this.label}</legend></fieldset>`}};E([d({type:String})],ob.prototype,`label`,void 0),E([d({type:String,attribute:`label-align`,reflect:!0})],ob.prototype,`labelAlign`,void 0),ob=E([T(`ixfx-form-group`)],ob);let sb=0,cb=class extends n{constructor(...e){super(...e),this.label=``,this.orientation=`horizontal`,this._labelId=`ixfx-form-options-${++sb}`}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this.setAttribute(`role`,`group`),this.setAttribute(`aria-labelledby`,this._labelId),this._observer=new MutationObserver(()=>this._moveChildren())}firstUpdated(){this._observer?.observe(this,{childList:!0}),this._moveChildren()}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}_moveChildren(){let e=this.querySelector(`:scope > .ixfx-form-options-items`);e&&Array.from(this.children).filter(e=>!e.classList.contains(`ixfx-form-options-items`)&&!e.classList.contains(`ixfx-form-options-label`)).forEach(n=>e.appendChild(n))}render(){return i`<span class="ixfx-form-options-label" id=${this._labelId}>${this.label}</span><div class="ixfx-form-options-items"></div>`}};E([d({type:String})],cb.prototype,`label`,void 0),E([d({type:String,reflect:!0})],cb.prototype,`orientation`,void 0),cb=E([T(`ixfx-form-options`)],cb);let lb=0,ub=class extends n{constructor(...e){super(...e),this.label=``}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this._ensureId()}_ensureId(){let e=this.querySelector(`input, select, textarea, [name]`);e&&(e.id?this._id=e.id:(this._id=`ixfx-form-part-${++lb}`,e.id=this._id))}render(){return this._id||this._ensureId(),i`<label for=${this._id??``}>${this.label}</label>`}};E([d({type:String})],ub.prototype,`label`,void 0),ub=E([T(`ixfx-form-part`)],ub);let db=class extends n{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this._observer=new MutationObserver(()=>this._indexParts()),this._observer.observe(this,{childList:!0}),this._indexParts()}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}_indexParts(){Array.from(this.children).filter(e=>e.tagName===`IXFX-FORM-PART`).forEach((e,n)=>{e.style.setProperty(`--ixfx-form-part-index`,String(n+1))})}};db=E([T(`ixfx-form-row`)],db);function fb(e,n={}){let r={};return e.querySelectorAll(`[name]`).forEach(e=>{let i=e.getAttribute(`name`);i&&(e instanceof HTMLInputElement?e.type===`radio`?e.checked&&(r[i]=e.value):e.type===`checkbox`?r[i]=e.checked:n.typed&&(e.type===`number`||e.type===`range`)?r[i]=Number.isNaN(e.valueAsNumber)?null:e.valueAsNumber:r[i]=e.value:e instanceof HTMLSelectElement?e.multiple?r[i]=Array.from(e.selectedOptions).map(e=>e.value):r[i]=e.value:(e instanceof HTMLTextAreaElement||`value`in e)&&(r[i]=e.value))}),r}function pb(e,n){e.querySelectorAll(`[name]`).forEach(e=>{let r=e.getAttribute(`name`);if(!r||!(r in n))return;let i=n[r];e instanceof HTMLInputElement?(e.type===`radio`?e.checked=e.value===i:e.type===`checkbox`?e.checked=!!i:e.value=String(i??``),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))):e instanceof HTMLSelectElement?(e.multiple&&Array.isArray(i)?Array.from(e.options).forEach(e=>{e.selected=i.includes(e.value)}):e.value=String(i??``),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))):e instanceof HTMLTextAreaElement?(e.value=String(i??``),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))):`value`in e&&(e.value=i)})}const mb=new Set([`button`,`submit`,`reset`,`image`,`file`,`color`]);let hb=class extends n{constructor(...e){super(...e),this.labelAlign=`right`,this.noValidate=!1,this._onKeydown=e=>{if(e.key!==`Enter`||e.defaultPrevented||e.isComposing||e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)return;let n=e.target;!(n instanceof HTMLInputElement)||mb.has(n.type)||this.form.querySelector(`button:not([type]), button[type=submit], input[type=submit], input[type=image]`)||(e.preventDefault(),this.requestSubmit())}}createRenderRoot(){return this}get form(){return this._form||(this._form=document.createElement(`form`),this._form.addEventListener(`submit`,e=>e.preventDefault()),this._form.addEventListener(`keydown`,this._onKeydown)),this._form}get elements(){return this.form.elements}connectedCallback(){super.connectedCallback(),ib(this,ab),this._adoptChildren(),this._observer=new MutationObserver(()=>this._adoptChildren()),this._observer.observe(this,{childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}updated(){this.form.noValidate=this.noValidate}_adoptChildren(){let e=this.form;e.parentNode!==this&&this.append(e);let n=Array.from(this.childNodes).filter(n=>n!==e);n.length>0&&e.append(...n)}requestSubmit(){this.form.requestSubmit()}reset(){this.form.reset()}checkValidity(){return this.form.checkValidity()}reportValidity(){return this.form.reportValidity()}getValues(e){return fb(this,e)}setValues(e){pb(this,e)}};E([d({type:String,attribute:`label-align`,reflect:!0})],hb.prototype,`labelAlign`,void 0),E([d({type:Boolean,attribute:`novalidate`,reflect:!0})],hb.prototype,`noValidate`,void 0),hb=E([T(`ixfx-form`)],hb);function gb(e,n,r,i,a,o,s,c,l=2){let u=Math.max(1,n),d=Math.max(1,r),f=Math.max(0,i),p=u+f,m=d+f,h=Math.max(0,s);if(c===`row`){let n=e===0?0:1,r=e===0?0:(e-1)*p+u;if(e===0||a<=0)return{cols:e,rows:n,totalHeight:0,totalWidth:r,startIndex:0,endIndex:0,colStride:p,rowStride:m,horizontal:!0};let i=Math.max(0,Math.floor(h/p)),o=Math.ceil((h+a)/p);return{cols:e,rows:n,totalHeight:0,totalWidth:r,startIndex:Math.max(0,i-l),endIndex:Math.min(e,o+l),colStride:p,rowStride:m,horizontal:!0}}let g=c===`column`?1:Math.max(1,Math.floor((Math.max(0,a)+f)/p)),_=e===0?0:Math.ceil(e/g),v=_===0?0:(_-1)*m+d;if(e===0||o<=0)return{cols:g,rows:_,totalHeight:v,totalWidth:0,startIndex:0,endIndex:0,colStride:p,rowStride:m,horizontal:!1};let y=Math.max(0,Math.floor(h/m)),b=Math.ceil((h+o)/m),x=Math.max(0,y-l),S=Math.min(_,b+l);return{cols:g,rows:_,totalHeight:v,totalWidth:0,startIndex:x*g,endIndex:Math.min(e,S*g),colStride:p,rowStride:m,horizontal:!1}}function _b(e,n,r,i){let a=Math.max(0,e.gap),o=e.orientation===`row`,s=e=>o?e:Math.ceil(e/n),c=e=>e===0?0:(s(e)-1)*r+i;if(!e.groups){let n=c(e.count);return{sections:[{group:void 0,first:0,count:e.count,headerOffset:0,itemsOffset:0,end:n}],total:n,count:e.count}}let l=o?e.headerWidth:e.headerHeight,u=[],d=0,f=0;for(let n of e.groups){let e=n.collapsed?0:n.count,r=d+l+a,i=e===0?d+l:r+c(e);u.push({group:n,first:f,count:e,headerOffset:d,itemsOffset:r,end:i}),f+=e,d=i+a}return{sections:u,total:u.length===0?0:u[u.length-1].end,count:f}}function vb(e,n){let r=0,i=e.length-1;for(;r<i;){let a=r+i+1>>1;e[a].headerOffset<=n?r=a:i=a-1}return r}function yb(e,n){let r=0,i=e.length-1;for(;r<i;){let a=r+i+1>>1;e[a].first<=n?r=a:i=a-1}let a=r;for(;a<e.length-1&&e[a].count===0;)a++;return a}function bb(e){let n=e.orientation===`row`,r=Math.max(1,e.itemWidth),i=Math.max(1,e.rowHeight),a=Math.max(0,e.gap),o=r+a,s=i+a,c=n||e.orientation===`column`?1:Math.max(1,Math.floor((Math.max(0,e.viewportWidth)+a)/o)),l=n?o:s,u=n?r:i,{sections:d,total:f,count:p}=_b(e,c,l,u),m=e.groups!==void 0,h=n?e.headerWidth:e.headerHeight,g=n?e.viewportWidth:e.viewportHeight,_=s-a,v=Math.max(0,(e.viewportHeight-_)/2),y=e=>{let r=yb(d,e),i=d[r],a=Math.max(0,e-i.first);if(n)return{x:i.itemsOffset+a*o,y:v,col:0,line:a,section:r};let l=c<=1?0:a%c,u=c<=1?a:Math.floor(a/c);return{x:l*o,y:i.itemsOffset+u*s,col:l,line:u,section:r}};return{horizontal:n,cols:c,colStride:o,rowStride:s,grouped:m,count:p,totalExtent:f,window:(u,m=2)=>{let _=Math.max(0,u),v=[],y=[],b=_-m*l,x=_+g+m*l,S=0;if(d.length>1){let e=0,n=d.length-1;for(;e<n;){let r=e+n>>1;d[r].end>=b?n=r:e=r+1}S=e}if(g>0)for(let o=S;o<d.length;o++){let s=d[o];if(s.headerOffset>x)break;if(s.group&&s.headerOffset+h>=b&&v.push({key:s.group.key,label:s.group.label,count:s.group.count,collapsed:s.group.collapsed,offset:s.headerOffset,size:h}),s.count===0)continue;let c=_-s.itemsOffset,l=c<0?g+c:g;if(l<=0)continue;let u=gb(s.count,r,i,a,n?l:e.viewportWidth,n?e.viewportHeight:l,Math.max(0,c),e.orientation,m);u.endIndex>u.startIndex&&y.push([s.first+u.startIndex,s.first+u.endIndex])}return{cols:n?p:c,rows:0,totalHeight:n?0:f,totalWidth:n?f:0,startIndex:y.length>0?y[0][0]:0,endIndex:y.length>0?y[y.length-1][1]:0,colStride:o,rowStride:s,horizontal:n,headers:v,ranges:y}},positionOf:y,extentOf:e=>{let{line:n,section:r}=y(e),i=d[r],a=i.itemsOffset+n*l;return[n===0&&i.group?i.headerOffset:a,a+u]},neighbour:(e,n)=>{if(p===0)return e;let r=yb(d,e),i=d[r],a=e-i.first,o=a%c;if(n>0){let e=a+c;if(e<=i.count-1)return i.first+e;let n=Math.floor((i.count-1)/c);if(Math.floor(a/c)<n)return i.first+i.count-1;for(let e=r+1;e<d.length;e++)if(d[e].count>0)return d[e].first+Math.min(o,d[e].count-1);return i.first+i.count-1}let s=a-c;if(s>=0)return i.first+s;for(let e=r-1;e>=0;e--){let n=d[e];if(n.count>0){let e=Math.floor((n.count-1)/c);return n.first+Math.min(e*c+o,n.count-1)}}return i.first},hitTest:(e,r,i,a)=>{let u=[];if(p===0)return u;let f=n?e:i,m=n?r:a,h=vb(d,f-l);for(let l=Math.max(0,h);l<d.length;l++){let p=d[l];if(p.itemsOffset>m)break;if(!(p.count===0||p.end<f)){if(n){let n=Math.max(0,Math.floor((e-p.itemsOffset)/o)),i=Math.min(p.count-1,Math.floor((r-p.itemsOffset)/o));for(let e=n;e<=i;e++)u.push(p.first+e)}else{let n=Math.max(0,Math.floor(e/o)),l=Math.min(c-1,Math.floor(r/o)),d=Math.max(0,Math.floor((i-p.itemsOffset)/s)),f=Math.floor((a-p.itemsOffset)/s);for(let e=d;e<=f;e++)for(let r=n;r<=l;r++){let n=e*c+r;n>=0&&n<p.count&&u.push(p.first+n)}}}}return u},anchorAt:e=>{if(p===0)return{index:0,lineFrac:0};let r=vb(d,e);for(;r<d.length-1&&d[r].count===0;)r++;let i=d[r];if(i.count===0)return{index:0,lineFrac:0};let a=Math.max(0,e-i.itemsOffset)/l,o=Math.max(0,Math.floor(a)),s=n?Math.min(i.count-1,o):Math.min(i.count-1,o*c+Math.max(0,Math.floor((c-1)/2)));return{index:i.first+s,lineFrac:a-o}},offsetOfAnchor:(e,n)=>{let{line:r,section:i}=y(e);return d[i].itemsOffset+(r+n)*l},snapTarget:e=>{let r=vb(d,e),i=d[r],a=Math.round((e-i.itemsOffset)/l);if(m){let e=i.count===0?0:n?i.count:Math.ceil(i.count/c);a=Math.max(0,Math.min(Math.max(0,e-1),a))}let o=[i.itemsOffset+a*l];return m&&(o.push(i.headerOffset),r+1<d.length&&o.push(d[r+1].headerOffset)),o.reduce((n,r)=>Math.abs(r-e)<Math.abs(n-e)?r:n)}}}function xb(e,n,r){let i=gn(e,e=>n.groupKeyOf(e),n.labelOf?(e,r)=>n.labelOf(e,r.map(e=>n.itemAt(e))):void 0),a=[],o=[],s=new Map;for(let e of i){let i=n.collapsed.has(e.key);o.push({key:e.key,label:e.label,count:e.items.length,collapsed:i});for(let n of e.items)s.set(r(n),e.key),i||a.push(n)}return{order:a,groups:o,groupByKey:s}}const Sb=`gl-auto-`;function Cb(e){return e.startsWith(Sb)}function wb(e){let n=new Set,r=new Set;for(let i of e)Cb(i)||(n.has(i)?r.add(i):n.add(i));r.size>0&&console.warn(`ixfx-grid-list: duplicate item key(s) ${[...r].map(e=>`"${e}"`).join(`, `)} — the first occurrence wins for key-based operations.`)}function Tb(e){let n=new Map;return e.forEach((e,r)=>{n.has(e)||n.set(e,r)}),n}var Eb=class{#e;#t=[];#n=new WeakMap;#r=0;#i;#a;#o=[];#s;#c;#l;#u=[];#d=new Map;constructor(e){this.#e=e,this.refresh()}get count(){return this.#o.length}get rawCount(){return this.#t.length}keyAt(e){let n=this.#o[e];return n===void 0?``:this.#m(this.#t[n])}indexOfKey(e){return this.#c??=Tb(this.keys()),this.#c.get(e)??-1}keys(){return this.#s??=this.#o.map(e=>this.#m(this.#t[e])),this.#s}labelAt(e){let n=this.#o[e];return n===void 0?``:this.#h(this.#t[n])}rawKeyAt(e){let n=this.#t[e];return n===void 0?``:this.#m(n)}rawSearchTextAt(e){let n=this.#t[e];return n===void 0?``:n.getAttribute(`data-search-label`)??n.getAttribute(`data-label`)??n.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??n.textContent?.trim()??``}isSelectable(e){let n=this.#o[e];return n!==void 0&&!this.#t[n].hasAttribute(`not-checked`)}renderCellContent(e){}iconAt(e){}iconColorAt(e){}textColorAt(e){}badgeAt(e){}setFilters(e){`predicate`in e&&(this.#i=e.predicate),`searchKeys`in e&&(this.#a=e.searchKeys),this.#f()}setGrouping(e){this.#l=e,this.#f()}groups(){return this.#u}groupKeyOfKey(e){return this.#d.get(e)??null}refresh(){this.#t=Array.from(this.#e.querySelectorAll(`:scope > *`)).filter(e=>!e.hidden),wb(this.#t.map(e=>this.#m(e))),this.#f()}effectiveElements(){return this.#o.map(e=>this.#t[e])}rawElementAt(e){return this.#t[e]}resolveKeyToElement(e){return Cb(e)?this.#t.find(n=>this.#n.get(n)===e):this.#t.find(n=>D(n)===e)}resolveKeyToData(e){}#f(){let e=[];for(let n=0;n<this.#t.length;n++)if(!(this.#i!==void 0&&!this.#i(n))){if(this.#a!==void 0){let e=this.#m(this.#t[n]);if(!Cb(e)&&!this.#a.has(e))continue}e.push(n)}this.#p(e),this.#s=void 0,this.#c=void 0}#p(e){if(this.#l===void 0){this.#o=e,this.#u=[],this.#d=new Map;return}let n=xb(e,this.#l,e=>this.#m(this.#t[e]));this.#o=n.order,this.#u=n.groups,this.#d=n.groupByKey}#m(e){let n=D(e);if(n!==void 0)return n;let r=this.#n.get(e);return r===void 0&&(this.#r+=1,r=`${Sb}${this.#r}`,this.#n.set(e,r)),r}#h(e){return e.getAttribute(`data-label`)??e.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??``}},Db=class{#e;#t;#n;#r;#i=[];#a;#o;#s;#c=[];#l=new Map;constructor(e,n){this.#e=e,this.#t=n,wb(e.map((e,r)=>n.key(e,r))),this.#u()}get count(){return this.#i.length}get rawCount(){return this.#e.length}keyAt(e){let n=this.#i[e];return n===void 0?``:this.#t.key(this.#e[n],n)}indexOfKey(e){return this.#o??=Tb(this.keys()),this.#o.get(e)??-1}keys(){return this.#a??=this.#i.map(e=>this.#t.key(this.#e[e],e)),this.#a}labelAt(e){let n=this.#i[e];return n===void 0?``:this.#t.label?.(this.#e[n],n)??this.#t.key(this.#e[n],n)}rawKeyAt(e){return e<0||e>=this.#e.length?``:this.#t.key(this.#e[e],e)}rawSearchTextAt(e){if(e<0||e>=this.#e.length)return``;let n=this.#e[e];return this.#t.searchableText?.(n,e)??this.#t.label?.(n,e)??``}isSelectable(e){let n=this.#i[e];return n!==void 0&&!this.#t.disabled?.(this.#e[n],n)}renderCellContent(e){let n=this.#i[e];return n===void 0?void 0:this.#t.render(this.#e[n],n)}iconAt(e){let n=this.#i[e];return n===void 0||this.#t.icon===void 0?void 0:this.#t.icon(this.#e[n],n)}iconColorAt(e){let n=this.#i[e];return n===void 0?void 0:this.#t.iconColor?.(this.#e[n],n)}textColorAt(e){let n=this.#i[e];return n===void 0?void 0:this.#t.textColor?.(this.#e[n],n)}badgeAt(e){let n=this.#i[e];return n===void 0||this.#t.badge===void 0?void 0:this.#t.badge(this.#e[n],n)}setFilters(e){`predicate`in e&&(this.#n=e.predicate),`searchKeys`in e&&(this.#r=e.searchKeys),this.#u()}setGrouping(e){this.#s=e,this.#u()}groups(){return this.#c}groupKeyOfKey(e){return this.#l.get(e)??null}refresh(){this.#u()}rawItemAt(e){return this.#e[e]}getItemAt(e){let n=this.#i[e];return n===void 0?void 0:this.#e[n]}resolveKeyToElement(e){}resolveKeyToData(e){let n=this.#e.findIndex((n,r)=>this.#t.key(n,r)===e);return n>=0?this.#e[n]:void 0}#u(){let e=[];for(let n=0;n<this.#e.length;n++)this.#n!==void 0&&!this.#n(n)||this.#r!==void 0&&!this.#r.has(this.#t.key(this.#e[n],n))||e.push(n);if(this.#s===void 0)this.#i=e,this.#c=[],this.#l=new Map;else{let n=xb(e,this.#s,e=>this.#t.key(this.#e[e],e));this.#i=n.order,this.#c=n.groups,this.#l=n.groupByKey}this.#a=void 0,this.#o=void 0}};function Ob(e,n){return typeof e==`object`&&e?e[n]:void 0}function kb(e,n){return e.getAttribute(`data-${n}`)}function Ab(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function jb(e,n,r){for(let i of n)r.has(i)||i.removeAttribute(e);for(let n of r)n.hasAttribute(e)||n.setAttribute(e,``);return r}let K=class extends n{constructor(...e){super(...e),this.selectionMode=`single`,this.interactionMode=`standard`,this.disableHoverTickle=!1,this.disableScrollHoverTickle=!1,this.itemSize=160,this.gap=8,this.orientation=`grid`,this.captionStyle=`under`,this.captionAlign=`middle`,this.captionPosition=`bottom`,this.captionBackdrop=`scrim`,this.captionHeight=24,this.itemWrap=`stop`,this.itemsDraggable=!1,this.marqueeFromCellBlank=!1,this.snapToItem=!1,this.items=[],this.groupBy=null,this.crossGroupSelection=!1,this.groupHeaderHeight=28,this.groupHeaderWidth=120,this._collapsedGroups=new Set,this._scrollTop=0,this._scrollLeft=0,this._viewportHeight=0,this._viewportWidth=0,this.#e=x(),this.#i=0,this.#a=0,this.#o=[],this.#s=`stop`,this.#c=new Map,this.#l=0,this.#u=new Set,this.#d=[],this.#f=new Map,this.#p=new Set,this.#m=0,this.#g=new Eb(this),this.#_=this.#g,this.selection=new nr({getOrderedItems:()=>this.#_.keys(),isSelectable:e=>{let n=this.#_.indexOfKey(e);return n>=0&&this.#_.isSelectable(n)},getModes:()=>({selectionMode:this.selectionMode,interactionMode:this.interactionMode}),getKey:e=>e,getGroupKey:e=>this.groupBy===null?null:this.#_.groupKeyOfKey(e),crossGroupSelection:()=>this.crossGroupSelection,getFallbackGroupKey:()=>{let e=this.tickled.tickledId;return e!==void 0&&this.groupBy!==null?this.#_.groupKeyOfKey(e):null},onChange:(e,n)=>{this._syncItemStates(),this.requestUpdate(),this.#ge(e,n)}}),this.tickled=new oe(this,{getItems:()=>this.#_.keys().map((e,n)=>({id:e,enabled:this.#_.isSelectable(n)})),onTickle:e=>{this.#Oe(),e!==void 0&&this.#_e(`list-tickle`,e)},onStateChange:()=>this._syncItemStates(),itemWrap:this.#s,hoverDisabled:()=>this.disableHoverTickle||this.#A.isDragging||this.#E.isDragging}),this.#v=!1,this.#y=NaN,this.#b=NaN,this.#x=new Set,this.#C=!1,this.#w=void 0,this.#T=0,this.#E=new er(this,{source:`grid-list`,isEnabled:()=>this.itemsDraggable&&this.selectionMode!==`none`&&this.#_.count>0,resolveEventToKey:e=>{if(e instanceof Element){let n=(e.closest?.(`.cell`))?.dataset.key;if(n)return n;let r=(e.closest?.(`[data-key]`))?.dataset.key??e.dataset?.key??D(e);if(r)return r}},prepareSelection:e=>this.#O(e),getMetrics:()=>({itemSize:this.itemSize,captionStyle:this.captionStyle,captionHeight:this.captionHeight,rowHeight:this.#ee()}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>this._dispatch(`list-native-drag-start`,e,!0),onActiveChange:(e,n)=>{if(this.#C=e,this.#w=e?n:void 0,this.toggleAttribute(`data-native-dragging`,e),e){let e=[...this.selection.selectedKeys].filter(e=>!Cb(e)).length;this.setAttribute(`aria-label`,e<=1?`Dragging 1 item`:`Dragging ${e} items`)}else this.removeAttribute(`aria-label`);this.requestUpdate()},onEnd:()=>{this.#qe(),this.#Ke()},syncLightDomDraggable:()=>{for(let e of this.children)e instanceof HTMLElement&&(e.draggable=this.itemsDraggable)},shouldStart:e=>!(this.marqueeFromCellBlank&&this.#j(e))}),this.#k=null,this.#A=new Hn(this,{getSurface:()=>this.#e.value,isEnabled:()=>this.selection.canDragSelect()&&this.#_.count>0&&!this.hasAttribute(`disable-drag-select`),hitTest:e=>this.#M(e),getBaseSelection:()=>this.selection.selected,onPreview:(e,n)=>{this.#x=e,this.#S=n,this.requestUpdate()},onCommit:e=>{this.selection.applyDragSelection(e),this.#x=new Set,this.#S=void 0,this.requestUpdate()},autoScroll:(e,n)=>{let r=this.#e.value;r&&(e!==0&&(r.scrollLeft+=e,this._scrollLeft=r.scrollLeft),n!==0&&(r.scrollTop+=n,this._scrollTop=r.scrollTop))},shouldStart:e=>{if(this.marqueeFromCellBlank&&this.#j(e))return!0;for(let n of e.composedPath())if(n instanceof Element&&(n.classList.contains(`cell`)||n.classList.contains(`group-header`)))return!1;return!0}}),this.#Y=!1,this.#me=new Set,this.#he=new Set,this.#ve=new Set,this.#Ne=e=>{let n=e.target;this.#Ie(),this.#Be(),this.#i=requestAnimationFrame(()=>{this.#i=0,this._scrollTop=n.scrollTop,this._scrollLeft=n.scrollLeft,this.#K()}),this.#He()},this.#Pe=e=>{if(this.orientation!==`row`||e.ctrlKey||e.metaKey||e.deltaY===0)return;let n=this.#e.value??e.currentTarget;n&&(n.scrollWidth<=n.clientWidth+1||(this.#Ie(),n.scrollLeft+=e.deltaX+e.deltaY,e.preventDefault()))},this.#Re=e=>{let n=!Number.isNaN(this.#y)&&(e.clientX!==this.#y||e.clientY!==this.#b);if(this.#y=e.clientX,this.#b=e.clientY,!n||!this.#v||(this.#Le(),this.disableHoverTickle))return;let r=this.shadowRoot?.elementFromPoint?.(e.clientX,e.clientY)?.closest(`.cell`)?.getAttribute(`data-key`);r&&this.tickled.handlePointerEnter(r)},this.#ze=()=>{this.#Le()},this._onKeyDown=e=>{if((e.ctrlKey||e.metaKey)&&e.key===`f`)return;if((e.ctrlKey||e.metaKey)&&e.key===`a`){this.selection.canSelectAll()&&(e.preventDefault(),this.selection.selectAll());return}let n=this.#_.count;if(n===0)return;let r=this.#fe(),i=this.#de(),a=()=>this.tickled.tickledId?this.#_.indexOfKey(this.tickled.tickledId):-1,o=e=>{let n=this.#_.keyAt(e);n&&(this.tickled.handleKeyboardNavigation(n),this.#pe(n))},s=e=>o(Math.max(0,Math.min(n-1,a()+e))),c=(e,n=1)=>{let c=a();if(c<0){s(e*n*r.cols);return}for(let r=0;r<n;r++)c=i.neighbour(c,e);o(c)},l=this.orientation===`grid`?r.cols:1;switch(e.key){case`ArrowLeft`:s(-1);break;case`ArrowRight`:s(1);break;case`ArrowUp`:this.orientation===`grid`?c(-1):s(-l);break;case`ArrowDown`:this.orientation===`grid`?c(1):s(l);break;case`Home`:this.tickled.handleKeyboardNavigation(`first`),this.tickled.tickledId&&this.#pe(this.tickled.tickledId);break;case`End`:this.tickled.handleKeyboardNavigation(`last`),this.tickled.tickledId&&this.#pe(this.tickled.tickledId);break;case`PageUp`:case`PageDown`:{let n=r.horizontal?this._viewportWidth:this._viewportHeight,i=r.horizontal?r.colStride:r.rowStride,a=Math.max(1,Math.floor(n/i));this.orientation===`grid`?c(e.key===`PageDown`?1:-1,a):s((e.key===`PageDown`?1:-1)*a*l);break}case`Enter`:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.#_e(`list-item-click`,n),this.#Je(n));break}case` `:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.selection.handleSpace(n));break}case`Escape`:this.#C&&this.#qe(),this.selection.clear();break;default:return}e.preventDefault()}}static{this.styles=[w,se,C,Ng(`x`),Ng(`y`),Gn,Ht,r`
|
|
7511
|
+
`;let ob=class extends n{constructor(...e){super(...e),this.label=``}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this._observer=new MutationObserver(()=>this._sync())}firstUpdated(){this._fieldset=this.querySelector(`fieldset`)??void 0,this._fieldset&&(this._observer?.observe(this,{childList:!0,subtree:!0}),this._sync())}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}_sync(){this._moveChildren(),this._updatePairs()}_updatePairs(){if(!this._fieldset)return;let e=Array.from(this._fieldset.querySelectorAll(`:scope > ixfx-form-row`)).map(e=>e.querySelectorAll(`:scope > ixfx-form-part`).length),n=Math.max(1,...e);this._fieldset.style.setProperty(`--ixfx-form-pairs`,String(n))}_moveChildren(){this._fieldset&&Array.from(this.children).filter(e=>e.tagName!==`FIELDSET`).forEach(e=>{this._fieldset.appendChild(e)})}render(){return i`<fieldset><legend>${this.label}</legend></fieldset>`}};E([d({type:String})],ob.prototype,`label`,void 0),E([d({type:String,attribute:`label-align`,reflect:!0})],ob.prototype,`labelAlign`,void 0),ob=E([T(`ixfx-form-group`)],ob);let sb=0,cb=class extends n{constructor(...e){super(...e),this.label=``,this.orientation=`horizontal`,this._labelId=`ixfx-form-options-${++sb}`}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this.setAttribute(`role`,`group`),this.setAttribute(`aria-labelledby`,this._labelId),this._observer=new MutationObserver(()=>this._moveChildren())}firstUpdated(){this._observer?.observe(this,{childList:!0}),this._moveChildren()}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}_moveChildren(){let e=this.querySelector(`:scope > .ixfx-form-options-items`);e&&Array.from(this.children).filter(e=>!e.classList.contains(`ixfx-form-options-items`)&&!e.classList.contains(`ixfx-form-options-label`)).forEach(n=>e.appendChild(n))}render(){return i`<span class="ixfx-form-options-label" id=${this._labelId}>${this.label}</span><div class="ixfx-form-options-items"></div>`}};E([d({type:String})],cb.prototype,`label`,void 0),E([d({type:String,reflect:!0})],cb.prototype,`orientation`,void 0),cb=E([T(`ixfx-form-options`)],cb);let lb=0,ub=class extends n{constructor(...e){super(...e),this.label=``}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this._ensureId()}_ensureId(){let e=this.querySelector(`input, select, textarea, [name]`);e&&(e.id?this._id=e.id:(this._id=`ixfx-form-part-${++lb}`,e.id=this._id))}render(){return this._id||this._ensureId(),i`<label for=${this._id??``}>${this.label}</label>`}};E([d({type:String})],ub.prototype,`label`,void 0),ub=E([T(`ixfx-form-part`)],ub);let db=class extends n{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),ib(this,ab),this._observer=new MutationObserver(()=>this._indexParts()),this._observer.observe(this,{childList:!0}),this._indexParts()}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}_indexParts(){Array.from(this.children).filter(e=>e.tagName===`IXFX-FORM-PART`).forEach((e,n)=>{e.style.setProperty(`--ixfx-form-part-index`,String(n+1))})}};db=E([T(`ixfx-form-row`)],db);function fb(e,n={}){let r={};return e.querySelectorAll(`[name]`).forEach(e=>{let i=e.getAttribute(`name`);i&&(e instanceof HTMLInputElement?e.type===`radio`?e.checked&&(r[i]=e.value):e.type===`checkbox`?r[i]=e.checked:n.typed&&(e.type===`number`||e.type===`range`)?r[i]=Number.isNaN(e.valueAsNumber)?null:e.valueAsNumber:r[i]=e.value:e instanceof HTMLSelectElement?e.multiple?r[i]=Array.from(e.selectedOptions).map(e=>e.value):r[i]=e.value:(e instanceof HTMLTextAreaElement||`value`in e)&&(r[i]=e.value))}),r}function pb(e,n){e.querySelectorAll(`[name]`).forEach(e=>{let r=e.getAttribute(`name`);if(!r||!(r in n))return;let i=n[r];e instanceof HTMLInputElement?(e.type===`radio`?e.checked=e.value===i:e.type===`checkbox`?e.checked=!!i:e.value=String(i??``),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))):e instanceof HTMLSelectElement?(e.multiple&&Array.isArray(i)?Array.from(e.options).forEach(e=>{e.selected=i.includes(e.value)}):e.value=String(i??``),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))):e instanceof HTMLTextAreaElement?(e.value=String(i??``),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))):`value`in e&&(e.value=i)})}const mb=new Set([`button`,`submit`,`reset`,`image`,`file`,`color`]);let hb=class extends n{constructor(...e){super(...e),this.labelAlign=`right`,this.noValidate=!1,this._onKeydown=e=>{if(e.key!==`Enter`||e.defaultPrevented||e.isComposing||e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)return;let n=e.target;!(n instanceof HTMLInputElement)||mb.has(n.type)||this.form.querySelector(`button:not([type]), button[type=submit], input[type=submit], input[type=image]`)||(e.preventDefault(),this.requestSubmit())}}createRenderRoot(){return this}get form(){return this._form||(this._form=document.createElement(`form`),this._form.addEventListener(`submit`,e=>e.preventDefault()),this._form.addEventListener(`keydown`,this._onKeydown)),this._form}get elements(){return this.form.elements}connectedCallback(){super.connectedCallback(),ib(this,ab),this._adoptChildren(),this._observer=new MutationObserver(()=>this._adoptChildren()),this._observer.observe(this,{childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect()}updated(){this.form.noValidate=this.noValidate}_adoptChildren(){let e=this.form;e.parentNode!==this&&this.append(e);let n=Array.from(this.childNodes).filter(n=>n!==e);n.length>0&&e.append(...n)}requestSubmit(){this.form.requestSubmit()}reset(){this.form.reset()}checkValidity(){return this.form.checkValidity()}reportValidity(){return this.form.reportValidity()}getValues(e){return fb(this,e)}setValues(e){pb(this,e)}};E([d({type:String,attribute:`label-align`,reflect:!0})],hb.prototype,`labelAlign`,void 0),E([d({type:Boolean,attribute:`novalidate`,reflect:!0})],hb.prototype,`noValidate`,void 0),hb=E([T(`ixfx-form`)],hb);function gb(e,n,r,i,a,o,s,c,l=2){let u=Math.max(1,n),d=Math.max(1,r),f=Math.max(0,i),p=u+f,m=d+f,h=Math.max(0,s);if(c===`row`){let n=e===0?0:1,r=e===0?0:(e-1)*p+u;if(e===0||a<=0)return{cols:e,rows:n,totalHeight:0,totalWidth:r,startIndex:0,endIndex:0,colStride:p,rowStride:m,horizontal:!0};let i=Math.max(0,Math.floor(h/p)),o=Math.ceil((h+a)/p);return{cols:e,rows:n,totalHeight:0,totalWidth:r,startIndex:Math.max(0,i-l),endIndex:Math.min(e,o+l),colStride:p,rowStride:m,horizontal:!0}}let g=c===`column`?1:Math.max(1,Math.floor((Math.max(0,a)+f)/p)),_=e===0?0:Math.ceil(e/g),v=_===0?0:(_-1)*m+d;if(e===0||o<=0)return{cols:g,rows:_,totalHeight:v,totalWidth:0,startIndex:0,endIndex:0,colStride:p,rowStride:m,horizontal:!1};let y=Math.max(0,Math.floor(h/m)),b=Math.ceil((h+o)/m),x=Math.max(0,y-l),S=Math.min(_,b+l);return{cols:g,rows:_,totalHeight:v,totalWidth:0,startIndex:x*g,endIndex:Math.min(e,S*g),colStride:p,rowStride:m,horizontal:!1}}function _b(e,n,r,i){let a=Math.max(0,e.gap),o=e.orientation===`row`,s=e=>o?e:Math.ceil(e/n),c=e=>e===0?0:(s(e)-1)*r+i;if(!e.groups){let n=c(e.count);return{sections:[{group:void 0,first:0,count:e.count,headerOffset:0,itemsOffset:0,end:n}],total:n,count:e.count}}let l=o?e.headerWidth:e.headerHeight,u=[],d=0,f=0;for(let n of e.groups){let e=n.collapsed?0:n.count,r=d+l+a,i=e===0?d+l:r+c(e);u.push({group:n,first:f,count:e,headerOffset:d,itemsOffset:r,end:i}),f+=e,d=i+a}return{sections:u,total:u.length===0?0:u[u.length-1].end,count:f}}function vb(e,n){let r=0,i=e.length-1;for(;r<i;){let a=r+i+1>>1;e[a].headerOffset<=n?r=a:i=a-1}return r}function yb(e,n){let r=0,i=e.length-1;for(;r<i;){let a=r+i+1>>1;e[a].first<=n?r=a:i=a-1}let a=r;for(;a<e.length-1&&e[a].count===0;)a++;return a}function bb(e){let n=e.orientation===`row`,r=Math.max(1,e.itemWidth),i=Math.max(1,e.rowHeight),a=Math.max(0,e.gap),o=r+a,s=i+a,c=n||e.orientation===`column`?1:Math.max(1,Math.floor((Math.max(0,e.viewportWidth)+a)/o)),l=n?o:s,u=n?r:i,{sections:d,total:f,count:p}=_b(e,c,l,u),m=e.groups!==void 0,h=n?e.headerWidth:e.headerHeight,g=n?e.viewportWidth:e.viewportHeight,_=s-a,v=Math.max(0,(e.viewportHeight-_)/2),y=e=>{let r=yb(d,e),i=d[r],a=Math.max(0,e-i.first);if(n)return{x:i.itemsOffset+a*o,y:v,col:0,line:a,section:r};let l=c<=1?0:a%c,u=c<=1?a:Math.floor(a/c);return{x:l*o,y:i.itemsOffset+u*s,col:l,line:u,section:r}};return{horizontal:n,cols:c,colStride:o,rowStride:s,grouped:m,count:p,totalExtent:f,window:(u,m=2)=>{let _=Math.max(0,u),v=[],y=[],b=_-m*l,x=_+g+m*l,S=0;if(d.length>1){let e=0,n=d.length-1;for(;e<n;){let r=e+n>>1;d[r].end>=b?n=r:e=r+1}S=e}if(g>0)for(let o=S;o<d.length;o++){let s=d[o];if(s.headerOffset>x)break;if(s.group&&s.headerOffset+h>=b&&v.push({key:s.group.key,label:s.group.label,count:s.group.count,collapsed:s.group.collapsed,offset:s.headerOffset,size:h}),s.count===0)continue;let c=_-s.itemsOffset,l=c<0?g+c:g;if(l<=0)continue;let u=gb(s.count,r,i,a,n?l:e.viewportWidth,n?e.viewportHeight:l,Math.max(0,c),e.orientation,m);u.endIndex>u.startIndex&&y.push([s.first+u.startIndex,s.first+u.endIndex])}return{cols:n?p:c,rows:0,totalHeight:n?0:f,totalWidth:n?f:0,startIndex:y.length>0?y[0][0]:0,endIndex:y.length>0?y[y.length-1][1]:0,colStride:o,rowStride:s,horizontal:n,headers:v,ranges:y}},positionOf:y,extentOf:e=>{let{line:n,section:r}=y(e),i=d[r],a=i.itemsOffset+n*l;return[n===0&&i.group?i.headerOffset:a,a+u]},neighbour:(e,n)=>{if(p===0)return e;let r=yb(d,e),i=d[r],a=e-i.first,o=a%c;if(n>0){let e=a+c;if(e<=i.count-1)return i.first+e;let n=Math.floor((i.count-1)/c);if(Math.floor(a/c)<n)return i.first+i.count-1;for(let e=r+1;e<d.length;e++)if(d[e].count>0)return d[e].first+Math.min(o,d[e].count-1);return i.first+i.count-1}let s=a-c;if(s>=0)return i.first+s;for(let e=r-1;e>=0;e--){let n=d[e];if(n.count>0){let e=Math.floor((n.count-1)/c);return n.first+Math.min(e*c+o,n.count-1)}}return i.first},hitTest:(e,r,i,a)=>{let u=[];if(p===0)return u;let f=n?e:i,m=n?r:a,h=vb(d,f-l);for(let l=Math.max(0,h);l<d.length;l++){let p=d[l];if(p.itemsOffset>m)break;if(!(p.count===0||p.end<f)){if(n){let n=Math.max(0,Math.floor((e-p.itemsOffset)/o)),i=Math.min(p.count-1,Math.floor((r-p.itemsOffset)/o));for(let e=n;e<=i;e++)u.push(p.first+e)}else{let n=Math.max(0,Math.floor(e/o)),l=Math.min(c-1,Math.floor(r/o)),d=Math.max(0,Math.floor((i-p.itemsOffset)/s)),f=Math.floor((a-p.itemsOffset)/s);for(let e=d;e<=f;e++)for(let r=n;r<=l;r++){let n=e*c+r;n>=0&&n<p.count&&u.push(p.first+n)}}}}return u},anchorAt:e=>{if(p===0)return{index:0,lineFrac:0};let r=vb(d,e);for(;r<d.length-1&&d[r].count===0;)r++;let i=d[r];if(i.count===0)return{index:0,lineFrac:0};let a=Math.max(0,e-i.itemsOffset)/l,o=Math.max(0,Math.floor(a)),s=n?Math.min(i.count-1,o):Math.min(i.count-1,o*c+Math.max(0,Math.floor((c-1)/2)));return{index:i.first+s,lineFrac:a-o}},offsetOfAnchor:(e,n)=>{let{line:r,section:i}=y(e);return d[i].itemsOffset+(r+n)*l},snapTarget:e=>{let r=vb(d,e),i=d[r],a=Math.round((e-i.itemsOffset)/l);if(m){let e=i.count===0?0:n?i.count:Math.ceil(i.count/c);a=Math.max(0,Math.min(Math.max(0,e-1),a))}let o=[i.itemsOffset+a*l];return m&&(o.push(i.headerOffset),r+1<d.length&&o.push(d[r+1].headerOffset)),o.reduce((n,r)=>Math.abs(r-e)<Math.abs(n-e)?r:n)}}}function xb(e,n,r){let i=hn(e,e=>n.groupKeyOf(e),n.labelOf?(e,r)=>n.labelOf(e,r.map(e=>n.itemAt(e))):void 0),a=[],o=[],s=new Map;for(let e of i){let i=n.collapsed.has(e.key);o.push({key:e.key,label:e.label,count:e.items.length,collapsed:i});for(let n of e.items)s.set(r(n),e.key),i||a.push(n)}return{order:a,groups:o,groupByKey:s}}const Sb=`gl-auto-`;function Cb(e){return e.startsWith(Sb)}function wb(e){let n=new Set,r=new Set;for(let i of e)Cb(i)||(n.has(i)?r.add(i):n.add(i));r.size>0&&console.warn(`ixfx-grid-list: duplicate item key(s) ${[...r].map(e=>`"${e}"`).join(`, `)} — the first occurrence wins for key-based operations.`)}function Tb(e){let n=new Map;return e.forEach((e,r)=>{n.has(e)||n.set(e,r)}),n}var Eb=class{#e;#t=[];#n=new WeakMap;#r=0;#i;#a;#o=[];#s;#c;#l;#u=[];#d=new Map;constructor(e){this.#e=e,this.refresh()}get count(){return this.#o.length}get rawCount(){return this.#t.length}keyAt(e){let n=this.#o[e];return n===void 0?``:this.#m(this.#t[n])}indexOfKey(e){return this.#c??=Tb(this.keys()),this.#c.get(e)??-1}keys(){return this.#s??=this.#o.map(e=>this.#m(this.#t[e])),this.#s}labelAt(e){let n=this.#o[e];return n===void 0?``:this.#h(this.#t[n])}rawKeyAt(e){let n=this.#t[e];return n===void 0?``:this.#m(n)}rawSearchTextAt(e){let n=this.#t[e];return n===void 0?``:n.getAttribute(`data-search-label`)??n.getAttribute(`data-label`)??n.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??n.textContent?.trim()??``}isSelectable(e){let n=this.#o[e];return n!==void 0&&!this.#t[n].hasAttribute(`not-checked`)}renderCellContent(e){}iconAt(e){}iconColorAt(e){}textColorAt(e){}badgeAt(e){}setFilters(e){`predicate`in e&&(this.#i=e.predicate),`searchKeys`in e&&(this.#a=e.searchKeys),this.#f()}setGrouping(e){this.#l=e,this.#f()}groups(){return this.#u}groupKeyOfKey(e){return this.#d.get(e)??null}refresh(){this.#t=Array.from(this.#e.querySelectorAll(`:scope > *`)).filter(e=>!e.hidden),wb(this.#t.map(e=>this.#m(e))),this.#f()}effectiveElements(){return this.#o.map(e=>this.#t[e])}rawElementAt(e){return this.#t[e]}resolveKeyToElement(e){return Cb(e)?this.#t.find(n=>this.#n.get(n)===e):this.#t.find(n=>D(n)===e)}resolveKeyToData(e){}#f(){let e=[];for(let n=0;n<this.#t.length;n++)if(!(this.#i!==void 0&&!this.#i(n))){if(this.#a!==void 0){let e=this.#m(this.#t[n]);if(!Cb(e)&&!this.#a.has(e))continue}e.push(n)}this.#p(e),this.#s=void 0,this.#c=void 0}#p(e){if(this.#l===void 0){this.#o=e,this.#u=[],this.#d=new Map;return}let n=xb(e,this.#l,e=>this.#m(this.#t[e]));this.#o=n.order,this.#u=n.groups,this.#d=n.groupByKey}#m(e){let n=D(e);if(n!==void 0)return n;let r=this.#n.get(e);return r===void 0&&(this.#r+=1,r=`${Sb}${this.#r}`,this.#n.set(e,r)),r}#h(e){return e.getAttribute(`data-label`)??e.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??``}},Db=class{#e;#t;#n;#r;#i=[];#a;#o;#s;#c=[];#l=new Map;constructor(e,n){this.#e=e,this.#t=n,wb(e.map((e,r)=>n.key(e,r))),this.#u()}get count(){return this.#i.length}get rawCount(){return this.#e.length}keyAt(e){let n=this.#i[e];return n===void 0?``:this.#t.key(this.#e[n],n)}indexOfKey(e){return this.#o??=Tb(this.keys()),this.#o.get(e)??-1}keys(){return this.#a??=this.#i.map(e=>this.#t.key(this.#e[e],e)),this.#a}labelAt(e){let n=this.#i[e];return n===void 0?``:this.#t.label?.(this.#e[n],n)??this.#t.key(this.#e[n],n)}rawKeyAt(e){return e<0||e>=this.#e.length?``:this.#t.key(this.#e[e],e)}rawSearchTextAt(e){if(e<0||e>=this.#e.length)return``;let n=this.#e[e];return this.#t.searchableText?.(n,e)??this.#t.label?.(n,e)??``}isSelectable(e){let n=this.#i[e];return n!==void 0&&!this.#t.disabled?.(this.#e[n],n)}renderCellContent(e){let n=this.#i[e];return n===void 0?void 0:this.#t.render(this.#e[n],n)}iconAt(e){let n=this.#i[e];return n===void 0||this.#t.icon===void 0?void 0:this.#t.icon(this.#e[n],n)}iconColorAt(e){let n=this.#i[e];return n===void 0?void 0:this.#t.iconColor?.(this.#e[n],n)}textColorAt(e){let n=this.#i[e];return n===void 0?void 0:this.#t.textColor?.(this.#e[n],n)}badgeAt(e){let n=this.#i[e];return n===void 0||this.#t.badge===void 0?void 0:this.#t.badge(this.#e[n],n)}setFilters(e){`predicate`in e&&(this.#n=e.predicate),`searchKeys`in e&&(this.#r=e.searchKeys),this.#u()}setGrouping(e){this.#s=e,this.#u()}groups(){return this.#c}groupKeyOfKey(e){return this.#l.get(e)??null}refresh(){this.#u()}rawItemAt(e){return this.#e[e]}getItemAt(e){let n=this.#i[e];return n===void 0?void 0:this.#e[n]}resolveKeyToElement(e){}resolveKeyToData(e){let n=this.#e.findIndex((n,r)=>this.#t.key(n,r)===e);return n>=0?this.#e[n]:void 0}#u(){let e=[];for(let n=0;n<this.#e.length;n++)this.#n!==void 0&&!this.#n(n)||this.#r!==void 0&&!this.#r.has(this.#t.key(this.#e[n],n))||e.push(n);if(this.#s===void 0)this.#i=e,this.#c=[],this.#l=new Map;else{let n=xb(e,this.#s,e=>this.#t.key(this.#e[e],e));this.#i=n.order,this.#c=n.groups,this.#l=n.groupByKey}this.#a=void 0,this.#o=void 0}};function Ob(e,n){return typeof e==`object`&&e?e[n]:void 0}function kb(e,n){return e.getAttribute(`data-${n}`)}function Ab(e,n){if(e===void 0||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function jb(e,n,r){for(let i of n)r.has(i)||i.removeAttribute(e);for(let n of r)n.hasAttribute(e)||n.setAttribute(e,``);return r}let K=class extends n{constructor(...e){super(...e),this.selectionMode=`single`,this.interactionMode=`standard`,this.disableHoverTickle=!1,this.disableScrollHoverTickle=!1,this.itemSize=160,this.gap=8,this.orientation=`grid`,this.captionStyle=`under`,this.captionAlign=`middle`,this.captionPosition=`bottom`,this.captionBackdrop=`scrim`,this.captionHeight=24,this.itemWrap=`stop`,this.itemsDraggable=!1,this.marqueeFromCellBlank=!1,this.snapToItem=!1,this.items=[],this.groupBy=null,this.crossGroupSelection=!1,this.groupHeaderHeight=28,this.groupHeaderWidth=120,this._collapsedGroups=new Set,this._scrollTop=0,this._scrollLeft=0,this._viewportHeight=0,this._viewportWidth=0,this.#e=x(),this.#i=0,this.#a=0,this.#o=[],this.#s=`stop`,this.#c=new Map,this.#l=0,this.#u=new Set,this.#d=[],this.#f=new Map,this.#p=new Set,this.#m=0,this.#g=new Eb(this),this.#_=this.#g,this.selection=new tr({getOrderedItems:()=>this.#_.keys(),isSelectable:e=>{let n=this.#_.indexOfKey(e);return n>=0&&this.#_.isSelectable(n)},getModes:()=>({selectionMode:this.selectionMode,interactionMode:this.interactionMode}),getKey:e=>e,getGroupKey:e=>this.groupBy===null?null:this.#_.groupKeyOfKey(e),crossGroupSelection:()=>this.crossGroupSelection,getFallbackGroupKey:()=>{let e=this.tickled.tickledId;return e!==void 0&&this.groupBy!==null?this.#_.groupKeyOfKey(e):null},onChange:(e,n)=>{this._syncItemStates(),this.requestUpdate(),this.#ge(e,n)}}),this.tickled=new oe(this,{getItems:()=>this.#_.keys().map((e,n)=>({id:e,enabled:this.#_.isSelectable(n)})),onTickle:e=>{this.#Oe(),e!==void 0&&this.#_e(`list-tickle`,e)},onStateChange:()=>this._syncItemStates(),itemWrap:this.#s,hoverDisabled:()=>this.disableHoverTickle||this.#A.isDragging||this.#E.isDragging}),this.#v=!1,this.#y=NaN,this.#b=NaN,this.#x=new Set,this.#C=!1,this.#w=void 0,this.#T=0,this.#E=new $n(this,{source:`grid-list`,isEnabled:()=>this.itemsDraggable&&this.selectionMode!==`none`&&this.#_.count>0,resolveEventToKey:e=>{if(e instanceof Element){let n=(e.closest?.(`.cell`))?.dataset.key;if(n)return n;let r=(e.closest?.(`[data-key]`))?.dataset.key??e.dataset?.key??D(e);if(r)return r}},prepareSelection:e=>this.#O(e),getMetrics:()=>({itemSize:this.itemSize,captionStyle:this.captionStyle,captionHeight:this.captionHeight,rowHeight:this.#ee()}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>this._dispatch(`list-native-drag-start`,e,!0),onActiveChange:(e,n)=>{if(this.#C=e,this.#w=e?n:void 0,this.toggleAttribute(`data-native-dragging`,e),e){let e=[...this.selection.selectedKeys].filter(e=>!Cb(e)).length;this.setAttribute(`aria-label`,e<=1?`Dragging 1 item`:`Dragging ${e} items`)}else this.removeAttribute(`aria-label`);this.requestUpdate()},onEnd:()=>{this.#qe(),this.#Ke()},syncLightDomDraggable:()=>{for(let e of this.children)e instanceof HTMLElement&&(e.draggable=this.itemsDraggable)},shouldStart:e=>!(this.marqueeFromCellBlank&&this.#j(e))}),this.#k=null,this.#A=new Vn(this,{getSurface:()=>this.#e.value,isEnabled:()=>this.selection.canDragSelect()&&this.#_.count>0&&!this.hasAttribute(`disable-drag-select`),hitTest:e=>this.#M(e),getBaseSelection:()=>this.selection.selected,onPreview:(e,n)=>{this.#x=e,this.#S=n,this.requestUpdate()},onCommit:e=>{this.selection.applyDragSelection(e),this.#x=new Set,this.#S=void 0,this.requestUpdate()},autoScroll:(e,n)=>{let r=this.#e.value;r&&(e!==0&&(r.scrollLeft+=e,this._scrollLeft=r.scrollLeft),n!==0&&(r.scrollTop+=n,this._scrollTop=r.scrollTop))},shouldStart:e=>{if(this.marqueeFromCellBlank&&this.#j(e))return!0;for(let n of e.composedPath())if(n instanceof Element&&(n.classList.contains(`cell`)||n.classList.contains(`group-header`)))return!1;return!0}}),this.#Y=!1,this.#me=new Set,this.#he=new Set,this.#ve=new Set,this.#Ne=e=>{let n=e.target;this.#Ie(),this.#Be(),this.#i=requestAnimationFrame(()=>{this.#i=0,this._scrollTop=n.scrollTop,this._scrollLeft=n.scrollLeft,this.#K()}),this.#He()},this.#Pe=e=>{if(this.orientation!==`row`||e.ctrlKey||e.metaKey||e.deltaY===0)return;let n=this.#e.value??e.currentTarget;n&&(n.scrollWidth<=n.clientWidth+1||(this.#Ie(),n.scrollLeft+=e.deltaX+e.deltaY,e.preventDefault()))},this.#Re=e=>{let n=!Number.isNaN(this.#y)&&(e.clientX!==this.#y||e.clientY!==this.#b);if(this.#y=e.clientX,this.#b=e.clientY,!n||!this.#v||(this.#Le(),this.disableHoverTickle))return;let r=this.shadowRoot?.elementFromPoint?.(e.clientX,e.clientY)?.closest(`.cell`)?.getAttribute(`data-key`);r&&this.tickled.handlePointerEnter(r)},this.#ze=()=>{this.#Le()},this._onKeyDown=e=>{if((e.ctrlKey||e.metaKey)&&e.key===`f`)return;if((e.ctrlKey||e.metaKey)&&e.key===`a`){this.selection.canSelectAll()&&(e.preventDefault(),this.selection.selectAll());return}let n=this.#_.count;if(n===0)return;let r=this.#fe(),i=this.#de(),a=()=>this.tickled.tickledId?this.#_.indexOfKey(this.tickled.tickledId):-1,o=e=>{let n=this.#_.keyAt(e);n&&(this.tickled.handleKeyboardNavigation(n),this.#pe(n))},s=e=>o(Math.max(0,Math.min(n-1,a()+e))),c=(e,n=1)=>{let c=a();if(c<0){s(e*n*r.cols);return}for(let r=0;r<n;r++)c=i.neighbour(c,e);o(c)},l=this.orientation===`grid`?r.cols:1;switch(e.key){case`ArrowLeft`:s(-1);break;case`ArrowRight`:s(1);break;case`ArrowUp`:this.orientation===`grid`?c(-1):s(-l);break;case`ArrowDown`:this.orientation===`grid`?c(1):s(l);break;case`Home`:this.tickled.handleKeyboardNavigation(`first`),this.tickled.tickledId&&this.#pe(this.tickled.tickledId);break;case`End`:this.tickled.handleKeyboardNavigation(`last`),this.tickled.tickledId&&this.#pe(this.tickled.tickledId);break;case`PageUp`:case`PageDown`:{let n=r.horizontal?this._viewportWidth:this._viewportHeight,i=r.horizontal?r.colStride:r.rowStride,a=Math.max(1,Math.floor(n/i));this.orientation===`grid`?c(e.key===`PageDown`?1:-1,a):s((e.key===`PageDown`?1:-1)*a*l);break}case`Enter`:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.#_e(`list-item-click`,n),this.#Je(n));break}case` `:{let n=this.tickled.tickledId;n&&(e.preventDefault(),this.selection.handleSpace(n));break}case`Escape`:this.#C&&this.#qe(),this.selection.clear();break;default:return}e.preventDefault()}}static{this.styles=[w,se,C,Mg(`x`),Mg(`y`),Wn,Vt,r`
|
|
7506
7512
|
:host {
|
|
7507
7513
|
--grid-list-item-bg: var(--item-bg);
|
|
7508
7514
|
--grid-list-radius: var(--radius-m);
|
|
@@ -7888,7 +7894,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
7888
7894
|
.cell.dragging-origin {
|
|
7889
7895
|
opacity: 0.6;
|
|
7890
7896
|
}
|
|
7891
|
-
`]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D(e){let n=`.cell[data-key="${CSS.escape(e)}"]`;return this.renderRoot.querySelector(n)??void 0}#O(e){let n=this.#_.indexOfKey(e);if(n<0||!this.#_.isSelectable(n))return;this.selection.selectedKeys.has(e)||this.selection.replace(e);let r=this.#_.keys().filter(e=>!Cb(e)&&this.selection.selectedKeys.has(e)),i=[];for(let e of r){let n=this.#_.indexOfKey(e);if(n<0)continue;let r=this.#_.resolveKeyToData(e),a=this.#_.resolveKeyToElement(e),o=a??(this.#_ instanceof Db?this.#D(e):void 0),s=r??a;s!==void 0&&i.push({key:e,index:n,item:s,...o?{element:o}:{}})}let a=i.find(n=>n.key===e);if(a)return{origin:a,selected:i}}#k;#A;#j(e){for(let n of e.composedPath())if(n instanceof Element)return n.classList.contains(`caption`)||n.matches?.(`input,button,a,select,textarea,[contenteditable]`)?!1:n.classList.contains(`content`)||n.classList.contains(`thumb`)?!0:(n.classList.contains(`cell`),!1);return!1}#M(e){if(this.#_.count===0)return[];let n=this.orientation===`row`,r=e.x+this._scrollLeft,i=r+e.width,a=n?0:e.y+this._scrollTop,o=n?0:a+e.height,s=this.#de().hitTest(r,i,a,o),c=[];for(let e of s){let n=this.#_.keyAt(e);!n||Cb(n)||this.#_.isSelectable(e)&&c.push(n)}return c}#N;#P;#F(){let e=this.itemAdapter===void 0?`element`:`data`;if(this.#N===e&&this.search!==void 0)return;let n=this.search;n&&(n.hostDisconnected(),this.removeController(n)),this.search=e===`data`?new Vt(this,{adapter:kt(this,{rawCount:()=>this.#_?.rawCount??0,rawKeyAt:e=>this.#_?.rawKeyAt(e)??``,rawSearchTextAt:e=>this.#_?.rawSearchTextAt(e)??``,onFilterChange:e=>{this.#P=e,this.#_?.setFilters({searchKeys:e}),this.requestUpdate(),this.updateComplete.then(()=>this.#K())},onActivate:e=>this.#Je(e),getHighlightRoot:()=>this.renderRoot})}):new Vt(this,{adapter:Mt(this,{itemSelector:`:scope > *`,getLabel:e=>e.getAttribute(`data-label`)??e.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??e.getAttribute(`data-search-label`)??e.textContent?.trim()??``,highlightKey:`grid-list-search`})}),this.#N=e}#I;#L;get registry(){return this.#I}#R(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#z(){!this.#I||!this.search||(this.search.setModes(this.#R()),this.#L?.(),this.#L=Rt(this.#I,this.search))}connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.hasAttribute(`role`)||this.setAttribute(`role`,`listbox`),this.#$();for(let[e,n]of[[`caption-style`,this.captionStyle],[`caption-align`,this.captionAlign],[`caption-position`,this.captionPosition],[`caption-backdrop`,this.captionBackdrop]])this.hasAttribute(e)||this.setAttribute(e,n);this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`pointermove`,this.#Re,{passive:!0}),this.addEventListener(`pointerleave`,this.#ze),this.#n??=new MutationObserver(e=>this.#V(e)),this.#n.observe(this,{childList:!0}),this.#r??=new MutationObserver(e=>this.#B(e)),this.#r.observe(this,{subtree:!0,attributeFilter:[`hidden`,`data-key`,`data-value`]}),this.#I??=Yt(),this.#F(),this.#z()}disconnectedCallback(){super.disconnectedCallback(),this.#Oe(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`pointermove`,this.#Re),this.removeEventListener(`pointerleave`,this.#ze),this.#Le(),this.#t?.disconnect(),this.#t=void 0,this.#n?.disconnect(),this.#r?.disconnect(),this.#Be(),this.#Ve(),this.#L?.(),this.#L=void 0,this.#I=void 0,this.#m&&=(clearTimeout(this.#m),0),(this.#C||this.#E.isDragging)&&this.#qe()}#B(e){e.some(e=>e.target.parentNode===this)&&this.#V([])}#V(e){let n=this.#o.length;this.#ae();let r=[];for(let n of e??[])for(let e of n.removedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let n=D(e);n!==void 0&&r.push(n)}if(r.length>0){let e=new Set(this.#_.keys()),n=r.filter(n=>!e.has(n));n.length>0&&this.selection.removeKeys(n,e=>e);let i=this.tickled.tickledId;i&&n.includes(i)&&this.tickled.focus(void 0)}this._syncItemStates(!0),this.#H(n,e),this.requestUpdate(),this.updateComplete.then(()=>this.#K())}#H(e,n){if(!this.hasUpdated||!n||n.length===0)return;let r=new Set(this.#o),i=[],a=0;for(let e of n){for(let n of e.addedNodes)n.nodeType===Node.ELEMENT_NODE&&r.has(n)&&i.push(n);for(let n of e.removedNodes)n.nodeType===Node.ELEMENT_NODE&&a++}if((i.length!==0||a!==0)&&(e!==0||a!==0)&&!(i.length>0&&i.length===this.#o.length)){for(let e of i)this.#p.add(e);this.#U()}}#U(){this.toggleAttribute(`reflowing`,!0),this.#m&&clearTimeout(this.#m),this.#m=window.setTimeout(()=>{this.#m=0,this.#p.clear(),this.toggleAttribute(`reflowing`,!1),this.requestUpdate()},320)}#W;#G;#K(){let e=this.renderedKeys(),n=this.visibleKeys();Ab(this.#W,e)&&Ab(this.#G,n)||(this.#W=e,this.#G=n,this._dispatch(`grid-list-viewport-change`,{renderedKeys:e,visibleKeys:n}))}firstUpdated(){this.#_||this.#q();let e=this.#e.value;e&&(this.#t=new ResizeObserver(e=>{for(let n of e){let e=n.contentRect.width,r=n.contentRect.height;if(e<=0||r<=0)return;if(e===this._viewportWidth&&r===this._viewportHeight)continue;let i=this.orientation===`row`,a=i?this._scrollLeft:this._scrollTop,o=i?this._viewportWidth:this._viewportHeight;o>0&&a>1&&this.#re(a,o,this.itemSize,this.gap,this.captionStyle,this.captionHeight,this.orientation),this._viewportWidth=e,this._viewportHeight=r}}),this.#t.observe(e),this.#ie(!1),this.#ae(),this.requestUpdate(),this.#E.refreshDraggable())}#q(){this.itemAdapter===void 0?(this.#g=new Eb(this),this.#_=this.#g):(this.#_=new Db(this.items,this.itemAdapter),this.#g=void 0),this.#_.setGrouping(this.#X()),this.#J(),this.#P&&this.#_.setFilters({searchKeys:this.#P})}#J(){if(this.#_ instanceof Eb){let e=this.filterPredicate,n=this.#_;n.setFilters({predicate:e?r=>e(n.rawElementAt(r)):void 0}),this.#o=n.effectiveElements()}else if(this.#_ instanceof Db){let e=this.itemFilterPredicate,n=this.#_;n.setFilters({predicate:e?r=>e(n.rawItemAt(r),r):void 0})}}willUpdate(e){if(e.has(`searchModes`)&&this.#z(),(e.has(`filterPredicate`)||e.has(`itemFilterPredicate`))&&(this.#J(),this.updateComplete.then(()=>this.#K())),e.has(`items`)||e.has(`itemAdapter`)){this.#h=void 0;let e=this.#_?.keys()??[],n=this.itemAdapter!==void 0!=this.#_ instanceof Db;this.#q();let r=this.#_.keys(),i=new Set(r),a=e.filter(e=>!i.has(e));a.length>0&&this.selection.removeKeys(a,e=>e);let o=this.tickled.tickledId;o&&!i.has(o)&&this.tickled.focus(void 0),this._syncItemStates(),this.updateComplete.then(()=>this.#K()),n&&(this.#F(),this.#z()),this.search?.refresh()}let n=e.has(`groupBy`)||e.has(`groupLabel`)||e.has(`_collapsedGroups`);if(n&&this.hasUpdated?(e.has(`groupBy`)&&(this._collapsedGroups.size>0&&(this._collapsedGroups=new Set),this.#Y=!0),this.#Z(),this.#Q(),this.#U(),this.updateComplete.then(()=>this.#K())):n&&this.#Z(),(e.has(`itemSize`)||e.has(`gap`))&&(this.itemSize=Math.max(16,Math.round(this.itemSize)),this.gap=Math.max(0,Math.round(this.gap))),e.has(`captionHeight`)&&(this.captionHeight=Math.max(0,Math.round(this.captionHeight))),e.has(`itemWrap`)&&(this.#s=this.itemWrap),(e.has(`itemSize`)||e.has(`gap`)||e.has(`captionStyle`)||e.has(`captionHeight`)||e.has(`orientation`))&&this.hasUpdated&&this.#_.count>0){let n=e.get(`orientation`)??this.orientation,r=n===`row`,i=r?this._scrollLeft:this._scrollTop,a=r?this._viewportWidth:this._viewportHeight;if(a>0&&i>1){let r=e.get(`itemSize`)??this.itemSize,o=e.get(`gap`)??this.gap,s=e.get(`captionStyle`)??this.captionStyle,c=e.get(`captionHeight`)??this.captionHeight;this.#re(i,a,r,o,s,c,n)}}}#Y;#X(){let e=this.groupBy;if(e==null||e===``)return;let n=this._collapsedGroups,r=this.#_;if(r instanceof Db)return{groupKeyOf:n=>hn(e,r.rawItemAt(n),n,Ob),itemAt:e=>r.rawItemAt(e),labelOf:this.groupLabel,collapsed:n};let i=r;return{groupKeyOf:n=>hn(e,i.rawElementAt(n),n,kb),itemAt:e=>i.rawElementAt(e),labelOf:this.groupLabel,collapsed:n}}#Z(){this.#_.setGrouping(this.#X()),this.#_ instanceof Eb&&(this.#o=this.#_.effectiveElements())}#Q(){let e=this.tickled.tickledId;e!==void 0&&this.#_.indexOfKey(e)<0&&this.tickled.focus(void 0)}get groups(){return this.groupBy===null?[]:this.#_.groups()}setGroupCollapsed(e,n){if(this._collapsedGroups.has(e)===n)return;let r=new Set(this._collapsedGroups);n?r.add(e):r.delete(e),this._collapsedGroups=r,this._dispatch(`list-group-toggle`,{groupKey:e,collapsed:n})}toggleGroup(e){this.setGroupCollapsed(e,!this._collapsedGroups.has(e))}collapseAllGroups(){for(let e of this.groups)this.setGroupCollapsed(e.key,!0)}expandAllGroups(){for(let e of[...this._collapsedGroups])this.setGroupCollapsed(e,!1)}#$(){this.setAttribute(`aria-multiselectable`,this.selection.canSelectMultiple()?`true`:`false`)}#ee(){let e=this.captionStyle===`separate`||this.captionStyle===`under`;return this.itemSize+(e?this.captionHeight:0)}#te(e){return e.getAttribute(`data-label`)??e.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??``}updated(e){super.updated(e);let n=this.#n?.takeRecords(),r=this.#r?.takeRecords();if(n!==void 0&&n.length>0?this.#V(n):r!==void 0&&r.length>0&&this.#B(r),this.#_ instanceof Eb&&this.#Se(),(e.has(`selectionMode`)||e.has(`interactionMode`))&&(this.selection.clearAnchor(),this.#$()),e.has(`disableScrollHoverTickle`)&&!this.disableScrollHoverTickle&&this.#Le(),e.has(`itemsDraggable`)&&this.#E.refreshDraggable(),e.has(`orientation`)){let e=this.#e.value;e&&(this.orientation===`row`?(e.scrollTop=0,this._scrollTop=0):(e.scrollLeft=0,this._scrollLeft=0))}let i=this.#e.value;i&&(Math.abs(i.scrollTop-this._scrollTop)>.5&&(i.scrollTop=this._scrollTop),Math.abs(i.scrollLeft-this._scrollLeft)>.5&&(i.scrollLeft=this._scrollLeft)),this.#ne(),this.#ke(),this.#Y&&(this.#Y=!1,this._dispatch(`list-group-change`,{groupBy:this.groupBy}))}#ne(){if(!this.#h)return;let{index:e,lineFrac:n}=this.#h;this.#h=void 0;let r=this.#e.value;if(!r)return;let i=this.#de(),a=i.horizontal,o=a?this._viewportWidth:this._viewportHeight;if(o<=0)return;let s=i.offsetOfAnchor(e,n),c=Math.max(0,i.totalExtent-o),l=Math.min(c,Math.max(0,s-o/2));a?Math.abs(r.scrollLeft-l)>.5&&(r.scrollLeft=l,this._scrollLeft=l):Math.abs(r.scrollTop-l)>.5&&(r.scrollTop=l,this._scrollTop=l)}#re(e,n,r,i,a,o,s){if((this.#_?.count??0)===0)return;let c=r+(a===`separate`||a===`under`?o:0),l=this.#le({itemWidth:r,rowHeight:c,gap:i,orientation:s});this.#h=l.anchorAt(e+n/2)}refreshLayout(){this.#ie(!0)}remeasure(){this.#ie(!0)}#ie(e=!1){let n=this.#e.value;if(!n)return;let r=n.clientWidth,i=n.clientHeight;if(r<=0||i<=0)return;let a=this.orientation===`row`,o=r!==this._viewportWidth||i!==this._viewportHeight;if(o){let e=a?this._scrollLeft:this._scrollTop,n=a?r:i;this.#re(e,n,this.itemSize,this.gap,this.captionStyle,this.captionHeight,this.orientation),this._viewportWidth=r,this._viewportHeight=i}e&&!o&&(this.#re(a?this._scrollLeft:this._scrollTop,a?r:i,this.itemSize,this.gap,this.captionStyle,this.captionHeight,this.orientation),this.requestUpdate()),(o||e)&&this.updateComplete.then(()=>this.#K())}#ae(){this.#_ instanceof Eb&&(this.#_.refresh(),this.#J())}get count(){return this.#_.count}get renderedCount(){return this.renderRoot.querySelectorAll(`.cell`).length}get selectedItems(){let e=new Set;for(let n of this.selection.selectedKeys){let r=this.#_.resolveKeyToElement(n);r&&e.add(r)}return e}get selectedKeys(){let e=new Set;for(let n of this.selection.selectedKeys)Cb(n)||e.add(n);return e}select(e){let n=D(e);n&&this.selection.replace(n)}selectMany(e){let n=[];for(let r of e){let e=D(r);e&&n.push(e)}this.selection.selectMany(n)}deselect(e){let n=D(e);n&&this.selection.deselect(n)}clearSelection(){this.selection.clear()}selectAll(){this.selection.canSelectAll()&&this.selection.selectAll()}selectKeys(e){this.selection.selectKeys(e,e=>e)}addSelectedKeys(e){this.selection.addKeys(e,e=>e)}removeSelectedKeys(e){this.selection.removeKeys(e,e=>e)}#oe(e){let n=this.itemAdapter;return n?this.items.findIndex((r,i)=>n.key(r,i)===e):-1}setItems(e){this.itemAdapter&&(this.items=e)}appendItems(e){this.itemAdapter&&e.length>0&&(this.items=[...this.items,...e])}updateItem(e,n){if(!this.itemAdapter)return;let r=this.#oe(e);if(r<0)return;let i=[...this.items];i[r]=n,this.items=i}removeItems(e){if(!this.itemAdapter)return;let n=this.itemAdapter,r=new Set(e);this.items=this.items.filter((e,i)=>!r.has(n.key(e,i)))}clearItems(){this.itemAdapter&&(this.selection.reset(),this.tickled.focus(void 0),this.items=[],this.#ge(new Set,new Set))}focusKey(e){this.#_.indexOfKey(e)<0||(this.tickled.focus(e),this.#pe(e))}get tickledKey(){return this.tickled.tickledId}getItem(e){return this.#_.resolveKeyToElement(e)}getItemByIndex(e){return this.#o[e]}getData(e){return this.#_.resolveKeyToData(e)}getKey(e){return D(e)}renderedKeys(){return this.#se(this.#fe())}visibleKeys(){return this.#se(this.#fe(!0))}#se(e){let n=this.#_.keys(),r=[];for(let[i,a]of e.ranges)for(let e=i;e<a;e++)Cb(n[e])||r.push(n[e]);return r}#ce(e={}){return{count:this.#_.count,groups:this.groupBy===null?void 0:this.#_.groups(),itemWidth:this.itemSize,rowHeight:this.#ee(),gap:this.gap,viewportWidth:this._viewportWidth,viewportHeight:this._viewportHeight,orientation:this.orientation,headerHeight:this.groupHeaderHeight,headerWidth:this.groupHeaderWidth,...e}}#le(e={}){return bb(this.#ce(e))}#ue;#de(){let e=this.#ce(),n=this.#ue;if(n){let r=n.params,i=r.groups===e.groups;for(let n of Object.keys(e)){if(!i)break;i=r[n]===e[n]}if(i)return n.layout}let r=bb(e);return this.#ue={params:e,layout:r},r}#fe(e=!1){return this.#de().window(this.orientation===`row`?this._scrollLeft:this._scrollTop,e?0:2)}#pe(e){let n=this.#_.indexOfKey(e),r=this.#e.value;if(n<0||!r)return;let[i,a]=this.#de().extentOf(n);if(this.orientation===`row`){let e=r.scrollLeft,n=e;i<e?n=i:a>e+this._viewportWidth&&(n=a-this._viewportWidth),n!==e&&(r.scrollLeft=n,this._scrollLeft=n);return}let o=r.scrollTop,s=o;i<o?s=i:a>o+this._viewportHeight&&(s=a-this._viewportHeight),s!==o&&(r.scrollTop=s,this._scrollTop=s)}#me;#he;_syncItemStates(e=!1){let n=this.selection.selectedKeys,r=this.tickled.tickledId,i=e=>{if(Cb(e))return;let n=this.#_.indexOfKey(e);return n<0?void 0:this.#o[n]},a=r===void 0?void 0:i(r),o=new Set;for(let e of n){let n=i(e);n&&o.add(n)}if(e)for(let e of this.#o)this.#me.add(e),this.#he.add(e);this.#me=jb(`data-tickled`,this.#me,a?new Set([a]):new Set),this.#he=jb(`data-selected`,this.#he,o),this.setAttribute(`data-input-mode`,this.tickled.inputMode)}#ge(e,n){let r=new Set,i=new Set;for(let n of e){let e=this.#_.resolveKeyToElement(n);e&&r.add(e)}for(let e of n){let n=this.#_.resolveKeyToElement(e);n&&i.add(n)}this._dispatch(`list-select`,{selected:r,previous:i,selectedKeys:this.selectedKeys,previousKeys:new Set([...n].filter(e=>!Cb(e)))})}#_e(e,n){let r=this.#_.indexOfKey(n),i=this.#_.resolveKeyToElement(n),a=i??this.#_.resolveKeyToData(n);this._dispatch(e,{item:a,key:n,index:r,element:i})}_dispatch(e,n,r=!1){return this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:r}))}#ve;#ye(e){return`left:${e.x}px;top:${e.y}px;width:${Math.max(0,e.width)}px;height:${Math.max(0,e.height)}px`}render(){let e=this.#fe();this.#ve=this.selection.selectedKeys;let n=e.horizontal?`width:${e.totalWidth}px;height:100%`:`height:${e.totalHeight}px`,r=e.horizontal?`scroll-fade-x`:`scroll-fade-y`;return i`
|
|
7897
|
+
`]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;#D(e){let n=`.cell[data-key="${CSS.escape(e)}"]`;return this.renderRoot.querySelector(n)??void 0}#O(e){let n=this.#_.indexOfKey(e);if(n<0||!this.#_.isSelectable(n))return;this.selection.selectedKeys.has(e)||this.selection.replace(e);let r=this.#_.keys().filter(e=>!Cb(e)&&this.selection.selectedKeys.has(e)),i=[];for(let e of r){let n=this.#_.indexOfKey(e);if(n<0)continue;let r=this.#_.resolveKeyToData(e),a=this.#_.resolveKeyToElement(e),o=a??(this.#_ instanceof Db?this.#D(e):void 0),s=r??a;s!==void 0&&i.push({key:e,index:n,item:s,...o?{element:o}:{}})}let a=i.find(n=>n.key===e);if(a)return{origin:a,selected:i}}#k;#A;#j(e){for(let n of e.composedPath())if(n instanceof Element)return n.classList.contains(`caption`)||n.matches?.(`input,button,a,select,textarea,[contenteditable]`)?!1:n.classList.contains(`content`)||n.classList.contains(`thumb`)?!0:(n.classList.contains(`cell`),!1);return!1}#M(e){if(this.#_.count===0)return[];let n=this.orientation===`row`,r=e.x+this._scrollLeft,i=r+e.width,a=n?0:e.y+this._scrollTop,o=n?0:a+e.height,s=this.#de().hitTest(r,i,a,o),c=[];for(let e of s){let n=this.#_.keyAt(e);!n||Cb(n)||this.#_.isSelectable(e)&&c.push(n)}return c}#N;#P;#F(){let e=this.itemAdapter===void 0?`element`:`data`;if(this.#N===e&&this.search!==void 0)return;let n=this.search;n&&(n.hostDisconnected(),this.removeController(n)),this.search=e===`data`?new Bt(this,{adapter:kt(this,{rawCount:()=>this.#_?.rawCount??0,rawKeyAt:e=>this.#_?.rawKeyAt(e)??``,rawSearchTextAt:e=>this.#_?.rawSearchTextAt(e)??``,onFilterChange:e=>{this.#P=e,this.#_?.setFilters({searchKeys:e}),this.requestUpdate(),this.updateComplete.then(()=>this.#K())},onActivate:e=>this.#Je(e),getHighlightRoot:()=>this.renderRoot})}):new Bt(this,{adapter:Mt(this,{itemSelector:`:scope > *`,getLabel:e=>e.getAttribute(`data-label`)??e.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??e.getAttribute(`data-search-label`)??e.textContent?.trim()??``,highlightKey:`grid-list-search`})}),this.#N=e}#I;#L;get registry(){return this.#I}#R(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#z(){!this.#I||!this.search||(this.search.setModes(this.#R()),this.#L?.(),this.#L=Rt(this.#I,this.search))}connectedCallback(){super.connectedCallback(),this.hasAttribute(`tabindex`)||(this.tabIndex=0),this.hasAttribute(`role`)||this.setAttribute(`role`,`listbox`),this.#$();for(let[e,n]of[[`caption-style`,this.captionStyle],[`caption-align`,this.captionAlign],[`caption-position`,this.captionPosition],[`caption-backdrop`,this.captionBackdrop]])this.hasAttribute(e)||this.setAttribute(e,n);this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`pointermove`,this.#Re,{passive:!0}),this.addEventListener(`pointerleave`,this.#ze),this.#n??=new MutationObserver(e=>this.#V(e)),this.#n.observe(this,{childList:!0}),this.#r??=new MutationObserver(e=>this.#B(e)),this.#r.observe(this,{subtree:!0,attributeFilter:[`hidden`,`data-key`,`data-value`]}),this.#I??=Jt(),this.#F(),this.#z()}disconnectedCallback(){super.disconnectedCallback(),this.#Oe(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`pointermove`,this.#Re),this.removeEventListener(`pointerleave`,this.#ze),this.#Le(),this.#t?.disconnect(),this.#t=void 0,this.#n?.disconnect(),this.#r?.disconnect(),this.#Be(),this.#Ve(),this.#L?.(),this.#L=void 0,this.#I=void 0,this.#m&&=(clearTimeout(this.#m),0),(this.#C||this.#E.isDragging)&&this.#qe()}#B(e){e.some(e=>e.target.parentNode===this)&&this.#V([])}#V(e){let n=this.#o.length;this.#ae();let r=[];for(let n of e??[])for(let e of n.removedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let n=D(e);n!==void 0&&r.push(n)}if(r.length>0){let e=new Set(this.#_.keys()),n=r.filter(n=>!e.has(n));n.length>0&&this.selection.removeKeys(n,e=>e);let i=this.tickled.tickledId;i&&n.includes(i)&&this.tickled.focus(void 0)}this._syncItemStates(!0),this.#H(n,e),this.requestUpdate(),this.updateComplete.then(()=>this.#K())}#H(e,n){if(!this.hasUpdated||!n||n.length===0)return;let r=new Set(this.#o),i=[],a=0;for(let e of n){for(let n of e.addedNodes)n.nodeType===Node.ELEMENT_NODE&&r.has(n)&&i.push(n);for(let n of e.removedNodes)n.nodeType===Node.ELEMENT_NODE&&a++}if((i.length!==0||a!==0)&&(e!==0||a!==0)&&!(i.length>0&&i.length===this.#o.length)){for(let e of i)this.#p.add(e);this.#U()}}#U(){this.toggleAttribute(`reflowing`,!0),this.#m&&clearTimeout(this.#m),this.#m=window.setTimeout(()=>{this.#m=0,this.#p.clear(),this.toggleAttribute(`reflowing`,!1),this.requestUpdate()},320)}#W;#G;#K(){let e=this.renderedKeys(),n=this.visibleKeys();Ab(this.#W,e)&&Ab(this.#G,n)||(this.#W=e,this.#G=n,this._dispatch(`grid-list-viewport-change`,{renderedKeys:e,visibleKeys:n}))}firstUpdated(){this.#_||this.#q();let e=this.#e.value;e&&(this.#t=new ResizeObserver(e=>{for(let n of e){let e=n.contentRect.width,r=n.contentRect.height;if(e<=0||r<=0)return;if(e===this._viewportWidth&&r===this._viewportHeight)continue;let i=this.orientation===`row`,a=i?this._scrollLeft:this._scrollTop,o=i?this._viewportWidth:this._viewportHeight;o>0&&a>1&&this.#re(a,o,this.itemSize,this.gap,this.captionStyle,this.captionHeight,this.orientation),this._viewportWidth=e,this._viewportHeight=r}}),this.#t.observe(e),this.#ie(!1),this.#ae(),this.requestUpdate(),this.#E.refreshDraggable())}#q(){this.itemAdapter===void 0?(this.#g=new Eb(this),this.#_=this.#g):(this.#_=new Db(this.items,this.itemAdapter),this.#g=void 0),this.#_.setGrouping(this.#X()),this.#J(),this.#P&&this.#_.setFilters({searchKeys:this.#P})}#J(){if(this.#_ instanceof Eb){let e=this.filterPredicate,n=this.#_;n.setFilters({predicate:e?r=>e(n.rawElementAt(r)):void 0}),this.#o=n.effectiveElements()}else if(this.#_ instanceof Db){let e=this.itemFilterPredicate,n=this.#_;n.setFilters({predicate:e?r=>e(n.rawItemAt(r),r):void 0})}}willUpdate(e){if(e.has(`searchModes`)&&this.#z(),(e.has(`filterPredicate`)||e.has(`itemFilterPredicate`))&&(this.#J(),this.updateComplete.then(()=>this.#K())),e.has(`items`)||e.has(`itemAdapter`)){this.#h=void 0;let e=this.#_?.keys()??[],n=this.itemAdapter!==void 0!=this.#_ instanceof Db;this.#q();let r=this.#_.keys(),i=new Set(r),a=e.filter(e=>!i.has(e));a.length>0&&this.selection.removeKeys(a,e=>e);let o=this.tickled.tickledId;o&&!i.has(o)&&this.tickled.focus(void 0),this._syncItemStates(),this.updateComplete.then(()=>this.#K()),n&&(this.#F(),this.#z()),this.search?.refresh()}let n=e.has(`groupBy`)||e.has(`groupLabel`)||e.has(`_collapsedGroups`);if(n&&this.hasUpdated?(e.has(`groupBy`)&&(this._collapsedGroups.size>0&&(this._collapsedGroups=new Set),this.#Y=!0),this.#Z(),this.#Q(),this.#U(),this.updateComplete.then(()=>this.#K())):n&&this.#Z(),(e.has(`itemSize`)||e.has(`gap`))&&(this.itemSize=Math.max(16,Math.round(this.itemSize)),this.gap=Math.max(0,Math.round(this.gap))),e.has(`captionHeight`)&&(this.captionHeight=Math.max(0,Math.round(this.captionHeight))),e.has(`itemWrap`)&&(this.#s=this.itemWrap),(e.has(`itemSize`)||e.has(`gap`)||e.has(`captionStyle`)||e.has(`captionHeight`)||e.has(`orientation`))&&this.hasUpdated&&this.#_.count>0){let n=e.get(`orientation`)??this.orientation,r=n===`row`,i=r?this._scrollLeft:this._scrollTop,a=r?this._viewportWidth:this._viewportHeight;if(a>0&&i>1){let r=e.get(`itemSize`)??this.itemSize,o=e.get(`gap`)??this.gap,s=e.get(`captionStyle`)??this.captionStyle,c=e.get(`captionHeight`)??this.captionHeight;this.#re(i,a,r,o,s,c,n)}}}#Y;#X(){let e=this.groupBy;if(e==null||e===``)return;let n=this._collapsedGroups,r=this.#_;if(r instanceof Db)return{groupKeyOf:n=>mn(e,r.rawItemAt(n),n,Ob),itemAt:e=>r.rawItemAt(e),labelOf:this.groupLabel,collapsed:n};let i=r;return{groupKeyOf:n=>mn(e,i.rawElementAt(n),n,kb),itemAt:e=>i.rawElementAt(e),labelOf:this.groupLabel,collapsed:n}}#Z(){this.#_.setGrouping(this.#X()),this.#_ instanceof Eb&&(this.#o=this.#_.effectiveElements())}#Q(){let e=this.tickled.tickledId;e!==void 0&&this.#_.indexOfKey(e)<0&&this.tickled.focus(void 0)}get groups(){return this.groupBy===null?[]:this.#_.groups()}setGroupCollapsed(e,n){if(this._collapsedGroups.has(e)===n)return;let r=new Set(this._collapsedGroups);n?r.add(e):r.delete(e),this._collapsedGroups=r,this._dispatch(`list-group-toggle`,{groupKey:e,collapsed:n})}toggleGroup(e){this.setGroupCollapsed(e,!this._collapsedGroups.has(e))}collapseAllGroups(){for(let e of this.groups)this.setGroupCollapsed(e.key,!0)}expandAllGroups(){for(let e of[...this._collapsedGroups])this.setGroupCollapsed(e,!1)}#$(){this.setAttribute(`aria-multiselectable`,this.selection.canSelectMultiple()?`true`:`false`)}#ee(){let e=this.captionStyle===`separate`||this.captionStyle===`under`;return this.itemSize+(e?this.captionHeight:0)}#te(e){return e.getAttribute(`data-label`)??e.querySelector(`[data-grid-list-caption]`)?.textContent?.trim()??``}updated(e){super.updated(e);let n=this.#n?.takeRecords(),r=this.#r?.takeRecords();if(n!==void 0&&n.length>0?this.#V(n):r!==void 0&&r.length>0&&this.#B(r),this.#_ instanceof Eb&&this.#Se(),(e.has(`selectionMode`)||e.has(`interactionMode`))&&(this.selection.clearAnchor(),this.#$()),e.has(`disableScrollHoverTickle`)&&!this.disableScrollHoverTickle&&this.#Le(),e.has(`itemsDraggable`)&&this.#E.refreshDraggable(),e.has(`orientation`)){let e=this.#e.value;e&&(this.orientation===`row`?(e.scrollTop=0,this._scrollTop=0):(e.scrollLeft=0,this._scrollLeft=0))}let i=this.#e.value;i&&(Math.abs(i.scrollTop-this._scrollTop)>.5&&(i.scrollTop=this._scrollTop),Math.abs(i.scrollLeft-this._scrollLeft)>.5&&(i.scrollLeft=this._scrollLeft)),this.#ne(),this.#ke(),this.#Y&&(this.#Y=!1,this._dispatch(`list-group-change`,{groupBy:this.groupBy}))}#ne(){if(!this.#h)return;let{index:e,lineFrac:n}=this.#h;this.#h=void 0;let r=this.#e.value;if(!r)return;let i=this.#de(),a=i.horizontal,o=a?this._viewportWidth:this._viewportHeight;if(o<=0)return;let s=i.offsetOfAnchor(e,n),c=Math.max(0,i.totalExtent-o),l=Math.min(c,Math.max(0,s-o/2));a?Math.abs(r.scrollLeft-l)>.5&&(r.scrollLeft=l,this._scrollLeft=l):Math.abs(r.scrollTop-l)>.5&&(r.scrollTop=l,this._scrollTop=l)}#re(e,n,r,i,a,o,s){if((this.#_?.count??0)===0)return;let c=r+(a===`separate`||a===`under`?o:0),l=this.#le({itemWidth:r,rowHeight:c,gap:i,orientation:s});this.#h=l.anchorAt(e+n/2)}refreshLayout(){this.#ie(!0)}remeasure(){this.#ie(!0)}#ie(e=!1){let n=this.#e.value;if(!n)return;let r=n.clientWidth,i=n.clientHeight;if(r<=0||i<=0)return;let a=this.orientation===`row`,o=r!==this._viewportWidth||i!==this._viewportHeight;if(o){let e=a?this._scrollLeft:this._scrollTop,n=a?r:i;this.#re(e,n,this.itemSize,this.gap,this.captionStyle,this.captionHeight,this.orientation),this._viewportWidth=r,this._viewportHeight=i}e&&!o&&(this.#re(a?this._scrollLeft:this._scrollTop,a?r:i,this.itemSize,this.gap,this.captionStyle,this.captionHeight,this.orientation),this.requestUpdate()),(o||e)&&this.updateComplete.then(()=>this.#K())}#ae(){this.#_ instanceof Eb&&(this.#_.refresh(),this.#J())}get count(){return this.#_.count}get renderedCount(){return this.renderRoot.querySelectorAll(`.cell`).length}get selectedItems(){let e=new Set;for(let n of this.selection.selectedKeys){let r=this.#_.resolveKeyToElement(n);r&&e.add(r)}return e}get selectedKeys(){let e=new Set;for(let n of this.selection.selectedKeys)Cb(n)||e.add(n);return e}select(e){let n=D(e);n&&this.selection.replace(n)}selectMany(e){let n=[];for(let r of e){let e=D(r);e&&n.push(e)}this.selection.selectMany(n)}deselect(e){let n=D(e);n&&this.selection.deselect(n)}clearSelection(){this.selection.clear()}selectAll(){this.selection.canSelectAll()&&this.selection.selectAll()}selectKeys(e){this.selection.selectKeys(e,e=>e)}addSelectedKeys(e){this.selection.addKeys(e,e=>e)}removeSelectedKeys(e){this.selection.removeKeys(e,e=>e)}#oe(e){let n=this.itemAdapter;return n?this.items.findIndex((r,i)=>n.key(r,i)===e):-1}setItems(e){this.itemAdapter&&(this.items=e)}appendItems(e){this.itemAdapter&&e.length>0&&(this.items=[...this.items,...e])}updateItem(e,n){if(!this.itemAdapter)return;let r=this.#oe(e);if(r<0)return;let i=[...this.items];i[r]=n,this.items=i}removeItems(e){if(!this.itemAdapter)return;let n=this.itemAdapter,r=new Set(e);this.items=this.items.filter((e,i)=>!r.has(n.key(e,i)))}clearItems(){this.itemAdapter&&(this.selection.reset(),this.tickled.focus(void 0),this.items=[],this.#ge(new Set,new Set))}focusKey(e){this.#_.indexOfKey(e)<0||(this.tickled.focus(e),this.#pe(e))}get tickledKey(){return this.tickled.tickledId}getItem(e){return this.#_.resolveKeyToElement(e)}getItemByIndex(e){return this.#o[e]}getData(e){return this.#_.resolveKeyToData(e)}getKey(e){return D(e)}renderedKeys(){return this.#se(this.#fe())}visibleKeys(){return this.#se(this.#fe(!0))}#se(e){let n=this.#_.keys(),r=[];for(let[i,a]of e.ranges)for(let e=i;e<a;e++)Cb(n[e])||r.push(n[e]);return r}#ce(e={}){return{count:this.#_.count,groups:this.groupBy===null?void 0:this.#_.groups(),itemWidth:this.itemSize,rowHeight:this.#ee(),gap:this.gap,viewportWidth:this._viewportWidth,viewportHeight:this._viewportHeight,orientation:this.orientation,headerHeight:this.groupHeaderHeight,headerWidth:this.groupHeaderWidth,...e}}#le(e={}){return bb(this.#ce(e))}#ue;#de(){let e=this.#ce(),n=this.#ue;if(n){let r=n.params,i=r.groups===e.groups;for(let n of Object.keys(e)){if(!i)break;i=r[n]===e[n]}if(i)return n.layout}let r=bb(e);return this.#ue={params:e,layout:r},r}#fe(e=!1){return this.#de().window(this.orientation===`row`?this._scrollLeft:this._scrollTop,e?0:2)}#pe(e){let n=this.#_.indexOfKey(e),r=this.#e.value;if(n<0||!r)return;let[i,a]=this.#de().extentOf(n);if(this.orientation===`row`){let e=r.scrollLeft,n=e;i<e?n=i:a>e+this._viewportWidth&&(n=a-this._viewportWidth),n!==e&&(r.scrollLeft=n,this._scrollLeft=n);return}let o=r.scrollTop,s=o;i<o?s=i:a>o+this._viewportHeight&&(s=a-this._viewportHeight),s!==o&&(r.scrollTop=s,this._scrollTop=s)}#me;#he;_syncItemStates(e=!1){let n=this.selection.selectedKeys,r=this.tickled.tickledId,i=e=>{if(Cb(e))return;let n=this.#_.indexOfKey(e);return n<0?void 0:this.#o[n]},a=r===void 0?void 0:i(r),o=new Set;for(let e of n){let n=i(e);n&&o.add(n)}if(e)for(let e of this.#o)this.#me.add(e),this.#he.add(e);this.#me=jb(`data-tickled`,this.#me,a?new Set([a]):new Set),this.#he=jb(`data-selected`,this.#he,o),this.setAttribute(`data-input-mode`,this.tickled.inputMode)}#ge(e,n){let r=new Set,i=new Set;for(let n of e){let e=this.#_.resolveKeyToElement(n);e&&r.add(e)}for(let e of n){let n=this.#_.resolveKeyToElement(e);n&&i.add(n)}this._dispatch(`list-select`,{selected:r,previous:i,selectedKeys:this.selectedKeys,previousKeys:new Set([...n].filter(e=>!Cb(e)))})}#_e(e,n){let r=this.#_.indexOfKey(n),i=this.#_.resolveKeyToElement(n),a=i??this.#_.resolveKeyToData(n);this._dispatch(e,{item:a,key:n,index:r,element:i})}_dispatch(e,n,r=!1){return this.dispatchEvent(new CustomEvent(e,{detail:n,bubbles:!0,composed:!0,cancelable:r}))}#ve;#ye(e){return`left:${e.x}px;top:${e.y}px;width:${Math.max(0,e.width)}px;height:${Math.max(0,e.height)}px`}render(){let e=this.#fe();this.#ve=this.selection.selectedKeys;let n=e.horizontal?`width:${e.totalWidth}px;height:100%`:`height:${e.totalHeight}px`,r=e.horizontal?`scroll-fade-x`:`scroll-fade-y`;return i`
|
|
7892
7898
|
<div
|
|
7893
7899
|
class="viewport ${r}"
|
|
7894
7900
|
part="viewport"
|
|
@@ -8120,7 +8126,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
8120
8126
|
height: 100%;
|
|
8121
8127
|
transform: none;
|
|
8122
8128
|
}
|
|
8123
|
-
`]}};E([d({type:Boolean,reflect:!0})],Mb.prototype,`collapsed`,void 0),E([d({type:String,attribute:`orientation`,reflect:!0})],Mb.prototype,`orientation`,void 0),E([d({type:Boolean})],Mb.prototype,`closable`,void 0),E([d({type:Boolean,reflect:!0})],Mb.prototype,`collapsible`,void 0),E([d({type:String})],Mb.prototype,`title`,void 0),E([d({type:String,attribute:`icon-name`})],Mb.prototype,`iconName`,void 0),E([d({type:String,attribute:`toggle-interaction`})],Mb.prototype,`toggleInteraction`,void 0),E([d({type:String,attribute:`variant`,reflect:!0})],Mb.prototype,`variant`,void 0),E([d({type:Boolean,attribute:`hide-titlebar`})],Mb.prototype,`hideTitlebar`,void 0),E([d({type:Boolean,attribute:`keep-toolbar`})],Mb.prototype,`keepToolbar`,void 0),E([d({type:Boolean,attribute:`sticky-header`,reflect:!0})],Mb.prototype,`stickyHeader`,void 0),Mb=E([T(`ixfx-panel`)],Mb);const Nb=`__ungrouped__`;let Pb=class extends n{constructor(...e){super(...e),this.grouped=!1,this.crossGroupSelection=!1,this.#n=new Map,this.#i=!1,this.#a=new je(this),this.#d=e=>{if(this.#i)return;let n=e.target,r;for(let[e,i]of this.#n)if(i===n){r=e;break}if(r!==void 0){if(this.grouped&&!this.crossGroupSelection){this.#i=!0;for(let[e,n]of this.#n)e!==r&&n.clearSelection();this.#i=!1}this.dispatchEvent(new CustomEvent(`grouped-select`,{detail:{selected:this.selectedItems,groupKey:r===Nb?void 0:r},bubbles:!0,composed:!0}))}}}#e;#t;#n;#r;#i;#a;get groupBy(){return this.#e}set groupBy(e){this.#e=e,this.requestUpdate()}get factory(){return this.#t}set factory(e){e!==this.#t&&(this.#s(),this.#t=e,this.requestUpdate())}get provider(){return this.#a.provider}set provider(e){this.#a.provider=e,e&&this.#a.request(void 0)}get selectedItems(){let e=new Set;for(let n of this.#n.values())for(let r of n.selectedItems)e.add(r);return e}dispatch(e,n){for(let r of this.#n.values())r.dispatch(e,n)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.addEventListener(`select`,this.#d)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`select`,this.#d)}updated(e){super.updated(e),e.has(`grouped`)&&this.#s(),this.#c()}render(){return this.#t?this.grouped?this.#e?(this.#r=this.#o(),i`${_(this.#r.keys(),e=>e,e=>i`<ixfx-panel data-group-key=${e} .title=${e}></ixfx-panel>`)}`):a:i`<div class="ungrouped-host"></div>`:a}#o(){let e=new Map;if(!this.#e)return e;for(let n of this.#a.items){let r=this.#e(n),i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return e}#s(){for(let e of this.#n.values())e.remove();this.#n.clear()}#c(){if(this.#t){if(!this.grouped){this.#l();return}this.#e&&this.#u()}}#l(){let e=this.querySelector(`.ungrouped-host`);if(!e)return;let n=this.#n.get(Nb);n||(n=this.#t(void 0),e.appendChild(n),this.#n.set(Nb,n)),n.setItems(this.#a.items)}#u(){let e=this.#r??this.#o();for(let n of[...this.#n.keys()])e.has(n)||(this.#n.get(n)?.remove(),this.#n.delete(n));for(let[n,r]of e){let e=[...this.children].find(e=>e instanceof HTMLElement&&e.dataset.groupKey===n);if(!e)continue;let i=this.#n.get(n);i||(i=this.#t(n),e.appendChild(i),this.#n.set(n,i)),i.setItems(r)}}#d};E([d({type:Boolean,reflect:!0})],Pb.prototype,`grouped`,void 0),E([d({type:Boolean,attribute:`cross-group-selection`,reflect:!0})],Pb.prototype,`crossGroupSelection`,void 0),Pb=E([T(`ixfx-grouped-item-lister`)],Pb);const Fb=`application/x-ixfx-tree`,Ib=new Map,Lb=new Map;let Rb,zb=0;function Bb(){return`tree-drag-${++zb}-${Date.now()}`}function Vb(e,n,r,i){Ib.set(e,{sourceId:e,nodes:r,keys:i}),Lb.set(e,new WeakRef(n)),Rb=e}function Hb(e){Ib.delete(e),Lb.delete(e),Rb===e&&(Rb=void 0)}function Ub(){if(Rb===void 0)return;let e=Ib.get(Rb);if(e)return{sourceId:Rb,keys:e.keys,nodes:e.nodes,element:Lb.get(Rb)?.deref()}}const Wb={direction:0,depth:0};function Gb(e){return Math.min(e/2,Math.max(24,Math.min(64,e*.2)))}function Kb(e,n){if(n<=0)return Wb;let r=Gb(n);return e<r?{direction:-1,depth:Math.min(1,(r-e)/r)}:e>n-r?{direction:1,depth:Math.min(1,(e-(n-r))/r)}:Wb}function qb(e,n){let r=Math.min(1,Math.max(0,n)/2500);return(120+3080*r*r)*(.35+.65*Math.min(1,Math.max(0,e)))}function Jb(e,n,r){return Math.max(n,Math.min(r,e))}var Yb=class{#e;#t;#n=!1;#r;#i=`internal`;#a=[];#o=[];#s;#c;#l=0;#u=0;#d=0;#f=0;#p=0;#m=0;#h=0;#g;#_=!1;#v;constructor(e,n){this.#e=e,this.#t=n,e.addController(this)}get isDragging(){return this.#n}get isRejected(){return this.#n&&this.#r===void 0}get dropState(){return this.#r}hostConnected(){this.#y()}hostUpdated(){this.#y()}#y(){let e=this.#t.getScrollContainer();!e||e===this.#v||(this.#b(),this.#v=e,e.addEventListener(`dragenter`,this.#x),e.addEventListener(`dragover`,this.#S),e.addEventListener(`dragleave`,this.#w),e.addEventListener(`drop`,this.#T))}#b(){let e=this.#v;e&&(e.removeEventListener(`dragenter`,this.#x),e.removeEventListener(`dragover`,this.#S),e.removeEventListener(`dragleave`,this.#w),e.removeEventListener(`drop`,this.#T),this.#v=void 0)}hostDisconnected(){this.#b(),this.#A(),this.#N(),this.#n=!1,this.#r=void 0}#x=e=>{this.#t.getDndMode()===`none`||!e.dataTransfer||this.#t.resolveDrag(e.dataTransfer,`hover`)!==void 0&&(e.preventDefault(),this.#n||(this.#n=!0,this.#t.onActiveChange(!0)))};#S=e=>{if(this.#t.getDndMode()===`none`||!e.dataTransfer)return;this.#u=e.clientX,this.#d=e.clientY,this.#g=e;let n=this.#t.resolveDrag(e.dataTransfer,`hover`);if(!n){this.#C(e);return}this.#n||(this.#n=!0,this.#t.onActiveChange(!0)),this.#i=n.source,this.#a=n.keys,this.#o=n.nodes;let r=this.#t.getVisibleRows();this.#k(this.#D(r,e.clientY)),this.#j();let i=this.#O(e,r,n.source);if(!i){this.#C(e,!1);return}let a={source:n.source,dragged:n.nodes.length>0?n.nodes:void 0,draggedKeys:n.keys,target:i,dataTransfer:e.dataTransfer};if(!this.#t.vet(a)){this.#C(e,!1);return}e.preventDefault(),e.dataTransfer.dropEffect=n.source===`internal`?`move`:`copy`,this.#P(i)};#C(e,n=!0){e.dataTransfer&&(e.dataTransfer.dropEffect=`none`),this.#P(void 0),n&&this.#A()}#w=e=>{let n=this.#t.getScrollContainer(),r=e.relatedTarget;n&&r&&n.contains(r)||this.#E()};#T=e=>{if(!e.dataTransfer){this.#E();return}e.preventDefault(),this.#N(),this.#A();let n=e=>{this.#r=void 0,this.#n=!1,this.#t.onDropStateChange(void 0),this.#t.onActiveChange(!1),this.#t.onDragEnd(e)};if(this.#t.getDndMode()===`none`){n(!1);return}let r=this.#t.resolveDrag(e.dataTransfer,`drop`);if(!r){n(!1);return}this.#a=r.keys,this.#o=r.nodes;let i=this.#O(e,this.#t.getVisibleRows(),r.source);if(!i){n(!1);return}let a={source:r.source,dragged:r.nodes.length>0?r.nodes:void 0,draggedKeys:r.keys,target:i,dataTransfer:e.dataTransfer};if(!this.#t.vet(a)){n(!1);return}let o={...a,external:r.source===`external`?r.nodes:void 0};n(this.#t.commitDrop(o))};#E(){this.#A(),this.#N(),this.#r!==void 0&&(this.#r=void 0,this.#t.onDropStateChange(void 0)),this.#n&&(this.#n=!1,this.#t.onActiveChange(!1))}#D(e,n){if(e.length!==0)return n<e[0].rect.top?e[0]:n>e[e.length-1].rect.bottom?e[e.length-1]:e.find(e=>n>=e.rect.top&&n<=e.rect.bottom)??e[e.length-1]}#O(e,n,r){if(n.length===0)return;let i=this.#D(n,e.clientY);if(!i)return;let a=Jb((e.clientY-i.rect.top)/i.rect.height,0,1),o=a<.25?`before`:a>.75?`after`:`inside`,s=i.node.item.isLeaf===!0;o===`inside`&&s&&(o=`after`);let c=!1;o===`after`&&!s&&this.#t.isExpanded(i.key)&&(o=`inside`,c=!0);let l,u,d,f;if(o===`inside`)l=i.key,u=i.key,d=i.depth+1,f=c?0:i.node.children?.length??0;else{let r=this.#t.getIndentPx()||1,a=n[0].rect.left,s=Jb(Math.round((e.clientX-a)/r),0,i.depth),c={node:i.node,depth:i.depth,parentKey:this.#t.getRowInfo(i.key)?.parentKey};u=i.key;for(let e=i.depth-s;e>0&&c.parentKey!==void 0;e--){let e=this.#t.getRowInfo(c.parentKey);if(!e)break;u=c.parentKey,c=e}d=c.depth,l=c.parentKey;let p=this.#t.getChildren(l).findIndex(e=>e.item.key===u);f=(p<0?0:p)+ +(o===`after`)}if(r===`internal`){for(let e of this.#a)if(e===l||e===u||l!==void 0&&this.#t.isSelfOrDescendant(e,l)||o!==`inside`&&this.#t.isSelfOrDescendant(e,u))return;if(this.#a.length>0&&!this.#t.isReorderAllowed()&&!this.#a.some(e=>this.#t.getParentKey(e)!==l))return}return{parentKey:l,index:f,referenceKey:u,position:o,depth:d}}#k(e){if(!e||e.node.item.isLeaf===!0||this.#t.isExpanded(e.key)){this.#A();return}if(e.key===this.#c)return;this.#A();let n=this.#c=e.key;this.#s=setTimeout(()=>{this.#s=void 0,this.#c===n&&(this.#c=void 0,this.#t.expandKey(n))},Math.max(0,this.#t.getExpandHoverMs()))}#A(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0),this.#c=void 0}#j(){this.#l===0&&(this.#l=requestAnimationFrame(this.#M))}#M=e=>{if(this.#l=0,!this.#n)return;let n=this.#t.getScrollContainer();if(!n||this.#_&&this.#g&&(this.#_=!1,this.#S(this.#g),!this.#n))return;let r=n.getBoundingClientRect(),i=this.#u>=r.left&&this.#u<=r.right?Kb(this.#d-r.top,r.height):{direction:0,depth:0};if(i.direction!==this.#f&&(this.#f=i.direction,this.#p=e,this.#m=e,this.#h=0),i.direction===0)return;let a=Math.min(50,Math.max(0,e-this.#m));this.#m=e;let o=qb(i.depth,e-this.#p),s=i.direction*o*a/1e3+this.#h,c=Math.trunc(s);if(this.#h=s-c,c!==0){let e=n.scrollTop;n.scrollTop=e+c,n.scrollTop!==e&&(this.#_=!0)}this.#j()};#N(){this.#l!==0&&(cancelAnimationFrame(this.#l),this.#l=0),this.#f=0,this.#h=0,this.#_=!1,this.#g=void 0}#P(e){let n=e===void 0?this.#r===void 0:e.referenceKey===this.#r?.referenceKey&&e.position===this.#r?.position&&e.depth===this.#r?.depth&&e.index===this.#r?.index;this.#r=e,(!n||this.#n)&&this.#t.onDropStateChange(e)}};function Xb(e,n){let r=[],i=new Map,a=[],o=(e,r,i)=>{if(!e||e.length===0)return;let o=e.filter(e=>n.isShown(e,r));for(let e=o.length-1;e>=0;e--)a.push({node:o[e],depth:r,parentKey:i,posInSet:e+1,setSize:o.length})};for(o(e.children,0,void 0);a.length>0;){let{node:e,depth:s,parentKey:c,posInSet:l,setSize:u}=a.pop();i.set(e.item.key,r.length),r.push({node:e,depth:s,parentKey:c,posInSet:l,setSize:u}),e.children&&e.children.length>0&&n.isExpanded(e,s)&&o(e.children,s+1,e.item.key)}return{rows:r,indexByKey:i}}function Zb(e){let n=new Map,r=new Set,i=new Set([e.item.key]),a=new Set,o=[];if(e.children)for(let r of e.children)n.set(r.item.key,e.item.key),o.push({node:r,depth:0,parentKey:e.item.key});for(;o.length>0;){let{node:e,depth:s,parentKey:c}=o.pop();if(i.has(e.item.key)&&a.add(e.item.key),i.add(e.item.key),n.set(e.item.key,c),e.item.icon&&r.add(s),e.children)for(let n=e.children.length-1;n>=0;n--){let r=e.children[n];o.push({node:r,depth:s+1,parentKey:e.item.key})}}if(a.size>0){let e=[...a].slice(0,5).map(e=>`"${e}"`).join(`, `);console.warn(`[ixfx-tree] ${a.size} duplicate item key(s) in tree (e.g. ${e}). Keys must be unique across the whole tree; duplicates break checkbox state, expansion and selection.`)}return{parentByKey:n,depthsWithIcons:r}}function Qb(e,n){let r=new Set;if(!e.children)return r;let i=[],a=(e,r)=>{i.push({node:e,depth:r,next:0,matched:n(e,r)})};for(let n of e.children)for(a(n,0);i.length>0;){let e=i[i.length-1],n=e.node.children;if(n&&e.next<n.length){a(n[e.next++],e.depth+1);continue}i.pop(),e.matched&&(r.add(e.node.item.key),i.length>0&&(i[i.length-1].matched=!0))}return r}function $b(e,n,r){if(r.size===0)return[...e];let i=new Set;for(let n of e)i.add(n.node.item.key);let a=Symbol(`end`),o=new Map,s=a;for(let e=n.length-1;e>=0;e--){let a=n[e];if(i.has(a)){s=a;continue}let c=r.get(a);if(!c)continue;let l=o.get(s);l?l.push(c):o.set(s,[c])}let c=[];for(let n of e){let e=o.get(n.node.item.key);if(e)for(let n=e.length-1;n>=0;n--)c.push(e[n]);c.push(n)}let l=o.get(a);if(l)for(let e=l.length-1;e>=0;e--)c.push(l[e]);return c}function ex(e,n){let r=new Map;if(!e.children)return r;let i=[];for(let a of e.children)for(i.push({node:a,next:0,checked:0,unchecked:0,counted:0});i.length>0;){let e=i[i.length-1],{node:a}=e,o=a.children,s=a.item.isLeaf||!o?.length;if(!s&&e.next<o.length){i.push({node:o[e.next++],next:0,checked:0,unchecked:0,counted:0});continue}i.pop();let c;c=s?n.has(a)?`checked`:`unchecked`:e.counted===0?`unchecked`:e.checked===e.counted?`checked`:e.unchecked===e.counted?`unchecked`:`indeterminate`,r.set(a.item.key,c);let l=s&&a.item.selectable===!1;if(i.length>0&&!l){let e=i[i.length-1];e.counted++,c===`checked`?e.checked++:c===`unchecked`&&e.unchecked++}}return r}function tx(e,n){if(e.has(n))return e;let r=new Set(e);return r.add(n),r}function nx(e,n){if(!e.has(n))return e;let r=new Set(e);return r.delete(n),r}function rx(e,n){let r;for(let i of e)n(i)&&(r??=new Set(e),r.delete(i));return r??e}function ix(e){return Math.max(1,e.rowHeight+e.gap)}function ax(e,n){return e.listOffset+n*ix(e)+e.gap}function ox(e,n){return ax(e,n)+e.rowHeight}function sx(e,n,r=5){let{count:i}=e;if(i<=0)return{start:0,end:0};let a=ix(e),o=Math.max(0,n-e.listOffset),s=Math.floor(o/a),c=Math.ceil((o+e.viewportHeight)/a),l=Math.min(i,Math.max(0,s-r));return{start:l,end:Math.min(i,Math.max(l,c+r))}}function cx(e,n,r,i=0){if(n<0||n>=e.count)return r;let a=ax(e,n),o=a+e.rowHeight;return a<r+i?n===0?0:Math.max(0,a-i):o>r+e.viewportHeight?Math.max(0,o-e.viewportHeight):r}function lx(e,n,r,i=0){if(n<0||n>=e.count)return r;let a=ax(e,n),o=a+e.rowHeight;if(a>=r+i&&o<=r+e.viewportHeight)return r;let s=a+e.rowHeight/2-(e.viewportHeight+i)/2;return Math.max(0,s)}function ux(e){return Math.max(1,Math.floor(e.viewportHeight/ix(e))-1)}function dx(e){return{count:e.count,topOf:n=>ax(e,n),bottomOf:n=>ox(e,n)}}function fx(e,n){let r=0,i=e.count;for(;r<i;){let a=r+i>>>1;e.bottomOf(a)>n?i=a:r=a+1}return r}function px(e,n,r,i=0){if(e.count===0)return;let a=Math.min(fx(e,n),e.count-1),o=a,s=e.count;for(;o<s;){let n=o+s>>>1;e.topOf(n)>=r?s=n:o=n+1}let c=Math.max(a,o-1);return{first:Math.max(0,a-i),last:Math.min(e.count-1,c+i)}}const mx={rows:[],indexByKey:new Map};let q=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this.itemDnd=`none`,this.dndExpandHoverMs=500,this.reorderable=!0,this.stickyHeaders=!0,this.virtualize=`auto`,this.virtualizeThreshold=200,this.animation=`auto`,this.applyInternalDrop=!0,this._expandedKeys=new Set,this.#i=0,this._selectionVersion=0,this._scrollTop=0,this.#l={rowHeight:30,gap:1,listOffset:0},this.#u=0,this.#d=0,this.#m=0,this.#h=0,this.#g=!1,this.#S=()=>{this.#d===0&&(this.#d=requestAnimationFrame(()=>{this.#d=0,this.#C()}))},this.tickled=new oe(this,{getItems:()=>this.#s().rows.map(({node:e})=>({id:e.item.key,enabled:!0})),hoverDisabled:()=>this.#Y?.isDragging===!0||this.#X?.isDragging===!0,onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)}}),this._focusedDepth=0,this.search=new Vt(this,{adapter:Wt(this,{labelSelector:`.tree-label`,highlightKey:`incr-search-highlight`})}),this.#I={indent:20},this.#L=[],this.#R=[],this.#z=new Map,this.#B=new Map,this.#V=new Set,this.#H=new Map,this.#U=new Map,this.#W=!1,this.#K=``,this.#Z=new Set,this.#Q=!1,this.#ee=()=>{this.#$=void 0},this.#ne=()=>{this.#fe===0&&(this.#fe=requestAnimationFrame(()=>{this.#fe=0,this.#ie()}))},this._stickyKeys=[],this.#ue=new Map,this.#de=!0,this.#fe=0,this.#me=!1,this.#Re=`user`,this.#ze=!1,this.#tt=0,this.#pt=e=>{if(this.search.isOpen)return;let n=this.#s().rows;if(n.length===0)return;if((e.ctrlKey||e.metaKey)&&e.key===`a`){e.preventDefault(),this.selectAll();return}[`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`,`Enter`,` `].includes(e.key)&&this.tickled.setInputMode(`keyboard`);let r=this.#ct();switch(e.key){case`ArrowDown`:e.preventDefault(),this.#ft(n,r,Math.min(r+1,n.length-1),e.shiftKey);break;case`ArrowUp`:e.preventDefault(),this.#ft(n,r,Math.max(r-1,0),e.shiftKey);break;case`Home`:e.preventDefault(),this.#ft(n,r,0,e.shiftKey);break;case`End`:e.preventDefault(),this.#ft(n,r,n.length-1,e.shiftKey);break;case`PageDown`:{e.preventDefault();let i=this.#dt();this.#ft(n,r,Math.min(r+i,n.length-1),e.shiftKey);break}case`PageUp`:{e.preventDefault();let i=this.#dt();this.#ft(n,r,Math.max(r-i,0),e.shiftKey);break}case`ArrowRight`:{e.preventDefault();let i=n[r];i&&i.node.item.isLeaf!==!0&&(this._expandedKeys.has(i.node.item.key)?r+1<n.length&&this.#lt(r+1):this.#Je(i.node,i.depth)),this.requestUpdate();break}case`ArrowLeft`:{e.preventDefault();let i=n[r];if(i&&this._expandedKeys.has(i.node.item.key))this.#e(nx(this._expandedKeys,i.node.item.key)),this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:i.node,depth:i.depth},bubbles:!0,composed:!0}));else if(i.depth>0){let e=i.depth-1;for(let i=r-1;i>=0;i--)if(n[i].depth===e){this.#lt(i);break}}this.requestUpdate();break}case`Enter`:{e.preventDefault();let i=n[r];i&&(this.interactionMode!==`manual`&&this.interactionMode!==`checked`&&this.select(i.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:i.node,depth:i.depth},bubbles:!0,composed:!0})),this.requestUpdate());break}case` `:{e.preventDefault();let i=n[r];if(!i)break;this.interactionMode===`checked`?this._handleCheckboxClick(new MouseEvent(`click`),i.node,i.depth):(this.interactionMode===`standard`||this.interactionMode===`vscode`||this.interactionMode===`manual`)&&this.#qe(i.node,i.depth);break}case`Escape`:e.preventDefault(),this.#rt()}},this.#mt=e=>{let n=e.target.closest(`ul.tree-list li`);if(!n)return;let r=n.dataset.key;if(!r)return;let i=this.#s(),a=i.indexByKey.get(r),o=a===void 0?void 0:i.rows[a];if(!o)return;let s={node:o.node,depth:o.depth};this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:s,bubbles:!0,composed:!0}))}}get selectedNodes(){return this._selectedNodes}#e(e){e!==this._expandedKeys&&(this._expandedKeys=e,this.#t=void 0,this.#de=!0)}#t;#n;#r;#i;#a;#o;invalidateStructure(){this.#i++,this.#t=void 0,this.requestUpdate()}#s(){if(!this.root)return mx;if(this.#t&&this.#n===this.root&&this.#r===this.filterPredicate)return this.#t;let e=this.#D();return this.#t=Xb(this.root,{isExpanded:(e,n)=>this._isExpanded(e,n),isShown:e?n=>e.matches.has(n.item.key):()=>!0}),this.#n=this.root,this.#r=this.filterPredicate,this.#t}#c(){let e=this.root;if(!e)return{parentByKey:new Map,depthsWithIcons:new Set};let n=this.#a;if(n&&n.root===e&&n.version===this.#i)return n.index;let r=Zb(e);return this.#a={root:e,version:this.#i,index:r},r}#l;#u;#d;#f;#p;#m;#h;#g;#_(){return this.virtualize===`off`?!1:this.virtualize===`on`||this.#s().rows.length>this.virtualizeThreshold}#v(e){return{count:e,rowHeight:this.#l.rowHeight,gap:this.#l.gap,listOffset:this.#l.listOffset,viewportHeight:this.#u>0?this.#u:600}}#y(){let e=this.renderRoot.querySelector(`ul.tree-list`),n=e?.querySelector(`li.item:not(.leaving)`),r=n?.getBoundingClientRect().height??0,i=r>0?r:this.#we(),a=n?Number.parseFloat(getComputedStyle(n).marginTop):NaN,o=Number.isNaN(a)?Number.parseFloat(getComputedStyle(this).getPropertyValue(`--tree-item-gap`)):a,s=Number.isNaN(o)?1:o,c=this.#l.listOffset;if(e){let n=Number.parseFloat(getComputedStyle(e).paddingTop);c=e.offsetTop+(Number.isNaN(n)?0:n)}let l=this.#Se()?.clientHeight??0,u=l>0&&l!==this.#u;l>0&&(this.#u=l);let d=this.#l,f=d.rowHeight!==i||d.gap!==s||d.listOffset!==c;return this.#l={rowHeight:i,gap:s,listOffset:c},f||u}#b(e){return sx(this.#v(e),this._scrollTop)}#x(){let e=this.#Se()?.scrollTop;e!==void 0&&e!==this._scrollTop&&(this._scrollTop=e)}#S;#C(){let e=this.#Se();if(!e||!this.root||!this.#_())return;let n=e.scrollTop;if(n===this._scrollTop)return;let r=sx(this.#v(this.#s().rows.length),n);(r.start!==this.#m||r.end!==this.#h)&&(this._scrollTop=n)}#w(){let e=this.#Se();e!==this.#f&&(this.#f?.removeEventListener(`scroll`,this.#S),this.#p?.disconnect(),this.#p=void 0,this.#f=e,e&&(e.addEventListener(`scroll`,this.#S,{passive:!0}),typeof ResizeObserver<`u`&&(this.#p=new ResizeObserver(e=>{let n=e.at(-1)?.contentRect.height??0;n>0&&n!==this.#u&&this.#_()&&this.requestUpdate()}),this.#p.observe(e))))}#T(){this.#f?.removeEventListener(`scroll`,this.#S),this.#f=void 0,this.#p?.disconnect(),this.#p=void 0,this.#d!==0&&(cancelAnimationFrame(this.#d),this.#d=0)}#E(e,n=`edge`){let r=this.#Se();if(!r)return;let i=this.#v(this.#s().rows.length),a=this.renderRoot.querySelector(`.sticky-headers`)?.getBoundingClientRect().height??0,o=(n===`center-if-hidden`?lx:cx)(i,e,r.scrollTop,a);(o!==r.scrollTop||o!==this._scrollTop)&&(r.scrollTop=o,this._scrollTop=o)}#D(){let e=this.filterPredicate,n=this.root;if(!e||!n)return;let r=this.#o;if(r&&r.predicate===e&&r.root===n&&r.version===this.#i)return r;let i=Qb(n,e),{parentByKey:a}=this.#c(),o=new Set;for(let e of i){let n=a.get(e);n!==void 0&&o.add(n)}let s={predicate:e,root:n,version:this.#i,matches:i,autoExpanded:o};return this.#o=s,s}get _structureVersion(){return this.#i}get _depthsWithIcons(){return this.#c().depthsWithIcons}#O;#k(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#A(){this.#F&&(this.search.setModes(this.#k()),this.#O?.(),this.#O=Rt(this.#F,this.search))}#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H;#U;#W;#G;#K;#q;#J;#Y;#X;#Z;#Q;#$;#ee;#te(){let e=this.#Se();this.stickyHeaders&&e?(!this.#me||this.#pe!==e)&&(this.#pe?.removeEventListener(`scroll`,this.#ne),e.addEventListener(`scroll`,this.#ne,{passive:!0}),this.#pe=e,this.#me=!0):this.#me&&=(this.#pe?.removeEventListener(`scroll`,this.#ne),this.#pe=void 0,!1)}#ne;#re(e){return{count:e.length,topOf:n=>e[n].offsetTop,bottomOf:n=>e[n].offsetTop+e[n].offsetHeight}}#ie(){this.#de=!1;let e=new Map,n=()=>this.#ae([],e);if(!this.stickyHeaders||!this.root)return n();let r=this.#Se(),i=this.renderRoot.querySelector(`ul.tree-list`);if(!r||!i)return n();let a=this.#s(),o=this.#_(),s=i.children,c=this.#R;if(a.rows.length===0||!o&&(s.length===0||s.length!==c.length))return n();let l=o?dx(this.#v(a.rows.length)):this.#re(s),u=r.scrollTop,d=u+(this.renderRoot.querySelector(`.sticky-headers`)?.getBoundingClientRect().height??0),f=fx(l,u);if(!o)for(;f<s.length&&s[f].classList.contains(`leaving`);)f++;if(f>=l.count)return n();let p=o?f:a.indexByKey.get(c[f]);if(p===void 0)return n();let m=[],h=a.rows[p].parentKey;for(;h!==void 0;){let e=a.indexByKey.get(h);if(e===void 0)break;m.unshift(a.rows[e]),h=a.rows[e].parentKey}let g=new Map,_=[];for(let e of m){let n=e.node.item.key,r=o?a.indexByKey.get(n):this.#z.get(n);r===void 0||l.bottomOf(r)>d||(_.push(n),g.set(n,{node:e.node,depth:e.depth}))}this.#ae(_,g)}#ae(e,n){let r=this._stickyKeys;r.length===e.length&&r.every((n,r)=>n===e[r])||(this.#ue=n,this._stickyKeys=e)}#oe(){return!this.stickyHeaders||this._stickyKeys.length===0?a:i`
|
|
8129
|
+
`]}};E([d({type:Boolean,reflect:!0})],Mb.prototype,`collapsed`,void 0),E([d({type:String,attribute:`orientation`,reflect:!0})],Mb.prototype,`orientation`,void 0),E([d({type:Boolean})],Mb.prototype,`closable`,void 0),E([d({type:Boolean,reflect:!0})],Mb.prototype,`collapsible`,void 0),E([d({type:String})],Mb.prototype,`title`,void 0),E([d({type:String,attribute:`icon-name`})],Mb.prototype,`iconName`,void 0),E([d({type:String,attribute:`toggle-interaction`})],Mb.prototype,`toggleInteraction`,void 0),E([d({type:String,attribute:`variant`,reflect:!0})],Mb.prototype,`variant`,void 0),E([d({type:Boolean,attribute:`hide-titlebar`})],Mb.prototype,`hideTitlebar`,void 0),E([d({type:Boolean,attribute:`keep-toolbar`})],Mb.prototype,`keepToolbar`,void 0),E([d({type:Boolean,attribute:`sticky-header`,reflect:!0})],Mb.prototype,`stickyHeader`,void 0),Mb=E([T(`ixfx-panel`)],Mb);const Nb=`__ungrouped__`;let Pb=class extends n{constructor(...e){super(...e),this.grouped=!1,this.crossGroupSelection=!1,this.#n=new Map,this.#i=!1,this.#a=new je(this),this.#d=e=>{if(this.#i)return;let n=e.target,r;for(let[e,i]of this.#n)if(i===n){r=e;break}if(r!==void 0){if(this.grouped&&!this.crossGroupSelection){this.#i=!0;for(let[e,n]of this.#n)e!==r&&n.clearSelection();this.#i=!1}this.dispatchEvent(new CustomEvent(`grouped-select`,{detail:{selected:this.selectedItems,groupKey:r===Nb?void 0:r},bubbles:!0,composed:!0}))}}}#e;#t;#n;#r;#i;#a;get groupBy(){return this.#e}set groupBy(e){this.#e=e,this.requestUpdate()}get factory(){return this.#t}set factory(e){e!==this.#t&&(this.#s(),this.#t=e,this.requestUpdate())}get provider(){return this.#a.provider}set provider(e){this.#a.provider=e,e&&this.#a.request(void 0)}get selectedItems(){let e=new Set;for(let n of this.#n.values())for(let r of n.selectedItems)e.add(r);return e}dispatch(e,n){for(let r of this.#n.values())r.dispatch(e,n)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.addEventListener(`select`,this.#d)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`select`,this.#d)}updated(e){super.updated(e),e.has(`grouped`)&&this.#s(),this.#c()}render(){return this.#t?this.grouped?this.#e?(this.#r=this.#o(),i`${_(this.#r.keys(),e=>e,e=>i`<ixfx-panel data-group-key=${e} .title=${e}></ixfx-panel>`)}`):a:i`<div class="ungrouped-host"></div>`:a}#o(){let e=new Map;if(!this.#e)return e;for(let n of this.#a.items){let r=this.#e(n),i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return e}#s(){for(let e of this.#n.values())e.remove();this.#n.clear()}#c(){if(this.#t){if(!this.grouped){this.#l();return}this.#e&&this.#u()}}#l(){let e=this.querySelector(`.ungrouped-host`);if(!e)return;let n=this.#n.get(Nb);n||(n=this.#t(void 0),e.appendChild(n),this.#n.set(Nb,n)),n.setItems(this.#a.items)}#u(){let e=this.#r??this.#o();for(let n of[...this.#n.keys()])e.has(n)||(this.#n.get(n)?.remove(),this.#n.delete(n));for(let[n,r]of e){let e=[...this.children].find(e=>e instanceof HTMLElement&&e.dataset.groupKey===n);if(!e)continue;let i=this.#n.get(n);i||(i=this.#t(n),e.appendChild(i),this.#n.set(n,i)),i.setItems(r)}}#d};E([d({type:Boolean,reflect:!0})],Pb.prototype,`grouped`,void 0),E([d({type:Boolean,attribute:`cross-group-selection`,reflect:!0})],Pb.prototype,`crossGroupSelection`,void 0),Pb=E([T(`ixfx-grouped-item-lister`)],Pb);const Fb=`application/x-ixfx-tree`,Ib=new Map,Lb=new Map;let Rb,zb=0;function Bb(){return`tree-drag-${++zb}-${Date.now()}`}function Vb(e,n,r,i){Ib.set(e,{sourceId:e,nodes:r,keys:i}),Lb.set(e,new WeakRef(n)),Rb=e}function Hb(e){Ib.delete(e),Lb.delete(e),Rb===e&&(Rb=void 0)}function Ub(){if(Rb===void 0)return;let e=Ib.get(Rb);if(e)return{sourceId:Rb,keys:e.keys,nodes:e.nodes,element:Lb.get(Rb)?.deref()}}const Wb={direction:0,depth:0};function Gb(e){return Math.min(e/2,Math.max(24,Math.min(64,e*.2)))}function Kb(e,n){if(n<=0)return Wb;let r=Gb(n);return e<r?{direction:-1,depth:Math.min(1,(r-e)/r)}:e>n-r?{direction:1,depth:Math.min(1,(e-(n-r))/r)}:Wb}function qb(e,n){let r=Math.min(1,Math.max(0,n)/2500);return(120+3080*r*r)*(.35+.65*Math.min(1,Math.max(0,e)))}function Jb(e,n,r){return Math.max(n,Math.min(r,e))}var Yb=class{#e;#t;#n=!1;#r;#i=`internal`;#a=[];#o=[];#s;#c;#l=0;#u=0;#d=0;#f=0;#p=0;#m=0;#h=0;#g;#_=!1;#v;constructor(e,n){this.#e=e,this.#t=n,e.addController(this)}get isDragging(){return this.#n}get isRejected(){return this.#n&&this.#r===void 0}get dropState(){return this.#r}hostConnected(){this.#y()}hostUpdated(){this.#y()}#y(){let e=this.#t.getScrollContainer();!e||e===this.#v||(this.#b(),this.#v=e,e.addEventListener(`dragenter`,this.#x),e.addEventListener(`dragover`,this.#S),e.addEventListener(`dragleave`,this.#w),e.addEventListener(`drop`,this.#T))}#b(){let e=this.#v;e&&(e.removeEventListener(`dragenter`,this.#x),e.removeEventListener(`dragover`,this.#S),e.removeEventListener(`dragleave`,this.#w),e.removeEventListener(`drop`,this.#T),this.#v=void 0)}hostDisconnected(){this.#b(),this.#A(),this.#N(),this.#n=!1,this.#r=void 0}#x=e=>{this.#t.getDndMode()===`none`||!e.dataTransfer||this.#t.resolveDrag(e.dataTransfer,`hover`)!==void 0&&(e.preventDefault(),this.#n||(this.#n=!0,this.#t.onActiveChange(!0)))};#S=e=>{if(this.#t.getDndMode()===`none`||!e.dataTransfer)return;this.#u=e.clientX,this.#d=e.clientY,this.#g=e;let n=this.#t.resolveDrag(e.dataTransfer,`hover`);if(!n){this.#C(e);return}this.#n||(this.#n=!0,this.#t.onActiveChange(!0)),this.#i=n.source,this.#a=n.keys,this.#o=n.nodes;let r=this.#t.getVisibleRows();this.#k(this.#D(r,e.clientY)),this.#j();let i=this.#O(e,r,n.source);if(!i){this.#C(e,!1);return}let a={source:n.source,dragged:n.nodes.length>0?n.nodes:void 0,draggedKeys:n.keys,target:i,dataTransfer:e.dataTransfer};if(!this.#t.vet(a)){this.#C(e,!1);return}e.preventDefault(),e.dataTransfer.dropEffect=n.source===`internal`?`move`:`copy`,this.#P(i)};#C(e,n=!0){e.dataTransfer&&(e.dataTransfer.dropEffect=`none`),this.#P(void 0),n&&this.#A()}#w=e=>{let n=this.#t.getScrollContainer(),r=e.relatedTarget;n&&r&&n.contains(r)||this.#E()};#T=e=>{if(!e.dataTransfer){this.#E();return}e.preventDefault(),this.#N(),this.#A();let n=e=>{this.#r=void 0,this.#n=!1,this.#t.onDropStateChange(void 0),this.#t.onActiveChange(!1),this.#t.onDragEnd(e)};if(this.#t.getDndMode()===`none`){n(!1);return}let r=this.#t.resolveDrag(e.dataTransfer,`drop`);if(!r){n(!1);return}this.#a=r.keys,this.#o=r.nodes;let i=this.#O(e,this.#t.getVisibleRows(),r.source);if(!i){n(!1);return}let a={source:r.source,dragged:r.nodes.length>0?r.nodes:void 0,draggedKeys:r.keys,target:i,dataTransfer:e.dataTransfer};if(!this.#t.vet(a)){n(!1);return}let o={...a,external:r.source===`external`?r.nodes:void 0};n(this.#t.commitDrop(o))};#E(){this.#A(),this.#N(),this.#r!==void 0&&(this.#r=void 0,this.#t.onDropStateChange(void 0)),this.#n&&(this.#n=!1,this.#t.onActiveChange(!1))}#D(e,n){if(e.length!==0)return n<e[0].rect.top?e[0]:n>e[e.length-1].rect.bottom?e[e.length-1]:e.find(e=>n>=e.rect.top&&n<=e.rect.bottom)??e[e.length-1]}#O(e,n,r){if(n.length===0)return;let i=this.#D(n,e.clientY);if(!i)return;let a=Jb((e.clientY-i.rect.top)/i.rect.height,0,1),o=a<.25?`before`:a>.75?`after`:`inside`,s=i.node.item.isLeaf===!0;o===`inside`&&s&&(o=`after`);let c=!1;o===`after`&&!s&&this.#t.isExpanded(i.key)&&(o=`inside`,c=!0);let l,u,d,f;if(o===`inside`)l=i.key,u=i.key,d=i.depth+1,f=c?0:i.node.children?.length??0;else{let r=this.#t.getIndentPx()||1,a=n[0].rect.left,s=Jb(Math.round((e.clientX-a)/r),0,i.depth),c={node:i.node,depth:i.depth,parentKey:this.#t.getRowInfo(i.key)?.parentKey};u=i.key;for(let e=i.depth-s;e>0&&c.parentKey!==void 0;e--){let e=this.#t.getRowInfo(c.parentKey);if(!e)break;u=c.parentKey,c=e}d=c.depth,l=c.parentKey;let p=this.#t.getChildren(l).findIndex(e=>e.item.key===u);f=(p<0?0:p)+ +(o===`after`)}if(r===`internal`){for(let e of this.#a)if(e===l||e===u||l!==void 0&&this.#t.isSelfOrDescendant(e,l)||o!==`inside`&&this.#t.isSelfOrDescendant(e,u))return;if(this.#a.length>0&&!this.#t.isReorderAllowed()&&!this.#a.some(e=>this.#t.getParentKey(e)!==l))return}return{parentKey:l,index:f,referenceKey:u,position:o,depth:d}}#k(e){if(!e||e.node.item.isLeaf===!0||this.#t.isExpanded(e.key)){this.#A();return}if(e.key===this.#c)return;this.#A();let n=this.#c=e.key;this.#s=setTimeout(()=>{this.#s=void 0,this.#c===n&&(this.#c=void 0,this.#t.expandKey(n))},Math.max(0,this.#t.getExpandHoverMs()))}#A(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0),this.#c=void 0}#j(){this.#l===0&&(this.#l=requestAnimationFrame(this.#M))}#M=e=>{if(this.#l=0,!this.#n)return;let n=this.#t.getScrollContainer();if(!n||this.#_&&this.#g&&(this.#_=!1,this.#S(this.#g),!this.#n))return;let r=n.getBoundingClientRect(),i=this.#u>=r.left&&this.#u<=r.right?Kb(this.#d-r.top,r.height):{direction:0,depth:0};if(i.direction!==this.#f&&(this.#f=i.direction,this.#p=e,this.#m=e,this.#h=0),i.direction===0)return;let a=Math.min(50,Math.max(0,e-this.#m));this.#m=e;let o=qb(i.depth,e-this.#p),s=i.direction*o*a/1e3+this.#h,c=Math.trunc(s);if(this.#h=s-c,c!==0){let e=n.scrollTop;n.scrollTop=e+c,n.scrollTop!==e&&(this.#_=!0)}this.#j()};#N(){this.#l!==0&&(cancelAnimationFrame(this.#l),this.#l=0),this.#f=0,this.#h=0,this.#_=!1,this.#g=void 0}#P(e){let n=e===void 0?this.#r===void 0:e.referenceKey===this.#r?.referenceKey&&e.position===this.#r?.position&&e.depth===this.#r?.depth&&e.index===this.#r?.index;this.#r=e,(!n||this.#n)&&this.#t.onDropStateChange(e)}};function Xb(e,n){let r=[],i=new Map,a=[],o=(e,r,i)=>{if(!e||e.length===0)return;let o=e.filter(e=>n.isShown(e,r));for(let e=o.length-1;e>=0;e--)a.push({node:o[e],depth:r,parentKey:i,posInSet:e+1,setSize:o.length})};for(o(e.children,0,void 0);a.length>0;){let{node:e,depth:s,parentKey:c,posInSet:l,setSize:u}=a.pop();i.set(e.item.key,r.length),r.push({node:e,depth:s,parentKey:c,posInSet:l,setSize:u}),e.children&&e.children.length>0&&n.isExpanded(e,s)&&o(e.children,s+1,e.item.key)}return{rows:r,indexByKey:i}}function Zb(e){let n=new Map,r=new Set,i=new Set([e.item.key]),a=new Set,o=[];if(e.children)for(let r of e.children)n.set(r.item.key,e.item.key),o.push({node:r,depth:0,parentKey:e.item.key});for(;o.length>0;){let{node:e,depth:s,parentKey:c}=o.pop();if(i.has(e.item.key)&&a.add(e.item.key),i.add(e.item.key),n.set(e.item.key,c),e.item.icon&&r.add(s),e.children)for(let n=e.children.length-1;n>=0;n--){let r=e.children[n];o.push({node:r,depth:s+1,parentKey:e.item.key})}}if(a.size>0){let e=[...a].slice(0,5).map(e=>`"${e}"`).join(`, `);console.warn(`[ixfx-tree] ${a.size} duplicate item key(s) in tree (e.g. ${e}). Keys must be unique across the whole tree; duplicates break checkbox state, expansion and selection.`)}return{parentByKey:n,depthsWithIcons:r}}function Qb(e,n){let r=new Set;if(!e.children)return r;let i=[],a=(e,r)=>{i.push({node:e,depth:r,next:0,matched:n(e,r)})};for(let n of e.children)for(a(n,0);i.length>0;){let e=i[i.length-1],n=e.node.children;if(n&&e.next<n.length){a(n[e.next++],e.depth+1);continue}i.pop(),e.matched&&(r.add(e.node.item.key),i.length>0&&(i[i.length-1].matched=!0))}return r}function $b(e,n,r){if(r.size===0)return[...e];let i=new Set;for(let n of e)i.add(n.node.item.key);let a=Symbol(`end`),o=new Map,s=a;for(let e=n.length-1;e>=0;e--){let a=n[e];if(i.has(a)){s=a;continue}let c=r.get(a);if(!c)continue;let l=o.get(s);l?l.push(c):o.set(s,[c])}let c=[];for(let n of e){let e=o.get(n.node.item.key);if(e)for(let n=e.length-1;n>=0;n--)c.push(e[n]);c.push(n)}let l=o.get(a);if(l)for(let e=l.length-1;e>=0;e--)c.push(l[e]);return c}function ex(e,n){let r=new Map;if(!e.children)return r;let i=[];for(let a of e.children)for(i.push({node:a,next:0,checked:0,unchecked:0,counted:0});i.length>0;){let e=i[i.length-1],{node:a}=e,o=a.children,s=a.item.isLeaf||!o?.length;if(!s&&e.next<o.length){i.push({node:o[e.next++],next:0,checked:0,unchecked:0,counted:0});continue}i.pop();let c;c=s?n.has(a)?`checked`:`unchecked`:e.counted===0?`unchecked`:e.checked===e.counted?`checked`:e.unchecked===e.counted?`unchecked`:`indeterminate`,r.set(a.item.key,c);let l=s&&a.item.selectable===!1;if(i.length>0&&!l){let e=i[i.length-1];e.counted++,c===`checked`?e.checked++:c===`unchecked`&&e.unchecked++}}return r}function tx(e,n){if(e.has(n))return e;let r=new Set(e);return r.add(n),r}function nx(e,n){if(!e.has(n))return e;let r=new Set(e);return r.delete(n),r}function rx(e,n){let r;for(let i of e)n(i)&&(r??=new Set(e),r.delete(i));return r??e}function ix(e){return Math.max(1,e.rowHeight+e.gap)}function ax(e,n){return e.listOffset+n*ix(e)+e.gap}function ox(e,n){return ax(e,n)+e.rowHeight}function sx(e,n,r=5){let{count:i}=e;if(i<=0)return{start:0,end:0};let a=ix(e),o=Math.max(0,n-e.listOffset),s=Math.floor(o/a),c=Math.ceil((o+e.viewportHeight)/a),l=Math.min(i,Math.max(0,s-r));return{start:l,end:Math.min(i,Math.max(l,c+r))}}function cx(e,n,r,i=0){if(n<0||n>=e.count)return r;let a=ax(e,n),o=a+e.rowHeight;return a<r+i?n===0?0:Math.max(0,a-i):o>r+e.viewportHeight?Math.max(0,o-e.viewportHeight):r}function lx(e,n,r,i=0){if(n<0||n>=e.count)return r;let a=ax(e,n),o=a+e.rowHeight;if(a>=r+i&&o<=r+e.viewportHeight)return r;let s=a+e.rowHeight/2-(e.viewportHeight+i)/2;return Math.max(0,s)}function ux(e){return Math.max(1,Math.floor(e.viewportHeight/ix(e))-1)}function dx(e){return{count:e.count,topOf:n=>ax(e,n),bottomOf:n=>ox(e,n)}}function fx(e,n){let r=0,i=e.count;for(;r<i;){let a=r+i>>>1;e.bottomOf(a)>n?i=a:r=a+1}return r}function px(e,n,r,i=0){if(e.count===0)return;let a=Math.min(fx(e,n),e.count-1),o=a,s=e.count;for(;o<s;){let n=o+s>>>1;e.topOf(n)>=r?s=n:o=n+1}let c=Math.max(a,o-1);return{first:Math.max(0,a-i),last:Math.min(e.count-1,c+i)}}const mx={rows:[],indexByKey:new Map};let q=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this.itemDnd=`none`,this.dndExpandHoverMs=500,this.reorderable=!0,this.stickyHeaders=!0,this.virtualize=`auto`,this.virtualizeThreshold=200,this.animation=`auto`,this.applyInternalDrop=!0,this._expandedKeys=new Set,this.#i=0,this._selectionVersion=0,this._scrollTop=0,this.#l={rowHeight:30,gap:1,listOffset:0},this.#u=0,this.#d=0,this.#m=0,this.#h=0,this.#g=!1,this.#S=()=>{this.#d===0&&(this.#d=requestAnimationFrame(()=>{this.#d=0,this.#C()}))},this.tickled=new oe(this,{getItems:()=>this.#s().rows.map(({node:e})=>({id:e.item.key,enabled:!0})),hoverDisabled:()=>this.#Y?.isDragging===!0||this.#X?.isDragging===!0,onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)}}),this._focusedDepth=0,this.search=new Bt(this,{adapter:Ut(this,{labelSelector:`.tree-label`,highlightKey:`incr-search-highlight`})}),this.#I={indent:20},this.#L=[],this.#R=[],this.#z=new Map,this.#B=new Map,this.#V=new Set,this.#H=new Map,this.#U=new Map,this.#W=!1,this.#K=``,this.#Z=new Set,this.#Q=!1,this.#ee=()=>{this.#$=void 0},this.#ne=()=>{this.#fe===0&&(this.#fe=requestAnimationFrame(()=>{this.#fe=0,this.#ie()}))},this._stickyKeys=[],this.#ue=new Map,this.#de=!0,this.#fe=0,this.#me=!1,this.#Re=`user`,this.#ze=!1,this.#tt=0,this.#pt=e=>{if(this.search.isOpen)return;let n=this.#s().rows;if(n.length===0)return;if((e.ctrlKey||e.metaKey)&&e.key===`a`){e.preventDefault(),this.selectAll();return}[`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`,`Enter`,` `].includes(e.key)&&this.tickled.setInputMode(`keyboard`);let r=this.#ct();switch(e.key){case`ArrowDown`:e.preventDefault(),this.#ft(n,r,Math.min(r+1,n.length-1),e.shiftKey);break;case`ArrowUp`:e.preventDefault(),this.#ft(n,r,Math.max(r-1,0),e.shiftKey);break;case`Home`:e.preventDefault(),this.#ft(n,r,0,e.shiftKey);break;case`End`:e.preventDefault(),this.#ft(n,r,n.length-1,e.shiftKey);break;case`PageDown`:{e.preventDefault();let i=this.#dt();this.#ft(n,r,Math.min(r+i,n.length-1),e.shiftKey);break}case`PageUp`:{e.preventDefault();let i=this.#dt();this.#ft(n,r,Math.max(r-i,0),e.shiftKey);break}case`ArrowRight`:{e.preventDefault();let i=n[r];i&&i.node.item.isLeaf!==!0&&(this._expandedKeys.has(i.node.item.key)?r+1<n.length&&this.#lt(r+1):this.#Je(i.node,i.depth)),this.requestUpdate();break}case`ArrowLeft`:{e.preventDefault();let i=n[r];if(i&&this._expandedKeys.has(i.node.item.key))this.#e(nx(this._expandedKeys,i.node.item.key)),this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:i.node,depth:i.depth},bubbles:!0,composed:!0}));else if(i.depth>0){let e=i.depth-1;for(let i=r-1;i>=0;i--)if(n[i].depth===e){this.#lt(i);break}}this.requestUpdate();break}case`Enter`:{e.preventDefault();let i=n[r];i&&(this.interactionMode!==`manual`&&this.interactionMode!==`checked`&&this.select(i.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:i.node,depth:i.depth},bubbles:!0,composed:!0})),this.requestUpdate());break}case` `:{e.preventDefault();let i=n[r];if(!i)break;this.interactionMode===`checked`?this._handleCheckboxClick(new MouseEvent(`click`),i.node,i.depth):(this.interactionMode===`standard`||this.interactionMode===`vscode`||this.interactionMode===`manual`)&&this.#qe(i.node,i.depth);break}case`Escape`:e.preventDefault(),this.#rt()}},this.#mt=e=>{let n=e.target.closest(`ul.tree-list li`);if(!n)return;let r=n.dataset.key;if(!r)return;let i=this.#s(),a=i.indexByKey.get(r),o=a===void 0?void 0:i.rows[a];if(!o)return;let s={node:o.node,depth:o.depth};this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:s,bubbles:!0,composed:!0}))}}get selectedNodes(){return this._selectedNodes}#e(e){e!==this._expandedKeys&&(this._expandedKeys=e,this.#t=void 0,this.#de=!0)}#t;#n;#r;#i;#a;#o;invalidateStructure(){this.#i++,this.#t=void 0,this.requestUpdate()}#s(){if(!this.root)return mx;if(this.#t&&this.#n===this.root&&this.#r===this.filterPredicate)return this.#t;let e=this.#D();return this.#t=Xb(this.root,{isExpanded:(e,n)=>this._isExpanded(e,n),isShown:e?n=>e.matches.has(n.item.key):()=>!0}),this.#n=this.root,this.#r=this.filterPredicate,this.#t}#c(){let e=this.root;if(!e)return{parentByKey:new Map,depthsWithIcons:new Set};let n=this.#a;if(n&&n.root===e&&n.version===this.#i)return n.index;let r=Zb(e);return this.#a={root:e,version:this.#i,index:r},r}#l;#u;#d;#f;#p;#m;#h;#g;#_(){return this.virtualize===`off`?!1:this.virtualize===`on`||this.#s().rows.length>this.virtualizeThreshold}#v(e){return{count:e,rowHeight:this.#l.rowHeight,gap:this.#l.gap,listOffset:this.#l.listOffset,viewportHeight:this.#u>0?this.#u:600}}#y(){let e=this.renderRoot.querySelector(`ul.tree-list`),n=e?.querySelector(`li.item:not(.leaving)`),r=n?.getBoundingClientRect().height??0,i=r>0?r:this.#we(),a=n?Number.parseFloat(getComputedStyle(n).marginTop):NaN,o=Number.isNaN(a)?Number.parseFloat(getComputedStyle(this).getPropertyValue(`--tree-item-gap`)):a,s=Number.isNaN(o)?1:o,c=this.#l.listOffset;if(e){let n=Number.parseFloat(getComputedStyle(e).paddingTop);c=e.offsetTop+(Number.isNaN(n)?0:n)}let l=this.#Se()?.clientHeight??0,u=l>0&&l!==this.#u;l>0&&(this.#u=l);let d=this.#l,f=d.rowHeight!==i||d.gap!==s||d.listOffset!==c;return this.#l={rowHeight:i,gap:s,listOffset:c},f||u}#b(e){return sx(this.#v(e),this._scrollTop)}#x(){let e=this.#Se()?.scrollTop;e!==void 0&&e!==this._scrollTop&&(this._scrollTop=e)}#S;#C(){let e=this.#Se();if(!e||!this.root||!this.#_())return;let n=e.scrollTop;if(n===this._scrollTop)return;let r=sx(this.#v(this.#s().rows.length),n);(r.start!==this.#m||r.end!==this.#h)&&(this._scrollTop=n)}#w(){let e=this.#Se();e!==this.#f&&(this.#f?.removeEventListener(`scroll`,this.#S),this.#p?.disconnect(),this.#p=void 0,this.#f=e,e&&(e.addEventListener(`scroll`,this.#S,{passive:!0}),typeof ResizeObserver<`u`&&(this.#p=new ResizeObserver(e=>{let n=e.at(-1)?.contentRect.height??0;n>0&&n!==this.#u&&this.#_()&&this.requestUpdate()}),this.#p.observe(e))))}#T(){this.#f?.removeEventListener(`scroll`,this.#S),this.#f=void 0,this.#p?.disconnect(),this.#p=void 0,this.#d!==0&&(cancelAnimationFrame(this.#d),this.#d=0)}#E(e,n=`edge`){let r=this.#Se();if(!r)return;let i=this.#v(this.#s().rows.length),a=this.renderRoot.querySelector(`.sticky-headers`)?.getBoundingClientRect().height??0,o=(n===`center-if-hidden`?lx:cx)(i,e,r.scrollTop,a);(o!==r.scrollTop||o!==this._scrollTop)&&(r.scrollTop=o,this._scrollTop=o)}#D(){let e=this.filterPredicate,n=this.root;if(!e||!n)return;let r=this.#o;if(r&&r.predicate===e&&r.root===n&&r.version===this.#i)return r;let i=Qb(n,e),{parentByKey:a}=this.#c(),o=new Set;for(let e of i){let n=a.get(e);n!==void 0&&o.add(n)}let s={predicate:e,root:n,version:this.#i,matches:i,autoExpanded:o};return this.#o=s,s}get _structureVersion(){return this.#i}get _depthsWithIcons(){return this.#c().depthsWithIcons}#O;#k(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#A(){this.#F&&(this.search.setModes(this.#k()),this.#O?.(),this.#O=Rt(this.#F,this.search))}#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H;#U;#W;#G;#K;#q;#J;#Y;#X;#Z;#Q;#$;#ee;#te(){let e=this.#Se();this.stickyHeaders&&e?(!this.#me||this.#pe!==e)&&(this.#pe?.removeEventListener(`scroll`,this.#ne),e.addEventListener(`scroll`,this.#ne,{passive:!0}),this.#pe=e,this.#me=!0):this.#me&&=(this.#pe?.removeEventListener(`scroll`,this.#ne),this.#pe=void 0,!1)}#ne;#re(e){return{count:e.length,topOf:n=>e[n].offsetTop,bottomOf:n=>e[n].offsetTop+e[n].offsetHeight}}#ie(){this.#de=!1;let e=new Map,n=()=>this.#ae([],e);if(!this.stickyHeaders||!this.root)return n();let r=this.#Se(),i=this.renderRoot.querySelector(`ul.tree-list`);if(!r||!i)return n();let a=this.#s(),o=this.#_(),s=i.children,c=this.#R;if(a.rows.length===0||!o&&(s.length===0||s.length!==c.length))return n();let l=o?dx(this.#v(a.rows.length)):this.#re(s),u=r.scrollTop,d=u+(this.renderRoot.querySelector(`.sticky-headers`)?.getBoundingClientRect().height??0),f=fx(l,u);if(!o)for(;f<s.length&&s[f].classList.contains(`leaving`);)f++;if(f>=l.count)return n();let p=o?f:a.indexByKey.get(c[f]);if(p===void 0)return n();let m=[],h=a.rows[p].parentKey;for(;h!==void 0;){let e=a.indexByKey.get(h);if(e===void 0)break;m.unshift(a.rows[e]),h=a.rows[e].parentKey}let g=new Map,_=[];for(let e of m){let n=e.node.item.key,r=o?a.indexByKey.get(n):this.#z.get(n);r===void 0||l.bottomOf(r)>d||(_.push(n),g.set(n,{node:e.node,depth:e.depth}))}this.#ae(_,g)}#ae(e,n){let r=this._stickyKeys;r.length===e.length&&r.every((n,r)=>n===e[r])||(this.#ue=n,this._stickyKeys=e)}#oe(){return!this.stickyHeaders||this._stickyKeys.length===0?a:i`
|
|
8124
8130
|
<div class="sticky-anchor">
|
|
8125
8131
|
<div class="sticky-headers" part="sticky-headers">
|
|
8126
8132
|
${this._stickyKeys.map(e=>{let n=this.#ue.get(e);return n?this.#se(n.node,n.depth):a})}
|
|
@@ -8138,13 +8144,13 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
8138
8144
|
@click=${n=>this.#ce(n,e)}
|
|
8139
8145
|
@keydown=${n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),this.#le(e))}}
|
|
8140
8146
|
>${this.renderNodeContent(e,n)}</div>
|
|
8141
|
-
`}#ce(e,n){if(!(this.#Y?.isDragging||this.#X?.isDragging)){if(n.item.isLeaf!==!0&&e.target instanceof Element&&e.target.closest(`.tree-caret`)){let e=this.#ue.get(n.item.key)?.depth??0;this.#Je(n,e),this.#de=!0,this.requestUpdate();return}this.#le(n)}}#le(e){this.#Ie(e)&&this.select(e),this.#et(e.item.key),this.#de=!0,this.requestUpdate()}#ue;#de;#fe;#pe;#me;get nativeDrag(){return this.#X}get dropState(){return this.#J}get nativeDragKeys(){return this.#Z}#he(e){this.#U.get(e)?.cancel(),this.#U.delete(e)}#ge(){for(let e of this.#U.values())try{e.cancel()}catch{}this.#U.clear()}willUpdate(e){super.willUpdate(e);let n=this.#t!==void 0&&e.size===1&&e.has(`_scrollTop`)&&this.#_();if(this.#g=n,n){this.#x();return}if(this.#t=void 0,(e.has(`root`)||e.has(`model`))&&this.#i++,e.has(`root`)&&this.root&&this._expandedKeys.size>0){let{parentByKey:e}=this.#c();this.#e(rx(this._expandedKeys,n=>!e.has(n)))}this.#_e(e.has(`filterPredicate`));let r=this.#_();this.toggleAttribute(`data-virtual`,r),r&&(this.#y(),this.#x()),(e.has(`root`)||e.has(`model`)||e.has(`filterPredicate`)||e.has(`stickyHeaders`))&&(this.#de=!0),this.#de&&this.#ie()}#_e(e){let n=this.#s().rows;if(this.#_()){this.#V.clear(),this.#ge(),this.#H.clear(),this.#L=[];return}let r=new Set(n.map(e=>e.node.item.key));if(this.#V.clear(),e)this.#ge(),this.#H.clear();else if(this.#W&&this.#L.length>0){let e=new Set(this.#L);for(let{node:r}of n)e.has(r.item.key)||this.#V.add(r.item.key);this.#V.size>50&&this.#V.clear();for(let e of this.#L)if(!r.has(e)&&!this.#H.has(e)){let n=this.#B.get(e);n&&this.#H.set(e,n)}}for(let e of[...this.#H.keys()])r.has(e)&&(this.#he(e),this.#H.delete(e));this.#H.size>50&&(this.#ge(),this.#H.clear())}_isLeaving(e){return this.#H.has(e.item.key)}_isFilteredOut(e,n){return!1}#ve(){if(this.#ye()||(this.#V.clear(),this.#ge(),this.#H.clear()),this.#V.size>0){for(let e of this.renderRoot.querySelectorAll(`.item`)){let n=e.dataset.key;if(!(n===void 0||!this.#V.has(n))){if(this.#U.has(n))this.#he(n);else for(let n of e.getAnimations())n.cancel();
|
|
8142
|
-
`))}catch{}},onActiveChange:e=>{this.toggleAttribute(`data-native-dragging`,e),e||(this.#Z=new Set),this.requestUpdate()},onEnd:()=>{Hb(this.#K),this.#Z=new Set,this.#q=setTimeout(()=>{this.#q=void 0},150),this.#Q||this.dispatchEvent(new CustomEvent(`tree-drag-end`,{detail:{dropped:!1},bubbles:!0,composed:!0})),this.#Q=!1}}),this.#Y=new Yb(this,{getDndMode:()=>this.itemDnd,getExpandHoverMs:()=>this.dndExpandHoverMs,getVisibleRows:()=>this.#De(),getRowInfo:e=>{let n=this.#s(),r=n.indexByKey.get(e);if(r===void 0)return;let{node:i,depth:a,parentKey:o}=n.rows[r];return{node:i,depth:a,parentKey:o}},getChildren:e=>this.#Te(e),getIndentPx:()=>this.#Ce(),getScrollContainer:()=>this.#Se(),isSelfOrDescendant:(e,n)=>this.#ke(e,n),isExpanded:e=>this._expandedKeys.has(e),isReorderAllowed:()=>this.reorderable,getParentKey:e=>this.#Ae(e)?.item.key,resolveDrag:(e,n)=>this.#Me(e,n),vet:e=>{if(this.canDrop&&!this.canDrop(e))return!1;let n=new CustomEvent(`tree-drag-over`,{detail:e,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(n)},expandKey:e=>this.#Oe(e),onDropStateChange:e=>{this.#J=e,this.toggleAttribute(`data-drop-rejected`,this.#Y.isDragging&&e===void 0),this.requestUpdate()},onActiveChange:e=>{e?(this.#$=void 0,this.#Se()?.addEventListener(`scroll`,this.#ee,{passive:!0})):(this.#Se()?.removeEventListener(`scroll`,this.#ee),this.#$=void 0,this.toggleAttribute(`data-drop-rejected`,!1)),this.requestUpdate()},commitDrop:e=>this.dispatchEvent(new CustomEvent(`tree-drop`,{detail:e,bubbles:!0,composed:!0,cancelable:!0}))?(this.applyInternalDrop&&e.source===`internal`&&this.model&&this.model.applyDrop({source:`internal`,draggedKeys:e.draggedKeys,target:e.target}),this.#Q=!0,!0):!1,onDragEnd:e=>{this.#J=void 0,this.toggleAttribute(`data-drop-rejected`,!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent(`tree-drag-end`,{detail:{dropped:e},bubbles:!0,composed:!0}))}})}#Se(){return this.shadowRoot?.querySelector(`#container`)??void 0}#Ce(){let e=Number.parseInt(getComputedStyle(this).getPropertyValue(`--tree-indent`),10);return Number.isNaN(e)?20:e}#we(){let e=Number.parseInt(getComputedStyle(this).getPropertyValue(`--tree-item-height`),10);return Number.isNaN(e)?30:e}#Te(e){if(e===void 0)return this.root?.children??[];let n=this.#s(),r=n.indexByKey.get(e);return r===void 0?[]:n.rows[r].node.children??[]}#Ee(e,n,r){let i=this.#s(),a=this.#v(i.rows.length),o=px(dx(a),e.scrollTop,e.scrollTop+e.clientHeight,1);if(!o)return;let s=e.getBoundingClientRect(),c=n.querySelector(`li.item`)?.getBoundingClientRect()??s;for(let n=o.first;n<=o.last;n++){let{node:o,depth:l}=i.rows[n],u=s.top-e.scrollTop+ax(a,n),d={x:c.left,y:u,left:c.left,right:c.left+c.width,top:u,bottom:u+a.rowHeight,width:c.width,height:a.rowHeight,toJSON:()=>({})};r.push({key:o.item.key,node:o,depth:l,index:n,rect:d})}}#De(){if(this.#$)return this.#$;let e=[],n=this.#Se(),r=this.renderRoot.querySelector(`ul.tree-list`),i=this.#R;if(n&&r&&this.#_())this.#Ee(n,r,e);else if(n&&r&&r.children.length===i.length){let a=this.#s(),o=r.children,s=px(this.#re(o),n.scrollTop,n.scrollTop+n.clientHeight,1);if(s)for(let n=s.first;n<=s.last;n++){let r=o[n];if(r.classList.contains(`leaving`))continue;let s=a.indexByKey.get(i[n]);if(s===void 0)continue;let{node:c,depth:l}=a.rows[s];e.push({key:c.item.key,node:c,depth:l,index:s,rect:r.getBoundingClientRect()})}}return this.#$=e,e}#Oe(e){if(this._expandedKeys.has(e))return;let n=this.#s(),r=n.indexByKey.get(e),i=r===void 0?void 0:n.rows[r];!i||i.node.item.isLeaf===!0||(this.#Je(i.node,i.depth),this.#$=void 0,this.requestUpdate())}#ke(e,n){if(e===n)return!0;let{parentByKey:r}=this.#c(),i=r.get(n);for(;i!==void 0;){if(i===e)return!0;i=r.get(i)}return!1}#Ae(e){let n=this.#c().parentByKey.get(e);if(n!==void 0&&n!==this.root?.item.key)return this.#je(n)}#je(e){let n=this.#s(),r=n.indexByKey.get(e);if(r!==void 0)return n.rows[r].node;let{parentByKey:i}=this.#c(),a=[];for(let n=e;n!==void 0&&n!==this.root?.item.key;n=i.get(n))a.unshift(n);let o=this.root;for(let e of a)o=o?.children?.find(n=>n.item.key===e);return o}#Me(e,n){let r=this.itemDnd;if(r===`none`)return;let i=r===`internal`||r===`both`,a=r===`external`||r===`both`,o=[];try{o=Array.from(e.types)}catch{}let s=Ub(),c=o.includes(Fb)||s!==void 0;if(i&&c){if(s&&s.keys.length>0){let e=this.root?
|
|
8147
|
+
`}#ce(e,n){if(!(this.#Y?.isDragging||this.#X?.isDragging)){if(n.item.isLeaf!==!0&&e.target instanceof Element&&e.target.closest(`.tree-caret`)){let e=this.#ue.get(n.item.key)?.depth??0;this.#Je(n,e),this.#de=!0,this.requestUpdate();return}this.#le(n)}}#le(e){this.#Ie(e)&&this.select(e),this.#et(e.item.key),this.#de=!0,this.requestUpdate()}#ue;#de;#fe;#pe;#me;get nativeDrag(){return this.#X}get dropState(){return this.#J}get nativeDragKeys(){return this.#Z}#he(e){this.#U.get(e)?.cancel(),this.#U.delete(e)}#ge(){for(let e of this.#U.values())try{e.cancel()}catch{}this.#U.clear()}willUpdate(e){super.willUpdate(e);let n=this.#t!==void 0&&e.size===1&&e.has(`_scrollTop`)&&this.#_();if(this.#g=n,n){this.#x();return}if(this.#t=void 0,(e.has(`root`)||e.has(`model`))&&this.#i++,e.has(`root`)&&this.root&&this._expandedKeys.size>0){let{parentByKey:e}=this.#c();this.#e(rx(this._expandedKeys,n=>!e.has(n)))}this.#_e(e.has(`filterPredicate`));let r=this.#_();this.toggleAttribute(`data-virtual`,r),r&&(this.#y(),this.#x()),(e.has(`root`)||e.has(`model`)||e.has(`filterPredicate`)||e.has(`stickyHeaders`))&&(this.#de=!0),this.#de&&this.#ie()}#_e(e){let n=this.#s().rows;if(this.#_()){this.#V.clear(),this.#ge(),this.#H.clear(),this.#L=[];return}let r=new Set(n.map(e=>e.node.item.key));if(this.#V.clear(),e)this.#ge(),this.#H.clear();else if(this.#W&&this.#L.length>0){let e=new Set(this.#L);for(let{node:r}of n)e.has(r.item.key)||this.#V.add(r.item.key);this.#V.size>50&&this.#V.clear();for(let e of this.#L)if(!r.has(e)&&!this.#H.has(e)){let n=this.#B.get(e);n&&this.#H.set(e,n)}}for(let e of[...this.#H.keys()])r.has(e)&&(this.#he(e),this.#H.delete(e));this.#H.size>50&&(this.#ge(),this.#H.clear())}_isLeaving(e){return this.#H.has(e.item.key)}_isFilteredOut(e,n){return!1}#ve(){if(this.#ye()||(this.#V.clear(),this.#ge(),this.#H.clear()),this.#V.size>0){for(let e of this.renderRoot.querySelectorAll(`.item`)){let n=e.dataset.key;if(!(n===void 0||!this.#V.has(n))){if(this.#U.has(n))this.#he(n);else for(let n of e.getAnimations())n.cancel();Yn(e)}}this.#V.clear()}if(this.#H.size>0)for(let e of this.renderRoot.querySelectorAll(`.item.leaving`)){let n=e.dataset.key;if(n===void 0||this.#U.has(n))continue;let r=Qn(e),i=r.animation;if(!i){r.then(()=>{this.#H.has(n)&&(this.#H.delete(n),this.requestUpdate())});continue}this.#he(n),this.#U.set(n,i),r.then(()=>{this.#U.get(n)===i&&(this.#U.delete(n),this.#H.delete(n),this.requestUpdate(),this.updateComplete.then(()=>{try{i.cancel()}catch{}}))})}let e=this.#s().rows;this.#L=e.map(e=>e.node.item.key),this.#B.clear();for(let n of e)this.#B.set(n.node.item.key,n);this.#W=!0}#ye(){return this.#G===void 0?this.animation===`never`?!1:this.animation===`always`||!Un():this.#G}updated(e){if(this.#$=void 0,this.#w(),this.#g){this.#g=!1,this.#be();return}if(this.#te(),e.has(`root`)&&this.root&&(this.#rt(),this.#Le(),this.tickled.clearTickled(),this._focusedDepth=0,this.#ge(),this.#H.clear(),this.#V.clear()),e.has(`model`)){this.#N?.(),this.#N=void 0;let e=this.model;e&&(this.root=e.root,this.#N=e._subscribe(e=>{e.type===`root`?(this.root=e.root,this.requestUpdate()):e.type===`invalidate`&&this._expandedKeys.has(e.key)&&(this.#e(nx(this._expandedKeys,e.key)),this.requestUpdate())}))}e.has(`interactionMode`)&&(this.#P=void 0,this.clearSelection()),e.has(`selectedNode`)&&this.selectedNode&&e.get(`selectedNode`)!==this.selectedNode&&this.tickled.setTickled(this.selectedNode.item.key),this.#_()?(this.#L=[],this.#B.clear(),this.#y()&&queueMicrotask(()=>this.requestUpdate()),this.#be()):this.#ve(),this.#G=void 0}#be(){this.search.isOpen&&this.search.repaintHighlights()}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#F=Jt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e,this.#A(),this.#xe()}#xe(){this.#K=Bb(),this.#X=new $n(this,{source:`tree-list`,isEnabled:()=>this.itemDnd!==`none`&&this.#Ne(),resolveEventToKey:e=>{if(e instanceof Element)return e.closest(`ul.tree-list li[data-key]`)?.getAttribute(`data-key`)??void 0},prepareSelection:e=>{let n=this.#s(),r=n.rows,i=n.indexByKey.get(e),a=i===void 0?void 0:r[i];if(!a)return;let o=new Set(this._selectedNodes);o.has(a.node)||o.clear(),o.add(a.node);let s=r.filter(e=>o.has(e.node)).map(e=>e.node.item.key),c=new Set(this.root?Cg(this.root,s):s),l=r.filter(e=>c.has(e.node.item.key)).map((e,n)=>({key:e.node.item.key,index:n,item:e.node,element:this.shadowRoot?.querySelector(`ul.tree-list li[data-key="${CSS.escape(e.node.item.key)}"]`)??void 0})),u=l.find(n=>n.key===e)??{key:e,index:0,item:a.node,element:void 0};return l.some(e=>e.key===u.key)||l.unshift(u),{origin:u,selected:l}},getMetrics:()=>({rowHeight:this.#we()}),getRenderer:()=>this.dragPreviewRenderer,getDragPreviewSourceResolver:()=>this.dragPreviewSource,dispatch:e=>{let n=e.selected.map(e=>e.key),r=e.selected.map(e=>e.item),i=new CustomEvent(`list-native-drag-start`,{detail:e,bubbles:!0,composed:!0,cancelable:!0}),a=this.dispatchEvent(i);return a&&(this.#Z=new Set(n),this.#Q=!1,(this.itemDnd===`internal`||this.itemDnd===`both`)&&Vb(this.#K,this,r,n),this.dispatchEvent(new CustomEvent(`tree-drag-start`,{detail:{nodes:r,keys:n},bubbles:!0,composed:!0}))),a},writeDataTransfer:(e,n)=>{if(this.itemDnd!==`internal`&&this.itemDnd!==`both`)return;let r=n.selected.map(e=>e.key),i=n.selected.map(e=>e.item);try{e.setData(Fb,JSON.stringify({sourceId:this.#K,keys:r,nodes:i})),e.setData(`text/plain`,i.map(e=>e.item.label).join(`
|
|
8148
|
+
`))}catch{}},onActiveChange:e=>{this.toggleAttribute(`data-native-dragging`,e),e||(this.#Z=new Set),this.requestUpdate()},onEnd:()=>{Hb(this.#K),this.#Z=new Set,this.#q=setTimeout(()=>{this.#q=void 0},150),this.#Q||this.dispatchEvent(new CustomEvent(`tree-drag-end`,{detail:{dropped:!1},bubbles:!0,composed:!0})),this.#Q=!1}}),this.#Y=new Yb(this,{getDndMode:()=>this.itemDnd,getExpandHoverMs:()=>this.dndExpandHoverMs,getVisibleRows:()=>this.#De(),getRowInfo:e=>{let n=this.#s(),r=n.indexByKey.get(e);if(r===void 0)return;let{node:i,depth:a,parentKey:o}=n.rows[r];return{node:i,depth:a,parentKey:o}},getChildren:e=>this.#Te(e),getIndentPx:()=>this.#Ce(),getScrollContainer:()=>this.#Se(),isSelfOrDescendant:(e,n)=>this.#ke(e,n),isExpanded:e=>this._expandedKeys.has(e),isReorderAllowed:()=>this.reorderable,getParentKey:e=>this.#Ae(e)?.item.key,resolveDrag:(e,n)=>this.#Me(e,n),vet:e=>{if(this.canDrop&&!this.canDrop(e))return!1;let n=new CustomEvent(`tree-drag-over`,{detail:e,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(n)},expandKey:e=>this.#Oe(e),onDropStateChange:e=>{this.#J=e,this.toggleAttribute(`data-drop-rejected`,this.#Y.isDragging&&e===void 0),this.requestUpdate()},onActiveChange:e=>{e?(this.#$=void 0,this.#Se()?.addEventListener(`scroll`,this.#ee,{passive:!0})):(this.#Se()?.removeEventListener(`scroll`,this.#ee),this.#$=void 0,this.toggleAttribute(`data-drop-rejected`,!1)),this.requestUpdate()},commitDrop:e=>this.dispatchEvent(new CustomEvent(`tree-drop`,{detail:e,bubbles:!0,composed:!0,cancelable:!0}))?(this.applyInternalDrop&&e.source===`internal`&&this.model&&this.model.applyDrop({source:`internal`,draggedKeys:e.draggedKeys,target:e.target}),this.#Q=!0,!0):!1,onDragEnd:e=>{this.#J=void 0,this.toggleAttribute(`data-drop-rejected`,!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent(`tree-drag-end`,{detail:{dropped:e},bubbles:!0,composed:!0}))}})}#Se(){return this.shadowRoot?.querySelector(`#container`)??void 0}#Ce(){let e=Number.parseInt(getComputedStyle(this).getPropertyValue(`--tree-indent`),10);return Number.isNaN(e)?20:e}#we(){let e=Number.parseInt(getComputedStyle(this).getPropertyValue(`--tree-item-height`),10);return Number.isNaN(e)?30:e}#Te(e){if(e===void 0)return this.root?.children??[];let n=this.#s(),r=n.indexByKey.get(e);return r===void 0?[]:n.rows[r].node.children??[]}#Ee(e,n,r){let i=this.#s(),a=this.#v(i.rows.length),o=px(dx(a),e.scrollTop,e.scrollTop+e.clientHeight,1);if(!o)return;let s=e.getBoundingClientRect(),c=n.querySelector(`li.item`)?.getBoundingClientRect()??s;for(let n=o.first;n<=o.last;n++){let{node:o,depth:l}=i.rows[n],u=s.top-e.scrollTop+ax(a,n),d={x:c.left,y:u,left:c.left,right:c.left+c.width,top:u,bottom:u+a.rowHeight,width:c.width,height:a.rowHeight,toJSON:()=>({})};r.push({key:o.item.key,node:o,depth:l,index:n,rect:d})}}#De(){if(this.#$)return this.#$;let e=[],n=this.#Se(),r=this.renderRoot.querySelector(`ul.tree-list`),i=this.#R;if(n&&r&&this.#_())this.#Ee(n,r,e);else if(n&&r&&r.children.length===i.length){let a=this.#s(),o=r.children,s=px(this.#re(o),n.scrollTop,n.scrollTop+n.clientHeight,1);if(s)for(let n=s.first;n<=s.last;n++){let r=o[n];if(r.classList.contains(`leaving`))continue;let s=a.indexByKey.get(i[n]);if(s===void 0)continue;let{node:c,depth:l}=a.rows[s];e.push({key:c.item.key,node:c,depth:l,index:s,rect:r.getBoundingClientRect()})}}return this.#$=e,e}#Oe(e){if(this._expandedKeys.has(e))return;let n=this.#s(),r=n.indexByKey.get(e),i=r===void 0?void 0:n.rows[r];!i||i.node.item.isLeaf===!0||(this.#Je(i.node,i.depth),this.#$=void 0,this.requestUpdate())}#ke(e,n){if(e===n)return!0;let{parentByKey:r}=this.#c(),i=r.get(n);for(;i!==void 0;){if(i===e)return!0;i=r.get(i)}return!1}#Ae(e){let n=this.#c().parentByKey.get(e);if(n!==void 0&&n!==this.root?.item.key)return this.#je(n)}#je(e){let n=this.#s(),r=n.indexByKey.get(e);if(r!==void 0)return n.rows[r].node;let{parentByKey:i}=this.#c(),a=[];for(let n=e;n!==void 0&&n!==this.root?.item.key;n=i.get(n))a.unshift(n);let o=this.root;for(let e of a)o=o?.children?.find(n=>n.item.key===e);return o}#Me(e,n){let r=this.itemDnd;if(r===`none`)return;let i=r===`internal`||r===`both`,a=r===`external`||r===`both`,o=[];try{o=Array.from(e.types)}catch{}let s=Ub(),c=o.includes(Fb)||s!==void 0;if(i&&c){if(s&&s.keys.length>0){let e=this.root?Cg(this.root,s.keys):s.keys;return{source:`internal`,keys:e,nodes:e.map(e=>this.#je(e)).filter(e=>e!==void 0)}}if(n===`drop`)try{let n=e.getData(Fb);if(n){let e=JSON.parse(n);return{source:`internal`,keys:e.keys??[],nodes:e.nodes??[]}}}catch{}return{source:`internal`,keys:[],nodes:[]}}if(a&&!c){if(this.acceptDropTypes!==void 0){let n=this.acceptDropTypes.trim().split(/\s+/).filter(Boolean),r=Array.from(e.types);if(n.length>0&&!n.some(e=>r.includes(e)))return}if(n===`drop`){let n=this.parseExternalDrop?.(e);return!n||n.length===0?void 0:{source:`external`,keys:n.map(e=>e.item.key),nodes:n}}return this.parseExternalDrop?{source:`external`,keys:[],nodes:[]}:void 0}}#Ne(){if(this.itemDnd===`none`)return!1;let e=this.#s().rows;return e.length===0?!1:!this.canDrag||e.some(({node:e})=>this.canDrag({nodes:[e],keys:[e.item.key]}))}disconnectedCallback(){super.disconnectedCallback(),this.#ge(),this.#H.clear(),this.#V.clear(),this.#N?.(),this.#N=void 0,this.#O?.(),this.#O=void 0,this.#q!==void 0&&(clearTimeout(this.#q),this.#q=void 0),this.#Se()?.removeEventListener(`scroll`,this.#ee),this.#T(),this.#me&&=(this.#pe?.removeEventListener(`scroll`,this.#ne),this.#pe=void 0,!1),this.#fe!==0&&(cancelAnimationFrame(this.#fe),this.#fe=0),Hb(this.#K),this.#F&&(this.#F.unregister(`select-all`),this.#F.unregister(`deselect-all`),this.#F=void 0,this.registry=void 0)}getConfig(){return{...this.#I}}setConfig(e){this.#I={...this.#I,...e},this.requestUpdate()}select(e){if(!this.#Ie(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#Be(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#Be(n),this.requestUpdate()}clearSelection(){if(this._selectedNodes.size===0)return;let e=new Set(this._selectedNodes);this.#Le(),this.#Be(e),this.requestUpdate()}selectAll(){let e=new Set(this._selectedNodes);if(this.interactionMode===`checked`)for(let{node:e}of this.#s().rows)this.#Ie(e)&&this.#Xe(e,!0);else{for(let{node:e}of this.#s().rows)this.#Ie(e)&&this._selectedNodes.add(e);this.selectedNode=[...this._selectedNodes].at(-1)}this.#Be(e),this.requestUpdate()}deselectAll(){let e=new Set(this._selectedNodes);if(this.interactionMode===`checked`)for(let{node:e}of this.#s().rows)this.#Ie(e)&&this.#Xe(e,!1);else this.#Le();this.#Be(e),this.requestUpdate()}expandAll(e,n){this.#G=n,this.#Pe(!0,e)}collapseAll(e,n){this.#G=n,this.#Pe(!1,e)}#Pe(e,n){let r=this.root;if(!r)return;let i=r=>e?r<(n??1/0):r>=(n??0),a=[],o=this._expandedKeys,s=(n,r)=>{let c=n.children;if(n.item.isLeaf!==!0&&c!==void 0&&c.length>0&&i(r)){let i=o.has(n.item.key);e&&!i?(o=tx(o,n.item.key),this._isExpanded(n,r)||a.push({node:n,depth:r})):!e&&i&&(o=nx(o,n.item.key),a.push({node:n,depth:r}))}for(let e of c??[])s(e,r+1)};for(let e of r.children??[])s(e,0);if(o===this._expandedKeys)return;this.#e(o);let c=e?`expand`:`collapse`;for(let{node:e,depth:n}of a)this.dispatchEvent(new CustomEvent(c,{detail:{node:e,depth:n},bubbles:!0,composed:!0}));this.requestUpdate()}navigateTo(e,n={}){if(!this.root?.children)return!1;let r=this.#Re,i=this.#ze;this.#Re=`programmatic`,this.#ze=n.silent===!0,n.animate!==void 0&&(this.#G=n.animate);try{return this.#Fe(e,n.reveal??`edge`)}finally{this.#Re=r,this.#ze=i}}#Fe(e,n){this.#rt(),this.#Le(),this.tickled.clearTickled(),this._focusedDepth=0;let r=this.root;for(let n of e){let i=r?.children;if(!i)return!1;let a=i.find(e=>e.item.key===n);if(!a)return!1;this.#it(a.item.key),this.#e(tx(this._expandedKeys,a.item.key)),n===e.at(-1)&&(this.select(a),this.tickled.setTickled(a.item.key)),r=a}return this.#de=!0,this.requestUpdate(),this.#et(e.at(-1),n),!0}navigateToNode(e,n){if(!this.root?.children)return!1;n!==void 0&&(this.#G=n);let r=this.#Ve(this.root.children,e);return r?this.navigateTo(r):!1}revealKey(e,n){if(!this.root?.children)return!1;n!==void 0&&(this.#G=n);let r=this.#Ve(this.root.children,n=>n.item.key===e);if(!r)return!1;for(let e=0;e<r.length-1;e++)this.#it(r[e]),this.#e(tx(this._expandedKeys,r[e]));return this.tickled.setTickled(e),this.#de=!0,this.requestUpdate(),this.updateComplete.then(()=>this.#et(e)),!0}selectMany(e){let n=new Set(this._selectedNodes);this._selectedNodes=new Set([...e].filter(e=>this.#Ie(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#Be(n),this.requestUpdate()}getNodes(){if(!this.root?.children)return[];let e=[],n=(r,i)=>{if(e.push({node:r,depth:i}),r.children)for(let e of r.children)n(e,i+1)};for(let e of this.root.children)n(e,0);return e}#Ie(e){return e.item.selectable===!1||this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0||e.item.isLeaf!==!1&&e.children?.length===0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#Le(){this._selectionVersion++,this._selectedNodes.clear(),this.selectedNode=void 0}#Re;#ze;#Be(e){if(this._selectionVersion++,this.#ze)return;let n={selected:new Set(this._selectedNodes),previous:e,origin:this.#Re};this.dispatchEvent(new CustomEvent(`select`,{detail:n,bubbles:!0,composed:!0}))}#Ve(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#Ve(i.children,n,e);if(r)return r}}}renderNodeContent(e,n){let r=e.item.isLeaf!==!0,o=this._isExpanded(e,n);return i`
|
|
8143
8149
|
<span class="tree-caret">
|
|
8144
8150
|
${r?i`<ixfx-icon class="caret-icon" name="chevron-down" .rotate=${o?a:`-90deg`}></ixfx-icon>`:``}
|
|
8145
8151
|
</span>
|
|
8146
8152
|
<span class="tree-label">${e.item.label}</span>
|
|
8147
|
-
`}_handleItemClick(e,n,r){if(!(this.#Y?.isDragging||this.#X?.isDragging||this.#q!==void 0)&&!(r&&r.detail>=2)){switch(this.#j&&this._expandedKeys.has(this.#j.item.key)&&this.#rt(),this.tickled.handlePointerEnter(e.item.key),this._focusedDepth=n,this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e,depth:n},bubbles:!0,composed:!0})),this.interactionMode){case`implicit`:this.#Ue(e,n,r);break;case`standard`:this.#We(e,n,r);break;case`vscode`:this.#We(e,n,r);break;case`manual`:this.#Ke(e,n,r);break;case`checked`:this.#Ge(e,n)}this.requestUpdate()}}#He(e,n){if(e.item.isLeaf===!0)return!1;let r=n?.target;return r instanceof Element&&r.closest(`.tree-caret`)!==null}#Ue(e,n,r){if(!this.#He(e,r)&&this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,(!n.has(e)||n.size!==1)&&this.#Be(n)}this.#Je(e,n)}#We(e,n,r){let i=r?r.metaKey||r.ctrlKey:!1,a=r?r.shiftKey:!1;if(i){if(this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.has(e)?(this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1))):(this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)}),this.#Be(n)}return}if(a&&this.#P){let n=this.#s(),r=n.rows,i=n.indexByKey.get(this.#P.node.item.key)??-1,a=n.indexByKey.get(e.item.key)??-1;if(i>=0&&a>=0){let n=new Set(this._selectedNodes),o=Math.min(i,a),s=Math.max(i,a),c=r.slice(o,s+1).map(e=>e.node).filter(e=>this.#Ie(e));this._selectedNodes=new Set(c),this.selectedNode=e,this.#Be(n)}return}if(!this.#He(e,r)&&this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)},(!n.has(e)||n.size!==1)&&this.#Be(n)}this.#Je(e,n)}#Ge(e,n){this.#Je(e,n)}#Ke(e,n,r){let i=r?r.metaKey||r.ctrlKey:!1,a=r?r.shiftKey:!1;if(i){if(this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.has(e)?(this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1))):(this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)}),this.#Be(n)}return}if(a&&this.#P){let n=this.#s(),r=n.rows,i=n.indexByKey.get(this.#P.node.item.key)??-1,a=n.indexByKey.get(e.item.key)??-1;if(i>=0&&a>=0){let n=new Set(this._selectedNodes),o=Math.min(i,a),s=Math.max(i,a),c=r.slice(o,s+1).map(e=>e.node).filter(e=>this.#Ie(e));this._selectedNodes=new Set(c),this.selectedNode=e,this.#Be(n)}return}this.#Je(e,n)}#qe(e,n){if(!this.#Ie(e))return;let r=new Set(this._selectedNodes);this._selectedNodes.has(e)?(this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1))):(this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)}),this.#Be(r)}_handleCheckboxClick(e,n,r){e.stopPropagation();let i=new Set(this._selectedNodes),a=this.#Ye(n);this.#Xe(n,!a),(this.selectedNode===void 0||!this._selectedNodes.has(this.selectedNode))&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#Be(i),this.requestUpdate()}#Je(e,n){let r=this._expandedKeys.has(e.item.key);if(this.#de=!0,r)this.#e(nx(this._expandedKeys,e.item.key)),this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}));else if(e.children===void 0){if(e.item.isLeaf!==!1)return;if(this.model??(this.loadChildren?this:void 0)){this.#j=e;let r=new AbortController;this.#M=r,this.#$e(e,n,r).catch(()=>{})}}else this.#it(e.item.key),this.#e(tx(this._expandedKeys,e.item.key)),this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}#Ye(e){let n=[],r=e=>{this.#Ie(e)&&n.push(e),e.children?.forEach(r)};return r(e),n.length>0&&n.every(e=>this._selectedNodes.has(e))}#Xe(e,n){if(this.#Ie(e)&&(n?this._selectedNodes.add(e):this._selectedNodes.delete(e)),e.children)for(let r of e.children)this.#Xe(r,n)}#Ze(e){return this.#s().indexByKey.get(e.item.key)??-1}#Qe(e,n,r){if(!this.#P){let r=e[n]?.node;r&&(this.#P={node:r,flatIndex:n})}if(!this.#P)return;let i=this.#s().indexByKey.get(this.#P.node.item.key)??-1;if(i<0)return;let a=Math.min(i,r),o=Math.max(i,r);if(this.interactionMode===`vscode`){this.#P.selectionSnapshot||(this.#P={...this.#P,selectionSnapshot:new Set(this._selectedNodes)});let n=this.#P.selectionSnapshot,i=e.slice(a,o+1).map(e=>e.node).filter(e=>this.#Ie(e)),s=new Set(n);for(let e of i)n.has(e)?s.delete(e):s.add(e);let c=new Set(this._selectedNodes);this._selectedNodes=s,this.selectedNode=e[r]?.node??this.selectedNode,this.#Be(c)}else{let n=new Set(this._selectedNodes),i=e.slice(a,o+1).map(e=>e.node).filter(e=>this.#Ie(e));this._selectedNodes=new Set(i),this.selectedNode=e[r]?.node??this.selectedNode,this.#Be(n)}}async#$e(e,n,r){try{let i;if(i=this.model?await this.model.getChildren(e,n,r.signal):[...await
|
|
8153
|
+
`}_handleItemClick(e,n,r){if(!(this.#Y?.isDragging||this.#X?.isDragging||this.#q!==void 0)&&!(r&&r.detail>=2)){switch(this.#j&&this._expandedKeys.has(this.#j.item.key)&&this.#rt(),this.tickled.handlePointerEnter(e.item.key),this._focusedDepth=n,this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e,depth:n},bubbles:!0,composed:!0})),this.interactionMode){case`implicit`:this.#Ue(e,n,r);break;case`standard`:this.#We(e,n,r);break;case`vscode`:this.#We(e,n,r);break;case`manual`:this.#Ke(e,n,r);break;case`checked`:this.#Ge(e,n)}this.requestUpdate()}}#He(e,n){if(e.item.isLeaf===!0)return!1;let r=n?.target;return r instanceof Element&&r.closest(`.tree-caret`)!==null}#Ue(e,n,r){if(!this.#He(e,r)&&this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,(!n.has(e)||n.size!==1)&&this.#Be(n)}this.#Je(e,n)}#We(e,n,r){let i=r?r.metaKey||r.ctrlKey:!1,a=r?r.shiftKey:!1;if(i){if(this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.has(e)?(this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1))):(this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)}),this.#Be(n)}return}if(a&&this.#P){let n=this.#s(),r=n.rows,i=n.indexByKey.get(this.#P.node.item.key)??-1,a=n.indexByKey.get(e.item.key)??-1;if(i>=0&&a>=0){let n=new Set(this._selectedNodes),o=Math.min(i,a),s=Math.max(i,a),c=r.slice(o,s+1).map(e=>e.node).filter(e=>this.#Ie(e));this._selectedNodes=new Set(c),this.selectedNode=e,this.#Be(n)}return}if(!this.#He(e,r)&&this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)},(!n.has(e)||n.size!==1)&&this.#Be(n)}this.#Je(e,n)}#Ge(e,n){this.#Je(e,n)}#Ke(e,n,r){let i=r?r.metaKey||r.ctrlKey:!1,a=r?r.shiftKey:!1;if(i){if(this.#Ie(e)){let n=new Set(this._selectedNodes);this._selectedNodes.has(e)?(this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1))):(this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)}),this.#Be(n)}return}if(a&&this.#P){let n=this.#s(),r=n.rows,i=n.indexByKey.get(this.#P.node.item.key)??-1,a=n.indexByKey.get(e.item.key)??-1;if(i>=0&&a>=0){let n=new Set(this._selectedNodes),o=Math.min(i,a),s=Math.max(i,a),c=r.slice(o,s+1).map(e=>e.node).filter(e=>this.#Ie(e));this._selectedNodes=new Set(c),this.selectedNode=e,this.#Be(n)}return}this.#Je(e,n)}#qe(e,n){if(!this.#Ie(e))return;let r=new Set(this._selectedNodes);this._selectedNodes.has(e)?(this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1))):(this._selectedNodes.add(e),this.selectedNode=e,this.#P={node:e,flatIndex:this.#Ze(e)}),this.#Be(r)}_handleCheckboxClick(e,n,r){e.stopPropagation();let i=new Set(this._selectedNodes),a=this.#Ye(n);this.#Xe(n,!a),(this.selectedNode===void 0||!this._selectedNodes.has(this.selectedNode))&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#Be(i),this.requestUpdate()}#Je(e,n){let r=this._expandedKeys.has(e.item.key);if(this.#de=!0,r)this.#e(nx(this._expandedKeys,e.item.key)),this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}));else if(e.children===void 0){if(e.item.isLeaf!==!1)return;if(this.model??(this.loadChildren?this:void 0)){this.#j=e;let r=new AbortController;this.#M=r,this.#$e(e,n,r).catch(()=>{})}}else this.#it(e.item.key),this.#e(tx(this._expandedKeys,e.item.key)),this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}#Ye(e){let n=[],r=e=>{this.#Ie(e)&&n.push(e),e.children?.forEach(r)};return r(e),n.length>0&&n.every(e=>this._selectedNodes.has(e))}#Xe(e,n){if(this.#Ie(e)&&(n?this._selectedNodes.add(e):this._selectedNodes.delete(e)),e.children)for(let r of e.children)this.#Xe(r,n)}#Ze(e){return this.#s().indexByKey.get(e.item.key)??-1}#Qe(e,n,r){if(!this.#P){let r=e[n]?.node;r&&(this.#P={node:r,flatIndex:n})}if(!this.#P)return;let i=this.#s().indexByKey.get(this.#P.node.item.key)??-1;if(i<0)return;let a=Math.min(i,r),o=Math.max(i,r);if(this.interactionMode===`vscode`){this.#P.selectionSnapshot||(this.#P={...this.#P,selectionSnapshot:new Set(this._selectedNodes)});let n=this.#P.selectionSnapshot,i=e.slice(a,o+1).map(e=>e.node).filter(e=>this.#Ie(e)),s=new Set(n);for(let e of i)n.has(e)?s.delete(e):s.add(e);let c=new Set(this._selectedNodes);this._selectedNodes=s,this.selectedNode=e[r]?.node??this.selectedNode,this.#Be(c)}else{let n=new Set(this._selectedNodes),i=e.slice(a,o+1).map(e=>e.node).filter(e=>this.#Ie(e));this._selectedNodes=new Set(i),this.selectedNode=e[r]?.node??this.selectedNode,this.#Be(n)}}async#$e(e,n,r){try{let i;if(i=this.model?await this.model.getChildren(e,n,r.signal):[...await hg(this.loadChildren({node:e,depth:n},r.signal),r.signal)],r.signal.aborted)return;e.children=i,this.#i++,this.#it(e.item.key),this.#e(tx(this._expandedKeys,e.item.key)),this.#t=void 0,this.#de=!0,this.#j=void 0,this.#M=void 0,this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:n},bubbles:!0,composed:!0})),this.requestUpdate()}catch{if(r.signal.aborted)return;e.children=[],this.#i++,this.#t=void 0,this.#j=void 0,this.#M=void 0,this.requestUpdate()}}_isSelected(e){return this._selectedNodes.has(e)}_isFocused(e){return this.tickled.isTickled(e.item.key)}_isExpanded(e,n=0){return this._expandedKeys.has(e.item.key)?!0:this.#D()?.autoExpanded.has(e.item.key)??!1}get _pendingNode(){return this.#j}#et(e,n=`edge`){if(n===`center-if-hidden`){this.updateComplete.then(()=>{this.#y();let r=this.#s().indexByKey.get(e);r!==void 0&&this.#E(r,n)});return}if(this.#_()){this.updateComplete.then(()=>{let n=this.#s().indexByKey.get(e);n!==void 0&&this.#E(n)});return}let r=++this.#tt;requestAnimationFrame(()=>{this.#nt(e);let n=this.#Se()?.getAnimations?.({subtree:!0})??[];n.length>0&&Promise.allSettled(n.map(e=>e.finished)).then(()=>{r===this.#tt&&this.#nt(e)})})}#tt;#nt(e){let n=this.#Se(),r=this.shadowRoot?.querySelector(`ul.tree-list [data-key="${CSS.escape(e)}"]`);if(!r||!n)return;let i=r.getBoundingClientRect(),a=n.getBoundingClientRect(),o=i.top-a.top,s=o+i.height,c=this.renderRoot.querySelector(`.sticky-headers`)?.getBoundingClientRect().height??0;o<c?n.scrollTop+=o-c:s>n.clientHeight&&(n.scrollTop+=s-n.clientHeight)}#rt(){this.#M&&(this.#M.abort(),this.#M=void 0,this.#j=void 0)}#it(e){if(this.exclusivity!==`none`){if(this.exclusivity===`depth`)this.#at(e);else if(this.exclusivity===`global`){let n=this.#ot(e);this.#e(rx(this._expandedKeys,r=>!n.has(r)&&r!==e))}}}#at(e){if(!this.root)return;let n=this.#st(this.root,e);if(!n?.children)return;let r=new Set(n.children.map(e=>e.item.key));this.#e(rx(this._expandedKeys,n=>n!==e&&r.has(n)))}#ot(e){let n=new Set,r=i=>{if(i.item.key===e)return!0;if(!i.children)return!1;for(let e of i.children)if(r(e))return n.add(i.item.key),!0;return!1};return this.root&&r(this.root),n}#st(e,n,r=void 0){if(e.children)for(let i of e.children){if(i.item.key===n)return r??e;let a=this.#st(i,n,i);if(a)return a}}#ct(){let e=this.tickled.tickledId;return e?this.#s().indexByKey.get(e)??0:0}#lt(e){let n=this.#s().rows;if(e<0||e>=n.length)return;let{node:r,depth:i}=n[e];if(this.tickled.setTickled(r.item.key),this._focusedDepth=i,this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:r,depth:i},bubbles:!0,composed:!0})),this.requestUpdate(),this.#_()){this.#E(e);return}this.updateComplete.then(()=>this.#ut())}#ut(){let e=this.tickled.tickledId;e!==void 0&&(this.shadowRoot?.querySelector(`ul.tree-list [data-key="${CSS.escape(e)}"]`))?.scrollIntoView({block:`nearest`,behavior:`smooth`})}#dt(){return this.#y(),ux(this.#v(this.#s().rows.length))}#ft(e,n,r,i){this.interactionMode===`implicit`&&this.select(e[r].node),this.#lt(r),i&&(this.interactionMode===`standard`||this.interactionMode===`vscode`)?this.#Qe(e,n,r):this.interactionMode===`vscode`&&(this.#P=void 0),this.requestUpdate()}#pt;renderLoadingIndicator(){return i`<span class="loading-spinner"></span>`}render(){let e=this.#s().rows;return i`
|
|
8148
8154
|
<div
|
|
8149
8155
|
id="container"
|
|
8150
8156
|
data-input-mode=${this.tickled.inputMode}
|
|
@@ -8196,7 +8202,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
8196
8202
|
${this.renderNodeContent(e,n)}
|
|
8197
8203
|
${l?this.renderLoadingIndicator():a}
|
|
8198
8204
|
</li>
|
|
8199
|
-
`}static{this.styles=[w,se,C,
|
|
8205
|
+
`}static{this.styles=[w,se,C,Vt,r`
|
|
8200
8206
|
:host {
|
|
8201
8207
|
--tree-bg: var(--surface-3);
|
|
8202
8208
|
--tree-text: var(--surface-3-text);
|
|
@@ -8555,7 +8561,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
8555
8561
|
white-space: nowrap;
|
|
8556
8562
|
position: relative;
|
|
8557
8563
|
}
|
|
8558
|
-
`]}};E([d({attribute:!1})],hx.prototype,`checkboxRenderer`,void 0),E([d({type:Boolean,reflect:!0,attribute:`align-checkboxes`})],hx.prototype,`alignCheckboxes`,void 0),hx=E([T(`ixfx-tree-list`)],hx);function gx(e,n){let r=document.createElement(`div`);r.style.cssText=`display:contents;`;let i;function a(r){let i={...e(r),data:r},o=n?.getChildren?.(r);return{item:i,children:o?o.map(a):i.isLeaf?[]:void 0}}function o(){return i||(i=document.createElement(`ixfx-tree-list`),i.interactionMode=n?.interactionMode??`standard`,i.selectionFilter=n?.selectionFilter??`all`,i.exclusivity=n?.exclusivity??`none`,i.style.cssText=`display:block;width:100%;`,r.appendChild(i),c(),i)}function s(e){let n=new Set;for(let r of e)r.item.data!==void 0&&n.add(r.item.data);return n}function c(){i.addEventListener(`select`,e=>{e.stopPropagation();let n={selected:s(e.detail.selected),previous:s(e.detail.previous)};r.dispatchEvent(new CustomEvent(`select`,{detail:n,bubbles:!0,composed:!0}))}),i.addEventListener(`activate`,e=>{e.stopPropagation();let n=e.detail.node.item.data;if(n===void 0)return;let i={item:n};r.dispatchEvent(new CustomEvent(`activate`,{detail:i,bubbles:!0,composed:!0}))}),i.addEventListener(`item-click`,e=>{e.stopPropagation();let n=e.detail.node.item.data;if(n===void 0)return;let i={item:n};r.dispatchEvent(new CustomEvent(`item-click`,{detail:i,bubbles:!0,composed:!0}))}),i.addEventListener(`tickle`,e=>{e.stopPropagation();let n=e.detail.node.item.data;if(n===void 0)return;let i={item:n};r.dispatchEvent(new CustomEvent(`tickle`,{detail:i,bubbles:!0,composed:!0}))})}let l=`single`,u=Object.assign(r,{setItems(e){let n=o();n.root={item:{key:`__adapter_root__`,label:``,isLeaf:!1},children:e.map(a)}},clearSelection(){i?.clearSelection()},dispatch(e,r){n?.onDispatch?.(e,r,i)}});return Object.defineProperties(u,{selectedItems:{get(){return i?s(i.selectedNodes):new Set},enumerable:!0,configurable:!0},selectionMode:{get(){return l},set(e){l=e,i&&(e===`none`?i.selectionFilter=`none`:e===`single`?(i.selectionFilter=n?.selectionFilter??`all`,i.interactionMode=`implicit`):(i.selectionFilter=n?.selectionFilter??`all`,i.interactionMode=n?.interactionMode??`standard`))},enumerable:!0,configurable:!0}}),u}function _x(e,n){let r=document.createElement(`div`);r.style.cssText=`display:contents;`;let i,a=n?.selectionMode??`single`,o=new WeakMap;function s(){return i||(i=document.createElement(`ixfx-vertical-list`),i.style.cssText=`height:auto;width:100%;`,i.selectionMode=a,n?.interactionMode&&(i.interactionMode=n.interactionMode),r.appendChild(i),c(),i)}function c(){i.addEventListener(`list-select`,e=>{let n={selected:u(e.detail.selected),previous:u(e.detail.previous)};r.dispatchEvent(new CustomEvent(`select`,{detail:n,bubbles:!0,composed:!0}))}),i.addEventListener(`list-activate`,e=>{let n=o.get(e.detail.item);n!==void 0&&r.dispatchEvent(new CustomEvent(`activate`,{detail:{item:n},bubbles:!0,composed:!0}))}),i.addEventListener(`list-item-click`,e=>{let n=o.get(e.detail.item);n!==void 0&&r.dispatchEvent(new CustomEvent(`item-click`,{detail:{item:n},bubbles:!0,composed:!0}))}),i.addEventListener(`list-tickle`,e=>{let n=o.get(e.detail.item);n!==void 0&&r.dispatchEvent(new CustomEvent(`tickle`,{detail:{item:n},bubbles:!0,composed:!0}))})}function l(n){let r=s();r.clearItems(),o=new WeakMap;for(let i of n){let n=e(i);o.set(n,i),r.addItem(n)}}function u(e){let n=new Set;for(let r of e){let e=o.get(r);e!==void 0&&n.add(e)}return n}let d=Object.assign(r,{setItems(e){l(e)},clearSelection(){i?.clearSelection()},dispatch(e,r){n?.onDispatch?.(e,r,i)}});return Object.defineProperties(d,{selectedItems:{get(){return i?u(i.selectedItems):new Set},enumerable:!0,configurable:!0},selectionMode:{get(){return i?.selectionMode??a},set(e){a=e,i&&(i.selectionMode=e)},enumerable:!0,configurable:!0}}),d}const vx=new Set([9,10,11,12,13,32]);function yx(e){return e<32&&e!==9&&e!==10&&e!==11&&e!==12&&e!==13}function bx(e){return e>=32&&e<=126}function xx(e){return e===0?`byte-null`:vx.has(e)?`byte-whitespace`:yx(e)?`byte-control`:bx(e)?`byte-printable`:`byte-other`}function Sx(e,n,r,i){let a=ag.createSteps(r,i,{steps:16}).map(ag.toCssColour);return{forByte:r=>r===0?e:r===255?n:a[r>>4]}}function Cx(e){return{data:new Uint8Array(e),changeset:new Set}}function wx(e,n){return e.data[n]??0}function Tx(e){return e.data.length}function Ex(e){return Math.max(0,Math.min(255,e))}function Dx(e,n,r){let i=Ex(r),a=e.data[n],o=new Map([[n,{before:a,after:i}]]);return e.data[n]=i,e.changeset.add(n),o}function Ox(e,n){let r=new Map;return n.forEach((n,i)=>{let a=Ex(n),o=e.data[i];r.set(i,{before:o,after:a}),e.data[i]=a,e.changeset.add(i)}),r}function kx(e,n){let r=new Map;return n.forEach((n,i)=>{let a=e.data[i];r.set(i,{before:n.after,after:a}),e.data[i]=n.after,e.changeset.add(i)}),r}function Ax(e){let n=new Map;return e.forEach((e,r)=>{n.set(r,{before:e.after,after:e.before})}),n}function jx(e){return e.changeset}function Mx(){return{undos:[],redos:[]}}function Nx(e,n){e.undos.push(n),e.redos=[]}function Px(e){let n=e.undos.pop();return n&&e.redos.push(n),n}function Fx(e){let n=e.redos.pop();return n&&e.undos.push(n),n}const Ix=e=>e*4,Lx=(e,n)=>e<n?e:n,Rx=(e,n)=>e>n?e:n;function zx(e,n){return Math.max(0,Math.min(e,n-1))}function Bx(e,n){if(!e)return[];let r=Ix(n);if(e.kind===`single`)return[e.pos];if(e.kind===`contiguous`){let n=Lx(e.start,e.end),r=Rx(e.start,e.end),i=[];for(let e=n;e<=r;e++)i.push(e);return i}if(e.kind===`rectangular`){let n=[];for(let i=0;i<e.height;i++)for(let a=0;a<e.width;a++){let o=e.y+i,s=e.x+a,c=o*r+s;n.push(c)}return n}return[]}function Vx(e,n,r){if(!e)return!1;let i=Ix(r);if(e.kind===`single`)return n===e.pos;if(e.kind===`contiguous`){let r=Lx(e.start,e.end),i=Rx(e.start,e.end);return n>=r&&n<=i}if(e.kind===`rectangular`){let r=Math.floor(n/i),a=n%i,o=e.x,s=e.y,c=e.width,l=e.height;return r>=s&&r<s+l&&a>=o&&a<o+c}return!1}function Hx(e,n,r,i){let a;a=e?e.kind===`single`?e.pos:e.kind===`contiguous`?Rx(e.start,e.end):e.kind===`rectangular`?e.y*Ix(r)+e.x+e.width-1:0:0;let o=Ix(r),s;switch(n){case`left`:s=a-1;break;case`right`:s=a+1;break;case`up`:s=a-o;break;case`down`:s=a+o;break;default:s=a}return zx(s,i)}function Ux(e,n,r,i){return{kind:`single`,pos:Hx(e,n,r,i)}}function Wx(e,n,r,i,a=0,o=0){let s=Ix(r),c,l,u,d;if(!e||e.kind===`single`){let n=e?.kind===`single`?e.pos:0;c=n%s,l=Math.floor(n/s),u=1,d=1}else if(e.kind===`contiguous`){let n=Lx(e.start,e.end),r=Rx(e.start,e.end);c=n%s,l=Math.floor(n/s),u=r-n+1,d=1}else e.kind===`rectangular`?(c=e.x,l=e.y,u=e.width,d=e.height):(c=0,l=0,u=1,d=1);let f=a>0||e?.kind===`rectangular`?a:c,p=o>0||e?.kind===`rectangular`?o:l;switch(n){case`left`:c>f?--u:(c===f&&u>1||c>0)&&(--c,u+=1);break;case`right`:c+u<s&&(u+=1);break;case`up`:l>p?--d:(l===p&&d>1||l>0)&&(--l,d+=1);break;case`down`:d+=1}return{kind:`rectangular`,x:c,y:l,width:u,height:d}}function Gx(e,n,r,i){let a=Ix(i);if(r===`contiguous`)return{kind:`contiguous`,start:Lx(e,n),end:Rx(e,n)};let o=e%a,s=Math.floor(e/a),c=n%a,l=Math.floor(n/a);return{kind:`rectangular`,x:Lx(o,c),y:Lx(s,l),width:Math.abs(c-o)+1,height:Math.abs(l-s)+1}}let Kx=class extends n{constructor(...e){super(...e),this.columns=4,this.colourScheme=`ascii`,this.showChangeset=!0,this.hideOffsetCol=!1,this.hideHexCol=!1,this.hideTextCol=!1,this._selection=null,this._scrollTop=0,this._editState=null,this._containerH=0,this._shadeMap=null,this._focusSide=null,this._store=Cx(new Uint8Array),this._undoStack=Mx(),this._copyBuffer=null,this._rowHeight=24,this._dragStart=null,this._dragAnchor=null,this._rectAnchorX=0,this._rectAnchorY=0,this._rectAnchorXFromKeyboard=0,this._rectAnchorYFromKeyboard=0,this._initialSelectionPoint=0,this._currentCursorPoint=0,this._pointerMode=null,this._currentDragDiff=null,this._shiftClickTarget=null,this._onScroll=e=>{let n=e.target;this._scrollTop=n.scrollTop,this.requestUpdate()},this._onKeyDown=e=>{if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)){e.preventDefault(),e.stopPropagation(),this._editState&&=null;let n=e.key.replace(`Arrow`,``).toLowerCase(),r=Tx(this._store),i=Ix(this.columns);if(e.metaKey||e.ctrlKey){if(!this._selection||this._selection.kind!==`rectangular`){let e=0;this._selection?.kind===`single`?e=this._selection.pos:this._selection?.kind===`contiguous`&&(e=Math.min(this._selection.start,this._selection.end)),this._rectAnchorXFromKeyboard=e%i,this._rectAnchorYFromKeyboard=Math.floor(e/i),this._selection={kind:`rectangular`,x:this._rectAnchorXFromKeyboard,y:this._rectAnchorYFromKeyboard,width:1,height:1}}this._selection=Wx(this._selection,n,this.columns,r,this._rectAnchorXFromKeyboard,this._rectAnchorYFromKeyboard)}else if(e.shiftKey){if(!this._selection)this._initialSelectionPoint=0,this._currentCursorPoint=0;else if(this._selection.kind===`single`)this._initialSelectionPoint=this._selection.pos,this._currentCursorPoint=this._selection.pos;else if(this._selection.kind===`rectangular`){let e=this._selection.y*i+this._selection.x;this._initialSelectionPoint=e,this._currentCursorPoint=e}let e=Hx(this._selection,n,this.columns,r),a=Math.min(this._initialSelectionPoint,e),o=Math.max(this._initialSelectionPoint,e);this._currentCursorPoint=e,this._selection={kind:`contiguous`,start:a,end:o}}else{this._selection=Ux(this._selection,n,this.columns,r);let e=Hx(this._selection,n,this.columns,r);this._initialSelectionPoint=e,this._currentCursorPoint=e}this._dispatchSelectEvent(),this.requestUpdate();return}if(e.key===`Tab`){if(e.preventDefault(),e.stopPropagation(),this._editState)this._advanceCursor();else{let e=Tx(this._store);this._selection=Ux(this._selection,`right`,this.columns,e),this._dispatchSelectEvent()}this.requestUpdate();return}if(e.key===`Escape`){if(e.preventDefault(),e.stopPropagation(),this._editState)this._editState=null;else if(this._selection&&this._selection.kind!==`single`){let e=this._selection,n=0;if(e.kind===`contiguous`){let r=e;n=Math.min(r.start,r.end)}if(e.kind===`rectangular`){let r=e;n=r.y*Ix(this.columns)+r.x}this._selection={kind:`single`,pos:n},this._dispatchSelectEvent()}this.requestUpdate();return}if(this._editState){if(e.stopPropagation(),e.key===`Backspace`){this._handleBackspace();return}if(e.key===`Enter`){this._editState.side===`hex`&&this._editState.partial.startsWith(`.`)&&this._commitDecimalValue();return}e.key.length===1&&this._handleValueEntry(e.key);return}if(this._selection&&this._selection.kind===`single`&&e.key.length===1){e.preventDefault(),e.stopPropagation();let n=this._selection.pos,r=this._focusSide??`hex`;this._editState={pos:n,side:r,partial:``},this._handleValueEntry(e.key)}}}static{this.styles=r`
|
|
8564
|
+
`]}};E([d({attribute:!1})],hx.prototype,`checkboxRenderer`,void 0),E([d({type:Boolean,reflect:!0,attribute:`align-checkboxes`})],hx.prototype,`alignCheckboxes`,void 0),hx=E([T(`ixfx-tree-list`)],hx);function gx(e,n){let r=document.createElement(`div`);r.style.cssText=`display:contents;`;let i;function a(r){let i={...e(r),data:r},o=n?.getChildren?.(r);return{item:i,children:o?o.map(a):i.isLeaf?[]:void 0}}function o(){return i||(i=document.createElement(`ixfx-tree-list`),i.interactionMode=n?.interactionMode??`standard`,i.selectionFilter=n?.selectionFilter??`all`,i.exclusivity=n?.exclusivity??`none`,i.style.cssText=`display:block;width:100%;`,r.appendChild(i),c(),i)}function s(e){let n=new Set;for(let r of e)r.item.data!==void 0&&n.add(r.item.data);return n}function c(){i.addEventListener(`select`,e=>{e.stopPropagation();let n={selected:s(e.detail.selected),previous:s(e.detail.previous)};r.dispatchEvent(new CustomEvent(`select`,{detail:n,bubbles:!0,composed:!0}))}),i.addEventListener(`activate`,e=>{e.stopPropagation();let n=e.detail.node.item.data;if(n===void 0)return;let i={item:n};r.dispatchEvent(new CustomEvent(`activate`,{detail:i,bubbles:!0,composed:!0}))}),i.addEventListener(`item-click`,e=>{e.stopPropagation();let n=e.detail.node.item.data;if(n===void 0)return;let i={item:n};r.dispatchEvent(new CustomEvent(`item-click`,{detail:i,bubbles:!0,composed:!0}))}),i.addEventListener(`tickle`,e=>{e.stopPropagation();let n=e.detail.node.item.data;if(n===void 0)return;let i={item:n};r.dispatchEvent(new CustomEvent(`tickle`,{detail:i,bubbles:!0,composed:!0}))})}let l=`single`,u=Object.assign(r,{setItems(e){let n=o();n.root={item:{key:`__adapter_root__`,label:``,isLeaf:!1},children:e.map(a)}},clearSelection(){i?.clearSelection()},dispatch(e,r){n?.onDispatch?.(e,r,i)}});return Object.defineProperties(u,{selectedItems:{get(){return i?s(i.selectedNodes):new Set},enumerable:!0,configurable:!0},selectionMode:{get(){return l},set(e){l=e,i&&(e===`none`?i.selectionFilter=`none`:e===`single`?(i.selectionFilter=n?.selectionFilter??`all`,i.interactionMode=`implicit`):(i.selectionFilter=n?.selectionFilter??`all`,i.interactionMode=n?.interactionMode??`standard`))},enumerable:!0,configurable:!0}}),u}function _x(e,n){let r=document.createElement(`div`);r.style.cssText=`display:contents;`;let i,a=n?.selectionMode??`single`,o=new WeakMap;function s(){return i||(i=document.createElement(`ixfx-vertical-list`),i.style.cssText=`height:auto;width:100%;`,i.selectionMode=a,n?.interactionMode&&(i.interactionMode=n.interactionMode),r.appendChild(i),c(),i)}function c(){i.addEventListener(`list-select`,e=>{let n={selected:u(e.detail.selected),previous:u(e.detail.previous)};r.dispatchEvent(new CustomEvent(`select`,{detail:n,bubbles:!0,composed:!0}))}),i.addEventListener(`list-activate`,e=>{let n=o.get(e.detail.item);n!==void 0&&r.dispatchEvent(new CustomEvent(`activate`,{detail:{item:n},bubbles:!0,composed:!0}))}),i.addEventListener(`list-item-click`,e=>{let n=o.get(e.detail.item);n!==void 0&&r.dispatchEvent(new CustomEvent(`item-click`,{detail:{item:n},bubbles:!0,composed:!0}))}),i.addEventListener(`list-tickle`,e=>{let n=o.get(e.detail.item);n!==void 0&&r.dispatchEvent(new CustomEvent(`tickle`,{detail:{item:n},bubbles:!0,composed:!0}))})}function l(n){let r=s();r.clearItems(),o=new WeakMap;for(let i of n){let n=e(i);o.set(n,i),r.addItem(n)}}function u(e){let n=new Set;for(let r of e){let e=o.get(r);e!==void 0&&n.add(e)}return n}let d=Object.assign(r,{setItems(e){l(e)},clearSelection(){i?.clearSelection()},dispatch(e,r){n?.onDispatch?.(e,r,i)}});return Object.defineProperties(d,{selectedItems:{get(){return i?u(i.selectedItems):new Set},enumerable:!0,configurable:!0},selectionMode:{get(){return i?.selectionMode??a},set(e){a=e,i&&(i.selectionMode=e)},enumerable:!0,configurable:!0}}),d}const vx=new Set([9,10,11,12,13,32]);function yx(e){return e<32&&e!==9&&e!==10&&e!==11&&e!==12&&e!==13}function bx(e){return e>=32&&e<=126}function xx(e){return e===0?`byte-null`:vx.has(e)?`byte-whitespace`:yx(e)?`byte-control`:bx(e)?`byte-printable`:`byte-other`}function Sx(e,n,r,i){let a=ig.createSteps(r,i,{steps:16}).map(ig.toCssColour);return{forByte:r=>r===0?e:r===255?n:a[r>>4]}}function Cx(e){return{data:new Uint8Array(e),changeset:new Set}}function wx(e,n){return e.data[n]??0}function Tx(e){return e.data.length}function Ex(e){return Math.max(0,Math.min(255,e))}function Dx(e,n,r){let i=Ex(r),a=e.data[n],o=new Map([[n,{before:a,after:i}]]);return e.data[n]=i,e.changeset.add(n),o}function Ox(e,n){let r=new Map;return n.forEach((n,i)=>{let a=Ex(n),o=e.data[i];r.set(i,{before:o,after:a}),e.data[i]=a,e.changeset.add(i)}),r}function kx(e,n){let r=new Map;return n.forEach((n,i)=>{let a=e.data[i];r.set(i,{before:n.after,after:a}),e.data[i]=n.after,e.changeset.add(i)}),r}function Ax(e){let n=new Map;return e.forEach((e,r)=>{n.set(r,{before:e.after,after:e.before})}),n}function jx(e){return e.changeset}function Mx(){return{undos:[],redos:[]}}function Nx(e,n){e.undos.push(n),e.redos=[]}function Px(e){let n=e.undos.pop();return n&&e.redos.push(n),n}function Fx(e){let n=e.redos.pop();return n&&e.undos.push(n),n}const Ix=e=>e*4,Lx=(e,n)=>e<n?e:n,Rx=(e,n)=>e>n?e:n;function zx(e,n){return Math.max(0,Math.min(e,n-1))}function Bx(e,n){if(!e)return[];let r=Ix(n);if(e.kind===`single`)return[e.pos];if(e.kind===`contiguous`){let n=Lx(e.start,e.end),r=Rx(e.start,e.end),i=[];for(let e=n;e<=r;e++)i.push(e);return i}if(e.kind===`rectangular`){let n=[];for(let i=0;i<e.height;i++)for(let a=0;a<e.width;a++){let o=e.y+i,s=e.x+a,c=o*r+s;n.push(c)}return n}return[]}function Vx(e,n,r){if(!e)return!1;let i=Ix(r);if(e.kind===`single`)return n===e.pos;if(e.kind===`contiguous`){let r=Lx(e.start,e.end),i=Rx(e.start,e.end);return n>=r&&n<=i}if(e.kind===`rectangular`){let r=Math.floor(n/i),a=n%i,o=e.x,s=e.y,c=e.width,l=e.height;return r>=s&&r<s+l&&a>=o&&a<o+c}return!1}function Hx(e,n,r,i){let a;a=e?e.kind===`single`?e.pos:e.kind===`contiguous`?Rx(e.start,e.end):e.kind===`rectangular`?e.y*Ix(r)+e.x+e.width-1:0:0;let o=Ix(r),s;switch(n){case`left`:s=a-1;break;case`right`:s=a+1;break;case`up`:s=a-o;break;case`down`:s=a+o;break;default:s=a}return zx(s,i)}function Ux(e,n,r,i){return{kind:`single`,pos:Hx(e,n,r,i)}}function Wx(e,n,r,i,a=0,o=0){let s=Ix(r),c,l,u,d;if(!e||e.kind===`single`){let n=e?.kind===`single`?e.pos:0;c=n%s,l=Math.floor(n/s),u=1,d=1}else if(e.kind===`contiguous`){let n=Lx(e.start,e.end),r=Rx(e.start,e.end);c=n%s,l=Math.floor(n/s),u=r-n+1,d=1}else e.kind===`rectangular`?(c=e.x,l=e.y,u=e.width,d=e.height):(c=0,l=0,u=1,d=1);let f=a>0||e?.kind===`rectangular`?a:c,p=o>0||e?.kind===`rectangular`?o:l;switch(n){case`left`:c>f?--u:(c===f&&u>1||c>0)&&(--c,u+=1);break;case`right`:c+u<s&&(u+=1);break;case`up`:l>p?--d:(l===p&&d>1||l>0)&&(--l,d+=1);break;case`down`:d+=1}return{kind:`rectangular`,x:c,y:l,width:u,height:d}}function Gx(e,n,r,i){let a=Ix(i);if(r===`contiguous`)return{kind:`contiguous`,start:Lx(e,n),end:Rx(e,n)};let o=e%a,s=Math.floor(e/a),c=n%a,l=Math.floor(n/a);return{kind:`rectangular`,x:Lx(o,c),y:Lx(s,l),width:Math.abs(c-o)+1,height:Math.abs(l-s)+1}}let Kx=class extends n{constructor(...e){super(...e),this.columns=4,this.colourScheme=`ascii`,this.showChangeset=!0,this.hideOffsetCol=!1,this.hideHexCol=!1,this.hideTextCol=!1,this._selection=null,this._scrollTop=0,this._editState=null,this._containerH=0,this._shadeMap=null,this._focusSide=null,this._store=Cx(new Uint8Array),this._undoStack=Mx(),this._copyBuffer=null,this._rowHeight=24,this._dragStart=null,this._dragAnchor=null,this._rectAnchorX=0,this._rectAnchorY=0,this._rectAnchorXFromKeyboard=0,this._rectAnchorYFromKeyboard=0,this._initialSelectionPoint=0,this._currentCursorPoint=0,this._pointerMode=null,this._currentDragDiff=null,this._shiftClickTarget=null,this._onScroll=e=>{let n=e.target;this._scrollTop=n.scrollTop,this.requestUpdate()},this._onKeyDown=e=>{if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)){e.preventDefault(),e.stopPropagation(),this._editState&&=null;let n=e.key.replace(`Arrow`,``).toLowerCase(),r=Tx(this._store),i=Ix(this.columns);if(e.metaKey||e.ctrlKey){if(!this._selection||this._selection.kind!==`rectangular`){let e=0;this._selection?.kind===`single`?e=this._selection.pos:this._selection?.kind===`contiguous`&&(e=Math.min(this._selection.start,this._selection.end)),this._rectAnchorXFromKeyboard=e%i,this._rectAnchorYFromKeyboard=Math.floor(e/i),this._selection={kind:`rectangular`,x:this._rectAnchorXFromKeyboard,y:this._rectAnchorYFromKeyboard,width:1,height:1}}this._selection=Wx(this._selection,n,this.columns,r,this._rectAnchorXFromKeyboard,this._rectAnchorYFromKeyboard)}else if(e.shiftKey){if(!this._selection)this._initialSelectionPoint=0,this._currentCursorPoint=0;else if(this._selection.kind===`single`)this._initialSelectionPoint=this._selection.pos,this._currentCursorPoint=this._selection.pos;else if(this._selection.kind===`rectangular`){let e=this._selection.y*i+this._selection.x;this._initialSelectionPoint=e,this._currentCursorPoint=e}let e=Hx(this._selection,n,this.columns,r),a=Math.min(this._initialSelectionPoint,e),o=Math.max(this._initialSelectionPoint,e);this._currentCursorPoint=e,this._selection={kind:`contiguous`,start:a,end:o}}else{this._selection=Ux(this._selection,n,this.columns,r);let e=Hx(this._selection,n,this.columns,r);this._initialSelectionPoint=e,this._currentCursorPoint=e}this._dispatchSelectEvent(),this.requestUpdate();return}if(e.key===`Tab`){if(e.preventDefault(),e.stopPropagation(),this._editState)this._advanceCursor();else{let e=Tx(this._store);this._selection=Ux(this._selection,`right`,this.columns,e),this._dispatchSelectEvent()}this.requestUpdate();return}if(e.key===`Escape`){if(e.preventDefault(),e.stopPropagation(),this._editState)this._editState=null;else if(this._selection&&this._selection.kind!==`single`){let e=this._selection,n=0;if(e.kind===`contiguous`){let r=e;n=Math.min(r.start,r.end)}if(e.kind===`rectangular`){let r=e;n=r.y*Ix(this.columns)+r.x}this._selection={kind:`single`,pos:n},this._dispatchSelectEvent()}this.requestUpdate();return}if(this._editState){if(e.stopPropagation(),e.key===`Backspace`){this._handleBackspace();return}if(e.key===`Enter`){this._editState.side===`hex`&&this._editState.partial.startsWith(`.`)&&this._commitDecimalValue();return}e.key.length===1&&this._handleValueEntry(e.key);return}if(this._selection&&this._selection.kind===`single`&&e.key.length===1){e.preventDefault(),e.stopPropagation();let n=this._selection.pos,r=this._focusSide??`hex`;this._editState={pos:n,side:r,partial:``},this._handleValueEntry(e.key)}}}static{this.styles=r`
|
|
8559
8565
|
:host {
|
|
8560
8566
|
--hex-row-height: 24px;
|
|
8561
8567
|
--hex-offset-width: 8ch;
|
|
@@ -9024,7 +9030,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9024
9030
|
padding: 2px 6px;
|
|
9025
9031
|
color: var(--surface-muted-text);
|
|
9026
9032
|
}
|
|
9027
|
-
`;function RS(e,n){let r=new Map;return n.map(n=>{let i=n.item.key,a=r.get(i)??0;return r.set(i,a+1),`${e}${a===0?i:`${i}#${a}`}`})}function zS(e){return e.split(``).length-1}function BS(e){let n=e.split(``);return n.length<2?void 0:`${n[0]}${n[1]}`}function VS(e,n){return e.startsWith(`${n}`)}function HS(e,n){if(!e)return;let r=(e,i)=>{if(i===n)return[e];if(!VS(n,i))return;let a=e.children??[],o=RS(i,a);for(let n=0;n<a.length;n++){let i=r(a[n],o[n]);if(i)return[e,...i]}};return r(e,e.item.key)}function US(e,n){if(!e)return;let r=(e,i)=>{if(e===n)return i;let a=e.children??[],o=RS(i,a);for(let e=0;e<a.length;e++){let n=r(a[e],o[e]);if(n!==void 0)return n}};return r(e,e.item.key)}function WS(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;let a=i.children?.length?WS(i.children,n,e):void 0;if(a)return a}}function GS(e,n){if(e){if(e.item.key===n)return e;for(let r of e.children??[]){let e=GS(r,n);if(e)return e}}}function KS(e,n){if(e){if(e.item.key===n)return[e];for(let r of e.children??[]){let i=KS(r,n);if(i)return[e,...i]}}}function qS(e,n){if(n<=0)return 1;let r=e.children??[];if(r.length===0)return 1;let i=1;for(let e of r)i+=qS(e,n-1);return i}function JS(e,n){let r=cS({x:Math.cos(e),y:Math.sin(e)},n);return Math.atan2(r.y,r.x)}function YS(e){let n=0;for(let r=0;r<e.length;r++)n=Math.imul(n,31)+e.charCodeAt(r)|0;return(n>>>0)%1e3/1e3*2-1}const XS=.5;function ZS(e,n,r){if(n<=0)return r;let i=Math.min(e,Math.PI)/2,a=Math.asinh(Math.sinh(n/2)/Math.max(Math.sin(i),1e-6));return Math.min(Math.max(r,a),r+6)}function QS(e,n=24,r=1,i=XS){let a=new Map;if(!e)return a;let o={x:0,y:0};a.set(e.item.key,{node:e,id:e.item.key,depth:0,parentKey:void 0,parentId:void 0,position:o,toParent:hS,angularShare:2*Math.PI});let s=(e,c,l,u,d,f)=>{if(f>=n)return;let p=e.children??[],m=p.length;if(m===0)return;let h=d-u,g=p.map(e=>Math.sqrt(qS(e,n-f-1))),_=g.reduce((e,n)=>e+n,0),v=RS(c,p),y=u;p.forEach((n,u)=>{let d=m===1?h:h*g[u]/_,p=y+d/2;y+=d;let b=p+(m===1?YS(n.item.key)*Math.min(.22,d*.4):0),x=dS(m===1?r:ZS(d,i,r)),S={x:x*Math.cos(b),y:x*Math.sin(b)},ee=yS(S),te=_S(l,ee);a.set(v[u],{node:n,id:v[u],depth:f+1,parentKey:e.item.key,parentId:c,position:gS(te,o),toParent:ee,angularShare:d});let ne=Math.min(d,Math.PI)/2,re=JS(p-ne,S),ie=JS(p+ne,S)-re;ie<=0&&(ie+=2*Math.PI),s(n,v[u],te,re,re+ie,f+1)})};return s(e,e.item.key,hS,-Math.PI,Math.PI,0),a}function $S(e,n,r){let i=new Map;if(!e.has(n))return i;i.set(n,{ring:0,frame:hS});let a=[n];for(let n=1;n<=r&&a.length>0;n++){let r=[];for(let o of a){let a=e.get(o),{frame:s}=i.get(o),c=(a,o)=>{i.has(a)||!e.has(a)||(i.set(a,{ring:n,frame:o()}),r.push(a))};for(let n of RS(o,a.node.children??[]))c(n,()=>_S(s,e.get(n).toParent));a.parentId!==void 0&&c(a.parentId,()=>_S(s,vS(a.toParent)))}a=r}return i}function eC(e,n,r){let i=hS;for(let a=n;a!==void 0&&a!==r;a=e.get(a)?.parentId)i=_S(e.get(a).toParent,i);return i}function tC(e,n,r){if(!e.has(n)||!e.has(r))return;let i=new Set;for(let r=n;r!==void 0;r=e.get(r)?.parentId)i.add(r);let a=r;for(;a!==void 0&&!i.has(a);)a=e.get(a)?.parentId;if(a!==void 0)return _S(vS(eC(e,n,a)),eC(e,r,a))}function nC(e,n){if(n!==void 0){if(e.has(n))return n;for(let r of e.values())if(r.node.item.key===n)return r.id}}function rC(e,n={}){if(!e)return{nodes:[],edges:[]};let{maxRadius:r=1/0,maxDepth:i=24,curvature:a=1,siblingSpacing:o=XS}=n,s=QS(e,i,a,o),c=nC(s,n.focusedKey)??e.item.key;if(!s.has(c))return{nodes:[],edges:[]};let l=n.view??xS(n.centerOverride??{x:0,y:0}),u=$S(s,c,r),d=[...u.keys()].map(e=>s.get(e).node.item.weight).filter(e=>typeof e==`number`),f=d.length>0?Math.min(...d):void 0,p=d.length>0?Math.max(...d):void 0,m=e=>e===void 0||f===void 0||p===void 0||p===f?.5:(e-f)/(p-f),h=[...u.entries()].map(([e,{ring:n,frame:r}])=>{let i=s.get(e),a=i.node.item.weight;return{node:i.node,key:i.node.item.key,id:e,depth:i.depth,ring:n,parentKey:i.parentKey,parentId:i.parentId,position:gS(_S(l,r),{x:0,y:0}),angularShare:i.angularShare,weight:a,weightNormalized:m(a)}}).sort((e,n)=>e.ring-n.ring),g=new Map(h.map(e=>[e.id,e])),_=[];for(let e of h){if(e.parentId===void 0)continue;let n=g.get(e.parentId);n&&_.push({fromKey:n.key,toKey:e.key,fromId:n.id,toId:e.id,from:n.position,to:e.position,weightNormalized:(n.weightNormalized+e.weightNormalized)/2})}return{nodes:h,edges:_}}const iC={action:{kind:`none`},handled:!1};function aC(e){let n=Math.atan2(e.position.y,e.position.x),r=Math.abs(n- -Math.PI/2);return r>Math.PI&&(r=2*Math.PI-r),r}function oC(e,n,r,i){let a=HS(n,r),o=a?.at(-1);if(!a||!o)return iC;let s=a.length>=2?a[a.length-2]:void 0,c={action:{kind:`none`},handled:!0},l=e=>e?{action:{kind:`focus`,node:e},handled:!0}:c;switch(e){case`ArrowUp`:{let e=i.filter(e=>e.parentId===r);return e.length===0?c:l(e.reduce((e,n)=>aC(e)<aC(n)?e:n).node)}case`ArrowDown`:return l(s);case`ArrowLeft`:case`ArrowRight`:{let n=s?.children??[],r=n.indexOf(o);return r===-1||n.length<=1?c:l(n[(r+(e===`ArrowRight`?1:-1)+n.length)%n.length])}case`Enter`:return{action:{kind:`activate`,node:o,depth:a.length-1},handled:!0};case`Escape`:return o===n?iC:l(n);default:return iC}}function sC(e,n){let r=new Set,i=new Map,a=async(n,r,i)=>{let{model:a,loadChildren:o}=e();return a?a.getChildren(n,r,i):[...await gg(o({node:n,depth:r},i),i)]},o=async(e,o)=>{r.add(e);let s=new AbortController;i.set(e,s),n();try{let n=await a(e,o,s.signal);s.signal.aborted||(e.children=n)}catch{s.signal.aborted||(e.children=[])}finally{r.delete(e),i.delete(e),s.signal.aborted||n()}};return{ensure(n){let{model:i,loadChildren:a}=e();if(!(!i&&!a))for(let{node:e,depth:i}of n)e.children===void 0&&!r.has(e)&&o(e,i)},isPending:e=>r.has(e),abortAll(){for(let e of i.values())e.abort();i.clear(),r.clear()}}}function cC(e){return Math.max(0,1-(e.x*e.x+e.y*e.y))}function lC(e){let n=new Map;for(let r of e)n.set(r.id,1/0);for(let r=0;r<e.length;r++){let i=e[r].position;for(let a=r+1;a<e.length;a++){let o=e[a].position,s=Math.hypot(i.x-o.x,i.y-o.y);s<n.get(e[r].id)&&n.set(e[r].id,s),s<n.get(e[a].id)&&n.set(e[a].id,s)}}return n}function uC(e,n){return n.minWeightScale+(n.maxWeightScale-n.minWeightScale)*e.weightNormalized}function dC(e,n,r){let i=r.nodeRadius*cC(e.position)*uC(e,r);return Math.max(Math.min(i,n*.45),.003)}function fC(e,n,r,i,a=0){let o=Math.cos(a),s=Math.sin(a),c=(e,r)=>({x:n.x+e*o-r*s,y:n.y+e*s+r*o});return{id:e,corners:[c(-r,-i),c(r,-i),c(r,i),c(-r,i)]}}function pC(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length];n+=i.x*a.y-a.x*i.y}return Math.abs(n)/2}function mC(e,n){let r=Math.sign((n[1].x-n[0].x)*(n[2].y-n[0].y)-(n[1].y-n[0].y)*(n[2].x-n[0].x))||1,i=[...e];for(let e=0;e<n.length&&i.length>0;e++){let a=n[e],o=n[(e+1)%n.length],s=e=>r*((o.x-a.x)*(e.y-a.y)-(o.y-a.y)*(e.x-a.x)),c=i;i=[];for(let e=0;e<c.length;e++){let n=c[e],r=c[(e+c.length-1)%c.length],a=s(n),o=s(r);if(a>=0!=o>=0){let e=o/(o-a);i.push({x:r.x+(n.x-r.x)*e,y:r.y+(n.y-r.y)*e})}a>=0&&i.push(n)}}return i}function hC(e){let n=e.map(e=>e.x),r=e.map(e=>e.y);return{x0:Math.min(...n),y0:Math.min(...r),x1:Math.max(...n),y1:Math.max(...r)}}function gC(e,n){let r=hC(e.corners),i=hC(n.corners);if(r.x1<=i.x0||i.x1<=r.x0||r.y1<=i.y0||i.y1<=r.y0)return 0;let a=pC(e.corners);return a<=0?1:pC(mC(e.corners,n.corners))/a}function _C(e,n=.03){let r=[];for(let i of e)r.every(e=>gC(i,e)<=n)&&r.push(i);return new Set(r.map(e=>e.id))}function vC(e,n){return n<=0||e.length<=n?e:`${e.slice(0,Math.max(1,n-1)).trimEnd()}…`}let yC;const bC=new Map;function xC(e,n,r){let i=`${r}\u0000${e}`,a=bC.get(i);if(a===void 0){if(yC===void 0)try{yC=typeof document>`u`?null:document.createElement(`canvas`).getContext(`2d`)}catch{yC=null}let n;if(yC){yC.font=`100px ${r||`sans-serif`}`;let i=yC.measureText(e).width;Number.isFinite(i)&&i>0&&(n=i/100)}a=n??e.length*.6,bC.set(i,a)}return a*n}function SC(e,n){let r=.45+.55*cC(e.position),i=Math.min(1,r*(n.zoom??1))*Math.sqrt(uC(e,n)),a=vC(e.node.item.label,n.maxChars),o=n.fontSize*.5,s=n.fontSize*1.55;return{scale:i,width:xC(a,n.fontSize,n.fontFamily)+o*2,height:s,markerSize:n.fontSize*.55,text:a}}function CC(e,n,r,i=0){return fC(e,n,r.width*r.scale/2,r.height*r.scale/2,i)}const wC={direction:0,textAngle:0,flipped:!1};function TC(e,n,r){let i=typeof getComputedStyle==`function`?getComputedStyle(e):void 0,a=Number.parseFloat(i?.getPropertyValue(`--hyperbolictree-font-size`)??``),o=Number.isFinite(a)&&a>0?a:13;return{px:o,units:o*(1050/(n>0?n:420)/(r||1)),family:i?.fontFamily??``}}function EC(e){return e?new Map(RS(e.item.key,e.children??[]).map((e,n)=>[e,n])):new Map}function DC(e,n){let r=BS(e),i=r===void 0?void 0:n.get(r);return i===void 0?``:` --branch-index: ${i}; --branch-count: ${n.size};`}function OC(e){let n=new Map;for(let r of e){let e=n.get(r.parentId)??[];e.push(r),n.set(r.parentId,e)}return n}function kC(e,n,r){let i=e=>e.ring===0?0:r(e.node)?1:2;return[...e].sort((e,r)=>i(e)-i(r)||n(r)-n(e)||e.ring-r.ring)}function AC(e,n){let r=new Map;if(!n){for(let n of e)r.set(n.id,wC);return r}let i=new Map(e.map(e=>[e.id,e])),a=new Map;for(let n of e){let e=n.parentId===void 0?void 0:i.get(n.parentId);e&&(e.ring<n.ring?a.set(n.id,e):n.ring<e.ring&&a.set(e.id,n))}for(let n of e){let e=a.get(n.id);if(!e||n.ring===0){r.set(n.id,wC);continue}let i=Math.atan2(n.position.y-e.position.y,n.position.x-e.position.x),o=Math.cos(i)<0;r.set(n.id,{direction:i,textAngle:o?i+Math.PI:i,flipped:o})}return r}const jC=e=>({x:e.position.x*500,y:e.position.y*500});function MC(e,n,r){let{font:i}=n,a=new Map(e.map(e=>[e.id,SC(e,{fontSize:i.units,fontFamily:i.family,maxChars:n.boxMaxChars,minWeightScale:n.minWeightScale,maxWeightScale:n.maxWeightScale,zoom:n.zoom})]));return{boxes:a,labelIds:_C(kC(e.filter(e=>!n.isTickled(e.id)&&i.px*a.get(e.id).scale>=n.minLabelSize),e=>a.get(e.id).scale,n.isSelected).map(e=>CC(e.id,jC(e),a.get(e.id),r.get(e.id).textAngle)))}}function NC(e,n,r){let{font:i}=n,a=lC(e),o=new Map(e.map(e=>[e.id,dC(e,a.get(e.id),n)]));return{radii:o,labelIds:_C(kC(e.filter(e=>!n.isTickled(e.id)&&o.get(e.id)*n.zoom>=n.minNodeRadius),e=>o.get(e.id),n.isSelected).map(e=>{let{direction:n}=r.get(e.id),a=xC(e.node.item.label,i.units,i.family)/2,s=(o.get(e.id)+.01)*500+a,c=jC(e),l={x:c.x+Math.cos(n)*s,y:c.y+Math.sin(n)*s};return fC(e.id,l,a+i.units*.6,i.units*.6,n)}))}}function PC(e,n){let r=AC(e,n.radialLabels),i=n.nodeShape===`box`?{...MC(e,n,r),radii:new Map}:{...NC(e,n,r),boxes:new Map},a=new Set(i.labelIds);for(let r of e)n.isTickled(r.id)&&a.add(r.id);return{siblingGroups:OC(e),font:n.font,branches:n.branches,boxes:i.boxes,radii:i.radii,labelIds:a,orientations:r}}function FC(e,n,r){let i=e=>r(e.id)?2:+!!n.labelIds.has(e.id),a=e=>e.position.x**2+e.position.y**2;return[...e].sort((e,n)=>i(e)-i(n)||a(n)-a(e))}function IC(e){return e.replace(/[^\w-]/g,`-`)}const LC=e=>e.preventDefault();function RC(e,n,r,i){let{node:o,key:c,id:l}=e,{ctx:u,state:d,handlers:f}=n,p=d.isSelected(o),m=[`node`,p?`selected`:``,d.isTickled(l)?`tickled`:``,d.isFiltered(e)?`filtered`:``,d.isPending(o)?`loading`:``,e.ring===0?`focused`:``].filter(Boolean).join(` `),h=u.siblingGroups.get(e.parentId)??[e],g=`--node-weight: ${e.weightNormalized};${e.weight===void 0?``:` --node-weight-raw: ${e.weight};`}`;return s`
|
|
9033
|
+
`;function RS(e,n){let r=new Map;return n.map(n=>{let i=n.item.key,a=r.get(i)??0;return r.set(i,a+1),`${e}${a===0?i:`${i}#${a}`}`})}function zS(e){return e.split(``).length-1}function BS(e){let n=e.split(``);return n.length<2?void 0:`${n[0]}${n[1]}`}function VS(e,n){return e.startsWith(`${n}`)}function HS(e,n){if(!e)return;let r=(e,i)=>{if(i===n)return[e];if(!VS(n,i))return;let a=e.children??[],o=RS(i,a);for(let n=0;n<a.length;n++){let i=r(a[n],o[n]);if(i)return[e,...i]}};return r(e,e.item.key)}function US(e,n){if(!e)return;let r=(e,i)=>{if(e===n)return i;let a=e.children??[],o=RS(i,a);for(let e=0;e<a.length;e++){let n=r(a[e],o[e]);if(n!==void 0)return n}};return r(e,e.item.key)}function WS(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;let a=i.children?.length?WS(i.children,n,e):void 0;if(a)return a}}function GS(e,n){if(e){if(e.item.key===n)return e;for(let r of e.children??[]){let e=GS(r,n);if(e)return e}}}function KS(e,n){if(e){if(e.item.key===n)return[e];for(let r of e.children??[]){let i=KS(r,n);if(i)return[e,...i]}}}function qS(e,n){if(n<=0)return 1;let r=e.children??[];if(r.length===0)return 1;let i=1;for(let e of r)i+=qS(e,n-1);return i}function JS(e,n){let r=cS({x:Math.cos(e),y:Math.sin(e)},n);return Math.atan2(r.y,r.x)}function YS(e){let n=0;for(let r=0;r<e.length;r++)n=Math.imul(n,31)+e.charCodeAt(r)|0;return(n>>>0)%1e3/1e3*2-1}const XS=.5;function ZS(e,n,r){if(n<=0)return r;let i=Math.min(e,Math.PI)/2,a=Math.asinh(Math.sinh(n/2)/Math.max(Math.sin(i),1e-6));return Math.min(Math.max(r,a),r+6)}function QS(e,n=24,r=1,i=XS){let a=new Map;if(!e)return a;let o={x:0,y:0};a.set(e.item.key,{node:e,id:e.item.key,depth:0,parentKey:void 0,parentId:void 0,position:o,toParent:hS,angularShare:2*Math.PI});let s=(e,c,l,u,d,f)=>{if(f>=n)return;let p=e.children??[],m=p.length;if(m===0)return;let h=d-u,g=p.map(e=>Math.sqrt(qS(e,n-f-1))),_=g.reduce((e,n)=>e+n,0),v=RS(c,p),y=u;p.forEach((n,u)=>{let d=m===1?h:h*g[u]/_,p=y+d/2;y+=d;let b=p+(m===1?YS(n.item.key)*Math.min(.22,d*.4):0),x=dS(m===1?r:ZS(d,i,r)),S={x:x*Math.cos(b),y:x*Math.sin(b)},ee=yS(S),te=_S(l,ee);a.set(v[u],{node:n,id:v[u],depth:f+1,parentKey:e.item.key,parentId:c,position:gS(te,o),toParent:ee,angularShare:d});let ne=Math.min(d,Math.PI)/2,re=JS(p-ne,S),ie=JS(p+ne,S)-re;ie<=0&&(ie+=2*Math.PI),s(n,v[u],te,re,re+ie,f+1)})};return s(e,e.item.key,hS,-Math.PI,Math.PI,0),a}function $S(e,n,r){let i=new Map;if(!e.has(n))return i;i.set(n,{ring:0,frame:hS});let a=[n];for(let n=1;n<=r&&a.length>0;n++){let r=[];for(let o of a){let a=e.get(o),{frame:s}=i.get(o),c=(a,o)=>{i.has(a)||!e.has(a)||(i.set(a,{ring:n,frame:o()}),r.push(a))};for(let n of RS(o,a.node.children??[]))c(n,()=>_S(s,e.get(n).toParent));a.parentId!==void 0&&c(a.parentId,()=>_S(s,vS(a.toParent)))}a=r}return i}function eC(e,n,r){let i=hS;for(let a=n;a!==void 0&&a!==r;a=e.get(a)?.parentId)i=_S(e.get(a).toParent,i);return i}function tC(e,n,r){if(!e.has(n)||!e.has(r))return;let i=new Set;for(let r=n;r!==void 0;r=e.get(r)?.parentId)i.add(r);let a=r;for(;a!==void 0&&!i.has(a);)a=e.get(a)?.parentId;if(a!==void 0)return _S(vS(eC(e,n,a)),eC(e,r,a))}function nC(e,n){if(n!==void 0){if(e.has(n))return n;for(let r of e.values())if(r.node.item.key===n)return r.id}}function rC(e,n={}){if(!e)return{nodes:[],edges:[]};let{maxRadius:r=1/0,maxDepth:i=24,curvature:a=1,siblingSpacing:o=XS}=n,s=QS(e,i,a,o),c=nC(s,n.focusedKey)??e.item.key;if(!s.has(c))return{nodes:[],edges:[]};let l=n.view??xS(n.centerOverride??{x:0,y:0}),u=$S(s,c,r),d=[...u.keys()].map(e=>s.get(e).node.item.weight).filter(e=>typeof e==`number`),f=d.length>0?Math.min(...d):void 0,p=d.length>0?Math.max(...d):void 0,m=e=>e===void 0||f===void 0||p===void 0||p===f?.5:(e-f)/(p-f),h=[...u.entries()].map(([e,{ring:n,frame:r}])=>{let i=s.get(e),a=i.node.item.weight;return{node:i.node,key:i.node.item.key,id:e,depth:i.depth,ring:n,parentKey:i.parentKey,parentId:i.parentId,position:gS(_S(l,r),{x:0,y:0}),angularShare:i.angularShare,weight:a,weightNormalized:m(a)}}).sort((e,n)=>e.ring-n.ring),g=new Map(h.map(e=>[e.id,e])),_=[];for(let e of h){if(e.parentId===void 0)continue;let n=g.get(e.parentId);n&&_.push({fromKey:n.key,toKey:e.key,fromId:n.id,toId:e.id,from:n.position,to:e.position,weightNormalized:(n.weightNormalized+e.weightNormalized)/2})}return{nodes:h,edges:_}}const iC={action:{kind:`none`},handled:!1};function aC(e){let n=Math.atan2(e.position.y,e.position.x),r=Math.abs(n- -Math.PI/2);return r>Math.PI&&(r=2*Math.PI-r),r}function oC(e,n,r,i){let a=HS(n,r),o=a?.at(-1);if(!a||!o)return iC;let s=a.length>=2?a[a.length-2]:void 0,c={action:{kind:`none`},handled:!0},l=e=>e?{action:{kind:`focus`,node:e},handled:!0}:c;switch(e){case`ArrowUp`:{let e=i.filter(e=>e.parentId===r);return e.length===0?c:l(e.reduce((e,n)=>aC(e)<aC(n)?e:n).node)}case`ArrowDown`:return l(s);case`ArrowLeft`:case`ArrowRight`:{let n=s?.children??[],r=n.indexOf(o);return r===-1||n.length<=1?c:l(n[(r+(e===`ArrowRight`?1:-1)+n.length)%n.length])}case`Enter`:return{action:{kind:`activate`,node:o,depth:a.length-1},handled:!0};case`Escape`:return o===n?iC:l(n);default:return iC}}function sC(e,n){let r=new Set,i=new Map,a=async(n,r,i)=>{let{model:a,loadChildren:o}=e();return a?a.getChildren(n,r,i):[...await hg(o({node:n,depth:r},i),i)]},o=async(e,o)=>{r.add(e);let s=new AbortController;i.set(e,s),n();try{let n=await a(e,o,s.signal);s.signal.aborted||(e.children=n)}catch{s.signal.aborted||(e.children=[])}finally{r.delete(e),i.delete(e),s.signal.aborted||n()}};return{ensure(n){let{model:i,loadChildren:a}=e();if(!(!i&&!a))for(let{node:e,depth:i}of n)e.children===void 0&&!r.has(e)&&o(e,i)},isPending:e=>r.has(e),abortAll(){for(let e of i.values())e.abort();i.clear(),r.clear()}}}function cC(e){return Math.max(0,1-(e.x*e.x+e.y*e.y))}function lC(e){let n=new Map;for(let r of e)n.set(r.id,1/0);for(let r=0;r<e.length;r++){let i=e[r].position;for(let a=r+1;a<e.length;a++){let o=e[a].position,s=Math.hypot(i.x-o.x,i.y-o.y);s<n.get(e[r].id)&&n.set(e[r].id,s),s<n.get(e[a].id)&&n.set(e[a].id,s)}}return n}function uC(e,n){return n.minWeightScale+(n.maxWeightScale-n.minWeightScale)*e.weightNormalized}function dC(e,n,r){let i=r.nodeRadius*cC(e.position)*uC(e,r);return Math.max(Math.min(i,n*.45),.003)}function fC(e,n,r,i,a=0){let o=Math.cos(a),s=Math.sin(a),c=(e,r)=>({x:n.x+e*o-r*s,y:n.y+e*s+r*o});return{id:e,corners:[c(-r,-i),c(r,-i),c(r,i),c(-r,i)]}}function pC(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length];n+=i.x*a.y-a.x*i.y}return Math.abs(n)/2}function mC(e,n){let r=Math.sign((n[1].x-n[0].x)*(n[2].y-n[0].y)-(n[1].y-n[0].y)*(n[2].x-n[0].x))||1,i=[...e];for(let e=0;e<n.length&&i.length>0;e++){let a=n[e],o=n[(e+1)%n.length],s=e=>r*((o.x-a.x)*(e.y-a.y)-(o.y-a.y)*(e.x-a.x)),c=i;i=[];for(let e=0;e<c.length;e++){let n=c[e],r=c[(e+c.length-1)%c.length],a=s(n),o=s(r);if(a>=0!=o>=0){let e=o/(o-a);i.push({x:r.x+(n.x-r.x)*e,y:r.y+(n.y-r.y)*e})}a>=0&&i.push(n)}}return i}function hC(e){let n=e.map(e=>e.x),r=e.map(e=>e.y);return{x0:Math.min(...n),y0:Math.min(...r),x1:Math.max(...n),y1:Math.max(...r)}}function gC(e,n){let r=hC(e.corners),i=hC(n.corners);if(r.x1<=i.x0||i.x1<=r.x0||r.y1<=i.y0||i.y1<=r.y0)return 0;let a=pC(e.corners);return a<=0?1:pC(mC(e.corners,n.corners))/a}function _C(e,n=.03){let r=[];for(let i of e)r.every(e=>gC(i,e)<=n)&&r.push(i);return new Set(r.map(e=>e.id))}function vC(e,n){return n<=0||e.length<=n?e:`${e.slice(0,Math.max(1,n-1)).trimEnd()}…`}let yC;const bC=new Map;function xC(e,n,r){let i=`${r}\u0000${e}`,a=bC.get(i);if(a===void 0){if(yC===void 0)try{yC=typeof document>`u`?null:document.createElement(`canvas`).getContext(`2d`)}catch{yC=null}let n;if(yC){yC.font=`100px ${r||`sans-serif`}`;let i=yC.measureText(e).width;Number.isFinite(i)&&i>0&&(n=i/100)}a=n??e.length*.6,bC.set(i,a)}return a*n}function SC(e,n){let r=.45+.55*cC(e.position),i=Math.min(1,r*(n.zoom??1))*Math.sqrt(uC(e,n)),a=vC(e.node.item.label,n.maxChars),o=n.fontSize*.5,s=n.fontSize*1.55;return{scale:i,width:xC(a,n.fontSize,n.fontFamily)+o*2,height:s,markerSize:n.fontSize*.55,text:a}}function CC(e,n,r,i=0){return fC(e,n,r.width*r.scale/2,r.height*r.scale/2,i)}const wC={direction:0,textAngle:0,flipped:!1};function TC(e,n,r){let i=typeof getComputedStyle==`function`?getComputedStyle(e):void 0,a=Number.parseFloat(i?.getPropertyValue(`--hyperbolictree-font-size`)??``),o=Number.isFinite(a)&&a>0?a:13;return{px:o,units:o*(1050/(n>0?n:420)/(r||1)),family:i?.fontFamily??``}}function EC(e){return e?new Map(RS(e.item.key,e.children??[]).map((e,n)=>[e,n])):new Map}function DC(e,n){let r=BS(e),i=r===void 0?void 0:n.get(r);return i===void 0?``:` --branch-index: ${i}; --branch-count: ${n.size};`}function OC(e){let n=new Map;for(let r of e){let e=n.get(r.parentId)??[];e.push(r),n.set(r.parentId,e)}return n}function kC(e,n,r){let i=e=>e.ring===0?0:r(e.node)?1:2;return[...e].sort((e,r)=>i(e)-i(r)||n(r)-n(e)||e.ring-r.ring)}function AC(e,n){let r=new Map;if(!n){for(let n of e)r.set(n.id,wC);return r}let i=new Map(e.map(e=>[e.id,e])),a=new Map;for(let n of e){let e=n.parentId===void 0?void 0:i.get(n.parentId);e&&(e.ring<n.ring?a.set(n.id,e):n.ring<e.ring&&a.set(e.id,n))}for(let n of e){let e=a.get(n.id);if(!e||n.ring===0){r.set(n.id,wC);continue}let i=Math.atan2(n.position.y-e.position.y,n.position.x-e.position.x),o=Math.cos(i)<0;r.set(n.id,{direction:i,textAngle:o?i+Math.PI:i,flipped:o})}return r}const jC=e=>({x:e.position.x*500,y:e.position.y*500});function MC(e,n,r){let{font:i}=n,a=new Map(e.map(e=>[e.id,SC(e,{fontSize:i.units,fontFamily:i.family,maxChars:n.boxMaxChars,minWeightScale:n.minWeightScale,maxWeightScale:n.maxWeightScale,zoom:n.zoom})]));return{boxes:a,labelIds:_C(kC(e.filter(e=>!n.isTickled(e.id)&&i.px*a.get(e.id).scale>=n.minLabelSize),e=>a.get(e.id).scale,n.isSelected).map(e=>CC(e.id,jC(e),a.get(e.id),r.get(e.id).textAngle)))}}function NC(e,n,r){let{font:i}=n,a=lC(e),o=new Map(e.map(e=>[e.id,dC(e,a.get(e.id),n)]));return{radii:o,labelIds:_C(kC(e.filter(e=>!n.isTickled(e.id)&&o.get(e.id)*n.zoom>=n.minNodeRadius),e=>o.get(e.id),n.isSelected).map(e=>{let{direction:n}=r.get(e.id),a=xC(e.node.item.label,i.units,i.family)/2,s=(o.get(e.id)+.01)*500+a,c=jC(e),l={x:c.x+Math.cos(n)*s,y:c.y+Math.sin(n)*s};return fC(e.id,l,a+i.units*.6,i.units*.6,n)}))}}function PC(e,n){let r=AC(e,n.radialLabels),i=n.nodeShape===`box`?{...MC(e,n,r),radii:new Map}:{...NC(e,n,r),boxes:new Map},a=new Set(i.labelIds);for(let r of e)n.isTickled(r.id)&&a.add(r.id);return{siblingGroups:OC(e),font:n.font,branches:n.branches,boxes:i.boxes,radii:i.radii,labelIds:a,orientations:r}}function FC(e,n,r){let i=e=>r(e.id)?2:+!!n.labelIds.has(e.id),a=e=>e.position.x**2+e.position.y**2;return[...e].sort((e,n)=>i(e)-i(n)||a(n)-a(e))}function IC(e){return e.replace(/[^\w-]/g,`-`)}const LC=e=>e.preventDefault();function RC(e,n,r,i){let{node:o,key:c,id:l}=e,{ctx:u,state:d,handlers:f}=n,p=d.isSelected(o),m=[`node`,p?`selected`:``,d.isTickled(l)?`tickled`:``,d.isFiltered(e)?`filtered`:``,d.isPending(o)?`loading`:``,e.ring===0?`focused`:``].filter(Boolean).join(` `),h=u.siblingGroups.get(e.parentId)??[e],g=`--node-weight: ${e.weightNormalized};${e.weight===void 0?``:` --node-weight-raw: ${e.weight};`}`;return s`
|
|
9028
9034
|
<g
|
|
9029
9035
|
class=${m}
|
|
9030
9036
|
data-key=${c}
|
|
@@ -9074,7 +9080,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9074
9080
|
data-from=${e.fromKey}
|
|
9075
9081
|
data-to=${e.toKey}
|
|
9076
9082
|
style="--edge-weight: ${e.weightNormalized};${DC(e.toId,n)}"
|
|
9077
|
-
/>`}function GC(e,n,r,i){return _(e,e=>`${e.fromId}->${e.toId}`,e=>{let a=n.get(e.fromId)?.node,o=n.get(e.toId)?.node;return i&&a&&o?s`<g transform="scale(${500})">${i({edge:e,fromNode:a,toNode:o})}</g>`:WC(e,r)})}let J=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this.maxRadius=4,this.nodeShape=`dot`,this.boxMaxChars=24,this.minLabelSize=9,this.colorByBranch=!1,this.nodeRadius=.05,this.minNodeRadius=.015,this.minWeightScale=.6,this.maxWeightScale=1.6,this.zoom=1,this.disableZoomGestures=!1,this.disableRadialLabels=!1,this.disableChildPreview=!1,this.curvature=1,this.siblingSpacing=XS,this.focusAnimationDuration=400,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this._focusId=void 0,this._viewOverride=void 0,this._focusRotation=0,this._zoomOffset={x:0,y:0},this._previewId=void 0,this.#e=Qx({candidate:e=>{let n=this.#u().nodes,r=e===void 0||this.disableChildPreview?void 0:n.find(n=>n.id===e);return r&&!this.#c.isDragging()&&Yx(r,n,this.#n)?r.id:void 0},currentId:()=>this._previewId,setPreviewId:e=>{this._previewId=e}}),this.#t=sC(()=>({model:this.model,loadChildren:this.loadChildren}),()=>this.requestUpdate()),this.#n=new Set,this.search=new Vt(this,{adapter:Wt(this,{labelSelector:`.hyperbolictree-label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>this.#u().nodes.map(e=>({id:e.id,enabled:!0})),onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)},onTickle:e=>{if(this.#e.update(e),e===void 0)return;let n=this.#u().nodes.find(n=>n.id===e);n&&this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:n.node,depth:n.depth},bubbles:!0,composed:!0}))}}),this._hostSize={width:0,height:0},this.#c=IS({svgRect:()=>this.renderRoot.querySelector(`svg.hyperbolictree`)?.getBoundingClientRect(),onDragStart:()=>this.#e.hide(),takeView:()=>{let e=this.#f();return this.#x(),this._viewOverride=e,e},setView:e=>{this._viewOverride=e},zoomState:()=>this.#O(),setZoomState:e=>{this.zoom=e.zoom,this._zoomOffset=e.offset},zoomGesturesEnabled:()=>!this.disableZoomGestures,hasFocus:()=>this.renderRoot.activeElement!==null,focusTree:()=>this.#k()})}static{this.shadowRootOptions={...n.shadowRootOptions,delegatesFocus:!0}}get selectedNodes(){return this._selectedNodes}get focusedNode(){return this._focusId===void 0?this.#l:HS(this.#l,this._focusId)?.at(-1)??this.#l}#e;#t;#n;#r;#i;#a;#o;#s;#c;get#l(){return this.model?.root??this.root}#u(){return rC(this.#l,{focusedKey:this._focusId,maxRadius:this.maxRadius,curvature:this.curvature,siblingSpacing:this.siblingSpacing,view:this.#f()})}get#d(){return this.#l?.item.key}#f(){return this._viewOverride??bS(this._focusRotation)}#p(e,n){let r=QS(this.#l,24,this.curvature,this.siblingSpacing),i=n===void 0?void 0:tC(r,n,e);return i?_S(this.#f(),i):bS(this._focusRotation)}#m(e){let n=this.#l,r=US(n,e);if(r!==void 0)return r;let i=GS(n,e.item.key);return i?US(n,i):void 0}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#i=Yt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e,this.#g(),typeof ResizeObserver==`function`&&(this.#s=new ResizeObserver(([e])=>{let{width:n,height:r}=e.contentRect;this._hostSize={width:n,height:r}}),this.#s.observe(this))}disconnectedCallback(){super.disconnectedCallback(),this.#s?.disconnect(),this.#s=void 0,this.#r?.(),this.#r=void 0,this.#e.dispose(),this.#t.abortAll(),this.#o!==void 0&&(cancelAnimationFrame(this.#o),this.#o=void 0),this.#i&&(this.#i.unregister(`select-all`),this.#i.unregister(`deselect-all`),this.#i=void 0,this.registry=void 0)}#h(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#g(){this.#i&&(this.search.setModes(this.#h()),this.#a?.(),this.#a=Rt(this.#i,this.search))}updated(e){e.has(`root`)&&this.root&&this.#_(),e.has(`model`)&&(this.#r?.(),this.#r=void 0,this.model&&(this.#r=this.model._subscribe(e=>{e.type===`root`?(this.#_(),this.requestUpdate()):e.type===`invalidate`&&this.requestUpdate()}),this.#_())),e.has(`interactionMode`)&&this.clearSelection(),e.has(`searchModes`)&&this.#g(),this._focusId!==void 0&&!HS(this.#l,this._focusId)&&(this._focusId=void 0,this._viewOverride=void 0,this._focusRotation=0),this.#t.ensure(this.#u().nodes)}#_(){this.#y(),this.tickled.clearTickled(),this._focusId=void 0,this._viewOverride=void 0,this._focusRotation=0,this._zoomOffset={x:0,y:0},this._previewId=void 0,this.#c.cancel(),this.#o!==void 0&&(cancelAnimationFrame(this.#o),this.#o=void 0)}#v(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#y(){this._selectedNodes.clear(),this.selectedNode=void 0}#b(e){this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set(this._selectedNodes),previous:e},bubbles:!0,composed:!0}))}select(e){if(!this.#v(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#b(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#b(n),this.requestUpdate()}clearSelection(){if(this._selectedNodes.size===0)return;let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectAll(){let e=new Set(this._selectedNodes);for(let e of this.#u().nodes)this.#v(e.node)&&this._selectedNodes.add(e.node);this.selectedNode=[...this._selectedNodes].at(-1),this.#b(e),this.requestUpdate()}deselectAll(){let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectMany(e){let n=new Set(this._selectedNodes);this._selectedNodes=new Set([...e].filter(e=>this.#v(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#b(n),this.requestUpdate()}focusOn(e){let n=this.#l,r=this.#m(e),i=this._focusId??this.#d;if(r===void 0||i===r)return;let a=HS(n,r)?.at(-1)??e,o=i===void 0?void 0:HS(n,i)?.at(-1),s=this.#p(r,i);this._focusId=r,this.#c.cancel(),this._previewId=void 0,this.#S(s),this.dispatchEvent(new CustomEvent(`focus`,{detail:{node:a,previous:o},bubbles:!0,composed:!0})),o&&i!==void 0&&(VS(r,i)?this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:a,depth:zS(r)},bubbles:!0,composed:!0})):VS(i,r)&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:o,depth:zS(i)},bubbles:!0,composed:!0}))),this.requestUpdate()}#x(){this.#o!==void 0&&(cancelAnimationFrame(this.#o),this.#o=void 0)}#S(e){this.#x();let{viewAt:n,settledRotation:r}=kS(e);this._focusRotation=r;let i=this._zoomOffset;if(this.focusAnimationDuration<=0||DS()||typeof requestAnimationFrame!=`function`){this._viewOverride=void 0,this._zoomOffset={x:0,y:0};return}let a=performance.now(),o=this.focusAnimationDuration,s=e=>{let r=Math.min(1,(e-a)/o),c=1-ES(r);this._zoomOffset={x:i.x*c,y:i.y*c},this._viewOverride=r>=1?void 0:n(r),this.#o=r<1?requestAnimationFrame(s):void 0};this.#o=requestAnimationFrame(s)}#C(e){this.focusOn(e);let n=this.#m(e);n!==void 0&&this.tickled.setTickled(n),this.interactionMode===`implicit`&&this.select(e)}navigateTo(e){let n=this.#l;if(!n?.children)return!1;let r=n;for(let n of e){let e=r.children?.find(e=>e.item.key===n);if(!e)return!1;r=e}this.focusOn(r),this.select(r);let i=this.#m(r);return i!==void 0&&this.tickled.setTickled(i),this.requestUpdate(),!0}navigateToNode(e){let n=this.#l;if(!n?.children)return!1;let r=WS(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=GS(this.#l,e),r=n?this.#m(n):void 0;return!n||r===void 0?!1:(this.#u().nodes.some(e=>e.id===r)||this.focusOn(n),this.tickled.setTickled(r),this.requestUpdate(),!0)}getNodes(){return this.#u().nodes.map(e=>({node:e.node,depth:e.depth}))}#w(e,n){return!this.filterPredicate||this.filterPredicate(e,n)?!0:e.children?.some(e=>this.#w(e,n+1))??!1}#T(e,n){if(this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.interactionMode===`standard`&&(n.ctrlKey||n.metaKey)){if(this._selectedNodes.has(e.node))this.deselect(e.node);else if(this.#v(e.node)){let n=new Set(this._selectedNodes);this._selectedNodes.add(e.node),this.selectedNode=e.node,this.#b(n),this.requestUpdate()}}else this.interactionMode!==`manual`&&this.select(e.node);this.tickled.setTickled(e.id),this.focusOn(e.node)}#E(e){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0}))}#D(e){let n=this.#l;if(this.disableKeyboardNavigation||!n)return;if(e.key===`Escape`&&this._previewId!==void 0){e.preventDefault(),this._previewId=void 0;return}let{action:r,handled:i}=oC(e.key,n,this._focusId??n.item.key,this.#u().nodes);i&&e.preventDefault(),r.kind===`focus`?this.#C(r.node):r.kind===`activate`&&(this.interactionMode!==`manual`&&this.select(r.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:r.node,depth:r.depth},bubbles:!0,composed:!0})))}#O(){return jS({zoom:this.zoom,offset:this._zoomOffset})}#k(){this.renderRoot.querySelector(`svg.hyperbolictree`)?.focus({preventScroll:!0})}#A(e){this.#e.hide(),this.interactionMode!==`manual`&&this.select(e);let n=this.#m(e);n!==void 0&&this.tickled.setTickled(n),this.focusOn(e),this.#k()}#j(e){let n=this._previewId===void 0||this.disableChildPreview?void 0:e.find(e=>e.id===this._previewId);if(!n)return;let{width:r,height:i}=this._hostSize,a=Xx(n.position,this.#O(),r||420,i||420),o=n.parentId===void 0?void 0:e.find(e=>e.id===n.parentId)?.node;return{node:n.node,anchor:a,side:Jx(a,r||420,i||420),parent:o}}#M(e,n){return PC(e,{nodeShape:this.nodeShape,radialLabels:!this.disableRadialLabels,zoom:this.#O().zoom,font:TC(this,Math.min(this._hostSize.width,this._hostSize.height),this.zoom),branches:n,boxMaxChars:this.boxMaxChars,minLabelSize:this.minLabelSize,nodeRadius:this.nodeRadius,minNodeRadius:this.minNodeRadius,minWeightScale:this.minWeightScale,maxWeightScale:this.maxWeightScale,isSelected:e=>this._selectedNodes.has(e),isTickled:e=>this.tickled.isTickled(e)})}#N(e,n){return UC(e,this.nodeShape,{ctx:n,state:{isSelected:e=>this._selectedNodes.has(e),isTickled:e=>this.tickled.isTickled(e),showTitle:e=>this.disableChildPreview||!e.node.children?.length,isFiltered:e=>!this.#w(e.node,e.depth),isPending:e=>this.#t.isPending(e)},handlers:{onClick:(e,n)=>{n.stopPropagation(),this.#c.wasDragged()||this.#T(e,n)},onDblClick:(e,n)=>{n.stopPropagation(),this.#c.wasDragged()||this.#E(e)},onPointerEnter:e=>this.tickled.handlePointerEnter(e)}})}render(){let{nodes:e,edges:n}=this.#u(),r=new Map(e.map(e=>[e.id,e])),a=EC(this.#l),o=this.#M(e,a);this.#n=o.labelIds;let{zoom:s,offset:c}=this.#O(),l=c.x===0&&c.y===0?``:`translate(${c.x*500} ${c.y*500}) `;return i`
|
|
9083
|
+
/>`}function GC(e,n,r,i){return _(e,e=>`${e.fromId}->${e.toId}`,e=>{let a=n.get(e.fromId)?.node,o=n.get(e.toId)?.node;return i&&a&&o?s`<g transform="scale(${500})">${i({edge:e,fromNode:a,toNode:o})}</g>`:WC(e,r)})}let J=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this.maxRadius=4,this.nodeShape=`dot`,this.boxMaxChars=24,this.minLabelSize=9,this.colorByBranch=!1,this.nodeRadius=.05,this.minNodeRadius=.015,this.minWeightScale=.6,this.maxWeightScale=1.6,this.zoom=1,this.disableZoomGestures=!1,this.disableRadialLabels=!1,this.disableChildPreview=!1,this.curvature=1,this.siblingSpacing=XS,this.focusAnimationDuration=400,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this._focusId=void 0,this._viewOverride=void 0,this._focusRotation=0,this._zoomOffset={x:0,y:0},this._previewId=void 0,this.#e=Qx({candidate:e=>{let n=this.#u().nodes,r=e===void 0||this.disableChildPreview?void 0:n.find(n=>n.id===e);return r&&!this.#c.isDragging()&&Yx(r,n,this.#n)?r.id:void 0},currentId:()=>this._previewId,setPreviewId:e=>{this._previewId=e}}),this.#t=sC(()=>({model:this.model,loadChildren:this.loadChildren}),()=>this.requestUpdate()),this.#n=new Set,this.search=new Bt(this,{adapter:Ut(this,{labelSelector:`.hyperbolictree-label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>this.#u().nodes.map(e=>({id:e.id,enabled:!0})),onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)},onTickle:e=>{if(this.#e.update(e),e===void 0)return;let n=this.#u().nodes.find(n=>n.id===e);n&&this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:n.node,depth:n.depth},bubbles:!0,composed:!0}))}}),this._hostSize={width:0,height:0},this.#c=IS({svgRect:()=>this.renderRoot.querySelector(`svg.hyperbolictree`)?.getBoundingClientRect(),onDragStart:()=>this.#e.hide(),takeView:()=>{let e=this.#f();return this.#x(),this._viewOverride=e,e},setView:e=>{this._viewOverride=e},zoomState:()=>this.#O(),setZoomState:e=>{this.zoom=e.zoom,this._zoomOffset=e.offset},zoomGesturesEnabled:()=>!this.disableZoomGestures,hasFocus:()=>this.renderRoot.activeElement!==null,focusTree:()=>this.#k()})}static{this.shadowRootOptions={...n.shadowRootOptions,delegatesFocus:!0}}get selectedNodes(){return this._selectedNodes}get focusedNode(){return this._focusId===void 0?this.#l:HS(this.#l,this._focusId)?.at(-1)??this.#l}#e;#t;#n;#r;#i;#a;#o;#s;#c;get#l(){return this.model?.root??this.root}#u(){return rC(this.#l,{focusedKey:this._focusId,maxRadius:this.maxRadius,curvature:this.curvature,siblingSpacing:this.siblingSpacing,view:this.#f()})}get#d(){return this.#l?.item.key}#f(){return this._viewOverride??bS(this._focusRotation)}#p(e,n){let r=QS(this.#l,24,this.curvature,this.siblingSpacing),i=n===void 0?void 0:tC(r,n,e);return i?_S(this.#f(),i):bS(this._focusRotation)}#m(e){let n=this.#l,r=US(n,e);if(r!==void 0)return r;let i=GS(n,e.item.key);return i?US(n,i):void 0}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#i=Jt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e,this.#g(),typeof ResizeObserver==`function`&&(this.#s=new ResizeObserver(([e])=>{let{width:n,height:r}=e.contentRect;this._hostSize={width:n,height:r}}),this.#s.observe(this))}disconnectedCallback(){super.disconnectedCallback(),this.#s?.disconnect(),this.#s=void 0,this.#r?.(),this.#r=void 0,this.#e.dispose(),this.#t.abortAll(),this.#o!==void 0&&(cancelAnimationFrame(this.#o),this.#o=void 0),this.#i&&(this.#i.unregister(`select-all`),this.#i.unregister(`deselect-all`),this.#i=void 0,this.registry=void 0)}#h(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#g(){this.#i&&(this.search.setModes(this.#h()),this.#a?.(),this.#a=Rt(this.#i,this.search))}updated(e){e.has(`root`)&&this.root&&this.#_(),e.has(`model`)&&(this.#r?.(),this.#r=void 0,this.model&&(this.#r=this.model._subscribe(e=>{e.type===`root`?(this.#_(),this.requestUpdate()):e.type===`invalidate`&&this.requestUpdate()}),this.#_())),e.has(`interactionMode`)&&this.clearSelection(),e.has(`searchModes`)&&this.#g(),this._focusId!==void 0&&!HS(this.#l,this._focusId)&&(this._focusId=void 0,this._viewOverride=void 0,this._focusRotation=0),this.#t.ensure(this.#u().nodes)}#_(){this.#y(),this.tickled.clearTickled(),this._focusId=void 0,this._viewOverride=void 0,this._focusRotation=0,this._zoomOffset={x:0,y:0},this._previewId=void 0,this.#c.cancel(),this.#o!==void 0&&(cancelAnimationFrame(this.#o),this.#o=void 0)}#v(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#y(){this._selectedNodes.clear(),this.selectedNode=void 0}#b(e){this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set(this._selectedNodes),previous:e},bubbles:!0,composed:!0}))}select(e){if(!this.#v(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#b(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#b(n),this.requestUpdate()}clearSelection(){if(this._selectedNodes.size===0)return;let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectAll(){let e=new Set(this._selectedNodes);for(let e of this.#u().nodes)this.#v(e.node)&&this._selectedNodes.add(e.node);this.selectedNode=[...this._selectedNodes].at(-1),this.#b(e),this.requestUpdate()}deselectAll(){let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectMany(e){let n=new Set(this._selectedNodes);this._selectedNodes=new Set([...e].filter(e=>this.#v(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#b(n),this.requestUpdate()}focusOn(e){let n=this.#l,r=this.#m(e),i=this._focusId??this.#d;if(r===void 0||i===r)return;let a=HS(n,r)?.at(-1)??e,o=i===void 0?void 0:HS(n,i)?.at(-1),s=this.#p(r,i);this._focusId=r,this.#c.cancel(),this._previewId=void 0,this.#S(s),this.dispatchEvent(new CustomEvent(`focus`,{detail:{node:a,previous:o},bubbles:!0,composed:!0})),o&&i!==void 0&&(VS(r,i)?this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:a,depth:zS(r)},bubbles:!0,composed:!0})):VS(i,r)&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:o,depth:zS(i)},bubbles:!0,composed:!0}))),this.requestUpdate()}#x(){this.#o!==void 0&&(cancelAnimationFrame(this.#o),this.#o=void 0)}#S(e){this.#x();let{viewAt:n,settledRotation:r}=kS(e);this._focusRotation=r;let i=this._zoomOffset;if(this.focusAnimationDuration<=0||DS()||typeof requestAnimationFrame!=`function`){this._viewOverride=void 0,this._zoomOffset={x:0,y:0};return}let a=performance.now(),o=this.focusAnimationDuration,s=e=>{let r=Math.min(1,(e-a)/o),c=1-ES(r);this._zoomOffset={x:i.x*c,y:i.y*c},this._viewOverride=r>=1?void 0:n(r),this.#o=r<1?requestAnimationFrame(s):void 0};this.#o=requestAnimationFrame(s)}#C(e){this.focusOn(e);let n=this.#m(e);n!==void 0&&this.tickled.setTickled(n),this.interactionMode===`implicit`&&this.select(e)}navigateTo(e){let n=this.#l;if(!n?.children)return!1;let r=n;for(let n of e){let e=r.children?.find(e=>e.item.key===n);if(!e)return!1;r=e}this.focusOn(r),this.select(r);let i=this.#m(r);return i!==void 0&&this.tickled.setTickled(i),this.requestUpdate(),!0}navigateToNode(e){let n=this.#l;if(!n?.children)return!1;let r=WS(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=GS(this.#l,e),r=n?this.#m(n):void 0;return!n||r===void 0?!1:(this.#u().nodes.some(e=>e.id===r)||this.focusOn(n),this.tickled.setTickled(r),this.requestUpdate(),!0)}getNodes(){return this.#u().nodes.map(e=>({node:e.node,depth:e.depth}))}#w(e,n){return!this.filterPredicate||this.filterPredicate(e,n)?!0:e.children?.some(e=>this.#w(e,n+1))??!1}#T(e,n){if(this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.interactionMode===`standard`&&(n.ctrlKey||n.metaKey)){if(this._selectedNodes.has(e.node))this.deselect(e.node);else if(this.#v(e.node)){let n=new Set(this._selectedNodes);this._selectedNodes.add(e.node),this.selectedNode=e.node,this.#b(n),this.requestUpdate()}}else this.interactionMode!==`manual`&&this.select(e.node);this.tickled.setTickled(e.id),this.focusOn(e.node)}#E(e){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0}))}#D(e){let n=this.#l;if(this.disableKeyboardNavigation||!n)return;if(e.key===`Escape`&&this._previewId!==void 0){e.preventDefault(),this._previewId=void 0;return}let{action:r,handled:i}=oC(e.key,n,this._focusId??n.item.key,this.#u().nodes);i&&e.preventDefault(),r.kind===`focus`?this.#C(r.node):r.kind===`activate`&&(this.interactionMode!==`manual`&&this.select(r.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:r.node,depth:r.depth},bubbles:!0,composed:!0})))}#O(){return jS({zoom:this.zoom,offset:this._zoomOffset})}#k(){this.renderRoot.querySelector(`svg.hyperbolictree`)?.focus({preventScroll:!0})}#A(e){this.#e.hide(),this.interactionMode!==`manual`&&this.select(e);let n=this.#m(e);n!==void 0&&this.tickled.setTickled(n),this.focusOn(e),this.#k()}#j(e){let n=this._previewId===void 0||this.disableChildPreview?void 0:e.find(e=>e.id===this._previewId);if(!n)return;let{width:r,height:i}=this._hostSize,a=Xx(n.position,this.#O(),r||420,i||420),o=n.parentId===void 0?void 0:e.find(e=>e.id===n.parentId)?.node;return{node:n.node,anchor:a,side:Jx(a,r||420,i||420),parent:o}}#M(e,n){return PC(e,{nodeShape:this.nodeShape,radialLabels:!this.disableRadialLabels,zoom:this.#O().zoom,font:TC(this,Math.min(this._hostSize.width,this._hostSize.height),this.zoom),branches:n,boxMaxChars:this.boxMaxChars,minLabelSize:this.minLabelSize,nodeRadius:this.nodeRadius,minNodeRadius:this.minNodeRadius,minWeightScale:this.minWeightScale,maxWeightScale:this.maxWeightScale,isSelected:e=>this._selectedNodes.has(e),isTickled:e=>this.tickled.isTickled(e)})}#N(e,n){return UC(e,this.nodeShape,{ctx:n,state:{isSelected:e=>this._selectedNodes.has(e),isTickled:e=>this.tickled.isTickled(e),showTitle:e=>this.disableChildPreview||!e.node.children?.length,isFiltered:e=>!this.#w(e.node,e.depth),isPending:e=>this.#t.isPending(e)},handlers:{onClick:(e,n)=>{n.stopPropagation(),this.#c.wasDragged()||this.#T(e,n)},onDblClick:(e,n)=>{n.stopPropagation(),this.#c.wasDragged()||this.#E(e)},onPointerEnter:e=>this.tickled.handlePointerEnter(e)}})}render(){let{nodes:e,edges:n}=this.#u(),r=new Map(e.map(e=>[e.id,e])),a=EC(this.#l),o=this.#M(e,a);this.#n=o.labelIds;let{zoom:s,offset:c}=this.#O(),l=c.x===0&&c.y===0?``:`translate(${c.x*500} ${c.y*500}) `;return i`
|
|
9078
9084
|
<svg
|
|
9079
9085
|
class="hyperbolictree"
|
|
9080
9086
|
viewBox="${-525} ${-525} ${1050} ${1050}"
|
|
@@ -9103,7 +9109,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9103
9109
|
</svg>
|
|
9104
9110
|
${Zx(this.#j(e),{onPointerEnter:()=>this.#e.pointerEnter(),onPointerLeave:()=>this.#e.pointerLeave(this.tickled.tickledId),onPick:e=>this.#A(e)})}
|
|
9105
9111
|
${this.search.renderField()}
|
|
9106
|
-
`}static{this.styles=[w,Ht,LS]}};E([d({type:Object})],J.prototype,`root`,void 0),E([d({attribute:!1})],J.prototype,`model`,void 0),E([d({attribute:!1})],J.prototype,`loadChildren`,void 0),E([d({reflect:!0,attribute:`exclusivity`})],J.prototype,`exclusivity`,void 0),E([d({reflect:!0,attribute:`selection-filter`})],J.prototype,`selectionFilter`,void 0),E([d({type:String,attribute:`interaction-mode`})],J.prototype,`interactionMode`,void 0),E([d({type:Number,attribute:`max-radius`})],J.prototype,`maxRadius`,void 0),E([d({type:String,attribute:`node-shape`,reflect:!0})],J.prototype,`nodeShape`,void 0),E([d({type:Number,attribute:`box-max-chars`})],J.prototype,`boxMaxChars`,void 0),E([d({type:Number,attribute:`min-label-size`})],J.prototype,`minLabelSize`,void 0),E([d({type:Boolean,attribute:`color-by-branch`,reflect:!0})],J.prototype,`colorByBranch`,void 0),E([d({type:Number,attribute:`node-radius`})],J.prototype,`nodeRadius`,void 0),E([d({type:Number,attribute:`min-node-radius`})],J.prototype,`minNodeRadius`,void 0),E([d({type:Number,attribute:`min-weight-scale`})],J.prototype,`minWeightScale`,void 0),E([d({type:Number,attribute:`max-weight-scale`})],J.prototype,`maxWeightScale`,void 0),E([d({type:Number})],J.prototype,`zoom`,void 0),E([d({type:Boolean,attribute:`disable-zoom-gestures`})],J.prototype,`disableZoomGestures`,void 0),E([d({type:Boolean,attribute:`disable-radial-labels`})],J.prototype,`disableRadialLabels`,void 0),E([d({type:Boolean,attribute:`disable-child-preview`})],J.prototype,`disableChildPreview`,void 0),E([d({type:Number})],J.prototype,`curvature`,void 0),E([d({type:Number,attribute:`sibling-spacing`})],J.prototype,`siblingSpacing`,void 0),E([d({type:Number,attribute:`focus-animation-duration`})],J.prototype,`focusAnimationDuration`,void 0),E([d({attribute:!1})],J.prototype,`edgeRenderer`,void 0),E([d({attribute:!1})],J.prototype,`selectedNode`,void 0),E([m()],J.prototype,`_selectedNodes`,void 0),E([d({attribute:!1})],J.prototype,`filterPredicate`,void 0),E([d({type:Boolean,attribute:`disable-keyboard-navigation`})],J.prototype,`disableKeyboardNavigation`,void 0),E([d({attribute:!1})],J.prototype,`registry`,void 0),E([d({type:String,attribute:`search-modes`,reflect:!0})],J.prototype,`searchModes`,void 0),E([m()],J.prototype,`_focusId`,void 0),E([m()],J.prototype,`_viewOverride`,void 0),E([m()],J.prototype,`_focusRotation`,void 0),E([m()],J.prototype,`_zoomOffset`,void 0),E([m()],J.prototype,`_previewId`,void 0),E([m()],J.prototype,`_hostSize`,void 0),J=E([T(`ixfx-hyperbolictree-list`)],J);function KC(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function qC(e,n){if(e){if(e.item.key===n)return e;for(let r of e.children??[]){let e=qC(r,n);if(e)return e}}}function JC(e,n){if(e){if(e.item.key===n)return[e];for(let r of e.children??[]){let i=JC(r,n);if(i)return[e,...i]}}}function YC(e,n={}){if(!e?.children?.length)return[];let{maxDepth:r=1/0,valueAccessor:i=()=>1,zoomKey:a,hideLeaves:o=!1}=n;if(r<=0)return[];let s=a===void 0?e:qC(e,a)??e,c=JC(e,s.item.key),l=c?c.length-2:-1,u=s.children??[];if(u.length===0)return[];let d=e=>e.item.isLeaf===!0||e.children!==void 0&&e.children.length===0,f=[],p=(e,n,a,s,c,l)=>{let u=o?e.filter(e=>!d(e)):e;if(u.length===0||a>=r)return;let m=u.map(e=>KC(i(e.item))),h=m.reduce((e,n)=>e+n,0),g=u.length,_=s;u.forEach((e,r)=>{let i=c*(h>0?m[r]/h:1/g),o=e.children??[];f.push({node:e,depth:n,relativeDepth:a,x:_,width:i,parentKey:l,index:r,setSize:g,hasChildren:o.length>0||e.children===void 0&&e.item.isLeaf!==!0}),o.length>0&&p(o,n+1,a+1,_,i,e.item.key),_+=i})};return p(u,l+1,0,0,1,s.item.key),f}let XC=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this.orientation=`horizontal`,this.maxDepth=4,this.minLabelWidth=40,this.minVerticalLabelWidth=16,this.hideLeaves=!1,this.valueAccessor=()=>1,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this._zoomKey=void 0,this.search=new Vt(this,{adapter:Wt(this,{labelSelector:`.icicle-label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>this.#c().map(e=>({id:e.node.item.key,enabled:!0})),onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)},onTickle:e=>{if(e===void 0)return;let n=this.#c().find(n=>n.node.item.key===e);n&&this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:n.node,depth:n.depth},bubbles:!0,composed:!0}))}}),this.#t=new Set,this.#n=new Map}static{this.shadowRootOptions={...n.shadowRootOptions,delegatesFocus:!0}}get selectedNodes(){return this._selectedNodes}get focusedNode(){if(this._zoomKey!==void 0)return qC(this.#s,this._zoomKey)}#e;#t;#n;#r;#i;#a;#o;get#s(){return this.model?.root??this.root}#c(){return YC(this.#s,{valueAccessor:this.valueAccessor,maxDepth:this.maxDepth,zoomKey:this._zoomKey,hideLeaves:this.hideLeaves})}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#i=Yt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e,this.#u(),typeof ResizeObserver<`u`&&(this.#o=new ResizeObserver(()=>this.requestUpdate()),this.#o.observe(this))}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=void 0;for(let e of this.#n.values())e.abort();this.#n.clear(),this.#t.clear(),this.#o?.disconnect(),this.#o=void 0,this.#i&&(this.#i.unregister(`select-all`),this.#i.unregister(`deselect-all`),this.#i=void 0,this.registry=void 0)}#l(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#u(){this.#i&&(this.search.setModes(this.#l()),this.#a?.(),this.#a=Rt(this.#i,this.search))}updated(e){e.has(`root`)&&this.root&&this.#m(),e.has(`model`)&&(this.#e?.(),this.#e=void 0,this.model&&(this.#e=this.model._subscribe(e=>{e.type===`root`?(this.#m(),this.requestUpdate()):e.type===`invalidate`&&this.requestUpdate()}),this.#m())),e.has(`interactionMode`)&&(this.#r=void 0,this.clearSelection()),e.has(`searchModes`)&&this.#u(),this._zoomKey!==void 0&&!qC(this.#s,this._zoomKey)&&(this._zoomKey=void 0),this.#h(),this.#p()}#d(){return(this.orientation===`vertical`?this.clientHeight:this.clientWidth)||0}#f(e){let n=this.#d();if(n===0)return{hidden:!1,rotated:!1};let r=this.orientation===`vertical`,i=e.width*n;return r?{hidden:i<this.minLabelWidth,rotated:!1}:i<this.minVerticalLabelWidth?{hidden:!0,rotated:!1}:{hidden:!1,rotated:i<this.minLabelWidth}}#p(){let e=this._tooltipEl;if(!e?.popover)return;let n=this.tickled.tickledId,r=n===void 0?void 0:this.#c().find(e=>e.node.item.key===n),i=r?this.#f(r):void 0,a=e.matches(`:popover-open`);if(r&&i&&(i.hidden||i.rotated)){if(e.textContent=r.node.item.label,!a)try{e.showPopover()}catch{}}else if(a)try{e.hidePopover()}catch{}}#m(){this.#v(),this.tickled.clearTickled(),this._zoomKey=void 0,this.#r=void 0}#h(){if(!(!this.model&&!this.loadChildren))for(let e of this.#c()){let{node:n}=e;n.children!==void 0||this.#t.has(n.item.key)||this.#g(n,e.depth)}}async#g(e,n){let r=e.item.key;this.#t.add(r);let i=new AbortController;this.#n.set(r,i),this.requestUpdate();try{let r;if(r=this.model?await this.model.getChildren(e,n,i.signal):[...await gg(this.loadChildren({node:e,depth:n},i.signal),i.signal)],i.signal.aborted)return;e.children=r}catch{if(i.signal.aborted)return;e.children=[]}finally{this.#t.delete(r),this.#n.delete(r),i.signal.aborted||this.requestUpdate()}}#_(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#v(){this._selectedNodes.clear(),this.selectedNode=void 0}#y(e){this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set(this._selectedNodes),previous:e},bubbles:!0,composed:!0}))}select(e){if(!this.#_(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#y(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#y(n),this.requestUpdate()}clearSelection(){if(this._selectedNodes.size===0)return;let e=new Set(this._selectedNodes);this.#v(),this.#y(e),this.requestUpdate()}selectAll(){let e=new Set(this._selectedNodes);for(let e of this.#c())this.#_(e.node)&&this._selectedNodes.add(e.node);this.selectedNode=[...this._selectedNodes].at(-1),this.#y(e),this.requestUpdate()}deselectAll(){let e=new Set(this._selectedNodes);this.#v(),this.#y(e),this.requestUpdate()}selectMany(e){let n=new Set(this._selectedNodes);this._selectedNodes=new Set([...e].filter(e=>this.#_(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#y(n),this.requestUpdate()}zoomTo(e){if(this._zoomKey===e.item.key)return;this._zoomKey=e.item.key,this.tickled.clearTickled();let n=JC(this.#s,e.item.key)?.length,r=n===void 0?-1:n-2;this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}zoomOut(){if(this._zoomKey===void 0)return;let e=this.focusedNode,n=this._zoomKey===void 0?void 0:JC(this.#s,this._zoomKey),r=n===void 0?-1:n.length-2;this._zoomKey=void 0,this.tickled.clearTickled(),this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:void 0,depth:-1},bubbles:!0,composed:!0})),e&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}#b(e){return e.item.isLeaf===!0?!1:e.children===void 0?this.model!==void 0||this.loadChildren!==void 0:e.children.length>0}navigateTo(e){let n=this.#s;if(!n?.children)return!1;let r=n,i=[];for(let n of e){let e=r.children?.find(e=>e.item.key===n);if(!e)return!1;i.push(e),r=e}let a=i.at(-1);return i.length>this.maxDepth?this.zoomTo(i[i.length-this.maxDepth-1]):this._zoomKey!==void 0&&this.zoomOut(),this.select(a),this.tickled.setTickled(a.item.key),this.requestUpdate(),!0}navigateToNode(e){let n=this.#s;if(!n?.children)return!1;let r=this.#S(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=this.#s;if(!n?.children)return!1;let r=this.#S(n.children,n=>n.item.key===e);if(!r)return!1;if(r.length>this.maxDepth){let e=this.#x(r.slice(0,r.length-this.maxDepth));e&&this.zoomTo(e)}return this.tickled.setTickled(e),this.requestUpdate(),!0}#x(e){let n=this.#s;for(let r of e){let e=r===n?.item.key?n:n?.children?.find(e=>e.item.key===r);if(!e)return;n=e}return n}#S(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#S(i.children,n,e);if(r)return r}}}getNodes(){return this.#c().map(e=>({node:e.node,depth:e.depth}))}#C(e,n){return!this.filterPredicate||this.filterPredicate(e,n)?!0:e.children?.some(e=>this.#C(e,n+1))??!1}#w(e,n,r){if(this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.interactionMode===`standard`&&(r.ctrlKey||r.metaKey)){if(this._selectedNodes.has(e.node))this.deselect(e.node);else if(this.#_(e.node)){let n=new Set(this._selectedNodes);this._selectedNodes.add(e.node),this.selectedNode=e.node,this.#y(n),this.requestUpdate()}this.#r=n}else if(this.interactionMode===`standard`&&r.shiftKey&&this.#r!==void 0){let e=this.#c(),r=Math.min(this.#r,n),i=Math.max(this.#r,n),a=new Set(this._selectedNodes);this._selectedNodes=new Set(e.slice(r,i+1).map(e=>e.node).filter(e=>this.#_(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#y(a),this.requestUpdate()}else this.interactionMode!==`manual`&&(this.select(e.node),this.#r=n);this.tickled.setTickled(e.node.item.key),this.#b(e.node)&&this.zoomTo(e.node)}#T(e){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0}))}#E(e){if(this.disableKeyboardNavigation)return;let n=this.#c();if(n.length===0)return;let r=this.tickled.tickledId,i=r===void 0?-1:n.findIndex(e=>e.node.item.key===r),a=i>=0?n[i]:void 0,o=n=>{n&&(e.preventDefault(),this.tickled.setTickled(n.node.item.key),this.interactionMode===`implicit`&&this.select(n.node))};switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=e.key===`ArrowRight`?1:-1;if(!a){o(n[0]);return}let i=n.filter(e=>e.relativeDepth===a.relativeDepth&&e.parentKey===a.parentKey);o(i[i.findIndex(e=>e.node.item.key===a.node.item.key)+r]??(r>0?i[0]:i.at(-1)));return}case`ArrowUp`:if(!a){o(n[0]);return}o((a.parentKey===void 0?void 0:n.find(e=>e.node.item.key===a.parentKey))??n[0]);return;case`ArrowDown`:if(!a){o(n[0]);return}o(n.find(e=>e.parentKey===a.node.item.key));return;case`Home`:o(n[0]);return;case`End`:o(n.at(-1));return;case`Enter`:if(!a)return;e.preventDefault(),this.interactionMode!==`manual`&&this.select(a.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:a.node,depth:a.depth},bubbles:!0,composed:!0})),this.#b(a.node)&&this.zoomTo(a.node);return;case`Escape`:this._zoomKey!==void 0&&(e.preventDefault(),this.zoomOut())}}#D(){let e=this.focusedNode;return e===void 0?a:i`
|
|
9112
|
+
`}static{this.styles=[w,Vt,LS]}};E([d({type:Object})],J.prototype,`root`,void 0),E([d({attribute:!1})],J.prototype,`model`,void 0),E([d({attribute:!1})],J.prototype,`loadChildren`,void 0),E([d({reflect:!0,attribute:`exclusivity`})],J.prototype,`exclusivity`,void 0),E([d({reflect:!0,attribute:`selection-filter`})],J.prototype,`selectionFilter`,void 0),E([d({type:String,attribute:`interaction-mode`})],J.prototype,`interactionMode`,void 0),E([d({type:Number,attribute:`max-radius`})],J.prototype,`maxRadius`,void 0),E([d({type:String,attribute:`node-shape`,reflect:!0})],J.prototype,`nodeShape`,void 0),E([d({type:Number,attribute:`box-max-chars`})],J.prototype,`boxMaxChars`,void 0),E([d({type:Number,attribute:`min-label-size`})],J.prototype,`minLabelSize`,void 0),E([d({type:Boolean,attribute:`color-by-branch`,reflect:!0})],J.prototype,`colorByBranch`,void 0),E([d({type:Number,attribute:`node-radius`})],J.prototype,`nodeRadius`,void 0),E([d({type:Number,attribute:`min-node-radius`})],J.prototype,`minNodeRadius`,void 0),E([d({type:Number,attribute:`min-weight-scale`})],J.prototype,`minWeightScale`,void 0),E([d({type:Number,attribute:`max-weight-scale`})],J.prototype,`maxWeightScale`,void 0),E([d({type:Number})],J.prototype,`zoom`,void 0),E([d({type:Boolean,attribute:`disable-zoom-gestures`})],J.prototype,`disableZoomGestures`,void 0),E([d({type:Boolean,attribute:`disable-radial-labels`})],J.prototype,`disableRadialLabels`,void 0),E([d({type:Boolean,attribute:`disable-child-preview`})],J.prototype,`disableChildPreview`,void 0),E([d({type:Number})],J.prototype,`curvature`,void 0),E([d({type:Number,attribute:`sibling-spacing`})],J.prototype,`siblingSpacing`,void 0),E([d({type:Number,attribute:`focus-animation-duration`})],J.prototype,`focusAnimationDuration`,void 0),E([d({attribute:!1})],J.prototype,`edgeRenderer`,void 0),E([d({attribute:!1})],J.prototype,`selectedNode`,void 0),E([m()],J.prototype,`_selectedNodes`,void 0),E([d({attribute:!1})],J.prototype,`filterPredicate`,void 0),E([d({type:Boolean,attribute:`disable-keyboard-navigation`})],J.prototype,`disableKeyboardNavigation`,void 0),E([d({attribute:!1})],J.prototype,`registry`,void 0),E([d({type:String,attribute:`search-modes`,reflect:!0})],J.prototype,`searchModes`,void 0),E([m()],J.prototype,`_focusId`,void 0),E([m()],J.prototype,`_viewOverride`,void 0),E([m()],J.prototype,`_focusRotation`,void 0),E([m()],J.prototype,`_zoomOffset`,void 0),E([m()],J.prototype,`_previewId`,void 0),E([m()],J.prototype,`_hostSize`,void 0),J=E([T(`ixfx-hyperbolictree-list`)],J);function KC(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function qC(e,n){if(e){if(e.item.key===n)return e;for(let r of e.children??[]){let e=qC(r,n);if(e)return e}}}function JC(e,n){if(e){if(e.item.key===n)return[e];for(let r of e.children??[]){let i=JC(r,n);if(i)return[e,...i]}}}function YC(e,n={}){if(!e?.children?.length)return[];let{maxDepth:r=1/0,valueAccessor:i=()=>1,zoomKey:a,hideLeaves:o=!1}=n;if(r<=0)return[];let s=a===void 0?e:qC(e,a)??e,c=JC(e,s.item.key),l=c?c.length-2:-1,u=s.children??[];if(u.length===0)return[];let d=e=>e.item.isLeaf===!0||e.children!==void 0&&e.children.length===0,f=[],p=(e,n,a,s,c,l)=>{let u=o?e.filter(e=>!d(e)):e;if(u.length===0||a>=r)return;let m=u.map(e=>KC(i(e.item))),h=m.reduce((e,n)=>e+n,0),g=u.length,_=s;u.forEach((e,r)=>{let i=c*(h>0?m[r]/h:1/g),o=e.children??[];f.push({node:e,depth:n,relativeDepth:a,x:_,width:i,parentKey:l,index:r,setSize:g,hasChildren:o.length>0||e.children===void 0&&e.item.isLeaf!==!0}),o.length>0&&p(o,n+1,a+1,_,i,e.item.key),_+=i})};return p(u,l+1,0,0,1,s.item.key),f}let XC=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this.orientation=`horizontal`,this.maxDepth=4,this.minLabelWidth=40,this.minVerticalLabelWidth=16,this.hideLeaves=!1,this.valueAccessor=()=>1,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this._zoomKey=void 0,this.search=new Bt(this,{adapter:Ut(this,{labelSelector:`.icicle-label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>this.#c().map(e=>({id:e.node.item.key,enabled:!0})),onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)},onTickle:e=>{if(e===void 0)return;let n=this.#c().find(n=>n.node.item.key===e);n&&this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:n.node,depth:n.depth},bubbles:!0,composed:!0}))}}),this.#t=new Set,this.#n=new Map}static{this.shadowRootOptions={...n.shadowRootOptions,delegatesFocus:!0}}get selectedNodes(){return this._selectedNodes}get focusedNode(){if(this._zoomKey!==void 0)return qC(this.#s,this._zoomKey)}#e;#t;#n;#r;#i;#a;#o;get#s(){return this.model?.root??this.root}#c(){return YC(this.#s,{valueAccessor:this.valueAccessor,maxDepth:this.maxDepth,zoomKey:this._zoomKey,hideLeaves:this.hideLeaves})}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#i=Jt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e,this.#u(),typeof ResizeObserver<`u`&&(this.#o=new ResizeObserver(()=>this.requestUpdate()),this.#o.observe(this))}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=void 0;for(let e of this.#n.values())e.abort();this.#n.clear(),this.#t.clear(),this.#o?.disconnect(),this.#o=void 0,this.#i&&(this.#i.unregister(`select-all`),this.#i.unregister(`deselect-all`),this.#i=void 0,this.registry=void 0)}#l(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#u(){this.#i&&(this.search.setModes(this.#l()),this.#a?.(),this.#a=Rt(this.#i,this.search))}updated(e){e.has(`root`)&&this.root&&this.#m(),e.has(`model`)&&(this.#e?.(),this.#e=void 0,this.model&&(this.#e=this.model._subscribe(e=>{e.type===`root`?(this.#m(),this.requestUpdate()):e.type===`invalidate`&&this.requestUpdate()}),this.#m())),e.has(`interactionMode`)&&(this.#r=void 0,this.clearSelection()),e.has(`searchModes`)&&this.#u(),this._zoomKey!==void 0&&!qC(this.#s,this._zoomKey)&&(this._zoomKey=void 0),this.#h(),this.#p()}#d(){return(this.orientation===`vertical`?this.clientHeight:this.clientWidth)||0}#f(e){let n=this.#d();if(n===0)return{hidden:!1,rotated:!1};let r=this.orientation===`vertical`,i=e.width*n;return r?{hidden:i<this.minLabelWidth,rotated:!1}:i<this.minVerticalLabelWidth?{hidden:!0,rotated:!1}:{hidden:!1,rotated:i<this.minLabelWidth}}#p(){let e=this._tooltipEl;if(!e?.popover)return;let n=this.tickled.tickledId,r=n===void 0?void 0:this.#c().find(e=>e.node.item.key===n),i=r?this.#f(r):void 0,a=e.matches(`:popover-open`);if(r&&i&&(i.hidden||i.rotated)){if(e.textContent=r.node.item.label,!a)try{e.showPopover()}catch{}}else if(a)try{e.hidePopover()}catch{}}#m(){this.#v(),this.tickled.clearTickled(),this._zoomKey=void 0,this.#r=void 0}#h(){if(!(!this.model&&!this.loadChildren))for(let e of this.#c()){let{node:n}=e;n.children!==void 0||this.#t.has(n.item.key)||this.#g(n,e.depth)}}async#g(e,n){let r=e.item.key;this.#t.add(r);let i=new AbortController;this.#n.set(r,i),this.requestUpdate();try{let r;if(r=this.model?await this.model.getChildren(e,n,i.signal):[...await hg(this.loadChildren({node:e,depth:n},i.signal),i.signal)],i.signal.aborted)return;e.children=r}catch{if(i.signal.aborted)return;e.children=[]}finally{this.#t.delete(r),this.#n.delete(r),i.signal.aborted||this.requestUpdate()}}#_(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#v(){this._selectedNodes.clear(),this.selectedNode=void 0}#y(e){this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set(this._selectedNodes),previous:e},bubbles:!0,composed:!0}))}select(e){if(!this.#_(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#y(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#y(n),this.requestUpdate()}clearSelection(){if(this._selectedNodes.size===0)return;let e=new Set(this._selectedNodes);this.#v(),this.#y(e),this.requestUpdate()}selectAll(){let e=new Set(this._selectedNodes);for(let e of this.#c())this.#_(e.node)&&this._selectedNodes.add(e.node);this.selectedNode=[...this._selectedNodes].at(-1),this.#y(e),this.requestUpdate()}deselectAll(){let e=new Set(this._selectedNodes);this.#v(),this.#y(e),this.requestUpdate()}selectMany(e){let n=new Set(this._selectedNodes);this._selectedNodes=new Set([...e].filter(e=>this.#_(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#y(n),this.requestUpdate()}zoomTo(e){if(this._zoomKey===e.item.key)return;this._zoomKey=e.item.key,this.tickled.clearTickled();let n=JC(this.#s,e.item.key)?.length,r=n===void 0?-1:n-2;this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}zoomOut(){if(this._zoomKey===void 0)return;let e=this.focusedNode,n=this._zoomKey===void 0?void 0:JC(this.#s,this._zoomKey),r=n===void 0?-1:n.length-2;this._zoomKey=void 0,this.tickled.clearTickled(),this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:void 0,depth:-1},bubbles:!0,composed:!0})),e&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}#b(e){return e.item.isLeaf===!0?!1:e.children===void 0?this.model!==void 0||this.loadChildren!==void 0:e.children.length>0}navigateTo(e){let n=this.#s;if(!n?.children)return!1;let r=n,i=[];for(let n of e){let e=r.children?.find(e=>e.item.key===n);if(!e)return!1;i.push(e),r=e}let a=i.at(-1);return i.length>this.maxDepth?this.zoomTo(i[i.length-this.maxDepth-1]):this._zoomKey!==void 0&&this.zoomOut(),this.select(a),this.tickled.setTickled(a.item.key),this.requestUpdate(),!0}navigateToNode(e){let n=this.#s;if(!n?.children)return!1;let r=this.#S(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=this.#s;if(!n?.children)return!1;let r=this.#S(n.children,n=>n.item.key===e);if(!r)return!1;if(r.length>this.maxDepth){let e=this.#x(r.slice(0,r.length-this.maxDepth));e&&this.zoomTo(e)}return this.tickled.setTickled(e),this.requestUpdate(),!0}#x(e){let n=this.#s;for(let r of e){let e=r===n?.item.key?n:n?.children?.find(e=>e.item.key===r);if(!e)return;n=e}return n}#S(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#S(i.children,n,e);if(r)return r}}}getNodes(){return this.#c().map(e=>({node:e.node,depth:e.depth}))}#C(e,n){return!this.filterPredicate||this.filterPredicate(e,n)?!0:e.children?.some(e=>this.#C(e,n+1))??!1}#w(e,n,r){if(this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.interactionMode===`standard`&&(r.ctrlKey||r.metaKey)){if(this._selectedNodes.has(e.node))this.deselect(e.node);else if(this.#_(e.node)){let n=new Set(this._selectedNodes);this._selectedNodes.add(e.node),this.selectedNode=e.node,this.#y(n),this.requestUpdate()}this.#r=n}else if(this.interactionMode===`standard`&&r.shiftKey&&this.#r!==void 0){let e=this.#c(),r=Math.min(this.#r,n),i=Math.max(this.#r,n),a=new Set(this._selectedNodes);this._selectedNodes=new Set(e.slice(r,i+1).map(e=>e.node).filter(e=>this.#_(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#y(a),this.requestUpdate()}else this.interactionMode!==`manual`&&(this.select(e.node),this.#r=n);this.tickled.setTickled(e.node.item.key),this.#b(e.node)&&this.zoomTo(e.node)}#T(e){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0}))}#E(e){if(this.disableKeyboardNavigation)return;let n=this.#c();if(n.length===0)return;let r=this.tickled.tickledId,i=r===void 0?-1:n.findIndex(e=>e.node.item.key===r),a=i>=0?n[i]:void 0,o=n=>{n&&(e.preventDefault(),this.tickled.setTickled(n.node.item.key),this.interactionMode===`implicit`&&this.select(n.node))};switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=e.key===`ArrowRight`?1:-1;if(!a){o(n[0]);return}let i=n.filter(e=>e.relativeDepth===a.relativeDepth&&e.parentKey===a.parentKey);o(i[i.findIndex(e=>e.node.item.key===a.node.item.key)+r]??(r>0?i[0]:i.at(-1)));return}case`ArrowUp`:if(!a){o(n[0]);return}o((a.parentKey===void 0?void 0:n.find(e=>e.node.item.key===a.parentKey))??n[0]);return;case`ArrowDown`:if(!a){o(n[0]);return}o(n.find(e=>e.parentKey===a.node.item.key));return;case`Home`:o(n[0]);return;case`End`:o(n.at(-1));return;case`Enter`:if(!a)return;e.preventDefault(),this.interactionMode!==`manual`&&this.select(a.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:a.node,depth:a.depth},bubbles:!0,composed:!0})),this.#b(a.node)&&this.zoomTo(a.node);return;case`Escape`:this._zoomKey!==void 0&&(e.preventDefault(),this.zoomOut())}}#D(){let e=this.focusedNode;return e===void 0?a:i`
|
|
9107
9113
|
<nav class="breadcrumb" part="breadcrumb" aria-label="Icicle zoom path">
|
|
9108
9114
|
<ixfx-crumb-navigation
|
|
9109
9115
|
with-up
|
|
@@ -9156,7 +9162,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9156
9162
|
</div>
|
|
9157
9163
|
<div id="icicle-tooltip" popover="manual" part="tooltip" class="icicle-tooltip"></div>
|
|
9158
9164
|
${this.search.renderField()}
|
|
9159
|
-
`}static{this.styles=[w,se,C,
|
|
9165
|
+
`}static{this.styles=[w,se,C,Vt,r`
|
|
9160
9166
|
:host {
|
|
9161
9167
|
--icicletree-band-height: 44px;
|
|
9162
9168
|
--icicletree-band-gap: 2px;
|
|
@@ -9397,7 +9403,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9397
9403
|
${this.#w()}
|
|
9398
9404
|
${this.#C(l)}
|
|
9399
9405
|
</svg>
|
|
9400
|
-
`}updated(e){if(super.updated(e),e.has(`radius`)&&this.style.setProperty(`--radius`,`${this.radius}%`),this.style.setProperty(`--value-relative`,this.#s().toString()),e.has(`flatten`)){let e=this.#T(`--marker-thickness`,.15),n=this.#T(`--radius`,45),r=Math.round(e*n)+5,i=Math.round(100*(1-this.flatten))+r;this.style.setProperty(`--dial-height`,`${i}px`);let a=this.renderRoot.querySelector(`svg`);a&&a.setAttribute(`viewBox`,`0 0 100 ${i}`)}}disconnectedCallback(){super.disconnectedCallback(),this.#a!==void 0&&clearTimeout(this.#a),this.#h()}firstUpdated(){let e=this.#T(`--marker-thickness`,.15),n=this.#T(`--radius`,45),r=Math.round(e*n),i=Math.round(100*(1-this.flatten))+r;this.style.setProperty(`--dial-height`,`${i}px`);let a=this.renderRoot.querySelector(`svg`);a&&a.setAttribute(`viewBox`,`0 0 100 ${i}`)}static{this.styles=[w,
|
|
9406
|
+
`}updated(e){if(super.updated(e),e.has(`radius`)&&this.style.setProperty(`--radius`,`${this.radius}%`),this.style.setProperty(`--value-relative`,this.#s().toString()),e.has(`flatten`)){let e=this.#T(`--marker-thickness`,.15),n=this.#T(`--radius`,45),r=Math.round(e*n)+5,i=Math.round(100*(1-this.flatten))+r;this.style.setProperty(`--dial-height`,`${i}px`);let a=this.renderRoot.querySelector(`svg`);a&&a.setAttribute(`viewBox`,`0 0 100 ${i}`)}}disconnectedCallback(){super.disconnectedCallback(),this.#a!==void 0&&clearTimeout(this.#a),this.#h()}firstUpdated(){let e=this.#T(`--marker-thickness`,.15),n=this.#T(`--radius`,45),r=Math.round(e*n),i=Math.round(100*(1-this.flatten))+r;this.style.setProperty(`--dial-height`,`${i}px`);let a=this.renderRoot.querySelector(`svg`);a&&a.setAttribute(`viewBox`,`0 0 100 ${i}`)}static{this.styles=[w,sn,r`
|
|
9401
9407
|
:host {
|
|
9402
9408
|
display: inline-block;
|
|
9403
9409
|
width: 100px;
|
|
@@ -9514,7 +9520,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9514
9520
|
stroke-width: var(--midpoint-border-width, 0);
|
|
9515
9521
|
vector-effect: non-scaling-stroke;
|
|
9516
9522
|
}
|
|
9517
|
-
`]}};E([d({type:Number})],pw.prototype,`radius`,null),E([d({type:Number})],pw.prototype,`value`,void 0),E([d({type:Number})],pw.prototype,`min`,void 0),E([d({type:Number})],pw.prototype,`max`,void 0),E([d({type:Number})],pw.prototype,`step`,void 0),E([d({type:Number})],pw.prototype,`stops`,void 0),E([d({type:String,attribute:`value-mode`})],pw.prototype,`valueMode`,void 0),E([d({type:Number})],pw.prototype,`flatten`,void 0),E([d({type:String,attribute:`marker-style`})],pw.prototype,`markerStyle`,void 0),E([d({type:Boolean})],pw.prototype,`wedge`,void 0),E([d({type:Boolean,reflect:!0})],pw.prototype,`disabled`,void 0),pw=E([T(`ixfx-radial-input`)],pw);let mw=class extends
|
|
9523
|
+
`]}};E([d({type:Number})],pw.prototype,`radius`,null),E([d({type:Number})],pw.prototype,`value`,void 0),E([d({type:Number})],pw.prototype,`min`,void 0),E([d({type:Number})],pw.prototype,`max`,void 0),E([d({type:Number})],pw.prototype,`step`,void 0),E([d({type:Number})],pw.prototype,`stops`,void 0),E([d({type:String,attribute:`value-mode`})],pw.prototype,`valueMode`,void 0),E([d({type:Number})],pw.prototype,`flatten`,void 0),E([d({type:String,attribute:`marker-style`})],pw.prototype,`markerStyle`,void 0),E([d({type:Boolean})],pw.prototype,`wedge`,void 0),E([d({type:Boolean,reflect:!0})],pw.prototype,`disabled`,void 0),pw=E([T(`ixfx-radial-input`)],pw);let mw=class extends lg{constructor(...e){super(...e),this.inputSelector=`ixfx-radial-input`,this.max=100,this.step=1,this.radius=45,this.flatten=.3,this.markerStyle=`needle`,this.wedge=!1,this.valueMode=`range`,this.tooltip=!1,this.flip=!1,this.aspectRatioThreshold=1.5,this.lighttouch=!1,this._isWide=!1}_getEffectivePrecision(){if(this.hasAttribute(`precision`))return this.precision;if(this.step!==void 0){let e=String(this.step).split(`.`)[1];return e?e.length:0}return this.max-this.min>10?0:2}_handleResize(e){super._handleResize(e);let{width:n,height:r}=e[0].contentRect;this._isWide=r>0&&n/r>=this.aspectRatioThreshold}_renderEditableNumber(){if(this._isMini)return a;let e=Math.max(this.label?.length??0,3)+1;return i`
|
|
9518
9524
|
<ixfx-editable-number
|
|
9519
9525
|
class="number"
|
|
9520
9526
|
mode="label"
|
|
@@ -9708,7 +9714,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9708
9714
|
${this.#Oe()}
|
|
9709
9715
|
${c}
|
|
9710
9716
|
</svg>
|
|
9711
|
-
`}#Me(e){if(this.disabled)return`not-allowed`;if(this.#i)return`grabbing`;let n=.06;if(this.valueMode===`single`){if(this.singleStyle===`unipolar`){let r=this.#D()/2,i=.5-r,a=.5+r;return Math.abs(e-i)<n||Math.abs(e-a)<n?`grab`:`pointer`}let r=this.#D();return Math.abs(e-r)<n?`grab`:`pointer`}let r=this.#D(),i=this.#O(),a=Math.min(r,i),o=Math.max(r,i);if(Math.abs(e-r)<n||Math.abs(e-i)<n)return`grab`;if(this.valueMode===`triple`){let r=this.#k();if(Math.abs(e-r)<n)return`grab`}return e>a&&e<o?this.valueDrag===`none`?`default`:`move`:`pointer`}#Ne;#Pe;updated(e){if(super.updated(e),this.valueMode===`single`)this.style.setProperty(`--value-relative`,this.#D().toString());else{let e=xw(this.#A(),this.min,this.max),n=xw(this.#j(),this.min,this.max);this.style.setProperty(`--value-min-relative`,e.toString()),this.style.setProperty(`--value-max-relative`,n.toString()),this.style.setProperty(`--value-relative`,n.toString()),this.valueMode===`triple`&&this.#r!==void 0&&this.style.setProperty(`--value-c-relative`,xw(this.#r,this.min,this.max).toString())}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.#w),this.removeEventListener(`pointerdown`,this.#pe),this.removeEventListener(`pointermove`,this.#me),this.removeEventListener(`pointerenter`,this.#he),this.#x?.disconnect(),this.#x=void 0,this.#S?.disconnect(),this.#S=void 0,this.#_!==void 0&&(clearTimeout(this.#_),this.#_=void 0),this.#ye()}static{this.styles=[w,
|
|
9717
|
+
`}#Me(e){if(this.disabled)return`not-allowed`;if(this.#i)return`grabbing`;let n=.06;if(this.valueMode===`single`){if(this.singleStyle===`unipolar`){let r=this.#D()/2,i=.5-r,a=.5+r;return Math.abs(e-i)<n||Math.abs(e-a)<n?`grab`:`pointer`}let r=this.#D();return Math.abs(e-r)<n?`grab`:`pointer`}let r=this.#D(),i=this.#O(),a=Math.min(r,i),o=Math.max(r,i);if(Math.abs(e-r)<n||Math.abs(e-i)<n)return`grab`;if(this.valueMode===`triple`){let r=this.#k();if(Math.abs(e-r)<n)return`grab`}return e>a&&e<o?this.valueDrag===`none`?`default`:`move`:`pointer`}#Ne;#Pe;updated(e){if(super.updated(e),this.valueMode===`single`)this.style.setProperty(`--value-relative`,this.#D().toString());else{let e=xw(this.#A(),this.min,this.max),n=xw(this.#j(),this.min,this.max);this.style.setProperty(`--value-min-relative`,e.toString()),this.style.setProperty(`--value-max-relative`,n.toString()),this.style.setProperty(`--value-relative`,n.toString()),this.valueMode===`triple`&&this.#r!==void 0&&this.style.setProperty(`--value-c-relative`,xw(this.#r,this.min,this.max).toString())}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.#w),this.removeEventListener(`pointerdown`,this.#pe),this.removeEventListener(`pointermove`,this.#me),this.removeEventListener(`pointerenter`,this.#he),this.#x?.disconnect(),this.#x=void 0,this.#S?.disconnect(),this.#S=void 0,this.#_!==void 0&&(clearTimeout(this.#_),this.#_=void 0),this.#ye()}static{this.styles=[w,sn,r`
|
|
9712
9718
|
:host {
|
|
9713
9719
|
display: inline-block;
|
|
9714
9720
|
width: 200px;
|
|
@@ -9853,7 +9859,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
9853
9859
|
stroke-width: var(--midpoint-border-width, 0);
|
|
9854
9860
|
vector-effect: non-scaling-stroke;
|
|
9855
9861
|
}
|
|
9856
|
-
`]}};E([d({type:Number,attribute:`value-a`})],ww.prototype,`valueA`,void 0),E([d({type:Number,attribute:`value-b`})],ww.prototype,`valueB`,void 0),E([d({type:Number,attribute:`value-c`})],ww.prototype,`valueC`,void 0),E([d({type:Number})],ww.prototype,`min`,void 0),E([d({type:Number})],ww.prototype,`max`,void 0),E([d({type:Number})],ww.prototype,`step`,void 0),E([d({type:Number})],ww.prototype,`stops`,void 0),E([d({type:String,attribute:`value-mode`})],ww.prototype,`valueMode`,void 0),E([d({type:String,attribute:`single-style`})],ww.prototype,`singleStyle`,void 0),E([d({type:String})],ww.prototype,`orientation`,void 0),E([d({type:String,attribute:`marker-style`})],ww.prototype,`markerStyle`,void 0),E([d({type:String,attribute:`marker-style-c`})],ww.prototype,`markerStyleC`,void 0),E([d({type:String})],ww.prototype,`crossover`,void 0),E([d({type:String,attribute:`value-drag`})],ww.prototype,`valueDrag`,void 0),E([d({type:String,attribute:`value-c-follow`})],ww.prototype,`valueCFollow`,void 0),E([d({type:Number,attribute:`value-min`})],ww.prototype,`valueMin`,void 0),E([d({type:Boolean,reflect:!0})],ww.prototype,`disabled`,void 0),E([d({type:Boolean,reflect:!0})],ww.prototype,`swipeable`,void 0),ww=E([T(`ixfx-slider-input`)],ww);let Tw=class extends
|
|
9862
|
+
`]}};E([d({type:Number,attribute:`value-a`})],ww.prototype,`valueA`,void 0),E([d({type:Number,attribute:`value-b`})],ww.prototype,`valueB`,void 0),E([d({type:Number,attribute:`value-c`})],ww.prototype,`valueC`,void 0),E([d({type:Number})],ww.prototype,`min`,void 0),E([d({type:Number})],ww.prototype,`max`,void 0),E([d({type:Number})],ww.prototype,`step`,void 0),E([d({type:Number})],ww.prototype,`stops`,void 0),E([d({type:String,attribute:`value-mode`})],ww.prototype,`valueMode`,void 0),E([d({type:String,attribute:`single-style`})],ww.prototype,`singleStyle`,void 0),E([d({type:String})],ww.prototype,`orientation`,void 0),E([d({type:String,attribute:`marker-style`})],ww.prototype,`markerStyle`,void 0),E([d({type:String,attribute:`marker-style-c`})],ww.prototype,`markerStyleC`,void 0),E([d({type:String})],ww.prototype,`crossover`,void 0),E([d({type:String,attribute:`value-drag`})],ww.prototype,`valueDrag`,void 0),E([d({type:String,attribute:`value-c-follow`})],ww.prototype,`valueCFollow`,void 0),E([d({type:Number,attribute:`value-min`})],ww.prototype,`valueMin`,void 0),E([d({type:Boolean,reflect:!0})],ww.prototype,`disabled`,void 0),E([d({type:Boolean,reflect:!0})],ww.prototype,`swipeable`,void 0),ww=E([T(`ixfx-slider-input`)],ww);let Tw=class extends lg{constructor(...e){super(...e),this.inputSelector=`ixfx-slider-input`,this.orientation=`horizontal`,this.singleStyle=`range`,this.markerStyle=`needle`,this.stops=void 0,this.disabled=!1,this.swipeable=!1,this.lighttouch=!1,this.switchHeight=80}_renderEditableNumber(){return this._isMini?i``:i`
|
|
9857
9863
|
<ixfx-editable-number
|
|
9858
9864
|
class="number"
|
|
9859
9865
|
mode="label"
|
|
@@ -10061,7 +10067,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
10061
10067
|
:host([mode="pulse"]) div {
|
|
10062
10068
|
transition: none;
|
|
10063
10069
|
}
|
|
10064
|
-
`}};E([d({type:Number})],Ew.prototype,`value`,void 0),E([d({type:Boolean,attribute:`lit`,reflect:!0})],Ew.prototype,`lit`,void 0),E([d({type:String})],Ew.prototype,`color`,void 0),E([d({type:Boolean,attribute:`glow`,reflect:!0})],Ew.prototype,`glow`,void 0),E([d({type:String,reflect:!0})],Ew.prototype,`mode`,void 0),E([d({type:Boolean,attribute:`blinking`,reflect:!0})],Ew.prototype,`blinking`,void 0),E([d({type:Number,attribute:`rate`})],Ew.prototype,`rate`,void 0),E([d({type:Number,attribute:`attack-time`})],Ew.prototype,`attackTime`,void 0),E([d({type:Number,attribute:`release-time`})],Ew.prototype,`releaseTime`,void 0),E([d({type:Boolean,attribute:`pulse-retrigger`})],Ew.prototype,`pulseRetrigger`,void 0),Ew=E([T(`ixfx-led`)],Ew);let Dw=class extends n{constructor(...e){super(...e),this.headers=!1,this.stretchLastColumn=!1,this.interactionMode=`standard`,this.selectionFilter=`leaf`,this.exclusivity=`none`,this._columns=[],this._selectedByDepth=new Map,this._selectedKeys=new Set,this._selectedNodes=new Set,this.#n=new Map,this.#o=-1,this.#s=0,this.#c=0,this.search=new Vt(this,{adapter:Wt(this,{labelSelector:`.label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>{let e=[];for(let n=0;n<this._columns.length;n++){let r=this._columns[n];if(r)for(let i of r)e.push({id:this.#m(i,n)})}return e}}),this.#_=`user`,this.#v=!1,this.#Y=e=>{if(this.search.isOpen)return;let n=this.#U(),r=this._columns[n];if(!r||r.length===0){let e=this._columns[0];e&&e.length>0&&(this.tickled.setTickled(this.#m(e[0],0)),this.requestUpdate());return}switch(e.key){case`ArrowDown`:e.preventDefault(),this.#J(r,n,e,e=>Math.min(e+1,r.length-1));break;case`ArrowUp`:e.preventDefault(),this.#J(r,n,e,e=>Math.max(e-1,0));break;case`Home`:e.preventDefault(),this.#J(r,n,e,()=>0,!0);break;case`End`:e.preventDefault(),this.#J(r,n,e,()=>r.length-1,!0);break;case`PageUp`:e.preventDefault(),this.#J(r,n,e,e=>Math.max(e-this.#q(n),0),!0);break;case`PageDown`:e.preventDefault(),this.#J(r,n,e,e=>Math.min(e+this.#q(n),r.length-1),!0);break;case`ArrowRight`:{e.preventDefault();let i=this.#W();if(!i){r.length>0&&(this.#K(r[0],n),this.requestUpdate());return}let{node:a,depth:o}=i;if(this.interactionMode===`vscode`||this.interactionMode===`standard`?(this._selectedByDepth.set(o,a),this.#R(a,o)):this.#F(a,o),this._columns.length>o+1){let e=this._columns[o+1];e&&e.length>0&&this.#K(e[0],o+1)}this.requestUpdate();break}case`ArrowLeft`:if(e.preventDefault(),n>0){this.#M(),this._columns=this._columns.slice(0,n);let e=this._columns[n-1];if(e&&e.length>0){let r=this._selectedByDepth.get(n-1),i=r&&e.includes(r)?r:e[0];this.#K(i,n-1)}this.requestUpdate()}break;case`Enter`:{e.preventDefault();let n=this.#W();if(!n)return;let{node:i,depth:a,index:o}=n;if(this.interactionMode===`standard`||this.interactionMode===`vscode`){if(e.shiftKey&&this.#t?.depth===a){let e=Math.min(this.#t.index,o),n=Math.max(this.#t.index,o);this._selectedKeys=new Set(r.slice(e,n+1).map(e=>e.item.key))}else this._selectedKeys.add(i.item.key),this.#t={key:i.item.key,depth:a,index:o}}else this._selectedByDepth.set(a,i);this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:i,depth:a},bubbles:!0,composed:!0})),this.requestUpdate();break}case`Escape`:if(e.preventDefault(),this.#M(),this._columns.length>1){this._columns=this._columns.slice(0,-1);let e=Math.max(0,n-1),r=this._columns[e];if(r&&r.length>0){let n=this._selectedByDepth.get(e),i=n&&r.includes(n)?n:r[0];this.#K(i,e)}this.requestUpdate()}}},this.#X=(e,n)=>{e.preventDefault(),e.stopPropagation(),this.#o=n,this.#s=e.clientX;let r=this.shadowRoot?.querySelectorAll(`.column`)[n];this.#c=r?r.getBoundingClientRect().width:200,window.addEventListener(`pointermove`,this.#$),window.addEventListener(`pointerup`,this.#te)},this.#Z=null,this.#Q=0,this.#$=e=>{this.#o<0||(this.#Q=Math.max(32,this.#c+(e.clientX-this.#s)),this.#Z??=requestAnimationFrame(this.#ee))},this.#ee=()=>{this.#Z=null,!(this.#o<0)&&(this.shadowRoot?.querySelectorAll(`.column`)[this.#o])?.setAttribute(`style`,this.#re(this.#Q))},this.#te=()=>{this.#Z!==null&&(cancelAnimationFrame(this.#Z),this.#Z=null),this.#o>=0&&this.#Q>0&&(this.#n.set(this.#o,this.#Q),this.requestUpdate()),this.#Q=0,this.#o=-1,window.removeEventListener(`pointermove`,this.#$),window.removeEventListener(`pointerup`,this.#te)}}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;get registry(){return this.#u}#f(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#p(){this.#u&&(this.search.setModes(this.#f()),this.#d?.(),this.#d=Rt(this.#u,this.search))}#m(e,n){return`${n}:${e.item.key}`}get#h(){return this.viewRoot??this.root}#g(){let e=this.tickled.tickledId;if(!e)return;let n=e.indexOf(`:`);if(!(n<0))return Number(e.substring(0,n))}updated(e){if(e.has(`searchModes`)&&this.#p(),e.has(`root`)&&this.root){this.#M(),this.viewRoot!==void 0&&(this.viewRoot=void 0),this._selectedByDepth.clear(),this._selectedKeys=new Set,this._selectedNodes.clear(),this.#e=void 0,this.#t=void 0,this.tickled.clearTickled();let e=this.#h;this._columns=e?.children?[e.children]:[]}if(e.has(`viewRoot`)&&this.#x(),e.has(`model`)){this.#l?.(),this.#l=void 0;let e=this.model;e&&(this.root=e.root,this.#l=e._subscribe(e=>{if(e.type===`root`)this.root=e.root,this.requestUpdate();else if(e.type===`invalidate`){for(let n=0;n<this._columns.length-1;n++)if(this._columns[n]?.some(n=>n.item.key===e.key)){this._columns=this._columns.slice(0,n+1),this.requestUpdate();break}}}))}if(this.#r?.children!==void 0&&this._loadingDepth!==void 0){let e=this._loadingDepth,n=this.#r.children;this.#r=void 0,this.#i=void 0,this._loadingDepth=void 0;let r=this._columns.slice(0,e);n.length>0&&r.push(n),this._columns=r}let n=e.get(`_columns`),r=e.has(`_columns`)&&(n?.length??0)<this._columns.length,i=e.has(`_loadingDepth`)&&this._loadingDepth!==void 0;if(r||i){let e=this.shadowRoot?.querySelector(`#container`);e?.scrollTo({left:e.scrollWidth,behavior:`smooth`})}}connectedCallback(){super.connectedCallback(),this.#u??=Yt(),this.#p()}disconnectedCallback(){super.disconnectedCallback(),this.#l?.(),this.#l=void 0,this.#d?.(),this.#d=void 0,this.#u=void 0}getConfig(){let e={};for(let[n,r]of this.#n)e[n]=r;return{columnWidths:e}}setConfig(e){this.#n.clear();for(let[n,r]of Object.entries(e.columnWidths))this.#n.set(Number(n),r);this.requestUpdate()}get selectedKeys(){return this._selectedKeys}set selectedKeys(e){this._selectedKeys=new Set(e),this.requestUpdate()}get selectedNode(){return this.#e}set selectedNode(e){this.#e=e,e&&(this.interactionMode===`implicit`||this.interactionMode===`standard`)&&(this._selectedKeys=new Set([e.item.key])),this.requestUpdate()}get selectedNodes(){return this._selectedNodes}select(e){if(!this.#A(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.add(e),this._selectedKeys.add(e.item.key),this.#e=e,this.#j(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this._selectedKeys.delete(e.item.key),this.#e===e&&(this.#e=[...this._selectedNodes].at(-1)),this.#j(n),this.requestUpdate()}clearSelection(){let e=new Set(this._selectedNodes);this._selectedKeys=new Set,this._selectedNodes.clear(),this.#e=void 0,e.size>0&&this.#j(e),this.requestUpdate()}selectAll(){}deselectAll(){}setSelected(e,n){this.interactionMode===`checked`?this.#H(e,n):n?(this._selectedKeys.add(e.item.key),this._selectedNodes.add(e)):(this._selectedKeys.delete(e.item.key),this._selectedNodes.delete(e)),this.requestUpdate()}getSelected(){let e=[];for(let n of this._columns)for(let r of n)this._selectedKeys.has(r.item.key)&&e.push(r);return e}navigateTo(e,n={}){let r=this.#h;if(!r?.children)return!1;let i=this.#_,a=this.#v;this.#_=`programmatic`,this.#v=n.silent===!0;try{return this.#y(r.children,e,n.reveal??`edge`)}finally{this.#_=i,this.#v=a}}invalidateStructure(){let e=new Set;for(let n of this._columns)for(let r of n)e.add(r);for(let e=0;e<this._columns.length;e++){let n=this._selectedByDepth.get(e);if(n&&!this._columns[e].includes(n)){this._columns=this._columns.slice(0,e+1);for(let n of[...this._selectedByDepth.keys()])n>=e&&this._selectedByDepth.delete(n);break}}for(let n of[...this._selectedNodes])e.has(n)||this._selectedNodes.delete(n);this.requestUpdate()}#_;#v;#y(e,n,r){this.#M(),this._selectedByDepth.clear(),this.tickled.clearTickled();let i=[e],a=e,o=!0,s,c=0;for(let e=0;e<n.length;e++){let r=a.findIndex(r=>r.item.key===n[e]);if(r<0){o=!1;break}let l=a[r];if(this._selectedByDepth.set(e,l),s=l,c=e,l.item.isLeaf||!l.children||l.children.length===0){e<n.length-1&&(o=!1);break}i.push(l.children),a=l.children}if(this._columns=i,s&&this.tickled.setTickled(this.#m(s,c)),this.interactionMode!==`implicit`&&this.interactionMode!==`manual`){let e=n.at(-1);e&&(this._selectedKeys=new Set([e]))}return this.requestUpdate(),this.#G(r===`center-if-hidden`?`auto`:`smooth`,r),o}navigateToNode(e){let n=this.#h;if(!n?.children)return!1;let r=this.#b(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=this.#h;if(!n?.children)return!1;let r=this.#b(n.children,n=>n.item.key===e);if(!r)return!1;let i=[n.children],a=n.children,o,s=0;for(let e=0;e<r.length;e++){let n=a.find(n=>n.item.key===r[e]);if(!n)return!1;if(o=n,s=e,n.children&&n.children.length>0)i.push(n.children),a=n.children;else break}return this._columns=i,o&&this.tickled.setTickled(this.#m(o,s)),this.requestUpdate(),this.#G(),!0}selectMany(e){let n=this.selectionFilter===`none`?[]:[...e],r=new Set(this._selectedNodes);this._selectedNodes=new Set(n),this._selectedKeys=new Set(n.map(e=>e.item.key)),this.#e=n.at(-1),this.#j(r),this.requestUpdate()}getNodes(){let e=this.#h;if(!e?.children)return[];let n=[],r=(e,i)=>{if(n.push({node:e,depth:i}),e.children)for(let n of e.children)r(n,i+1)};for(let n of e.children)r(n,0);return n}#b(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#b(i.children,n,e);if(r)return r}}}#x(){this.#M();let e=new Set(this._selectedNodes);this._selectedByDepth.clear(),this._selectedKeys=new Set,this._selectedNodes.clear(),this.#e=void 0,this.#t=void 0,this.tickled.clearTickled();let n=this.#h;n?.children===void 0?n?(this._columns=[],this.#z(n,-1,!1)):(this._columns=[],this._loadingDepth=void 0):(this._columns=n.children?[n.children]:[],this._loadingDepth=void 0),e.size>0&&this.#j(e)}rebaseTo(e){if(e===void 0)return this.#S();let n=typeof e==`string`?this.#w(e):e;return!n||n.item.isLeaf===!0||n===this.viewRoot||n.item.key===this.viewRoot?.item.key?!1:n===this.root||!this.viewRoot&&n.item.key===this.root?.item.key?this.#S():(this.viewRoot=n,this.#C(),!0)}rebaseUp(){if(!this.viewRoot)return!1;let e=this.#E(this.viewRoot);return e?e===this.root?this.#S():(this.viewRoot=e,this.#C(),!0):!1}#S(){return this.viewRoot!==void 0&&(this.viewRoot=void 0,this.#C(),!0)}#C(){let e=this.viewRoot,n={viewRoot:e,path:e?this.#O(e):[]};this.dispatchEvent(new CustomEvent(`rebase`,{detail:n,bubbles:!0,composed:!0}))}#w(e){if(this.root)return this.root.item.key===e?this.root:this.#T(this.root.children??[],e)}#T(e,n){for(let r of e){if(r.item.key===n)return r;if(r.children){let e=this.#T(r.children,n);if(e)return e}}}#E(e){if(!(!this.root||e===this.root))return this.#D(this.root,e)}#D(e,n){if(e.children)for(let r of e.children){if(r===n||r.item.key===n.item.key)return e;let i=this.#D(r,n);if(i)return i}}#O(e){let n=[e],r=this.#E(e);for(;r&&(n.unshift(r),r!==this.root);)r=this.#E(r);return n}renderColumnContent(e,n){return console.warn(`ixfx-miller-base: renderColumnContent not overridden. depth=${n}, nodes=${e.length}`),a}_handleItemClick(e,n,r){this.#F(e,n,r)}_handleCheckboxClick(e,n,r){e.stopPropagation(),this.#B(n)}_handleItemDblClick(e,n,r){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}_handleItemRightClick(e,n,r){this.dispatchEvent(new CustomEvent(`item-rightclick`,{detail:{node:e,depth:n,mouseEvent:r},bubbles:!0,composed:!0}))}_handleHeaderRightClick(e,n){let r=this.#ne(n),i=this.#N(n);this.dispatchEvent(new CustomEvent(`header-rightclick`,{detail:{depth:n,label:r,path:i,mouseEvent:e},bubbles:!0,composed:!0}))}_isSelected(e,n){return this.interactionMode===`implicit`?this._selectedByDepth.get(n)===e:this._selectedKeys.has(e.item.key)}#k(e,n){let r=this._columns[n+1];return r!==void 0&&e.children===r}_isOpen(e,n){return this.#k(e,n)}getItemState(e,n){let r=this._columns[n]?.find(n=>n.item.key===e);if(r)return{selected:this._isSelected(r,n),open:this.#k(r,n),focused:this._isFocused(r,n),isLeaf:r.item.isLeaf??!1}}#A(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf!==!1:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#j(e){if(this.#v)return;let n={selected:new Set(this._selectedNodes),previous:e,origin:this.#_};this.dispatchEvent(new CustomEvent(`select`,{detail:n,bubbles:!0,composed:!0}))}#M(){if(this.#a!==void 0&&(clearTimeout(this.#a),this.#a=void 0),this.#i){let e=this.#r,n=this._loadingDepth;this.#i.abort(),this.#i=void 0,this.#r=void 0,this._loadingDepth=void 0,e&&n!==void 0&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}}#N(e){let n=[];this.#h&&n.push(this.#h);for(let r=0;r<e;r++){let e=this._selectedByDepth.get(r);e&&n.push(e)}return n}#P(e){let n={depth:e,label:this.#ne(e),path:this.#N(e)};this.dispatchEvent(new CustomEvent(`header-click`,{detail:n,bubbles:!0,composed:!0}))}#F(e,n,r){switch(this._loadingDepth!==void 0&&this._loadingDepth>n&&this.#M(),this.tickled.setTickled(this.#m(e,n)),this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e,depth:n},bubbles:!0,composed:!0})),this.interactionMode){case`implicit`:this.#I(e,n);break;case`standard`:this.#L(e,n,r);break;case`vscode`:this.#L(e,n,r);break;case`manual`:break;case`checked`:this.#R(e,n,!0)}}#I(e,n){let r=new Set(this._selectedNodes);this._selectedByDepth.set(n,e),this.#e=e,this._selectedKeys=new Set([e.item.key]),this._selectedNodes.clear(),this._selectedNodes.add(e),this.#R(e,n,!0),r.has(e)||this.#j(r)}#L(e,n,r){let i=this._columns[n],a=i?i.indexOf(e):-1,o=r?r.metaKey||r.ctrlKey:!1,s=r?r.shiftKey:!1;if(o){this._selectedKeys.has(e.item.key)?(this._selectedKeys.delete(e.item.key),this._selectedNodes.delete(e)):(this._selectedKeys.add(e.item.key),this._selectedNodes.add(e)),this.#t=a>=0?{key:e.item.key,depth:n,index:a}:this.#t,this.requestUpdate();return}if(s&&this.#t&&this.#t.depth===n&&i){let e=Math.min(this.#t.index,a),n=Math.max(this.#t.index,a),r=i.slice(e,n+1);this._selectedKeys=new Set(r.map(e=>e.item.key)),this._selectedNodes=new Set(r),this.requestUpdate();return}let c=new Set(this._selectedNodes);this._selectedKeys=new Set([e.item.key]),this._selectedNodes=new Set([e]),this.#t=a>=0?{key:e.item.key,depth:n,index:a}:void 0,this._selectedByDepth.set(n,e),this.#e=e,this.#R(e,n,!0),(!c.has(e)||c.size!==1)&&this.#j(c)}#R(e,n,r=!1){if(e.item.isLeaf){this._columns=this._columns.slice(0,n+1),this.requestUpdate();return}if(e.children===void 0)this.#z(e,n,!0,r);else{let r=this._columns.slice(0,n+1);r.push(e.children),this._columns=r,this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}}#z(e,n,r,i=!1){let a=n+1;this._columns=this._columns.slice(0,a),this._loadingDepth=a,this.#i?.abort(),this.#r=e;let o=new AbortController;this.#i=o,r&&this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}));let s=n=>{if(o.signal.aborted)return;e.children=n,this.#r=void 0,this.#i=void 0,this._loadingDepth=void 0;let r=this._columns.slice(0,a);n.length>0&&r.push(n),this._columns=r},c=n=>{n.name!==`AbortError`&&console.error(n),e.children=[],this.#r=void 0,this.#i=void 0,this._loadingDepth=void 0,this.requestUpdate()};if(this.model||this.loadChildren){this.#a!==void 0&&(clearTimeout(this.#a),this.#a=void 0);let n=()=>{this.#a=void 0,this.#r===e&&(this.model?this.model.getChildren(e,a-1,o.signal):gg(this.loadChildren({node:e,depth:a-1},o.signal),o.signal)).then(e=>s([...e])).catch(c)};i?n():this.#a=setTimeout(n,150)}else{this._loadingDepth=void 0,this.#r=void 0,this.#i=void 0;let e=this._columns.slice(0,a);e.push([]),this._columns=e}}#B(e){let n=new Set(this._selectedNodes),r=this._selectedKeys.has(e.item.key);(e.children?.length?this.#V(e):r)?this.#H(e,!1):this.#H(e,!0),this.requestUpdate(),this.#j(n)}#V(e){return this._selectedKeys.has(e.item.key)?!e.children?.length||e.children.every(e=>this.#V(e)):!1}#H(e,n){if(n?(this._selectedKeys.add(e.item.key),this._selectedNodes.add(e)):(this._selectedKeys.delete(e.item.key),this._selectedNodes.delete(e)),e.children)for(let r of e.children)this.#H(r,n)}#U(){return this.#g()??0}#W(){let e=this.tickled.tickledId;if(!e)return;let n=e.indexOf(`:`);if(n<0)return;let r=Number(e.substring(0,n)),i=e.substring(n+1),a=this._columns[r];if(!a)return;let o=a.findIndex(e=>e.item.key===i);if(!(o<0))return{node:a[o],depth:r,index:o}}#G(e=`smooth`,n=`edge`){requestAnimationFrame(()=>{let r=this.#W();if(!r)return;let i=this.shadowRoot?.querySelectorAll(`.column`)[r.depth]?.querySelector(`.column-content`);if(!i)return;let a=i.querySelectorAll(`.item`)[r.index];if(a){if(n===`center-if-hidden`){let n=a.getBoundingClientRect(),r=i.getBoundingClientRect(),o=n.top<r.top||n.bottom>r.bottom;a.scrollIntoView({block:o?`center`:`nearest`,inline:`nearest`,behavior:e});return}a.scrollIntoView({block:`nearest`,behavior:e})}})}#K(e,n){this.tickled.setTickled(this.#m(e,n)),this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}#q(e){let n=this.shadowRoot?.querySelectorAll(`.column`)[e]?.querySelector(`.column-content`),r=n?.querySelector(`.item`);return!n||!r||r.offsetHeight===0?10:Math.max(1,Math.floor(n.clientHeight/r.offsetHeight)-1)}#J(e,n,r,i,a=!1){let o=this.#W(),s=i(o!==void 0&&o.depth===n?o.index:-1),c=e[s];if(c){if(this.#K(c,n),this.interactionMode===`standard`||this.interactionMode===`vscode`){let i=o?.index??0;if(r.shiftKey){if(!this.#t||this.#t.depth!==n){let r=e[i];r&&(this.#t={key:r.item.key,depth:n,index:i,selectionSnapshot:this.interactionMode===`vscode`?new Set(this._selectedKeys):void 0})}if(this.#t){let n=Math.min(this.#t.index,s),r=Math.max(this.#t.index,s),i=e.slice(n,r+1).map(e=>e.item.key);if(this.interactionMode===`vscode`){let e=this.#t.selectionSnapshot;for(let n of i)e.has(n)?this._selectedKeys.delete(n):this._selectedKeys.add(n)}else this._selectedKeys=new Set(i)}}else this.#t=this.interactionMode===`standard`?{key:c.item.key,depth:n,index:s}:void 0}this.requestUpdate(),a&&this.#G(`auto`)}}#Y;#X;#Z;#Q;#$;#ee;#te;#ne(e){if(e===0)return this.#h?.item.label??``;let n=this._selectedByDepth.get(e-1);if(n)return n.item.label;let r=this._columns[e-1],i=this._columns[e];if(r&&i){let e=r.find(e=>e.children===i);if(e)return e.item.label}return``}#re(e){return`width:${e}px;flex-grow:0;flex-shrink:0;flex-basis:auto;max-width:none`}#ie(e,n){let r=this.#n.get(e);return r===void 0?this.stretchLastColumn&&n?`width:max-content;flex-grow:1;flex-shrink:0;flex-basis:auto;min-width:0`:`width:max-content;flex-grow:0;flex-shrink:0;flex-basis:auto`:this.#re(r)}#ae(e,n){return this.tickled.isTickled(this.#m(e,n))}renderLoadingIndicator(){return i`<div class="loading-spinner"></div>`}#oe(){let e=this._loadingDepth,n=this.stretchLastColumn&&this.#n.get(e)===void 0;return i`
|
|
10070
|
+
`}};E([d({type:Number})],Ew.prototype,`value`,void 0),E([d({type:Boolean,attribute:`lit`,reflect:!0})],Ew.prototype,`lit`,void 0),E([d({type:String})],Ew.prototype,`color`,void 0),E([d({type:Boolean,attribute:`glow`,reflect:!0})],Ew.prototype,`glow`,void 0),E([d({type:String,reflect:!0})],Ew.prototype,`mode`,void 0),E([d({type:Boolean,attribute:`blinking`,reflect:!0})],Ew.prototype,`blinking`,void 0),E([d({type:Number,attribute:`rate`})],Ew.prototype,`rate`,void 0),E([d({type:Number,attribute:`attack-time`})],Ew.prototype,`attackTime`,void 0),E([d({type:Number,attribute:`release-time`})],Ew.prototype,`releaseTime`,void 0),E([d({type:Boolean,attribute:`pulse-retrigger`})],Ew.prototype,`pulseRetrigger`,void 0),Ew=E([T(`ixfx-led`)],Ew);let Dw=class extends n{constructor(...e){super(...e),this.headers=!1,this.stretchLastColumn=!1,this.interactionMode=`standard`,this.selectionFilter=`leaf`,this.exclusivity=`none`,this._columns=[],this._selectedByDepth=new Map,this._selectedKeys=new Set,this._selectedNodes=new Set,this.#n=new Map,this.#o=-1,this.#s=0,this.#c=0,this.search=new Bt(this,{adapter:Ut(this,{labelSelector:`.label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>{let e=[];for(let n=0;n<this._columns.length;n++){let r=this._columns[n];if(r)for(let i of r)e.push({id:this.#m(i,n)})}return e}}),this.#_=`user`,this.#v=!1,this.#Y=e=>{if(this.search.isOpen)return;let n=this.#U(),r=this._columns[n];if(!r||r.length===0){let e=this._columns[0];e&&e.length>0&&(this.tickled.setTickled(this.#m(e[0],0)),this.requestUpdate());return}switch(e.key){case`ArrowDown`:e.preventDefault(),this.#J(r,n,e,e=>Math.min(e+1,r.length-1));break;case`ArrowUp`:e.preventDefault(),this.#J(r,n,e,e=>Math.max(e-1,0));break;case`Home`:e.preventDefault(),this.#J(r,n,e,()=>0,!0);break;case`End`:e.preventDefault(),this.#J(r,n,e,()=>r.length-1,!0);break;case`PageUp`:e.preventDefault(),this.#J(r,n,e,e=>Math.max(e-this.#q(n),0),!0);break;case`PageDown`:e.preventDefault(),this.#J(r,n,e,e=>Math.min(e+this.#q(n),r.length-1),!0);break;case`ArrowRight`:{e.preventDefault();let i=this.#W();if(!i){r.length>0&&(this.#K(r[0],n),this.requestUpdate());return}let{node:a,depth:o}=i;if(this.interactionMode===`vscode`||this.interactionMode===`standard`?(this._selectedByDepth.set(o,a),this.#R(a,o)):this.#F(a,o),this._columns.length>o+1){let e=this._columns[o+1];e&&e.length>0&&this.#K(e[0],o+1)}this.requestUpdate();break}case`ArrowLeft`:if(e.preventDefault(),n>0){this.#M(),this._columns=this._columns.slice(0,n);let e=this._columns[n-1];if(e&&e.length>0){let r=this._selectedByDepth.get(n-1),i=r&&e.includes(r)?r:e[0];this.#K(i,n-1)}this.requestUpdate()}break;case`Enter`:{e.preventDefault();let n=this.#W();if(!n)return;let{node:i,depth:a,index:o}=n;if(this.interactionMode===`standard`||this.interactionMode===`vscode`){if(e.shiftKey&&this.#t?.depth===a){let e=Math.min(this.#t.index,o),n=Math.max(this.#t.index,o);this._selectedKeys=new Set(r.slice(e,n+1).map(e=>e.item.key))}else this._selectedKeys.add(i.item.key),this.#t={key:i.item.key,depth:a,index:o}}else this._selectedByDepth.set(a,i);this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:i,depth:a},bubbles:!0,composed:!0})),this.requestUpdate();break}case`Escape`:if(e.preventDefault(),this.#M(),this._columns.length>1){this._columns=this._columns.slice(0,-1);let e=Math.max(0,n-1),r=this._columns[e];if(r&&r.length>0){let n=this._selectedByDepth.get(e),i=n&&r.includes(n)?n:r[0];this.#K(i,e)}this.requestUpdate()}}},this.#X=(e,n)=>{e.preventDefault(),e.stopPropagation(),this.#o=n,this.#s=e.clientX;let r=this.shadowRoot?.querySelectorAll(`.column`)[n];this.#c=r?r.getBoundingClientRect().width:200,window.addEventListener(`pointermove`,this.#$),window.addEventListener(`pointerup`,this.#te)},this.#Z=null,this.#Q=0,this.#$=e=>{this.#o<0||(this.#Q=Math.max(32,this.#c+(e.clientX-this.#s)),this.#Z??=requestAnimationFrame(this.#ee))},this.#ee=()=>{this.#Z=null,!(this.#o<0)&&(this.shadowRoot?.querySelectorAll(`.column`)[this.#o])?.setAttribute(`style`,this.#re(this.#Q))},this.#te=()=>{this.#Z!==null&&(cancelAnimationFrame(this.#Z),this.#Z=null),this.#o>=0&&this.#Q>0&&(this.#n.set(this.#o,this.#Q),this.requestUpdate()),this.#Q=0,this.#o=-1,window.removeEventListener(`pointermove`,this.#$),window.removeEventListener(`pointerup`,this.#te)}}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;get registry(){return this.#u}#f(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#p(){this.#u&&(this.search.setModes(this.#f()),this.#d?.(),this.#d=Rt(this.#u,this.search))}#m(e,n){return`${n}:${e.item.key}`}get#h(){return this.viewRoot??this.root}#g(){let e=this.tickled.tickledId;if(!e)return;let n=e.indexOf(`:`);if(!(n<0))return Number(e.substring(0,n))}updated(e){if(e.has(`searchModes`)&&this.#p(),e.has(`root`)&&this.root){this.#M(),this.viewRoot!==void 0&&(this.viewRoot=void 0),this._selectedByDepth.clear(),this._selectedKeys=new Set,this._selectedNodes.clear(),this.#e=void 0,this.#t=void 0,this.tickled.clearTickled();let e=this.#h;this._columns=e?.children?[e.children]:[]}if(e.has(`viewRoot`)&&this.#x(),e.has(`model`)){this.#l?.(),this.#l=void 0;let e=this.model;e&&(this.root=e.root,this.#l=e._subscribe(e=>{if(e.type===`root`)this.root=e.root,this.requestUpdate();else if(e.type===`invalidate`){for(let n=0;n<this._columns.length-1;n++)if(this._columns[n]?.some(n=>n.item.key===e.key)){this._columns=this._columns.slice(0,n+1),this.requestUpdate();break}}}))}if(this.#r?.children!==void 0&&this._loadingDepth!==void 0){let e=this._loadingDepth,n=this.#r.children;this.#r=void 0,this.#i=void 0,this._loadingDepth=void 0;let r=this._columns.slice(0,e);n.length>0&&r.push(n),this._columns=r}let n=e.get(`_columns`),r=e.has(`_columns`)&&(n?.length??0)<this._columns.length,i=e.has(`_loadingDepth`)&&this._loadingDepth!==void 0;if(r||i){let e=this.shadowRoot?.querySelector(`#container`);e?.scrollTo({left:e.scrollWidth,behavior:`smooth`})}}connectedCallback(){super.connectedCallback(),this.#u??=Jt(),this.#p()}disconnectedCallback(){super.disconnectedCallback(),this.#l?.(),this.#l=void 0,this.#d?.(),this.#d=void 0,this.#u=void 0}getConfig(){let e={};for(let[n,r]of this.#n)e[n]=r;return{columnWidths:e}}setConfig(e){this.#n.clear();for(let[n,r]of Object.entries(e.columnWidths))this.#n.set(Number(n),r);this.requestUpdate()}get selectedKeys(){return this._selectedKeys}set selectedKeys(e){this._selectedKeys=new Set(e),this.requestUpdate()}get selectedNode(){return this.#e}set selectedNode(e){this.#e=e,e&&(this.interactionMode===`implicit`||this.interactionMode===`standard`)&&(this._selectedKeys=new Set([e.item.key])),this.requestUpdate()}get selectedNodes(){return this._selectedNodes}select(e){if(!this.#A(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.add(e),this._selectedKeys.add(e.item.key),this.#e=e,this.#j(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this._selectedKeys.delete(e.item.key),this.#e===e&&(this.#e=[...this._selectedNodes].at(-1)),this.#j(n),this.requestUpdate()}clearSelection(){let e=new Set(this._selectedNodes);this._selectedKeys=new Set,this._selectedNodes.clear(),this.#e=void 0,e.size>0&&this.#j(e),this.requestUpdate()}selectAll(){}deselectAll(){}setSelected(e,n){this.interactionMode===`checked`?this.#H(e,n):n?(this._selectedKeys.add(e.item.key),this._selectedNodes.add(e)):(this._selectedKeys.delete(e.item.key),this._selectedNodes.delete(e)),this.requestUpdate()}getSelected(){let e=[];for(let n of this._columns)for(let r of n)this._selectedKeys.has(r.item.key)&&e.push(r);return e}navigateTo(e,n={}){let r=this.#h;if(!r?.children)return!1;let i=this.#_,a=this.#v;this.#_=`programmatic`,this.#v=n.silent===!0;try{return this.#y(r.children,e,n.reveal??`edge`)}finally{this.#_=i,this.#v=a}}invalidateStructure(){let e=new Set;for(let n of this._columns)for(let r of n)e.add(r);for(let e=0;e<this._columns.length;e++){let n=this._selectedByDepth.get(e);if(n&&!this._columns[e].includes(n)){this._columns=this._columns.slice(0,e+1);for(let n of[...this._selectedByDepth.keys()])n>=e&&this._selectedByDepth.delete(n);break}}for(let n of[...this._selectedNodes])e.has(n)||this._selectedNodes.delete(n);this.requestUpdate()}#_;#v;#y(e,n,r){this.#M(),this._selectedByDepth.clear(),this.tickled.clearTickled();let i=[e],a=e,o=!0,s,c=0;for(let e=0;e<n.length;e++){let r=a.findIndex(r=>r.item.key===n[e]);if(r<0){o=!1;break}let l=a[r];if(this._selectedByDepth.set(e,l),s=l,c=e,l.item.isLeaf||!l.children||l.children.length===0){e<n.length-1&&(o=!1);break}i.push(l.children),a=l.children}if(this._columns=i,s&&this.tickled.setTickled(this.#m(s,c)),this.interactionMode!==`implicit`&&this.interactionMode!==`manual`){let e=n.at(-1);e&&(this._selectedKeys=new Set([e]))}return this.requestUpdate(),this.#G(r===`center-if-hidden`?`auto`:`smooth`,r),o}navigateToNode(e){let n=this.#h;if(!n?.children)return!1;let r=this.#b(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=this.#h;if(!n?.children)return!1;let r=this.#b(n.children,n=>n.item.key===e);if(!r)return!1;let i=[n.children],a=n.children,o,s=0;for(let e=0;e<r.length;e++){let n=a.find(n=>n.item.key===r[e]);if(!n)return!1;if(o=n,s=e,n.children&&n.children.length>0)i.push(n.children),a=n.children;else break}return this._columns=i,o&&this.tickled.setTickled(this.#m(o,s)),this.requestUpdate(),this.#G(),!0}selectMany(e){let n=this.selectionFilter===`none`?[]:[...e],r=new Set(this._selectedNodes);this._selectedNodes=new Set(n),this._selectedKeys=new Set(n.map(e=>e.item.key)),this.#e=n.at(-1),this.#j(r),this.requestUpdate()}getNodes(){let e=this.#h;if(!e?.children)return[];let n=[],r=(e,i)=>{if(n.push({node:e,depth:i}),e.children)for(let n of e.children)r(n,i+1)};for(let n of e.children)r(n,0);return n}#b(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#b(i.children,n,e);if(r)return r}}}#x(){this.#M();let e=new Set(this._selectedNodes);this._selectedByDepth.clear(),this._selectedKeys=new Set,this._selectedNodes.clear(),this.#e=void 0,this.#t=void 0,this.tickled.clearTickled();let n=this.#h;n?.children===void 0?n?(this._columns=[],this.#z(n,-1,!1)):(this._columns=[],this._loadingDepth=void 0):(this._columns=n.children?[n.children]:[],this._loadingDepth=void 0),e.size>0&&this.#j(e)}rebaseTo(e){if(e===void 0)return this.#S();let n=typeof e==`string`?this.#w(e):e;return!n||n.item.isLeaf===!0||n===this.viewRoot||n.item.key===this.viewRoot?.item.key?!1:n===this.root||!this.viewRoot&&n.item.key===this.root?.item.key?this.#S():(this.viewRoot=n,this.#C(),!0)}rebaseUp(){if(!this.viewRoot)return!1;let e=this.#E(this.viewRoot);return e?e===this.root?this.#S():(this.viewRoot=e,this.#C(),!0):!1}#S(){return this.viewRoot!==void 0&&(this.viewRoot=void 0,this.#C(),!0)}#C(){let e=this.viewRoot,n={viewRoot:e,path:e?this.#O(e):[]};this.dispatchEvent(new CustomEvent(`rebase`,{detail:n,bubbles:!0,composed:!0}))}#w(e){if(this.root)return this.root.item.key===e?this.root:this.#T(this.root.children??[],e)}#T(e,n){for(let r of e){if(r.item.key===n)return r;if(r.children){let e=this.#T(r.children,n);if(e)return e}}}#E(e){if(!(!this.root||e===this.root))return this.#D(this.root,e)}#D(e,n){if(e.children)for(let r of e.children){if(r===n||r.item.key===n.item.key)return e;let i=this.#D(r,n);if(i)return i}}#O(e){let n=[e],r=this.#E(e);for(;r&&(n.unshift(r),r!==this.root);)r=this.#E(r);return n}renderColumnContent(e,n){return console.warn(`ixfx-miller-base: renderColumnContent not overridden. depth=${n}, nodes=${e.length}`),a}_handleItemClick(e,n,r){this.#F(e,n,r)}_handleCheckboxClick(e,n,r){e.stopPropagation(),this.#B(n)}_handleItemDblClick(e,n,r){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}_handleItemRightClick(e,n,r){this.dispatchEvent(new CustomEvent(`item-rightclick`,{detail:{node:e,depth:n,mouseEvent:r},bubbles:!0,composed:!0}))}_handleHeaderRightClick(e,n){let r=this.#ne(n),i=this.#N(n);this.dispatchEvent(new CustomEvent(`header-rightclick`,{detail:{depth:n,label:r,path:i,mouseEvent:e},bubbles:!0,composed:!0}))}_isSelected(e,n){return this.interactionMode===`implicit`?this._selectedByDepth.get(n)===e:this._selectedKeys.has(e.item.key)}#k(e,n){let r=this._columns[n+1];return r!==void 0&&e.children===r}_isOpen(e,n){return this.#k(e,n)}getItemState(e,n){let r=this._columns[n]?.find(n=>n.item.key===e);if(r)return{selected:this._isSelected(r,n),open:this.#k(r,n),focused:this._isFocused(r,n),isLeaf:r.item.isLeaf??!1}}#A(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf!==!1:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#j(e){if(this.#v)return;let n={selected:new Set(this._selectedNodes),previous:e,origin:this.#_};this.dispatchEvent(new CustomEvent(`select`,{detail:n,bubbles:!0,composed:!0}))}#M(){if(this.#a!==void 0&&(clearTimeout(this.#a),this.#a=void 0),this.#i){let e=this.#r,n=this._loadingDepth;this.#i.abort(),this.#i=void 0,this.#r=void 0,this._loadingDepth=void 0,e&&n!==void 0&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}}#N(e){let n=[];this.#h&&n.push(this.#h);for(let r=0;r<e;r++){let e=this._selectedByDepth.get(r);e&&n.push(e)}return n}#P(e){let n={depth:e,label:this.#ne(e),path:this.#N(e)};this.dispatchEvent(new CustomEvent(`header-click`,{detail:n,bubbles:!0,composed:!0}))}#F(e,n,r){switch(this._loadingDepth!==void 0&&this._loadingDepth>n&&this.#M(),this.tickled.setTickled(this.#m(e,n)),this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e,depth:n},bubbles:!0,composed:!0})),this.interactionMode){case`implicit`:this.#I(e,n);break;case`standard`:this.#L(e,n,r);break;case`vscode`:this.#L(e,n,r);break;case`manual`:break;case`checked`:this.#R(e,n,!0)}}#I(e,n){let r=new Set(this._selectedNodes);this._selectedByDepth.set(n,e),this.#e=e,this._selectedKeys=new Set([e.item.key]),this._selectedNodes.clear(),this._selectedNodes.add(e),this.#R(e,n,!0),r.has(e)||this.#j(r)}#L(e,n,r){let i=this._columns[n],a=i?i.indexOf(e):-1,o=r?r.metaKey||r.ctrlKey:!1,s=r?r.shiftKey:!1;if(o){this._selectedKeys.has(e.item.key)?(this._selectedKeys.delete(e.item.key),this._selectedNodes.delete(e)):(this._selectedKeys.add(e.item.key),this._selectedNodes.add(e)),this.#t=a>=0?{key:e.item.key,depth:n,index:a}:this.#t,this.requestUpdate();return}if(s&&this.#t&&this.#t.depth===n&&i){let e=Math.min(this.#t.index,a),n=Math.max(this.#t.index,a),r=i.slice(e,n+1);this._selectedKeys=new Set(r.map(e=>e.item.key)),this._selectedNodes=new Set(r),this.requestUpdate();return}let c=new Set(this._selectedNodes);this._selectedKeys=new Set([e.item.key]),this._selectedNodes=new Set([e]),this.#t=a>=0?{key:e.item.key,depth:n,index:a}:void 0,this._selectedByDepth.set(n,e),this.#e=e,this.#R(e,n,!0),(!c.has(e)||c.size!==1)&&this.#j(c)}#R(e,n,r=!1){if(e.item.isLeaf){this._columns=this._columns.slice(0,n+1),this.requestUpdate();return}if(e.children===void 0)this.#z(e,n,!0,r);else{let r=this._columns.slice(0,n+1);r.push(e.children),this._columns=r,this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}}#z(e,n,r,i=!1){let a=n+1;this._columns=this._columns.slice(0,a),this._loadingDepth=a,this.#i?.abort(),this.#r=e;let o=new AbortController;this.#i=o,r&&this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}));let s=n=>{if(o.signal.aborted)return;e.children=n,this.#r=void 0,this.#i=void 0,this._loadingDepth=void 0;let r=this._columns.slice(0,a);n.length>0&&r.push(n),this._columns=r},c=n=>{n.name!==`AbortError`&&console.error(n),e.children=[],this.#r=void 0,this.#i=void 0,this._loadingDepth=void 0,this.requestUpdate()};if(this.model||this.loadChildren){this.#a!==void 0&&(clearTimeout(this.#a),this.#a=void 0);let n=()=>{this.#a=void 0,this.#r===e&&(this.model?this.model.getChildren(e,a-1,o.signal):hg(this.loadChildren({node:e,depth:a-1},o.signal),o.signal)).then(e=>s([...e])).catch(c)};i?n():this.#a=setTimeout(n,150)}else{this._loadingDepth=void 0,this.#r=void 0,this.#i=void 0;let e=this._columns.slice(0,a);e.push([]),this._columns=e}}#B(e){let n=new Set(this._selectedNodes),r=this._selectedKeys.has(e.item.key);(e.children?.length?this.#V(e):r)?this.#H(e,!1):this.#H(e,!0),this.requestUpdate(),this.#j(n)}#V(e){return this._selectedKeys.has(e.item.key)?!e.children?.length||e.children.every(e=>this.#V(e)):!1}#H(e,n){if(n?(this._selectedKeys.add(e.item.key),this._selectedNodes.add(e)):(this._selectedKeys.delete(e.item.key),this._selectedNodes.delete(e)),e.children)for(let r of e.children)this.#H(r,n)}#U(){return this.#g()??0}#W(){let e=this.tickled.tickledId;if(!e)return;let n=e.indexOf(`:`);if(n<0)return;let r=Number(e.substring(0,n)),i=e.substring(n+1),a=this._columns[r];if(!a)return;let o=a.findIndex(e=>e.item.key===i);if(!(o<0))return{node:a[o],depth:r,index:o}}#G(e=`smooth`,n=`edge`){requestAnimationFrame(()=>{let r=this.#W();if(!r)return;let i=this.shadowRoot?.querySelectorAll(`.column`)[r.depth]?.querySelector(`.column-content`);if(!i)return;let a=i.querySelectorAll(`.item`)[r.index];if(a){if(n===`center-if-hidden`){let n=a.getBoundingClientRect(),r=i.getBoundingClientRect(),o=n.top<r.top||n.bottom>r.bottom;a.scrollIntoView({block:o?`center`:`nearest`,inline:`nearest`,behavior:e});return}a.scrollIntoView({block:`nearest`,behavior:e})}})}#K(e,n){this.tickled.setTickled(this.#m(e,n)),this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}#q(e){let n=this.shadowRoot?.querySelectorAll(`.column`)[e]?.querySelector(`.column-content`),r=n?.querySelector(`.item`);return!n||!r||r.offsetHeight===0?10:Math.max(1,Math.floor(n.clientHeight/r.offsetHeight)-1)}#J(e,n,r,i,a=!1){let o=this.#W(),s=i(o!==void 0&&o.depth===n?o.index:-1),c=e[s];if(c){if(this.#K(c,n),this.interactionMode===`standard`||this.interactionMode===`vscode`){let i=o?.index??0;if(r.shiftKey){if(!this.#t||this.#t.depth!==n){let r=e[i];r&&(this.#t={key:r.item.key,depth:n,index:i,selectionSnapshot:this.interactionMode===`vscode`?new Set(this._selectedKeys):void 0})}if(this.#t){let n=Math.min(this.#t.index,s),r=Math.max(this.#t.index,s),i=e.slice(n,r+1).map(e=>e.item.key);if(this.interactionMode===`vscode`){let e=this.#t.selectionSnapshot;for(let n of i)e.has(n)?this._selectedKeys.delete(n):this._selectedKeys.add(n)}else this._selectedKeys=new Set(i)}}else this.#t=this.interactionMode===`standard`?{key:c.item.key,depth:n,index:s}:void 0}this.requestUpdate(),a&&this.#G(`auto`)}}#Y;#X;#Z;#Q;#$;#ee;#te;#ne(e){if(e===0)return this.#h?.item.label??``;let n=this._selectedByDepth.get(e-1);if(n)return n.item.label;let r=this._columns[e-1],i=this._columns[e];if(r&&i){let e=r.find(e=>e.children===i);if(e)return e.item.label}return``}#re(e){return`width:${e}px;flex-grow:0;flex-shrink:0;flex-basis:auto;max-width:none`}#ie(e,n){let r=this.#n.get(e);return r===void 0?this.stretchLastColumn&&n?`width:max-content;flex-grow:1;flex-shrink:0;flex-basis:auto;min-width:0`:`width:max-content;flex-grow:0;flex-shrink:0;flex-basis:auto`:this.#re(r)}#ae(e,n){return this.tickled.isTickled(this.#m(e,n))}renderLoadingIndicator(){return i`<div class="loading-spinner"></div>`}#oe(){let e=this._loadingDepth,n=this.stretchLastColumn&&this.#n.get(e)===void 0;return i`
|
|
10065
10071
|
<div class="column loading-column ${n?`stretch-last`:``}" style=${this.#ie(e,!0)}>
|
|
10066
10072
|
${this.headers?i`
|
|
10067
10073
|
<div class="column-header">${this.#ne(e)}</div>
|
|
@@ -10092,7 +10098,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
10092
10098
|
${this._loadingDepth===void 0?a:this.#oe()}
|
|
10093
10099
|
</div>
|
|
10094
10100
|
${this.search.renderField()}
|
|
10095
|
-
`}_getFocusedIndex(e){let n=this.#W();return n&&n.depth===e?n.index:0}_isFocused(e,n){return this.#ae(e,n)}_handleItemPointerEnter(e,n){this.tickled.handlePointerEnter(this.#m(e,n)),this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}_handleColumnPointerLeave(){this.tickled.handlePointerLeave(new PointerEvent(`pointerleave`))}static{this.styles=[w,se,
|
|
10101
|
+
`}_getFocusedIndex(e){let n=this.#W();return n&&n.depth===e?n.index:0}_isFocused(e,n){return this.#ae(e,n)}_handleItemPointerEnter(e,n){this.tickled.handlePointerEnter(this.#m(e,n)),this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:e,depth:n},bubbles:!0,composed:!0}))}_handleColumnPointerLeave(){this.tickled.handlePointerLeave(new PointerEvent(`pointerleave`))}static{this.styles=[w,se,Vt,r`
|
|
10096
10102
|
:host {
|
|
10097
10103
|
--column-bg: var(--surface-3);
|
|
10098
10104
|
--column-header-bg: var(--surface-2);
|
|
@@ -10339,7 +10345,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
10339
10345
|
}
|
|
10340
10346
|
|
|
10341
10347
|
|
|
10342
|
-
`]}};Aw=E([T(`ixfx-miller-list`)],Aw);var jw=class{#e;#t;#n;#r=new WeakMap;#i=new Map;#a=new Map;#o=new Map;#s=new WeakMap;#c;constructor(e,n,r){this.#e=e,this.#t=n,this.#n=r}connect(){this.disconnect(),this.#c=new AbortController,this.#s=new WeakMap,this.#i.clear(),this.#o.clear(),this.#a.clear();let e={item:this.#f(this.#e)};this.#r.set(e,this.#e),e.children=this.#p(this.#e),this.#t.root=e,this.#t.loadChildren=this.#n.loadChildren??(({node:e})=>{let n=this.#r.get(e);return n?this.#p(n):[]})}disconnect(){this.#c?.abort(),this.#c=void 0,this.#t.loadChildren=void 0}navigateToValue(e,n){let r=this.#_(this.#e,e);return r?this.#l(r,n):!1}navigateToKeyPath(e,n){let r=this.#t.viewRoot??this.#t.root;if(!r||e.length===0)return!1;this.#u(r);let i=r.children??[];for(let n=0;n<e.length-1;n++){let r=i.find(r=>r.item.key===e[n]);if(!r)return!1;this.#u(r),i=r.children??[]}return this.#t.navigateTo(e,n)}navigateToIdentity(e,n){let r=this.#d(e);if(!r)return!1;let i=[],a=this.#e.getIdentity();for(let e=r;e;e=e.getParent())if(i.unshift(e),e.getIdentity()===a)return this.#l(i,n);return!1}lookupByKey(e){return this.#a.get(e)}sync(){let e=this.#t.root;if(!e)return;this.#s=new WeakMap,this.#i.clear(),this.#o.clear(),this.#a.clear(),this.#r.set(e,this.#e),e.item=this.#f(this.#e);let n=new Set([e]);e.children&&this.#g(this.#e,e.children,n);let r=this.#t.viewRoot;r&&!n.has(r)&&(this.#t.viewRoot=void 0),this.#t.invalidateStructure()}#l(e,n){let r=this.#t.viewRoot??this.#t.root;if(!r)return!1;let i=1;if(this.#t.viewRoot){let n=this.#r.get(r);if(!n)return!1;let a=n.getIdentity(),o=e.findIndex(e=>e.getIdentity()===a);if(o<0)return!1;i=o+1}return i>=e.length?!1:this.navigateToKeyPath(e.slice(i).map(e=>this.#f(e).key),n)}#u(e){if(e.children!==void 0)return;let n=this.#r.get(e);n&&(e.children=this.#p(n))}#d(e){return this.#o.get(e)}#f(e){let n=e.getIdentity(),r=this.#s.get(n);return r||(r=this.#n.valueToItem(e.getValue(),e),this.#s.set(n,r)),r}#p(e){return Array.from(e.children(),e=>this.#m(e))}#m(e){let n=[...e.children()];for(let e of n)this.#o.set(e.getIdentity(),e);let r=this.#f(e),i=r.isLeaf??n.length===0,a={item:{...r,isLeaf:i},children:i?[]:void 0};return this.#h(a,e),a}#h(e,n){this.#r.set(e,n),this.#i.set(n.getIdentity(),e),this.#o.set(n.getIdentity(),n),this.#a.set(e.item.key,n)}#g(e,n,r){let i=new Map(n.map(e=>[e.item.key,e])),a=Array.from(e.children(),e=>{let n=this.#m(e),a=i.get(n.item.key);return a?(a.item=n.item,this.#h(a,e),r.add(a),n.item.isLeaf?a.children=[]:a.children===void 0?a.children=void 0:this.#g(e,a.children,r),a):(r.add(n),n)});n.splice(0,n.length,...a)}#_(e,n,r=[]){let i=[...r,e];if(n(e.getValue()))return i;for(let r of e.children()){let e=this.#_(r,n,i);if(e)return e}}};function Mw(e){return e.children!==void 0&&e.children.length>0}function Nw(e){return e.flatMap(e=>Mw(e)?Nw(e.children):[e])}function Pw(e,n){for(let r of e){if(r.key===n)return r;let e=r.children?Pw(r.children,n):void 0;if(e)return e}}function Fw(e,n){return Nw(e).find(e=>e.key===n)}const Iw=`__all__`;function Lw(e,n){let r=n===`desc`?-1:1;return[...e].sort((e,n)=>r*e.label.localeCompare(n.label,void 0,{sensitivity:`base`,numeric:!0}))}function Rw(e,n,r,i){if(r===0)return{insert:0,caretOffset:0};let a=2**53-1,o=i;for(let s=0;s<r;s++){if(s===i)continue;let r=e[s],c=e[s+1]??e[e.length-1],l=(r+c)/2,u=Math.abs(n-(n<l?r:c));u<a&&(a=u,o=n<l?s:s+1)}let s=o>i?o-1:o;return{insert:Math.max(0,Math.min(r-1,s)),caretOffset:e[o]??e[e.length-1]}}var zw=class{#e;#t;#n;#r;#i;#a;#o=void 0;#s;#c;#l;#u=[];#d=!0;#f=[];#p=!1;#m;constructor(e){this.id=e.id,this.#e=e.category,this.#t=e.categoryDefaults,this.#n=e.selectionMode,this.#r=e.dataProvider,this.#i=e.onSelectionChange,this.#a=e.onRequestData,this.#m={id:e.id,categoryKey:e.category.key,sort:e.categoryDefaults?.sort??`asc`,grouped:e.categoryDefaults?.grouped??!1,menu:e.categoryDefaults?.menu??!0,width:220}}get state(){return this.getState()}get categoryKey(){return this.#e.key}get menu(){return this.#m.menu}getState(){return{...this.#m}}updateState(e){let n=e;if(e.width!==void 0&&!Number.isFinite(e.width)){let{width:r,...i}=e;n=i}let r=n.sort!==void 0&&n.sort!==this.#m.sort,i=n.grouped!==void 0&&n.grouped!==this.#m.grouped;this.#m={...this.#m,...n},r&&this.#_(),i&&this.#v()}setWidth(e){Number.isFinite(e)&&(this.#m={...this.#m,width:Math.max(80,Math.min(480,Math.round(e)))})}setSort(e){e!==this.#m.sort&&(this.#m={...this.#m,sort:e},this.#_())}setGrouped(e){e!==this.#m.grouped&&(this.#m={...this.#m,grouped:e},this.#v())}setSelectionMode(e){if(e!==this.#n){this.#n=e;for(let n of this.#y())n.selectionMode=e}}setCategory(e){this.#e=e,this.#t=e.defaults,this.#m={...this.#m,categoryKey:e.key,sort:e.defaults?.sort??`asc`,grouped:e.defaults?.grouped??!1,menu:e.defaults?.menu??!0},this.clearSelection(),this.#v()}get listerHost(){return this.#s}get isMounted(){return this.#s!==void 0}setDataProvider(e){this.#r=e}mount(e){if(this.#s)return;this.#s=e;let n=document.createElement(`div`);n.className=`all-row`,n.dataset.key=Iw,n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`);let r=document.createElement(`span`);r.className=`all-label`,n.appendChild(r);let i=()=>{this.#d||this.#x()};n.addEventListener(`click`,i),n.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())}),this.#c=n;let a=document.createElement(`ixfx-grouped-item-lister`);a.crossGroupSelection=!0,a.factory=()=>_x(Bw,{selectionMode:this.#n,interactionMode:`standard`}),a.addEventListener(`select`,this.#b),this.#l=a,this.#v(),this.#C(),e.append(n,a),this.#f.length>0&&(this.#g(),this.#S())}unmount(){this.#w(),this.#c?.remove(),this.#l?.remove(),this.#c=void 0,this.#l=void 0,this.#s=void 0}requestData(e){if(!this.#r)return;this.#w();let n=new AbortController;this.#o=n;let{signal:r}=n;this.#a(this.id,e,r),Promise.resolve().then(async()=>{let n=await
|
|
10348
|
+
`]}};Aw=E([T(`ixfx-miller-list`)],Aw);var jw=class{#e;#t;#n;#r=new WeakMap;#i=new Map;#a=new Map;#o=new Map;#s=new WeakMap;#c;constructor(e,n,r){this.#e=e,this.#t=n,this.#n=r}connect(){this.disconnect(),this.#c=new AbortController,this.#s=new WeakMap,this.#i.clear(),this.#o.clear(),this.#a.clear();let e={item:this.#f(this.#e)};this.#r.set(e,this.#e),e.children=this.#p(this.#e),this.#t.root=e,this.#t.loadChildren=this.#n.loadChildren??(({node:e})=>{let n=this.#r.get(e);return n?this.#p(n):[]})}disconnect(){this.#c?.abort(),this.#c=void 0,this.#t.loadChildren=void 0}navigateToValue(e,n){let r=this.#_(this.#e,e);return r?this.#l(r,n):!1}navigateToKeyPath(e,n){let r=this.#t.viewRoot??this.#t.root;if(!r||e.length===0)return!1;this.#u(r);let i=r.children??[];for(let n=0;n<e.length-1;n++){let r=i.find(r=>r.item.key===e[n]);if(!r)return!1;this.#u(r),i=r.children??[]}return this.#t.navigateTo(e,n)}navigateToIdentity(e,n){let r=this.#d(e);if(!r)return!1;let i=[],a=this.#e.getIdentity();for(let e=r;e;e=e.getParent())if(i.unshift(e),e.getIdentity()===a)return this.#l(i,n);return!1}lookupByKey(e){return this.#a.get(e)}sync(){let e=this.#t.root;if(!e)return;this.#s=new WeakMap,this.#i.clear(),this.#o.clear(),this.#a.clear(),this.#r.set(e,this.#e),e.item=this.#f(this.#e);let n=new Set([e]);e.children&&this.#g(this.#e,e.children,n);let r=this.#t.viewRoot;r&&!n.has(r)&&(this.#t.viewRoot=void 0),this.#t.invalidateStructure()}#l(e,n){let r=this.#t.viewRoot??this.#t.root;if(!r)return!1;let i=1;if(this.#t.viewRoot){let n=this.#r.get(r);if(!n)return!1;let a=n.getIdentity(),o=e.findIndex(e=>e.getIdentity()===a);if(o<0)return!1;i=o+1}return i>=e.length?!1:this.navigateToKeyPath(e.slice(i).map(e=>this.#f(e).key),n)}#u(e){if(e.children!==void 0)return;let n=this.#r.get(e);n&&(e.children=this.#p(n))}#d(e){return this.#o.get(e)}#f(e){let n=e.getIdentity(),r=this.#s.get(n);return r||(r=this.#n.valueToItem(e.getValue(),e),this.#s.set(n,r)),r}#p(e){return Array.from(e.children(),e=>this.#m(e))}#m(e){let n=[...e.children()];for(let e of n)this.#o.set(e.getIdentity(),e);let r=this.#f(e),i=r.isLeaf??n.length===0,a={item:{...r,isLeaf:i},children:i?[]:void 0};return this.#h(a,e),a}#h(e,n){this.#r.set(e,n),this.#i.set(n.getIdentity(),e),this.#o.set(n.getIdentity(),n),this.#a.set(e.item.key,n)}#g(e,n,r){let i=new Map(n.map(e=>[e.item.key,e])),a=Array.from(e.children(),e=>{let n=this.#m(e),a=i.get(n.item.key);return a?(a.item=n.item,this.#h(a,e),r.add(a),n.item.isLeaf?a.children=[]:a.children===void 0?a.children=void 0:this.#g(e,a.children,r),a):(r.add(n),n)});n.splice(0,n.length,...a)}#_(e,n,r=[]){let i=[...r,e];if(n(e.getValue()))return i;for(let r of e.children()){let e=this.#_(r,n,i);if(e)return e}}};function Mw(e){return e.children!==void 0&&e.children.length>0}function Nw(e){return e.flatMap(e=>Mw(e)?Nw(e.children):[e])}function Pw(e,n){for(let r of e){if(r.key===n)return r;let e=r.children?Pw(r.children,n):void 0;if(e)return e}}function Fw(e,n){return Nw(e).find(e=>e.key===n)}const Iw=`__all__`;function Lw(e,n){let r=n===`desc`?-1:1;return[...e].sort((e,n)=>r*e.label.localeCompare(n.label,void 0,{sensitivity:`base`,numeric:!0}))}function Rw(e,n,r,i){if(r===0)return{insert:0,caretOffset:0};let a=2**53-1,o=i;for(let s=0;s<r;s++){if(s===i)continue;let r=e[s],c=e[s+1]??e[e.length-1],l=(r+c)/2,u=Math.abs(n-(n<l?r:c));u<a&&(a=u,o=n<l?s:s+1)}let s=o>i?o-1:o;return{insert:Math.max(0,Math.min(r-1,s)),caretOffset:e[o]??e[e.length-1]}}var zw=class{#e;#t;#n;#r;#i;#a;#o=void 0;#s;#c;#l;#u=[];#d=!0;#f=[];#p=!1;#m;constructor(e){this.id=e.id,this.#e=e.category,this.#t=e.categoryDefaults,this.#n=e.selectionMode,this.#r=e.dataProvider,this.#i=e.onSelectionChange,this.#a=e.onRequestData,this.#m={id:e.id,categoryKey:e.category.key,sort:e.categoryDefaults?.sort??`asc`,grouped:e.categoryDefaults?.grouped??!1,menu:e.categoryDefaults?.menu??!0,width:220}}get state(){return this.getState()}get categoryKey(){return this.#e.key}get menu(){return this.#m.menu}getState(){return{...this.#m}}updateState(e){let n=e;if(e.width!==void 0&&!Number.isFinite(e.width)){let{width:r,...i}=e;n=i}let r=n.sort!==void 0&&n.sort!==this.#m.sort,i=n.grouped!==void 0&&n.grouped!==this.#m.grouped;this.#m={...this.#m,...n},r&&this.#_(),i&&this.#v()}setWidth(e){Number.isFinite(e)&&(this.#m={...this.#m,width:Math.max(80,Math.min(480,Math.round(e)))})}setSort(e){e!==this.#m.sort&&(this.#m={...this.#m,sort:e},this.#_())}setGrouped(e){e!==this.#m.grouped&&(this.#m={...this.#m,grouped:e},this.#v())}setSelectionMode(e){if(e!==this.#n){this.#n=e;for(let n of this.#y())n.selectionMode=e}}setCategory(e){this.#e=e,this.#t=e.defaults,this.#m={...this.#m,categoryKey:e.key,sort:e.defaults?.sort??`asc`,grouped:e.defaults?.grouped??!1,menu:e.defaults?.menu??!0},this.clearSelection(),this.#v()}get listerHost(){return this.#s}get isMounted(){return this.#s!==void 0}setDataProvider(e){this.#r=e}mount(e){if(this.#s)return;this.#s=e;let n=document.createElement(`div`);n.className=`all-row`,n.dataset.key=Iw,n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`);let r=document.createElement(`span`);r.className=`all-label`,n.appendChild(r);let i=()=>{this.#d||this.#x()};n.addEventListener(`click`,i),n.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())}),this.#c=n;let a=document.createElement(`ixfx-grouped-item-lister`);a.crossGroupSelection=!0,a.factory=()=>_x(Bw,{selectionMode:this.#n,interactionMode:`standard`}),a.addEventListener(`select`,this.#b),this.#l=a,this.#v(),this.#C(),e.append(n,a),this.#f.length>0&&(this.#g(),this.#S())}unmount(){this.#w(),this.#c?.remove(),this.#l?.remove(),this.#c=void 0,this.#l=void 0,this.#s=void 0}requestData(e){if(!this.#r)return;this.#w();let n=new AbortController;this.#o=n;let{signal:r}=n;this.#a(this.id,e,r),Promise.resolve().then(async()=>{let n=await hg(this.#r(e,r),r);r.aborted||this.#h(n)}).catch(()=>{})}#h(e){this.#f=e;let n=this.#u.filter(n=>e.some(e=>e.key===n)),r=n.length!==this.#u.length;if(this.#u=n,n.length===0&&(this.#d=!0),!this.#l){r&&this.#i(this.id,n);return}this.#g(),this.#S(),r&&this.#i(this.id,n)}#g(){if(!this.#l)return;let e=Lw(this.#f,this.#m.sort);this.#l.provider=()=>e}#_(){!this.#l||this.#f.length===0||(this.#g(),this.#S())}#v(){if(!this.#l)return;let e=this.#t?.groupBy;this.#l.groupBy=e,this.#l.grouped=this.#m.grouped&&e!==void 0,this.#f.length>0&&this.#S()}#y(){return this.#l?this.#l.querySelectorAll(`:scope > .ungrouped-host > *, :scope > ixfx-panel > *`):[]}#b=()=>{if(this.#p)return;let e=[...this.#l?.selectedItems??[]].map(e=>e.key).filter(e=>e!==Iw);if(e.length===this.#u.length&&e.every(e=>this.#u.includes(e))){this.#C();return}this.#u=e,this.#d=e.length===0,this.#C(),this.#i(this.id,e)};#x(){let e=this.#u;this.#p=!0;try{this.#u=[],this.#d=!0;for(let e of this.#y())e.clearSelection()}finally{this.#p=!1}this.#C(),e.length>0&&this.#i(this.id,[])}clearSelection(){this.#x()}get selectedValues(){return this.#u}#S(){this.#l&&this.#l.updateComplete.then(()=>{if(!(!this.#l||!this.#s)){this.#p=!0;try{let e=this.#u;for(let n of this.#l.querySelectorAll(`ixfx-vertical-list`))n.selectKeys(e);let n=[...this.#l.selectedItems].map(e=>e.key).filter(e=>e!==Iw);this.#u=n,this.#d=n.length===0}finally{this.#p=!1}this.#C()}})}#C(){if(!this.#c)return;let e=this.#t?.allLabel??`All`,n=this.#c.querySelector(`.all-label`);n&&(n.textContent=e),this.#c.toggleAttribute(`data-selected`,this.#d)}#w(){this.#o&&=(this.#o.abort(),void 0)}};function Bw(e){let n=document.createElement(`li`);n.dataset.key=e.key;let r=document.createElement(`span`);if(r.className=`item-label`,r.textContent=e.label,n.appendChild(r),e.count!==void 0){let r=document.createElement(`span`);r.className=`count`,r.textContent=String(e.count),n.appendChild(r)}return n}_e(`menu`,`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>`);let Vw=class extends n{constructor(...e){super(...e),this.categories=[],this.selectionMode=`multiple`,this.minColumns=1,this.maxColumns=5,this._columns=[],this._colOffsets=[0],this._resizingColumnId=void 0,this._draggingColumnId=void 0,this._dropCaretX=void 0,this._idCounter=0,this._autoSeeded=!1,this._drag={pointerId:-1,from:-1,startX:0,startY:0,active:!1,ghost:null,insert:-1}}static{this.styles=[w,Yt,r`
|
|
10343
10349
|
:host {
|
|
10344
10350
|
--multicol-list-bg: var(--surface-3);
|
|
10345
10351
|
--multicol-list-header-bg: var(--surface-2);
|
|
@@ -10738,7 +10744,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
10738
10744
|
pointer-events: none;
|
|
10739
10745
|
z-index: 1;
|
|
10740
10746
|
}
|
|
10741
|
-
`}};E([d({type:String,reflect:!0})],uT.prototype,`orientation`,void 0),E([d({type:String})],uT.prototype,`variant`,void 0),E([d({type:String,attribute:`toggle-interaction`})],uT.prototype,`toggleInteraction`,void 0),E([d({type:Boolean})],uT.prototype,`collapsible`,void 0),E([d({type:Boolean,attribute:`accordion`,reflect:!0})],uT.prototype,`accordion`,void 0),E([d({type:Boolean,attribute:`allow-reorder`,reflect:!0})],uT.prototype,`allowReorder`,void 0),E([d({attribute:`sticky-headers`,reflect:!0,converter:{fromAttribute:e=>e!==`false`,toAttribute:e=>e?`true`:`false`}})],uT.prototype,`stickyHeaders`,void 0),E([d()],uT.prototype,`gap`,void 0),E([p({slot:``})],uT.prototype,`_panels`,void 0),uT=E([T(`ixfx-panel-group`)],uT);var dT=Object.defineProperty,fT=(e,n)=>{let r={};for(var i in e)dT(r,i,{get:e[i],enumerable:!0});return n||dT(r,Symbol.toStringTag,{value:`Module`}),r};const pT=Math.pow,mT=1/Math.sqrt(2*Math.PI),hT=(e=.4)=>n=>{let r=mT/e,i=-2.5,a=(n-.5)/e;a*=a,i*=a;let o=r*pT(Math.E,i);return o>1?1:o<0?0:o};var gT=fT({arch:()=>TT,backIn:()=>WT,backInOut:()=>qT,backOut:()=>GT,bell:()=>ZT,bounceIn:()=>XT,bounceInOut:()=>$T,bounceOut:()=>ST,circIn:()=>HT,circInOut:()=>KT,circOut:()=>UT,cubicIn:()=>PT,cubicOut:()=>FT,elasticIn:()=>JT,elasticInOut:()=>QT,elasticOut:()=>YT,expoIn:()=>RT,expoInOut:()=>VT,expoOut:()=>zT,quadIn:()=>AT,quadInOut:()=>NT,quadOut:()=>jT,quartIn:()=>IT,quartOut:()=>LT,quintIn:()=>CT,quintInOut:()=>BT,quintOut:()=>wT,sineIn:()=>OT,sineInOut:()=>MT,sineOut:()=>kT,smootherstep:()=>DT,smoothstep:()=>ET});const _T=Math.sqrt,vT=Math.pow,yT=Math.cos,bT=Math.PI,xT=Math.sin,ST=e=>{let n=7.5625,r=2.75;return e<1/r?n*e*e:e<2/r?n*(e-=1.5/r)*e+.75:e<2.5/r?n*(e-=2.25/r)*e+.9375:n*(e-=2.625/r)*e+.984375},CT=e=>e*e*e*e*e,wT=e=>1-vT(1-e,5),TT=e=>e*(1-e)*4,ET=e=>e*e*(3-2*e),DT=e=>(e*(e*6-15)+10)*e*e*e,OT=e=>1-yT(e*bT/2),kT=e=>xT(e*bT/2),AT=e=>e*e,jT=e=>1-(1-e)*(1-e),MT=e=>-(yT(bT*e)-1)/2,NT=e=>e<.5?2*e*e:1-vT(-2*e+2,2)/2,PT=e=>e*e*e,FT=e=>1-vT(1-e,3),IT=e=>e*e*e*e,LT=e=>1-vT(1-e,4),RT=e=>e===0?0:vT(2,10*e-10),zT=e=>e===1?1:1-vT(2,-10*e),BT=e=>e<.5?16*e*e*e*e*e:1-vT(-2*e+2,5)/2,VT=e=>e===0?0:e===1?1:e<.5?vT(2,20*e-10)/2:(2-vT(2,-20*e+10))/2,HT=e=>1-_T(1-vT(e,2)),UT=e=>_T(1-vT(e-1,2)),WT=e=>2.70158*e*e*e-1.70158*e*e,GT=e=>1+2.70158*vT(e-1,3)+1.70158*vT(e-1,2),KT=e=>e<.5?(1-_T(1-vT(2*e,2)))/2:(_T(1-vT(-2*e+2,2))+1)/2,qT=e=>{let n=2.5949095;return e<.5?vT(2*e,2)*(7.189819*e-n)/2:(vT(2*e-2,2)*(3.5949095*(e*2-2)+n)+2)/2},JT=e=>{let n=2*bT/3;return e===0?0:e===1?1:-vT(2,10*e-10)*xT((e*10-10.75)*n)},YT=e=>{let n=2*bT/3;return e===0?0:e===1?1:vT(2,-10*e)*xT((e*10-.75)*n)+1},XT=e=>1-ST(1-e),ZT=hT(),QT=e=>{let n=2*bT/4.5;return e===0?0:e===1?1:e<.5?-(vT(2,20*e-10)*xT((20*e-11.125)*n))/2:vT(2,-20*e+10)*xT((20*e-11.125)*n)/2+1},$T=e=>e<.5?(1-ST(1-2*e))/2:(1+ST(2*e-1))/2,eE=(e=0,n=0)=>{let r={x:
|
|
10747
|
+
`}};E([d({type:String,reflect:!0})],uT.prototype,`orientation`,void 0),E([d({type:String})],uT.prototype,`variant`,void 0),E([d({type:String,attribute:`toggle-interaction`})],uT.prototype,`toggleInteraction`,void 0),E([d({type:Boolean})],uT.prototype,`collapsible`,void 0),E([d({type:Boolean,attribute:`accordion`,reflect:!0})],uT.prototype,`accordion`,void 0),E([d({type:Boolean,attribute:`allow-reorder`,reflect:!0})],uT.prototype,`allowReorder`,void 0),E([d({attribute:`sticky-headers`,reflect:!0,converter:{fromAttribute:e=>e!==`false`,toAttribute:e=>e?`true`:`false`}})],uT.prototype,`stickyHeaders`,void 0),E([d()],uT.prototype,`gap`,void 0),E([p({slot:``})],uT.prototype,`_panels`,void 0),uT=E([T(`ixfx-panel-group`)],uT);var dT=Object.defineProperty,fT=(e,n)=>{let r={};for(var i in e)dT(r,i,{get:e[i],enumerable:!0});return n||dT(r,Symbol.toStringTag,{value:`Module`}),r};const pT=Math.pow,mT=1/Math.sqrt(2*Math.PI),hT=(e=.4)=>n=>{let r=mT/e,i=-2.5,a=(n-.5)/e;a*=a,i*=a;let o=r*pT(Math.E,i);return o>1?1:o<0?0:o};var gT=fT({arch:()=>TT,backIn:()=>WT,backInOut:()=>qT,backOut:()=>GT,bell:()=>ZT,bounceIn:()=>XT,bounceInOut:()=>$T,bounceOut:()=>ST,circIn:()=>HT,circInOut:()=>KT,circOut:()=>UT,cubicIn:()=>PT,cubicOut:()=>FT,elasticIn:()=>JT,elasticInOut:()=>QT,elasticOut:()=>YT,expoIn:()=>RT,expoInOut:()=>VT,expoOut:()=>zT,quadIn:()=>AT,quadInOut:()=>NT,quadOut:()=>jT,quartIn:()=>IT,quartOut:()=>LT,quintIn:()=>CT,quintInOut:()=>BT,quintOut:()=>wT,sineIn:()=>OT,sineInOut:()=>MT,sineOut:()=>kT,smootherstep:()=>DT,smoothstep:()=>ET});const _T=Math.sqrt,vT=Math.pow,yT=Math.cos,bT=Math.PI,xT=Math.sin,ST=e=>{let n=7.5625,r=2.75;return e<1/r?n*e*e:e<2/r?n*(e-=1.5/r)*e+.75:e<2.5/r?n*(e-=2.25/r)*e+.9375:n*(e-=2.625/r)*e+.984375},CT=e=>e*e*e*e*e,wT=e=>1-vT(1-e,5),TT=e=>e*(1-e)*4,ET=e=>e*e*(3-2*e),DT=e=>(e*(e*6-15)+10)*e*e*e,OT=e=>1-yT(e*bT/2),kT=e=>xT(e*bT/2),AT=e=>e*e,jT=e=>1-(1-e)*(1-e),MT=e=>-(yT(bT*e)-1)/2,NT=e=>e<.5?2*e*e:1-vT(-2*e+2,2)/2,PT=e=>e*e*e,FT=e=>1-vT(1-e,3),IT=e=>e*e*e*e,LT=e=>1-vT(1-e,4),RT=e=>e===0?0:vT(2,10*e-10),zT=e=>e===1?1:1-vT(2,-10*e),BT=e=>e<.5?16*e*e*e*e*e:1-vT(-2*e+2,5)/2,VT=e=>e===0?0:e===1?1:e<.5?vT(2,20*e-10)/2:(2-vT(2,-20*e+10))/2,HT=e=>1-_T(1-vT(e,2)),UT=e=>_T(1-vT(e-1,2)),WT=e=>2.70158*e*e*e-1.70158*e*e,GT=e=>1+2.70158*vT(e-1,3)+1.70158*vT(e-1,2),KT=e=>e<.5?(1-_T(1-vT(2*e,2)))/2:(_T(1-vT(-2*e+2,2))+1)/2,qT=e=>{let n=2.5949095;return e<.5?vT(2*e,2)*(7.189819*e-n)/2:(vT(2*e-2,2)*(3.5949095*(e*2-2)+n)+2)/2},JT=e=>{let n=2*bT/3;return e===0?0:e===1?1:-vT(2,10*e-10)*xT((e*10-10.75)*n)},YT=e=>{let n=2*bT/3;return e===0?0:e===1?1:vT(2,-10*e)*xT((e*10-.75)*n)+1},XT=e=>1-ST(1-e),ZT=hT(),QT=e=>{let n=2*bT/4.5;return e===0?0:e===1?1:e<.5?-(vT(2,20*e-10)*xT((20*e-11.125)*n))/2:vT(2,-20*e+10)*xT((20*e-11.125)*n)/2+1},$T=e=>e<.5?(1-ST(1-2*e))/2:(1+ST(2*e-1))/2,eE=(e=0,n=0)=>{let r={x:ui(e,-1,1,0,1),y:ui(e,-1,1,1,0)},i=Ld.interpolate(Math.abs(e),Ld.Empty,r);e!==0&&n>0&&(i=e>0?Ld.interpolate(n,i,{x:0,y:r.x*2}):Ld.interpolate(n,i,{x:r.y*2,y:0}));let a=Wa.cubic(Ld.Empty,Ld.Unit,i,r),o=Wa.interpolator(a);return e=>o(e)},tE=(e,n)=>{k(Rr(e,`fn`));let r;return()=>(r===void 0&&(r=ku(n,{clampValue:!0})),e(r()))},nE=(e,n)=>{k(Rr(e,`fn`));let r=Pu(),i=Po(n);if(i===void 0)throw Error(`Param 'duration' not provided`);let a=Nu(i,{timer:r,clampValue:!0});return Iu(e,a)},rE=(e,n)=>{k(Rr(e,`fn`));let r;return()=>(r===void 0&&(r=Au(n,{clampValue:!0})),e(r()))},iE=(e,n)=>{k(Rr(e,`fn`));let r=Fu(),i=Nu(n,{timer:r,clampValue:!0});return Iu(e,i)};var aE=fT({Named:()=>gT,create:()=>oE,get:()=>pE,getEasingNames:()=>hE,line:()=>eE,tickEasing:()=>uE,ticks:()=>lE,time:()=>cE,timeEasing:()=>sE});const oE=e=>{let n=dE(e.name??`quintIn`)??e.fn;if(n===void 0)throw Error(`Either 'name' or 'fn' must be set`);if(`duration`in e)return cE(n,e.duration);if(`ticks`in e)return lE(n,e.ticks);throw Error(`Expected 'duration' or 'ticks' in options`)},sE=(e,n)=>nE(dE(e),n),cE=(e,n)=>tE(dE(e),n),lE=(e,n)=>rE(dE(e),n),uE=(e,n)=>iE(dE(e),n),dE=e=>{let n=typeof e==`function`?e:pE(e);if(n===void 0)throw Error(typeof e==`string`?`Easing function not found: '${e}'`:`Easing function not found`);return n};let fE;const pE=function(e){k(zr(e,`non-empty`,`easingName`));let n=mE().get(e.toLowerCase());if(n===void 0)throw Error(`Easing not found: '${e}'`);return n};function mE(){if(fE===void 0){fE=new Map;for(let[e,n]of Object.entries(gT))fE.set(e.toLowerCase(),n);return fE}return fE}function*hE(){yield*mE().keys()}const gE=[`green`,`yellow`,`red`],_E=new Map;function vE(e){let n=e.join(`\0`);return _E.has(n)||_E.set(n,ig.scale(e,{stepsBetween:99})),_E.get(n)}function yE(e,n){let r=getComputedStyle(e),i=r.getPropertyValue(n).trim(),a=/var\((--[\w-]+)(?:,(.*))?\)/g;for(let e=0;e<5&&i.includes(`var(`);e++)i=i.replace(a,(e,n,i)=>r.getPropertyValue(n).trim()||(i?i.trim():``));return i}function bE(e){return yE(e,`--plot-color`)||`oklch(60% 0.15 140)`}function xE(e){if(!e.trim())return gE;let n=e.split(`,`).map(e=>e.trim()).filter(Boolean);return n.length>=2?n:gE}function SE(e){try{let n=ig.HslSpace.fromCss(e,{scalar:!0});return{h:n.h,s:n.s,l:n.l}}catch{return{h:.39,s:.5,l:.55}}}function CE(e,n){let r=Math.max(0,Math.min(1,e));if(n.easingName)try{return Math.max(0,Math.min(1,aE.get(n.easingName)(r)))}catch{}return n.valueMap?Math.max(0,Math.min(1,n.valueMap(r))):r}function wE(e,n,r){let i=CE(e,r);switch(r.mode){case`fixed`:return{fill:n,opacity:1};case`opacity`:return{fill:n,opacity:Math.max(.04,i)};case`hue`:{let e=SE(n);return{fill:`hsl(${Math.round(i*360)}deg ${Math.round(e.s*100)}% ${Math.round(e.l*100)}%)`,opacity:1}}case`saturation`:{let e=SE(n);return{fill:`hsl(${Math.round(e.h*360)}deg ${Math.round(i*100)}% ${Math.round(e.l*100)}%)`,opacity:1}}case`lightness`:{let e=SE(n);return{fill:`hsl(${Math.round(e.h*360)}deg ${Math.round(e.s*100)}% ${Math.round(i*100)}%)`,opacity:1}}case`scale`:{let e=vE(r.palette.length>=2?r.palette:gE);return{fill:e[Math.min(e.length-1,Math.floor(i*e.length))],opacity:1}}default:return{fill:n,opacity:1}}}function TE(e,n,r){if(r===`opacity`)return{...e,opacity:e.opacity*Math.max(.08,n**.6)};if(r===`desaturation`){let r=SE(e.fill),i=r.s*n;return{fill:`hsl(${Math.round(r.h*360)}deg ${Math.round(i*100)}% ${Math.round(r.l*100)}%)`,opacity:e.opacity}}return e}var EE=class{#e;#t;#n;#r;constructor(e={}){this.values=[],this.#e=mi(),this.#t={min:0,max:0},this.#n=null,this.#r={capacityLimit:100,persistentScaling:!0,fixedRange:null,...e},this.#r.fixedRange!==null&&(this.#n=this.#r.fixedRange)}setRange(e,n){this.#n={min:e,max:n}}unsetRange(){this.#n=null,this.#i()}get isAutoRange(){return this.#n===null}add(e){if(typeof e==`number`)this.values.push(e),this.isAutoRange&&(this.#t=this.#e.seen(e));else if(this.values.push(...e),this.isAutoRange)for(let n of e)this.#t=this.#e.seen(n);this.values.length>this.#r.capacityLimit&&(this.values=this.values.slice(this.values.length-this.#r.capacityLimit),!this.#r.persistentScaling&&this.isAutoRange&&this.#i())}#i(){this.#r.persistentScaling||(this.#e=mi());for(let e=0;e<this.values.length;e++)this.#t=this.#e.seen(this.values[e])}set(e){e.length>this.#r.capacityLimit&&(e=e.slice(e.length-this.#r.capacityLimit)),this.values=e,this.#i()}get range(){return this.#n?this.#n:this.#t}clear(){let e=this.values.length===0;return this.values=[],this.#r.persistentScaling||this.#i(),!e}};function DE(e){if(typeof e==`number`)return!0;if(typeof e!=`string`)return!1;let n=e.trim();return n!==``&&!Number.isNaN(Number(n))}var OE;let kE=!1;function AE(){if(kE)return;kE=!0;let e=document.createElement(`style`);e.textContent=`
|
|
10742
10748
|
ixfx-tooltip {
|
|
10743
10749
|
display: inline-block;
|
|
10744
10750
|
background: var(--surface-5);
|
|
@@ -10908,7 +10914,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
10908
10914
|
x=${e.x-c/2} y=${Math.min(e.y,i)}
|
|
10909
10915
|
width=${c} height=${Math.max(1,Math.abs(e.y-i))}
|
|
10910
10916
|
fill=${n[o].fill} opacity=${n[o].opacity}
|
|
10911
|
-
/>`})}let iD=class extends n{constructor(...e){super(...e),this.drawStyle=`line-sharp`,this.ageStyle=`none`,this.title=``,this.precise=!1,this.tooltips=!0,this.capacity=100,this.rangeMin=NaN,this.rangeMax=NaN,this.persistentScale=!0,this.paused=!1,this.clickPauses=!1,this.shaded=!1,this.areaColor=``,this.colorMode=`fixed`,this.colorEasing=``,this.colorScale=``,this.colorValueMap=null,this._width=100,this._height=40,this.#e=new EE,this.#t=!1,this.#n=null,this.#r=null,this.valueFormat=e=>e?e.toFixed(2):``,this.#c=e=>{this.#n=e.clientX,this.#r=e.clientY,this.#o(e.clientX,e.clientY);let n=this.#a(e.clientX,this.getBoundingClientRect());this.dispatchEvent(new CustomEvent(`plot-pointer-move`,{detail:{clientX:e.clientX,clientY:e.clientY,index:n},bubbles:!0,composed:!0}))},this.#l=()=>{this.#n=null,this.#r=null,LE(this),this.dispatchEvent(new CustomEvent(`plot-pointer-leave`,{bubbles:!0,composed:!0}))},this.#u=e=>{this.clickPauses&&(this.paused=!this.paused);let n=this.#a(e.clientX,this.getBoundingClientRect());n<0||this.dispatchEvent(new CustomEvent(`plot-datapoint-click`,{detail:{value:this.#e.values[n],index:n},bubbles:!0,composed:!0}))}}#e;#t;#n;#r;#i(e){return e?e.trim().split(/[,\s;]+/).map(e=>Number.parseFloat(e)).filter(e=>!Number.isNaN(e)):[]}add(e,n=!1){this.#t=!0,this.#e.add(e),!this.paused&&(n||this.redraw())}redraw(){this.requestUpdate(),this.#s()}set(e,n=!1){this.#t=!0,this.#e.set(e),!this.paused&&(n||this.redraw())}clear(){let e=this.#e.clear();return this.requestUpdate(),e}firstUpdated(e){if(this._width=this.clientWidth||100,this._height=this.clientHeight||40,new ResizeObserver(e=>{let n=e[0];this._width=n.contentRect.width,this._height=n.contentRect.height}).observe(this),!this.#t){let e=this.#i(this.textContent??``);e.length>0&&this.#e.set(e)}}updated(e){if(e.has(`capacity`)||e.has(`persistentScale`)||e.has(`rangeMin`)||e.has(`rangeMax`)){let e=[...this.#e.values],n=!Number.isNaN(this.rangeMin)&&!Number.isNaN(this.rangeMax)?{min:this.rangeMin,max:this.rangeMax}:null;this.#e=new EE({capacityLimit:this.capacity,persistentScaling:this.persistentScale,fixedRange:n}),e.length>0&&this.#e.set(e)}}#a(e,n){let r=this.#e.values.length;if(r===0)return-1;let i=e-n.left;if(i<0||i>n.width)return-1;let a=n.height<20?0:Math.min(4,n.height*.05),o=n.width-a*2,s=Math.floor((i-a)/(o/r));return s>=0&&s<r?s:-1}#o(e,n){if(!this.tooltips)return;let r=this.getBoundingClientRect(),i=this.#a(e,r);if(i<0){LE(this);return}FE(this,e,n,this.valueFormat(this.#e.values[i]))}#s(){this.#n!==null&&this.#r!==null&&this.#o(this.#n,this.#r)}#c;#l;#u;#d(e,n,r,i,a,o){let s=e.length,c=s>0?a/s:a,l=e=>i+(e+.5)*c;return e.map((e,a)=>{let c=
|
|
10917
|
+
/>`})}let iD=class extends n{constructor(...e){super(...e),this.drawStyle=`line-sharp`,this.ageStyle=`none`,this.title=``,this.precise=!1,this.tooltips=!0,this.capacity=100,this.rangeMin=NaN,this.rangeMax=NaN,this.persistentScale=!0,this.paused=!1,this.clickPauses=!1,this.shaded=!1,this.areaColor=``,this.colorMode=`fixed`,this.colorEasing=``,this.colorScale=``,this.colorValueMap=null,this._width=100,this._height=40,this.#e=new EE,this.#t=!1,this.#n=null,this.#r=null,this.valueFormat=e=>e?e.toFixed(2):``,this.#c=e=>{this.#n=e.clientX,this.#r=e.clientY,this.#o(e.clientX,e.clientY);let n=this.#a(e.clientX,this.getBoundingClientRect());this.dispatchEvent(new CustomEvent(`plot-pointer-move`,{detail:{clientX:e.clientX,clientY:e.clientY,index:n},bubbles:!0,composed:!0}))},this.#l=()=>{this.#n=null,this.#r=null,LE(this),this.dispatchEvent(new CustomEvent(`plot-pointer-leave`,{bubbles:!0,composed:!0}))},this.#u=e=>{this.clickPauses&&(this.paused=!this.paused);let n=this.#a(e.clientX,this.getBoundingClientRect());n<0||this.dispatchEvent(new CustomEvent(`plot-datapoint-click`,{detail:{value:this.#e.values[n],index:n},bubbles:!0,composed:!0}))}}#e;#t;#n;#r;#i(e){return e?e.trim().split(/[,\s;]+/).map(e=>Number.parseFloat(e)).filter(e=>!Number.isNaN(e)):[]}add(e,n=!1){this.#t=!0,this.#e.add(e),!this.paused&&(n||this.redraw())}redraw(){this.requestUpdate(),this.#s()}set(e,n=!1){this.#t=!0,this.#e.set(e),!this.paused&&(n||this.redraw())}clear(){let e=this.#e.clear();return this.requestUpdate(),e}firstUpdated(e){if(this._width=this.clientWidth||100,this._height=this.clientHeight||40,new ResizeObserver(e=>{let n=e[0];this._width=n.contentRect.width,this._height=n.contentRect.height}).observe(this),!this.#t){let e=this.#i(this.textContent??``);e.length>0&&this.#e.set(e)}}updated(e){if(e.has(`capacity`)||e.has(`persistentScale`)||e.has(`rangeMin`)||e.has(`rangeMax`)){let e=[...this.#e.values],n=!Number.isNaN(this.rangeMin)&&!Number.isNaN(this.rangeMax)?{min:this.rangeMin,max:this.rangeMax}:null;this.#e=new EE({capacityLimit:this.capacity,persistentScaling:this.persistentScale,fixedRange:n}),e.length>0&&this.#e.set(e)}}#a(e,n){let r=this.#e.values.length;if(r===0)return-1;let i=e-n.left;if(i<0||i>n.width)return-1;let a=n.height<20?0:Math.min(4,n.height*.05),o=n.width-a*2,s=Math.floor((i-a)/(o/r));return s>=0&&s<r?s:-1}#o(e,n){if(!this.tooltips)return;let r=this.getBoundingClientRect(),i=this.#a(e,r);if(i<0){LE(this);return}FE(this,e,n,this.valueFormat(this.#e.values[i]))}#s(){this.#n!==null&&this.#r!==null&&this.#o(this.#n,this.#r)}#c;#l;#u;#d(e,n,r,i,a,o){let s=e.length,c=s>0?a/s:a,l=e=>i+(e+.5)*c;return e.map((e,a)=>{let c=ri(GE(e,n,r)),u=s>1?a/(s-1):1;return{x:l(a),y:i+(1-c)*o,value:e,scaledValue:c,index:a,ageFraction:u}})}get series(){return this.#e}get values(){return this.#e.values}get dataLength(){return this.#e.values.length}getValueAt(e){return this.#e.values[e]}getIndexFromClientX(e){return this.#a(e,this.getBoundingClientRect())}#f(e,n,r,i,a,o,s,c){let l=n.at(-1)??{fill:`currentColor`,opacity:1},u=(this.drawStyle===`line-sharp`||this.drawStyle===`line-round`)&&this.shaded,d=this.areaColor||void 0;if(u)return[XE(e,l,o,d),this.drawStyle===`line-sharp`?YE(e,l,r,!1):YE(e,l,r,!0)];switch(this.drawStyle){case`line-sharp`:return[YE(e,l,r,!1)];case`line-round`:return[YE(e,l,r,!0)];case`circles`:return ZE(e,n,i,this.ageStyle);case`squares`:return QE(e,n,i*2,this.ageStyle);case`vbar`:return $E(e,n,r,o,this.ageStyle);case`hbar`:return eD(e,n,r,a,this.ageStyle);case`hist-bottom`:return tD(e,n,a,o,this.ageStyle);case`hist-top`:return nD(e,n,a,s,this.ageStyle);case`hist-middle`:return rD(e,n,a,c,this.ageStyle);default:return[]}}render(){let{values:e,range:n}=this.#e,r=this._width,a=this._height,o=a<20?0:Math.min(4,a*.05),c=Math.max(1,r-o*2),l=Math.max(1,a-o*2),u=o+l,d=o,f=o+l/2,p=UE(r,a),m=WE(r,a,e.length),h=e.length>0?Math.max(1,c/e.length*.85):c,g=`var(--plot-text, var(--surface-2-text, #fff))`,_=e.length>0?this.#d(e,n.min,n.max,o,c,l):[],v=_.length>0?bE(this):``,y={mode:this.colorMode,palette:xE(this.colorScale),easingName:this.colorEasing,valueMap:this.colorValueMap},b=this.drawStyle!==`line-sharp`&&this.drawStyle!==`line-round`,x=_.map(e=>{let n=wE(e.scaledValue,v,y);return b?TE(n,e.ageFraction,this.ageStyle):n}),S=_.length>0?this.#f(_,x,p,m,h,u,d,f):[],ee=this.title?s`<text
|
|
10912
10918
|
x=${o+2} y=${d+Math.min(10,a*.6)}
|
|
10913
10919
|
class="overlay-text"
|
|
10914
10920
|
fill=${g}
|
|
@@ -10999,7 +11005,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
10999
11005
|
dominant-baseline: hanging;
|
|
11000
11006
|
pointer-events: none;
|
|
11001
11007
|
}
|
|
11002
|
-
`}};E([d({attribute:`draw-style`})],aD.prototype,`drawStyle`,void 0),E([d({attribute:`age-style`})],aD.prototype,`ageStyle`,void 0),E([d()],aD.prototype,`title`,void 0),E([d({type:Boolean})],aD.prototype,`precise`,void 0),E([d({type:Boolean})],aD.prototype,`tooltips`,void 0),E([d({type:Number})],aD.prototype,`capacity`,void 0),E([d({type:Boolean,attribute:`persistent-scale`})],aD.prototype,`persistentScale`,void 0),E([d({type:Boolean,reflect:!0})],aD.prototype,`paused`,void 0),E([d({type:Boolean,attribute:`click-pauses`})],aD.prototype,`clickPauses`,void 0),E([d({attribute:`color-mode`})],aD.prototype,`colorMode`,void 0),E([d({attribute:`color-easing`})],aD.prototype,`colorEasing`,void 0),E([d({attribute:`color-scale`})],aD.prototype,`colorScale`,void 0),E([m()],aD.prototype,`_width`,void 0),E([m()],aD.prototype,`_height`,void 0),aD=E([T(`ixfx-plot-xy-axis`)],aD);const oD=Math.PI/180,sD=180/Math.PI;function cD(e,n){let r=n*50;return{x:50+Math.cos(e)*r,y:50+Math.sin(e)*r}}function lD(e,n){let r=e-50,i=n-50,a=Math.sqrt(r*r+i*i),o=Math.min(1,a/50);return{angleRad:(Math.atan2(i,r)%(2*Math.PI)+2*Math.PI)%(2*Math.PI),radius:o}}const uD=e=>Math.max(0,Math.min(1,e));function dD(e,n,r,i){if(r<=0||!i)return e;let a=360/r,o=(e%360+360)%360,s=Math.round(o/a)*a,c=o%a;if(Math.abs(c)<1e-4||Math.abs(a-c)<1e-4){let r=e-n;return r>180&&(r-=360),r<-180&&(r+=360),(s+(r>=0?1:-1)*a+360)%360}return s}function fD(e,n,r,i){if(r<=0||!i)return e;let a=1/r,o=Math.round(e/a)*a,s=e%a;return Math.abs(s)<1e-4||Math.abs(a-s)<1e-4?Math.max(0,Math.min(1,o+(e>=n?1:-1)*a)):o}function pD(e,n){if(!n||n<=1)return e;let r=360/n,i=(e%360+360)%360;return Math.round(i/r)*r}function mD(e,n){if(!n||n<=1)return e;let r=1/n;return Math.round(e/r)*r}let hD=class extends qy(n){constructor(...e){super(...e),this.angle=0,this.radius=.5,this.rings=0,this.rays=0,this.showRay=!1,this.showOrigin=!1,this.hideCursor=!1,this.snapValue=!1,this.disabled=!1,this._dragging=!1,this._dragStartAngle=0,this._dragStartRadius=0,this._pressedKeys=new Set,this._prevAngle=0,this._prevRadius=0,this._onPointerDown=e=>{e.preventDefault(),this.renderRoot.querySelector(`svg`)?.focus();let n=this.renderRoot.querySelector(`.polar-pad-area`);n&&n.setPointerCapture(e.pointerId),this._dragging=!0,this._dragStartAngle=this.angle,this._dragStartRadius=this.radius,this.setAttribute(`dragging`,``),this._updateFromPointer(e),globalThis.addEventListener(`pointermove`,this._onPointerMove),globalThis.addEventListener(`pointerup`,this._onPointerUp)},this._onPointerMove=e=>{this._dragging&&(e.preventDefault(),this._updateFromPointer(e))},this._onPointerUp=()=>{let e=this.angle!==this._dragStartAngle||this.radius!==this._dragStartRadius;this._dragging=!1,this.removeAttribute(`dragging`),globalThis.removeEventListener(`pointermove`,this._onPointerMove),globalThis.removeEventListener(`pointerup`,this._onPointerUp),e&&this.dispatchEvent(new CustomEvent(`change`,{detail:{angle:this.angle,radius:this.radius},bubbles:!0,composed:!0}))},this._onKeyDown=e=>{if(!this.disabled){if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))e.preventDefault(),this._pressedKeys.add(e.key),this._handleKeyboardMove(e.shiftKey);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let n=e.key===`Home`?0:1;n!==this.radius&&(this._prevRadius=this.radius,this.radius=n,this.dispatchEvent(new CustomEvent(`input`,{detail:{angle:this.angle,radius:this.radius},bubbles:!0,composed:!0})))}}},this._onKeyUp=e=>{this._pressedKeys.delete(e.key)},this._handleKeyboardMove=e=>{let n=this.stopsAngle??this.stops,r=this.stopsRadius??this.stops,i=Ky(360,n,this.stepAngle,e),a=Ky(1,r,this.stepRadius,e);this._prevAngle=this.angle,this._prevRadius=this.radius;let o=this.angle,s=this.radius;this._pressedKeys.has(`ArrowLeft`)&&(o-=i),this._pressedKeys.has(`ArrowRight`)&&(o+=i),this._pressedKeys.has(`ArrowUp`)&&(s=Math.min(1,s+a)),this._pressedKeys.has(`ArrowDown`)&&(s=Math.max(0,s-a)),o=(o%360+360)%360;let c=dD(o,this._prevAngle,this.rays,this.snapValue),l=fD(s,this._prevRadius,this.rings,this.snapValue);c=pD(c,n),l=mD(l,r),(c!==this.angle||l!==this.radius)&&(this.angle=c,this.radius=l,this.dispatchEvent(new CustomEvent(`input`,{detail:{angle:this.angle,radius:this.radius},bubbles:!0,composed:!0})))},this._uid=Math.random().toString(36).slice(2,8)}static{this.styles=[
|
|
11008
|
+
`}};E([d({attribute:`draw-style`})],aD.prototype,`drawStyle`,void 0),E([d({attribute:`age-style`})],aD.prototype,`ageStyle`,void 0),E([d()],aD.prototype,`title`,void 0),E([d({type:Boolean})],aD.prototype,`precise`,void 0),E([d({type:Boolean})],aD.prototype,`tooltips`,void 0),E([d({type:Number})],aD.prototype,`capacity`,void 0),E([d({type:Boolean,attribute:`persistent-scale`})],aD.prototype,`persistentScale`,void 0),E([d({type:Boolean,reflect:!0})],aD.prototype,`paused`,void 0),E([d({type:Boolean,attribute:`click-pauses`})],aD.prototype,`clickPauses`,void 0),E([d({attribute:`color-mode`})],aD.prototype,`colorMode`,void 0),E([d({attribute:`color-easing`})],aD.prototype,`colorEasing`,void 0),E([d({attribute:`color-scale`})],aD.prototype,`colorScale`,void 0),E([m()],aD.prototype,`_width`,void 0),E([m()],aD.prototype,`_height`,void 0),aD=E([T(`ixfx-plot-xy-axis`)],aD);const oD=Math.PI/180,sD=180/Math.PI;function cD(e,n){let r=n*50;return{x:50+Math.cos(e)*r,y:50+Math.sin(e)*r}}function lD(e,n){let r=e-50,i=n-50,a=Math.sqrt(r*r+i*i),o=Math.min(1,a/50);return{angleRad:(Math.atan2(i,r)%(2*Math.PI)+2*Math.PI)%(2*Math.PI),radius:o}}const uD=e=>Math.max(0,Math.min(1,e));function dD(e,n,r,i){if(r<=0||!i)return e;let a=360/r,o=(e%360+360)%360,s=Math.round(o/a)*a,c=o%a;if(Math.abs(c)<1e-4||Math.abs(a-c)<1e-4){let r=e-n;return r>180&&(r-=360),r<-180&&(r+=360),(s+(r>=0?1:-1)*a+360)%360}return s}function fD(e,n,r,i){if(r<=0||!i)return e;let a=1/r,o=Math.round(e/a)*a,s=e%a;return Math.abs(s)<1e-4||Math.abs(a-s)<1e-4?Math.max(0,Math.min(1,o+(e>=n?1:-1)*a)):o}function pD(e,n){if(!n||n<=1)return e;let r=360/n,i=(e%360+360)%360;return Math.round(i/r)*r}function mD(e,n){if(!n||n<=1)return e;let r=1/n;return Math.round(e/r)*r}let hD=class extends qy(n){constructor(...e){super(...e),this.angle=0,this.radius=.5,this.rings=0,this.rays=0,this.showRay=!1,this.showOrigin=!1,this.hideCursor=!1,this.snapValue=!1,this.disabled=!1,this._dragging=!1,this._dragStartAngle=0,this._dragStartRadius=0,this._pressedKeys=new Set,this._prevAngle=0,this._prevRadius=0,this._onPointerDown=e=>{e.preventDefault(),this.renderRoot.querySelector(`svg`)?.focus();let n=this.renderRoot.querySelector(`.polar-pad-area`);n&&n.setPointerCapture(e.pointerId),this._dragging=!0,this._dragStartAngle=this.angle,this._dragStartRadius=this.radius,this.setAttribute(`dragging`,``),this._updateFromPointer(e),globalThis.addEventListener(`pointermove`,this._onPointerMove),globalThis.addEventListener(`pointerup`,this._onPointerUp)},this._onPointerMove=e=>{this._dragging&&(e.preventDefault(),this._updateFromPointer(e))},this._onPointerUp=()=>{let e=this.angle!==this._dragStartAngle||this.radius!==this._dragStartRadius;this._dragging=!1,this.removeAttribute(`dragging`),globalThis.removeEventListener(`pointermove`,this._onPointerMove),globalThis.removeEventListener(`pointerup`,this._onPointerUp),e&&this.dispatchEvent(new CustomEvent(`change`,{detail:{angle:this.angle,radius:this.radius},bubbles:!0,composed:!0}))},this._onKeyDown=e=>{if(!this.disabled){if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))e.preventDefault(),this._pressedKeys.add(e.key),this._handleKeyboardMove(e.shiftKey);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let n=e.key===`Home`?0:1;n!==this.radius&&(this._prevRadius=this.radius,this.radius=n,this.dispatchEvent(new CustomEvent(`input`,{detail:{angle:this.angle,radius:this.radius},bubbles:!0,composed:!0})))}}},this._onKeyUp=e=>{this._pressedKeys.delete(e.key)},this._handleKeyboardMove=e=>{let n=this.stopsAngle??this.stops,r=this.stopsRadius??this.stops,i=Ky(360,n,this.stepAngle,e),a=Ky(1,r,this.stepRadius,e);this._prevAngle=this.angle,this._prevRadius=this.radius;let o=this.angle,s=this.radius;this._pressedKeys.has(`ArrowLeft`)&&(o-=i),this._pressedKeys.has(`ArrowRight`)&&(o+=i),this._pressedKeys.has(`ArrowUp`)&&(s=Math.min(1,s+a)),this._pressedKeys.has(`ArrowDown`)&&(s=Math.max(0,s-a)),o=(o%360+360)%360;let c=dD(o,this._prevAngle,this.rays,this.snapValue),l=fD(s,this._prevRadius,this.rings,this.snapValue);c=pD(c,n),l=mD(l,r),(c!==this.angle||l!==this.radius)&&(this.angle=c,this.radius=l,this.dispatchEvent(new CustomEvent(`input`,{detail:{angle:this.angle,radius:this.radius},bubbles:!0,composed:!0})))},this._uid=Math.random().toString(36).slice(2,8)}static{this.styles=[sn,w,r`
|
|
11003
11009
|
:host {
|
|
11004
11010
|
display: block;
|
|
11005
11011
|
width: 200px;
|
|
@@ -11568,14 +11574,14 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
11568
11574
|
:host([swipeable][orientation="vertical"]):hover .range-bg {
|
|
11569
11575
|
background: var(--background-track-hover-vertical, var(--_bg-track-hover));
|
|
11570
11576
|
}
|
|
11571
|
-
`]}};E([d({type:Number})],vD.prototype,`min`,void 0),E([d({type:Number})],vD.prototype,`max`,void 0),E([d({type:Number})],vD.prototype,`value`,void 0),E([d({type:Number})],vD.prototype,`step`,void 0),E([d({type:String,reflect:!0})],vD.prototype,`orientation`,void 0),E([d({type:Boolean,reflect:!0})],vD.prototype,`swipeable`,void 0),E([d({type:Boolean})],vD.prototype,`tooltip`,void 0),E([d({type:String,attribute:`tooltip-orientation`})],vD.prototype,`tooltipOrientation`,void 0),E([d({attribute:!1})],vD.prototype,`labelFormatter`,void 0),E([f(`input`)],vD.prototype,`_inputEl`,void 0),E([f(`ixfx-tooltip`)],vD.prototype,`_tooltipEl`,void 0),vD=E([T(`ixfx-range-input`)],vD);function yD(e){return{client:{x:e.clientX,y:e.clientY},offset:{x:e.offsetX,y:e.offsetY}}}function bD(e,n){let r=yD(e),i=e=>{n.progress(yD(e),r)},a=e=>{document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,a),n.complete(yD(e),r)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,a)}function xD(e,n){let r=e-n,i=e+n;return e=>e>=r&&e<=i}let SD=class extends n{constructor(...e){super(...e),this.tooltip=!0,this.tooltipOrientation=`top`,this.crossover=`allow`,this.resizeMode=`dual`,this.orientation=`horizontal`,this.step=1,this.a=0,this.b=50,this.#e=100,this.#t=0,this.#n=e=>e,this.#r=e=>e,this.#i=e=>e,this.draggingThumb=`none`}#e;#t;#n;#r;#i;#a(){this.#n=
|
|
11577
|
+
`]}};E([d({type:Number})],vD.prototype,`min`,void 0),E([d({type:Number})],vD.prototype,`max`,void 0),E([d({type:Number})],vD.prototype,`value`,void 0),E([d({type:Number})],vD.prototype,`step`,void 0),E([d({type:String,reflect:!0})],vD.prototype,`orientation`,void 0),E([d({type:Boolean,reflect:!0})],vD.prototype,`swipeable`,void 0),E([d({type:Boolean})],vD.prototype,`tooltip`,void 0),E([d({type:String,attribute:`tooltip-orientation`})],vD.prototype,`tooltipOrientation`,void 0),E([d({attribute:!1})],vD.prototype,`labelFormatter`,void 0),E([f(`input`)],vD.prototype,`_inputEl`,void 0),E([f(`ixfx-tooltip`)],vD.prototype,`_tooltipEl`,void 0),vD=E([T(`ixfx-range-input`)],vD);function yD(e){return{client:{x:e.clientX,y:e.clientY},offset:{x:e.offsetX,y:e.offsetY}}}function bD(e,n){let r=yD(e),i=e=>{n.progress(yD(e),r)},a=e=>{document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,a),n.complete(yD(e),r)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,a)}function xD(e,n){let r=e-n,i=e+n;return e=>e>=r&&e<=i}let SD=class extends n{constructor(...e){super(...e),this.tooltip=!0,this.tooltipOrientation=`top`,this.crossover=`allow`,this.resizeMode=`dual`,this.orientation=`horizontal`,this.step=1,this.a=0,this.b=50,this.#e=100,this.#t=0,this.#n=e=>e,this.#r=e=>e,this.#i=e=>e,this.draggingThumb=`none`}#e;#t;#n;#r;#i;#a(){this.#n=di(this.#t,this.#e,0,100),this.#r=di(0,100,this.#t,this.#e),this.#i=ii(this.#t,this.#e),this.a=this.#i(this.a),this.b=this.#i(this.b)}set max(e){this.#e=e,this.#a()}get max(){return this.#e}set min(e){this.#t=e,this.#a()}get min(){return this.#t}_onInput(e){e.stopPropagation();let n=e.target,r=this.#r(n.valueAsNumber),i=n.id,a=this.a,o=this.b;if(this.resizeMode===`none`){let e=r-(i===`a`?this.a:this.b),s=this.a+e,c=this.b+e;if(s<this.min&&(e=this.min-this.a),c>this.max&&(e=this.max-this.b),e===0){n.valueAsNumber=this.#n(i===`a`?this.a:this.b);return}a=this.a+e,o=this.b+e}else if(this.resizeMode===`bipolar`){let e,s;if(i===`a`){let n=r-this.a;e=r,s=this.b-n}else{let n=r-this.b;e=this.a-n,s=r}if(e<this.min||s>this.max||e>this.max||s<this.min){n.valueAsNumber=this.#n(i===`a`?this.a:this.b);return}a=e,o=s}else if(this.resizeMode===`bipolar-flex`){let e,s;if(i===`a`){if(e=r,this.b<=this.min)s=this.min;else if(this.b>=this.max)s=this.max;else{let e=r-this.a;s=this.b-e}}else if(s=r,this.a<=this.min)e=this.min;else if(this.a>=this.max)e=this.max;else{let n=r-this.b;e=this.a-n}if(e<this.min&&(e=this.min),e>this.max&&(e=this.max),s<this.min&&(s=this.min),s>this.max&&(s=this.max),e>s){n.valueAsNumber=this.#n(i===`a`?this.a:this.b);return}a=e,o=s}else if(i===`a`)r>this.b&&this.crossover===`stop`?n.valueAsNumber=this.#n(this.a):a=r;else if(i===`b`)r<a&&this.crossover===`stop`?n.valueAsNumber=this.#n(this.b):o=r;else throw Error(`Expected 'a' or 'b', got: '${n.id}'`);this.setPoles(a,o)}setPoles(e,n){let r=e!==this.a,i=n!==this.b;this.a=this.#i(e),this.b=this.#i(n),this.dispatchEvent(new CustomEvent(`input`,{detail:{a:this.a,b:this.b,changed:r&&i?`both`:r?`a`:`b`}}))}_onPointerDown(e){let n=this.a,r=this.b;this.valuesAtPointerDown={a:n,b:r};let i=e.target.getBoundingClientRect(),a=this.orientation===`vertical`,o=a?i.height:i.width,s=o/(this.max-this.min),c=a?e.offsetY:e.offsetX,l=e=>a?this.max-e*s:e*s,u=e=>a?o-e*s:e*s,d=u(n),f=u(r);if(a?(this.b<this.a?c>f:c<f)||(this.b<this.a?c<d:c>d):this.b<this.a&&c<f||this.b>this.a&&c>f||this.a<this.b&&c<d||this.a>this.b&&c>d){if(this.resizeMode===`none`||this.resizeMode===`bipolar`||this.resizeMode===`bipolar-flex`){let e=l(c)-this.b;this.a+e<this.min&&(e=this.min-this.a),this.b+e>this.max&&(e=this.max-this.b);let n=this.a+e,r=this.b+e;n>=this.min&&r<=this.max&&this.setPoles(n,r)}else this.b=l(c);return}let p=xD(d,10),m=xD(f,10),h=i=>{let o=this.setPoles.bind(this),c=this.resizeMode,u=this.min,p=this.max,m=a?e.offsetY:e.offsetX,h=!1;bD(e,{progress(e,l){let d=a?e.offset.y:e.offset.x,f=(a?m-d:d-m)/s;if(h=!0,i===`a`){if(c===`bipolar`){let e=n+f,i=r-f;if(e<u||i>p||e>p||i<u)return;o(e,i)}else if(c===`bipolar-flex`){let e=n+f,i=r;if(r<=u?i=u:r>=p?i=p:(e=n+f,i=r-f),e<u&&(e=u),e>p&&(e=p),i<u&&(i=u),i>p&&(i=p),e>i)return;o(e,i)}else{let e=f;n+f<u&&(e=u-n),r+e>p&&(e=p-r);let i=n+e,a=r+e;i>=u&&a<=p&&o(i,a)}}else if(i===`b`){if(c===`bipolar`){let e=n-f,i=r+f;if(e<u||i>p||e>p||i<u)return;o(e,i)}else if(c===`bipolar-flex`){let e=n,i=r+f;if(n<=u?e=u:n>=p?e=p:(e=n-f,i=r+f),e<u&&(e=u),e>p&&(e=p),i<u&&(i=u),i>p&&(i=p),e>i)return;o(e,i)}else{let e=f;n+f<u&&(e=u-n),r+e>p&&(e=p-r);let i=n+e,a=r+e;i>=u&&a<=p&&o(i,a)}}else if(c===`bipolar`){let e=n+f,i=r+f;if(e<u||i>p)return;o(e,i)}else if(c===`bipolar-flex`){let e=n+f,i=r+f;if(e<u?(e=u,i=u+(r-n)):i>p&&(i=p,e=p-(r-n)),e<u||i>p||e>i)return;o(e,i)}else{let e=f;n+f<u&&(e=u-n),r+e>p&&(e=p-r);let i=n+e,a=r+e;i>=u&&a<=p&&o(i,a)}},complete(i,s){if(!h){let i=a?e.offsetY:e.offsetX;Math.abs(i-d)<Math.abs(i-f)?o(l(i),r):o(n,l(i))}}})};if(p(c)){if(this.draggingThumb=`a`,this.resizeMode===`dual`)return!1;e.preventDefault(),e.target.setPointerCapture(e.pointerId),h(`a`);return}if(m(c)){if(this.draggingThumb=`b`,this.resizeMode===`dual`)return!1;e.preventDefault(),e.target.setPointerCapture(e.pointerId),h(`b`);return}this.draggingThumb=`none`,e.preventDefault(),e.target.setPointerCapture(e.pointerId),h(`none`)}firstUpdated(e){this.#a()}render(){let e=this.tooltip?i`<ixfx-tooltip style="--tooltip-background: var(--surface-5); --tooltip-color: var(--surface-5-text)" anchor="--a-tooltip" .orientation=${this.tooltipOrientation} .value=${this.a}></ixfx-tooltip>`:a,n=this.tooltip?i`<ixfx-tooltip style="--tooltip-background: var(--surface-5); --tooltip-color: var(--surface-5-text)" anchor="--b-tooltip" .orientation=${this.tooltipOrientation} .value=${this.b}></ixfx-tooltip>`:a,r=this.#n(this.a),o=this.#n(this.b),s=this.orientation===`vertical`?`writing-mode: vertical-lr; direction: rtl;`:a;return i`
|
|
11572
11578
|
<div @pointerdown=${this._onPointerDown} @input=${this._onInput} style="--a: ${r}; --b: ${o}">
|
|
11573
11579
|
<input class="thumb-round" .value=${r} id="a" step=${this.step} type="range" style="${s}" anchor="--a-tooltip" />
|
|
11574
11580
|
${e}
|
|
11575
11581
|
|
|
11576
11582
|
<input class="thumb-round" .value=${o} id="b" step=${this.step} type="range" style="${s}" anchor="--b-tooltip" />
|
|
11577
11583
|
${n}
|
|
11578
|
-
</div>`}static{this.styles=[w,gD,
|
|
11584
|
+
</div>`}static{this.styles=[w,gD,sn,r`
|
|
11579
11585
|
:host {
|
|
11580
11586
|
display: grid;
|
|
11581
11587
|
--value-label-color: unset;
|
|
@@ -11727,7 +11733,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
11727
11733
|
.value=${this.value}></ixfx-tooltip>`:a,n=this.orientation===`vertical`?`writing-mode: vertical-lr; direction: rtl;`:a;return i`
|
|
11728
11734
|
<input ?disabled=${this.disabled} step=${this.step} min=${this.min} max=${this.max} value=${this.value} @input=${this.onRangeInput} type="range" style=${n}>
|
|
11729
11735
|
${e}
|
|
11730
|
-
`}static{this.styles=[w,
|
|
11736
|
+
`}static{this.styles=[w,sn,gD,r`
|
|
11731
11737
|
:host {
|
|
11732
11738
|
display: inline-block;
|
|
11733
11739
|
--value-label-color: unset;
|
|
@@ -11786,7 +11792,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
11786
11792
|
[type="range"]:focus {
|
|
11787
11793
|
outline: none;
|
|
11788
11794
|
}
|
|
11789
|
-
`]}};E([d({type:Boolean})],CD.prototype,`tooltip`,void 0),E([d({type:String,attribute:`tooltip-orientation`})],CD.prototype,`tooltipOrientation`,void 0),E([d({type:String,reflect:!0})],CD.prototype,`orientation`,void 0),E([d({type:Boolean,attribute:!0})],CD.prototype,`disabled`,void 0),E([d({type:Number})],CD.prototype,`min`,void 0),E([d({type:Number})],CD.prototype,`max`,void 0),E([d({type:Number})],CD.prototype,`value`,null),E([d({type:Number})],CD.prototype,`step`,void 0),CD=E([T(`ixfx-range`)],CD);let wD=class extends n{constructor(...e){super(...e),this.value=0,this.max=5,this.allowHalf=!1,this.disabled=!1,this.readonly=!1,this.variant=`star`,this._preview=null}static{this.styles=[
|
|
11795
|
+
`]}};E([d({type:Boolean})],CD.prototype,`tooltip`,void 0),E([d({type:String,attribute:`tooltip-orientation`})],CD.prototype,`tooltipOrientation`,void 0),E([d({type:String,reflect:!0})],CD.prototype,`orientation`,void 0),E([d({type:Boolean,attribute:!0})],CD.prototype,`disabled`,void 0),E([d({type:Number})],CD.prototype,`min`,void 0),E([d({type:Number})],CD.prototype,`max`,void 0),E([d({type:Number})],CD.prototype,`value`,null),E([d({type:Number})],CD.prototype,`step`,void 0),CD=E([T(`ixfx-range`)],CD);let wD=class extends n{constructor(...e){super(...e),this.value=0,this.max=5,this.allowHalf=!1,this.disabled=!1,this.readonly=!1,this.variant=`star`,this._preview=null}static{this.styles=[sn,r`
|
|
11790
11796
|
:host {
|
|
11791
11797
|
--ixfx-rating-size: 1.5rem;
|
|
11792
11798
|
--ixfx-rating-gap: 0.2rem;
|
|
@@ -11824,7 +11830,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
11824
11830
|
@click=${e=>this._commit(this._calc(e,a))}>
|
|
11825
11831
|
<svg viewBox="0 0 24 24" class="bg" fill="currentColor"><path d=${d}></path></svg>
|
|
11826
11832
|
${s||c?i`<svg viewBox="0 0 24 24" class="fill" fill="currentColor"><path d=${d}></path></svg>`:``}
|
|
11827
|
-
</span>`})}`}firstUpdated(){this.addEventListener(`pointerleave`,()=>this._preview=null),this.addEventListener(`keydown`,e=>{if(this.disabled||this.readonly)return;let n=this.allowHalf?.5:1;if(e.key===`ArrowRight`||e.key===`ArrowUp`)e.preventDefault(),this._commit(Math.min(this.max,this.value+n));else if(e.key===`ArrowLeft`||e.key===`ArrowDown`)e.preventDefault(),this._commit(Math.max(0,this.value-n));else if(e.key===`Home`)e.preventDefault(),this._commit(0);else if(e.key===`End`)e.preventDefault(),this._commit(this.max);else if(/^\d$/.test(e.key)){e.preventDefault();let n=parseInt(e.key,10);this._commit(Math.min(n,this.max))}})}};E([d({type:Number})],wD.prototype,`value`,void 0),E([d({type:Number})],wD.prototype,`max`,void 0),E([d({type:Boolean,attribute:`allow-half`})],wD.prototype,`allowHalf`,void 0),E([d({type:Boolean,reflect:!0})],wD.prototype,`disabled`,void 0),E([d({type:Boolean,reflect:!0})],wD.prototype,`readonly`,void 0),E([d({type:String})],wD.prototype,`variant`,void 0),E([m()],wD.prototype,`_preview`,void 0),wD=E([T(`ixfx-rating`)],wD);let TD=class extends qy(n){constructor(...e){super(...e),this._selectedIndex=-1,this._slottedItems=[],this.tickled=new oe(this,{getItems:()=>this._slottedItems.map((e,n)=>({id:n,enabled:!0})),onStateChange:()=>this._syncTickled()}),this._onSlotChange=()=>{this._slottedItems=Array.from(this.shadowRoot?.querySelector(`slot`)?.assignedElements()??[]);let e=this._slottedItems.findIndex(e=>e.hasAttribute(`selected`)),n=e>=0?e:this._selectedIndex;n>=this._slottedItems.length&&(n=this._slottedItems.length-1),n<0&&this._slottedItems.length>0&&(n=0),this.selectedIndex=n},this._syncTickled=()=>{this._slottedItems.forEach((e,n)=>{let r=this.tickled.isTickled(n);e.classList.toggle(`tickled`,r),e.tabIndex=r&&this.tickled.inputMode===`keyboard`?0:-1})},this._findSlottedItem=e=>{let n=e instanceof Element?e:null;for(;n;){if(this._slottedItems.includes(n))return n;n=n.parentElement}},this._handlePointerOver=e=>{let n=this._findSlottedItem(e.target);n&&this.tickled.handlePointerEnter(this._slottedItems.indexOf(n))},this._handleKeyDown=e=>{e.key===`ArrowLeft`?(e.preventDefault(),this.tickled.handleKeyboardNavigation(`previous`),this._applyTickledSelection()):e.key===`ArrowRight`?(e.preventDefault(),this.tickled.handleKeyboardNavigation(`next`),this._applyTickledSelection()):e.key===`Home`?(e.preventDefault(),this.tickled.handleKeyboardNavigation(`first`),this._applyTickledSelection()):e.key===`End`&&(e.preventDefault(),this.tickled.handleKeyboardNavigation(`last`),this._applyTickledSelection())},this._applyTickledSelection=()=>{let e=this.tickled.tickledId;e!==void 0&&e!==this._selectedIndex&&(this.selectedIndex=e)},this._wheelCooldown=!1,this._handleClick=e=>{e.currentTarget.focus();let n=this._findSlottedItem(e.target),r=n?this._slottedItems.indexOf(n):-1;r>=0&&r!==this._selectedIndex&&(this.selectedIndex=r)},this._updateSelectedAttribute=()=>{this._slottedItems.forEach((e,n)=>{n===this._selectedIndex?e.setAttribute(`selected`,``):e.removeAttribute(`selected`)})},this._scrollSelectedIntoView=()=>{let e=this._slottedItems[this._selectedIndex];e&&e.scrollIntoView({inline:`center`,behavior:`smooth`})},this._emitChange=()=>{this.dispatchEvent(new CustomEvent(`change`,{detail:{selectedIndex:this._selectedIndex,selectedItem:this.selectedItem,selectedValue:this.selectedValue},bubbles:!0,composed:!0}))}}static{this.styles=[w,se,C,
|
|
11833
|
+
</span>`})}`}firstUpdated(){this.addEventListener(`pointerleave`,()=>this._preview=null),this.addEventListener(`keydown`,e=>{if(this.disabled||this.readonly)return;let n=this.allowHalf?.5:1;if(e.key===`ArrowRight`||e.key===`ArrowUp`)e.preventDefault(),this._commit(Math.min(this.max,this.value+n));else if(e.key===`ArrowLeft`||e.key===`ArrowDown`)e.preventDefault(),this._commit(Math.max(0,this.value-n));else if(e.key===`Home`)e.preventDefault(),this._commit(0);else if(e.key===`End`)e.preventDefault(),this._commit(this.max);else if(/^\d$/.test(e.key)){e.preventDefault();let n=parseInt(e.key,10);this._commit(Math.min(n,this.max))}})}};E([d({type:Number})],wD.prototype,`value`,void 0),E([d({type:Number})],wD.prototype,`max`,void 0),E([d({type:Boolean,attribute:`allow-half`})],wD.prototype,`allowHalf`,void 0),E([d({type:Boolean,reflect:!0})],wD.prototype,`disabled`,void 0),E([d({type:Boolean,reflect:!0})],wD.prototype,`readonly`,void 0),E([d({type:String})],wD.prototype,`variant`,void 0),E([m()],wD.prototype,`_preview`,void 0),wD=E([T(`ixfx-rating`)],wD);let TD=class extends qy(n){constructor(...e){super(...e),this._selectedIndex=-1,this._slottedItems=[],this.tickled=new oe(this,{getItems:()=>this._slottedItems.map((e,n)=>({id:n,enabled:!0})),onStateChange:()=>this._syncTickled()}),this._onSlotChange=()=>{this._slottedItems=Array.from(this.shadowRoot?.querySelector(`slot`)?.assignedElements()??[]);let e=this._slottedItems.findIndex(e=>e.hasAttribute(`selected`)),n=e>=0?e:this._selectedIndex;n>=this._slottedItems.length&&(n=this._slottedItems.length-1),n<0&&this._slottedItems.length>0&&(n=0),this.selectedIndex=n},this._syncTickled=()=>{this._slottedItems.forEach((e,n)=>{let r=this.tickled.isTickled(n);e.classList.toggle(`tickled`,r),e.tabIndex=r&&this.tickled.inputMode===`keyboard`?0:-1})},this._findSlottedItem=e=>{let n=e instanceof Element?e:null;for(;n;){if(this._slottedItems.includes(n))return n;n=n.parentElement}},this._handlePointerOver=e=>{let n=this._findSlottedItem(e.target);n&&this.tickled.handlePointerEnter(this._slottedItems.indexOf(n))},this._handleKeyDown=e=>{e.key===`ArrowLeft`?(e.preventDefault(),this.tickled.handleKeyboardNavigation(`previous`),this._applyTickledSelection()):e.key===`ArrowRight`?(e.preventDefault(),this.tickled.handleKeyboardNavigation(`next`),this._applyTickledSelection()):e.key===`Home`?(e.preventDefault(),this.tickled.handleKeyboardNavigation(`first`),this._applyTickledSelection()):e.key===`End`&&(e.preventDefault(),this.tickled.handleKeyboardNavigation(`last`),this._applyTickledSelection())},this._applyTickledSelection=()=>{let e=this.tickled.tickledId;e!==void 0&&e!==this._selectedIndex&&(this.selectedIndex=e)},this._wheelCooldown=!1,this._handleClick=e=>{e.currentTarget.focus();let n=this._findSlottedItem(e.target),r=n?this._slottedItems.indexOf(n):-1;r>=0&&r!==this._selectedIndex&&(this.selectedIndex=r)},this._updateSelectedAttribute=()=>{this._slottedItems.forEach((e,n)=>{n===this._selectedIndex?e.setAttribute(`selected`,``):e.removeAttribute(`selected`)})},this._scrollSelectedIntoView=()=>{let e=this._slottedItems[this._selectedIndex];e&&e.scrollIntoView({inline:`center`,behavior:`smooth`})},this._emitChange=()=>{this.dispatchEvent(new CustomEvent(`change`,{detail:{selectedIndex:this._selectedIndex,selectedItem:this.selectedItem,selectedValue:this.selectedValue},bubbles:!0,composed:!0}))}}static{this.styles=[w,se,C,Mg(`x`),r`
|
|
11828
11834
|
:host {
|
|
11829
11835
|
--select-horiz-item-width: 80%;
|
|
11830
11836
|
--select-horiz-gap: var(--space-s);
|
|
@@ -11940,7 +11946,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
11940
11946
|
>
|
|
11941
11947
|
${this.display===`rectangle`?this.#_():this.#g()}
|
|
11942
11948
|
</svg>
|
|
11943
|
-
`}updated(e){super.updated(e),this.style.setProperty(`--shapefill-value-relative`,this.#o().toString())}disconnectedCallback(){super.disconnectedCallback(),this.#a!==void 0&&clearTimeout(this.#a),this.#p()}static{this.styles=[w,
|
|
11949
|
+
`}updated(e){super.updated(e),this.style.setProperty(`--shapefill-value-relative`,this.#o().toString())}disconnectedCallback(){super.disconnectedCallback(),this.#a!==void 0&&clearTimeout(this.#a),this.#p()}static{this.styles=[w,sn,r`
|
|
11944
11950
|
:host {
|
|
11945
11951
|
display: inline-block;
|
|
11946
11952
|
width: 2em;
|
|
@@ -12215,7 +12221,170 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12215
12221
|
>
|
|
12216
12222
|
<slot></slot>
|
|
12217
12223
|
</div>
|
|
12218
|
-
`}};E([d({type:String,attribute:`orientation`})],ID.prototype,`orientation`,void 0),E([d({type:Number,attribute:`snap-positions`})],ID.prototype,`snapPositions`,void 0),E([d({type:String,attribute:`snap-logic`})],ID.prototype,`snapLogic`,void 0),E([d({type:String,attribute:`click-snap`})],ID.prototype,`clickSnap`,void 0),E([d({type:Number})],ID.prototype,`snap`,void 0),E([m()],ID.prototype,`_dragging`,void 0),ID=E([T(`ixfx-snap-container`)],ID);
|
|
12224
|
+
`}};E([d({type:String,attribute:`orientation`})],ID.prototype,`orientation`,void 0),E([d({type:Number,attribute:`snap-positions`})],ID.prototype,`snapPositions`,void 0),E([d({type:String,attribute:`snap-logic`})],ID.prototype,`snapLogic`,void 0),E([d({type:String,attribute:`click-snap`})],ID.prototype,`clickSnap`,void 0),E([d({type:Number})],ID.prototype,`snap`,void 0),E([m()],ID.prototype,`_dragging`,void 0),ID=E([T(`ixfx-snap-container`)],ID);const LD=``,RD=e=>e.weight;function zD(e,n){return`${e}${n}`}function BD(e){return e.join(``)}function VD(e,n){return n.startsWith(`${e}`)}function HD(e){return e.split(``)}function UD(e){let n=e.lastIndexOf(``);return n<0?void 0:e.slice(0,n)}function WD(e,n){if(!e)return;let[r,...i]=HD(n);if(r!==e.item.key)return;let a=e;for(let e of i)if(a=a.children?.find(n=>n.item.key===e),!a)return;return a}function GD(e,n){if(!e)return;let r=(e,i)=>{if(n(e))return i;for(let n of e.children??[]){let e=r(n,zD(i,n.item.key));if(e!==void 0)return e}};return r(e,e.item.key)}function KD(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0}function qD(e){let n=new Map,r=i=>{let a=n.get(i);if(a!==void 0)return a;let o=KD(e(i.item,i));if(o===void 0){let e=i.children??[];o=e.length>0?e.reduce((e,n)=>e+r(n),0):1}return n.set(i,o),o};return r}function JD(e){return e.children===void 0?e.item.isLeaf!==!0:e.children.length>0}function YD(e,n={}){let r=new Map;if(!e)return r;let{valueAccessor:i=RD,maxDepth:a=1/0}=n,o=qD(i),s={id:e.item.key,node:e,parentId:void 0,depth:0,x0:0,x1:1,value:o(e),index:0,setSize:1,hasChildren:JD(e)};r.set(s.id,s);let c=[s];for(;c.length>0;){let e=[];for(let n of c){let i=n.node.children??[];if(i.length===0||n.depth+1>a)continue;let s=i.map(o),c=s.reduce((e,n)=>e+n,0),l=Math.max(n.value,c),u=n.x1-n.x0,d=n.x0;i.forEach((a,o)=>{let c=l>0?u*s[o]/l:0,f={id:zD(n.id,a.item.key),node:a,parentId:n.id,depth:n.depth+1,x0:d,x1:d+c,value:s[o],index:o,setSize:i.length,hasChildren:JD(a)};d+=c,r.set(f.id,f),e.push(f)})}c=e}return r}const XD=Math.PI*2,ZD=1-1e-6,QD=e=>Math.min(1,Math.max(0,e));function $D(e){return!e||e.x1-e.x0<=0?{x0:0,x1:1,depth:0}:{x0:e.x0,x1:e.x1,depth:e.depth}}function eO(e,n){let r=n.x1-n.x0;return{a0:QD((e.x0-n.x0)/r),a1:QD((e.x1-n.x0)/r),depth:e.depth-n.depth-1}}function tO(e,n){return e>=0?n.center+e*n.ring:Math.max(0,n.center*(1+e))}function nO(e,n){return{inner:tO(e,n),outer:tO(e+1,n)}}function rO(e,n,r){let i=Math.max(0,e),a=i*Math.min(.9,Math.max(0,r));return{center:a,ring:(i-a)/Math.max(1,n)}}function iO(e,n){let r=e*XD;return`${(n*Math.sin(r)).toFixed(2)} ${(-n*Math.cos(r)).toFixed(2)}`}function aO(e){let n=(e*2).toFixed(2);return`M0 ${(-e).toFixed(2)}a${e.toFixed(2)} ${e.toFixed(2)} 0 1 1 0 ${n}a${e.toFixed(2)} ${e.toFixed(2)} 0 1 1 0 -${n}Z`}function oO(e,n,r,i){let a=n-e;if(a<=0||i<=0||i<=r)return``;if(a>=ZD)return r>0?`${aO(i)}${aO(r)}`:aO(i);let o=+(a>.5),s=i.toFixed(2);if(r<=0)return`M0 0L${iO(e,i)}A${s} ${s} 0 ${o} 1 ${iO(n,i)}Z`;let c=r.toFixed(2);return`M${iO(e,i)}A${s} ${s} 0 ${o} 1 ${iO(n,i)}L${iO(n,r)}A${c} ${c} 0 ${o} 0 ${iO(e,r)}Z`}function sO(e,n,r){return Math.max(0,n-e)*XD*r}function cO(e,n,r,i){let a=Math.min(n,e+.9999),o=+(a-e>.5),s=r.toFixed(2);return i?`M${iO(a,r)}A${s} ${s} 0 ${o} 0 ${iO(e,r)}`:`M${iO(e,r)}A${s} ${s} 0 ${o} 1 ${iO(a,r)}`}function lO(e,n){return e.length<=n?e:`${e.slice(0,n-1)}…`}function uO(e,n,r,i,a={}){if(e.depth<0||n.length===0)return;let{inner:o,outer:s}=nO(e.depth,r),c=s-o,l=(o+s)/2,u=e.a1-e.a0,d=sO(e.a0,e.a1,l),f=i*.6,p=i*.5,m=(e.a0+e.a1)/2,h=m*360,g=h>90&&h<270,_=c>=i*1.3;if(a.curved&&_){let r=Math.floor((d-p)/f);if(r>=Math.min(n.length,4))return{kind:`curved`,path:u>=ZD?cO(.5,1.5,l,!1):cO(e.a0,e.a1,l,g),text:lO(n,r)}}let v=m*XD,y=l*Math.sin(v),b=-l*Math.cos(v);if(!a.curved&&_&&u<.5&&d>=n.length*f+p)return{kind:`straight`,x:y,y:b,rotate:h+(g?180:0),text:n};if(d<i*1.1)return;let x=Math.floor((c-p)/f);if(!(x<3))return{kind:`straight`,x:y,y:b,rotate:h-90+(h>180?180:0),text:lO(n,x)}}function dO(e,n,r){let i=new Map;for(let a of e.values()){if(a.depth<=n.depth)continue;if(a.parentId===r){let{a0:e,a1:r}=eO(a,n);i.set(a.id,(e+r)/2*360);continue}let e=a.parentId===void 0?void 0:i.get(a.parentId);e!==void 0&&i.set(a.id,e)}return i}function fO(e,n){return n<=1?0:(e+.5)/n-.5}function pO(e,n,r){if(e.length===0)return;let i=n===void 0?void 0:e.find(e=>e.id===n);if(r===`Home`)return e[0].id;if(r===`End`)return e.at(-1).id;if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(r)){if(!i)return e[0].id;switch(r){case`ArrowLeft`:case`ArrowRight`:{let n=e.filter(e=>e.parentId===i.parentId);return n[(n.findIndex(e=>e.id===i.id)+(r===`ArrowRight`?1:-1)+n.length)%n.length].id}case`ArrowUp`:return e.find(e=>e.id===i.parentId)?.id;default:return e.find(e=>e.parentId===i.id)?.id}}}const mO=r`
|
|
12225
|
+
:host {
|
|
12226
|
+
--sunbursttree-hue-start: 250;
|
|
12227
|
+
--sunbursttree-chroma: 0.14;
|
|
12228
|
+
--sunbursttree-chroma-step: 0.015;
|
|
12229
|
+
--sunbursttree-lightness: 60%;
|
|
12230
|
+
--sunbursttree-lightness-step: 5%;
|
|
12231
|
+
--sunbursttree-shade-step: 10%;
|
|
12232
|
+
--sunbursttree-center-color: var(--surface-4);
|
|
12233
|
+
--sunbursttree-center-text: var(--surface-4-text);
|
|
12234
|
+
--sunbursttree-gap-color: var(--surface-2);
|
|
12235
|
+
--sunbursttree-gap: 1px;
|
|
12236
|
+
--sunbursttree-font-size: 11px;
|
|
12237
|
+
--sunbursttree-label-lightness: 22%;
|
|
12238
|
+
|
|
12239
|
+
display: block;
|
|
12240
|
+
position: relative;
|
|
12241
|
+
min-height: 200px;
|
|
12242
|
+
aspect-ratio: 1;
|
|
12243
|
+
outline: none;
|
|
12244
|
+
}
|
|
12245
|
+
|
|
12246
|
+
:host(:focus),
|
|
12247
|
+
:host(:focus-visible) {
|
|
12248
|
+
outline: none;
|
|
12249
|
+
}
|
|
12250
|
+
|
|
12251
|
+
.sunburst {
|
|
12252
|
+
display: block;
|
|
12253
|
+
width: 100%;
|
|
12254
|
+
height: 100%;
|
|
12255
|
+
outline: none;
|
|
12256
|
+
overflow: hidden;
|
|
12257
|
+
font-size: var(--sunbursttree-font-size);
|
|
12258
|
+
}
|
|
12259
|
+
|
|
12260
|
+
.arc {
|
|
12261
|
+
--_l: clamp(
|
|
12262
|
+
10%,
|
|
12263
|
+
calc(
|
|
12264
|
+
var(--sunbursttree-lightness)
|
|
12265
|
+
+ var(--arc-depth, 0) * var(--sunbursttree-lightness-step)
|
|
12266
|
+
+ var(--arc-shade, 0) * var(--sunbursttree-shade-step)
|
|
12267
|
+
+ var(--_boost, 0%)
|
|
12268
|
+
),
|
|
12269
|
+
95%
|
|
12270
|
+
);
|
|
12271
|
+
--_c: max(0, calc(var(--sunbursttree-chroma) - var(--arc-depth, 0) * var(--sunbursttree-chroma-step)));
|
|
12272
|
+
--_arc-color: oklch(var(--_l) var(--_c) calc(var(--sunbursttree-hue-start) + var(--arc-hue, 0)));
|
|
12273
|
+
|
|
12274
|
+
fill: color-mix(in oklch, var(--_arc-color), var(--sunbursttree-center-color) calc(var(--arc-centre, 0) * 100%));
|
|
12275
|
+
fill-rule: evenodd;
|
|
12276
|
+
stroke: var(--sunbursttree-gap-color);
|
|
12277
|
+
stroke-width: var(--sunbursttree-gap);
|
|
12278
|
+
stroke-linejoin: round;
|
|
12279
|
+
cursor: pointer;
|
|
12280
|
+
}
|
|
12281
|
+
|
|
12282
|
+
.arc.tickled {
|
|
12283
|
+
--_boost: 10%;
|
|
12284
|
+
}
|
|
12285
|
+
|
|
12286
|
+
.arc.selected {
|
|
12287
|
+
stroke: var(--accent);
|
|
12288
|
+
stroke-width: calc(var(--sunbursttree-gap) + 1.5px);
|
|
12289
|
+
paint-order: fill;
|
|
12290
|
+
}
|
|
12291
|
+
|
|
12292
|
+
.arc.filtered {
|
|
12293
|
+
fill-opacity: 0.3;
|
|
12294
|
+
}
|
|
12295
|
+
|
|
12296
|
+
.arc.loading {
|
|
12297
|
+
cursor: progress;
|
|
12298
|
+
}
|
|
12299
|
+
|
|
12300
|
+
.arc.exiting {
|
|
12301
|
+
pointer-events: none;
|
|
12302
|
+
}
|
|
12303
|
+
|
|
12304
|
+
.arc.center.leaf {
|
|
12305
|
+
cursor: default;
|
|
12306
|
+
}
|
|
12307
|
+
|
|
12308
|
+
.sunburst-label {
|
|
12309
|
+
fill: oklch(var(--sunbursttree-label-lightness) 0.03 calc(var(--sunbursttree-hue-start) + var(--arc-hue, 0)));
|
|
12310
|
+
pointer-events: none;
|
|
12311
|
+
user-select: none;
|
|
12312
|
+
dominant-baseline: central;
|
|
12313
|
+
text-anchor: middle;
|
|
12314
|
+
}
|
|
12315
|
+
|
|
12316
|
+
.center-readout {
|
|
12317
|
+
fill: var(--sunbursttree-center-text);
|
|
12318
|
+
pointer-events: none;
|
|
12319
|
+
user-select: none;
|
|
12320
|
+
text-anchor: middle;
|
|
12321
|
+
dominant-baseline: central;
|
|
12322
|
+
}
|
|
12323
|
+
|
|
12324
|
+
.center-readout .center-label {
|
|
12325
|
+
font-weight: var(--font-weight-bold, 600);
|
|
12326
|
+
}
|
|
12327
|
+
|
|
12328
|
+
.center-readout .center-meta {
|
|
12329
|
+
fill-opacity: 0.75;
|
|
12330
|
+
}
|
|
12331
|
+
|
|
12332
|
+
.empty-state {
|
|
12333
|
+
padding: var(--space-l);
|
|
12334
|
+
color: var(--surface-muted-text);
|
|
12335
|
+
font-size: var(--text-s);
|
|
12336
|
+
}
|
|
12337
|
+
`;function hO(e){return e<.5?4*e*e*e:1-(-2*e+2)**3/2}function gO(e){return 1-(1-e)**3}function _O(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}const vO=(e,n,r)=>e+(n-e)*r;function yO(e,n,r){return e+(((n-e)%360+540)%360-180)*r}function bO(e,n,r){return{a0:vO(e.a0,n.a0,r),a1:vO(e.a1,n.a1,r),depth:vO(e.depth,n.depth,r),hue:yO(e.hue,n.hue,r),shade:vO(e.shade,n.shade,r),opacity:vO(e.opacity,n.opacity,r)}}function xO(e){let{current:n,targets:r,enter:i,exit:a}=e,o=new Map,s=new Map,c=new Set;for(let[e,a]of r)o.set(e,n.get(e)??i(e,a)),s.set(e,a);for(let[e,i]of n)r.has(e)||(o.set(e,i),s.set(e,a(e,i)),c.add(e));return{from:o,to:s,exiting:c}}function SO(e,n){let r=new Map;for(let[i,a]of e.to){let o=e.from.get(i)??a;r.set(i,n>=1?a:bO(o,a,n))}return r}function CO(e){let n=new Map;for(let[r,i]of e.to)e.exiting.has(r)||n.set(r,i);return n}const wO=1e-4;function TO(e,n){return Math.abs(e.a0-n.a0)<wO&&Math.abs(e.a1-n.a1)<wO&&Math.abs(e.depth-n.depth)<wO&&Math.abs(yO(e.hue,n.hue,1)-e.hue)<wO*360&&Math.abs(e.shade-n.shade)<wO&&Math.abs(e.opacity-n.opacity)<wO}function EO(e,n){if(e.size!==n.size)return!1;for(let[r,i]of e){let e=n.get(r);if(!e||!TO(i,e))return!1}return!0}const DO=e=>e.toLocaleString(void 0,{maximumFractionDigits:2});let OO=0,Z=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this.maxDepth=5,this.centerRatio=.22,this.minArcLength=1.5,this.disableLabels=!1,this.curvedLabels=!1,this.animationDuration=600,this.valueAccessor=RD,this.valueFormatter=DO,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this._zoomId=void 0,this._size={width:0,height:0},this.search=new Bt(this,{adapter:Ut(this,{labelSelector:`.sunburst-label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>this.#x().map(e=>({id:e.id,enabled:!0})),onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)},onTickle:e=>{let n=e===void 0?void 0:this.#e.get(e);n&&this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:n.node,depth:n.depth-1},bubbles:!0,composed:!0}))}}),this._layoutDirty=!0,this._ticking=!1,this.#e=new Map,this.#t={x0:0,x1:1,depth:0},this.#n={center:0,ring:0},this.#r=new Map,this.#i=new Map,this.#o=0,this.#s=hO,this.#l=11,this.#u=`sunburst-${++OO}-label-`,this.#p=new Set,this.#m=new Map,this.#O=e=>{this.#c=void 0;let n=this.#a;if(!n)return;let r=(e-this.#o)/Math.max(1,this.animationDuration);r>=1?(this.#i=CO(n),this.#a=void 0):(this.#i=SO(n,this.#s(Math.max(0,r))),this.#c=requestAnimationFrame(this.#O)),this._ticking=!0;try{this.requestUpdate()}finally{this._ticking=!1}}}static{this.shadowRootOptions={...n.shadowRootOptions,delegatesFocus:!0}}get selectedNodes(){return this._selectedNodes}get focusedNode(){if(this._zoomId!==void 0)return WD(this.#y,this._zoomId)}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;get#y(){return this.model?.root??this.root}get#b(){return this._zoomId??this.#y?.item.key}#x(){let e=[];for(let[n,r]of this.#r){let i=this.#e.get(n);i&&r.depth>=0&&e.push(i)}return e}requestUpdate(...e){this._ticking||(this._layoutDirty=!0),super.requestUpdate(...e)}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#g=Jt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),e.register({id:`zoom-up`,label:`Zoom Out One Level`,description:`Zoom to the parent of the centre`,execute:()=>this.zoomUp()}),this.registry=e,this.#C(),typeof ResizeObserver<`u`&&(this.#v=new ResizeObserver(([e])=>{let{width:n,height:r}=e.contentRect;this.#l=Number.parseFloat(getComputedStyle(this).getPropertyValue(`--sunbursttree-font-size`))||11,(n!==this._size.width||r!==this._size.height)&&(this._size={width:n,height:r})}),this.#v.observe(this))}disconnectedCallback(){super.disconnectedCallback(),this.#f?.(),this.#f=void 0;for(let e of this.#m.values())e.abort();if(this.#m.clear(),this.#p.clear(),this.#v?.disconnect(),this.#v=void 0,this.#c!==void 0&&cancelAnimationFrame(this.#c),this.#c=void 0,this.#a&&(this.#i=CO(this.#a)),this.#a=void 0,this.#g){for(let e of[`select-all`,`deselect-all`,`zoom-up`])this.#g.unregister(e);this.#g=void 0,this.registry=void 0}}#S(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#C(){this.#g&&(this.search.setModes(this.#S()),this.#_?.(),this.#_=Rt(this.#g,this.search))}willUpdate(e){e.has(`root`)&&e.get(`root`)!==void 0&&this.#k(),e.has(`interactionMode`)&&e.get(`interactionMode`)!==void 0&&(this.#h=void 0,this.#N()),this._layoutDirty&&(this._layoutDirty=!1,this.#T())}updated(e){e.has(`model`)&&(this.#f?.(),this.#f=this.model?._subscribe(()=>this.requestUpdate())),e.has(`searchModes`)&&this.#C(),this.#A()}#w(){let e=this._size.width||320,n=this._size.height||320;return Math.max(0,Math.min(e,n)/2-2)}#T(){let e=this.#y,n=this.#e,r=this.#t,i=Math.max(1,Math.floor(this.maxDepth)),a=this._zoomId===void 0?0:HD(this._zoomId).length-1,o=YD(e,{valueAccessor:this.valueAccessor,maxDepth:Math.max(a,r.depth)+i});this._zoomId!==void 0&&!o.has(this._zoomId)&&(this._zoomId=void 0);let s=this.#b,c=$D(s===void 0?void 0:o.get(s)),l=rO(this.#w(),i,this.centerRatio),u=this.#E(o,c,l,s,i);if(this.#e=o,this.#t=c,this.#n=l,EO(u,this.#r))return;this.#r=u;let d=xO({current:this.#i,targets:u,enter:(e,i)=>{let a=n.get(e);if(a){let e=eO(a,r);return{...i,...e,opacity:0}}return{...i,a1:i.a0}},exit:(e,n)=>{let r=o.get(e);if(r)return{...n,...eO(r,c),opacity:0};let i=(n.a0+n.a1)/2;return{...n,a0:i,a1:i,opacity:0}}});this.#D(d)}#E(e,n,r,i,a){let o=new Map;if(i===void 0)return o;let s=dO(e,n,i);for(let c of e.values()){let e=eO(c,n);e.depth<-1||e.depth>=a||(e.depth===-1?c.id!==i:!s.has(c.id))||e.depth>=0&&sO(e.a0,e.a1,nO(e.depth,r).outer)<this.minArcLength||o.set(c.id,{...e,hue:s.get(c.id)??this.#i.get(c.id)?.hue??0,shade:fO(c.index,c.setSize),opacity:1})}return o}#D(e){if((_O()?0:this.animationDuration)<=0||!this.isConnected){this.#a=void 0,this.#i=CO(e);return}this.#s=this.#a?gO:hO,this.#a=e,this.#i=SO(e,0),this.#o=performance.now(),this.#c??=requestAnimationFrame(this.#O)}#O;#k(){if(this._selectedNodes.size===0)return;let e=new Map;for(let n of this.#e.values())e.set(n.node,n.id);let n=this.#y,r=r=>{let i=r===void 0?void 0:e.get(r);return i===void 0?void 0:WD(n,i)};this._selectedNodes=new Set([...this._selectedNodes].map(r).filter(e=>e!==void 0)),this.selectedNode=r(this.selectedNode)??[...this._selectedNodes].at(-1),this.#h=void 0}#A(){if(!(!this.model&&!this.loadChildren))for(let e of this.#r.keys()){let n=this.#e.get(e);!n||n.node.children!==void 0||n.node.item.isLeaf===!0||this.#p.has(e)||this.#j(n)}}async#j(e){let{id:n,node:r}=e,i=e.depth-1;this.#p.add(n);let a=new AbortController;this.#m.set(n,a);try{let e=this.model?await this.model.getChildren(r,i,a.signal):[...await hg(this.loadChildren({node:r,depth:i},a.signal),a.signal)];if(a.signal.aborted)return;r.children=e}catch{if(a.signal.aborted)return;r.children=[]}finally{this.#p.delete(n),this.#m.delete(n),a.signal.aborted||this.requestUpdate()}}#M(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#N(){this._selectedNodes=new Set,this.selectedNode=void 0}#P(e,n=[...e].at(-1)){let r=this._selectedNodes;this._selectedNodes=e,this.selectedNode=n,this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set(e),previous:r},bubbles:!0,composed:!0}))}select(e){this.#M(e)&&this.#P(new Set([e]),e)}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);n.delete(e),this.#P(n,this.selectedNode===e?[...n].at(-1):this.selectedNode)}clearSelection(){this._selectedNodes.size>0&&this.#P(new Set)}selectAll(){this.#P(new Set([...this._selectedNodes,...this.#x().map(e=>e.node).filter(e=>this.#M(e))]))}deselectAll(){this.#P(new Set)}selectMany(e){this.#P(new Set([...e].filter(e=>this.#M(e))))}#F(e){for(let n of this.#e.values())if(n.node===e)return n.id;return GD(this.#y,n=>n===e)}#I(e){let n=e===this.#y?.item.key?void 0:e;if(n===this._zoomId)return;let r=this._zoomId,i=this.focusedNode;this._zoomId=n,this.tickled.clearTickled();let a=this.focusedNode,o=e=>e===void 0?-1:HD(e).length-2;this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:a,depth:o(n)},bubbles:!0,composed:!0})),n!==void 0&&(r===void 0||VD(r,n))&&a?this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:a,depth:o(n)},bubbles:!0,composed:!0})):i&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:i,depth:o(r)},bubbles:!0,composed:!0}))}zoomTo(e){let n=this.#F(e);n!==void 0&&this.#I(n)}zoomUp(){this._zoomId!==void 0&&this.#I(UD(this._zoomId))}zoomOut(){this.#I(void 0)}#L(e){return e.x1-e.x0<=0||e.node.item.isLeaf===!0?!1:e.node.children===void 0?this.model!==void 0||this.loadChildren!==void 0:e.node.children.length>0}#R(e){let n=this.#y,r=WD(n,e);if(!r)return;let i=UD(e);return i!==void 0&&this.#I(i),this.tickled.setTickled(e),r}navigateTo(e){let n=this.#y;if(!n||e.length===0)return!1;let r=this.#R(BD([n.item.key,...e]));return r?(this.select(r),!0):!1}navigateToNode(e){let n=this.#y,r=GD(n,r=>r!==n&&e(r));return r!==void 0&&this.navigateTo(HD(r).slice(1))}revealKey(e){let n=this.#y,r=GD(n,r=>r!==n&&r.item.key===e);return r!==void 0&&this.#R(r)!==void 0}getNodes(){return this.#x().map(e=>({node:e.node,depth:e.depth-1}))}#z(e){let n=this.filterPredicate;if(!n)return!1;if(this.#d?.predicate!==n||this.#d.layout!==this.#e){let e=(r,i)=>n(r,i)||(r.children?.some(n=>e(n,i+1))??!1),r=new Set;for(let n of this.#e.values())n.depth>0&&!e(n.node,n.depth-1)&&r.add(n.id);this.#d={predicate:n,layout:this.#e,ids:r}}return this.#d.ids.has(e)}#B(e,n){this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e.node,depth:e.depth-1},bubbles:!0,composed:!0}));let{node:r}=e,i=this.#x(),a=i.findIndex(n=>n.id===e.id);if(this.interactionMode===`standard`&&(n.ctrlKey||n.metaKey)){this._selectedNodes.has(r)?this.deselect(r):this.#M(r)&&this.#P(new Set([...this._selectedNodes,r]),r),this.#h=a;return}if(this.interactionMode===`standard`&&n.shiftKey&&this.#h!==void 0){let e=Math.min(this.#h,a),n=Math.max(this.#h,a);this.#P(new Set(i.slice(e,n+1).map(e=>e.node).filter(e=>this.#M(e))));return}this.interactionMode!==`manual`&&(this.select(r),this.#h=a),this.#L(e)?this.#I(e.id):this.tickled.setTickled(e.id)}#V(e){let n={node:e.node,depth:e.depth-1};this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:n,bubbles:!0,composed:!0}))}#H(e){if(this.disableKeyboardNavigation)return;if(e.key===`Escape`||e.key===`Backspace`){this._zoomId!==void 0&&(e.preventDefault(),this.zoomUp());return}let n=this.#x(),r=this.tickled.tickledId;if(e.key===`Enter`){let n=r===void 0?void 0:this.#e.get(r);if(!n)return;e.preventDefault(),this.interactionMode!==`manual`&&this.select(n.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:n.node,depth:n.depth-1},bubbles:!0,composed:!0})),this.#L(n)&&this.#I(n.id);return}let i=pO(n,r,e.key);if(i===void 0)return;e.preventDefault(),this.tickled.setInputMode(`keyboard`),this.tickled.setTickled(i);let a=this.#e.get(i);a&&this.interactionMode===`implicit`&&this.select(a.node)}#U(e,n,r){let i=this.#e.get(e),{inner:o,outer:c}=nO(n.depth,this.#n),l=oO(n.a0,n.a1,o,c),u=!this.#r.has(e),d=e===r,f=`--arc-hue:${n.hue.toFixed(2)};--arc-depth:${Math.max(0,n.depth).toFixed(3)};--arc-shade:${n.shade.toFixed(3)};--arc-centre:${Math.min(1,Math.max(0,-n.depth)).toFixed(3)};opacity:${n.opacity.toFixed(3)}`;if(!i||u)return s`<path class="arc exiting" d=${l} style=${f} aria-hidden="true"></path>`;if(d){let e=this._zoomId!==void 0;return s`<path
|
|
12338
|
+
class="arc center ${e?``:`leaf`}"
|
|
12339
|
+
part="center"
|
|
12340
|
+
d=${l}
|
|
12341
|
+
style=${f}
|
|
12342
|
+
role=${e?`button`:`presentation`}
|
|
12343
|
+
aria-label=${e?`Zoom out from ${i.node.item.label}`:a}
|
|
12344
|
+
@click=${()=>this.zoomUp()}
|
|
12345
|
+
@pointerenter=${()=>this.tickled.clearTickled()}
|
|
12346
|
+
></path>`}let{node:p}=i,m=this._selectedNodes.has(p),h=this.tickled.isTickled(e),g=[`arc`,m?`selected`:``,h?`tickled`:``,this.#z(e)?`filtered`:``,this.#p.has(e)?`loading`:``].join(` `);return s`<path
|
|
12347
|
+
class=${g}
|
|
12348
|
+
part="arc"
|
|
12349
|
+
d=${l}
|
|
12350
|
+
style=${f}
|
|
12351
|
+
data-id=${e}
|
|
12352
|
+
data-key=${p.item.key}
|
|
12353
|
+
role="treeitem"
|
|
12354
|
+
aria-level=${i.depth}
|
|
12355
|
+
aria-selected=${m}
|
|
12356
|
+
aria-setsize=${i.setSize}
|
|
12357
|
+
aria-posinset=${i.index+1}
|
|
12358
|
+
aria-label=${p.item.label}
|
|
12359
|
+
@click=${e=>this.#B(i,e)}
|
|
12360
|
+
@dblclick=${()=>this.#V(i)}
|
|
12361
|
+
@pointerenter=${()=>this.tickled.handlePointerEnter(e)}
|
|
12362
|
+
></path>`}#W(){if(this.disableLabels)return a;let e=[],n=[];for(let[r,i]of this.#i){let a=this.#e.get(r);if(!a||i.opacity<.05)continue;let o=uO(i,a.node.item.label,this.#n,this.#l,{curved:this.curvedLabels});if(!o)continue;let c=`--arc-hue:${i.hue.toFixed(2)};opacity:${i.opacity.toFixed(3)}`;if(o.kind===`curved`){let r=`${this.#u}${n.length}`;n.push(s`<path id=${r} d=${o.path}></path>`),e.push(s`<text class="sunburst-label curved" part="label" style=${c}
|
|
12363
|
+
><textPath href="#${r}" startOffset="50%">${o.text}</textPath></text>`)}else e.push(s`<text
|
|
12364
|
+
class="sunburst-label"
|
|
12365
|
+
part="label"
|
|
12366
|
+
transform="translate(${o.x.toFixed(2)} ${o.y.toFixed(2)}) rotate(${o.rotate.toFixed(2)})"
|
|
12367
|
+
style=${c}
|
|
12368
|
+
>${o.text}</text>`)}return s`<defs>${n}</defs>${e}`}#G(e){let n=e===void 0?void 0:this.#e.get(e);if(!n)return a;let r=this.tickled.tickledId,i=r===void 0?void 0:this.#e.get(r),o=i??n,c=Math.max(4,Math.floor(this.#n.center*1.7/(this.#l*.6))),l=o.node.item.label,u=l.length<=c?l:`${l.slice(0,c-1)}…`,d=i&&n.value>0?` · ${(i.value/n.value*100).toFixed(+(i.value/n.value<.1))}%`:``,f=this.#l*1.3;return s`<g class="center-readout" part="center-readout" aria-hidden="true">
|
|
12369
|
+
<text class="center-label" y=${(-f/2).toFixed(2)}>${u}</text>
|
|
12370
|
+
<text class="center-meta" y=${(f/2).toFixed(2)}>${this.valueFormatter(o.value,o.node)}${d}</text>
|
|
12371
|
+
</g>`}render(){if(!this.#y)return i`<div class="empty-state">No data</div>${this.search.renderField()}`;let e=this._size.width||320,n=this._size.height||320,r=this.#b;return i`
|
|
12372
|
+
<svg
|
|
12373
|
+
class="sunburst"
|
|
12374
|
+
viewBox="${-e/2} ${-n/2} ${e} ${n}"
|
|
12375
|
+
role="tree"
|
|
12376
|
+
tabindex="0"
|
|
12377
|
+
aria-label=${this.#y.item.label}
|
|
12378
|
+
data-input-mode=${this.tickled.inputMode}
|
|
12379
|
+
@keydown=${e=>this.#H(e)}
|
|
12380
|
+
@pointerleave=${()=>this.tickled.clearTickled()}
|
|
12381
|
+
>
|
|
12382
|
+
<g class="arcs">${_(this.#i,([e])=>e,([e,n])=>this.#U(e,n,r))}</g>
|
|
12383
|
+
<g class="labels">${this.#W()}</g>
|
|
12384
|
+
${this.#G(r)}
|
|
12385
|
+
</svg>
|
|
12386
|
+
${this.search.renderField()}
|
|
12387
|
+
`}static{this.styles=[w,Vt,mO]}};E([d({type:Object})],Z.prototype,`root`,void 0),E([d({attribute:!1})],Z.prototype,`model`,void 0),E([d({attribute:!1})],Z.prototype,`loadChildren`,void 0),E([d({reflect:!0,attribute:`exclusivity`})],Z.prototype,`exclusivity`,void 0),E([d({reflect:!0,attribute:`selection-filter`})],Z.prototype,`selectionFilter`,void 0),E([d({type:String,attribute:`interaction-mode`})],Z.prototype,`interactionMode`,void 0),E([d({type:Number,attribute:`max-depth`})],Z.prototype,`maxDepth`,void 0),E([d({type:Number,attribute:`center-ratio`})],Z.prototype,`centerRatio`,void 0),E([d({type:Number,attribute:`min-arc-length`})],Z.prototype,`minArcLength`,void 0),E([d({type:Boolean,attribute:`disable-labels`})],Z.prototype,`disableLabels`,void 0),E([d({type:Boolean,attribute:`curved-labels`,reflect:!0})],Z.prototype,`curvedLabels`,void 0),E([d({type:Number,attribute:`animation-duration`})],Z.prototype,`animationDuration`,void 0),E([d({attribute:!1})],Z.prototype,`valueAccessor`,void 0),E([d({attribute:!1})],Z.prototype,`valueFormatter`,void 0),E([d({attribute:!1})],Z.prototype,`selectedNode`,void 0),E([m()],Z.prototype,`_selectedNodes`,void 0),E([d({attribute:!1})],Z.prototype,`filterPredicate`,void 0),E([d({type:Boolean,attribute:`disable-keyboard-navigation`})],Z.prototype,`disableKeyboardNavigation`,void 0),E([d({attribute:!1})],Z.prototype,`registry`,void 0),E([d({type:String,attribute:`search-modes`,reflect:!0})],Z.prototype,`searchModes`,void 0),E([m()],Z.prototype,`_zoomId`,void 0),E([m()],Z.prototype,`_size`,void 0),Z=E([T(`ixfx-sunbursttree-list`)],Z);let kO=class extends qy(n){constructor(...e){super(...e),this.barSpacing=20,this.barWidth=14,this.debounceMs=200,this.retractDurationMs=400,this._startX=0,this._currentX=0,this._pointerId=null,this._componentWidth=0,this._isDragging=!1,this._offset=0,this._width=0,this._height=0,this._animRafId=null,this._debounceTimer=null,this._animStartOffset=0,this._animStartTime=null,this._resizeObserver=null,this.#e=e=>{if(e.pointerId!==this._pointerId)return;this.#r();let n=this.getBoundingClientRect();if(e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom){let e=this._currentX-this._startX,n=Math.max(-1,Math.min(1,e/this._componentWidth));this.#n(n)}this._isDragging=!1,this._pointerId=null,this.#i()},this.#t=e=>{e.pointerId===this._pointerId&&(this.#r(),this._isDragging=!1,this._pointerId=null,this.#i())},this._onPointerDown=e=>{e.preventDefault(),this.#o(),e.target.setPointerCapture(e.pointerId),this._pointerId=e.pointerId,this._startX=e.clientX,this._currentX=e.clientX,this._componentWidth=this.getBoundingClientRect().width,this._isDragging=!0,window.addEventListener(`pointerup`,this.#e),window.addEventListener(`pointercancel`,this.#t)},this._onPointerMove=e=>{if(!this._isDragging||e.pointerId!==this._pointerId)return;this._currentX=e.clientX;let n=this._currentX-this._startX,r=Math.max(-1,Math.min(1,n/this._componentWidth));this._offset=r*this._height*.5,this.requestUpdate()}}#e;#t;#n(e){this.dispatchEvent(new CustomEvent(`input`,{detail:{value:e},bubbles:!0,composed:!0}))}_applyWheelDelta(e,n){this.#o();let r=n.shiftKey?.05:.1,i=Math.max(-1,Math.min(1,e*r));this.#n(i),this._offset=i*this._height*.5,this.requestUpdate(),this.#i()}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(e=>{let n=e[0];n&&(this._width=n.contentRect.width,this._height=n.contentRect.height,this.requestUpdate())}),this._resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=null,this.#o(),this.#r(),this._isDragging=!1,this._pointerId=null}#r(){window.removeEventListener(`pointerup`,this.#e),window.removeEventListener(`pointercancel`,this.#t)}#i(){this._debounceTimer!==null&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=null,this.#a()},this.debounceMs)}#a(){this._animStartOffset=this._offset,this._animStartTime=null;let e=n=>{this._animStartTime===null&&(this._animStartTime=n);let r=n-this._animStartTime,i=Math.min(r/this.retractDurationMs,1),a=1-(1-i)**3;this._offset=this._animStartOffset*(1-a),this.requestUpdate(),i<1?this._animRafId=requestAnimationFrame(e):(this._offset=0,this._animRafId=null,this.requestUpdate())};this._animRafId=requestAnimationFrame(e)}#o(){this._animRafId!==null&&(cancelAnimationFrame(this._animRafId),this._animRafId=null),this._debounceTimer!==null&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}#s(){let e=this._width,n=this._height,r=this._offset,{barSpacing:i,barWidth:a}=this;if(e===0||n===0)return s``;let o=a/2,c=n/2,l=Math.ceil(e/i)+1;return s`${Array.from({length:l},(e,a)=>{let l=a*i,u=l-o,d=l+o,f=a%2==0?`var(--swipe-color-a, var(--surface-4))`:`var(--swipe-color-b, var(--surface-5))`,p=`M${u},0 L${d},0 L${d+r},${c} L${d},${n} L${u},${n} L${u+r},${c}Z`;return s`<path d=${p} style="fill:${f}"></path>`})}`}static{this.styles=[w,sn,r`
|
|
12219
12388
|
:host {
|
|
12220
12389
|
display: block;
|
|
12221
12390
|
user-select: none;
|
|
@@ -12251,7 +12420,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12251
12420
|
>
|
|
12252
12421
|
<svg aria-hidden="true">${this.#s()}</svg>
|
|
12253
12422
|
</div>
|
|
12254
|
-
`}};E([d({type:Number})],
|
|
12423
|
+
`}};E([d({type:Number})],kO.prototype,`barSpacing`,void 0),E([d({type:Number})],kO.prototype,`barWidth`,void 0),E([d({type:Number})],kO.prototype,`debounceMs`,void 0),E([d({type:Number})],kO.prototype,`retractDurationMs`,void 0),kO=E([T(`ixfx-swipe`)],kO);let AO=class extends n{render(){return i`<slot></slot>`}static{this.styles=[w,r`
|
|
12255
12424
|
:host {
|
|
12256
12425
|
display:none;
|
|
12257
12426
|
height:100%;
|
|
@@ -12262,12 +12431,12 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12262
12431
|
background: var(--surface-3);
|
|
12263
12432
|
display:block;
|
|
12264
12433
|
}
|
|
12265
|
-
`]}};
|
|
12434
|
+
`]}};AO=E([T(`ixfx-tab-panel`)],AO);var jO=class{#e;#t;#n;#r=[];#i;#a;#o;#s=new Set;constructor(e,n,r={}){this.#e=e,this.#t=n,this.#n=r,this.#o=r.commands}connect(){this.disconnect(),this.#i=new AbortController;let{signal:e}=this.#i;this.#e.addEventListener(`change`,this.#c,{signal:e}),this.#e.addEventListener(`reorder`,this.#l,{signal:e}),this.#e.addEventListener(`close`,this.#u,{signal:e}),this.#a=new MutationObserver(()=>this.#x()),this.#a.observe(this.#e,{childList:!0}),this.#a.observe(this.#t,{childList:!0}),this.#x(),this.#t.syncWithList(this.#e);for(let e of this.#r)this.#C(e)}disconnect(){this.#i?.abort(),this.#i=void 0,this.#a?.disconnect(),this.#a=void 0;for(let e of this.#r)this.#w(e);this.#s.clear(),this.#r=[]}selectTab(e){let n=this.#f(e);if(!n)return!1;let r=this.getSelected();return r?.id===n.id?(this.#t.selectPanel(n.forId),!0):(this.#e.selectElement(n.item),this.#t.selectPanel(n.forId),this.#n.onSelect?.(n,r),!0)}selectNext(){return this.#d(1)}selectPrevious(){return this.#d(-1)}getSelected(){return this.#r.find(e=>e.item.hasAttribute(`selected`))}getTabs(){return[...this.#r]}getTab(e){return this.#r.find(n=>n.id===e)}addTab(e){let{id:n,forId:r}=this.#g(e),i=document.createElement(`ixfx-tab-list-item`);i.id=n,i.setAttribute(`for`,r),i.closeable=e.closeable??!0,i.append(e.label),e.iconName&&(i.iconName=e.iconName),e.description&&(i.description=e.description);for(let n of e.toolbar??[])n.slot=`toolbar`,i.append(n);let a=document.createElement(`ixfx-tab-panel`);a.id=r,e.content!==void 0&&this.#y(a,e.content);let o=Math.max(0,Math.min(e.index??this.#r.length,this.#r.length));this.#b(this.#e,i,o),this.#b(this.#t,a,o);let s={id:n,forId:r,item:i,panel:a,label:e.label,iconName:e.iconName};return this.#r.splice(o,0,s),this.#C(s),this.#n.onAdd?.(s),(e.select??!0)&&this.selectTab(n),s}removeTab(e){let n=this.#f(e);if(!n)return!1;let r=this.#r.indexOf(n),i=n.item.hasAttribute(`selected`)?this.#m(r):void 0;return n.item.remove(),n.panel.remove(),this.#h(n),this.#w(n),this.#n.onRemove?.(n),i&&this.selectTab(i.id),!0}renameTab(e,n){let r=this.#f(e);if(!r)return!1;for(let e of[...r.item.childNodes])(e.nodeType!==Node.ELEMENT_NODE||e.slot!==`toolbar`)&&r.item.removeChild(e);return r.item.prepend(n),r.label=n,this.#T(r),!0}setTabIcon(e,n){let r=this.#f(e);return r?(n?(r.item.iconName=n,r.iconName=n):(r.item.iconName=void 0,r.item.removeAttribute(`icon-name`),r.iconName=void 0),!0):!1}#c=e=>{let n=e.detail;this.#t.selectPanel(n.for);let r=this.#r.find(e=>e.forId===n.for);if(!r)return;let i=n.previous?this.#r.find(e=>e.id===n.previous):void 0;this.#n.onSelect?.(r,i)};#l=()=>{this.#x(),this.#n.onReorder?.(this.#r)};#u=e=>{let n=e.target?.closest(`ixfx-tab-list-item`),r=n?this.#p(n):void 0;if(!r)return;let i=this.#r.indexOf(r),a=r.item.hasAttribute(`selected`)?this.#m(i):void 0;r.panel.remove(),this.#h(r),this.#w(r),this.#n.onRemove?.(r),a&&this.selectTab(a.id)};#d(e){let n=this.#r;if(n.length===0)return!1;let r=this.getSelected(),i=((r?n.indexOf(r):e===1?-1:0)+e+n.length)%n.length;return this.selectTab(n[i].id)}#f(e){if(typeof e!=`string`)return this.#r.find(n=>n.item===e);let n=e.trim().toLowerCase();return this.#r.find(n=>n.id===e)??this.#r.find(n=>n.forId===e)??this.#r.find(e=>e.label.toLowerCase()===n)}#p(e){return this.#r.find(n=>n.item===e)}#m(e){let n=this.#r;if(!(n.length<=1))return n[e+1]??n[e-1]}#h(e){let n=this.#r.indexOf(e);n>=0&&this.#r.splice(n,1)}#g(e){let n=this.#_(e.label)||`tab`;return{id:e.id??this.#v(`tab-${n}`),forId:e.forId??this.#v(`panel-${n}`)}}#_(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}#v(e){let n=e,r=2;for(;document.getElementById(n);)n=`${e}-${r++}`;return n}#y(e,n){if(typeof n==`function`){n(e);return}if(typeof n==`string`){e.append(document.createTextNode(n));return}e.append(n)}#b(e,n,r){let i=Array.from(e.children);e.insertBefore(n,i[r]??null)}#x(){let e=new Map;for(let n of this.#t.querySelectorAll(`ixfx-tab-panel`))e.set(n.id,n);let n=[];for(let r of this.#e.querySelectorAll(`ixfx-tab-list-item`)){let i=r.getAttribute(`for`)??``,a=e.get(i);a&&n.push({id:r.id||i,forId:i,item:r,panel:a,label:this.#S(r),iconName:r.iconName})}this.#r=n}#S(e){let n=``;for(let r of e.childNodes)r instanceof Element&&r.getAttribute(`slot`)===`toolbar`||(n+=r.textContent??``);return n.trim()}#C(e){this.#o&&(e.item.commandActive||this.#o.has(e.id)||(this.#o.register({id:e.id,label:e.label,description:e.item.description??e.label,icon:e.iconName,execute:()=>{this.selectTab(e.id)}}),this.#s.add(e.id)))}#w(e){this.#o&&this.#s.has(e.id)&&(this.#o.unregister(e.id),this.#s.delete(e.id))}#T(e){if(!this.#o||!this.#s.has(e.id))return;let n=this.#o.get(e.id);n&&(this.#o.unregister(e.id),this.#o.register({...n,label:e.label}))}};let MO=class extends n{#e;render(){return i`<slot></slot>`}getSelectedElement(){for(let e of this._listItems)if(this.#t(e))return e}#t(e){return e.hasAttribute(`selected`)}#n(e){e.removeAttribute(`selected`),this.onUnselectedPanel&&this.onUnselectedPanel(e.id,e)}#r(e){this.onSelectingPanel&&this.onSelectingPanel(e.id,e),e.setAttribute(`selected`,``),this.onSelectedPanel&&this.onSelectedPanel(e.id,e)}syncWithList(e){this.#e=e,Promise.all([e.updateComplete,this.updateComplete]).then(()=>{let n=e.getSelectedElement();if(!n)return;let r=n.getAttribute(`for`);r&&this.selectPanel(r)})}selectPanel(e){let n=this.getSelectedElement();if(n){if(n.id===e)return;this.#n(n)}let r=!1;for(let n of this._listItems)n.id===e&&(this.#r(n),r=!0);return r}selectTab(e){let n=this.#i(e);return n?(this.#e?.selectElement(n),this.selectPanel(n.getAttribute(`for`)??``)===!0):this.selectPanel(e)===!0}#i(e){let n=this.#e;if(!n)return;let r=Array.from(n.querySelectorAll(`ixfx-tab-list-item`));for(let n of r)if(n.getAttribute(`for`)===e)return n;let i=e.trim().toLowerCase();for(let e of r)if(this.#a(e).toLowerCase()===i)return e}#a(e){let n=``;for(let r of e.childNodes)r instanceof Element&&r.getAttribute(`slot`)===`toolbar`||(n+=r.textContent??``);return n.trim()}static{this.styles=r`
|
|
12266
12435
|
:host {
|
|
12267
12436
|
display: block;
|
|
12268
12437
|
}
|
|
12269
12438
|
|
|
12270
|
-
`}};E([p()],
|
|
12439
|
+
`}};E([p()],MO.prototype,`_listItems`,void 0),MO=E([T(`ixfx-tab-panels`)],MO);let NO=class extends n{constructor(...e){super(...e),this.text=``,this.paused=!1}render(){return i`<span class="shimmer" part="text"
|
|
12271
12440
|
>${this.text===``?i`<slot></slot>`:this.text}</span
|
|
12272
12441
|
>`}static{this.styles=r`
|
|
12273
12442
|
:host {
|
|
@@ -12323,7 +12492,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12323
12492
|
-webkit-text-fill-color: var(--text-shimmer-color);
|
|
12324
12493
|
}
|
|
12325
12494
|
}
|
|
12326
|
-
`}};E([d({type:String})],VD.prototype,`text`,void 0),E([d({type:Boolean,reflect:!0})],VD.prototype,`paused`,void 0),VD=E([T(`ixfx-text-shimmer`)],VD);var HD=class{#e;#t;#n=120;#r=4;#i=4;constructor(e,n){this.#e=e,this.#t=n,e.min=n.logicalMin,e.max=n.logicalMax,n.labelFormatter&&(e.formatLabel=n.labelFormatter),e.addEventListener(`track-select`,this.#a)}setTempo(e){this.#n=e,this.#o()}setTimeSignature(e,n){this.#r=e,this.#i=n,this.#o()}setViewRange(e){this.#e.setViewRange(e)}dispose(){this.#e.removeEventListener(`track-select`,this.#a)}#a=e=>{let n=e.detail,r=this.#e.getTrackEvents(n.trackKey).map(e=>e.id);if(n.shiftKey){let e=new Set(this.#e.selectedIds);for(let n of r)e.has(n)?e.delete(n):e.add(n);this.#e.selectedIds=[...e]}else this.#e.selectedIds=r};#o(){if(this.#t.labelFormatter)return;this.#n;let e=this.#r;this.#e.formatLabel=n=>{let r=e,i=n;return`${Math.floor(i/r)+1}.${Math.floor(i%r)+1}`}}};const UD=[1,2,5,10];function WD(e,n,r,i=`adaptive`,a,o){return i===`fixed`&&a!==void 0&&o!==void 0?KD(a,o):GD(e,n,r)}function GD(e,n,r){let i=e.max-e.min;if(i<=0||r<=0)return{majorStep:100,minorDivisions:4,minorStep:25};let a=80*qD(n),o=i/Math.max(2,Math.floor(r/a)),s=10**Math.floor(Math.log10(o)),c=s;for(let e of UD){let n=e*s;if(n>=o*.8){c=n;break}}let l=c/s,u=l===5||l===10?5:4,d=c/u;return{majorStep:c,minorDivisions:u,minorStep:d}}function KD(e,n){let r=e;for(;r*n<5&&r<0xe8d4a51000;)r*=2;return{majorStep:r*4,minorDivisions:4,minorStep:r}}function qD(e){switch(e){case`x-wide`:return 2;case`wide`:return 1.5;case`normal`:return 1;case`slim`:return .7;case`x-slim`:return .5;default:return 1}}function JD(e,n,r,i,a,o){let{majorStep:s,minorStep:c}=r;if(s<=0)return;let l=n.x+n.width;if(i){e.fillStyle=a[`--timeline-alt-major-bg`]??`rgba(255,255,255,0.03)`;let r=Math.floor(n.x/s);for(let i=r;i*s<l;i++)if(i%2!=0){let r=i*s*o;e.fillRect(r,n.y,s*o,n.height)}}if(c>0){e.strokeStyle=a[`--timeline-grid-minor-color`]??`rgba(255,255,255,0.05)`,e.lineWidth=Number.parseFloat(a[`--timeline-grid-minor-width`]??`0.5`),e.beginPath();let r=Math.floor(n.x/c)*c;for(let i=r;i<l;i+=c){if(Math.abs(i%s)<c*.01)continue;let r=i*o;e.moveTo(r,n.y),e.lineTo(r,n.y+n.height)}e.stroke()}e.strokeStyle=a[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=Number.parseFloat(a[`--timeline-grid-major-width`]??`1`),e.beginPath();let u=Math.floor(n.x/s)*s;for(let r=u;r<l;r+=s){let i=r*o;e.moveTo(i,n.y),e.lineTo(i,n.y+n.height)}e.stroke()}function YD(e,n,r,i,a,o,s,c=0){let{majorStep:l}=r;if(l<=0||i<=0)return;let u=c,d=c+i;if(n.y+n.height<u||n.y>d)return;let f=n.x+n.width,p=i-6;e.fillStyle=o[`--timeline-bg`]??`#111`;let m=n.x*s;e.fillRect(m,u,n.width*s,p),e.strokeStyle=o[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=Number.parseFloat(o[`--timeline-grid-major-width`]??`1`),e.beginPath();let h=Math.ceil(n.x/l)*l;for(let n=h;n<f;n+=l){let r=n*s;e.moveTo(r,u+p),e.lineTo(r,d)}e.stroke(),e.strokeStyle=o[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=1,e.beginPath(),e.moveTo(m,d),e.lineTo(m+n.width*s,d),e.stroke(),e.fillStyle=o[`--timeline-axis-label-color`]??`rgba(255,255,255,0.5)`,e.font=`11px system-ui, sans-serif`,e.textBaseline=`middle`,e.textAlign=`left`;for(let n=h;n<f;n+=l){let r=n*s;e.fillText(a(n),r+4,u+p/2)}e.textAlign=`start`}function XD(e,n,r,i,a,o){let s=a[`--timeline-track-bg`]??`#1a1a1a`,c=a[`--timeline-track-bg-alt`]??`#1e1e1e`;for(let l=0;l<r.length;l++){let u=r[l];if(u.y+u.height<n.y)continue;if(u.y>n.y+n.height)break;let d=i.find(e=>e.key===u.trackKey);e.fillStyle=d?.color?`${d.color}22`:l%2==0?s:c,e.fillRect(n.x*o,u.y,n.width*o,u.height),e.strokeStyle=a[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=.5,e.beginPath(),e.moveTo(n.x*o,u.y+u.height),e.lineTo((n.x+n.width)*o,u.y+u.height),e.stroke()}}function ZD(e,n,r,i,a,o,s,c,l){let u=c[`--timeline-event-bg`]??`#3498db`,d=c[`--timeline-event-selected-bg`]??`#5dade2`,f=c[`--timeline-event-tickled-bg`]??`#444`,p=c[`--timeline-event-label-color`]??`#fff`,m=Number.parseFloat(c[`--timeline-event-radius`]??`4`),h=n.x+n.width;for(let c of r){if(c.end<n.x||c.start>h)continue;let r=i.find(e=>e.trackKey===c.trackKey);if(!r||r.y+r.height<n.y||r.y>n.y+n.height)continue;let g=!1;(s.kind===`event-move`&&s.eventId===c.id||s.kind===`event-start`&&s.eventId===c.id||s.kind===`event-end`&&s.eventId===c.id)&&(g=!0);let _=c.start*l,v=(c.end-c.start)*l,y=r.y+3,b=r.height-6;if(v<1)continue;let x=a.has(c.id),S=o===c.id,ee;ee=x?d:S?f:c.color??u,e.fillStyle=ee,e.beginPath(),$D(e,_,y,v,b,Math.min(m,v/2,b/2)),e.fill(),g&&(e.strokeStyle=`#fff`,e.lineWidth=1.5,e.beginPath(),$D(e,_,y,v,b,Math.min(m,v/2,b/2)),e.stroke()),x&&!g&&(e.strokeStyle=d,e.lineWidth=1,e.beginPath(),$D(e,_,y,v,b,Math.min(m,v/2,b/2)),e.stroke()),v>=40&&c.label&&(e.fillStyle=p,e.font=`11px system-ui, sans-serif`,e.textBaseline=`middle`,e.save(),e.beginPath(),e.rect(_+4,y,v-8,b),e.clip(),e.fillText(c.label,_+6,y+b/2),e.restore())}}function QD(e,n,r){if(n.kind!==`marquee`)return;let i=Math.min(n.startLogicalX,n.currentLogicalX)*r,a=Math.max(n.startLogicalX,n.currentLogicalX)*r,o=Math.min(n.startY,n.currentY),s=Math.max(n.startY,n.currentY);e.fillStyle=`rgba(100, 150, 255, 0.15)`,e.fillRect(i,o,a-i,s-o),e.strokeStyle=`rgba(100, 150, 255, 0.6)`,e.lineWidth=1,e.strokeRect(i,o,a-i,s-o)}function $D(e,n,r,i,a,o){o=Math.max(0,o),e.moveTo(n+o,r),e.arcTo(n+i,r,n+i,r+a,o),e.arcTo(n+i,r+a,n,r+a,o),e.arcTo(n,r+a,n,r,o),e.arcTo(n,r,n+i,r,o),e.closePath()}const eO=[`--timeline-bg`,`--timeline-track-bg`,`--timeline-track-bg-alt`,`--timeline-alt-major-bg`,`--timeline-grid-major-color`,`--timeline-grid-minor-color`,`--timeline-grid-major-width`,`--timeline-grid-minor-width`,`--timeline-event-bg`,`--timeline-event-selected-bg`,`--timeline-event-tickled-bg`,`--timeline-event-label-color`,`--timeline-event-radius`,`--timeline-axis-label-color`];function tO(e){let n=getComputedStyle(e),r={};for(let e of eO)r[e]=n.getPropertyValue(e).trim();return r}function nO(e,n,r){return e/n+r}function rO(e){return e>0?1/e:1}function iO(e,n,r,i,a){let o=i.find(e=>n>=e.y&&n<e.y+e.height);if(!o)return{kind:`empty`,logicalX:e,y:n,trackKey:void 0};let s=8*rO(a),c=r.filter(e=>e.trackKey===o.trackKey);for(let n of c)if(!(e<n.start||e>n.end))return e<=n.start+s?{kind:`event-start`,eventId:n.id}:e>=n.end-s?{kind:`event-end`,eventId:n.id}:{kind:`event-move`,eventId:n.id,trackKey:o.trackKey,offsetX:e-n.start};return{kind:`empty`,logicalX:e,y:n,trackKey:o.trackKey}}function aO(e,n){return n.find(n=>e>=n.y&&e<n.y+n.height)?.trackKey}function oO(e,n){return Math.abs(e)>n?e-Math.sign(e)*n:0}function sO(e,n,r,i,a){let o=n*Math.exp(-a/100),s=r-(r-e)*n/o;return o>0&&(s+=-i/o),{ppu:o,viewMin:s}}function cO(e,n,r,i,a,o){let s=n-e,c=s*Math.exp(-a/100),l=i-(s>0?(i-e)/s:.5)*c;return r>0&&(l+=o/r),{vMin:l,vMax:l+c}}function lO(e,n){let r=new AbortController,i=r.signal;return n.addEventListener(`pointerdown`,r=>{let i=e.pxPerUnit,a=n.convertFromViewportToCanvas(r.offsetX,r.offsetY),o=nO(a.x,i,e.min),s=a.y,c=n.logicalScrollTop;if(s>=c&&s<c+e.axisHeight){n.setPointerCapture(r.pointerId),e._drag={kind:`axis-zoom`,anchorUnit:o,startScreenX:r.screenX,startScreenY:r.screenY,startViewMin:e._viewRange.min,startPpu:i};return}let l=iO(o,s,e._internalEvents,e._trackLayout,i);if(r.shiftKey&&l.kind===`event-move`){dO(e,l.eventId);return}if(l.kind===`event-move`){n.setPointerCapture(r.pointerId),e._drag={kind:`event-move`,eventId:l.eventId,originTrackKey:l.trackKey,offsetX:l.offsetX};return}if(l.kind===`event-start`){n.setPointerCapture(r.pointerId),e._drag={kind:`event-start`,eventId:l.eventId};return}if(l.kind===`event-end`){n.setPointerCapture(r.pointerId),e._drag={kind:`event-end`,eventId:l.eventId};return}l.kind===`empty`&&(n.setPointerCapture(r.pointerId),e._drag={kind:`marquee`,startLogicalX:o,startY:s,currentLogicalX:o,currentY:s})},{signal:i}),n.addEventListener(`pointermove`,r=>{let i=e._drag;if(i.kind===`none`){uO(e,n,r);return}let a=e.pxPerUnit,o=n.convertFromViewportToCanvas(r.offsetX,r.offsetY),s=nO(o.x,a,e.min),c=o.y;if(i.kind===`axis-zoom`){let n=r.screenX-i.startScreenX,a=r.screenY-i.startScreenY;if(Math.abs(n)+Math.abs(a)<5)return;let o=oO(n,4),s=oO(a,4),c=sO(i.startViewMin,i.startPpu,i.anchorUnit,o,s);e.setZoomPan(c.viewMin,c.ppu);return}if(i.kind===`marquee`){e._drag={...i,currentLogicalX:s,currentY:c},n.invalidateAll();return}if(i.kind===`event-move`){let r=e._internalEvents.find(e=>e.id===i.eventId);if(!r)return;let a=r.end-r.start,o=s,l=c,u=s-i.offsetX,d=u+a,f=aO(c,e._trackLayout)??r.trackKey,p=e.pxPerUnit,m=WD(e._viewRange,e.userScale,n.viewportWidth,e.gridMode,e.minorStep,p),h=e.processDrag(i.eventId,o,l,u,d,f,i.originTrackKey,m);e._internalEvents=e._internalEvents.map(e=>e.id===i.eventId?{...e,start:h.start,end:h.end,trackKey:h.trackKey}:e),n.invalidateAll();return}if(i.kind===`event-start`){let r=e._internalEvents.find(e=>e.id===i.eventId);if(!r)return;let a=Math.min(s,r.end-1);e._internalEvents=e._internalEvents.map(e=>e.id===i.eventId?{...e,start:a}:e),n.invalidateAll();return}if(i.kind===`event-end`){let r=e._internalEvents.find(e=>e.id===i.eventId);if(!r)return;let a=Math.max(s,r.start+1);e._internalEvents=e._internalEvents.map(e=>e.id===i.eventId?{...e,end:a}:e),n.invalidateAll()}},{signal:i}),n.addEventListener(`pointerup`,r=>{let i=e._drag;if(n.releasePointerCapture(r.pointerId),i.kind===`axis-zoom`){e._drag={kind:`none`};return}if(i.kind===`marquee`){let r=Math.min(i.startLogicalX,i.currentLogicalX),a=Math.max(i.startLogicalX,i.currentLogicalX),o=Math.min(i.startY,i.currentY),s=Math.max(i.startY,i.currentY);if(Math.abs(a-r)<2&&Math.abs(s-o)<2)e._selectedIds=new Set,fO(e);else{let n=new Set;for(let i of e._internalEvents){let c=e._trackLayout.find(e=>e.trackKey===i.trackKey);if(!c)continue;let l=c.y+3,u=c.y+c.height-3;i.end>=r&&i.start<=a&&u>=o&&l<=s&&n.add(i.id)}e._selectedIds=n,fO(e)}e._drag={kind:`none`},n.invalidateAll();return}if(i.kind===`event-move`){let n=e._internalEvents.find(e=>e.id===i.eventId);n&&e.dispatchEvent(new CustomEvent(`event-move`,{detail:{eventId:n.id,fromTrackKey:i.originTrackKey,toTrackKey:n.trackKey,start:n.start,end:n.end},bubbles:!0,composed:!0})),e._drag={kind:`none`};return}if(i.kind===`event-start`||i.kind===`event-end`){let n=e._internalEvents.find(e=>e.id===i.eventId);n&&e.dispatchEvent(new CustomEvent(`event-resize`,{detail:{eventId:n.id,start:n.start,end:n.end},bubbles:!0,composed:!0})),e._drag={kind:`none`};return}e._drag={kind:`none`}},{signal:i}),n.addEventListener(`pointerleave`,()=>{e._tickledId!==void 0&&(e._tickledId=void 0,n.invalidateAll())},{signal:i}),()=>r.abort()}function uO(e,n,r){let i=e.pxPerUnit,a=n.convertFromViewportToCanvas(r.offsetX,r.offsetY),o=nO(a.x,i,e.min),s=a.y,c=n.logicalScrollTop;if(s>=c&&s<c+e.axisHeight){n.style.cursor=`col-resize`,e._tickledId!==void 0&&(e._tickledId=void 0,n.invalidateAll());return}let l=iO(o,s,e._internalEvents,e._trackLayout,i),u;(l.kind===`event-move`||l.kind===`event-start`||l.kind===`event-end`)&&(u=l.eventId),l.kind===`event-start`||l.kind===`event-end`?n.style.cursor=`ew-resize`:l.kind===`event-move`?n.style.cursor=`grab`:n.style.cursor=`crosshair`,u!==e._tickledId&&(e._tickledId=u,n.invalidateAll())}function dO(e,n){let r=new Set(e._selectedIds);r.has(n)?r.delete(n):r.add(n),e._selectedIds=r,fO(e),e.getVCanvas()?.invalidateAll()}function fO(e){e.dispatchEvent(new CustomEvent(`selection-change`,{detail:{selectedIds:[...e._selectedIds]},bubbles:!0,composed:!0}))}const pO=r`
|
|
12495
|
+
`}};E([d({type:String})],NO.prototype,`text`,void 0),E([d({type:Boolean,reflect:!0})],NO.prototype,`paused`,void 0),NO=E([T(`ixfx-text-shimmer`)],NO);var PO=class{#e;#t;#n=120;#r=4;#i=4;constructor(e,n){this.#e=e,this.#t=n,e.min=n.logicalMin,e.max=n.logicalMax,n.labelFormatter&&(e.formatLabel=n.labelFormatter),e.addEventListener(`track-select`,this.#a)}setTempo(e){this.#n=e,this.#o()}setTimeSignature(e,n){this.#r=e,this.#i=n,this.#o()}setViewRange(e){this.#e.setViewRange(e)}dispose(){this.#e.removeEventListener(`track-select`,this.#a)}#a=e=>{let n=e.detail,r=this.#e.getTrackEvents(n.trackKey).map(e=>e.id);if(n.shiftKey){let e=new Set(this.#e.selectedIds);for(let n of r)e.has(n)?e.delete(n):e.add(n);this.#e.selectedIds=[...e]}else this.#e.selectedIds=r};#o(){if(this.#t.labelFormatter)return;this.#n;let e=this.#r;this.#e.formatLabel=n=>{let r=e,i=n;return`${Math.floor(i/r)+1}.${Math.floor(i%r)+1}`}}};const FO=[1,2,5,10];function IO(e,n,r,i=`adaptive`,a,o){return i===`fixed`&&a!==void 0&&o!==void 0?RO(a,o):LO(e,n,r)}function LO(e,n,r){let i=e.max-e.min;if(i<=0||r<=0)return{majorStep:100,minorDivisions:4,minorStep:25};let a=80*zO(n),o=i/Math.max(2,Math.floor(r/a)),s=10**Math.floor(Math.log10(o)),c=s;for(let e of FO){let n=e*s;if(n>=o*.8){c=n;break}}let l=c/s,u=l===5||l===10?5:4,d=c/u;return{majorStep:c,minorDivisions:u,minorStep:d}}function RO(e,n){let r=e;for(;r*n<5&&r<0xe8d4a51000;)r*=2;return{majorStep:r*4,minorDivisions:4,minorStep:r}}function zO(e){switch(e){case`x-wide`:return 2;case`wide`:return 1.5;case`normal`:return 1;case`slim`:return .7;case`x-slim`:return .5;default:return 1}}function BO(e,n,r,i,a,o){let{majorStep:s,minorStep:c}=r;if(s<=0)return;let l=n.x+n.width;if(i){e.fillStyle=a[`--timeline-alt-major-bg`]??`rgba(255,255,255,0.03)`;let r=Math.floor(n.x/s);for(let i=r;i*s<l;i++)if(i%2!=0){let r=i*s*o;e.fillRect(r,n.y,s*o,n.height)}}if(c>0){e.strokeStyle=a[`--timeline-grid-minor-color`]??`rgba(255,255,255,0.05)`,e.lineWidth=Number.parseFloat(a[`--timeline-grid-minor-width`]??`0.5`),e.beginPath();let r=Math.floor(n.x/c)*c;for(let i=r;i<l;i+=c){if(Math.abs(i%s)<c*.01)continue;let r=i*o;e.moveTo(r,n.y),e.lineTo(r,n.y+n.height)}e.stroke()}e.strokeStyle=a[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=Number.parseFloat(a[`--timeline-grid-major-width`]??`1`),e.beginPath();let u=Math.floor(n.x/s)*s;for(let r=u;r<l;r+=s){let i=r*o;e.moveTo(i,n.y),e.lineTo(i,n.y+n.height)}e.stroke()}function VO(e,n,r,i,a,o,s,c=0){let{majorStep:l}=r;if(l<=0||i<=0)return;let u=c,d=c+i;if(n.y+n.height<u||n.y>d)return;let f=n.x+n.width,p=i-6;e.fillStyle=o[`--timeline-bg`]??`#111`;let m=n.x*s;e.fillRect(m,u,n.width*s,p),e.strokeStyle=o[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=Number.parseFloat(o[`--timeline-grid-major-width`]??`1`),e.beginPath();let h=Math.ceil(n.x/l)*l;for(let n=h;n<f;n+=l){let r=n*s;e.moveTo(r,u+p),e.lineTo(r,d)}e.stroke(),e.strokeStyle=o[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=1,e.beginPath(),e.moveTo(m,d),e.lineTo(m+n.width*s,d),e.stroke(),e.fillStyle=o[`--timeline-axis-label-color`]??`rgba(255,255,255,0.5)`,e.font=`11px system-ui, sans-serif`,e.textBaseline=`middle`,e.textAlign=`left`;for(let n=h;n<f;n+=l){let r=n*s;e.fillText(a(n),r+4,u+p/2)}e.textAlign=`start`}function HO(e,n,r,i,a,o){let s=a[`--timeline-track-bg`]??`#1a1a1a`,c=a[`--timeline-track-bg-alt`]??`#1e1e1e`;for(let l=0;l<r.length;l++){let u=r[l];if(u.y+u.height<n.y)continue;if(u.y>n.y+n.height)break;let d=i.find(e=>e.key===u.trackKey);e.fillStyle=d?.color?`${d.color}22`:l%2==0?s:c,e.fillRect(n.x*o,u.y,n.width*o,u.height),e.strokeStyle=a[`--timeline-grid-major-color`]??`rgba(255,255,255,0.12)`,e.lineWidth=.5,e.beginPath(),e.moveTo(n.x*o,u.y+u.height),e.lineTo((n.x+n.width)*o,u.y+u.height),e.stroke()}}function UO(e,n,r,i,a,o,s,c,l){let u=c[`--timeline-event-bg`]??`#3498db`,d=c[`--timeline-event-selected-bg`]??`#5dade2`,f=c[`--timeline-event-tickled-bg`]??`#444`,p=c[`--timeline-event-label-color`]??`#fff`,m=Number.parseFloat(c[`--timeline-event-radius`]??`4`),h=n.x+n.width;for(let c of r){if(c.end<n.x||c.start>h)continue;let r=i.find(e=>e.trackKey===c.trackKey);if(!r||r.y+r.height<n.y||r.y>n.y+n.height)continue;let g=!1;(s.kind===`event-move`&&s.eventId===c.id||s.kind===`event-start`&&s.eventId===c.id||s.kind===`event-end`&&s.eventId===c.id)&&(g=!0);let _=c.start*l,v=(c.end-c.start)*l,y=r.y+3,b=r.height-6;if(v<1)continue;let x=a.has(c.id),S=o===c.id,ee;ee=x?d:S?f:c.color??u,e.fillStyle=ee,e.beginPath(),GO(e,_,y,v,b,Math.min(m,v/2,b/2)),e.fill(),g&&(e.strokeStyle=`#fff`,e.lineWidth=1.5,e.beginPath(),GO(e,_,y,v,b,Math.min(m,v/2,b/2)),e.stroke()),x&&!g&&(e.strokeStyle=d,e.lineWidth=1,e.beginPath(),GO(e,_,y,v,b,Math.min(m,v/2,b/2)),e.stroke()),v>=40&&c.label&&(e.fillStyle=p,e.font=`11px system-ui, sans-serif`,e.textBaseline=`middle`,e.save(),e.beginPath(),e.rect(_+4,y,v-8,b),e.clip(),e.fillText(c.label,_+6,y+b/2),e.restore())}}function WO(e,n,r){if(n.kind!==`marquee`)return;let i=Math.min(n.startLogicalX,n.currentLogicalX)*r,a=Math.max(n.startLogicalX,n.currentLogicalX)*r,o=Math.min(n.startY,n.currentY),s=Math.max(n.startY,n.currentY);e.fillStyle=`rgba(100, 150, 255, 0.15)`,e.fillRect(i,o,a-i,s-o),e.strokeStyle=`rgba(100, 150, 255, 0.6)`,e.lineWidth=1,e.strokeRect(i,o,a-i,s-o)}function GO(e,n,r,i,a,o){o=Math.max(0,o),e.moveTo(n+o,r),e.arcTo(n+i,r,n+i,r+a,o),e.arcTo(n+i,r+a,n,r+a,o),e.arcTo(n,r+a,n,r,o),e.arcTo(n,r,n+i,r,o),e.closePath()}const KO=[`--timeline-bg`,`--timeline-track-bg`,`--timeline-track-bg-alt`,`--timeline-alt-major-bg`,`--timeline-grid-major-color`,`--timeline-grid-minor-color`,`--timeline-grid-major-width`,`--timeline-grid-minor-width`,`--timeline-event-bg`,`--timeline-event-selected-bg`,`--timeline-event-tickled-bg`,`--timeline-event-label-color`,`--timeline-event-radius`,`--timeline-axis-label-color`];function qO(e){let n=getComputedStyle(e),r={};for(let e of KO)r[e]=n.getPropertyValue(e).trim();return r}function JO(e,n,r){return e/n+r}function YO(e){return e>0?1/e:1}function XO(e,n,r,i,a){let o=i.find(e=>n>=e.y&&n<e.y+e.height);if(!o)return{kind:`empty`,logicalX:e,y:n,trackKey:void 0};let s=8*YO(a),c=r.filter(e=>e.trackKey===o.trackKey);for(let n of c)if(!(e<n.start||e>n.end))return e<=n.start+s?{kind:`event-start`,eventId:n.id}:e>=n.end-s?{kind:`event-end`,eventId:n.id}:{kind:`event-move`,eventId:n.id,trackKey:o.trackKey,offsetX:e-n.start};return{kind:`empty`,logicalX:e,y:n,trackKey:o.trackKey}}function ZO(e,n){return n.find(n=>e>=n.y&&e<n.y+n.height)?.trackKey}function QO(e,n){return Math.abs(e)>n?e-Math.sign(e)*n:0}function $O(e,n,r,i,a){let o=n*Math.exp(-a/100),s=r-(r-e)*n/o;return o>0&&(s+=-i/o),{ppu:o,viewMin:s}}function ek(e,n,r,i,a,o){let s=n-e,c=s*Math.exp(-a/100),l=i-(s>0?(i-e)/s:.5)*c;return r>0&&(l+=o/r),{vMin:l,vMax:l+c}}function tk(e,n){let r=new AbortController,i=r.signal;return n.addEventListener(`pointerdown`,r=>{let i=e.pxPerUnit,a=n.convertFromViewportToCanvas(r.offsetX,r.offsetY),o=JO(a.x,i,e.min),s=a.y,c=n.logicalScrollTop;if(s>=c&&s<c+e.axisHeight){n.setPointerCapture(r.pointerId),e._drag={kind:`axis-zoom`,anchorUnit:o,startScreenX:r.screenX,startScreenY:r.screenY,startViewMin:e._viewRange.min,startPpu:i};return}let l=XO(o,s,e._internalEvents,e._trackLayout,i);if(r.shiftKey&&l.kind===`event-move`){rk(e,l.eventId);return}if(l.kind===`event-move`){n.setPointerCapture(r.pointerId),e._drag={kind:`event-move`,eventId:l.eventId,originTrackKey:l.trackKey,offsetX:l.offsetX};return}if(l.kind===`event-start`){n.setPointerCapture(r.pointerId),e._drag={kind:`event-start`,eventId:l.eventId};return}if(l.kind===`event-end`){n.setPointerCapture(r.pointerId),e._drag={kind:`event-end`,eventId:l.eventId};return}l.kind===`empty`&&(n.setPointerCapture(r.pointerId),e._drag={kind:`marquee`,startLogicalX:o,startY:s,currentLogicalX:o,currentY:s})},{signal:i}),n.addEventListener(`pointermove`,r=>{let i=e._drag;if(i.kind===`none`){nk(e,n,r);return}let a=e.pxPerUnit,o=n.convertFromViewportToCanvas(r.offsetX,r.offsetY),s=JO(o.x,a,e.min),c=o.y;if(i.kind===`axis-zoom`){let n=r.screenX-i.startScreenX,a=r.screenY-i.startScreenY;if(Math.abs(n)+Math.abs(a)<5)return;let o=QO(n,4),s=QO(a,4),c=$O(i.startViewMin,i.startPpu,i.anchorUnit,o,s);e.setZoomPan(c.viewMin,c.ppu);return}if(i.kind===`marquee`){e._drag={...i,currentLogicalX:s,currentY:c},n.invalidateAll();return}if(i.kind===`event-move`){let r=e._internalEvents.find(e=>e.id===i.eventId);if(!r)return;let a=r.end-r.start,o=s,l=c,u=s-i.offsetX,d=u+a,f=ZO(c,e._trackLayout)??r.trackKey,p=e.pxPerUnit,m=IO(e._viewRange,e.userScale,n.viewportWidth,e.gridMode,e.minorStep,p),h=e.processDrag(i.eventId,o,l,u,d,f,i.originTrackKey,m);e._internalEvents=e._internalEvents.map(e=>e.id===i.eventId?{...e,start:h.start,end:h.end,trackKey:h.trackKey}:e),n.invalidateAll();return}if(i.kind===`event-start`){let r=e._internalEvents.find(e=>e.id===i.eventId);if(!r)return;let a=Math.min(s,r.end-1);e._internalEvents=e._internalEvents.map(e=>e.id===i.eventId?{...e,start:a}:e),n.invalidateAll();return}if(i.kind===`event-end`){let r=e._internalEvents.find(e=>e.id===i.eventId);if(!r)return;let a=Math.max(s,r.start+1);e._internalEvents=e._internalEvents.map(e=>e.id===i.eventId?{...e,end:a}:e),n.invalidateAll()}},{signal:i}),n.addEventListener(`pointerup`,r=>{let i=e._drag;if(n.releasePointerCapture(r.pointerId),i.kind===`axis-zoom`){e._drag={kind:`none`};return}if(i.kind===`marquee`){let r=Math.min(i.startLogicalX,i.currentLogicalX),a=Math.max(i.startLogicalX,i.currentLogicalX),o=Math.min(i.startY,i.currentY),s=Math.max(i.startY,i.currentY);if(Math.abs(a-r)<2&&Math.abs(s-o)<2)e._selectedIds=new Set,ik(e);else{let n=new Set;for(let i of e._internalEvents){let c=e._trackLayout.find(e=>e.trackKey===i.trackKey);if(!c)continue;let l=c.y+3,u=c.y+c.height-3;i.end>=r&&i.start<=a&&u>=o&&l<=s&&n.add(i.id)}e._selectedIds=n,ik(e)}e._drag={kind:`none`},n.invalidateAll();return}if(i.kind===`event-move`){let n=e._internalEvents.find(e=>e.id===i.eventId);n&&e.dispatchEvent(new CustomEvent(`event-move`,{detail:{eventId:n.id,fromTrackKey:i.originTrackKey,toTrackKey:n.trackKey,start:n.start,end:n.end},bubbles:!0,composed:!0})),e._drag={kind:`none`};return}if(i.kind===`event-start`||i.kind===`event-end`){let n=e._internalEvents.find(e=>e.id===i.eventId);n&&e.dispatchEvent(new CustomEvent(`event-resize`,{detail:{eventId:n.id,start:n.start,end:n.end},bubbles:!0,composed:!0})),e._drag={kind:`none`};return}e._drag={kind:`none`}},{signal:i}),n.addEventListener(`pointerleave`,()=>{e._tickledId!==void 0&&(e._tickledId=void 0,n.invalidateAll())},{signal:i}),()=>r.abort()}function nk(e,n,r){let i=e.pxPerUnit,a=n.convertFromViewportToCanvas(r.offsetX,r.offsetY),o=JO(a.x,i,e.min),s=a.y,c=n.logicalScrollTop;if(s>=c&&s<c+e.axisHeight){n.style.cursor=`col-resize`,e._tickledId!==void 0&&(e._tickledId=void 0,n.invalidateAll());return}let l=XO(o,s,e._internalEvents,e._trackLayout,i),u;(l.kind===`event-move`||l.kind===`event-start`||l.kind===`event-end`)&&(u=l.eventId),l.kind===`event-start`||l.kind===`event-end`?n.style.cursor=`ew-resize`:l.kind===`event-move`?n.style.cursor=`grab`:n.style.cursor=`crosshair`,u!==e._tickledId&&(e._tickledId=u,n.invalidateAll())}function rk(e,n){let r=new Set(e._selectedIds);r.has(n)?r.delete(n):r.add(n),e._selectedIds=r,ik(e),e.getVCanvas()?.invalidateAll()}function ik(e){e.dispatchEvent(new CustomEvent(`selection-change`,{detail:{selectedIds:[...e._selectedIds]},bubbles:!0,composed:!0}))}const ak=r`
|
|
12327
12496
|
:host {
|
|
12328
12497
|
/* Layout */
|
|
12329
12498
|
--timeline-axis-height: 24px;
|
|
@@ -12473,7 +12642,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12473
12642
|
.meta-area.visible {
|
|
12474
12643
|
display: block;
|
|
12475
12644
|
}
|
|
12476
|
-
`;let
|
|
12645
|
+
`;let ok=class extends n{constructor(...e){super(...e),this.label=``,this.trackKey=``,this.selected=!1,this.reorderable=!1,this.resizable=!1,this.#e=!1,this.#t=0,this.#n=0,this.#r=void 0,this.#o=e=>{if(this.#e){let n=e.screenY-this.#t,r=Math.max(24,this.#n+n);this.#a(`track-resize-move`,r);return}this.#i(e)?this.style.cursor=`ns-resize`:this.style.cursor=``},this.#s=e=>{this.#i(e)&&(e.stopPropagation(),e.preventDefault(),this.#e=!0,this.#t=e.screenY,this.#n=this.offsetHeight,this.#r=e.pointerId,this.setPointerCapture(e.pointerId))},this.#c=e=>{if(!this.#e)return;let n=e.screenY-this.#t,r=Math.max(24,this.#n+n);this.#a(`track-resize`,r),this.#u(e.pointerId)},this.#l=e=>{this.#e&&this.#u(this.#r)}}static{this.styles=[w,Yt,r`
|
|
12477
12646
|
:host {
|
|
12478
12647
|
display: flex;
|
|
12479
12648
|
align-items: center;
|
|
@@ -12518,7 +12687,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12518
12687
|
`]}#e;#t;#n;#r;connectedCallback(){super.connectedCallback(),this.addEventListener(`pointermove`,this.#o),this.addEventListener(`pointerdown`,this.#s),this.addEventListener(`pointerup`,this.#c),this.addEventListener(`pointercancel`,this.#l),this.addEventListener(`lostpointercapture`,this.#l)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointermove`,this.#o),this.removeEventListener(`pointerdown`,this.#s),this.removeEventListener(`pointerup`,this.#c),this.removeEventListener(`pointercancel`,this.#l),this.removeEventListener(`lostpointercapture`,this.#l),this.#e=!1}render(){return i`
|
|
12519
12688
|
<span class="handle ixfx-handle" data-handle="dotted" data-shape="spot" part="handle"></span>
|
|
12520
12689
|
<span class="label">${this.label}</span>
|
|
12521
|
-
`}#i(e){if(!this.resizable)return!1;let n=this.getBoundingClientRect();return e.clientY>=n.bottom-6}#a(e,n){this.dispatchEvent(new CustomEvent(e,{detail:{trackKey:this.trackKey,height:n},bubbles:!0,composed:!0}))}#o;#s;#c;#l;#u(e){if(this.#e=!1,this.#t=0,this.#n=0,e!==void 0)try{this.releasePointerCapture(e)}catch{}this.#r=void 0,this.style.cursor=``}};E([d({type:String})],
|
|
12690
|
+
`}#i(e){if(!this.resizable)return!1;let n=this.getBoundingClientRect();return e.clientY>=n.bottom-6}#a(e,n){this.dispatchEvent(new CustomEvent(e,{detail:{trackKey:this.trackKey,height:n},bubbles:!0,composed:!0}))}#o;#s;#c;#l;#u(e){if(this.#e=!1,this.#t=0,this.#n=0,e!==void 0)try{this.releasePointerCapture(e)}catch{}this.#r=void 0,this.style.cursor=``}};E([d({type:String})],ok.prototype,`label`,void 0),E([d({type:String,attribute:`track-key`})],ok.prototype,`trackKey`,void 0),E([d({type:Boolean,reflect:!0})],ok.prototype,`selected`,void 0),E([d({type:Boolean,reflect:!0})],ok.prototype,`reorderable`,void 0),E([d({type:Boolean,reflect:!0})],ok.prototype,`resizable`,void 0),ok=E([T(`ixfx-timeline-track-tab`)],ok);function sk(e,n,r,i,a=0,o=0){return{x:e+r-i,y:n+a-o}}function ck(e,n,r,i,a=0,o=0){return{x:e-r+i,y:n-a+o}}function lk(e,n,r){return Math.max(n,Math.min(e,r))}const uk=r`
|
|
12522
12691
|
:host {
|
|
12523
12692
|
display: block;
|
|
12524
12693
|
position: relative;
|
|
@@ -12607,7 +12776,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12607
12776
|
scroll-timeline: --scrollfade x;
|
|
12608
12777
|
}
|
|
12609
12778
|
|
|
12610
|
-
`;function yO(e,n){return e*n}function bO(e,n){return n===0||e<=n}function xO(e,n){return e<0||n===0?0:bO(e,n)?(n-e)/2:0}function SO(e,n,r,i,a){if(n===0||e<0)return 0;let o=r+i*a;return e>=o?0:bO(r,i)?r:e+n>o?Math.max(0,o-e):n}function CO(e,n,r,i){if(r===0)return{firstTile:0,lastTile:0,tiles:[]};let a=yO(n,i.tileWidthMultiplier);if(bO(r,n))return{firstTile:0,lastTile:0,tiles:[{index:0,logicalX:0}]};let o=Math.floor(e/a),s=Math.floor((e+n-1)/a),c=Math.max(0,Math.ceil(r/a)-1),l=[],u=o,d=Math.min(s+i.tilesBuffer,c);for(let e=u;e<=d;e++){let n=e*a;if(!(n>=r)&&(l.push({index:e,logicalX:n}),l.length>=i.maxPoolSize))break}return{firstTile:Math.max(0,o),lastTile:l.length>0?l[l.length-1].index:0,tiles:l}}function wO(e,n){return e*n}function TO(e,n){return n===0||e<=n}function EO(e,n){return e<0||n===0?0:TO(e,n)?(n-e)/2:0}function DO(e,n,r,i,a){if(n===0||e<0)return 0;let o=r+i*a;return e>=o?0:TO(r,i)?r:e+n>o?Math.max(0,o-e):n}function OO(e,n,r,i){if(r===0)return{firstRow:0,lastRow:0,rows:[]};let a=wO(n,i.tileHeightMultiplier);if(TO(r,n))return{firstRow:0,lastRow:0,rows:[{row:0,logicalY:0}]};let o=Math.floor(e/a),s=Math.floor((e+n-1)/a),c=Math.max(0,Math.ceil(r/a)-1),l=[],u=Math.min(s+i.tilesBuffer,c);for(let e=o;e<=u;e++){let n=e*a;if(!(n>=r)&&(l.push({row:e,logicalY:n}),l.length>=i.maxPoolSize))break}return{firstRow:Math.max(0,o),lastRow:l.length>0?l[l.length-1].row:0,rows:l}}function kO(e,n){let r=null,i=(...i)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(...i)},n)};return i.cancel=()=>{r&&=(clearTimeout(r),null)},i}const AO=[`#FF6B6B`,`#4ECDC4`,`#45B7D1`,`#96CEB4`,`#FFEAA7`,`#DDA0DD`,`#98D8C8`,`#F7DC6F`,`#BB8FCE`,`#85C1E9`];function jO(e){return AO[e%AO.length]}function MO(e,n,r,i,a){i.fillStyle=`whitesmoke`,i.fillRect(a.x,a.y,a.width,a.height),i.fillStyle=jO(e),i.strokeStyle=jO(e),i.lineWidth=2,i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(a.x+a.width,a.y+a.height),i.moveTo(a.x+a.width,a.y),i.lineTo(a.x,a.y+a.height),i.stroke(),i.font=`24pt system-ui`,i.textBaseline=`top`,i.fillText(`#${e}/${n}`,a.x+20,a.y+20),i.font=`18pt system-ui`,i.fillText(`Pos: ${Math.round(a.x)},${Math.round(a.y)}`,a.x+20,a.y+60),i.fillText(`Size: ${Math.round(a.width)}x${Math.round(a.height)}`,a.x+20,a.y+90),i.fillText(`VCanvas width: ${Math.round(r)}`,a.x+20,a.y+120);let o=a.x+a.width/2,s=a.y+a.height/2;i.beginPath(),i.moveTo(a.x,s),i.lineTo(a.x+a.width,s),i.moveTo(o,a.y),i.lineTo(o,a.y+a.height),i.stroke(),i.strokeRect(a.x,a.y,a.width,a.height)}var NO=function(e,n,r,i){var a=arguments.length,o=a<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,r):i,s;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(o=(a<3?s(o):a>3?s(n,r,o):s(n,r))||o);return a>3&&o&&Object.defineProperty(n,r,o),o};const PO=(e,n)=>`${e},${n}`;let FO=class extends n{_emitScrollEndEvent(e){let n=new CustomEvent(`scrollend-virtual`,{detail:{logicalScrollLeft:this._scrollLeft,logicalScrollTop:this._scrollTop,userGesture:e,containerScrollLeft:this._scrollContainer?.scrollLeft??0,containerScrollTop:this._scrollContainer?.scrollTop??0},bubbles:!0,composed:!0});this.dispatchEvent(n)}constructor(){super(),this.debugTrace=!1,this.debugDraw=!1,this.hinting=!1,this._viewportWidth=0,this._viewportHeight=0,this._scrollLeft=0,this._scrollTop=0,this._logicalHeight=0,this._tilePool=new Map,this._visibleTiles=new Set,this._pendingDraws=new Map,this._scrollContainer=null,this._spacer=null,this._tilePoolEl=null,this._childrenContainerEl=null,this._resizeObserver=null,this._positionedChildren=new Map,this._boundOnScroll=this._onScroll.bind(this),this._renderingOptions={tileWidthMultiplier:.5,tileHeightMultiplier:.5,tilesBuffer:2,overlapPercent:.01,overscrollPadMultiplier:1,maxPoolSize:3,scrollDebounceMs:100},this._dpr=window.devicePixelRatio||1,this._logicalWidth=0,this.logicalWidth=0,this.logicalHeight=0,this.drawCallback=null,this._scrollDebounce=kO(()=>{this._requestRedrawAll(`scrollDebounce`)},this._renderingOptions.scrollDebounceMs),this._scrollEndDebounce=kO(()=>{this._emitScrollEndEvent(!0)},this._renderingOptions.scrollDebounceMs),this._resizeDebounce=kO(()=>{this._onResize()},this._renderingOptions.scrollDebounceMs)}static{this.styles=vO}connectedCallback(){super.connectedCallback(),this._setupResizeObserver()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._scrollEndDebounce.cancel(),this._pendingDraws.forEach(e=>e.abort()),this._tilePool.clear(),this._scrollContainer?.removeEventListener(`scroll`,this._boundOnScroll)}firstUpdated(){let e=this.shadowRoot?.querySelector(`.scroll-container`);this._scrollContainer=e,this._spacer=this.shadowRoot?.querySelector(`.spacer`),this._tilePoolEl=this.shadowRoot?.querySelector(`.tile-pool`),this._childrenContainerEl=this.shadowRoot?.querySelector(`.children-container`),this._scrollContainer&&this._scrollContainer.addEventListener(`scroll`,this._boundOnScroll),requestAnimationFrame(()=>{this._updateViewportDimensions(),this._updateSpacer(),this._updateScrollContainerClass(),this._recalculateTiles(`firstUpdated cb`),this._positionChildren(`firstUpdated cb`)})}set logicalWidth(e){this._logicalWidth=e,this._updateSpacer(),this._updateScrollContainerClass(),this.hasUpdated&&(this._updateTileWidths(`set logicalWidth`),this._recalculateTiles(`set logicalWidth`))}get logicalWidth(){return this._logicalWidth}set logicalHeight(e){this._logicalHeight=e,this._updateSpacer(),this._updateScrollContainerClass(),this.hasUpdated&&this._recalculateTiles(`set logicalHeight`)}get logicalHeight(){return this._logicalHeight}get effectiveLogicalWidth(){return this._logicalWidth||this._viewportWidth}get effectiveLogicalHeight(){return this._logicalHeight||this._viewportHeight}_setupResizeObserver(){this._resizeObserver=new ResizeObserver(()=>{this._resizeDebounce()}),this._resizeObserver.observe(this)}_onResize(){let e=this._viewportWidth,n=this._viewportHeight;this._updateViewportDimensions();let r=e!==this._viewportWidth,i=n!==this._viewportHeight;(r||i)&&(this._updateSpacer(),this._updateScrollContainerClass(),this._recalculateTiles(`onResize`))}_updateTileWidths(e){let n=this._getTileWidth();for(let e of this._tilePool.values()){let r=this._getTileClippedWidth(e.logicalX,n);e.canvas.width=r*this._dpr,e.canvas.style.width=`${r}px`,e.ctx.scale(this._dpr,this._dpr)}this._requestRedrawAll(`updateTileWidths (${e})`)}_updateViewportDimensions(){let e=this.getBoundingClientRect();this._viewportWidth=e.width,this._viewportHeight=e.height}_onScroll(){if(!this._scrollContainer)return;let e=this._scrollContainer.scrollLeft,n=this._scrollContainer.scrollTop;(e!==this._scrollLeft||n!==this._scrollTop)&&(this._scrollLeft=e,this._scrollTop=n,this._recalculateTiles(`onScroll`),this._emitScrollEvent(!0),this._scrollDebounce(),this._scrollEndDebounce())}_updateSpacer(){if(!this._spacer)return;let e=bO(this.effectiveLogicalWidth,this._viewportWidth),n=TO(this.effectiveLogicalHeight,this._viewportHeight);e&&n?this._spacer.style.display=`none`:(this._spacer.style.display=`block`,this._spacer.style.width=`${this.effectiveLogicalWidth}px`,this._spacer.style.height=`${this.effectiveLogicalHeight}px`),this._childrenContainerEl&&(this._childrenContainerEl.style.width=`${this.effectiveLogicalWidth}px`,this._childrenContainerEl.style.height=`${this.effectiveLogicalHeight}px`)}_updateScrollContainerClass(){if(!this._scrollContainer)return;let e=this.effectiveLogicalHeight>this._viewportHeight;this._scrollContainer.classList.toggle(`vertical`,e)}_getTileWidth(){return yO(this._viewportWidth,this._renderingOptions.tileWidthMultiplier)}_getTileHeight(){return wO(this._viewportHeight,this._renderingOptions.tileHeightMultiplier)}_getTileClippedWidth(e,n){return SO(e,n,this.effectiveLogicalWidth,this._viewportWidth,this._renderingOptions.overscrollPadMultiplier)}_getTileClippedHeight(e,n){return DO(e,n,this.effectiveLogicalHeight,this._viewportHeight,this._renderingOptions.overscrollPadMultiplier)}_calculateTileRange(){return CO(this._scrollLeft,this._viewportWidth,this.effectiveLogicalWidth,this._renderingOptions)}_calculateTileRowRange(){return OO(this._scrollTop,this._viewportHeight,this.effectiveLogicalHeight,this._renderingOptions)}_recalculateTiles(e){this._updateViewportDimensions();let{tiles:n}=this._calculateTileRange(),{rows:r}=this._calculateTileRowRange(),i=new Set;for(let{index:e,logicalX:a}of n)for(let{row:n,logicalY:o}of r)i.add(PO(e,n)),this._tilePool.has(PO(e,n))||this._tilePool.set(PO(e,n),this._createTile(e,n,a,o));let a=this._renderingOptions.maxPoolSize*Math.max(1,r.length),o=[...this._tilePool.keys()].filter(e=>!i.has(e)),s=[...i].filter(e=>!this._tilePool.has(e)),c=Math.min(o.length,s.length);for(let e=0;e<c;e++){let n=o[e],r=s[e],i=this._tilePool.get(n);if(i&&r){let[e,a]=r.split(`,`),o=Number(e),s=Number(a);this._tilePool.delete(n),i.col=o,i.row=s,i.logicalX=o*this._getTileWidth(),i.logicalY=s*this._getTileHeight(),i.visible=!1,i.canvas.dataset.tileKey=r,this._tilePool.set(r,i)}}let l=[...this._tilePool.keys()];if(l.length>a){let e=l.length-a;l.filter(e=>!i.has(e)).slice(0,e).forEach(e=>{let n=this._tilePool.get(e);n&&(this._tilePool.delete(e),n.canvas.remove())})}this._updateTiles(`recalculateTiles (${e})`)}_createTile(e,n,r,i){let a=document.createElement(`canvas`),o=PO(e,n);a.dataset.tileKey=o;let s=this._getTileWidth(),c=this._getTileHeight(),l=this._getTileClippedWidth(r,s),u=this._getTileClippedHeight(i,c),d=a.getContext(`2d`);if(!d)throw Error(`Could not get canvas context`);return this._viewportHeight===0&&this.#e(`Warning: Creating tile ${o} with viewport height 0. The VCanvas component may not be properly sized or visible.`),a.width=l*this._dpr,a.height=u*this._dpr,a.style.width=`${l}px`,a.style.height=`${u}px`,d.scale(this._dpr,this._dpr),this.#e(`Created tile ${o} at logicalX ${r} logicalY ${i}`),{canvas:a,ctx:d,logicalX:r,logicalY:i,col:e,row:n,visible:!1,isInDOM:!1}}_updateTiles(e){let{tiles:n,firstTile:r,lastTile:i}=this._calculateTileRange(),{rows:a,firstRow:o,lastRow:s}=this._calculateTileRowRange(),c=this._getTileWidth(),l=this._getTileHeight(),u=bO(this.effectiveLogicalWidth,this._viewportWidth),d=TO(this.effectiveLogicalHeight,this._viewportHeight),f=xO(this.effectiveLogicalWidth,this._viewportWidth),p=EO(this.effectiveLogicalHeight,this._viewportHeight),m=this._renderingOptions.tilesBuffer,h=[];for(let e of this._tilePool.values())e.visible=!1;this._visibleTiles.clear();for(let[n,a]of this._tilePool){let g=u?a.col===0:a.col>=r-m&&a.col<=i+m,_=d?a.row===0:a.row>=o-m&&a.row<=s+m;if(g&&_){this._visibleTiles.add(n);let r=a.col*c,i=a.row*l,o=u?f:r,s=d?p:i,m=this._getTileClippedWidth(r,c),g=this._getTileClippedHeight(i,l);(!a.visible||a.logicalX!==r||a.logicalY!==i||a.canvas.style.left!==`${o}px`||a.canvas.style.top!==`${s}px`||a.canvas.width!==m*this._dpr||a.canvas.height!==g*this._dpr)&&(a.logicalX=r,a.logicalY=i,a.canvas.width=m*this._dpr,a.canvas.style.width=`${m}px`,a.canvas.height=g*this._dpr,a.canvas.style.height=`${g}px`,a.canvas.style.left=`${o}px`,a.canvas.style.top=`${s}px`,a.ctx.scale(this._dpr,this._dpr),!a.isInDOM&&this._tilePoolEl&&(this._tilePoolEl.appendChild(a.canvas),a.isInDOM=!0),a.visible||(h.push(n),this._requestTileDraw(`updateTiles(${e})`,n))),a.visible=!0}else a.visible&&(a.visible=!1,a.isInDOM=!1,a.canvas.remove())}for(let{index:r,logicalX:i}of n)for(let{row:n,logicalY:o}of a){let a=PO(r,n);if(!this._tilePool.has(a)&&this._tilePoolEl){let s=this._createTile(r,n,i,o),c=u?f:i,l=d?p:o;s.canvas.style.left=`${c}px`,s.canvas.style.top=`${l}px`,s.visible=!0,s.isInDOM=!0,this._tilePoolEl.appendChild(s.canvas),this._tilePool.set(a,s),this._visibleTiles.add(a),h.push(a),this._requestTileDraw(`updateTiles(${e})`,a)}}return h}_requestRedrawAll(e){this.#e(`Requesting _requestRedrawAll: ${e} visible tiles: ${this._visibleTiles.size} pending draws: ${this._pendingDraws.size}`),this._pendingDraws.forEach(e=>e.abort()),this._pendingDraws.clear();for(let n of this._visibleTiles)this._requestTileDraw(`requestRedrawAll(${e})`,n)}#e(e){this.debugTrace&&console.log(`[VCanvas]`,e)}_requestTileDraw(e,n,r){let i=this._tilePool.get(n);if(!i||!this.drawCallback)return;let a=new AbortController;this._pendingDraws.set(n,a);let o=this._getTileWidth(),s=this._getTileHeight(),c=bO(this.effectiveLogicalWidth,this._viewportWidth),l=TO(this.effectiveLogicalHeight,this._viewportHeight),u;if(r)u=r;else{let e=o*this._renderingOptions.overlapPercent,n=s*this._renderingOptions.overlapPercent;u={x:c?0:i.logicalX-e,y:l?0:i.logicalY-n,width:c?this.effectiveLogicalWidth:o+e*2,height:l?this.effectiveLogicalHeight:s+n*2}}i.ctx.save(),i.ctx.translate(-i.logicalX,-i.logicalY);let d=u.x-i.logicalX,f=u.y-i.logicalY;r?(i.ctx.beginPath(),i.ctx.rect(d,f,u.width,u.height),i.ctx.clip(),i.ctx.clearRect(d,f,u.width,u.height)):i.ctx.clearRect(0,0,i.canvas.width,i.canvas.height),this.debugDraw&&MO(i.col,this._tilePool.size,this.effectiveLogicalWidth,i.ctx,u);try{this.drawCallback(i.ctx,u,a.signal)}finally{i&&i.ctx.restore(),this._pendingDraws.delete(n)}}_emitScrollEvent(e){let n=new CustomEvent(`scroll-virtual`,{detail:{logicalScrollLeft:this._scrollLeft,logicalScrollTop:this._scrollTop,userGesture:e,containerScrollLeft:this._scrollContainer?.scrollLeft??0,containerScrollTop:this._scrollContainer?.scrollTop??0,viewportStartLogical:this._scrollLeft,viewportEndLogical:this._scrollLeft+this._viewportWidth,viewportStartLogicalY:this._scrollTop,viewportEndLogicalY:this._scrollTop+this._viewportHeight},bubbles:!0,composed:!0});this.dispatchEvent(n)}isRegionVisible(e){let n=this._scrollLeft,r=this._scrollLeft+this._viewportWidth,i=e.x+e.width>n&&e.x<r,a=this._scrollTop,o=this._scrollTop+this._viewportHeight,s=e.y+e.height>a&&e.y<o;return i&&s}_updateScrollPosition(e){this._scrollContainer&&(this._scrollContainer.scrollLeft=this._scrollLeft,this._scrollContainer.scrollTop=this._scrollTop),this._recalculateTiles(`updateScrollPosition`),this._emitScrollEvent(e),this._scrollDebounce()}get logicalScrollLeft(){return this._scrollLeft}set logicalScrollLeft(e){let n=this._scrollLeft,r=_O(e,0,Math.max(0,this.effectiveLogicalWidth-this._viewportWidth));r!==this._scrollLeft&&(this._scrollLeft=r,this.requestUpdate(`logicalScrollLeft`,n),this._updateScrollPosition(!1))}get logicalScrollTop(){return this._scrollTop}set logicalScrollTop(e){let n=this._scrollTop,r=_O(e,0,Math.max(0,this.effectiveLogicalHeight-this._viewportHeight));r!==this._scrollTop&&(this._scrollTop=r,this.requestUpdate(`logicalScrollTop`,n),this._updateScrollPosition(!1))}get containerScrollLeft(){return this._scrollContainer?.scrollLeft??0}get containerScrollTop(){return this._scrollContainer?.scrollTop??0}get viewportWidth(){return this._viewportWidth}get viewportHeight(){return this._viewportHeight}setRenderingOptions(e){this._renderingOptions={...this._renderingOptions,...e},this._recalculateTiles(`setRenderingOptions`)}getRenderingOptions(){return this._renderingOptions}invalidateAll(){this._requestRedrawAll(`invalidateAll`)}invalidateRegion(e,n,r,i){this.#e(`invalidateRegion: ${e},${n},${r},${i}`);let a=this._getTileWidth(),o=this._getTileHeight(),{firstTile:s,lastTile:c}=this._calculateTileRange(),{firstRow:l,lastRow:u}=this._calculateTileRowRange(),d=this._renderingOptions.overlapPercent,f=Math.floor(e/a),p=Math.ceil((e+r)/a),m=Math.floor(n/o),h=Math.ceil((n+i)/o);for(let g=Math.max(s,f);g<=Math.min(c,p);g++)for(let s=Math.max(l,m);s<=Math.min(u,h);s++){let c=PO(g,s);if(this._visibleTiles.has(c)){let s=this._tilePool.get(c);if(s){let l=a*d,u=o*d,f=s.logicalX-l,p=s.logicalX+a+l,m=s.logicalY-u,h=s.logicalY+o+u,g=Math.max(e,f),_=Math.min(e+r,p)-g,v=Math.max(n,m),y=Math.min(n+i,h)-v;if(_>0&&y>0){let e={x:g,y:v,width:_,height:y};this._requestTileDraw(`invalidateRegion`,c,e)}}}}}convertFromViewportToCanvas(e,n){let r=xO(this.effectiveLogicalWidth,this._viewportWidth),i=EO(this.effectiveLogicalHeight,this._viewportHeight);return hO(e,n,this._scrollLeft,r,this._scrollTop,i)}convertFromCanvasToViewport(e,n){let r=xO(this.effectiveLogicalWidth,this._viewportWidth),i=EO(this.effectiveLogicalHeight,this._viewportHeight);return gO(e,n,this._scrollLeft,r,this._scrollTop,i)}positionChildRange(e,n,r,i,a){if(Number.isNaN(n)||Number.isNaN(r)){console.warn(`positionChildRange: Invalid startX or endX values: ${n}, ${r}`);return}let o=Array.from(this.children).filter(n=>n.matches?.(e)),s=i??0,c=a??this.effectiveLogicalHeight;for(let e of o)this._positionedChildren.set(e,{startX:n,endX:r,startY:s,endY:c});this._positionChildren(`positionChildRange`)}manualChildPositioningUpdate(){this._positionChildren(`manualChildPositioningUpdate`)}positionChildClear(e){for(let[n]of this._positionedChildren)n.matches?.(e)&&(this._positionedChildren.delete(n),n.removeAttribute(`style`))}_positionChildren(e){if(this.#e(`_positionChildren: ${e} positionedChildren: ${this._positionedChildren.size}`),this.hasUpdated&&this._childrenContainerEl)for(let[e,n]of this._positionedChildren){let r=n.endX-n.startX,i=n.endY-n.startY;e.setAttribute(`style`,`position: absolute; left: ${n.startX}px; top: ${n.startY}px; width: ${r}px; height: ${i}px;`)}}render(){let e=v({"scroll-container":!0,scrollable:this.hinting});return i`
|
|
12779
|
+
`;function dk(e,n){return e*n}function fk(e,n){return n===0||e<=n}function pk(e,n){return e<0||n===0?0:fk(e,n)?(n-e)/2:0}function mk(e,n,r,i,a){if(n===0||e<0)return 0;let o=r+i*a;return e>=o?0:fk(r,i)?r:e+n>o?Math.max(0,o-e):n}function hk(e,n,r,i){if(r===0)return{firstTile:0,lastTile:0,tiles:[]};let a=dk(n,i.tileWidthMultiplier);if(fk(r,n))return{firstTile:0,lastTile:0,tiles:[{index:0,logicalX:0}]};let o=Math.floor(e/a),s=Math.floor((e+n-1)/a),c=Math.max(0,Math.ceil(r/a)-1),l=[],u=o,d=Math.min(s+i.tilesBuffer,c);for(let e=u;e<=d;e++){let n=e*a;if(!(n>=r)&&(l.push({index:e,logicalX:n}),l.length>=i.maxPoolSize))break}return{firstTile:Math.max(0,o),lastTile:l.length>0?l[l.length-1].index:0,tiles:l}}function gk(e,n){return e*n}function _k(e,n){return n===0||e<=n}function vk(e,n){return e<0||n===0?0:_k(e,n)?(n-e)/2:0}function yk(e,n,r,i,a){if(n===0||e<0)return 0;let o=r+i*a;return e>=o?0:_k(r,i)?r:e+n>o?Math.max(0,o-e):n}function bk(e,n,r,i){if(r===0)return{firstRow:0,lastRow:0,rows:[]};let a=gk(n,i.tileHeightMultiplier);if(_k(r,n))return{firstRow:0,lastRow:0,rows:[{row:0,logicalY:0}]};let o=Math.floor(e/a),s=Math.floor((e+n-1)/a),c=Math.max(0,Math.ceil(r/a)-1),l=[],u=Math.min(s+i.tilesBuffer,c);for(let e=o;e<=u;e++){let n=e*a;if(!(n>=r)&&(l.push({row:e,logicalY:n}),l.length>=i.maxPoolSize))break}return{firstRow:Math.max(0,o),lastRow:l.length>0?l[l.length-1].row:0,rows:l}}function xk(e,n){let r=null,i=(...i)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(...i)},n)};return i.cancel=()=>{r&&=(clearTimeout(r),null)},i}const Sk=[`#FF6B6B`,`#4ECDC4`,`#45B7D1`,`#96CEB4`,`#FFEAA7`,`#DDA0DD`,`#98D8C8`,`#F7DC6F`,`#BB8FCE`,`#85C1E9`];function Ck(e){return Sk[e%Sk.length]}function wk(e,n,r,i,a){i.fillStyle=`whitesmoke`,i.fillRect(a.x,a.y,a.width,a.height),i.fillStyle=Ck(e),i.strokeStyle=Ck(e),i.lineWidth=2,i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(a.x+a.width,a.y+a.height),i.moveTo(a.x+a.width,a.y),i.lineTo(a.x,a.y+a.height),i.stroke(),i.font=`24pt system-ui`,i.textBaseline=`top`,i.fillText(`#${e}/${n}`,a.x+20,a.y+20),i.font=`18pt system-ui`,i.fillText(`Pos: ${Math.round(a.x)},${Math.round(a.y)}`,a.x+20,a.y+60),i.fillText(`Size: ${Math.round(a.width)}x${Math.round(a.height)}`,a.x+20,a.y+90),i.fillText(`VCanvas width: ${Math.round(r)}`,a.x+20,a.y+120);let o=a.x+a.width/2,s=a.y+a.height/2;i.beginPath(),i.moveTo(a.x,s),i.lineTo(a.x+a.width,s),i.moveTo(o,a.y),i.lineTo(o,a.y+a.height),i.stroke(),i.strokeRect(a.x,a.y,a.width,a.height)}var Tk=function(e,n,r,i){var a=arguments.length,o=a<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,r):i,s;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(o=(a<3?s(o):a>3?s(n,r,o):s(n,r))||o);return a>3&&o&&Object.defineProperty(n,r,o),o};const Ek=(e,n)=>`${e},${n}`;let Dk=class extends n{_emitScrollEndEvent(e){let n=new CustomEvent(`scrollend-virtual`,{detail:{logicalScrollLeft:this._scrollLeft,logicalScrollTop:this._scrollTop,userGesture:e,containerScrollLeft:this._scrollContainer?.scrollLeft??0,containerScrollTop:this._scrollContainer?.scrollTop??0},bubbles:!0,composed:!0});this.dispatchEvent(n)}constructor(){super(),this.debugTrace=!1,this.debugDraw=!1,this.hinting=!1,this._viewportWidth=0,this._viewportHeight=0,this._scrollLeft=0,this._scrollTop=0,this._logicalHeight=0,this._tilePool=new Map,this._visibleTiles=new Set,this._pendingDraws=new Map,this._scrollContainer=null,this._spacer=null,this._tilePoolEl=null,this._childrenContainerEl=null,this._resizeObserver=null,this._positionedChildren=new Map,this._boundOnScroll=this._onScroll.bind(this),this._renderingOptions={tileWidthMultiplier:.5,tileHeightMultiplier:.5,tilesBuffer:2,overlapPercent:.01,overscrollPadMultiplier:1,maxPoolSize:3,scrollDebounceMs:100},this._dpr=window.devicePixelRatio||1,this._logicalWidth=0,this.logicalWidth=0,this.logicalHeight=0,this.drawCallback=null,this._scrollDebounce=xk(()=>{this._requestRedrawAll(`scrollDebounce`)},this._renderingOptions.scrollDebounceMs),this._scrollEndDebounce=xk(()=>{this._emitScrollEndEvent(!0)},this._renderingOptions.scrollDebounceMs),this._resizeDebounce=xk(()=>{this._onResize()},this._renderingOptions.scrollDebounceMs)}static{this.styles=uk}connectedCallback(){super.connectedCallback(),this._setupResizeObserver()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=null,this._scrollEndDebounce.cancel(),this._pendingDraws.forEach(e=>e.abort()),this._tilePool.clear(),this._scrollContainer?.removeEventListener(`scroll`,this._boundOnScroll)}firstUpdated(){let e=this.shadowRoot?.querySelector(`.scroll-container`);this._scrollContainer=e,this._spacer=this.shadowRoot?.querySelector(`.spacer`),this._tilePoolEl=this.shadowRoot?.querySelector(`.tile-pool`),this._childrenContainerEl=this.shadowRoot?.querySelector(`.children-container`),this._scrollContainer&&this._scrollContainer.addEventListener(`scroll`,this._boundOnScroll),requestAnimationFrame(()=>{this._updateViewportDimensions(),this._updateSpacer(),this._updateScrollContainerClass(),this._recalculateTiles(`firstUpdated cb`),this._positionChildren(`firstUpdated cb`)})}set logicalWidth(e){this._logicalWidth=e,this._updateSpacer(),this._updateScrollContainerClass(),this.hasUpdated&&(this._updateTileWidths(`set logicalWidth`),this._recalculateTiles(`set logicalWidth`))}get logicalWidth(){return this._logicalWidth}set logicalHeight(e){this._logicalHeight=e,this._updateSpacer(),this._updateScrollContainerClass(),this.hasUpdated&&this._recalculateTiles(`set logicalHeight`)}get logicalHeight(){return this._logicalHeight}get effectiveLogicalWidth(){return this._logicalWidth||this._viewportWidth}get effectiveLogicalHeight(){return this._logicalHeight||this._viewportHeight}_setupResizeObserver(){this._resizeObserver=new ResizeObserver(()=>{this._resizeDebounce()}),this._resizeObserver.observe(this)}_onResize(){let e=this._viewportWidth,n=this._viewportHeight;this._updateViewportDimensions();let r=e!==this._viewportWidth,i=n!==this._viewportHeight;(r||i)&&(this._updateSpacer(),this._updateScrollContainerClass(),this._recalculateTiles(`onResize`))}_updateTileWidths(e){let n=this._getTileWidth();for(let e of this._tilePool.values()){let r=this._getTileClippedWidth(e.logicalX,n);e.canvas.width=r*this._dpr,e.canvas.style.width=`${r}px`,e.ctx.scale(this._dpr,this._dpr)}this._requestRedrawAll(`updateTileWidths (${e})`)}_updateViewportDimensions(){let e=this.getBoundingClientRect();this._viewportWidth=e.width,this._viewportHeight=e.height}_onScroll(){if(!this._scrollContainer)return;let e=this._scrollContainer.scrollLeft,n=this._scrollContainer.scrollTop;(e!==this._scrollLeft||n!==this._scrollTop)&&(this._scrollLeft=e,this._scrollTop=n,this._recalculateTiles(`onScroll`),this._emitScrollEvent(!0),this._scrollDebounce(),this._scrollEndDebounce())}_updateSpacer(){if(!this._spacer)return;let e=fk(this.effectiveLogicalWidth,this._viewportWidth),n=_k(this.effectiveLogicalHeight,this._viewportHeight);e&&n?this._spacer.style.display=`none`:(this._spacer.style.display=`block`,this._spacer.style.width=`${this.effectiveLogicalWidth}px`,this._spacer.style.height=`${this.effectiveLogicalHeight}px`),this._childrenContainerEl&&(this._childrenContainerEl.style.width=`${this.effectiveLogicalWidth}px`,this._childrenContainerEl.style.height=`${this.effectiveLogicalHeight}px`)}_updateScrollContainerClass(){if(!this._scrollContainer)return;let e=this.effectiveLogicalHeight>this._viewportHeight;this._scrollContainer.classList.toggle(`vertical`,e)}_getTileWidth(){return dk(this._viewportWidth,this._renderingOptions.tileWidthMultiplier)}_getTileHeight(){return gk(this._viewportHeight,this._renderingOptions.tileHeightMultiplier)}_getTileClippedWidth(e,n){return mk(e,n,this.effectiveLogicalWidth,this._viewportWidth,this._renderingOptions.overscrollPadMultiplier)}_getTileClippedHeight(e,n){return yk(e,n,this.effectiveLogicalHeight,this._viewportHeight,this._renderingOptions.overscrollPadMultiplier)}_calculateTileRange(){return hk(this._scrollLeft,this._viewportWidth,this.effectiveLogicalWidth,this._renderingOptions)}_calculateTileRowRange(){return bk(this._scrollTop,this._viewportHeight,this.effectiveLogicalHeight,this._renderingOptions)}_recalculateTiles(e){this._updateViewportDimensions();let{tiles:n}=this._calculateTileRange(),{rows:r}=this._calculateTileRowRange(),i=new Set;for(let{index:e,logicalX:a}of n)for(let{row:n,logicalY:o}of r)i.add(Ek(e,n)),this._tilePool.has(Ek(e,n))||this._tilePool.set(Ek(e,n),this._createTile(e,n,a,o));let a=this._renderingOptions.maxPoolSize*Math.max(1,r.length),o=[...this._tilePool.keys()].filter(e=>!i.has(e)),s=[...i].filter(e=>!this._tilePool.has(e)),c=Math.min(o.length,s.length);for(let e=0;e<c;e++){let n=o[e],r=s[e],i=this._tilePool.get(n);if(i&&r){let[e,a]=r.split(`,`),o=Number(e),s=Number(a);this._tilePool.delete(n),i.col=o,i.row=s,i.logicalX=o*this._getTileWidth(),i.logicalY=s*this._getTileHeight(),i.visible=!1,i.canvas.dataset.tileKey=r,this._tilePool.set(r,i)}}let l=[...this._tilePool.keys()];if(l.length>a){let e=l.length-a;l.filter(e=>!i.has(e)).slice(0,e).forEach(e=>{let n=this._tilePool.get(e);n&&(this._tilePool.delete(e),n.canvas.remove())})}this._updateTiles(`recalculateTiles (${e})`)}_createTile(e,n,r,i){let a=document.createElement(`canvas`),o=Ek(e,n);a.dataset.tileKey=o;let s=this._getTileWidth(),c=this._getTileHeight(),l=this._getTileClippedWidth(r,s),u=this._getTileClippedHeight(i,c),d=a.getContext(`2d`);if(!d)throw Error(`Could not get canvas context`);return this._viewportHeight===0&&this.#e(`Warning: Creating tile ${o} with viewport height 0. The VCanvas component may not be properly sized or visible.`),a.width=l*this._dpr,a.height=u*this._dpr,a.style.width=`${l}px`,a.style.height=`${u}px`,d.scale(this._dpr,this._dpr),this.#e(`Created tile ${o} at logicalX ${r} logicalY ${i}`),{canvas:a,ctx:d,logicalX:r,logicalY:i,col:e,row:n,visible:!1,isInDOM:!1}}_updateTiles(e){let{tiles:n,firstTile:r,lastTile:i}=this._calculateTileRange(),{rows:a,firstRow:o,lastRow:s}=this._calculateTileRowRange(),c=this._getTileWidth(),l=this._getTileHeight(),u=fk(this.effectiveLogicalWidth,this._viewportWidth),d=_k(this.effectiveLogicalHeight,this._viewportHeight),f=pk(this.effectiveLogicalWidth,this._viewportWidth),p=vk(this.effectiveLogicalHeight,this._viewportHeight),m=this._renderingOptions.tilesBuffer,h=[];for(let e of this._tilePool.values())e.visible=!1;this._visibleTiles.clear();for(let[n,a]of this._tilePool){let g=u?a.col===0:a.col>=r-m&&a.col<=i+m,_=d?a.row===0:a.row>=o-m&&a.row<=s+m;if(g&&_){this._visibleTiles.add(n);let r=a.col*c,i=a.row*l,o=u?f:r,s=d?p:i,m=this._getTileClippedWidth(r,c),g=this._getTileClippedHeight(i,l);(!a.visible||a.logicalX!==r||a.logicalY!==i||a.canvas.style.left!==`${o}px`||a.canvas.style.top!==`${s}px`||a.canvas.width!==m*this._dpr||a.canvas.height!==g*this._dpr)&&(a.logicalX=r,a.logicalY=i,a.canvas.width=m*this._dpr,a.canvas.style.width=`${m}px`,a.canvas.height=g*this._dpr,a.canvas.style.height=`${g}px`,a.canvas.style.left=`${o}px`,a.canvas.style.top=`${s}px`,a.ctx.scale(this._dpr,this._dpr),!a.isInDOM&&this._tilePoolEl&&(this._tilePoolEl.appendChild(a.canvas),a.isInDOM=!0),a.visible||(h.push(n),this._requestTileDraw(`updateTiles(${e})`,n))),a.visible=!0}else a.visible&&(a.visible=!1,a.isInDOM=!1,a.canvas.remove())}for(let{index:r,logicalX:i}of n)for(let{row:n,logicalY:o}of a){let a=Ek(r,n);if(!this._tilePool.has(a)&&this._tilePoolEl){let s=this._createTile(r,n,i,o),c=u?f:i,l=d?p:o;s.canvas.style.left=`${c}px`,s.canvas.style.top=`${l}px`,s.visible=!0,s.isInDOM=!0,this._tilePoolEl.appendChild(s.canvas),this._tilePool.set(a,s),this._visibleTiles.add(a),h.push(a),this._requestTileDraw(`updateTiles(${e})`,a)}}return h}_requestRedrawAll(e){this.#e(`Requesting _requestRedrawAll: ${e} visible tiles: ${this._visibleTiles.size} pending draws: ${this._pendingDraws.size}`),this._pendingDraws.forEach(e=>e.abort()),this._pendingDraws.clear();for(let n of this._visibleTiles)this._requestTileDraw(`requestRedrawAll(${e})`,n)}#e(e){this.debugTrace&&console.log(`[VCanvas]`,e)}_requestTileDraw(e,n,r){let i=this._tilePool.get(n);if(!i||!this.drawCallback)return;let a=new AbortController;this._pendingDraws.set(n,a);let o=this._getTileWidth(),s=this._getTileHeight(),c=fk(this.effectiveLogicalWidth,this._viewportWidth),l=_k(this.effectiveLogicalHeight,this._viewportHeight),u;if(r)u=r;else{let e=o*this._renderingOptions.overlapPercent,n=s*this._renderingOptions.overlapPercent;u={x:c?0:i.logicalX-e,y:l?0:i.logicalY-n,width:c?this.effectiveLogicalWidth:o+e*2,height:l?this.effectiveLogicalHeight:s+n*2}}i.ctx.save(),i.ctx.translate(-i.logicalX,-i.logicalY);let d=u.x-i.logicalX,f=u.y-i.logicalY;r?(i.ctx.beginPath(),i.ctx.rect(d,f,u.width,u.height),i.ctx.clip(),i.ctx.clearRect(d,f,u.width,u.height)):i.ctx.clearRect(0,0,i.canvas.width,i.canvas.height),this.debugDraw&&wk(i.col,this._tilePool.size,this.effectiveLogicalWidth,i.ctx,u);try{this.drawCallback(i.ctx,u,a.signal)}finally{i&&i.ctx.restore(),this._pendingDraws.delete(n)}}_emitScrollEvent(e){let n=new CustomEvent(`scroll-virtual`,{detail:{logicalScrollLeft:this._scrollLeft,logicalScrollTop:this._scrollTop,userGesture:e,containerScrollLeft:this._scrollContainer?.scrollLeft??0,containerScrollTop:this._scrollContainer?.scrollTop??0,viewportStartLogical:this._scrollLeft,viewportEndLogical:this._scrollLeft+this._viewportWidth,viewportStartLogicalY:this._scrollTop,viewportEndLogicalY:this._scrollTop+this._viewportHeight},bubbles:!0,composed:!0});this.dispatchEvent(n)}isRegionVisible(e){let n=this._scrollLeft,r=this._scrollLeft+this._viewportWidth,i=e.x+e.width>n&&e.x<r,a=this._scrollTop,o=this._scrollTop+this._viewportHeight,s=e.y+e.height>a&&e.y<o;return i&&s}_updateScrollPosition(e){this._scrollContainer&&(this._scrollContainer.scrollLeft=this._scrollLeft,this._scrollContainer.scrollTop=this._scrollTop),this._recalculateTiles(`updateScrollPosition`),this._emitScrollEvent(e),this._scrollDebounce()}get logicalScrollLeft(){return this._scrollLeft}set logicalScrollLeft(e){let n=this._scrollLeft,r=lk(e,0,Math.max(0,this.effectiveLogicalWidth-this._viewportWidth));r!==this._scrollLeft&&(this._scrollLeft=r,this.requestUpdate(`logicalScrollLeft`,n),this._updateScrollPosition(!1))}get logicalScrollTop(){return this._scrollTop}set logicalScrollTop(e){let n=this._scrollTop,r=lk(e,0,Math.max(0,this.effectiveLogicalHeight-this._viewportHeight));r!==this._scrollTop&&(this._scrollTop=r,this.requestUpdate(`logicalScrollTop`,n),this._updateScrollPosition(!1))}get containerScrollLeft(){return this._scrollContainer?.scrollLeft??0}get containerScrollTop(){return this._scrollContainer?.scrollTop??0}get viewportWidth(){return this._viewportWidth}get viewportHeight(){return this._viewportHeight}setRenderingOptions(e){this._renderingOptions={...this._renderingOptions,...e},this._recalculateTiles(`setRenderingOptions`)}getRenderingOptions(){return this._renderingOptions}invalidateAll(){this._requestRedrawAll(`invalidateAll`)}invalidateRegion(e,n,r,i){this.#e(`invalidateRegion: ${e},${n},${r},${i}`);let a=this._getTileWidth(),o=this._getTileHeight(),{firstTile:s,lastTile:c}=this._calculateTileRange(),{firstRow:l,lastRow:u}=this._calculateTileRowRange(),d=this._renderingOptions.overlapPercent,f=Math.floor(e/a),p=Math.ceil((e+r)/a),m=Math.floor(n/o),h=Math.ceil((n+i)/o);for(let g=Math.max(s,f);g<=Math.min(c,p);g++)for(let s=Math.max(l,m);s<=Math.min(u,h);s++){let c=Ek(g,s);if(this._visibleTiles.has(c)){let s=this._tilePool.get(c);if(s){let l=a*d,u=o*d,f=s.logicalX-l,p=s.logicalX+a+l,m=s.logicalY-u,h=s.logicalY+o+u,g=Math.max(e,f),_=Math.min(e+r,p)-g,v=Math.max(n,m),y=Math.min(n+i,h)-v;if(_>0&&y>0){let e={x:g,y:v,width:_,height:y};this._requestTileDraw(`invalidateRegion`,c,e)}}}}}convertFromViewportToCanvas(e,n){let r=pk(this.effectiveLogicalWidth,this._viewportWidth),i=vk(this.effectiveLogicalHeight,this._viewportHeight);return sk(e,n,this._scrollLeft,r,this._scrollTop,i)}convertFromCanvasToViewport(e,n){let r=pk(this.effectiveLogicalWidth,this._viewportWidth),i=vk(this.effectiveLogicalHeight,this._viewportHeight);return ck(e,n,this._scrollLeft,r,this._scrollTop,i)}positionChildRange(e,n,r,i,a){if(Number.isNaN(n)||Number.isNaN(r)){console.warn(`positionChildRange: Invalid startX or endX values: ${n}, ${r}`);return}let o=Array.from(this.children).filter(n=>n.matches?.(e)),s=i??0,c=a??this.effectiveLogicalHeight;for(let e of o)this._positionedChildren.set(e,{startX:n,endX:r,startY:s,endY:c});this._positionChildren(`positionChildRange`)}manualChildPositioningUpdate(){this._positionChildren(`manualChildPositioningUpdate`)}positionChildClear(e){for(let[n]of this._positionedChildren)n.matches?.(e)&&(this._positionedChildren.delete(n),n.removeAttribute(`style`))}_positionChildren(e){if(this.#e(`_positionChildren: ${e} positionedChildren: ${this._positionedChildren.size}`),this.hasUpdated&&this._childrenContainerEl)for(let[e,n]of this._positionedChildren){let r=n.endX-n.startX,i=n.endY-n.startY;e.setAttribute(`style`,`position: absolute; left: ${n.startX}px; top: ${n.startY}px; width: ${r}px; height: ${i}px;`)}}render(){let e=v({"scroll-container":!0,scrollable:this.hinting});return i`
|
|
12611
12780
|
<div class=${e}>
|
|
12612
12781
|
<div class="spacer"></div>
|
|
12613
12782
|
<div class="tile-pool"></div>
|
|
@@ -12615,7 +12784,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12615
12784
|
<slot></slot>
|
|
12616
12785
|
</div>
|
|
12617
12786
|
</div>
|
|
12618
|
-
`}};
|
|
12787
|
+
`}};Tk([d({type:Boolean})],Dk.prototype,`hinting`,void 0),Tk([d()],Dk.prototype,`logicalWidth`,null),Tk([d()],Dk.prototype,`logicalHeight`,null),Tk([d({type:Number})],Dk.prototype,`logicalScrollLeft`,null),Tk([d({type:Number})],Dk.prototype,`logicalScrollTop`,null),Dk=Tk([l(`x-vcanvas`)],Dk);const Ok=1e4;let Q=class extends n{constructor(...e){super(...e),this.tracks=[],this.events=[],this.min=0,this.max=1e3,this.trackHeight=`fixed`,this.userScale=`normal`,this.reorderable=!1,this.metaEnabled=!1,this.altMajorBg=!1,this.defaultTrackHeight=48,this.gridMode=`adaptive`,this.minorStep=10,this.onDragging=null,this.formatLabel=String,this._ppu=1,this._viewRange={min:0,max:4e3},this._vViewRange={min:0,max:1},this._vScale=1,this._selectedIds=new Set,this._tickledId=void 0,this._drag={kind:`none`},this._metaHeight=120,this._trackHeightOverrides=new Map,this._trackLayout=[],this._internalEvents=[],this._internalTracks=[],this.#e=null,this.#t={},this.#n=null,this.#r=24,this.#i=void 0,this.#a=null,this.#o=!1,this.#s=!1,this.#C=e=>{this.#s?(this._viewRange=this.#_(this._viewRange.min,this._ppu),this.#m(this._vViewRange.min,this._vViewRange.max)):(this.#s=!0,this.#v(),this.#h(),this.#E()),this.#y(),this.#S()},this.#w=(e,n,r)=>{let i=this._ppu,a={x:n.x/i+this.min,y:n.y,width:n.width/i,height:n.height};this.#t=qO(this);let o=IO(this._viewRange,this.userScale,this.#c(),this.gridMode,this.minorStep,i),s=this._internalTracks.map(e=>({key:e.key,color:e.color}));HO(e,a,this._trackLayout,s,this.#t,i),BO(e,a,o,this.altMajorBg,this.#t,i),UO(e,a,this._internalEvents,this._trackLayout,this._selectedIds,this._tickledId,this._drag,this.#t,i),WO(e,this._drag,i);let c=this.#e?.logicalScrollTop??0;VO(e,a,o,this.#r,this.formatLabel,this.#t,i,c)},this.#T=e=>{let n=e.detail;if(n.userGesture===!1)return;let r=this._ppu;if(r<=0)return;let i=n.logicalScrollLeft/r+this.min;if(this._viewRange=this.#_(i,r),this._vScale>0){let e=this._vViewRange.max-this._vViewRange.min,r=n.logicalScrollTop/this._vScale;this.#m(r,r+e)}},this.#D=e=>{let n=e.detail,r=n.b-n.a,i=this.#c();r>0&&(this._ppu=Math.max(this.#l(),Math.min(i/r,Ok))),this._viewRange=this.#_(n.a,this._ppu),this.#y()},this.#O=e=>{let n=e.detail;this.#m(n.a,n.b)},this.#k=e=>{let n=e.currentTarget;n.setPointerCapture(e.pointerId),e.stopPropagation(),e.preventDefault();let r=n.getBoundingClientRect(),i=r.height>0?(e.clientY-r.top)/r.height:.5,a=this._vViewRange.max-this._vViewRange.min,o=this._vViewRange.min+i*a;this._drag={kind:`v-axis-zoom`,anchorBaseY:o,startScreenX:e.screenX,startScreenY:e.screenY,startVMin:this._vViewRange.min,startVMax:this._vViewRange.max,startVScale:this._vScale}},this.#A=e=>{if(this._drag.kind!==`v-axis-zoom`)return;let n=this._drag,r=e.screenX-n.startScreenX,i=e.screenY-n.startScreenY;if(Math.abs(r)+Math.abs(i)<5)return;let a=QO(r,4),o=QO(i,4),s=ek(n.startVMin,n.startVMax,n.startVScale,n.anchorBaseY,a,o);this.setVerticalZoomPan(s.vMin,s.vMax)},this.#j=e=>{this._drag.kind===`v-axis-zoom`&&(e.currentTarget.releasePointerCapture(e.pointerId),this._drag={kind:`none`})},this.#F=e=>{let{trackKey:n,height:r}=e.detail;this.#L(n,r)},this.#I=e=>{let{trackKey:n,height:r}=e.detail;this.#L(n,r),this.dispatchEvent(new CustomEvent(`track-resize`,{detail:{trackKey:n,height:r},bubbles:!0,composed:!0}))}}static{this.styles=[ak]}#e;#t;#n;#r;#i;#a;#o;#s;get pxPerUnit(){return this._ppu}get axisHeight(){return this.#r}get tabWidth(){return this.#P}#c(){return this.#e?.viewportWidth??this.#e?.clientWidth??800}#l(){let e=this.max-this.min;return e<=0?1:this.#c()/e}#u(){return this.#e?.viewportHeight??this.#e?.clientHeight??300}#d(){let e=0;for(let n of this._internalTracks){if(n.hidden)continue;let r=this._trackHeightOverrides.get(n.key);e+=r??n.height??this.defaultTrackHeight}return e||1}#f(){let e=1/0;for(let n of this._internalTracks){if(n.hidden)continue;let r=this._trackHeightOverrides.get(n.key)??n.height??this.defaultTrackHeight;r<e&&(e=r)}return e===1/0?this.defaultTrackHeight:e}#p(){let e=0;for(let n of this._internalTracks){if(n.hidden)continue;let r=this._trackHeightOverrides.get(n.key)??n.height??this.defaultTrackHeight;r>e&&(e=r)}return e||this.defaultTrackHeight}#m(e,n){let r=this.#d(),i=this.#u()-this.#r,a=e,o=n,s=this.#p(),c=Math.max(s,r*.05),l=this.#f(),u=i>0?i*l/24:r,d=Math.min(r,u),f=o-a;if(f<c){let e=(a+o)/2;a=e-c/2,o=e+c/2,f=c}if(f>d){let e=(a+o)/2;a=e-d/2,o=e+d/2,f=d}o>r&&(o=r,a=Math.max(0,o-f)),a<0&&(a=0,o=Math.min(r,a+f)),this._vViewRange={min:a,max:o},this._vScale=i>0?i/(o-a):1}#h(){let e=this.#d();this.#m(0,e)}get#g(){return this._vViewRange.min*this._vScale}#_(e,n){let r=this.#c(),i=n>0?r/n:this.max-this.min,a=e,o=a+i;return o>this.max&&(o=this.max,a=Math.max(this.min,o-i)),a<this.min&&(a=this.min,o=Math.min(this.max,a+i)),{min:a,max:o}}setPpu(e){this._ppu=Math.max(this.#l(),Math.min(e,Ok)),this._viewRange=this.#_(this._viewRange.min,this._ppu)}setViewRange(e){let n=this.#c(),r=e.max-e.min;r>0&&(this._ppu=Math.max(this.#l(),Math.min(n/r,Ok))),this._viewRange=this.#_(e.min,this._ppu)}setZoomPan(e,n){this._ppu=Math.max(this.#l(),Math.min(n,Ok)),this._viewRange=this.#_(e,this._ppu)}setVerticalZoomPan(e,n){this.#m(e,n)}selectAll(){this._selectedIds=new Set(this._internalEvents.map(e=>e.id)),this.#R(),this.#S()}deselectAll(){this._selectedIds=new Set,this.#R(),this.#S()}getTrackEvents(e){return this._internalEvents.filter(n=>n.trackKey===e)}get selectedIds(){return[...this._selectedIds]}set selectedIds(e){this._selectedIds=new Set(e),this.#R(),this.#S()}selectTrack(e,n=!1){this.dispatchEvent(new CustomEvent(`track-select`,{detail:{trackKey:e,shiftKey:n},bubbles:!0,composed:!0}))}resetTrackHeights(){this._trackHeightOverrides=new Map,this.#o=!0}static{this.defaultDragSnapping=()=>({})}static{this.gridSnapping=e=>{let{gridResolution:n,currentStart:r,currentEnd:i}=e,{minorStep:a}=n;return{start:Math.round(r/a)*a,end:Math.round(i/a)*a}}}processDrag(e,n,r,i,a,o,s,c){let l=i,u=a,d=o;if(this.onDragging){let f=this.onDragging({eventId:e,rawLogicalX:n,rawY:r,currentStart:i,currentEnd:a,currentTrackKey:o,gridResolution:c,originTrackKey:s});l=f.start??i,u=f.end??a,d=f.trackKey??o}return this.dispatchEvent(new CustomEvent(`dragging`,{detail:{eventId:e,start:l,end:u,trackKey:d,rawLogicalX:n,rawY:r,originTrackKey:s},bubbles:!0,composed:!0})),{start:l,end:u,trackKey:d}}getVCanvas(){return this.#e}get tickledEvent(){return this._tickledId===void 0?null:this._internalEvents.find(e=>e.id===this._tickledId)??null}firstUpdated(){this.#e=this.shadowRoot?.querySelector(`x-vcanvas`),this.#e&&(this.#e.drawCallback=this.#w,this.#e.addEventListener(`scroll-virtual`,this.#T),this.#n=tk(this,this.#e),this.#a=new ResizeObserver(this.#C),this.#a.observe(this.#e))}disconnectedCallback(){super.disconnectedCallback(),this.#n?.(),this.#n=null,this.#a?.disconnect(),this.#a=null}willUpdate(e){let n=!1,r=!1,i=!1;e.has(`tracks`)&&(this._internalTracks=[...this.tracks],n=!0,r=!0),e.has(`events`)&&(this._internalEvents=[...this.events]),e.has(`trackHeight`)&&(this.trackHeight!==`free`&&this._trackHeightOverrides.size>0&&(this._trackHeightOverrides=new Map),n=!0,r=!0),(e.has(`_vScale`)||e.has(`defaultTrackHeight`)||e.has(`_trackHeightOverrides`))&&(n=!0),(e.has(`min`)||e.has(`max`))&&(i=!0),this.#o&&(this.#o=!1,r=!0),i&&this.#v(),r&&this.#h(),n&&this.#E()}updated(e){(e.has(`_ppu`)||e.has(`_viewRange`)||e.has(`min`)||e.has(`max`))&&(this.#y(),this.#S()),(e.has(`events`)||e.has(`userScale`)||e.has(`altMajorBg`)||e.has(`gridMode`)||e.has(`minorStep`))&&this.#S(),e.has(`_trackLayout`)&&(this.#b(),this.#N(),this.#S()),(e.has(`_vViewRange`)||e.has(`_vScale`))&&(this.#M(),this.#S()),this._tickledId!==this.#i&&(this.#i=this._tickledId,this.dispatchEvent(new CustomEvent(`tickle-change`,{detail:{event:this.tickledEvent},bubbles:!0,composed:!0})))}render(){let e=this.#d();return i`
|
|
12619
12788
|
<div class="content-wrapper">
|
|
12620
12789
|
<div class="content-area">
|
|
12621
12790
|
<div class="v-axis-zone"
|
|
@@ -12668,7 +12837,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12668
12837
|
|
|
12669
12838
|
<div class="meta-resizer ${this.metaEnabled?`visible`:``}"></div>
|
|
12670
12839
|
<div class="meta-area ${this.metaEnabled?`visible`:``}" style="height:${this._metaHeight}px"></div>
|
|
12671
|
-
`}#v(){let e=this.#c(),n=this.max-this.min,r=.8;this._ppu=n>0?e/(n*r):1,this._viewRange={min:this.min,max:this.min+n*r},this.#y()}#y(){if(!this.#e)return;let e=this.max-this.min;this.#e.logicalWidth=e*this._ppu,this.#b(),this.#x()}#b(){if(!this.#e)return;let e=this._trackLayout.reduce((e,n)=>e+n.height,0),n=Math.max(e,40)+this.#r;this.#e.logicalHeight=n,this.#e.logicalScrollTop=this.#g}#x(){this.#e&&(this.#e.logicalScrollLeft=(this._viewRange.min-this.min)*this._ppu)}#S(){this.#e?.invalidateAll()}#C;#w;#T;#E(){let e=[],n=this.#r;for(let r of this._internalTracks){if(r.hidden)continue;let i=this._trackHeightOverrides.get(r.key)??r.height??this.defaultTrackHeight,a=Math.round(i*this._vScale);e.push({trackKey:r.key,y:n,height:a}),n+=a}this._trackLayout=e}#D;#O;#k;#A;#j;#M(){this.#b(),this.#N()}#N(){let e=this.shadowRoot?.querySelector(`.tab-column`);if(!e)return;let n=this.#e?.logicalScrollTop??0;e.style.transform=`translateY(${-n}px)`;for(let n of this._trackLayout){let r=e.querySelector(`ixfx-timeline-track-tab[track-key="${n.trackKey}"]`);r&&(r.style.top=`${n.y}px`,r.style.height=`${n.height}px`)}}get#P(){let e=getComputedStyle(this).getPropertyValue(`--timeline-tab-width`).trim();return Number.parseInt(e,10)||120}#F;#I;#L(e,n){if(this.trackHeight===`fixed`)this.defaultTrackHeight=n;else if(this.trackHeight===`free`){let r=new Map(this._trackHeightOverrides);r.set(e,n),this._trackHeightOverrides=r}}#R(){this.dispatchEvent(new CustomEvent(`selection-change`,{detail:{selectedIds:[...this._selectedIds]},bubbles:!0,composed:!0}))}};E([d({type:Array})],
|
|
12840
|
+
`}#v(){let e=this.#c(),n=this.max-this.min,r=.8;this._ppu=n>0?e/(n*r):1,this._viewRange={min:this.min,max:this.min+n*r},this.#y()}#y(){if(!this.#e)return;let e=this.max-this.min;this.#e.logicalWidth=e*this._ppu,this.#b(),this.#x()}#b(){if(!this.#e)return;let e=this._trackLayout.reduce((e,n)=>e+n.height,0),n=Math.max(e,40)+this.#r;this.#e.logicalHeight=n,this.#e.logicalScrollTop=this.#g}#x(){this.#e&&(this.#e.logicalScrollLeft=(this._viewRange.min-this.min)*this._ppu)}#S(){this.#e?.invalidateAll()}#C;#w;#T;#E(){let e=[],n=this.#r;for(let r of this._internalTracks){if(r.hidden)continue;let i=this._trackHeightOverrides.get(r.key)??r.height??this.defaultTrackHeight,a=Math.round(i*this._vScale);e.push({trackKey:r.key,y:n,height:a}),n+=a}this._trackLayout=e}#D;#O;#k;#A;#j;#M(){this.#b(),this.#N()}#N(){let e=this.shadowRoot?.querySelector(`.tab-column`);if(!e)return;let n=this.#e?.logicalScrollTop??0;e.style.transform=`translateY(${-n}px)`;for(let n of this._trackLayout){let r=e.querySelector(`ixfx-timeline-track-tab[track-key="${n.trackKey}"]`);r&&(r.style.top=`${n.y}px`,r.style.height=`${n.height}px`)}}get#P(){let e=getComputedStyle(this).getPropertyValue(`--timeline-tab-width`).trim();return Number.parseInt(e,10)||120}#F;#I;#L(e,n){if(this.trackHeight===`fixed`)this.defaultTrackHeight=n;else if(this.trackHeight===`free`){let r=new Map(this._trackHeightOverrides);r.set(e,n),this._trackHeightOverrides=r}}#R(){this.dispatchEvent(new CustomEvent(`selection-change`,{detail:{selectedIds:[...this._selectedIds]},bubbles:!0,composed:!0}))}};E([d({type:Array})],Q.prototype,`tracks`,void 0),E([d({type:Array})],Q.prototype,`events`,void 0),E([d({type:Number})],Q.prototype,`min`,void 0),E([d({type:Number})],Q.prototype,`max`,void 0),E([d({type:String,attribute:`track-height`})],Q.prototype,`trackHeight`,void 0),E([d({type:String,attribute:`user-scale`})],Q.prototype,`userScale`,void 0),E([d({type:Boolean})],Q.prototype,`reorderable`,void 0),E([d({type:Boolean,attribute:`meta`})],Q.prototype,`metaEnabled`,void 0),E([d({type:Boolean,attribute:`alt-major-bg`})],Q.prototype,`altMajorBg`,void 0),E([d({type:Number,attribute:`default-track-height`})],Q.prototype,`defaultTrackHeight`,void 0),E([d({type:String,attribute:`grid-mode`})],Q.prototype,`gridMode`,void 0),E([d({type:Number,attribute:`minor-step`})],Q.prototype,`minorStep`,void 0),E([d({type:Object})],Q.prototype,`onDragging`,void 0),E([m()],Q.prototype,`_ppu`,void 0),E([m()],Q.prototype,`_viewRange`,void 0),E([m()],Q.prototype,`_vViewRange`,void 0),E([m()],Q.prototype,`_vScale`,void 0),E([m()],Q.prototype,`_selectedIds`,void 0),E([m()],Q.prototype,`_tickledId`,void 0),E([m()],Q.prototype,`_drag`,void 0),E([m()],Q.prototype,`_metaHeight`,void 0),E([m()],Q.prototype,`_trackHeightOverrides`,void 0),E([m()],Q.prototype,`_trackLayout`,void 0),E([m()],Q.prototype,`_internalEvents`,void 0),E([m()],Q.prototype,`_internalTracks`,void 0),Q=E([T(`ixfx-timeline`)],Q);let kk=class extends n{constructor(...e){super(...e),this.label=``,this.grow=!1,this.reorderable=!1}static{this.styles=[w,Yt,r`
|
|
12672
12841
|
:host {
|
|
12673
12842
|
display: flex;
|
|
12674
12843
|
flex-direction: column;
|
|
@@ -12744,7 +12913,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12744
12913
|
<slot></slot>
|
|
12745
12914
|
</div>
|
|
12746
12915
|
</div>
|
|
12747
|
-
`}};E([d({type:String})],
|
|
12916
|
+
`}};E([d({type:String})],kk.prototype,`label`,void 0),E([d({type:Boolean,reflect:!0})],kk.prototype,`grow`,void 0),E([d({type:Boolean,reflect:!0})],kk.prototype,`reorderable`,void 0),kk=E([T(`ixfx-toolbar-group`)],kk);var Ak;function jk(e,n){let r=0,i=1/0;for(let a=0;a<e.length;a++){let[o,s]=e[a];if(n<(o+s)/2){let e=Math.abs(n-o);e<i&&(i=e,r=a)}else{let e=Math.abs(n-s);e<i&&(i=e,r=a+1)}}return r}let Mk=!1;function Nk(){if(Mk)return;Mk=!0;let e=document.createElement(`style`);e.textContent=`
|
|
12748
12917
|
.ixfx-drag-ghost.ixfx-toolbar-group-ghost {
|
|
12749
12918
|
padding: var(--space-s, 8px) var(--space-m, 16px);
|
|
12750
12919
|
background: var(--surface-4);
|
|
@@ -12757,7 +12926,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12757
12926
|
user-select: none;
|
|
12758
12927
|
-webkit-user-select: none;
|
|
12759
12928
|
}
|
|
12760
|
-
`,document.head.appendChild(e)}let
|
|
12929
|
+
`,document.head.appendChild(e)}let Pk=class extends n{static{Ak=this}constructor(...e){super(...e),this.orientation=`horizontal`,this.layout=`one-line`,this.verticalWriting=`auto`,this.toolbarAlign=`near`,this.showGroupLabels=!1,this.invisibleGroups=!1,this.allowReorder=!1,this._overflowCount=0,this._popoverOpen=!1,this._ro=null,this._anchor=`--toolbar-${Ak._cnt++}`,this._sizes=new WeakMap,this._measureQueued=!1,this._dragState=null,this._suppressNextClick=!1,this._onClickCapture=e=>{this._suppressNextClick&&(this._suppressNextClick=!1,e.preventDefault(),e.stopPropagation())},this._onKeyDown=e=>{let n=this._dragState;if(e.key!==`Escape`||!n?.active)return;e.preventDefault();let r=n.pointerId;this._abortDrag(),this._endDrag(r)},this._onPointerDown=e=>{if(!this.allowReorder||e.button!==0)return;let n=this._findDragTarget(e);n?.parentNode&&(Array.prototype.indexOf.call(n.parentNode.children,n)<0||(this._dragState={pointerId:e.pointerId,source:n,startX:e.clientX,startY:e.clientY,active:!1,ghost:null,gapIndex:void 0},window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)))},this._onPointerMove=e=>{let n=this._dragState;if(!n||e.pointerId!==n.pointerId)return;let r=Math.hypot(e.clientX-n.startX,e.clientY-n.startY);if(!n.active){if(r<5)return;this._beginDrag(e)}n.ghost?.move(e.clientX,e.clientY);let i=this._computeGapIndex(e.clientX,e.clientY);i!==n.gapIndex&&(n.gapIndex=i,this.requestUpdate())},this._onPointerUp=e=>{let n=this._dragState;if(!(!n||e.pointerId!==n.pointerId)){if(n.active){let r=this._computeGapIndex(e.clientX,e.clientY);this._commitDrag(n.source,r)}this._endDrag(e.pointerId)}},this._onPointerCancel=e=>{let n=this._dragState;!n||e.pointerId!==n.pointerId||(this._abortDrag(),this._endDrag(e.pointerId))}}static{this._cnt=0}static{this.styles=[w,de,r`
|
|
12761
12930
|
:host {
|
|
12762
12931
|
--toolbar-gap: var(--space-s);
|
|
12763
12932
|
--toolbar-group-gap: var(--space-m);
|
|
@@ -12855,7 +13024,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12855
13024
|
pointer-events: none;
|
|
12856
13025
|
z-index: 1;
|
|
12857
13026
|
}
|
|
12858
|
-
`]}connectedCallback(){super.connectedCallback(),this.style.setProperty(`--anchor-name`,this._anchor),this.addEventListener(`click`,this._onClickCapture,!0)}firstUpdated(){this._slot.addEventListener(`slotchange`,()=>{this._updateGroups(),this._scheduleMeasure()}),this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(this._inner),this._popover.addEventListener(`toggle`,()=>{this._popoverOpen=this._popover.matches(`:popover-open`)}),this._scheduleMeasure(),this._updateGroups()}updated(e){(e.has(`showGroupLabels`)||e.has(`allowReorder`))&&this._updateGroups()}_mainGroups(){return Array.from(this.children).filter(e=>e.tagName===`IXFX-TOOLBAR-GROUP`&&e.getAttribute(`slot`)!==`overflow`)}_groupKey(e){return e.id||e.label||``}getGroupOrder(){return this._mainGroups().map(e=>this._groupKey(e))}setGroupOrder(e){let n=this._mainGroups();if(n.length===0)return;let r=new Set,i=[];for(let a of e){let e=n.find(e=>!r.has(e)&&e.id===a&&a!==``)??n.find(e=>!r.has(e)&&this._groupKey(e)===a);e&&(r.add(e),i.push(e))}let a=[...i,...n.filter(e=>!r.has(e))],o=a.length*a.length+1,s=!0;for(;s&&o-->0;){s=!1;for(let e=0;e+1<a.length;e++){let n=a[e],r=a[e+1];n.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING||this._insertAndEmit(n,r)&&(s=!0)}}}getLayoutSnapshot(){return{version:1,order:this.getGroupOrder()}}applyLayoutSnapshot(e){if(typeof e!=`object`||!e)return!1;let{version:n,order:r}=e;return n!==1||!Array.isArray(r)||!r.every(e=>typeof e==`string`)?!1:(this.setGroupOrder(r),!0)}_insertAndEmit(e,n){let r=e.parentNode;if(!r)return!1;let i=Array.prototype.indexOf.call(r.children,e);r.insertBefore(e,n);let a=Array.prototype.indexOf.call(r.children,e);return a!==i&&(this.dispatchEvent(new CustomEvent(`reorder`,{bubbles:!0,composed:!0,detail:{fromIndex:i,toIndex:a,group:e}})),this._updateGroups(),this._scheduleMeasure(),!0)}_updateGroups(){for(let e of Array.from(this.children))e.tagName===`IXFX-TOOLBAR-GROUP`&&(this.showGroupLabels?e.setAttribute(`show-label`,``):e.removeAttribute(`show-label`),this.allowReorder&&e.getAttribute(`slot`)!==`overflow`?e.setAttribute(`reorderable`,``):e.removeAttribute(`reorderable`))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`click`,this._onClickCapture,!0),this._ro?.disconnect(),this._dragState&&(this._abortDrag(),this._endDrag(this._dragState.pointerId))}_findDragTarget(e){if(!this.allowReorder)return null;let n=e.composedPath(),r=null,i=!1;for(let e of n)e instanceof HTMLElement&&(e.classList.contains(`grab-handle`)&&(i=!0),!r&&e.tagName===`IXFX-TOOLBAR-GROUP`&&(r=e));return!r||!i||r.getAttribute(`slot`)===`overflow`?null:r}_beginDrag(e){let n=this._dragState;if(!(!n||n.active)){try{this.setPointerCapture(e.pointerId)}catch{}n.active=!0,this.setAttribute(`dragging`,``),n.source.setAttribute(`drag-source`,``),n.ghost=this._createGhost(n.source),n.ghost?.move(e.clientX,e.clientY)}}_abortDrag(){let e=this._dragState;e&&(e.source.removeAttribute(`drag-source`),e.gapIndex!==void 0&&(e.gapIndex=void 0,this.requestUpdate()))}_endDrag(e){let n=this._dragState;if(n){n.ghost?.destroy(),n.ghost=null,this.removeAttribute(`dragging`),this._dragState=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel);try{this.releasePointerCapture(e)}catch{}this.requestUpdate()}}_commitDrag(e,n){e.removeAttribute(`drag-source`);let r=this._mainGroups().filter(n=>n!==e),i=r.length,a=n===void 0?i:Math.max(0,Math.min(n,i)),o=this.orientation===`vertical-left`?i-a:a;if(!e.parentNode)return;let s=r[o]??null;this._insertAndEmit(e,s)&&(this._suppressNextClick=!0)}_createGhost(e){let n=document.createElement(`span`);n.textContent=(`label`in e&&typeof e.label==`string`&&e.label||(e.textContent??``).trim()).slice(0,60),n.style.overflow=`hidden`,n.style.textOverflow=`ellipsis`,n.style.whiteSpace=`nowrap`;try{return
|
|
13027
|
+
`]}connectedCallback(){super.connectedCallback(),this.style.setProperty(`--anchor-name`,this._anchor),this.addEventListener(`click`,this._onClickCapture,!0)}firstUpdated(){this._slot.addEventListener(`slotchange`,()=>{this._updateGroups(),this._scheduleMeasure()}),this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(this._inner),this._popover.addEventListener(`toggle`,()=>{this._popoverOpen=this._popover.matches(`:popover-open`)}),this._scheduleMeasure(),this._updateGroups()}updated(e){(e.has(`showGroupLabels`)||e.has(`allowReorder`))&&this._updateGroups()}_mainGroups(){return Array.from(this.children).filter(e=>e.tagName===`IXFX-TOOLBAR-GROUP`&&e.getAttribute(`slot`)!==`overflow`)}_groupKey(e){return e.id||e.label||``}getGroupOrder(){return this._mainGroups().map(e=>this._groupKey(e))}setGroupOrder(e){let n=this._mainGroups();if(n.length===0)return;let r=new Set,i=[];for(let a of e){let e=n.find(e=>!r.has(e)&&e.id===a&&a!==``)??n.find(e=>!r.has(e)&&this._groupKey(e)===a);e&&(r.add(e),i.push(e))}let a=[...i,...n.filter(e=>!r.has(e))],o=a.length*a.length+1,s=!0;for(;s&&o-->0;){s=!1;for(let e=0;e+1<a.length;e++){let n=a[e],r=a[e+1];n.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING||this._insertAndEmit(n,r)&&(s=!0)}}}getLayoutSnapshot(){return{version:1,order:this.getGroupOrder()}}applyLayoutSnapshot(e){if(typeof e!=`object`||!e)return!1;let{version:n,order:r}=e;return n!==1||!Array.isArray(r)||!r.every(e=>typeof e==`string`)?!1:(this.setGroupOrder(r),!0)}_insertAndEmit(e,n){let r=e.parentNode;if(!r)return!1;let i=Array.prototype.indexOf.call(r.children,e);r.insertBefore(e,n);let a=Array.prototype.indexOf.call(r.children,e);return a!==i&&(this.dispatchEvent(new CustomEvent(`reorder`,{bubbles:!0,composed:!0,detail:{fromIndex:i,toIndex:a,group:e}})),this._updateGroups(),this._scheduleMeasure(),!0)}_updateGroups(){for(let e of Array.from(this.children))e.tagName===`IXFX-TOOLBAR-GROUP`&&(this.showGroupLabels?e.setAttribute(`show-label`,``):e.removeAttribute(`show-label`),this.allowReorder&&e.getAttribute(`slot`)!==`overflow`?e.setAttribute(`reorderable`,``):e.removeAttribute(`reorderable`))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`click`,this._onClickCapture,!0),this._ro?.disconnect(),this._dragState&&(this._abortDrag(),this._endDrag(this._dragState.pointerId))}_findDragTarget(e){if(!this.allowReorder)return null;let n=e.composedPath(),r=null,i=!1;for(let e of n)e instanceof HTMLElement&&(e.classList.contains(`grab-handle`)&&(i=!0),!r&&e.tagName===`IXFX-TOOLBAR-GROUP`&&(r=e));return!r||!i||r.getAttribute(`slot`)===`overflow`?null:r}_beginDrag(e){let n=this._dragState;if(!(!n||n.active)){try{this.setPointerCapture(e.pointerId)}catch{}n.active=!0,this.setAttribute(`dragging`,``),n.source.setAttribute(`drag-source`,``),n.ghost=this._createGhost(n.source),n.ghost?.move(e.clientX,e.clientY)}}_abortDrag(){let e=this._dragState;e&&(e.source.removeAttribute(`drag-source`),e.gapIndex!==void 0&&(e.gapIndex=void 0,this.requestUpdate()))}_endDrag(e){let n=this._dragState;if(n){n.ghost?.destroy(),n.ghost=null,this.removeAttribute(`dragging`),this._dragState=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel);try{this.releasePointerCapture(e)}catch{}this.requestUpdate()}}_commitDrag(e,n){e.removeAttribute(`drag-source`);let r=this._mainGroups().filter(n=>n!==e),i=r.length,a=n===void 0?i:Math.max(0,Math.min(n,i)),o=this.orientation===`vertical-left`?i-a:a;if(!e.parentNode)return;let s=r[o]??null;this._insertAndEmit(e,s)&&(this._suppressNextClick=!0)}_createGhost(e){let n=document.createElement(`span`);n.textContent=(`label`in e&&typeof e.label==`string`&&e.label||(e.textContent??``).trim()).slice(0,60),n.style.overflow=`hidden`,n.style.textOverflow=`ellipsis`,n.style.whiteSpace=`nowrap`;try{return Nk(),Gg({anchor:e,content:n,className:`ixfx-toolbar-group-ghost`})}catch{return null}}_computeGapIndex(e,n){let r=this._dragState;if(!r)return;let i=this._mainGroups().filter(e=>e!==r.source);if(i.length===0)return 0;let a=this.orientation===`vertical-left`?[...i].reverse():i,o=this.orientation===`horizontal`,s=o?e:n;return jk(a.map(e=>{let n=e.getBoundingClientRect();return[o?n.left:n.top,o?n.right:n.bottom]}),s)}_computeCaretStyle(){let e=this._dragState;if(!e?.active||e.gapIndex===void 0)return;let n=this._mainGroups().filter(n=>n!==e.source);if(n.length===0)return;let r=this.getBoundingClientRect();if(!r)return;let i=this.orientation===`vertical-left`?[...n].reverse():n,a=Math.max(0,Math.min(e.gapIndex,i.length)),o=a<i.length?i[a].getBoundingClientRect():i[i.length-1].getBoundingClientRect();return this.orientation===`horizontal`?`transform: translate(${(a<i.length?o.left:o.right)-r.left-1}px, 0); width: 2px; height: ${r.height}px;`:`transform: translate(0, ${(a<i.length?o.top:o.bottom)-r.top-1}px); width: ${r.width}px; height: 2px;`}_scheduleMeasure(){this._measureQueued||(this._measureQueued=!0,requestAnimationFrame(()=>{this._measureQueued=!1,this._measure()}))}_measure(){let e=Array.from(this.children),n=e=>e.hasAttribute(`grow`)||e.matches(`[grow]`),r=e.filter(e=>!n(e)),i=this.orientation===`horizontal`,a=getComputedStyle(this).getPropertyValue(`--toolbar-overflow`).trim();if(this.layout!==`one-line`||a===`disabled`){let n=!1;for(let r of e)r.getAttribute(`slot`)===`overflow`&&(r.removeAttribute(`slot`),n=!0),r.hasAttribute(`hidden`)&&(r.removeAttribute(`hidden`),n=!0);this._overflowCount!==0&&(this._overflowCount=0,n=!0),n&&this.requestUpdate();return}if(!this._inner)return;let o=getComputedStyle(this._inner),s=(i?Number.parseFloat(o.columnGap):Number.parseFloat(o.rowGap))||0,c=i?this._inner.clientWidth:this._inner.clientHeight,l=r.filter(e=>e.getAttribute(`slot`)!==`overflow`),u=r.filter(e=>e.getAttribute(`slot`)===`overflow`),d=0;l.forEach((e,n)=>{let r=i?e.offsetWidth:e.offsetHeight;r>0&&this._sizes.set(e,r),d+=(n?s:0)+(this._sizes.get(e)??r)});let f=!1;if(a===`collapsed`){if(l.length>0){for(let e of l)e.setAttribute(`slot`,`overflow`);u.push(...l),l.length=0,f=!0}let e=u.length;e!==this._overflowCount&&(this._overflowCount=e,f=!0),f&&this.requestUpdate();return}let p=u.length>0?s+36:0;for(;l.length>0&&d+p>c;){let e=l[l.length-1],n=this._sizes.get(e)??0;e.setAttribute(`slot`,`overflow`),l.pop(),u.unshift(e),d-=(l.length?s:0)+n,f=!0}for(;u.length>0;){let e=u[0],n=this._sizes.get(e);if(n===void 0)break;let r=l.length?s:0,i=u.length>1?s+36:0;if(d+r+n+i>c)break;e.removeAttribute(`slot`),u.shift(),l.push(e),d+=r+n,f=!0}let m=u.length;m!==this._overflowCount&&(this._overflowCount=m,f=!0),f&&this.requestUpdate()}_toggleOverflow(){try{this._popover.togglePopover()}catch{this._popover.showPopover()}}render(){let e=getComputedStyle(this).getPropertyValue(`--toolbar-overflow`).trim(),n=this._overflowCount>0||e===`collapsed`,r=this._computeCaretStyle();return i`
|
|
12859
13028
|
<div class="inner" role="toolbar" aria-orientation=${this.orientation}>
|
|
12860
13029
|
<slot @pointerdown=${this._onPointerDown} @keydown=${this._onKeyDown}></slot>
|
|
12861
13030
|
<ixfx-button class="overflow-btn" ?hidden=${!n} @click=${this._toggleOverflow} aria-label="More" aria-haspopup="true" aria-expanded=${this._popoverOpen}>⋯</ixfx-button>
|
|
@@ -12864,7 +13033,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
12864
13033
|
<slot name="overflow"></slot>
|
|
12865
13034
|
</div>
|
|
12866
13035
|
${r?i`<div class="drop-caret" style=${r}></div>`:a}
|
|
12867
|
-
`}};E([d({type:String,reflect:!0})],
|
|
13036
|
+
`}};E([d({type:String,reflect:!0})],Pk.prototype,`orientation`,void 0),E([d({type:String,reflect:!0})],Pk.prototype,`layout`,void 0),E([d({type:String,attribute:`vertical-writing`,reflect:!0})],Pk.prototype,`verticalWriting`,void 0),E([d({type:String,attribute:`toolbar-align`,reflect:!0})],Pk.prototype,`toolbarAlign`,void 0),E([d({type:Boolean,attribute:`show-group-labels`,reflect:!0})],Pk.prototype,`showGroupLabels`,void 0),E([d({type:Boolean,attribute:`invisible-groups`,reflect:!0})],Pk.prototype,`invisibleGroups`,void 0),E([d({type:Boolean,attribute:`allow-reorder`,reflect:!0})],Pk.prototype,`allowReorder`,void 0),E([m()],Pk.prototype,`_overflowCount`,void 0),E([m()],Pk.prototype,`_popoverOpen`,void 0),E([f(`.inner`)],Pk.prototype,`_inner`,void 0),E([f(`.overflow-popover`)],Pk.prototype,`_popover`,void 0),E([f(`slot`)],Pk.prototype,`_slot`,void 0),Pk=Ak=E([T(`ixfx-toolbar`)],Pk);let Fk=class extends n{constructor(...e){super(...e),this.text=``,this.effect=`fade`,this.duration=300,this.easing=`ease`,this._currentText=``,this._outgoingText=``,this._transitionId=0,this._queue=[],this.#e=()=>{this._onTransitionEnd()},this.#t=()=>{this._onTransitionEnd()}}setText(e,n){this._pendingEffect=n,this.text=e}updated(e){if(e.has(`text`)&&this.text!==this._currentText){let e=this._pendingEffect??this.effect;this._pendingEffect=void 0,this._activeEffect===void 0?this._startTransition(this.text,e):this._queue.push({text:this.text,effect:e})}}_startTransition(e,n){let r=this._currentText;this._currentText=e,this._outgoingText=r,r!==``&&(this._transitionId++,this._activeEffect=n)}_onTransitionEnd(){if(this._outgoingText=``,this._activeEffect=void 0,this._queue.length>0){let e=this._queue.shift();this._startTransition(e.text,e.effect)}}#e;#t;#n(){let e=Math.round(this.duration*.3),n=Math.round(this.duration*.1),r=this._currentText.split(``),o=this._outgoingText.split(``),s=o.length-1,c=r=>`animation-duration:${e}ms;animation-delay:${r*n}ms;animation-timing-function:${this.easing}`;return i`
|
|
12868
13037
|
${ee(`cc${this._transitionId}`,i`
|
|
12869
13038
|
<span class="layer current char-swap">
|
|
12870
13039
|
${r.map((e,n)=>i`<span class="char in" style=${c(n)}>${e}</span>`)}
|
|
@@ -13024,7 +13193,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
13024
13193
|
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
13025
13194
|
to { opacity: 0; transform: translateY(0.3em) scale(0.8); }
|
|
13026
13195
|
}
|
|
13027
|
-
`}};E([d({type:String})],UO.prototype,`text`,void 0),E([d({type:String})],UO.prototype,`effect`,void 0),E([d({type:Number})],UO.prototype,`duration`,void 0),E([d({type:String})],UO.prototype,`easing`,void 0),E([m()],UO.prototype,`_currentText`,void 0),E([m()],UO.prototype,`_outgoingText`,void 0),E([m()],UO.prototype,`_activeEffect`,void 0),E([m()],UO.prototype,`_transitionId`,void 0),UO=E([T(`ixfx-transitory-label`)],UO);var WO=class{#e;#t;#n;#r=new WeakMap;#i=new Map;#a=new Map;#o=new WeakMap;#s;constructor(e,n,r){this.#e=e,this.#t=n,this.#n=r}connect(){this.disconnect(),this.#s=new AbortController;let{signal:e}=this.#s;this.#o=new WeakMap,this.#i.clear(),this.#a.clear();let n={item:this.#c(this.#e)};this.#r.set(n,this.#e),n.children=this.#l(this.#e),this.#t.root=n,this.#t.addEventListener(`expand`,e=>{let{node:n}=e.detail,r=this.#r.get(n);r&&(n.children=this.#l(r),this.#t.invalidateStructure())},{signal:e}),this.#t.addEventListener(`collapse`,e=>{},{signal:e})}disconnect(){this.#s?.abort(),this.#s=void 0}sync(){let e=this.#t.root;e&&(this.#o=new WeakMap,this.#i.clear(),this.#a.clear(),this.#r.set(e,this.#e),e.item=this.#c(this.#e),e.children=this.#f(this.#e,e.children??[]),this.#t.invalidateStructure())}lookupByKey(e){return this.#a.get(e)}navigateToKeyPath(e,n){if(e.length===0)return!1;let r=this.#t.root?.children??[];for(let n=0;n<e.length-1;n++){let i=r.find(r=>r.item.key===e[n]);if(!i)return!1;if(i.children===void 0){let e=this.#r.get(i);e&&(i.children=this.#l(e),this.#t.invalidateStructure())}r=i.children??[]}return this.#t.navigateTo(e,n)}navigateToIdentity(e,n){let r=this.#i.get(e);if(!r)return!1;let i=[],a=this.#e.getIdentity();for(;r&&r.getIdentity()!==a;)i.unshift(this.#c(r).key),r=r.getParent();return r!==void 0&&this.navigateToKeyPath(i,n)}navigateToValue(e,n){let r=this.#p(this.#e,e);return r?this.navigateToKeyPath(r.slice(1).map(e=>this.#c(e).key),n):!1}#c(e,n){let r=e.getIdentity(),i=this.#o.get(r);return i||(i=this.#n.valueToItem(e.getValue(),e),this.#o.set(r,i)),n===void 0?i:{...i,isLeaf:i.isLeaf??n}}#l(e){return Array.from(e.children(),e=>this.#d(e))}#u(e,n){this.#r.set(e,n),this.#i.set(n.getIdentity(),n),this.#a.set(e.item.key,n)}#d(e){let n=[...e.children()];for(let e of n)this.#i.set(e.getIdentity(),e);let r={item:this.#c(e,n.length===0)};return this.#u(r,e),r}#f(e,n){let r=new Map(n.map(e=>[e.item.key,e]));return Array.from(e.children(),e=>{let n=this.#d(e),i=r.get(n.item.key);return i?(i.item=n.item,this.#u(i,e),i.children!==void 0&&(i.children=this.#f(e,i.children)),i):n})}#p(e,n,r=[]){let i=[...r,e];if(n(e.getValue()))return i;for(let r of e.children()){let e=this.#p(r,n,i);if(e)return e}}};function GO(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function KO(e,n){if(e){if(e.item.key===n)return e;for(let r of e.children??[]){let e=KO(r,n);if(e)return e}}}function qO(e,n){if(e){if(e.item.key===n)return[e];for(let r of e.children??[]){let i=qO(r,n);if(i)return[e,...i]}}}function JO(e,n,r){if(e.length===0||n<=0||r<=0)return 1/0;let i=0;for(let a of e){if(a<=0)return 1/0;let e=r*r*a/(n*n);i=Math.max(i,e,1/e)}return i}function YO(e,n){let r=Array.from({length:e.length}),i=n.x,a=n.y,o=n.width,s=n.height,c=0;for(;c<e.length;){let n=Math.min(o,s),l=c+1,u=e.slice(c,l).map(e=>e.area),d=u.reduce((e,n)=>e+n,0),f=JO(u,d,n);for(;l<e.length;){let r=e.slice(c,l+1).map(e=>e.area),i=r.reduce((e,n)=>e+n,0),a=JO(r,i,n);if(a<=f)l++,u=r,d=i,f=a;else break}if(o<=s){let e=d/o,n=i;for(let i=c;i<l;i++){let o=u[i-c]/e;r[i]={x:n,y:a,width:o,height:e},n+=o}a+=e,s-=e}else{let e=d/s,n=a;for(let a=c;a<l;a++){let o=u[a-c]/e;r[a]={x:i,y:n,width:e,height:o},n+=o}i+=e,o-=e}c=l}return r}function XO(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.min(e,1):0}function ZO(e,n,r,i){if(e.width<=0||e.height<=0)return n.map(()=>({x:e.x,y:e.y,width:0,height:0}));let a=n.reduce((e,n)=>e+n,0),o=a>0?n.map(e=>e/a):n.map(()=>1/n.length),s=r===`dice`||r===`slice-dice`&&i%2==0,c=r===`slice`||r===`slice-dice`&&i%2==1;if(r===`squarify`){let r=o.map((e,n)=>({share:e,i:n})).filter(e=>e.share>0),i=n.map(()=>({x:e.x,y:e.y,width:0,height:0}));if(r.length>0){let n=e.width*e.height,a=YO(r.map(e=>({area:e.share*n})),e);r.forEach((e,n)=>{i[e.i]=a[n]})}return i}let l=[];if(s){let n=e.x;o.forEach(r=>{let i=e.width*r;l.push({x:n,y:e.y,width:i,height:e.height}),n+=i})}else if(c){let n=e.y;o.forEach(r=>{let i=e.height*r;l.push({x:e.x,y:n,width:e.width,height:i}),n+=i})}return l}function QO(e,n={}){if(!e?.children?.length)return[];let{maxDepth:r=1/0,valueAccessor:i=()=>1,zoomKey:a,tilingMethod:o=`squarify`,hideLeaves:s=!1,presentation:c=`nested`,cascadeOffsetX:l,cascadeOffsetY:u}=n;if(r<=0)return[];let d=c===`cascaded`,f=d?XO(l):0,p=d?XO(u):0,m=e=>{let n=e.children??[];return s?n.filter(e=>e.item.isLeaf!==!0):n},h=a===void 0?e:KO(e,a)??e,g=qO(e,h.item.key),_=g?g.length-2:-1,v=m(h);if(v.length===0)return[];let y=[],b=(e,n,a,s,c)=>{if(e.length===0||s>=r)return;let l=ZO(n,e.map(e=>GO(i(e.item))),o,s),u=e.length;e.forEach((e,n)=>{let r=l[n],i=m(e);if(y.push({node:e,depth:a,relativeDepth:s,x:r.x,y:r.y,width:r.width,height:r.height,parentKey:c,index:n,setSize:u,hasChildren:i.length>0||e.children===void 0&&e.item.isLeaf!==!0}),i.length>0){let n=f<=0&&p<=0?r:{x:r.x+f,y:r.y+p,width:Math.max(0,r.width-f),height:Math.max(0,r.height-p)};b(i,n,a+1,s+1,e.item.key)}})};return b(v,{x:0,y:0,width:1,height:1},_+1,0,h.item.key),y}let Q=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this.tilingMethod=`squarify`,this.presentation=`nested`,this.cascadeOffset=6,this.maxDepth=4,this.hideLeaves=!1,this.minLabelArea=1600,this.minTileWidth=24,this.padding=4,this.minChildArea=400,this.valueAccessor=()=>1,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this._zoomKey=void 0,this.search=new Vt(this,{adapter:Wt(this,{labelSelector:`.treemap-label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>this.#u().map(e=>({id:e.node.item.key,enabled:!0})),onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)},onTickle:e=>{if(e===void 0)return;let n=this.#u().find(n=>n.node.item.key===e);n&&this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:n.node,depth:n.depth},bubbles:!0,composed:!0}))}}),this.#t=new Set,this.#n=new Map,this.#c=0}get selectedNodes(){return this._selectedNodes}get focusedNode(){if(this._zoomKey!==void 0)return KO(this.#l,this._zoomKey)}#e;#t;#n;#r;#i;#a;#o;#s;#c;get#l(){return this.model?.root??this.root}#u(){return this.#d(this._zoomKey)}#d(e){return QO(this.#l,{valueAccessor:this.valueAccessor,maxDepth:this.maxDepth,zoomKey:e,tilingMethod:this.tilingMethod,hideLeaves:this.hideLeaves,presentation:this.presentation,...this.#f()})}#f(){if(this.presentation!==`cascaded`||!Number.isFinite(this.cascadeOffset)||this.cascadeOffset<=0)return{};let e=this.clientWidth||0,n=this.clientHeight||0;return e<=0||n<=0?{}:{cascadeOffsetX:this.cascadeOffset/e,cascadeOffsetY:this.cascadeOffset/n}}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#i=Yt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e,this.#m(),typeof ResizeObserver<`u`&&(this.#o=new ResizeObserver(()=>this.requestUpdate()),this.#o.observe(this))}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=void 0;for(let e of this.#n.values())e.abort();this.#n.clear(),this.#t.clear(),this.#o?.disconnect(),this.#o=void 0,this.#i&&(this.#i.unregister(`select-all`),this.#i.unregister(`deselect-all`),this.#i=void 0,this.registry=void 0)}#p(){let e=this.searchModes?.trim();if(e===void 0)return[...zt];let n=new Set(e.split(/\s+/));return zt.filter(e=>n.has(e))}#m(){this.#i&&(this.search.setModes(this.#p()),this.#a?.(),this.#a=Rt(this.#i,this.search))}updated(e){if(e.has(`root`)&&this.root&&this.#h(),e.has(`model`)&&(this.#e?.(),this.#e=void 0,this.model&&(this.#e=this.model._subscribe(e=>{e.type===`root`?(this.#h(),this.requestUpdate()):e.type===`invalidate`&&this.requestUpdate()}),this.#h())),e.has(`interactionMode`)&&(this.#r=void 0,this.clearSelection()),e.has(`searchModes`)&&this.#m(),this._zoomKey!==void 0&&!KO(this.#l,this._zoomKey)&&(this._zoomKey=void 0),this.#g(),this.#s){let e=this.#s;this.#s=void 0,this.#S(e)}}#h(){this.#s=void 0,this.#y(),this.tickled.clearTickled(),this._zoomKey=void 0,this.#r=void 0}#g(){if(!(!this.model&&!this.loadChildren))for(let e of this.#u()){let{node:n}=e;n.children!==void 0||this.#t.has(n.item.key)||this.#_(n,e.depth)}}async#_(e,n){let r=e.item.key;this.#t.add(r);let i=new AbortController;this.#n.set(r,i),this.requestUpdate();try{let r;if(r=this.model?await this.model.getChildren(e,n,i.signal):[...await gg(this.loadChildren({node:e,depth:n},i.signal),i.signal)],i.signal.aborted)return;e.children=r}catch{if(i.signal.aborted)return;e.children=[]}finally{this.#t.delete(r),this.#n.delete(r),i.signal.aborted||this.requestUpdate()}}#v(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#y(){this._selectedNodes.clear(),this.selectedNode=void 0}#b(e){this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set(this._selectedNodes),previous:e},bubbles:!0,composed:!0}))}select(e){if(!this.#v(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#b(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#b(n),this.requestUpdate()}clearSelection(){if(this._selectedNodes.size===0)return;let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectAll(){let e=new Set(this._selectedNodes);for(let e of this.#u())this.#v(e.node)&&this._selectedNodes.add(e.node);this.selectedNode=[...this._selectedNodes].at(-1),this.#b(e),this.requestUpdate()}deselectAll(){let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectMany(e){let n=new Set(this._selectedNodes);this._selectedNodes=new Set([...e].filter(e=>this.#v(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#b(n),this.requestUpdate()}zoomTo(e){if(this._zoomKey===e.item.key)return;this.#s=this.#x(e.item.key),this._zoomKey=e.item.key,this.tickled.clearTickled();let n=qO(this.#l,e.item.key)?.length,r=n===void 0?-1:n-2;this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}zoomOut(){if(this._zoomKey===void 0)return;this.#s=this.#x(void 0);let e=this.focusedNode,n=this._zoomKey===void 0?void 0:qO(this.#l,this._zoomKey),r=n===void 0?-1:n.length-2;this._zoomKey=void 0,this.tickled.clearTickled(),this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:void 0,depth:-1},bubbles:!0,composed:!0})),e&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}#x(e){if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;if(e!==void 0){let n=this.#u().find(n=>n.node.item.key===e);if(n)return{direction:`in`,rect:{x:n.x,y:n.y,width:n.width,height:n.height}}}let n=this._zoomKey;if(n===void 0)return;let r=this.#d(e).find(e=>e.node.item.key===n);if(r)return{direction:`out`,rect:{x:r.x,y:r.y,width:r.width,height:r.height}}}#S(e){let n=this.renderRoot.querySelector(`.viewport-inner`),r=this.renderRoot.querySelector(`.viewport`);if(!(n instanceof HTMLElement)||!(r instanceof HTMLElement))return;let i=r.clientWidth,a=r.clientHeight;if(i<=0||a<=0)return;let{rect:o,direction:s}=e,c=s===`in`?`translate(${o.x*i}px, ${o.y*a}px) scale(${Math.max(o.width,1e-4)}, ${Math.max(o.height,1e-4)})`:(()=>{let e=o.width>0?1/o.width:1,n=o.height>0?1/o.height:1;return`translate(${-o.x*e*i}px, ${-o.y*n*a}px) scale(${e}, ${n})`})();n.classList.remove(`flipping`),n.style.transform=c,n.offsetWidth,requestAnimationFrame(()=>{n.classList.add(`flipping`),n.style.transform=`none`}),n.addEventListener(`transitionend`,()=>n.classList.remove(`flipping`),{once:!0})}#C(e){return e.item.isLeaf===!0?!1:e.children===void 0?this.model!==void 0||this.loadChildren!==void 0:this.hideLeaves?e.children.some(e=>e.item.isLeaf!==!0):e.children.length>0}navigateTo(e){let n=this.#l;if(!n?.children)return!1;let r=n,i=[];for(let n of e){let e=r.children?.find(e=>e.item.key===n);if(!e)return!1;i.push(e),r=e}let a=i.at(-1);return i.length>this.maxDepth?this.zoomTo(i[i.length-this.maxDepth-1]):this._zoomKey!==void 0&&this.zoomOut(),this.select(a),this.tickled.setTickled(a.item.key),this.requestUpdate(),!0}navigateToNode(e){let n=this.#l;if(!n?.children)return!1;let r=this.#T(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=this.#l;if(!n?.children)return!1;let r=this.#T(n.children,n=>n.item.key===e);if(!r)return!1;if(r.length>this.maxDepth){let e=this.#w(r.slice(0,r.length-this.maxDepth));e&&this.zoomTo(e)}return this.tickled.setTickled(e),this.requestUpdate(),!0}#w(e){let n=this.#l;for(let r of e){let e=r===n?.item.key?n:n?.children?.find(e=>e.item.key===r);if(!e)return;n=e}return n}#T(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#T(i.children,n,e);if(r)return r}}}getNodes(){return this.#u().map(e=>({node:e.node,depth:e.depth}))}#E(e,n){return!this.filterPredicate||this.filterPredicate(e,n)?!0:e.children?.some(e=>this.#E(e,n+1))??!1}#D(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}#O(e,n){let r=this.#u(),i=this.#D(e),a=r.filter(n=>n!==e&&n.relativeDepth===e.relativeDepth&&n.parentKey===e.parentKey),o,s=1/0;for(let e of a){let r=this.#D(e),a=r.x-i.x,c=r.y-i.y;if(!(n===`left`?a<0:n===`right`?a>0:n===`up`?c<0:c>0))continue;let l=Math.hypot(a,c);l<s&&(s=l,o=e)}return o||(n===`up`||n===`left`?e.parentKey===void 0?void 0:r.find(n=>n.node.item.key===e.parentKey):r.find(n=>n.parentKey===e.node.item.key))}#k(e,n,r){if(this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.interactionMode===`standard`&&(r.ctrlKey||r.metaKey)){if(this._selectedNodes.has(e.node))this.deselect(e.node);else if(this.#v(e.node)){let n=new Set(this._selectedNodes);this._selectedNodes.add(e.node),this.selectedNode=e.node,this.#b(n),this.requestUpdate()}this.#r=n}else if(this.interactionMode===`standard`&&r.shiftKey&&this.#r!==void 0){let e=this.#u(),r=Math.min(this.#r,n),i=Math.max(this.#r,n),a=new Set(this._selectedNodes);this._selectedNodes=new Set(e.slice(r,i+1).map(e=>e.node).filter(e=>this.#v(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#b(a),this.requestUpdate()}else this.interactionMode!==`manual`&&(this.select(e.node),this.#r=n);this.tickled.setTickled(e.node.item.key),this.#C(e.node)&&this.zoomTo(e.node)}#A(e){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0}))}#j(e){if(this.disableKeyboardNavigation)return;let n=this.#u();if(n.length===0)return;let r=this.tickled.tickledId,i=r===void 0?-1:n.findIndex(e=>e.node.item.key===r),a=i>=0?n[i]:void 0,o=n=>{n&&(e.preventDefault(),this.tickled.setTickled(n.node.item.key),this.interactionMode===`implicit`&&this.select(n.node))};switch(e.key){case`ArrowLeft`:o(a?this.#O(a,`left`):n[0]);return;case`ArrowRight`:o(a?this.#O(a,`right`):n[0]);return;case`ArrowUp`:o(a?this.#O(a,`up`):n[0]);return;case`ArrowDown`:o(a?this.#O(a,`down`):n[0]);return;case`Home`:o(n[0]);return;case`End`:o(n.at(-1));return;case`Enter`:if(!a)return;e.preventDefault(),this.interactionMode!==`manual`&&this.select(a.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:a.node,depth:a.depth},bubbles:!0,composed:!0})),this.#C(a.node)&&this.zoomTo(a.node);return;case`Backspace`:case`Escape`:this._zoomKey!==void 0&&(e.preventDefault(),this.zoomOut())}}#M(e){if(!e.metaKey||e.deltaY===0||(e.preventDefault(),performance.now()<this.#c))return;if(e.deltaY>0){if(this._zoomKey===void 0)return;this.#c=performance.now()+260,this.#N();return}let n=(e.target?.closest(`.tile`))?.getAttribute(`data-key`)??void 0;if(n===void 0)return;let r=this.#u().find(e=>e.node.item.key===n);!r||!this.#C(r.node)||(this.#c=performance.now()+260,this.zoomTo(r.node))}#N(){let e=this._zoomKey===void 0?void 0:qO(this.#l,this._zoomKey),n=e&&e.length>2?e[e.length-2]:void 0;n?this.zoomTo(n):this.zoomOut()}#P(){let e=this.focusedNode;return e===void 0?a:i`
|
|
13196
|
+
`}};E([d({type:String})],Fk.prototype,`text`,void 0),E([d({type:String})],Fk.prototype,`effect`,void 0),E([d({type:Number})],Fk.prototype,`duration`,void 0),E([d({type:String})],Fk.prototype,`easing`,void 0),E([m()],Fk.prototype,`_currentText`,void 0),E([m()],Fk.prototype,`_outgoingText`,void 0),E([m()],Fk.prototype,`_activeEffect`,void 0),E([m()],Fk.prototype,`_transitionId`,void 0),Fk=E([T(`ixfx-transitory-label`)],Fk);var Ik=class{#e;#t;#n;#r=new WeakMap;#i=new Map;#a=new Map;#o=new WeakMap;#s;constructor(e,n,r){this.#e=e,this.#t=n,this.#n=r}connect(){this.disconnect(),this.#s=new AbortController;let{signal:e}=this.#s;this.#o=new WeakMap,this.#i.clear(),this.#a.clear();let n={item:this.#c(this.#e)};this.#r.set(n,this.#e),n.children=this.#l(this.#e),this.#t.root=n,this.#t.addEventListener(`expand`,e=>{let{node:n}=e.detail,r=this.#r.get(n);r&&(n.children=this.#l(r),this.#t.invalidateStructure())},{signal:e}),this.#t.addEventListener(`collapse`,e=>{},{signal:e})}disconnect(){this.#s?.abort(),this.#s=void 0}sync(){let e=this.#t.root;e&&(this.#o=new WeakMap,this.#i.clear(),this.#a.clear(),this.#r.set(e,this.#e),e.item=this.#c(this.#e),e.children=this.#f(this.#e,e.children??[]),this.#t.invalidateStructure())}lookupByKey(e){return this.#a.get(e)}navigateToKeyPath(e,n){if(e.length===0)return!1;let r=this.#t.root?.children??[];for(let n=0;n<e.length-1;n++){let i=r.find(r=>r.item.key===e[n]);if(!i)return!1;if(i.children===void 0){let e=this.#r.get(i);e&&(i.children=this.#l(e),this.#t.invalidateStructure())}r=i.children??[]}return this.#t.navigateTo(e,n)}navigateToIdentity(e,n){let r=this.#i.get(e);if(!r)return!1;let i=[],a=this.#e.getIdentity();for(;r&&r.getIdentity()!==a;)i.unshift(this.#c(r).key),r=r.getParent();return r!==void 0&&this.navigateToKeyPath(i,n)}navigateToValue(e,n){let r=this.#p(this.#e,e);return r?this.navigateToKeyPath(r.slice(1).map(e=>this.#c(e).key),n):!1}#c(e,n){let r=e.getIdentity(),i=this.#o.get(r);return i||(i=this.#n.valueToItem(e.getValue(),e),this.#o.set(r,i)),n===void 0?i:{...i,isLeaf:i.isLeaf??n}}#l(e){return Array.from(e.children(),e=>this.#d(e))}#u(e,n){this.#r.set(e,n),this.#i.set(n.getIdentity(),n),this.#a.set(e.item.key,n)}#d(e){let n=[...e.children()];for(let e of n)this.#i.set(e.getIdentity(),e);let r={item:this.#c(e,n.length===0)};return this.#u(r,e),r}#f(e,n){let r=new Map(n.map(e=>[e.item.key,e]));return Array.from(e.children(),e=>{let n=this.#d(e),i=r.get(n.item.key);return i?(i.item=n.item,this.#u(i,e),i.children!==void 0&&(i.children=this.#f(e,i.children)),i):n})}#p(e,n,r=[]){let i=[...r,e];if(n(e.getValue()))return i;for(let r of e.children()){let e=this.#p(r,n,i);if(e)return e}}};function Lk(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:0}function Rk(e,n){if(e){if(e.item.key===n)return e;for(let r of e.children??[]){let e=Rk(r,n);if(e)return e}}}function zk(e,n){if(e){if(e.item.key===n)return[e];for(let r of e.children??[]){let i=zk(r,n);if(i)return[e,...i]}}}function Bk(e,n,r){if(e.length===0||n<=0||r<=0)return 1/0;let i=0;for(let a of e){if(a<=0)return 1/0;let e=r*r*a/(n*n);i=Math.max(i,e,1/e)}return i}function Vk(e,n){let r=Array.from({length:e.length}),i=n.x,a=n.y,o=n.width,s=n.height,c=0;for(;c<e.length;){let n=Math.min(o,s),l=c+1,u=e.slice(c,l).map(e=>e.area),d=u.reduce((e,n)=>e+n,0),f=Bk(u,d,n);for(;l<e.length;){let r=e.slice(c,l+1).map(e=>e.area),i=r.reduce((e,n)=>e+n,0),a=Bk(r,i,n);if(a<=f)l++,u=r,d=i,f=a;else break}if(o<=s){let e=d/o,n=i;for(let i=c;i<l;i++){let o=u[i-c]/e;r[i]={x:n,y:a,width:o,height:e},n+=o}a+=e,s-=e}else{let e=d/s,n=a;for(let a=c;a<l;a++){let o=u[a-c]/e;r[a]={x:i,y:n,width:e,height:o},n+=o}i+=e,o-=e}c=l}return r}function Hk(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.min(e,1):0}function Uk(e,n,r,i){if(e.width<=0||e.height<=0)return n.map(()=>({x:e.x,y:e.y,width:0,height:0}));let a=n.reduce((e,n)=>e+n,0),o=a>0?n.map(e=>e/a):n.map(()=>1/n.length),s=r===`dice`||r===`slice-dice`&&i%2==0,c=r===`slice`||r===`slice-dice`&&i%2==1;if(r===`squarify`){let r=o.map((e,n)=>({share:e,i:n})).filter(e=>e.share>0),i=n.map(()=>({x:e.x,y:e.y,width:0,height:0}));if(r.length>0){let n=e.width*e.height,a=Vk(r.map(e=>({area:e.share*n})),e);r.forEach((e,n)=>{i[e.i]=a[n]})}return i}let l=[];if(s){let n=e.x;o.forEach(r=>{let i=e.width*r;l.push({x:n,y:e.y,width:i,height:e.height}),n+=i})}else if(c){let n=e.y;o.forEach(r=>{let i=e.height*r;l.push({x:e.x,y:n,width:e.width,height:i}),n+=i})}return l}function Wk(e,n={}){if(!e?.children?.length)return[];let{maxDepth:r=1/0,valueAccessor:i=()=>1,zoomKey:a,tilingMethod:o=`squarify`,hideLeaves:s=!1,presentation:c=`nested`,cascadeOffsetX:l,cascadeOffsetY:u}=n;if(r<=0)return[];let d=c===`cascaded`,f=d?Hk(l):0,p=d?Hk(u):0,m=e=>{let n=e.children??[];return s?n.filter(e=>e.item.isLeaf!==!0):n},h=a===void 0?e:Rk(e,a)??e,g=zk(e,h.item.key),_=g?g.length-2:-1,v=m(h);if(v.length===0)return[];let y=[],b=(e,n,a,s,c)=>{if(e.length===0||s>=r)return;let l=Uk(n,e.map(e=>Lk(i(e.item))),o,s),u=e.length;e.forEach((e,n)=>{let r=l[n],i=m(e);if(y.push({node:e,depth:a,relativeDepth:s,x:r.x,y:r.y,width:r.width,height:r.height,parentKey:c,index:n,setSize:u,hasChildren:i.length>0||e.children===void 0&&e.item.isLeaf!==!0}),i.length>0){let n=f<=0&&p<=0?r:{x:r.x+f,y:r.y+p,width:Math.max(0,r.width-f),height:Math.max(0,r.height-p)};b(i,n,a+1,s+1,e.item.key)}})};return b(v,{x:0,y:0,width:1,height:1},_+1,0,h.item.key),y}let $=class extends n{constructor(...e){super(...e),this.exclusivity=`none`,this.selectionFilter=`all`,this.interactionMode=`standard`,this.tilingMethod=`squarify`,this.presentation=`nested`,this.cascadeOffset=6,this.maxDepth=4,this.hideLeaves=!1,this.minLabelArea=1600,this.minTileWidth=24,this.padding=4,this.minChildArea=400,this.valueAccessor=()=>1,this._selectedNodes=new Set,this.disableKeyboardNavigation=!1,this.registry=void 0,this._zoomKey=void 0,this.search=new Bt(this,{adapter:Ut(this,{labelSelector:`.treemap-label`,highlightKey:`incr-search-highlight`})}),this.tickled=new oe(this,{getItems:()=>this.#u().map(e=>({id:e.node.item.key,enabled:!0})),onStateChange:()=>{this.setAttribute(`data-input-mode`,this.tickled.inputMode)},onTickle:e=>{if(e===void 0)return;let n=this.#u().find(n=>n.node.item.key===e);n&&this.dispatchEvent(new CustomEvent(`tickle`,{detail:{node:n.node,depth:n.depth},bubbles:!0,composed:!0}))}}),this.#t=new Set,this.#n=new Map,this.#c=0}get selectedNodes(){return this._selectedNodes}get focusedNode(){if(this._zoomKey!==void 0)return Rk(this.#l,this._zoomKey)}#e;#t;#n;#r;#i;#a;#o;#s;#c;get#l(){return this.model?.root??this.root}#u(){return this.#d(this._zoomKey)}#d(e){return Wk(this.#l,{valueAccessor:this.valueAccessor,maxDepth:this.maxDepth,zoomKey:e,tilingMethod:this.tilingMethod,hideLeaves:this.hideLeaves,presentation:this.presentation,...this.#f()})}#f(){if(this.presentation!==`cascaded`||!Number.isFinite(this.cascadeOffset)||this.cascadeOffset<=0)return{};let e=this.clientWidth||0,n=this.clientHeight||0;return e<=0||n<=0?{}:{cascadeOffsetX:this.cascadeOffset/e,cascadeOffsetY:this.cascadeOffset/n}}connectedCallback(){super.connectedCallback(),this.setAttribute(`data-input-mode`,`mouse`);let e=this.#i=Jt();e.register({id:`select-all`,label:`Select All`,description:`Select all visible items`,execute:()=>this.selectAll()}),e.register({id:`deselect-all`,label:`Deselect All`,description:`Clear all selection`,execute:()=>this.deselectAll()}),this.registry=e,this.#m(),typeof ResizeObserver<`u`&&(this.#o=new ResizeObserver(()=>this.requestUpdate()),this.#o.observe(this))}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=void 0;for(let e of this.#n.values())e.abort();this.#n.clear(),this.#t.clear(),this.#o?.disconnect(),this.#o=void 0,this.#i&&(this.#i.unregister(`select-all`),this.#i.unregister(`deselect-all`),this.#i=void 0,this.registry=void 0)}#p(){let e=this.searchModes?.trim();if(e===void 0)return[...O];let n=new Set(e.split(/\s+/));return O.filter(e=>n.has(e))}#m(){this.#i&&(this.search.setModes(this.#p()),this.#a?.(),this.#a=Rt(this.#i,this.search))}updated(e){if(e.has(`root`)&&this.root&&this.#h(),e.has(`model`)&&(this.#e?.(),this.#e=void 0,this.model&&(this.#e=this.model._subscribe(e=>{e.type===`root`?(this.#h(),this.requestUpdate()):e.type===`invalidate`&&this.requestUpdate()}),this.#h())),e.has(`interactionMode`)&&(this.#r=void 0,this.clearSelection()),e.has(`searchModes`)&&this.#m(),this._zoomKey!==void 0&&!Rk(this.#l,this._zoomKey)&&(this._zoomKey=void 0),this.#g(),this.#s){let e=this.#s;this.#s=void 0,this.#S(e)}}#h(){this.#s=void 0,this.#y(),this.tickled.clearTickled(),this._zoomKey=void 0,this.#r=void 0}#g(){if(!(!this.model&&!this.loadChildren))for(let e of this.#u()){let{node:n}=e;n.children!==void 0||this.#t.has(n.item.key)||this.#_(n,e.depth)}}async#_(e,n){let r=e.item.key;this.#t.add(r);let i=new AbortController;this.#n.set(r,i),this.requestUpdate();try{let r;if(r=this.model?await this.model.getChildren(e,n,i.signal):[...await hg(this.loadChildren({node:e,depth:n},i.signal),i.signal)],i.signal.aborted)return;e.children=r}catch{if(i.signal.aborted)return;e.children=[]}finally{this.#t.delete(r),this.#n.delete(r),i.signal.aborted||this.requestUpdate()}}#v(e){return this.selectionFilter===`none`?!1:this.selectionFilter===`leaf`?e.item.isLeaf===!0:this.selectionFilter!==`branch`||e.item.isLeaf===!1||e.children!==void 0&&e.children.length>0}#y(){this._selectedNodes.clear(),this.selectedNode=void 0}#b(e){this.dispatchEvent(new CustomEvent(`select`,{detail:{selected:new Set(this._selectedNodes),previous:e},bubbles:!0,composed:!0}))}select(e){if(!this.#v(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.clear(),this._selectedNodes.add(e),this.selectedNode=e,this.#b(n),this.requestUpdate()}deselect(e){if(!this._selectedNodes.has(e))return;let n=new Set(this._selectedNodes);this._selectedNodes.delete(e),this.selectedNode===e&&(this.selectedNode=[...this._selectedNodes].at(-1)),this.#b(n),this.requestUpdate()}clearSelection(){if(this._selectedNodes.size===0)return;let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectAll(){let e=new Set(this._selectedNodes);for(let e of this.#u())this.#v(e.node)&&this._selectedNodes.add(e.node);this.selectedNode=[...this._selectedNodes].at(-1),this.#b(e),this.requestUpdate()}deselectAll(){let e=new Set(this._selectedNodes);this.#y(),this.#b(e),this.requestUpdate()}selectMany(e){let n=new Set(this._selectedNodes);this._selectedNodes=new Set([...e].filter(e=>this.#v(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#b(n),this.requestUpdate()}zoomTo(e){if(this._zoomKey===e.item.key)return;this.#s=this.#x(e.item.key),this._zoomKey=e.item.key,this.tickled.clearTickled();let n=zk(this.#l,e.item.key)?.length,r=n===void 0?-1:n-2;this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`expand`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}zoomOut(){if(this._zoomKey===void 0)return;this.#s=this.#x(void 0);let e=this.focusedNode,n=this._zoomKey===void 0?void 0:zk(this.#l,this._zoomKey),r=n===void 0?-1:n.length-2;this._zoomKey=void 0,this.tickled.clearTickled(),this.dispatchEvent(new CustomEvent(`zoom`,{detail:{node:void 0,depth:-1},bubbles:!0,composed:!0})),e&&this.dispatchEvent(new CustomEvent(`collapse`,{detail:{node:e,depth:r},bubbles:!0,composed:!0})),this.requestUpdate()}#x(e){if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;if(e!==void 0){let n=this.#u().find(n=>n.node.item.key===e);if(n)return{direction:`in`,rect:{x:n.x,y:n.y,width:n.width,height:n.height}}}let n=this._zoomKey;if(n===void 0)return;let r=this.#d(e).find(e=>e.node.item.key===n);if(r)return{direction:`out`,rect:{x:r.x,y:r.y,width:r.width,height:r.height}}}#S(e){let n=this.renderRoot.querySelector(`.viewport-inner`),r=this.renderRoot.querySelector(`.viewport`);if(!(n instanceof HTMLElement)||!(r instanceof HTMLElement))return;let i=r.clientWidth,a=r.clientHeight;if(i<=0||a<=0)return;let{rect:o,direction:s}=e,c=s===`in`?`translate(${o.x*i}px, ${o.y*a}px) scale(${Math.max(o.width,1e-4)}, ${Math.max(o.height,1e-4)})`:(()=>{let e=o.width>0?1/o.width:1,n=o.height>0?1/o.height:1;return`translate(${-o.x*e*i}px, ${-o.y*n*a}px) scale(${e}, ${n})`})();n.classList.remove(`flipping`),n.style.transform=c,n.offsetWidth,requestAnimationFrame(()=>{n.classList.add(`flipping`),n.style.transform=`none`}),n.addEventListener(`transitionend`,()=>n.classList.remove(`flipping`),{once:!0})}#C(e){return e.item.isLeaf===!0?!1:e.children===void 0?this.model!==void 0||this.loadChildren!==void 0:this.hideLeaves?e.children.some(e=>e.item.isLeaf!==!0):e.children.length>0}navigateTo(e){let n=this.#l;if(!n?.children)return!1;let r=n,i=[];for(let n of e){let e=r.children?.find(e=>e.item.key===n);if(!e)return!1;i.push(e),r=e}let a=i.at(-1);return i.length>this.maxDepth?this.zoomTo(i[i.length-this.maxDepth-1]):this._zoomKey!==void 0&&this.zoomOut(),this.select(a),this.tickled.setTickled(a.item.key),this.requestUpdate(),!0}navigateToNode(e){let n=this.#l;if(!n?.children)return!1;let r=this.#T(n.children,e);return r?this.navigateTo(r):!1}revealKey(e){let n=this.#l;if(!n?.children)return!1;let r=this.#T(n.children,n=>n.item.key===e);if(!r)return!1;if(r.length>this.maxDepth){let e=this.#w(r.slice(0,r.length-this.maxDepth));e&&this.zoomTo(e)}return this.tickled.setTickled(e),this.requestUpdate(),!0}#w(e){let n=this.#l;for(let r of e){let e=r===n?.item.key?n:n?.children?.find(e=>e.item.key===r);if(!e)return;n=e}return n}#T(e,n,r=[]){for(let i of e){let e=[...r,i.item.key];if(n(i))return e;if(i.children?.length){let r=this.#T(i.children,n,e);if(r)return r}}}getNodes(){return this.#u().map(e=>({node:e.node,depth:e.depth}))}#E(e,n){return!this.filterPredicate||this.filterPredicate(e,n)?!0:e.children?.some(e=>this.#E(e,n+1))??!1}#D(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}#O(e,n){let r=this.#u(),i=this.#D(e),a=r.filter(n=>n!==e&&n.relativeDepth===e.relativeDepth&&n.parentKey===e.parentKey),o,s=1/0;for(let e of a){let r=this.#D(e),a=r.x-i.x,c=r.y-i.y;if(!(n===`left`?a<0:n===`right`?a>0:n===`up`?c<0:c>0))continue;let l=Math.hypot(a,c);l<s&&(s=l,o=e)}return o||(n===`up`||n===`left`?e.parentKey===void 0?void 0:r.find(n=>n.node.item.key===e.parentKey):r.find(n=>n.parentKey===e.node.item.key))}#k(e,n,r){if(this.dispatchEvent(new CustomEvent(`item-click`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.interactionMode===`standard`&&(r.ctrlKey||r.metaKey)){if(this._selectedNodes.has(e.node))this.deselect(e.node);else if(this.#v(e.node)){let n=new Set(this._selectedNodes);this._selectedNodes.add(e.node),this.selectedNode=e.node,this.#b(n),this.requestUpdate()}this.#r=n}else if(this.interactionMode===`standard`&&r.shiftKey&&this.#r!==void 0){let e=this.#u(),r=Math.min(this.#r,n),i=Math.max(this.#r,n),a=new Set(this._selectedNodes);this._selectedNodes=new Set(e.slice(r,i+1).map(e=>e.node).filter(e=>this.#v(e))),this.selectedNode=[...this._selectedNodes].at(-1),this.#b(a),this.requestUpdate()}else this.interactionMode!==`manual`&&(this.select(e.node),this.#r=n);this.tickled.setTickled(e.node.item.key),this.#C(e.node)&&this.zoomTo(e.node)}#A(e){this.dispatchEvent(new CustomEvent(`item-dblclick`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:e.node,depth:e.depth},bubbles:!0,composed:!0}))}#j(e){if(this.disableKeyboardNavigation)return;let n=this.#u();if(n.length===0)return;let r=this.tickled.tickledId,i=r===void 0?-1:n.findIndex(e=>e.node.item.key===r),a=i>=0?n[i]:void 0,o=n=>{n&&(e.preventDefault(),this.tickled.setTickled(n.node.item.key),this.interactionMode===`implicit`&&this.select(n.node))};switch(e.key){case`ArrowLeft`:o(a?this.#O(a,`left`):n[0]);return;case`ArrowRight`:o(a?this.#O(a,`right`):n[0]);return;case`ArrowUp`:o(a?this.#O(a,`up`):n[0]);return;case`ArrowDown`:o(a?this.#O(a,`down`):n[0]);return;case`Home`:o(n[0]);return;case`End`:o(n.at(-1));return;case`Enter`:if(!a)return;e.preventDefault(),this.interactionMode!==`manual`&&this.select(a.node),this.dispatchEvent(new CustomEvent(`activate`,{detail:{node:a.node,depth:a.depth},bubbles:!0,composed:!0})),this.#C(a.node)&&this.zoomTo(a.node);return;case`Backspace`:case`Escape`:this._zoomKey!==void 0&&(e.preventDefault(),this.zoomOut())}}#M(e){if(!e.metaKey||e.deltaY===0||(e.preventDefault(),performance.now()<this.#c))return;if(e.deltaY>0){if(this._zoomKey===void 0)return;this.#c=performance.now()+260,this.#N();return}let n=(e.target?.closest(`.tile`))?.getAttribute(`data-key`)??void 0;if(n===void 0)return;let r=this.#u().find(e=>e.node.item.key===n);!r||!this.#C(r.node)||(this.#c=performance.now()+260,this.zoomTo(r.node))}#N(){let e=this._zoomKey===void 0?void 0:zk(this.#l,this._zoomKey),n=e&&e.length>2?e[e.length-2]:void 0;n?this.zoomTo(n):this.zoomOut()}#P(){let e=this.focusedNode;return e===void 0?a:i`
|
|
13028
13197
|
<nav class="breadcrumb" part="breadcrumb" aria-label="Treemap zoom path">
|
|
13029
13198
|
<ixfx-crumb-navigation
|
|
13030
13199
|
with-up
|
|
@@ -13085,7 +13254,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
13085
13254
|
`}
|
|
13086
13255
|
</div>
|
|
13087
13256
|
${this.search.renderField()}
|
|
13088
|
-
`}static{this.styles=[w,se,C,
|
|
13257
|
+
`}static{this.styles=[w,se,C,Vt,r`
|
|
13089
13258
|
:host {
|
|
13090
13259
|
--treemap-height: 280px;
|
|
13091
13260
|
--treemap-gap: 2px;
|
|
@@ -13246,7 +13415,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
13246
13415
|
color: var(--surface-muted-text);
|
|
13247
13416
|
font-size: var(--text-s);
|
|
13248
13417
|
}
|
|
13249
|
-
`]}};E([d({type:Object})]
|
|
13418
|
+
`]}};E([d({type:Object})],$.prototype,`root`,void 0),E([d({attribute:!1})],$.prototype,`model`,void 0),E([d({attribute:!1})],$.prototype,`loadChildren`,void 0),E([d({reflect:!0,attribute:`exclusivity`})],$.prototype,`exclusivity`,void 0),E([d({reflect:!0,attribute:`selection-filter`})],$.prototype,`selectionFilter`,void 0),E([d({type:String,attribute:`interaction-mode`})],$.prototype,`interactionMode`,void 0),E([d({type:String,attribute:`tiling-method`})],$.prototype,`tilingMethod`,void 0),E([d({type:String,attribute:`presentation`})],$.prototype,`presentation`,void 0),E([d({type:Number,attribute:`cascade-offset`})],$.prototype,`cascadeOffset`,void 0),E([d({type:Number,attribute:`max-depth`})],$.prototype,`maxDepth`,void 0),E([d({type:Boolean,attribute:`hide-leaves`})],$.prototype,`hideLeaves`,void 0),E([d({type:Number,attribute:`min-label-area`})],$.prototype,`minLabelArea`,void 0),E([d({type:Number,attribute:`min-tile-width`})],$.prototype,`minTileWidth`,void 0),E([d({type:Number})],$.prototype,`padding`,void 0),E([d({type:Number,attribute:`min-child-area`})],$.prototype,`minChildArea`,void 0),E([d({attribute:!1})],$.prototype,`valueAccessor`,void 0),E([d({attribute:!1})],$.prototype,`categoryAccessor`,void 0),E([d({attribute:!1})],$.prototype,`selectedNode`,void 0),E([m()],$.prototype,`_selectedNodes`,void 0),E([d({attribute:!1})],$.prototype,`filterPredicate`,void 0),E([d({type:Boolean,attribute:`disable-keyboard-navigation`})],$.prototype,`disableKeyboardNavigation`,void 0),E([d({attribute:!1})],$.prototype,`registry`,void 0),E([d({type:String,attribute:`search-modes`,reflect:!0})],$.prototype,`searchModes`,void 0),E([m()],$.prototype,`_zoomKey`,void 0),$=E([T(`ixfx-treemap-list`)],$);let Gk=class extends n{constructor(...e){super(...e),this.layout=`vertical`,this.sizeA=``,this.sizeB=``,this.fixedA=!1,this.fixedB=!1,this.collapsible=!1,this.collapsedA=!1,this.collapsedB=!1,this.minSizeA=``,this.maxSizeA=``,this.minSizeB=``,this.maxSizeB=``,this._hasCorner=!1,this.#t=``,this.#n=``,this.#r=0,this.#i=0,this.#a=``,this.#u=null,this.#p=.1,this.#E=e=>{e.preventDefault();let n=this.getZone();n&&n.classList.add(`user-resizing`),this.#e=this.getBoundingClientRect(),this.#t=this.sizeA,this.#n=this.sizeB,window.addEventListener(`pointerup`,this.#D),window.addEventListener(`pointermove`,this.#O)},this.#D=e=>{e.preventDefault();let n=this.getZone();n&&n.classList.remove(`user-resizing`),window.removeEventListener(`pointerup`,this.#D),window.removeEventListener(`pointermove`,this.#O)},this.#O=e=>{let n=this.#e;if(n){if(this.layout===`horizontal`){let r=ri((e.y-n.y)/n.height);if(this.collapsible&&this.collapsedA){if(r>(this.#d??.05)+this.#p){this.collapsedA=!1,this.#h(`A`,!1),this.#d=void 0;let{sizeA:e,sizeB:i}=this.#x(`${r*100}%`,`${(1-r)*100}%`,n.height);this.sizeA=e,this.sizeB=i}}else if(this.collapsible&&!this.collapsedA&&r<5/n.height)this.collapsedA=!0,this.#h(`A`,!0),this.sizeA=`0px`,this.sizeB=`100%`,this.#d=r;else if(!this.collapsedA){let{sizeA:e,sizeB:i}=this.#x(`${r*100}%`,`${(1-r)*100}%`,n.height);this.sizeA=e,this.sizeB=i}if(this.collapsible&&this.collapsedB){if(r<(this.#f??.95)-this.#p){this.collapsedB=!1,this.#h(`B`,!1),this.#f=void 0;let{sizeA:e,sizeB:i}=this.#x(`${r*100}%`,`${(1-r)*100}%`,n.height);this.sizeA=e,this.sizeB=i}}else this.collapsible&&!this.collapsedB&&r>1-5/n.height&&(this.collapsedB=!0,this.#h(`B`,!0),this.sizeA=`100%`,this.sizeB=`0px`,this.#f=r)}else{let r=ri((e.x-n.x)/n.width);if(this.collapsible&&this.collapsedA){if(r>(this.#d??.05)+this.#p){this.collapsedA=!1,this.#h(`A`,!1),this.#d=void 0;let{sizeA:e,sizeB:i}=this.#x(`${r*100}%`,`${(1-r)*100}%`,n.width);this.sizeA=e,this.sizeB=i}}else if(this.collapsible&&!this.collapsedA&&r<5/n.width)this.collapsedA=!0,this.#h(`A`,!0),this.sizeA=`0px`,this.sizeB=`100%`,this.#d=r;else if(!this.collapsedA){let{sizeA:e,sizeB:i}=this.#x(`${r*100}%`,`${(1-r)*100}%`,n.width);this.sizeA=e,this.sizeB=i}if(this.collapsible&&this.collapsedB){if(r<(this.#f??.95)-this.#p){this.collapsedB=!1,this.#h(`B`,!1),this.#f=void 0;let{sizeA:e,sizeB:i}=this.#x(`${r*100}%`,`${(1-r)*100}%`,n.width);this.sizeA=e,this.sizeB=i}}else this.collapsible&&!this.collapsedB&&r>1-5/n.width&&(this.collapsedB=!0,this.#h(`B`,!0),this.sizeA=`100%`,this.sizeB=`0px`,this.#f=r)}e.preventDefault()}},this.#k=e=>{e.preventDefault(),e.stopPropagation();let n=this.getZone();n&&n.classList.add(`user-resizing`),this.#e=this.getBoundingClientRect(),this.#r=e.clientX,this.#i=e.clientY,this.#t=this.sizeA,this.#n=this.sizeB;let r=this.#v();if(r){this.#a=r.sizeA;let e=r.getBoundingClientRect(),n=r.shadowRoot?.querySelector(`.split-bar`);n&&(this.#s=e,this.#c=n.getBoundingClientRect());let i=r.getZone();i&&i.classList.add(`user-resizing`)}window.addEventListener(`pointerup`,this.#A),window.addEventListener(`pointermove`,this.#M)},this.#A=e=>{e.preventDefault();let n=this.getZone();n&&n.classList.remove(`user-resizing`);let r=this.#v();if(r){let e=r.getZone();e&&e.classList.remove(`user-resizing`)}window.removeEventListener(`pointerup`,this.#A),window.removeEventListener(`pointermove`,this.#M)},this.#M=e=>{let n=this.#e,r=this.getZone(),i=this.#v();if(!n||!r||!i)return;let a=r.getBoundingClientRect(),o=e.clientX-a.left,s=e.clientY-a.top;if(this.layout===`vertical`&&i.layout===`horizontal`){let e=o/n.width,r=s/n.height,{sizeA:i,sizeB:a}=this.#x(`${e*100}%`,`${(1-e)*100}%`,n.width);e=this.#y(i,n.width),this.sizeA=i,this.sizeB=a,this.#u={sizeA:r,sizeB:1-r},requestAnimationFrame(()=>this.#j());let c=this.shadowRoot?.querySelector(`.corner-zone`);c&&(c.style.left=`${o-6}px`,c.style.top=`${s-6}px`)}else if(this.layout===`horizontal`&&i.layout===`vertical`){let e=o/n.width,r=s/n.height,{sizeA:i,sizeB:a}=this.#x(`${r*100}%`,`${(1-r)*100}%`,n.height);r=this.#y(i,n.height),this.sizeA=i,this.sizeB=a,this.#u={sizeA:e,sizeB:1-e},requestAnimationFrame(()=>this.#j());let c=this.shadowRoot?.querySelector(`.corner-zone`);c&&(c.style.left=`${o-6}px`,c.style.top=`${s-6}px`)}e.preventDefault()}}get showGrabHandle(){let e=getComputedStyle(this).getPropertyValue(`--handle-size`).trim(),n=Number.parseFloat(e);return!Number.isNaN(n)&&n>3}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;disconnectedCallback(){super.disconnectedCallback(),this.#l?.disconnect()}firstUpdated(){this.#g()}updated(e){(e.has(`sizeA`)||e.has(`sizeB`)||e.has(`collapsedA`)||e.has(`collapsedB`))&&this.#T(),(e.has(`sizeA`)||e.has(`sizeB`))&&this.#m()}#m(){this.collapsedA?this.setAttribute(`data-collapsed-a`,``):this.removeAttribute(`data-collapsed-a`),this.collapsedB?this.setAttribute(`data-collapsed-b`,``):this.removeAttribute(`data-collapsed-b`)}#h(e,n){this.dispatchEvent(new CustomEvent(`ixfx-split-collapsed`,{detail:{panel:e,collapsed:n},bubbles:!0,composed:!0}))}#g(){let e=this.shadowRoot?.querySelector(`slot[name="a"]`);e&&(this.#l=new MutationObserver(()=>{this.#_()}),this.#l.observe(e,{characterData:!0,childList:!0,subtree:!0}),this.#_())}#_(){let e=this.shadowRoot?.querySelector(`slot[name="a"]`);if(!e)return;let n=e.assignedElements(),r=e=>{for(let n of e){if(n.tagName===`IXFX-SPLIT-LAYOUT`)return n;let e=r(Array.from(n.children));if(e)return e}},i=r(n);i?(this.#o=i,this._hasCorner=!0,requestAnimationFrame(()=>this.#T())):(this.#o=void 0,this._hasCorner=!1)}#v(){if(this.#o)return this.#o;let e=this.shadowRoot?.querySelector(`slot[name="a"]`);if(e)return e.assignedElements().find(e=>e.tagName===`IXFX-SPLIT-LAYOUT`)}#y(e,n){return e.endsWith(`px`)?Number.parseFloat(e.replace(`px`,``))/n:e.endsWith(`%`)?Number.parseFloat(e.replace(`%`,``))/100:.5}#b(e,n){return e.endsWith(`px`)?Number.parseFloat(e.replace(`px`,``)):e.endsWith(`%`)?Number.parseFloat(e.replace(`%`,``))/100*n:null}#x(e,n,r){let i=this.#y(e,r),a=this.#y(n,r),o=this.#S(this.minSizeA,r),s=this.#S(this.minSizeB,r),c=this.#C(this.maxSizeA,r),l=this.#C(this.maxSizeB,r);if(o!==null||s!==null){let e=(o??0)+(s??0);if(e>1){let n=1/e;o!==null&&(i=o===null?0:o*n),s!==null&&(a=s===null?0:s*n)}i<(o??0)&&(i=o??0),a<(s??0)&&(a=s??0)}c!==null&&i>c&&(i=c),l!==null&&a>l&&(a=l),a=1-i;let u=!this.sizeA.endsWith(`px`);return this.sizeB.endsWith(`px`),u?{sizeA:`${i*100}%`,sizeB:`${a*100}%`}:{sizeA:`${i*r}px`,sizeB:`${a*r}px`}}#S(e,n){if(e.length===0)return null;let r=this.#b(e,n);return r===null?e.endsWith(`%`)?Number.parseFloat(e.replace(`%`,``))/100:null:r/n}#C(e,n){if(e.length===0)return null;let r=this.#b(e,n);return r===null?e.endsWith(`%`)?Number.parseFloat(e.replace(`%`,``))/100:null:r/n}#w(){let e=this.getBoundingClientRect(),n=this.getZone();if(!n)return null;let r=this.#v();if(!r)return null;n.getBoundingClientRect();let i=this.#y(this.sizeA||`50%`,e.width),a,o;if(this.layout===`vertical`&&r.layout===`horizontal`)a=i*e.width,o=this.#y(r.sizeA||`50%`,e.height)*e.height;else if(this.layout===`horizontal`&&r.layout===`vertical`)a=this.#y(r.sizeA||`50%`,e.width)*e.width,o=i*e.height;else return null;return{x:a,y:o}}#T(){if(!this._hasCorner)return;let e=this.shadowRoot?.querySelector(`.corner-zone`);if(!e||!this.getZone())return;let n=this.#w();if(!n){e.style.display=`none`;return}let r=n.x-6,i=n.y-6;e.style.left=`${r}px`,e.style.top=`${i}px`,e.style.display=`block`;let a=this.#v();a&&(this.layout===`vertical`&&a.layout===`horizontal`?e.style.cursor=`nwse-resize`:this.layout===`horizontal`&&a.layout===`vertical`&&(e.style.cursor=`nesw-resize`))}getZone(){if(!this.shadowRoot)return;let e=this.shadowRoot.querySelector(`#zone`);if(e)return e}#E;#D;#O;#k;#A;#j(){if(!this.#u)return;let{sizeA:e,sizeB:n}=this.#u,r=this.#v();r&&(r.sizeA=`${e*100}%`,r.sizeB=`${n*100}%`),this.#u=null}#M;render(){let e=this.layout===`vertical`?`width`:`height`,n=this.sizeA,r=this.sizeB;return this.collapsedA?n=`0px`:n.length===0&&r.length===0?r=n=`50%`:n.length===0?n=`auto`:r.length===0&&(r=`auto`),this.collapsedB&&(r=`0px`),n=`${e}:${n}`,r=`${e}:${r}`,i`
|
|
13250
13419
|
<div id="zone">
|
|
13251
13420
|
<slot style=${n} name="a"></slot>
|
|
13252
13421
|
${this._hasCorner?i`<div class="corner-zone" @pointerdown=${this.#k}></div>`:``}
|
|
@@ -13259,7 +13428,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
13259
13428
|
></span>`:``}
|
|
13260
13429
|
</div>
|
|
13261
13430
|
<slot style=${r} name="b"></slot>
|
|
13262
|
-
</div>`}static{this.styles=[w,
|
|
13431
|
+
</div>`}static{this.styles=[w,Yt,r`
|
|
13263
13432
|
:host {
|
|
13264
13433
|
--handle-size: 2px;
|
|
13265
13434
|
--handle-colour: transparent;
|
|
@@ -13370,7 +13539,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
13370
13539
|
:host([data-collapsed-b]) slot[name="b"] {
|
|
13371
13540
|
display: none;
|
|
13372
13541
|
}
|
|
13373
|
-
`]}};E([d({type:String})]
|
|
13542
|
+
`]}};E([d({type:String})],Gk.prototype,`layout`,void 0),E([d({type:String})],Gk.prototype,`sizeA`,void 0),E([d({type:String})],Gk.prototype,`sizeB`,void 0),E([d({type:Boolean})],Gk.prototype,`fixedA`,void 0),E([d({type:Boolean})],Gk.prototype,`fixedB`,void 0),E([d({type:Boolean})],Gk.prototype,`collapsible`,void 0),E([d({type:Boolean,reflect:!0})],Gk.prototype,`collapsedA`,void 0),E([d({type:Boolean,reflect:!0})],Gk.prototype,`collapsedB`,void 0),E([d({type:String})],Gk.prototype,`minSizeA`,void 0),E([d({type:String})],Gk.prototype,`maxSizeA`,void 0),E([d({type:String})],Gk.prototype,`minSizeB`,void 0),E([d({type:String})],Gk.prototype,`maxSizeB`,void 0),E([m()],Gk.prototype,`_hasCorner`,void 0),Gk=E([T(`ixfx-twosplit-layout`)],Gk);function Kk(e){return e instanceof HTMLElement&&`checked`in e}function qk(e){if(typeof e==`string`){let n=document.querySelector(e);if(!(n instanceof HTMLElement))throw Error(`Element not found or not HTMLElement: ${e}`);return n}return e}function Jk(e,n){let r=qk(e);if(!Kk(r))throw Error(`Target element is not a checkbox-like element`);let i=[];for(let e of n){let n=qk(e);Kk(n)&&i.push(n)}let a=()=>{if(i.length===0){r.checked=!1,r.indeterminate=!1;return}let e=0,n=0;for(let r of i)r.checked?e++:n++;e>0&&n>0?(r.checked=!1,r.indeterminate=!0):e===i.length?(r.checked=!0,r.indeterminate=!1):(r.checked=!1,r.indeterminate=!1)},o=()=>{a()};for(let e of i)e.addEventListener(`change`,o);return a(),()=>{for(let e of i)e.removeEventListener(`change`,o)}}function Yk(e,n,r,i){return i===`linear`?(e-n)/(r-n):Math.log(e/n)/Math.log(r/n)}function Xk(e,n,r,i){return i===`linear`?n+e*(r-n):n*(r/n)**e}function Zk(e,n,r,i){if(!i||i<=1)return e;let a=(r-n)/i;return Math.round((e-n)/a)*a+n}let Qk=class extends qy(n){constructor(...e){super(...e),this.xMin=1,this.xMax=100,this.x=50,this.yMin=1,this.yMax=100,this.y=50,this.xScale=`linear`,this.yScale=`linear`,this.xLabel=`X`,this.yLabel=`Y`,this.showCrosshairs=!1,this.showGrid=!1,this.hideCursor=!1,this.disabled=!1,this._dragging=!1,this._dragStartX=0,this._dragStartY=0,this._pressedKeys=new Set,this._onKeyDown=e=>{if(!this.disabled){if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))e.preventDefault(),this._pressedKeys.add(e.key),this._handleKeyboardMove(e.shiftKey);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let n=e.key===`Home`?this.xMin:this.xMax,r=e.key===`Home`?this.yMin:this.yMax;(n!==this.x||r!==this.y)&&(this.x=n,this.y=r,this.dispatchEvent(new CustomEvent(`input`,{detail:{x:this.x,y:this.y},bubbles:!0,composed:!0})))}}},this._onKeyUp=e=>{this._pressedKeys.delete(e.key)},this._handleKeyboardMove=e=>{let n=this.xMax-this.xMin,r=this.yMax-this.yMin,i=this.stopsX??this.stops,a=this.stopsY??this.stops,o=Ky(n,i,this.stepX,e),s=Ky(r,a,this.stepY,e),c=this.x,l=this.y;if(this._pressedKeys.has(`ArrowLeft`)&&(c=Math.max(this.xMin,this.x-o)),this._pressedKeys.has(`ArrowRight`)&&(c=Math.min(this.xMax,this.x+o)),this._pressedKeys.has(`ArrowUp`)&&(l=Math.min(this.yMax,this.y+s)),this._pressedKeys.has(`ArrowDown`)&&(l=Math.max(this.yMin,this.y-s)),c!==this.x||l!==this.y){let e=this.xSnapStep&&this.xSnapStep>0?Math.round(c/this.xSnapStep)*this.xSnapStep:c,n=this.ySnapStep&&this.ySnapStep>0?Math.round(l/this.ySnapStep)*this.ySnapStep:l;e=Zk(e,this.xMin,this.xMax,i),n=Zk(n,this.yMin,this.yMax,a),this.x=e,this.y=n,this.dispatchEvent(new CustomEvent(`input`,{detail:{x:this.x,y:this.y},bubbles:!0,composed:!0}))}},this._onPointerDown=e=>{e.preventDefault();let n=this.renderRoot.querySelector(`.xy-pad-area`);n?.focus(),n&&n.setPointerCapture(e.pointerId),this._dragging=!0,this._dragStartX=this.x,this._dragStartY=this.y,this.setAttribute(`dragging`,``),this._updateFromPointer(e),globalThis.addEventListener(`pointermove`,this._onPointerMove),globalThis.addEventListener(`pointerup`,this._onPointerUp)},this._onPointerMove=e=>{this._dragging&&(e.preventDefault(),this._updateFromPointer(e))},this._onPointerUp=()=>{let e=this.x!==this._dragStartX||this.y!==this._dragStartY;this._dragging=!1,this.removeAttribute(`dragging`),globalThis.removeEventListener(`pointermove`,this._onPointerMove),globalThis.removeEventListener(`pointerup`,this._onPointerUp),e&&this.dispatchEvent(new CustomEvent(`change`,{detail:{x:this.x,y:this.y},bubbles:!0,composed:!0}))}}static{this.styles=[w,sn,r`
|
|
13374
13543
|
:host {
|
|
13375
13544
|
display: block;
|
|
13376
13545
|
width: 200px;
|
|
@@ -13484,7 +13653,7 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
13484
13653
|
height:100%;
|
|
13485
13654
|
text-align:center;
|
|
13486
13655
|
}
|
|
13487
|
-
`]}_stepYByDelta(e,n){let r=this.yMax-this.yMin,i=this.stopsY??this.stops,a=Ky(r,i,this.stepY,n),o=e===1?Math.min(this.yMax,this.y+a):Math.max(this.yMin,this.y-a);if(o===this.y)return;let s=this.ySnapStep&&this.ySnapStep>0?Math.round(o/this.ySnapStep)*this.ySnapStep:o;s=
|
|
13656
|
+
`]}_stepYByDelta(e,n){let r=this.yMax-this.yMin,i=this.stopsY??this.stops,a=Ky(r,i,this.stepY,n),o=e===1?Math.min(this.yMax,this.y+a):Math.max(this.yMin,this.y-a);if(o===this.y)return;let s=this.ySnapStep&&this.ySnapStep>0?Math.round(o/this.ySnapStep)*this.ySnapStep:o;s=Zk(s,this.yMin,this.yMax,i),s!==this.y&&(this.y=s,this.dispatchEvent(new CustomEvent(`input`,{detail:{x:this.x,y:this.y},bubbles:!0,composed:!0})))}_applyWheelDelta(e,n){this._stepYByDelta(e,n.shiftKey)}_updateFromPointer(e){let n=this.renderRoot.querySelector(`.xy-pad-area`);if(!n)return;let r=n.getBoundingClientRect(),i=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width)),a=Math.max(0,Math.min(1,1-(e.clientY-r.top)/r.height)),o=Xk(i,this.xMin,this.xMax,this.xScale),s=Xk(a,this.yMin,this.yMax,this.yScale),c=this.xSnapStep&&this.xSnapStep>0?Math.round(o/this.xSnapStep)*this.xSnapStep:o,l=this.ySnapStep&&this.ySnapStep>0?Math.round(s/this.ySnapStep)*this.ySnapStep:s,u=this.stopsX??this.stops,d=this.stopsY??this.stops;c=Zk(c,this.xMin,this.xMax,u),l=Zk(l,this.yMin,this.yMax,d),this.x=c,this.y=l,this.dispatchEvent(new CustomEvent(`input`,{detail:{x:this.x,y:this.y},bubbles:!0,composed:!0}))}_setPctVars(){let e=Math.max(this.xMin,Math.min(this.xMax,this.x)),n=Math.max(this.yMin,Math.min(this.yMax,this.y)),r=Yk(e,this.xMin,this.xMax,this.xScale)*100,i=Yk(n,this.yMin,this.yMax,this.yScale)*100;this.style.setProperty(`--x-pct`,`${r}`),this.style.setProperty(`--y-pct`,`${i}`);let a=r-50,o=i-50,s=Math.sqrt(a*a+o*o);this.style.setProperty(`--radius-pct`,`${s}`)}getRelativeX(){return Yk(Math.max(this.xMin,Math.min(this.xMax,this.x)),this.xMin,this.xMax,this.xScale)}getRelativeY(){return Yk(Math.max(this.yMin,Math.min(this.yMax,this.y)),this.yMin,this.yMax,this.yScale)}getPolar(){let e=this.getRelativeX()-.5,n=this.getRelativeY()-.5,r=Math.sqrt(e*e+n*n)*2,i=Math.atan2(n,e);return i<0&&(i+=2*Math.PI),{radius:r,angle:i}}updated(e){super.updated(e),this._setPctVars()}disconnectedCallback(){super.disconnectedCallback(),this._onPointerUp(),this._pressedKeys.clear()}render(){return i`
|
|
13488
13657
|
<div class="xy-pad-area"
|
|
13489
13658
|
tabindex=${this.disabled?-1:0}
|
|
13490
13659
|
@pointerdown=${this._onPointerDown}
|
|
@@ -13496,4 +13665,4 @@ ixfx-form-options[orientation="vertical"] ixfx-form-part > label {
|
|
|
13496
13665
|
<div class="xy-pad-label-x">${this.xLabel}</div>
|
|
13497
13666
|
<div class="xy-pad-label-y">${this.yLabel}</div>
|
|
13498
13667
|
</div>
|
|
13499
|
-
`}};E([d({type:Number})]
|
|
13668
|
+
`}};E([d({type:Number})],Qk.prototype,`xMin`,void 0),E([d({type:Number})],Qk.prototype,`xMax`,void 0),E([d({type:Number})],Qk.prototype,`x`,void 0),E([d({type:Number})],Qk.prototype,`yMin`,void 0),E([d({type:Number})],Qk.prototype,`yMax`,void 0),E([d({type:Number})],Qk.prototype,`y`,void 0),E([d({type:String})],Qk.prototype,`xScale`,void 0),E([d({type:String})],Qk.prototype,`yScale`,void 0),E([d({type:Number,attribute:`x-snap-step`})],Qk.prototype,`xSnapStep`,void 0),E([d({type:Number,attribute:`y-snap-step`})],Qk.prototype,`ySnapStep`,void 0),E([d({type:Number,attribute:`step-x`})],Qk.prototype,`stepX`,void 0),E([d({type:Number,attribute:`step-y`})],Qk.prototype,`stepY`,void 0),E([d({type:String})],Qk.prototype,`xLabel`,void 0),E([d({type:String})],Qk.prototype,`yLabel`,void 0),E([d({type:Boolean,reflect:!0,attribute:`show-crosshairs`})],Qk.prototype,`showCrosshairs`,void 0),E([d({type:Boolean,reflect:!0,attribute:`show-grid`})],Qk.prototype,`showGrid`,void 0),E([d({type:Boolean,reflect:!0,attribute:`hide-cursor`})],Qk.prototype,`hideCursor`,void 0),E([d({type:Boolean,reflect:!0})],Qk.prototype,`disabled`,void 0),E([d({type:Number})],Qk.prototype,`stops`,void 0),E([d({type:Number,attribute:`stops-x`})],Qk.prototype,`stopsX`,void 0),E([d({type:Number,attribute:`stops-y`})],Qk.prototype,`stopsY`,void 0),Qk=E([T(`ixfx-xy-pad`)],Qk);function $k(){console.log(`Init`)}export{ke as AcTextElement,Kt as AcTokenElement,$t as BottomDrawerElement,ln as ButtonElement,lr as Checkbox,xr as CheckedSelect,z as ColourPicker,mg as ColourPickerPopup,Ig as CrumbNavigationElement,Lg as CrumbPathController,zg as CrumbPathElement,XS as DEFAULT_SIBLING_SPACING,je as DataController,Bg as DataDisplayComponent,B as DataGridElement,h_ as DataTableElement,V as DetailListElement,ky as DockHostElement,Ey as DockPanelElement,dn as EMPTY_GROUP_LABEL,Uy as EditableLabel,Jy as EditableNumber,G as FlatListElement,hb as FormElement,ob as FormGroupElement,cb as FormOptionsElement,ub as FormPartElement,db as FormRowElement,K as GridListElement,Pb as GroupedItemListerElement,J as HyperbolicTreeListElement,tn as ICON_CARET_RIGHT,nn as ICON_CHECK,en as ICON_CHEVRON_DOWN,rn as ICON_CLOSE,XC as IcicleTreeListElement,Ot as IncrSearchMillerController,Ot as IncrSearchTreeController,Kx as IxfxHexEditorElement,Te as IxfxIconElement,Q as IxfxTimelineElement,At as KeyedElementIndex,Hn as LIST_ITEM_MOTION_MS,It as LIST_SEARCH_COMMAND_IDS,O as LIST_SEARCH_MODES,mw as LabelledRadialInput,ug as LabelledRangeInput,Tw as LabelledSliderInput,Ew as LedElement,Vn as ListDragSelectController,S_ as ListGroupHeaderElement,$n as ListNativeDragController,Bt as ListSearchController,tr as ListSelectionController,l_ as Menu,Dw as MillerBaseElement,Aw as MillerListElement,jw as MillerTreeController,Vw as MulticolListElement,Pg as NarrowedTextElement,aT as NotificationManager,Hw as NotificationPillElement,d_ as PanTextElement,Mb as PanelElement,uT as PanelGroupElement,EE as PlotDataSeries,X as PlotHistogram,qE as PlotMultiAxis,iD as PlotSingleAxis,aD as PlotXyAxis,hD as PolarPad,pw as RadialInputElement,un as RadioGroup,CD as RangeElement,vD as RangeInput,SD as RangeMultiElement,wD as RatingElement,LD as SUNBURST_PATH_SEPARATOR,TD as SelectHorizElement,OD as ShapefillValueElement,ww as SliderInputElement,ND as SlidingNumberElement,FD as SnackbarElement,ID as SnapContainer,cr as SplitButton,uy as SplitLayoutElement,ly as SplitPanelElement,Z as SunburstTreeListElement,kO as SwipeElement,jO as TabController,by as TabListElement,Ty as TabListItemElement,AO as TabPanelElement,MO as TabPanelsElement,NO as TextShimmerElement,oe as TickledController,PO as TimelineController,ok as TimelineTrackTabElement,Xt as TitlebarElement,Pk as ToolbarElement,kk as ToolbarGroupElement,jE as TooltipElement,Fk as TransitoryLabelElement,q as TreeBaseElement,Ik as TreeController,jg as TreeDataModel,Yb as TreeDropController,nr as TreeKeyboardNavController,hx as TreeListElement,$ as TreemapListElement,Gk as TwoSplitLayoutElement,W as VerticalListElement,Qk as XyPad,gv as addPanelToStack,Yn as animateListItemIn,Qn as animateListItemOut,TE as applyAgeModification,ne as applyHighlights,gS as applyIsometry,ty as applySnapshot,wg as applyTreeDrop,tk as attachTimelineInteractions,Zt as bottomDrawerCommandId,ie as buildHighlightTargets,Wv as buildModel,wn as captionForEntry,sS as clampToDisk,re as clearHighlights,pv as collectContainerNames,hg as collectDataResult,uv as collectPanelIds,mv as collectStackPaths,_S as composeIsometry,QS as computeCanonicalPositions,wE as computeColour,rC as computeHyperbolicLayout,YC as computeIcicleLayout,Ev as computeLeafGeoms,YD as computeSunburstLayout,Wk as computeTreemapLayout,wt as createAcCompletionProvider,kt as createDataListSearchAdapter,zn as createDefaultListDragPreview,Ft as createElementIncrSearch,Mt as createElementListSearchAdapter,tv as createEmptyLayout,ev as createEmptyStack,Ct as createFuzzySearch,Et as createIncrSearch,Jw as createPillRenderer,rv as createSplit,nv as createStack,gx as createTreeListAdapter,Ut as createTreeListSearchAdapter,qD as createValueResolver,_x as createVerticalListAdapter,SS as decomposeViewIsometry,fn as defaultGroupLabel,RD as defaultSunburstValueAccessor,Zv as distribute,Tg as dropTargetFor,dS as euclideanRadiusForHyperbolicDistance,Sv as extractStack,Iv as findEmptiedStacks,US as findHyperbolicIdOf,WS as findHyperbolicKeyPath,GS as findHyperbolicNode,KS as findHyperbolicPath,HS as findHyperbolicPathById,qC as findIcicleNode,JC as findIciclePath,U as findNode,oy as findPanelNode,sv as findParentOf,cv as findStackOf,dv as findStackPathByName,GD as findSunburstId,WD as findSunburstNodeById,Rk as findTreemapNode,zk as findTreemapPath,mS as geodesicInterpolate,wS as geodesicPath,CS as geodesicSegment,Q_ as getActiveDragPanelId,ye as getIcon,be as getIconEntry,Ce as getIconFont,Ov as getLeafNeighbours,xe as hasIcon,BS as hyperbolicBranchId,RS as hyperbolicChildIds,fS as hyperbolicDistanceForEuclideanRadius,zS as hyperbolicIdDepth,tC as hyperbolicRelativeFrame,ge as iconBus,hS as identityIsometry,$k as init,yv as insertBeside,vS as invertIsometry,Z_ as isDragging,VS as isHyperbolicDescendantId,er as isMultiMode,$_ as isSplit,H as isStack,VD as isSunburstAncestorId,D as keyForElement,Wn as listItemFadeKeyframes,Vt as listSearchStyles,uS as mobiusAdd,lS as mobiusFromOrigin,cS as mobiusToOrigin,Jk as monitorIndeterminate,jv as moveLeafNodeToEdge,Av as moveLeafStep,oS as norm,Xv as normalise,KC as normaliseValue,iv as normalize,sT as panelGapIndex,xE as parseColourScaleAttr,Pv as parseLayout,hn as partitionByGroup,pS as poincareDistance,q_ as pointerOverAnyHost,Un as prefersReducedMotion,ay as preserveRestoreWeights,Cg as pruneDraggedDescendants,bE as readBaseColour,ve as registerFontIcon,_e as registerIcon,Rt as registerListSearchCommands,_v as removePanelFromStack,qO as resolveCssVars,IO as resolveGrid,mn as resolveGroupKey,Tv as resolveLeafPath,Qv as resolveTracks,bS as rotationIsometry,Mv as serializeLayout,vv as setActive,Se as setIconFont,iy as setPanelRestoreWeight,Fv as snapshotNonEmptyStacks,Zn as startListItemOutAnimation,zD as sunburstChildId,JD as sunburstHasChildren,HD as sunburstIdToPath,UD as sunburstParentId,BD as sunburstPathToId,we as svgToDataUri,kv as swapLeaves,C as tickledItemStyles,se as tickledStyles,ak as timelineStyles,pn as toGroupKey,$v as toSnapshot,gn as toggleInSet,jk as toolbarGapIndex,yS as translationFromOrigin,xS as viewIsometry,sy as walk,bv as wrapRoot};
|