@yongdall/theme 0.1.0

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/index.mjs ADDED
@@ -0,0 +1,749 @@
1
+ import{Menu as e,Page as t,PageSider as n,User as r,configuration as i,createComputed as a,createIcon as o,createShowField as s,createState as c,effect as l,filterPermission as u,loadMenu as d,neverAbortedSignal as f,root as p,runPattern as m,toFileLink as h,userMenus as g,waitAbortSignal as _,watch as v,webRoot as y}from"@yongdall/web";const b=`YongDallTheme`,x=`${b}-activity`,S=document.createElement(`div`);S.classList.add(x);const ee=new Map;let C;function w(e){document.title=[e?e.title:``,i.title||`拥道YongDall`].filter(Boolean).join(` | `)}w();var te=e=>{let t=document.createElement(`div`);t.classList.add(`${x}-page`);let n=t.appendChild(document.createElement(`a`));n.classList.add(`${x}-title`),n.href=e.href,n.innerText=e.title;let r=t.appendChild(document.createElement(`button`));r.type=`button`,r.classList.add(`${x}-close`),r.addEventListener(`click`,()=>{e.destroy()});let i={button:t,link:n,next:C};C&&(C.last=i),C=i,ee.set(e,i),S.insertBefore(t,S.firstChild),l(()=>{e.current&&w(e)},e.signal),l(()=>{i.link.innerText=e.title},e.signal),l(()=>{i.link.href=e.href},e.signal),l(()=>{e.current?i.button.classList.add(`${x}-current`):i.button.classList.remove(`${x}-current`)},e.signal),l(()=>{e.loading?i.button.classList.add(`${x}-loading`):i.button.classList.remove(`${x}-loading`)},e.signal),l(()=>{e.unsaved?i.button.classList.add(`${x}-unsaved`):i.button.classList.remove(`${x}-unsaved`)},e.signal),_(e.signal).then(()=>{let{last:e,next:t}=i;e&&(e.next=t),t&&(t.last=e),C===i&&(C=t),i.button.remove()})},T=class{#e;#t;#n;#r;#i=[];#a=document.createElement(`table`);#o=this.#a.appendChild(document.createElement(`thead`));#s=this.#o.appendChild(document.createElement(`tr`));#c=this.#a.appendChild(document.createElement(`tbody`));get root(){return this.#a}get createUrl(){return this.#e}set createUrl(e){let t=typeof e==`function`?e:null;this.#e!==t&&(this.#e=t,this.#l())}constructor(e,t){let n=Object.entries(t.fields).filter(([,{type:e}])=>e&&typeof e!=`object`),r=Object.entries(t.fields).filter(([,e])=>e.primary).map(([e])=>e);this.#n=t.labelPattern||``,this.#e=typeof e==`function`?e:null,this.#t=n,this.#r=r;let i=this.#s;i.innerHTML=``,i.appendChild(document.createElement(`th`)).appendChild(document.createTextNode(`#`));for(let[e,t]of n)i.appendChild(document.createElement(`th`)).appendChild(document.createTextNode(t.label||e))}#l(){let e=this.#c;e.innerHTML=``;let t=this.#r,n=this.#n,r=this.#t,i=this.#e;for(let a of this.#i){let o=e.appendChild(document.createElement(`tr`)),c=o.appendChild(document.createElement(`td`)),l=m(n,a)||t.map(e=>a[e]).join(`$`);if(i){let e=c.appendChild(document.createElement(`a`));e.href=i(t.map(e=>a[e]).join(`$`)),e.appendChild(document.createTextNode(l))}else c.appendChild(document.createTextNode(l));for(let[e,t]of r){let n=o.appendChild(document.createElement(`td`)),r=s(e,t,{inline:!0},a);n.appendChild(r.root)}}}setData(e){this.#i=e,this.#l()}destroy(){}},E=class extends HTMLElement{static formAssociated=!0;#e=document.createElement(`div`);#t=this.attachInternals();constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`:host {
2
+ display: inline-block;
3
+ color: #000;
4
+ margin: auto;
5
+ position: relative;
6
+ border-radius: 100%;
7
+ border: 1px solid;
8
+ width: 1em;
9
+ height: 1em;
10
+ }
11
+ :host([hidden]) {
12
+ display: none;
13
+ }
14
+ div {
15
+ height: 1px;
16
+ width: 50%;
17
+ position: absolute;
18
+ background: currentColor;
19
+ margin: auto 0 auto auto;
20
+ top: 0;
21
+ left: 0;
22
+ right: 0;
23
+ bottom: 0;
24
+ pointer-events: none;
25
+ transform-origin: left;
26
+ }
27
+ `,e.appendChild(this.#e);let t=e=>{if(!(e.buttons&1))return;let{left:t,width:n,top:r,height:i}=this.getBoundingClientRect(),a=e.clientX-t-n/2,o=e.clientY-r-i/2,s=Math.atan2(o,a)/Math.PI*180;this.value=Math.round(s),this.dispatchEvent(new InputEvent(`input`)),this.dispatchEvent(new InputEvent(`change`))};this.addEventListener(`pointerdown`,t),this.addEventListener(`pointermove`,t),this.value=this.getAttribute(`value`)}#n=0;get value(){return this.#n}set value(e){let t=parseInt(String(e));Number.isFinite(t)&&(this.#n=t,this.#e.style.transform=`rotate(${t}deg)`,this.#t.setFormValue(String(t)))}connectedCallback(){this.getAttribute(`tabindex`)===null&&this.setAttribute(`tabindex`,`0`)}};try{customElements.define(`nl-angle`,E)}catch{}var ne=class extends HTMLElement{static observedAttributes=[`separator`];#e=document.createElement(`style`);#t(e){if(e===null){this.#e.textContent=``;return}let t=`::slotted(*)::after {content: ${JSON.stringify(e)}; }`;this.#e.textContent=t}constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`::slotted(*)::after {content: var(--nl-breadcrumb-separator, ' / ');}`,e.appendChild(this.#e),e.appendChild(document.createElement(`style`)).textContent=`::slotted(:last-child)::after {content: none}`,e.appendChild(document.createElement(`slot`))}get separator(){return this.getAttribute(`separator`)}set separator(e){e==null?this.removeAttribute(`separator`):this.setAttribute(`separator`,e)}connectedCallback(){this.#t(this.separator)}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`separator`:this.#t(n);break}}};try{customElements.define(`nl-breadcrumb`,ne)}catch{}var re=class extends HTMLElement{static observedAttributes=[`label`,`explain`];get label(){return this.getAttribute(`label`)||``}set label(e){e?this.setAttribute(`label`,e):this.removeAttribute(`label`)}get explain(){return this.getAttribute(`explain`)||``}set explain(e){e?this.setAttribute(`explain`,e):this.removeAttribute(`explain`)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=document.createElement(`div`);#t=document.createElement(`div`);constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
28
+ [hidden]{
29
+ display: none!important;
30
+ }
31
+ :host {
32
+ position: relative;
33
+ border-block: 1px solid currentColor;
34
+ display: flex;
35
+ align-items: center;
36
+ line-height: 1.4;
37
+ overflow: hidden;
38
+ padding: 8px;
39
+ min-block-size: 32px;
40
+ font-size: 14px;
41
+ text-decoration: none;
42
+ }
43
+
44
+ .icon {
45
+ display: block;
46
+ margin-inline-end: 5px;
47
+ }
48
+
49
+ .body {
50
+ flex: 1;
51
+ }
52
+
53
+ .label {
54
+ line-height: 24px;
55
+ font-size: 14px;
56
+ }
57
+ :host([bold]) .label {
58
+ font-weight: bold;
59
+ }
60
+ .explain {
61
+ color: var(--nl-cell-explain-color, currentColor);
62
+ }
63
+ .explain:empty {
64
+ display: none;
65
+ }
66
+ .extra {
67
+ display: block;
68
+ position: relative;
69
+ text-align: end;
70
+ }
71
+ .link {
72
+ display: none;
73
+ position: relative;
74
+ inline-size: 16px;
75
+ text-align: center;
76
+ }
77
+ .link::before {
78
+ content: '';
79
+ transform: rotate(45deg);
80
+ border: 2px solid transparent;
81
+ pointer-events: none;
82
+ inline-size: 8px;
83
+ block-size: 8px;
84
+ display: inline-block;
85
+ color: var(--nl-cell-link-color, #CCC);
86
+ border-block-start-color: currentColor;
87
+ border-inline-end-color: currentColor;
88
+ }
89
+
90
+ :host([link]) .link {
91
+ display: block;
92
+ }
93
+
94
+ `,e.addEventListener(`click`,e=>{this.disabled&&(e.stopPropagation(),e.preventDefault())});let t=e.appendChild(document.createElement(`slot`));t.name=`icon`,t.className=`icon`,t.hidden=!t.assignedNodes().length,t.addEventListener(`slotchange`,e=>{t.hidden=!t.assignedNodes().length});let n=e.appendChild(document.createElement(`div`));n.className=`body`;let r=n.appendChild(this.#e);r.className=`label`;let i=n.appendChild(this.#t);i.setAttribute(`part`,`explain`),i.className=`explain`;let a=e.appendChild(document.createElement(`slot`));a.name=`extra`,a.className=`extra`,a.hidden=!a.assignedNodes().length,a.addEventListener(`slotchange`,e=>{a.hidden=!a.assignedNodes().length});let o=e.appendChild(document.createElement(`div`));o.className=`link`,o.setAttribute(`part`,`link`)}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`label`:this.#e.innerText=n||``;break;case`explain`:this.#t.innerText=n||``;break}}};try{customElements.define(`nl-cell`,re)}catch{}
95
+ /*!
96
+ * 匿龙组件库 @neeloong/components v0.7.0
97
+ * (c) 2023-2024 猛火Fierflame
98
+ * @license MIT
99
+ */
100
+ const ie=new Set([`vertical-lr`,`vertical-rl`,`sideways-lr`,`sideways-rl`]);function D(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}var ae=class e extends HTMLElement{static observedAttributes=[`accordion`,`disabled`,`open`,`menu`,`animation`,`label`];get nonTrigger(){return this.getAttribute(`non-trigger`)!==null}set nonTrigger(e){D(this,`non-trigger`,e)}get startTrigger(){return this.getAttribute(`start-trigger`)!==null}set startTrigger(e){D(this,`start-trigger`,e)}get accordion(){return this.getAttribute(`accordion`)!==null}set accordion(e){D(this,`accordion`,e)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){D(this,`disabled`,e)}get open(){return this.getAttribute(`open`)!==null}set open(e){D(this,`open`,e)}get animation(){return this.getAttribute(`animation`)!==null}set animation(e){D(this,`animation`,e)}get menu(){return this.getAttribute(`menu`)!==null}set menu(e){D(this,`menu`,e)}get label(){return this.getAttribute(`label`)||``}set label(e){e?this.setAttribute(`label`,e):this.removeAttribute(`label`)}#e=(()=>{let e=this.attachShadow({mode:`closed`});return e.appendChild(document.createElement(`style`)).textContent=`
101
+ :host {
102
+ display: block;
103
+ border: 1px solid #666;
104
+ writing-mode: inherit;
105
+ }
106
+ :host[hidden] {
107
+ display: none;
108
+ }
109
+ header {
110
+ display: flex;
111
+ border-block-end: inherit;
112
+ cursor: pointer;
113
+ }
114
+ .label {
115
+ flex: 1;
116
+ display: flex;
117
+ }
118
+ .trigger {
119
+ width: .35em;
120
+ height: .35em;
121
+ border: .15em solid currentcolor;
122
+ border-block-start: none;
123
+ border-inline-start: none;
124
+ margin-inline: .3em .5em;
125
+ margin-block: auto;
126
+ transform: rotate(-45deg);
127
+ }
128
+ section {
129
+ overflow: hidden;
130
+ }
131
+ main {
132
+ padding: 8px;
133
+ }
134
+
135
+ :host(:not([open])) section {
136
+ block-size: 0!important;
137
+ }
138
+ :host(:not([open])) header {
139
+ margin-block-end: -1px;
140
+ }
141
+
142
+ :host([open]) .trigger {
143
+ transform: rotate(45deg);
144
+ }
145
+
146
+
147
+ :host([menu]) {
148
+ border: none;
149
+ }
150
+ :host([menu]) main {
151
+ padding: 0!important;
152
+ }
153
+ :host([menu]) header {
154
+ margin-block-end: 0;
155
+ }
156
+ :host([animation]) section {
157
+ transition: block-size .3s;
158
+ }
159
+ :host([animation]) .trigger {
160
+ transition: transform .3s;
161
+ }
162
+ :host([non-trigger]) .trigger-slot {
163
+ display: none;
164
+ }
165
+
166
+ :host([start-trigger]) header {
167
+ flex-direction: row-reverse;
168
+ }
169
+ `,e})();#t=(()=>{let e=document.createElement(`header`);e.setAttribute(`part`,`header`),this.#e.appendChild(e),e.tabIndex=0;let t=t=>{this.disabled||this.#e.activeElement===e&&this.dispatchEvent(new Event(`beforechange`,{cancelable:!0}))&&(this.open=!this.open,this.dispatchEvent(new Event(`change`)))};return e.addEventListener(`click`,t),e.addEventListener(`keydown`,e=>{(e.code===`Enter`||e.code===`Space`)&&t()}),e})();#n=(()=>{let e=document.createElement(`slot`);return this.#t.appendChild(e),e.className=`label`,e.name=`label`,e})();#r=(()=>{let e=document.createElement(`slot`);return this.#t.appendChild(e),e.name=`trigger`,e.className=`trigger-slot`,e.appendChild(document.createElement(`span`)).className=`trigger`,e})();#i=(()=>{let e=document.createElement(`section`);return e.setAttribute(`part`,`main`),this.#e.appendChild(e),e})();#a=(()=>{let e=document.createElement(`main`);return this.#i.appendChild(e),e.appendChild(document.createElement(`slot`)),e})();#o(){let e=ie.has(getComputedStyle(this).writingMode?.toLowerCase());this.#i.style.blockSize=`${e?this.#a.clientWidth:this.#a.clientHeight}px`}updateSize(){this.#o()}#s=new ResizeObserver(()=>this.#o());connectedCallback(){this.#s.observe(this.#a)}disconnectedCallback(){this.#s.unobserve(this.#a)}adoptedCallback(){}#c(){let t=this.parentElement;if(!t)return;let n=getComputedStyle(t).whiteSpace?.toLowerCase()||``,r=n.startsWith(`pre`)||n===`break-spaces`,i=this;for(;i=i.previousSibling;)if(!(i instanceof Comment)){if(i instanceof Text){let e=i.textContent||``;if(r?e.includes(`
170
+ `):e.replace(/[\s\n ]/g,``))break;continue}if(!(i instanceof e)||!i.accordion)break;i.open=!1}for(i=this;i=i.nextSibling;)if(!(i instanceof Comment)){if(i instanceof Text){let e=i.textContent||``;if(r?e.includes(`
171
+ `):e.replace(/[\s\n ]/g,``))break;continue}if(!(i instanceof e)||!i.accordion)break;i.open=!1}}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`accordion`:if(n===null||!this.open)break;this.#c();break;case`disabled`:n===null?this.#t.tabIndex=0:this.#t.removeAttribute(`tabindex`);break;case`open`:if(!this.accordion||!this.open)break;this.#c();break;case`label`:this.#n.innerText=n||``;break}}};try{customElements.define(`nl-collapse`,ae)}catch{}
172
+ /*!
173
+ * 匿龙组件库 @neeloong/components v0.7.0
174
+ * (c) 2023-2024 猛火Fierflame
175
+ * @license MIT
176
+ */
177
+ const oe=typeof HTMLElement.prototype.showPopover==`function`;let se=0;function ce(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`),n=document.createElementNS(`http://www.w3.org/2000/svg`,`defs`),r=document.createElementNS(`http://www.w3.org/2000/svg`,`mask`),i=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),a=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),o=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),s=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),c=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),l=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),u=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),d=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),f=`nl-focus-mask:${se++}`;return t.appendChild(n),n.appendChild(r),r.setAttribute(`id`,f),r.appendChild(i),i.setAttribute(`x`,`0`),i.setAttribute(`y`,`0`),i.setAttribute(`width`,`100vw`),i.setAttribute(`height`,`100vh`),i.setAttribute(`fill`,`white`),r.appendChild(a),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`width`,`100vw`),a.setAttribute(`height`,`100vh`),a.setAttribute(`fill`,`black`),t.appendChild(o),o.setAttribute(`x`,`0`),o.setAttribute(`y`,`0`),o.setAttribute(`width`,`100%`),o.setAttribute(`height`,`100%`),o.setAttribute(`fill`,`currentcolor`),o.setAttribute(`mask`,`url(#${f})`),t.appendChild(s),s.setAttribute(`pointer-events`,`auto`),s.setAttribute(`fill`,`transparent`),s.appendChild(c),c.setAttribute(`x`,`0`),c.setAttribute(`y`,`0`),c.setAttribute(`width`,`100%`),c.setAttribute(`height`,`100%`),s.appendChild(l),l.setAttribute(`x`,`0`),l.setAttribute(`y`,`0`),l.setAttribute(`width`,`100%`),l.setAttribute(`height`,`100%`),s.appendChild(u),u.setAttribute(`x`,`0`),u.setAttribute(`y`,`0`),u.setAttribute(`width`,`100%`),u.setAttribute(`height`,`100%`),s.appendChild(d),d.setAttribute(`x`,`0`),d.setAttribute(`y`,`0`),d.setAttribute(`width`,`100%`),d.setAttribute(`height`,`100%`),e.appendChild(t),{setRect(e,t,n,r){a.setAttribute(`x`,`${e}`),a.setAttribute(`y`,`${t}`),a.setAttribute(`width`,`${n}`),a.setAttribute(`height`,`${r}`),c.setAttribute(`width`,`${e}`),l.setAttribute(`height`,`${t}`),u.setAttribute(`x`,`${e+n}`),d.setAttribute(`y`,`${t+r}`)}}}var le=class extends HTMLElement{static observedAttributes=[`hidden`,`target`,`x`,`y`,`width`,`height`];get x(){return parseFloat(this.getAttribute(`x`)||``)||0}set x(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`x`,String(e)):this.removeAttribute(`x`)}get y(){return parseFloat(this.getAttribute(`y`)||``)||0}set y(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`y`,String(e)):this.removeAttribute(`y`)}get width(){return parseFloat(this.getAttribute(`width`)||``)||0}set width(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`width`,String(e)):this.removeAttribute(`width`)}get height(){return parseFloat(this.getAttribute(`height`)||``)||0}set height(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`height`,String(e)):this.removeAttribute(`height`)}get target(){return this.getAttribute(`target`)}set target(e){typeof e==`string`?this.setAttribute(`target`,e):this.removeAttribute(`target`)}#e=(()=>{let e=this.attachShadow({mode:`closed`});return e.appendChild(document.createElement(`style`)).textContent=`
178
+ :host {
179
+ display: contents;
180
+ color: inherit;
181
+ }
182
+ div {
183
+ color: inherit;
184
+ width: 100%;
185
+ height: 100%;
186
+ position: fixed;
187
+ inset: 0;
188
+ pointer-events: none;
189
+ background: none;
190
+ border: none;
191
+ margin: 0;
192
+ padding: 0;
193
+ overflow: hidden;
194
+ }
195
+ svg {
196
+ color: inherit;
197
+ width: 100%;
198
+ height: 100%;
199
+ position: fixed;
200
+ inset: 0;
201
+ pointer-events: none;
202
+ }
203
+ `,e})();#t=this.#e.appendChild(document.createElement(`div`));#n=ce(this.#t);#r=this.attachInternals();#i=null;get targetElement(){return this.#i}set targetElement(e){this.#i=e instanceof Element?e:null}#a=!1;#o=!1;#s(){this.#a&&=(this.#t.removeAttribute(`popover`),!1)}#c(){if(!(this.#a||!this.#o)){if(oe){let e=this.#t;e.popover=`manual`,e.showPopover()}this.update(),this.#a=!0}}#l(){let e=this.#i;if(e)return e;let{target:t}=this;if(t===``)return this.parentElement;if(!t)return null;try{return document.querySelector(t)}catch{}return null}update(){if(!this.#o)return;let{left:e,top:t,width:n,height:r}=this.#l()?.getBoundingClientRect()||{top:this.y,left:this.x,width:this.width,height:this.height};this.#n.setRect(e,t,n,r)}connectedCallback(){this.#o=!0,!this.hidden&&this.#c()}disconnectedCallback(){this.#o=!1}attributeChangedCallback(e,t,n){if(this.#o&&t!==n)switch(e){case`hidden`:n===null?this.#c():this.#s();break;case`target`:case`x`:case`y`:case`width`:case`height`:this.update();break}}};try{customElements.define(`nl-focus`,le)}catch{}var ue=class extends HTMLElement{static observedAttributes=[`radius`,`unit`];get radius(){let e=parseFloat(this.getAttribute(`radius`)||``);return Number.isNaN(e)||!Number.isFinite(e)?0:e<0?-1:e}set radius(e){typeof e!=`number`||!Number.isFinite(e)?this.removeAttribute(`radius`):this.setAttribute(`radius`,e<0?`-1`:String(e))}get unit(){return this.getAttribute(`unit`)||`px`}set unit(e){e?this.setAttribute(`unit`,e):this.removeAttribute(`unit`)}get long(){return this.hasAttribute(`nl-long`)}set long(e){e?this.setAttribute(`nl-long`,``):this.removeAttribute(`nl-long`)}get column(){return this.hasAttribute(`column`)}set column(e){e?this.setAttribute(`column`,``):this.removeAttribute(`column`)}#e=document.createElement(`style`);constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
204
+ :host {
205
+ display: inline-flex;
206
+ flex-direction: row;
207
+ }
208
+
209
+ :host([column]) {
210
+ flex-direction: column;
211
+ }
212
+ slot {
213
+ border-radius: inherit;
214
+ }
215
+ ::slotted(*) {
216
+ border-radius: 0;
217
+ flex: 1;
218
+ }
219
+ ::slotted(:first-child) {
220
+ border-start-start-radius: inherit;
221
+ border-end-start-radius: inherit;
222
+ }
223
+
224
+ ::slotted(:last-child) {
225
+ border-start-end-radius: inherit;
226
+ border-end-end-radius: inherit;
227
+ }
228
+
229
+ :host([column]) ::slotted(:first-child) {
230
+ border-end-start-radius: 0;
231
+ border-start-end-radius: inherit;
232
+ }
233
+
234
+ :host([column]) ::slotted(:last-child) {
235
+ border-start-end-radius: 0;
236
+ border-end-start-radius: inherit;
237
+ }
238
+
239
+ :host([nl-long]) {
240
+ display: flex;
241
+ inline-size: 100%;
242
+ }
243
+ ::slotted([nl-long]) {
244
+ flex: 100000;
245
+ }
246
+ `,e.appendChild(this.#e),e.appendChild(document.createElement(`slot`)),this.#t()}#t(){let{radius:e}=this,t=e>=0?`${e}${this.unit}`:`50%`;this.#e.textContent=`:host {border-radius: var(--nl-group-radius, ${t})}`}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`radius`:case`unit`:this.#t();break}}};try{customElements.define(`nl-group`,ue)}catch{}
247
+ /*!
248
+ * 匿龙组件库 @neeloong/components v0.7.0
249
+ * (c) 2023-2024 猛火Fierflame
250
+ * @license MIT
251
+ */
252
+ const de=new Set;document.addEventListener(`pointerdown`,e=>{if(!e.isPrimary)return;let t=new Set(e.composedPath());for(let e of[...de])t.has(e)||e.close()});const fe=new Set([`vertical-lr`,`vertical-rl`,`sideways-lr`,`sideways-rl`]),pe=typeof HTMLElement.prototype.showPopover==`function`;function me({left:e,top:t,width:n,height:r},i,a,o){let s=window.innerWidth-e-n,c=window.innerHeight-t-r,l=[[e,n,s],[t,r,c]];return i&&l.reverse(),a&&l[1].reverse(),o&&l[0].reverse(),l}const he=[`blockEnd`,`blockStart`,`inlineEnd`,`inlineStart`],ge=[`start`,`end`,`center`],_e=[`inlineEnd`,`inlineStart`],ve=[`start`,`end`];function ye(e){let t=[];function n(e){t.includes(e)||t.push(e)}for(let t of(e||``).replace(/\n|\s|-/g,``).toLowerCase().split(/,/))(t===`inlineend`||t===`inline`)&&n(`inlineEnd`),(t===`inlinestart`||t===`inline`)&&n(`inlineStart`),(t===`blockend`||t===`block`)&&n(`blockEnd`),(t===`blockstart`||t===`block`)&&n(`blockStart`);return t.length?t:he}function be(e){let t=[];for(let n of(e||``).replace(/\n|\s|-/g,``).toLowerCase().split(/,/))[`start`,`end`,`center`].includes(n)&&(t.includes(n)||t.push(n));return t.length?t:ge}function xe(e){let t=getComputedStyle(e),n=t.writingMode?.toLowerCase();return[fe.has(n),[`vertical-rl`,`sideways-rl`].includes(n),t.direction.toLowerCase()===`rtl`!=(n===`sideways-lr`)]}var Se=class e extends HTMLElement{static observedAttributes=[`open`,`hidden`,`target`,`x`,`y`,`direction`,`align`,`mask`,`disabled`];close(){this.removeAttribute(`open`)}show(){this.setAttribute(`open`,``)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.show():this.close()}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get mask(){return this.hasAttribute(`mask`)}set mask(e){e?this.setAttribute(`mask`,``):this.removeAttribute(`mask`)}get x(){return parseFloat(this.getAttribute(`x`)||``)||0}set x(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`x`,String(e)):this.removeAttribute(`x`)}get y(){return parseFloat(this.getAttribute(`y`)||``)||0}set y(e){e&&typeof e==`number`&&Number.isFinite(e)?this.setAttribute(`y`,String(e)):this.removeAttribute(`y`)}get target(){return this.getAttribute(`target`)}set target(e){typeof e==`string`?this.setAttribute(`target`,e):this.removeAttribute(`target`)}#e=he;#t=ge;get direction(){return[...this.#e]}set direction(e){let t=Array.isArray(e)?e.filter(Boolean).join(`,`):e;t!==null&&typeof t!=`string`||(t?this.setAttribute(`direction`,t):this.removeAttribute(`direction`))}get align(){return[...this.#t]}set align(e){let t=Array.isArray(e)?e.filter(Boolean).join(`,`):e;t!==null&&typeof t!=`string`||(t?this.setAttribute(`direction`,t):this.removeAttribute(`direction`))}#n=document.createElement(`div`);#r=document.createElement(`dialog`);#i=this.attachInternals();#a=this;constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
253
+ :host {
254
+ display: contents;
255
+ }
256
+ div {
257
+ display: flex;
258
+ flex-wrap: nowrap;
259
+ flex-direction: row;
260
+ align-items: stretch;
261
+ }
262
+ div[hidden] {
263
+ display: none;
264
+ }
265
+ div slot {
266
+ display: inline;
267
+ flex: 1;
268
+ }
269
+ div::after {
270
+ content: '';
271
+ width: 0;
272
+ height: 0;
273
+ box-sizing: content-box;
274
+ border: transparent solid 0.3em;
275
+ border-inline-start-color: currentColor;
276
+ margin: auto;
277
+ margin-inline-start: 0.3em;
278
+ }
279
+ dialog {
280
+ position: fixed;
281
+ margin: 0;
282
+ box-sizing: border-box;
283
+ max-width: calc(100% - 36px);
284
+ max-height: calc(100% - 36px);
285
+ user-select: none;
286
+ padding: .2em;
287
+ border: 1px solid;
288
+ outline: none;
289
+ }
290
+ div, dialog ::slotted(*) {
291
+ color: var(--neeloong-menu-fg, #000);
292
+ background: var(--neeloong-menu-bg, #FFF);
293
+ }
294
+ div.open, div:hover, div:focus, dialog ::slotted(:hover), dialog ::slotted(:focus) {
295
+ color: var(--neeloong-menu-fg-highlight, #000);
296
+ background: var(--neeloong-menu-bg-highlight, #6666);
297
+ }
298
+ :host([disabled]) div, dialog ::slotted([disabled]) {
299
+ color: var(--neeloong-menu-fg-disabled, #AAA);
300
+ background: var(--neeloong-menu-bg-disabled, #FFF);
301
+ }
302
+
303
+ dialog::backdrop {
304
+ background: transparent;
305
+ }
306
+ `;let t=e.appendChild(this.#n);t.appendChild(document.createElement(`slot`)).name=`label`,t.addEventListener(`pointerenter`,e=>{this.#u&&e.isPrimary&&this.#f()}),t.addEventListener(`click`,e=>{e.stopPropagation()});let n=e.appendChild(this.#r);n.setAttribute(`part`,`menu`);let r=n.appendChild(document.createElement(`slot`));n.addEventListener(`click`,e=>{if(this.#u)return;let t=e.composedPath(),r=t.indexOf(n);r>=0&&t.slice(0,r).find(e=>e instanceof Element&&e.getAttribute(`disabled`)!==null||e instanceof HTMLHRElement)||this.close()}),n.addEventListener(`close`,e=>{this.close()}),r.addEventListener(`pointermove`,e=>{if(!e.isPrimary)return;let t=this.#l;t&&(e.composedPath().includes(t)||t.#d())}),n.addEventListener(`scroll`,e=>{if(!this.#c)return;let t=this.#l;t&&t.#_()}),this.addEventListener(`contextmenu`,e=>{e.stopPropagation(),e.preventDefault()},{capture:!0})}#o=null;get targetElement(){return this.#o}set targetElement(e){this.#o=e instanceof Element?e:null}#s=!1;#c=!1;#l=null;#u=null;get parentMenu(){return this.#u}#d(){if(!this.#s)return;let e=this.#l;e&&e.#d();let t=this.#u;t&&t.#l===this?t.#l=null:de.delete(this);let n=this.#r;n.close(),this.#i.states?.delete(`--open`),this.#n.classList.remove(`open`),n.removeAttribute(`popover`),this.#s=!1}#f(){if(this.#s||!this.#c)return;let e=this.#u,t=this.#r;if(e){if(!e.#s||this.disabled)return;let n=e.#l;n&&n.#d(),e.#l=this,pe?(t.popover=`manual`,t.showPopover()):t.show()}else{this.#v();let e=this.#l;e&&e.#d(),pe&&!this.hasAttribute(`mask`)?(t.popover=`manual`,t.showPopover(),de.add(this)):t.showModal()}this.#n.classList.add(`open`),this.#i.states?.add(`--open`),requestAnimationFrame(()=>{this.#c&&this.#_()}),this.#s=!0}#p=!1;#m=!1;#h=!1;#g(){if(this.#u)return this.#n;let e=this.#o;if(e)return e;let{target:t}=this;if(t===``)return this.parentElement;if(!t)return null;try{return document.querySelector(t)}catch{}return null}#_(){if(!this.#c)return;let e=this.#r,t=this.#g(),n=this.#a,r=n.#p,i=me(t?.getBoundingClientRect()||{top:this.y,left:this.x,width:0,height:0},n.#p,n.#m,n.#h),[[a,o,s],[c,l,u]]=i,[d,f]=this.#u?[_e,ve]:[this.#e,this.#t],p=e.getBoundingClientRect(),m=r?p.height:p.width,h=r?p.width:p.height,[g]=d.map(e=>{switch(e){case`blockStart`:return[e,c/h,1];case`blockEnd`:return[e,u/h,1];case`inlineStart`:return[e,1,a/m];default:return[`inlineEnd`,1,s/m]}}).reduce((e,t)=>e[1]<1&&t[1]<1?e[1]>=t[1]?e:t:e[1]>=1&&t[1]<1?e:t[1]>=1&&e[1]<1?t:e[2]>=1||e[2]>=t[2]?e:t),_=g===`blockEnd`||g===`blockStart`;_&&i.reverse();let[[v,y,b],[x,S,ee]]=i,[C,w]=_?[m,h]:[h,m],te=f.find(e=>e===`start`?S+ee>C:e===`end`?S+x>C:!0)||``,T=g===`inlineStart`||g===`blockStart`?v-w:v+y,E=0;switch(te){case`start`:E=x;break;case`end`:E=x+S-C;break;default:E=Math.max(18,Math.min(x+S/2-C/2,x+S+ee-18-C));break}_&&([T,E]=[E,T]),e.style.insetBlockStart=`${E}px`,e.style.insetInlineStart=`${T}px`;let ne=this.#l;ne&&ne.#_()}update(){if(this.#c)return this.#_()}#v(){let[e,t,n]=xe(this);this.#p=e,this.#m=t,this.#h=n}connectedCallback(){this.#c=!0;let t=this.parentNode,n=t instanceof e?t:null;this.#u=n,this.#a=n?n.#a:this,this.#n.hidden=!n,!this.hidden&&n&&n.#s&&this.#f()}disconnectedCallback(){this.close(),this.#a=this,this.#c=!1,this.#u=null}attributeChangedCallback(e,t,n){if(this.#c&&t!==n)switch(e){case`disabled`:this.#c&&this.open&&n!==null&&this.close();break;case`open`:!this.#u&&!this.hidden&&(n===null?this.#d():this.#f());break;case`mask`:if(n!==null){let e=this.#r;e.getAttribute(`popover`)!==null&&(e.removeAttribute(`popover`),this.close())}break;case`hidden`:n===null?this.open&&!this.#u&&this.#f():this.#d();break;case`direction`:this.#e=ye(n),this.#c&&!this.#u&&this.#_();break;case`align`:this.#t=be(n),this.#c&&!this.#u&&this.#_();break;case`target`:case`x`:case`y`:this.#c&&!this.#u&&this.#_();break}}};try{customElements.define(`nl-menu`,Se)}catch{}
307
+ /*!
308
+ * 匿龙组件库 @neeloong/components v0.7.0
309
+ * (c) 2023-2024 猛火Fierflame
310
+ * @license MIT
311
+ */
312
+ const O=[];function Ce(e){let t=getComputedStyle(e).writingMode?.toLowerCase();return[`vertical-lr`,`sideways-lr`].includes(t)?1:[`vertical-rl`,`sideways-rl`].includes(t)?2:0}function we(){let e=[0,0,0,0];for(let{element:t}of O){let n=Ce(t),r=t.classList.contains(`open`);r&&(e[n]+=20),t.style.insetBlockStart=`${e[n]}px`,r&&(e[n]+=n%3?t.clientWidth:t.clientHeight)}}const Te=new ResizeObserver(function(){we()});var Ee=class extends HTMLElement{static observedAttributes=[`open`,`hidden`,`duration`];get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get closable(){return this.hasAttribute(`closable`)}set closable(e){e?this.setAttribute(`closable`,``):this.removeAttribute(`closable`)}get duration(){let e=parseFloat(this.getAttribute(`duration`)||``);return Number.isNaN(e)?1.5:e<=0?1/0:Number.isFinite(e)?e:1.5}set duration(e){typeof e!=`number`||!Number.isFinite(e)?this.removeAttribute(`duration`):e<=0||!Number.isFinite(e)?this.setAttribute(`duration`,`0`):this.setAttribute(`duration`,String(e))}#e=document.createElement(`style`);#t=document.createElement(`section`);#n={element:this.#t};#r=!1;#i=null;#a=this.attachInternals();constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
313
+ :host {
314
+ transition-property: none;
315
+ transition-duration: .5s;
316
+ display: contents;
317
+ inline-size: fit-content;
318
+ block-size: fit-content;
319
+ color: canvastext;
320
+ background-color: canvas;
321
+ border: solid;
322
+ padding: 0.25em;
323
+ writing-mode: inherit;
324
+ }
325
+ section {
326
+ inline-size: inherit;
327
+ block-size: inherit;
328
+ background: inherit;
329
+ border: inherit;
330
+ border-radius: inherit;
331
+ color: inherit;
332
+ padding: inherit;
333
+ position: fixed;
334
+ inset: auto;
335
+ inset-inline: 0;
336
+ margin-block: 0;
337
+ margin-inline: auto;
338
+ overflow: auto;
339
+ transition-property: opacity;
340
+ transition-duration: inherit;
341
+ opacity: 0;
342
+ display: none;
343
+ z-index: 9999999999999999999999;
344
+ }
345
+ section.open {
346
+ opacity: 1;
347
+ }
348
+ .shown {
349
+ display: flex;
350
+ transition-property: opacity, inset-block-start;
351
+ align-items: center;
352
+ flex-wrap: nowrap;
353
+ flex-direction: row;
354
+ }
355
+
356
+ slot {
357
+ display: block;
358
+ flex: 1;
359
+ }
360
+
361
+ .close {
362
+ block-size: 1em;
363
+ inline-size: 1em;
364
+ display: none;
365
+ cursor: pointer;
366
+ transition: color .5s;
367
+ position: relative;
368
+ line-height: 1em;
369
+ border-radius: 100%;
370
+ overflow: hidden;
371
+ }
372
+ :host([closable]) .close {
373
+ display: block;
374
+ }
375
+ .close::before,
376
+ .close::after {
377
+ content: '';
378
+ position: absolute;
379
+ display: inline-block;
380
+ inline-size: 80%;
381
+ block-size: 5%;
382
+ background: currentColor;
383
+ inset: 0;
384
+ margin: auto;
385
+ }
386
+ .close::before {
387
+ transform: rotate(45deg);
388
+ }
389
+ .close::after {
390
+ transform: rotate(-45deg);
391
+ }
392
+
393
+ `,e.appendChild(this.#e);let t=e.appendChild(this.#t);t.popover=`manual`,t.setAttribute(`part`,`message`),t.appendChild(document.createElement(`slot`)).setAttribute(`part`,`slot`);let n=t.appendChild(document.createElement(`div`));n.className=`close`,n.addEventListener(`click`,e=>{this.#o(e)}),n.setAttribute(`part`,`close`),n.tabIndex=0,n.addEventListener(`keydown`,e=>{[`Enter`,`Space`].includes(e.code)&&this.#o(e)}),t.addEventListener(`transitionend`,e=>{e.propertyName===`opacity`&&(t.classList.contains(`open`)||this.#p())})}#o(e){e?.defaultPrevented||this.open&&this.dispatchEvent(new Event(`beforeclose`,{cancelable:!0}))&&(this.open=!1,this.dispatchEvent(new Event(`close`)))}#s=!1;#c(){let e=this.#i;e!==null&&(clearTimeout(e),this.#i=null)}#l(){this.#c();let{duration:e}=this;e!==1/0&&(this.#i=setTimeout(()=>{this.#i=null,this.open=!1},e*1e3))}#u(){if(this.#s)return;this.#s=!0;let e=0,t=Ce(this.#t);for(let{element:n}of O)n.classList.contains(`open`)&&Ce(n)===t&&(e+=(t%3?n.clientWidth:n.clientHeight)+20);let n=this.#t;n.style.insetBlockStart=`${e}px`,n.showPopover?.(),n.classList.add(`shown`),this.#a.states?.add(`--shown`),n.setAttribute(`part`,`message shown`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.#s&&n.classList.contains(`shown`)&&(n.classList.add(`open`),this.#a.states?.add(`--open`),this.#l(),Te.observe(n),O.push(this.#n),we())})})}#d(){let e=O.indexOf(this.#n);e<0||(O.splice(e,1),!(e>=O.length)&&we())}#f(){if(!this.#s)return;this.#s=!1,this.#c();let e=this.#t;e.classList.remove(`open`),this.#a.states?.delete(`--open`),Te.unobserve(e),we()}#p(){this.#d();let e=this.#t;e.hidePopover?.(),this.#a.states?.delete(`--shown`),e.classList.remove(`shown`),e.setAttribute(`part`,`message`)}connectedCallback(){this.#r=!0,!this.hidden&&this.open&&this.#u()}disconnectedCallback(){this.#r=!1,this.#f(),this.#p()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:case`open`:this.#r&&(!this.hidden&&this.open?this.#u():this.#f());break;case`duration`:this.#l();break}}};try{customElements.define(`nl-message`,Ee)}catch{}function k(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}var De=class extends HTMLElement{static observedAttributes=[`hidden`,`open`,`disabled`,`size`,`position`];get open(){return this.hasAttribute(`open`)}set open(e){k(this,`open`,e)}get cancelable(){return this.hasAttribute(`cancelable`)}set cancelable(e){k(this,`cancelable`,e)}get closable(){return this.hasAttribute(`closable`)}set closable(e){k(this,`closable`,e)}get mask(){return this.hasAttribute(`mask`)}set mask(e){k(this,`mask`,e)}get maskClosable(){return this.hasAttribute(`mask-closable`)}set maskClosable(e){k(this,`mask-closable`,e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){k(this,`disabled`,e)}get size(){return this.getAttribute(`size`)||``}set size(e){e?this.setAttribute(`size`,e):this.removeAttribute(`size`)}get position(){let e=this.getAttribute(`position`)||``;return[`block-start`,`block-end`,`inline-start`,`inline-end`].includes(e)?e:`center`}set position(e){e?this.setAttribute(`position`,e):this.removeAttribute(`position`)}cancel(){this.disabled||this.open&&this.dispatchEvent(new Event(`cancel`,{cancelable:!0}))&&(this.open=!1,this.dispatchEvent(new Event(`close`)))}ok(){this.disabled||this.open&&this.dispatchEvent(new Event(`ok`,{cancelable:!0}))&&(this.open=!1,this.dispatchEvent(new Event(`close`)))}#e=document.createElement(`section`);#t=document.createElement(`dialog`);#n=document.createElement(`button`);#r=document.createElement(`button`);constructor(){super();let e=()=>this.cancel(),t=this.attachShadow({mode:`closed`});t.appendChild(document.createElement(`style`)).textContent=`
394
+ :host {
395
+ display: none;
396
+ }
397
+ :host([open]) {
398
+ display: contents;
399
+ }
400
+ :host([open][hidden]) {
401
+ display: none;
402
+ }
403
+ dialog {
404
+ position: fixed;
405
+ max-block-size: 100%;
406
+ max-inline-size: 100%;
407
+ inline-size: 100%;
408
+ border: none;
409
+ background: none;
410
+ outline: none;
411
+ padding: 0;
412
+ }
413
+ dialog::backdrop {
414
+ background: none;
415
+ }
416
+ :host([mask]) dialog::backdrop {
417
+ background: rgba(48,48,48,0.5);
418
+ }
419
+ .ok:after {
420
+ content: '确认';
421
+ }
422
+ .cancel {
423
+ display: none;
424
+ }
425
+ .cancel:after {
426
+ content: '取消';
427
+ }
428
+ :host([cancelable]) .cancel {
429
+ display: inline-block;
430
+ }
431
+ section {
432
+ right: 0;
433
+ left: 0;
434
+ padding: 1em;
435
+ background: #FFF;
436
+ box-sizing: content-box;
437
+ box-shadow: 5px 5px 10px -4px rgba(0,0,0,.12),
438
+ 5px -5px 10px -4px rgba(0,0,0,.12),
439
+ -5px 5px 10px -4px rgba(0,0,0,.12),
440
+ -5px -5px 10px -4px rgba(0,0,0,.12)
441
+ }
442
+ .center {
443
+ padding-block: 6px;
444
+ }
445
+ .inline-start {
446
+ block-size: 100%;
447
+ margin-inline-start: 0;
448
+ }
449
+ .inline-end {
450
+ block-size: 100%;
451
+ margin-inline-end: 0;
452
+ }
453
+ .block-start {
454
+ margin-block-start: 0;
455
+ }
456
+ .block-end {
457
+ margin-block-end: 0;
458
+ }
459
+ .center section, .inline-start section, .inline-end section {
460
+ display: flex;
461
+ flex-direction: column;
462
+ min-block-size: calc(100% - 2em);
463
+ inline-size: var(--nl-modal-size, 640px);
464
+ max-inline-size: calc(100vi - 2em - 16px);
465
+ }
466
+ .block-start section, .block-end section {
467
+ display: flex;
468
+ flex-direction: column;
469
+ block-size: var(--nl-modal-size, 640px);
470
+ max-block-size: calc(100vb - 2em - 16px);
471
+ }
472
+ .center section {
473
+ margin: auto;
474
+ }
475
+ .inline-start section {
476
+ margin-inline-end: auto;
477
+ }
478
+ .inline-end section {
479
+ margin-inline-start: auto;
480
+ }
481
+ .block-start section {
482
+ margin-block-end: auto;
483
+ }
484
+ .block-end section {
485
+ margin-block-start: auto;
486
+ }
487
+ .inline-start section slot.body, .inline-end section slot.body {
488
+ flex: 1;
489
+ display: block;
490
+ }
491
+ .block-start section slot.body, .block-end section slot.body {
492
+ flex: 1;
493
+ display: block;
494
+ overflow: auto;
495
+ }
496
+ :host([round]) .center section {
497
+ border-radius: 1em;
498
+ }
499
+ :host([round]) .inline-start section {
500
+ border-start-end-radius: 1em;
501
+ border-end-end-radius: 1em;
502
+ }
503
+ :host([round]) .inline-end section {
504
+ border-start-start-radius: 1em;
505
+ border-end-start-radius: 1em;
506
+ }
507
+ :host([round]) .block-start section {
508
+ border-end-start-radius: 1em;
509
+ border-end-end-radius: 1em;
510
+ }
511
+ :host([round]) .block-end section {
512
+ border-start-start-radius: 1em;
513
+ border-start-end-radius: 1em;
514
+ }
515
+
516
+
517
+ .close {
518
+ block-size: 40px;
519
+ inline-size: 40px;
520
+ display: none;
521
+ cursor: pointer;
522
+ transition: color .5s;
523
+ position: relative;
524
+ line-height: 40px;
525
+ }
526
+ :host([closable]) .close {
527
+ display: inline-block;
528
+ }
529
+ .close-icon {
530
+ overflow: hidden;
531
+ }
532
+ .close-icon::before,
533
+ .close-icon::after {
534
+ content: '';
535
+ position: absolute;
536
+ display: inline-block;
537
+ inline-size: 60%;
538
+ block-size: 5%;
539
+ background: currentColor;
540
+ inset: 0;
541
+ margin: auto;
542
+ }
543
+ .close-icon::before {
544
+ transform: rotate(45deg);
545
+
546
+ }
547
+ .close-icon::after {
548
+ transform: rotate(-45deg);
549
+
550
+ }
551
+ .close-icon:hover {
552
+ color: #88F;
553
+ }
554
+
555
+ header {
556
+ position: sticky;
557
+ text-align: start;
558
+ inset-block-start: 0;
559
+ background: inherit;
560
+ margin-block-start: -1em;
561
+ margin-inline: -1em;
562
+ padding-inline: 1em;
563
+ padding-block-start: 1em;
564
+ padding-block-end: 1em;
565
+ border-start-start-radius: inherit;
566
+ border-start-end-radius: inherit;
567
+ display: flex;
568
+ }
569
+ .empty {
570
+ padding-block: 0;
571
+ }
572
+ [name=header] {
573
+ display: block;
574
+ flex: 1;
575
+ line-height: 40px;
576
+ }
577
+ footer {
578
+ text-align: end;
579
+ position: sticky;
580
+ inset-block-end: 0;
581
+ background: inherit;
582
+ margin-block-end: -1em;
583
+ margin-inline: -1em;
584
+ padding-inline: 1em;
585
+ padding-block-start: 1em;
586
+ padding-block-end: 1em;
587
+ border-end-start-radius: inherit;
588
+ border-end-end-radius: inherit;
589
+ }
590
+
591
+ `,this.#t.autofocus=!1;let n=t.appendChild(this.#t);n.className=`center`,n.addEventListener(`keydown`,t=>{t.defaultPrevented||t.code===`Escape`&&(t.preventDefault(),e())}),n.addEventListener(`click`,t=>{t.target===t.currentTarget&&this.maskClosable&&e()});let r=n.appendChild(this.#e);r.style.inlineSize=this.getAttribute(`size`)||``;let i=r.appendChild(document.createElement(`header`)),a=i.appendChild(document.createElement(`slot`));a.name=`header`,a.addEventListener(`slotchange`,e=>{a.assignedNodes().length?i.classList.remove(`empty`):i.classList.add(`empty`)}),a.assignedNodes().length?i.classList.remove(`empty`):i.classList.add(`empty`);let o=i.appendChild(document.createElement(`slot`));o.className=`close`,o.name=`close`,o.addEventListener(`click`,e),o.addEventListener(`slotchange`,e=>{o.assignedNodes().length?o.classList.remove(`close-icon`):o.classList.add(`close-icon`)}),o.assignedNodes().length?o.classList.remove(`close-icon`):o.classList.add(`close-icon`),r.appendChild(document.createElement(`slot`)).className=`body`;let s=r.appendChild(document.createElement(`footer`)).appendChild(document.createElement(`slot`));s.name=`footer`;let{disabled:c}=this,l=s.appendChild(this.#n);l.addEventListener(`click`,()=>this.ok()),l.className=`ok`,l.disabled=c;let u=s.appendChild(this.#r);u.addEventListener(`click`,e),u.className=`cancel`,u.disabled=c}#i=!1;connectedCallback(){this.#i=!0,!this.hidden&&this.open&&this.#t.showModal()}disconnectedCallback(){this.#i=!1,this.#t.close()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:case`open`:this.#i&&(!this.hidden&&this.open?this.#t.showModal():this.#t.close());break;case`disabled`:{let e=n!==null;this.#r.disabled=e,this.#n.disabled=e;break}case`position`:{let{size:e}=this,t=this.#e,r=this.#t;switch(n){case`block-start`:case`block-end`:t.style.inlineSize=``,t.style.blockSize=e,r.className=n;break;case`inline-start`:case`inline-end`:t.style.inlineSize=e,t.style.blockSize=``,r.className=n;break;default:t.style.inlineSize=e,t.style.blockSize=``,r.className=`center`}break}case`size`:this.position.startsWith(`block`)?this.#e.style.blockSize=n||``:this.#e.style.inlineSize=n||``;break}}};try{customElements.define(`nl-modal`,De)}catch{}function Oe(e,t){let n=e.attachShadow({mode:`closed`});n.appendChild(document.createElement(`style`)).textContent=`:host {
592
+ display: block;
593
+ overflow: hidden;
594
+ position: relative;
595
+ }
596
+ :host([hidden]) { display: none; }`,n.appendChild(document.createElement(`slot`));let r=new ResizeObserver(e=>{let n=e.pop();if(!n)return;let{contentRect:{width:r,height:i}}=n;for(let e of t)e.resize(r,i)});function i(n){let r=n.composedPath(),i=r.findIndex(t=>t===e),a=i<0?[]:r.slice(0,i).reverse();for(let e of[...t]){let t=e.match(a);if(t)return e;if(t===null)return null}return null}let a={};function o(t){let n=i(t);if(!n)return;let{pageX:r,pageY:o,pointerId:s}=t,{x:c,y:l}=e.getBoundingClientRect(),u=r-c,d=o-l,f=null;t.pointerType===`mouse`?f=n.mouseBegin(u,d,t.buttons):t.pointerType===`touch`&&(f=n.touchBegin(s,u,d)),typeof f==`boolean`&&(f&&e.setPointerCapture(s),a[s]=n)}function s(t){let{pointerId:n}=t,r=a[n];if(!r)return;let{pageX:i,pageY:o}=t,{x:s,y:c}=e.getBoundingClientRect(),l=i-s,u=o-c;if(t.pointerType===`mouse`){r?.mouseMove(l,u,t.buttons);return}t.pointerType===`touch`&&r.touchMove(n,l,u)}function c(t){let{pointerId:n}=t;e.hasPointerCapture(n)&&e.releasePointerCapture(n);let r=a[n];r&&(t.pointerType===`mouse`&&r.mouseEnd(),t.pointerType===`touch`&&(delete a[n],r.touchEnd(n)))}function l(t){let n=i(t);if(!n)return;let{deltaMode:r,deltaX:a,deltaY:o,pageX:s,pageY:c}=t,{x:l,y:u}=e.getBoundingClientRect(),d=s-l,f=c-u;n.wheel(r,a,o,d,f)}return e.addEventListener(`wheel`,l,!0),e.addEventListener(`pointermove`,s),e.addEventListener(`pointerdown`,o),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,c),e.addEventListener(`lostpointercapture`,c),e.addEventListener(`touchmove`,e=>e.preventDefault()),[()=>{r.observe(e)},()=>{r.unobserve(e)}]}var ke=class extends HTMLElement{#e=new Set;#t;#n;constructor(){super(),[this.#t,this.#n]=Oe(this,this.#e)}register(e){let t=this.#e;t.add(e);let{width:n,height:r}=this.getBoundingClientRect();return e.resize(n,r),()=>{t.delete(e)}}connectedCallback(){this.#t()}disconnectedCallback(){this.#n()}adoptedCallback(){}};function Ae(e,t){let n=e.reduce((e,t)=>e+t)/e.length,r=t.reduce((e,t)=>e+t)/t.length;return e.map((i,a)=>(e[a]-n)*(t[a]-r)).reduce((e,t)=>e+t)/e.map(e=>(e-n)**2).reduce((e,t)=>e+t)}function je(e){let t=performance.now()/1e3;for(let n=0;n<e.length;n++){let[,,r]=e[n];if(t-r>.05){e.length=n;break}t=r}if(e.length<3)return;let n=e.map(e=>e[2]),r=Ae(n,e.map(e=>e[0])),i=Ae(n,e.map(e=>e[1])),a=Math.sign(r),o=Math.sign(i),s=Math.abs(r),c=Math.abs(i),l=(s**2+c**2)**.5,u=s/l,d=c/l,f=1e3,[[p,m,h]]=e;function g(){let e=performance.now()/1e3-h;return l-e*f<=0?[p+a*s*l/f/2,m+o*c*l/f/2,!0]:[p+a*(s+s-f*u*e)*e/2,m+o*(c+c-f*d*e)*e/2,!1]}return g}var Me=class extends HTMLElement{#e;#t;constructor(){super();let e=()=>{};this.#t=()=>{let t=this.parentNode;for(;t&&!(t instanceof Le);)t=t.parentNode;t&&(e=t.register(this))},this.#e=()=>{e()}}connectedCallback(){this.#t()}disconnectedCallback(){this.#e()}};function Ne(e,t,n,r){return((e-t)**2+(n-r)**2)**.5}function Pe(e,t,n){let r=t-n,i=Math.min(r,0),a=Math.max(r,0);return Math.min(Math.max(i,e),a)}function Fe(e,t){let n=e.attachShadow({mode:`closed`});n.appendChild(document.createElement(`style`)).textContent=`
597
+ :host{display: block; position: absolute; transform-origin: 0 0; }
598
+ :host([hidden]) { display: none; }
599
+ `,n.appendChild(document.createElement(`slot`));let r=!1;function i(){r=!0;let[t,n]=o;!t||!n||(r=!1,l=Math.min(t/e.clientWidth,n/e.clientHeight),s=(t-e.clientWidth*l)/2,c=(n-e.clientHeight*l)/2,e.style.transform=`translate(${s}px,${c}px)scale(${l})`)}let a={},o=[0,0],s=0,c=0,l=1;function u(t){let n=e.clientWidth,r=e.clientHeight,[i,a]=o;if(!i||!a)return t;let s=i/n,c=a/r,l=Math.max(s,c,5),u=Math.min(s,c,.5);return Math.max(u,Math.min(t,l))}let d=``,f;function p(e,t,n,r){let i=Ne(e,n,t,r),a=l;if(!i||!a){f=void 0;return}f={x:(s-(e+n)/2)/a,y:(c-(t+r)/2)/a,s:a/i}}function m(e,t,n,r){if(!f)return;let i=Ne(e,n,t,r);if(!i)return;let{s:a,x:o,y:d}=f,p=u(i*a);l=p,s=o*p+(e+n)/2,c=d*p+(t+r)/2,w()}function h(){d=``,f=void 0}let g=``,_,v=0;function y(e,t){cancelAnimationFrame(v),_=void 0,_={x:s,y:c,frame:[[s,c,performance.now()/1e3]],bx:e,by:t}}function b(e,t){if(!_)return;let{x:n,y:r,bx:i,by:a}=_;s=n+e-i,c=r+t-a;let o=[s,c,performance.now()/1e3];_.frame=[o,..._.frame].slice(0,20),w()}function x(){if(!_)return;g=``;let{frame:t}=_;if(_=void 0,!e.inertia)return;let n=je(t);if(!n)return;let r=()=>{let t;[s,c,t]=n(),w(),e.inertia&&(t||(v=requestAnimationFrame(r)))};r()}function S(){cancelAnimationFrame(v),g=``,_=void 0}let ee={resize(t,n){o=[t,n],(e.autoAdaptively||r)&&i()},match(n){if(!n.length)return e.global||!1;if(n[0]!==e)return!1;if(!t.size)return!0;let r=new Set(n);for(let e of t)if(r.has(e))return!0;return null},touchMove(t,n,r){a[t]=[n,r];let i=Object.values(a);if(g===`touch`){if(i.length!==1)return S();let[e]=i;b(e[0],e[1])}if(d!==`touch`)return;if(!e.touchScalable||i.length!==2)return h();let[o,s]=i;m(o[0],o[1],s[0],s[1])},touchBegin(t,n,r){a[t]=[n,r];let i=Object.values(a);if(i.length===1){if(!g&&e.touchMovable)return h(),g=`touch`,y(n,r),e.touchCapture}else if(i.length===2&&!d&&e.touchScalable){S(),d=`touch`;let[t,n]=i;return p(t[0],t[1],n[0],n[1]),e.touchCapture}return null},touchEnd(e){delete a[e],d===`touch`&&h(),g===`touch`&&x()},mouseMove(e,t,n){if(g===`leftMouse`&&!(n&1)||g===`roller`&&!(n&4)){x();return}g&&b(e,t)},mouseBegin(t,n,r){if(g)return null;let i=``,a=null;if(r&1){if(!e.leftMouseMovable)return null;i=`leftMouse`,a=e.leftMouseMovableCapture}else if(r&4){if(!e.rollerMovable)return null;i=`roller`,a=e.rollerMovableCapture}return h(),g=i,y(t,n),a},mouseEnd(){g&&x()},wheel(t,n,r,i,a){if(!e.rollerScalable)return;let o=Math.abs(n)>Math.abs(r)?n:r;if(o===0)return;h();let d=Math.abs(o),f=0;if(o>0)switch(t){case 0:f=1.01;break;case 1:f=1.25;break;case 2:f=1.6;break}else switch(t){case 0:f=1/1.01;break;case 1:f=1/1.25;break;case 2:f=1/1.6;break}let p=l,m=u(f**d*p);l=m,s=(s-i)/p*m+i,c=(c-a)/p*m+a,w()}},C=()=>{};function w(){let[t,n]=o;(!t||!n)&&(e.style.transform=`translate(${s}px,${c}px)scale(${l})`),s=Pe(s,t,e.clientWidth*l),c=Pe(c,n,e.clientHeight*l),e.style.transform=`translate(${s}px,${c}px)scale(${l})`}return[()=>{e.autoAdaptively&&requestAnimationFrame(i);let t=e.parentNode;for(;t&&!(t instanceof ke);)t=t.parentNode;t&&(C=t.register(ee))},()=>{C()},i]}function A(e,t,n){if(!n&&n!==``){e.removeAttribute(t);return}e.setAttribute(t,n===!0?``:n)}var Ie=class extends HTMLElement{static get Area(){return ke}static get Target(){return Me}get inertia(){return this.getAttribute(`inertia`)!==null}set inertia(e){A(this,`inertia`,e)}get touchCapture(){return this.getAttribute(`touch-capture`)!==null}set touchCapture(e){A(this,`touch-capture`,e)}get touchMovable(){return this.getAttribute(`touch-movable`)!==null}set touchMovable(e){A(this,`touch-movable`,e)}get touchScalable(){return this.getAttribute(`touch-scalable`)!==null}set touchScalable(e){A(this,`touch-scalable`,e)}get rollerMovable(){return this.getAttribute(`roller-movable`)!==null}set rollerMovable(e){A(this,`roller-movable`,e)}get rollerMovableCapture(){return this.getAttribute(`roller-movable-capture`)!==null}set rollerMovableCapture(e){A(this,`roller-movable-capture`,e)}get rollerScalable(){return this.getAttribute(`roller-scalable`)!==null}set rollerScalable(e){A(this,`roller-scalable`,e)}get leftMouseMovable(){return this.getAttribute(`left-mouse-movable`)!==null}set leftMouseMovable(e){A(this,`left-mouse-movable`,e)}get leftMouseMovableCapture(){return this.getAttribute(`left-mouse-movable-capture`)!==null}set leftMouseMovableCapture(e){A(this,`left-mouse-movable-capture`,e)}get autoAdaptively(){return this.getAttribute(`adaptively`)!==null}set autoAdaptively(e){A(this,`adaptively`,e)}get global(){return this.getAttribute(`global`)!==null}set global(e){A(this,`global`,e)}#e=new Set;#t;#n;#r;constructor(){super(),[this.#t,this.#n,this.#r]=Fe(this,this.#e)}register(e){let t=this.#e;return t.add(e),()=>{t.delete(e)}}adaptively(){this.#r()}connectedCallback(){this.#t()}disconnectedCallback(){this.#n()}adoptedCallback(){}};try{customElements.define(`nl-movable-area`,ke),customElements.define(`nl-movable`,Ie),customElements.define(`nl-movable-target`,Me)}catch{}var Le=Ie,j=class extends HTMLElement{#e=()=>{};#t=null;get pagination(){return this.#t}updateCallback(e){}#n=0;#r=0;#i=1;#a=1;get size(){return this.#n}get total(){return this.#r}get pages(){return this.#i}get page(){return this.#a}connectedCallback(){let e=this.parentNode;for(;e&&!(e instanceof Ye);)e=e.parentNode;e&&(this.#t=e,this.#e=e.register({update:({size:e,total:t,pages:n,page:r})=>{this.#n=e,this.#r=t,this.#i=n,this.#a=r,this.updateCallback({size:e,total:t,pages:n,page:r})}}))}disconnectedCallback(){this.#t=null,this.#e()}};function M(e){let t=document.createElement(`style`);return t.textContent=e,t}var Re=class extends j{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(M(``));#n=(()=>{let e=document.createElement(`input`);e.setAttribute(`part`,`input`),e.type=`number`,e.min=`1`,e.step=`1`,this.#e.appendChild(e);let t=()=>{let{pagination:t}=this;if(!t)return;let n=e.value;n&&t.setPage(Number(n))};return e.addEventListener(`change`,t),e.addEventListener(`keydown`,e=>{e.code===`Enter`&&(e.preventDefault(),t())}),e})();updateCallback(){let e=this.#n,{pages:t,page:n}=this;e.max=String(t),e.value=String(n),e.placeholder=String(n)}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#n.disabled=this.disabled;break}}},ze=class extends j{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(M(``));#n=(()=>{let e=document.createElement(`button`);return e.type=`button`,this.#e.appendChild(e),e.setAttribute(`part`,`button`),e})();#r=this.#n.appendChild(document.createElement(`slot`));#i(){this.#n.disabled=this.disabled||this.page===this.pages}constructor(){super(),this.addEventListener(`click`,e=>{let{defaultPrevented:t}=e;e.preventDefault(),this.#n.disabled?e.stopPropagation():t||this.pagination?.setPage(this.page+1)})}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#i();break}}},Be=class extends j{static observedAttributes=[`value`,`disabled`];get value(){return Math.max(1,parseInt(this.getAttribute(`value`)||``)||1)}set value(e){e?this.setAttribute(`value`,String(e)):this.removeAttribute(`value`)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get target(){return Math.min(this.value,this.pages)}get isCurrent(){return this.target===this.page}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(M(``));#n=(()=>{let e=document.createElement(`button`);return e.type=`button`,e.setAttribute(`part`,`button`),this.#e.appendChild(e),e})();#r=(()=>{let e=document.createElement(`slot`);return this.#n.appendChild(e),e.innerText=`1`,e})();#i(){this.#n.disabled=this.disabled||this.isCurrent}constructor(){super(),this.addEventListener(`click`,e=>{let{defaultPrevented:t}=e;e.preventDefault(),this.#n.disabled?e.stopPropagation():t||this.pagination?.setPage(this.value)})}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`value`:this.#r.innerText=String(this.value),this.#i();break;case`disabled`:this.#i();break}}},Ve=class extends j{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(M(`
600
+ :host { display: contents; }
601
+ .placeholder::after {
602
+ content: var(--nl-pagination-pager-placeholder, '...');
603
+ }
604
+ `));#n=Object.create(null);#r=[];#i(){for(let e of this.#r)e.remove();let e=Object.create(null),t=[];this.#n=e,this.#r=t;let{disabled:n}=this,r=this.#e,i=this.page,a=this.pages,o=Math.max(2,i-2),s=Math.min(i+2,a-1),c=a=>{let o=document.createElement(`button`);o.type=`button`,o.innerText=String(a),o.setAttribute(`part`,a===i?`button current`:`button`),o.disabled=n||a===i,o.addEventListener(`click`,()=>{this.pagination?.setPage(a)}),t.push(o),r.appendChild(o),e[a]=o},l=()=>{let e=document.createElement(`span`);e.className=`placeholder`,e.setAttribute(`part`,`placeholder`),r.appendChild(e),t.push(e)};c(1),i>4&&l();for(let e=o;e<=s;e++)c(e);a-i>3&&l(),a>1&&c(a)}#a(){let{disabled:e}=this,t=String(this.page);for(let[n,r]of Object.entries(this.#n))r.disabled=e||n===t}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#a();break}}},He=class extends j{static observedAttributes=[`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(M(``));#n=(()=>{let e=document.createElement(`button`);return e.type=`button`,e.setAttribute(`part`,`button`),this.#e.appendChild(e),e})();#r=this.#n.appendChild(document.createElement(`slot`));#i(){this.#n.disabled=this.disabled||this.page===1}constructor(){super(),this.addEventListener(`click`,e=>{let{defaultPrevented:t}=e;e.preventDefault(),this.#n.disabled?e.stopPropagation():t||this.pagination?.setPage(this.page-1)})}updateCallback(){this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`disabled`:this.#i();break}}};function Ue(e){let t=e?.split(/[,;: ]/).map(e=>parseInt(e)).filter(e=>e>=0);return t?.length?new Set(t):null}function We(e){if(typeof e==`string`){let t=Ue(e);return t?[...t]:[]}if(typeof e==`number`){let t=Math.floor(e);return t>=0?[t]:[]}if(typeof e==`bigint`)return e>=0n?[Number(e)]:[];try{return Array(e).flat(1/0).flatMap(We)}catch{return[]}}const Ge=[10,20,30,50,100];function Ke(e,t){let n=Ue(e)||new Set(Ge);return typeof t==`number`&&n.add(t),[...n].sort((e,t)=>e-t)}var qe=class extends j{static observedAttributes=[`sizes`,`label`,`non-label`,`disabled`];get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}#e=this.attachShadow({mode:`closed`});#t=this.#e.appendChild(M(``));#n=(()=>{let e=this.#e.appendChild(document.createElement(`select`));return e.setAttribute(`part`,`input`),e.addEventListener(`change`,()=>{let{pagination:t}=this;t&&t.setSize(Number(e.value))}),e})();#r=(()=>{let e=document.createElement(`option`);return e.label=`-`,e.value=`0`,e})();#i=[];#a(){let e=Ue(this.getAttribute(`sizes`))||new Set(Ge),{size:t}=this;e.add(t);let n=this.#n;n.innerHTML=``,e.delete(0)&&n.appendChild(this.#r);let r=[];this.#i=r;let i=this.label;for(let t of[...e].sort((e,t)=>e-t)){let e=document.createElement(`option`);e.label=i.replace(/#/g,String(t)),e.value=String(t),r.push(e),n.appendChild(e)}n.value=String(t)}get label(){return this.getAttribute(`label`)||`#`}set label(e){e?this.setAttribute(`label`,e):this.removeAttribute(`label`)}get nonLabel(){return this.getAttribute(`non-label`)||`-`}set nonLabel(e){e?this.setAttribute(`non-label`,e):this.removeAttribute(`non-label`)}get sizes(){return Ke(this.getAttribute(`sizes`))}set sizes(e){let t=We(e);t.length?this.setAttribute(`sizes`,[...new Set(t)].sort((e,t)=>e-t).join(`,`)):this.removeAttribute(`sizes`)}#o=0;updateCallback(){let{size:e}=this;this.#o!==e&&(this.#o=e,this.#a())}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`sizes`:this.#a();break;case`label`:{let e=this.label;for(let t of this.#i)t.label=e.replace(/#/g,t.value);break}case`non-label`:this.#r.label=this.nonLabel;break;case`disabled`:this.#n.disabled=this.disabled;break}}},Je=class extends j{static observedAttributes=[`name`];get name(){let e=this.getAttribute(`name`)?.toLowerCase()||``;return[`size`,`total`,`pages`,`page`,`start`,`end`].includes(e)?e:`page`}set name(e){e?this.setAttribute(`name`,String(e)):this.removeAttribute(`name`)}#e={size:0,total:0,pages:1,page:1,start:0,end:0};#t=this.attachShadow({mode:`closed`});#n=this.#t.appendChild(M(``));#r=this.#t.appendChild(document.createTextNode(``));#i(){let e=this.#e[this.name];this.#r.textContent=String(e)}updateCallback(){let{size:e,total:t,pages:n,page:r}=this;this.#e={size:e,total:t,pages:n,page:r,start:Math.min((r-1)*e+1,t),end:e?Math.min(r*e,t):t},this.#i()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`name`:this.#i()}}};function N(e,t,n){if(n=typeof n==`string`?parseInt(n):typeof n==`number`?Math.floor(n):typeof n==`bigint`?Number(n):NaN,Number.isNaN(n)||n<0){e.removeAttribute(t);return}e.setAttribute(t,String(n))}function P(e){if(!e)return 0;let t=parseInt(e);return Number.isNaN(t)||t<0?0:t}var Ye=class extends HTMLElement{static get Widget(){return j}static get Jumper(){return Re}static get Next(){return ze}static get Page(){return Be}static get Pager(){return Ve}static get Prev(){return He}static get Sizer(){return qe}static get Value(){return Je}static observedAttributes=[`size`,`total`,`pages`,`page`];get size(){return P(this.getAttribute(`size`))||0}set size(e){N(this,`size`,e)}get total(){return P(this.getAttribute(`total`))||0}set total(e){N(this,`total`,e)}get pages(){let e=P(this.getAttribute(`pages`));if(e)return e;let{size:t}=this;return t&&Math.ceil(this.total/t)||1}set pages(e){N(this,`pages`,e)}get page(){return Math.min(P(this.getAttribute(`page`))||1,this.pages)}set page(e){N(this,`page`,e)}setPage(e){this.page=e,this.dispatchEvent(new Event(`change`))}setSize(e){this.size=e,this.dispatchEvent(new Event(`change`))}#e=new Set;register(e){let t=this.#e;return t.add(e),e.update({...this.#t}),()=>{t.delete(e)}}connectedCallback(){}disconnectedCallback(){}adoptedCallback(){}#t={size:0,total:0,pages:1,page:1};attributeChangedCallback(e,t,n){if(t===n)return;let{size:r,total:i,pages:a,page:o}=this,s=this.#t;if(r===s.size&&i===s.total&&a===s.pages&&o===s.page)return;let c={size:r,total:i,pages:a,page:o};this.#t=c;for(let e of[...this.#e])e.update({...c})}};try{customElements.define(`nl-pagination`,Ye),customElements.define(`nl-pagination-jumper`,Re),customElements.define(`nl-pagination-next`,ze),customElements.define(`nl-pagination-page`,Be),customElements.define(`nl-pagination-pager`,Ve),customElements.define(`nl-pagination-prev`,He),customElements.define(`nl-pagination-sizer`,qe),customElements.define(`nl-pagination-value`,Je)}catch{}var Xe=class extends HTMLElement{static observedAttributes=[`digit`,`value`,`sign`,`plus`,`zero`];#e=document.createElement(`span`);#t=document.createElement(`span`);#n=document.createElement(`span`);#r(){let e=this.currentDigit,t=this.currentSign;this.#n.innerText=this.sign?t:`${e}`,this.#e.style.insetBlockStart=`-${e}00%`,this.#t.style.insetBlockStart=`-${t===`+`?2:t===`-`?0:1}00%`}constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
605
+ :host {
606
+ display: inline-block;
607
+ overflow: hidden;
608
+
609
+ position: relative;
610
+ container-name: host;
611
+ }
612
+ :host([hidden]) { display: none; }
613
+
614
+ .value {
615
+ color: transparent;
616
+ text-align: center;
617
+ text-orientation: upright;
618
+ inline-size: 100%;
619
+ block-size: 100%;
620
+ display: flex;
621
+ flex-direction: column;
622
+ overflow: hidden;
623
+ }
624
+ .value:empty::before {
625
+ content: '.'
626
+ }
627
+ .root, .sign {
628
+ position: absolute;
629
+ text-align: center;
630
+ text-orientation: upright;
631
+ transition: all 1.5s;
632
+ display: flex;
633
+ flex-direction: column;
634
+ justify-content: space-around;
635
+ overflow: hidden;
636
+ user-select: none;
637
+ pointer-events: none;
638
+ }
639
+ .root {
640
+ counter-reset: nl-roll-digit -1;
641
+ inline-size: 100%;
642
+ block-size: 1000%;
643
+ inset-inline-start: 0;
644
+ }
645
+ .root span {
646
+ flex: 1;
647
+ overflow: hidden;
648
+ counter-increment: nl-roll-digit;
649
+ }
650
+ .root span::before {
651
+ content: counter(nl-roll-digit)
652
+ }
653
+ .sign {
654
+ inline-size: 100%;
655
+ block-size: 300%;
656
+ inset-block-start: -100%;
657
+ inset-inline-start: -100%;
658
+ }
659
+ .sign span {
660
+ flex: 1;
661
+ overflow: hidden;
662
+ }
663
+ .sign span::before {
664
+ content: ''
665
+ }
666
+ .sign span:first-child::before {
667
+ content: '-'
668
+ }
669
+ .sign span:last-child::before {
670
+ content: '+'
671
+ }
672
+ :host([sign]) .sign {
673
+ inset-inline-start: 0;
674
+ }
675
+ :host([sign]) .root {
676
+ inset-inline-start: 100%;
677
+ }
678
+ `;let t=e.appendChild(this.#e);t.className=`root`;for(let e=0;e<10;e++)t.appendChild(document.createElement(`span`));let n=e.appendChild(this.#t);n.className=`sign`;for(let e=0;e<3;e++)n.appendChild(document.createElement(`span`));e.appendChild(this.#n).className=`value`}get currentDigit(){return Math.floor(Math.abs(this.value)/10**this.digit%10)}get currentSign(){let{value:e}=this;return e<0?`-`:e?this.plus?`+`:``:this.zero}get digit(){return parseInt(this.getAttribute(`digit`)||``)||0}set digit(e){e==null?this.removeAttribute(`digit`):this.setAttribute(`digit`,String(e))}get sign(){return this.hasAttribute(`sign`)}set sign(e){e?this.setAttribute(`sign`,``):this.removeAttribute(`sign`)}get plus(){return this.hasAttribute(`plus`)}set plus(e){e?this.setAttribute(`plus`,``):this.removeAttribute(`plus`)}get zero(){let e=this.getAttribute(`zero`);return e===`+`||e===`-`?e:``}set zero(e){e===`+`||e===`-`?this.setAttribute(`plus-zero`,e):this.removeAttribute(`zero`)}get value(){return parseFloat(this.getAttribute(`value`)||``)||0}set value(e){e==null?this.removeAttribute(`value`):this.setAttribute(`value`,String(e))}connectedCallback(){this.#r()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`digit`:case`value`:case`sign`:case`plus`:case`zero`:this.#r();break}}};try{customElements.define(`nl-roll-digit`,Xe)}catch{}function Ze(e){return e?/^\d+$/.test(e)?`${e}px`:e:`0`}function Qe(e){let t=[`::slotted(*) {
679
+ flex-basis: calc(100% / ${e});
680
+ max-inline-size: calc(100% / ${e});
681
+ }`];for(let n=1;n<=e;n++)t.push(`::slotted([nl-span="${n}"]) {
682
+ flex-basis: calc(${n}00% / ${e});
683
+ min-inline-size: calc(${n}00% / ${e});
684
+ max-inline-size: calc(${n}00% / ${e});
685
+ }`),t.push(`::slotted([nl-offset="${n}"]) {
686
+ margin-inline-start: calc(${n}00% / ${e});
687
+ }`);return t.join(`
688
+ `)}function $e(e){if(typeof e!=`number`)return 0;let t=Math.floor(e);return Number.isFinite(t)&&t>1?t:0}var et=class extends HTMLElement{static observedAttributes=[`aliquot`,`gutter-inline`,`gutter-block`];#e=document.createElement(`style`);#t=document.createElement(`style`);get gutterInline(){return Ze(this.getAttribute(`gutter-inline`))}set gutterInline(e){this.setAttribute(`gutter-inline`,String(e))}get gutterBlock(){return Ze(this.getAttribute(`gutter-block`))}set gutterBlock(e){this.setAttribute(`gutter-block`,String(e))}get aliquot(){let e=parseInt(this.getAttribute(`aliquot`)||``);return!e||e<2?24:e}set aliquot(e){let t=$e(e);t?this.setAttribute(`aliquot`,String(t)):this.removeAttribute(`aliquot`)}constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(document.createElement(`style`)).textContent=`
689
+ :host { display: flex; flex-flow: row wrap; }
690
+ ::slotted(*) { box-sizing: border-box; }
691
+ ::slotted([nl-span=0]) { flex: 0 0 0%; max-inline-size: 0%; }
692
+ `,e.appendChild(this.#t),e.appendChild(this.#e),e.appendChild(document.createElement(`slot`))}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`aliquot`:this.#t.textContent=Qe(this.aliquot);break;case`gutter-inline`:case`gutter-block`:this.#e.textContent=`::slotted(*) {
693
+ padding-block: ${this.gutterBlock};
694
+ padding-inline: ${this.gutterInline};
695
+ }`;break}}};try{customElements.define(`nl-row`,et)}catch{}var tt=class extends HTMLElement{static observedAttributes=[`column`,`space`,`unit`];get column(){return this.hasAttribute(`column`)}set column(e){e?this.setAttribute(`column`,``):this.removeAttribute(`column`)}get space(){let e=parseFloat(this.getAttribute(`space`)||``);return Number.isNaN(e)||!Number.isFinite(e)?16:e<=0?0:e}set space(e){typeof e!=`number`||!Number.isFinite(e)?this.removeAttribute(`space`):this.setAttribute(`space`,e<=0?`0`:String(e))}get unit(){return this.getAttribute(`unit`)||`px`}set unit(e){e?this.setAttribute(`unit`,e):this.removeAttribute(`unit`)}#e=document.createElement(`style`);constructor(){super();let e=this.attachShadow({mode:`closed`});e.appendChild(this.#e),e.appendChild(document.createElement(`style`)).textContent=`
696
+ :host {
697
+ display: inline-block;
698
+ }
699
+ ::slotted(*) {
700
+ display: inline-block;
701
+ }
702
+ ::slotted(*:last-child) {
703
+ margin-inline-end: 0;
704
+ margin-block-end: 0;
705
+ }
706
+ :host([column]) ::slotted(*) {
707
+ display: block;
708
+ }
709
+ `,e.appendChild(document.createElement(`slot`))}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`column`:case`space`:case`unit`:this.#e.textContent=`::slotted(*) {margin-${this.column?`block`:`inline`}-end: var(--nl-space, ${this.space}${this.unit})}`;break}}};try{customElements.define(`nl-space`,tt)}catch{}function nt(e,t,n){n?e.setAttribute(t,``):e.removeAttribute(t)}function F(e,t,n=0,r=1){let i=e?parseFloat(e):t;return Math.max(n,Math.min(Number.isNaN(i)?t:i,r))}function rt(e,t,n,r=0,i=1){let a=typeof n==`string`?parseFloat(n):n===null?NaN:n;if(Number.isNaN(a)){e.removeAttribute(t);return}e.setAttribute(t,String(Math.max(r,Math.min(a,i))))}const it=new Set([`vertical-lr`,`vertical-rl`,`sideways-lr`,`sideways-rl`]);function at(e){let t=getComputedStyle(e),n=t.writingMode?.toLowerCase(),r=it.has(n),i=t.flexDirection.toLocaleLowerCase(),a=i.includes(`column`),o=a?[`vertical-rl`,`sideways-rl`].includes(n):t.direction.toLowerCase()===`rtl`!=(n===`sideways-lr`);return o=o!==i.includes(`reverse`),[r!==a,o]}var ot=class extends HTMLElement{static observedAttributes=[`column`,`disabled`,`min`,`max`,`value`];get column(){return this.getAttribute(`column`)!==null}set column(e){nt(this,`column`,e)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){nt(this,`disabled`,e)}get min(){return F(this.getAttribute(`min`),0,0,1)}set min(e){rt(this,`min`,e,0,F(this.getAttribute(`max`),1,0,1))}get max(){return F(this.getAttribute(`max`),1,this.min,1)}set max(e){rt(this,`max`,e,this.min,1)}get value(){return F(this.getAttribute(`value`),.5,this.min,this.max)}set value(e){rt(this,`value`,e,this.min,this.max)}#e=null;#t(){let e=this.#e;e!==null&&(this.#i.states.delete(`--moving`),this.#e=null,this.#a.releasePointerCapture(e))}#n=(()=>{let e=this.attachShadow({mode:`closed`});return e.appendChild(document.createElement(`style`)).textContent=`
710
+ :host {
711
+ display: flex;
712
+ border: 1px solid;
713
+ writing-mode: inherit;
714
+ }
715
+ :host([hidden]) {
716
+ display: none;
717
+ }
718
+ :host([column]) {
719
+ display: none;
720
+ flex-direction: column;
721
+ }
722
+ slot {
723
+ display: block;
724
+ position: relative;
725
+ }
726
+ .start {
727
+ flex: 1;
728
+ overflow: hidden;
729
+ }
730
+ .end {
731
+ flex: 1;
732
+ overflow: hidden;
733
+ }
734
+ .trigger {
735
+ cursor: move;
736
+ }
737
+ .trigger div {
738
+ inline-size: 8px;
739
+ block-size: 100%;
740
+ background: currentColor;
741
+ opacity: .2;
742
+ }
743
+ :host(:state(--moving)) div, div:hover {
744
+ opacity: .5;
745
+ }
746
+ `,e})();#r=(()=>{let e=document.createElement(`slot`);return e.name=`start`,e.className=`start`,this.#n.appendChild(e),e})();#i=this.attachInternals();#a=(()=>{let e=document.createElement(`slot`);e.name=`trigger`,e.tabIndex=0,e.className=`trigger`,e.appendChild(document.createElement(`div`)),this.#n.appendChild(e);let t=0;e.addEventListener(`pointerdown`,n=>{if(this.hidden||this.disabled)return;let{pointerId:r}=n,i=this.#e;if([null,r].includes(i))switch(this.#i.states.add(`--moving`),this.#e=r,e.setPointerCapture(r),at(e).map((e,t)=>e?2**t:0).reduce((e,t)=>e+t)){case 0:t=-n.offsetX;break;case 1:t=-n.offsetY;break;case 2:t=n.offsetX-e.offsetWidth;break;case 3:t=n.offsetY-e.offsetHeight;break}});let n=this,r=t=>t?n.clientHeight-e.offsetHeight:n.clientWidth-e.offsetWidth,i=i=>{let[a,o]=at(e),s=0;switch([a,o].map((e,t)=>e?2**t:0).reduce((e,t)=>e+t)){case 0:s=i.clientX-n.getBoundingClientRect().left;break;case 1:s=i.clientY-n.getBoundingClientRect().top;break;case 2:s=n.getBoundingClientRect().right-i.clientX;break;case 3:s=n.getBoundingClientRect().bottom-i.clientY;break}let{max:c,min:l}=this,u=Math.max(l,Math.min((s+t)/r(a),c));this.setAttribute(`value`,String(u))};return e.addEventListener(`pointermove`,t=>{let{pointerId:n}=t;e.hasPointerCapture(n)&&i(t)}),e.addEventListener(`pointerup`,e=>{let{pointerId:t}=e;t===this.#e&&(i(e),this.#t())}),e.addEventListener(`pointercancel`,e=>{let{pointerId:t}=e;t===this.#e&&(i(e),this.#t())}),e.addEventListener(`keydown`,t=>{if(this.hidden||this.disabled||this.#e!==null||this.#n.activeElement!==e)return;let{max:n,min:i}=this;switch(t.code){case`Home`:t.preventDefault(),this.setAttribute(`value`,String(Math.max(i,0)));return;case`End`:t.preventDefault(),this.setAttribute(`value`,String(Math.min(1,n)));return}let[a,o]=at(e),s=0;switch(t.code){case`ArrowUp`:s=a?-1:0;break;case`ArrowDown`:s=a?1:0;break;case`ArrowLeft`:s=a?0:-1;break;case`ArrowRight`:s=a?0:1;break}if(!s)return;t.preventDefault(),o&&(s=-s),t.ctrlKey&&(s*=100),t.shiftKey&&(s*=10);let c=F(this.getAttribute(`value`),.5,i,n);c=Math.max(i,Math.min(c+s/r(a),n)),this.setAttribute(`value`,String(c))}),e})();#o=(()=>{let e=document.createElement(`slot`);return e.name=`end`,e.className=`end`,this.#n.appendChild(e),e})();connectedCallback(){}disconnectedCallback(){this.#t()}adoptedCallback(){this.#t()}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`hidden`:if(!this.hidden)break;this.#t();break;case`disabled`:n===null?this.#a.tabIndex=0:this.#a.removeAttribute(`tabindex`),this.#t();break;case`min`:case`max`:case`value`:{let{value:e}=this;this.#r.style.flex=`${e}`,this.#o.style.flex=`${1-e}`;break}}}};try{customElements.define(`nl-split`,ot)}catch{}var st=class{#e;#t;constructor(){let e=document.createElement(`nl-pagination`);e.size=20,e.appendChild(document.createElement(`nl-pagination-value`)).name=`start`,e.appendChild(document.createTextNode(`-`)),e.appendChild(document.createElement(`nl-pagination-value`)).name=`end`,e.appendChild(document.createTextNode(`/`)),e.appendChild(document.createElement(`nl-pagination-value`)).name=`total`,e.appendChild(document.createElement(`nl-pagination-prev`)).innerText=`上一页`,e.appendChild(document.createElement(`nl-pagination-pager`)),e.appendChild(document.createElement(`nl-pagination-next`)).innerText=`下一页`,e.appendChild(document.createElement(`nl-pagination-sizer`));let t=new Set;e.addEventListener(`change`,()=>{for(let e of t)e()}),this.#e=t,this.#t=e}get root(){return this.#t}get size(){return this.#t.size}set size(e){this.#t.size=e}get page(){return this.#t.page}set page(e){this.#t.page=e}get total(){return this.#t.total}set total(e){this.#t.total=e}listen(e){let t=this.#e,n=()=>e(this);return t.add(n),()=>{t.delete(n)}}destroy(){}};function ct(e){e.listen(`update`,()=>{let{container:t}=e;t.innerHTML=``})}function*lt(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e;e=t.nextNode();)yield e}function ut(e,t){let n=[],r=[...lt(t)].filter(e=>e.nodeValue?.length),i=r.reduce((e,t)=>{let n=e[e.length-1]?.[1]||0;return[...e,[n,n+(t.nodeValue?.length||0),t]]},[]),a=r.map(e=>e.nodeValue).join(``),o=0;for(let t of e){let e=a.indexOf(t,o);if(e===-1)return[];let r=e+t.length,s=i.findLast(([t])=>t<=e);if(!s)return[];let c=i.findLast(([,e])=>e>=r);if(!c)return[];o=e+t.length;let l=new Range;l.setStart(s[2],e-s[0]),l.setEnd(c[2],r-s[0]),n.push(l)}return n}function dt(e,t,n,r={}){let i=new Map,a=null,o=[],s=[];function c(e){let t=document.createElement(`a`);return t.href=e.path||`#`,t.appendChild(document.createTextNode(e.label||e.title||``)),t.title=e.title||e.label||``,t}function l(e,t){let{children:r}=e;if(!r.length){let t=document.createElement(`div`),r=new AbortController,a=n(e,r.signal);if(!a)return r.abort(),null;s.push(()=>{r.abort()}),t.appendChild(a);for(let n of e.buttons||[])t.appendChild(c(n));t.className=`NavMenu-item`;let{page:o,path:l}=e;if(o){let e=`${o}/${l}`,n=i.get(e);n?n.push(t):i.set(e,[t])}return{el:t,filter(e,n){let r=n?ut(n,a):[];return t.hidden=!!(!e&&n&&!r.length),r}}}let a=document.createElement(`nl-collapse`);a.setAttribute(`animation`,``),a.setAttribute(`menu`,``);let o=a.appendChild(document.createElement(`div`));o.appendChild(document.createTextNode(e.label||e.title||``)),o.className=`NavMenu-label`,o.slot=`label`,o.style.flex=`1`;for(let t of e.buttons||[])a.appendChild(c(t)).slot=`label`;let l=u(a,r,t+1);return l.length?{el:a,filter(e,t){if(!t){for(let t of l)t.filter(e);return a.hidden=!1,a.open=!1,[]}let n=ut(t,o),r=!!(e||n.length),i=l.flatMap(e=>e.filter(r,t));a.open=!!i.length;let s=[...n,...i];return a.hidden=!e&&!s.length,s}}:null}function u(t,n,r){let i=!1,a=!1,s=[];for(let c of n){if(!c){if(!i)continue;a=!0;continue}a&&(a=!1,e.appendChild(document.createElement(`hr`)));let n=l(c,r);n&&(s.push(n),i=!0,t.appendChild(n.el),o.push(n.el),n.el.style.setProperty(`--NavMenu-level`,String(r)))}return s}let d=u(e,t,0);function p(t){let n=i.get(t)?.[0];if(!n)return;let r=[],o=n.parentElement;for(;o&&o!==e;o=o.parentElement)r.push(o);if(o===e){a?.classList.remove(`NavMenu-current`);for(let e of r)e.setAttribute(`open`,``);a=n,a?.classList.add(`NavMenu-current`)}}let m=!1;function h(){if(!m){m=!0;for(let e of o)e.remove();for(let e of s)e()}}let g=r.signal||f;return g.aborted?h():g.addEventListener(`abort`,h,{once:!0}),v(()=>r.active||``,e=>{e&&p(e)},{signal:g,immediate:!0}),e=>{let t=e.toLowerCase().split(/[\s\n]+/).filter(Boolean);return t.length||(t=null),d.flatMap(e=>e.filter(!1,t))}}const I=document.createElement(`div`);I.style.display=`flex`,I.style.flexDirection=`column`;const ft=I.appendChild(document.createElement(`header`));ft.classList.add(`NavMenu-header`);const L=ft.appendChild(document.createElement(`input`));L.placeholder=`过滤菜单...`,L.type=`search`;const R=ft.appendChild(document.createElement(`button`));R.appendChild(o(`refresh`,!0)),R.classList.add(`icon`),R.title=`刷新`;const z=I.appendChild(document.createElement(`main`));z.style.flex=`1`,z.style.overflow=`auto`,z.classList.add(`NavMenu`);let pt=0,mt=!1,ht=null;function gt(){let e=ht?.(L.value)||[],t=new Highlight(...e);CSS.highlights.set(`NavMenu-filter-highlight`,t)}L.addEventListener(`input`,gt);const _t=c([]),vt=a(()=>{let t=r.permissions,n=_t.get();return t?e.filter(n,e=>{let n=e.permission;return n?u(n,t):!0}):n});let yt=null;l(()=>{yt?.abort(),z.innerHTML=``,yt=new AbortController,ht=dt(z,vt.get(),e.createItem,{signal:yt.signal}),gt()});async function bt(t=!1){if(R.disabled)return;R.disabled=!0,++pt;let n=pt,r=`application`,a=i.application||``,o=await d(r,a,t);mt&&n!==pt||(R.disabled=!1,mt=!0,_t.set(e.build(o,r,a,[])))}R.addEventListener(`click`,()=>bt(!0));function xt(e,t,n){if(!e){let e=o(`user`,t);return n||e.setAttribute(`fill-opacity`,`0.5`),e}let r=document.createElement(`img`);return r.src=e,r}function St(e,t){e.classList.add(`${b}-user-avatar`);let n=[],s,c=new AbortController;if(n.push(()=>c.abort()),i.single)s=o(`singleUser`,new AbortController().signal),t||s.setAttribute(`fill-opacity`,`0.5`),e.appendChild(s);else{let i=``,o=new AbortController;s=xt(i,o.signal,t),e.appendChild(s);let u=a(()=>r.session?.avatar||``);l(()=>{let n=u.get();if(n===i)return;i=n,o?.abort(),o=new AbortController;let r=xt(i,o.signal,t);e.replaceChild(r,s),s=r},c.signal),n.push(()=>{o?.abort(),o=null})}let u=a(()=>{let e=r.target,t=r.session;return!e||e.id===(t?.id||``)?null:e.avatar||``}),d=null,f=null,p=null;return l(()=>{let n=u.get();n!==d&&(d=n,f?.remove(),f=null,p?.abort(),n!==null&&(p=new AbortController,f=xt(n,p.signal,t),e.insertBefore(f,s)))},c.signal),n.push(()=>{p?.abort(),p=null}),()=>{for(let e of n)e()}}const B=document.createElement(`div`);B.classList.add(`${b}-user`);const V=document.createElement(`div`);V.classList.add(`${b}-user-button`),St(V,!0);const H=B.appendChild(document.createElement(`span`));H.classList.add(`${b}-user-info`);const Ct=H.appendChild(document.createElement(`span`));St(Ct),Ct.classList.add(`avatar`);const wt=H.appendChild(document.createElement(`span`));wt.classList.add(`username`),wt.innerText=`用户名`;const Tt=H.appendChild(document.createElement(`span`));if(Tt.classList.add(`btns`),i.help){let e=Tt.appendChild(document.createElement(`a`));e.href=i.help,e.target=`_blank`,e.appendChild(o(`help`,!0)),e.title=`帮助`}const U=Tt.appendChild(document.createElement(`div`));U.appendChild(o(`logout`,!0)),U.title=`退出登录`,l(()=>{U.hidden=!r.current}),U.addEventListener(`click`,()=>r.exit()),l(()=>{wt.innerText=r.current?.name||``});const Et=c([]);Et.set(e.fromDefine(g,[]));const Dt=a(()=>{let t=Et.get();return r.current?t:e.filter(t,e=>!e.logged)}),W=B.appendChild(document.createElement(`main`));W.style.flex=`1`,W.style.overflow=`auto`,W.classList.add(`NavMenu`);let Ot=null;l(()=>{Ot?.abort(),W.innerHTML=``,Ot=new AbortController,dt(W,Dt.get(),e.createItem,{signal:Ot.signal})});const G=document.createElement(`a`);G.classList.add(`${b}-logo`),G.href=y.href;const kt=i.logo,At=kt&&h(kt);if(At){let e=G.appendChild(document.createElement(`img`));e.src=At.href,e.classList.add(`logo`)}else G.appendChild(o(`logo`,!0)).classList.add(`logo`);const jt={404:{title:`您所请求的页面无法找到`,description:`服务器无法正常提供信息。
747
+ 目标页面可能已经被更改、删除或移到其他位置,或您所输入页面地址错误。`}};function Mt(e,t){if((t??``)==``){e.container.appendChild(document.createTextNode(`空页面`));return}let n=(typeof t==`number`||typeof t==`string`)&&Object.hasOwn(jt,t)&&jt[t]||jt[404],r=n?.title||`Error`,i=n?.description,a=document.createElement(`div`),o=a.appendChild(document.createElement(`div`)),s=o.appendChild(document.createElement(`div`)),c=o.appendChild(document.createElement(`div`));if(a.style.marginBlock=`8%`,a.style.marginInline=`auto`,a.style.inlineSize=`600px`,a.style.maxInlineSize=`100%`,a.style.padding=`20px`,s.style.paddingBlock=`20px`,s.style.fontSize=`20px`,s.style.color=`#8e8e8e`,s.style.textAlign=`center`,c.style.fontSize=`13px`,c.style.lineHeight=`1.3em`,c.style.color=`#b5b5b5`,s.appendChild(document.createTextNode(r)),e.title=r||`Error`,i&&typeof i==`string`)for(let e of i.split(`
748
+ `))c.appendChild(document.createTextNode(e)),c.appendChild(document.createElement(`br`));e.container.appendChild(a),e.loading=!1}const K=`${b}-allSider-nav`,q=document.createElement(`header`);q.className=`${K}-header`;const J=q.appendChild(document.createElement(`div`));J.classList.add(`${K}-actions`);const Nt=q.appendChild(document.createElement(`div`));Nt.classList.add(`${K}-sidebar`);const Pt=`${K}-open`;let Y=null;function Ft(){window.innerWidth>800||Y?.()}var It=class{button;sider;#e;#t=!1;get disabled(){return this.#t}set disabled(e){e?this.disable():this.enable()}disable(){if(this.#t)return;this.#t=!0;let e=this.#e;Y===e&&e(),this.button.hidden=!0,this.sider.hidden=!0}enable(){this.#t&&(this.#t=!1,this.button.hidden=!1)}#n=()=>this.toggle();constructor(e,t){let n=t instanceof HTMLElement?t:document.createElement(`div`),r=e instanceof HTMLElement?e:document.createElement(`div`);n.tabIndex=0,n.classList.add(`${K}-button`),r.hidden=!0,Nt.appendChild(r),n.classList.add(`${K}-selectable`),n.addEventListener(`click`,this.#n),this.#e=()=>{Y=null,document.body.classList.remove(Pt),n.classList.remove(`${K}-selected`),r.hidden=!0},this.button=n,this.sider=r}get open(){return Y===this.#e}set open(e){e?this.show():this.hide()}show(){if(this.#t)return;let e=this.#e;Y!==e&&(Y?.(),Y=e,document.body.classList.add(Pt),this.button.classList.add(`${K}-selected`),this.sider.hidden=!1)}toggle(){if(this.#t)return;let e=this.#e;if(Y===e){e();return}this.show()}hide(){if(this.#t)return;let e=this.#e;Y===e&&e()}remove(){let e=this.#e;Y===e&&e();let{button:t,sider:n}=this;t.remove(),n.remove(),t.classList.remove(`${K}-button`),t.classList.remove(`${K}-selectable`),t.removeEventListener(`click`,this.#n),n.hidden=!1}};Nt.addEventListener(`click`,e=>{e.target===e.currentTarget&&Y?.()});var X=class e{root=document.createElement(`div`);#e=new Set;constructor(e){let t=this.root;e.appendChild(t),t.className=`${K}-group`}remove(){this.root.remove();for(let e of[...this.#e])e()}createGroup(){let t=new e(this.root),n=this.#e,r=()=>{n.delete(r),t.remove()};return n.add(r),t}createAction(e){let t=document.createElement(e?`a`:`div`);t.tabIndex=0,t.classList.add(`${K}-button`),t.addEventListener(`click`,()=>{Ft()}),this.root.appendChild(t);let n=this.#e,r=()=>{n.delete(r),t.remove()};return n.add(r),t}createSider(e,t){let n=new It(e,t);this.root.appendChild(n.button);let r=this.#e,i=()=>{r.delete(i),n.remove()};return r.add(i),n}};const Lt=document.createElement(`div`),Rt=new X(J),zt=new X(J);new X(J),J.appendChild(document.createElement(`span`));const Bt=new X(J),Z=zt.createSider(Lt);Z.button.innerText=`页面`,Z.disabled=!0;var Vt=class extends n{#e;#t;constructor(e,t,n,r,i){super(t,n,r,i),this.#e=e,this.#t=t,i.addEventListener(`abort`,()=>{this.#n()})}insert(){super.insert(),this.#e.show&&(Z.disabled=!1)}#n(){this.#e.show&&!this.#t.children.length&&(Z.disabled=!0)}remove(){super.remove(),this.#n()}},Ht=class extends t{#e=(()=>{let e=document.createElement(`div`);return e.classList.add(`Page-sides`),Lt.appendChild(e),e})();destroy(){return super.destroy()?(this.#e.remove(),!0):!1}toggle(e){super.toggle(e),Z.disabled=!(e&&this.#e.children.length)}get siderOpen(){return Z.open}set siderOpen(e){e?Z.show():Z.hide()}createSider(e,t){if(this.destroyed||t?.aborted)return null;let n=this.#e;return new Vt(this,n,null,e!==!1,t instanceof AbortSignal?AbortSignal.any([t,this.signal]):this.signal)}constructor(e){super(e),e&&(Z.disabled=!this.#e.children.length)}};function Ut(e,t,n){let r=document.createElement(`nl-menu`),i=!1,a=!1,o=()=>{i=!0,a&&(a=!1,r.appendChild(document.createElement(`hr`)))};for(let s of e){if(!s){if(!i)continue;a=!0;continue}let{children:e}=s;if(!e?.length){let e=new AbortController,i=t(s,AbortSignal.any([n,e.signal]));if(!i){e.abort();continue}o(),r.appendChild(i);continue}let c=Ut(e,t,n);if(!c)continue;o();let l=r.appendChild(c),u=l.insertBefore(document.createElement(`div`),l.firstChild);u.appendChild(document.createTextNode(s.label||s.title||``)),u.slot=`label`}return i?r:null}function Wt(e,t,n){if(n.aborted)return null;let r=document.createElement(`div`),i=!1,a=!1,o=()=>{i=!0,a&&=!1};for(let s of e){if(!s){if(!i)continue;a=!0;continue}let{children:e}=s;if(!e?.length){let e=new AbortController,i=t(s,AbortSignal.any([n,e.signal]));if(!i){e.abort();continue}o(),r.appendChild(document.createElement(`button`)).appendChild(i);continue}let c=Ut(e,t,n);if(!c)continue;o();let l=r.appendChild(document.createElement(`button`));l.appendChild(document.createTextNode(s.label||s.title||``)),c.targetElement=l,l.addEventListener(`click`,()=>c.show?.()),r.appendChild(c)}return r.childNodes.length?(r.classList.add(`MenuButtons`),r):null}function Gt(e,t){let n=document.createElement(`a`);n.appendChild(document.createTextNode(e.label||e.title||``));let{page:r,path:i,uri:a,target:o,command:s,script:c,click:u}=e;function d(){let t=e.disabled;return!!(typeof t==`function`?t():t)}return l(()=>{n.disabled=d()},t),r?(n.href=new URL(i?.[0]===`/`?`${r}${i}`:`${r}/${i||``}`,y).href,o&&typeof o==`string`&&(n.target=o)):a?(n.href=a,o!==``&&(n.target=o??`_blank`)):typeof u==`function`?n.addEventListener(`click`,e=>{d()||e.defaultPrevented||u()}):(s||c)&&n.addEventListener(`click`,e=>{d()||e.defaultPrevented}),n}function Kt(e,t,n,r){let i=document.createElement(`div`),a=Ut(e,n,r);if(!a)return null;let s=i.appendChild(document.createElement(`button`)),c=t?.label||t?.title||``;return c?s.appendChild(document.createTextNode(c)):s.appendChild(o(t?.icon||`more`,r)),a.targetElement=s,s.addEventListener(`click`,()=>a.show()),i.appendChild(a),i}var qt={components:{List:T,Pagination:st,createMenuButtons:Wt,createMenuItem:Gt,createMenuButton:Kt},pageManager:te,elements:[p,q],classNames:[b,`${b}-allSider`],styleFiles:[`theme-allSider.css`],home:ct,rootClassName:`${b}-root`,createPage(e){return new Ht(e)},renderError(e,t){Mt(e,t)},setup(e){G.addEventListener(`click`,()=>{Ft()},{signal:e}),J.insertBefore(G,J.firstElementChild);let t=Rt.createSider(I);bt(!0),t.button.appendChild(o(`menu`,e)),t.button.title=`菜单`;let n=Rt.createSider(S);n.button.appendChild(o(`activity`,e)),n.button.title=`活动`;let r=Bt.createSider(B,V);e.addEventListener(`abort`,()=>{G.remove(),t.remove(),n.remove(),r.remove()},{once:!0})}};const Q=`${b}-tradition`,Jt=document.createElement(`header`),$=Jt.appendChild(document.createElement(`div`));$.classList.add(`${Q}-header`);const Yt=Jt.appendChild(document.createElement(`div`));Yt.classList.add(`${Q}-sidebar`);const Xt=$.appendChild(o(`menu`,!0));Xt.classList.add(`${Q}-menu-button`);const Zt=$.appendChild(document.createElement(`div`));Zt.classList.add(`${Q}-header-title`),Zt.innerText=i.title||i.company||``,$.appendChild(document.createElement(`span`));const Qt=`${Q}-menu-open`;Xt.addEventListener(`click`,()=>{document.body.classList.toggle(Qt)});function $t(){window.innerWidth>800||document.body.classList.remove(Qt)}Yt.addEventListener(`click`,e=>{e.target===e.currentTarget&&document.body.classList.remove(Qt)});var en=class extends t{},tn={components:{List:T,Pagination:st,createMenuButtons:Wt,createMenuItem:Gt,createMenuButton:Kt},pageManager:te,elements:[Jt,p],classNames:[b,`${b}-tradition`],styleFiles:[`theme-tradition.css`],home:ct,rootClassName:`${b}-root`,createPage(e){return new en(e)},renderError(e,t){Mt(e,t)},setup(e){G.addEventListener(`click`,()=>{$t()},{signal:e}),$.insertBefore(G,Zt),Jt.appendChild(S),Yt.appendChild(I),bt(!0),document.body.appendChild(B),B.setAttribute(`popover`,`auto`),V.addEventListener(`click`,()=>{B.showPopover()},{signal:e}),$.appendChild(V),e.addEventListener(`abort`,()=>{G.remove(),S.remove(),I.remove(),B.removeAttribute(`popover`),B.remove(),V.remove()},{once:!0})}};export{qt as allSider,qt as theme,tn as tradition};
749
+ //# sourceMappingURL=index.mjs.map