@livenetworks/ashlar 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function K(){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 R(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 o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){i=t[o];break}if(!R(i))return}e.apply(console,t)}}function Q(e,t,n){const i=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function N(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){N(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function me(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function pe(e,t){const n=!!(t&&t.typed),i=t&&t.exclude,o={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const r=s[c];r.name&&r.type==="checkbox"&&!r.disabled&&(l[r.name]=(l[r.name]||0)+1)}for(let c=0;c<s.length;c++){const r=s[c];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(i&&r.matches&&r.matches(i)))if(r.type==="checkbox")n&&l[r.name]===1?o[r.name]=r.checked:(o[r.name]||(o[r.name]=[]),r.checked&&o[r.name].push(r.value));else if(r.type==="radio")r.checked&&(o[r.name]=r.value);else if(r.type==="select-multiple"){o[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&o[r.name].push(r.options[u].value)}else if(n&&r.type==="hidden")o[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const u=Number(r.value);o[r.name]=r.value===""||isNaN(u)?null:u}else o[r.name]=r.value}return o}function we(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ge(e,t){const n=e.elements,i=[],o={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(o[l.name]=(o[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[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 r=t[c];if(l.type==="checkbox"){if(Array.isArray(r))l.checked=r.indexOf(l.value)!==-1;else if(o[l.name]>1){const u=String(r).split(",").map(function(p){return p.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=we(r);i.push(l)}else if(l.type==="radio")l.checked=l.value===String(r),i.push(l);else if(l.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<l.options.length;u++)l.options[u].selected=r.indexOf(l.options[u].value)!==-1;i.push(l)}else l.value=r,l.tagName==="SELECT"&&r!=null&&l.setAttribute("data-ln-value",r),i.push(l)}return i}function be(e,t,{get:n,set:i}){Object.defineProperty(e,"value",{get:function(){return n?n.call(this):t.get.call(this)},set:function(o){i?i.call(this,o,s=>t.set.call(this,s)):t.set.call(this,o)},configurable:!0})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ge,window.lnCore.serializeForm=pe,window.lnCore.resolveFormMethod=me);const Y={};function ye(e,t){Y[e]=t}function Ce(e){return Y[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ye,window.lnCore.getDataMapper=Ce);function F(e){const t=e?e.closest("[lang]"):null,n=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function J(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,N(function(){new MutationObserver(function(){Q(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const z={};function G(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];z[n]=t}function O(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return z[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=G,window.lnCore.getLocaleFallback=O,window.lnCore.ensureLocaleObserver=J);const B={};function _e(e,t){B[e]||(B[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=B[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function X(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],r=c.getAttribute("data-ln-field");t[r]!=null&&(c.textContent=t[r])}const i=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<i.length;l++){const c=i[l],r=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const d=p[0].trim(),a=p[1].trim();t[a]!=null&&c.setAttribute(d,t[a])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const c=o[l],r=c.getAttribute("data-ln-show");r in t&&c.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],r=c.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const d=p[0].trim(),a=p[1].trim();a in t&&c.classList.toggle(d,!!t[a])}}return e}function ve(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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<n.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[i],t??null),n[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)X(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function Z(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.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]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let s=0;s<o.length;s++){const l=o[s],c=l.attributes;for(let r=0;r<c.length;r++){const u=c[r];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function Ae(e,t,n,i,o,s){const l={};for(let r=0;r<e.children.length;r++){const u=e.children[r],p=u.getAttribute("data-ln-render-key");p&&(l[p]=u)}const c=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],p=String(i(u));let d=l[p];if(d)o(d,u,r);else{const a=_e(n,s);if(!a||(Z(a,u),d=a.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",p),o(d,u,r)}c.appendChild(d)}e.textContent="",e.appendChild(c)}function xe(e,t){const n={},i=e.querySelectorAll("["+t+"]");for(let o=0;o<i.length;o++)n[i[o].getAttribute(t)]=i[o].textContent,i[o].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=Z,window.lnCore.fill=X,window.lnCore.lnFill=ve,window.lnCore.renderList=Ae);function q(e,t,n){const i=e.getAttribute(t);return i===null?n:i}function ee(e,t,n){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?n:i}function te(e,t,n=!1){const i=e.getAttribute(t);if(i===null)return!!n;const o=i.trim().toLowerCase();return!(o==="false"||o==="0")}function ne(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const $=new Map;function re(e,t){const n=(e?e.join("|"):"")+"::"+t;if($.has(n))return $.get(n);const i=new Set(e||[]),o=function(s,l){const c=s.getAttribute(l);return c!==null&&i.has(c)?c:t};return $.set(n,o),o}function oe(e,t,n){const i=parseFloat(e.getAttribute(t));return isNaN(i)?n:i}function ie(e,t,n){const i=e.getAttribute(t);if(!i)return n;try{return JSON.parse(i)}catch{return n}}function le(e,t,n,i,o){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=r=>{o?console.warn(r,o):console.warn(r)};if(l==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const r=e.values||[];return r.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(c(`[${s}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(c(`[${s}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(r){return c(`[${s}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function Se(e,t,n){for(const i in n){const[o,s,l]=n[i];Object.defineProperty(e,i,{get:function(){return o(t,s,l)},enumerable:!0,configurable:!0})}return e}function ke(e){const t={};for(const n in e){const i=e[n];if(!i||!i.prop)continue;let o=i.read;if(!o&&i.type)switch(i.type){case"enum":o=re(i.values,i.fallback);break;case"integer":o=ee;break;case"float":o=oe;break;case"boolean":o=te;break;case"list":o=ne;break;case"json":o=ie;break;case"string":default:o=q;break}o||(o=q),t[i.prop]=[o,n,i.fallback]}return t}function Ee(e){const t={};for(const n in e){const i=e[n];i&&i.effect&&(t[n]=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 n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Se,window.lnCore.attrSpec=ke,window.lnCore.attrStr=q,window.lnCore.attrInt=ee,window.lnCore.attrBool=te,window.lnCore.attrList=ne,window.lnCore.attrEnum=re,window.lnCore.attrFloat=oe,window.lnCore.attrJson=ie);function T(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(n){console.error("["+t.attribute+"] init failed",e,n)}}}function se(e,t,n,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:i};if(e.matches&&e.matches(s)&&T(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let r=0;r<c.length;r++)T(c[r],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Oe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Te(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 ae(){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 Le(e){const t=ae(),n=e.observed||[];for(let i=0;i<n.length;i++){const o=n[i];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 i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const o=t.byDeclaredAttr.get(i);o.some(s=>s.componentTag===e.componentTag)||o.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 o of i)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function ce(e,t,n,i){for(let o=0;o<e.length;o++){const s=e[o];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,i):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,i)}}function Me(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,i=ae(),o=i.byAttr.get(t),s=K()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!n&&!o&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&R(l)){const c=i.byDeclaredAttr.get(t),r=l.getAttribute(t);for(let u=0;u<c.length;u++)le(c[u].spec,r,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(n||o)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const c=i.byReactive.get(t);c&&ce(c,l,t,e.oldValue),i.reactiveWildcard.length&&ce(i.reactiveWildcard,l,t,e.oldValue)}if(o)for(let c=0;c<o.length;c++){const r=o[c];if(r.handler){r.handler(l,t,e.oldValue);continue}r.onAttributeChange&&l[r.attribute]?r.onAttributeChange(l,t):(se(l,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(l))}}}function Ne(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,N(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{Me(t[n])}catch(i){console.error("[ln-core] mutation handler failed",t[n].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function V(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function j(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function P(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Fe(e){const t=V();if(!t.length)return;const n=e.target;if(n){const o=n.nodeType===1?n:n.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}const i=j();if(e.target&&i.length)for(let o=0;o<i.length;o++){const s=i[o],l=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):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 l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const r=t[c];if(r.selector&&r.attribute&&r.ComponentFn){if(!l)s.matches&&s.matches(r.query)&&T(s,r);else if(s.matches&&s.matches(r.query)&&T(s,r),s.querySelectorAll){const u=s.querySelectorAll(r.query);for(let p=0;p<u.length;p++)T(u[p],r)}}r.onInit&&r.onInit(s)}}}for(let o=0;o<e.removedNodes.length;o++){const s=e.removedNodes[o];if(s.nodeType===1){const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const r=t[c],u=r.query;if(u){if(!l)s.matches&&s.matches(u)&&P(s,r);else if(s.matches&&s.matches(u)&&P(s,r),s.querySelectorAll){const p=s.querySelectorAll(u);for(let d=0;d<p.length;d++)P(p[d],r)}}}}}}function ue(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,N(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const i=t[n];if(i.type==="childList")try{Fe(i)}catch(o){console.error("[ln-core] lifecycle handler failed",i.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ie(e){V().push(e),e.onSubtreeChange&&e.query&&j().push(e),ue()}function de(e,t,n,i,o={}){const s=o.extraAttributes||[],l=o.onAttributeChange||null,c=o.onSubtreeChange||null,r=o.onInit||null,u=o.onAttrChange||null,p=o.effects||null,d=o.attributes||null,a=d?Ee(d):p,f=d?new Set(Object.keys(d)):null,h=o.persist||null;function g(m){const w=m||document.body;if(se(w,e,t,n),d&&K())for(const b in d){const A=d[b],x=Array.from(w.querySelectorAll("["+b+"]"));w.matches&&w.matches("["+b+"]")&&x.push(w);for(let k=0;k<x.length;k++){const M=x[k];R(M)&&le(A,M.getAttribute(b),b,i,M)}}r&&r(w)}const C=[];if(e.indexOf("[")!==-1){const m=/\[([\w-]+)/g;let w;for(;(w=m.exec(e))!==null;)C.push(w[1])}else C.push(e);Le({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:n,onInit:r,observed:C.concat(s),onAttributeChange:l,onAttrChange:u,effects:a,declared:f,persist:h}),Ne();const y=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,_=o.subtreeQuery||(y?e:"["+e+"]"),S={selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:c,query:_};V().push(S),c&&_&&j().push(S),ue(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=de,window.lnCore.observeLifecycle=Ie);function D(){Oe()>0?Te(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",D):D(),g}function fe(e){return(e||"").replace(/^#/,"")}function H(e){const t=e===void 0?location.hash:e,n={},i=fe(t);if(!i)return n;const o=i.split("&");for(let s=0;s<o.length;s++){const l=o[s];if(!l)continue;const c=l.indexOf(":"),r=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(r)try{n[r]=decodeURIComponent(u)}catch{n[r]=u}}return n}function Re(e){if(!e)return null;const t=H();return e in t?t[e]:null}function Be(e,t){if(!e)return;const n=H();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");fe(location.hash)!==o&&(location.hash=o)}function qe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function $e(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.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 je(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 Pe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function He(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),i=e.slice(t+1),o=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=H,window.lnCore.hashGet=Re,window.lnCore.hashSet=Be,window.lnCore.hashLinkClick=qe,window.lnCore.resolveHashNamespace=$e,window.lnCore.hashSortEncode=Ve,window.lnCore.hashSortDecode=je,window.lnCore.hashFilterEncode=Pe,window.lnCore.hashFilterDecode=He);function We(){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=We);function v(e){if(e==null||e==="")return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;const t=Number(e);if(!isNaN(t)&&t>0){const n=t<1e11?t*1e3:t,i=new Date(n);return isNaN(i.getTime())?null:i}if(typeof e=="string"){const n=e.trim();if(!n)return null;const i=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(i){const s=+i[1],l=+i[2],c=+i[3],r=new Date(s,l-1,c);return r.getFullYear()!==s||r.getMonth()!==l-1||r.getDate()!==c?null:r}const o=new Date(n);return isNaN(o.getTime())?null:o}return null}function E(e){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return t+"-"+n+"-"+i}const W=/^(short|medium|long)(\s+datetime)?$/,Ue={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},"short datetime":{dateStyle:"short",timeStyle:"short"},"medium datetime":{dateStyle:"medium",timeStyle:"short"},"long datetime":{dateStyle:"long",timeStyle:"short"}};function Ke(e){return!e||e===""?{dateStyle:"medium"}:String(e).trim().match(W)?Ue[e.trim()]:null}function L(e){if(!e||typeof e!="string")return null;const t=e.trim();if(t.length<6)return null;let n,i;if(t.indexOf(".")!==-1)n=".",i=t.split(".");else if(t.indexOf("/")!==-1)n="/",i=t.split("/");else if(t.indexOf("-")!==-1)n="-",i=t.split("-");else return null;if(i.length!==3)return null;const o=[];for(let u=0;u<3;u++){const p=parseInt(i[u],10);if(isNaN(p))return null;o.push(p)}let s,l,c;n==="."?(s=o[0],l=o[1],c=o[2]):n==="/"?(l=o[0],s=o[1],c=o[2]):i[0].length===4?(c=o[0],l=o[1],s=o[2]):(s=o[0],l=o[1],c=o[2]),c<100&&(c+=c<50?2e3:1900);const r=new Date(c,l-1,s);return r.getFullYear()!==c||r.getMonth()!==l-1||r.getDate()!==s?null:r}function U(e,t,n,i){if(!e||!(e instanceof Date)||isNaN(e.getTime())||!t||typeof t!="string")return"";const o=e.getDate(),s=e.getMonth(),l=e.getFullYear(),c=e.getHours(),r=e.getMinutes();let u,p;const d=(n||"").toLowerCase().split("-")[0];let a=!1;try{const g=new Intl.DateTimeFormat(n,{month:"long"}).resolvedOptions().locale.toLowerCase().split("-")[0];a=!!(i&&g!==d)}catch{a=!!i}if(a&&i&&i.monthsLong)u=i.monthsLong[s];else try{u=new Intl.DateTimeFormat(n,{month:"long"}).format(e)}catch{u=String(s+1)}if(a&&i&&i.monthsShort)p=i.monthsShort[s];else try{p=new Intl.DateTimeFormat(n,{month:"short"}).format(e)}catch{p=String(s+1)}const f={yyyy:String(l),yy:String(l).slice(-2),MMMM:u,MMM:p,MM:String(s+1).padStart(2,"0"),M:String(s+1),dd:String(o).padStart(2,"0"),d:String(o),HH:String(c).padStart(2,"0"),mm:String(r).padStart(2,"0")};return t.replace(/yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|mm/g,function(h){return f[h]!==void 0?f[h]:h})}function I(e,t,n,i){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const o=Ke(t);if(o)try{const s=new Intl.DateTimeFormat(n,o),l=(n||"").toLowerCase().split("-")[0],c=s.resolvedOptions().locale.toLowerCase().split("-")[0];return i&&c!==l?U(e,"dd.MM.yyyy",n,i):s.format(e)}catch{return U(e,"dd.MM.yyyy",n,i)}return U(e,t||"dd.MM.yyyy",n,i)}(function(){const e="data-ln-date",t="lnDate";if(window[t]!==void 0)return;function n(a){const f=a[t];if(f){if(f.isTextElement)f._initTextElement();else if(f.value){const h=v(f.value);h&&f._displayFormatted(h)}}}const i={"data-ln-date":{type:"enum",values:["short","medium","long","full","iso"],fallback:"medium",effect:n,description:"Date display style preset or activator"},"data-ln-date-format":{type:"string",effect:n,description:"Custom Intl.DateTimeFormat pattern or options"},"data-ln-date-locale":{type:"string",effect:n,description:"BCP 47 language tag override for date formatting"},"data-ln-value":{type:"string",effect:n,description:"Raw ISO date string or timestamp for non-time elements (td, span)"},"data-ln-date-dict":{type:"marker",description:"Container for date translation dictionary"},"data-ln-date-dict-key":{type:"string",description:"Dictionary key for relative time or custom date formatting"},"data-ln-date-field":{type:"string",description:"Field name mapping for date record binding"},"data-ln-date-label":{type:"string",description:"Accessible label text for the date input"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");function s(a,f,h){Q(a.dom,"ln-date:change",{value:f,formatted:a.dom.value,date:h}),a.dom.dispatchEvent(new Event("change",{bubbles:!0}))}function l(a,f,h,g){a._setHiddenRaw(f),o.set.call(a._picker,f),a._lastISO=f,g!==void 0?(a._isFormatting=!0,a.dom.value=g,a._isFormatting=!1):h&&a._displayFormatted(h),s(a,f,h)}function c(a){a._setHiddenRaw(""),o.set.call(a._picker,""),a._isFormatting=!0,a.dom.value="",a._isFormatting=!1,a._lastISO="",s(a,"",null)}const r=new Set;let u=!1;function p(){J(),!u&&(u=!0,document.addEventListener("ln-core:locale-change",function(){r.forEach(function(a){if(a.isTextElement)a._formatTextContent();else if(a.value){const f=v(a.value);f&&a._displayFormatted(f)}})}))}function d(a){if(a[t])return a[t];if(a[t]=this,this.dom=a,r.add(this),p(),a.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;this.isTextElement=!1;const f=a.value,h=a.name,g=a.closest(".form-element, form")||a.parentNode;if(g){const m=g.querySelectorAll("[data-ln-date-dict]");for(let w=0;w<m.length;w++){const b=m[w].getAttribute("data-ln-date-dict");if(b){const A=xe(m[w],"data-ln-date-dict-key");A["months-long"]&&(A.monthsLong=A["months-long"].split(",").map(x=>x.trim())),A["months-short"]&&(A.monthsShort=A["months-short"].split(",").map(x=>x.trim())),G(b,A)}}}const C=document.createElement("span");C.setAttribute("data-ln-date-field",""),a.parentNode.insertBefore(C,a),C.appendChild(a),this._wrapper=C;const y=document.createElement("input");y.type="hidden",y.name=h,a.removeAttribute("name"),a.hasAttribute("data-ln-fill-as")&&y.setAttribute("data-ln-fill-as",a.getAttribute("data-ln-fill-as")),a.insertAdjacentElement("afterend",y),this._hidden=y;const _=document.createElement("input");_.type="date",_.tabIndex=-1,_.setAttribute("tabindex","-1"),_.setAttribute("aria-hidden","true"),_.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Date picker"),_.style.cssText="position:absolute;opacity:0;width:0;height:0;overflow:hidden;pointer-events:none",y.insertAdjacentElement("afterend",_),this._picker=_,a.type="text";const S=document.createElement("button");S.type="button",S.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Open date picker"),S.innerHTML='<svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-calendar"></use></svg>',_.insertAdjacentElement("afterend",S),this._btn=S,this._lastISO="",Object.defineProperty(y,"value",{get:function(){return o.get.call(y)},set:function(m){if(o.set.call(y,m),m&&m!==""){const w=v(m);w&&l(self,m,w)}else m===""&&c(self)}}),be(a,o,{get:function(){return o.get.call(a)},set:function(m,w){if(self._isFormatting){w(m);return}if(!m||m===""){w(""),c(self);return}const b=v(m)||L(m);if(b){const A=E(b),x=a.getAttribute(e)||"",k=F(a),M=O(k),he=I(b,x,k,M);w(he),l(self,A,b,he)}else w(String(m)),c(self)}}),this._onPickerChange=function(){const m=_.value;if(m){const w=v(m);w&&l(self,m,w)}else c(self)},_.addEventListener("change",this._onPickerChange),this._onBlur=function(){const m=self.dom.value.trim();if(m===""){self._lastISO!==""&&c(self);return}if(self._lastISO){const b=v(self._lastISO);if(b){const A=self.dom.getAttribute(e)||"",x=F(self.dom),k=O(x);if(m===I(b,A,x,k))return}}const w=L(m);if(w){const b=E(w);l(self,b,w)}else if(self._lastISO){const b=v(self._lastISO);b&&self._displayFormatted(b)}else self.dom.value=""},a.addEventListener("blur",this._onBlur),this._onBtnClick=function(){self._openPicker()},S.addEventListener("click",this._onBtnClick);const D=a.form;if(D&&(this._form=D,this._onFormReset=function(){setTimeout(function(){const m=self.dom.value;if(m){const w=v(m)||L(m);if(w){const b=E(w);l(self,b,w);return}}c(self)},0)},D.addEventListener("reset",this._onFormReset)),f&&f!==""){const m=v(f);m&&l(self,f,m)}return this}d.prototype._initTextElement=function(){const a=this.dom,f=a.getAttribute("data-ln-value"),h=a.getAttribute("data-ln-date"),g=a.getAttribute("datetime");let C=null;a.tagName==="TIME"&&g!==null&&g!==""?C=g:f!==null&&f!==""?C=f:g!==null&&g!==""?C=g:h!==null&&h!==""&&h!=="true"&&!W.test(h)?C=h:C=a.textContent.trim();const y=v(C)||L(C);if(y&&!isNaN(y.getTime())){const _=E(y);this._rawValue=_,a.tagName!=="TIME"&&!a.hasAttribute("data-ln-value")&&a.setAttribute("data-ln-value",_),this._formatTextContent()}else this._rawValue=null},d.prototype._formatTextContent=function(){if(this._rawValue){const a=v(this._rawValue);if(a){let h=this.dom.getAttribute("data-ln-date-format");if(!h){const y=this.dom.getAttribute("data-ln-date");y&&W.test(y)&&(h=y)}const g=F(this.dom),C=O(g);this.dom.textContent=I(a,h||"medium",g,C)}}},d.prototype._openPicker=function(){if(typeof this._picker.showPicker=="function")try{this._picker.showPicker()}catch{this._picker.click()}else this._picker.click()},d.prototype._setHiddenRaw=function(a){o.set.call(this._hidden,a)},d.prototype._displayFormatted=function(a){const f=this.dom.getAttribute(e)||"",h=F(this.dom),g=O(h);this._isFormatting=!0,this.dom.value=I(a,f,h,g),this._isFormatting=!1},Object.defineProperty(d.prototype,"value",{get:function(){return this.isTextElement?this._rawValue||"":o.get.call(this._hidden)},set:function(a){if(this.isTextElement){if(!a||a===""){this._rawValue=null,this.dom.removeAttribute("data-ln-value"),this.dom.tagName==="TIME"&&this.dom.removeAttribute("datetime"),this.dom.textContent="";return}const h=v(a)||L(a);if(!h)return;const g=E(h);this._rawValue=g,this.dom.tagName==="TIME"?this.dom.setAttribute("datetime",g):this.dom.setAttribute("data-ln-value",g),this._formatTextContent();return}if(!a||a===""){c(this);return}const f=v(a);f&&l(this,a,f)}}),Object.defineProperty(d.prototype,"date",{get:function(){const a=this.value;return a?v(a):null},set:function(a){if(!a||!(a instanceof Date)||isNaN(a.getTime())){this.value="";return}this.value=E(a)}}),Object.defineProperty(d.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:this.dom.value}}),d.prototype.destroy=function(){if(!this.dom[t])return;if(r.delete(this),this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement){delete this.dom[t];return}this._form&&this._onFormReset&&this._form.removeEventListener("reset",this._onFormReset),this._picker.removeEventListener("change",this._onPickerChange),this.dom.removeEventListener("blur",this._onBlur),this._btn.removeEventListener("click",this._onBtnClick);const a=this.value;this._hidden.remove(),this._picker.remove(),this._btn.remove(),this._wrapper&&this._wrapper.parentNode&&(this._wrapper.parentNode.insertBefore(this.dom,this._wrapper),this._wrapper.remove()),delete this.dom.value,this.dom.name=this._hidden.name,this.dom.type="date",a&&(this.dom.value=a),delete this.dom[t]},de(e,t,d,"ln-date",{attributes:i,extraAttributes:["datetime","lang"],onAttributeChange:n})})()})();
|
|
1
|
+
(function(){"use strict";function K(){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 R(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 o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){i=t[o];break}if(!R(i))return}e.apply(console,t)}}function Q(e,t,n){const i=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function N(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){N(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function me(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function pe(e,t){const n=!!(t&&t.typed),i=t&&t.exclude,o={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const r=s[c];r.name&&r.type==="checkbox"&&!r.disabled&&(l[r.name]=(l[r.name]||0)+1)}for(let c=0;c<s.length;c++){const r=s[c];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(i&&r.matches&&r.matches(i)))if(r.type==="checkbox")n&&l[r.name]===1?o[r.name]=r.checked:(o[r.name]||(o[r.name]=[]),r.checked&&o[r.name].push(r.value));else if(r.type==="radio")r.checked&&(o[r.name]=r.value);else if(r.type==="select-multiple"){o[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&o[r.name].push(r.options[u].value)}else if(n&&r.type==="hidden")o[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const u=Number(r.value);o[r.name]=r.value===""||isNaN(u)?null:u}else o[r.name]=r.value}return o}function we(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ge(e,t){const n=e.elements,i=[],o={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(o[l.name]=(o[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[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 r=t[c];if(l.type==="checkbox"){if(Array.isArray(r))l.checked=r.indexOf(l.value)!==-1;else if(o[l.name]>1){const u=String(r).split(",").map(function(p){return p.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=we(r);i.push(l)}else if(l.type==="radio")l.checked=l.value===String(r),i.push(l);else if(l.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<l.options.length;u++)l.options[u].selected=r.indexOf(l.options[u].value)!==-1;i.push(l)}else l.value=r,l.tagName==="SELECT"&&r!=null&&l.setAttribute("data-ln-value",r),i.push(l)}return i}function be(e,t,{get:n,set:i}){Object.defineProperty(e,"value",{get:function(){return n?n.call(this):t.get.call(this)},set:function(o){i?i.call(this,o,s=>t.set.call(this,s)):t.set.call(this,o)},configurable:!0})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ge,window.lnCore.serializeForm=pe,window.lnCore.resolveFormMethod=me);const Y={};function ye(e,t){Y[e]=t}function Ce(e){return Y[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ye,window.lnCore.getDataMapper=Ce);function F(e){const t=e?e.closest("[lang]"):null,n=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function J(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,N(function(){new MutationObserver(function(){Q(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const z={};function G(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];z[n]=t}function T(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return z[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=G,window.lnCore.getLocaleFallback=T,window.lnCore.ensureLocaleObserver=J);const B={};function _e(e,t){B[e]||(B[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=B[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function X(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],r=c.getAttribute("data-ln-field");t[r]!=null&&(c.textContent=t[r])}const i=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<i.length;l++){const c=i[l],r=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const m=p[0].trim(),a=p[1].trim();t[a]!=null&&c.setAttribute(m,t[a])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const c=o[l],r=c.getAttribute("data-ln-show");r in t&&c.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],r=c.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const p=r[u].trim().split(":");if(p.length!==2)continue;const m=p[0].trim(),a=p[1].trim();a in t&&c.classList.toggle(m,!!t[a])}}return e}function ve(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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<n.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[i],t??null),n[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)X(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function Z(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.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]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let s=0;s<o.length;s++){const l=o[s],c=l.attributes;for(let r=0;r<c.length;r++){const u=c[r];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function Ae(e,t,n,i,o,s){const l={};for(let r=0;r<e.children.length;r++){const u=e.children[r],p=u.getAttribute("data-ln-render-key");p&&(l[p]=u)}const c=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],p=String(i(u));let m=l[p];if(m)o(m,u,r);else{const a=_e(n,s);if(!a||(Z(a,u),m=a.firstElementChild,!m))continue;m.setAttribute("data-ln-render-key",p),o(m,u,r)}c.appendChild(m)}e.textContent="",e.appendChild(c)}function xe(e,t){const n={},i=e.querySelectorAll("["+t+"]");for(let o=0;o<i.length;o++)n[i[o].getAttribute(t)]=i[o].textContent,i[o].remove();return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=Z,window.lnCore.fill=X,window.lnCore.lnFill=ve,window.lnCore.renderList=Ae);function q(e,t,n){const i=e.getAttribute(t);return i===null?n:i}function ee(e,t,n){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?n:i}function te(e,t,n=!1){const i=e.getAttribute(t);if(i===null)return!!n;const o=i.trim().toLowerCase();return!(o==="false"||o==="0")}function ne(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const $=new Map;function re(e,t){const n=(e?e.join("|"):"")+"::"+t;if($.has(n))return $.get(n);const i=new Set(e||[]),o=function(s,l){const c=s.getAttribute(l);return c!==null&&i.has(c)?c:t};return $.set(n,o),o}function oe(e,t,n){const i=parseFloat(e.getAttribute(t));return isNaN(i)?n:i}function ie(e,t,n){const i=e.getAttribute(t);if(!i)return n;try{return JSON.parse(i)}catch{return n}}function le(e,t,n,i,o){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=r=>{o?console.warn(r,o):console.warn(r)};if(l==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const r=e.values||[];return r.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(c(`[${s}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(c(`[${s}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(r){return c(`[${s}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function Se(e,t,n){for(const i in n){const[o,s,l]=n[i];Object.defineProperty(e,i,{get:function(){return o(t,s,l)},enumerable:!0,configurable:!0})}return e}function ke(e){const t={};for(const n in e){const i=e[n];if(!i||!i.prop)continue;let o=i.read;if(!o&&i.type)switch(i.type){case"enum":o=re(i.values,i.fallback);break;case"integer":o=ee;break;case"float":o=oe;break;case"boolean":o=te;break;case"list":o=ne;break;case"json":o=ie;break;case"string":default:o=q;break}o||(o=q),t[i.prop]=[o,n,i.fallback]}return t}function Ee(e){const t={};for(const n in e){const i=e[n];i&&i.effect&&(t[n]=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 n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=Se,window.lnCore.attrSpec=ke,window.lnCore.attrStr=q,window.lnCore.attrInt=ee,window.lnCore.attrBool=te,window.lnCore.attrList=ne,window.lnCore.attrEnum=re,window.lnCore.attrFloat=oe,window.lnCore.attrJson=ie);function L(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(n){console.error("["+t.attribute+"] init failed",e,n)}}}function se(e,t,n,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:n,ComponentFn:i};if(e.matches&&e.matches(s)&&L(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let r=0;r<c.length;r++)L(c[r],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Oe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Te(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 ae(){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 Le(e){const t=ae(),n=e.observed||[];for(let i=0;i<n.length;i++){const o=n[i];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 i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const o=t.byDeclaredAttr.get(i);o.some(s=>s.componentTag===e.componentTag)||o.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 o of i)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function ce(e,t,n,i){for(let o=0;o<e.length;o++){const s=e[o];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,i):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,i)}}function Me(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,i=ae(),o=i.byAttr.get(t),s=K()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!n&&!o&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&R(l)){const c=i.byDeclaredAttr.get(t),r=l.getAttribute(t);for(let u=0;u<c.length;u++)le(c[u].spec,r,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(n||o)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),n){const c=i.byReactive.get(t);c&&ce(c,l,t,e.oldValue),i.reactiveWildcard.length&&ce(i.reactiveWildcard,l,t,e.oldValue)}if(o)for(let c=0;c<o.length;c++){const r=o[c];if(r.handler){r.handler(l,t,e.oldValue);continue}r.onAttributeChange&&l[r.attribute]?r.onAttributeChange(l,t):(se(l,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(l))}}}function Ne(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,N(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{Me(t[n])}catch(i){console.error("[ln-core] mutation handler failed",t[n].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function V(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function j(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function P(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Fe(e){const t=V();if(!t.length)return;const n=e.target;if(n){const o=n.nodeType===1?n:n.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}const i=j();if(e.target&&i.length)for(let o=0;o<i.length;o++){const s=i[o],l=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):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 l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const r=t[c];if(r.selector&&r.attribute&&r.ComponentFn){if(!l)s.matches&&s.matches(r.query)&&L(s,r);else if(s.matches&&s.matches(r.query)&&L(s,r),s.querySelectorAll){const u=s.querySelectorAll(r.query);for(let p=0;p<u.length;p++)L(u[p],r)}}r.onInit&&r.onInit(s)}}}for(let o=0;o<e.removedNodes.length;o++){const s=e.removedNodes[o];if(s.nodeType===1){const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const r=t[c],u=r.query;if(u){if(!l)s.matches&&s.matches(u)&&P(s,r);else if(s.matches&&s.matches(u)&&P(s,r),s.querySelectorAll){const p=s.querySelectorAll(u);for(let m=0;m<p.length;m++)P(p[m],r)}}}}}}function ue(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,N(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const i=t[n];if(i.type==="childList")try{Fe(i)}catch(o){console.error("[ln-core] lifecycle handler failed",i.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ie(e){V().push(e),e.onSubtreeChange&&e.query&&j().push(e),ue()}function de(e,t,n,i,o={}){const s=o.extraAttributes||[],l=o.onAttributeChange||null,c=o.onSubtreeChange||null,r=o.onInit||null,u=o.onAttrChange||null,p=o.effects||null,m=o.attributes||null,a=m?Ee(m):p,d=m?new Set(Object.keys(m)):null,h=o.persist||null;function g(D){const f=D||document.body;if(se(f,e,t,n),m&&K())for(const w in m){const b=m[w],_=Array.from(f.querySelectorAll("["+w+"]"));f.matches&&f.matches("["+w+"]")&&_.push(f);for(let S=0;S<_.length;S++){const E=_[S];R(E)&&le(b,E.getAttribute(w),w,i,E)}}r&&r(f)}const y=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let f;for(;(f=D.exec(e))!==null;)y.push(f[1])}else y.push(e);Le({selector:e,attribute:t,componentTag:i,attributes:m,ComponentFn:n,onInit:r,observed:y.concat(s),onAttributeChange:l,onAttrChange:u,effects:a,declared:d,persist:h}),Ne();const A=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,C=o.subtreeQuery||(A?e:"["+e+"]"),x={selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:c,query:C};V().push(x),c&&C&&j().push(x),ue(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=de,window.lnCore.observeLifecycle=Ie);function k(){Oe()>0?Te(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k(),g}function fe(e){return(e||"").replace(/^#/,"")}function H(e){const t=e===void 0?location.hash:e,n={},i=fe(t);if(!i)return n;const o=i.split("&");for(let s=0;s<o.length;s++){const l=o[s];if(!l)continue;const c=l.indexOf(":"),r=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(r)try{n[r]=decodeURIComponent(u)}catch{n[r]=u}}return n}function Re(e){if(!e)return null;const t=H();return e in t?t[e]:null}function Be(e,t){if(!e)return;const n=H();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");fe(location.hash)!==o&&(location.hash=o)}function qe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function $e(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.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 je(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 Pe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function He(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),i=e.slice(t+1),o=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=H,window.lnCore.hashGet=Re,window.lnCore.hashSet=Be,window.lnCore.hashLinkClick=qe,window.lnCore.resolveHashNamespace=$e,window.lnCore.hashSortEncode=Ve,window.lnCore.hashSortDecode=je,window.lnCore.hashFilterEncode=Pe,window.lnCore.hashFilterDecode=He);function We(){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=We);function v(e){if(e==null||e==="")return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;const t=Number(e);if(!isNaN(t)&&t>0){const n=t<1e11?t*1e3:t,i=new Date(n);return isNaN(i.getTime())?null:i}if(typeof e=="string"){const n=e.trim();if(!n)return null;const i=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n);if(i){const s=+i[1],l=+i[2],c=+i[3],r=new Date(s,l-1,c);return r.getFullYear()!==s||r.getMonth()!==l-1||r.getDate()!==c?null:r}const o=new Date(n);return isNaN(o.getTime())?null:o}return null}function O(e){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return t+"-"+n+"-"+i}const W=/^(short|medium|long)(\s+datetime)?$/,Ue={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},"short datetime":{dateStyle:"short",timeStyle:"short"},"medium datetime":{dateStyle:"medium",timeStyle:"short"},"long datetime":{dateStyle:"long",timeStyle:"short"}};function Ke(e){return!e||e===""?{dateStyle:"medium"}:String(e).trim().match(W)?Ue[e.trim()]:null}function M(e){if(!e||typeof e!="string")return null;const t=e.trim();if(t.length<6)return null;let n,i;if(t.indexOf(".")!==-1)n=".",i=t.split(".");else if(t.indexOf("/")!==-1)n="/",i=t.split("/");else if(t.indexOf("-")!==-1)n="-",i=t.split("-");else return null;if(i.length!==3)return null;const o=[];for(let u=0;u<3;u++){const p=parseInt(i[u],10);if(isNaN(p))return null;o.push(p)}let s,l,c;n==="."?(s=o[0],l=o[1],c=o[2]):n==="/"?(l=o[0],s=o[1],c=o[2]):i[0].length===4?(c=o[0],l=o[1],s=o[2]):(s=o[0],l=o[1],c=o[2]),c<100&&(c+=c<50?2e3:1900);const r=new Date(c,l-1,s);return r.getFullYear()!==c||r.getMonth()!==l-1||r.getDate()!==s?null:r}function U(e,t,n,i){if(!e||!(e instanceof Date)||isNaN(e.getTime())||!t||typeof t!="string")return"";const o=e.getDate(),s=e.getMonth(),l=e.getFullYear(),c=e.getHours(),r=e.getMinutes();let u,p;const m=(n||"").toLowerCase().split("-")[0];let a=!1;try{const g=new Intl.DateTimeFormat(n,{month:"long"}).resolvedOptions().locale.toLowerCase().split("-")[0];a=!!(i&&g!==m)}catch{a=!!i}if(a&&i&&i.monthsLong)u=i.monthsLong[s];else try{u=new Intl.DateTimeFormat(n,{month:"long"}).format(e)}catch{u=String(s+1)}if(a&&i&&i.monthsShort)p=i.monthsShort[s];else try{p=new Intl.DateTimeFormat(n,{month:"short"}).format(e)}catch{p=String(s+1)}const d={yyyy:String(l),yy:String(l).slice(-2),MMMM:u,MMM:p,MM:String(s+1).padStart(2,"0"),M:String(s+1),dd:String(o).padStart(2,"0"),d:String(o),HH:String(c).padStart(2,"0"),mm:String(r).padStart(2,"0")};return t.replace(/yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|mm/g,function(h){return d[h]!==void 0?d[h]:h})}function I(e,t,n,i){if(!e||!(e instanceof Date)||isNaN(e.getTime()))return"";const o=Ke(t);if(o)try{const s=new Intl.DateTimeFormat(n,o),l=(n||"").toLowerCase().split("-")[0],c=s.resolvedOptions().locale.toLowerCase().split("-")[0];return i&&c!==l?U(e,"dd.MM.yyyy",n,i):s.format(e)}catch{return U(e,"dd.MM.yyyy",n,i)}return U(e,t||"dd.MM.yyyy",n,i)}(function(){const e="data-ln-date",t="lnDate";if(window[t]!==void 0)return;function n(a){const d=a[t];if(d){if(d.isTextElement)d._initTextElement();else if(d.value){const h=v(d.value);h&&d._displayFormatted(h)}}}const i={"data-ln-date":{type:"enum",values:["short","medium","long","full","iso"],fallback:"medium",effect:n,description:"Date display style preset or activator"},"data-ln-date-format":{type:"string",effect:n,description:"Custom Intl.DateTimeFormat pattern or options"},"data-ln-date-locale":{type:"string",effect:n,description:"BCP 47 language tag override for date formatting"},"data-ln-value":{type:"string",effect:n,description:"Raw ISO date string or timestamp for non-time elements (td, span)"},"data-ln-date-dict":{type:"marker",description:"Container for date translation dictionary"},"data-ln-date-dict-key":{type:"string",description:"Dictionary key for relative time or custom date formatting"},"data-ln-date-field":{type:"string",description:"Field name mapping for date record binding"},"data-ln-date-label":{type:"string",description:"Accessible label text for the date input"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");function s(a,d,h){Q(a.dom,"ln-date:change",{value:d,formatted:a.dom.value,date:h}),a.dom.dispatchEvent(new Event("change",{bubbles:!0}))}function l(a,d,h,g){a._setHiddenRaw(d),o.set.call(a._picker,d),a._lastISO=d,g!==void 0?(a._isFormatting=!0,a.dom.value=g,a._isFormatting=!1):h&&a._displayFormatted(h),s(a,d,h)}function c(a){a._setHiddenRaw(""),o.set.call(a._picker,""),a._isFormatting=!0,a.dom.value="",a._isFormatting=!1,a._lastISO="",s(a,"",null)}const r=new Set;let u=!1;function p(){J(),!u&&(u=!0,document.addEventListener("ln-core:locale-change",function(){r.forEach(function(a){if(a.isTextElement)a._formatTextContent();else if(a.value){const d=v(a.value);d&&a._displayFormatted(d)}})}))}function m(a){if(a[t])return a[t];a[t]=this,this.dom=a;const d=this;if(r.add(this),p(),a.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;this.isTextElement=!1;const h=a.value,g=a.name,y=a.closest(".form-element, form")||a.parentNode;if(y){const f=y.querySelectorAll("[data-ln-date-dict]");for(let w=0;w<f.length;w++){const b=f[w].getAttribute("data-ln-date-dict");if(b){const _=xe(f[w],"data-ln-date-dict-key");_["months-long"]&&(_.monthsLong=_["months-long"].split(",").map(S=>S.trim())),_["months-short"]&&(_.monthsShort=_["months-short"].split(",").map(S=>S.trim())),G(b,_)}}}const A=document.createElement("span");A.setAttribute("data-ln-date-field",""),a.parentNode.insertBefore(A,a),A.appendChild(a),this._wrapper=A;const C=document.createElement("input");C.type="hidden",C.name=g,a.removeAttribute("name"),a.hasAttribute("data-ln-fill-as")&&C.setAttribute("data-ln-fill-as",a.getAttribute("data-ln-fill-as")),a.insertAdjacentElement("afterend",C),this._hidden=C;const x=document.createElement("input");x.type="date",x.tabIndex=-1,x.setAttribute("tabindex","-1"),x.setAttribute("aria-hidden","true"),x.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Date picker"),x.style.cssText="position:absolute;opacity:0;width:0;height:0;overflow:hidden;pointer-events:none",C.insertAdjacentElement("afterend",x),this._picker=x,a.type="text";const k=document.createElement("button");k.type="button",k.setAttribute("aria-label",a.getAttribute("data-ln-date-label")||"Open date picker"),k.innerHTML='<svg class="ln-icon" aria-hidden="true"><use href="#ln-icon-calendar"></use></svg>',x.insertAdjacentElement("afterend",k),this._btn=k,this._lastISO="",Object.defineProperty(C,"value",{get:function(){return o.get.call(C)},set:function(f){if(o.set.call(C,f),f&&f!==""){const w=v(f);w&&l(d,f,w)}else f===""&&c(d)}}),be(a,o,{get:function(){return o.get.call(a)},set:function(f,w){if(d._isFormatting){w(f);return}if(!f||f===""){w(""),c(d);return}const b=v(f)||M(f);if(b){const _=O(b),S=a.getAttribute(e)||"",E=F(a),Qe=T(E),he=I(b,S,E,Qe);w(he),l(d,_,b,he)}else w(String(f)),c(d)}}),this._onPickerChange=function(){const f=x.value;if(f){const w=v(f);w&&l(d,f,w)}else c(d)},x.addEventListener("change",this._onPickerChange),this._onBlur=function(){const f=d.dom.value.trim();if(f===""){d._lastISO!==""&&c(d);return}if(d._lastISO){const b=v(d._lastISO);if(b){const _=d.dom.getAttribute(e)||"",S=F(d.dom),E=T(S);if(f===I(b,_,S,E))return}}const w=M(f);if(w){const b=O(w);l(d,b,w)}else if(d._lastISO){const b=v(d._lastISO);b&&d._displayFormatted(b)}else d.dom.value=""},a.addEventListener("blur",this._onBlur),this._onBtnClick=function(){d._openPicker()},k.addEventListener("click",this._onBtnClick);const D=a.form;if(D&&(this._form=D,this._onFormReset=function(){setTimeout(function(){const f=d.dom.value;if(f){const w=v(f)||M(f);if(w){const b=O(w);l(d,b,w);return}}c(d)},0)},D.addEventListener("reset",this._onFormReset)),h&&h!==""){const f=v(h);f&&l(d,h,f)}return this}m.prototype._initTextElement=function(){const a=this.dom,d=a.getAttribute("data-ln-value"),h=a.getAttribute("data-ln-date"),g=a.getAttribute("datetime");let y=null;a.tagName==="TIME"&&g!==null&&g!==""?y=g:d!==null&&d!==""?y=d:g!==null&&g!==""?y=g:h!==null&&h!==""&&h!=="true"&&!W.test(h)?y=h:y=a.textContent.trim();const A=v(y)||M(y);if(A&&!isNaN(A.getTime())){const C=O(A);this._rawValue=C,a.tagName!=="TIME"&&!a.hasAttribute("data-ln-value")&&a.setAttribute("data-ln-value",C),this._formatTextContent()}else this._rawValue=null},m.prototype._formatTextContent=function(){if(this._rawValue){const a=v(this._rawValue);if(a){let h=this.dom.getAttribute("data-ln-date-format");if(!h){const A=this.dom.getAttribute("data-ln-date");A&&W.test(A)&&(h=A)}const g=F(this.dom),y=T(g);this.dom.textContent=I(a,h||"medium",g,y)}}},m.prototype._openPicker=function(){if(typeof this._picker.showPicker=="function")try{this._picker.showPicker()}catch{this._picker.click()}else this._picker.click()},m.prototype._setHiddenRaw=function(a){o.set.call(this._hidden,a)},m.prototype._displayFormatted=function(a){const d=this.dom.getAttribute(e)||"",h=F(this.dom),g=T(h);this._isFormatting=!0,this.dom.value=I(a,d,h,g),this._isFormatting=!1},Object.defineProperty(m.prototype,"value",{get:function(){return this.isTextElement?this._rawValue||"":o.get.call(this._hidden)},set:function(a){if(this.isTextElement){if(!a||a===""){this._rawValue=null,this.dom.removeAttribute("data-ln-value"),this.dom.tagName==="TIME"&&this.dom.removeAttribute("datetime"),this.dom.textContent="";return}const h=v(a)||M(a);if(!h)return;const g=O(h);this._rawValue=g,this.dom.tagName==="TIME"?this.dom.setAttribute("datetime",g):this.dom.setAttribute("data-ln-value",g),this._formatTextContent();return}if(!a||a===""){c(this);return}const d=v(a);d&&l(this,a,d)}}),Object.defineProperty(m.prototype,"date",{get:function(){const a=this.value;return a?v(a):null},set:function(a){if(!a||!(a instanceof Date)||isNaN(a.getTime())){this.value="";return}this.value=O(a)}}),Object.defineProperty(m.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:this.dom.value}}),m.prototype.destroy=function(){if(!this.dom[t])return;if(r.delete(this),this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement){delete this.dom[t];return}this._form&&this._onFormReset&&this._form.removeEventListener("reset",this._onFormReset),this._picker.removeEventListener("change",this._onPickerChange),this.dom.removeEventListener("blur",this._onBlur),this._btn.removeEventListener("click",this._onBtnClick);const a=this.value;this._hidden.remove(),this._picker.remove(),this._btn.remove(),this._wrapper&&this._wrapper.parentNode&&(this._wrapper.parentNode.insertBefore(this.dom,this._wrapper),this._wrapper.remove()),delete this.dom.value,this.dom.name=this._hidden.name,this.dom.type="date",a&&(this.dom.value=a),delete this.dom[t]},de(e,t,m,"ln-date",{attributes:i,extraAttributes:["datetime","lang"],onAttributeChange:n})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function W(){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 T(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 r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!T(r))return}e.apply(console,t)}}function D(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function L(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){L(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ue(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ce(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,o={},a=e.elements,s={};if(n)for(let u=0;u<a.length;u++){const i=a[u];i.name&&i.type==="checkbox"&&!i.disabled&&(s[i.name]=(s[i.name]||0)+1)}for(let u=0;u<a.length;u++){const i=a[u];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(r&&i.matches&&i.matches(r)))if(i.type==="checkbox")n&&s[i.name]===1?o[i.name]=i.checked:(o[i.name]||(o[i.name]=[]),i.checked&&o[i.name].push(i.value));else if(i.type==="radio")i.checked&&(o[i.name]=i.value);else if(i.type==="select-multiple"){o[i.name]=[];for(let l=0;l<i.options.length;l++)i.options[l].selected&&o[i.name].push(i.options[l].value)}else if(n&&i.type==="hidden")o[i.name]=i.value;else if(n&&(i.type==="number"||i.type==="range")){const l=Number(i.value);o[i.name]=i.value===""||isNaN(l)?null:l}else o[i.name]=i.value}return o}function de(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function fe(e,t){const n=e.elements,r=[],o={};for(let a=0;a<n.length;a++){const s=n[a];s.name&&s.type==="checkbox"&&(o[s.name]=(o[s.name]||0)+1)}for(let a=0;a<n.length;a++){const s=n[a];if(s.type==="file"||s.type==="submit"||s.type==="button")continue;const u=s.getAttribute("data-ln-fill-as")||s.name;if(!u||!(u in t))continue;const i=t[u];if(s.type==="checkbox"){if(Array.isArray(i))s.checked=i.indexOf(s.value)!==-1;else if(o[s.name]>1){const l=String(i).split(",").map(function(c){return c.trim()});s.checked=l.indexOf(s.value)!==-1}else s.checked=de(i);r.push(s)}else if(s.type==="radio")s.checked=s.value===String(i),r.push(s);else if(s.type==="select-multiple"){if(Array.isArray(i))for(let l=0;l<s.options.length;l++)s.options[l].selected=i.indexOf(s.options[l].value)!==-1;r.push(s)}else s.value=i,s.tagName==="SELECT"&&i!=null&&s.setAttribute("data-ln-value",i),r.push(s)}return r}function he(e,t,{get:n,set:r}){Object.defineProperty(e,"value",{get:function(){return n?n.call(this):t.get.call(this)},set:function(o){r?r.call(this,o,a=>t.set.call(this,a)):t.set.call(this,o)},configurable:!0})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=fe,window.lnCore.serializeForm=ce,window.lnCore.resolveFormMethod=ue);const P={};function we(e,t){P[e]=t}function pe(e){return P[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=we,window.lnCore.getDataMapper=pe);function _(e){const t=e?e.closest("[lang]"):null,n=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function U(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,L(function(){new MutationObserver(function(){D(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const K={};function me(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];K[n]=t}function be(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return K[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=me,window.lnCore.getLocaleFallback=be,window.lnCore.ensureLocaleObserver=U);const I={};function ge(e,t){I[e]||(I[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=I[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function Q(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let s=0;s<n.length;s++){const u=n[s],i=u.getAttribute("data-ln-field");t[i]!=null&&(u.textContent=t[i])}const r=e.querySelectorAll("[data-ln-attr]");for(let s=0;s<r.length;s++){const u=r[s],i=u.getAttribute("data-ln-attr").split(",");for(let l=0;l<i.length;l++){const c=i[l].trim().split(":");if(c.length!==2)continue;const f=c[0].trim(),d=c[1].trim();t[d]!=null&&u.setAttribute(f,t[d])}}const o=e.querySelectorAll("[data-ln-show]");for(let s=0;s<o.length;s++){const u=o[s],i=u.getAttribute("data-ln-show");i in t&&u.classList.toggle("hidden",!t[i])}const a=e.querySelectorAll("[data-ln-class]");for(let s=0;s<a.length;s++){const u=a[s],i=u.getAttribute("data-ln-class").split(",");for(let l=0;l<i.length;l++){const c=i[l].trim().split(":");if(c.length!==2)continue;const f=c[0].trim(),d=c[1].trim();d in t&&u.classList.toggle(f,!!t[d])}}return e}function ye(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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].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)Q(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function G(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const a=n.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(s,u){return t[u]!==void 0?t[u]:""}))}const r=function(a,s){return t[s]!==void 0?t[s]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let a=0;a<o.length;a++){const s=o[a],u=s.attributes;for(let i=0;i<u.length;i++){const l=u[i];l.value.indexOf("{{")!==-1&&s.setAttribute(l.name,l.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function Ce(e,t,n,r,o,a){const s={};for(let i=0;i<e.children.length;i++){const l=e.children[i],c=l.getAttribute("data-ln-render-key");c&&(s[c]=l)}const u=document.createDocumentFragment();for(let i=0;i<t.length;i++){const l=t[i],c=String(r(l));let f=s[c];if(f)o(f,l,i);else{const d=ge(n,a);if(!d||(G(d,l),f=d.firstElementChild,!f))continue;f.setAttribute("data-ln-render-key",c),o(f,l,i)}u.appendChild(f)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=G,window.lnCore.fill=Q,window.lnCore.lnFill=ye,window.lnCore.renderList=Ce);function $(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function J(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function z(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const o=r.trim().toLowerCase();return!(o==="false"||o==="0")}function X(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const q=new Map;function Y(e,t){const n=(e?e.join("|"):"")+"::"+t;if(q.has(n))return q.get(n);const r=new Set(e||[]),o=function(a,s){const u=a.getAttribute(s);return u!==null&&r.has(u)?u:t};return q.set(n,o),o}function Z(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function ee(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function te(e,t,n,r,o){if(!e||t===null)return!0;const a=r||"ln-component",s=e.type;if(s==="trigger"||s==="marker"||s==="string"||s==="list"||!s||t===""&&e.fallback!==void 0)return!0;const u=i=>{o?console.warn(i,o):console.warn(i)};if(s==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(u(`[${a}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(s==="enum"){const i=e.values||[];return i.includes(t)?!0:(u(`[${a}] Invalid value "${t}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(s==="integer"){if(!/^-?\d+$/.test(t))return u(`[${a}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(u(`[${a}] Value ${i} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(u(`[${a}] Value ${i} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(s==="float")return isNaN(Number(t))?(u(`[${a}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(s==="json")try{return JSON.parse(t),!0}catch(i){return u(`[${a}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function _e(e,t,n){for(const r in n){const[o,a,s]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,a,s)},enumerable:!0,configurable:!0})}return e}function ve(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let o=r.read;if(!o&&r.type)switch(r.type){case"enum":o=Y(r.values,r.fallback);break;case"integer":o=J;break;case"float":o=Z;break;case"boolean":o=z;break;case"list":o=X;break;case"json":o=ee;break;case"string":default:o=$;break}o||(o=$),t[r.prop]=[o,n,r.fallback]}return t}function xe(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function Ae(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=_e,window.lnCore.attrSpec=ve,window.lnCore.attrStr=$,window.lnCore.attrInt=J,window.lnCore.attrBool=z,window.lnCore.attrList=X,window.lnCore.attrEnum=Y,window.lnCore.attrFloat=Z,window.lnCore.attrJson=ee);function F(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(n){console.error("["+t.attribute+"] init failed",e,n)}}}function ne(e,t,n,r){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",s={selector:t,attribute:n,ComponentFn:r};if(e.matches&&e.matches(a)&&F(e,s),e.querySelectorAll){const u=e.querySelectorAll(a);for(let i=0;i<u.length;i++)F(u[i],s)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ee(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function De(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 ie(){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 Ne(e){const t=ie(),n=e.observed||[];for(let r=0;r<n.length;r++){const o=n[r];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 r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const o=t.byDeclaredAttr.get(r);o.some(a=>a.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=Ae(e);if(r===null)t.reactiveWildcard.push(e);else for(const o of r)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function re(e,t,n,r){for(let o=0;o<e.length;o++){const a=e[o];if(!t[a.attribute])continue;const s=a.effects&&a.effects[n];s?s(t,n,r):a.onAttrChange&&(!a.declared||a.declared.has(n))&&a.onAttrChange(t,n,r)}}function Se(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,r=ie(),o=r.byAttr.get(t),a=W()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!n&&!o&&!a)return;const s=e.target;if(e.oldValue!==s.getAttribute(t)){if(a&&T(s)){const u=r.byDeclaredAttr.get(t),i=s.getAttribute(t);for(let l=0;l<u.length;l++)te(u[l].spec,i,t,u[l].componentTag,s)}if(window.lnCore._debugSink&&(n||o)&&window.lnCore._debugSink("attr",t,s,{oldValue:e.oldValue,newValue:s.getAttribute(t)}),n){const u=r.byReactive.get(t);u&&re(u,s,t,e.oldValue),r.reactiveWildcard.length&&re(r.reactiveWildcard,s,t,e.oldValue)}if(o)for(let u=0;u<o.length;u++){const i=o[u];if(i.handler){i.handler(s,t,e.oldValue);continue}i.onAttributeChange&&s[i.attribute]?i.onAttributeChange(s,t):(ne(s,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(s))}}}function ke(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,L(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{Se(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function H(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function j(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function M(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Re(e){const t=H();if(!t.length)return;const n=e.target;if(n){const o=n.nodeType===1?n:n.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}const r=j();if(e.target&&r.length)for(let o=0;o<r.length;o++){const a=r[o],s=a.query,u=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;u&&a.onSubtreeChange(u,e)}for(let o=0;o<e.addedNodes.length;o++){const a=e.addedNodes[o];if(a.nodeType===1){const s=!!(a.firstElementChild||a.children&&a.children.length);for(let u=0;u<t.length;u++){const i=t[u];if(i.selector&&i.attribute&&i.ComponentFn){if(!s)a.matches&&a.matches(i.query)&&F(a,i);else if(a.matches&&a.matches(i.query)&&F(a,i),a.querySelectorAll){const l=a.querySelectorAll(i.query);for(let c=0;c<l.length;c++)F(l[c],i)}}i.onInit&&i.onInit(a)}}}for(let o=0;o<e.removedNodes.length;o++){const a=e.removedNodes[o];if(a.nodeType===1){const s=!!(a.firstElementChild||a.children&&a.children.length);for(let u=0;u<t.length;u++){const i=t[u],l=i.query;if(l){if(!s)a.matches&&a.matches(l)&&M(a,i);else if(a.matches&&a.matches(l)&&M(a,i),a.querySelectorAll){const c=a.querySelectorAll(l);for(let f=0;f<c.length;f++)M(c[f],i)}}}}}}function oe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,L(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{Re(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Fe(e){H().push(e),e.onSubtreeChange&&e.query&&j().push(e),oe()}function le(e,t,n,r,o={}){const a=o.extraAttributes||[],s=o.onAttributeChange||null,u=o.onSubtreeChange||null,i=o.onInit||null,l=o.onAttrChange||null,c=o.effects||null,f=o.attributes||null,d=f?xe(f):c,h=f?new Set(Object.keys(f)):null,p=o.persist||null;function m(N){const y=N||document.body;if(ne(y,e,t,n),f&&W())for(const S in f){const g=f[S],x=Array.from(y.querySelectorAll("["+S+"]"));y.matches&&y.matches("["+S+"]")&&x.push(y);for(let R=0;R<x.length;R++){const B=x[R];T(B)&&te(g,B.getAttribute(S),S,r,B)}}i&&i(y)}const w=[];if(e.indexOf("[")!==-1){const N=/\[([\w-]+)/g;let y;for(;(y=N.exec(e))!==null;)w.push(y[1])}else w.push(e);Ne({selector:e,attribute:t,componentTag:r,attributes:f,ComponentFn:n,onInit:i,observed:w.concat(a),onAttributeChange:s,onAttrChange:l,effects:d,declared:h,persist:p}),ke();const b=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,C=o.subtreeQuery||(b?e:"["+e+"]"),E={selector:e,attribute:t,ComponentFn:n,onInit:i,onSubtreeChange:u,query:C};H().push(E),u&&C&&j().push(E),oe(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=le,window.lnCore.observeLifecycle=Fe);function k(){Ee()>0?De(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k(),m}function se(e){return(e||"").replace(/^#/,"")}function V(e){const t=e===void 0?location.hash:e,n={},r=se(t);if(!r)return n;const o=r.split("&");for(let a=0;a<o.length;a++){const s=o[a];if(!s)continue;const u=s.indexOf(":"),i=u>-1?s.slice(0,u):s,l=u>-1?s.slice(u+1):"";if(i)try{n[i]=decodeURIComponent(l)}catch{n[i]=l}}return n}function Le(e){if(!e)return null;const t=V();return e in t?t[e]:null}function Oe(e,t){if(!e)return;const n=V();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(a){const s=n[a];return s===""?a:a+":"+encodeURIComponent(s)}).join("&");se(location.hash)!==o&&(location.hash=o)}function Te(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ie(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function $e(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function qe(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 He(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function je(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),o=r?r.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=V,window.lnCore.hashGet=Le,window.lnCore.hashSet=Oe,window.lnCore.hashLinkClick=Te,window.lnCore.resolveHashNamespace=Ie,window.lnCore.hashSortEncode=$e,window.lnCore.hashSortDecode=qe,window.lnCore.hashFilterEncode=He,window.lnCore.hashFilterDecode=je);function Me(){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=Me);const A={};function O(e){const t=e||"default";if(!A[t]){const n=new Intl.NumberFormat(e,{useGrouping:!0}),r=n.formatToParts(1234.5);let o="",a=".";for(let s=0;s<r.length;s++)r[s].type==="group"&&(o=r[s].value),r[s].type==="decimal"&&(a=r[s].value);A[t]={groupSep:o,decimalSep:a,fmt:n}}return A[t]}function ae(e,t,n){if(e==null||typeof e!="string")return"";let r=e.trim();return r===""?"":(r=r.replace(/[$€£¥]/g,""),t&&(r=r.split(t).join("")),r=r.replace(/\s/g,""),n&&n!=="."&&(r=r.replace(n,".")),r=r.replace(/[^\d.-]/g,""),r)}function Ve(e,t){if(typeof e=="number")return isNaN(e)?NaN:e;if(e==null||typeof e!="string")return NaN;const n=e.trim();if(n===""||n==="-")return NaN;const r=O(t),o=ae(n,r.groupSep,r.decimalSep);if(o===""||o==="-")return NaN;const a=parseFloat(o);return isNaN(a)?NaN:a}function v(e,t,n={}){if(typeof e!="number"||isNaN(e)||!Number.isFinite(e))return"";const r=t||"default",o=n.maxDecimals!=null?parseInt(n.maxDecimals,10):null,a=n.userDecimals!=null?n.userDecimals:null;if(o!==null){const s=r+"|max:"+o;return A[s]||(A[s]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:0,maximumFractionDigits:o})),A[s].format(e)}if(a!==null&&a>0){const s=r+"|exact:"+a;return A[s]||(A[s]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:a,maximumFractionDigits:a})),A[s].format(e)}return O(t).fmt.format(e)}function Be(e,t){if(!e)return 0;if(t<=0)return e.startsWith("-")?1:0;let n=t,r=0;for(let o=0;o<e.length&&n>0;o++)r=o+1,/[0-9]/.test(e[o])&&n--;return n>0&&(r=e.length),r}(function(){const e="data-ln-number",t="lnNumber";if(window[t]!==void 0)return;function n(l){const c=l[t];c&&(c.isTextElement?c._initTextElement():isNaN(c.value)||c._displayFormatted(c.value))}const r={"data-ln-number":{type:"marker",effect:n,description:"Activates localized number formatting on input or text element"},"data-ln-value":{type:"float",effect:n,description:"Raw unformatted numeric value"},"data-ln-number-decimals":{type:"integer",fallback:0,min:0,max:20,effect:n,description:"Number of decimal fraction digits"},"data-ln-number-min":{type:"float",effect:n,description:"Minimum allowed numeric value"},"data-ln-number-max":{type:"float",effect:n,description:"Maximum allowed numeric value"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),a=new Set;let s=!1;function u(){U(),!s&&(s=!0,document.addEventListener("ln-core:locale-change",function(){a.forEach(function(l){l.isTextElement?l._formatTextContent():isNaN(l.value)||l._displayFormatted(l.value)})}))}function i(l){if(l[t])return l[t];if(l[t]=this,this.dom=l,a.add(this),u(),l.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;const c=document.createElement("input");c.type="hidden",c.name=l.name,l.removeAttribute("name"),l.hasAttribute("data-ln-fill-as")&&c.setAttribute("data-ln-fill-as",l.getAttribute("data-ln-fill-as")),l.type="text",l.setAttribute("inputmode","decimal"),l.insertAdjacentElement("afterend",c),this._hidden=c,Object.defineProperty(c,"value",{get:function(){return o.get.call(c)},set:function(d){if(o.set.call(c,d),d!==""&&!isNaN(parseFloat(d))){const h=self.dom.getAttribute("data-ln-number-decimals");self._setDisplayRaw(v(parseFloat(d),_(self.dom),{maxDecimals:h}))}else self._setDisplayRaw("");self.dom.dispatchEvent(new Event("input",{bubbles:!0}))}}),he(l,o,{get:function(){return o.get.call(l)},set:function(d){if(d===""){self._setDisplayRaw(""),self._setHiddenRaw(""),l.dispatchEvent(new Event("input",{bubbles:!0}));return}const h=typeof d=="number"?d:parseFloat(String(d));if(isNaN(h))self._setDisplayRaw(String(d)),self._setHiddenRaw("");else{self._setHiddenRaw(h);const p=l.getAttribute("data-ln-number-decimals");self._setDisplayRaw(v(h,_(l),{maxDecimals:p}))}l.dispatchEvent(new Event("input",{bubbles:!0}))}}),this._onInput=function(){self._handleInput()},l.addEventListener("input",this._onInput),this._onKeyDown=function(d){if(d.key!=="Backspace")return;const h=l.selectionStart,p=l.selectionEnd;if(h!==p||h===0)return;const m=O(_(l)),w=o.get.call(l),b=w[h-1];if(b===m.groupSep||/\s/.test(b)){d.preventDefault();const C=h-2>=0?h-2:0,E=w.slice(0,C)+w.slice(h);o.set.call(l,E),l.setSelectionRange(C,C),l.dispatchEvent(new Event("input",{bubbles:!0}))}},l.addEventListener("keydown",this._onKeyDown),this._onPaste=function(d){d.preventDefault();const h=(d.clipboardData||window.clipboardData).getData("text"),p=Ve(h,_(l));self.value=isNaN(p)?NaN:p},l.addEventListener("paste",this._onPaste);const f=l.value;if(f!==""){const d=parseFloat(f);if(!isNaN(d)){const h=l.getAttribute("data-ln-number-decimals");this._setHiddenRaw(d),this._setDisplayRaw(v(d,_(l),{maxDecimals:h})),l.dispatchEvent(new Event("input",{bubbles:!0}))}}return l.form&&(this._onFormReset=function(){setTimeout(function(){const d=l.defaultValue;if(d!==""){const h=parseFloat(d);if(!isNaN(h)){const p=l.getAttribute("data-ln-number-decimals");self._setHiddenRaw(h),self._setDisplayRaw(v(h,_(l),{maxDecimals:p})),l.dispatchEvent(new Event("input",{bubbles:!0}));return}}self._setHiddenRaw(""),self._setDisplayRaw(""),l.dispatchEvent(new Event("input",{bubbles:!0}))},0)},l.form.addEventListener("reset",this._onFormReset)),this}i.prototype._initTextElement=function(){const l=this.dom;let c=l.getAttribute("data-ln-value"),f=l.getAttribute("data-ln-number"),d=null;c!==null&&c!==""?d=c:f!==null&&f!==""&&f!=="true"?d=f:d=l.textContent.trim();const h=parseFloat(d);isNaN(h)?this._rawValue=null:(this._rawValue=h,l.hasAttribute("data-ln-value")||l.setAttribute("data-ln-value",String(h)),this._formatTextContent())},i.prototype._formatTextContent=function(){if(this._rawValue!==null&&!isNaN(this._rawValue)){const l=this.dom.getAttribute("data-ln-number-decimals");this.dom.textContent=v(this._rawValue,_(this.dom),{maxDecimals:l})}},i.prototype._handleInput=function(){const l=this.dom,c=o.get.call(l);if(c===""){this._setHiddenRaw(""),D(l,"ln-number:input",{value:NaN,formatted:""});return}if(c==="-"){this._setHiddenRaw(""),D(l,"ln-number:input",{value:NaN,formatted:"-"});return}const f=l.selectionStart;let d=0;for(let g=0;g<f;g++)/[0-9]/.test(c[g])&&d++;const h=_(l),p=O(h);let m=c,w=ae(c,p.groupSep,p.decimalSep),b=parseFloat(w);if(isNaN(b)){this._setHiddenRaw(""),D(l,"ln-number:input",{value:NaN,formatted:c});return}const C=l.getAttribute("data-ln-number-decimals"),E=w.indexOf(".");if(C!==null&&E!==-1){const g=parseInt(C,10),x=w.slice(E+1);if(g===0)w=w.slice(0,E),m=m.split(p.decimalSep)[0],b=parseFloat(w),this._setDisplayRaw(m);else if(x.length>g){w=w.slice(0,E+1+g);const R=m.split(p.decimalSep);m=R[0]+p.decimalSep+R[1].slice(0,g),b=parseFloat(w),this._setDisplayRaw(m)}}const k=l.getAttribute("data-ln-number-max");if(k!==null&&b>parseFloat(k)){const g=parseFloat(k),x=v(g,h,{maxDecimals:C});this._setDisplayRaw(x),this._setHiddenRaw(g),l.setSelectionRange(x.length,x.length),D(l,"ln-number:input",{value:g,formatted:x});return}if(m.endsWith(p.decimalSep)||p.decimalSep!=="."&&m.endsWith(".")){this._setHiddenRaw(b),D(l,"ln-number:input",{value:b,formatted:m});return}const N=w.indexOf(".");if(N!==-1&&w.slice(N+1).endsWith("0")){this._setHiddenRaw(b),D(l,"ln-number:input",{value:b,formatted:m});return}let y;if(C!==null)y=v(b,h,{maxDecimals:C});else{const g=N!==-1?w.slice(N+1).length:0;y=v(b,h,{userDecimals:g})}this._setDisplayRaw(y);const S=Be(y,d);l.setSelectionRange(S,S),this._setHiddenRaw(b),D(l,"ln-number:input",{value:b,formatted:y})},i.prototype._setHiddenRaw=function(l){this._hidden&&o.set.call(this._hidden,String(l))},i.prototype._setDisplayRaw=function(l){this.isTextElement?this.dom.textContent=String(l):o.set.call(this.dom,String(l))},i.prototype._displayFormatted=function(l){if(this.isTextElement)this._formatTextContent();else{const c=this.dom.getAttribute("data-ln-number-decimals");this._setDisplayRaw(v(l,_(this.dom),{maxDecimals:c}))}},Object.defineProperty(i.prototype,"value",{get:function(){if(this.isTextElement)return this._rawValue;const l=o.get.call(this._hidden);return l===""?NaN:parseFloat(l)},set:function(l){const c=typeof l=="number"?l:parseFloat(l);if(this.isTextElement){isNaN(c)?(this._rawValue=null,this.dom.textContent=""):(this._rawValue=c,this.dom.setAttribute("data-ln-value",String(c)),this._formatTextContent());return}if(isNaN(c)){this._setDisplayRaw(""),this._setHiddenRaw(""),this.dom.dispatchEvent(new Event("input",{bubbles:!0}));return}this._setHiddenRaw(c);const f=this.dom.getAttribute("data-ln-number-decimals");this._setDisplayRaw(v(c,_(this.dom),{maxDecimals:f})),this.dom.dispatchEvent(new Event("input",{bubbles:!0}))}}),Object.defineProperty(i.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:o.get.call(this.dom)}}),i.prototype.destroy=function(){this.dom[t]&&(a.delete(this),this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement||(this._onFormReset&&this.dom.form&&this.dom.form.removeEventListener("reset",this._onFormReset),this.dom.removeEventListener("input",this._onInput),this.dom.removeEventListener("keydown",this._onKeyDown),this.dom.removeEventListener("paste",this._onPaste),this._hidden&&(this.dom.name=this._hidden.name,this._hidden.remove()),this.dom.type="number",this.dom.removeAttribute("inputmode")),delete this.dom[t])},le(e,t,i,"ln-number",{attributes:r,extraAttributes:["lang"],onAttributeChange:n})})()})();
|
|
1
|
+
(function(){"use strict";function W(){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 T(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 r=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){r=t[o];break}if(!T(r))return}e.apply(console,t)}}function D(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function L(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){L(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ue(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ce(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,o={},a=e.elements,s={};if(n)for(let u=0;u<a.length;u++){const i=a[u];i.name&&i.type==="checkbox"&&!i.disabled&&(s[i.name]=(s[i.name]||0)+1)}for(let u=0;u<a.length;u++){const i=a[u];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(r&&i.matches&&i.matches(r)))if(i.type==="checkbox")n&&s[i.name]===1?o[i.name]=i.checked:(o[i.name]||(o[i.name]=[]),i.checked&&o[i.name].push(i.value));else if(i.type==="radio")i.checked&&(o[i.name]=i.value);else if(i.type==="select-multiple"){o[i.name]=[];for(let l=0;l<i.options.length;l++)i.options[l].selected&&o[i.name].push(i.options[l].value)}else if(n&&i.type==="hidden")o[i.name]=i.value;else if(n&&(i.type==="number"||i.type==="range")){const l=Number(i.value);o[i.name]=i.value===""||isNaN(l)?null:l}else o[i.name]=i.value}return o}function de(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function fe(e,t){const n=e.elements,r=[],o={};for(let a=0;a<n.length;a++){const s=n[a];s.name&&s.type==="checkbox"&&(o[s.name]=(o[s.name]||0)+1)}for(let a=0;a<n.length;a++){const s=n[a];if(s.type==="file"||s.type==="submit"||s.type==="button")continue;const u=s.getAttribute("data-ln-fill-as")||s.name;if(!u||!(u in t))continue;const i=t[u];if(s.type==="checkbox"){if(Array.isArray(i))s.checked=i.indexOf(s.value)!==-1;else if(o[s.name]>1){const l=String(i).split(",").map(function(c){return c.trim()});s.checked=l.indexOf(s.value)!==-1}else s.checked=de(i);r.push(s)}else if(s.type==="radio")s.checked=s.value===String(i),r.push(s);else if(s.type==="select-multiple"){if(Array.isArray(i))for(let l=0;l<s.options.length;l++)s.options[l].selected=i.indexOf(s.options[l].value)!==-1;r.push(s)}else s.value=i,s.tagName==="SELECT"&&i!=null&&s.setAttribute("data-ln-value",i),r.push(s)}return r}function he(e,t,{get:n,set:r}){Object.defineProperty(e,"value",{get:function(){return n?n.call(this):t.get.call(this)},set:function(o){r?r.call(this,o,a=>t.set.call(this,a)):t.set.call(this,o)},configurable:!0})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=fe,window.lnCore.serializeForm=ce,window.lnCore.resolveFormMethod=ue);const P={};function we(e,t){P[e]=t}function pe(e){return P[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=we,window.lnCore.getDataMapper=pe);function v(e){const t=e?e.closest("[lang]"):null,n=(t?t.getAttribute("lang")||t.lang:null)||(typeof document<"u"&&document.documentElement?document.documentElement.getAttribute("lang")||document.documentElement.lang:null)||(typeof navigator<"u"?navigator.language:null);return n?n.trim():"en-US"}function U(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,L(function(){new MutationObserver(function(){D(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const K={};function me(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];K[n]=t}function be(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return K[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=me,window.lnCore.getLocaleFallback=be,window.lnCore.ensureLocaleObserver=U);const I={};function ge(e,t){I[e]||(I[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=I[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function Q(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let s=0;s<n.length;s++){const u=n[s],i=u.getAttribute("data-ln-field");t[i]!=null&&(u.textContent=t[i])}const r=e.querySelectorAll("[data-ln-attr]");for(let s=0;s<r.length;s++){const u=r[s],i=u.getAttribute("data-ln-attr").split(",");for(let l=0;l<i.length;l++){const c=i[l].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),p=c[1].trim();t[p]!=null&&u.setAttribute(d,t[p])}}const o=e.querySelectorAll("[data-ln-show]");for(let s=0;s<o.length;s++){const u=o[s],i=u.getAttribute("data-ln-show");i in t&&u.classList.toggle("hidden",!t[i])}const a=e.querySelectorAll("[data-ln-class]");for(let s=0;s<a.length;s++){const u=a[s],i=u.getAttribute("data-ln-class").split(",");for(let l=0;l<i.length;l++){const c=i[l].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),p=c[1].trim();p in t&&u.classList.toggle(d,!!t[p])}}return e}function ye(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 n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].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)Q(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function G(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const a=n.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(s,u){return t[u]!==void 0?t[u]:""}))}const r=function(a,s){return t[s]!==void 0?t[s]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let a=0;a<o.length;a++){const s=o[a],u=s.attributes;for(let i=0;i<u.length;i++){const l=u[i];l.value.indexOf("{{")!==-1&&s.setAttribute(l.name,l.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function Ce(e,t,n,r,o,a){const s={};for(let i=0;i<e.children.length;i++){const l=e.children[i],c=l.getAttribute("data-ln-render-key");c&&(s[c]=l)}const u=document.createDocumentFragment();for(let i=0;i<t.length;i++){const l=t[i],c=String(r(l));let d=s[c];if(d)o(d,l,i);else{const p=ge(n,a);if(!p||(G(p,l),d=p.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",c),o(d,l,i)}u.appendChild(d)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=G,window.lnCore.fill=Q,window.lnCore.lnFill=ye,window.lnCore.renderList=Ce);function $(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function J(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function z(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const o=r.trim().toLowerCase();return!(o==="false"||o==="0")}function X(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const q=new Map;function Y(e,t){const n=(e?e.join("|"):"")+"::"+t;if(q.has(n))return q.get(n);const r=new Set(e||[]),o=function(a,s){const u=a.getAttribute(s);return u!==null&&r.has(u)?u:t};return q.set(n,o),o}function Z(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function ee(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function te(e,t,n,r,o){if(!e||t===null)return!0;const a=r||"ln-component",s=e.type;if(s==="trigger"||s==="marker"||s==="string"||s==="list"||!s||t===""&&e.fallback!==void 0)return!0;const u=i=>{o?console.warn(i,o):console.warn(i)};if(s==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(u(`[${a}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(s==="enum"){const i=e.values||[];return i.includes(t)?!0:(u(`[${a}] Invalid value "${t}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(s==="integer"){if(!/^-?\d+$/.test(t))return u(`[${a}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(u(`[${a}] Value ${i} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(u(`[${a}] Value ${i} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(s==="float")return isNaN(Number(t))?(u(`[${a}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(s==="json")try{return JSON.parse(t),!0}catch(i){return u(`[${a}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function _e(e,t,n){for(const r in n){const[o,a,s]=n[r];Object.defineProperty(e,r,{get:function(){return o(t,a,s)},enumerable:!0,configurable:!0})}return e}function ve(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let o=r.read;if(!o&&r.type)switch(r.type){case"enum":o=Y(r.values,r.fallback);break;case"integer":o=J;break;case"float":o=Z;break;case"boolean":o=z;break;case"list":o=X;break;case"json":o=ee;break;case"string":default:o=$;break}o||(o=$),t[r.prop]=[o,n,r.fallback]}return t}function xe(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function Ae(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=_e,window.lnCore.attrSpec=ve,window.lnCore.attrStr=$,window.lnCore.attrInt=J,window.lnCore.attrBool=z,window.lnCore.attrList=X,window.lnCore.attrEnum=Y,window.lnCore.attrFloat=Z,window.lnCore.attrJson=ee);function F(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(n){console.error("["+t.attribute+"] init failed",e,n)}}}function ne(e,t,n,r){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",s={selector:t,attribute:n,ComponentFn:r};if(e.matches&&e.matches(a)&&F(e,s),e.querySelectorAll){const u=e.querySelectorAll(a);for(let i=0;i<u.length;i++)F(u[i],s)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ee(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function De(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 ie(){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 Ne(e){const t=ie(),n=e.observed||[];for(let r=0;r<n.length;r++){const o=n[r];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 r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const o=t.byDeclaredAttr.get(r);o.some(a=>a.componentTag===e.componentTag)||o.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=Ae(e);if(r===null)t.reactiveWildcard.push(e);else for(const o of r)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function re(e,t,n,r){for(let o=0;o<e.length;o++){const a=e[o];if(!t[a.attribute])continue;const s=a.effects&&a.effects[n];s?s(t,n,r):a.onAttrChange&&(!a.declared||a.declared.has(n))&&a.onAttrChange(t,n,r)}}function Se(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,r=ie(),o=r.byAttr.get(t),a=W()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!n&&!o&&!a)return;const s=e.target;if(e.oldValue!==s.getAttribute(t)){if(a&&T(s)){const u=r.byDeclaredAttr.get(t),i=s.getAttribute(t);for(let l=0;l<u.length;l++)te(u[l].spec,i,t,u[l].componentTag,s)}if(window.lnCore._debugSink&&(n||o)&&window.lnCore._debugSink("attr",t,s,{oldValue:e.oldValue,newValue:s.getAttribute(t)}),n){const u=r.byReactive.get(t);u&&re(u,s,t,e.oldValue),r.reactiveWildcard.length&&re(r.reactiveWildcard,s,t,e.oldValue)}if(o)for(let u=0;u<o.length;u++){const i=o[u];if(i.handler){i.handler(s,t,e.oldValue);continue}i.onAttributeChange&&s[i.attribute]?i.onAttributeChange(s,t):(ne(s,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(s))}}}function ke(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,L(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{Se(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function H(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function j(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function M(e,t){if(!document.contains(e))if(t.attribute){const n=e[t.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Re(e){const t=H();if(!t.length)return;const n=e.target;if(n){const o=n.nodeType===1?n:n.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}const r=j();if(e.target&&r.length)for(let o=0;o<r.length;o++){const a=r[o],s=a.query,u=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;u&&a.onSubtreeChange(u,e)}for(let o=0;o<e.addedNodes.length;o++){const a=e.addedNodes[o];if(a.nodeType===1){const s=!!(a.firstElementChild||a.children&&a.children.length);for(let u=0;u<t.length;u++){const i=t[u];if(i.selector&&i.attribute&&i.ComponentFn){if(!s)a.matches&&a.matches(i.query)&&F(a,i);else if(a.matches&&a.matches(i.query)&&F(a,i),a.querySelectorAll){const l=a.querySelectorAll(i.query);for(let c=0;c<l.length;c++)F(l[c],i)}}i.onInit&&i.onInit(a)}}}for(let o=0;o<e.removedNodes.length;o++){const a=e.removedNodes[o];if(a.nodeType===1){const s=!!(a.firstElementChild||a.children&&a.children.length);for(let u=0;u<t.length;u++){const i=t[u],l=i.query;if(l){if(!s)a.matches&&a.matches(l)&&M(a,i);else if(a.matches&&a.matches(l)&&M(a,i),a.querySelectorAll){const c=a.querySelectorAll(l);for(let d=0;d<c.length;d++)M(c[d],i)}}}}}}function oe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,L(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{Re(r)}catch(o){console.error("[ln-core] lifecycle handler failed",r.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Fe(e){H().push(e),e.onSubtreeChange&&e.query&&j().push(e),oe()}function le(e,t,n,r,o={}){const a=o.extraAttributes||[],s=o.onAttributeChange||null,u=o.onSubtreeChange||null,i=o.onInit||null,l=o.onAttrChange||null,c=o.effects||null,d=o.attributes||null,p=d?xe(d):c,f=d?new Set(Object.keys(d)):null,h=o.persist||null;function w(S){const y=S||document.body;if(ne(y,e,t,n),d&&W())for(const k in d){const g=d[k],A=Array.from(y.querySelectorAll("["+k+"]"));y.matches&&y.matches("["+k+"]")&&A.push(y);for(let R=0;R<A.length;R++){const B=A[R];T(B)&&te(g,B.getAttribute(k),k,r,B)}}i&&i(y)}const m=[];if(e.indexOf("[")!==-1){const S=/\[([\w-]+)/g;let y;for(;(y=S.exec(e))!==null;)m.push(y[1])}else m.push(e);Ne({selector:e,attribute:t,componentTag:r,attributes:d,ComponentFn:n,onInit:i,observed:m.concat(a),onAttributeChange:s,onAttrChange:l,effects:p,declared:f,persist:h}),ke();const b=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,C=o.subtreeQuery||(b?e:"["+e+"]"),_={selector:e,attribute:t,ComponentFn:n,onInit:i,onSubtreeChange:u,query:C};H().push(_),u&&C&&j().push(_),oe(),window[t]=w,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=le,window.lnCore.observeLifecycle=Fe);function N(){Ee()>0?De(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N):N(),w}function se(e){return(e||"").replace(/^#/,"")}function V(e){const t=e===void 0?location.hash:e,n={},r=se(t);if(!r)return n;const o=r.split("&");for(let a=0;a<o.length;a++){const s=o[a];if(!s)continue;const u=s.indexOf(":"),i=u>-1?s.slice(0,u):s,l=u>-1?s.slice(u+1):"";if(i)try{n[i]=decodeURIComponent(l)}catch{n[i]=l}}return n}function Le(e){if(!e)return null;const t=V();return e in t?t[e]:null}function Oe(e,t){if(!e)return;const n=V();t==null?delete n[e]:n[e]=String(t);const o=Object.keys(n).map(function(a){const s=n[a];return s===""?a:a+":"+encodeURIComponent(s)}).join("&");se(location.hash)!==o&&(location.hash=o)}function Te(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ie(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function $e(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function qe(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 He(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function je(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),o=r?r.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:n,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=V,window.lnCore.hashGet=Le,window.lnCore.hashSet=Oe,window.lnCore.hashLinkClick=Te,window.lnCore.resolveHashNamespace=Ie,window.lnCore.hashSortEncode=$e,window.lnCore.hashSortDecode=qe,window.lnCore.hashFilterEncode=He,window.lnCore.hashFilterDecode=je);function Me(){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=Me);const E={};function O(e){const t=e||"default";if(!E[t]){const n=new Intl.NumberFormat(e,{useGrouping:!0}),r=n.formatToParts(1234.5);let o="",a=".";for(let s=0;s<r.length;s++)r[s].type==="group"&&(o=r[s].value),r[s].type==="decimal"&&(a=r[s].value);E[t]={groupSep:o,decimalSep:a,fmt:n}}return E[t]}function ae(e,t,n){if(e==null||typeof e!="string")return"";let r=e.trim();return r===""?"":(r=r.replace(/[$€£¥]/g,""),t&&(r=r.split(t).join("")),r=r.replace(/\s/g,""),n&&n!=="."&&(r=r.replace(n,".")),r=r.replace(/[^\d.-]/g,""),r)}function Ve(e,t){if(typeof e=="number")return isNaN(e)?NaN:e;if(e==null||typeof e!="string")return NaN;const n=e.trim();if(n===""||n==="-")return NaN;const r=O(t),o=ae(n,r.groupSep,r.decimalSep);if(o===""||o==="-")return NaN;const a=parseFloat(o);return isNaN(a)?NaN:a}function x(e,t,n={}){if(typeof e!="number"||isNaN(e)||!Number.isFinite(e))return"";const r=t||"default",o=n.maxDecimals!=null?parseInt(n.maxDecimals,10):null,a=n.userDecimals!=null?n.userDecimals:null;if(o!==null){const s=r+"|max:"+o;return E[s]||(E[s]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:0,maximumFractionDigits:o})),E[s].format(e)}if(a!==null&&a>0){const s=r+"|exact:"+a;return E[s]||(E[s]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:a,maximumFractionDigits:a})),E[s].format(e)}return O(t).fmt.format(e)}function Be(e,t){if(!e)return 0;if(t<=0)return e.startsWith("-")?1:0;let n=t,r=0;for(let o=0;o<e.length&&n>0;o++)r=o+1,/[0-9]/.test(e[o])&&n--;return n>0&&(r=e.length),r}(function(){const e="data-ln-number",t="lnNumber";if(window[t]!==void 0)return;function n(l){const c=l[t];c&&(c.isTextElement?c._initTextElement():isNaN(c.value)||c._displayFormatted(c.value))}const r={"data-ln-number":{type:"marker",effect:n,description:"Activates localized number formatting on input or text element"},"data-ln-value":{type:"float",effect:n,description:"Raw unformatted numeric value"},"data-ln-number-decimals":{type:"integer",fallback:0,min:0,max:20,effect:n,description:"Number of decimal fraction digits"},"data-ln-number-min":{type:"float",effect:n,description:"Minimum allowed numeric value"},"data-ln-number-max":{type:"float",effect:n,description:"Maximum allowed numeric value"}},o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),a=new Set;let s=!1;function u(){U(),!s&&(s=!0,document.addEventListener("ln-core:locale-change",function(){a.forEach(function(l){l.isTextElement?l._formatTextContent():isNaN(l.value)||l._displayFormatted(l.value)})}))}function i(l){if(l[t])return l[t];l[t]=this,this.dom=l;const c=this;if(a.add(this),u(),l.tagName!=="INPUT")return this.isTextElement=!0,this._initTextElement(),this;const d=document.createElement("input");d.type="hidden",d.name=l.name,l.removeAttribute("name"),l.hasAttribute("data-ln-fill-as")&&d.setAttribute("data-ln-fill-as",l.getAttribute("data-ln-fill-as")),l.type="text",l.setAttribute("inputmode","decimal"),l.insertAdjacentElement("afterend",d),this._hidden=d,Object.defineProperty(d,"value",{get:function(){return o.get.call(d)},set:function(f){if(o.set.call(d,f),f!==""&&!isNaN(parseFloat(f))){const h=c.dom.getAttribute("data-ln-number-decimals");c._setDisplayRaw(x(parseFloat(f),v(c.dom),{maxDecimals:h}))}else c._setDisplayRaw("");c.dom.dispatchEvent(new Event("input",{bubbles:!0}))}}),he(l,o,{get:function(){return o.get.call(l)},set:function(f){if(f===""){c._setDisplayRaw(""),c._setHiddenRaw(""),l.dispatchEvent(new Event("input",{bubbles:!0}));return}const h=typeof f=="number"?f:parseFloat(String(f));if(isNaN(h))c._setDisplayRaw(String(f)),c._setHiddenRaw("");else{c._setHiddenRaw(h);const w=l.getAttribute("data-ln-number-decimals");c._setDisplayRaw(x(h,v(l),{maxDecimals:w}))}l.dispatchEvent(new Event("input",{bubbles:!0}))}}),this._onInput=function(){c._handleInput()},l.addEventListener("input",this._onInput),this._onKeyDown=function(f){if(f.key!=="Backspace")return;const h=l.selectionStart,w=l.selectionEnd;if(h!==w||h===0)return;const m=O(v(l)),b=o.get.call(l),C=b[h-1];if(C===m.groupSep||/\s/.test(C)){f.preventDefault();const _=h-2>=0?h-2:0,N=b.slice(0,_)+b.slice(h);o.set.call(l,N),l.setSelectionRange(_,_),l.dispatchEvent(new Event("input",{bubbles:!0}))}},l.addEventListener("keydown",this._onKeyDown),this._onPaste=function(f){f.preventDefault();const h=(f.clipboardData||window.clipboardData).getData("text"),w=Ve(h,v(l));c.value=isNaN(w)?NaN:w},l.addEventListener("paste",this._onPaste);const p=l.value;if(p!==""){const f=parseFloat(p);if(!isNaN(f)){const h=l.getAttribute("data-ln-number-decimals");this._setHiddenRaw(f),this._setDisplayRaw(x(f,v(l),{maxDecimals:h})),l.dispatchEvent(new Event("input",{bubbles:!0}))}}return l.form&&(this._onFormReset=function(){setTimeout(function(){const f=l.defaultValue;if(f!==""){const h=parseFloat(f);if(!isNaN(h)){const w=l.getAttribute("data-ln-number-decimals");c._setHiddenRaw(h),c._setDisplayRaw(x(h,v(l),{maxDecimals:w})),l.dispatchEvent(new Event("input",{bubbles:!0}));return}}c._setHiddenRaw(""),c._setDisplayRaw(""),l.dispatchEvent(new Event("input",{bubbles:!0}))},0)},l.form.addEventListener("reset",this._onFormReset)),this}i.prototype._initTextElement=function(){const l=this.dom;let c=l.getAttribute("data-ln-value"),d=l.getAttribute("data-ln-number"),p=null;c!==null&&c!==""?p=c:d!==null&&d!==""&&d!=="true"?p=d:p=l.textContent.trim();const f=parseFloat(p);isNaN(f)?this._rawValue=null:(this._rawValue=f,l.hasAttribute("data-ln-value")||l.setAttribute("data-ln-value",String(f)),this._formatTextContent())},i.prototype._formatTextContent=function(){if(this._rawValue!==null&&!isNaN(this._rawValue)){const l=this.dom.getAttribute("data-ln-number-decimals");this.dom.textContent=x(this._rawValue,v(this.dom),{maxDecimals:l})}},i.prototype._handleInput=function(){const l=this.dom,c=o.get.call(l);if(c===""){this._setHiddenRaw(""),D(l,"ln-number:input",{value:NaN,formatted:""});return}if(c==="-"){this._setHiddenRaw(""),D(l,"ln-number:input",{value:NaN,formatted:"-"});return}const d=l.selectionStart;let p=0;for(let g=0;g<d;g++)/[0-9]/.test(c[g])&&p++;const f=v(l),h=O(f);let w=c,m=ae(c,h.groupSep,h.decimalSep),b=parseFloat(m);if(isNaN(b)){this._setHiddenRaw(""),D(l,"ln-number:input",{value:NaN,formatted:c});return}const C=l.getAttribute("data-ln-number-decimals"),_=m.indexOf(".");if(C!==null&&_!==-1){const g=parseInt(C,10),A=m.slice(_+1);if(g===0)m=m.slice(0,_),w=w.split(h.decimalSep)[0],b=parseFloat(m),this._setDisplayRaw(w);else if(A.length>g){m=m.slice(0,_+1+g);const R=w.split(h.decimalSep);w=R[0]+h.decimalSep+R[1].slice(0,g),b=parseFloat(m),this._setDisplayRaw(w)}}const N=l.getAttribute("data-ln-number-max");if(N!==null&&b>parseFloat(N)){const g=parseFloat(N),A=x(g,f,{maxDecimals:C});this._setDisplayRaw(A),this._setHiddenRaw(g),l.setSelectionRange(A.length,A.length),D(l,"ln-number:input",{value:g,formatted:A});return}if(w.endsWith(h.decimalSep)||h.decimalSep!=="."&&w.endsWith(".")){this._setHiddenRaw(b),D(l,"ln-number:input",{value:b,formatted:w});return}const S=m.indexOf(".");if(S!==-1&&m.slice(S+1).endsWith("0")){this._setHiddenRaw(b),D(l,"ln-number:input",{value:b,formatted:w});return}let y;if(C!==null)y=x(b,f,{maxDecimals:C});else{const g=S!==-1?m.slice(S+1).length:0;y=x(b,f,{userDecimals:g})}this._setDisplayRaw(y);const k=Be(y,p);l.setSelectionRange(k,k),this._setHiddenRaw(b),D(l,"ln-number:input",{value:b,formatted:y})},i.prototype._setHiddenRaw=function(l){this._hidden&&o.set.call(this._hidden,String(l))},i.prototype._setDisplayRaw=function(l){this.isTextElement?this.dom.textContent=String(l):o.set.call(this.dom,String(l))},i.prototype._displayFormatted=function(l){if(this.isTextElement)this._formatTextContent();else{const c=this.dom.getAttribute("data-ln-number-decimals");this._setDisplayRaw(x(l,v(this.dom),{maxDecimals:c}))}},Object.defineProperty(i.prototype,"value",{get:function(){if(this.isTextElement)return this._rawValue;const l=o.get.call(this._hidden);return l===""?NaN:parseFloat(l)},set:function(l){const c=typeof l=="number"?l:parseFloat(l);if(this.isTextElement){isNaN(c)?(this._rawValue=null,this.dom.textContent=""):(this._rawValue=c,this.dom.setAttribute("data-ln-value",String(c)),this._formatTextContent());return}if(isNaN(c)){this._setDisplayRaw(""),this._setHiddenRaw(""),this.dom.dispatchEvent(new Event("input",{bubbles:!0}));return}this._setHiddenRaw(c);const d=this.dom.getAttribute("data-ln-number-decimals");this._setDisplayRaw(x(c,v(this.dom),{maxDecimals:d})),this.dom.dispatchEvent(new Event("input",{bubbles:!0}))}}),Object.defineProperty(i.prototype,"formatted",{get:function(){return this.isTextElement?this.dom.textContent:o.get.call(this.dom)}}),i.prototype.destroy=function(){this.dom[t]&&(a.delete(this),this._onLocaleChange&&document.removeEventListener("ln-core:locale-change",this._onLocaleChange),this.isTextElement||(this._onFormReset&&this.dom.form&&this.dom.form.removeEventListener("reset",this._onFormReset),this.dom.removeEventListener("input",this._onInput),this.dom.removeEventListener("keydown",this._onKeyDown),this.dom.removeEventListener("paste",this._onPaste),this._hidden&&(this.dom.name=this._hidden.name,this._hidden.remove()),this.dom.type="number",this.dom.removeAttribute("inputmode")),delete this.dom[t])},le(e,t,i,"ln-number",{attributes:r,extraAttributes:["lang"],onAttributeChange:n})})()})();
|
package/package.json
CHANGED