wrec 0.20.8 → 0.20.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/wrec.es.js +3 -3
- package/dist/wrec.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ To run the examples in the `src/examples` directory:
|
|
|
138
138
|
1. cd to the `wrec` project directory.
|
|
139
139
|
1. Enter `npm install`.
|
|
140
140
|
1. Enter `npm run dev`.
|
|
141
|
-
1. Browse `localhost:5173/examples/{name}.html` where `name`
|
|
141
|
+
1. Browse `localhost:5173/src/examples/{name}.html` where `name`
|
|
142
142
|
is the name of one of the `.html` files in that directory.
|
|
143
143
|
|
|
144
144
|
`hello-world.html` demonstrates a basic Wrec component.
|
package/dist/wrec.es.js
CHANGED
|
@@ -1227,12 +1227,12 @@ class U extends HTMLElement {
|
|
|
1227
1227
|
"is a Boolean attribute, so its value must match attribute name or be missing"
|
|
1228
1228
|
), e === t);
|
|
1229
1229
|
}
|
|
1230
|
-
// Updates the matching attribute for a property
|
|
1230
|
+
// Updates the matching attribute for a property.
|
|
1231
1231
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1232
1232
|
#N(t, e, n, s) {
|
|
1233
|
-
if (pe(n)
|
|
1233
|
+
if (pe(n)) {
|
|
1234
1234
|
const r = e === Boolean ? this.hasAttribute(s) : this.#A(t, s);
|
|
1235
|
-
n !== r && ln(this, t, n);
|
|
1235
|
+
n !== r && ln(this, s || t, n);
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
1238
|
// Updates all computed properties that reference this property.
|
package/dist/wrec.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(T,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(T=typeof globalThis<"u"?globalThis:T||self,E(T.wrec={}))})(this,(function(T){"use strict";var ln=T=>{throw TypeError(T)};var ge=(T,E,M)=>E.has(T)||ln("Cannot "+M);var O=(T,E,M)=>(ge(T,E,"read from private field"),M?M.call(T):E.get(T)),q=(T,E,M)=>E.has(T)?ln("Cannot add the same private member more than once"):E instanceof WeakSet?E.add(T):E.set(T,M),ct=(T,E,M,yt)=>(ge(T,E,"write to private field"),yt?yt.call(T,M):E.set(T,M),M),fn=(T,E,M)=>(ge(T,E,"access private method"),M);var K,Nt,H,gt,Et,Y,Dt,un;const{entries:E,setPrototypeOf:M,isFrozen:yt,getPrototypeOf:pn,getOwnPropertyDescriptor:hn}=Object;let{freeze:L,seal:x,create:zt}=Object,{apply:$t,construct:Wt}=typeof Reflect<"u"&&Reflect;L||(L=function(t){return t}),x||(x=function(t){return t}),$t||($t=function(t,e){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(e,s)}),Wt||(Wt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return new t(...n)});const Rt=D(Array.prototype.forEach),mn=D(Array.prototype.lastIndexOf),Ee=D(Array.prototype.pop),lt=D(Array.prototype.push),dn=D(Array.prototype.splice),wt=D(String.prototype.toLowerCase),Gt=D(String.prototype.toString),Bt=D(String.prototype.match),ft=D(String.prototype.replace),Tn=D(String.prototype.indexOf),gn=D(String.prototype.trim),k=D(Object.prototype.hasOwnProperty),N=D(RegExp.prototype.test),ut=En(TypeError);function D(r){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return $t(r,t,n)}}function En(r){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Wt(r,e)}}function d(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wt;M&&M(r,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=e(s);i!==s&&(yt(t)||(t[n]=i),s=i)}r[s]=!0}return r}function An(r){for(let t=0;t<r.length;t++)k(r,t)||(r[t]=null);return r}function U(r){const t=zt(null);for(const[e,n]of E(r))k(r,e)&&(Array.isArray(n)?t[e]=An(n):n&&typeof n=="object"&&n.constructor===Object?t[e]=U(n):t[e]=n);return t}function pt(r,t){for(;r!==null;){const n=hn(r,t);if(n){if(n.get)return D(n.get);if(typeof n.value=="function")return D(n.value)}r=pn(r)}function e(){return null}return e}const Ae=L(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),jt=L(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Yt=L(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),_n=L(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Vt=L(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),bn=L(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_e=L(["#text"]),be=L(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Xt=L(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Se=L(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ot=L(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sn=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yn=x(/<%[\w\W]*|[\w\W]*%>/gm),Rn=x(/\$\{[\w\W]*/gm),wn=x(/^data-[\-\w.\u00B7-\uFFFF]+$/),On=x(/^aria-[\-\w]+$/),ye=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Cn=x(/^(?:\w+script|data):/i),Mn=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=x(/^html$/i),Ln=x(/^[a-z][.\w]*(-[.\w]+)+$/i);var we=Object.freeze({__proto__:null,ARIA_ATTR:On,ATTR_WHITESPACE:Mn,CUSTOM_ELEMENT:Ln,DATA_ATTR:wn,DOCTYPE_NAME:Re,ERB_EXPR:yn,IS_ALLOWED_URI:ye,IS_SCRIPT_OR_DATA:Cn,MUSTACHE_EXPR:Sn,TMPLIT_EXPR:Rn});const ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},Nn=function(){return typeof window>"u"?null:window},Dn=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(n=e.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Oe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ce(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nn();const t=f=>Ce(f);if(t.version="3.3.1",t.removed=[],!r||!r.document||r.document.nodeType!==ht.document||!r.Element)return t.isSupported=!1,t;let{document:e}=r;const n=e,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:c,Node:u,Element:p,NodeFilter:h,NamedNodeMap:m=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:V,trustedTypes:W}=r,X=p.prototype,Xn=pt(X,"cloneNode"),qn=pt(X,"remove"),Kn=pt(X,"nextSibling"),Zn=pt(X,"childNodes"),It=pt(X,"parentNode");if(typeof c=="function"){const f=e.createElement("template");f.content&&f.content.ownerDocument&&(e=f.content.ownerDocument)}let I,At="";const{implementation:ee,createNodeIterator:Jn,createDocumentFragment:Qn,getElementsByTagName:to}=e,{importNode:eo}=n;let P=Oe();t.isSupported=typeof E=="function"&&typeof It=="function"&&ee&&ee.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ne,ERB_EXPR:oe,TMPLIT_EXPR:se,DATA_ATTR:no,ARIA_ATTR:oo,IS_SCRIPT_OR_DATA:so,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:io}=we;let{IS_ALLOWED_URI:He}=we,S=null;const ze=d({},[...Ae,...jt,...Yt,...Vt,..._e]);let R=null;const $e=d({},[...be,...Xt,...Se,...Ot]);let A=Object.seal(zt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_t=null,ie=null;const et=Object.seal(zt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let We=!0,re=!0,Ge=!1,Be=!0,nt=!1,Pt=!0,Z=!1,ae=!1,ce=!1,ot=!1,vt=!1,xt=!1,je=!0,Ye=!1;const ro="user-content-";let le=!0,bt=!1,st={},z=null;const fe=d({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ve=null;const Xe=d({},["audio","video","img","source","image","track"]);let ue=null;const qe=d({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",Ft="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xhtml";let it=G,pe=!1,he=null;const ao=d({},[kt,Ft,G],Gt);let Ut=d({},["mi","mo","mn","ms","mtext"]),Ht=d({},["annotation-xml"]);const co=d({},["title","style","font","a","script"]);let St=null;const lo=["application/xhtml+xml","text/html"],fo="text/html";let b=null,rt=null;const uo=e.createElement("form"),Ke=function(o){return o instanceof RegExp||o instanceof Function},me=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rt&&rt===o)){if((!o||typeof o!="object")&&(o={}),o=U(o),St=lo.indexOf(o.PARSER_MEDIA_TYPE)===-1?fo:o.PARSER_MEDIA_TYPE,b=St==="application/xhtml+xml"?Gt:wt,S=k(o,"ALLOWED_TAGS")?d({},o.ALLOWED_TAGS,b):ze,R=k(o,"ALLOWED_ATTR")?d({},o.ALLOWED_ATTR,b):$e,he=k(o,"ALLOWED_NAMESPACES")?d({},o.ALLOWED_NAMESPACES,Gt):ao,ue=k(o,"ADD_URI_SAFE_ATTR")?d(U(qe),o.ADD_URI_SAFE_ATTR,b):qe,Ve=k(o,"ADD_DATA_URI_TAGS")?d(U(Xe),o.ADD_DATA_URI_TAGS,b):Xe,z=k(o,"FORBID_CONTENTS")?d({},o.FORBID_CONTENTS,b):fe,_t=k(o,"FORBID_TAGS")?d({},o.FORBID_TAGS,b):U({}),ie=k(o,"FORBID_ATTR")?d({},o.FORBID_ATTR,b):U({}),st=k(o,"USE_PROFILES")?o.USE_PROFILES:!1,We=o.ALLOW_ARIA_ATTR!==!1,re=o.ALLOW_DATA_ATTR!==!1,Ge=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,nt=o.SAFE_FOR_TEMPLATES||!1,Pt=o.SAFE_FOR_XML!==!1,Z=o.WHOLE_DOCUMENT||!1,ot=o.RETURN_DOM||!1,vt=o.RETURN_DOM_FRAGMENT||!1,xt=o.RETURN_TRUSTED_TYPE||!1,ce=o.FORCE_BODY||!1,je=o.SANITIZE_DOM!==!1,Ye=o.SANITIZE_NAMED_PROPS||!1,le=o.KEEP_CONTENT!==!1,bt=o.IN_PLACE||!1,He=o.ALLOWED_URI_REGEXP||ye,it=o.NAMESPACE||G,Ut=o.MATHML_TEXT_INTEGRATION_POINTS||Ut,Ht=o.HTML_INTEGRATION_POINTS||Ht,A=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Ke(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Ke(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(A.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),nt&&(re=!1),vt&&(ot=!0),st&&(S=d({},_e),R=[],st.html===!0&&(d(S,Ae),d(R,be)),st.svg===!0&&(d(S,jt),d(R,Xt),d(R,Ot)),st.svgFilters===!0&&(d(S,Yt),d(R,Xt),d(R,Ot)),st.mathMl===!0&&(d(S,Vt),d(R,Se),d(R,Ot))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?et.tagCheck=o.ADD_TAGS:(S===ze&&(S=U(S)),d(S,o.ADD_TAGS,b))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?et.attributeCheck=o.ADD_ATTR:(R===$e&&(R=U(R)),d(R,o.ADD_ATTR,b))),o.ADD_URI_SAFE_ATTR&&d(ue,o.ADD_URI_SAFE_ATTR,b),o.FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.FORBID_CONTENTS,b)),o.ADD_FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.ADD_FORBID_CONTENTS,b)),le&&(S["#text"]=!0),Z&&d(S,["html","head","body"]),S.table&&(d(S,["tbody"]),delete _t.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=o.TRUSTED_TYPES_POLICY,At=I.createHTML("")}else I===void 0&&(I=Dn(W,s)),I!==null&&typeof At=="string"&&(At=I.createHTML(""));L&&L(o),rt=o}},Ze=d({},[...jt,...Yt,..._n]),Je=d({},[...Vt,...bn]),po=function(o){let a=It(o);(!a||!a.tagName)&&(a={namespaceURI:it,tagName:"template"});const l=wt(o.tagName),g=wt(a.tagName);return he[o.namespaceURI]?o.namespaceURI===Ft?a.namespaceURI===G?l==="svg":a.namespaceURI===kt?l==="svg"&&(g==="annotation-xml"||Ut[g]):!!Ze[l]:o.namespaceURI===kt?a.namespaceURI===G?l==="math":a.namespaceURI===Ft?l==="math"&&Ht[g]:!!Je[l]:o.namespaceURI===G?a.namespaceURI===Ft&&!Ht[g]||a.namespaceURI===kt&&!Ut[g]?!1:!Je[l]&&(co[l]||!Ze[l]):!!(St==="application/xhtml+xml"&&he[o.namespaceURI]):!1},$=function(o){lt(t.removed,{element:o});try{It(o).removeChild(o)}catch{qn(o)}},J=function(o,a){try{lt(t.removed,{attribute:a.getAttributeNode(o),from:a})}catch{lt(t.removed,{attribute:null,from:a})}if(a.removeAttribute(o),o==="is")if(ot||vt)try{$(a)}catch{}else try{a.setAttribute(o,"")}catch{}},Qe=function(o){let a=null,l=null;if(ce)o="<remove></remove>"+o;else{const _=Bt(o,/^[\r\n\t ]+/);l=_&&_[0]}St==="application/xhtml+xml"&&it===G&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const g=I?I.createHTML(o):o;if(it===G)try{a=new V().parseFromString(g,St)}catch{}if(!a||!a.documentElement){a=ee.createDocument(it,"template",null);try{a.documentElement.innerHTML=pe?At:g}catch{}}const C=a.body||a.documentElement;return o&&l&&C.insertBefore(e.createTextNode(l),C.childNodes[0]||null),it===G?to.call(a,Z?"html":"body")[0]:Z?a.documentElement:C},tn=function(o){return Jn.call(o.ownerDocument||o,o,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},de=function(o){return o instanceof y&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof m)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},en=function(o){return typeof u=="function"&&o instanceof u};function B(f,o,a){Rt(f,l=>{l.call(t,o,a,rt)})}const nn=function(o){let a=null;if(B(P.beforeSanitizeElements,o,null),de(o))return $(o),!0;const l=b(o.nodeName);if(B(P.uponSanitizeElement,o,{tagName:l,allowedTags:S}),Pt&&o.hasChildNodes()&&!en(o.firstElementChild)&&N(/<[/\w!]/g,o.innerHTML)&&N(/<[/\w!]/g,o.textContent)||o.nodeType===ht.progressingInstruction||Pt&&o.nodeType===ht.comment&&N(/<[/\w]/g,o.data))return $(o),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(l))&&(!S[l]||_t[l])){if(!_t[l]&&sn(l)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l)))return!1;if(le&&!z[l]){const g=It(o)||o.parentNode,C=Zn(o)||o.childNodes;if(C&&g){const _=C.length;for(let v=_-1;v>=0;--v){const j=Xn(C[v],!0);j.__removalCount=(o.__removalCount||0)+1,g.insertBefore(j,Kn(o))}}}return $(o),!0}return o instanceof p&&!po(o)||(l==="noscript"||l==="noembed"||l==="noframes")&&N(/<\/no(script|embed|frames)/i,o.innerHTML)?($(o),!0):(nt&&o.nodeType===ht.text&&(a=o.textContent,Rt([ne,oe,se],g=>{a=ft(a,g," ")}),o.textContent!==a&&(lt(t.removed,{element:o.cloneNode()}),o.textContent=a)),B(P.afterSanitizeElements,o,null),!1)},on=function(o,a,l){if(je&&(a==="id"||a==="name")&&(l in e||l in uo))return!1;if(!(re&&!ie[a]&&N(no,a))){if(!(We&&N(oo,a))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(a,o))){if(!R[a]||ie[a]){if(!(sn(o)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&N(A.attributeNameCheck,a)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(a,o))||a==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l))))return!1}else if(!ue[a]){if(!N(He,ft(l,Ue,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&o!=="script"&&Tn(l,"data:")===0&&Ve[o])){if(!(Ge&&!N(so,ft(l,Ue,"")))){if(l)return!1}}}}}}}return!0},sn=function(o){return o!=="annotation-xml"&&Bt(o,io)},rn=function(o){B(P.beforeSanitizeAttributes,o,null);const{attributes:a}=o;if(!a||de(o))return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let g=a.length;for(;g--;){const C=a[g],{name:_,namespaceURI:v,value:j}=C,at=b(_),Te=j;let w=_==="value"?Te:gn(Te);if(l.attrName=at,l.attrValue=w,l.keepAttr=!0,l.forceKeepAttr=void 0,B(P.uponSanitizeAttribute,o,l),w=l.attrValue,Ye&&(at==="id"||at==="name")&&(J(_,o),w=ro+w),Pt&&N(/((--!?|])>)|<\/(style|title|textarea)/i,w)){J(_,o);continue}if(at==="attributename"&&Bt(w,"href")){J(_,o);continue}if(l.forceKeepAttr)continue;if(!l.keepAttr){J(_,o);continue}if(!Be&&N(/\/>/i,w)){J(_,o);continue}nt&&Rt([ne,oe,se],cn=>{w=ft(w,cn," ")});const an=b(o.nodeName);if(!on(an,at,w)){J(_,o);continue}if(I&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!v)switch(W.getAttributeType(an,at)){case"TrustedHTML":{w=I.createHTML(w);break}case"TrustedScriptURL":{w=I.createScriptURL(w);break}}if(w!==Te)try{v?o.setAttributeNS(v,_,w):o.setAttribute(_,w),de(o)?$(o):Ee(t.removed)}catch{J(_,o)}}B(P.afterSanitizeAttributes,o,null)},ho=function f(o){let a=null;const l=tn(o);for(B(P.beforeSanitizeShadowDOM,o,null);a=l.nextNode();)B(P.uponSanitizeShadowNode,a,null),nn(a),rn(a),a.content instanceof i&&f(a.content);B(P.afterSanitizeShadowDOM,o,null)};return t.sanitize=function(f){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,l=null,g=null,C=null;if(pe=!f,pe&&(f="<!-->"),typeof f!="string"&&!en(f))if(typeof f.toString=="function"){if(f=f.toString(),typeof f!="string")throw ut("dirty is not a string, aborting")}else throw ut("toString is not a function");if(!t.isSupported)return f;if(ae||me(o),t.removed=[],typeof f=="string"&&(bt=!1),bt){if(f.nodeName){const j=b(f.nodeName);if(!S[j]||_t[j])throw ut("root node is forbidden and cannot be sanitized in-place")}}else if(f instanceof u)a=Qe("<!---->"),l=a.ownerDocument.importNode(f,!0),l.nodeType===ht.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?a=l:a.appendChild(l);else{if(!ot&&!nt&&!Z&&f.indexOf("<")===-1)return I&&xt?I.createHTML(f):f;if(a=Qe(f),!a)return ot?null:xt?At:""}a&&ce&&$(a.firstChild);const _=tn(bt?f:a);for(;g=_.nextNode();)nn(g),rn(g),g.content instanceof i&&ho(g.content);if(bt)return f;if(ot){if(vt)for(C=Qn.call(a.ownerDocument);a.firstChild;)C.appendChild(a.firstChild);else C=a;return(R.shadowroot||R.shadowrootmode)&&(C=eo.call(n,C,!0)),C}let v=Z?a.outerHTML:a.innerHTML;return Z&&S["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&N(Re,a.ownerDocument.doctype.name)&&(v="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
|
|
2
2
|
`+v),nt&&Rt([ne,oe,se],j=>{v=ft(v,j," ")}),I&&xt?I.createHTML(v):v},t.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};me(f),ae=!0},t.clearConfig=function(){rt=null,ae=!1},t.isValidAttribute=function(f,o,a){rt||me({});const l=b(f),g=b(o);return on(l,g,a)},t.addHook=function(f,o){typeof o=="function"&<(P[f],o)},t.removeHook=function(f,o){if(o!==void 0){const a=mn(P[f],o);return a===-1?void 0:dn(P[f],a,1)[0]}return Ee(P[f])},t.removeHooks=function(f){P[f]=[]},t.removeAllHooks=function(){P=Oe()},t}var Me=Ce();function Le(r,t,e=""){const n=new WeakMap,s={get(i,c){const u=Reflect.get(i,c);if(u===null||typeof u!="object")return u;const p=n.get(u);if(p)return p;const h=e?`${e}.${c}`:c,m=Le(u,t,h);return n.set(u,m),m},set(i,c,u){const p=Reflect.get(i,c);if(p!==u){Reflect.set(i,c,u);const h=e?`${e}.${c}`:c;t(h,p,u)}return!0}};return new Proxy(r,s)}function Ne(r){const t={};for(const[e,n]of Object.entries(r)){const s=typeof n=="object"&&n!==null;t[e]=s?Ne(n):n}return t}const Ct=typeof window<"u"&&typeof window.document<"u";let De=class extends Error{};const tt=class tt{constructor(t,e,n){q(this,Dt);q(this,Nt,Symbol("objectId"));q(this,H,[]);q(this,gt);q(this,Et);q(this,Y);if(!t)throw new De("name cannot be empty");if(O(tt,K).has(t))throw new De(`WrecState with name "${t}" already exists`);if(ct(this,gt,t),ct(this,Et,e),ct(this,Y,Le({},fn(this,Dt,un).bind(this))),e&&Ct){const s=sessionStorage.getItem("wrec-state-"+t),i=s?JSON.parse(s):void 0;i&&(n=i)}if(n)for(const[s,i]of Object.entries(n))this.addProperty(s,i);O(tt,K).set(t,this)}static get(t){return O(this,K).get(t)}addListener(t,e={}){const n=O(this,H).find(s=>s.listenerRef.deref()===t);if(n){const{propertyMap:s}=n;for(const[i,c]of Object.entries(e))s[i]=c}else O(this,H).push({listenerRef:new WeakRef(t),propertyMap:e})}addProperty(t,e){Object.defineProperty(this,t,{enumerable:!0,get(){return O(this,Y)[t]},set(n){O(this,Y)[t]=n}}),O(this,Y)[t]=e}get id(){return O(this,Nt)}log(){console.log("WrecState:",O(this,gt));for(const[t,e]of Object.entries(O(this,Y)))console.log(` ${t} = ${JSON.stringify(e)}`)}removeListener(t){ct(this,H,O(this,H).filter(e=>e.listenerRef.deref()!==t))}};K=new WeakMap,Nt=new WeakMap,H=new WeakMap,gt=new WeakMap,Et=new WeakMap,Y=new WeakMap,Dt=new WeakSet,un=function(t,e,n){const s=new Set;for(const i of O(this,H)){const c=i.listenerRef.deref();if(!c)s.add(i);else if(Ct&&c instanceof HTMLElement&&!c.isConnected)s.add(i);else{const{propertyMap:u}=i,p=Object.keys(u);(p.length===0||p.includes(t))&&c.changed(t,u[t],n,e,this)}}ct(this,H,O(this,H).filter(i=>!s.has(i)))},q(tt,K,new Map),Ct&&window.addEventListener("beforeunload",()=>{for(const[t,e]of O(tt,K).entries())if(O(e,Et)){const n=Ne(e);sessionStorage.setItem("wrec-state-"+t,JSON.stringify(n))}});let Mt=tt;Ct&&process.env.NODE_ENV==="development"&&(window.WrecState=Mt);function Ie(r,t){let e=r;for(const n of t.split("."))e=e[n];return e}function In(r,t,e){const n=t.split("."),s=n.length-1;let i=r;n.forEach((c,u)=>{u===s?i[c]=e:i=i[c]})}const Pn=new Set(["class","disabled","hidden","id","tabindex","title"]),vn=new Set(["onblur","onchange","onclick","onfocus","oninput","onkeydown","onreset","onsubmit"]);Me.addHook("uponSanitizeAttribute",(r,t)=>{const{attrName:e}=t,n=e.toLowerCase();vn.has(n)&&(t.forceKeepAttr=!0)});class Q extends Error{}const xn=/([a-zA-Z-]+)\s*:\s*([^;}]+)/g,Pe="a-zA-Z_$",kn=Pe+"0-9",mt=`[${Pe}][${kn}]*`,Fn=/<!--\s*(.*?)\s*-->/,Un=/<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g,qt=new RegExp(`^this\\.${mt}$`),Kt=new RegExp(`this\\.${mt}(\\.${mt})*`,"g"),ve=new RegExp(`this\\.${mt}(\\.${mt})*`),Hn=5;function zn(r){return r instanceof HTMLButtonElement||r instanceof HTMLFieldSetElement||r instanceof HTMLInputElement||r instanceof HTMLSelectElement||r instanceof HTMLTextAreaElement||r instanceof F}function $n(r,t,e){const n=document.createElement(r);if(t)for(const[s,i]of Object.entries(t))n.setAttribute(s,i);return e&&(n.innerHTML=e),n}const Wn=r=>r===String?"":r===Number?0:r===Boolean?!1:r===Array?[]:r===Object?{}:void 0;function Lt(r){const t=[];let e=r.firstElementChild;for(;e;)t.push(e),e.shadowRoot&&t.push(...Lt(e.shadowRoot)),e.firstElementChild&&t.push(...Lt(e)),e=e.nextElementSibling;return t}const dt=r=>r.substring(Hn).split(".")[0];function xe(r,t){let e=r[0];return t.forEach((n,s)=>{e+=n+r[s+1]}),e}function Zt(r){const t=typeof r;return t==="string"||t==="number"||t==="boolean"}function Tt(r){return r.localName==="textarea"}function Jt(r){const{localName:t}=r;return t==="input"||t==="select"}const Gn=r=>r.replace(/<!--[\s\S]*?-->/g,"");function ke(r,t,e,n){return r.slice(0,t)+n+r.slice(t+e)}function Bn(r){let t=r.trim(),e=null;/^\s*<tr[\s>]/i.test(t)?(t=`<table><tbody>${t}</tbody></table>`,e="tbody"):/^\s*<(td|th)[\s>]/i.test(t)?(t=`<table><tbody><tr>${t}</tr></tbody></table>`,e="tr"):/^\s*<option[\s>]/i.test(t)?(t=`<select>${t}</select>`,e="select"):/^\s*<col[\s>]/i.test(t)&&(t=`<table><colgroup>${t}</colgroup></table>`,e="colgroup");const n=Me.sanitize(t,{ADD_TAGS:["#comment"],ALLOW_UNKNOWN_PROTOCOLS:!0,RETURN_DOM_FRAGMENT:!0});if(e){const s=n.querySelector(e);if(s)return s.childNodes}return n.childNodes}function Qt(r){const t=Number(r);if(isNaN(t))throw new Q(`can't convert "${r}" to a number`);return t}function Fe(r,t,e){const[n,s]=t.split(":");if(Zt(e))if(typeof e=="boolean"){e?r.setAttribute(n,n):r.removeAttribute(n);const i=F.getPropName(n);r[i]=e}else{const i=r.getAttribute(t),c=String(e);i!==c&&(r.setAttribute(n,c),n==="value"&&Jt(r)&&(r.value=c))}else{const i=F.getPropName(t);r[i]=e}}function te(r,t,e){const[n,s]=t.split(":");r instanceof CSSStyleRule?r.style.setProperty(n,e):(Fe(r,n,e),n==="value"&&Jt(r)&&(r.value=e))}async function jn(r){const t=new Set;for(const n of Lt(r.content)){const{localName:s}=n;s.includes("-")&&t.add(s)}function e(n){return new Promise((s,i)=>{setTimeout(()=>{const c=`custom element <${n}> not defined`;i(new Error(c))},1e3)})}return Promise.all([...t].map(async n=>Promise.race([customElements.whenDefined(n),e(n)])))}class F extends HTMLElement{static attrToPropMap=new Map;static propToAttrMap=new Map;static css="";static elementName="";static formAssociated=!1;static html="";static properties;static propToComputedMap;static propToExprsMap;static template=null;#t=this.constructor;#n=new Map;#c={};#s;#l={};#f=null;#u=new Map;static define(t){if(this.elementName=t,customElements.get(t))throw new Q(`custom element ${t} is already defined`);customElements.define(t,this)}constructor(){super(),this.attachShadow({mode:"open"});const t=this.#t;t.attrToPropMap||(t.attrToPropMap=new Map),t.properties||(t.properties={}),t.propToAttrMap||(t.propToExprsMap=new Map),t.propToComputedMap||(t.propToComputedMap=new Map),t.propToExprsMap||(t.propToExprsMap=new Map)}attributeChangedCallback(t,e,n){t==="disabled"&&this.#m();const s=F.getPropName(t);if(this.#i(s)){const i=this.#_(s,String(n));this[s]=i;const c=this.#c[s];c&&this.setFormValue(c,String(i)),this.propertyChangedCallback(s,e,n)}}async#y(){const t=this.#t;let{template:e}=t;if(!e){e=t.template=document.createElement("template");let n=`<style>
|
|
3
3
|
:host([hidden]) { display: none; }`;t.css&&(n+=t.css),n+=`</style>
|
|
4
|
-
`;let s=t.html.trim();if(!s)throw new Q("static property html must be set");s.startsWith("<")||(s=`<span><!--${s}--></span>`),e.innerHTML=n+s}await jn(e),this.shadowRoot.replaceChildren(e.content.cloneNode(!0))}changed(t,e,n){this[e]=n}connectedCallback(){this.#P(),this.#w(),this.#y().then(()=>{this.hasAttribute("disabled")&&this.#m(),this.#S(this.shadowRoot),this.#d(this.shadowRoot),this.#R()})}#R(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#o(s))}#w(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))i.computed||this.#h(s,i,e);for(const[s,i]of Object.entries(n))i.computed&&this.#h(s,i,e)}#h(t,e,n){const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,t,"is a required attribute");let c=e.value;this.hasOwnProperty(t)&&(c=this[t],delete this[t]);const{type:u}=e,p=u===Boolean?c||i:n.includes(s)&&i?this.#A(t,s):c||Wn(u),h="#"+t;this[h]=p,e.computed&&this.#L(t,e),Object.defineProperty(this,t,{enumerable:!0,get(){return this[h]},set(m){u===Number&&typeof m=="string"&&(m=Qt(m));const y=this[h];if(m===y)return;this.#x(t,u,m),this[h]=m;const{state:V,stateProp:W}=this.#t.properties[t];W&&In(V,W,m),this.#D(t),this.#N(t,u,m,s),this.#E(t),this.#I(t,m);const X=this.#c[t];X&&this.setFormValue(X,String(m)),this.propertyChangedCallback(t,y,m),e.dispatch&&this.dispatch("change",{tagName:this.localName,property:t,oldValue:y,value:m})}})}#m(){const t=this.hasAttribute("disabled"),e=Lt(this.shadowRoot);for(const n of e)zn(n)&&(n.disabled=t)}disconnectedCallback(){this.#n.clear(),this.#l.clear(),this.#u.clear()}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}displayIfSet(t,e="block"){return`display: ${t?e:"none"}`}#O(t){const e=t instanceof F;for(const n of t.getAttributeNames()){const s=t.getAttribute(n),i=this.#g(t,s);if(i){const c=this[i];c===void 0&&this.#a(t,n,i),t[i]=c;let[u,p]=n.split(":");u==="value"&&(p?(t["on"+p]===void 0&&this.#e(t,n,"refers to an unsupported event name"),t.setAttribute(u,this[i])):p="change"),e&&t.#u.set(F.getPropName(u),i)}this.#r(s,t,n)}}#o(t){return new Function("return "+t).call(this)}#C(t){const{localName:e}=t;if(e==="style"){const{sheet:n}=t,s=n?.cssRules??[],i=Array.from(s);for(const c of i)if(c.constructor===CSSStyleRule){const u=Array.from(c.style);for(const p of u)if(p.startsWith("--")){const h=c.style.getPropertyValue(p);this.#r(h,c,p)}}}else{let n="";if(Tt(t)){this.#r(t.textContent,t);const s=t.textContent?.match(Fn);s&&(n=s[1])}else{const s=Array.from(t.childNodes).find(i=>i.nodeType===Node.COMMENT_NODE);s&&(n=s.textContent?.trim()??"")}if(n){const s=this.#g(t,n);s&&Tt(t)?t.textContent=this[s]:this.#r(n,t)}}}formAssociatedCallback(){let t=this.getAttribute("form-assoc");if(!t){const c=this.getAttribute("name");if(c)if(this.#i("value"))t=`value:${c}`;else return;else return}const e={},n=t.split(",");for(const c of n){const[u,p]=c.split(":");e[u.trim()]=p.trim()}this.#c=e,this.#s=new FormData,this.#f=this.attachInternals(),this.#f.setFormValue(this.#s);const s=Object.keys(this.#t.properties),i=this.#l;for(const c of s)i[c]=this[c]}formResetCallback(){const t=this.#l;for(const e of Object.keys(t)){let n=t[e];qt.test(n)&&(n=this.#o(n)),this[e]=n}}static getAttrName(t){let e=this.propToAttrMap.get(t);return e||(e=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),this.propToAttrMap.set(t,e)),e}static getPropName(t){let e=this.attrToPropMap.get(t);return e||(e=t.replace(/-([a-z])/g,(n,s)=>s.toUpperCase()),this.attrToPropMap.set(t,e)),e}#M(t,e,n){if(n.length!==1)return;const[s]=n;if(!qt.test(s))return;const i=Jt(t)||Tt(t);let[c,u]=(e??"").split(":");if(!(i&&c==="value"||Tt(t)))return;u?t["on"+u]===void 0&&this.#e(t,e,"refers to an unsupported event name"):u="change";const h=dt(s);t.addEventListener(u,m=>{const{target:y}=m;if(!y)return;const V=y.value,{type:W}=this.#t.properties[h];this[h]=W===Number?Qt(V):V,this.#E(h)})}#i(t){return!!this.#t.properties[t]}#d(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e)this.#O(n),n.firstElementChild||this.#C(n)}#T(){if(this.#t.formAssociated||this.closest("form")===null)return;const t=this.#t.name;throw new Q(`inside form, class ${t} requires "static formAssociated = true;"`)}static get observedAttributes(){const t=Object.keys(this.properties||{}).map(e=>F.getAttrName(e));return t.includes("disabled")||t.push("disabled"),t}propertyChangedCallback(t,e,n){}#g(t,e){if(!e||!qt.test(e))return;const n=dt(e);return this[n]===void 0&&this.#a(t,"",n),n}#E(t){const s=this.#t.propToExprsMap.get(t)||[];for(const i of s){let c=this.#o(i);const u=this.#n.get(i)??[];for(const p of u)if(p instanceof HTMLElement)this.#b(p,c);else if(!(p instanceof CSSStyleRule)){const{element:h,attrName:m}=p;h instanceof CSSStyleRule?h.style.setProperty(m,c):te(h,m,c)}}}#L(t,e){const{computed:n,uses:s}=e,i=this.#t.propToComputedMap;function c(p,h){let m=i.get(p);m||(m=[],i.set(p,m)),m.push([t,h])}const u=n.match(Kt)||[];for(const p of u){const h=dt(p);this[h]===void 0&&this.#a(null,t,h),typeof this[h]!="function"&&c(h,n)}if(s)for(const p of s.split(","))c(p,n)}#r(t,e,n=void 0){if(!t)return;const s=this.#p(e,n,t);if(!s){const p=t.replaceAll("this..","this.");n?te(e,n,p):"textContent"in e&&(e.textContent=p);return}const i=this.#t;s.forEach(p=>{const h=dt(p);if(typeof this[h]=="function")return;const m=i.propToExprsMap;let y=m.get(h);y||(y=[],m.set(h,y)),y.includes(t)||y.push(t)});for(const[p,h]of this.#n.entries())for(const m of h){const y=m instanceof HTMLElement||m instanceof CSSStyleRule?m:m.element;y instanceof CSSStyleRule||y.isConnected||this.#n.set(p,h.filter(V=>V!==m))}let c=this.#n.get(t);c||(c=[],this.#n.set(t,c)),c.push(n?{element:e,attrName:n}:e),e instanceof HTMLElement&&this.#M(e,n,s);const u=this.#o(t);n?te(e,n,u):this.#b(e,u)}setAttributeSafe(t,e){this.hasAttribute(t)||this.setAttribute(t,e)}setFormValue(t,e){!this.#s||!Zt(e)||(this.#s.set(t,e),this.#f?.setFormValue(this.#s))}#e(t,e,n){const s=t instanceof HTMLElement?t.localName:"CSS rule";throw new Q(`component ${this.#t.elementName}`+(t?`, element "${s}"`:"")+(e?`, attribute "${e}"`:"")+` ${n}`)}#a(t,e,n){this.#e(t,e,`refers to missing property "${n}"`)}#A(t,e){return this.#_(t,this.getAttribute(e))}#_(t,e){if(e?.match(Kt))return e;const n=this.#t,{type:s}=n.properties[t];if(s||this.#e(null,t,"does not specify its type"),s===String)return e;if(s===Number)return Qt(e);if(s===Boolean)return e==="true"?!0:e==="false"||e==="null"?!1:(e&&e!==t&&this.#e(null,t,"is a Boolean attribute, so its value must match attribute name or be missing"),e===t)}#N(t,e,n,s){if(Zt(n)
|
|
4
|
+
`;let s=t.html.trim();if(!s)throw new Q("static property html must be set");s.startsWith("<")||(s=`<span><!--${s}--></span>`),e.innerHTML=n+s}await jn(e),this.shadowRoot.replaceChildren(e.content.cloneNode(!0))}changed(t,e,n){this[e]=n}connectedCallback(){this.#P(),this.#w(),this.#y().then(()=>{this.hasAttribute("disabled")&&this.#m(),this.#S(this.shadowRoot),this.#d(this.shadowRoot),this.#R()})}#R(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#o(s))}#w(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))i.computed||this.#h(s,i,e);for(const[s,i]of Object.entries(n))i.computed&&this.#h(s,i,e)}#h(t,e,n){const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,t,"is a required attribute");let c=e.value;this.hasOwnProperty(t)&&(c=this[t],delete this[t]);const{type:u}=e,p=u===Boolean?c||i:n.includes(s)&&i?this.#A(t,s):c||Wn(u),h="#"+t;this[h]=p,e.computed&&this.#L(t,e),Object.defineProperty(this,t,{enumerable:!0,get(){return this[h]},set(m){u===Number&&typeof m=="string"&&(m=Qt(m));const y=this[h];if(m===y)return;this.#x(t,u,m),this[h]=m;const{state:V,stateProp:W}=this.#t.properties[t];W&&In(V,W,m),this.#D(t),this.#N(t,u,m,s),this.#E(t),this.#I(t,m);const X=this.#c[t];X&&this.setFormValue(X,String(m)),this.propertyChangedCallback(t,y,m),e.dispatch&&this.dispatch("change",{tagName:this.localName,property:t,oldValue:y,value:m})}})}#m(){const t=this.hasAttribute("disabled"),e=Lt(this.shadowRoot);for(const n of e)zn(n)&&(n.disabled=t)}disconnectedCallback(){this.#n.clear(),this.#l.clear(),this.#u.clear()}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}displayIfSet(t,e="block"){return`display: ${t?e:"none"}`}#O(t){const e=t instanceof F;for(const n of t.getAttributeNames()){const s=t.getAttribute(n),i=this.#g(t,s);if(i){const c=this[i];c===void 0&&this.#a(t,n,i),t[i]=c;let[u,p]=n.split(":");u==="value"&&(p?(t["on"+p]===void 0&&this.#e(t,n,"refers to an unsupported event name"),t.setAttribute(u,this[i])):p="change"),e&&t.#u.set(F.getPropName(u),i)}this.#r(s,t,n)}}#o(t){return new Function("return "+t).call(this)}#C(t){const{localName:e}=t;if(e==="style"){const{sheet:n}=t,s=n?.cssRules??[],i=Array.from(s);for(const c of i)if(c.constructor===CSSStyleRule){const u=Array.from(c.style);for(const p of u)if(p.startsWith("--")){const h=c.style.getPropertyValue(p);this.#r(h,c,p)}}}else{let n="";if(Tt(t)){this.#r(t.textContent,t);const s=t.textContent?.match(Fn);s&&(n=s[1])}else{const s=Array.from(t.childNodes).find(i=>i.nodeType===Node.COMMENT_NODE);s&&(n=s.textContent?.trim()??"")}if(n){const s=this.#g(t,n);s&&Tt(t)?t.textContent=this[s]:this.#r(n,t)}}}formAssociatedCallback(){let t=this.getAttribute("form-assoc");if(!t){const c=this.getAttribute("name");if(c)if(this.#i("value"))t=`value:${c}`;else return;else return}const e={},n=t.split(",");for(const c of n){const[u,p]=c.split(":");e[u.trim()]=p.trim()}this.#c=e,this.#s=new FormData,this.#f=this.attachInternals(),this.#f.setFormValue(this.#s);const s=Object.keys(this.#t.properties),i=this.#l;for(const c of s)i[c]=this[c]}formResetCallback(){const t=this.#l;for(const e of Object.keys(t)){let n=t[e];qt.test(n)&&(n=this.#o(n)),this[e]=n}}static getAttrName(t){let e=this.propToAttrMap.get(t);return e||(e=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),this.propToAttrMap.set(t,e)),e}static getPropName(t){let e=this.attrToPropMap.get(t);return e||(e=t.replace(/-([a-z])/g,(n,s)=>s.toUpperCase()),this.attrToPropMap.set(t,e)),e}#M(t,e,n){if(n.length!==1)return;const[s]=n;if(!qt.test(s))return;const i=Jt(t)||Tt(t);let[c,u]=(e??"").split(":");if(!(i&&c==="value"||Tt(t)))return;u?t["on"+u]===void 0&&this.#e(t,e,"refers to an unsupported event name"):u="change";const h=dt(s);t.addEventListener(u,m=>{const{target:y}=m;if(!y)return;const V=y.value,{type:W}=this.#t.properties[h];this[h]=W===Number?Qt(V):V,this.#E(h)})}#i(t){return!!this.#t.properties[t]}#d(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e)this.#O(n),n.firstElementChild||this.#C(n)}#T(){if(this.#t.formAssociated||this.closest("form")===null)return;const t=this.#t.name;throw new Q(`inside form, class ${t} requires "static formAssociated = true;"`)}static get observedAttributes(){const t=Object.keys(this.properties||{}).map(e=>F.getAttrName(e));return t.includes("disabled")||t.push("disabled"),t}propertyChangedCallback(t,e,n){}#g(t,e){if(!e||!qt.test(e))return;const n=dt(e);return this[n]===void 0&&this.#a(t,"",n),n}#E(t){const s=this.#t.propToExprsMap.get(t)||[];for(const i of s){let c=this.#o(i);const u=this.#n.get(i)??[];for(const p of u)if(p instanceof HTMLElement)this.#b(p,c);else if(!(p instanceof CSSStyleRule)){const{element:h,attrName:m}=p;h instanceof CSSStyleRule?h.style.setProperty(m,c):te(h,m,c)}}}#L(t,e){const{computed:n,uses:s}=e,i=this.#t.propToComputedMap;function c(p,h){let m=i.get(p);m||(m=[],i.set(p,m)),m.push([t,h])}const u=n.match(Kt)||[];for(const p of u){const h=dt(p);this[h]===void 0&&this.#a(null,t,h),typeof this[h]!="function"&&c(h,n)}if(s)for(const p of s.split(","))c(p,n)}#r(t,e,n=void 0){if(!t)return;const s=this.#p(e,n,t);if(!s){const p=t.replaceAll("this..","this.");n?te(e,n,p):"textContent"in e&&(e.textContent=p);return}const i=this.#t;s.forEach(p=>{const h=dt(p);if(typeof this[h]=="function")return;const m=i.propToExprsMap;let y=m.get(h);y||(y=[],m.set(h,y)),y.includes(t)||y.push(t)});for(const[p,h]of this.#n.entries())for(const m of h){const y=m instanceof HTMLElement||m instanceof CSSStyleRule?m:m.element;y instanceof CSSStyleRule||y.isConnected||this.#n.set(p,h.filter(V=>V!==m))}let c=this.#n.get(t);c||(c=[],this.#n.set(t,c)),c.push(n?{element:e,attrName:n}:e),e instanceof HTMLElement&&this.#M(e,n,s);const u=this.#o(t);n?te(e,n,u):this.#b(e,u)}setAttributeSafe(t,e){this.hasAttribute(t)||this.setAttribute(t,e)}setFormValue(t,e){!this.#s||!Zt(e)||(this.#s.set(t,e),this.#f?.setFormValue(this.#s))}#e(t,e,n){const s=t instanceof HTMLElement?t.localName:"CSS rule";throw new Q(`component ${this.#t.elementName}`+(t?`, element "${s}"`:"")+(e?`, attribute "${e}"`:"")+` ${n}`)}#a(t,e,n){this.#e(t,e,`refers to missing property "${n}"`)}#A(t,e){return this.#_(t,this.getAttribute(e))}#_(t,e){if(e?.match(Kt))return e;const n=this.#t,{type:s}=n.properties[t];if(s||this.#e(null,t,"does not specify its type"),s===String)return e;if(s===Number)return Qt(e);if(s===Boolean)return e==="true"?!0:e==="false"||e==="null"?!1:(e&&e!==t&&this.#e(null,t,"is a Boolean attribute, so its value must match attribute name or be missing"),e===t)}#N(t,e,n,s){if(Zt(n)){const i=e===Boolean?this.hasAttribute(s):this.#A(t,s);n!==i&&Fe(this,s||t,n)}}#D(t){const n=this.#t.propToComputedMap.get(t)||[];for(const[s,i]of n)this[s]=this.#o(i)}#b(t,e){if(e===void 0)return;const n=t instanceof HTMLElement;Array.isArray(e)&&(e=e.join(""));const s=typeof e;s!=="string"&&s!=="number"&&this.#e(t,void 0," computed content is not a string or number");const i=String(e);if(t instanceof HTMLElement&&Tt(t))t.value=i;else if(n&&s==="string"&&i.trim().startsWith("<")){const c=Bn(i);t.replaceChildren(...c),this.#S(t),this.#d(t)}else n&&(t.textContent=i)}#I(t,e){const n=this.#u.get(t);if(!n)return;const s=this.getRootNode();if(!(s instanceof ShadowRoot))return;const{host:i}=s;if(!i)return;const c=i;c[n]=e}useState(t,e){if(!e){e={};for(const n of Object.keys(t))e[n]=n}this.#v(t,e);for(const[n,s]of Object.entries(e))if(this.#i(s)){const i=Ie(t,n);i!==void 0&&(this[s]=i);const c=this.#t.properties[s];c.state=t,c.stateProp=n}t.addListener(this,e)}#P(){const t=new Set(Object.keys(this.#t.properties));for(const e of this.getAttributeNames())if(!Pn.has(e)&&!e.startsWith("on")){if(e==="form-assoc"){this.#T();continue}if(!t.has(F.getPropName(e))){if(e==="name"){this.#T();continue}this.#e(null,e,"is not a supported attribute")}}}#p(t,e,n){const s=n.match(Kt);if(s)return s.forEach(i=>{const c=dt(i);this[c]===void 0&&this.#a(t,e,c)}),s}#v(t,e){for(const[n,s]of Object.entries(e)){let i=Ie(t,n);if(i===void 0)throw new Q(`invalid state path "${n}"`);i=this[s],this.#i(s)||this.#e(null,s,"refers to missing property in useState map")}}#x(t,e,n){if(n instanceof e)return;let s=typeof n;if(s==="object"){const{constructor:i}=n;s=i.name,i!==e&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}s!==e.name.toLowerCase()&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}#S(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e){const s=[];for(const i of Array.from(n.attributes)){const c=i.name;if(c.startsWith("on")){let u=c.slice(2);u=u[0].toLowerCase()+u.slice(1).toLowerCase();const p=i.value;this.#p(n,c,p);let h;typeof this[p]=="function"?h=m=>this[p](m):(this.#p(n,c,p),h=()=>this.#o(p)),n.addEventListener(u,h),s.push(c)}}for(const i of s)n.removeAttribute(i)}}}function Yn(r,...t){let e=xe(r,t);for(;;){const n=xn.exec(e);if(!n)break;const s=n[2];if(ve.test(s)){const i=n[1];if(!i.startsWith("--")){const c=`--${i}: ${s};
|
|
5
5
|
${i}: var(--${i})`;e=ke(e,n.index,n[0].length,c)}}}return e}function Vn(r,...t){let e=xe(r,t);for(;;){const n=Un.exec(e);if(!n||n[1]==="style")break;const s=Gn(n[2]);if(ve.test(s)){const i=`<!-- ${s.trim()} -->`,c=n.index+n[0].indexOf(">")+1;e=ke(e,c,s.length,i)}}return e}T.Wrec=F,T.WrecState=Mt,T.createElement=$n,T.css=Yn,T.html=Vn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
|