@lv-saharan/omii
Version:
OMII,OMI + I ,quick web framework!
26 lines (25 loc) • 48 kB
JavaScript
var ur=Object.create;var Me=Object.defineProperty;var pr=Object.getOwnPropertyDescriptor;var hr=Object.getOwnPropertyNames;var dr=Object.getPrototypeOf,mr=Object.prototype.hasOwnProperty;var yr=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ut=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var gr=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of hr(t))!mr.call(e,n)&&n!==r&&Me(e,n,{get:()=>t[n],enumerable:!(s=pr(t,n))||s.enumerable});return e};var pt=(e,t,r)=>(r=e!=null?ur(dr(e)):{},gr(t||!e||!e.__esModule?Me(r,"default",{value:e,enumerable:!0}):r,e));var ht=(e,t,r)=>(yr(e,typeof t!="symbol"?t+"":t,r),r);var Et=ut(xt=>{(function(e){"use strict";if(e.WeakMap)return;var t=Object.prototype.hasOwnProperty,r=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{value:1}).x===1}catch{}}(),s=function(i,o,c){r?Object.defineProperty(i,o,{configurable:!0,writable:!0,value:c}):i[o]=c};e.WeakMap=function(){function i(){if(this===void 0)throw new TypeError("Constructor WeakMap requires 'new'");if(s(this,"_id",c("_WeakMap")),arguments.length>0)throw new TypeError("WeakMap iterable is not supported")}s(i.prototype,"delete",function(a){if(o(this,"delete"),!n(a))return!1;var l=a[this._id];return l&&l[0]===a?(delete a[this._id],!0):!1}),s(i.prototype,"get",function(a){if(o(this,"get"),!!n(a)){var l=a[this._id];if(l&&l[0]===a)return l[1]}}),s(i.prototype,"has",function(a){if(o(this,"has"),!n(a))return!1;var l=a[this._id];return!!(l&&l[0]===a)}),s(i.prototype,"set",function(a,l){if(o(this,"set"),!n(a))throw new TypeError("Invalid value used as weak map key");var d=a[this._id];return d&&d[0]===a?(d[1]=l,this):(s(a,this._id,[a,l]),this)});function o(a,l){if(!n(a)||!t.call(a,"_id"))throw new TypeError(l+" method called on incompatible receiver "+typeof a)}function c(a){return a+"_"+u()+"."+u()}function u(){return Math.random().toString().substring(2)}return s(i,"_polyfill",!0),i}();function n(i){return Object(i)===i}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:xt)});var Jt=ut((Cn,B)=>{B.exports=Xe;B.exports.match=jr;B.exports.regexpToFunction=Bt;B.exports.parse=Ye;B.exports.compile=Or;B.exports.tokensToFunction=Vt;B.exports.tokensToRegExp=Gt;var qt="/",Mr=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function Ye(e,t){for(var r=[],s=0,n=0,i="",o=t&&t.delimiter||qt,c=t&&t.whitelist||void 0,u=!1,a;(a=Mr.exec(e))!==null;){var l=a[0],d=a[1],h=a.index;if(i+=e.slice(n,h),n=h+l.length,d){i+=d[1],u=!0;continue}var b="",A=a[2],L=a[3],C=a[4],x=a[5];if(!u&&i.length){var y=i.length-1,S=i[y],w=c?c.indexOf(S)>-1:!0;w&&(b=S,i=i.slice(0,y))}i&&(r.push(i),i="",u=!1);var R=x==="+"||x==="*",O=x==="?"||x==="*",j=L||C,z=b||o;r.push({name:A||s++,prefix:b,delimiter:z,optional:O,repeat:R,pattern:j?Ir(j):"[^"+D(z===o?z:z+o)+"]+?"})}return(i||n<e.length)&&r.push(i+e.substr(n)),r}function Or(e,t){return Vt(Ye(e,t),t)}function jr(e,t){var r=[],s=Xe(e,r,t);return Bt(s,r)}function Bt(e,t){return function(r,s){var n=e.exec(r);if(!n)return!1;for(var i=n[0],o=n.index,c={},u=s&&s.decode||decodeURIComponent,a=1;a<n.length;a++)if(n[a]!==void 0){var l=t[a-1];l.repeat?c[l.name]=n[a].split(l.delimiter).map(function(d){return u(d,l)}):c[l.name]=u(n[a],l)}return{path:i,index:o,params:c}}}function Vt(e,t){for(var r=new Array(e.length),s=0;s<e.length;s++)typeof e[s]=="object"&&(r[s]=new RegExp("^(?:"+e[s].pattern+")$",Qe(t)));return function(n,i){for(var o="",c=i&&i.encode||encodeURIComponent,u=i?i.validate!==!1:!0,a=0;a<e.length;a++){var l=e[a];if(typeof l=="string"){o+=l;continue}var d=n?n[l.name]:void 0,h;if(Array.isArray(d)){if(!l.repeat)throw new TypeError('Expected "'+l.name+'" to not repeat, but got array');if(d.length===0){if(l.optional)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var b=0;b<d.length;b++){if(h=c(d[b],l),u&&!r[a].test(h))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'"');o+=(b===0?l.prefix:l.delimiter)+h}continue}if(typeof d=="string"||typeof d=="number"||typeof d=="boolean"){if(h=c(String(d),l),u&&!r[a].test(h))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but got "'+h+'"');o+=l.prefix+h;continue}if(!l.optional)throw new TypeError('Expected "'+l.name+'" to be '+(l.repeat?"an array":"a string"))}return o}}function D(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function Ir(e){return e.replace(/([=!:$/()])/g,"\\$1")}function Qe(e){return e&&e.sensitive?"":"i"}function Ur(e,t){if(!t)return e;var r=e.source.match(/\((?!\?)/g);if(r)for(var s=0;s<r.length;s++)t.push({name:s,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return e}function Dr(e,t,r){for(var s=[],n=0;n<e.length;n++)s.push(Xe(e[n],t,r).source);return new RegExp("(?:"+s.join("|")+")",Qe(r))}function Wr(e,t,r){return Gt(Ye(e,r),t,r)}function Gt(e,t,r){r=r||{};for(var s=r.strict,n=r.start!==!1,i=r.end!==!1,o=r.delimiter||qt,c=[].concat(r.endsWith||[]).map(D).concat("$").join("|"),u=n?"^":"",a=0;a<e.length;a++){var l=e[a];if(typeof l=="string")u+=D(l);else{var d=l.repeat?"(?:"+l.pattern+")(?:"+D(l.delimiter)+"(?:"+l.pattern+"))*":l.pattern;t&&t.push(l),l.optional?l.prefix?u+="(?:"+D(l.prefix)+"("+d+"))?":u+="("+d+")?":u+=D(l.prefix)+"("+d+")"}}if(i)s||(u+="(?:"+D(o)+")?"),u+=c==="$"?"$":"(?="+c+")";else{var h=e[e.length-1],b=typeof h=="string"?h[h.length-1]===o:h===void 0;s||(u+="(?:"+D(o)+"(?="+c+"))?"),b||(u+="(?="+D(o)+"|"+c+")")}return new RegExp(u,Qe(r))}function Xe(e,t,r){return e instanceof RegExp?Ur(e,t):Array.isArray(e)?Dr(e,t,r):Wr(e,t,r)}});function Sr(){return typeof global!="object"||!global||global.Math!==Math||global.Array!==Array?self||window||global||function(){return this}():global}var g={store:null,root:Sr(),mapping:{}};(function(){if(window.Reflect===void 0||window.customElements===void 0||window.customElements.hasOwnProperty("polyfillWrapFlushCallback"))return;let e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)})();function Se(e){let t=document.createElement("style");return t.textContent=e,t}function Oe(e){return e.replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function Z(e){return e.children}function we(e,t){for(let r in t)e[r]=t[r];return e}function je(e,t){e!=null&&(typeof e=="function"?e(t):e.current=t)}var Zr=typeof Promise=="function"?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function V(e){return Object.prototype.toString.call(e)==="[object Array]"}function be(e){return typeof e!="string"||!e?[]:e.replace(/]/g,"").replace(/\[/g,".").split(".")}var wr=/\B([A-Z])/g;function ie(e){return e.replace(wr,"-$1").toLowerCase()}function ve(e){return e.replace(/\-(\w)/g,function(t,r){return r.toUpperCase()}).replace(/^\S/,t=>t.toUpperCase())}function dt(e,t){return be(e).forEach(s=>{t=t[s]}),t}var K=[];function M(e,t){let r=[],s,n,i,o;for(o=arguments.length;o-- >2;)K.push(arguments[o]);for(t&&t.children!=null&&(K.length||K.push(t.children),delete t.children);K.length;)if((n=K.pop())&&n.pop!==void 0)for(o=n.length;o--;)K.push(n[o]);else typeof n=="boolean"&&(n=null),(i=typeof e!="function")&&(n==null?n="":typeof n=="number"?n=String(n):typeof n!="string"&&(i=!1)),i&&s?r[r.length-1]+=n:r.length===0?r=[n]:r.push(n),s=i;if(e===Z)return r;let c={nodeName:e,children:r,attributes:t??void 0,key:t?.key};return g.vnode!==void 0&&g.vnode(c),c}var _="prevProps",mt=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,yt={onanimationcancel:1,oncompositionend:1,oncompositionstart:1,oncompositionupdate:1,onfocusin:1,onfocusout:1,onscrollend:1,ontouchcancel:1,ontouchend:1,ontouchmove:1,ontouchstart:1};function gt(e,t,r){return typeof t=="string"||typeof t=="number"?e.splitText!==void 0:typeof t.nodeName=="string"?!e._componentConstructor&&Ie(e,t.nodeName):typeof t.nodeName=="function"?g.mapping[e.nodeName.toLowerCase()]===t.nodeName:r||e._componentConstructor===t.nodeName}function Ie(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}var xe={};function oe(e,t){xe["o-"+e]=t}function I(e,t,r){let s=be(t),n=e;for(let i=0,o=s.length;i<o;i++)i===o-1?n[s[i]]=r:n=n[s[i]]}function N(e,t){let r=be(t),s=e;for(let n=0,i=r.length;n<i;n++)s=s[r[n]];return s}function St(e){return this._listeners[e.type](e)}function Ue(e,t,r){e._listeners=e._listeners||{},e._listeners[t]=r,e.addEventListener(t,St)}function De(e,t){e.removeEventListener(t,St)}function bt(e,t,r){let s=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e,r);return s.normalizedNodeName=e,s}function We(e){let t=e.parentNode;t&&t.removeChild(e)}function Ee(e,t,r,s,n,i){if(t==="className"&&(t="class"),t[0]=="o"&&t[1]=="-")xe[t]&&xe[t](e,s,i);else if(!(t==="key"||t==="ignoreAttrs"))if(t==="ref")je(r,null),je(s,e);else if(t==="class"&&!n)e.className=s||"";else if(t==="style"){if((!s||typeof s=="string"||typeof r=="string")&&(e.style.cssText=s||""),s&&typeof s=="object"){if(typeof r!="string")for(let o in r)o in s||(e.style[o]="");for(let o in s)e.style[o]=typeof s[o]=="number"&&mt.test(o)===!1?s[o]+"px":s[o]}}else if(t==="unsafeHTML")s&&(e.innerHTML=s.html||s||"");else if(t==="dangerouslySetInnerHTML")s&&(e.innerHTML=s.__html||"");else if(t[0]=="o"&&t[1]=="n")br(e,t,s,r);else if(e.nodeName==="INPUT"&&t==="value")e[t]=s??"";else if(t!=="list"&&t!=="type"&&t!=="css"&&!n&&t in e&&s!==""){try{e[t]=s??""}catch{}(s==null||s===!1)&&t!="spellcheck"&&(e.pureRemoveAttribute?e.pureRemoveAttribute(t):e.removeAttribute(t))}else{let o=n&&t!==(t=t.replace(/^xlink:?/,""));s==null||s===!1?o?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.pureRemoveAttribute?e.pureRemoveAttribute(t):e.removeAttribute(t):typeof s!="function"&&(o?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),s):e.pureSetAttribute?e.pureSetAttribute(t,s):e.setAttribute(t,s))}}function wt(e){return this._listeners[e.type](g.event&&g.event(e)||e)}function br(e,t,r,s){let n=t!==(t=t.replace(/Capture$/,"")),i=t.toLowerCase();t=(yt[i]||i in e?i:t).slice(2),r?s||e.addEventListener(t,wt,n):e.removeEventListener(t,wt,n),(e._listeners||(e._listeners={}))[t]=r}var He=(e,t)=>{if(e==null||typeof e!="function"&&typeof e.nodeName!="function")return e;let r=e.nodeName;if(typeof r=="function"){for(let s in g.mapping)if(g.mapping[s]===r)return e.nodeName=s,e}if(t.vnode=e,t.update=s=>U(t.dom,t.vnode,t.dom&&t.dom.parentNode,t.component,s),typeof r=="function"){let{children:s,attributes:n}=e;t.children=s,e=r(n,t)}else e=e(t);return e instanceof Array&&(e={nodeName:"output",children:e}),(e==null||!e.hasOwnProperty("nodeName"))&&(e={nodeName:"output",children:[e]}),e.setDom=s=>{s&&(t.dom=s,Promise.resolve().then(()=>{s.dispatchEvent(new CustomEvent("updated",{detail:t,cancelable:!0,bubbles:!0}))}),s.update||(s.update=t.update))},e};async function U(e,t,r,s,n){if(!e&&!t)return;let i={hydrating:e!=null&&!(_ in e),isSvgMode:r!=null&&r.ownerSVGElement!==void 0},o;if(t=He(t,{component:s}),t&&t.nodeName===Z&&(t=t.children),V(t))if(t=t.map(c=>He(c,{component:s})),r)await vt(r,t,i.hydrating,s,n,i);else{o=[];for(let c=0;c<t.length;c++){let u=t[c],a=await Ce(c===0?e:null,u,s,n,i);o.push(a)}}else{if(V(e))for(let c=0;c<e.length;c++){let u=e[c];c===0?o=await Ce(u,t,s,n,i):ee(u,!1)}else o=await Ce(e,t,s,n,i);r&&o.parentNode!==r&&r.appendChild(o)}return o}async function Ce(e,t,r,s,n){e&&t&&e.props&&(e.props.children=t.children);let i=e,o=n.isSvgMode;if((t==null||typeof t=="boolean")&&(t=""),typeof t=="string"||typeof t=="number")return e&&e.splitText!==void 0&&e.parentNode&&(!e._component||r)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),ee(e,!0))),i[_]=!0,t.setDom&&t.setDom(i),i;let c=t.nodeName;if(n.isSvgMode=c==="svg"?!0:c==="foreignObject"?!1:n.isSvgMode,c=String(c),(!e||!Ie(e,c))&&(i=bt(c,n.isSvgMode,t.attributes&&t.attributes.is&&{is:t.attributes.is}),e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),ee(e,!0)}let u=i.firstChild,a=i[_],l=t.children;if(l=t.children.map(d=>He(d,{component:r})),a==null){a=i[_]={};for(let d=i.attributes,h=d.length;h--;)a[d[h].name]=d[h].value}return!n.hydrating&&l&&l.length===1&&typeof l[0]=="string"&&u!=null&&u.splitText!==void 0&&u.nextSibling==null?u.nodeValue!=l[0]&&(u.nodeValue=l[0]):(l&&l.length||u!=null)&&(i.constructor.is=="WeElement"&&i.constructor.noSlot||await vt(i,l,n.hydrating||a.unsafeHTML!=null||a.dangerouslySetInnerHTML!=null,r,s,n)),await xr(i,t.attributes,a,r,s,n),i.props&&(i.props.children=t.children),n.isSvgMode=o,t.setDom&&t.setDom(i),i}async function vt(e,t,r,s,n,i){let o=e.childNodes,c=[],u={},a=0,l=0,d=o.length,h=0,b=t?t.length:0,A,L,C,x,y;if(d!==0)for(let S=0;S<d;S++){let w=o[S],R=w[_],O=b&&R?w._component?w._component.__key:R.key:null;O!=null?(a++,u[O]=w):(R||(w.splitText!==void 0?r?w.nodeValue.trim():!0:r))&&(c[h++]=w)}if(b!==0)for(let S=0;S<b;S++){if(x=t[S],y=null,x){let w=x.key;if(w!=null)a&&u[w]!==void 0&&(y=u[w],u[w]=void 0,a--);else if(!y&&l<h){for(A=l;A<h;A++)if(c[A]!==void 0&>(L=c[A],x,r)){y=L,c[A]=void 0,A===h-1&&h--,A===l&&l++;break}}}y=await Ce(y,x,s,n,i),C=o[S],y&&y!==e&&y!==C&&(C==null?e.appendChild(y):y===C.nextSibling?We(C):e.insertBefore(y,C))}if(a)for(let S in u)u[S]!==void 0&&ee(u[S],!1);for(;l<=h;)(y=c[h--])!==void 0&&ee(y,!1)}function ee(e,t){e[_]!=null&&e[_].ref&&(typeof e[_].ref=="function"?e[_].ref(null):e[_].ref.current&&(e[_].ref.current=null)),(t===!1||e[_]==null)&&We(e),vr(e)}function vr(e){for(e=e.lastChild;e;){let t=e.previousSibling;ee(e,!0),e=t}}async function xr(e,t,r,s,n,{isSvgMode:i}){let o,c=e.update,u;e.receiveProps&&(u=Object.assign({},r));for(o in r)!(t&&t[o]!=null)&&r[o]!=null&&(Ee(e,o,r[o],r[o]=void 0,i,s),c&&delete e.props[o]);for(o in t)if(c&&typeof t[o]=="object"&&o!=="ref"){o==="style"&&Ee(e,o,r[o],r[o]=t[o],i,s);let a=Oe(o);e.props[a]=r[a]=t[o]}else if(o!=="children"&&(!(o in r)||t[o]!==(o==="value"||o==="checked"?e[o]:r[o])))if(Ee(e,o,r[o],t[o],i,s),e.nodeName.indexOf("-")!==-1){e.props=e.props||{};let a=Oe(o);e.props[a]=r[a]=t[o]}else r[o]=t[o];c&&!n&&e.parentNode&&e.receiveProps&&e.receiveProps(e.props,u)!==!1&&await e.update()}var Cs=pt(Et(),1);var Er=0,Fe=new WeakMap,$=class extends HTMLElement{constructor(){super(),this.props=Object.assign({},this.constructor.defaultProps,this.props),this.elementId=Er++,this.computed={},this.isInstalled=!1}async connectedCallback(){let t=this.parentNode;for(;t&&!this.store;)this.store=t.store,t=t.parentNode||t.host;if(this.inject){this.injection={},t=this.parentNode;let n;for(;t&&!n;)n=t.provide,t=t.parentNode||t.host;if(n)this.inject.forEach(i=>{this.injection[i]=n[i]});else throw"The provide prop was not found on the parent node or the provide type is incorrect."}await this.attrsToProps(),await this.beforeInstall(),await this.install(),await this.afterInstall();let r;if(this.constructor.isLightDom)r=this;else if(!this.shadowRoot)r=this.attachShadow({mode:"open"});else{r=this.shadowRoot;let n;for(;n=r.firstChild;)r.removeChild(n)}if(Fe.has(this.constructor))r.adoptedStyleSheets=Fe.get(this.constructor);else{let n=this.constructor.css;if(n){if(typeof n=="string"){let i=new CSSStyleSheet;i.replaceSync(n),r.adoptedStyleSheets=[i]}else if(Object.prototype.toString.call(n)==="[object Array]"){let i=[];n.forEach(o=>{if(typeof o=="string"){let c=new CSSStyleSheet;c.replaceSync(o),i.push(c)}else i.push(o);r.adoptedStyleSheets=i})}else if(n.default&&typeof n.default=="string"){let i=new CSSStyleSheet;i.replaceSync(n.default),r.adoptedStyleSheets=[i]}else r.adoptedStyleSheets=[n];Fe.set(this.constructor,r.adoptedStyleSheets)}}await this.beforeRender(),g.afterInstall&&g.afterInstall(this);let s=await this.render(this.props,this.store);this.rootNode=await U(null,s,null,this),await this.rendered(),this.css&&r.appendChild(Se(typeof this.css=="function"?this.css():this.css)),this.props.css&&(this._customStyleElement=Se(this.props.css),this._customStyleContent=this.props.css,r.appendChild(this._customStyleElement)),V(this.rootNode)?this.rootNode.forEach(function(n){r.appendChild(n)}):this.rootNode&&r.appendChild(this.rootNode),await this.installed(),this.isInstalled=!0}async disconnectedCallback(){await this.uninstall(),this.isInstalled=!1}async update(t,r){this._willUpdate=!0,await this.beforeUpdate(),await this.beforeRender(),this._customStyleContent!=this.props.css&&(this._customStyleContent=this.props.css,this._customStyleElement?this._customStyleElement.textContent=this._customStyleContent:(this._customStyleElement=Se(this.props.css),this.shadowRoot.appendChild(this._customStyleElement))),this.attrsToProps(t);let s=await this.render(this.props,this.store);await this.rendered(),this.rootNode=await U(this.rootNode,s,this.constructor.isLightDom?this:this.shadowRoot,this,r),this._willUpdate=!1,await this.updated()}async forceUpdate(){await this.update(!0)}async updateProps(t){Object.keys(t).forEach(r=>{this.props[r]=t[r],this.prevProps&&(this.prevProps[r]=t[r])}),await this.forceUpdate()}async updateSelf(t){await this.update(t,!0)}removeAttribute(t){super.removeAttribute(t),this.isInstalled&&this.update()}setAttribute(t,r){r&&typeof r=="object"?super.setAttribute(t,JSON.stringify(r)):super.setAttribute(t,r),this.isInstalled&&this.update()}pureRemoveAttribute(t){super.removeAttribute(t)}pureSetAttribute(t,r){super.setAttribute(t,r)}attrsToProps(t){if(t||this.store&&this.store.ignoreAttrs||this.props.ignoreAttrs)return;let r=this;r.props.css=r.getAttribute("css");let s=this.constructor.propTypes;!s||Object.keys(s).forEach(n=>{let i=s[n],o=r.getAttribute(ie(n));if(o!==null)switch(i){case String:r.props[n]=o;break;case Number:r.props[n]=Number(o);break;case Boolean:o==="false"||o==="0"?r.props[n]=!1:r.props[n]=!0;break;case Array:case Object:if(o[0]===":")r.props[n]=dt(o.substr(1),Omi.$);else try{r.props[n]=JSON.parse(o)}catch{console.warn(`The ${n} object prop does not comply with the JSON specification, the incorrect string is [${o}].`)}break}else r.constructor.defaultProps&&r.constructor.defaultProps.hasOwnProperty(n)?r.props[n]=r.constructor.defaultProps[n]:r.props[n]=null})}fire(t,r){let s=this.props[`on${ve(t)}`];s?s(new CustomEvent(t,{detail:r})):this.dispatchEvent(new CustomEvent(t,{detail:r}))}beforeInstall(){}install(){}afterInstall(){}installed(){}uninstall(){}beforeUpdate(){}updated(){}beforeRender(){}rendered(){}receiveProps(){}};ht($,"is","WeElement");function qe(e,t,r){return t=typeof t=="string"?document.querySelector(t):t,r&&(t.store=r),U(null,e,t,!1)}var Cr=["use","useSelf"];function W(e,t,r){if(!customElements.get(e)&&!g.mapping[e])if(t.is==="WeElement")customElements.define(e,t),g.mapping[e]=t;else{typeof r=="string"?r={css:r}:r=r||{};class s extends ${static css=r.css;static propTypes=r.propTypes;static defaultProps=r.defaultProps;static isLightDom=r.isLightDom;compute=r.compute;render(){return t.call(this,this)}}for(let n in r)typeof r[n]=="function"&&(s.prototype[n]=function(){return r[n].apply(this,arguments)});Cr.forEach(n=>{r[n]&&r[n]!=="function"&&(s.prototype[n]=function(){return r[n]})}),customElements.define(e,s),g.mapping[e]=s}}function Be(e){return function(t){W(e,t)}}function Ve(e,t){return M(e.nodeName,we(we({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function H(e){let t=e.getRootNode();return t&&t.host}function Ge(e){return e.replace(/([1-9]\d*|0)(\.\d*)*rpx/g,(t,r)=>window.innerWidth*Number(r)/750+"px")}var Nr={}.hasOwnProperty;function ae(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(!!r){var s=typeof r;if(s==="string"||s==="number")e.push(r);else if(Array.isArray(r)&&r.length){var n=ae.apply(null,r);n&&e.push(n)}else if(s==="object")for(var i in r)Nr.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}function Je(){let[e,...t]=Array.prototype.slice.call(arguments,0);if(e.class?(t.unshift(e.class),delete e.class):e.className&&(t.unshift(e.className),delete e.className),t.length>0)return{class:ae.apply(null,t)}}function ze(e){return JSON.stringify(e)}(function(){"use strict";if(typeof document>"u"||"adoptedStyleSheets"in document)return;var e="ShadyCSS"in window&&!ShadyCSS.nativeShadow,t=document.implementation.createHTMLDocument(""),r=new WeakMap,s=typeof DOMException=="object"?Error:DOMException,n=Object.defineProperty,i=Array.prototype.forEach,o=/.+?;?$/gm;function c(f){var p=f.replace(o,"");return p!==f&&console.warn("@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418"),p.trim()}function u(f){return"isConnected"in f?f.isConnected:document.contains(f)}function a(f){return f.filter(function(p,m){return f.indexOf(p)===m})}function l(f,p){return f.filter(function(m){return p.indexOf(m)===-1})}function d(f){f.parentNode.removeChild(f)}function h(f){return f.shadowRoot||r.get(f)}var b=["addRule","deleteRule","insertRule","removeRule"],A=CSSStyleSheet,L=A.prototype;L.replace=function(){return Promise.reject(new s("Can't call replace on non-constructed CSSStyleSheets."))},L.replaceSync=function(){throw new s("Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.")};function C(f){return typeof f=="object"?k.isPrototypeOf(f)||L.isPrototypeOf(f):!1}function x(f){return typeof f=="object"?L.isPrototypeOf(f):!1}var y=new WeakMap,S=new WeakMap,w=new WeakMap,R=new WeakMap;function O(f,p){var m=document.createElement("style");return w.get(f).set(p,m),S.get(f).push(p),m}function j(f,p){return w.get(f).get(p)}function z(f,p){w.get(f).delete(p),S.set(f,S.get(f).filter(function(m){return m!==p}))}function nt(f,p){requestAnimationFrame(function(){p.textContent=y.get(f).textContent,R.get(f).forEach(function(m){return p.sheet[m.method].apply(p.sheet,m.args)})})}function de(f){if(!y.has(f))throw new TypeError("Illegal invocation")}function _e(){var f=this,p=document.createElement("style");t.body.appendChild(p),y.set(f,p),S.set(f,[]),w.set(f,new WeakMap),R.set(f,[])}var k=_e.prototype;k.replace=function(p){try{return this.replaceSync(p),Promise.resolve(this)}catch(m){return Promise.reject(m)}},k.replaceSync=function(p){if(de(this),typeof p=="string"){var m=this;y.get(m).textContent=c(p),R.set(m,[]),S.get(m).forEach(function(T){T.isConnected()&&nt(m,j(m,T))})}},n(k,"cssRules",{configurable:!0,enumerable:!0,get:function(){return de(this),y.get(this).sheet.cssRules}}),n(k,"media",{configurable:!0,enumerable:!0,get:function(){return de(this),y.get(this).sheet.media}}),b.forEach(function(f){k[f]=function(){var p=this;de(p);var m=arguments;R.get(p).push({method:f,args:m}),S.get(p).forEach(function(P){if(P.isConnected()){var E=j(p,P).sheet;E[f].apply(E,m)}});var T=y.get(p).sheet;return T[f].apply(T,m)}}),n(_e,Symbol.hasInstance,{configurable:!0,value:C});var it={childList:!0,subtree:!0},ot=new WeakMap;function Y(f){var p=ot.get(f);return p||(p=new ct(f),ot.set(f,p)),p}function at(f){n(f.prototype,"adoptedStyleSheets",{configurable:!0,enumerable:!0,get:function(){return Y(this).sheets},set:function(p){Y(this).update(p)}})}function Le(f,p){for(var m=document.createNodeIterator(f,NodeFilter.SHOW_ELEMENT,function(P){return h(P)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},null,!1),T=void 0;T=m.nextNode();)p(h(T))}var me=new WeakMap,Q=new WeakMap,ye=new WeakMap;function cr(f,p){return p instanceof HTMLStyleElement&&Q.get(f).some(function(m){return j(m,f)})}function lt(f){var p=me.get(f);return p instanceof Document?p.body:p}function $e(f){var p=document.createDocumentFragment(),m=Q.get(f),T=ye.get(f),P=lt(f);T.disconnect(),m.forEach(function(E){p.appendChild(j(E,f)||O(E,f))}),P.insertBefore(p,null),T.observe(P,it),m.forEach(function(E){nt(E,j(E,f))})}function ct(f){var p=this;p.sheets=[],me.set(p,f),Q.set(p,[]),ye.set(p,new MutationObserver(function(m,T){if(!document){T.disconnect();return}m.forEach(function(P){e||i.call(P.addedNodes,function(E){E instanceof Element&&Le(E,function(X){Y(X).connect()})}),i.call(P.removedNodes,function(E){E instanceof Element&&(cr(p,E)&&$e(p),e||Le(E,function(X){Y(X).disconnect()}))})})}))}if(ct.prototype={isConnected:function(){var f=me.get(this);return f instanceof Document?f.readyState!=="loading":u(f.host)},connect:function(){var f=lt(this);ye.get(this).observe(f,it),Q.get(this).length>0&&$e(this),Le(f,function(p){Y(p).connect()})},disconnect:function(){ye.get(this).disconnect()},update:function(f){var p=this,m=me.get(p)===document?"Document":"ShadowRoot";if(!Array.isArray(f))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+m+": Iterator getter is not callable.");if(!f.every(C))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+m+": Failed to convert value to 'CSSStyleSheet'");if(f.some(x))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+m+": Can't adopt non-constructed stylesheets");p.sheets=f;var T=Q.get(p),P=a(f),E=l(T,P);E.forEach(function(X){d(j(X,p)),z(X,p)}),Q.set(p,P),p.isConnected()&&P.length>0&&$e(p)}},window.CSSStyleSheet=_e,at(Document),"ShadowRoot"in window){at(ShadowRoot);var ft=Element.prototype,fr=ft.attachShadow;ft.attachShadow=function(p){var m=fr.call(this,p);return p.mode==="closed"&&r.set(this,m),m}}var ge=Y(document);ge.isConnected()?ge.connect():document.addEventListener("DOMContentLoaded",ge.connect.bind(ge))})();M.f=Z;function Ct(){return{}}var Nt={},Rr=$,Rt=W,Ne=g.mapping,Tt={tag:Be,WeElement:$,Component:Rr,render:qe,h:M,createElement:M,options:g,define:W,cloneElement:Ve,getHost:H,rpx:Ge,defineElement:Rt,classNames:ae,extractClass:Je,createRef:Ct,o:ze,elements:Ne,$:Nt,extend:oe,get:N,set:I,bind:Ue,unbind:De};g.root.Omi=Tt;g.root.omi=Tt;g.root.Omi.version="6.25.9";var Tr=(e={})=>{e=typeof e=="function"?e():e;for(let t in e){let r=e[t];typeof r=="function"&&(e[t]=r())}return new Headers({"Content-Type":"application/json",...e})},Pt=(e,t="",r={})=>{for(let s in r){let n=r[s];if(n instanceof Array){for(let i of n)e.append(`${t}${s}`,i);continue}else if(n===null||typeof n!="object"){e.set(`${t}${s}`,n);continue}Pt(e,`${t}${s}.`,n)}},At=(e,t={})=>{let r=new URL(e);return Pt(r.searchParams,"",t),r.href},Ar=(e,t,r,s,n)=>(e=="GET"||e=="DELETE"?(t=At(t,r),r=null):t=At(t,n),s=Tr(s),r instanceof FormData?s.delete("Content-Type"):r=r!=null?JSON.stringify(r):null,new Request(t,{method:e,headers:s,body:r})),le=async(e,t,r,s,n)=>{let i=Ar(e,t,r,s??{},n);return fetch(i).then(o=>{if(!o.ok){let c=new CustomEvent("fetcherror",{detail:{method:i.method,url:i.url,body:r,status:o.status,statusText:o.statusText}});return window.dispatchEvent(c),new Error({status:o.status,statusText:o.statusText})}try{return o.json()}catch(c){console.error(`fetch ${i.url} error\uFF0C\u8FD4\u56DE\u503C\u4E0D\u662FJSON`,c)}})},Pr={async get(e,t,r){return le("GET",e,t,r)},async post(e,t,r,s){return le("POST",e,t,r,s)},async put(e,t,r,s){return le("PUT",e,t,r,s)},async patch(e,t,r){return le("PATCH",e,t,r)},async delete(e,t,r,s){return le("DELETE",e,t,r,s)}},F=Pr;var _r=["get","post","add","update","put","patch","modify","delete","del"],Lr=new RegExp(`^(?<action>${_r.join("|")})(?<name>\\w+)`,"i"),ce=class{#s="";#t="";#r={};#e=[];#o=[];#n={get:!0,post:"add",put:"update",patch:"modify",delete:"del"};#i=Lr;constructor(t,r,s,n,i,o,c){r=r??location.href,t=t+"",this.#r=s??{},this.#t=new URL(t,r).href,t.startsWith("/")&&(t=t.substr(1)),this.#s=t,n&&(this.#e=n),i&&(this.#o=i),this.#n=o??this.#n,c instanceof Array&&(this.#i=new RegExp(`^(?<action>${c.join("|")})(?<name>\\w+)`,"i"));for(let u in this.#n){let a=this.#n[u];if(typeof u=="string"&&(typeof a=="string"&&this[a]===void 0&&(this[a]=this[u]),a instanceof Array&&a.length))for(let l of a)typeof l=="string"&&this[l]===void 0&&(this[l]=this[u])}}get headers(){return this.#r}get controllerURL(){return this.#t}get beforeSends(){return this.#e}get afterReceives(){return this.#o}get actionsMap(){return this.#n}get parseActionsRegExp(){return this.#i}id(t){return te(t,this.controllerURL+"/",this.headers,this.beforeSends,this.afterReceives)}path(t){return te(t,this.controllerURL+"/",this.headers,this.beforeSends,this.afterReceives)}beforeSend(t){if(!t)throw new Error("need a handler");this.beforeSends.push(t)}afterReceive(t){if(!t)throw new Error("need a handler");this.afterReceives.push(t)}async get(t){let r=`${this.controllerURL}`,s=null;t instanceof Array?r=`${this.controllerURL}/${t.join(",")}`:typeof t=="object"?s=t:arguments.length&&(r=`${this.controllerURL}/${[...arguments].join(",")}`);let n={url:r,data:s,headers:this.headers};this.beforeSends.forEach(o=>{o(n)});let i=await F.get(n.url,n.data,n.headers);return this.afterReceives.forEach(o=>{o(i)}),i}async post(t,r){let s={url:this.controllerURL,data:t,headers:this.headers,params:r};this.beforeSends.forEach(i=>{i(s)});let n=await F.post(s.url,s.data,s.headers,s.params);return this.afterReceives.forEach(i=>{i(n)}),n}async put(t,r,s){r==null&&typeof t=="object"&&(r=t,t=null);let n={url:t==null?this.controllerURL:`${this.controllerURL}/${t}`,data:r,headers:this.headers,params:s};this.beforeSends.forEach(o=>{o(n)});let i=await F.put(n.url,n.data,n.headers,n.params);return this.afterReceives.forEach(o=>{o(i)}),i}async patch(t,r,s){r==null&&typeof t=="object"&&(r=t,t=null);let n={url:t==null?this.controllerURL:`${this.controllerURL}/${t}`,data:r,headers:this.headers,params:s};this.beforeSends.forEach(o=>{o(n)});let i=await F.patch(n.url,n.data,n.headers,n.params);return this.afterReceives.forEach(o=>{o(i)}),i}async delete(t){let r=`${this.controllerURL}`,s=null;t instanceof Array?r=`${this.controllerURL}/${t.join(",")}`:typeof t=="object"?s=t:arguments.length&&(r=`${this.controllerURL}/${[...arguments].join(",")}`);let n={url:r,data:s,headers:this.headers};this.beforeSends.forEach(o=>{o(n)});let i=await F.delete(n.url,n.data,n.headers);return this.afterReceives.forEach(o=>{o(i)}),i}},_t={get(e,t,r){let s=e.$controller;if(t in s)return s[t];let n=s.parseActionsRegExp.exec(t),i=!1;if(n){let[o,...c]=n.groups.name;t=[o.toLowerCase(),...c].join(""),i=n.groups.action}return te(t,s.controllerURL+"/",s.headers,s.beforeSends,s.afterReceives,s.actionsMap,s.parseActions,i)},apply(e,t,r){let s=e.$controller,n=e.$action;if(n)return s[n].apply(s,r);if(r.length===0)return new Proxy(e,_t);let[i]=r;return te(i,s.controllerURL+"/",s.headers,s.beforeSends,s.afterReceives,s.actionsMap,s.parseActions)}},te=(e,t,r,s,n,i,o,c)=>{let u=()=>{};return u.$action=c,u.$controller=new ce(e,t,r,s,n,i,o),new Proxy(u,_t)};var Lt={request:F,createController:te,Controller:ce};var Mt=function(e,t,r,s){var n;t[0]=0;for(var i=1;i<t.length;i++){var o=t[i++],c=t[i]?(t[0]|=o?1:2,r[t[i++]]):t[++i];o===3?s[0]=c:o===4?s[1]=Object.assign(s[1]||{},c):o===5?(s[1]=s[1]||{})[t[++i]]=c:o===6?s[1][t[++i]]+=c+"":o?(n=e.apply(c,Mt(e,c,r,["",null])),s.push(n),c[0]?t[0]|=2:(t[i-2]=0,t[i]=n)):s.push(c)}return s},$t=new Map;function Ot(e){var t=$t.get(this);return t||(t=new Map,$t.set(this,t)),(t=Mt(this,t.get(e)||(t.set(e,t=function(r){for(var s,n,i=1,o="",c="",u=[0],a=function(h){i===1&&(h||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(0,h,o):i===3&&(h||o)?(u.push(3,h,o),i=2):i===2&&o==="..."&&h?u.push(4,h,0):i===2&&o&&!h?u.push(5,0,!0,o):i>=5&&((o||!h&&i===5)&&(u.push(i,0,o,n),i=6),h&&(u.push(i,h,0,n),i=6)),o=""},l=0;l<r.length;l++){l&&(i===1&&a(),a(l));for(var d=0;d<r[l].length;d++)s=r[l][d],i===1?s==="<"?(a(),u=[u],i=3):o+=s:i===4?o==="--"&&s===">"?(i=1,o=""):o=s+o[0]:c?s===c?c="":o+=s:s==='"'||s==="'"?c=s:s===">"?(a(),i=1):i&&(s==="="?(i=5,n=o,o=""):s==="/"&&(i<5||r[l][d+1]===">")?(a(),i===3&&(u=u[0]),i=u,(u=u[0]).push(2,0,i),i=0):s===" "||s===" "||s===`
`||s==="\r"?(a(),i=2):o+=s),i===3&&o==="!--"&&(i=4,u=u[0])}return a(),u}(e)),t),arguments,[])).length>1?t:t[0]}var ke=e=>{let t=document.createElement("link");return t.setAttribute("href",e),t.setAttribute("rel","stylesheet"),t},jt=e=>e.map(ke),re=async(e,t)=>q(e,t,!0),q=async(e,t,r=!1)=>{let s=[],n=[e];for(;n.length;){let i=n.shift();if(i instanceof Promise&&(i=await i),!!i){if(typeof i=="function"){let o=i.call(t);n.unshift(o);continue}if(i instanceof Array){n.unshift(...i);continue}if(i.default){n.unshift(i.default);continue}if(typeof i=="string"){if(r===!1){s.push(i);continue}let o=new CSSStyleSheet;o.replaceSync(i),s.push(o)}i instanceof CSSStyleSheet&&s.push(i)}}return s};function It(e,t){let r=[];if(!e)return r;if(e instanceof Array)for(let s of e)r.push(...It(s,t));else e instanceof HTMLCollection||e instanceof NodeList?r=[...e]:e instanceof HTMLElement?r.push(e):typeof e=="string"&&(r=[...t?.querySelectorAll(e)??[]]);return r}function Re(e,t=document,r=!1,s=!0){let n=It(e,t),o=Object.keys(Ne).join(","),c=!s;for(let u of n)if("update"in u)u.update(r,c);else{let a=[...u.querySelectorAll(o)];for(let l of a)l.update(r,c)}}function fe(e,t,r){var s=r||{},n=s.noTrailing,i=n===void 0?!1:n,o=s.noLeading,c=o===void 0?!1:o,u=s.debounceMode,a=u===void 0?void 0:u,l,d=!1,h=0;function b(){l&&clearTimeout(l)}function A(C){var x=C||{},y=x.upcomingOnly,S=y===void 0?!1:y;b(),d=!S}function L(){for(var C=arguments.length,x=new Array(C),y=0;y<C;y++)x[y]=arguments[y];var S=this,w=Date.now()-h;if(d)return;function R(){h=Date.now(),t.apply(S,x)}function O(){l=void 0}!c&&a&&!l&&R(),b(),a===void 0&&w>e?c?(h=Date.now(),i||(l=setTimeout(a?O:R,e))):R():i!==!0&&(l=setTimeout(a?O:R,a===void 0?e-w:e))}return L.cancel=A,L}function Ut(e,t,r){var s=r||{},n=s.atBegin,i=n===void 0?!1:n;return fe(e,t,{debounceMode:i!==!1})}var Dt=new CSSStyleSheet,Wt=Dt;function Ht(e){typeof e=="string"&&Dt.replace(e)}var $r=13,Ft=new WeakMap,Te=class extends ${#s=null;get store(){if(this.#s)return this.#s;let e=this.parentNode;for(;e&&!e.store;)e=e.parentNode??e.host;return e?this.#s=e.store:this.#s={},this.#s}set store(e){this.#s=e}#t=null;get injection(){if(this.#t)return this.#t;if(this.inject){this.#t={};let e=this.parentNode,t;for(;e&&!t;)t=e.provide,e=e.parentNode??e.host;if(t)this.inject.forEach(r=>{this.#t[r]=t[r]});else throw"The provide prop was not found on the parent node or the provide type is incorrect."}}#r=!1;async connectedCallback(){if(this.#r===!0)return;this.#r=!0,this.attrsToProps(),this.mixProps();let e;if(this.constructor.isLightDom)e=this;else if(!this.shadowRoot)e=this.attachShadow({mode:"open"});else{e=this.shadowRoot;let r;for(;r=e.firstChild;)e.removeChild(r)}await this.beforeInstall(),await this.install(),await this.afterInstall(),await this.beforeRender(),g.afterInstall&&await g.afterInstall(this);let t=await this.render(this.props,this.store);await this.rendered(),await this.#o(),this.rootNode=await U(null,t,null,this),V(this.rootNode)?this.rootNode.forEach(function(r){e.appendChild(r)}):this.rootNode&&e.appendChild(this.rootNode),this.isInstalled=!0,await this.installed(),this.#r=!1,this.fire("installed")}async disconnectedCallback(){await this.uninstall(),this.isInstalled=!1}#e={default_css_content:null,default_cssstylesheet:new CSSStyleSheet,props_css_content:null,props_cssstylesheet:new CSSStyleSheet,csssses:[],stylesheetMap:new Map,theme_css:null,theme_cssstylesheet:new CSSStyleSheet};get themeCSSStyleSheet(){if(this.$props.themeCss)return this.$props.themeCss instanceof CSSStyleSheet?this.$props.themeCss:(this.$props.themeCss!=this.#e.theme_css&&(this.#e.theme_css=this.$props.themeCss,this.#e.theme_cssstylesheet.replace(this.#e.theme_css)),this.#e.theme_cssstylesheet);{let e=H(this);return e?e.themeCSSStyleSheet:this.#e.theme_cssstylesheet}}async#o(){if(this.constructor.isLightDom!==!0){let e=Ft.get(this.constructor);if(e===void 0){e={resolves:[],cssss:!1},Ft.set(this.constructor,e),e.cssss=await re(this.constructor.css,this);for(let t of e.resolves)t(e.cssss)}else if(e.cssss===!1){let t=await new Promise(r=>{e.resolves.push(r)})}this.shadowRoot.adoptedStyleSheets=[...e.cssss,this.#e.default_cssstylesheet,this.#e.props_cssstylesheet,this.themeCSSStyleSheet,Wt],jt(await q(this.constructor.stylesheets,this)).forEach(t=>{this.shadowRoot.appendChild(t)})}await this.updateStyle()}async updateStyle(){if(this.constructor.isLightDom===!0)return;if(this.css){let i=(await q(this.css,this)).join(`
`);this.#e.default_css_content!=i&&(this.#e.default_css_content=i,this.#e.default_cssstylesheet.replaceSync(i))}typeof this.props.css=="string"&&this.#e.props_css_content!=this.props.css&&(this.#e.props_css_content=this.props.css,this.#e.props_cssstylesheet.replaceSync(this.props.css));let e=await re(this.cssss,this);e.push(...await re(this.props.cssss,H(this)));let t=this.shadowRoot??this;if(this.#e.csssses.length!==e.length||e.some((i,o)=>i!=this.#e.csssses[o])){let i=[...t.adoptedStyleSheets];i.splice(-(this.#e.csssses.length+2),this.#e.csssses.length+1,...e,this.themeCSSStyleSheet),t.adoptedStyleSheets=i,this.#e.csssses=e}let r=await q(this.stylesheets,this);r.push(...await q(this.props.styleSheets,H(this)));let s=this.#e.stylesheetMap,n=new Set(s.keys());r.forEach(i=>{if(!s.has(i)){let o=ke(i);t.appendChild(o),s.set(i,o)}n.delete(i)}),n.forEach(i=>{let o=s.get(i);o&&(t.removeChild(o),s.delete(i))}),this.styleUpdated&&this.styleUpdated(),this.fire("styleUpdated")}updateTargets(e,t=!0,r=!0){Re(e,this.shadowRoot??this,t,r)}#n=!1;async update(e,t){if(!!this.isInstalled){if(this._willUpdate===!0){this.#n===!1&&(this.#n=()=>{this.#n=!1,this.update(e,t)});return}this._willUpdate=!0,this.fire("beforeUpdate");try{await this.beforeUpdate(),await this.beforeRender(),this.attrsToProps(e),this.mixProps();let r=await this.render(this.props,this.store);await this.rendered(),await this.updateStyle(),this.rootNode=await U(this.rootNode,r,this.constructor.isLightDom?this:this.shadowRoot,this,t)}finally{this._willUpdate=!1,this.#n!==!1&&this.#n(),await this.updated(),this.fire("updated")}}}lazyUpdate=fe($r,(e,t)=>{this.update(e,t)},{noLeading:!0});async forceUpdate(){await this.update(!0)}async forceUpdateSelf(){await this.update(!0,!0)}async update$Props(e,{ignoreAttrs:t=!0,updateSelf:r=!1,updateAttrs:s=!1}={}){Object.keys(e).forEach(n=>{let i=e[n];this.$props[n]=i,this.prevProps&&this.$props==this.props&&(this.prevProps[n]=i),s&&this.pureSetAttribute(n,i)}),await this.update(t,r)}#i;get $props(){return this.#i??this.props}mixProps(){let e=this.props.props??this.getAttribute("props");if(typeof e=="string"){let t=H(this)??g.root;try{e=N(t,e)}catch(r){console.warn("parent host can not find props settings",r)}}if(e&&typeof e=="object"){this.#i=e;for(let t in this.props)t!=="props"&&t!=="children"&&!e.hasOwnProperty(t)&&(e[t]=this.props[t])}else this.#i=this.props}attrsToProps(e){if(e||this.props.ignoreAttrs)return;let t=this;t.props.css=t.getAttribute("css");let r=this.constructor.propTypes;!r||Object.keys(r).forEach(s=>{let n=r[s],i=t.getAttribute(ie(s));if(i!==null)switch(n){case String:t.props[s]=i;break;case Number:t.props[s]=Number(i);break;case Boolean:i==="false"||i==="0"?t.props[s]=!1:t.props[s]=!0;break;case Array:case Object:if(i[0]===":")t.props[s]=getValByPath(i.substr(1),Omi.$);else try{t.props[s]=JSON.parse(i)}catch{console.warn(`The ${s} object prop does not comply with the JSON specification, the incorrect string is [${i}].`)}break}else(!Reflect.has(t,s)||Reflect.hasOwnProperty(t,s))&&(t.constructor.defaultProps&&t.constructor.defaultProps.hasOwnProperty(s)?t.props[s]=t.constructor.defaultProps[s]:t.props[s]=null)})}static get observedAttributes(){return this.updateOnAttributeChanged&&this.propTypes?Object.keys(this.propTypes).map(ie):[]}attributeChangedCallback(e,t,r){this.isInstalled&&this._willUpdate!==!0&&this.updateOnAttributeChanged!==!1&&this.lazyUpdate()}fire(e,t,{cancelable:r=!1,bubbles:s=!1,composed:n=!1}={}){let i=new CustomEvent(e,{detail:t,cancelable:r,bubbles:s,composed:n}),o=this.props[`on${ve(e)}`];return typeof o=="function"?o(i,this):this.dispatchEvent(i)}$$(e){return[...(this.shadowRoot??this).querySelectorAll(e)]}$(e){return(this.shadowRoot??this).querySelector(e)}async beforeInstall(){}async install(){}async afterInstall(){}async installed(){}async uninstall(){}async beforeUpdate(){}async updated(){}async beforeRender(){}async rendered(){}receiveProps(){}};var Ae=pt(Jt());var G={},v=Fr();v.route=Ze;v.route.params=null;v.historyLength=0;v.route.to=function(e,t){v.route._routeByTo=!0,v.route.data=t,e[0]==="#"?location.hash=e:location.hash="#"+e};window.addEventListener("hashchange",kt);function kt(e){let t=!1;window.history.length===v.historyLength&&!v.route._routeByTo&&(t=!0),v.route._routeByTo=!1,v.historyLength=window.history.length;let r=!1;if(v.route.before&&(r=v.route.before(e)===!1),r)return;let s=window.location.hash.replace("#","");s===""&&(s="/");let n=!0;Object.keys(G).every(function(i){let o=s.split("?")[0].match(G[i].reg);if(o){let c=i.match(G[i].reg);return v.route.params=Hr(o,c),v.route.query=zt(s),G[i].callback({params:v.route.params,query:zt(s),data:v.route.data,byNative:t}),v.route.data=null,n=!1,!1}return!0}),n&&G["*"]&&G["*"].callback({byNative:t}),v.route.after&&v.route.after(e)}document.addEventListener("DOMContentLoaded",kt);function Hr(e,t){let r={};return e.forEach(function(s,n){n>0&&(r[t[n].replace(":","")]=s)}),r}function Ze(e,t){G[e]={callback:t,reg:Ae.default?Ae.default(e):Ae(e)}}function Fr(){return typeof global!="object"||!global||global.Math!==Math||global.Array!==Array?self||window||global||function(){return this}():global}function zt(e){e=e.replace(/#.*$/,"");let t=e.split(/[?&]/).slice(1),r,s={};for(r=0;r<t.length;r++){let n=t[r].match(/([^=]+)=([^=]+)/);n!==null&&(s[n[1]]=decodeURIComponent(n[2]))}return s}var Ke=new Map,Yt=new Map,Qt="oi-part";function Xt(e,t){if(t=t??Qt,Ke.has(e))return Ke.get(e);let r=Yt.get(t)??1,s=`${t}-${r+1}`;return W(s,e),Yt.set(t,++r),Ke.set(e,s),s}function Zt(e){Qt=e}var ue=Symbol("observing-proxy"),et=Symbol("proxy-get"),Kt=Symbol("proxy-set"),tt=Symbol("proxy-del"),er=Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(e=>typeof e=="symbol");var tr=new WeakMap,rr=new WeakMap;function pe(e){return tr.get(e)??{}}function Pe(e,{proxy:t,handler:r}){tr.set(e,{proxy:t,handler:r}),rr.set(t,{raw:e,handler:r})}function rt(e){return rr.get(e)??{}}var st=new WeakMap;function sr(e,t){let r=st.get(e);r===void 0&&(r=[],st.set(e,r)),r.push(t)}function nr(e){return st.get(e)??[]}var J=class{#s=et;#t;#r;constructor(...t){this.#r=new Set,this.addCallbacks(...t)}get callbacks(){return this.#r}addCallbacks(...t){t.forEach(r=>{this.#r.has(r)||(this.#r.add(r),sr(r,this.#r))})}doCallbacks({path:t,oldVal:r,val:s}){this.#r.forEach(n=>{n({path:t,oldVal:r,val:s})})}deleteProperty(t,r){let s=Reflect.deleteProperty(t,r);return this.#s=tt,s}get(t,r,s){if(this.#s=et,r===ue)return!0;if(r==="addCallbacks")return this.addCallbacks.bind(this);let n=Reflect.get(t,r,s);if(typeof r=="symbol"&&er.includes(r))return n;if(this.#t||(this.#t=new Set),Promise.resolve().then(()=>{this.#t=null}),t instanceof Array||this.#t.add(r),typeof n=="object"){let{proxy:i,handler:o}=pe(n);return i===void 0?(o=new J(...this.#r),i=new Proxy(n,o),Pe(n,{proxy:i,handler:o})):o.addCallbacks(...this.#r),o.#t=this.#t,i}return n}set(t,r,s,n){let i=Reflect.get(t,r,n),o=Reflect.set(t,r,s,n);return t instanceof Array&&r==="length"&&this.#s!==tt||(this.#t||(this.#t=new Set),Promise.resolve().then(()=>{this.#t=null}),this.#t.add(r),this.doCallbacks({path:[...this.#t],oldVal:i,val:s})),this.#s=Kt,o}};function ir(e={},...t){if(typeof e!="object"&&console.error("observe need a object"),e[ue]===!0){let{handler:n}=rt(e);return n&&n.addCallbacks(...t),e}let{proxy:r,handler:s}=pe(e);if(s)s.addCallbacks(...t);else{let n=new J(...t);r=new Proxy(e,n),Pe(e,{proxy:r,handler:n})}return r}function or(e,...t){if(typeof e=="function"&&t.unshift(e),t.length===0){let{handler:r}=e[ue]===!0?rt(e):pe(e);t=(r&&r.callbacks)??[]}t.forEach(r=>{nr(r).forEach(n=>{n.delete(r)})})}function ar(e){return this._bindingListeners[e.type](e)}function se(e,t,r){e._bindingListeners=e._bindingListeners||{},e._bindingListeners[t]=r,e.addEventListener(t,ar)}function ne(e,t){e.removeEventListener(t,ar)}var lr=[],he=e=>{lr.push(e)};var qr=(e,t,r)=>{let s=N(r,t);if(s instanceof Array&&e.multiple){Array.from(e.options).forEach(n=>{s.some(i=>i==n.value)?n.selected=!0:n.selected=!1});return}(s===!1||s===null||s===void 0)&&(s=""),e.value=s};he((e,t,r)=>{if(e.nodeName==="SELECT")return ne(e,"change"),se(e,"change",()=>{let s=N(r,t);s instanceof Array?s.splice(0,s.length,...Array.from(e.selectedOptions).filter(n=>n.value!="").map(n=>n.value)):I(r,t,e.value)}),qr});var Br=(e,t,r)=>{let s=N(r,t);if(s instanceof Array){e.checked=s.some(n=>n==e.value);return}e.checked=N(r,t)==e.value};he((e,t,r)=>{if(e.type==="radio"&&e.nodeName=="INPUT")return ne(e,"change"),se(e,"change",()=>{let s=N(r,t);s instanceof Array?s.splice(0,s.length,e.value):I(r,t,e.value)}),Br});var Vr=(e,t,r)=>{let s=(e.prevProps&&e.prevProps["o-true-value"])??e.getAttribute("o-true-value")??!0,n=N(r,t);n instanceof Array?e.checked=n.some(i=>i==e.value):e.checked=n==s};he((e,t,r)=>{if(e.type==="checkbox"&&e.nodeName=="INPUT"){let s=(e.prevProps&&e.prevProps["o-true-value"])??e.getAttribute("o-true-value")??!0,n=(e.prevProps&&e.prevProps["o-false-value"])??e.getAttribute("o-false-value")??!1;return ne(e,"change"),se(e,"change",()=>{let i=N(r,t);if(i instanceof Array){let o=new Set(i);e.checked?o.add(e.value):o.delete(e.value),i.splice(0,i.length,...o)}else I(r,t,e.checked?s:n)}),Vr}});var Gr=(e,t,r)=>{e.value=N(r,t)??""};he((e,t,r)=>{if(e.nodeName=="INPUT"){let s=e.getAttribute("input-pattern");if(s){let n=new RegExp(s);ne(e,"keypress"),se(e,"keypress",i=>{i.key.length==1&&!n.test(`${e.value}${i.key}`)&&i.preventDefault()})}return ne(e,"input"),se(e,"input",n=>{I(r,t,e.value)}),Gr}});var Jr=(e,t,r)=>{e.value=N(r,t)??null};he((e,t,r)=>{if(Reflect.has(e,"value"))return ne(e,"change"),se(e,"change",()=>{let s=N(r,t);s instanceof Array?s.splice(0,s.length,e.value):I(r,t,e.value)}),Jr});oe("model",(e,t,r)=>{let s=r;r=r.bindingScope??r.props?.bindingScope??r,r===!1&&(s=r=window);let n=s.__bindings??(s.__bindings=[]);Promise.resolve().then(()=>{for(let i of lr){let o=i(e,t,r);if(typeof o=="function"){n.push({element:e,path:t,updateFunction:o}),o(e,t,r);break}}}),s.hasOwnProperty("updateBindings")||(s.updateBindings=()=>{for(let i of n)i.updateFunction(i.element,i.path,r)})});var zr=Ot.bind(M);var kr="1.1.17",Yr=g.root.omii={...g.root.omi,version:kr,Component:Te,route:Ze,apis:Lt,html:zr,uniqueTag:Xt,setTagPrefix:Zt,updateTargets:Re,throttle:fe,debounce:Ut,setTheme:Ht,purgeCSS:q,purgeCSSSS:re,observe:ir,unobserve:or},Kn=Yr;export{Nt as $,Te as Component,$ as WeElement,Lt as apis,Ue as bind,ae as classNames,Ve as cloneElement,M as createElement,Ct as createRef,Ut as debounce,Kn as default,W as define,Rt as defineElement,Ne as elements,oe as extend,Je as extractClass,N as get,H as getHost,M as h,zr as html,ze as o,ir as observe,g as options,q as purgeCSS,re as purgeCSSSS,qe as render,Ze as route,Ge as rpx,I as set,Zt as setTagPrefix,Ht as setTheme,Be as tag,fe as throttle,De as unbind,Xt as uniqueTag,or as unobserve,Re as updateTargets};
/*!
* omi-router v3.0.5 by dntzhang
* Router for Omi.
* Github: https://github.com/Tencent/omi
* MIT Licensed.
*/
/*!
* weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill
* https://github.com/polygonplanet/weakmap-polyfill
* Copyright (c) 2015-2021 polygonplanet <polygon.planet.aqua@gmail.com>
* @license MIT
*/
/**
* @license
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
//# sourceMappingURL=omii.js.map