@livenetworks/ashlar 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autoresize/src/ln-autoresize.js +3 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/lifecycle.js +24 -12
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-date/src/ln-date.js +22 -13
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
- package/components/ln-dropdown/src/ln-dropdown.js +18 -5
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +1 -1
- package/components/ln-filter/src/ln-filter.js +11 -10
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-form/src/ln-form.js +11 -0
- package/components/ln-icon/ln-icon.js +1 -1
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-list/src/ln-list.js +14 -5
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-number/src/ln-number.js +22 -12
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-popover/ln-popover.schema.json +82 -82
- package/components/ln-popover/src/ln-popover.js +22 -5
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-search/ln-search.schema.json +103 -103
- package/components/ln-search/src/ln-search.js +9 -5
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-sortable/src/ln-sortable.js +52 -7
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-tabs/src/ln-tabs.js +12 -8
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-time/src/ln-time.js +17 -7
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-validate/src/ln-validate.js +21 -7
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function q(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function A(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let l=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){l=t[o];break}if(!A(l))return}e.apply(console,t)}}function C(e,t,i){const l=i||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:l}))}function X(e,t,i){const l=i||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l);const o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:l});return e.dispatchEvent(o),o}function y(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){y(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Z(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ee(e,t){const i=!!(t&&t.typed),l=t&&t.exclude,o={},a=e.elements,r={};if(i)for(let s=0;s<a.length;s++){const n=a[s];n.name&&n.type==="checkbox"&&!n.disabled&&(r[n.name]=(r[n.name]||0)+1)}for(let s=0;s<a.length;s++){const n=a[s];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(l&&n.matches&&n.matches(l)))if(n.type==="checkbox")i&&r[n.name]===1?o[n.name]=n.checked:(o[n.name]||(o[n.name]=[]),n.checked&&o[n.name].push(n.value));else if(n.type==="radio")n.checked&&(o[n.name]=n.value);else if(n.type==="select-multiple"){o[n.name]=[];for(let c=0;c<n.options.length;c++)n.options[c].selected&&o[n.name].push(n.options[c].value)}else if(i&&n.type==="hidden")o[n.name]=n.value;else if(i&&(n.type==="number"||n.type==="range")){const c=Number(n.value);o[n.name]=n.value===""||isNaN(c)?null:c}else o[n.name]=n.value}return o}function te(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ne(e,t){const i=e.elements,l=[],o={};for(let a=0;a<i.length;a++){const r=i[a];r.name&&r.type==="checkbox"&&(o[r.name]=(o[r.name]||0)+1)}for(let a=0;a<i.length;a++){const r=i[a];if(r.type==="file"||r.type==="submit"||r.type==="button")continue;const s=r.getAttribute("data-ln-fill-as")||r.name;if(!s||!(s in t))continue;const n=t[s];if(r.type==="checkbox"){if(Array.isArray(n))r.checked=n.indexOf(r.value)!==-1;else if(o[r.name]>1){const c=String(n).split(",").map(function(d){return d.trim()});r.checked=c.indexOf(r.value)!==-1}else r.checked=te(n);l.push(r)}else if(r.type==="radio")r.checked=r.value===String(n),l.push(r);else if(r.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<r.options.length;c++)r.options[c].selected=n.indexOf(r.options[c].value)!==-1;l.push(r)}else r.value=n,r.tagName==="SELECT"&&n!=null&&r.setAttribute("data-ln-value",n),l.push(r)}return l}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ne,window.lnCore.serializeForm=ee,window.lnCore.resolveFormMethod=Z);const F={};function re(e,t){F[e]=t}function oe(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=re,window.lnCore.getDataMapper=oe);function ie(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,y(function(){new MutationObserver(function(){C(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function le(e,t){if(!e||typeof t!="object")return;const i=e.toLowerCase().split("-")[0];$[i]=t}function se(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=le,window.lnCore.getLocaleFallback=se,window.lnCore.ensureLocaleObserver=ie);const v={};function ae(e,t){v[e]||(v[e]=document.querySelector('[data-ln-template="'+e+'"]'));const i=v[e];return i?i.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function M(e,t){if(!e||!t)return e;const i=e.querySelectorAll("[data-ln-field]");for(let r=0;r<i.length;r++){const s=i[r],n=s.getAttribute("data-ln-field");t[n]!=null&&(s.textContent=t[n])}const l=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<l.length;r++){const s=l[r],n=s.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();t[f]!=null&&s.setAttribute(u,t[f])}}const o=e.querySelectorAll("[data-ln-show]");for(let r=0;r<o.length;r++){const s=o[r],n=s.getAttribute("data-ln-show");n in t&&s.classList.toggle("hidden",!t[n])}const a=e.querySelectorAll("[data-ln-class]");for(let r=0;r<a.length;r++){const s=a[r],n=s.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();f in t&&s.classList.toggle(u,!!t[f])}}return e}function ce(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const i=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let l=0;l<i.length;l++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",i[l],t??null),i[l].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)M(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let i=0;i<t.length;i++)t[i].textContent=""}})));function B(e,t){if(!e||!t)return e;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;i.nextNode();){const a=i.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,s){return t[s]!==void 0?t[s]:""}))}const l=function(a,r){return t[r]!==void 0?t[r]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let a=0;a<o.length;a++){const r=o[a],s=r.attributes;for(let n=0;n<s.length;n++){const c=s[n];c.value.indexOf("{{")!==-1&&r.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,l))}}return e}function de(e,t,i,l,o,a){const r={};for(let n=0;n<e.children.length;n++){const c=e.children[n],d=c.getAttribute("data-ln-render-key");d&&(r[d]=c)}const s=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],d=String(l(c));let u=r[d];if(u)o(u,c,n);else{const f=ae(i,a);if(!f||(B(f,c),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),o(u,c,n)}s.appendChild(u)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=M,window.lnCore.lnFill=ce,window.lnCore.renderList=de);function x(e,t,i){const l=e.getAttribute(t);return l===null?i:l}function N(e,t,i){const l=parseInt(e.getAttribute(t),10);return isNaN(l)?i:l}function R(e,t,i=!1){const l=e.getAttribute(t);if(l===null)return!!i;const o=l.trim().toLowerCase();return!(o==="false"||o==="0")}function j(e,t){return(e.getAttribute(t)||"").split(",").map(i=>i.trim()).filter(Boolean)}const _=new Map;function W(e,t){const i=(e?e.join("|"):"")+"::"+t;if(_.has(i))return _.get(i);const l=new Set(e||[]),o=function(a,r){const s=a.getAttribute(r);return s!==null&&l.has(s)?s:t};return _.set(i,o),o}function P(e,t,i){const l=parseFloat(e.getAttribute(t));return isNaN(l)?i:l}function U(e,t,i){const l=e.getAttribute(t);if(!l)return i;try{return JSON.parse(l)}catch{return i}}function V(e,t,i,l,o){if(!e||t===null)return!0;const a=l||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const s=n=>{o?console.warn(n,o):console.warn(n)};if(r==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(s(`[${a}] Invalid value "${t}" for boolean attribute "${i}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const n=e.values||[];return n.includes(t)?!0:(s(`[${a}] Invalid value "${t}" for attribute "${i}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return s(`[${a}] Invalid integer "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(s(`[${a}] Value ${n} for attribute "${i}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(s(`[${a}] Value ${n} for attribute "${i}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(s(`[${a}] Invalid float "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(n){return s(`[${a}] Invalid JSON for attribute "${i}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function ue(e,t,i){for(const l in i){const[o,a,r]=i[l];Object.defineProperty(e,l,{get:function(){return o(t,a,r)},enumerable:!0,configurable:!0})}return e}function fe(e){const t={};for(const i in e){const l=e[i];if(!l||!l.prop)continue;let o=l.read;if(!o&&l.type)switch(l.type){case"enum":o=W(l.values,l.fallback);break;case"integer":o=N;break;case"float":o=P;break;case"boolean":o=R;break;case"list":o=j;break;case"json":o=U;break;case"string":default:o=x;break}o||(o=x),t[l.prop]=[o,i,l.fallback]}return t}function we(e){const t={};for(const i in e){const l=e[i];l&&l.effect&&(t[i]=l.effect)}return Object.keys(t).length?t:null}function be(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const i in e.effects)t.add(i);if(e.onAttrChange&&e.declared)for(const i of e.declared)t.add(i);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ue,window.lnCore.attrSpec=fe,window.lnCore.attrStr=x,window.lnCore.attrInt=N,window.lnCore.attrBool=R,window.lnCore.attrList=j,window.lnCore.attrEnum=W,window.lnCore.attrFloat=P,window.lnCore.attrJson=U);function g(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(i){console.error("["+t.attribute+"] init failed",e,i)}}}function H(e,t,i,l){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r={selector:t,attribute:i,ComponentFn:l};if(e.matches&&e.matches(a)&&g(e,r),e.querySelectorAll){const s=e.querySelectorAll(a);for(let n=0;n<s.length;n++)g(s[n],r)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function he(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function pe(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function Q(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ge(e){const t=Q(),i=e.observed||[];for(let l=0;l<i.length;l++){const o=i[l];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const l in e.attributes){t.byDeclaredAttr.has(l)||t.byDeclaredAttr.set(l,[]);const o=t.byDeclaredAttr.get(l);o.some(a=>a.componentTag===e.componentTag)||o.push({spec:e.attributes[l],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const l=be(e);if(l===null)t.reactiveWildcard.push(e);else for(const o of l)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function J(e,t,i,l){for(let o=0;o<e.length;o++){const a=e[o];if(!t[a.attribute])continue;const r=a.effects&&a.effects[i];r?r(t,i,l):a.onAttrChange&&(!a.declared||a.declared.has(i))&&a.onAttrChange(t,i,l)}}function me(e){const t=e.attributeName,i=t.indexOf("data-ln-")===0,l=Q(),o=l.byAttr.get(t),a=q()&&l.byDeclaredAttr&&l.byDeclaredAttr.has(t);if(!i&&!o&&!a)return;const r=e.target;if(e.oldValue!==r.getAttribute(t)){if(a&&A(r)){const s=l.byDeclaredAttr.get(t),n=r.getAttribute(t);for(let c=0;c<s.length;c++)V(s[c].spec,n,t,s[c].componentTag,r)}if(window.lnCore._debugSink&&(i||o)&&window.lnCore._debugSink("attr",t,r,{oldValue:e.oldValue,newValue:r.getAttribute(t)}),i){const s=l.byReactive.get(t);s&&J(s,r,t,e.oldValue),l.reactiveWildcard.length&&J(l.reactiveWildcard,r,t,e.oldValue)}if(o)for(let s=0;s<o.length;s++){const n=o[s];if(n.handler){n.handler(r,t,e.oldValue);continue}n.onAttributeChange&&r[n.attribute]?n.onAttributeChange(r,t):(H(r,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(r))}}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,y(function(){new MutationObserver(function(t){for(let i=0;i<t.length;i++)try{me(t[i])}catch(l){console.error("[ln-core] mutation handler failed",t[i].target,l)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function k(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function E(e,t){if(!document.contains(e))if(t.attribute){const i=e[t.attribute];if(i&&typeof i.destroy=="function")try{i.destroy()}catch(l){console.error("["+t.attribute+"] destroy failed",e,l)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ye(e){const t=k();if(!t.length)return;const i=e.target;if(i){const l=i.nodeType===1?i:i.parentElement;if(l&&(l.isContentEditable||l.closest&&l.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let l=0;l<t.length;l++){const o=t[l];if(o.onSubtreeChange&&o.query){const a=o.query,r=e.target.nodeType===1?e.target.matches&&e.target.matches(a)?e.target:e.target.closest?e.target.closest(a):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(a):null;r&&o.onSubtreeChange(r,e)}}for(let l=0;l<e.addedNodes.length;l++){const o=e.addedNodes[l];if(o.nodeType===1){const a=!!(o.firstElementChild||o.children&&o.children.length);for(let r=0;r<t.length;r++){const s=t[r];if(s.selector&&s.attribute&&s.ComponentFn){if(!a)o.matches&&o.matches(s.query)&&g(o,s);else if(o.matches&&o.matches(s.query)&&g(o,s),o.querySelectorAll){const n=o.querySelectorAll(s.query);for(let c=0;c<n.length;c++)g(n[c],s)}}s.onInit&&s.onInit(o)}}}for(let l=0;l<e.removedNodes.length;l++){const o=e.removedNodes[l];if(o.nodeType===1){const a=!!(o.firstElementChild||o.children&&o.children.length);for(let r=0;r<t.length;r++){const s=t[r],n=s.query;if(n){if(!a)o.matches&&o.matches(n)&&E(o,s);else if(o.matches&&o.matches(n)&&E(o,s),o.querySelectorAll){const c=o.querySelectorAll(n);for(let d=0;d<c.length;d++)E(c[d],s)}}}}}}function K(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,y(function(){new MutationObserver(function(t){for(let i=0;i<t.length;i++){const l=t[i];if(l.type==="childList")try{ye(l)}catch(o){console.error("[ln-core] lifecycle handler failed",l.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ae(e){k().push(e),K()}function Y(e,t,i,l,o={}){const a=o.extraAttributes||[],r=o.onAttributeChange||null,s=o.onSubtreeChange||null,n=o.onInit||null,c=o.onAttrChange||null,d=o.effects||null,u=o.attributes||null,f=u?we(u):d,h=u?new Set(Object.keys(u)):null,p=o.persist||null;function b(O){const w=O||document.body;if(H(w,e,t,i),u&&q())for(const m in u){const qe=u[m],D=Array.from(w.querySelectorAll("["+m+"]"));w.matches&&w.matches("["+m+"]")&&D.push(w);for(let I=0;I<D.length;I++){const T=D[I];A(T)&&V(qe,T.getAttribute(m),m,l,T)}}n&&n(w)}const L=[];if(e.indexOf("[")!==-1){const O=/\[([\w-]+)/g;let w;for(;(w=O.exec(e))!==null;)L.push(w[1])}else L.push(e);ge({selector:e,attribute:t,componentTag:l,attributes:u,ComponentFn:i,onInit:n,observed:L.concat(a),onAttributeChange:r,onAttrChange:c,effects:f,declared:h,persist:p}),Ce();const Ie=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Te=o.subtreeQuery||(Ie?e:"["+e+"]");k().push({selector:e,attribute:t,ComponentFn:i,onInit:n,onSubtreeChange:s,query:Te}),K(),window[t]=b,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Y,window.lnCore.observeLifecycle=Ae);function G(){he()>0?pe(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",G):G(),b}function z(e){return(e||"").replace(/^#/,"")}function S(e){const t=e===void 0?location.hash:e,i={},l=z(t);if(!l)return i;const o=l.split("&");for(let a=0;a<o.length;a++){const r=o[a];if(!r)continue;const s=r.indexOf(":"),n=s>-1?r.slice(0,s):r,c=s>-1?r.slice(s+1):"";if(n)try{i[n]=decodeURIComponent(c)}catch{i[n]=c}}return i}function ve(e){if(!e)return null;const t=S();return e in t?t[e]:null}function xe(e,t){if(!e)return;const i=S();t==null?delete i[e]:i[e]=String(t);const o=Object.keys(i).map(function(a){const r=i[a];return r===""?a:a+":"+encodeURIComponent(r)}).join("&");z(location.hash)!==o&&(location.hash=o)}function _e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ke(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const i=e.getAttribute("data-ln-hash");if(i&&i.trim()!=="")return i.trim();const l=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return l?t?l+"-"+t:l:t||null}function Ee(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Se(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Le(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Oe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const i=e.slice(0,t),l=e.slice(t+1),o=l?l.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:i,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=S,window.lnCore.hashGet=ve,window.lnCore.hashSet=xe,window.lnCore.hashLinkClick=_e,window.lnCore.resolveHashNamespace=ke,window.lnCore.hashSortEncode=Ee,window.lnCore.hashSortDecode=Se,window.lnCore.hashFilterEncode=Le,window.lnCore.hashFilterDecode=Oe);function De(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=De),(function(){const e="data-ln-sortable",t="lnSortable",i="data-ln-sortable-handle";if(window[t]!==void 0)return;const l={"data-ln-sortable":{effect:a,type:"enum",values:["enabled","disabled"],fallback:"enabled",description:"Enables drag-and-drop item reordering or disables when set to disabled"},"data-ln-sortable-handle":{type:"marker",description:"Designates an element as the drag handle for its parent sortable item"}};function o(r){this.dom=r,this.isEnabled=r.getAttribute(e)!=="disabled",this._dragging=null,r.setAttribute("aria-roledescription","sortable list");const s=this;return this._onPointerDown=function(n){s.isEnabled&&s._handlePointerDown(n)},r.addEventListener("pointerdown",this._onPointerDown),this}o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("pointerdown",this._onPointerDown),delete this.dom[t])},o.prototype._handlePointerDown=function(r){let s=r.target.closest("["+i+"]"),n;if(s){for(n=s;n&&n.parentElement!==this.dom;)n=n.parentElement;if(!n||n.parentElement!==this.dom)return}else{if(this.dom.querySelector("["+i+"]"))return;for(n=r.target;n&&n.parentElement!==this.dom;)n=n.parentElement;if(!n||n.parentElement!==this.dom)return;s=n}const d=Array.from(this.dom.children).indexOf(n);if(X(this.dom,"ln-sortable:before-drag",{item:n,index:d}).defaultPrevented)return;r.preventDefault(),s.setPointerCapture(r.pointerId),this._dragging=n,n.classList.add("ln-sortable--dragging"),n.setAttribute("aria-grabbed","true"),this.dom.classList.add("ln-sortable--active"),C(this.dom,"ln-sortable:drag-start",{item:n,index:d});const f=this,h=function(b){f._handlePointerMove(b)},p=function(b){f._handlePointerEnd(b),s.removeEventListener("pointermove",h),s.removeEventListener("pointerup",p),s.removeEventListener("pointercancel",p)};s.addEventListener("pointermove",h),s.addEventListener("pointerup",p),s.addEventListener("pointercancel",p)},o.prototype._handlePointerMove=function(r){if(!this._dragging)return;const s=Array.from(this.dom.children),n=this._dragging;for(const c of s)c.classList.remove("ln-sortable--drop-before","ln-sortable--drop-after");for(const c of s){if(c===n)continue;const d=c.getBoundingClientRect(),u=d.top+d.height/2;if(r.clientY>=d.top&&r.clientY<u){c.classList.add("ln-sortable--drop-before");break}else if(r.clientY>=u&&r.clientY<=d.bottom){c.classList.add("ln-sortable--drop-after");break}}},o.prototype._handlePointerEnd=function(r){if(!this._dragging)return;const s=this._dragging,n=Array.from(this.dom.children),c=n.indexOf(s);let d=null,u=null;for(const f of n){if(f.classList.contains("ln-sortable--drop-before")){d=f,u="before";break}if(f.classList.contains("ln-sortable--drop-after")){d=f,u="after";break}}for(const f of n)f.classList.remove("ln-sortable--drop-before","ln-sortable--drop-after");if(s.classList.remove("ln-sortable--dragging"),s.removeAttribute("aria-grabbed"),this.dom.classList.remove("ln-sortable--active"),d&&d!==s){u==="before"?this.dom.insertBefore(s,d):this.dom.insertBefore(s,d.nextElementSibling);const h=Array.from(this.dom.children).indexOf(s);C(this.dom,"ln-sortable:reordered",{item:s,oldIndex:c,newIndex:h})}this._dragging=null};function a(r){const s=r[t];if(!s)return;const n=r.getAttribute(e)!=="disabled";n!==s.isEnabled&&(s.isEnabled=n,C(r,n?"ln-sortable:enabled":"ln-sortable:disabled",{target:r}))}Y(e,t,o,"ln-sortable",{attributes:l})})()})();
|
|
1
|
+
(function(){"use strict";function $(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function _(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let l=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){l=t[i];break}if(!_(l))return}e.apply(console,t)}}function v(e,t,o){const l=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:l}))}function ne(e,t,o){const l=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l);const i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:l});return e.dispatchEvent(i),i}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function re(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function oe(e,t){const o=!!(t&&t.typed),l=t&&t.exclude,i={},a=e.elements,r={};if(o)for(let s=0;s<a.length;s++){const n=a[s];n.name&&n.type==="checkbox"&&!n.disabled&&(r[n.name]=(r[n.name]||0)+1)}for(let s=0;s<a.length;s++){const n=a[s];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(l&&n.matches&&n.matches(l)))if(n.type==="checkbox")o&&r[n.name]===1?i[n.name]=n.checked:(i[n.name]||(i[n.name]=[]),n.checked&&i[n.name].push(n.value));else if(n.type==="radio")n.checked&&(i[n.name]=n.value);else if(n.type==="select-multiple"){i[n.name]=[];for(let c=0;c<n.options.length;c++)n.options[c].selected&&i[n.name].push(n.options[c].value)}else if(o&&n.type==="hidden")i[n.name]=n.value;else if(o&&(n.type==="number"||n.type==="range")){const c=Number(n.value);i[n.name]=n.value===""||isNaN(c)?null:c}else i[n.name]=n.value}return i}function ie(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function le(e,t){const o=e.elements,l=[],i={};for(let a=0;a<o.length;a++){const r=o[a];r.name&&r.type==="checkbox"&&(i[r.name]=(i[r.name]||0)+1)}for(let a=0;a<o.length;a++){const r=o[a];if(r.type==="file"||r.type==="submit"||r.type==="button")continue;const s=r.getAttribute("data-ln-fill-as")||r.name;if(!s||!(s in t))continue;const n=t[s];if(r.type==="checkbox"){if(Array.isArray(n))r.checked=n.indexOf(r.value)!==-1;else if(i[r.name]>1){const c=String(n).split(",").map(function(d){return d.trim()});r.checked=c.indexOf(r.value)!==-1}else r.checked=ie(n);l.push(r)}else if(r.type==="radio")r.checked=r.value===String(n),l.push(r);else if(r.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<r.options.length;c++)r.options[c].selected=n.indexOf(r.options[c].value)!==-1;l.push(r)}else r.value=n,r.tagName==="SELECT"&&n!=null&&r.setAttribute("data-ln-value",n),l.push(r)}return l}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=le,window.lnCore.serializeForm=oe,window.lnCore.resolveFormMethod=re);const M={};function se(e,t){M[e]=t}function ae(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=se,window.lnCore.getDataMapper=ae);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){v(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const R={};function de(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];R[o]=t}function ue(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return R[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=de,window.lnCore.getLocaleFallback=ue,window.lnCore.ensureLocaleObserver=ce);const x={};function fe(e,t){x[e]||(x[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=x[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function B(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let r=0;r<o.length;r++){const s=o[r],n=s.getAttribute("data-ln-field");t[n]!=null&&(s.textContent=t[n])}const l=e.querySelectorAll("[data-ln-attr]");for(let r=0;r<l.length;r++){const s=l[r],n=s.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();t[f]!=null&&s.setAttribute(u,t[f])}}const i=e.querySelectorAll("[data-ln-show]");for(let r=0;r<i.length;r++){const s=i[r],n=s.getAttribute("data-ln-show");n in t&&s.classList.toggle("hidden",!t[n])}const a=e.querySelectorAll("[data-ln-class]");for(let r=0;r<a.length;r++){const s=a[r],n=s.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();f in t&&s.classList.toggle(u,!!t[f])}}return e}function we(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let l=0;l<o.length;l++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[l],t??null),o[l].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)B(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function N(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const a=o.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(r,s){return t[s]!==void 0?t[s]:""}))}const l=function(a,r){return t[r]!==void 0?t[r]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let a=0;a<i.length;a++){const r=i[a],s=r.attributes;for(let n=0;n<s.length;n++){const c=s[n];c.value.indexOf("{{")!==-1&&r.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,l))}}return e}function be(e,t,o,l,i,a){const r={};for(let n=0;n<e.children.length;n++){const c=e.children[n],d=c.getAttribute("data-ln-render-key");d&&(r[d]=c)}const s=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],d=String(l(c));let u=r[d];if(u)i(u,c,n);else{const f=fe(o,a);if(!f||(N(f,c),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),i(u,c,n)}s.appendChild(u)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=N,window.lnCore.fill=B,window.lnCore.lnFill=we,window.lnCore.renderList=be);function k(e,t,o){const l=e.getAttribute(t);return l===null?o:l}function j(e,t,o){const l=parseInt(e.getAttribute(t),10);return isNaN(l)?o:l}function P(e,t,o=!1){const l=e.getAttribute(t);if(l===null)return!!o;const i=l.trim().toLowerCase();return!(i==="false"||i==="0")}function W(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const E=new Map;function U(e,t){const o=(e?e.join("|"):"")+"::"+t;if(E.has(o))return E.get(o);const l=new Set(e||[]),i=function(a,r){const s=a.getAttribute(r);return s!==null&&l.has(s)?s:t};return E.set(o,i),i}function V(e,t,o){const l=parseFloat(e.getAttribute(t));return isNaN(l)?o:l}function H(e,t,o){const l=e.getAttribute(t);if(!l)return o;try{return JSON.parse(l)}catch{return o}}function Q(e,t,o,l,i){if(!e||t===null)return!0;const a=l||"ln-component",r=e.type;if(r==="trigger"||r==="marker"||r==="string"||r==="list"||!r||t===""&&e.fallback!==void 0)return!0;const s=n=>{i?console.warn(n,i):console.warn(n)};if(r==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(s(`[${a}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(r==="enum"){const n=e.values||[];return n.includes(t)?!0:(s(`[${a}] Invalid value "${t}" for attribute "${o}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(r==="integer"){if(!/^-?\d+$/.test(t))return s(`[${a}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(s(`[${a}] Value ${n} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(s(`[${a}] Value ${n} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(r==="float")return isNaN(Number(t))?(s(`[${a}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(r==="json")try{return JSON.parse(t),!0}catch(n){return s(`[${a}] Invalid JSON for attribute "${o}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function he(e,t,o){for(const l in o){const[i,a,r]=o[l];Object.defineProperty(e,l,{get:function(){return i(t,a,r)},enumerable:!0,configurable:!0})}return e}function pe(e){const t={};for(const o in e){const l=e[o];if(!l||!l.prop)continue;let i=l.read;if(!i&&l.type)switch(l.type){case"enum":i=U(l.values,l.fallback);break;case"integer":i=j;break;case"float":i=V;break;case"boolean":i=P;break;case"list":i=W;break;case"json":i=H;break;case"string":default:i=k;break}i||(i=k),t[l.prop]=[i,o,l.fallback]}return t}function ge(e){const t={};for(const o in e){const l=e[o];l&&l.effect&&(t[o]=l.effect)}return Object.keys(t).length?t:null}function me(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=he,window.lnCore.attrSpec=pe,window.lnCore.attrStr=k,window.lnCore.attrInt=j,window.lnCore.attrBool=P,window.lnCore.attrList=W,window.lnCore.attrEnum=U,window.lnCore.attrFloat=V,window.lnCore.attrJson=H);function m(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function J(e,t,o,l){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",r={selector:t,attribute:o,ComponentFn:l};if(e.matches&&e.matches(a)&&m(e,r),e.querySelectorAll){const s=e.querySelectorAll(a);for(let n=0;n<s.length;n++)m(s[n],r)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ye(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function K(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ve(e){const t=K(),o=e.observed||[];for(let l=0;l<o.length;l++){const i=o[l];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const l in e.attributes){t.byDeclaredAttr.has(l)||t.byDeclaredAttr.set(l,[]);const i=t.byDeclaredAttr.get(l);i.some(a=>a.componentTag===e.componentTag)||i.push({spec:e.attributes[l],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const l=me(e);if(l===null)t.reactiveWildcard.push(e);else for(const i of l)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function Y(e,t,o,l){for(let i=0;i<e.length;i++){const a=e[i];if(!t[a.attribute])continue;const r=a.effects&&a.effects[o];r?r(t,o,l):a.onAttrChange&&(!a.declared||a.declared.has(o))&&a.onAttrChange(t,o,l)}}function Ae(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,l=K(),i=l.byAttr.get(t),a=$()&&l.byDeclaredAttr&&l.byDeclaredAttr.has(t);if(!o&&!i&&!a)return;const r=e.target;if(e.oldValue!==r.getAttribute(t)){if(a&&_(r)){const s=l.byDeclaredAttr.get(t),n=r.getAttribute(t);for(let c=0;c<s.length;c++)Q(s[c].spec,n,t,s[c].componentTag,r)}if(window.lnCore._debugSink&&(o||i)&&window.lnCore._debugSink("attr",t,r,{oldValue:e.oldValue,newValue:r.getAttribute(t)}),o){const s=l.byReactive.get(t);s&&Y(s,r,t,e.oldValue),l.reactiveWildcard.length&&Y(l.reactiveWildcard,r,t,e.oldValue)}if(i)for(let s=0;s<i.length;s++){const n=i[s];if(n.handler){n.handler(r,t,e.oldValue);continue}n.onAttributeChange&&r[n.attribute]?n.onAttributeChange(r,t):(J(r,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(r))}}}function _e(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{Ae(t[o])}catch(l){console.error("[ln-core] mutation handler failed",t[o].target,l)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function S(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function L(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function D(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(l){console.error("["+t.attribute+"] destroy failed",e,l)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function xe(e){const t=S();if(!t.length)return;const o=e.target;if(o){const i=o.nodeType===1?o:o.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}const l=L();if(e.target&&l.length)for(let i=0;i<l.length;i++){const a=l[i],r=a.query,s=e.target.nodeType===1?e.target.matches&&e.target.matches(r)?e.target:e.target.closest?e.target.closest(r):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(r):null;s&&a.onSubtreeChange(s,e)}for(let i=0;i<e.addedNodes.length;i++){const a=e.addedNodes[i];if(a.nodeType===1){const r=!!(a.firstElementChild||a.children&&a.children.length);for(let s=0;s<t.length;s++){const n=t[s];if(n.selector&&n.attribute&&n.ComponentFn){if(!r)a.matches&&a.matches(n.query)&&m(a,n);else if(a.matches&&a.matches(n.query)&&m(a,n),a.querySelectorAll){const c=a.querySelectorAll(n.query);for(let d=0;d<c.length;d++)m(c[d],n)}}n.onInit&&n.onInit(a)}}}for(let i=0;i<e.removedNodes.length;i++){const a=e.removedNodes[i];if(a.nodeType===1){const r=!!(a.firstElementChild||a.children&&a.children.length);for(let s=0;s<t.length;s++){const n=t[s],c=n.query;if(c){if(!r)a.matches&&a.matches(c)&&D(a,n);else if(a.matches&&a.matches(c)&&D(a,n),a.querySelectorAll){const d=a.querySelectorAll(c);for(let u=0;u<d.length;u++)D(d[u],n)}}}}}}function z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const l=t[o];if(l.type==="childList")try{xe(l)}catch(i){console.error("[ln-core] lifecycle handler failed",l.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function ke(e){S().push(e),e.onSubtreeChange&&e.query&&L().push(e),z()}function G(e,t,o,l,i={}){const a=i.extraAttributes||[],r=i.onAttributeChange||null,s=i.onSubtreeChange||null,n=i.onInit||null,c=i.onAttrChange||null,d=i.effects||null,u=i.attributes||null,f=u?ge(u):d,w=u?new Set(Object.keys(u)):null,h=i.persist||null;function g(T){const b=T||document.body;if(J(b,e,t,o),u&&$())for(const y in u){const $e=u[y],I=Array.from(b.querySelectorAll("["+y+"]"));b.matches&&b.matches("["+y+"]")&&I.push(b);for(let q=0;q<I.length;q++){const F=I[q];_(F)&&Q($e,F.getAttribute(y),y,l,F)}}n&&n(b)}const p=[];if(e.indexOf("[")!==-1){const T=/\[([\w-]+)/g;let b;for(;(b=T.exec(e))!==null;)p.push(b[1])}else p.push(e);ve({selector:e,attribute:t,componentTag:l,attributes:u,ComponentFn:o,onInit:n,observed:p.concat(a),onAttributeChange:r,onAttrChange:c,effects:f,declared:w,persist:h}),_e();const C=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Z=i.subtreeQuery||(C?e:"["+e+"]"),ee={selector:e,attribute:t,ComponentFn:o,onInit:n,onSubtreeChange:s,query:Z};S().push(ee),s&&Z&&L().push(ee),z(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=G,window.lnCore.observeLifecycle=ke);function te(){Ce()>0?ye(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",te):te(),g}function X(e){return(e||"").replace(/^#/,"")}function O(e){const t=e===void 0?location.hash:e,o={},l=X(t);if(!l)return o;const i=l.split("&");for(let a=0;a<i.length;a++){const r=i[a];if(!r)continue;const s=r.indexOf(":"),n=s>-1?r.slice(0,s):r,c=s>-1?r.slice(s+1):"";if(n)try{o[n]=decodeURIComponent(c)}catch{o[n]=c}}return o}function Ee(e){if(!e)return null;const t=O();return e in t?t[e]:null}function Se(e,t){if(!e)return;const o=O();t==null?delete o[e]:o[e]=String(t);const i=Object.keys(o).map(function(a){const r=o[a];return r===""?a:a+":"+encodeURIComponent(r)}).join("&");X(location.hash)!==i&&(location.hash=i)}function Le(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function De(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const l=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return l?t?l+"-"+t:l:t||null}function Oe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Te(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ie(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function qe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),l=e.slice(t+1),i=l?l.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:o,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=O,window.lnCore.hashGet=Ee,window.lnCore.hashSet=Se,window.lnCore.hashLinkClick=Le,window.lnCore.resolveHashNamespace=De,window.lnCore.hashSortEncode=Oe,window.lnCore.hashSortDecode=Te,window.lnCore.hashFilterEncode=Ie,window.lnCore.hashFilterDecode=qe);function Fe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Fe),(function(){const e="data-ln-sortable",t="lnSortable",o="data-ln-sortable-handle";if(window[t]!==void 0)return;const l={"data-ln-sortable":{effect:a,type:"enum",values:["enabled","disabled"],fallback:"enabled",description:"Enables drag-and-drop item reordering or disables when set to disabled"},"data-ln-sortable-handle":{type:"marker",description:"Designates an element as the drag handle for its parent sortable item"}};function i(r){this.dom=r,this.isEnabled=r.getAttribute(e)!=="disabled",this._dragging=null,r.setAttribute("aria-roledescription","sortable list");const s=this;return this._onPointerDown=function(n){s.isEnabled&&s._handlePointerDown(n)},r.addEventListener("pointerdown",this._onPointerDown),this}i.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("pointerdown",this._onPointerDown),delete this.dom[t])},i.prototype._handlePointerDown=function(r){let s=r.target.closest("["+o+"]"),n;if(s){for(n=s;n&&n.parentElement!==this.dom;)n=n.parentElement;if(!n||n.parentElement!==this.dom)return}else{if(this.dom.querySelector("["+o+"]"))return;for(n=r.target;n&&n.parentElement!==this.dom;)n=n.parentElement;if(!n||n.parentElement!==this.dom)return;s=n}const d=Array.from(this.dom.children).indexOf(n);if(ne(this.dom,"ln-sortable:before-drag",{item:n,index:d}).defaultPrevented)return;r.preventDefault(),s.setPointerCapture(r.pointerId),this._dragging=n,n.classList.add("ln-sortable--dragging"),n.setAttribute("aria-grabbed","true"),this.dom.classList.add("ln-sortable--active"),v(this.dom,"ln-sortable:drag-start",{item:n,index:d});const f=this;let w=null,h=null;const g=function(C){h=C,!w&&(w=requestAnimationFrame(function(){w=null,h&&f._handlePointerMove(h)}))},p=function(C){w&&(cancelAnimationFrame(w),w=null),f._handlePointerEnd(C),s.removeEventListener("pointermove",g),s.removeEventListener("pointerup",p),s.removeEventListener("pointercancel",p)};s.addEventListener("pointermove",g),s.addEventListener("pointerup",p),s.addEventListener("pointercancel",p)},i.prototype._handlePointerMove=function(r){if(!this._dragging)return;const s=Array.from(this.dom.children),n=this._dragging;let c=null,d=null;for(let u=0;u<s.length;u++){const f=s[u];if(f===n)continue;const w=f.getBoundingClientRect(),h=w.top+w.height/2;if(r.clientY>=w.top&&r.clientY<h){c=f,d="before";break}else if(r.clientY>=h&&r.clientY<=w.bottom){c=f,d="after";break}}if(!(this._lastDropTarget===c&&this._lastDropPos===d)){this._lastDropTarget&&this._lastDropTarget!==c&&this._lastDropTarget.classList.remove("ln-sortable--drop-before","ln-sortable--drop-after"),this._lastDropTarget=c,this._lastDropPos=d;for(let u=0;u<s.length;u++){const f=s[u];f!==c&&(f.classList.contains("ln-sortable--drop-before")&&f.classList.remove("ln-sortable--drop-before"),f.classList.contains("ln-sortable--drop-after")&&f.classList.remove("ln-sortable--drop-after"))}if(c){const u=d==="before"?"ln-sortable--drop-before":"ln-sortable--drop-after",f=d==="before"?"ln-sortable--drop-after":"ln-sortable--drop-before";c.classList.contains(f)&&c.classList.remove(f),c.classList.contains(u)||c.classList.add(u)}}},i.prototype._handlePointerEnd=function(r){if(!this._dragging)return;const s=this._dragging,n=Array.from(this.dom.children),c=n.indexOf(s);let d=null,u=null;for(const f of n){if(f.classList.contains("ln-sortable--drop-before")){d=f,u="before";break}if(f.classList.contains("ln-sortable--drop-after")){d=f,u="after";break}}this._lastDropTarget=null,this._lastDropPos=null;for(const f of n)f.classList.remove("ln-sortable--drop-before","ln-sortable--drop-after");if(s.classList.remove("ln-sortable--dragging"),s.removeAttribute("aria-grabbed"),this.dom.classList.remove("ln-sortable--active"),d&&d!==s){u==="before"?this.dom.insertBefore(s,d):this.dom.insertBefore(s,d.nextElementSibling);const w=Array.from(this.dom.children).indexOf(s);v(this.dom,"ln-sortable:reordered",{item:s,oldIndex:c,newIndex:w})}this._dragging=null};function a(r){const s=r[t];if(!s)return;const n=r.getAttribute(e)!=="disabled";n!==s.isEnabled&&(s.isEnabled=n,v(r,n?"ln-sortable:enabled":"ln-sortable:disabled",{target:r}))}G(e,t,i,"ln-sortable",{attributes:l})})()})();
|
|
@@ -90,8 +90,22 @@ import { registerComponent, dispatch, dispatchCancelable } from '../../ln-core';
|
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
const self = this;
|
|
93
|
-
|
|
93
|
+
let rafMove = null;
|
|
94
|
+
let lastEvent = null;
|
|
95
|
+
|
|
96
|
+
const onMove = function (ev) {
|
|
97
|
+
lastEvent = ev;
|
|
98
|
+
if (rafMove) return;
|
|
99
|
+
rafMove = requestAnimationFrame(function () {
|
|
100
|
+
rafMove = null;
|
|
101
|
+
if (lastEvent) self._handlePointerMove(lastEvent);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
94
104
|
const onEnd = function (ev) {
|
|
105
|
+
if (rafMove) {
|
|
106
|
+
cancelAnimationFrame(rafMove);
|
|
107
|
+
rafMove = null;
|
|
108
|
+
}
|
|
95
109
|
self._handlePointerEnd(ev);
|
|
96
110
|
handle.removeEventListener('pointermove', onMove);
|
|
97
111
|
handle.removeEventListener('pointerup', onEnd);
|
|
@@ -109,24 +123,52 @@ import { registerComponent, dispatch, dispatchCancelable } from '../../ln-core';
|
|
|
109
123
|
const children = Array.from(this.dom.children);
|
|
110
124
|
const dragging = this._dragging;
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
126
|
+
let targetChild = null;
|
|
127
|
+
let targetPos = null;
|
|
115
128
|
|
|
116
|
-
for (
|
|
129
|
+
for (let i = 0; i < children.length; i++) {
|
|
130
|
+
const child = children[i];
|
|
117
131
|
if (child === dragging) continue;
|
|
118
132
|
|
|
119
133
|
const rect = child.getBoundingClientRect();
|
|
120
134
|
const mid = rect.top + rect.height / 2;
|
|
121
135
|
|
|
122
136
|
if (e.clientY >= rect.top && e.clientY < mid) {
|
|
123
|
-
child
|
|
137
|
+
targetChild = child;
|
|
138
|
+
targetPos = 'before';
|
|
124
139
|
break;
|
|
125
140
|
} else if (e.clientY >= mid && e.clientY <= rect.bottom) {
|
|
126
|
-
child
|
|
141
|
+
targetChild = child;
|
|
142
|
+
targetPos = 'after';
|
|
127
143
|
break;
|
|
128
144
|
}
|
|
129
145
|
}
|
|
146
|
+
|
|
147
|
+
if (this._lastDropTarget === targetChild && this._lastDropPos === targetPos) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (this._lastDropTarget && this._lastDropTarget !== targetChild) {
|
|
152
|
+
this._lastDropTarget.classList.remove('ln-sortable--drop-before', 'ln-sortable--drop-after');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
this._lastDropTarget = targetChild;
|
|
156
|
+
this._lastDropPos = targetPos;
|
|
157
|
+
|
|
158
|
+
for (let i = 0; i < children.length; i++) {
|
|
159
|
+
const child = children[i];
|
|
160
|
+
if (child !== targetChild) {
|
|
161
|
+
if (child.classList.contains('ln-sortable--drop-before')) child.classList.remove('ln-sortable--drop-before');
|
|
162
|
+
if (child.classList.contains('ln-sortable--drop-after')) child.classList.remove('ln-sortable--drop-after');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (targetChild) {
|
|
167
|
+
const cls = targetPos === 'before' ? 'ln-sortable--drop-before' : 'ln-sortable--drop-after';
|
|
168
|
+
const otherCls = targetPos === 'before' ? 'ln-sortable--drop-after' : 'ln-sortable--drop-before';
|
|
169
|
+
if (targetChild.classList.contains(otherCls)) targetChild.classList.remove(otherCls);
|
|
170
|
+
if (!targetChild.classList.contains(cls)) targetChild.classList.add(cls);
|
|
171
|
+
}
|
|
130
172
|
};
|
|
131
173
|
|
|
132
174
|
_component.prototype._handlePointerEnd = function (e) {
|
|
@@ -152,6 +194,9 @@ import { registerComponent, dispatch, dispatchCancelable } from '../../ln-core';
|
|
|
152
194
|
}
|
|
153
195
|
}
|
|
154
196
|
|
|
197
|
+
this._lastDropTarget = null;
|
|
198
|
+
this._lastDropPos = null;
|
|
199
|
+
|
|
155
200
|
for (const child of children) {
|
|
156
201
|
child.classList.remove('ln-sortable--drop-before', 'ln-sortable--drop-after');
|
|
157
202
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function D(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function m(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let i=null;for(let n=1;n<t.length;n++)if(t[n]&&t[n].nodeType===1){i=t[n];break}if(!m(i))return}e.apply(console,t)}}function I(e,t,r){const i=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function g(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){g(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Y(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function Z(e,t){const r=!!(t&&t.typed),i=t&&t.exclude,n={},s=e.elements,l={};if(r)for(let c=0;c<s.length;c++){const o=s[c];o.name&&o.type==="checkbox"&&!o.disabled&&(l[o.name]=(l[o.name]||0)+1)}for(let c=0;c<s.length;c++){const o=s[c];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(i&&o.matches&&o.matches(i)))if(o.type==="checkbox")r&&l[o.name]===1?n[o.name]=o.checked:(n[o.name]||(n[o.name]=[]),o.checked&&n[o.name].push(o.value));else if(o.type==="radio")o.checked&&(n[o.name]=o.value);else if(o.type==="select-multiple"){n[o.name]=[];for(let u=0;u<o.options.length;u++)o.options[u].selected&&n[o.name].push(o.options[u].value)}else if(r&&o.type==="hidden")n[o.name]=o.value;else if(r&&(o.type==="number"||o.type==="range")){const u=Number(o.value);n[o.name]=o.value===""||isNaN(u)?null:u}else n[o.name]=o.value}return n}function ee(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function te(e,t){const r=e.elements,i=[],n={};for(let s=0;s<r.length;s++){const l=r[s];l.name&&l.type==="checkbox"&&(n[l.name]=(n[l.name]||0)+1)}for(let s=0;s<r.length;s++){const l=r[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const o=t[c];if(l.type==="checkbox"){if(Array.isArray(o))l.checked=o.indexOf(l.value)!==-1;else if(n[l.name]>1){const u=String(o).split(",").map(function(a){return a.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=ee(o);i.push(l)}else if(l.type==="radio")l.checked=l.value===String(o),i.push(l);else if(l.type==="select-multiple"){if(Array.isArray(o))for(let u=0;u<l.options.length;u++)l.options[u].selected=o.indexOf(l.options[u].value)!==-1;i.push(l)}else l.value=o,l.tagName==="SELECT"&&o!=null&&l.setAttribute("data-ln-value",o),i.push(l)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=te,window.lnCore.serializeForm=Z,window.lnCore.resolveFormMethod=Y);const q={};function ne(e,t){q[e]=t}function re(e){return q[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ne,window.lnCore.getDataMapper=re);function oe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,g(function(){new MutationObserver(function(){I(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const F={};function ie(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];F[r]=t}function le(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return F[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ie,window.lnCore.getLocaleFallback=le,window.lnCore.ensureLocaleObserver=oe);const y={};function se(e,t){y[e]||(y[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=y[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function T(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let l=0;l<r.length;l++){const c=r[l],o=c.getAttribute("data-ln-field");t[o]!=null&&(c.textContent=t[o])}const i=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<i.length;l++){const c=i[l],o=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<o.length;u++){const a=o[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const n=e.querySelectorAll("[data-ln-show]");for(let l=0;l<n.length;l++){const c=n[l],o=c.getAttribute("data-ln-show");o in t&&c.classList.toggle("hidden",!t[o])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],o=c.getAttribute("data-ln-class").split(",");for(let u=0;u<o.length;u++){const a=o[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function ce(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<r.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[i],t??null),r[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)T(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function $(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const s=r.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const i=function(s,l){return t[l]!==void 0?t[l]:""},n=Array.from(e.querySelectorAll("*"));e.nodeType===1&&n.push(e);for(let s=0;s<n.length;s++){const l=n[s],c=l.attributes;for(let o=0;o<c.length;o++){const u=c[o];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function ue(e,t,r,i,n,s){const l={};for(let o=0;o<e.children.length;o++){const u=e.children[o],a=u.getAttribute("data-ln-render-key");a&&(l[a]=u)}const c=document.createDocumentFragment();for(let o=0;o<t.length;o++){const u=t[o],a=String(i(u));let d=l[a];if(d)n(d,u,o);else{const f=se(r,s);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),n(d,u,o)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=T,window.lnCore.lnFill=ce,window.lnCore.renderList=ue);function h(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function N(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function R(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const n=i.trim().toLowerCase();return!(n==="false"||n==="0")}function M(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const A=new Map;function B(e,t){const r=(e?e.join("|"):"")+"::"+t;if(A.has(r))return A.get(r);const i=new Set(e||[]),n=function(s,l){const c=s.getAttribute(l);return c!==null&&i.has(c)?c:t};return A.set(r,n),n}function j(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function W(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function V(e,t,r,i,n){if(!e||t===null)return!0;const s=i||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=o=>{n?console.warn(o,n):console.warn(o)};if(l==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const o=e.values||[];return o.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${r}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(c(`[${s}] Value ${o} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(c(`[${s}] Value ${o} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(o){return c(`[${s}] Invalid JSON for attribute "${r}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function U(e,t,r){for(const i in r){const[n,s,l]=r[i];Object.defineProperty(e,i,{get:function(){return n(t,s,l)},enumerable:!0,configurable:!0})}return e}function H(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let n=i.read;if(!n&&i.type)switch(i.type){case"enum":n=B(i.values,i.fallback);break;case"integer":n=N;break;case"float":n=j;break;case"boolean":n=R;break;case"list":n=M;break;case"json":n=W;break;case"string":default:n=h;break}n||(n=h),t[i.prop]=[n,r,i.fallback]}return t}function ae(e){const t={};for(const r in e){const i=e[r];i&&i.effect&&(t[r]=i.effect)}return Object.keys(t).length?t:null}function de(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=U,window.lnCore.attrSpec=H,window.lnCore.attrStr=h,window.lnCore.attrInt=N,window.lnCore.attrBool=R,window.lnCore.attrList=M,window.lnCore.attrEnum=B,window.lnCore.attrFloat=j,window.lnCore.attrJson=W);function b(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(r){console.error("["+t.attribute+"] init failed",e,r)}}}function J(e,t,r,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:r,ComponentFn:i};if(e.matches&&e.matches(s)&&b(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let o=0;o<c.length;o++)b(c[o],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function fe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function we(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function Q(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function he(e){const t=Q(),r=e.observed||[];for(let i=0;i<r.length;i++){const n=r[i];t.byAttr.has(n)||t.byAttr.set(n,[]),t.byAttr.get(n).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const n=t.byDeclaredAttr.get(i);n.some(s=>s.componentTag===e.componentTag)||n.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=de(e);if(i===null)t.reactiveWildcard.push(e);else for(const n of i)t.byReactive.has(n)||t.byReactive.set(n,[]),t.byReactive.get(n).push(e)}e.persist&&t.persist.push(e)}function K(e,t,r,i){for(let n=0;n<e.length;n++){const s=e[n];if(!t[s.attribute])continue;const l=s.effects&&s.effects[r];l?l(t,r,i):s.onAttrChange&&(!s.declared||s.declared.has(r))&&s.onAttrChange(t,r,i)}}function be(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,i=Q(),n=i.byAttr.get(t),s=D()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!r&&!n&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&m(l)){const c=i.byDeclaredAttr.get(t),o=l.getAttribute(t);for(let u=0;u<c.length;u++)V(c[u].spec,o,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(r||n)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),r){const c=i.byReactive.get(t);c&&K(c,l,t,e.oldValue),i.reactiveWildcard.length&&K(i.reactiveWildcard,l,t,e.oldValue)}if(n)for(let c=0;c<n.length;c++){const o=n[c];if(o.handler){o.handler(l,t,e.oldValue);continue}o.onAttributeChange&&l[o.attribute]?o.onAttributeChange(l,t):(J(l,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(l))}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,g(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{be(t[r])}catch(i){console.error("[ln-core] mutation handler failed",t[r].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function x(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function v(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ge(e){const t=x();if(!t.length)return;const r=e.target;if(r){const i=r.nodeType===1?r:r.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let i=0;i<t.length;i++){const n=t[i];if(n.onSubtreeChange&&n.query){const s=n.query,l=e.target.nodeType===1?e.target.matches&&e.target.matches(s)?e.target:e.target.closest?e.target.closest(s):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(s):null;l&&n.onSubtreeChange(l,e)}}for(let i=0;i<e.addedNodes.length;i++){const n=e.addedNodes[i];if(n.nodeType===1){const s=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const c=t[l];if(c.selector&&c.attribute&&c.ComponentFn){if(!s)n.matches&&n.matches(c.query)&&b(n,c);else if(n.matches&&n.matches(c.query)&&b(n,c),n.querySelectorAll){const o=n.querySelectorAll(c.query);for(let u=0;u<o.length;u++)b(o[u],c)}}c.onInit&&c.onInit(n)}}}for(let i=0;i<e.removedNodes.length;i++){const n=e.removedNodes[i];if(n.nodeType===1){const s=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const c=t[l],o=c.query;if(o){if(!s)n.matches&&n.matches(o)&&v(n,c);else if(n.matches&&n.matches(o)&&v(n,c),n.querySelectorAll){const u=n.querySelectorAll(o);for(let a=0;a<u.length;a++)v(u[a],c)}}}}}}function P(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,g(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="childList")try{ge(i)}catch(n){console.error("[ln-core] lifecycle handler failed",i.target,n)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ce(e){x().push(e),P()}function z(e,t,r,i,n={}){const s=n.extraAttributes||[],l=n.onAttributeChange||null,c=n.onSubtreeChange||null,o=n.onInit||null,u=n.onAttrChange||null,a=n.effects||null,d=n.attributes||null,f=d?ae(d):a,De=d?new Set(Object.keys(d)):null,Ie=n.persist||null;function C(k){const w=k||document.body;if(J(w,e,t,r),d&&D())for(const p in d){const Te=d[p],O=Array.from(w.querySelectorAll("["+p+"]"));w.matches&&w.matches("["+p+"]")&&O.push(w);for(let E=0;E<O.length;E++){const L=O[E];m(L)&&V(Te,L.getAttribute(p),p,i,L)}}o&&o(w)}const S=[];if(e.indexOf("[")!==-1){const k=/\[([\w-]+)/g;let w;for(;(w=k.exec(e))!==null;)S.push(w[1])}else S.push(e);he({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:r,onInit:o,observed:S.concat(s),onAttributeChange:l,onAttrChange:u,effects:f,declared:De,persist:Ie}),pe();const qe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Fe=n.subtreeQuery||(qe?e:"["+e+"]");x().push({selector:e,attribute:t,ComponentFn:r,onInit:o,onSubtreeChange:c,query:Fe}),P(),window[t]=C,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=z,window.lnCore.observeLifecycle=Ce);function X(){fe()>0?we(function(){C(document.body)}):C(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",X):X(),C}function G(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,r={},i=G(t);if(!i)return r;const n=i.split("&");for(let s=0;s<n.length;s++){const l=n[s];if(!l)continue;const c=l.indexOf(":"),o=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(o)try{r[o]=decodeURIComponent(u)}catch{r[o]=u}}return r}function me(e){if(!e)return null;const t=_();return e in t?t[e]:null}function ye(e,t){if(!e)return;const r=_();t==null?delete r[e]:r[e]=String(t);const n=Object.keys(r).map(function(s){const l=r[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");G(location.hash)!==n&&(location.hash=n)}function Ae(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function xe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function _e(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Se(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ke(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),i=e.slice(t+1),n=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:r,values:n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=me,window.lnCore.hashSet=ye,window.lnCore.hashLinkClick=Ae,window.lnCore.resolveHashNamespace=xe,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=_e,window.lnCore.hashFilterEncode=Se,window.lnCore.hashFilterDecode=ke);function Oe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Oe);function Ee(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t).trim(),i=e.slice(t+1).trim();if(!r)return null;const n={};return n[r]=[i],n}function Le(e){return e==null?"":String(e)}(function(){const e="data-ln-stat",t="lnStat";if(window[t]!==void 0)return;const r={"data-ln-stat":{prop:"_storeName",type:"string",read:h,fallback:"",description:"Store or entity name to count"},"data-ln-stat-filter":{prop:"_filterRaw",type:"string",read:h,fallback:"",description:"JSON or key:value filter criteria for record counting"}},i=H(r);function n(s){return this.dom=s,U(this,s,i),this._onSetCount=function(l){s.textContent=Le(l.detail&&l.detail.count),s.classList.remove("is-loading")},s.addEventListener("ln-stat:set-count",this._onSetCount),I(s,"ln-stat:request-count",{stat:this._storeName,filters:Ee(this._filterRaw)}),this}n.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-stat:set-count",this._onSetCount),delete this.dom[t])},z(e,t,n,"ln-stat",{attributes:r})})()})();
|
|
1
|
+
(function(){"use strict";function I(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function m(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let l=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){l=t[o];break}if(!m(l))return}e.apply(console,t)}}function q(e,t,r){const l=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:l}))}function g(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){g(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function te(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ne(e,t){const r=!!(t&&t.typed),l=t&&t.exclude,o={},s=e.elements,i={};if(r)for(let c=0;c<s.length;c++){const n=s[c];n.name&&n.type==="checkbox"&&!n.disabled&&(i[n.name]=(i[n.name]||0)+1)}for(let c=0;c<s.length;c++){const n=s[c];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(l&&n.matches&&n.matches(l)))if(n.type==="checkbox")r&&i[n.name]===1?o[n.name]=n.checked:(o[n.name]||(o[n.name]=[]),n.checked&&o[n.name].push(n.value));else if(n.type==="radio")n.checked&&(o[n.name]=n.value);else if(n.type==="select-multiple"){o[n.name]=[];for(let u=0;u<n.options.length;u++)n.options[u].selected&&o[n.name].push(n.options[u].value)}else if(r&&n.type==="hidden")o[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const u=Number(n.value);o[n.name]=n.value===""||isNaN(u)?null:u}else o[n.name]=n.value}return o}function re(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function oe(e,t){const r=e.elements,l=[],o={};for(let s=0;s<r.length;s++){const i=r[s];i.name&&i.type==="checkbox"&&(o[i.name]=(o[i.name]||0)+1)}for(let s=0;s<r.length;s++){const i=r[s];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const c=i.getAttribute("data-ln-fill-as")||i.name;if(!c||!(c in t))continue;const n=t[c];if(i.type==="checkbox"){if(Array.isArray(n))i.checked=n.indexOf(i.value)!==-1;else if(o[i.name]>1){const u=String(n).split(",").map(function(a){return a.trim()});i.checked=u.indexOf(i.value)!==-1}else i.checked=re(n);l.push(i)}else if(i.type==="radio")i.checked=i.value===String(n),l.push(i);else if(i.type==="select-multiple"){if(Array.isArray(n))for(let u=0;u<i.options.length;u++)i.options[u].selected=n.indexOf(i.options[u].value)!==-1;l.push(i)}else i.value=n,i.tagName==="SELECT"&&n!=null&&i.setAttribute("data-ln-value",n),l.push(i)}return l}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=oe,window.lnCore.serializeForm=ne,window.lnCore.resolveFormMethod=te);const F={};function ie(e,t){F[e]=t}function le(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ie,window.lnCore.getDataMapper=le);function se(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,g(function(){new MutationObserver(function(){q(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function ce(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];T[r]=t}function ue(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ce,window.lnCore.getLocaleFallback=ue,window.lnCore.ensureLocaleObserver=se);const y={};function ae(e,t){y[e]||(y[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=y[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function $(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let i=0;i<r.length;i++){const c=r[i],n=c.getAttribute("data-ln-field");t[n]!=null&&(c.textContent=t[n])}const l=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<l.length;i++){const c=l[i],n=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<n.length;u++){const a=n[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const o=e.querySelectorAll("[data-ln-show]");for(let i=0;i<o.length;i++){const c=o[i],n=c.getAttribute("data-ln-show");n in t&&c.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let i=0;i<s.length;i++){const c=s[i],n=c.getAttribute("data-ln-class").split(",");for(let u=0;u<n.length;u++){const a=n[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function de(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let l=0;l<r.length;l++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[l],t??null),r[l].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)$(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function N(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const s=r.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,c){return t[c]!==void 0?t[c]:""}))}const l=function(s,i){return t[i]!==void 0?t[i]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let s=0;s<o.length;s++){const i=o[s],c=i.attributes;for(let n=0;n<c.length;n++){const u=c[n];u.value.indexOf("{{")!==-1&&i.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,l))}}return e}function fe(e,t,r,l,o,s){const i={};for(let n=0;n<e.children.length;n++){const u=e.children[n],a=u.getAttribute("data-ln-render-key");a&&(i[a]=u)}const c=document.createDocumentFragment();for(let n=0;n<t.length;n++){const u=t[n],a=String(l(u));let d=i[a];if(d)o(d,u,n);else{const f=ae(r,s);if(!f||(N(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),o(d,u,n)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=N,window.lnCore.fill=$,window.lnCore.lnFill=de,window.lnCore.renderList=fe);function h(e,t,r){const l=e.getAttribute(t);return l===null?r:l}function R(e,t,r){const l=parseInt(e.getAttribute(t),10);return isNaN(l)?r:l}function M(e,t,r=!1){const l=e.getAttribute(t);if(l===null)return!!r;const o=l.trim().toLowerCase();return!(o==="false"||o==="0")}function B(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const A=new Map;function j(e,t){const r=(e?e.join("|"):"")+"::"+t;if(A.has(r))return A.get(r);const l=new Set(e||[]),o=function(s,i){const c=s.getAttribute(i);return c!==null&&l.has(c)?c:t};return A.set(r,o),o}function W(e,t,r){const l=parseFloat(e.getAttribute(t));return isNaN(l)?r:l}function V(e,t,r){const l=e.getAttribute(t);if(!l)return r;try{return JSON.parse(l)}catch{return r}}function U(e,t,r,l,o){if(!e||t===null)return!0;const s=l||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const c=n=>{o?console.warn(n,o):console.warn(n)};if(i==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const n=e.values||[];return n.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(c(`[${s}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(c(`[${s}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(n){return c(`[${s}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function H(e,t,r){for(const l in r){const[o,s,i]=r[l];Object.defineProperty(e,l,{get:function(){return o(t,s,i)},enumerable:!0,configurable:!0})}return e}function J(e){const t={};for(const r in e){const l=e[r];if(!l||!l.prop)continue;let o=l.read;if(!o&&l.type)switch(l.type){case"enum":o=j(l.values,l.fallback);break;case"integer":o=R;break;case"float":o=W;break;case"boolean":o=M;break;case"list":o=B;break;case"json":o=V;break;case"string":default:o=h;break}o||(o=h),t[l.prop]=[o,r,l.fallback]}return t}function we(e){const t={};for(const r in e){const l=e[r];l&&l.effect&&(t[r]=l.effect)}return Object.keys(t).length?t:null}function he(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=H,window.lnCore.attrSpec=J,window.lnCore.attrStr=h,window.lnCore.attrInt=R,window.lnCore.attrBool=M,window.lnCore.attrList=B,window.lnCore.attrEnum=j,window.lnCore.attrFloat=W,window.lnCore.attrJson=V);function b(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(r){console.error("["+t.attribute+"] init failed",e,r)}}}function Q(e,t,r,l){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:r,ComponentFn:l};if(e.matches&&e.matches(s)&&b(e,i),e.querySelectorAll){const c=e.querySelectorAll(s);for(let n=0;n<c.length;n++)b(c[n],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function be(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function pe(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function K(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ge(e){const t=K(),r=e.observed||[];for(let l=0;l<r.length;l++){const o=r[l];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const l in e.attributes){t.byDeclaredAttr.has(l)||t.byDeclaredAttr.set(l,[]);const o=t.byDeclaredAttr.get(l);o.some(s=>s.componentTag===e.componentTag)||o.push({spec:e.attributes[l],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const l=he(e);if(l===null)t.reactiveWildcard.push(e);else for(const o of l)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function P(e,t,r,l){for(let o=0;o<e.length;o++){const s=e[o];if(!t[s.attribute])continue;const i=s.effects&&s.effects[r];i?i(t,r,l):s.onAttrChange&&(!s.declared||s.declared.has(r))&&s.onAttrChange(t,r,l)}}function Ce(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,l=K(),o=l.byAttr.get(t),s=I()&&l.byDeclaredAttr&&l.byDeclaredAttr.has(t);if(!r&&!o&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&m(i)){const c=l.byDeclaredAttr.get(t),n=i.getAttribute(t);for(let u=0;u<c.length;u++)U(c[u].spec,n,t,c[u].componentTag,i)}if(window.lnCore._debugSink&&(r||o)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),r){const c=l.byReactive.get(t);c&&P(c,i,t,e.oldValue),l.reactiveWildcard.length&&P(l.reactiveWildcard,i,t,e.oldValue)}if(o)for(let c=0;c<o.length;c++){const n=o[c];if(n.handler){n.handler(i,t,e.oldValue);continue}n.onAttributeChange&&i[n.attribute]?n.onAttributeChange(i,t):(Q(i,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(i))}}}function me(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,g(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Ce(t[r])}catch(l){console.error("[ln-core] mutation handler failed",t[r].target,l)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function x(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function v(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function _(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(l){console.error("["+t.attribute+"] destroy failed",e,l)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ye(e){const t=x();if(!t.length)return;const r=e.target;if(r){const o=r.nodeType===1?r:r.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}const l=v();if(e.target&&l.length)for(let o=0;o<l.length;o++){const s=l[o],i=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(i)?e.target:e.target.closest?e.target.closest(i):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(i):null;c&&s.onSubtreeChange(c,e)}for(let o=0;o<e.addedNodes.length;o++){const s=e.addedNodes[o];if(s.nodeType===1){const i=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const n=t[c];if(n.selector&&n.attribute&&n.ComponentFn){if(!i)s.matches&&s.matches(n.query)&&b(s,n);else if(s.matches&&s.matches(n.query)&&b(s,n),s.querySelectorAll){const u=s.querySelectorAll(n.query);for(let a=0;a<u.length;a++)b(u[a],n)}}n.onInit&&n.onInit(s)}}}for(let o=0;o<e.removedNodes.length;o++){const s=e.removedNodes[o];if(s.nodeType===1){const i=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const n=t[c],u=n.query;if(u){if(!i)s.matches&&s.matches(u)&&_(s,n);else if(s.matches&&s.matches(u)&&_(s,n),s.querySelectorAll){const a=s.querySelectorAll(u);for(let d=0;d<a.length;d++)_(a[d],n)}}}}}}function z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,g(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const l=t[r];if(l.type==="childList")try{ye(l)}catch(o){console.error("[ln-core] lifecycle handler failed",l.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ae(e){x().push(e),e.onSubtreeChange&&e.query&&v().push(e),z()}function G(e,t,r,l,o={}){const s=o.extraAttributes||[],i=o.onAttributeChange||null,c=o.onSubtreeChange||null,n=o.onInit||null,u=o.onAttrChange||null,a=o.effects||null,d=o.attributes||null,f=d?we(d):a,Fe=d?new Set(Object.keys(d)):null,Te=o.persist||null;function C(O){const w=O||document.body;if(Q(w,e,t,r),d&&I())for(const p in d){const Ne=d[p],E=Array.from(w.querySelectorAll("["+p+"]"));w.matches&&w.matches("["+p+"]")&&E.push(w);for(let L=0;L<E.length;L++){const D=E[L];m(D)&&U(Ne,D.getAttribute(p),p,l,D)}}n&&n(w)}const k=[];if(e.indexOf("[")!==-1){const O=/\[([\w-]+)/g;let w;for(;(w=O.exec(e))!==null;)k.push(w[1])}else k.push(e);ge({selector:e,attribute:t,componentTag:l,attributes:d,ComponentFn:r,onInit:n,observed:k.concat(s),onAttributeChange:i,onAttrChange:u,effects:f,declared:Fe,persist:Te}),me();const $e=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Y=o.subtreeQuery||($e?e:"["+e+"]"),Z={selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:c,query:Y};x().push(Z),c&&Y&&v().push(Z),z(),window[t]=C,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=G,window.lnCore.observeLifecycle=Ae);function ee(){be()>0?pe(function(){C(document.body)}):C(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ee):ee(),C}function X(e){return(e||"").replace(/^#/,"")}function S(e){const t=e===void 0?location.hash:e,r={},l=X(t);if(!l)return r;const o=l.split("&");for(let s=0;s<o.length;s++){const i=o[s];if(!i)continue;const c=i.indexOf(":"),n=c>-1?i.slice(0,c):i,u=c>-1?i.slice(c+1):"";if(n)try{r[n]=decodeURIComponent(u)}catch{r[n]=u}}return r}function xe(e){if(!e)return null;const t=S();return e in t?t[e]:null}function ve(e,t){if(!e)return;const r=S();t==null?delete r[e]:r[e]=String(t);const o=Object.keys(r).map(function(s){const i=r[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");X(location.hash)!==o&&(location.hash=o)}function _e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Se(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const l=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return l?t?l+"-"+t:l:t||null}function ke(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ee(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Le(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),l=e.slice(t+1),o=l?l.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:r,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=S,window.lnCore.hashGet=xe,window.lnCore.hashSet=ve,window.lnCore.hashLinkClick=_e,window.lnCore.resolveHashNamespace=Se,window.lnCore.hashSortEncode=ke,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Ee,window.lnCore.hashFilterDecode=Le);function De(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=De);function Ie(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t).trim(),l=e.slice(t+1).trim();if(!r)return null;const o={};return o[r]=[l],o}function qe(e){return e==null?"":String(e)}(function(){const e="data-ln-stat",t="lnStat";if(window[t]!==void 0)return;const r={"data-ln-stat":{prop:"_storeName",type:"string",read:h,fallback:"",description:"Store or entity name to count"},"data-ln-stat-filter":{prop:"_filterRaw",type:"string",read:h,fallback:"",description:"JSON or key:value filter criteria for record counting"}},l=J(r);function o(s){return this.dom=s,H(this,s,l),this._onSetCount=function(i){s.textContent=qe(i.detail&&i.detail.count),s.classList.remove("is-loading")},s.addEventListener("ln-stat:set-count",this._onSetCount),q(s,"ln-stat:request-count",{stat:this._storeName,filters:Ie(this._filterRaw)}),this}o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-stat:set-count",this._onSetCount),delete this.dom[t])},G(e,t,o,"ln-stat",{attributes:r})})()})();
|