jqx-es 1.2.3 → 1.2.4

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.
@@ -12,4 +12,4 @@ ${r}`),f}}return{sheet:t,removeRules:p,tryParseAtOrNestedRules:h,ruleExists:u,ch
12
12
  `).replaceAll("\\3b",";").split(`
13
13
  `)}function Lt(t){return t.reduce((e,r)=>{let[n,o]=[r.slice(0,r.indexOf(":")).trim(),r.slice(r.indexOf(":")+1).trim().replace(/;$|;.+(?=\/*).+\/$/,"")];return n&&o?{...e,[n]:o}:e},{})}function Ct(t){return Lt(wt(t))}function $e(t,e){return t?.replace("::",":")===e?.replace("::",":")}var Ft=[...Array(26)].map((t,e)=>String.fromCharCode(e+65)).concat([...Array(26)].map((t,e)=>String.fromCharCode(e+97))).concat([...Array(10)].map((t,e)=>`${e}`)),$=Pt(),He={get(t,e){return t[K(e)]||t[e]},enumerable:!1,configurable:!1},C=new Proxy({start:"afterbegin",afterbegin:"afterbegin",end:"beforeend",beforeend:"beforeend",before:"beforebegin",beforebegin:"beforebegin",after:"afterend",afterend:"afterend"},{get(t,e){return t[String(e).toLowerCase()]??t[e]}});function X(t,e=2){return`${t}`.padStart(e,"0")}function Tt(t,e=0){return[t,e]=[Math.floor(t),Math.ceil(e)],Math.floor([...crypto.getRandomValues(new Uint32Array(1))].shift()/2**32*(t-e+1)+e)}function F(t,e=1){return e=a(e,Number)&&e||1,a(t,String)&&t.length>=e}function Ne(t){return t=a(t,String)&&/,/.test(t)?t.split(","):t,a(t,Array)?t.filter(e=>F(e)).map(e=>e.trim().toLowerCase()):a(t,String)&&t?.trim().toLowerCase()||""}function $t(t){let e=t.length;for(;e--;){let r=Tt(e);[t[e],t[r]]=[t[r],t[e]]}return t}function A(t,e=120){return`${t}`.trim().slice(0,e).replace(/>\s+</g,"><").replace(/</g,"&lt;").replace(/\s{2,}/g," ").replace(/\n/g,"\\n")+(t.length>e?" &hellip;":"").trim()}function D(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`).replace(/^-|-$/,"")}function At([t,...e]){return`${t.toUpperCase()}${e.join("")}`}function K(t){return a(t,String)?t.toLowerCase().split("-").map((e,r)=>r&&`${At(e)}`||e).join(""):t}function V(){return`_${$t(Ft).slice(0,8).join("")}`}function ce(t,e=120){return A(t,e).replace(/&lt;/g,"<")}function Ae(){return(t=>`[${X(t.getHours())}:${X(t.getMinutes())}:${X(t.getSeconds())}.${X(t.getMilliseconds(),3)}]`)(new Date)}function j(t){return t.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function q(t){return a(t,Comment,Text)}function P(t){return a(t,Text,HTMLElement,Comment)}function Me(t){a(t,Comment)}function Dt(t){return a(t,Text)}function ee(t){return a(t,String)&&/^<|>$/.test(`${t}`.trim())}function te(t){return a(t,Array)&&!t?.find(e=>!P(e))}function ue(t){return a(t,Array)&&!t?.find(e=>!ee(e))}function fe(t){return t?.filter(e=>e).reduce((e,r)=>e.concat(Me(r)?`<!--${r.data}-->`:q(r)?r.textContent:r.outerHTML),"")}function de(t){return t?a(t,Proxy)?[t.EL]:a(t,NodeList)?[...t]:P(t)?[t]:te(t)?t:t.isJQx?t.collection:void 0:[]}function me(t,e,r){let n=e!==document.body&&a(t,String)&&t.toLowerCase()!=="body"?e:document,o;try{r.collection=[...n.querySelectorAll(t)]}catch{o=`Invalid CSS querySelector. [${a(t,String)?t:"Nothing valid given!"}]`}let l=r.collection.length;return l<1?`CSS querySelector "${t}", output: nothing`:o??`CSS querySelector "${t}", output ${l} element${l>1?"s":""}`}function ge(t){let e=t.data.get("hid")||`HID${V()}`;return t.data.add({hid:e}),`[data-hid="${e}"]`}function Pe(){return{isCommentOrTextNode:q,isNode:P,isComment:Me,isText:Dt,isHtmlString:ee,isArrayOfHtmlElements:te,isArrayOfHtmlStrings:ue,ElemArray2HtmlString:fe,input2Collection:de,setCollectionFromCssSelector:me,addHandlerId:ge}}function Ht(t){if(!t)return;let e=t.style,r=getComputedStyle(t),n=[e.visibility,r.visibility].includes("hidden"),o=[e.display,r.display].includes("none"),l=t.offsetTop<0||t.offsetLeft+t.offsetWidth<0||t.offsetLeft>document.body.offsetWidth,u=+r.opacity==0||+(e.opacity||1)==0;return!(l||u||o||n)}function Nt(t){return[...t.parentNode.querySelectorAll(":is(:read-write)")].find(e=>e===t)??!1}function Mt(t){return[...t.parentNode.querySelectorAll(":is(:modal)")].find(e=>e===t)??!1}function Oe(){let e={notInDOM:!0,writable:"n/a",modal:"n/a",empty:!0,open:"n/a",visible:"n/a"};return r=>{let n=r.node;return a(n,Node)?{get writable(){return Nt(n)},get modal(){return Mt(n)},get inDOM(){return n.isConnected},get open(){return n.open??!1},get visible(){return Ht(n)},get disabled(){return n.hasAttribute("readonly")||n.hasAttribute("disabled")},get empty(){return r.collection.length<1},get virtual(){return r.isVirtual}}:e}}function De(t){return a(t,String)&&Object.assign(document.createElement("textarea"),{innerHTML:t}).textContent||t}function Pt(){let t=!1,e=[],r={get on(){return t=!0,r},get off(){return t=!1,r},get backLog(){return e}};function n(...l){return e.unshift(...l.map(u=>`${Ae()} \u2A3B ${De(u)}`)),console.error(e.slice(0,l.length).join(`
14
14
  `)),r}function o(...l){return e.unshift(...l.map(u=>`${Ae()} \u2714 ${De(u)}`)),t&&console.log(e.slice(0,l.length).join(`
15
- `)),r}return Object.defineProperties(r,{log:{value:o,enumerable:!1},error:{value:n,enumerable:!1}}),Object.freeze(r)}var pe=!1,Ot={on:()=>pe=!0,off:()=>pe=!1},B={tagsRaw:W,allowUnknownHtmlTags:Ot,isAllowed(t){if(pe)return!0;let e=a(t,String)?t.toLowerCase():t?.nodeName.toLowerCase()||"none";return e==="#text"||!!W[e]},allowTag:t=>W[t.toLowerCase()]=!0,prohibitTag:t=>W[t.toLowerCase()]=!1};var It=!0,re={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/^javascript|injected|noreferrer|alert|DataURL/gi};function Rt(t){if(It&&Object.keys(t.removed).length){let e=Object.entries(t.removed).reduce((r,[n,o])=>[...r,`${j(n)} => ${o}`],[]).join("\\000A");$.error(`JQx: HTML creation error(s): ${e}`)}}function kt(t){let e=t.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(e)&&!r.find(n=>n===e)||B.isAllowed(e)}function U(t){let e={rawHTML:t?.parentElement?.getHTML()??"no html",removed:{}};return a(t,HTMLElement)&&[...t.childNodes].forEach(r=>{if(r?.children?.length&&U(r),r?.attributes){let o=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let u=l.name.trim().toLowerCase(),h=l.value.trim().toLowerCase().replace(re.whiteSpace,""),p=u==="href"?!re.validURL.test(h):re.notAllowedValues.test(h),y=u.startsWith("data")?!re.data.test(u):!!o[u];if(p||y){let b=ce(l.value||"none",60);b+=b.length===60?"...":"",e.removed[`${l.name}`]=`attribute/property/value not allowed, removed. Value: ${b}`,r.removeAttribute(l.name)}})}if(!(kt(r)||r.constructor===CharacterData||r.constructor===Comment)){let o=(r?.outerHTML||r?.textContent).trim(),l=ce(o,60)??"EMPTY";l+=l.length===60?"...":"",e.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),Rt(e),t}function jt(t){let e=document.createElement("div");return e.insertAdjacentHTML(C.end,t),e.childNodes.length?U(e):void 0}function Bt(t,e,r){return a(t,Comment)?e.insertAdjacentHTML(r,`<!--${t.data}-->`):e.insertAdjacentText(r,t.data)}function _(t=[],e=document.body,r=C.BeforeEnd){r=r||C.BeforeEnd,t.reduce((n,o)=>{let l=P(o)&&Jt(o,e,r);return l?[...n,l]:n},[])}function Jt(t,e=document.body,r=C.BeforeEnd){return r=r||C.BeforeEnd,e=e?.isJQx?e?.[0]:e,a(t,Comment,Text)?Bt(t,e,r):a(t,HTMLElement)?e.insertAdjacentElement(r,t):void 0}function H(t){if(a(t,Text,Comment))return t;let e=t?.trim(),r=e?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(o=>o.length).shift():void 0),e.startsWith("<!--")&&e.endsWith("-->"))return document.createComment(t.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(e))return document.createTextNode(r);let n=jt(t);return n.childNodes.length<1?H(`<span data-jqxcreationerror="1">${A(t,60)}</span>`):n.children[0]}var Qt=Oe();function Ie(t){return t&&(t.textContent="")}function E(t,e){let r=t.collection.filter(n=>!q(n));for(let n=0;n<r.length;n+=1)e(r[n],n);return t}function Q(t){let e=t.cloneNode(!0);return e.removeAttribute&&e.removeAttribute("id"),t.isConnected?t.remove():t=null,e}function je(t,e){if(t&&a(e,Object))for(let[r,n]of Object.entries(e))t.setAttribute(`data-${D(r)}`,n)}function Re(t,e){return t.andThen(e,!0)}function ke(t,e){return t.andThen(e)}function Be(t){return t.startsWith("data")||J.html.find(e=>t.toLowerCase()===e)}function Wt(t,e,r,n){r&&a(e,String)&&(e={[e]:r==="-"?"":r});let o;e.className&&(o=e.className,delete e.className),o=[...t.classList].find(u=>u.startsWith("JQxClass-")||o&&u===o)||o||`JQxClass-${V().slice(1)}`,n.editCssRule(`.${o}`,e),t.classList.add(o)}function zt(t,e){if(t)for(let[r,n]of Object.entries(e)){if(r=D(r),r.startsWith("data"))return je(t,n);a(n,String)&&Be(r)&&t.setAttribute(r,n.split(/[, ]/)?.join(" "))}}function ye(t,e){if(a(e,Object))for(let[r,n]of Object.entries(e)){let o;/!important/i.test(n)&&(n=n.slice(0,n.indexOf("!")).trim(),o="important"),t.style.setProperty(D(r),n,o)}}function Vt(...t){debugLog.log("\u2757"+t.map(e=>String(e)).join(", "))}function be(t,e=0,r=!0){return t=t?.parentElement,e+=t?t[r?"scrollTop":"scrollLeft"]:0,t?be(t,e,r):e}function Ut(t){return{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},He)},set:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},get:(r,n)=>e.data.all[r]??n,add:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},remove:r=>(e[0]?.removeAttribute(`data-${D(r)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let r=e[0],n=e.first()?.getBoundingClientRect().toJSON();return n.scrollTopDistance=be(r,0),n.scrollLeftDistance=be(r,0,!1),n},node:e=>e[0],HTML:e=>({get:(r,n)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=r?e.outerHtml:e.html();return n?j(o):o},set:(r,n=!1,o=!1)=>{r=r.isJQx?r.HTML.get(1):r;let l=a(r,String);return r=l&&o?j(r):r,l&&(r||"").trim().length&&e.html(r,n),e},replace:(r,n=!1)=>e.HTML.set(r,!1,n),append:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r,!0,n)),insert:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r+e.HTML.get(),!1,n))}),is:e=>Qt(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let r=t(e[0]?.parentNode);return r.is.empty?e:r},render:e=>(!e.is.empty&&e.toDOM()||t.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:r=>e.style(r),inSheet:r=>e.css(r),valueOf:r=>e.is.empty?void 0:getComputedStyle(e[0])[D(r)],nwRule:r=>e.Style.byRule({rules:r}),byRule:({classes2Apply:r=[],rules:n=[]}={})=>{let l=a(n,String)&&!r.length?n.split("{")[0].trim():"";if(n=n&&a(n,String)?[n]:n,r=r&&a(r,String)?[r]:r,(n?.length||r?.length)&&(n?.length&&t.editCssRules(...n),r))for(let u of r)e.addClass(u);return l?.startsWith(".")&&e.addClass(l.slice(1)),l?.startsWith("#")&&!e.attr("id")&&e.prop({id:l.slice(1)}),e}})}}function _t(t){return{addClass:(e,...r)=>E(e,n=>n&&r.forEach(o=>n.classList.add(o))),after:ke,afterMe:ke,andThen:(e,r,n=!1)=>{if(!r||!a(r,String,Node,Proxy))return Vt(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${r}]`),e;r=r?.isJQx?r.collection:a(r,Node)?t.virtual(r).collection:t.virtual(H(r)).collection;let[o,l,u]=n?[0,"before",r.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(r)];return e[o][l](...r),e.collection=u,e},append:(e,...r)=>{if(!e.is.empty&&r.length){let n=e.length===1;for(let o of r){if(!o.isJQx&&F(o)){let l=o.trim(),h=!/^<(.+)[^>]+>$/m.test(l)?t.text(o):H(o);E(e,p=>p.append(n?h:Q(h)))}P(o)&&E(e,l=>l.append(n?o:Q(o))),o.isJQx&&!o.is.empty&&E(e,l=>o.collection.forEach(u=>l.append(n?u:Q(u))))}}return e},appendTo:(e,r)=>(r.isJQx||(r=t(r)),r.append(e),e),attr:(e,r,n)=>{let o=e[0];if(!o)return e;if(!n&&F(r))return r=D(r),r==="class"?[...o?.classList].join(" "):o?.getAttribute(r);if(F(r)&&n)switch(r=D(r),!0){case r.startsWith("data-"):r={data:{[r.replace("data-","")]:n}};break;default:r={[r]:n}}return a(r,Object)&&!e.is.empty&&zt(o,r),e},before:Re,beforeMe:Re,clear:e=>E(e,Ie),closest:(e,r)=>{let n=F(r)?e[0].closest(r):null;return n?t(n):e},computedStyle:(e,r)=>e.first()&&getComputedStyle(e.first())[r],css:(e,r,n)=>E(e,o=>Wt(o,r,n,t)),duplicate:(e,r=!1,n=document.body)=>{let o=e.toNodeList().map(u=>u.removeAttribute&&u.removeAttribute("id")||u),l=t.virtual(o);return r?l.toDOM(n):l},each:(e,r)=>E(e,r),empty:e=>E(e,Ie),find:(e,r)=>e.collection.length>0?[...e.first()?.querySelectorAll(r)]:[],find$:(e,r)=>e.collection.length>0?t(r,e):e,first:(e,r=!1)=>{if(e.collection.length>0)return r?e.single():e.collection[0]},first$:(e,r)=>e.single(r),getData:(e,r,n)=>e.first()&&e.first().dataset?.[r]||n,hasClass:(e,...r)=>{let n=e[0];return!n||!n.classList.length?!1:r.find(o=>n.classList.contains(o))&&!0||!1},hide:e=>E(e,r=>ye(r,{display:"none !important"})),html:(e,r,n)=>{if(r===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${r.isJQx?r.HTML.get(!0):r}</div>`);if(!a(o,Comment))return E(e,u=>(n||(u.textContent=""),u.insertAdjacentHTML(t.at.end,o.getHTML())))}return e},htmlFor:(e,r,n="",o=!1)=>{if(r&&e.collection.length){if(!r||!F(n))return e;let l=e.find$(r);if(l.length<1)return e;let u=H(`<span>${n}</span>`);l.each(h=>{o||(h.textContent=""),h.insertAdjacentHTML(t.at.end,u?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,r)=>e.single(r),on:(e,r,...n)=>{if(e.collection.length&&a(r,String,Array)){if(r?.length<1||n.length<1)return e;let o=ge(e);t.handle({type:r,selector:o,handlers:n})}return e},prepend:(e,...r)=>{if(!e.is.empty&&r){let n=e.length===1;for(let o of r){if(F(o)){o=o.trim();let u=!/^<(.+)[^>]+>$/m.test(o)?t.text(o):H(o);u=n?u:Q(u),E(e,h=>h.prepend(u.cloneNode(!0)))}P(o)&&E(e,l=>l.prepend(n?o:Q(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),E(e,l=>E(o,u=>l.prepend(n?u:Q(u)))),o.collection.reverse())}}return e},prependTo:(e,r)=>(r.isJQx||(r=t.virtual(r)),r.prepend(e),e),prop:(e,r,n)=>{if(a(r,String)&&!n)return r.startsWith("data")?e[0]?.dataset[r.slice(r.indexOf("-")+1)]:e[0]?.[r];let o=a(r,Object)?r:{[r]:n};for(let[l,u]of Object.entries(o)){if(l=l.trim(),u&&!Be(l)||!u)return!1;if(l.toLowerCase()==="id")return e[0].id=u;E(e,p=>{if(l.startsWith("data"))return p.dataset[l.slice(l.indexOf("-")+1)]=u;p[l]=u})}return e},remove:(e,r)=>{$.log(`remove ${A(e.HTML.get(1),40)}${r?` /w selector ${r}`:""}`);let n=l=>l.remove(),o=()=>e.collection=e.collection.filter(l=>document.documentElement.contains(l));if(r){let l=e.find$(r);return l.is.empty||(E(l,n),o()),e}return E(e,n),o(),e},rmAttr:(e,...r)=>{for(let n of r)e.node.removeAttribute(n);return e},removeClass:(e,...r)=>E(e,n=>{if(n)for(let o of r)n.classList.remove(o)}),renderTo:(e,r=document.body,n=t.at.end)=>(e.first$().toDOM(r,n),e),replace:(e,r,n)=>{let o=e[0];return!r||!n||!a(n,HTMLElement)&&!n.isJQx?(console.error("JQx replace: invalid replacement value"),e):(n.isJQx&&(n=n[0]),a(n,NodeList)&&(n=n[0]),o&&r&&(r=a(r,String)?o.querySelectorAll(r):r.isJQx?r.collection:r,a(r,HTMLElement,NodeList,Array)&&a(n,HTMLElement)&&(a(r,HTMLElement)?[r]:[...r]).forEach(l=>l.replaceWith(n.cloneNode(!0)))),e)},replaceClass:(e,r,...n)=>E(e,o=>{o.classList.remove(r);for(let l of n)o.classList.add(l)}),replaceMe:(e,r)=>e.replaceWith(r),replaceWith:(e,r)=>(r=a(r,Element)?r:r.isJQx?r[0]:void 0,r&&(e[0].replaceWith(r),e=t.virtual(r)),e),setData:(e,r)=>E(e,n=>je(n,r)),show:e=>E(e,r=>ye(r,{display:"revert-layer !important"})),single:(e,r)=>e.collection.length>0?a(r,String)?e.find$(r):a(r,Number)?t(e.collection[r]):t(e.collection[0]):e,style:(e,r,n)=>E(e,l=>{n&&a(r,String)&&(r={[r]:n||"none"}),ye(l,r)}),text:(e,r,n=!1)=>e.isEmpty()?e:a(r,String)?E(e,l=>l.textContent=n?l.textContent+r:r):e.first().textContent,toDOM:(e,r=document.body,n=C.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),e.collection=_(e.collection,r,n),e),toggleClass:(e,r)=>E(e,n=>n.classList.toggle(r)),toNodeList:e=>[...e.collection].map(r=>document.importNode(r,!0)),trigger:(e,r,n=Event,o={})=>{if(e.collection.length){let l=new n(r,{...o,bubbles:o.bubbles??!0});for(let u of e.collection)u.dispatchEvent(l)}return e},val:(e,r)=>{let n=e[0];return!n||!a(n,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:r===void 0?n.value:(n.value=a(r,String)?r:"",e)}}}function Je(t){return{factoryExtensions:Ut(t),instanceExtensions:_t(t)}}function Qe(t){if(t.node("#jqxPopup"))return;t.logger.log("JQx: [JQx].Popup first call. Dialog element created."),t.dialog({id:"jqxPopup"},t.div({id:"jqxPopupContent"})).render,t.editCssRules(...ve);let[e,r]=[t("#jqxPopupContent"),t.node("#jqxPopup")],n={};return t.handle({type:"click, keydown",handlers:y,capture:!0}),Object.freeze({show:o,removeModal:p});function o(m){if(r.open)return;n={...m};let{content:g}=n;return t.IS(g,String,HTMLElement)||g?.isJQx?u():!0}function l(){return n.modal?x(n.warnMessage):h()}function u(){e.clear();let{content:m,modal:g,closeAfter:f}=n;g=t.IS(g,Boolean)?g:!1;let S=g?"":t.div({id:"closeHandleIcon"});e.append(S,t.IS(m,String)?t.div(m):m),r.showModal(),!g&&t.IS(f,Number)&&b(l,f)}function h(){if(r.close(n.returnValue),t.IS(n.callback,Function))return n.callback(n.returnValue);n={}}function p({callback:m,value:g}={}){n.returnValue=g,n.modal=!1,n.callback=m||n.callback,l()}function y(m){if(!(Object.keys(n).length<1||!r.open))return m.key==="Escape"&&m.preventDefault(),n.activeTimer&&clearTimeout(n.activeTimer),(m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),document.activeElement.blur()}function b(m,g){t.IS(m,Function)&&t.IS(g,Number)&&g>0&&(n.activeTimer=setTimeout(m,g*1e3))}function x(m){if(!t.IS(m,String,HTMLElement,Proxy))return;let g=e.find$(".warn");switch(!0){case g.is.empty:g=t.div({class:"warn"},m);default:e.append(g.addClass("active")),b(()=>e.find$(".warn").removeClass("active"),2)}}}var N={},Gt=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],We=t=>!!Gt.find(e=>e===t);function ze(t){return function(o){let{eventType:l,selector:u,callback:h,name:p,capture:y,once:b,canRemove:x}=o;switch(!0){case(!F(l)||!t.IS(h,Function)):default:p=p||!/handlers$/.test(h.name)&&h.name||void 0,y=t.IS(y,Boolean)?y:!1,b=t.IS(b,Boolean)?b:!1,x=F(p,4)&&t.IS(x,Boolean)?x:b;let{handler:m,signal:g,remove:f}=e({selector:u,callback:h,canRemove:x,once:b,name:p,eventType:l});return n({eventType:l,handler:m,capture:y,once:b,signal:g,remove:f,name:p})}};function e(o){let{selector:l,callback:u,canRemove:h,name:p,eventType:y,once:b}=o,x=(h||b)&&new AbortController,m=r({once:b,abortcontroller:x,name:p,eventType:y}),g=l?{handler:f=>{let S=f.target?.closest?.(l);return S&&u(f,t(S),m)},remove:m}:{handler:f=>u(f,f.target,m),remove:m};return x&&(g.signal=x.signal,b)?{handler:(f,S)=>{g.handler(f,S),m()}}:g}function r(o){let{once:l,abortcontroller:u,name:h,eventType:p}=o;return h?u?function(){u.abort();let b=[...N[p].entries()].find(([x,m])=>m.name===h);N[p].delete(b[0]),setTimeout(()=>t.logger.log(`Listener for event type [${p}] with name [${h}] was removed${l?" (once active, so handled once).":""}`),100)}:function(y){t.logger.error(`Listener for event type [${p}] with name [${h}] is not marked as removable`)}:function(){t.logger.error("An anonymous listener can not be removed")}}function n(o){let{eventType:l,handler:u,capture:h,once:p,signal:y,remove:b,name:x}=o;if(N[l]||(N[l]=new Map),!(N[l].has(u)||[...N[l].values()].find(g=>(g.name||"")===x))){let g={capture:h||We(l),once:p||!1};y&&(g.signal=y),document.addEventListener(l,u,g);let f={name:x,remove:b,capture:h||We(l)};N[l].set(u,f)}}}var he,ne,{isComment:tn,isText:rn,isHtmlString:nn,isArrayOfHtmlElements:on,isArrayOfHtmlStrings:ln,ElemArray2HtmlString:sn,addHandlerId:an,cssRuleEdit:Se,addFn:Zt}=Yt();function Yt(){let t=Y({createWithId:"JQxStylesheet"}),e=(r,n)=>ne[r]=(o,...l)=>n(o,...l);return{...Pe(),cssRuleEdit:t,addFn:e}}function G(t){return new Proxy(t,{get:(e,r)=>Xt(e,r,t)})}function Ve(t,e){return(...r)=>a(t,Function)&&t(G(e),...r)}function Xt(t,e,r){switch(!0){case a(e,Symbol):return t;case a(+e,Number):return t.collection?.[e]||void 0;case e in he:return Ve(he[e],r)();case e in ne:return Ve(ne[e],r);default:return t[e]}}function _e(t){let e=rr(t);for(let[r,n]of Object.entries(Object.getOwnPropertyDescriptors(e)))Object.defineProperty(t,r,n);return t}function Kt(t){return{allow:e=>{let r=/-/.test(e),n=r&&e;e=r?K(e):e.toLowerCase(),B.allowTag(e),a(t[e],Function)||Object.defineProperties(t,xe(e,!0,t,n))},prohibit:e=>{e=e.toLowerCase(),B.prohibitTag(e),a(t[e],Function)&&Object.defineProperties(t,xe(e,!1,t))}}}function Ue(...t){if(t.length===1){let e=String(t.shift().trim());t=e.startsWith("!")?[e.slice(1,-1)]:e.split(",").map(r=>r.trim())}for(let e of t.map(r=>r.startsWith("!")?r.slice(1,-1):r))Se(e,{removeRule:1})}function qt(t){return function(e,r,n){r=r?.isJQx?r?.[0]:r,n=n&&Object.values(C).find(l=>n===l);let o=t(e,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of o.collection)n?r.insertAdjacentElement(n,l):r.append(l);return o}}function er(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);for(let[o,l]of Object.entries(n))!(o in e)&&Object.defineProperty(e,o,l)}return e}function tr(t,e,r,n){return t=D(n||t.toLowerCase()),{get(){return(...o)=>e&&r.virtual(U(ie[t](...o)))},enumerable:!1,configurable:!0}}function xe(t,e,r,n){t=t.toLowerCase();let o=tr(t,e,r,n);return n?{[n]:o,[K(n)]:o}:{[t]:o,[t.toUpperCase()]:o}}function rr(t){return er(Object.entries(B.tagsRaw).reduce(nr(t),{}),cr(t))}function nr(t){return function(e,[r,n]){return n&&Object.defineProperties(e,xe(r,n,t)),e}}function or(t){return function(e,r,...n){a(r,Function)&&(n.push(r),r=void 0),t({type:e,selector:r,handlers:n})}}function ir(t){return function(e){let{type:r,origin:n,selector:o,handlers:l,name:u,capture:h,once:p,canRemove:y}=e,b=Ne(r),x=u;if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l,y=a(y,Boolean)?y:!1;let m={eventType:b,selector:o||n,capture:h,name:x,once:p,canRemove:y};switch(!0){case(a(b,Array)&&b.length>0):for(let f of b){m.eventType=f;for(let S of l)g(S)}return;default:for(let f of l)g(f)}function g(f){m.name=x,a(f,Function)&&t({...m,callback:f})}}}function lr(t,e){return e=F(e)&&e,t=F(t)&&t,e&&t&&[...N[t].values()].find(r=>(r.name||"")===e)}function sr(t){return t.activePopup||Object.defineProperty(t,"activePopup",{value:Qe(t),enumerable:!1}),t.activePopup}function ar(t){let e=(p,y)=>Se(p,y),r=p=>Y({createWithId:p||`jqx${V()}`}),n=(...p)=>{for(let y of p)Se(y)},o=Kt(t),l=ze(t),u=ir(l);return{editCssRule:e,createStyle:r,editCssRules:n,allowProhibit:o,handle:l,capturedHandling:u,log:(...p)=>$.on.log(...p).off}}function cr(t){let{factoryExtensions:e,instanceExtensions:r}=Je(t);he=e,ne=r;let{editCssRule:n,createStyle:o,editCssRules:l,allowProhibit:u,handle:h,capturedHandling:p,log:y}=ar(t);return{log:y,editCssRules:l,createStyle:o,editStylesheet:o,editCssRule:n,escHtml:j,logger:$,text:(b,x=!1)=>x?t.comment(b):document.createTextNode(b),node:(b,x=document)=>x.querySelector(b,x),nodes:(b,x=document)=>[...x.querySelectorAll(b,x)],get getNamedListener(){return lr},get virtual(){return qt(t)},get allowTag(){return u.allow},get prohibitTag(){return u.prohibit},get removeCssRule(){return Ue},get removeCssRules(){return Ue},get delegate(){return or(p)},get delegateCaptured(){return p},get handle(){return p},get at(){return C},get setStyle(){return n},get fn(){return Zt},get lenient(){return B.allowUnknownHtmlTags},get IS(){return a},get Popup(){return sr(t)}}}var ur=_e(fr());function fr(){return function(r,n,o=C.BeforeEnd){if(r?.isJQx)return r;let l=a(n,HTMLBRElement);n=(!l&&n&&n.isJQx?n[0]:n)||document.body,o=o&&Object.values(C).find(g=>o===g)?o:void 0;let u=ee(r),h=!u&&ue(r),p=h||u,y={collection:de(r)??[],isVirtual:l,isJQx:!0},b=te(y.collection),x=`input =&gt; ${h?`"${A(r.join(", "),70)}"`:!p&&b?`element collection [${A(y.collection.map(g=>`${a(g,Comment,Text)?"Comment|Text @":""} ${g?.outerHTML||g?.textContent}`).join(", "),70)}]`:`"${A(r,70)}"`}`;if(y.collection.length&&b)return $.log(x),l||y.collection.forEach(g=>{n.contains(g)||_([g],n,o)}),G(y);if(p){if([r].flat().forEach(g=>y.collection.push(H(g))),y.collection.length>0){let g=y.collection.filter(f=>f?.dataset?.jqxcreationerror);y.collection=y.collection.filter(f=>!f?.dataset?.jqxcreationerror),$.log(`${x}`),$.log(`*Created ${y.isVirtual?"VIRTUAL ":""}[${A(fe(y.collection).trim()||"sanitized: no elements remaining",70)}]`),y.isVirtual||_(y.collection,n,o)}return G(y)}let m=me(r,n,y);return $.log(`input => ${m}`),G(y)}}return qe(dr);})();
15
+ `)),r}return Object.defineProperties(r,{log:{value:o,enumerable:!1},error:{value:n,enumerable:!1}}),Object.freeze(r)}var pe=!1,Ot={on:()=>pe=!0,off:()=>pe=!1},B={tagsRaw:W,allowUnknownHtmlTags:Ot,isAllowed(t){if(pe)return!0;let e=a(t,String)?t.toLowerCase():t?.nodeName.toLowerCase()||"none";return e==="#text"||!!W[e]},allowTag:t=>W[t.toLowerCase()]=!0,prohibitTag:t=>W[t.toLowerCase()]=!1};var It=!0,re={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/^javascript|injected|noreferrer|alert|DataURL/gi};function Rt(t){if(It&&Object.keys(t.removed).length){let e=Object.entries(t.removed).reduce((r,[n,o])=>[...r,`${j(n)} => ${o}`],[]).join("\\000A");$.error(`JQx: HTML creation error(s): ${e}`)}}function kt(t){let e=t.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(e)&&!r.find(n=>n===e)||B.isAllowed(e)}function U(t){let e={rawHTML:t?.parentElement?.getHTML()??"no html",removed:{}};return a(t,HTMLElement)&&[...t.childNodes].forEach(r=>{if(r?.children?.length&&U(r),r?.attributes){let o=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let u=l.name.trim().toLowerCase(),h=l.value.trim().toLowerCase().replace(re.whiteSpace,""),p=u==="href"?!re.validURL.test(h):re.notAllowedValues.test(h),y=u.startsWith("data")?!re.data.test(u):!!o[u];if(p||y){let b=ce(l.value||"none",60);b+=b.length===60?"...":"",e.removed[`${l.name}`]=`attribute/property/value not allowed, removed. Value: ${b}`,r.removeAttribute(l.name)}})}if(!(kt(r)||r.constructor===CharacterData||r.constructor===Comment)){let o=(r?.outerHTML||r?.textContent).trim(),l=ce(o,60)??"EMPTY";l+=l.length===60?"...":"",e.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),Rt(e),t}function jt(t){let e=document.createElement("div");return e.insertAdjacentHTML(C.end,t),e.childNodes.length?U(e):void 0}function Bt(t,e,r){return a(t,Comment)?e.insertAdjacentHTML(r,`<!--${t.data}-->`):e.insertAdjacentText(r,t.data)}function _(t=[],e=document.body,r=C.BeforeEnd){return r=r||C.BeforeEnd,t.reduce((n,o)=>{let l=P(o)&&Jt(o,e,r);return l?[...n,l]:n},[])}function Jt(t,e=document.body,r=C.BeforeEnd){return r=r||C.BeforeEnd,e=e?.isJQx?e?.[0]:e,a(t,Comment,Text)?Bt(t,e,r):a(t,HTMLElement)?e.insertAdjacentElement(r,t):void 0}function H(t){if(a(t,Text,Comment))return t;let e=t?.trim(),r=e?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(o=>o.length).shift():void 0),e.startsWith("<!--")&&e.endsWith("-->"))return document.createComment(t.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(e))return document.createTextNode(r);let n=jt(t);return n.childNodes.length<1?H(`<span data-jqxcreationerror="1">${A(t,60)}</span>`):n.children[0]}var Qt=Oe();function Ie(t){return t&&(t.textContent="")}function E(t,e){let r=t.collection.filter(n=>!q(n));for(let n=0;n<r.length;n+=1)e(r[n],n);return t}function Q(t){let e=t.cloneNode(!0);return e.removeAttribute&&e.removeAttribute("id"),t.isConnected?t.remove():t=null,e}function je(t,e){if(t&&a(e,Object))for(let[r,n]of Object.entries(e))t.setAttribute(`data-${D(r)}`,n)}function Re(t,e){return t.andThen(e,!0)}function ke(t,e){return t.andThen(e)}function Be(t){return t.startsWith("data")||J.html.find(e=>t.toLowerCase()===e)}function Wt(t,e,r,n){r&&a(e,String)&&(e={[e]:r==="-"?"":r});let o;e.className&&(o=e.className,delete e.className),o=[...t.classList].find(u=>u.startsWith("JQxClass-")||o&&u===o)||o||`JQxClass-${V().slice(1)}`,n.editCssRule(`.${o}`,e),t.classList.add(o)}function zt(t,e){if(t)for(let[r,n]of Object.entries(e)){if(r=D(r),r.startsWith("data"))return je(t,n);a(n,String)&&Be(r)&&t.setAttribute(r,n.split(/[, ]/)?.join(" "))}}function ye(t,e){if(a(e,Object))for(let[r,n]of Object.entries(e)){let o;/!important/i.test(n)&&(n=n.slice(0,n.indexOf("!")).trim(),o="important"),t.style.setProperty(D(r),n,o)}}function Vt(...t){debugLog.log("\u2757"+t.map(e=>String(e)).join(", "))}function be(t,e=0,r=!0){return t=t?.parentElement,e+=t?t[r?"scrollTop":"scrollLeft"]:0,t?be(t,e,r):e}function Ut(t){return{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},He)},set:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},get:(r,n)=>e.data.all[r]??n,add:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},remove:r=>(e[0]?.removeAttribute(`data-${D(r)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let r=e[0],n=e.first()?.getBoundingClientRect().toJSON();return n.scrollTopDistance=be(r,0),n.scrollLeftDistance=be(r,0,!1),n},node:e=>e[0],HTML:e=>({get:(r,n)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=r?e.outerHtml:e.html();return n?j(o):o},set:(r,n=!1,o=!1)=>{r=r.isJQx?r.HTML.get(1):r;let l=a(r,String);return r=l&&o?j(r):r,l&&(r||"").trim().length&&e.html(r,n),e},replace:(r,n=!1)=>e.HTML.set(r,!1,n),append:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r,!0,n)),insert:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r+e.HTML.get(),!1,n))}),is:e=>Qt(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let r=t(e[0]?.parentNode);return r.is.empty?e:r},render:e=>(!e.is.empty&&e.toDOM()||t.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:r=>e.style(r),inSheet:r=>e.css(r),valueOf:r=>e.is.empty?void 0:getComputedStyle(e[0])[D(r)],nwRule:r=>e.Style.byRule({rules:r}),byRule:({classes2Apply:r=[],rules:n=[]}={})=>{let l=a(n,String)&&!r.length?n.split("{")[0].trim():"";if(n=n&&a(n,String)?[n]:n,r=r&&a(r,String)?[r]:r,(n?.length||r?.length)&&(n?.length&&t.editCssRules(...n),r))for(let u of r)e.addClass(u);return l?.startsWith(".")&&e.addClass(l.slice(1)),l?.startsWith("#")&&!e.attr("id")&&e.prop({id:l.slice(1)}),e}})}}function _t(t){return{addClass:(e,...r)=>E(e,n=>n&&r.forEach(o=>n.classList.add(o))),after:ke,afterMe:ke,andThen:(e,r,n=!1)=>{if(!r||!a(r,String,Node,Proxy))return Vt(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${r}]`),e;r=r?.isJQx?r.collection:a(r,Node)?t.virtual(r).collection:t.virtual(H(r)).collection;let[o,l,u]=n?[0,"before",r.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(r)];return e[o][l](...r),e.collection=u,e},append:(e,...r)=>{if(!e.is.empty&&r.length){let n=e.length===1;for(let o of r){if(!o.isJQx&&F(o)){let l=o.trim(),h=!/^<(.+)[^>]+>$/m.test(l)?t.text(o):H(o);E(e,p=>p.append(n?h:Q(h)))}P(o)&&E(e,l=>l.append(n?o:Q(o))),o.isJQx&&!o.is.empty&&E(e,l=>o.collection.forEach(u=>l.append(n?u:Q(u))))}}return e},appendTo:(e,r)=>(r.isJQx||(r=t(r)),r.append(e),e),attr:(e,r,n)=>{let o=e[0];if(!o)return e;if(!n&&F(r))return r=D(r),r==="class"?[...o?.classList].join(" "):o?.getAttribute(r);if(F(r)&&n)switch(r=D(r),!0){case r.startsWith("data-"):r={data:{[r.replace("data-","")]:n}};break;default:r={[r]:n}}return a(r,Object)&&!e.is.empty&&zt(o,r),e},before:Re,beforeMe:Re,clear:e=>E(e,Ie),closest:(e,r)=>{let n=F(r)?e[0].closest(r):null;return n?t(n):e},computedStyle:(e,r)=>e.first()&&getComputedStyle(e.first())[r],css:(e,r,n)=>E(e,o=>Wt(o,r,n,t)),duplicate:(e,r=!1,n=document.body)=>{if(e.collection.length>0){let o=e.collection[0].cloneNode(!0);return o.childNodes.forEach(l=>{l.removeAttribute&&l?.removeAttribute("id")}),r?t(o).toDOM(n):t.virtual(o)}return $.error("Duplicating an empty JQx instance is not possible"),e},each:(e,r)=>E(e,r),empty:e=>E(e,Ie),find:(e,r)=>e.collection.length>0?[...e.first()?.querySelectorAll(r)]:[],find$:(e,r)=>e.collection.length>0?t(r,e):e,first:(e,r=!1)=>{if(e.collection.length>0)return r?e.single():e.collection[0]},first$:(e,r)=>e.single(r),getData:(e,r,n)=>e.first()&&e.first().dataset?.[r]||n,hasClass:(e,...r)=>{let n=e[0];return!n||!n.classList.length?!1:r.find(o=>n.classList.contains(o))&&!0||!1},hide:e=>E(e,r=>ye(r,{display:"none !important"})),html:(e,r,n)=>{if(r===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${r.isJQx?r.HTML.get(!0):r}</div>`);if(!a(o,Comment))return E(e,u=>(n||(u.textContent=""),u.insertAdjacentHTML(t.at.end,o.getHTML())))}return e},htmlFor:(e,r,n="",o=!1)=>{if(r&&e.collection.length){if(!r||!F(n))return e;let l=e.find$(r);if(l.length<1)return e;let u=H(`<span>${n}</span>`);l.each(h=>{o||(h.textContent=""),h.insertAdjacentHTML(t.at.end,u?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,r)=>e.single(r),on:(e,r,...n)=>{if(e.collection.length&&a(r,String,Array)){if(r?.length<1||n.length<1)return e;let o=ge(e);t.handle({type:r,selector:o,handlers:n})}return e},prepend:(e,...r)=>{if(!e.is.empty&&r){let n=e.length===1;for(let o of r){if(F(o)){o=o.trim();let u=!/^<(.+)[^>]+>$/m.test(o)?t.text(o):H(o);u=n?u:Q(u),E(e,h=>h.prepend(u.cloneNode(!0)))}P(o)&&E(e,l=>l.prepend(n?o:Q(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),E(e,l=>E(o,u=>l.prepend(n?u:Q(u)))),o.collection.reverse())}}return e},prependTo:(e,r)=>(r.isJQx||(r=t.virtual(r)),r.prepend(e),e),prop:(e,r,n)=>{if(a(r,String)&&!n)return r.startsWith("data")?e[0]?.dataset[r.slice(r.indexOf("-")+1)]:e[0]?.[r];let o=a(r,Object)?r:{[r]:n};for(let[l,u]of Object.entries(o)){if(l=l.trim(),u&&!Be(l)||!u)return!1;if(l.toLowerCase()==="id")return e[0].id=u;E(e,p=>{if(l.startsWith("data"))return p.dataset[l.slice(l.indexOf("-")+1)]=u;p[l]=u})}return e},remove:(e,r)=>{$.log(`remove ${A(e.HTML.get(1),40)}${r?` /w selector ${r}`:""}`);let n=l=>l.remove(),o=()=>e.collection=e.collection.filter(l=>document.documentElement.contains(l));if(r){let l=e.find$(r);return l.is.empty||(E(l,n),o()),e}return E(e,n),o(),e},rmAttr:(e,...r)=>{for(let n of r)e.node.removeAttribute(n);return e},removeClass:(e,...r)=>E(e,n=>{if(n)for(let o of r)n.classList.remove(o)}),renderTo:(e,r=document.body,n=t.at.end)=>(e.first$().toDOM(r,n),e),replace:(e,r,n)=>{let o=e[0];return!r||!n||!a(n,HTMLElement)&&!n.isJQx?(console.error("JQx replace: invalid replacement value"),e):(n.isJQx&&(n=n[0]),a(n,NodeList)&&(n=n[0]),o&&r&&(r=a(r,String)?o.querySelectorAll(r):r.isJQx?r.collection:r,a(r,HTMLElement,NodeList,Array)&&a(n,HTMLElement)&&(a(r,HTMLElement)?[r]:[...r]).forEach(l=>l.replaceWith(n.cloneNode(!0)))),e)},replaceClass:(e,r,...n)=>E(e,o=>{o.classList.remove(r);for(let l of n)o.classList.add(l)}),replaceMe:(e,r)=>e.replaceWith(r),replaceWith:(e,r)=>(r=a(r,Element)?r:r.isJQx?r[0]:void 0,r&&(e[0].replaceWith(r),e=t.virtual(r)),e),setData:(e,r)=>E(e,n=>je(n,r)),show:e=>E(e,r=>ye(r,{display:"revert-layer !important"})),single:(e,r)=>e.collection.length>0?a(r,String)?e.find$(r):a(r,Number)?t(e.collection[r]):t(e.collection[0]):e,style:(e,r,n)=>E(e,l=>{n&&a(r,String)&&(r={[r]:n||"none"}),ye(l,r)}),text:(e,r,n=!1)=>e.isEmpty()?e:a(r,String)?E(e,l=>l.textContent=n?l.textContent+r:r):e.first().textContent,toDOM:(e,r=document.body,n=C.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),_(e.collection,r,n),e),toggleClass:(e,r)=>E(e,n=>n.classList.toggle(r)),toNodeList:e=>[...e.collection].map(r=>document.importNode(r,!0)),trigger:(e,r,n=Event,o={})=>{if(e.collection.length){let l=new n(r,{...o,bubbles:o.bubbles??!0});for(let u of e.collection)u.dispatchEvent(l)}return e},val:(e,r)=>{let n=e[0];return!n||!a(n,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:r===void 0?n.value:(n.value=a(r,String)?r:"",e)}}}function Je(t){return{factoryExtensions:Ut(t),instanceExtensions:_t(t)}}function Qe(t){if(t.node("#jqxPopup"))return;t.logger.log("JQx: [JQx].Popup first call. Dialog element created."),t.dialog({id:"jqxPopup"},t.div({id:"jqxPopupContent"})).render,t.editCssRules(...ve);let[e,r]=[t("#jqxPopupContent"),t.node("#jqxPopup")],n={};return t.handle({type:"click, keydown",handlers:y,capture:!0}),Object.freeze({show:o,removeModal:p});function o(m){if(r.open)return;n={...m};let{content:g}=n;return t.IS(g,String,HTMLElement)||g?.isJQx?u():!0}function l(){return n.modal?x(n.warnMessage):h()}function u(){e.clear();let{content:m,modal:g,closeAfter:f}=n;g=t.IS(g,Boolean)?g:!1;let S=g?"":t.div({id:"closeHandleIcon"});e.append(S,t.IS(m,String)?t.div(m):m),r.showModal(),!g&&t.IS(f,Number)&&b(l,f)}function h(){if(r.close(n.returnValue),t.IS(n.callback,Function))return n.callback(n.returnValue);n={}}function p({callback:m,value:g}={}){n.returnValue=g,n.modal=!1,n.callback=m||n.callback,l()}function y(m){if(!(Object.keys(n).length<1||!r.open))return m.key==="Escape"&&m.preventDefault(),n.activeTimer&&clearTimeout(n.activeTimer),(m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),document.activeElement.blur()}function b(m,g){t.IS(m,Function)&&t.IS(g,Number)&&g>0&&(n.activeTimer=setTimeout(m,g*1e3))}function x(m){if(!t.IS(m,String,HTMLElement,Proxy))return;let g=e.find$(".warn");switch(!0){case g.is.empty:g=t.div({class:"warn"},m);default:e.append(g.addClass("active")),b(()=>e.find$(".warn").removeClass("active"),2)}}}var N={},Gt=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],We=t=>!!Gt.find(e=>e===t);function ze(t){return function(o){let{eventType:l,selector:u,callback:h,name:p,capture:y,once:b,canRemove:x}=o;switch(!0){case(!F(l)||!t.IS(h,Function)):default:p=p||!/handlers$/.test(h.name)&&h.name||void 0,y=t.IS(y,Boolean)?y:!1,b=t.IS(b,Boolean)?b:!1,x=F(p,4)&&t.IS(x,Boolean)?x:b;let{handler:m,signal:g,remove:f}=e({selector:u,callback:h,canRemove:x,once:b,name:p,eventType:l});return n({eventType:l,handler:m,capture:y,once:b,signal:g,remove:f,name:p})}};function e(o){let{selector:l,callback:u,canRemove:h,name:p,eventType:y,once:b}=o,x=(h||b)&&new AbortController,m=r({once:b,abortcontroller:x,name:p,eventType:y}),g=l?{handler:f=>{let S=f.target?.closest?.(l);return S&&u(f,t(S),m)},remove:m}:{handler:f=>u(f,f.target,m),remove:m};return x&&(g.signal=x.signal,b)?{handler:(f,S)=>{g.handler(f,S),m()}}:g}function r(o){let{once:l,abortcontroller:u,name:h,eventType:p}=o;return h?u?function(){u.abort();let b=[...N[p].entries()].find(([x,m])=>m.name===h);N[p].delete(b[0]),setTimeout(()=>t.logger.log(`Listener for event type [${p}] with name [${h}] was removed${l?" (once active, so handled once).":""}`),100)}:function(y){t.logger.error(`Listener for event type [${p}] with name [${h}] is not marked as removable`)}:function(){t.logger.error("An anonymous listener can not be removed")}}function n(o){let{eventType:l,handler:u,capture:h,once:p,signal:y,remove:b,name:x}=o;if(N[l]||(N[l]=new Map),!(N[l].has(u)||[...N[l].values()].find(g=>(g.name||"")===x))){let g={capture:h||We(l),once:p||!1};y&&(g.signal=y),document.addEventListener(l,u,g);let f={name:x,remove:b,capture:h||We(l)};N[l].set(u,f)}}}var he,ne,{isComment:tn,isText:rn,isHtmlString:nn,isArrayOfHtmlElements:on,isArrayOfHtmlStrings:ln,ElemArray2HtmlString:sn,addHandlerId:an,cssRuleEdit:Se,addFn:Zt}=Yt();function Yt(){let t=Y({createWithId:"JQxStylesheet"}),e=(r,n)=>ne[r]=(o,...l)=>n(o,...l);return{...Pe(),cssRuleEdit:t,addFn:e}}function G(t){return new Proxy(t,{get:(e,r)=>Xt(e,r,t)})}function Ve(t,e){return(...r)=>a(t,Function)&&t(G(e),...r)}function Xt(t,e,r){switch(!0){case a(e,Symbol):return t;case a(+e,Number):return t.collection?.[e]||void 0;case e in he:return Ve(he[e],r)();case e in ne:return Ve(ne[e],r);default:return t[e]}}function _e(t){let e=rr(t);for(let[r,n]of Object.entries(Object.getOwnPropertyDescriptors(e)))Object.defineProperty(t,r,n);return t}function Kt(t){return{allow:e=>{let r=/-/.test(e),n=r&&e;e=r?K(e):e.toLowerCase(),B.allowTag(e),a(t[e],Function)||Object.defineProperties(t,xe(e,!0,t,n))},prohibit:e=>{e=e.toLowerCase(),B.prohibitTag(e),a(t[e],Function)&&Object.defineProperties(t,xe(e,!1,t))}}}function Ue(...t){if(t.length===1){let e=String(t.shift().trim());t=e.startsWith("!")?[e.slice(1,-1)]:e.split(",").map(r=>r.trim())}for(let e of t.map(r=>r.startsWith("!")?r.slice(1,-1):r))Se(e,{removeRule:1})}function qt(t){return function(e,r,n){r=r?.isJQx?r?.[0]:r,n=n&&Object.values(C).find(l=>n===l);let o=t(e,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of o.collection)n?r.insertAdjacentElement(n,l):r.append(l);return o}}function er(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);for(let[o,l]of Object.entries(n))!(o in e)&&Object.defineProperty(e,o,l)}return e}function tr(t,e,r,n){return t=D(n||t.toLowerCase()),{get(){return(...o)=>e&&r.virtual(U(ie[t](...o)))},enumerable:!1,configurable:!0}}function xe(t,e,r,n){t=t.toLowerCase();let o=tr(t,e,r,n);return n?{[n]:o,[K(n)]:o}:{[t]:o,[t.toUpperCase()]:o}}function rr(t){return er(Object.entries(B.tagsRaw).reduce(nr(t),{}),cr(t))}function nr(t){return function(e,[r,n]){return n&&Object.defineProperties(e,xe(r,n,t)),e}}function or(t){return function(e,r,...n){a(r,Function)&&(n.push(r),r=void 0),t({type:e,selector:r,handlers:n})}}function ir(t){return function(e){let{type:r,origin:n,selector:o,handlers:l,name:u,capture:h,once:p,canRemove:y}=e,b=Ne(r),x=u;if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l,y=a(y,Boolean)?y:!1;let m={eventType:b,selector:o||n,capture:h,name:x,once:p,canRemove:y};switch(!0){case(a(b,Array)&&b.length>0):for(let f of b){m.eventType=f;for(let S of l)g(S)}return;default:for(let f of l)g(f)}function g(f){m.name=x,a(f,Function)&&t({...m,callback:f})}}}function lr(t,e){return e=F(e)&&e,t=F(t)&&t,e&&t&&[...N[t].values()].find(r=>(r.name||"")===e)}function sr(t){return t.activePopup||Object.defineProperty(t,"activePopup",{value:Qe(t),enumerable:!1}),t.activePopup}function ar(t){let e=(p,y)=>Se(p,y),r=p=>Y({createWithId:p||`jqx${V()}`}),n=(...p)=>{for(let y of p)Se(y)},o=Kt(t),l=ze(t),u=ir(l);return{editCssRule:e,createStyle:r,editCssRules:n,allowProhibit:o,handle:l,capturedHandling:u,log:(...p)=>$.on.log(...p).off}}function cr(t){let{factoryExtensions:e,instanceExtensions:r}=Je(t);he=e,ne=r;let{editCssRule:n,createStyle:o,editCssRules:l,allowProhibit:u,handle:h,capturedHandling:p,log:y}=ar(t);return{log:y,editCssRules:l,createStyle:o,editStylesheet:o,editCssRule:n,escHtml:j,logger:$,text:(b,x=!1)=>x?t.comment(b):document.createTextNode(b),node:(b,x=document)=>x.querySelector(b,x),nodes:(b,x=document)=>[...x.querySelectorAll(b,x)],get getNamedListener(){return lr},get virtual(){return qt(t)},get allowTag(){return u.allow},get prohibitTag(){return u.prohibit},get removeCssRule(){return Ue},get removeCssRules(){return Ue},get delegate(){return or(p)},get delegateCaptured(){return p},get handle(){return p},get at(){return C},get setStyle(){return n},get fn(){return Zt},get lenient(){return B.allowUnknownHtmlTags},get IS(){return a},get Popup(){return sr(t)}}}var ur=_e(fr());function fr(){return function(r,n,o=C.BeforeEnd){if(r?.isJQx)return r;let l=a(n,HTMLBRElement);n=(!l&&n&&n.isJQx?n[0]:n)||document.body,o=o&&Object.values(C).find(g=>o===g)?o:void 0;let u=ee(r),h=!u&&ue(r),p=h||u,y={collection:de(r)??[],isVirtual:l,isJQx:!0},b=te(y.collection),x=`input =&gt; ${h?`"${A(r.join(", "),70)}"`:!p&&b?`element collection [${A(y.collection.map(g=>`${a(g,Comment,Text)?"Comment|Text @":""} ${g?.outerHTML||g?.textContent}`).join(", "),70)}]`:`"${A(r,70)}"`}`;if(y.collection.length&&b)return $.log(x),l||y.collection.forEach(g=>{n.contains(g)||_([g],n,o)}),G(y);if(p){if([r].flat().forEach(g=>y.collection.push(H(g))),y.collection.length>0){let g=y.collection.filter(f=>f?.dataset?.jqxcreationerror);y.collection=y.collection.filter(f=>!f?.dataset?.jqxcreationerror),$.log(`${x}`),$.log(`*Created ${y.isVirtual?"VIRTUAL ":""}[${A(fe(y.collection).trim()||"sanitized: no elements remaining",70)}]`),y.isVirtual||_(y.collection,n,o)}return G(y)}let m=me(r,n,y);return $.log(`input => ${m}`),G(y)}}return qe(dr);})();
package/Bundle/jqx.min.js CHANGED
@@ -12,4 +12,4 @@ ${r}`),f}}return{sheet:t,removeRules:p,tryParseAtOrNestedRules:h,ruleExists:u,ch
12
12
  `).replaceAll("\\3b",";").split(`
13
13
  `)}function bt(t){return t.reduce((e,r)=>{let[n,o]=[r.slice(0,r.indexOf(":")).trim(),r.slice(r.indexOf(":")+1).trim().replace(/;$|;.+(?=\/*).+\/$/,"")];return n&&o?{...e,[n]:o}:e},{})}function ht(t){return bt(yt(t))}function Te(t,e){return t?.replace("::",":")===e?.replace("::",":")}var St=[...Array(26)].map((t,e)=>String.fromCharCode(e+65)).concat([...Array(26)].map((t,e)=>String.fromCharCode(e+97))).concat([...Array(10)].map((t,e)=>`${e}`)),$=Tt(),De={get(t,e){return t[K(e)]||t[e]},enumerable:!1,configurable:!1},C=new Proxy({start:"afterbegin",afterbegin:"afterbegin",end:"beforeend",beforeend:"beforeend",before:"beforebegin",beforebegin:"beforebegin",after:"afterend",afterend:"afterend"},{get(t,e){return t[String(e).toLowerCase()]??t[e]}});function X(t,e=2){return`${t}`.padStart(e,"0")}function xt(t,e=0){return[t,e]=[Math.floor(t),Math.ceil(e)],Math.floor([...crypto.getRandomValues(new Uint32Array(1))].shift()/2**32*(t-e+1)+e)}function F(t,e=1){return e=a(e,Number)&&e||1,a(t,String)&&t.length>=e}function He(t){return t=a(t,String)&&/,/.test(t)?t.split(","):t,a(t,Array)?t.filter(e=>F(e)).map(e=>e.trim().toLowerCase()):a(t,String)&&t?.trim().toLowerCase()||""}function vt(t){let e=t.length;for(;e--;){let r=xt(e);[t[e],t[r]]=[t[r],t[e]]}return t}function A(t,e=120){return`${t}`.trim().slice(0,e).replace(/>\s+</g,"><").replace(/</g,"&lt;").replace(/\s{2,}/g," ").replace(/\n/g,"\\n")+(t.length>e?" &hellip;":"").trim()}function D(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`).replace(/^-|-$/,"")}function Et([t,...e]){return`${t.toUpperCase()}${e.join("")}`}function K(t){return a(t,String)?t.toLowerCase().split("-").map((e,r)=>r&&`${Et(e)}`||e).join(""):t}function V(){return`_${vt(St).slice(0,8).join("")}`}function ae(t,e=120){return A(t,e).replace(/&lt;/g,"<")}function $e(){return(t=>`[${X(t.getHours())}:${X(t.getMinutes())}:${X(t.getSeconds())}.${X(t.getMilliseconds(),3)}]`)(new Date)}function j(t){return t.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function q(t){return a(t,Comment,Text)}function P(t){return a(t,Text,HTMLElement,Comment)}function Ne(t){a(t,Comment)}function wt(t){return a(t,Text)}function ee(t){return a(t,String)&&/^<|>$/.test(`${t}`.trim())}function te(t){return a(t,Array)&&!t?.find(e=>!P(e))}function ce(t){return a(t,Array)&&!t?.find(e=>!ee(e))}function ue(t){return t?.filter(e=>e).reduce((e,r)=>e.concat(Ne(r)?`<!--${r.data}-->`:q(r)?r.textContent:r.outerHTML),"")}function fe(t){return t?a(t,Proxy)?[t.EL]:a(t,NodeList)?[...t]:P(t)?[t]:te(t)?t:t.isJQx?t.collection:void 0:[]}function de(t,e,r){let n=e!==document.body&&a(t,String)&&t.toLowerCase()!=="body"?e:document,o;try{r.collection=[...n.querySelectorAll(t)]}catch{o=`Invalid CSS querySelector. [${a(t,String)?t:"Nothing valid given!"}]`}let l=r.collection.length;return l<1?`CSS querySelector "${t}", output: nothing`:o??`CSS querySelector "${t}", output ${l} element${l>1?"s":""}`}function me(t){let e=t.data.get("hid")||`HID${V()}`;return t.data.add({hid:e}),`[data-hid="${e}"]`}function Me(){return{isCommentOrTextNode:q,isNode:P,isComment:Ne,isText:wt,isHtmlString:ee,isArrayOfHtmlElements:te,isArrayOfHtmlStrings:ce,ElemArray2HtmlString:ue,input2Collection:fe,setCollectionFromCssSelector:de,addHandlerId:me}}function Lt(t){if(!t)return;let e=t.style,r=getComputedStyle(t),n=[e.visibility,r.visibility].includes("hidden"),o=[e.display,r.display].includes("none"),l=t.offsetTop<0||t.offsetLeft+t.offsetWidth<0||t.offsetLeft>document.body.offsetWidth,u=+r.opacity==0||+(e.opacity||1)==0;return!(l||u||o||n)}function Ct(t){return[...t.parentNode.querySelectorAll(":is(:read-write)")].find(e=>e===t)??!1}function Ft(t){return[...t.parentNode.querySelectorAll(":is(:modal)")].find(e=>e===t)??!1}function Pe(){let e={notInDOM:!0,writable:"n/a",modal:"n/a",empty:!0,open:"n/a",visible:"n/a"};return r=>{let n=r.node;return a(n,Node)?{get writable(){return Ct(n)},get modal(){return Ft(n)},get inDOM(){return n.isConnected},get open(){return n.open??!1},get visible(){return Lt(n)},get disabled(){return n.hasAttribute("readonly")||n.hasAttribute("disabled")},get empty(){return r.collection.length<1},get virtual(){return r.isVirtual}}:e}}function Ae(t){return a(t,String)&&Object.assign(document.createElement("textarea"),{innerHTML:t}).textContent||t}function Tt(){let t=!1,e=[],r={get on(){return t=!0,r},get off(){return t=!1,r},get backLog(){return e}};function n(...l){return e.unshift(...l.map(u=>`${$e()} \u2A3B ${Ae(u)}`)),console.error(e.slice(0,l.length).join(`
14
14
  `)),r}function o(...l){return e.unshift(...l.map(u=>`${$e()} \u2714 ${Ae(u)}`)),t&&console.log(e.slice(0,l.length).join(`
15
- `)),r}return Object.defineProperties(r,{log:{value:o,enumerable:!1},error:{value:n,enumerable:!1}}),Object.freeze(r)}var ge=!1,$t={on:()=>ge=!0,off:()=>ge=!1},B={tagsRaw:W,allowUnknownHtmlTags:$t,isAllowed(t){if(ge)return!0;let e=a(t,String)?t.toLowerCase():t?.nodeName.toLowerCase()||"none";return e==="#text"||!!W[e]},allowTag:t=>W[t.toLowerCase()]=!0,prohibitTag:t=>W[t.toLowerCase()]=!1};var At=!0,re={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/^javascript|injected|noreferrer|alert|DataURL/gi};function Dt(t){if(At&&Object.keys(t.removed).length){let e=Object.entries(t.removed).reduce((r,[n,o])=>[...r,`${j(n)} => ${o}`],[]).join("\\000A");$.error(`JQx: HTML creation error(s): ${e}`)}}function Ht(t){let e=t.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(e)&&!r.find(n=>n===e)||B.isAllowed(e)}function U(t){let e={rawHTML:t?.parentElement?.getHTML()??"no html",removed:{}};return a(t,HTMLElement)&&[...t.childNodes].forEach(r=>{if(r?.children?.length&&U(r),r?.attributes){let o=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let u=l.name.trim().toLowerCase(),h=l.value.trim().toLowerCase().replace(re.whiteSpace,""),p=u==="href"?!re.validURL.test(h):re.notAllowedValues.test(h),y=u.startsWith("data")?!re.data.test(u):!!o[u];if(p||y){let b=ae(l.value||"none",60);b+=b.length===60?"...":"",e.removed[`${l.name}`]=`attribute/property/value not allowed, removed. Value: ${b}`,r.removeAttribute(l.name)}})}if(!(Ht(r)||r.constructor===CharacterData||r.constructor===Comment)){let o=(r?.outerHTML||r?.textContent).trim(),l=ae(o,60)??"EMPTY";l+=l.length===60?"...":"",e.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),Dt(e),t}function Nt(t){let e=document.createElement("div");return e.insertAdjacentHTML(C.end,t),e.childNodes.length?U(e):void 0}function Mt(t,e,r){return a(t,Comment)?e.insertAdjacentHTML(r,`<!--${t.data}-->`):e.insertAdjacentText(r,t.data)}function _(t=[],e=document.body,r=C.BeforeEnd){r=r||C.BeforeEnd,t.reduce((n,o)=>{let l=P(o)&&Pt(o,e,r);return l?[...n,l]:n},[])}function Pt(t,e=document.body,r=C.BeforeEnd){return r=r||C.BeforeEnd,e=e?.isJQx?e?.[0]:e,a(t,Comment,Text)?Mt(t,e,r):a(t,HTMLElement)?e.insertAdjacentElement(r,t):void 0}function H(t){if(a(t,Text,Comment))return t;let e=t?.trim(),r=e?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(o=>o.length).shift():void 0),e.startsWith("<!--")&&e.endsWith("-->"))return document.createComment(t.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(e))return document.createTextNode(r);let n=Nt(t);return n.childNodes.length<1?H(`<span data-jqxcreationerror="1">${A(t,60)}</span>`):n.children[0]}var Ot=Pe();function Oe(t){return t&&(t.textContent="")}function E(t,e){let r=t.collection.filter(n=>!q(n));for(let n=0;n<r.length;n+=1)e(r[n],n);return t}function Q(t){let e=t.cloneNode(!0);return e.removeAttribute&&e.removeAttribute("id"),t.isConnected?t.remove():t=null,e}function ke(t,e){if(t&&a(e,Object))for(let[r,n]of Object.entries(e))t.setAttribute(`data-${D(r)}`,n)}function Ie(t,e){return t.andThen(e,!0)}function Re(t,e){return t.andThen(e)}function je(t){return t.startsWith("data")||J.html.find(e=>t.toLowerCase()===e)}function It(t,e,r,n){r&&a(e,String)&&(e={[e]:r==="-"?"":r});let o;e.className&&(o=e.className,delete e.className),o=[...t.classList].find(u=>u.startsWith("JQxClass-")||o&&u===o)||o||`JQxClass-${V().slice(1)}`,n.editCssRule(`.${o}`,e),t.classList.add(o)}function Rt(t,e){if(t)for(let[r,n]of Object.entries(e)){if(r=D(r),r.startsWith("data"))return ke(t,n);a(n,String)&&je(r)&&t.setAttribute(r,n.split(/[, ]/)?.join(" "))}}function pe(t,e){if(a(e,Object))for(let[r,n]of Object.entries(e)){let o;/!important/i.test(n)&&(n=n.slice(0,n.indexOf("!")).trim(),o="important"),t.style.setProperty(D(r),n,o)}}function kt(...t){debugLog.log("\u2757"+t.map(e=>String(e)).join(", "))}function ye(t,e=0,r=!0){return t=t?.parentElement,e+=t?t[r?"scrollTop":"scrollLeft"]:0,t?ye(t,e,r):e}function jt(t){return{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},De)},set:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},get:(r,n)=>e.data.all[r]??n,add:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},remove:r=>(e[0]?.removeAttribute(`data-${D(r)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let r=e[0],n=e.first()?.getBoundingClientRect().toJSON();return n.scrollTopDistance=ye(r,0),n.scrollLeftDistance=ye(r,0,!1),n},node:e=>e[0],HTML:e=>({get:(r,n)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=r?e.outerHtml:e.html();return n?j(o):o},set:(r,n=!1,o=!1)=>{r=r.isJQx?r.HTML.get(1):r;let l=a(r,String);return r=l&&o?j(r):r,l&&(r||"").trim().length&&e.html(r,n),e},replace:(r,n=!1)=>e.HTML.set(r,!1,n),append:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r,!0,n)),insert:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r+e.HTML.get(),!1,n))}),is:e=>Ot(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let r=t(e[0]?.parentNode);return r.is.empty?e:r},render:e=>(!e.is.empty&&e.toDOM()||t.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:r=>e.style(r),inSheet:r=>e.css(r),valueOf:r=>e.is.empty?void 0:getComputedStyle(e[0])[D(r)],nwRule:r=>e.Style.byRule({rules:r}),byRule:({classes2Apply:r=[],rules:n=[]}={})=>{let l=a(n,String)&&!r.length?n.split("{")[0].trim():"";if(n=n&&a(n,String)?[n]:n,r=r&&a(r,String)?[r]:r,(n?.length||r?.length)&&(n?.length&&t.editCssRules(...n),r))for(let u of r)e.addClass(u);return l?.startsWith(".")&&e.addClass(l.slice(1)),l?.startsWith("#")&&!e.attr("id")&&e.prop({id:l.slice(1)}),e}})}}function Bt(t){return{addClass:(e,...r)=>E(e,n=>n&&r.forEach(o=>n.classList.add(o))),after:Re,afterMe:Re,andThen:(e,r,n=!1)=>{if(!r||!a(r,String,Node,Proxy))return kt(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${r}]`),e;r=r?.isJQx?r.collection:a(r,Node)?t.virtual(r).collection:t.virtual(H(r)).collection;let[o,l,u]=n?[0,"before",r.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(r)];return e[o][l](...r),e.collection=u,e},append:(e,...r)=>{if(!e.is.empty&&r.length){let n=e.length===1;for(let o of r){if(!o.isJQx&&F(o)){let l=o.trim(),h=!/^<(.+)[^>]+>$/m.test(l)?t.text(o):H(o);E(e,p=>p.append(n?h:Q(h)))}P(o)&&E(e,l=>l.append(n?o:Q(o))),o.isJQx&&!o.is.empty&&E(e,l=>o.collection.forEach(u=>l.append(n?u:Q(u))))}}return e},appendTo:(e,r)=>(r.isJQx||(r=t(r)),r.append(e),e),attr:(e,r,n)=>{let o=e[0];if(!o)return e;if(!n&&F(r))return r=D(r),r==="class"?[...o?.classList].join(" "):o?.getAttribute(r);if(F(r)&&n)switch(r=D(r),!0){case r.startsWith("data-"):r={data:{[r.replace("data-","")]:n}};break;default:r={[r]:n}}return a(r,Object)&&!e.is.empty&&Rt(o,r),e},before:Ie,beforeMe:Ie,clear:e=>E(e,Oe),closest:(e,r)=>{let n=F(r)?e[0].closest(r):null;return n?t(n):e},computedStyle:(e,r)=>e.first()&&getComputedStyle(e.first())[r],css:(e,r,n)=>E(e,o=>It(o,r,n,t)),duplicate:(e,r=!1,n=document.body)=>{let o=e.toNodeList().map(u=>u.removeAttribute&&u.removeAttribute("id")||u),l=t.virtual(o);return r?l.toDOM(n):l},each:(e,r)=>E(e,r),empty:e=>E(e,Oe),find:(e,r)=>e.collection.length>0?[...e.first()?.querySelectorAll(r)]:[],find$:(e,r)=>e.collection.length>0?t(r,e):e,first:(e,r=!1)=>{if(e.collection.length>0)return r?e.single():e.collection[0]},first$:(e,r)=>e.single(r),getData:(e,r,n)=>e.first()&&e.first().dataset?.[r]||n,hasClass:(e,...r)=>{let n=e[0];return!n||!n.classList.length?!1:r.find(o=>n.classList.contains(o))&&!0||!1},hide:e=>E(e,r=>pe(r,{display:"none !important"})),html:(e,r,n)=>{if(r===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${r.isJQx?r.HTML.get(!0):r}</div>`);if(!a(o,Comment))return E(e,u=>(n||(u.textContent=""),u.insertAdjacentHTML(t.at.end,o.getHTML())))}return e},htmlFor:(e,r,n="",o=!1)=>{if(r&&e.collection.length){if(!r||!F(n))return e;let l=e.find$(r);if(l.length<1)return e;let u=H(`<span>${n}</span>`);l.each(h=>{o||(h.textContent=""),h.insertAdjacentHTML(t.at.end,u?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,r)=>e.single(r),on:(e,r,...n)=>{if(e.collection.length&&a(r,String,Array)){if(r?.length<1||n.length<1)return e;let o=me(e);t.handle({type:r,selector:o,handlers:n})}return e},prepend:(e,...r)=>{if(!e.is.empty&&r){let n=e.length===1;for(let o of r){if(F(o)){o=o.trim();let u=!/^<(.+)[^>]+>$/m.test(o)?t.text(o):H(o);u=n?u:Q(u),E(e,h=>h.prepend(u.cloneNode(!0)))}P(o)&&E(e,l=>l.prepend(n?o:Q(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),E(e,l=>E(o,u=>l.prepend(n?u:Q(u)))),o.collection.reverse())}}return e},prependTo:(e,r)=>(r.isJQx||(r=t.virtual(r)),r.prepend(e),e),prop:(e,r,n)=>{if(a(r,String)&&!n)return r.startsWith("data")?e[0]?.dataset[r.slice(r.indexOf("-")+1)]:e[0]?.[r];let o=a(r,Object)?r:{[r]:n};for(let[l,u]of Object.entries(o)){if(l=l.trim(),u&&!je(l)||!u)return!1;if(l.toLowerCase()==="id")return e[0].id=u;E(e,p=>{if(l.startsWith("data"))return p.dataset[l.slice(l.indexOf("-")+1)]=u;p[l]=u})}return e},remove:(e,r)=>{$.log(`remove ${A(e.HTML.get(1),40)}${r?` /w selector ${r}`:""}`);let n=l=>l.remove(),o=()=>e.collection=e.collection.filter(l=>document.documentElement.contains(l));if(r){let l=e.find$(r);return l.is.empty||(E(l,n),o()),e}return E(e,n),o(),e},rmAttr:(e,...r)=>{for(let n of r)e.node.removeAttribute(n);return e},removeClass:(e,...r)=>E(e,n=>{if(n)for(let o of r)n.classList.remove(o)}),renderTo:(e,r=document.body,n=t.at.end)=>(e.first$().toDOM(r,n),e),replace:(e,r,n)=>{let o=e[0];return!r||!n||!a(n,HTMLElement)&&!n.isJQx?(console.error("JQx replace: invalid replacement value"),e):(n.isJQx&&(n=n[0]),a(n,NodeList)&&(n=n[0]),o&&r&&(r=a(r,String)?o.querySelectorAll(r):r.isJQx?r.collection:r,a(r,HTMLElement,NodeList,Array)&&a(n,HTMLElement)&&(a(r,HTMLElement)?[r]:[...r]).forEach(l=>l.replaceWith(n.cloneNode(!0)))),e)},replaceClass:(e,r,...n)=>E(e,o=>{o.classList.remove(r);for(let l of n)o.classList.add(l)}),replaceMe:(e,r)=>e.replaceWith(r),replaceWith:(e,r)=>(r=a(r,Element)?r:r.isJQx?r[0]:void 0,r&&(e[0].replaceWith(r),e=t.virtual(r)),e),setData:(e,r)=>E(e,n=>ke(n,r)),show:e=>E(e,r=>pe(r,{display:"revert-layer !important"})),single:(e,r)=>e.collection.length>0?a(r,String)?e.find$(r):a(r,Number)?t(e.collection[r]):t(e.collection[0]):e,style:(e,r,n)=>E(e,l=>{n&&a(r,String)&&(r={[r]:n||"none"}),pe(l,r)}),text:(e,r,n=!1)=>e.isEmpty()?e:a(r,String)?E(e,l=>l.textContent=n?l.textContent+r:r):e.first().textContent,toDOM:(e,r=document.body,n=C.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),e.collection=_(e.collection,r,n),e),toggleClass:(e,r)=>E(e,n=>n.classList.toggle(r)),toNodeList:e=>[...e.collection].map(r=>document.importNode(r,!0)),trigger:(e,r,n=Event,o={})=>{if(e.collection.length){let l=new n(r,{...o,bubbles:o.bubbles??!0});for(let u of e.collection)u.dispatchEvent(l)}return e},val:(e,r)=>{let n=e[0];return!n||!a(n,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:r===void 0?n.value:(n.value=a(r,String)?r:"",e)}}}function Be(t){return{factoryExtensions:jt(t),instanceExtensions:Bt(t)}}function Je(t){if(t.node("#jqxPopup"))return;t.logger.log("JQx: [JQx].Popup first call. Dialog element created."),t.dialog({id:"jqxPopup"},t.div({id:"jqxPopupContent"})).render,t.editCssRules(...xe);let[e,r]=[t("#jqxPopupContent"),t.node("#jqxPopup")],n={};return t.handle({type:"click, keydown",handlers:y,capture:!0}),Object.freeze({show:o,removeModal:p});function o(m){if(r.open)return;n={...m};let{content:g}=n;return t.IS(g,String,HTMLElement)||g?.isJQx?u():!0}function l(){return n.modal?x(n.warnMessage):h()}function u(){e.clear();let{content:m,modal:g,closeAfter:f}=n;g=t.IS(g,Boolean)?g:!1;let S=g?"":t.div({id:"closeHandleIcon"});e.append(S,t.IS(m,String)?t.div(m):m),r.showModal(),!g&&t.IS(f,Number)&&b(l,f)}function h(){if(r.close(n.returnValue),t.IS(n.callback,Function))return n.callback(n.returnValue);n={}}function p({callback:m,value:g}={}){n.returnValue=g,n.modal=!1,n.callback=m||n.callback,l()}function y(m){if(!(Object.keys(n).length<1||!r.open))return m.key==="Escape"&&m.preventDefault(),n.activeTimer&&clearTimeout(n.activeTimer),(m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),document.activeElement.blur()}function b(m,g){t.IS(m,Function)&&t.IS(g,Number)&&g>0&&(n.activeTimer=setTimeout(m,g*1e3))}function x(m){if(!t.IS(m,String,HTMLElement,Proxy))return;let g=e.find$(".warn");switch(!0){case g.is.empty:g=t.div({class:"warn"},m);default:e.append(g.addClass("active")),b(()=>e.find$(".warn").removeClass("active"),2)}}}var N={},Jt=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],Qe=t=>!!Jt.find(e=>e===t);function We(t){return function(o){let{eventType:l,selector:u,callback:h,name:p,capture:y,once:b,canRemove:x}=o;switch(!0){case(!F(l)||!t.IS(h,Function)):default:p=p||!/handlers$/.test(h.name)&&h.name||void 0,y=t.IS(y,Boolean)?y:!1,b=t.IS(b,Boolean)?b:!1,x=F(p,4)&&t.IS(x,Boolean)?x:b;let{handler:m,signal:g,remove:f}=e({selector:u,callback:h,canRemove:x,once:b,name:p,eventType:l});return n({eventType:l,handler:m,capture:y,once:b,signal:g,remove:f,name:p})}};function e(o){let{selector:l,callback:u,canRemove:h,name:p,eventType:y,once:b}=o,x=(h||b)&&new AbortController,m=r({once:b,abortcontroller:x,name:p,eventType:y}),g=l?{handler:f=>{let S=f.target?.closest?.(l);return S&&u(f,t(S),m)},remove:m}:{handler:f=>u(f,f.target,m),remove:m};return x&&(g.signal=x.signal,b)?{handler:(f,S)=>{g.handler(f,S),m()}}:g}function r(o){let{once:l,abortcontroller:u,name:h,eventType:p}=o;return h?u?function(){u.abort();let b=[...N[p].entries()].find(([x,m])=>m.name===h);N[p].delete(b[0]),setTimeout(()=>t.logger.log(`Listener for event type [${p}] with name [${h}] was removed${l?" (once active, so handled once).":""}`),100)}:function(y){t.logger.error(`Listener for event type [${p}] with name [${h}] is not marked as removable`)}:function(){t.logger.error("An anonymous listener can not be removed")}}function n(o){let{eventType:l,handler:u,capture:h,once:p,signal:y,remove:b,name:x}=o;if(N[l]||(N[l]=new Map),!(N[l].has(u)||[...N[l].values()].find(g=>(g.name||"")===x))){let g={capture:h||Qe(l),once:p||!1};y&&(g.signal=y),document.addEventListener(l,u,g);let f={name:x,remove:b,capture:h||Qe(l)};N[l].set(u,f)}}}var be,ne,{isComment:Vr,isText:Ur,isHtmlString:_r,isArrayOfHtmlElements:Gr,isArrayOfHtmlStrings:Zr,ElemArray2HtmlString:Yr,addHandlerId:Xr,cssRuleEdit:he,addFn:Qt}=Wt();function Wt(){let t=Y({createWithId:"JQxStylesheet"}),e=(r,n)=>ne[r]=(o,...l)=>n(o,...l);return{...Me(),cssRuleEdit:t,addFn:e}}function G(t){return new Proxy(t,{get:(e,r)=>zt(e,r,t)})}function ze(t,e){return(...r)=>a(t,Function)&&t(G(e),...r)}function zt(t,e,r){switch(!0){case a(e,Symbol):return t;case a(+e,Number):return t.collection?.[e]||void 0;case e in be:return ze(be[e],r)();case e in ne:return ze(ne[e],r);default:return t[e]}}function Ue(t){let e=Zt(t);for(let[r,n]of Object.entries(Object.getOwnPropertyDescriptors(e)))Object.defineProperty(t,r,n);return t}function Vt(t){return{allow:e=>{let r=/-/.test(e),n=r&&e;e=r?K(e):e.toLowerCase(),B.allowTag(e),a(t[e],Function)||Object.defineProperties(t,Se(e,!0,t,n))},prohibit:e=>{e=e.toLowerCase(),B.prohibitTag(e),a(t[e],Function)&&Object.defineProperties(t,Se(e,!1,t))}}}function Ve(...t){if(t.length===1){let e=String(t.shift().trim());t=e.startsWith("!")?[e.slice(1,-1)]:e.split(",").map(r=>r.trim())}for(let e of t.map(r=>r.startsWith("!")?r.slice(1,-1):r))he(e,{removeRule:1})}function Ut(t){return function(e,r,n){r=r?.isJQx?r?.[0]:r,n=n&&Object.values(C).find(l=>n===l);let o=t(e,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of o.collection)n?r.insertAdjacentElement(n,l):r.append(l);return o}}function _t(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);for(let[o,l]of Object.entries(n))!(o in e)&&Object.defineProperty(e,o,l)}return e}function Gt(t,e,r,n){return t=D(n||t.toLowerCase()),{get(){return(...o)=>e&&r.virtual(U(oe[t](...o)))},enumerable:!1,configurable:!0}}function Se(t,e,r,n){t=t.toLowerCase();let o=Gt(t,e,r,n);return n?{[n]:o,[K(n)]:o}:{[t]:o,[t.toUpperCase()]:o}}function Zt(t){return _t(Object.entries(B.tagsRaw).reduce(Yt(t),{}),rr(t))}function Yt(t){return function(e,[r,n]){return n&&Object.defineProperties(e,Se(r,n,t)),e}}function Xt(t){return function(e,r,...n){a(r,Function)&&(n.push(r),r=void 0),t({type:e,selector:r,handlers:n})}}function Kt(t){return function(e){let{type:r,origin:n,selector:o,handlers:l,name:u,capture:h,once:p,canRemove:y}=e,b=He(r),x=u;if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l,y=a(y,Boolean)?y:!1;let m={eventType:b,selector:o||n,capture:h,name:x,once:p,canRemove:y};switch(!0){case(a(b,Array)&&b.length>0):for(let f of b){m.eventType=f;for(let S of l)g(S)}return;default:for(let f of l)g(f)}function g(f){m.name=x,a(f,Function)&&t({...m,callback:f})}}}function qt(t,e){return e=F(e)&&e,t=F(t)&&t,e&&t&&[...N[t].values()].find(r=>(r.name||"")===e)}function er(t){return t.activePopup||Object.defineProperty(t,"activePopup",{value:Je(t),enumerable:!1}),t.activePopup}function tr(t){let e=(p,y)=>he(p,y),r=p=>Y({createWithId:p||`jqx${V()}`}),n=(...p)=>{for(let y of p)he(y)},o=Vt(t),l=We(t),u=Kt(l);return{editCssRule:e,createStyle:r,editCssRules:n,allowProhibit:o,handle:l,capturedHandling:u,log:(...p)=>$.on.log(...p).off}}function rr(t){let{factoryExtensions:e,instanceExtensions:r}=Be(t);be=e,ne=r;let{editCssRule:n,createStyle:o,editCssRules:l,allowProhibit:u,handle:h,capturedHandling:p,log:y}=tr(t);return{log:y,editCssRules:l,createStyle:o,editStylesheet:o,editCssRule:n,escHtml:j,logger:$,text:(b,x=!1)=>x?t.comment(b):document.createTextNode(b),node:(b,x=document)=>x.querySelector(b,x),nodes:(b,x=document)=>[...x.querySelectorAll(b,x)],get getNamedListener(){return qt},get virtual(){return Ut(t)},get allowTag(){return u.allow},get prohibitTag(){return u.prohibit},get removeCssRule(){return Ve},get removeCssRules(){return Ve},get delegate(){return Xt(p)},get delegateCaptured(){return p},get handle(){return p},get at(){return C},get setStyle(){return n},get fn(){return Qt},get lenient(){return B.allowUnknownHtmlTags},get IS(){return a},get Popup(){return er(t)}}}var rn=Ue(nr());function nr(){return function(r,n,o=C.BeforeEnd){if(r?.isJQx)return r;let l=a(n,HTMLBRElement);n=(!l&&n&&n.isJQx?n[0]:n)||document.body,o=o&&Object.values(C).find(g=>o===g)?o:void 0;let u=ee(r),h=!u&&ce(r),p=h||u,y={collection:fe(r)??[],isVirtual:l,isJQx:!0},b=te(y.collection),x=`input =&gt; ${h?`"${A(r.join(", "),70)}"`:!p&&b?`element collection [${A(y.collection.map(g=>`${a(g,Comment,Text)?"Comment|Text @":""} ${g?.outerHTML||g?.textContent}`).join(", "),70)}]`:`"${A(r,70)}"`}`;if(y.collection.length&&b)return $.log(x),l||y.collection.forEach(g=>{n.contains(g)||_([g],n,o)}),G(y);if(p){if([r].flat().forEach(g=>y.collection.push(H(g))),y.collection.length>0){let g=y.collection.filter(f=>f?.dataset?.jqxcreationerror);y.collection=y.collection.filter(f=>!f?.dataset?.jqxcreationerror),$.log(`${x}`),$.log(`*Created ${y.isVirtual?"VIRTUAL ":""}[${A(ue(y.collection).trim()||"sanitized: no elements remaining",70)}]`),y.isVirtual||_(y.collection,n,o)}return G(y)}let m=de(r,n,y);return $.log(`input => ${m}`),G(y)}}export{rn as default};
15
+ `)),r}return Object.defineProperties(r,{log:{value:o,enumerable:!1},error:{value:n,enumerable:!1}}),Object.freeze(r)}var ge=!1,$t={on:()=>ge=!0,off:()=>ge=!1},B={tagsRaw:W,allowUnknownHtmlTags:$t,isAllowed(t){if(ge)return!0;let e=a(t,String)?t.toLowerCase():t?.nodeName.toLowerCase()||"none";return e==="#text"||!!W[e]},allowTag:t=>W[t.toLowerCase()]=!0,prohibitTag:t=>W[t.toLowerCase()]=!1};var At=!0,re={data:/data-[\-\w.\p{L}]/ui,validURL:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,whiteSpace:/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g,notAllowedValues:/^javascript|injected|noreferrer|alert|DataURL/gi};function Dt(t){if(At&&Object.keys(t.removed).length){let e=Object.entries(t.removed).reduce((r,[n,o])=>[...r,`${j(n)} => ${o}`],[]).join("\\000A");$.error(`JQx: HTML creation error(s): ${e}`)}}function Ht(t){let e=t.nodeName.toLowerCase(),r=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];return/-/.test(e)&&!r.find(n=>n===e)||B.isAllowed(e)}function U(t){let e={rawHTML:t?.parentElement?.getHTML()??"no html",removed:{}};return a(t,HTMLElement)&&[...t.childNodes].forEach(r=>{if(r?.children?.length&&U(r),r?.attributes){let o=a(r,SVGElement)?J.svg:J.html;[...(r??{attributes:[]}).attributes].forEach(l=>{let u=l.name.trim().toLowerCase(),h=l.value.trim().toLowerCase().replace(re.whiteSpace,""),p=u==="href"?!re.validURL.test(h):re.notAllowedValues.test(h),y=u.startsWith("data")?!re.data.test(u):!!o[u];if(p||y){let b=ae(l.value||"none",60);b+=b.length===60?"...":"",e.removed[`${l.name}`]=`attribute/property/value not allowed, removed. Value: ${b}`,r.removeAttribute(l.name)}})}if(!(Ht(r)||r.constructor===CharacterData||r.constructor===Comment)){let o=(r?.outerHTML||r?.textContent).trim(),l=ae(o,60)??"EMPTY";l+=l.length===60?"...":"",e.removed[`<${r.nodeName?.toLowerCase()}>`]=`not allowed, not rendered. Value: ${l}`,r.remove()}}),Dt(e),t}function Nt(t){let e=document.createElement("div");return e.insertAdjacentHTML(C.end,t),e.childNodes.length?U(e):void 0}function Mt(t,e,r){return a(t,Comment)?e.insertAdjacentHTML(r,`<!--${t.data}-->`):e.insertAdjacentText(r,t.data)}function _(t=[],e=document.body,r=C.BeforeEnd){return r=r||C.BeforeEnd,t.reduce((n,o)=>{let l=P(o)&&Pt(o,e,r);return l?[...n,l]:n},[])}function Pt(t,e=document.body,r=C.BeforeEnd){return r=r||C.BeforeEnd,e=e?.isJQx?e?.[0]:e,a(t,Comment,Text)?Mt(t,e,r):a(t,HTMLElement)?e.insertAdjacentElement(r,t):void 0}function H(t){if(a(t,Text,Comment))return t;let e=t?.trim(),r=e?.split(/<text>|<\/text>/i)??[];if(r?.length&&(r=r.length>1?r.filter(o=>o.length).shift():void 0),e.startsWith("<!--")&&e.endsWith("-->"))return document.createComment(t.replace(/<!--|-->$/g,""));if(r||!/^<(.+)[^>]+>/m.test(e))return document.createTextNode(r);let n=Nt(t);return n.childNodes.length<1?H(`<span data-jqxcreationerror="1">${A(t,60)}</span>`):n.children[0]}var Ot=Pe();function Oe(t){return t&&(t.textContent="")}function E(t,e){let r=t.collection.filter(n=>!q(n));for(let n=0;n<r.length;n+=1)e(r[n],n);return t}function Q(t){let e=t.cloneNode(!0);return e.removeAttribute&&e.removeAttribute("id"),t.isConnected?t.remove():t=null,e}function ke(t,e){if(t&&a(e,Object))for(let[r,n]of Object.entries(e))t.setAttribute(`data-${D(r)}`,n)}function Ie(t,e){return t.andThen(e,!0)}function Re(t,e){return t.andThen(e)}function je(t){return t.startsWith("data")||J.html.find(e=>t.toLowerCase()===e)}function It(t,e,r,n){r&&a(e,String)&&(e={[e]:r==="-"?"":r});let o;e.className&&(o=e.className,delete e.className),o=[...t.classList].find(u=>u.startsWith("JQxClass-")||o&&u===o)||o||`JQxClass-${V().slice(1)}`,n.editCssRule(`.${o}`,e),t.classList.add(o)}function Rt(t,e){if(t)for(let[r,n]of Object.entries(e)){if(r=D(r),r.startsWith("data"))return ke(t,n);a(n,String)&&je(r)&&t.setAttribute(r,n.split(/[, ]/)?.join(" "))}}function pe(t,e){if(a(e,Object))for(let[r,n]of Object.entries(e)){let o;/!important/i.test(n)&&(n=n.slice(0,n.indexOf("!")).trim(),o="important"),t.style.setProperty(D(r),n,o)}}function kt(...t){debugLog.log("\u2757"+t.map(e=>String(e)).join(", "))}function ye(t,e=0,r=!0){return t=t?.parentElement,e+=t?t[r?"scrollTop":"scrollLeft"]:0,t?ye(t,e,r):e}function jt(t){return{data:e=>({get all(){return new Proxy(e[0]?.dataset??{},De)},set:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},get:(r,n)=>e.data.all[r]??n,add:(r={})=>{if(!e.is.empty&&a(r,Object))for(let[n,o]of Object.entries(r))e.setData({[n]:o});return e},remove:r=>(e[0]?.removeAttribute(`data-${D(r)}`),e)}),dimensions:e=>{if(e.is.empty)return{error:"[instance].dimensions: NO ELEMENTS"};let r=e[0],n=e.first()?.getBoundingClientRect().toJSON();return n.scrollTopDistance=ye(r,0),n.scrollLeftDistance=ye(r,0,!1),n},node:e=>e[0],HTML:e=>({get:(r,n)=>{if(e.is.empty)return"NO ELEMENTS IN COLLECTION";let o=r?e.outerHtml:e.html();return n?j(o):o},set:(r,n=!1,o=!1)=>{r=r.isJQx?r.HTML.get(1):r;let l=a(r,String);return r=l&&o?j(r):r,l&&(r||"").trim().length&&e.html(r,n),e},replace:(r,n=!1)=>e.HTML.set(r,!1,n),append:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r,!0,n)),insert:(r,n=!1)=>(r=a(r,HTMLElement)?t(r).HTML.get(1):r.isJQx?r.HTML.get(1):r,e.HTML.set(r+e.HTML.get(),!1,n))}),is:e=>Ot(e),length:e=>e.collection.length,outerHtml:e=>(e.first()||{outerHTML:void 0}).outerHTML,parent:e=>{let r=t(e[0]?.parentNode);return r.is.empty?e:r},render:e=>(!e.is.empty&&e.toDOM()||t.log("[JQx.render]: empty collection"),e),Style:e=>({get computed(){return e.is.empty?{}:getComputedStyle(e[0])},inline:r=>e.style(r),inSheet:r=>e.css(r),valueOf:r=>e.is.empty?void 0:getComputedStyle(e[0])[D(r)],nwRule:r=>e.Style.byRule({rules:r}),byRule:({classes2Apply:r=[],rules:n=[]}={})=>{let l=a(n,String)&&!r.length?n.split("{")[0].trim():"";if(n=n&&a(n,String)?[n]:n,r=r&&a(r,String)?[r]:r,(n?.length||r?.length)&&(n?.length&&t.editCssRules(...n),r))for(let u of r)e.addClass(u);return l?.startsWith(".")&&e.addClass(l.slice(1)),l?.startsWith("#")&&!e.attr("id")&&e.prop({id:l.slice(1)}),e}})}}function Bt(t){return{addClass:(e,...r)=>E(e,n=>n&&r.forEach(o=>n.classList.add(o))),after:Re,afterMe:Re,andThen:(e,r,n=!1)=>{if(!r||!a(r,String,Node,Proxy))return kt(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${r}]`),e;r=r?.isJQx?r.collection:a(r,Node)?t.virtual(r).collection:t.virtual(H(r)).collection;let[o,l,u]=n?[0,"before",r.concat(e.collection)]:[e.collection.length-1,"after",e.collection.concat(r)];return e[o][l](...r),e.collection=u,e},append:(e,...r)=>{if(!e.is.empty&&r.length){let n=e.length===1;for(let o of r){if(!o.isJQx&&F(o)){let l=o.trim(),h=!/^<(.+)[^>]+>$/m.test(l)?t.text(o):H(o);E(e,p=>p.append(n?h:Q(h)))}P(o)&&E(e,l=>l.append(n?o:Q(o))),o.isJQx&&!o.is.empty&&E(e,l=>o.collection.forEach(u=>l.append(n?u:Q(u))))}}return e},appendTo:(e,r)=>(r.isJQx||(r=t(r)),r.append(e),e),attr:(e,r,n)=>{let o=e[0];if(!o)return e;if(!n&&F(r))return r=D(r),r==="class"?[...o?.classList].join(" "):o?.getAttribute(r);if(F(r)&&n)switch(r=D(r),!0){case r.startsWith("data-"):r={data:{[r.replace("data-","")]:n}};break;default:r={[r]:n}}return a(r,Object)&&!e.is.empty&&Rt(o,r),e},before:Ie,beforeMe:Ie,clear:e=>E(e,Oe),closest:(e,r)=>{let n=F(r)?e[0].closest(r):null;return n?t(n):e},computedStyle:(e,r)=>e.first()&&getComputedStyle(e.first())[r],css:(e,r,n)=>E(e,o=>It(o,r,n,t)),duplicate:(e,r=!1,n=document.body)=>{if(e.collection.length>0){let o=e.collection[0].cloneNode(!0);return o.childNodes.forEach(l=>{l.removeAttribute&&l?.removeAttribute("id")}),r?t(o).toDOM(n):t.virtual(o)}return $.error("Duplicating an empty JQx instance is not possible"),e},each:(e,r)=>E(e,r),empty:e=>E(e,Oe),find:(e,r)=>e.collection.length>0?[...e.first()?.querySelectorAll(r)]:[],find$:(e,r)=>e.collection.length>0?t(r,e):e,first:(e,r=!1)=>{if(e.collection.length>0)return r?e.single():e.collection[0]},first$:(e,r)=>e.single(r),getData:(e,r,n)=>e.first()&&e.first().dataset?.[r]||n,hasClass:(e,...r)=>{let n=e[0];return!n||!n.classList.length?!1:r.find(o=>n.classList.contains(o))&&!0||!1},hide:e=>E(e,r=>pe(r,{display:"none !important"})),html:(e,r,n)=>{if(r===void 0){let o=e.node;return o?.getHTML&&o.getHTML()||""}if(!e.isEmpty()){let o=H(`<div>${r.isJQx?r.HTML.get(!0):r}</div>`);if(!a(o,Comment))return E(e,u=>(n||(u.textContent=""),u.insertAdjacentHTML(t.at.end,o.getHTML())))}return e},htmlFor:(e,r,n="",o=!1)=>{if(r&&e.collection.length){if(!r||!F(n))return e;let l=e.find$(r);if(l.length<1)return e;let u=H(`<span>${n}</span>`);l.each(h=>{o||(h.textContent=""),h.insertAdjacentHTML(t.at.end,u?.getHTML())})}return e},isEmpty:e=>e.collection.length<1,nth$:(e,r)=>e.single(r),on:(e,r,...n)=>{if(e.collection.length&&a(r,String,Array)){if(r?.length<1||n.length<1)return e;let o=me(e);t.handle({type:r,selector:o,handlers:n})}return e},prepend:(e,...r)=>{if(!e.is.empty&&r){let n=e.length===1;for(let o of r){if(F(o)){o=o.trim();let u=!/^<(.+)[^>]+>$/m.test(o)?t.text(o):H(o);u=n?u:Q(u),E(e,h=>h.prepend(u.cloneNode(!0)))}P(o)&&E(e,l=>l.prepend(n?o:Q(o))),o.isJQx&&!o.is.empty&&(o.collection.length>1&&o.collection.reverse(),E(e,l=>E(o,u=>l.prepend(n?u:Q(u)))),o.collection.reverse())}}return e},prependTo:(e,r)=>(r.isJQx||(r=t.virtual(r)),r.prepend(e),e),prop:(e,r,n)=>{if(a(r,String)&&!n)return r.startsWith("data")?e[0]?.dataset[r.slice(r.indexOf("-")+1)]:e[0]?.[r];let o=a(r,Object)?r:{[r]:n};for(let[l,u]of Object.entries(o)){if(l=l.trim(),u&&!je(l)||!u)return!1;if(l.toLowerCase()==="id")return e[0].id=u;E(e,p=>{if(l.startsWith("data"))return p.dataset[l.slice(l.indexOf("-")+1)]=u;p[l]=u})}return e},remove:(e,r)=>{$.log(`remove ${A(e.HTML.get(1),40)}${r?` /w selector ${r}`:""}`);let n=l=>l.remove(),o=()=>e.collection=e.collection.filter(l=>document.documentElement.contains(l));if(r){let l=e.find$(r);return l.is.empty||(E(l,n),o()),e}return E(e,n),o(),e},rmAttr:(e,...r)=>{for(let n of r)e.node.removeAttribute(n);return e},removeClass:(e,...r)=>E(e,n=>{if(n)for(let o of r)n.classList.remove(o)}),renderTo:(e,r=document.body,n=t.at.end)=>(e.first$().toDOM(r,n),e),replace:(e,r,n)=>{let o=e[0];return!r||!n||!a(n,HTMLElement)&&!n.isJQx?(console.error("JQx replace: invalid replacement value"),e):(n.isJQx&&(n=n[0]),a(n,NodeList)&&(n=n[0]),o&&r&&(r=a(r,String)?o.querySelectorAll(r):r.isJQx?r.collection:r,a(r,HTMLElement,NodeList,Array)&&a(n,HTMLElement)&&(a(r,HTMLElement)?[r]:[...r]).forEach(l=>l.replaceWith(n.cloneNode(!0)))),e)},replaceClass:(e,r,...n)=>E(e,o=>{o.classList.remove(r);for(let l of n)o.classList.add(l)}),replaceMe:(e,r)=>e.replaceWith(r),replaceWith:(e,r)=>(r=a(r,Element)?r:r.isJQx?r[0]:void 0,r&&(e[0].replaceWith(r),e=t.virtual(r)),e),setData:(e,r)=>E(e,n=>ke(n,r)),show:e=>E(e,r=>pe(r,{display:"revert-layer !important"})),single:(e,r)=>e.collection.length>0?a(r,String)?e.find$(r):a(r,Number)?t(e.collection[r]):t(e.collection[0]):e,style:(e,r,n)=>E(e,l=>{n&&a(r,String)&&(r={[r]:n||"none"}),pe(l,r)}),text:(e,r,n=!1)=>e.isEmpty()?e:a(r,String)?E(e,l=>l.textContent=n?l.textContent+r:r):e.first().textContent,toDOM:(e,r=document.body,n=C.BeforeEnd)=>(e.isVirtual&&(e.isVirtual=!1),_(e.collection,r,n),e),toggleClass:(e,r)=>E(e,n=>n.classList.toggle(r)),toNodeList:e=>[...e.collection].map(r=>document.importNode(r,!0)),trigger:(e,r,n=Event,o={})=>{if(e.collection.length){let l=new n(r,{...o,bubbles:o.bubbles??!0});for(let u of e.collection)u.dispatchEvent(l)}return e},val:(e,r)=>{let n=e[0];return!n||!a(n,HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement)?e:r===void 0?n.value:(n.value=a(r,String)?r:"",e)}}}function Be(t){return{factoryExtensions:jt(t),instanceExtensions:Bt(t)}}function Je(t){if(t.node("#jqxPopup"))return;t.logger.log("JQx: [JQx].Popup first call. Dialog element created."),t.dialog({id:"jqxPopup"},t.div({id:"jqxPopupContent"})).render,t.editCssRules(...xe);let[e,r]=[t("#jqxPopupContent"),t.node("#jqxPopup")],n={};return t.handle({type:"click, keydown",handlers:y,capture:!0}),Object.freeze({show:o,removeModal:p});function o(m){if(r.open)return;n={...m};let{content:g}=n;return t.IS(g,String,HTMLElement)||g?.isJQx?u():!0}function l(){return n.modal?x(n.warnMessage):h()}function u(){e.clear();let{content:m,modal:g,closeAfter:f}=n;g=t.IS(g,Boolean)?g:!1;let S=g?"":t.div({id:"closeHandleIcon"});e.append(S,t.IS(m,String)?t.div(m):m),r.showModal(),!g&&t.IS(f,Number)&&b(l,f)}function h(){if(r.close(n.returnValue),t.IS(n.callback,Function))return n.callback(n.returnValue);n={}}function p({callback:m,value:g}={}){n.returnValue=g,n.modal=!1,n.callback=m||n.callback,l()}function y(m){if(!(Object.keys(n).length<1||!r.open))return m.key==="Escape"&&m.preventDefault(),n.activeTimer&&clearTimeout(n.activeTimer),(m.target.closest("#closeHandleIcon")||!m.target.closest("#jqxPopupContent"))&&l(),document.activeElement.blur()}function b(m,g){t.IS(m,Function)&&t.IS(g,Number)&&g>0&&(n.activeTimer=setTimeout(m,g*1e3))}function x(m){if(!t.IS(m,String,HTMLElement,Proxy))return;let g=e.find$(".warn");switch(!0){case g.is.empty:g=t.div({class:"warn"},m);default:e.append(g.addClass("active")),b(()=>e.find$(".warn").removeClass("active"),2)}}}var N={},Jt=["load","unload","scroll","focus","blur","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","loadstart","progress","error","abort","load","loadend","pointerenter","pointerleave","readystatechange"],Qe=t=>!!Jt.find(e=>e===t);function We(t){return function(o){let{eventType:l,selector:u,callback:h,name:p,capture:y,once:b,canRemove:x}=o;switch(!0){case(!F(l)||!t.IS(h,Function)):default:p=p||!/handlers$/.test(h.name)&&h.name||void 0,y=t.IS(y,Boolean)?y:!1,b=t.IS(b,Boolean)?b:!1,x=F(p,4)&&t.IS(x,Boolean)?x:b;let{handler:m,signal:g,remove:f}=e({selector:u,callback:h,canRemove:x,once:b,name:p,eventType:l});return n({eventType:l,handler:m,capture:y,once:b,signal:g,remove:f,name:p})}};function e(o){let{selector:l,callback:u,canRemove:h,name:p,eventType:y,once:b}=o,x=(h||b)&&new AbortController,m=r({once:b,abortcontroller:x,name:p,eventType:y}),g=l?{handler:f=>{let S=f.target?.closest?.(l);return S&&u(f,t(S),m)},remove:m}:{handler:f=>u(f,f.target,m),remove:m};return x&&(g.signal=x.signal,b)?{handler:(f,S)=>{g.handler(f,S),m()}}:g}function r(o){let{once:l,abortcontroller:u,name:h,eventType:p}=o;return h?u?function(){u.abort();let b=[...N[p].entries()].find(([x,m])=>m.name===h);N[p].delete(b[0]),setTimeout(()=>t.logger.log(`Listener for event type [${p}] with name [${h}] was removed${l?" (once active, so handled once).":""}`),100)}:function(y){t.logger.error(`Listener for event type [${p}] with name [${h}] is not marked as removable`)}:function(){t.logger.error("An anonymous listener can not be removed")}}function n(o){let{eventType:l,handler:u,capture:h,once:p,signal:y,remove:b,name:x}=o;if(N[l]||(N[l]=new Map),!(N[l].has(u)||[...N[l].values()].find(g=>(g.name||"")===x))){let g={capture:h||Qe(l),once:p||!1};y&&(g.signal=y),document.addEventListener(l,u,g);let f={name:x,remove:b,capture:h||Qe(l)};N[l].set(u,f)}}}var be,ne,{isComment:Vr,isText:Ur,isHtmlString:_r,isArrayOfHtmlElements:Gr,isArrayOfHtmlStrings:Zr,ElemArray2HtmlString:Yr,addHandlerId:Xr,cssRuleEdit:he,addFn:Qt}=Wt();function Wt(){let t=Y({createWithId:"JQxStylesheet"}),e=(r,n)=>ne[r]=(o,...l)=>n(o,...l);return{...Me(),cssRuleEdit:t,addFn:e}}function G(t){return new Proxy(t,{get:(e,r)=>zt(e,r,t)})}function ze(t,e){return(...r)=>a(t,Function)&&t(G(e),...r)}function zt(t,e,r){switch(!0){case a(e,Symbol):return t;case a(+e,Number):return t.collection?.[e]||void 0;case e in be:return ze(be[e],r)();case e in ne:return ze(ne[e],r);default:return t[e]}}function Ue(t){let e=Zt(t);for(let[r,n]of Object.entries(Object.getOwnPropertyDescriptors(e)))Object.defineProperty(t,r,n);return t}function Vt(t){return{allow:e=>{let r=/-/.test(e),n=r&&e;e=r?K(e):e.toLowerCase(),B.allowTag(e),a(t[e],Function)||Object.defineProperties(t,Se(e,!0,t,n))},prohibit:e=>{e=e.toLowerCase(),B.prohibitTag(e),a(t[e],Function)&&Object.defineProperties(t,Se(e,!1,t))}}}function Ve(...t){if(t.length===1){let e=String(t.shift().trim());t=e.startsWith("!")?[e.slice(1,-1)]:e.split(",").map(r=>r.trim())}for(let e of t.map(r=>r.startsWith("!")?r.slice(1,-1):r))he(e,{removeRule:1})}function Ut(t){return function(e,r,n){r=r?.isJQx?r?.[0]:r,n=n&&Object.values(C).find(l=>n===l);let o=t(e,document.createElement("br"));if(r&&!a(r,HTMLBRElement))for(let l of o.collection)n?r.insertAdjacentElement(n,l):r.append(l);return o}}function _t(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);for(let[o,l]of Object.entries(n))!(o in e)&&Object.defineProperty(e,o,l)}return e}function Gt(t,e,r,n){return t=D(n||t.toLowerCase()),{get(){return(...o)=>e&&r.virtual(U(oe[t](...o)))},enumerable:!1,configurable:!0}}function Se(t,e,r,n){t=t.toLowerCase();let o=Gt(t,e,r,n);return n?{[n]:o,[K(n)]:o}:{[t]:o,[t.toUpperCase()]:o}}function Zt(t){return _t(Object.entries(B.tagsRaw).reduce(Yt(t),{}),rr(t))}function Yt(t){return function(e,[r,n]){return n&&Object.defineProperties(e,Se(r,n,t)),e}}function Xt(t){return function(e,r,...n){a(r,Function)&&(n.push(r),r=void 0),t({type:e,selector:r,handlers:n})}}function Kt(t){return function(e){let{type:r,origin:n,selector:o,handlers:l,name:u,capture:h,once:p,canRemove:y}=e,b=He(r),x=u;if(!a(l,Function,Array))return;l=a(l,Function)?[l]:l,y=a(y,Boolean)?y:!1;let m={eventType:b,selector:o||n,capture:h,name:x,once:p,canRemove:y};switch(!0){case(a(b,Array)&&b.length>0):for(let f of b){m.eventType=f;for(let S of l)g(S)}return;default:for(let f of l)g(f)}function g(f){m.name=x,a(f,Function)&&t({...m,callback:f})}}}function qt(t,e){return e=F(e)&&e,t=F(t)&&t,e&&t&&[...N[t].values()].find(r=>(r.name||"")===e)}function er(t){return t.activePopup||Object.defineProperty(t,"activePopup",{value:Je(t),enumerable:!1}),t.activePopup}function tr(t){let e=(p,y)=>he(p,y),r=p=>Y({createWithId:p||`jqx${V()}`}),n=(...p)=>{for(let y of p)he(y)},o=Vt(t),l=We(t),u=Kt(l);return{editCssRule:e,createStyle:r,editCssRules:n,allowProhibit:o,handle:l,capturedHandling:u,log:(...p)=>$.on.log(...p).off}}function rr(t){let{factoryExtensions:e,instanceExtensions:r}=Be(t);be=e,ne=r;let{editCssRule:n,createStyle:o,editCssRules:l,allowProhibit:u,handle:h,capturedHandling:p,log:y}=tr(t);return{log:y,editCssRules:l,createStyle:o,editStylesheet:o,editCssRule:n,escHtml:j,logger:$,text:(b,x=!1)=>x?t.comment(b):document.createTextNode(b),node:(b,x=document)=>x.querySelector(b,x),nodes:(b,x=document)=>[...x.querySelectorAll(b,x)],get getNamedListener(){return qt},get virtual(){return Ut(t)},get allowTag(){return u.allow},get prohibitTag(){return u.prohibit},get removeCssRule(){return Ve},get removeCssRules(){return Ve},get delegate(){return Xt(p)},get delegateCaptured(){return p},get handle(){return p},get at(){return C},get setStyle(){return n},get fn(){return Qt},get lenient(){return B.allowUnknownHtmlTags},get IS(){return a},get Popup(){return er(t)}}}var rn=Ue(nr());function nr(){return function(r,n,o=C.BeforeEnd){if(r?.isJQx)return r;let l=a(n,HTMLBRElement);n=(!l&&n&&n.isJQx?n[0]:n)||document.body,o=o&&Object.values(C).find(g=>o===g)?o:void 0;let u=ee(r),h=!u&&ce(r),p=h||u,y={collection:fe(r)??[],isVirtual:l,isJQx:!0},b=te(y.collection),x=`input =&gt; ${h?`"${A(r.join(", "),70)}"`:!p&&b?`element collection [${A(y.collection.map(g=>`${a(g,Comment,Text)?"Comment|Text @":""} ${g?.outerHTML||g?.textContent}`).join(", "),70)}]`:`"${A(r,70)}"`}`;if(y.collection.length&&b)return $.log(x),l||y.collection.forEach(g=>{n.contains(g)||_([g],n,o)}),G(y);if(p){if([r].flat().forEach(g=>y.collection.push(H(g))),y.collection.length>0){let g=y.collection.filter(f=>f?.dataset?.jqxcreationerror);y.collection=y.collection.filter(f=>!f?.dataset?.jqxcreationerror),$.log(`${x}`),$.log(`*Created ${y.isVirtual?"VIRTUAL ":""}[${A(ue(y.collection).trim()||"sanitized: no elements remaining",70)}]`),y.isVirtual||_(y.collection,n,o)}return G(y)}let m=de(r,n,y);return $.log(`input => ${m}`),G(y)}}export{rn as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jqx-es",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The good parts of JQuery",
package/src/DOM.js CHANGED
@@ -26,7 +26,7 @@ function characterDataElement2DOM(elem, root, position) {
26
26
 
27
27
  function inject2DOMTree( collection = [], root = document.body, position = insertPositions.BeforeEnd ) {
28
28
  position = position || insertPositions.BeforeEnd;
29
- collection.reduce( (acc, elem) => {
29
+ return collection.reduce( (acc, elem) => {
30
30
  const created = isNode(elem) && element2DOM(elem, root, position);
31
31
  return created ? [...acc, created] : acc;
32
32
  }, []);
package/src/JQxMethods.js CHANGED
@@ -325,9 +325,15 @@ function instanceExtensionsFactory(jqx) {
325
325
  computedStyle: (instance, property) => instance.first() && getComputedStyle(instance.first())[property],
326
326
  css: (instance, keyOrKvPairs, value) => loop(instance, el => css(el, keyOrKvPairs, value, jqx)),
327
327
  duplicate: (instance, toDOM = false, root = document.body) => {
328
- const nodes = instance.toNodeList().map(el => el.removeAttribute && el.removeAttribute(`id`) || el);
329
- const nwJQx = jqx.virtual(nodes);
330
- return toDOM ? nwJQx.toDOM(root) : nwJQx;
328
+ if (instance.collection.length > 0) {
329
+ const clone = instance.collection[0].cloneNode(true);
330
+ clone.childNodes.forEach((node) => {
331
+ node.removeAttribute && node?.removeAttribute(`id`)
332
+ });
333
+ return toDOM ? jqx(clone).toDOM(root) : jqx.virtual(clone);
334
+ }
335
+ systemLog.error(`Duplicating an empty JQx instance is not possible`);
336
+ return instance;
331
337
  },
332
338
  each: (instance, cb) => loop(instance, cb),
333
339
  empty: instance => loop(instance, emptyElement),
@@ -578,8 +584,7 @@ function instanceExtensionsFactory(jqx) {
578
584
  },
579
585
  toDOM: (instance, root = document.body, position = insertPositions.BeforeEnd) => {
580
586
  if (instance.isVirtual) { instance.isVirtual = false; }
581
- instance.collection = inject2DOMTree(instance.collection, root, position);
582
-
587
+ inject2DOMTree(instance.collection, root, position);
583
588
  return instance;
584
589
  },
585
590
  toggleClass: (instance, className) => loop(instance, el => el.classList.toggle(className)),
package/src/_JQxX.js ADDED
@@ -0,0 +1,500 @@
1
+ import {
2
+ addHandlerId, ExamineElementFeatureFactory,
3
+ insertPositions,
4
+ IS, isCommentOrTextNode,
5
+ isNode,
6
+ isNonEmptyString, randomString,
7
+ systemLog,
8
+ toDashedNotation,
9
+ truncateHtmlStr
10
+ } from "./Utilities.js";
11
+ import {ATTRS, createElementFromHtmlString, inject2DOMTree} from "./DOM.js";
12
+
13
+ const isIt = ExamineElementFeatureFactory();
14
+
15
+ /* region functions */
16
+ function emptyElement(el) {
17
+ return el && (el.textContent = "");
18
+ }
19
+
20
+ function loop(instance, callback) {
21
+ const cleanCollection = instance.collection.filter(el => !isCommentOrTextNode(el));
22
+ for (let i = 0; i < cleanCollection.length; i += 1) {
23
+ callback(cleanCollection[i], i);
24
+ }
25
+
26
+ return instance;
27
+ }
28
+
29
+ function compareCI(key, compareTo) {
30
+ return key.toLowerCase().trim() === compareTo.trim().toLowerCase();
31
+ }
32
+
33
+ function cloneAndDestroy(elem) {
34
+ const cloned = elem.cloneNode(true)
35
+ cloned.removeAttribute && cloned.removeAttribute(`id`);
36
+ elem.isConnected ? elem.remove() : elem = null;
37
+ return cloned;
38
+ }
39
+
40
+ function setData(el, keyValuePairs) {
41
+ if (el && IS(keyValuePairs, Object)) {
42
+ for (const [key, value] of Object.entries(keyValuePairs)) {
43
+ el.setAttribute(`data-${toDashedNotation(key)}`, value);
44
+ }
45
+ }
46
+ }
47
+
48
+ function before (instance, elem2AddBefore) {
49
+ return instance.andThen(elem2AddBefore, true);
50
+ }
51
+
52
+ function after(instance, elem2AddAfter) {
53
+ return instance.andThen(elem2AddAfter);
54
+ }
55
+
56
+ function checkProp(prop) {
57
+ return prop.startsWith(`data`) || ATTRS.html.find(attr => prop.toLowerCase() === attr);
58
+ }
59
+
60
+ function css(el, keyOrKvPairs, value, jqx) {
61
+ if (value && IS(keyOrKvPairs, String)) {
62
+ keyOrKvPairs = {[keyOrKvPairs]: value === "-" ? "" : value};
63
+ }
64
+
65
+ let nwClass = undefined;
66
+
67
+ if (keyOrKvPairs.className) {
68
+ nwClass = keyOrKvPairs.className;
69
+ delete keyOrKvPairs.className;
70
+ }
71
+
72
+ const classExists = ([...el.classList].find(c => c.startsWith(`JQxClass-`) || nwClass && c === nwClass));
73
+ nwClass = classExists || nwClass || `JQxClass-${randomString().slice(1)}`;
74
+ jqx.editCssRule(`.${nwClass}`, keyOrKvPairs);
75
+ el.classList.add(nwClass);
76
+ }
77
+
78
+ function assignAttrValues(/*NODOC*/el, keyValuePairs) {
79
+ if (el) {
80
+ for (let [key, value] of Object.entries(keyValuePairs)) {
81
+ key = toDashedNotation(key);
82
+ if (key.startsWith(`data`)) {
83
+ return setData(el, value);
84
+ }
85
+
86
+ if (IS(value, String) && checkProp(key)) {
87
+ el.setAttribute(key, value.split(/[, ]/)?.join(` `));
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ function applyStyle(el, rules) {
94
+ if (IS(rules, Object)) {
95
+ for (let [key, value] of Object.entries(rules)) {
96
+ let priority;
97
+ if (/!important/i.test(value)) {
98
+ value = value.slice(0, value.indexOf(`!`)).trim();
99
+ priority = 'important';
100
+ }
101
+
102
+ el.style.setProperty(toDashedNotation(key), value, priority)
103
+ }
104
+ }
105
+ }
106
+
107
+ function logDebug(...args) {
108
+ debugLog.log(`❗` + args.map(v => String(v)).join(`, `) ) ;
109
+ }
110
+
111
+ function findParentScrollDistance(node, distance = 0, top = true) {
112
+ node = node?.parentElement;
113
+ const what = top ? `scrollTop` : `scrollLeft`;
114
+ distance += node ? node[what] : 0;
115
+ return !node ? distance : findParentScrollDistance(node, distance, top);
116
+ }
117
+ /* endregion functions */
118
+
119
+ function instanceExtensionsFactory(instance) {
120
+ const allMethods = {
121
+ addClass: (...classNames) => loop(instance, el => el && classNames.forEach(cn => el.classList.add(cn))),
122
+ after,
123
+ afterMe: after,
124
+ andThen: (elem2Add, before = false) => {
125
+ if (!elem2Add || !IS(elem2Add, String, Node, Proxy)) {
126
+ logDebug(`[JQx instance].[beforeMe | afterMe | andThen]: insufficient input [${elem2Add}]`, );
127
+ return instance;
128
+ }
129
+
130
+ elem2Add = elem2Add?.isJQx
131
+ ? elem2Add.collection
132
+ : IS(elem2Add, Node) ? jqx.virtual(elem2Add).collection
133
+ : jqx.virtual(createElementFromHtmlString(elem2Add)).collection;
134
+
135
+ const [index, method, reCollected] = before
136
+ ? [0, `before`, elem2Add.concat(instance.collection)]
137
+ : [instance.collection.length - 1, `after`, instance.collection.concat(elem2Add)];
138
+
139
+ instance[index][method](...elem2Add);
140
+ instance.collection = reCollected;
141
+ return instance;
142
+ },
143
+ append: (...elems2Append) => {
144
+ if (!instance.is.empty && elems2Append.length) {
145
+ const shouldMove = instance.length === 1;
146
+
147
+ for (let elem2Append of elems2Append) {
148
+ if (!elem2Append.isJQx && isNonEmptyString(elem2Append)) {
149
+ const elem2Append4Test = elem2Append.trim();
150
+ const isPlainString = !/^<(.+)[^>]+>$/m.test(elem2Append4Test);
151
+ let toAppend = isPlainString ? jqx.text(elem2Append) : createElementFromHtmlString(elem2Append);
152
+ loop(instance, el => el.append(shouldMove ? toAppend : cloneAndDestroy(toAppend)));
153
+ }
154
+
155
+ if (isNode(elem2Append)) {
156
+ loop(instance, el => el.append(shouldMove ? elem2Append : cloneAndDestroy(elem2Append)));
157
+ }
158
+
159
+ if (elem2Append.isJQx && !elem2Append.is.empty) {
160
+ loop(instance, el =>
161
+ elem2Append.collection.forEach(elem =>
162
+ el.append(shouldMove ? elem : cloneAndDestroy(elem)))
163
+ );
164
+ }
165
+ }
166
+ }
167
+ return instance;
168
+ },
169
+ appendTo: (appendTo) => {
170
+ if (!appendTo.isJQx) {
171
+ appendTo = jqx(appendTo);
172
+ }
173
+ appendTo.append(instance);
174
+ return instance;
175
+ },
176
+ attr: (keyOrObj, value) => {
177
+ const firstElem = instance[0];
178
+
179
+ if (!firstElem) { return instance }
180
+
181
+ if (!value && isNonEmptyString(keyOrObj)) {
182
+ keyOrObj = toDashedNotation(keyOrObj);
183
+
184
+ if (keyOrObj === `class`) {
185
+ return [...firstElem?.classList]?.join(` `);
186
+ }
187
+
188
+ return firstElem?.getAttribute(keyOrObj);
189
+ }
190
+
191
+ if (isNonEmptyString(keyOrObj) && value) {
192
+ keyOrObj = toDashedNotation(keyOrObj);
193
+
194
+ switch(true) {
195
+ case keyOrObj.startsWith(`data-`):
196
+ keyOrObj = { data: {[keyOrObj.replace(`data-`, ``)]: value } };
197
+ break;
198
+ default: keyOrObj = { [keyOrObj]: value };
199
+ }
200
+ }
201
+
202
+ if (IS(keyOrObj, Object) && !instance.is.empty) {
203
+ assignAttrValues(firstElem, keyOrObj);
204
+ }
205
+
206
+ return instance;
207
+ },
208
+ before,
209
+ beforeMe: before,
210
+ clear: instance => loop(instance, emptyElement),
211
+ closest: (selector) => {
212
+ const theClosest = isNonEmptyString(selector) ? instance[0].closest(selector) : null;
213
+ return theClosest ? jqx(theClosest) : instance
214
+ },
215
+ computedStyle: (property) => instance.first() && getComputedStyle(instance.first())[property],
216
+ css: (keyOrKvPairs, value) => loop(instance, el => css(el, keyOrKvPairs, value, jqx)),
217
+ duplicate: (toDOM = false, root = document.body) => {
218
+ const nodes = instance.toNodeList().map(el => el.removeAttribute && el.removeAttribute(`id`) || el);
219
+ const nwJQx = jqx.virtual(nodes);
220
+ return toDOM ? nwJQx.toDOM(root) : nwJQx;
221
+ },
222
+ each: (cb) => loop(instance, cb),
223
+ empty: instance => loop(instance, emptyElement),
224
+ find: (selector) =>
225
+ instance.collection.length > 0 ? [...instance.first()?.querySelectorAll(selector)] : [],
226
+ find$: (selector) => { return instance.collection.length > 0 ? jqx(selector, instance) : instance; },
227
+ first: (asJQxInstance = false) => {
228
+ if (instance.collection.length > 0) {
229
+ return asJQxInstance
230
+ ? instance.single()
231
+ : instance.collection[0];
232
+ }
233
+ return undefined;
234
+ },
235
+ first$: (indexOrSelector) => instance.single(indexOrSelector),
236
+ getData: (dataAttribute, valueWhenFalsy) =>
237
+ instance.first() && instance.first().dataset?.[dataAttribute] || valueWhenFalsy,
238
+ hasClass: (...classNames) => {
239
+ const firstElem = instance[0];
240
+ return !firstElem || !firstElem.classList.length
241
+ ? false : classNames.find(cn => firstElem.classList.contains(cn)) && true || false;
242
+ },
243
+ hide: instance => loop(instance, el => applyStyle(el, {display: `none !important`})),
244
+ html: (htmlValue, append) => {
245
+ if (htmlValue === undefined) {
246
+ const node = instance.node;
247
+ return node?.getHTML && node.getHTML() || ``;
248
+ }
249
+
250
+ if (!instance.isEmpty()) {
251
+ const nwElement = createElementFromHtmlString(
252
+ `<div>${htmlValue.isJQx ? htmlValue.HTML.get(true) : htmlValue}</div>`
253
+ );
254
+
255
+ if (!IS(nwElement, Comment)) {
256
+ const cb = el => {
257
+ if (!append) { el.textContent = ``; }
258
+
259
+ return el.insertAdjacentHTML(jqx.at.end, nwElement.getHTML());
260
+ }
261
+ return loop(instance, cb);
262
+ }
263
+ }
264
+
265
+ return instance;
266
+ },
267
+ htmlFor: (forQuery, htmlString = "", append = false) => {
268
+ if (forQuery && instance.collection.length) {
269
+ if (!forQuery || !isNonEmptyString(htmlString)) { return instance; }
270
+
271
+ const el2Change = instance.find$(forQuery);
272
+
273
+ if (el2Change.length < 1) { return instance; }
274
+
275
+ const nwElement = createElementFromHtmlString(`<span>${htmlString}</span>`);
276
+
277
+ el2Change.each(el => {
278
+ if (!append) { el.textContent = ``; }
279
+ el.insertAdjacentHTML(jqx.at.end, nwElement?.getHTML());
280
+ });
281
+
282
+ }
283
+
284
+ return instance;
285
+ },
286
+ isEmpty: instance => instance.collection.length < 1,
287
+ nth$: (indexOrSelector) => instance.single(indexOrSelector),
288
+ on: (type, ...callback) => {
289
+ if (instance.collection.length && IS(type, String, Array)) {
290
+ if (type?.length < 1 || callback.length < 1) { return instance; }
291
+ const cssSelector4Handler = addHandlerId(instance);
292
+ jqx.handle({type, selector: cssSelector4Handler, handlers: callback});
293
+ }
294
+
295
+ return instance;
296
+ },
297
+ prepend: (...elems2Prepend) => {
298
+ if (!instance.is.empty && elems2Prepend) {
299
+ const shouldMove = instance.length === 1;
300
+
301
+ for (let elem2Prepend of elems2Prepend) {
302
+ if (isNonEmptyString(elem2Prepend)) {
303
+ elem2Prepend = elem2Prepend.trim();
304
+ const isPlainString = !/^<(.+)[^>]+>$/m.test(elem2Prepend);
305
+ let toPrepend = isPlainString ? jqx.text(elem2Prepend) : createElementFromHtmlString(elem2Prepend);
306
+ toPrepend = shouldMove ? toPrepend : cloneAndDestroy(toPrepend);
307
+ loop(instance, el => el.prepend(toPrepend.cloneNode(true)));
308
+ }
309
+
310
+ if (isNode(elem2Prepend)) {
311
+ loop(instance, el => el.prepend(shouldMove ? elem2Prepend : cloneAndDestroy(elem2Prepend)));
312
+ }
313
+
314
+ if (elem2Prepend.isJQx && !elem2Prepend.is.empty) {
315
+ elem2Prepend.collection.length > 1 && elem2Prepend.collection.reverse();
316
+ loop(instance, el => loop( elem2Prepend, elem => el.prepend(shouldMove ? elem : cloneAndDestroy(elem)) ) );
317
+ elem2Prepend.collection.reverse();
318
+ }
319
+ }
320
+ }
321
+
322
+ return instance;
323
+ },
324
+ prependTo: (prependTo) => {
325
+ if (!prependTo.isJQx) {
326
+ prependTo = jqx.virtual(prependTo);
327
+ }
328
+
329
+ prependTo.prepend(instance);
330
+ return instance;
331
+ },
332
+ prop: (nameOrProperties, value) => {
333
+ if (IS(nameOrProperties, String) && !value) {
334
+ return nameOrProperties.startsWith(`data`)
335
+ ? instance[0]?.dataset[nameOrProperties.slice(nameOrProperties.indexOf(`-`)+1)]
336
+ : instance[0]?.[nameOrProperties];
337
+ }
338
+
339
+ const props = !IS(nameOrProperties, Object) ? { [nameOrProperties]: value } : nameOrProperties;
340
+ for (let [propName, propValue] of Object.entries(props)) {
341
+ propName = propName.trim();
342
+
343
+ if (propValue && !checkProp(propName) || !propValue) {
344
+ return false;
345
+ }
346
+
347
+ const isId = propName.toLowerCase() === `id`;
348
+
349
+ if (isId) { return instance[0].id = propValue; }
350
+
351
+ loop(instance, el => {
352
+ if (propName.startsWith(`data`)) {
353
+ return el.dataset[propName.slice(propName.indexOf(`-`)+1)] = propValue;
354
+ }
355
+
356
+ el[propName] = propValue;
357
+ });
358
+ }
359
+
360
+ return instance;
361
+ },
362
+ remove: (selector) => {
363
+ systemLog.log(`remove ${truncateHtmlStr(instance.HTML.get(1), 40)}${selector ? ` /w selector ${selector}` : ``}`);
364
+ const remover = el => el.remove();
365
+ const removeFromCollection = () =>
366
+ instance.collection = instance.collection.filter(el => document.documentElement.contains(el));
367
+
368
+ if (selector) {
369
+ const selectedElements = instance.find$(selector);
370
+ if (!selectedElements.is.empty) {
371
+ loop(selectedElements, remover);
372
+ removeFromCollection();
373
+ }
374
+ return instance;
375
+ }
376
+ loop(instance, remover);
377
+ removeFromCollection();
378
+ return instance;
379
+ },
380
+ rmAttr: (...attrNames) => {
381
+ for (const attr of attrNames) { instance.node.removeAttribute(attr); }
382
+ return instance;
383
+ },
384
+ removeClass: (...classNames) =>
385
+ loop(instance, el => { if (el) { for (const cn of classNames) { el.classList.remove(cn); } } }),
386
+ renderTo: (root = document.body, at = jqx.at.end) => {
387
+ instance.first$().toDOM(root, at);
388
+ return instance;
389
+ },
390
+ replace: (oldChild, newChild) => {
391
+ const firstElem = instance[0];
392
+
393
+ if (!oldChild || (!newChild || !IS(newChild, HTMLElement) && !newChild.isJQx)) {
394
+ console.error(`JQx replace: invalid replacement value`);
395
+ return instance;
396
+ }
397
+
398
+ if (newChild.isJQx) {
399
+ newChild = newChild[0];
400
+ }
401
+
402
+ if (IS(newChild, NodeList)) {
403
+ newChild = newChild[0];
404
+ }
405
+
406
+ if (firstElem && oldChild) {
407
+ oldChild = IS(oldChild, String)
408
+ ? firstElem.querySelectorAll(oldChild)
409
+ : oldChild.isJQx
410
+ ? oldChild.collection
411
+ : oldChild;
412
+
413
+ if (IS(oldChild, HTMLElement, NodeList, Array) && IS(newChild, HTMLElement)) {
414
+ (IS(oldChild, HTMLElement) ? [oldChild] : [...oldChild])
415
+ .forEach(chld => chld.replaceWith(newChild.cloneNode(true)));
416
+ }
417
+ }
418
+
419
+ return instance;
420
+ },
421
+ replaceClass: (className, ...nwClassNames) => loop( instance, el => {
422
+ el.classList.remove(className);
423
+ for (const name of nwClassNames) { el.classList.add(name); }
424
+ } ),
425
+ replaceMe: (newChild) => /*NODOC*/ instance.replaceWith(newChild),
426
+ replaceWith: (newChild) => {
427
+ newChild = IS(newChild, Element) ? newChild : newChild.isJQx ? newChild[0] : undefined;
428
+
429
+ if (newChild) {
430
+ instance[0].replaceWith(newChild);
431
+ instance = jqx.virtual(newChild);
432
+ }
433
+
434
+ return instance;
435
+ },
436
+ setData: (keyValuePairs) => loop(instance, el => setData(el, keyValuePairs)),
437
+ show: instance => loop(instance, el => applyStyle(el, {display: `revert-layer !important`})),
438
+ single: (indexOrSelector) => {
439
+ if (instance.collection.length > 0) {
440
+ if (IS(indexOrSelector, String)) {
441
+ return instance.find$(indexOrSelector);
442
+ }
443
+
444
+ if (IS(indexOrSelector, Number)) {
445
+ return jqx(instance.collection[indexOrSelector]);
446
+ }
447
+
448
+ return jqx(instance.collection[0]);
449
+ }
450
+
451
+ return instance;
452
+ },
453
+ style: (keyOrKvPairs, value) => {
454
+ const loopCollectionLambda = el => {
455
+ if (value && IS(keyOrKvPairs, String)) {
456
+ keyOrKvPairs = { [keyOrKvPairs]: value || `none` };
457
+ }
458
+
459
+ applyStyle(el, keyOrKvPairs);
460
+ };
461
+ return loop(instance, loopCollectionLambda);
462
+ },
463
+ text: (textValue, append = false) => {
464
+ if (instance.isEmpty()) { return instance; }
465
+ if (!IS(textValue, String)) { return instance.first().textContent; }
466
+ const loopCollectionLambda = el => el.textContent = append ? el.textContent + textValue : textValue;
467
+ return loop(instance, loopCollectionLambda);
468
+ },
469
+ toDOM: (root = document.body, position = insertPositions.BeforeEnd) => {
470
+ if (instance.isVirtual) { instance.isVirtual = false; }
471
+ instance.collection = inject2DOMTree(instance.collection, root, position);
472
+
473
+ return instance;
474
+ },
475
+ toggleClass: (className) => loop(instance, el => el.classList.toggle(className)),
476
+ toNodeList: instance => [...instance.collection].map(el => document.importNode(el, true)),
477
+ trigger: (evtType, SpecifiedEvent = Event, options = {}) => {
478
+ if (instance.collection.length) {
479
+ const evObj = new SpecifiedEvent( evtType, { ...options, bubbles: options.bubbles??true} );
480
+ for( let elem of instance.collection ) { elem.dispatchEvent(evObj); }
481
+ }
482
+ return instance;
483
+ },
484
+ val: (newValue) => {
485
+ const firstElem = instance[0];
486
+
487
+ if (!firstElem || !IS(firstElem, HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement)) {
488
+ return instance;
489
+ }
490
+
491
+ if (newValue === undefined) {
492
+ return firstElem.value;
493
+ }
494
+
495
+ firstElem.value = !IS(newValue, String) ? "" : newValue;
496
+
497
+ return instance;
498
+ },
499
+ };
500
+ }