litos-ui 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var ms=Object.defineProperty;var _e=p=>{throw TypeError(p)};var ps=(p,g,v)=>g in p?ms(p,g,{enumerable:!0,configurable:!0,writable:!0,value:v}):p[g]=v;var a=(p,g,v)=>ps(p,typeof g!="symbol"?g+"":g,v),_t=(p,g,v)=>g.has(p)||_e("Cannot "+v);var b=(p,g,v)=>(_t(p,g,"read from private field"),v?v.call(p):g.get(p)),x=(p,g,v)=>g.has(p)?_e("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(p):g.set(p,v),wt=(p,g,v,it)=>(_t(p,g,"write to private field"),it?it.call(p,v):g.set(p,v),v),$=(p,g,v)=>(_t(p,g,"access private method"),v);(function(){"use strict";var yt,tt,J,ut,q,xt,Mt,z,k,we,Et,xe,Me,Ee,W,Le,Se,ot,Ae,ct,V,Ne,Te,ht,O,K,et,Ie,He;const p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",g="0123456789";function v(s,r=!0){return s==null?!0:(r&&typeof s=="string"?s.trim().length:s.length)===0}function it(s,r){r={isPositive:!1,isFloat:!0,...r};const t=r.isPositive?"[+]?":"[+-]?",e=r.isFloat?"([0-9]*[.])?[0-9]+":"[0-9]+";return new RegExp("^"+t+e+"$").test(s)}function B(s){if(typeof s=="object"&&s.min!=null&&s.max!=null){const r=Math.random(),t=s.hasEnd?1:0,e=r*(s.max-s.min+t)+s.min;return s.isInteger!==!1?Math.floor(e):e}else{if(typeof s=="object"&&s.length==null)throw new Error("random_length_cannot_null");let r=typeof s=="object"?s.length:s,t=p;typeof s=="object"&&s.hasLetter===!1&&(t=g);const e=Array.from({length:r},()=>t.charAt(B({min:0,max:t.length-1,hasEnd:!0}))).join("");return typeof s=="object"&&s.firstIsZero===!1&&e.indexOf("0")===0?B(s):e}}function Lt(s,r){return typeof s=="string"?(r||document).querySelectorAll(s):[s]}function X(s,r){return Lt(s,r)}function L(s,r={},t){let e;if(s.startsWith("<")&&s.endsWith(">")?e=new DOMParser().parseFromString(s,"text/html").body.firstElementChild:e=document.createElement(s),e&&r)for(const i in r){const n=r[i];i==="class"?e.className=F(n):i==="style"?e.style.cssText=Y(n):i==="textContent"&&n?e.textContent=n:i==="innerHTML"&&n?e.innerHTML=n:i==="outerHTML"&&n?e.outerHTML=n:n===!0?e.setAttribute(i,""):typeof n=="string"&&e.setAttribute(i,n)}return e}function St(s,r={},t){return L(s,r)}function u(s,r){const t=Lt(s,r);return t.length>0?t[0]:void 0}function S(s,r){s.classList.add(r)}function I(s,r){s.classList.remove(r)}function At(s,r){return s.classList.contains(r)}function _(s,r,t,e){s.addEventListener(r,t,e)}function w(s,r,t,e){s.removeEventListener(r,t,e)}function rt(s,r){for(let t=0,e=s.length;t<e&&r(s[t],t)!==!0;t++);}function ft(s,r,t){const e=s.getAttribute(r);if(t==null)return e;const i=typeof t;return e==null?t:i==="bigint"||i==="number"?e===""?t:Number(e):i==="boolean"?e===""||e==="1"||e==="true"||e===r:i==="object"?e===""?t:JSON.parse(e):e}function ze(s,r=null,t="horizontal"){r==null&&(r=s.offsetParent);const e=r.getBoundingClientRect(),i=s.getBoundingClientRect();let n=t==="horizontal"?i.left:i.top,l=t==="horizontal"?i.right:i.bottom,o=t==="horizontal"?e.left:e.top,c=t==="horizontal"?e.right:e.bottom;return n>=o&&l<=c}function F(s){let r="";if(Array.isArray(s))for(let t=0,e=s.length;t<e;t++){const i=s[t];i&&(r+=`${i} `)}else if(typeof s=="string")r=s;else for(const t in s)s[t]&&(r+=`${t} `);return r.trim()}function Y(s){let r="";if(Array.isArray(s))for(let t=0,e=s.length;t<e;t++){const i=s[t];i&&(r+=`${i};`)}else if(typeof s=="string")r=s;else for(const t in s){const e=s[t];e&&(r+=`${t}:${e};`)}return r}function nt(s,r,t="set"){for(let e=0,i=r.length;e<i;e++){const n=r[e];t==="set"?s.style.setProperty(n[0],n[1]):s.style.removeProperty(n[0])}}function Nt(s,r,t="enter",e){const i=t==="enter"?"from":"to";let n="",l="";const o=[];if(typeof r=="string")n=`${r}-${t}-${i}`,l=`${r}-${t}-active`;else for(let c=0,h=r.length;c<h;c++){const d=r[c];d.length>=3&&o.push(`${d[0]} ${d[2]}`)}t==="enter"?n?(s.classList.add(n),setTimeout(()=>{s.classList.add(l),requestAnimationFrame(()=>{s.classList.remove(n)})},0)):(nt(s,r,"set"),setTimeout(()=>{o.length>0&&s.style.setProperty("transition",o.join(", ")),requestAnimationFrame(()=>{nt(s,r,"remove")})},0)):n?(s.classList.add(l),requestAnimationFrame(()=>{s.classList.add(n)})):(o.length>0&&s.style.setProperty("transition",o.join(", ")),requestAnimationFrame(()=>{nt(s,r,"set")})),s.addEventListener("transitionend",()=>{n?(s.classList.remove(l),requestAnimationFrame(()=>{s.classList.remove(n)})):(s.style.removeProperty("transition"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{nt(s,r,"remove")})})),e&&e()},{once:!0})}let Ve=-1,Tt={prefix:"l"};function f(s,r){const t=Array.isArray(s)?s:[s];for(const e of t){const i=`${Tt.prefix}-${e.baseName}`;customElements.get(i)||customElements.define(i,e)}}function It(){return`${Tt.prefix}-${++Ve}`}function A(s,r,t){if(s==null)return r;switch(typeof r){case"boolean":return s===""||s==="true"||s==="1"||s===t;case"number":return Number(s);default:return s}}function M(s){const r=s.attributes;for(const t of r){const{name:e,value:i}=t;if(e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("_")||e.startsWith("$"))continue;const l=e.split("-").map((c,h)=>h===0?c:c[0].toUpperCase()+c.slice(1)).join(""),o=A(i,s[l],e);s[l]=o,e==="value"&&(s._resetValue=o)}}function H(s,r){let t=" ";return r===!0?t=` ${s}`:typeof r=="string"&&!v(r)&&(t=` ${s}="${r}"`),t}function Fe(s){return s.map(t=>H(t[0],t[1])).join("")}function Re(s,r){for(const t of r){const e=t[1],i=t[0];e===!0?s.setAttribute(i,""):typeof e=="string"&&!v(e)&&s.setAttribute(i,e)}}function mt(s,r,t,e,i=10){let n=0;return t==="top"?n=r.height+i:t==="bottom"?n=-(s.height+i):(t==="left"||t==="right")&&(e===""?n=r.height/2-s.height/2:e==="end"&&(n=r.height-s.height)),n}function pt(s,r,t,e,i=10){let n=0;return t==="left"?n=r.width+i:t==="right"?n=-(s.width+i):(t==="top"||t==="bottom")&&(e===""?n=r.width/2-s.width/2:e==="end"&&(n=r.width-s.width)),n}function Be(s,r,t,e,i,n,l,o,c=10,h="absolute"){const d=window.innerHeight+n-10,y=window.innerWidth+i-10;let R=s.top+n-o;R+r.height>d&&(t==="left"||t==="right"?e="end":t="top",o=mt(s,r,t,e,c),R=s.top+n-o),R<n&&(t==="left"||t==="right"?e="start":t="bottom");let T=s.left+i-l;return T+r.width>y&&(t==="top"||t==="bottom"?e="end":t="left",l=pt(s,r,t,e,c),T=s.left+i-l),T<i&&(t==="top"||t==="bottom"?e="start":t="right"),h==="fixed"&&(o=mt(s,r,t,e,c),l=pt(s,r,t,e,c),T=s.left+i-l,R=s.top+n-o),{x:T,y:R,mainAlign:t,crossAlign:e}}class N extends HTMLElement{constructor(t=!0){super();a(this,"rendered",!1);t&&this.attachShadow({mode:"open"})}static get observedAttributes(){return[]}attributeChangedCallback(t,e,i){}get shadow(){return this.shadowRoot}get root(){return this.shadowRoot||this}createStyle(t){const e=document.createElement("style");e.textContent=t.trim(),this.root.appendChild(e)}createLink(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,this.root.appendChild(e)}loadStyle(t){{let e=document.querySelector("#litos-ui-style");e?this.createLink(e.href):queueMicrotask(()=>{e=document.querySelector("#litos-ui-style"),e&&this.createLink(e.href)})}}loadExternalStyle(t){}loadStyleText(t){this.createStyle(t)}getAttr(t,e){return ft(this,t,e)}appendToRoot(t){if(t)if(typeof t=="string"){let e=document.createElement("div");e.innerHTML=t,this.root.append(...e.children),e=void 0}else t.length?this.root.append(...t):this.root.append(t)}connectedCallback(){this.appendToRoot(this.render()),this.rendered=!0}disconnectedCallback(){this.root.innerHTML="",this.rendered=!1}render(){}}a(N,"baseName","base-component");class C extends N{constructor(){super();a(this,"useLink");a(this,"viewBox");this.useLink=!1,this.viewBox="0 0 1024 1024"}connectedCallback(){this.loadStyle(["icon"]),this.render(),this.rendered=!0}render(){const t=this.createEl("svg"),e=this.getAttr("useLink",this.useLink),i=this.getAttr("viewBox",this.viewBox);t.classList.add("l-icon"),e||t.setAttribute("viewBox",i);const n=this.renderChildren();if(typeof n=="string")if(n===""){const l=this.children,o=[];for(let c=0,h=l.length;c<h;c++){const d=l[c];o.push(d.outerHTML)}t.innerHTML=o.join("")}else t.innerHTML=n;else t.append(n);this.shadow.appendChild(t)}renderChildren(){return""}createEl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}a(C,"baseName","base-icon");let bt=(yt=class extends C{renderChildren(){return'<path d="M520.665 64.564a29.244 29.244 0 0 0-7.071-.894c-16.211 0-29.35 13.14-29.35 29.35 0 15.83 12.538 28.696 28.223 29.293v.073c.375 0 .751-.014 1.127-.014 216.493 0 389.629 173.942 389.629 390.433 0 216.496-173.136 388.827-389.63 388.827s-389.63-172.333-389.63-388.829c0-.27.01-.536.01-.804h-.01c0-16.209-13.141-29.35-29.35-29.35s-29.35 13.139-29.35 29.35c0 .055.007.11.007.164-.001.214-.007.425-.007.64 0 247.609 200.722 448.331 448.33 448.331 247.607 0 448.33-200.722 448.33-448.33-.002-245.242-196.917-444.456-441.258-448.24z" fill="currentColor"></path>'}},a(yt,"baseName","loading-icon"),yt);const at=2,qe=.16,Pe=.05,je=.05,De=.15,We=/rgba?\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)/,Ht=/^#(?:([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})|([0-9A-Fa-f]{1})([0-9A-Fa-f]{1})([0-9A-Fa-f]{1}))$/;function Oe(s){return s.r!=null&&s.g!=null&&s.b!=null}function zt(s){return s.h!=null&&s.s!=null&&s.v!=null}function Ke(s){let r=s.match(We);if(r!=null){const t=parseInt(r[1].trim()),e=parseInt(r[2].trim()),i=parseInt(r[3].trim());if(isNaN(t)||isNaN(e)||isNaN(i))throw new Error("Invalid RGB color.");let n=1;return r[4]!=null&&(n=parseFloat(r[4].trim()),isNaN(n)&&(n=1)),{r:t,g:e,b:i,a:n}}}function Ye(s){const r=s.match(Ht);if(r!=null){const t=r[4]!==void 0,e=parseInt(t?r[4]+r[4]:r[1],16),i=parseInt(t?r[5]+r[5]:r[2],16),n=parseInt(t?r[6]+r[6]:r[3],16);return{r:e,g:i,b:n}}}function gt(s){if(typeof s=="string"){let r=Ye(s);if(r==null&&(r=Ke(s)),r!=null)return r;throw new Error("Invalid color string")}else{if(Oe(s))return s;if(zt(s))return Ge(s);throw new Error("Invalid color")}}function Ue(s){if(zt(s))return s;const r=gt(s),t=r.r/255,e=r.g/255,i=r.b/255;let n=Math.max(t,e,i),l=Math.min(t,e,i),o=n-l,c=n,h=n===0?0:o/n,d=0;if(n===l)d=0;else switch(n){case t:d=((e-i)/o+(e<i?6:0))/6;break;case e:d=((i-t)/o+2)/6;break;case i:d=((t-e)/o+4)/6;break}return d=d*360,{h:d,s:h,v:c}}function Ge(s){let r=s.s,t=s.v;r>1&&(r/=100),t>1&&(t/=100);const e=s.h;var i=Math.floor(e/60)%6,n=e/60-Math.floor(e/60),l=t*(1-r),o=t*(1-n*r),c=t*(1-(1-n)*r);let h=0,d=0,y=0;switch(i){case 0:h=t,d=c,y=l;break;case 1:h=o,d=t,y=l;break;case 2:h=l,d=t,y=c;break;case 3:h=l,d=o,y=t;break;case 4:h=c,d=l,y=t;break;case 5:h=t,d=l,y=o;break}return h=Math.round(h*255),d=Math.round(d*255),y=Math.round(y*255),{r:h,g:d,b:y}}function Je(s,r,t){let e;return Math.round(s.h)>=60&&Math.round(s.h)<=240?e=t?Math.round(s.h)-at*r:Math.round(s.h)+at*r:e=t?Math.round(s.h)+at*r:Math.round(s.h)-at*r,e<0?e+=360:e>=360&&(e-=360),e}function Xe(s,r,t){if(s.h===0&&s.s===0)return s.s;let e;return t?e=s.s-qe*r:e=s.s+Pe*r,e>1&&(e=1),e<.06&&(e=.06),Number(e.toFixed(2))}function Ze(s,r,t){let e;return t?e=s.v+je*r:e=s.v-De*r,e>1&&(e=1),Number(e.toFixed(2))}function Vt(s){const r=t=>t.toString(16).padStart(2,"0");return`#${r(s.r)}${r(s.g)}${r(s.b)}`.toUpperCase()}function Qe(s){return typeof s=="string"&&Ht.test(s)?s:Vt(gt(s))}function U(s,r=1,t=!0){const e=Ue(s);return Qe({h:Je(e,r,t),s:Xe(e,r,t),v:Ze(e,r,t)})}f(bt);class Ft extends N{constructor(){super();a(this,"htmlType","button");a(this,"_handleClick",t=>{const e=t.target,i=ft(e,"html-type");if(i==="reset"||i==="submit"){const n=this._getForm();n&&(i==="reset"?n.reset():i==="submit"&&n.submit())}});M(this)}static get observedAttributes(){return["loading","color","disabled"]}attributeChangedCallback(t,e,i){const n=u(".l-btn",this.root);if(n)if(t==="loading")A(i,!1,t)?(S(n,"l-btn-loading"),n.disabled=!0,n.innerHTML=this.loadingBody()):(I(n,"l-btn-loading"),n.disabled=this.getAttr("disabled",!1),n.innerHTML="<slot></slot>");else if(t==="color"){const l=this.getAttr("text",!1),o=this.getAttr("ghost",!1);n.style.cssText=this.applyColor(i,l,o)}else t==="disabled"&&(n.disabled=this.getAttr("disabled",!1))}connectedCallback(){this.loadStyle(["button"]),this.loadExternalStyle(["animation"]),this.render(),(this.htmlType==="reset"||this.htmlType==="submit")&&_(this,"click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),(this.htmlType==="reset"||this.htmlType==="submit")&&w(this,"click",this._handleClick)}render(){const t=this.getAttr("type","normal"),e=document.createElement("button"),i=this.getAttr("loading",!1),n=this.getAttr("shape","default"),l=this.getAttr("text",!1),o=this.getAttr("ghost",!1),c=["l-btn",`l-btn-${t}`,this.getAttr("block",!1)?"l-btn-block":"",n==="round"?"l-btn-round":"",n==="circle"?"l-btn-circle":"",o?"l-btn-ghost":"",l?"l-btn-text":"",i?"l-btn-loading":""];e.className=F(c),e.disabled=this.getAttr("disabled",!1)||i,e.type=this.getAttr("html-type","button");const h=this.applyColor(this.getAttr("color"),l,o);h&&(e.style.cssText=h),i?e.innerHTML=this.loadingBody():e.innerHTML="<slot></slot>",e.setAttribute("part","default"),this.root.appendChild(e)}loadingBody(){const t=this.getAttr("loading-text",""),e=['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];return t===""?e.push("<slot></slot>"):e.push(`<span>${t}</span>`),e.join("")}applyColor(t,e=!1,i=!1){if(!t)return"";const n=U(t,1,!0),l=U(t,3,!1);return Y({"--l-btn-border-color":e?"transparent":t,"--l-btn-text-color":i||e?t:"#ffffff","--l-btn-hover-text-color":i||e?n:"#ffffff","--l-btn-background":i||e?"transparent":t,"--l-btn-active-text-color":i||e?l:"#ffffff","--l-btn-hover-border-color":e?"transparent":n,"--l-btn-hover-background":i||e?"transparent":n,"--l-btn-active-background":i||e?"transparent":l,"--l-btn-active-border-color":e?"transparent":l})}_getForm(){let t=this.parentElement,e;for(;t!=null;){const i=t.tagName;if(i==="L-FORM"){e=t;break}if(i==="BODY")break;t=t.parentElement}return t=null,e}}a(Ft,"baseName","button");let m;function P(s,r,t){m==null&&(m=new Map),m.has(s)||m.set(s,new Map([[r,new Set]])),m.get(s).has(r)||m.get(s).set(r,new Set),m.get(s).get(r).add(t)}function Z(s,r,t){var e,i,n,l,o,c;(i=(e=m==null?void 0:m.get(s))==null?void 0:e.get(r))==null||i.delete(t),((l=(n=m==null?void 0:m.get(s))==null?void 0:n.get(r))==null?void 0:l.size)==0&&((o=m.get(s))==null||o.delete(r)),((c=m==null?void 0:m.get(s))==null?void 0:c.size)==0&&m.delete(s),(m==null?void 0:m.size)==0&&(m=void 0)}function Rt(s){s==null?m!=null&&(m.clear(),m=void 0):m!=null&&(m.delete(s),m.size===0&&(m=void 0))}function E(s,r,...t){var i;const e=(i=m==null?void 0:m.get(s))==null?void 0:i.get(r);if(e!=null)for(const n of e)n(...t)}class Q extends N{constructor(t=!0){super();a(this,"disabled",!1);a(this,"name");a(this,"formAttrs",{});a(this,"formItemAttrs",{});a(this,"_value","");a(this,"_resetValue");a(this,"_firstPushValue",!0);a(this,"_reseting",!1);a(this,"_formAttributeChanged",(t,e,i)=>{i===this.formAttrs.formId?this.formAttrs[t]=e:this.formItemAttrs[t]=e,t==="disabled"&&this._changeDisabled()});a(this,"_resetFieldValue",()=>{this._reseting=!0,this.reset()});this._firstPushValue=t}set value(t){this.setValue(t)}get value(){return this.getValue()}setValue(t){this._value=t,this.pushValueChange()}getValue(){return this._value}static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,e,i){if(t==="disabled"){const n=A(i,!1,t);n!==this.disabled&&(this._changeDisabled(),this.disabled=n)}else this.attributeChange(t,e,i)}attributeChange(t,e,i){}connectedCallback(){const t=this._getForm();this.formAttrs=t.formAttr,this.formItemAttrs=t.formItemAttr,this.formAttrs.id&&(P(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),P(this.formAttrs.id,"reset",this._resetFieldValue),this._firstPushValue&&this.pushValueChange()),this.formItemAttrs.id&&P(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged),super.connectedCallback()}disconnectedCallback(){this.formAttrs.id&&(Z(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),Z(this.formAttrs.id,"reset",this._resetFieldValue)),this.formItemAttrs.id&&Z(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged),super.disconnectedCallback()}isDisabled(){return this.disabled===!0||this.formItemAttrs.disabled===!0?!0:this.formAttrs.disabled||!1}getName(){return this.name?this.name:this.formItemAttrs.name}_getForm(){let t=this.parentElement,e={},i={};for(;t!=null;){const n=t.tagName;if(n==="L-FORM"){const l=t.sharedAttrs;for(let o=0;o<l.length;o++){const c=l[o];e[c]=t[c]}break}if(n==="BODY")break;if(n==="L-FORM-ITEM"){const l=t.sharedAttrs;for(let o=0;o<l.length;o++){const c=l[o];i[c]=t[c]}}t=t.parentElement}return t=null,{formAttr:e,formItemAttr:i}}_changeDisabled(){}pushValueChange(){const t=this.getName();this.formAttrs.id&&t&&E(this.formAttrs.id,"valueChange",t,this._value,!this._reseting),this._reseting=!1}reset(){this.value=this._resetValue||""}}class Bt extends Q{constructor(){super();a(this,"type","text");a(this,"placeholder");a(this,"autosize",!1);a(this,"allowInput");a(this,"parser");a(this,"width");a(this,"block",!1);a(this,"error",!1);a(this,"$input");a(this,"_input",t=>{const e=t.target;let i=e.value;if(this.allowInput!=null){let n=this.allowInput.indexOf("."),l=n===-1?n:parseInt(this.allowInput.substring(n+1));i=this._numberInputParse(i,{integer:this.allowInput.includes("integer"),negative:this.allowInput.startsWith("-"),precition:l}),i=String(i),e.value=i}this.parser!=null&&(i=this.parser(i),e.value=i),this.setValue(i)});a(this,"_validateChange",(t,e)=>{const i=this.getName();if(i){const n=t===!0?!1:t[i]!=null;(e==null||e===i&&this.error!=n)&&(this.error=n,this._updateError()),Object.keys(t)[0]===i&&this.focus()}});M(this)}set value(t){this.setValue(t),this.$input!=null&&(this.$input.value=this.value)}get value(){return this.getValue()}static get observedAttributes(){return["disabled","error"]}connectedCallback(){super.connectedCallback(),this.loadStyle(["input"])}disconnectedCallback(){super.disconnectedCallback(),this.formAttrs.id&&Z(this.formAttrs.id,"validateChange",this._validateChange),w(this.$input,"input",this._input),this.$input=void 0}attributeChange(t,e,i){if(t==="error"){const n=A(i,!1,t);n!==this.error&&(this.error=n,this._updateError())}}render(){let t=H("value",this.value);const e=H("placeholder",this.placeholder),i=H("disabled",this.isDisabled()),n=F({"l-input":!0,"is-autosize":this.autosize,"is-error":this.error}),l=this.getName(),o=H("name",l),c=`${t}${o}${e}${i}`;this.shadow.innerHTML=`<input part="default" type="${this.type}" class="${n}"${c}></input>`,this.$input=u("input",this.root),_(this.$input,"input",this._input),this.style.cssText=Y(this._getStyleObj())+this.getAttr("style",""),l&&this.formAttrs.id&&P(this.formAttrs.id,"validateChange",this._validateChange)}setParser(t){this.parser=t}focus(){var t;(t=this.$input)==null||t.focus()}_changeDisabled(){this.$input!=null&&(this.$input.disabled=this.isDisabled())}_numberInputParse(t,e){let i=t,n=e.negative?"-?":"";if(e.integer){const o=i.match(new RegExp(`^(${n}\\d*)`));return o!=null?o[1]:i.substring(0,i.length-1)}const l=i.match(new RegExp(`(${n}\\d+\\.\\d{0,${e.precition}})|(${n}\\d*)`));return l!=null?i=l[1]||l[2]:i="",l!=null?l[1]||l[2]:""}_getStyleObj(){const t={};return this._isBlock()&&(t["--l-input-width"]="100%"),this.width&&(t["--l-input-width"]=this.width),t}_isBlock(){if(this.block===!0||this.formItemAttrs.innerBlock===!0||this.formAttrs.innerBlock===!0)return!0}_updateError(){this.$input&&(this.error?S(this.$input,"is-error"):I(this.$input,"is-error"))}}a(Bt,"componentName","input");class qt extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>'}}a(qt,"baseName","arrow-down-icon");class Pt extends C{renderChildren(){return'<path fill="currentColor" d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>'}}a(Pt,"baseName","arrow-left-icon");class jt extends C{renderChildren(){return'<path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>'}}a(jt,"baseName","arrow-right-icon");class Dt extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"></path>'}}a(Dt,"baseName","arrow-up-icon");class Wt extends C{renderChildren(){return'<path fill="currentColor" d="M512 320 192 704h639.936z"></path>'}}a(Wt,"baseName","caret-top-icon");class Ot extends C{renderChildren(){return'<path fill="currentColor" d="m192 384 320 384 320-384z"></path>'}}a(Ot,"baseName","caret-bottom-icon");class Kt extends C{constructor(){super();a(this,"_t");a(this,"_start");this.useLink=!0,this._t=void 0,this._start=0}renderChildren(){return""}render(){super.render()}disconnectedCallback(){this._t!=null&&(cancelAnimationFrame(this._t),this._t=void 0)}connectedCallback(){super.connectedCallback();const t=this.getAttribute("name");this._start=Date.now(),t&&this._loadIcon(t)}_loadIcon(t){Date.now()-this._start>=1e4||(this._t=requestAnimationFrame(()=>{const i=document.querySelector(`#${t}`);if(i==null){this._loadIcon(t);return}this._t=void 0;let n=i.getAttribute("viewBox");n||(n="0 0 1024 1024");const l=this.shadow.querySelector("svg");l!=null&&(l.setAttribute("viewBox",n),l.innerHTML=i.innerHTML)}))}}a(Kt,"baseName","font-icon");class Yt extends C{renderChildren(){return'<path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"></path>'}}a(Yt,"baseName","search-icon");class Ut extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"></path>'}}a(Ut,"baseName","sun-icon");class Gt extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"></path>'}}a(Gt,"baseName","moon-icon");class Jt extends C{constructor(){super()}renderChildren(){return'<path d="M1039.92888889 967.11111111L1039.92888889 56.88888889c0-40.15900445-32.65877333-72.81777778-72.81777778-72.81777778l-910.22222222 0c-40.15900445 0-72.81777778 32.65877333-72.81777778 72.81777778l0 910.22222222c0 40.15900445 32.65877333 72.81777778 72.81777778 72.81777778L967.11111111 1039.92888889c40.15900445 0 72.81777778-32.65877333 72.81777778-72.81777778zM56.88888889 56.88888889L967.11111111 56.88888889l0 910.22222222-910.22222221 0.07281778L56.88888889 56.88888889z"></path><path d="M876.08888889 349.17944888a36.40888889 36.40888889 0 0 0-36.40888889-36.40888889l-120.47701333 1e-8L719.20298668 184.32a36.40888889 36.40888889 0 0 0-72.81777779 0l0 164.85944889a36.40888889 36.40888889 0 0 0 36.40888889 36.40888889L839.68 385.58833778a36.40888889 36.40888889 0 0 0 36.40888889-36.4088889z m-156.88590221 473.27914667L719.20298667 694.04444445 839.68 694.04444445a36.40888889 36.40888889 0 1 0 0-72.81777778l-156.88590222 0a36.40888889 36.40888889 0 0 0-36.40888889 36.40888888l0 164.82304a36.40888889 36.40888889 0 1 0 72.81777779 0zM366.36444445 349.17944888L366.36444445 184.32a36.40888889 36.40888889 0 1 0-72.81777778 0l0 128.45055999-120.51342222 1e-8a36.40888889 36.40888889 0 1 0 0 72.81777778L329.95555555 385.58833778a36.40888889 36.40888889 0 0 0 36.4088889-36.4088889z m0 473.27914667L366.36444445 657.63555555a36.40888889 36.40888889 0 0 0-36.4088889-36.40888888l-156.9223111-1e-8a36.40888889 36.40888889 0 1 0 0 72.81777779L293.54666667 694.04444445l0 128.4141511a36.40888889 36.40888889 0 1 0 72.81777778 0z"></path>'}}a(Jt,"baseName","reduction-icon");class Xt extends C{constructor(){super()}renderChildren(){return'<path d="M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"></path>'}}a(Xt,"baseName","refresh-left-icon");class Zt extends C{renderChildren(){return'<path d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"></path>'}}a(Zt,"baseName","refresh-right-icon");class Qt extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10m0-1.5v-17a8.5 8.5 0 0 1 0 17"/>'}}a(Qt,"baseName","theme-default-icon");class te extends C{renderChildren(){return'<path d="M384 96a32 32 0 0 1 64 0v786.752a32 32 0 0 1-54.592 22.656L95.936 608a32 32 0 0 1 0-45.312h.128a32 32 0 0 1 45.184 0L384 805.632zm192 45.248a32 32 0 0 1 54.592-22.592L928.064 416a32 32 0 0 1 0 45.312h-.128a32 32 0 0 1-45.184 0L640 218.496V928a32 32 0 1 1-64 0V141.248z"></path>'}}a(te,"baseName","sort-icon");class ee extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path fill="currentColor" d="M12 23a11 11 0 100-22 11 11 0 000 22zM8.82 7.4L12 10.6l3.18-3.19 1.42 1.42L13.4 12l3.19 3.18-1.42 1.42L12 13.4 8.82 16.6 7.4 15.18 10.6 12 7.4 8.82 8.82 7.4z"></path>'}}a(ee,"baseName","mask-close-icon");class se extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 0C228.693333 0 0 228.693333 0 512s228.693333 512 512 512 512-228.693333 512-512S795.306667 0 512 0z m307.2 368.64L467.626667 730.453333c0 3.413333-3.413333 3.413333-3.413334 6.826667-13.653333 13.653333-37.546667 13.653333-51.2 0l-177.493333-177.493333c-13.653333-13.653333-13.653333-37.546667 0-51.2 13.653333-13.653333 37.546667-13.653333 51.2 0l150.186667 153.6 334.506666-341.333334c13.653333-13.653333 37.546667-13.653333 51.2 0 10.24 10.24 10.24 34.133333-3.413333 47.786667z m0 0"></path>'}}a(se,"baseName","success-icon");class ie extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 1024C229.234 1024 0 794.766 0 512S229.234 0 512 0s512 229.234 512 512-229.234 512-512 512z m-64.853-734.52l19.484 244.906 1.309 16.156c1.251 15.93 15.018 28.644 30.72 28.644h25.571c15.56 0 29.298-12.601 30.663-28.132l1.422-16.668 21.334-244.907c3.214-36.978-24.434-66.844-61.725-66.844h-6.627c-37.462 0-65.138 29.923-62.18 66.844zM512 801.393a66.788 66.788 0 1 0 0-133.575 66.788 66.788 0 0 0 0 133.575z"></path>'}}a(ie,"baseName","warn-icon");class re extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 64a448 448 0 110 896.064A448 448 0 01512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 01-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 017.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"></path>'}}a(re,"baseName","info-icon"),f(ee),f(se),f(ie),f(re);const G=[],ne=[["opacity","0","0.3s"],["transform","translate3d(-50%, -100%, 0)","0.3s"]];function ae(s){const r=G.findIndex(n=>n.id===s);if(r===-1)return;const t=G.splice(r,1)[0];if(t==null)return;Nt(t,ne,"leave",()=>{t.remove()});const e=15+t.offsetHeight,i=G.length;if(i!==0)for(let n=r;n<i;n++){const l=G[n],o=parseInt(l.style.top,10)-e;l.style.setProperty("top",`${o}px`)}}function ts(s){const r=document.createElement("div");r.id=s.id;const t=s.type||"info";let e=`l-message l-message-${t}`;s.customClass&&(e+=" "+s.customClass),r.className=e,r.style.setProperty("top",`${s.offset}px`),r.style.setProperty("z-index",`${s.zindex||1e3}`),s.width&&r.style.setProperty("width",s.width);let i=t;return i==="error"&&(i="mask-close"),r.innerHTML=['<div class="l-message-container">',`<l-${i}-icon class="l-message-icon"></l-${i}-icon>`,`<span class="l-message-content">${s.message}</span>`,"</div>"].join(""),r}const lt=s=>{const r=G.reduce((l,o)=>l+o.offsetHeight+15,15),t=It(),e=typeof s=="string"?{message:s}:s;e.id=t,e.offset=r;const i=ts(e);G.push(i),document.body.appendChild(i),Nt(i,ne,"enter");let n=e.duration;return n==null&&(n=3e3),n!==0&&setTimeout(()=>{ae(t)},n),t};for(const s of["info","success","error","warn","show"])lt[s]=r=>{const t=typeof r=="string"?{message:r}:r;return s!=="show"?t.type=s:t.type==null&&(t.type="info"),lt(t)};lt.close=ae;const vt={mobile:"请输入正确的手机号",same:"两次输入不一致",required:"%s为必填字段"},Ct="请输入正确的数据",j={same:/^same:(.+)$/i,mobile:/^1[345678]\d{9}$/,required:/^\S{1}.*/},$t={same(s,r){return r===s},pattern(s,r){return r==null?!1:s.test(String(r))}};class le extends Error{constructor(r,t,e){super(e),this.name="ValidateError",this.key=t,this.detail=r}}class es{constructor(r){this.rules={},this.addSchemas(r)}addSchemas(r){for(let t of r)this.rules[t.key]=this._parseSchemaRules(t)}addSchema(r){this.rules[r.key]=this._parseSchemaRules(r)}async validate(r,t=!1){return new Promise((e,i)=>{const n={};let l,o;for(let c in this.rules){let h=this._validateRule(this.rules[c],r[c],r);if(h!==""&&(h=h.replace("%s",c),n[c]=h,l=c,o=h,t))break}l==null?e(!0):i(new le(n,l,o))})}async validateKey(r,t,e){return new Promise((i,n)=>{let l=this.rules[r];if(l==null){i({key:r,value:t});return}let o=this._validateRule(l,t,e);o!==""?(o=o.replace("%s",r),n(new le({[r]:o},r,o))):i({key:r,value:t})})}_validateRule(r,t,e){let i="";for(let n of r)if(n.rule==="required"?(t==null||!$t.pattern(j.required,t))&&(i=n.message):typeof n.rule=="function"?n.rule(t)||(i=n.message):n.sameKey!=null?e!=null&&($t.same(t,e[n.sameKey])||(i=n.message)):$t.pattern(n.rule,t)||(i=n.message),i!=="")break;return i}_parseSchemaRules(r){let t=[],e=r.rules;if(r.required===!0&&t.push(...this._parseStringRule("required",r.message)),e!=null)if(typeof e=="string")t=t.concat(this._parseStringRule(e,r.message));else if(e instanceof Array)for(let i of e)typeof i=="string"?t.push(...this._parseStringRule(i,r.message)):i instanceof RegExp||typeof i=="function"?t.push({rule:i,message:r.message||Ct}):typeof i.rule=="string"?t.push(...this._parseStringRule(i.rule,i.message)):t.push({rule:i.rule,message:i.message||Ct});else t.push({rule:e,message:Ct});return t}_parseStringRule(r,t){let e=[],i=r.split("|");for(let n of i){let l=t,o=null,c;if(r==="required")o="required",l=l||t||vt.required;else if(j.same.test(n)){if(n.match(j.same)!=null){o=j.same;let d=n.match(j.same);d!=null&&(c=d[1]),l=l||vt.same}}else Object.hasOwn(j,n)&&(o=j[n],l=l||vt[n]);e.push({rule:o,message:l,sameKey:c})}return e}}class oe extends N{constructor(){super();a(this,"inline",!1);a(this,"labelPosition","right");a(this,"labelWidth");a(this,"id");a(this,"disabled",!1);a(this,"sharedAttrs",["disabled","id","innerBlock"]);a(this,"validator");a(this,"innerBlock",!1);a(this,"novalidate",!1);a(this,"_data");a(this,"emit");a(this,"ruleChange",t=>{this.validator.addSchema(t)});a(this,"_valueChange",(t,e,i=!0)=>{this._data==null&&(this._data={});const n=Object.hasOwn(this._data,t);this._data[t]=e,!this.novalidate&&n&&i&&this.validator.validateKey(t,e,this._data).then(()=>{E(this.id,"validateChange",!0,t)}).catch(l=>{E(this.id,"validateChange",l.detail,t)})});M(this),this.id==null&&(this.id=`l-f${B(3)}-${B(6)}`),this.validator=new es([]),this.emit=new CustomEvent("submit")}static get observedAttributes(){return["disabled","label-position"]}attributeChangedCallback(t,e,i){if(t==="disabled"){const n=A(i,!1,t);n!==this.disabled&&(E(this.id,"attributeChanged",t,n,this.id),this.disabled=n)}else if(t==="label-position"){const n=u("form",this.root);n&&(n.className=F(["l-form",this.inline?"l-form-inline":void 0,`l-form--${i}`]))}}connectedCallback(){this.loadStyle(["form"]),super.connectedCallback(),P(this.id,"ruleChange",this.ruleChange),P(this.id,"valueChange",this._valueChange)}disconnectedCallback(){Rt(this.id),this.validator=void 0}render(){const t=F(["l-form",this.inline?"l-form-inline":void 0,`l-form--${this.labelPosition}`]),e=Y({"--l-form-label-width":this.labelWidth?this.labelWidth:""});this.shadow.innerHTML=`<form class="${t}" style="${e}"><slot></slot></form>`}validateField(t){const e=[];if(this._data!=null){if(Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const l=t[i];e.push(this.validator.validateKey(l,this._data[l],this._data))}else e.push(this.validator.validateKey(t,this._data[t],this._data));Promise.allSettled(e).then(i=>{for(let n=0,l=i.length;n<l;n++){const o=i[n];o.status==="rejected"?E(this.id,"validateChange",o.reason.detail,o.reason.key):E(this.id,"validateChange",!0,o.value.key)}})}}clearValidate(){E(this.id,"validateChange",!0)}reset(){this.clearValidate(),E(this.id,"reset")}submit(){this.novalidate?this.dispatchEvent(this.emit):this.validate().then(t=>{t&&this.dispatchEvent(this.emit)})}async validate(){if(this._data!=null)try{return await this.validator.validate(this._data),E(this.id,"validateChange",!0),Promise.resolve(!0)}catch(t){return E(this.id,"validateChange",t.detail),Promise.resolve(!1)}return Promise.resolve(!0)}getData(){return{...this._data}}}a(oe,"baseName","form");class ce extends N{constructor(){super();a(this,"disabled",!1);a(this,"sharedAttrs",["disabled","id","name","innerBlock"]);a(this,"required",!1);a(this,"error");a(this,"label");a(this,"id");a(this,"verify");a(this,"validity");a(this,"pattern");a(this,"name");a(this,"innerBlock",!1);a(this,"labelPosition","right");a(this,"formId");a(this,"_validateChange",(t,e)=>{const i=t===!0?void 0:t[this.name];(e==null||e===this.name&&this.error!=i)&&(this.error=i,this._updateError())});M(this),this.id==null&&(this.id=`l-fi${B(3)}-${B(6)}`)}static get observedAttributes(){return["error","label","disabled"]}attributeChangedCallback(t,e,i){if(t==="error")i!=this.error&&(this.error=i,this._updateError());else if(t==="label")this.label=i,this._updateLabel();else if(t==="disabled"){const n=A(i,!1,t);n!==this.disabled&&(E(this.id,"attributeChanged",t,n,this.id),this.disabled=n)}}connectedCallback(){var t;if(super.connectedCallback(),this.loadStyle(["form"]),this.formId=this._getFormId(),this.name&&this.formId){let e=((t=this.verify)==null?void 0:t.split("|"))||[];this.pattern&&e.push(new RegExp(this.pattern));const i={key:this.name,required:this.required,message:this.validity,rules:e};E(this.formId,"ruleChange",i),P(this.formId,"validateChange",this._validateChange)}}disconnectedCallback(){Rt(this.id),this.formId&&Z(this.formId,"validateChange",this._validateChange)}setRules(t){const e={...t,key:this.name};e.required!=null&&this.required&&(e.required=!0),this.formId&&E(this.formId,"ruleChange",e)}setError(t){this.error=t}render(){const t=["l-form-item",this.required?"is-required":void 0,this.error?"is-error":void 0,`l-form-item--${this.labelPosition}`],e=this.label!=null?`<label class="l-form-item__label">${this.label}</label>`:"",i=this.error?`<div class="l-form-item__error">${this.error}</div>`:"";this.shadow.innerHTML=[`<div class="${F(t)}">${e}`,'<div class="l-form-item__content">',`<slot></slot>${i}</div></div>`].join("")}_updateError(){if(!this.rendered)return;let t=u(".l-form-item__error",this.root);if(t)this.error?t.textContent=this.error:t.remove();else if(this.error){t=document.createElement("div"),t.className="l-form-item__error",t.textContent=this.error;const i=u(".l-form-item__content",this.root);i&&i.appendChild(t)}const e=u(".l-form-item",this.root);e&&(this.error?S(e,"is-error"):I(e,"is-error"))}_updateLabel(){if(!this.rendered)return;let t=u(".l-form-item__label",this.root);if(t==null){if(this.label!=null){t=document.createElement("div"),t.className="l-form-item__label",t.textContent=this.label;const e=u(".l-form-item",this.root);e&&e.appendChild(t)}}else this.label!=null?t.textContent=this.label:t.remove()}_getFormId(){let t=this.parentElement,e;for(;t!=null;){const i=t.tagName;if(i==="L-FORM"){e=t.id;break}if(i==="BODY")break;t=t.parentElement}return t=null,e}}a(ce,"baseName","form-item");class he extends Q{constructor(){super(!1);a(this,"type");a(this,"label");a(this,"checked",!1);a(this,"_changeEvent");a(this,"_radioChange",t=>{const e=t.target;let i=e.parentElement;for(;i!=null&&!At(i,"l-radio");)i=i.parentElement;const n=u(".is-checked",this.root);n&&I(n,"is-checked"),this.value=e.value,i&&S(i,"is-checked"),this.dispatchEvent(this._changeEvent)});M(this),this._changeEvent=new CustomEvent("change")}setItems(t){this._removeEvents(),this.root.innerHTML=this._renderItems(t),this._initEvents()}connectedCallback(){super.connectedCallback(),this.loadStyle(["radio"]),this._initEvents()}disconnectedCallback(){super.disconnectedCallback(),this._removeEvents()}attributeChange(t,e,i){if(t==="checked"){const n=A(i,!1,t);this.checked=n,this.value=n;const l=u(".l-radio",this.root);if(l&&!At(l,"is-checked")){S(l,"is-checked");const o=u("input",l);o&&(o.checked=!0)}}}render(){this.getName()||(this.name=`la${B(3)}_${B(6)}`);const t=[],e=u('[slot="label"]',this),i=X("[radio-value]",this);e!=null||this.label?(this.value=this._isChecked(),e?t.push(this._renderItem("slot",void 0,this._isChecked(),"label")):t.push(this._renderItem(this.label,void 0,this._isChecked(),"label"))):i.length>0&&(rt(i,n=>{const l=n.cloneNode(!0),o=ft(n,"radio-value");t.push(this._renderItem(l.outerHTML,o,this.value===o))}),this.pushValueChange()),this.root.innerHTML=t.join("")}setValue(t){super.setValue(t);let e="";typeof t!="boolean"&&(e=`[l-value="${t}"]`);const i=u(".is-checked",this.root);i&&I(i,"is-checked");const n=u(`label${e}`,this.root);if(n){const l=u("input",n);typeof t=="boolean"?(t?S(n,"is-checked"):I(n,"is-checked"),l.checked=t):(S(n,"is-checked"),l.checked=!0)}}_renderItems(t){const e=[];for(let i=0,n=t.length;i<n;i++){const l=t[i];e.push(this._renderItem(l.label,l.value,this.value===l.value,l.labelPart))}return e.join("")}_renderItem(t,e,i=!1,n=void 0){const l=F({"l-radio":!0,"l-radio--disabled":this.isDisabled(),"l-radio--button":this.type==="button","is-checked":i}),o=H("disabled",this.isDisabled()),c=H("checked",i),h=H("value",e),y=`${H("name",this.getName())}${h}${o}${c}`,R=H("part",n),dt=H("l-value",e),T=[`<label class="${l}"${dt}>`,`<input type="radio" class="l-radio__input"${y} />`];this.type!=="button"&&T.push('<span class="l-radio__inner"></span>');let st=t==="slot"?'<slot name="label"></slot>':t;return T.push(`<div class="l-radio__label"${R}>${st}</div>`),T.push("</label>"),T.join("")}_isChecked(){return this.checked}_initEvents(){rt(X("input",this.root),t=>{_(t,"change",this._radioChange)})}_removeEvents(){rt(X("input",this.root),t=>{w(t,"change",this._radioChange)})}}a(he,"baseName","radio"),f(bt);class de extends N{constructor(){super();a(this,"finish",!1);a(this,"infinite",!0);a(this,"observer");a(this,"loadMoreEmit");a(this,"$more");M(this),this.loadMoreEmit=new CustomEvent("load-more")}static get observedAttributes(){return["finish"]}attributeChangedCallback(t,e,i){if(t==="finish"){const n=A(i,!1,t);this.finish!==n&&(this.finish=n,this._finishChange())}}connectedCallback(){this.loadStyle(["list"]),this.loadExternalStyle(["animation"]),super.connectedCallback(),this.infinite&&(this.observer=new IntersectionObserver(t=>{t[0].isIntersecting&&!this.finish&&this.dispatchEvent(this.loadMoreEmit)}),this.$more=u(".l-list-loadmore",this.root),!this.finish&&this.$more&&this.observer.observe(this.$more))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.$more&&(this.observer.unobserve(this.$more),this.$more=void 0),this.observer.disconnect(),this.observer=void 0),this.loadMoreEmit=void 0}render(){const t=["<slot></slot>"];this.infinite&&(t.push('<div class="l-list-loadmore">'),this.finish||t.push('<l-loading-icon class="l-list-icon l-rotate-anim"></l-loading-icon>'),t.push(`<span class="l-list-loadmore-text">${this._loadingText()}</span></div>`)),this.root.innerHTML=t.join("")}_loadingText(){return this.finish?"已经到底啦!":"加载中……"}_finishChange(){if(this.$more){this.observer&&(this.finish?this.observer.unobserve(this.$more):this.observer.observe(this.$more));const t=u(".l-list-loadmore-text",this.$more);t&&(t.textContent=this._loadingText());let e=u(".l-list-icon",this.$more);this.finish?e&&e.remove():e==null&&(e=document.createElement("l-loading-icon"),e.className="l-list-icon l-rotate-anim",this.$more.prepend(e))}}}a(de,"baseName","list");class ue extends N{constructor(){super();a(this,"shape","triangle-top");a(this,"background");M(this)}connectedCallback(){this.loadStyle(["polygon"]),super.connectedCallback()}render(){const t=F(["l-polygon",this.shape?`l-polygon-${this.shape}`:""]),e=Y([this.background?`--l-polygen-background: ${this.background}`:""]);this.root.innerHTML=`<div part="default" class="${t}" style="${e}"></div>`}}a(ue,"baseName","polygon");class fe extends Q{constructor(){super();a(this,"$select");a(this,"changeEmit");a(this,"_handleChange",t=>{const e=t.target.value;super.setValue(e),this.dispatchEvent(this.changeEmit)});M(this),this.changeEmit=new CustomEvent("change")}connectedCallback(){this.loadStyle(["input"]),super.connectedCallback(),this.$select=u("select",this.root),this.value&&(this.$select.value=this.value),_(this.$select,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$select&&w(this.$select,"change",this._handleChange),this.changeEmit=void 0,this.$select=void 0}render(){let t=this.innerHTML.trim();const e=Fe([["name",this.getName()],["disabled",this.isDisabled()]]);this.root.innerHTML=`<select class="l-input"${e}>${t}</select>`}_changeDisabled(){this.$select&&(this.$select.disabled=this.isDisabled())}setOptions(t){if(!this.$select)return;const e=t.map(i=>`<option value="${i.value}">${i.label}</option>`);this.$select.innerHTML=e.join("")}appendOptions(t){if(!this.$select)return;const e=document.createDocumentFragment();for(let i=0,n=t.length;i<n;i++){const l=t[i],o=document.createElement("option");o.value=l.value,o.innerHTML=l.label,e.appendChild(o)}this.$select.appendChild(e)}reset(){super.reset(),this.$select&&(this.$select.value=this.value)}setValue(t){super.setValue(t),this.$select&&(this.$select.value=this.value)}}a(fe,"baseName","select-ori");class me extends Q{constructor(){super(!1);x(this,J);a(this,"actionRender");a(this,"checkedText");a(this,"uncheckedText");x(this,tt,t=>{this.isDisabled()||(this.setValue(!this.value),this.dispatchEvent(new CustomEvent("change")))});M(this);const t=this.value?A(this.value,!1,"value"):!1;this._resetValue=t,this.value=t}connectedCallback(){this.loadStyle(["switch"]),super.connectedCallback(),this.pushValueChange(),$(this,J,ut).call(this),_(this,"click",b(this,tt))}disconnectedCallback(){super.disconnectedCallback(),w(this,"click",b(this,tt)),this.actionRender=void 0}render(){this.isDisabled()&&this.classList.add("l-switch--disabled"),this.value&&this.classList.add("l-switch--checked");const t=['<div class="l-switch-action" part="action"></div>'];if(this.checkedText||this.uncheckedText){const e=this.value?this.checkedText||"":this.uncheckedText||"";t.push(`<span class="l-switch-text">${e}</span>`)}return t.join("")}setValue(t){super.setValue(t),t?S(this,"l-switch--checked"):I(this,"l-switch--checked");const e=u(".l-switch-text",this.root);e&&(e.textContent=this.value?this.checkedText||"":this.uncheckedText||""),$(this,J,ut).call(this)}setActionRender(t){this.actionRender=t,$(this,J,ut).call(this)}}tt=new WeakMap,J=new WeakSet,ut=function(){const t=u(".l-switch-action",this.root);if(t)if(this.actionRender){const e=this.actionRender({checked:this.value});typeof e=="string"?t.innerHTML=e:t.innerHTML=e.outerHTML}else{const e=u('[slot="checked-action"]',this),i=u('[slot="unchecked-action"]',this);this.value&&e?t.innerHTML='<slot name="checked-action"></slot>':!this.value&&i&&(t.innerHTML='<slot name="unchecked-action"></slot>')}},a(me,"baseName","switch");class pe extends Q{constructor(){super();a(this,"$picker");a(this,"_value","#000000");a(this,"_handleChange",t=>{const e=t.target.value;super.setValue(e),this.dispatchEvent(new CustomEvent("change",{detail:e}))});M(this)}setValue(t){super.setValue(t),this.$picker&&(this.$picker.value=t)}connectedCallback(){this.loadStyle(["input","color_picker"]),super.connectedCallback(),this.$picker=u("input",this.root),_(this.$picker,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$picker&&(w(this.$picker,"change",this._handleChange),this.$picker=void 0)}render(){const t=document.createElement("input");return Re(t,[["value",this.value],["disabled",this.isDisabled()],["name",this.getName()],["type","color"],["class","l-input l-color-picker"]]),t}_changeDisabled(){this.$picker&&(this.$picker.disabled=this.isDisabled())}}a(pe,"baseName","color-picker");function ss(s,r,t){let e=s.target,i="";do if(t&&t.isSameNode(e)||e.tagName==="BODY"||(e.getAttribute&&(i=e.getAttribute(r)||""),i===""&&(e=e.parentNode),!e))break;while(i==="");return[i!=="__stop__"&&i!=="",i,e]}class be extends N{constructor(){super();x(this,q);a(this,"type","nav");a(this,"name");a(this,"justifyContent");a(this,"gap");a(this,"$line");a(this,"_handleClick",t=>{const[e,i]=ss(t,"l-name",this.root);e&&i!==this.name&&(this.name=i,this.dispatchEvent(new CustomEvent("change",{detail:{name:i}})),this._updateActive(),this._updateLine())});M(this),this.root}connectedCallback(){this.loadStyle(["tabbar"]),S(this,`l-tabbar--${this.type}`),!v(this.gap)&&!this.gap.startsWith("0")&&S(this,"l-tabbar-gap"),super.connectedCallback(),this._init()}static get observedAttributes(){return["name","type","justify-content","gap"]}attributeChangedCallback(t,e,i){if(t==="name"){const n=A(i,void 0);this.name=n,this._updateActive(),this._updateLine()}else if(t==="type"){const n=A(i,"nav");if(n!==this.type&&(I(this,`l-tabbar--${this.type}`),this.type=n,I(this,`l-tabbar--${n}`),n==="card")){let l=u(".l-tabbar-card-border",this.root);l||(l=L("div",{class:"l-tabbar-card-border"}),this.root.appendChild(l))}}else{const n=A(i,void 0);this[t]=n;const l=u(".l-tabbar-wrapper",this.root);l&&(l.style.cssText=$(this,q,xt).call(this)),t==="gap"&&(!v(this.gap)&&!this.gap.startsWith("0")?S(this,"l-tabbar-gap"):I(this,"l-tabbar-gap"))}}disconnectedCallback(){super.disconnectedCallback(),this._destroy()}render(){const t=X("[l-name]",this),e=document.createDocumentFragment(),i=document.createElement("div");if(i.className="l-tabbar-wrapper",i.style.cssText=$(this,q,xt).call(this),i.setAttribute("part","default"),t.length>0&&rt(t,n=>{const l=n.getAttribute("l-name");if(l){const o=n.cloneNode(!0);o.classList.add("l-tabbar-item"),l===this.name&&o.classList.add("active");const c=u("[l-icon]",o),h=X(":not([l-icon])",o);if(c){const d=L("div",{class:["l-tabbar-item-icon",h.length===0?"only":void 0]});d.appendChild(c.cloneNode(!0)),c.replaceWith(d)}i.appendChild(o)}}),e.appendChild(i),this.type==="card"){const n=L("div",{class:"l-tabbar-card-border"});e.appendChild(n)}return e}setItems(t){const e=u(".l-tabbar-wrapper",this.root);e&&(e.innerHTML="",e.appendChild($(this,q,Mt).call(this,t)))}addItems(t){const e=u(".l-tabbar-wrapper",this.root);e&&e.appendChild($(this,q,Mt).call(this,t))}_init(){_(this.root,"click",this._handleClick),setTimeout(()=>{this._updateLine()},300)}_destroy(){w(this.root,"click",this._handleClick),this.$line=void 0}_updateActive(){const t=u(".active",this.root);t&&I(t,"active");const e=u(`[l-name="${this.name}"]`,this.root);e&&S(e,"active")}_updateLine(){queueMicrotask(()=>{if(!this.name||this.type==="nav"||!this.rendered)return;const t=u(".active",this.root);if(!t)return;const e=t.offsetLeft;if(!this.$line){const i=L("div",{class:"l-tabbar--bar-line"});this.root.appendChild(i),this.$line=u(".l-tabbar--bar-line",this.root)}this.$line.style.cssText=`width:${t.offsetWidth}px;left:${e}px`,ze(t,this)||this.scrollTo({left:e,behavior:"smooth"})})}}q=new WeakSet,xt=function(){const t={};if(v(this.justifyContent)||(t["justify-content"]=this.justifyContent),!v(this.gap)){let e=this.gap;it(e,{isPositive:!0})&&(e=`${e}px`),t["--l-tabbar-item-gap"]=e}return Y(t)},Mt=function(t){const e=document.createDocumentFragment();for(let i=0,n=t.length;i<n;i++){const l=t[i],o=L("div",{class:F(["l-tabbar-item",this.name===l.name?"active":void 0]),"l-name":l.name}),c=l.icon;if(c){const d=L("div",{class:"l-tabbar-item-icon"});let y=typeof c=="string"?c:c();typeof y=="string"?d.innerHTML=y:d.appendChild(y),o.appendChild(d)}const h=l.text;if(h){let d=typeof h=="string"?h:h();typeof d=="string"?o.appendChild(L(d)):o.appendChild(d)}e.appendChild(o)}return e},a(be,"baseName","tabbar");function ge(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"auto"}async function is(s,r=!0){return new Promise(t=>{const e=document.documentElement.classList;s==null&&(s=ge());function i(){s==="light"?(e.add("light"),e.remove("dark")):s==="dark"?(e.add("dark"),e.remove("light")):e.remove("light","dark")}r&&document.startViewTransition?document.startViewTransition(()=>{i(),t(s)}):(i(),t(s))})}function rs(){let s=document.documentElement.className.match(/light|dark/);return s!=null&&(s=s[0]),s==null&&(s=localStorage.getItem("web-theme-appearance")),s==null&&(s=ge()),s}async function ns(s,r=!0,t=!0){return r===!0&&localStorage.setItem("web-theme-appearance",s??"auto"),is(s,t)}function as(s){const r=document.documentElement,t=r.className.match(/color-([0-9a-fA-F]{6})/);if(t==null){let e=getComputedStyle(r).getPropertyValue("--nt-primary-color");return e===""&&(e=localStorage.getItem("web-theme-color")),e||s}return`#${t[1]}`}async function ls(s){const r=[`--nt-primary-color: ${s};`,`--l-primary-color: ${s};`,`--nt-primary-color-dark1: ${U(s,1,!1)};`,`--l-primary-color-dark1: ${U(s,1,!1)};`];for(let e=1;e<=5;e++)r.push(`--nt-primary-color-light${e}: ${U(s,e)};`),r.push(`--l-primary-color-light${e}: ${U(s,e)};`);let t=document.getElementById("color-theme-style");return t==null&&(t=document.createElement("style"),t.id="color-theme-style",document.head.appendChild(t)),t.innerHTML=`:root{${r.join("")}}`,s}function os(s,r=!0){return r===!0&&localStorage.setItem("web-theme-color",s),ls(s)}const cs=[{value:"auto",text:"跟随系统",icon:"l-theme-default-icon"},{value:"light",text:"浅色模式",icon:"l-sun-icon"},{value:"dark",text:"深色模式",icon:"l-moon-icon"}];class ve extends N{constructor(){super();x(this,k);a(this,"type","button");a(this,"label","text");a(this,"theme");x(this,z);x(this,W,async t=>{let e;if(this.type==="button")e=this.theme==="dark"?"auto":"dark";else{const i=t.target.value;this.type!=="switch"?e=i:e=i?"dark":"light"}await ns(e),this.theme=e,this.type==="button"&&$(this,k,Et).call(this,b(this,z)),this.dispatchEvent(new CustomEvent("change",{detail:e}))});M(this),this.theme=rs()}connectedCallback(){this.loadStyle(["theme"]),super.connectedCallback(),$(this,k,Le).call(this)}disconnectedCallback(){super.disconnectedCallback(),$(this,k,Se).call(this)}render(){switch(this.type){case"select":return $(this,k,xe).call(this);case"radio":return $(this,k,Ee).call(this);case"switch":return $(this,k,Me).call(this);default:return $(this,k,we).call(this)}}}z=new WeakMap,k=new WeakSet,we=function(){const t=L("l-button",{class:"l-theme-btn l-theme-inner"});return $(this,k,Et).call(this,t),t},Et=function(t){const e=this.theme==="auto"?"sun":"moon";t.innerHTML=`<l-${e}-icon></l-${e}-icon>`},xe=function(){const t=L("l-select-ori",{class:"l-theme-inner"});t.value=this.theme;const e=['<option value="auto">跟随系统</option>','<option value="light">浅色模式</option>','<option value="dark">深色模式</option>'];return t.innerHTML=e.join(""),t},Me=function(){const t=L("l-switch",{class:"l-theme-switch l-theme-inner"});return t.value=this.theme==="dark",t.innerHTML='<l-sun-icon slot="unchecked-action"></l-sun-icon><l-moon-icon slot="checked-action"></l-moon-icon>',t},Ee=function(){const t=L("l-radio",{class:"l-theme-inner"});t.value=this.theme,t.type="button";const e=cs.map(i=>this.label==="icon"?`<${i.icon} radio-value="${i.value}"></${i.icon}>`:`<span radio-value="${i.value}">${i.text}</span>`);return t.innerHTML=e.join(""),t},W=new WeakMap,Le=function(){wt(this,z,u(".l-theme-inner",this.root)),this.type==="button"?_(b(this,z),"click",b(this,W)):_(b(this,z),"change",b(this,W))},Se=function(){b(this,z)&&(this.type==="button"?w(b(this,z),"click",b(this,W)):w(b(this,z),"change",b(this,W)),wt(this,z,void 0))},a(ve,"baseName","theme");class Ce extends N{constructor(){super();x(this,ot);a(this,"color");x(this,ct,async t=>{const e=t.detail;this.color=e,await os(e),this.dispatchEvent(new CustomEvent("change",{detail:e}))});this.color=as()||"#722ed1"}connectedCallback(){super.connectedCallback(),$(this,ot,Ae).call(this)}render(){const t=document.createElement("l-color-picker");return t.value=this.color,t}}ot=new WeakSet,Ae=function(){const t=u("l-color-picker",this.root);t&&_(t,"change",b(this,ct))},ct=new WeakMap,a(Ce,"baseName","theme-color");const D=new Map;function $e(s){for(const r of D.values())for(const t of r)hs(s,t)}function hs(s,r){const t=s.target,e=!t,i=r.el.contains(t),n=r.el===t;e||i||n||r.handler(s)}function ds(s,r){D.has(s)||D.set(s,[]);const t=D.get(s);t&&t.push({el:s,handler:r}),D.size===1&&document.addEventListener("click",$e,!0)}function us(s){D.delete(s),D.size===0&&document.removeEventListener("click",$e,!0)}class ye extends N{constructor(){super();x(this,V);a(this,"inline",!1);a(this,"placement","top");a(this,"content");a(this,"showArrow",!0);a(this,"trigger","hover");a(this,"disabled",!1);a(this,"isShow",!1);a(this,"width");a(this,"destroyOnHide",!1);a(this,"offset");a(this,"position","absolute");a(this,"theme","default");a(this,"_t");x(this,ht,t=>{t.target.id!==this.id&&this.hide()});x(this,O,t=>{this.show(t.target)});x(this,K,()=>{this.hide()});x(this,et,t=>{this.trigger==="click"?this.toggle(t.target):this.trigger==="focus"&&this.show(t.target)});M(this),this.id||(this.id=`${It()}-popover`),this.style.display=this.inline?"inline-block":"block"}connectedCallback(){this.loadStyle(["popover"]),super.connectedCallback(),this.renderContent(),$(this,V,Ne).call(this)}disconnectedCallback(){super.disconnectedCallback(),$(this,V,Te).call(this)}render(){const t=document.createElement("slot");return t.setAttribute("name","trigger"),t}renderContent(){if(!this.isShow)return;let t=u(".l-popover--content",this.root);if(t){t.style.removeProperty("display");return}if(t=St("div",{class:["l-popover--content",`l-popover-${this.placement}`,this.theme==="tooltip"?"l-popover-tooltip":void 0]}),this.offset&&(t.style.cssText="--l-popover-offset: ${this.offset}px;"),t.part="content",t.innerHTML=this.content?this.content:"<slot></slot>",this.showArrow){const e=St("div",{class:"l-popover--arrow"});t.appendChild(e)}this.trigger==="hover"&&(_(t,"mouseenter",b(this,O)),_(t,"mouseleave",b(this,K))),this.root.appendChild(t)}hideContent(){const t=u(".l-popover--content",this.root);t&&(this.destroyOnHide?(this.trigger==="hover"&&(w(t,"mouseenter",b(this,O)),w(t,"mouseleave",b(this,K))),this.root.removeChild(t)):t.style.display="none")}show(t){if(!this.disabled){if(this.isShow){$(this,V,Ie).call(this);return}this.isShow=!0,this.renderContent(),$(this,V,He).call(this,t)}}hide(){this._t=setTimeout(()=>{this.isShow=!1,this.hideContent()},50)}toggle(t){this.isShow?this.hide():this.show(t)}}V=new WeakSet,Ne=function(){const t=u('[slot="trigger"]',this);t&&(this.trigger==="hover"?(_(t,"mouseenter",b(this,O)),_(t,"mouseleave",b(this,K))):(this.trigger==="click"||this.trigger==="focus")&&(_(t,"click",b(this,et)),ds(t,b(this,ht))))},Te=function(){const t=u('[slot="trigger"]',this);t&&(this.trigger==="hover"?(w(t,"mouseenter",b(this,O)),w(t,"mouseleave",b(this,K))):(this.trigger==="click"||this.trigger==="focus")&&(w(t,"click",b(this,et)),us(t)))},ht=new WeakMap,O=new WeakMap,K=new WeakMap,et=new WeakMap,Ie=function(){this._t&&(clearTimeout(this._t),this._t=void 0)},He=function(t){let e="bottom",i="";const n=this.placement.split("-");n!=null&&(e=n[0],i=n[1]||"");let l;t==null&&(t=u('[slot="trigger"]',this));const o=u(".l-popover--content",this.root);if(o){let c=o.getBoundingClientRect();const h=t.getBoundingClientRect();let d=document.documentElement;const y=d.scrollLeft,R=d.scrollTop;this.width!=null&&(this.width==="trigger"?l=h.width:l=this.width),l!=null&&(c.width=l);const dt=mt(h,c,e,i,this.offset),T=pt(h,c,e,i,this.offset),st=Be(h,c,e,i,y,R,T,dt,this.offset);e=st.mainAlign,i=st.crossAlign,l!=null&&o.style.setProperty("width",`${l}px`);const ke=`l-popover-${e}${i===""?"":"-"+i}`,kt=o.className.split(" ");kt[1]!==ke&&(kt[1]=`${ke}`,o.className=kt.join(" "))}},a(ye,"baseName","popover"),f(ye),f(Qt),f(Ce),f(ve),f(be),f(pe),f(me),f(fe),f(ue),f(de),f(he),f(oe),f(ce),f(Ft),f(Bt),f(C),f(qt),f(Wt),f(Ot),f(Kt),f(bt),f(Yt),f(Ut),f(Gt),f(Jt),f(Xt),f(Zt),f(te),f([Pt,jt,Dt]),globalThis.LMessage=lt;function fs(){const s=document.currentScript.src,r=s.lastIndexOf("/"),e=`${s.slice(0,r+1)}litos-ui.css`,i=document.createElement("link");i.rel="stylesheet",i.href=e,i.id="litos-ui-style",document.head.appendChild(i)}fs()})();
1
+ var ms=Object.defineProperty;var _e=p=>{throw TypeError(p)};var ps=(p,g,v)=>g in p?ms(p,g,{enumerable:!0,configurable:!0,writable:!0,value:v}):p[g]=v;var a=(p,g,v)=>ps(p,typeof g!="symbol"?g+"":g,v),_t=(p,g,v)=>g.has(p)||_e("Cannot "+v);var b=(p,g,v)=>(_t(p,g,"read from private field"),v?v.call(p):g.get(p)),x=(p,g,v)=>g.has(p)?_e("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(p):g.set(p,v),wt=(p,g,v,it)=>(_t(p,g,"write to private field"),it?it.call(p,v):g.set(p,v),v),y=(p,g,v)=>(_t(p,g,"access private method"),v);(function(){"use strict";var yt,tt,J,ut,q,xt,Mt,z,k,we,Et,xe,Me,Ee,W,Le,Ae,ot,Se,ct,V,Ne,Te,ht,O,K,et,Ie,He;const p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",g="0123456789";function v(s,n=!0){return s==null?!0:(n&&typeof s=="string"?s.trim().length:s.length)===0}function it(s,n){n={isPositive:!1,isFloat:!0,...n};const t=n.isPositive?"[+]?":"[+-]?",e=n.isFloat?"([0-9]*[.])?[0-9]+":"[0-9]+";return new RegExp("^"+t+e+"$").test(s)}function B(s){if(typeof s=="object"&&s.min!=null&&s.max!=null){const n=Math.random(),t=s.hasEnd?1:0,e=n*(s.max-s.min+t)+s.min;return s.isInteger!==!1?Math.floor(e):e}else{if(typeof s=="object"&&s.length==null)throw new Error("random_length_cannot_null");let n=typeof s=="object"?s.length:s,t=p;typeof s=="object"&&s.hasLetter===!1&&(t=g);const e=Array.from({length:n},()=>t.charAt(B({min:0,max:t.length-1,hasEnd:!0}))).join("");return typeof s=="object"&&s.firstIsZero===!1&&e.indexOf("0")===0?B(s):e}}function Lt(s,n){return typeof s=="string"?(n||document).querySelectorAll(s):[s]}function X(s,n){return Lt(s,n)}function L(s,n={},t){let e;if(s.startsWith("<")&&s.endsWith(">")?e=new DOMParser().parseFromString(s,"text/html").body.firstElementChild:e=document.createElement(s),e&&n)for(const i in n){const r=n[i];i==="class"?e.className=F(r):i==="style"?e.style.cssText=Y(r):i==="textContent"&&r?e.textContent=r:i==="innerHTML"&&r?e.innerHTML=r:i==="outerHTML"&&r?e.outerHTML=r:r===!0?e.setAttribute(i,""):typeof r=="string"&&e.setAttribute(i,r)}return e}function At(s,n={},t){return L(s,n)}function u(s,n){const t=Lt(s,n);return t.length>0?t[0]:void 0}function A(s,n){s.classList.add(n)}function I(s,n){s.classList.remove(n)}function St(s,n){return s.classList.contains(n)}function _(s,n,t,e){s.addEventListener(n,t,e)}function w(s,n,t,e){s.removeEventListener(n,t,e)}function nt(s,n){for(let t=0,e=s.length;t<e&&n(s[t],t)!==!0;t++);}function ft(s,n,t){const e=s.getAttribute(n);if(t==null)return e;const i=typeof t;return e==null?t:i==="bigint"||i==="number"?e===""?t:Number(e):i==="boolean"?e===""||e==="1"||e==="true"||e===n:i==="object"?e===""?t:JSON.parse(e):e}function ze(s,n=null,t="horizontal"){n==null&&(n=s.offsetParent);const e=n.getBoundingClientRect(),i=s.getBoundingClientRect();let r=t==="horizontal"?i.left:i.top,l=t==="horizontal"?i.right:i.bottom,o=t==="horizontal"?e.left:e.top,c=t==="horizontal"?e.right:e.bottom;return r>=o&&l<=c}function F(s){let n="";if(Array.isArray(s))for(let t=0,e=s.length;t<e;t++){const i=s[t];i&&(n+=`${i} `)}else if(typeof s=="string")n=s;else for(const t in s)s[t]&&(n+=`${t} `);return n.trim()}function Y(s){let n="";if(Array.isArray(s))for(let t=0,e=s.length;t<e;t++){const i=s[t];i&&(n+=`${i};`)}else if(typeof s=="string")n=s;else for(const t in s){const e=s[t];e&&(n+=`${t}:${e};`)}return n}function rt(s,n,t="set"){for(let e=0,i=n.length;e<i;e++){const r=n[e];t==="set"?s.style.setProperty(r[0],r[1]):s.style.removeProperty(r[0])}}function Nt(s,n,t="enter",e){const i=t==="enter"?"from":"to";let r="",l="";const o=[];if(typeof n=="string")r=`${n}-${t}-${i}`,l=`${n}-${t}-active`;else for(let c=0,h=n.length;c<h;c++){const d=n[c];d.length>=3&&o.push(`${d[0]} ${d[2]}`)}t==="enter"?r?(s.classList.add(r),setTimeout(()=>{s.classList.add(l),requestAnimationFrame(()=>{s.classList.remove(r)})},0)):(rt(s,n,"set"),setTimeout(()=>{o.length>0&&s.style.setProperty("transition",o.join(", ")),requestAnimationFrame(()=>{rt(s,n,"remove")})},0)):r?(s.classList.add(l),requestAnimationFrame(()=>{s.classList.add(r)})):(o.length>0&&s.style.setProperty("transition",o.join(", ")),requestAnimationFrame(()=>{rt(s,n,"set")})),s.addEventListener("transitionend",()=>{r?(s.classList.remove(l),requestAnimationFrame(()=>{s.classList.remove(r)})):(s.style.removeProperty("transition"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{rt(s,n,"remove")})})),e&&e()},{once:!0})}let Ve=-1,Tt={prefix:"l"};function f(s,n){const t=Array.isArray(s)?s:[s];for(const e of t){const i=`${Tt.prefix}-${e.baseName}`;customElements.get(i)||customElements.define(i,e)}}function It(){return`${Tt.prefix}-${++Ve}`}function S(s,n,t){if(s==null)return n;switch(typeof n){case"boolean":return s===""||s==="true"||s==="1"||s===t;case"number":return Number(s);default:return s}}function M(s){const n=s.attributes;for(const t of n){const{name:e,value:i}=t;if(e.startsWith("data-")||e.startsWith("aria-")||e.startsWith("_")||e.startsWith("$"))continue;const l=e.split("-").map((c,h)=>h===0?c:c[0].toUpperCase()+c.slice(1)).join(""),o=S(i,s[l],e);s[l]=o,e==="value"&&(s._resetValue=o)}}function H(s,n){let t=" ";return n===!0?t=` ${s}`:typeof n=="string"&&!v(n)&&(t=` ${s}="${n}"`),t}function Fe(s){return s.map(t=>H(t[0],t[1])).join("")}function Re(s,n){for(const t of n){const e=t[1],i=t[0];e===!0?s.setAttribute(i,""):typeof e=="string"&&!v(e)&&s.setAttribute(i,e)}}function mt(s,n,t,e,i=10){let r=0;return t==="top"?r=n.height+i:t==="bottom"?r=-(s.height+i):(t==="left"||t==="right")&&(e===""?r=n.height/2-s.height/2:e==="end"&&(r=n.height-s.height)),r}function pt(s,n,t,e,i=10){let r=0;return t==="left"?r=n.width+i:t==="right"?r=-(s.width+i):(t==="top"||t==="bottom")&&(e===""?r=n.width/2-s.width/2:e==="end"&&(r=n.width-s.width)),r}function Be(s,n,t,e,i,r,l,o,c=10,h="absolute"){const d=window.innerHeight+r-10,$=window.innerWidth+i-10;let R=s.top+r-o;R+n.height>d&&(t==="left"||t==="right"?e="end":t="top",o=mt(s,n,t,e,c),R=s.top+r-o),R<r&&(t==="left"||t==="right"?e="start":t="bottom");let T=s.left+i-l;return T+n.width>$&&(t==="top"||t==="bottom"?e="end":t="left",l=pt(s,n,t,e,c),T=s.left+i-l),T<i&&(t==="top"||t==="bottom"?e="start":t="right"),h==="fixed"&&(o=mt(s,n,t,e,c),l=pt(s,n,t,e,c),T=s.left+i-l,R=s.top+r-o),{x:T,y:R,mainAlign:t,crossAlign:e}}class N extends HTMLElement{constructor(t=!0){super();a(this,"rendered",!1);t&&this.attachShadow({mode:"open"})}static get observedAttributes(){return[]}attributeChangedCallback(t,e,i){}get shadow(){return this.shadowRoot}get root(){return this.shadowRoot||this}createStyle(t){const e=document.createElement("style");e.textContent=t.trim(),this.root.appendChild(e)}createLink(t){const e=document.createElement("link");e.rel="stylesheet",e.href=t,this.root.appendChild(e)}loadStyle(t){{let e=document.querySelector("#litos-ui-style");e?this.createLink(e.href):queueMicrotask(()=>{e=document.querySelector("#litos-ui-style"),e&&this.createLink(e.href)})}}loadExternalStyle(t){}loadStyleText(t){this.createStyle(t)}getAttr(t,e){return ft(this,t,e)}appendToRoot(t){if(t)if(typeof t=="string"){let e=document.createElement("div");e.innerHTML=t,this.root.append(...e.children),e=void 0}else t.length?this.root.append(...t):this.root.append(t)}connectedCallback(){this.appendToRoot(this.render()),this.rendered=!0}disconnectedCallback(){this.root.innerHTML="",this.rendered=!1}render(){}}a(N,"baseName","base-component");class C extends N{constructor(){super();a(this,"useLink");a(this,"viewBox");this.useLink=!1,this.viewBox="0 0 1024 1024"}connectedCallback(){this.loadStyle(["icon"]),this.render(),this.rendered=!0}render(){const t=this.createEl("svg"),e=this.getAttr("useLink",this.useLink),i=this.getAttr("viewBox",this.viewBox);t.classList.add("l-icon"),e||t.setAttribute("viewBox",i);const r=this.renderChildren();if(typeof r=="string")if(r===""){const l=this.children,o=[];for(let c=0,h=l.length;c<h;c++){const d=l[c];o.push(d.outerHTML)}t.innerHTML=o.join("")}else t.innerHTML=r;else t.append(r);this.shadow.appendChild(t)}renderChildren(){return""}createEl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}a(C,"baseName","base-icon");let bt=(yt=class extends C{renderChildren(){return'<path d="M520.665 64.564a29.244 29.244 0 0 0-7.071-.894c-16.211 0-29.35 13.14-29.35 29.35 0 15.83 12.538 28.696 28.223 29.293v.073c.375 0 .751-.014 1.127-.014 216.493 0 389.629 173.942 389.629 390.433 0 216.496-173.136 388.827-389.63 388.827s-389.63-172.333-389.63-388.829c0-.27.01-.536.01-.804h-.01c0-16.209-13.141-29.35-29.35-29.35s-29.35 13.139-29.35 29.35c0 .055.007.11.007.164-.001.214-.007.425-.007.64 0 247.609 200.722 448.331 448.33 448.331 247.607 0 448.33-200.722 448.33-448.33-.002-245.242-196.917-444.456-441.258-448.24z" fill="currentColor"></path>'}},a(yt,"baseName","loading-icon"),yt);const at=2,qe=.16,Pe=.05,De=.05,je=.15,We=/rgba?\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d*\.?\d+))?\s*\)/,Ht=/^#(?:([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})|([0-9A-Fa-f]{1})([0-9A-Fa-f]{1})([0-9A-Fa-f]{1}))$/;function Oe(s){return s.r!=null&&s.g!=null&&s.b!=null}function zt(s){return s.h!=null&&s.s!=null&&s.v!=null}function Ke(s){let n=s.match(We);if(n!=null){const t=parseInt(n[1].trim()),e=parseInt(n[2].trim()),i=parseInt(n[3].trim());if(isNaN(t)||isNaN(e)||isNaN(i))throw new Error("Invalid RGB color.");let r=1;return n[4]!=null&&(r=parseFloat(n[4].trim()),isNaN(r)&&(r=1)),{r:t,g:e,b:i,a:r}}}function Ye(s){const n=s.match(Ht);if(n!=null){const t=n[4]!==void 0,e=parseInt(t?n[4]+n[4]:n[1],16),i=parseInt(t?n[5]+n[5]:n[2],16),r=parseInt(t?n[6]+n[6]:n[3],16);return{r:e,g:i,b:r}}}function gt(s){if(typeof s=="string"){let n=Ye(s);if(n==null&&(n=Ke(s)),n!=null)return n;throw new Error("Invalid color string")}else{if(Oe(s))return s;if(zt(s))return Ge(s);throw new Error("Invalid color")}}function Ue(s){if(zt(s))return s;const n=gt(s),t=n.r/255,e=n.g/255,i=n.b/255;let r=Math.max(t,e,i),l=Math.min(t,e,i),o=r-l,c=r,h=r===0?0:o/r,d=0;if(r===l)d=0;else switch(r){case t:d=((e-i)/o+(e<i?6:0))/6;break;case e:d=((i-t)/o+2)/6;break;case i:d=((t-e)/o+4)/6;break}return d=d*360,{h:d,s:h,v:c}}function Ge(s){let n=s.s,t=s.v;n>1&&(n/=100),t>1&&(t/=100);const e=s.h;var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),l=t*(1-n),o=t*(1-r*n),c=t*(1-(1-r)*n);let h=0,d=0,$=0;switch(i){case 0:h=t,d=c,$=l;break;case 1:h=o,d=t,$=l;break;case 2:h=l,d=t,$=c;break;case 3:h=l,d=o,$=t;break;case 4:h=c,d=l,$=t;break;case 5:h=t,d=l,$=o;break}return h=Math.round(h*255),d=Math.round(d*255),$=Math.round($*255),{r:h,g:d,b:$}}function Je(s,n,t){let e;return Math.round(s.h)>=60&&Math.round(s.h)<=240?e=t?Math.round(s.h)-at*n:Math.round(s.h)+at*n:e=t?Math.round(s.h)+at*n:Math.round(s.h)-at*n,e<0?e+=360:e>=360&&(e-=360),e}function Xe(s,n,t){if(s.h===0&&s.s===0)return s.s;let e;return t?e=s.s-qe*n:e=s.s+Pe*n,e>1&&(e=1),e<.06&&(e=.06),Number(e.toFixed(2))}function Ze(s,n,t){let e;return t?e=s.v+De*n:e=s.v-je*n,e>1&&(e=1),Number(e.toFixed(2))}function Vt(s){const n=t=>t.toString(16).padStart(2,"0");return`#${n(s.r)}${n(s.g)}${n(s.b)}`.toUpperCase()}function Qe(s){return typeof s=="string"&&Ht.test(s)?s:Vt(gt(s))}function U(s,n=1,t=!0){const e=Ue(s);return Qe({h:Je(e,n,t),s:Xe(e,n,t),v:Ze(e,n,t)})}f(bt);class Ft extends N{constructor(){super();a(this,"htmlType","button");a(this,"_handleClick",t=>{const e=t.target,i=ft(e,"html-type");if(i==="reset"||i==="submit"){const r=this._getForm();r&&(i==="reset"?r.reset():i==="submit"&&r.submit())}});M(this)}static get observedAttributes(){return["loading","color","disabled"]}attributeChangedCallback(t,e,i){const r=u(".l-btn",this.root);if(r)if(t==="loading")S(i,!1,t)?(A(r,"l-btn-loading"),r.disabled=!0,r.innerHTML=this.loadingBody()):(I(r,"l-btn-loading"),r.disabled=this.getAttr("disabled",!1),r.innerHTML="<slot></slot>");else if(t==="color"){const l=this.getAttr("text",!1),o=this.getAttr("ghost",!1);r.style.cssText=this.applyColor(i,l,o)}else t==="disabled"&&(r.disabled=this.getAttr("disabled",!1))}connectedCallback(){this.loadStyle(["button"]),this.loadExternalStyle(["animation"]),this.render(),(this.htmlType==="reset"||this.htmlType==="submit")&&_(this,"click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),(this.htmlType==="reset"||this.htmlType==="submit")&&w(this,"click",this._handleClick)}render(){const t=this.getAttr("type","normal"),e=document.createElement("button"),i=this.getAttr("loading",!1),r=this.getAttr("shape","default"),l=this.getAttr("text",!1),o=this.getAttr("ghost",!1),c=["l-btn",`l-btn-${t}`,this.getAttr("block",!1)?"l-btn-block":"",r==="round"?"l-btn-round":"",r==="circle"?"l-btn-circle":"",o?"l-btn-ghost":"",l?"l-btn-text":"",i?"l-btn-loading":""];e.className=F(c),e.disabled=this.getAttr("disabled",!1)||i,e.type=this.getAttr("html-type","button");const h=this.applyColor(this.getAttr("color"),l,o);h&&(e.style.cssText=h),i?e.innerHTML=this.loadingBody():e.innerHTML="<slot></slot>",e.setAttribute("part","default"),this.root.appendChild(e)}loadingBody(){const t=this.getAttr("loading-text",""),e=['<l-loading-icon class="l-rotate-anim"></l-loading-icon>'];return t===""?e.push("<slot></slot>"):e.push(`<span>${t}</span>`),e.join("")}applyColor(t,e=!1,i=!1){if(!t)return"";const r=U(t,1,!0),l=U(t,3,!1);return Y({"--l-btn-border-color":e?"transparent":t,"--l-btn-text-color":i||e?t:"#ffffff","--l-btn-hover-text-color":i||e?r:"#ffffff","--l-btn-background":i||e?"transparent":t,"--l-btn-active-text-color":i||e?l:"#ffffff","--l-btn-hover-border-color":e?"transparent":r,"--l-btn-hover-background":i||e?"transparent":r,"--l-btn-active-background":i||e?"transparent":l,"--l-btn-active-border-color":e?"transparent":l})}_getForm(){let t=this.parentElement,e;for(;t!=null;){const i=t.tagName;if(i==="L-FORM"){e=t;break}if(i==="BODY")break;t=t.parentElement}return t=null,e}}a(Ft,"baseName","button");let m;function P(s,n,t){m==null&&(m=new Map),m.has(s)||m.set(s,new Map([[n,new Set]])),m.get(s).has(n)||m.get(s).set(n,new Set),m.get(s).get(n).add(t)}function Z(s,n,t){var e,i,r,l,o,c;(i=(e=m==null?void 0:m.get(s))==null?void 0:e.get(n))==null||i.delete(t),((l=(r=m==null?void 0:m.get(s))==null?void 0:r.get(n))==null?void 0:l.size)==0&&((o=m.get(s))==null||o.delete(n)),((c=m==null?void 0:m.get(s))==null?void 0:c.size)==0&&m.delete(s),(m==null?void 0:m.size)==0&&(m=void 0)}function Rt(s){s==null?m!=null&&(m.clear(),m=void 0):m!=null&&(m.delete(s),m.size===0&&(m=void 0))}function E(s,n,...t){var i;const e=(i=m==null?void 0:m.get(s))==null?void 0:i.get(n);if(e!=null)for(const r of e)r(...t)}class Q extends N{constructor(t=!0){super();a(this,"disabled",!1);a(this,"name");a(this,"formAttrs",{});a(this,"formItemAttrs",{});a(this,"_value","");a(this,"_resetValue");a(this,"_firstPushValue",!0);a(this,"_reseting",!1);a(this,"_formAttributeChanged",(t,e,i)=>{i===this.formAttrs.formId?this.formAttrs[t]=e:this.formItemAttrs[t]=e,t==="disabled"&&this._changeDisabled()});a(this,"_resetFieldValue",()=>{this._reseting=!0,this.reset()});this._firstPushValue=t}set value(t){this.setValue(t)}get value(){return this.getValue()}setValue(t){this._value=t,this.pushValueChange()}getValue(){return this._value}static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,e,i){if(t==="disabled"){const r=S(i,!1,t);r!==this.disabled&&(this._changeDisabled(),this.disabled=r)}else this.attributeChange(t,e,i)}attributeChange(t,e,i){}connectedCallback(){const t=this._getForm();this.formAttrs=t.formAttr,this.formItemAttrs=t.formItemAttr,this.formAttrs.id&&(P(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),P(this.formAttrs.id,"reset",this._resetFieldValue),this._firstPushValue&&this.pushValueChange()),this.formItemAttrs.id&&P(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged),super.connectedCallback()}disconnectedCallback(){this.formAttrs.id&&(Z(this.formAttrs.id,"attributeChanged",this._formAttributeChanged),Z(this.formAttrs.id,"reset",this._resetFieldValue)),this.formItemAttrs.id&&Z(this.formItemAttrs.id,"attributeChanged",this._formAttributeChanged),super.disconnectedCallback()}isDisabled(){return this.disabled===!0||this.formItemAttrs.disabled===!0?!0:this.formAttrs.disabled||!1}getName(){return this.name?this.name:this.formItemAttrs.name}_getForm(){let t=this.parentElement,e={},i={};for(;t!=null;){const r=t.tagName;if(r==="L-FORM"){const l=t.sharedAttrs;for(let o=0;o<l.length;o++){const c=l[o];e[c]=t[c]}break}if(r==="BODY")break;if(r==="L-FORM-ITEM"){const l=t.sharedAttrs;for(let o=0;o<l.length;o++){const c=l[o];i[c]=t[c]}}t=t.parentElement}return t=null,{formAttr:e,formItemAttr:i}}_changeDisabled(){}pushValueChange(){const t=this.getName();this.formAttrs.id&&t&&E(this.formAttrs.id,"valueChange",t,this._value,!this._reseting),this._reseting=!1}reset(){this.value=this._resetValue||""}}class Bt extends Q{constructor(){super();a(this,"type","text");a(this,"placeholder");a(this,"autosize",!1);a(this,"allowInput");a(this,"parser");a(this,"width");a(this,"block",!1);a(this,"error",!1);a(this,"$input");a(this,"_input",t=>{const e=t.target;let i=e.value;if(this.allowInput!=null){let r=this.allowInput.indexOf("."),l=r===-1?r:parseInt(this.allowInput.substring(r+1));i=this._numberInputParse(i,{integer:this.allowInput.includes("integer"),negative:this.allowInput.startsWith("-"),precition:l}),i=String(i),e.value=i}this.parser!=null&&(i=this.parser(i),e.value=i),this.setValue(i)});a(this,"_validateChange",(t,e)=>{const i=this.getName();if(i){const r=t===!0?!1:t[i]!=null;(e==null||e===i&&this.error!=r)&&(this.error=r,this._updateError()),Object.keys(t)[0]===i&&this.focus()}});M(this)}set value(t){this.setValue(t),this.$input!=null&&(this.$input.value=this.value)}get value(){return this.getValue()}static get observedAttributes(){return["disabled","error"]}connectedCallback(){super.connectedCallback(),this.loadStyle(["input"])}disconnectedCallback(){super.disconnectedCallback(),this.formAttrs.id&&Z(this.formAttrs.id,"validateChange",this._validateChange),w(this.$input,"input",this._input),this.$input=void 0}attributeChange(t,e,i){if(t==="error"){const r=S(i,!1,t);r!==this.error&&(this.error=r,this._updateError())}}render(){let t=H("value",this.value);const e=H("placeholder",this.placeholder),i=H("disabled",this.isDisabled()),r=F({"l-input":!0,"is-autosize":this.autosize,"is-error":this.error}),l=this.getName(),o=H("name",l),c=`${t}${o}${e}${i}`;this.shadow.innerHTML=`<input part="default" type="${this.type}" class="${r}"${c}></input>`,this.$input=u("input",this.root),_(this.$input,"input",this._input),this.style.cssText=Y(this._getStyleObj())+this.getAttr("style",""),l&&this.formAttrs.id&&P(this.formAttrs.id,"validateChange",this._validateChange)}setParser(t){this.parser=t}focus(){var t;(t=this.$input)==null||t.focus()}_changeDisabled(){this.$input!=null&&(this.$input.disabled=this.isDisabled())}_numberInputParse(t,e){let i=t,r=e.negative?"-?":"";if(e.integer){const o=i.match(new RegExp(`^(${r}\\d*)`));return o!=null?o[1]:i.substring(0,i.length-1)}const l=i.match(new RegExp(`(${r}\\d+\\.\\d{0,${e.precition}})|(${r}\\d*)`));return l!=null?i=l[1]||l[2]:i="",l!=null?l[1]||l[2]:""}_getStyleObj(){const t={};return this._isBlock()&&(t["--l-input-width"]="100%"),this.width&&(t["--l-input-width"]=this.width),t}_isBlock(){if(this.block===!0||this.formItemAttrs.innerBlock===!0||this.formAttrs.innerBlock===!0)return!0}_updateError(){this.$input&&(this.error?A(this.$input,"is-error"):I(this.$input,"is-error"))}}a(Bt,"componentName","input");class qt extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>'}}a(qt,"baseName","arrow-down-icon");class Pt extends C{renderChildren(){return'<path fill="currentColor" d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>'}}a(Pt,"baseName","arrow-left-icon");class Dt extends C{renderChildren(){return'<path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>'}}a(Dt,"baseName","arrow-right-icon");class jt extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"></path>'}}a(jt,"baseName","arrow-up-icon");class Wt extends C{renderChildren(){return'<path fill="currentColor" d="M512 320 192 704h639.936z"></path>'}}a(Wt,"baseName","caret-top-icon");class Ot extends C{renderChildren(){return'<path fill="currentColor" d="m192 384 320 384 320-384z"></path>'}}a(Ot,"baseName","caret-bottom-icon");class Kt extends C{constructor(){super();a(this,"_t");a(this,"_start");this.useLink=!0,this._t=void 0,this._start=0}renderChildren(){return""}render(){super.render()}disconnectedCallback(){this._t!=null&&(cancelAnimationFrame(this._t),this._t=void 0)}connectedCallback(){super.connectedCallback();const t=this.getAttribute("name");this._start=Date.now(),t&&this._loadIcon(t)}_loadIcon(t){Date.now()-this._start>=1e4||(this._t=requestAnimationFrame(()=>{const i=document.querySelector(`#${t}`);if(i==null){this._loadIcon(t);return}this._t=void 0;let r=i.getAttribute("viewBox");r||(r="0 0 1024 1024");const l=this.shadow.querySelector("svg");l!=null&&(l.setAttribute("viewBox",r),l.innerHTML=i.innerHTML)}))}}a(Kt,"baseName","font-icon");class Yt extends C{renderChildren(){return'<path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"></path>'}}a(Yt,"baseName","search-icon");class Ut extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"></path>'}}a(Ut,"baseName","sun-icon");class Gt extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"></path>'}}a(Gt,"baseName","moon-icon");class Jt extends C{constructor(){super()}renderChildren(){return'<path d="M1039.92888889 967.11111111L1039.92888889 56.88888889c0-40.15900445-32.65877333-72.81777778-72.81777778-72.81777778l-910.22222222 0c-40.15900445 0-72.81777778 32.65877333-72.81777778 72.81777778l0 910.22222222c0 40.15900445 32.65877333 72.81777778 72.81777778 72.81777778L967.11111111 1039.92888889c40.15900445 0 72.81777778-32.65877333 72.81777778-72.81777778zM56.88888889 56.88888889L967.11111111 56.88888889l0 910.22222222-910.22222221 0.07281778L56.88888889 56.88888889z"></path><path d="M876.08888889 349.17944888a36.40888889 36.40888889 0 0 0-36.40888889-36.40888889l-120.47701333 1e-8L719.20298668 184.32a36.40888889 36.40888889 0 0 0-72.81777779 0l0 164.85944889a36.40888889 36.40888889 0 0 0 36.40888889 36.40888889L839.68 385.58833778a36.40888889 36.40888889 0 0 0 36.40888889-36.4088889z m-156.88590221 473.27914667L719.20298667 694.04444445 839.68 694.04444445a36.40888889 36.40888889 0 1 0 0-72.81777778l-156.88590222 0a36.40888889 36.40888889 0 0 0-36.40888889 36.40888888l0 164.82304a36.40888889 36.40888889 0 1 0 72.81777779 0zM366.36444445 349.17944888L366.36444445 184.32a36.40888889 36.40888889 0 1 0-72.81777778 0l0 128.45055999-120.51342222 1e-8a36.40888889 36.40888889 0 1 0 0 72.81777778L329.95555555 385.58833778a36.40888889 36.40888889 0 0 0 36.4088889-36.4088889z m0 473.27914667L366.36444445 657.63555555a36.40888889 36.40888889 0 0 0-36.4088889-36.40888888l-156.9223111-1e-8a36.40888889 36.40888889 0 1 0 0 72.81777779L293.54666667 694.04444445l0 128.4141511a36.40888889 36.40888889 0 1 0 72.81777778 0z"></path>'}}a(Jt,"baseName","reduction-icon");class Xt extends C{constructor(){super()}renderChildren(){return'<path d="M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"></path>'}}a(Xt,"baseName","refresh-left-icon");class Zt extends C{renderChildren(){return'<path d="M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"></path>'}}a(Zt,"baseName","refresh-right-icon");class Qt extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10m0-1.5v-17a8.5 8.5 0 0 1 0 17"/>'}}a(Qt,"baseName","theme-default-icon");class te extends C{renderChildren(){return'<path d="M384 96a32 32 0 0 1 64 0v786.752a32 32 0 0 1-54.592 22.656L95.936 608a32 32 0 0 1 0-45.312h.128a32 32 0 0 1 45.184 0L384 805.632zm192 45.248a32 32 0 0 1 54.592-22.592L928.064 416a32 32 0 0 1 0 45.312h-.128a32 32 0 0 1-45.184 0L640 218.496V928a32 32 0 1 1-64 0V141.248z"></path>'}}a(te,"baseName","sort-icon");class ee extends C{constructor(){super(),this.viewBox="0 0 24 24"}renderChildren(){return'<path fill="currentColor" d="M12 23a11 11 0 100-22 11 11 0 000 22zM8.82 7.4L12 10.6l3.18-3.19 1.42 1.42L13.4 12l3.19 3.18-1.42 1.42L12 13.4 8.82 16.6 7.4 15.18 10.6 12 7.4 8.82 8.82 7.4z"></path>'}}a(ee,"baseName","mask-close-icon");class se extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 0C228.693333 0 0 228.693333 0 512s228.693333 512 512 512 512-228.693333 512-512S795.306667 0 512 0z m307.2 368.64L467.626667 730.453333c0 3.413333-3.413333 3.413333-3.413334 6.826667-13.653333 13.653333-37.546667 13.653333-51.2 0l-177.493333-177.493333c-13.653333-13.653333-13.653333-37.546667 0-51.2 13.653333-13.653333 37.546667-13.653333 51.2 0l150.186667 153.6 334.506666-341.333334c13.653333-13.653333 37.546667-13.653333 51.2 0 10.24 10.24 10.24 34.133333-3.413333 47.786667z m0 0"></path>'}}a(se,"baseName","success-icon");class ie extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 1024C229.234 1024 0 794.766 0 512S229.234 0 512 0s512 229.234 512 512-229.234 512-512 512z m-64.853-734.52l19.484 244.906 1.309 16.156c1.251 15.93 15.018 28.644 30.72 28.644h25.571c15.56 0 29.298-12.601 30.663-28.132l1.422-16.668 21.334-244.907c3.214-36.978-24.434-66.844-61.725-66.844h-6.627c-37.462 0-65.138 29.923-62.18 66.844zM512 801.393a66.788 66.788 0 1 0 0-133.575 66.788 66.788 0 0 0 0 133.575z"></path>'}}a(ie,"baseName","warn-icon");class ne extends C{connectedCallback(){super.connectedCallback()}renderChildren(){return'<path fill="currentColor" d="M512 64a448 448 0 110 896.064A448 448 0 01512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 01-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 017.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"></path>'}}a(ne,"baseName","info-icon"),f(ee),f(se),f(ie),f(ne);const G=[],re=[["opacity","0","0.3s"],["transform","translate3d(-50%, -100%, 0)","0.3s"]];function ae(s){const n=G.findIndex(r=>r.id===s);if(n===-1)return;const t=G.splice(n,1)[0];if(t==null)return;Nt(t,re,"leave",()=>{t.remove()});const e=15+t.offsetHeight,i=G.length;if(i!==0)for(let r=n;r<i;r++){const l=G[r],o=parseInt(l.style.top,10)-e;l.style.setProperty("top",`${o}px`)}}function ts(s){const n=document.createElement("div");n.id=s.id;const t=s.type||"info";let e=`l-message l-message-${t}`;s.customClass&&(e+=" "+s.customClass),n.className=e,n.style.setProperty("top",`${s.offset}px`),n.style.setProperty("z-index",`${s.zindex||1e3}`),s.width&&n.style.setProperty("width",s.width);let i=t;return i==="error"&&(i="mask-close"),n.innerHTML=['<div class="l-message-container">',`<l-${i}-icon class="l-message-icon"></l-${i}-icon>`,`<span class="l-message-content">${s.message}</span>`,"</div>"].join(""),n}const lt=s=>{const n=G.reduce((l,o)=>l+o.offsetHeight+15,15),t=It(),e=typeof s=="string"?{message:s}:s;e.id=t,e.offset=n;const i=ts(e);G.push(i),document.body.appendChild(i),Nt(i,re,"enter");let r=e.duration;return r==null&&(r=3e3),r!==0&&setTimeout(()=>{ae(t)},r),t};for(const s of["info","success","error","warn","show"])lt[s]=n=>{const t=typeof n=="string"?{message:n}:n;return s!=="show"?t.type=s:t.type==null&&(t.type="info"),lt(t)};lt.close=ae;const vt={mobile:"请输入正确的手机号",same:"两次输入不一致",required:"%s为必填字段"},Ct="请输入正确的数据",D={same:/^same:(.+)$/i,mobile:/^1[345678]\d{9}$/,required:/^\S{1}.*/},$t={same(s,n){return n===s},pattern(s,n){return n==null?!1:s.test(String(n))}};class le extends Error{constructor(n,t,e){super(e),this.name="ValidateError",this.key=t,this.detail=n}}class es{constructor(n){this.rules={},this.addSchemas(n)}addSchemas(n){for(let t of n)this.rules[t.key]=this._parseSchemaRules(t)}addSchema(n){this.rules[n.key]=this._parseSchemaRules(n)}async validate(n,t=!1){return new Promise((e,i)=>{const r={};let l,o;for(let c in this.rules){let h=this._validateRule(this.rules[c],n[c],n);if(h!==""&&(h=h.replace("%s",c),r[c]=h,l=c,o=h,t))break}l==null?e(!0):i(new le(r,l,o))})}async validateKey(n,t,e){return new Promise((i,r)=>{let l=this.rules[n];if(l==null){i({key:n,value:t});return}let o=this._validateRule(l,t,e);o!==""?(o=o.replace("%s",n),r(new le({[n]:o},n,o))):i({key:n,value:t})})}_validateRule(n,t,e){let i="";for(let r of n)if(r.rule==="required"?(t==null||!$t.pattern(D.required,t))&&(i=r.message):typeof r.rule=="function"?r.rule(t)||(i=r.message):r.sameKey!=null?e!=null&&($t.same(t,e[r.sameKey])||(i=r.message)):$t.pattern(r.rule,t)||(i=r.message),i!=="")break;return i}_parseSchemaRules(n){let t=[],e=n.rules;if(n.required===!0&&t.push(...this._parseStringRule("required",n.message)),e!=null)if(typeof e=="string")t=t.concat(this._parseStringRule(e,n.message));else if(e instanceof Array)for(let i of e)typeof i=="string"?t.push(...this._parseStringRule(i,n.message)):i instanceof RegExp||typeof i=="function"?t.push({rule:i,message:n.message||Ct}):typeof i.rule=="string"?t.push(...this._parseStringRule(i.rule,i.message)):t.push({rule:i.rule,message:i.message||Ct});else t.push({rule:e,message:Ct});return t}_parseStringRule(n,t){let e=[],i=n.split("|");for(let r of i){let l=t,o=null,c;if(n==="required")o="required",l=l||t||vt.required;else if(D.same.test(r)){if(r.match(D.same)!=null){o=D.same;let d=r.match(D.same);d!=null&&(c=d[1]),l=l||vt.same}}else Object.hasOwn(D,r)&&(o=D[r],l=l||vt[r]);e.push({rule:o,message:l,sameKey:c})}return e}}class oe extends N{constructor(){super();a(this,"inline",!1);a(this,"labelPosition","right");a(this,"labelWidth");a(this,"id");a(this,"disabled",!1);a(this,"sharedAttrs",["disabled","id","innerBlock"]);a(this,"validator");a(this,"innerBlock",!1);a(this,"novalidate",!1);a(this,"_data");a(this,"emit");a(this,"ruleChange",t=>{this.validator.addSchema(t)});a(this,"_valueChange",(t,e,i=!0)=>{this._data==null&&(this._data={});const r=Object.hasOwn(this._data,t);this._data[t]=e,!this.novalidate&&r&&i&&this.validator.validateKey(t,e,this._data).then(()=>{E(this.id,"validateChange",!0,t)}).catch(l=>{E(this.id,"validateChange",l.detail,t)})});M(this),this.id==null&&(this.id=`l-f${B(3)}-${B(6)}`),this.validator=new es([]),this.emit=new CustomEvent("submit")}static get observedAttributes(){return["disabled","label-position"]}attributeChangedCallback(t,e,i){if(t==="disabled"){const r=S(i,!1,t);r!==this.disabled&&(E(this.id,"attributeChanged",t,r,this.id),this.disabled=r)}else if(t==="label-position"){const r=u("form",this.root);r&&(r.className=F(["l-form",this.inline?"l-form-inline":void 0,`l-form--${i}`]))}}connectedCallback(){this.loadStyle(["form"]),super.connectedCallback(),P(this.id,"ruleChange",this.ruleChange),P(this.id,"valueChange",this._valueChange)}disconnectedCallback(){Rt(this.id),this.validator=void 0}render(){const t=F(["l-form",this.inline?"l-form-inline":void 0,`l-form--${this.labelPosition}`]),e=Y({"--l-form-label-width":this.labelWidth?this.labelWidth:""});this.shadow.innerHTML=`<form class="${t}" style="${e}"><slot></slot></form>`}validateField(t){const e=[];if(this._data!=null){if(Array.isArray(t))for(let i=0,r=t.length;i<r;i++){const l=t[i];e.push(this.validator.validateKey(l,this._data[l],this._data))}else e.push(this.validator.validateKey(t,this._data[t],this._data));Promise.allSettled(e).then(i=>{for(let r=0,l=i.length;r<l;r++){const o=i[r];o.status==="rejected"?E(this.id,"validateChange",o.reason.detail,o.reason.key):E(this.id,"validateChange",!0,o.value.key)}})}}clearValidate(){E(this.id,"validateChange",!0)}reset(){this.clearValidate(),E(this.id,"reset")}submit(){this.novalidate?this.dispatchEvent(this.emit):this.validate().then(t=>{t&&this.dispatchEvent(this.emit)})}async validate(){if(this._data!=null)try{return await this.validator.validate(this._data),E(this.id,"validateChange",!0),Promise.resolve(!0)}catch(t){return E(this.id,"validateChange",t.detail),Promise.resolve(!1)}return Promise.resolve(!0)}getData(){return{...this._data}}}a(oe,"baseName","form");class ce extends N{constructor(){super();a(this,"disabled",!1);a(this,"sharedAttrs",["disabled","id","name","innerBlock"]);a(this,"required",!1);a(this,"error");a(this,"label");a(this,"id");a(this,"verify");a(this,"validity");a(this,"pattern");a(this,"name");a(this,"innerBlock",!1);a(this,"labelPosition","right");a(this,"formId");a(this,"_validateChange",(t,e)=>{const i=t===!0?void 0:t[this.name];(e==null||e===this.name&&this.error!=i)&&(this.error=i,this._updateError())});M(this),this.id==null&&(this.id=`l-fi${B(3)}-${B(6)}`)}static get observedAttributes(){return["error","label","disabled"]}attributeChangedCallback(t,e,i){if(t==="error")i!=this.error&&(this.error=i,this._updateError());else if(t==="label")this.label=i,this._updateLabel();else if(t==="disabled"){const r=S(i,!1,t);r!==this.disabled&&(E(this.id,"attributeChanged",t,r,this.id),this.disabled=r)}}connectedCallback(){var t;if(super.connectedCallback(),this.loadStyle(["form"]),this.formId=this._getFormId(),this.name&&this.formId){let e=((t=this.verify)==null?void 0:t.split("|"))||[];this.pattern&&e.push(new RegExp(this.pattern));const i={key:this.name,required:this.required,message:this.validity,rules:e};E(this.formId,"ruleChange",i),P(this.formId,"validateChange",this._validateChange)}}disconnectedCallback(){Rt(this.id),this.formId&&Z(this.formId,"validateChange",this._validateChange)}setRules(t){const e={...t,key:this.name};e.required!=null&&this.required&&(e.required=!0),this.formId&&E(this.formId,"ruleChange",e)}setError(t){this.error=t}render(){const t=["l-form-item",this.required?"is-required":void 0,this.error?"is-error":void 0,`l-form-item--${this.labelPosition}`],e=this.label!=null?`<label class="l-form-item__label">${this.label}</label>`:"",i=this.error?`<div class="l-form-item__error">${this.error}</div>`:"";this.shadow.innerHTML=[`<div class="${F(t)}">${e}`,'<div class="l-form-item__content">',`<slot></slot>${i}</div></div>`].join("")}_updateError(){if(!this.rendered)return;let t=u(".l-form-item__error",this.root);if(t)this.error?t.textContent=this.error:t.remove();else if(this.error){t=document.createElement("div"),t.className="l-form-item__error",t.textContent=this.error;const i=u(".l-form-item__content",this.root);i&&i.appendChild(t)}const e=u(".l-form-item",this.root);e&&(this.error?A(e,"is-error"):I(e,"is-error"))}_updateLabel(){if(!this.rendered)return;let t=u(".l-form-item__label",this.root);if(t==null){if(this.label!=null){t=document.createElement("div"),t.className="l-form-item__label",t.textContent=this.label;const e=u(".l-form-item",this.root);e&&e.appendChild(t)}}else this.label!=null?t.textContent=this.label:t.remove()}_getFormId(){let t=this.parentElement,e;for(;t!=null;){const i=t.tagName;if(i==="L-FORM"){e=t.id;break}if(i==="BODY")break;t=t.parentElement}return t=null,e}}a(ce,"baseName","form-item");class he extends Q{constructor(){super(!1);a(this,"type");a(this,"label");a(this,"checked",!1);a(this,"_changeEvent");a(this,"_radioChange",t=>{const e=t.target;let i=e.parentElement;for(;i!=null&&!St(i,"l-radio");)i=i.parentElement;const r=u(".is-checked",this.root);r&&I(r,"is-checked"),this.value=e.value,i&&A(i,"is-checked"),this.dispatchEvent(this._changeEvent)});M(this),this._changeEvent=new CustomEvent("change")}setItems(t){this._removeEvents(),this.root.innerHTML=this._renderItems(t),this._initEvents()}connectedCallback(){super.connectedCallback(),this.loadStyle(["radio"]),this._initEvents()}disconnectedCallback(){super.disconnectedCallback(),this._removeEvents()}attributeChange(t,e,i){if(t==="checked"){const r=S(i,!1,t);this.checked=r,this.value=r;const l=u(".l-radio",this.root);if(l&&!St(l,"is-checked")){A(l,"is-checked");const o=u("input",l);o&&(o.checked=!0)}}}render(){this.getName()||(this.name=`la${B(3)}_${B(6)}`);const t=[],e=u('[slot="label"]',this),i=X("[radio-value]",this);e!=null||this.label?(this.value=this._isChecked(),e?t.push(this._renderItem("slot",void 0,this._isChecked(),"label")):t.push(this._renderItem(this.label,void 0,this._isChecked(),"label"))):i.length>0&&(nt(i,r=>{const l=r.cloneNode(!0),o=ft(r,"radio-value");t.push(this._renderItem(l.outerHTML,o,this.value===o))}),this.pushValueChange()),this.root.innerHTML=t.join("")}setValue(t){super.setValue(t);let e="";typeof t!="boolean"&&(e=`[l-value="${t}"]`);const i=u(".is-checked",this.root);i&&I(i,"is-checked");const r=u(`label${e}`,this.root);if(r){const l=u("input",r);typeof t=="boolean"?(t?A(r,"is-checked"):I(r,"is-checked"),l.checked=t):(A(r,"is-checked"),l.checked=!0)}}_renderItems(t){const e=[];for(let i=0,r=t.length;i<r;i++){const l=t[i];e.push(this._renderItem(l.label,l.value,this.value===l.value,l.labelPart))}return e.join("")}_renderItem(t,e,i=!1,r=void 0){const l=F({"l-radio":!0,"l-radio--disabled":this.isDisabled(),"l-radio--button":this.type==="button","is-checked":i}),o=H("disabled",this.isDisabled()),c=H("checked",i),h=H("value",e),$=`${H("name",this.getName())}${h}${o}${c}`,R=H("part",r),dt=H("l-value",e),T=[`<label class="${l}"${dt}>`,`<input type="radio" class="l-radio__input"${$} />`];this.type!=="button"&&T.push('<span class="l-radio__inner"></span>');let st=t==="slot"?'<slot name="label"></slot>':t;return T.push(`<div class="l-radio__label"${R}>${st}</div>`),T.push("</label>"),T.join("")}_isChecked(){return this.checked}_initEvents(){nt(X("input",this.root),t=>{_(t,"change",this._radioChange)})}_removeEvents(){nt(X("input",this.root),t=>{w(t,"change",this._radioChange)})}}a(he,"baseName","radio"),f(bt);class de extends N{constructor(){super();a(this,"finish",!1);a(this,"infinite",!0);a(this,"observer");a(this,"loadMoreEmit");a(this,"$more");M(this),this.loadMoreEmit=new CustomEvent("load-more")}static get observedAttributes(){return["finish"]}attributeChangedCallback(t,e,i){if(t==="finish"){const r=S(i,!1,t);this.finish!==r&&(this.finish=r,this._finishChange())}}connectedCallback(){this.loadStyle(["list"]),this.loadExternalStyle(["animation"]),super.connectedCallback(),this.infinite&&(this.observer=new IntersectionObserver(t=>{t[0].isIntersecting&&!this.finish&&this.dispatchEvent(this.loadMoreEmit)}),this.$more=u(".l-list-loadmore",this.root),!this.finish&&this.$more&&this.observer.observe(this.$more))}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.$more&&(this.observer.unobserve(this.$more),this.$more=void 0),this.observer.disconnect(),this.observer=void 0),this.loadMoreEmit=void 0}render(){const t=["<slot></slot>"];this.infinite&&(t.push('<div class="l-list-loadmore">'),this.finish||t.push('<l-loading-icon class="l-list-icon l-rotate-anim"></l-loading-icon>'),t.push(`<span class="l-list-loadmore-text">${this._loadingText()}</span></div>`)),this.root.innerHTML=t.join("")}_loadingText(){return this.finish?"已经到底啦!":"加载中……"}_finishChange(){if(this.$more){this.observer&&(this.finish?this.observer.unobserve(this.$more):this.observer.observe(this.$more));const t=u(".l-list-loadmore-text",this.$more);t&&(t.textContent=this._loadingText());let e=u(".l-list-icon",this.$more);this.finish?e&&e.remove():e==null&&(e=document.createElement("l-loading-icon"),e.className="l-list-icon l-rotate-anim",this.$more.prepend(e))}}}a(de,"baseName","list");class ue extends N{constructor(){super();a(this,"shape","triangle-top");a(this,"background");M(this)}connectedCallback(){this.loadStyle(["polygon"]),super.connectedCallback()}render(){const t=F(["l-polygon",this.shape?`l-polygon-${this.shape}`:""]),e=Y([this.background?`--l-polygen-background: ${this.background}`:""]);this.root.innerHTML=`<div part="default" class="${t}" style="${e}"></div>`}}a(ue,"baseName","polygon");class fe extends Q{constructor(){super();a(this,"$select");a(this,"changeEmit");a(this,"_handleChange",t=>{const e=t.target.value;super.setValue(e),this.dispatchEvent(this.changeEmit)});M(this),this.changeEmit=new CustomEvent("change")}connectedCallback(){this.loadStyle(["input"]),super.connectedCallback(),this.$select=u("select",this.root),this.value&&(this.$select.value=this.value),_(this.$select,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$select&&w(this.$select,"change",this._handleChange),this.changeEmit=void 0,this.$select=void 0}render(){let t=this.innerHTML.trim();const e=Fe([["name",this.getName()],["disabled",this.isDisabled()]]);this.root.innerHTML=`<select class="l-input"${e}>${t}</select>`}_changeDisabled(){this.$select&&(this.$select.disabled=this.isDisabled())}setOptions(t){if(!this.$select)return;const e=t.map(i=>`<option value="${i.value}">${i.label}</option>`);this.$select.innerHTML=e.join("")}appendOptions(t){if(!this.$select)return;const e=document.createDocumentFragment();for(let i=0,r=t.length;i<r;i++){const l=t[i],o=document.createElement("option");o.value=l.value,o.innerHTML=l.label,e.appendChild(o)}this.$select.appendChild(e)}reset(){super.reset(),this.$select&&(this.$select.value=this.value)}setValue(t){super.setValue(t),this.$select&&(this.$select.value=this.value)}}a(fe,"baseName","select-ori");class me extends Q{constructor(){super(!1);x(this,J);a(this,"actionRender");a(this,"checkedText");a(this,"uncheckedText");x(this,tt,t=>{this.isDisabled()||(this.setValue(!this.value),this.dispatchEvent(new CustomEvent("change")))});M(this);const t=this.value?S(this.value,!1,"value"):!1;this._resetValue=t,this.value=t}connectedCallback(){this.loadStyle(["switch"]),super.connectedCallback(),this.pushValueChange(),y(this,J,ut).call(this),_(this,"click",b(this,tt))}disconnectedCallback(){super.disconnectedCallback(),w(this,"click",b(this,tt)),this.actionRender=void 0}render(){this.isDisabled()&&this.classList.add("l-switch--disabled"),this.value&&this.classList.add("l-switch--checked");const t=['<div class="l-switch-action" part="action"></div>'];if(this.checkedText||this.uncheckedText){const e=this.value?this.checkedText||"":this.uncheckedText||"";t.push(`<span class="l-switch-text">${e}</span>`)}return t.join("")}setValue(t){super.setValue(t),t?A(this,"l-switch--checked"):I(this,"l-switch--checked");const e=u(".l-switch-text",this.root);e&&(e.textContent=this.value?this.checkedText||"":this.uncheckedText||""),y(this,J,ut).call(this)}setActionRender(t){this.actionRender=t,y(this,J,ut).call(this)}}tt=new WeakMap,J=new WeakSet,ut=function(){const t=u(".l-switch-action",this.root);if(t)if(this.actionRender){const e=this.actionRender({checked:this.value});typeof e=="string"?t.innerHTML=e:t.innerHTML=e.outerHTML}else{const e=u('[slot="checked-action"]',this),i=u('[slot="unchecked-action"]',this);this.value&&e?t.innerHTML='<slot name="checked-action"></slot>':!this.value&&i&&(t.innerHTML='<slot name="unchecked-action"></slot>')}},a(me,"baseName","switch");class pe extends Q{constructor(){super();a(this,"$picker");a(this,"_value","#000000");a(this,"_handleChange",t=>{const e=t.target.value;super.setValue(e),this.dispatchEvent(new CustomEvent("change",{detail:e}))});M(this)}setValue(t){super.setValue(t),this.$picker&&(this.$picker.value=t)}connectedCallback(){this.loadStyle(["input","color_picker"]),super.connectedCallback(),this.$picker=u("input",this.root),_(this.$picker,"change",this._handleChange)}disconnectedCallback(){super.disconnectedCallback(),this.$picker&&(w(this.$picker,"change",this._handleChange),this.$picker=void 0)}render(){const t=document.createElement("input");return Re(t,[["value",this.value],["disabled",this.isDisabled()],["name",this.getName()],["type","color"],["class","l-input l-color-picker"]]),t}_changeDisabled(){this.$picker&&(this.$picker.disabled=this.isDisabled())}}a(pe,"baseName","color-picker");function ss(s,n,t){let e=s.target,i="";do if(t&&t.isSameNode(e)||e.tagName==="BODY"||(e.getAttribute&&(i=e.getAttribute(n)||""),i===""&&(e=e.parentNode),!e))break;while(i==="");return[i!=="__stop__"&&i!=="",i,e]}class be extends N{constructor(){super();x(this,q);a(this,"type","nav");a(this,"name");a(this,"gap");a(this,"$line");a(this,"_handleClick",t=>{const[e,i]=ss(t,"l-name",this.root);e&&i!==this.name&&(this.name=i,this.dispatchEvent(new CustomEvent("change",{detail:{name:i}})),this._updateActive(),this._updateLine())});M(this)}connectedCallback(){this.loadStyle(["tabbar"]),A(this,`l-tabbar--${this.type}`),!v(this.gap)&&!this.gap.startsWith("0")&&A(this,"l-tabbar-gap"),super.connectedCallback(),this._init()}static get observedAttributes(){return["name","type","justify-content","gap"]}attributeChangedCallback(t,e,i){if(t==="name"){const r=S(i,void 0);this.name=r,this._updateActive(),this._updateLine()}else if(t==="type"){const r=S(i,"nav");if(r!==this.type&&(I(this,`l-tabbar--${this.type}`),this.type=r,I(this,`l-tabbar--${r}`),r==="card")){let l=u(".l-tabbar-card-border",this.root);l||(l=L("div",{class:"l-tabbar-card-border"}),this.root.appendChild(l))}}else{const r=S(i,void 0);this[t]=r;const l=u(".l-tabbar-wrapper",this.root);l&&(l.style.cssText=y(this,q,xt).call(this)),t==="gap"&&(!v(this.gap)&&!this.gap.startsWith("0")?A(this,"l-tabbar-gap"):I(this,"l-tabbar-gap"))}}disconnectedCallback(){super.disconnectedCallback(),this._destroy()}render(){const t=document.createDocumentFragment(),e=document.createElement("div");if(e.className="l-tabbar-wrapper",e.style.cssText=y(this,q,xt).call(this),e.setAttribute("part","default"),this.getAttr("custom-content",!1)){const r=document.createElement("slot");e.appendChild(r)}else{const r=X("[l-name]",this);r.length>0&&nt(r,l=>{const o=l.getAttribute("l-name");if(o){const c=l.cloneNode(!0);c.classList.add("l-tabbar-item"),o===this.name&&c.classList.add("active");const h=u("[l-icon]",c),d=X(":not([l-icon])",c);if(h){const $=L("div",{class:["l-tabbar-item-icon",d.length===0?"only":void 0]});$.appendChild(h.cloneNode(!0)),h.replaceWith($)}e.appendChild(c)}})}if(t.appendChild(e),this.type==="card"){const r=L("div",{class:"l-tabbar-card-border"});t.appendChild(r)}return t}setItems(t){const e=u(".l-tabbar-wrapper",this.root);e&&(e.innerHTML="",e.appendChild(y(this,q,Mt).call(this,t)))}addItems(t){const e=u(".l-tabbar-wrapper",this.root);e&&e.appendChild(y(this,q,Mt).call(this,t))}_init(){_(this.root,"click",this._handleClick),setTimeout(()=>{this._updateLine()},300)}_destroy(){w(this.root,"click",this._handleClick),this.$line=void 0}_updateActive(){const e=this.getAttr("custom-content",!1)?this:this.root,i=u(".active",e);i&&I(i,"active");const r=u(`[l-name="${this.name}"]`,e);r&&A(r,"active")}_updateLine(){queueMicrotask(()=>{if(!this.name||this.type==="nav"||!this.rendered)return;const t=this.getAttr("custom-content",!1),e=u(".active",t?this:this.root);if(!e)return;const i=e.offsetLeft;if(!this.$line){const r=L("div",{class:"l-tabbar--bar-line"});r.part="line",this.root.appendChild(r),this.$line=u(".l-tabbar--bar-line",this.root)}this.$line.style.cssText=`width:${e.offsetWidth}px;left:${i}px`,ze(e,this)||this.scrollTo({left:i,behavior:"smooth"})})}}q=new WeakSet,xt=function(){const t={},e=this.getAttr("justify-content");if(v(e)||(t["justify-content"]=e),!v(this.gap)){let i=this.gap;it(i,{isPositive:!0})&&(i=`${i}px`),t["--l-tabbar-item-gap"]=i}return Y(t)},Mt=function(t){const e=document.createDocumentFragment();for(let i=0,r=t.length;i<r;i++){const l=t[i],o=L("div",{class:F(["l-tabbar-item",this.name===l.name?"active":void 0]),"l-name":l.name}),c=l.icon;if(c){const d=L("div",{class:"l-tabbar-item-icon"});let $=typeof c=="string"?c:c();typeof $=="string"?d.innerHTML=$:d.appendChild($),o.appendChild(d)}const h=l.text;if(h){let d=typeof h=="string"?h:h();typeof d=="string"?o.appendChild(L(d)):o.appendChild(d)}e.appendChild(o)}return e},a(be,"baseName","tabbar");function ge(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"auto"}async function is(s,n=!0){return new Promise(t=>{const e=document.documentElement.classList;s==null&&(s=ge());function i(){s==="light"?(e.add("light"),e.remove("dark")):s==="dark"?(e.add("dark"),e.remove("light")):e.remove("light","dark")}n&&document.startViewTransition?document.startViewTransition(()=>{i(),t(s)}):(i(),t(s))})}function ns(){let s=document.documentElement.className.match(/light|dark/);return s!=null&&(s=s[0]),s==null&&(s=localStorage.getItem("web-theme-appearance")),s==null&&(s=ge()),s}async function rs(s,n=!0,t=!0){return n===!0&&localStorage.setItem("web-theme-appearance",s??"auto"),is(s,t)}function as(s){const n=document.documentElement,t=n.className.match(/color-([0-9a-fA-F]{6})/);if(t==null){let e=getComputedStyle(n).getPropertyValue("--nt-primary-color");return e===""&&(e=localStorage.getItem("web-theme-color")),e||s}return`#${t[1]}`}async function ls(s){const n=[`--nt-primary-color: ${s};`,`--l-primary-color: ${s};`,`--nt-primary-color-dark1: ${U(s,1,!1)};`,`--l-primary-color-dark1: ${U(s,1,!1)};`];for(let e=1;e<=5;e++)n.push(`--nt-primary-color-light${e}: ${U(s,e)};`),n.push(`--l-primary-color-light${e}: ${U(s,e)};`);let t=document.getElementById("color-theme-style");return t==null&&(t=document.createElement("style"),t.id="color-theme-style",document.head.appendChild(t)),t.innerHTML=`:root{${n.join("")}}`,s}function os(s,n=!0){return n===!0&&localStorage.setItem("web-theme-color",s),ls(s)}const cs=[{value:"auto",text:"跟随系统",icon:"l-theme-default-icon"},{value:"light",text:"浅色模式",icon:"l-sun-icon"},{value:"dark",text:"深色模式",icon:"l-moon-icon"}];class ve extends N{constructor(){super();x(this,k);a(this,"type","button");a(this,"label","text");a(this,"theme");x(this,z);x(this,W,async t=>{let e;if(this.type==="button")e=this.theme==="dark"?"auto":"dark";else{const i=t.target.value;this.type!=="switch"?e=i:e=i?"dark":"light"}await rs(e),this.theme=e,this.type==="button"&&y(this,k,Et).call(this,b(this,z)),this.dispatchEvent(new CustomEvent("change",{detail:e}))});M(this),this.theme=ns()}connectedCallback(){this.loadStyle(["theme"]),super.connectedCallback(),y(this,k,Le).call(this)}disconnectedCallback(){super.disconnectedCallback(),y(this,k,Ae).call(this)}render(){switch(this.type){case"select":return y(this,k,xe).call(this);case"radio":return y(this,k,Ee).call(this);case"switch":return y(this,k,Me).call(this);default:return y(this,k,we).call(this)}}}z=new WeakMap,k=new WeakSet,we=function(){const t=L("l-button",{class:"l-theme-btn l-theme-inner"});return y(this,k,Et).call(this,t),t},Et=function(t){const e=this.theme==="auto"?"sun":"moon";t.innerHTML=`<l-${e}-icon></l-${e}-icon>`},xe=function(){const t=L("l-select-ori",{class:"l-theme-inner"});t.value=this.theme;const e=['<option value="auto">跟随系统</option>','<option value="light">浅色模式</option>','<option value="dark">深色模式</option>'];return t.innerHTML=e.join(""),t},Me=function(){const t=L("l-switch",{class:"l-theme-switch l-theme-inner"});return t.value=this.theme==="dark",t.innerHTML='<l-sun-icon slot="unchecked-action"></l-sun-icon><l-moon-icon slot="checked-action"></l-moon-icon>',t},Ee=function(){const t=L("l-radio",{class:"l-theme-inner"});t.value=this.theme,t.type="button";const e=cs.map(i=>this.label==="icon"?`<${i.icon} radio-value="${i.value}"></${i.icon}>`:`<span radio-value="${i.value}">${i.text}</span>`);return t.innerHTML=e.join(""),t},W=new WeakMap,Le=function(){wt(this,z,u(".l-theme-inner",this.root)),this.type==="button"?_(b(this,z),"click",b(this,W)):_(b(this,z),"change",b(this,W))},Ae=function(){b(this,z)&&(this.type==="button"?w(b(this,z),"click",b(this,W)):w(b(this,z),"change",b(this,W)),wt(this,z,void 0))},a(ve,"baseName","theme");class Ce extends N{constructor(){super();x(this,ot);a(this,"color");x(this,ct,async t=>{const e=t.detail;this.color=e,await os(e),this.dispatchEvent(new CustomEvent("change",{detail:e}))});this.color=as()||"#722ed1"}connectedCallback(){super.connectedCallback(),y(this,ot,Se).call(this)}render(){const t=document.createElement("l-color-picker");return t.value=this.color,t}}ot=new WeakSet,Se=function(){const t=u("l-color-picker",this.root);t&&_(t,"change",b(this,ct))},ct=new WeakMap,a(Ce,"baseName","theme-color");const j=new Map;function $e(s){for(const n of j.values())for(const t of n)hs(s,t)}function hs(s,n){const t=s.target,e=!t,i=n.el.contains(t),r=n.el===t;e||i||r||n.handler(s)}function ds(s,n){j.has(s)||j.set(s,[]);const t=j.get(s);t&&t.push({el:s,handler:n}),j.size===1&&document.addEventListener("click",$e,!0)}function us(s){j.delete(s),j.size===0&&document.removeEventListener("click",$e,!0)}class ye extends N{constructor(){super();x(this,V);a(this,"inline",!1);a(this,"placement","top");a(this,"content");a(this,"showArrow",!0);a(this,"trigger","hover");a(this,"disabled",!1);a(this,"isShow",!1);a(this,"width");a(this,"destroyOnHide",!1);a(this,"offset");a(this,"position","absolute");a(this,"theme","default");a(this,"_t");x(this,ht,t=>{t.target.id!==this.id&&this.hide()});x(this,O,t=>{this.show(t.target)});x(this,K,()=>{this.hide()});x(this,et,t=>{this.trigger==="click"?this.toggle(t.target):this.trigger==="focus"&&this.show(t.target)});M(this),this.id||(this.id=`${It()}-popover`),this.style.display=this.inline?"inline-block":"block"}connectedCallback(){this.loadStyle(["popover"]),super.connectedCallback(),this.renderContent(),y(this,V,Ne).call(this)}disconnectedCallback(){super.disconnectedCallback(),y(this,V,Te).call(this)}render(){const t=document.createElement("slot");return t.setAttribute("name","trigger"),t}renderContent(){if(!this.isShow)return;let t=u(".l-popover--content",this.root);if(t){t.style.removeProperty("display");return}if(t=At("div",{class:["l-popover--content",`l-popover-${this.placement}`,this.theme==="tooltip"?"l-popover-tooltip":void 0]}),this.offset&&(t.style.cssText="--l-popover-offset: ${this.offset}px;"),t.part="content",t.innerHTML=this.content?this.content:"<slot></slot>",this.showArrow){const e=At("div",{class:"l-popover--arrow"});t.appendChild(e)}this.trigger==="hover"&&(_(t,"mouseenter",b(this,O)),_(t,"mouseleave",b(this,K))),this.root.appendChild(t)}hideContent(){const t=u(".l-popover--content",this.root);t&&(this.destroyOnHide?(this.trigger==="hover"&&(w(t,"mouseenter",b(this,O)),w(t,"mouseleave",b(this,K))),this.root.removeChild(t)):t.style.display="none")}show(t){if(!this.disabled){if(this.isShow){y(this,V,Ie).call(this);return}this.isShow=!0,this.renderContent(),y(this,V,He).call(this,t)}}hide(){this._t=setTimeout(()=>{this.isShow=!1,this.hideContent()},50)}toggle(t){this.isShow?this.hide():this.show(t)}}V=new WeakSet,Ne=function(){const t=u('[slot="trigger"]',this);t&&(this.trigger==="hover"?(_(t,"mouseenter",b(this,O)),_(t,"mouseleave",b(this,K))):(this.trigger==="click"||this.trigger==="focus")&&(_(t,"click",b(this,et)),ds(t,b(this,ht))))},Te=function(){const t=u('[slot="trigger"]',this);t&&(this.trigger==="hover"?(w(t,"mouseenter",b(this,O)),w(t,"mouseleave",b(this,K))):(this.trigger==="click"||this.trigger==="focus")&&(w(t,"click",b(this,et)),us(t)))},ht=new WeakMap,O=new WeakMap,K=new WeakMap,et=new WeakMap,Ie=function(){this._t&&(clearTimeout(this._t),this._t=void 0)},He=function(t){let e="bottom",i="";const r=this.placement.split("-");r!=null&&(e=r[0],i=r[1]||"");let l;t==null&&(t=u('[slot="trigger"]',this));const o=u(".l-popover--content",this.root);if(o){let c=o.getBoundingClientRect();const h=t.getBoundingClientRect();let d=document.documentElement;const $=d.scrollLeft,R=d.scrollTop;this.width!=null&&(this.width==="trigger"?l=h.width:l=this.width),l!=null&&(c.width=l);const dt=mt(h,c,e,i,this.offset),T=pt(h,c,e,i,this.offset),st=Be(h,c,e,i,$,R,T,dt,this.offset);e=st.mainAlign,i=st.crossAlign,l!=null&&o.style.setProperty("width",`${l}px`);const ke=`l-popover-${e}${i===""?"":"-"+i}`,kt=o.className.split(" ");kt[1]!==ke&&(kt[1]=`${ke}`,o.className=kt.join(" "))}},a(ye,"baseName","popover"),f(ye),f(Qt),f(Ce),f(ve),f(be),f(pe),f(me),f(fe),f(ue),f(de),f(he),f(oe),f(ce),f(Ft),f(Bt),f(C),f(qt),f(Wt),f(Ot),f(Kt),f(bt),f(Yt),f(Ut),f(Gt),f(Jt),f(Xt),f(Zt),f(te),f([Pt,Dt,jt]),globalThis.LMessage=lt;function fs(){const s=document.currentScript.src,n=s.lastIndexOf("/"),e=`${s.slice(0,n+1)}litos-ui.css`,i=document.createElement("link");i.rel="stylesheet",i.href=e,i.id="litos-ui-style",document.head.appendChild(i)}fs()})();
@@ -16,7 +16,6 @@ export default class Tabbar extends BaseComponent {
16
16
  */
17
17
  type: "nav" | "bar" | "card";
18
18
  name?: string;
19
- justifyContent?: string;
20
19
  gap?: string;
21
20
  private $line?;
22
21
  constructor();
@@ -1,41 +1,40 @@
1
- var A = Object.defineProperty;
2
- var k = (s) => {
3
- throw TypeError(s);
1
+ var L = Object.defineProperty;
2
+ var k = (n) => {
3
+ throw TypeError(n);
4
4
  };
5
- var N = (s, a, t) => a in s ? A(s, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[a] = t;
6
- var p = (s, a, t) => N(s, typeof a != "symbol" ? a + "" : a, t), w = (s, a, t) => a.has(s) || k("Cannot " + t);
7
- var x = (s, a, t) => a.has(s) ? k("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(s) : a.set(s, t);
8
- var m = (s, a, t) => (w(s, a, "access private method"), t);
9
- import { isBlank as u, isNumeric as T } from "ph-utils";
5
+ var N = (n, a, e) => a in n ? L(n, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[a] = e;
6
+ var f = (n, a, e) => N(n, typeof a != "symbol" ? a + "" : a, e), w = (n, a, e) => a.has(n) || k("Cannot " + e);
7
+ var x = (n, a, e) => a.has(n) ? k("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(n) : a.set(n, e);
8
+ var u = (n, a, e) => (w(n, a, "access private method"), e);
9
+ import { isBlank as g, isNumeric as T } from "ph-utils";
10
10
  import W from "../base.js";
11
- import { initAttr as j, parseAttrValue as C } from "../utils/index.js";
12
- import { addClass as g, removeClass as v, $one as c, create as b, $ as L, iterate as E, on as S, off as B, isVisible as D, formatStyle as I, formatClass as M } from "ph-utils/dom";
13
- function R(s, a, t) {
14
- let e = s.target, i = "";
11
+ import { initAttr as E, parseAttrValue as C } from "../utils/index.js";
12
+ import { addClass as v, removeClass as $, $one as l, create as b, $ as A, iterate as j, on as S, off as B, isVisible as D, formatStyle as I, formatClass as M } from "ph-utils/dom";
13
+ function R(n, a, e) {
14
+ let t = n.target, i = "";
15
15
  do
16
- if (t && t.isSameNode(e) || e.tagName === "BODY" || (e.getAttribute && (i = e.getAttribute(a) || ""), i === "" && (e = e.parentNode), !e)) break;
16
+ if (e && e.isSameNode(t) || t.tagName === "BODY" || (t.getAttribute && (i = t.getAttribute(a) || ""), i === "" && (t = t.parentNode), !t)) break;
17
17
  while (i === "");
18
- return [i !== "__stop__" && i !== "", i, e];
18
+ return [i !== "__stop__" && i !== "", i, t];
19
19
  }
20
- var h, y, _;
20
+ var p, y, _;
21
21
  class F extends W {
22
22
  constructor() {
23
23
  super();
24
- x(this, h);
24
+ x(this, p);
25
25
  /**
26
26
  * 标签类型:
27
27
  * 1. nav - 每一项等分排列, 类似于移动端底部的标签栏
28
28
  * 2. bar - 选项卡
29
29
  * 3. card - 卡片
30
30
  */
31
- p(this, "type", "nav");
32
- p(this, "name");
33
- p(this, "justifyContent");
34
- p(this, "gap");
35
- p(this, "$line");
36
- p(this, "_handleClick", (t) => {
37
- const [e, i] = R(t, "l-name", this.root);
38
- e && i !== this.name && (this.name = i, this.dispatchEvent(
31
+ f(this, "type", "nav");
32
+ f(this, "name");
33
+ f(this, "gap");
34
+ f(this, "$line");
35
+ f(this, "_handleClick", (e) => {
36
+ const [t, i] = R(e, "l-name", this.root);
37
+ t && i !== this.name && (this.name = i, this.dispatchEvent(
39
38
  new CustomEvent("change", {
40
39
  detail: {
41
40
  name: i
@@ -43,56 +42,63 @@ class F extends W {
43
42
  })
44
43
  ), this._updateActive(), this._updateLine());
45
44
  });
46
- j(this), this.root;
45
+ E(this);
47
46
  }
48
47
  connectedCallback() {
49
- this.loadStyle(["tabbar"]), g(this, `l-tabbar--${this.type}`), !u(this.gap) && !this.gap.startsWith("0") && g(this, "l-tabbar-gap"), super.connectedCallback(), this._init();
48
+ this.loadStyle(["tabbar"]), v(this, `l-tabbar--${this.type}`), !g(this.gap) && !this.gap.startsWith("0") && v(this, "l-tabbar-gap"), super.connectedCallback(), this._init();
50
49
  }
51
50
  static get observedAttributes() {
52
51
  return ["name", "type", "justify-content", "gap"];
53
52
  }
54
- attributeChangedCallback(t, e, i) {
55
- if (t === "name") {
56
- const r = C(i, void 0);
57
- this.name = r, this._updateActive(), this._updateLine();
58
- } else if (t === "type") {
59
- const r = C(i, "nav");
60
- if (r !== this.type && (v(this, `l-tabbar--${this.type}`), this.type = r, v(this, `l-tabbar--${r}`), r === "card")) {
61
- let n = c(".l-tabbar-card-border", this.root);
62
- n || (n = b("div", { class: "l-tabbar-card-border" }), this.root.appendChild(n));
53
+ attributeChangedCallback(e, t, i) {
54
+ if (e === "name") {
55
+ const s = C(i, void 0);
56
+ this.name = s, this._updateActive(), this._updateLine();
57
+ } else if (e === "type") {
58
+ const s = C(i, "nav");
59
+ if (s !== this.type && ($(this, `l-tabbar--${this.type}`), this.type = s, $(this, `l-tabbar--${s}`), s === "card")) {
60
+ let r = l(".l-tabbar-card-border", this.root);
61
+ r || (r = b("div", { class: "l-tabbar-card-border" }), this.root.appendChild(r));
63
62
  }
64
63
  } else {
65
- const r = C(i, void 0);
66
- this[t] = r;
67
- const n = c(".l-tabbar-wrapper", this.root);
68
- n && (n.style.cssText = m(this, h, y).call(this)), t === "gap" && (!u(this.gap) && !this.gap.startsWith("0") ? g(this, "l-tabbar-gap") : v(this, "l-tabbar-gap"));
64
+ const s = C(i, void 0);
65
+ this[e] = s;
66
+ const r = l(".l-tabbar-wrapper", this.root);
67
+ r && (r.style.cssText = u(this, p, y).call(this)), e === "gap" && (!g(this.gap) && !this.gap.startsWith("0") ? v(this, "l-tabbar-gap") : $(this, "l-tabbar-gap"));
69
68
  }
70
69
  }
71
70
  disconnectedCallback() {
72
71
  super.disconnectedCallback(), this._destroy();
73
72
  }
74
73
  render() {
75
- const t = L("[l-name]", this), e = document.createDocumentFragment(), i = document.createElement("div");
76
- if (i.className = "l-tabbar-wrapper", i.style.cssText = m(this, h, y).call(this), i.setAttribute("part", "default"), t.length > 0 && E(t, (r) => {
77
- const n = r.getAttribute("l-name");
78
- if (n) {
79
- const o = r.cloneNode(!0);
80
- o.classList.add("l-tabbar-item"), n === this.name && o.classList.add("active");
81
- const d = c("[l-icon]", o), f = L(":not([l-icon])", o);
82
- if (d) {
83
- const l = b("div", {
84
- class: [
85
- "l-tabbar-item-icon",
86
- f.length === 0 ? "only" : void 0
87
- ]
88
- });
89
- l.appendChild(d.cloneNode(!0)), d.replaceWith(l);
74
+ const e = document.createDocumentFragment(), t = document.createElement("div");
75
+ if (t.className = "l-tabbar-wrapper", t.style.cssText = u(this, p, y).call(this), t.setAttribute("part", "default"), this.getAttr("custom-content", !1)) {
76
+ const s = document.createElement("slot");
77
+ t.appendChild(s);
78
+ } else {
79
+ const s = A("[l-name]", this);
80
+ s.length > 0 && j(s, (r) => {
81
+ const h = r.getAttribute("l-name");
82
+ if (h) {
83
+ const o = r.cloneNode(!0);
84
+ o.classList.add("l-tabbar-item"), h === this.name && o.classList.add("active");
85
+ const d = l("[l-icon]", o), c = A(":not([l-icon])", o);
86
+ if (d) {
87
+ const m = b("div", {
88
+ class: [
89
+ "l-tabbar-item-icon",
90
+ c.length === 0 ? "only" : void 0
91
+ ]
92
+ });
93
+ m.appendChild(d.cloneNode(!0)), d.replaceWith(m);
94
+ }
95
+ t.appendChild(o);
90
96
  }
91
- i.appendChild(o);
92
- }
93
- }), e.appendChild(i), this.type === "card") {
94
- const r = b("div", { class: "l-tabbar-card-border" });
95
- e.appendChild(r);
97
+ });
98
+ }
99
+ if (e.appendChild(t), this.type === "card") {
100
+ const s = b("div", { class: "l-tabbar-card-border" });
101
+ e.appendChild(s);
96
102
  }
97
103
  return e;
98
104
  }
@@ -101,18 +107,18 @@ class F extends W {
101
107
  * @param items - 选项卡栏项目的数组。
102
108
  * 该方法首先清空选项卡栏的包装器元素,然后根据传入的项目数组创建并追加新的选项卡项目。
103
109
  */
104
- setItems(t) {
105
- const e = c(".l-tabbar-wrapper", this.root);
106
- e && (e.innerHTML = "", e.appendChild(m(this, h, _).call(this, t)));
110
+ setItems(e) {
111
+ const t = l(".l-tabbar-wrapper", this.root);
112
+ t && (t.innerHTML = "", t.appendChild(u(this, p, _).call(this, e)));
107
113
  }
108
114
  /**
109
115
  * 向标签栏添加项目。
110
116
  * @param items 要添加的标签栏项目数组。
111
117
  * @returns 无返回值。
112
118
  */
113
- addItems(t) {
114
- const e = c(".l-tabbar-wrapper", this.root);
115
- e && e.appendChild(m(this, h, _).call(this, t));
119
+ addItems(e) {
120
+ const t = l(".l-tabbar-wrapper", this.root);
121
+ t && t.appendChild(u(this, p, _).call(this, e));
116
122
  }
117
123
  _init() {
118
124
  S(this.root, "click", this._handleClick), setTimeout(() => {
@@ -123,10 +129,10 @@ class F extends W {
123
129
  B(this.root, "click", this._handleClick), this.$line = void 0;
124
130
  }
125
131
  _updateActive() {
126
- const t = c(".active", this.root);
127
- t && v(t, "active");
128
- const e = c(`[l-name="${this.name}"]`, this.root);
129
- e && g(e, "active");
132
+ const t = this.getAttr("custom-content", !1) ? this : this.root, i = l(".active", t);
133
+ i && $(i, "active");
134
+ const s = l(`[l-name="${this.name}"]`, t);
135
+ s && v(s, "active");
130
136
  }
131
137
  /**
132
138
  * 初始化线条的方法,在微任务队列中执行。
@@ -135,51 +141,51 @@ class F extends W {
135
141
  _updateLine() {
136
142
  queueMicrotask(() => {
137
143
  if (!this.name || this.type === "nav" || !this.rendered) return;
138
- const t = c(".active", this.root);
144
+ const e = this.getAttr("custom-content", !1), t = l(".active", e ? this : this.root);
139
145
  if (!t) return;
140
- const e = t.offsetLeft;
146
+ const i = t.offsetLeft;
141
147
  if (!this.$line) {
142
- const i = b("div", { class: "l-tabbar--bar-line" });
143
- this.root.appendChild(i), this.$line = c(".l-tabbar--bar-line", this.root);
148
+ const s = b("div", { class: "l-tabbar--bar-line" });
149
+ s.part = "line", this.root.appendChild(s), this.$line = l(".l-tabbar--bar-line", this.root);
144
150
  }
145
- this.$line.style.cssText = `width:${t.offsetWidth}px;left:${e}px`, D(t, this) || this.scrollTo({
146
- left: e,
151
+ this.$line.style.cssText = `width:${t.offsetWidth}px;left:${i}px`, D(t, this) || this.scrollTo({
152
+ left: i,
147
153
  behavior: "smooth"
148
154
  });
149
155
  });
150
156
  }
151
157
  }
152
- h = new WeakSet(), y = function() {
153
- const t = {};
154
- if (u(this.justifyContent) || (t["justify-content"] = this.justifyContent), !u(this.gap)) {
155
- let e = this.gap;
156
- T(e, { isPositive: !0 }) && (e = `${e}px`), t["--l-tabbar-item-gap"] = e;
158
+ p = new WeakSet(), y = function() {
159
+ const e = {}, t = this.getAttr("justify-content");
160
+ if (g(t) || (e["justify-content"] = t), !g(this.gap)) {
161
+ let i = this.gap;
162
+ T(i, { isPositive: !0 }) && (i = `${i}px`), e["--l-tabbar-item-gap"] = i;
157
163
  }
158
- return I(t);
159
- }, _ = function(t) {
160
- const e = document.createDocumentFragment();
161
- for (let i = 0, r = t.length; i < r; i++) {
162
- const n = t[i], o = b("div", {
164
+ return I(e);
165
+ }, _ = function(e) {
166
+ const t = document.createDocumentFragment();
167
+ for (let i = 0, s = e.length; i < s; i++) {
168
+ const r = e[i], h = b("div", {
163
169
  class: M([
164
170
  "l-tabbar-item",
165
- this.name === n.name ? "active" : void 0
171
+ this.name === r.name ? "active" : void 0
166
172
  ]),
167
- "l-name": n.name
168
- }), d = n.icon;
169
- if (d) {
170
- const l = b("div", { class: "l-tabbar-item-icon" });
171
- let $ = typeof d == "string" ? d : d();
172
- typeof $ == "string" ? l.innerHTML = $ : l.appendChild($), o.appendChild(l);
173
+ "l-name": r.name
174
+ }), o = r.icon;
175
+ if (o) {
176
+ const c = b("div", { class: "l-tabbar-item-icon" });
177
+ let m = typeof o == "string" ? o : o();
178
+ typeof m == "string" ? c.innerHTML = m : c.appendChild(m), h.appendChild(c);
173
179
  }
174
- const f = n.text;
175
- if (f) {
176
- let l = typeof f == "string" ? f : f();
177
- typeof l == "string" ? o.appendChild(b(l)) : o.appendChild(l);
180
+ const d = r.text;
181
+ if (d) {
182
+ let c = typeof d == "string" ? d : d();
183
+ typeof c == "string" ? h.appendChild(b(c)) : h.appendChild(c);
178
184
  }
179
- e.appendChild(o);
185
+ t.appendChild(h);
180
186
  }
181
- return e;
182
- }, p(F, "baseName", "tabbar");
187
+ return t;
188
+ }, f(F, "baseName", "tabbar");
183
189
  export {
184
190
  F as default,
185
191
  R as shouldEventNext
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "litos-ui",
3
3
  "description": "基于 Web Component 的 UI 组件库",
4
- "version": "0.6.2",
4
+ "version": "0.6.3",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "docs:dev": "vitepress dev docs",