@livenetworks/ashlar 2.0.10 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-ajax/src/ln-ajax.js +15 -26
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/helpers.js +1 -1
- package/components/ln-core/index.js +1 -1
- package/components/ln-core/lifecycle.js +97 -40
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-external-links/src/ln-external-links.js +9 -21
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-icon/ln-icon.js +1 -1
- package/components/ln-icon/src/ln-icon.js +14 -16
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-link/src/ln-link.js +16 -26
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-nav/src/ln-nav.js +5 -4
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-persist/ln-persist.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-progress/src/ln-progress.js +9 -21
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function N(){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 k(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 o=null;for(let a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){o=t[a];break}if(!k(o))return}e.apply(console,t)}}function h(e,t,r){const o=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function v(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function oe(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ie(e,t){const r=!!(t&&t.typed),o=t&&t.exclude,a={},l=e.elements,i={};if(r)for(let u=0;u<l.length;u++){const s=l[u];s.name&&s.type==="checkbox"&&!s.disabled&&(i[s.name]=(i[s.name]||0)+1)}for(let u=0;u<l.length;u++){const s=l[u];if(!(!s.name||s.disabled||s.type==="file"||s.type==="submit"||s.type==="button")&&!(o&&s.matches&&s.matches(o)))if(s.type==="checkbox")r&&i[s.name]===1?a[s.name]=s.checked:(a[s.name]||(a[s.name]=[]),s.checked&&a[s.name].push(s.value));else if(s.type==="radio")s.checked&&(a[s.name]=s.value);else if(s.type==="select-multiple"){a[s.name]=[];for(let n=0;n<s.options.length;n++)s.options[n].selected&&a[s.name].push(s.options[n].value)}else if(r&&s.type==="hidden")a[s.name]=s.value;else if(r&&(s.type==="number"||s.type==="range")){const n=Number(s.value);a[s.name]=s.value===""||isNaN(n)?null:n}else a[s.name]=s.value}return a}function se(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ae(e,t){const r=e.elements,o=[],a={};for(let l=0;l<r.length;l++){const i=r[l];i.name&&i.type==="checkbox"&&(a[i.name]=(a[i.name]||0)+1)}for(let l=0;l<r.length;l++){const i=r[l];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const u=i.getAttribute("data-ln-fill-as")||i.name;if(!u||!(u in t))continue;const s=t[u];if(i.type==="checkbox"){if(Array.isArray(s))i.checked=s.indexOf(i.value)!==-1;else if(a[i.name]>1){const n=String(s).split(",").map(function(c){return c.trim()});i.checked=n.indexOf(i.value)!==-1}else i.checked=se(s);o.push(i)}else if(i.type==="radio")i.checked=i.value===String(s),o.push(i);else if(i.type==="select-multiple"){if(Array.isArray(s))for(let n=0;n<i.options.length;n++)i.options[n].selected=s.indexOf(i.options[n].value)!==-1;o.push(i)}else i.value=s,i.tagName==="SELECT"&&s!=null&&i.setAttribute("data-ln-value",s),o.push(i)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ae,window.lnCore.serializeForm=ie,window.lnCore.resolveFormMethod=oe);const F={};function ue(e,t){F[e]=t}function le(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ue,window.lnCore.getDataMapper=le);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,v(function(){new MutationObserver(function(){h(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const M={};function de(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];M[r]=t}function fe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return M[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=de,window.lnCore.getLocaleFallback=fe,window.lnCore.ensureLocaleObserver=ce);const E={};function pe(e,t){E[e]||(E[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=E[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function $(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let i=0;i<r.length;i++){const u=r[i],s=u.getAttribute("data-ln-field");t[s]!=null&&(u.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<o.length;i++){const u=o[i],s=u.getAttribute("data-ln-attr").split(",");for(let n=0;n<s.length;n++){const c=s[n].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),f=c[1].trim();t[f]!=null&&u.setAttribute(d,t[f])}}const a=e.querySelectorAll("[data-ln-show]");for(let i=0;i<a.length;i++){const u=a[i],s=u.getAttribute("data-ln-show");s in t&&u.classList.toggle("hidden",!t[s])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const u=l[i],s=u.getAttribute("data-ln-class").split(",");for(let n=0;n<s.length;n++){const c=s[n].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),f=c[1].trim();f in t&&u.classList.toggle(d,!!t[f])}}return e}function he(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<r.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[o],t??null),r[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)$(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function K(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const l=r.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,u){return t[u]!==void 0?t[u]:""}))}const o=function(l,i){return t[i]!==void 0?t[i]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let l=0;l<a.length;l++){const i=a[l],u=i.attributes;for(let s=0;s<u.length;s++){const n=u[s];n.value.indexOf("{{")!==-1&&i.setAttribute(n.name,n.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function we(e,t,r,o,a,l){const i={};for(let s=0;s<e.children.length;s++){const n=e.children[s],c=n.getAttribute("data-ln-render-key");c&&(i[c]=n)}const u=document.createDocumentFragment();for(let s=0;s<t.length;s++){const n=t[s],c=String(o(n));let d=i[c];if(d)a(d,n,s);else{const f=pe(r,l);if(!f||(K(f,n),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",c),a(d,n,s)}u.appendChild(d)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=K,window.lnCore.fill=$,window.lnCore.lnFill=he,window.lnCore.renderList=we);function S(e,t,r){const o=e.getAttribute(t);return o===null?r:o}function j(e,t,r){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?r:o}function U(e,t,r=!1){const o=e.getAttribute(t);if(o===null)return!!r;const a=o.trim().toLowerCase();return!(a==="false"||a==="0")}function V(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const I=new Map;function W(e,t){const r=(e?e.join("|"):"")+"::"+t;if(I.has(r))return I.get(r);const o=new Set(e||[]),a=function(l,i){const u=l.getAttribute(i);return u!==null&&o.has(u)?u:t};return I.set(r,a),a}function H(e,t,r){const o=parseFloat(e.getAttribute(t));return isNaN(o)?r:o}function z(e,t,r){const o=e.getAttribute(t);if(!o)return r;try{return JSON.parse(o)}catch{return r}}function J(e,t,r,o,a){if(!e||t===null)return!0;const l=o||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const u=s=>{a?console.warn(s,a):console.warn(s)};if(i==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(u(`[${l}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const s=e.values||[];return s.includes(t)?!0:(u(`[${l}] Invalid value "${t}" for attribute "${r}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return u(`[${l}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(u(`[${l}] Value ${s} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(u(`[${l}] Value ${s} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(u(`[${l}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(s){return u(`[${l}] Invalid JSON for attribute "${r}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function me(e,t,r){for(const o in r){const[a,l,i]=r[o];Object.defineProperty(e,o,{get:function(){return a(t,l,i)},enumerable:!0,configurable:!0})}return e}function be(e){const t={};for(const r in e){const o=e[r];if(!o||!o.prop)continue;let a=o.read;if(!a&&o.type)switch(o.type){case"enum":a=W(o.values,o.fallback);break;case"integer":a=j;break;case"float":a=H;break;case"boolean":a=U;break;case"list":a=V;break;case"json":a=z;break;case"string":default:a=S;break}a||(a=S),t[o.prop]=[a,r,o.fallback]}return t}function ye(e){const t={};for(const r in e){const o=e[r];o&&o.effect&&(t[r]=o.effect)}return Object.keys(t).length?t:null}function ge(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=me,window.lnCore.attrSpec=be,window.lnCore.attrStr=S,window.lnCore.attrInt=j,window.lnCore.attrBool=U,window.lnCore.attrList=V,window.lnCore.attrEnum=W,window.lnCore.attrFloat=H,window.lnCore.attrJson=z);function L(e,t,r,o){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i=Array.from(e.querySelectorAll(l));e.matches&&e.matches(l)&&i.push(e);for(const u of i)if(!u[r]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[r]=new o(u)}catch(s){console.error("["+r+"] init failed",u,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function _e(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ce(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 X(){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 xe(e){const t=X(),r=e.observed||[];for(let o=0;o<r.length;o++){const a=r[o];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const a=t.byDeclaredAttr.get(o);a.some(l=>l.componentTag===e.componentTag)||a.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ge(e);if(o===null)t.reactiveWildcard.push(e);else for(const a of o)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function G(e,t,r,o){for(let a=0;a<e.length;a++){const l=e[a];if(!t[l.attribute])continue;const i=l.effects&&l.effects[r];i?i(t,r,o):l.onAttrChange&&(!l.declared||l.declared.has(r))&&l.onAttrChange(t,r,o)}}function qe(e){const t=e.target,r=e.attributeName;if(e.oldValue===t.getAttribute(r))return;const o=X(),a=o.byAttr.get(r);if(N()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(r)&&k(t)){const l=o.byDeclaredAttr.get(r),i=t.getAttribute(r);for(let u=0;u<l.length;u++)J(l[u].spec,i,r,l[u].componentTag,t)}if(window.lnCore._debugSink&&(r.indexOf("data-ln-")===0||a)&&window.lnCore._debugSink("attr",r,t,{oldValue:e.oldValue,newValue:t.getAttribute(r)}),r.indexOf("data-ln-")===0){const l=o.byReactive.get(r);l&&G(l,t,r,e.oldValue),o.reactiveWildcard.length&&G(o.reactiveWildcard,t,r,e.oldValue)}if(a)for(let l=0;l<a.length;l++){const i=a[l];if(i.handler){i.handler(t,r,e.oldValue);continue}i.onAttributeChange&&t[i.attribute]?i.onAttributeChange(t,r):(L(t,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(t))}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,v(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{qe(t[r])}catch(o){console.error("[ln-core] mutation handler failed",t[r].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function Y(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function Ae(e){const t=Y();if(t.length){if(e.target)for(let r=0;r<t.length;r++){const o=t[r];if(o.onSubtreeChange){const a=o.query,l=e.target.nodeType===1?e.target.matches(a)?e.target:e.target.closest(a):e.target.parentElement?e.target.parentElement.closest(a):null;l&&o.onSubtreeChange(l,e)}}for(let r=0;r<e.addedNodes.length;r++){const o=e.addedNodes[r];if(o.nodeType===1)for(let a=0;a<t.length;a++){const l=t[a];L(o,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(o)}}for(let r=0;r<e.removedNodes.length;r++){const o=e.removedNodes[r];if(o.nodeType===1)for(let a=0;a<t.length;a++){const l=t[a],i=l.query,u=Array.from(o.querySelectorAll(i));o.matches&&o.matches(i)&&u.push(o);for(let s=0;s<u.length;s++){const n=u[s];if(!document.contains(n)){const c=n[l.attribute];if(c&&typeof c.destroy=="function")try{c.destroy()}catch(d){console.error("["+l.attribute+"] destroy failed",n,d)}delete n[l.attribute]}}}}}}function ke(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,v(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{Ae(o)}catch(a){console.error("[ln-core] lifecycle handler failed",o.target,a)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Z(e,t,r,o,a={}){const l=a.extraAttributes||[],i=a.onAttributeChange||null,u=a.onSubtreeChange||null,s=a.onInit||null,n=a.onAttrChange||null,c=a.effects||null,d=a.attributes||null,f=d?ye(d):c,m=d?new Set(Object.keys(d)):null,b=a.persist||null;function p(R){const _=R||document.body;if(L(_,e,t,r),d&&N())for(const q in d){const Ke=d[q],P=Array.from(_.querySelectorAll("["+q+"]"));_.matches&&_.matches("["+q+"]")&&P.push(_);for(let B=0;B<P.length;B++){const Q=P[B];k(Q)&&J(Ke,Q.getAttribute(q),q,o,Q)}}s&&s(_)}const C=[];if(e.indexOf("[")!==-1){const R=/\[([\w-]+)/g;let _;for(;(_=R.exec(e))!==null;)C.push(_[1])}else C.push(e);xe({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:r,onInit:s,observed:C.concat(l),onAttributeChange:i,onAttrChange:n,effects:f,declared:m,persist:b}),ve();const T=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,$e=a.subtreeQuery||(T?e:"["+e+"]");Y().push({selector:e,attribute:t,ComponentFn:r,onInit:s,onSubtreeChange:u,query:$e}),ke(),window[t]=p,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Z);function re(){_e()>0?Ce(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",re):re(),p}function ee(e){return(e||"").replace(/^#/,"")}function D(e){const t=e===void 0?location.hash:e,r={},o=ee(t);if(!o)return r;const a=o.split("&");for(let l=0;l<a.length;l++){const i=a[l];if(!i)continue;const u=i.indexOf(":"),s=u>-1?i.slice(0,u):i,n=u>-1?i.slice(u+1):"";if(s)try{r[s]=decodeURIComponent(n)}catch{r[s]=n}}return r}function Ee(e){if(!e)return null;const t=D();return e in t?t[e]:null}function Se(e,t){if(!e)return;const r=D();t==null?delete r[e]:r[e]=String(t);const a=Object.keys(r).map(function(l){const i=r[l];return i===""?l:l+":"+encodeURIComponent(i)}).join("&");ee(location.hash)!==a&&(location.hash=a)}function Ie(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Le(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function De(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Te(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Re(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),o=e.slice(t+1),a=o?o.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:r,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=D,window.lnCore.hashGet=Ee,window.lnCore.hashSet=Se,window.lnCore.hashLinkClick=Ie,window.lnCore.resolveHashNamespace=Le,window.lnCore.hashSortEncode=De,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Te,window.lnCore.hashFilterDecode=Re);function O(){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=O);const Pe="ln_api_queue",Be=2,w="outbox",y="_queue_meta";function g(e,t){return e.error||new Error(t)}function x(e,t){return e.bound([t,-1/0],[t,1/0])}function te(e){return"seq:"+e}function A(e){return"paused:"+e}function ne(e){e.leaseOwner=null,e.leaseUntil=0}function Qe(e,t,r){return typeof e!="string"||e.indexOf(t)===-1?e:e.split(t).join(r)}function Ne(e,t,r,o){const a=new Map,l=[],i=[];for(const u of e||[])a.has(u.chainKey)||a.set(u.chainKey,[]),a.get(u.chainKey).push(u);return a.forEach((u,s)=>{u.sort((c,d)=>c.seq-d.seq);const n=u[0];if(!(!n||n.status==="failed")){if(n.status==="inflight"&&(n.leaseUntil||0)>o){i.push({chainKey:s,at:n.leaseUntil});return}if((n.nextAttemptAt||0)>o){i.push({chainKey:s,at:n.nextAttemptAt});return}n.status="inflight",n.leaseOwner=t,n.leaseUntil=o+r,n.updatedAt=o,l.push(n)}}),{entries:l,wakeups:i}}function Fe(e,t,r,o,a){const l=[],i=[];for(const u of e||[]){if(u.entryId===t){i.push(u.entryId);continue}u.chainKey===r&&(u.chainKey=o,u.targetId===r&&(u.targetId=o),u.meta&&u.meta.id===r&&(u.meta.id=o),u.meta&&typeof u.meta.action=="string"&&(u.meta.action=Qe(u.meta.action,r,o)),u.updatedAt=a,l.push(u))}return{changed:l,deleted:i}}class Me{constructor(t){t=t||{},this.indexedDB=t.indexedDB||globalThis.indexedDB,this.keyRange=t.IDBKeyRange||globalThis.IDBKeyRange,this.dbName=t.dbName||Pe,this.now=t.now||(()=>Date.now()),this.uuid=t.uuid||(()=>crypto.randomUUID()),this._db=null,this._ready=null}open(){return this._ready?this._ready:!this.indexedDB||!this.keyRange?Promise.resolve(null):(this._ready=new Promise((t,r)=>{const o=this.indexedDB.open(this.dbName,Be);o.onupgradeneeded=a=>{const l=a.target.result;let i;l.objectStoreNames.contains(w)?i=a.target.transaction.objectStore(w):i=l.createObjectStore(w,{keyPath:"entryId"}),i.indexNames.contains("by_scope_chain")||i.createIndex("by_scope_chain",["scope","chainKey"],{unique:!1}),i.indexNames.contains("by_scope_seq")||i.createIndex("by_scope_seq",["scope","seq"],{unique:!1}),l.objectStoreNames.contains(y)||l.createObjectStore(y,{keyPath:"key"})},o.onerror=()=>r(g(o,"Queue database open failed")),o.onsuccess=a=>{this._db=a.target.result,this._db.onversionchange=()=>this.close(),t(this._db)}}),this._ready)}close(){this._db&&this._db.close(),this._db=null,this._ready=null}deleteDatabase(){return this.close(),this.indexedDB?new Promise((t,r)=>{const o=this.indexedDB.deleteDatabase(this.dbName);o.onsuccess=()=>t(),o.onerror=()=>r(g(o,"Queue database delete failed")),o.onblocked=()=>r(new Error("Queue database delete blocked"))}):Promise.resolve()}allForScope(t){return this.open().then(r=>r?new Promise((o,a)=>{const i=r.transaction(w,"readonly").objectStore(w).index("by_scope_seq").getAll(x(this.keyRange,t));i.onsuccess=()=>o(i.result||[]),i.onerror=()=>a(g(i,"Queue scope read failed"))}):[])}enqueue(t,r){return r=r||{},this.open().then(o=>o?new Promise((a,l)=>{const i=o.transaction([y,w],"readwrite"),u=i.objectStore(y),s=i.objectStore(w),n=te(t);let c=null;const d=m=>{const b=m+1;c={entryId:this.uuid(),scope:t,chainKey:r.chainKey,seq:b,op:r.op,targetId:r.targetId!==void 0?r.targetId:null,payload:r.payload,expectedVersion:r.expectedVersion!==void 0?r.expectedVersion:null,meta:r.meta||{},attempts:0,nextAttemptAt:0,status:"pending",leaseOwner:null,leaseUntil:0,createdAt:this.now(),updatedAt:this.now()},u.put({key:n,value:b}),s.put(c)},f=u.get(n);f.onerror=()=>l(g(f,"Queue sequence read failed")),f.onsuccess=()=>{const m=f.result;if(m&&typeof m.value=="number"){d(m.value);return}const b=s.index("by_scope_seq").getAll(x(this.keyRange,t));b.onerror=()=>l(g(b,"Queue sequence migration failed")),b.onsuccess=()=>{const p=(b.result||[]).reduce((C,T)=>Math.max(C,T.seq||0),0);d(p)}},i.oncomplete=()=>a(c),i.onerror=()=>l(i.error||new Error("Queue enqueue transaction failed")),i.onabort=()=>l(i.error||new Error("Queue enqueue transaction aborted"))}):null)}claimReady(t,r,o){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),s=u.objectStore(w),n=s.index("by_scope_seq").getAll(x(this.keyRange,t)),c=this.now();let d={entries:[],wakeups:[]};n.onerror=()=>i(g(n,"Queue claim read failed")),n.onsuccess=()=>{d=Ne(n.result||[],r,o,c);for(const f of d.entries)s.put(f)},u.oncomplete=()=>l(d),u.onerror=()=>i(u.error||new Error("Queue claim transaction failed")),u.onabort=()=>i(u.error||new Error("Queue claim transaction aborted"))}):{entries:[],wakeups:[]})}ack(t,r){return this._updateEntry(t,r,(o,a)=>(a.delete(o.entryId),{status:"acked",entry:o}))}nack(t,r,o,a){a=a||{};const l=a.maxAttempts||8,i=a.backoff||[2e3,5e3,15e3,6e4,3e5];return this.open().then(u=>u?new Promise((s,n)=>{const c=u.transaction([w,y],"readwrite"),d=c.objectStore(w),f=c.objectStore(y),m=d.get(r);let b=null;m.onerror=()=>n(g(m,"Queue nack read failed")),m.onsuccess=()=>{const p=m.result;if(!(!p||p.scope!==t)){if(o==="drop"){d.delete(p.entryId),b={status:"dropped",entry:p};return}if(ne(p),p.updatedAt=this.now(),o==="auth"){p.status="pending",d.put(p),f.put({key:A(t),value:"auth"}),b={status:"auth",entry:p};return}if(o==="retry"){if(p.attempts=(p.attempts||0)+1,p.attempts>=l){p.status="failed",p.nextAttemptAt=0,d.put(p),b={status:"failed",entry:p};return}const C=i[Math.min(p.attempts-1,i.length-1)];p.status="pending",p.nextAttemptAt=this.now()+C,d.put(p),b={status:"retry",entry:p,delay:C}}}},c.oncomplete=()=>s(b),c.onerror=()=>n(c.error||new Error("Queue nack transaction failed")),c.onabort=()=>n(c.error||new Error("Queue nack transaction aborted"))}):null)}remap(t,r,o){return this._remapTransaction(t,null,r,o)}resolveCreate(t,r,o,a){return this._remapTransaction(t,r,o,a)}_remapTransaction(t,r,o,a){return this.open().then(l=>l?new Promise((i,u)=>{const s=l.transaction(w,"readwrite"),n=s.objectStore(w),c=n.index("by_scope_seq").getAll(x(this.keyRange,t));let d={changed:[],deleted:[]};c.onerror=()=>u(g(c,"Queue remap read failed")),c.onsuccess=()=>{d=Fe(c.result||[],r,o,a,this.now());for(const f of d.deleted)n.delete(f);for(const f of d.changed)n.put(f)},s.oncomplete=()=>i(d.changed),s.onerror=()=>u(s.error||new Error("Queue remap transaction failed")),s.onabort=()=>u(s.error||new Error("Queue remap transaction aborted"))}):[])}resetFailed(t){return this.open().then(r=>r?new Promise((o,a)=>{const l=r.transaction(w,"readwrite"),i=l.objectStore(w),u=i.index("by_scope_seq").getAll(x(this.keyRange,t));let s=0;u.onerror=()=>a(g(u,"Queue failed-entry read failed")),u.onsuccess=()=>{for(const n of u.result||[])n.status==="failed"&&(n.status="pending",n.attempts=0,n.nextAttemptAt=0,n.updatedAt=this.now(),ne(n),i.put(n),s++)},l.oncomplete=()=>o(s),l.onerror=()=>a(l.error||new Error("Queue failed-entry reset failed")),l.onabort=()=>a(l.error||new Error("Queue failed-entry reset aborted"))}):0)}getPaused(t){return this.open().then(r=>r?new Promise((o,a)=>{const i=r.transaction(y,"readonly").objectStore(y).get(A(t));i.onsuccess=()=>{const u=i.result?i.result.value:!1;o(u||!1)},i.onerror=()=>a(g(i,"Queue pause-state read failed"))}):!1)}setPaused(t,r){return this.open().then(o=>{if(o)return new Promise((a,l)=>{const i=o.transaction(y,"readwrite"),u=typeof r=="string"?r:r?"manual":!1;i.objectStore(y).put({key:A(t),value:u}),i.oncomplete=()=>a(),i.onerror=()=>l(i.error||new Error("Queue pause-state write failed")),i.onabort=()=>l(i.error||new Error("Queue pause-state write aborted"))})})}clear(t){return this.open().then(r=>{if(r)return new Promise((o,a)=>{const l=r.transaction([w,y],"readwrite"),u=l.objectStore(w).index("by_scope_seq").openCursor(x(this.keyRange,t));u.onsuccess=s=>{const n=s.target.result;n&&(n.delete(),n.continue())},u.onerror=()=>a(g(u,"Queue clear failed")),l.objectStore(y).delete(te(t)),l.objectStore(y).delete(A(t)),l.oncomplete=()=>o(),l.onerror=()=>a(l.error||new Error("Queue clear transaction failed")),l.onabort=()=>a(l.error||new Error("Queue clear transaction aborted"))})})}_updateEntry(t,r,o){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),s=u.objectStore(w),n=s.get(r);let c=null;n.onerror=()=>i(g(n,"Queue entry read failed")),n.onsuccess=()=>{const d=n.result;!d||d.scope!==t||(c=o(d,s))},u.oncomplete=()=>l(c),u.onerror=()=>i(u.error||new Error("Queue entry transaction failed")),u.onabort=()=>i(u.error||new Error("Queue entry transaction aborted"))}):null)}}(function(){const e="data-ln-api-queue",t="lnApiQueue",r=[2e3,5e3,15e3,6e4,3e5],o=8,a=6e4;if(window[t]!==void 0)return;function l(n){const c=n[t];c&&c._drain()}const i={"data-ln-api-queue":{type:"marker",description:"Mounts offline API synchronization queue backed by IndexedDB"},"data-ln-api-queue-online":{effect:l,type:"enum",values:["true","false"],fallback:"auto",description:"Network connectivity override (true/false, or auto-detect from navigator.onLine)"}},u=new Me({indexedDB:window.indexedDB,IDBKeyRange:window.IDBKeyRange,uuid:O});function s(n){this.dom=n,n[t]=this;const c=n.closest("[data-ln-data-coordinator]");this.scope=n.id||(c?c.id:null)||"default",this._paused=!1,this._timers=new Map,this._workerId=O(),this._drainPromise=null,this._onlineHandler=()=>this._drain(),this._bindEvents(),window.addEventListener("online",this._onlineHandler);const d=this;return u.open().then(f=>f?u.getPaused(d.scope):(console.warn("[ln-api-queue] IndexedDB not available — queue disabled"),!1)).then(f=>{if(d._paused=!!f,d._paused){const m=typeof f=="string"?f:"auth";h(d.dom,"ln-api-queue:paused",{reason:m,restored:!0})}return d._emitPendingCount()}).then(()=>d._drain()).catch(f=>{console.error("[ln-api-queue] Initialization failed:",f),h(d.dom,"ln-api-queue:error",{operation:"initialize",error:f})}),this}s.prototype._isOnline=function(){const n=this.dom.getAttribute("data-ln-api-queue-online");return n==="true"?!0:n==="false"?!1:navigator.onLine},s.prototype._emitPendingCount=function(){const n=this;return u.allForScope(n.scope).then(c=>(h(n.dom,"ln-api-queue:pending-count",{count:c.length,scope:n.scope}),c.length===0&&h(n.dom,"ln-api-queue:drained",{scope:n.scope}),c))},s.prototype._clearTimer=function(n){const c=this._timers.get(n);c&&(clearTimeout(c),this._timers.delete(n))},s.prototype._scheduleTimer=function(n,c){const d=Math.max(0,c),f=this._timers.get(n);f&&clearTimeout(f);const m=this,b=setTimeout(()=>{m._timers.delete(n),m._drain()},d);this._timers.set(n,b)},s.prototype._drain=function(){const n=this;return n._paused||!n._isOnline()?Promise.resolve():(n._drainPromise||(n._drainPromise=u.claimReady(n.scope,n._workerId,a).then(c=>{for(const d of c.wakeups)n._scheduleTimer(d.chainKey,d.at-Date.now());for(const d of c.entries)n._clearTimer(d.chainKey),h(n.dom,"ln-api-queue:send",{entryId:d.entryId,chainKey:d.chainKey,op:d.op,targetId:d.targetId,payload:d.payload,expectedVersion:d.expectedVersion,idempotencyKey:d.entryId,meta:d.meta})}).catch(c=>{console.error("[ln-api-queue] Drain failed:",c),h(n.dom,"ln-api-queue:error",{operation:"drain",error:c})}).finally(()=>{n._drainPromise=null})),n._drainPromise)},s.prototype._onEnqueue=function(n){const c=this;return u.enqueue(c.scope,n.detail||{}).then(d=>{if(d)return c._emitPendingCount().then(f=>(h(c.dom,"ln-api-queue:enqueued",{entryId:d.entryId,chainKey:d.chainKey,count:f.length}),c._drain()))}).catch(d=>{h(c.dom,"ln-api-queue:error",{operation:"enqueue",error:d})})},s.prototype._onAck=function(n){const c=this,d=n.detail||{};return u.ack(c.scope,d.entryId).then(()=>c._emitPendingCount()).then(()=>c._drain()).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"ack",entryId:d.entryId,error:f})})},s.prototype._onNack=function(n){const c=this,d=n.detail||{};return u.nack(c.scope,d.entryId,d.reason,{maxAttempts:o,backoff:r}).then(f=>{if(f)return f.status==="failed"?h(c.dom,"ln-api-queue:failed",{entryId:f.entry.entryId,chainKey:f.entry.chainKey,attempts:f.entry.attempts}):f.status==="retry"?c._scheduleTimer(f.entry.chainKey,f.delay):f.status==="auth"&&(c._paused=!0,h(c.dom,"ln-api-queue:paused",{reason:"auth"}),h(c.dom,"ln-api-queue:auth-required",{entryId:f.entry.entryId,chainKey:f.entry.chainKey})),c._emitPendingCount().then(()=>{if(f.status==="dropped")return c._drain()})}).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"nack",entryId:d.entryId,error:f})})},s.prototype._onRemap=function(n){const c=this,d=n.detail||{};return u.remap(c.scope,d.oldKey,d.newId).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"remap",error:f})})},s.prototype._onResolveCreate=function(n){const c=this,d=n.detail||{};return u.resolveCreate(c.scope,d.entryId,d.oldKey,d.newId).then(()=>c._emitPendingCount()).then(()=>c._drain()).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"resolve-create",entryId:d.entryId,error:f})})},s.prototype._onResume=function(){const n=this;return u.setPaused(n.scope,!1).then(()=>(n._paused=!1,h(n.dom,"ln-api-queue:resumed",{}),n._drain())).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"resume",error:c})})},s.prototype._onPause=function(){const n=this;return u.setPaused(n.scope,"manual").then(()=>{n._paused=!0,h(n.dom,"ln-api-queue:paused",{reason:"manual"})}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"pause",error:c})})},s.prototype._onDrain=function(){const n=this;return u.resetFailed(n.scope).then(()=>{const c=n._drainPromise;return c?c.then(()=>n._drain()):n._drain()}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"manual-drain",error:c})})},s.prototype._onClear=function(){const n=this;return n._timers.forEach(c=>clearTimeout(c)),n._timers.clear(),u.clear(n.scope).then(()=>{n._paused=!1,h(n.dom,"ln-api-queue:pending-count",{count:0,scope:n.scope}),h(n.dom,"ln-api-queue:drained",{scope:n.scope})}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"clear",error:c})})},s.prototype._bindEvents=function(){const n=this;n._handlers={enqueue:c=>n._onEnqueue(c),ack:c=>n._onAck(c),nack:c=>n._onNack(c),remap:c=>n._onRemap(c),resolveCreate:c=>n._onResolveCreate(c),resume:()=>n._onResume(),pause:()=>n._onPause(),drain:()=>n._onDrain(),clear:()=>n._onClear()},n.dom.addEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.addEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.addEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.addEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.addEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.addEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.addEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.addEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.addEventListener("ln-api-queue:request-clear",n._handlers.clear)},s.prototype.destroy=function(){if(!this.dom[t])return;const n=this;n.dom.removeEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.removeEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.removeEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.removeEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.removeEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.removeEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.removeEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.removeEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.removeEventListener("ln-api-queue:request-clear",n._handlers.clear),window.removeEventListener("online",n._onlineHandler),n._timers.forEach(c=>clearTimeout(c)),n._timers.clear(),delete n.dom[t]},Z(e,t,s,"ln-api-queue",{attributes:i})})()})();
|
|
1
|
+
(function(){"use strict";function M(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function E(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 a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){r=t[a];break}if(!E(r))return}e.apply(console,t)}}function h(e,t,o){const r=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ae(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ue(e,t){const o=!!(t&&t.typed),r=t&&t.exclude,a={},l=e.elements,i={};if(o)for(let u=0;u<l.length;u++){const s=l[u];s.name&&s.type==="checkbox"&&!s.disabled&&(i[s.name]=(i[s.name]||0)+1)}for(let u=0;u<l.length;u++){const s=l[u];if(!(!s.name||s.disabled||s.type==="file"||s.type==="submit"||s.type==="button")&&!(r&&s.matches&&s.matches(r)))if(s.type==="checkbox")o&&i[s.name]===1?a[s.name]=s.checked:(a[s.name]||(a[s.name]=[]),s.checked&&a[s.name].push(s.value));else if(s.type==="radio")s.checked&&(a[s.name]=s.value);else if(s.type==="select-multiple"){a[s.name]=[];for(let n=0;n<s.options.length;n++)s.options[n].selected&&a[s.name].push(s.options[n].value)}else if(o&&s.type==="hidden")a[s.name]=s.value;else if(o&&(s.type==="number"||s.type==="range")){const n=Number(s.value);a[s.name]=s.value===""||isNaN(n)?null:n}else a[s.name]=s.value}return a}function le(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ce(e,t){const o=e.elements,r=[],a={};for(let l=0;l<o.length;l++){const i=o[l];i.name&&i.type==="checkbox"&&(a[i.name]=(a[i.name]||0)+1)}for(let l=0;l<o.length;l++){const i=o[l];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const u=i.getAttribute("data-ln-fill-as")||i.name;if(!u||!(u in t))continue;const s=t[u];if(i.type==="checkbox"){if(Array.isArray(s))i.checked=s.indexOf(i.value)!==-1;else if(a[i.name]>1){const n=String(s).split(",").map(function(c){return c.trim()});i.checked=n.indexOf(i.value)!==-1}else i.checked=le(s);r.push(i)}else if(i.type==="radio")i.checked=i.value===String(s),r.push(i);else if(i.type==="select-multiple"){if(Array.isArray(s))for(let n=0;n<i.options.length;n++)i.options[n].selected=s.indexOf(i.options[n].value)!==-1;r.push(i)}else i.value=s,i.tagName==="SELECT"&&s!=null&&i.setAttribute("data-ln-value",s),r.push(i)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ce,window.lnCore.serializeForm=ue,window.lnCore.resolveFormMethod=ae);const $={};function de(e,t){$[e]=t}function fe(e){return $[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=de,window.lnCore.getDataMapper=fe);function pe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){h(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const K={};function he(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];K[o]=t}function we(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=he,window.lnCore.getLocaleFallback=we,window.lnCore.ensureLocaleObserver=pe);const S={};function me(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=S[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function j(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let i=0;i<o.length;i++){const u=o[i],s=u.getAttribute("data-ln-field");t[s]!=null&&(u.textContent=t[s])}const r=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<r.length;i++){const u=r[i],s=u.getAttribute("data-ln-attr").split(",");for(let n=0;n<s.length;n++){const c=s[n].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),f=c[1].trim();t[f]!=null&&u.setAttribute(d,t[f])}}const a=e.querySelectorAll("[data-ln-show]");for(let i=0;i<a.length;i++){const u=a[i],s=u.getAttribute("data-ln-show");s in t&&u.classList.toggle("hidden",!t[s])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const u=l[i],s=u.getAttribute("data-ln-class").split(",");for(let n=0;n<s.length;n++){const c=s[n].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),f=c[1].trim();f in t&&u.classList.toggle(d,!!t[f])}}return e}function be(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<o.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[r],t??null),o[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)j(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function U(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const l=o.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,u){return t[u]!==void 0?t[u]:""}))}const r=function(l,i){return t[i]!==void 0?t[i]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let l=0;l<a.length;l++){const i=a[l],u=i.attributes;for(let s=0;s<u.length;s++){const n=u[s];n.value.indexOf("{{")!==-1&&i.setAttribute(n.name,n.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function ye(e,t,o,r,a,l){const i={};for(let s=0;s<e.children.length;s++){const n=e.children[s],c=n.getAttribute("data-ln-render-key");c&&(i[c]=n)}const u=document.createDocumentFragment();for(let s=0;s<t.length;s++){const n=t[s],c=String(r(n));let d=i[c];if(d)a(d,n,s);else{const f=me(o,l);if(!f||(U(f,n),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",c),a(d,n,s)}u.appendChild(d)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=U,window.lnCore.fill=j,window.lnCore.lnFill=be,window.lnCore.renderList=ye);function I(e,t,o){const r=e.getAttribute(t);return r===null?o:r}function V(e,t,o){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?o:r}function W(e,t,o=!1){const r=e.getAttribute(t);if(r===null)return!!o;const a=r.trim().toLowerCase();return!(a==="false"||a==="0")}function H(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const D=new Map;function z(e,t){const o=(e?e.join("|"):"")+"::"+t;if(D.has(o))return D.get(o);const r=new Set(e||[]),a=function(l,i){const u=l.getAttribute(i);return u!==null&&r.has(u)?u:t};return D.set(o,a),a}function J(e,t,o){const r=parseFloat(e.getAttribute(t));return isNaN(r)?o:r}function X(e,t,o){const r=e.getAttribute(t);if(!r)return o;try{return JSON.parse(r)}catch{return o}}function G(e,t,o,r,a){if(!e||t===null)return!0;const l=r||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const u=s=>{a?console.warn(s,a):console.warn(s)};if(i==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(u(`[${l}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const s=e.values||[];return s.includes(t)?!0:(u(`[${l}] Invalid value "${t}" for attribute "${o}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return u(`[${l}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(u(`[${l}] Value ${s} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(u(`[${l}] Value ${s} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(u(`[${l}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(s){return u(`[${l}] Invalid JSON for attribute "${o}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function ge(e,t,o){for(const r in o){const[a,l,i]=o[r];Object.defineProperty(e,r,{get:function(){return a(t,l,i)},enumerable:!0,configurable:!0})}return e}function _e(e){const t={};for(const o in e){const r=e[o];if(!r||!r.prop)continue;let a=r.read;if(!a&&r.type)switch(r.type){case"enum":a=z(r.values,r.fallback);break;case"integer":a=V;break;case"float":a=J;break;case"boolean":a=W;break;case"list":a=H;break;case"json":a=X;break;case"string":default:a=I;break}a||(a=I),t[r.prop]=[a,o,r.fallback]}return t}function Ce(e){const t={};for(const o in e){const r=e[o];r&&r.effect&&(t[o]=r.effect)}return Object.keys(t).length?t:null}function qe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ge,window.lnCore.attrSpec=_e,window.lnCore.attrStr=I,window.lnCore.attrInt=V,window.lnCore.attrBool=W,window.lnCore.attrList=H,window.lnCore.attrEnum=z,window.lnCore.attrFloat=J,window.lnCore.attrJson=X);function x(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function Y(e,t,o,r){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:o,ComponentFn:r};if(e.matches&&e.matches(l)&&x(e,i),e.querySelectorAll){const u=e.querySelectorAll(l);for(let s=0;s<u.length;s++)x(u[s],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function xe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ve(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 Z(){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 Ae(e){const t=Z(),o=e.observed||[];for(let r=0;r<o.length;r++){const a=o[r];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).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 a=t.byDeclaredAttr.get(r);a.some(l=>l.componentTag===e.componentTag)||a.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=qe(e);if(r===null)t.reactiveWildcard.push(e);else for(const a of r)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function ee(e,t,o,r){for(let a=0;a<e.length;a++){const l=e[a];if(!t[l.attribute])continue;const i=l.effects&&l.effects[o];i?i(t,o,r):l.onAttrChange&&(!l.declared||l.declared.has(o))&&l.onAttrChange(t,o,r)}}function ke(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,r=Z(),a=r.byAttr.get(t),l=M()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!o&&!a&&!l)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(l&&E(i)){const u=r.byDeclaredAttr.get(t),s=i.getAttribute(t);for(let n=0;n<u.length;n++)G(u[n].spec,s,t,u[n].componentTag,i)}if(window.lnCore._debugSink&&(o||a)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),o){const u=r.byReactive.get(t);u&&ee(u,i,t,e.oldValue),r.reactiveWildcard.length&&ee(r.reactiveWildcard,i,t,e.oldValue)}if(a)for(let u=0;u<a.length;u++){const s=a[u];if(s.handler){s.handler(i,t,e.oldValue);continue}s.onAttributeChange&&i[s.attribute]?s.onAttributeChange(i,t):(Y(i,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(i))}}}function Ee(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{ke(t[o])}catch(r){console.error("[ln-core] mutation handler failed",t[o].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function L(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function O(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Se(e){const t=L();if(t.length){if(e.target)for(let o=0;o<t.length;o++){const r=t[o];if(r.onSubtreeChange&&r.query){const a=r.query,l=e.target.nodeType===1?e.target.matches&&e.target.matches(a)?e.target:e.target.closest?e.target.closest(a):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(a):null;l&&r.onSubtreeChange(l,e)}}for(let o=0;o<e.addedNodes.length;o++){const r=e.addedNodes[o];if(r.nodeType===1){const a=!!(r.firstElementChild||r.children&&r.children.length);for(let l=0;l<t.length;l++){const i=t[l];if(i.selector&&i.attribute&&i.ComponentFn){if(!a)r.matches&&r.matches(i.query)&&x(r,i);else if(r.matches&&r.matches(i.query)&&x(r,i),r.querySelectorAll){const u=r.querySelectorAll(i.query);for(let s=0;s<u.length;s++)x(u[s],i)}}i.onInit&&i.onInit(r)}}}for(let o=0;o<e.removedNodes.length;o++){const r=e.removedNodes[o];if(r.nodeType===1){const a=!!(r.firstElementChild||r.children&&r.children.length);for(let l=0;l<t.length;l++){const i=t[l],u=i.query;if(u){if(!a)r.matches&&r.matches(u)&&O(r,i);else if(r.matches&&r.matches(u)&&O(r,i),r.querySelectorAll){const s=r.querySelectorAll(u);for(let n=0;n<s.length;n++)O(s[n],i)}}}}}}}function te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const r=t[o];if(r.type==="childList")try{Se(r)}catch(a){console.error("[ln-core] lifecycle handler failed",r.target,a)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ie(e){L().push(e),te()}function ne(e,t,o,r,a={}){const l=a.extraAttributes||[],i=a.onAttributeChange||null,u=a.onSubtreeChange||null,s=a.onInit||null,n=a.onAttrChange||null,c=a.effects||null,d=a.attributes||null,f=d?Ce(d):c,m=d?new Set(Object.keys(d)):null,b=a.persist||null;function p(B){const _=B||document.body;if(Y(_,e,t,o),d&&M())for(const v in d){const Ve=d[v],Q=Array.from(_.querySelectorAll("["+v+"]"));_.matches&&_.matches("["+v+"]")&&Q.push(_);for(let N=0;N<Q.length;N++){const F=Q[N];E(F)&&G(Ve,F.getAttribute(v),v,r,F)}}s&&s(_)}const C=[];if(e.indexOf("[")!==-1){const B=/\[([\w-]+)/g;let _;for(;(_=B.exec(e))!==null;)C.push(_[1])}else C.push(e);Ae({selector:e,attribute:t,componentTag:r,attributes:d,ComponentFn:o,onInit:s,observed:C.concat(l),onAttributeChange:i,onAttrChange:n,effects:f,declared:m,persist:b}),Ee();const P=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ue=a.subtreeQuery||(P?e:"["+e+"]");L().push({selector:e,attribute:t,ComponentFn:o,onInit:s,onSubtreeChange:u,query:Ue}),te(),window[t]=p,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ne,window.lnCore.observeLifecycle=Ie);function se(){xe()>0?ve(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",se):se(),p}function re(e){return(e||"").replace(/^#/,"")}function T(e){const t=e===void 0?location.hash:e,o={},r=re(t);if(!r)return o;const a=r.split("&");for(let l=0;l<a.length;l++){const i=a[l];if(!i)continue;const u=i.indexOf(":"),s=u>-1?i.slice(0,u):i,n=u>-1?i.slice(u+1):"";if(s)try{o[s]=decodeURIComponent(n)}catch{o[s]=n}}return o}function De(e){if(!e)return null;const t=T();return e in t?t[e]:null}function Le(e,t){if(!e)return;const o=T();t==null?delete o[e]:o[e]=String(t);const a=Object.keys(o).map(function(l){const i=o[l];return i===""?l:l+":"+encodeURIComponent(i)}).join("&");re(location.hash)!==a&&(location.hash=a)}function Oe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Te(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const 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 Re(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Pe(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 Be(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Qe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),r=e.slice(t+1),a=r?r.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:o,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=T,window.lnCore.hashGet=De,window.lnCore.hashSet=Le,window.lnCore.hashLinkClick=Oe,window.lnCore.resolveHashNamespace=Te,window.lnCore.hashSortEncode=Re,window.lnCore.hashSortDecode=Pe,window.lnCore.hashFilterEncode=Be,window.lnCore.hashFilterDecode=Qe);function R(){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=R);const Ne="ln_api_queue",Fe=2,w="outbox",y="_queue_meta";function g(e,t){return e.error||new Error(t)}function q(e,t){return e.bound([t,-1/0],[t,1/0])}function oe(e){return"seq:"+e}function k(e){return"paused:"+e}function ie(e){e.leaseOwner=null,e.leaseUntil=0}function Me(e,t,o){return typeof e!="string"||e.indexOf(t)===-1?e:e.split(t).join(o)}function $e(e,t,o,r){const a=new Map,l=[],i=[];for(const u of e||[])a.has(u.chainKey)||a.set(u.chainKey,[]),a.get(u.chainKey).push(u);return a.forEach((u,s)=>{u.sort((c,d)=>c.seq-d.seq);const n=u[0];if(!(!n||n.status==="failed")){if(n.status==="inflight"&&(n.leaseUntil||0)>r){i.push({chainKey:s,at:n.leaseUntil});return}if((n.nextAttemptAt||0)>r){i.push({chainKey:s,at:n.nextAttemptAt});return}n.status="inflight",n.leaseOwner=t,n.leaseUntil=r+o,n.updatedAt=r,l.push(n)}}),{entries:l,wakeups:i}}function Ke(e,t,o,r,a){const l=[],i=[];for(const u of e||[]){if(u.entryId===t){i.push(u.entryId);continue}u.chainKey===o&&(u.chainKey=r,u.targetId===o&&(u.targetId=r),u.meta&&u.meta.id===o&&(u.meta.id=r),u.meta&&typeof u.meta.action=="string"&&(u.meta.action=Me(u.meta.action,o,r)),u.updatedAt=a,l.push(u))}return{changed:l,deleted:i}}class je{constructor(t){t=t||{},this.indexedDB=t.indexedDB||globalThis.indexedDB,this.keyRange=t.IDBKeyRange||globalThis.IDBKeyRange,this.dbName=t.dbName||Ne,this.now=t.now||(()=>Date.now()),this.uuid=t.uuid||(()=>crypto.randomUUID()),this._db=null,this._ready=null}open(){return this._ready?this._ready:!this.indexedDB||!this.keyRange?Promise.resolve(null):(this._ready=new Promise((t,o)=>{const r=this.indexedDB.open(this.dbName,Fe);r.onupgradeneeded=a=>{const l=a.target.result;let i;l.objectStoreNames.contains(w)?i=a.target.transaction.objectStore(w):i=l.createObjectStore(w,{keyPath:"entryId"}),i.indexNames.contains("by_scope_chain")||i.createIndex("by_scope_chain",["scope","chainKey"],{unique:!1}),i.indexNames.contains("by_scope_seq")||i.createIndex("by_scope_seq",["scope","seq"],{unique:!1}),l.objectStoreNames.contains(y)||l.createObjectStore(y,{keyPath:"key"})},r.onerror=()=>o(g(r,"Queue database open failed")),r.onsuccess=a=>{this._db=a.target.result,this._db.onversionchange=()=>this.close(),t(this._db)}}),this._ready)}close(){this._db&&this._db.close(),this._db=null,this._ready=null}deleteDatabase(){return this.close(),this.indexedDB?new Promise((t,o)=>{const r=this.indexedDB.deleteDatabase(this.dbName);r.onsuccess=()=>t(),r.onerror=()=>o(g(r,"Queue database delete failed")),r.onblocked=()=>o(new Error("Queue database delete blocked"))}):Promise.resolve()}allForScope(t){return this.open().then(o=>o?new Promise((r,a)=>{const i=o.transaction(w,"readonly").objectStore(w).index("by_scope_seq").getAll(q(this.keyRange,t));i.onsuccess=()=>r(i.result||[]),i.onerror=()=>a(g(i,"Queue scope read failed"))}):[])}enqueue(t,o){return o=o||{},this.open().then(r=>r?new Promise((a,l)=>{const i=r.transaction([y,w],"readwrite"),u=i.objectStore(y),s=i.objectStore(w),n=oe(t);let c=null;const d=m=>{const b=m+1;c={entryId:this.uuid(),scope:t,chainKey:o.chainKey,seq:b,op:o.op,targetId:o.targetId!==void 0?o.targetId:null,payload:o.payload,expectedVersion:o.expectedVersion!==void 0?o.expectedVersion:null,meta:o.meta||{},attempts:0,nextAttemptAt:0,status:"pending",leaseOwner:null,leaseUntil:0,createdAt:this.now(),updatedAt:this.now()},u.put({key:n,value:b}),s.put(c)},f=u.get(n);f.onerror=()=>l(g(f,"Queue sequence read failed")),f.onsuccess=()=>{const m=f.result;if(m&&typeof m.value=="number"){d(m.value);return}const b=s.index("by_scope_seq").getAll(q(this.keyRange,t));b.onerror=()=>l(g(b,"Queue sequence migration failed")),b.onsuccess=()=>{const p=(b.result||[]).reduce((C,P)=>Math.max(C,P.seq||0),0);d(p)}},i.oncomplete=()=>a(c),i.onerror=()=>l(i.error||new Error("Queue enqueue transaction failed")),i.onabort=()=>l(i.error||new Error("Queue enqueue transaction aborted"))}):null)}claimReady(t,o,r){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),s=u.objectStore(w),n=s.index("by_scope_seq").getAll(q(this.keyRange,t)),c=this.now();let d={entries:[],wakeups:[]};n.onerror=()=>i(g(n,"Queue claim read failed")),n.onsuccess=()=>{d=$e(n.result||[],o,r,c);for(const f of d.entries)s.put(f)},u.oncomplete=()=>l(d),u.onerror=()=>i(u.error||new Error("Queue claim transaction failed")),u.onabort=()=>i(u.error||new Error("Queue claim transaction aborted"))}):{entries:[],wakeups:[]})}ack(t,o){return this._updateEntry(t,o,(r,a)=>(a.delete(r.entryId),{status:"acked",entry:r}))}nack(t,o,r,a){a=a||{};const l=a.maxAttempts||8,i=a.backoff||[2e3,5e3,15e3,6e4,3e5];return this.open().then(u=>u?new Promise((s,n)=>{const c=u.transaction([w,y],"readwrite"),d=c.objectStore(w),f=c.objectStore(y),m=d.get(o);let b=null;m.onerror=()=>n(g(m,"Queue nack read failed")),m.onsuccess=()=>{const p=m.result;if(!(!p||p.scope!==t)){if(r==="drop"){d.delete(p.entryId),b={status:"dropped",entry:p};return}if(ie(p),p.updatedAt=this.now(),r==="auth"){p.status="pending",d.put(p),f.put({key:k(t),value:"auth"}),b={status:"auth",entry:p};return}if(r==="retry"){if(p.attempts=(p.attempts||0)+1,p.attempts>=l){p.status="failed",p.nextAttemptAt=0,d.put(p),b={status:"failed",entry:p};return}const C=i[Math.min(p.attempts-1,i.length-1)];p.status="pending",p.nextAttemptAt=this.now()+C,d.put(p),b={status:"retry",entry:p,delay:C}}}},c.oncomplete=()=>s(b),c.onerror=()=>n(c.error||new Error("Queue nack transaction failed")),c.onabort=()=>n(c.error||new Error("Queue nack transaction aborted"))}):null)}remap(t,o,r){return this._remapTransaction(t,null,o,r)}resolveCreate(t,o,r,a){return this._remapTransaction(t,o,r,a)}_remapTransaction(t,o,r,a){return this.open().then(l=>l?new Promise((i,u)=>{const s=l.transaction(w,"readwrite"),n=s.objectStore(w),c=n.index("by_scope_seq").getAll(q(this.keyRange,t));let d={changed:[],deleted:[]};c.onerror=()=>u(g(c,"Queue remap read failed")),c.onsuccess=()=>{d=Ke(c.result||[],o,r,a,this.now());for(const f of d.deleted)n.delete(f);for(const f of d.changed)n.put(f)},s.oncomplete=()=>i(d.changed),s.onerror=()=>u(s.error||new Error("Queue remap transaction failed")),s.onabort=()=>u(s.error||new Error("Queue remap transaction aborted"))}):[])}resetFailed(t){return this.open().then(o=>o?new Promise((r,a)=>{const l=o.transaction(w,"readwrite"),i=l.objectStore(w),u=i.index("by_scope_seq").getAll(q(this.keyRange,t));let s=0;u.onerror=()=>a(g(u,"Queue failed-entry read failed")),u.onsuccess=()=>{for(const n of u.result||[])n.status==="failed"&&(n.status="pending",n.attempts=0,n.nextAttemptAt=0,n.updatedAt=this.now(),ie(n),i.put(n),s++)},l.oncomplete=()=>r(s),l.onerror=()=>a(l.error||new Error("Queue failed-entry reset failed")),l.onabort=()=>a(l.error||new Error("Queue failed-entry reset aborted"))}):0)}getPaused(t){return this.open().then(o=>o?new Promise((r,a)=>{const i=o.transaction(y,"readonly").objectStore(y).get(k(t));i.onsuccess=()=>{const u=i.result?i.result.value:!1;r(u||!1)},i.onerror=()=>a(g(i,"Queue pause-state read failed"))}):!1)}setPaused(t,o){return this.open().then(r=>{if(r)return new Promise((a,l)=>{const i=r.transaction(y,"readwrite"),u=typeof o=="string"?o:o?"manual":!1;i.objectStore(y).put({key:k(t),value:u}),i.oncomplete=()=>a(),i.onerror=()=>l(i.error||new Error("Queue pause-state write failed")),i.onabort=()=>l(i.error||new Error("Queue pause-state write aborted"))})})}clear(t){return this.open().then(o=>{if(o)return new Promise((r,a)=>{const l=o.transaction([w,y],"readwrite"),u=l.objectStore(w).index("by_scope_seq").openCursor(q(this.keyRange,t));u.onsuccess=s=>{const n=s.target.result;n&&(n.delete(),n.continue())},u.onerror=()=>a(g(u,"Queue clear failed")),l.objectStore(y).delete(oe(t)),l.objectStore(y).delete(k(t)),l.oncomplete=()=>r(),l.onerror=()=>a(l.error||new Error("Queue clear transaction failed")),l.onabort=()=>a(l.error||new Error("Queue clear transaction aborted"))})})}_updateEntry(t,o,r){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),s=u.objectStore(w),n=s.get(o);let c=null;n.onerror=()=>i(g(n,"Queue entry read failed")),n.onsuccess=()=>{const d=n.result;!d||d.scope!==t||(c=r(d,s))},u.oncomplete=()=>l(c),u.onerror=()=>i(u.error||new Error("Queue entry transaction failed")),u.onabort=()=>i(u.error||new Error("Queue entry transaction aborted"))}):null)}}(function(){const e="data-ln-api-queue",t="lnApiQueue",o=[2e3,5e3,15e3,6e4,3e5],r=8,a=6e4;if(window[t]!==void 0)return;function l(n){const c=n[t];c&&c._drain()}const i={"data-ln-api-queue":{type:"marker",description:"Mounts offline API synchronization queue backed by IndexedDB"},"data-ln-api-queue-online":{effect:l,type:"enum",values:["true","false"],fallback:"auto",description:"Network connectivity override (true/false, or auto-detect from navigator.onLine)"}},u=new je({indexedDB:window.indexedDB,IDBKeyRange:window.IDBKeyRange,uuid:R});function s(n){this.dom=n,n[t]=this;const c=n.closest("[data-ln-data-coordinator]");this.scope=n.id||(c?c.id:null)||"default",this._paused=!1,this._timers=new Map,this._workerId=R(),this._drainPromise=null,this._onlineHandler=()=>this._drain(),this._bindEvents(),window.addEventListener("online",this._onlineHandler);const d=this;return u.open().then(f=>f?u.getPaused(d.scope):(console.warn("[ln-api-queue] IndexedDB not available — queue disabled"),!1)).then(f=>{if(d._paused=!!f,d._paused){const m=typeof f=="string"?f:"auth";h(d.dom,"ln-api-queue:paused",{reason:m,restored:!0})}return d._emitPendingCount()}).then(()=>d._drain()).catch(f=>{console.error("[ln-api-queue] Initialization failed:",f),h(d.dom,"ln-api-queue:error",{operation:"initialize",error:f})}),this}s.prototype._isOnline=function(){const n=this.dom.getAttribute("data-ln-api-queue-online");return n==="true"?!0:n==="false"?!1:navigator.onLine},s.prototype._emitPendingCount=function(){const n=this;return u.allForScope(n.scope).then(c=>(h(n.dom,"ln-api-queue:pending-count",{count:c.length,scope:n.scope}),c.length===0&&h(n.dom,"ln-api-queue:drained",{scope:n.scope}),c))},s.prototype._clearTimer=function(n){const c=this._timers.get(n);c&&(clearTimeout(c),this._timers.delete(n))},s.prototype._scheduleTimer=function(n,c){const d=Math.max(0,c),f=this._timers.get(n);f&&clearTimeout(f);const m=this,b=setTimeout(()=>{m._timers.delete(n),m._drain()},d);this._timers.set(n,b)},s.prototype._drain=function(){const n=this;return n._paused||!n._isOnline()?Promise.resolve():(n._drainPromise||(n._drainPromise=u.claimReady(n.scope,n._workerId,a).then(c=>{for(const d of c.wakeups)n._scheduleTimer(d.chainKey,d.at-Date.now());for(const d of c.entries)n._clearTimer(d.chainKey),h(n.dom,"ln-api-queue:send",{entryId:d.entryId,chainKey:d.chainKey,op:d.op,targetId:d.targetId,payload:d.payload,expectedVersion:d.expectedVersion,idempotencyKey:d.entryId,meta:d.meta})}).catch(c=>{console.error("[ln-api-queue] Drain failed:",c),h(n.dom,"ln-api-queue:error",{operation:"drain",error:c})}).finally(()=>{n._drainPromise=null})),n._drainPromise)},s.prototype._onEnqueue=function(n){const c=this;return u.enqueue(c.scope,n.detail||{}).then(d=>{if(d)return c._emitPendingCount().then(f=>(h(c.dom,"ln-api-queue:enqueued",{entryId:d.entryId,chainKey:d.chainKey,count:f.length}),c._drain()))}).catch(d=>{h(c.dom,"ln-api-queue:error",{operation:"enqueue",error:d})})},s.prototype._onAck=function(n){const c=this,d=n.detail||{};return u.ack(c.scope,d.entryId).then(()=>c._emitPendingCount()).then(()=>c._drain()).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"ack",entryId:d.entryId,error:f})})},s.prototype._onNack=function(n){const c=this,d=n.detail||{};return u.nack(c.scope,d.entryId,d.reason,{maxAttempts:r,backoff:o}).then(f=>{if(f)return f.status==="failed"?h(c.dom,"ln-api-queue:failed",{entryId:f.entry.entryId,chainKey:f.entry.chainKey,attempts:f.entry.attempts}):f.status==="retry"?c._scheduleTimer(f.entry.chainKey,f.delay):f.status==="auth"&&(c._paused=!0,h(c.dom,"ln-api-queue:paused",{reason:"auth"}),h(c.dom,"ln-api-queue:auth-required",{entryId:f.entry.entryId,chainKey:f.entry.chainKey})),c._emitPendingCount().then(()=>{if(f.status==="dropped")return c._drain()})}).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"nack",entryId:d.entryId,error:f})})},s.prototype._onRemap=function(n){const c=this,d=n.detail||{};return u.remap(c.scope,d.oldKey,d.newId).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"remap",error:f})})},s.prototype._onResolveCreate=function(n){const c=this,d=n.detail||{};return u.resolveCreate(c.scope,d.entryId,d.oldKey,d.newId).then(()=>c._emitPendingCount()).then(()=>c._drain()).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"resolve-create",entryId:d.entryId,error:f})})},s.prototype._onResume=function(){const n=this;return u.setPaused(n.scope,!1).then(()=>(n._paused=!1,h(n.dom,"ln-api-queue:resumed",{}),n._drain())).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"resume",error:c})})},s.prototype._onPause=function(){const n=this;return u.setPaused(n.scope,"manual").then(()=>{n._paused=!0,h(n.dom,"ln-api-queue:paused",{reason:"manual"})}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"pause",error:c})})},s.prototype._onDrain=function(){const n=this;return u.resetFailed(n.scope).then(()=>{const c=n._drainPromise;return c?c.then(()=>n._drain()):n._drain()}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"manual-drain",error:c})})},s.prototype._onClear=function(){const n=this;return n._timers.forEach(c=>clearTimeout(c)),n._timers.clear(),u.clear(n.scope).then(()=>{n._paused=!1,h(n.dom,"ln-api-queue:pending-count",{count:0,scope:n.scope}),h(n.dom,"ln-api-queue:drained",{scope:n.scope})}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"clear",error:c})})},s.prototype._bindEvents=function(){const n=this;n._handlers={enqueue:c=>n._onEnqueue(c),ack:c=>n._onAck(c),nack:c=>n._onNack(c),remap:c=>n._onRemap(c),resolveCreate:c=>n._onResolveCreate(c),resume:()=>n._onResume(),pause:()=>n._onPause(),drain:()=>n._onDrain(),clear:()=>n._onClear()},n.dom.addEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.addEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.addEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.addEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.addEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.addEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.addEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.addEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.addEventListener("ln-api-queue:request-clear",n._handlers.clear)},s.prototype.destroy=function(){if(!this.dom[t])return;const n=this;n.dom.removeEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.removeEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.removeEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.removeEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.removeEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.removeEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.removeEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.removeEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.removeEventListener("ln-api-queue:request-clear",n._handlers.clear),window.removeEventListener("online",n._onlineHandler),n._timers.forEach(c=>clearTimeout(c)),n._timers.clear(),delete n.dom[t]},ne(e,t,s,"ln-api-queue",{attributes:i})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function E(){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 g(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 o=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){o=t[r];break}if(!g(o))return}e.apply(console,t)}}function Q(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function J(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function K(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,r={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const i=s[c];i.name&&i.type==="checkbox"&&!i.disabled&&(l[i.name]=(l[i.name]||0)+1)}for(let c=0;c<s.length;c++){const i=s[c];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(o&&i.matches&&i.matches(o)))if(i.type==="checkbox")n&&l[i.name]===1?r[i.name]=i.checked:(r[i.name]||(r[i.name]=[]),i.checked&&r[i.name].push(i.value));else if(i.type==="radio")i.checked&&(r[i.name]=i.value);else if(i.type==="select-multiple"){r[i.name]=[];for(let u=0;u<i.options.length;u++)i.options[u].selected&&r[i.name].push(i.options[u].value)}else if(n&&i.type==="hidden")r[i.name]=i.value;else if(n&&(i.type==="number"||i.type==="range")){const u=Number(i.value);r[i.name]=i.value===""||isNaN(u)?null:u}else r[i.name]=i.value}return r}function G(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function P(e,t){const n=e.elements,o=[],r={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(r[l.name]=(r[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 i=t[c];if(l.type==="checkbox"){if(Array.isArray(i))l.checked=i.indexOf(l.value)!==-1;else if(r[l.name]>1){const u=String(i).split(",").map(function(a){return a.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=G(i);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(i),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(i))for(let u=0;u<l.options.length;u++)l.options[u].selected=i.indexOf(l.options[u].value)!==-1;o.push(l)}else l.value=i,l.tagName==="SELECT"&&i!=null&&l.setAttribute("data-ln-value",i),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=P,window.lnCore.serializeForm=K,window.lnCore.resolveFormMethod=J);const L={};function X(e,t){L[e]=t}function Y(e){return L[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=X,window.lnCore.getDataMapper=Y);function Z(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){Q(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const I={};function ee(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];I[n]=t}function te(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return I[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ee,window.lnCore.getLocaleFallback=te,window.lnCore.ensureLocaleObserver=Z);const C={};function ne(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function T(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],i=c.getAttribute("data-ln-field");t[i]!=null&&(c.textContent=t[i])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const c=o[l],i=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<i.length;u++){const a=i[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const r=e.querySelectorAll("[data-ln-show]");for(let l=0;l<r.length;l++){const c=r[l],i=c.getAttribute("data-ln-show");i in t&&c.classList.toggle("hidden",!t[i])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],i=c.getAttribute("data-ln-class").split(",");for(let u=0;u<i.length;u++){const a=i[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function oe(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 o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)T(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(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 o=function(s,l){return t[l]!==void 0?t[l]:""},r=Array.from(e.querySelectorAll("*"));e.nodeType===1&&r.push(e);for(let s=0;s<r.length;s++){const l=r[s],c=l.attributes;for(let i=0;i<c.length;i++){const u=c[i];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function re(e,t,n,o,r,s){const l={};for(let i=0;i<e.children.length;i++){const u=e.children[i],a=u.getAttribute("data-ln-render-key");a&&(l[a]=u)}const c=document.createDocumentFragment();for(let i=0;i<t.length;i++){const u=t[i],a=String(o(u));let d=l[a];if(d)r(d,u,i);else{const f=ne(n,s);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),r(d,u,i)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=T,window.lnCore.lnFill=oe,window.lnCore.renderList=re);function m(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function D(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function F(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const r=o.trim().toLowerCase();return!(r==="false"||r==="0")}function N(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function M(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const o=new Set(e||[]),r=function(s,l){const c=s.getAttribute(l);return c!==null&&o.has(c)?c:t};return y.set(n,r),r}function R(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function q(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function B(e,t,n,o,r){if(!e||t===null)return!0;const s=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=i=>{r?console.warn(i,r):console.warn(i)};if(l==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const i=e.values||[];return i.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${i.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 i=parseInt(t,10);return e.min!==void 0&&i<e.min?(c(`[${s}] Value ${i} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(c(`[${s}] Value ${i} 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(i){return c(`[${s}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function ie(e,t,n){for(const o in n){const[r,s,l]=n[o];Object.defineProperty(e,o,{get:function(){return r(t,s,l)},enumerable:!0,configurable:!0})}return e}function le(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let r=o.read;if(!r&&o.type)switch(o.type){case"enum":r=M(o.values,o.fallback);break;case"integer":r=D;break;case"float":r=R;break;case"boolean":r=F;break;case"list":r=N;break;case"json":r=q;break;case"string":default:r=m;break}r||(r=m),t[o.prop]=[r,n,o.fallback]}return t}function se(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ce(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=ie,window.lnCore.attrSpec=le,window.lnCore.attrStr=m,window.lnCore.attrInt=D,window.lnCore.attrBool=F,window.lnCore.attrList=N,window.lnCore.attrEnum=M,window.lnCore.attrFloat=R,window.lnCore.attrJson=q);function A(e,t,n,o){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&l.push(e);for(const c of l)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(i){console.error("["+n+"] init failed",c,i)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ue(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ae(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 j(){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 de(e){const t=j(),n=e.observed||[];for(let o=0;o<n.length;o++){const r=n[o];t.byAttr.has(r)||t.byAttr.set(r,[]),t.byAttr.get(r).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const r=t.byDeclaredAttr.get(o);r.some(s=>s.componentTag===e.componentTag)||r.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ce(e);if(o===null)t.reactiveWildcard.push(e);else for(const r of o)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function W(e,t,n,o){for(let r=0;r<e.length;r++){const s=e[r];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,o):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,o)}}function fe(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=j(),r=o.byAttr.get(n);if(E()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&g(t)){const s=o.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let c=0;c<s.length;c++)B(s[c].spec,l,n,s[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||r)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=o.byReactive.get(n);s&&W(s,t,n,e.oldValue),o.reactiveWildcard.length&&W(o.reactiveWildcard,t,n,e.oldValue)}if(r)for(let s=0;s<r.length;s++){const l=r[s];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(A(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function we(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{fe(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function U(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function he(e){const t=U();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const r=o.query,s=e.target.nodeType===1?e.target.matches(r)?e.target:e.target.closest(r):e.target.parentElement?e.target.parentElement.closest(r):null;s&&o.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let r=0;r<t.length;r++){const s=t[r];A(o,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let r=0;r<t.length;r++){const s=t[r],l=s.query,c=Array.from(o.querySelectorAll(l));o.matches&&o.matches(l)&&c.push(o);for(let i=0;i<c.length;i++){const u=c[i];if(!document.contains(u)){const a=u[s.attribute];if(a&&typeof a.destroy=="function")try{a.destroy()}catch(d){console.error("["+s.attribute+"] destroy failed",u,d)}delete u[s.attribute]}}}}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{he(o)}catch(r){console.error("[ln-core] lifecycle handler failed",o.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function V(e,t,n,o,r={}){const s=r.extraAttributes||[],l=r.onAttributeChange||null,c=r.onSubtreeChange||null,i=r.onInit||null,u=r.onAttrChange||null,a=r.effects||null,d=r.attributes||null,f=d?se(d):a,ke=d?new Set(Object.keys(d)):null,Se=r.persist||null;function b(_){const w=_||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Le=d[h],k=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&k.push(w);for(let S=0;S<k.length;S++){const O=k[S];g(O)&&B(Le,O.getAttribute(h),h,o,O)}}i&&i(w)}const v=[];if(e.indexOf("[")!==-1){const _=/\[([\w-]+)/g;let w;for(;(w=_.exec(e))!==null;)v.push(w[1])}else v.push(e);de({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:i,observed:v.concat(s),onAttributeChange:l,onAttrChange:u,effects:f,declared:ke,persist:Se}),we();const Oe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ee=r.subtreeQuery||(Oe?e:"["+e+"]");U().push({selector:e,attribute:t,ComponentFn:n,onInit:i,onSubtreeChange:c,query:Ee}),pe(),window[t]=b,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=V);function H(){ue()>0?ae(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",H):H(),b}function z(e){return(e||"").replace(/^#/,"")}function x(e){const t=e===void 0?location.hash:e,n={},o=z(t);if(!o)return n;const r=o.split("&");for(let s=0;s<r.length;s++){const l=r[s];if(!l)continue;const c=l.indexOf(":"),i=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(i)try{n[i]=decodeURIComponent(u)}catch{n[i]=u}}return n}function be(e){if(!e)return null;const t=x();return e in t?t[e]:null}function ge(e,t){if(!e)return;const n=x();t==null?delete n[e]:n[e]=String(t);const r=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");z(location.hash)!==r&&(location.hash=r)}function Ce(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function me(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 o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function ye(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ae(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 xe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ve(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),r=o?o.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=x,window.lnCore.hashGet=be,window.lnCore.hashSet=ge,window.lnCore.hashLinkClick=Ce,window.lnCore.resolveHashNamespace=me,window.lnCore.hashSortEncode=ye,window.lnCore.hashSortDecode=Ae,window.lnCore.hashFilterEncode=xe,window.lnCore.hashFilterDecode=ve);function _e(){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=_e),(function(){const e="data-ln-autoresize",t="lnAutoresize";if(window[t]!==void 0)return;const n={"data-ln-autoresize":{type:"marker",description:"Automatically adjusts textarea height to match its scrollable content"}};function o(r){if(r.tagName!=="TEXTAREA")return console.warn("[ln-autoresize] Can only be applied to <textarea>, got:",r.tagName),this;this.dom=r;const s=this;return this._onInput=function(){s._resize()},r.addEventListener("input",this._onInput),this._resize(),this}o.prototype._resize=function(){this.dom.style.height="auto",this.dom.style.height=this.dom.scrollHeight+"px"},o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("input",this._onInput),this.dom.style.height="",delete this.dom[t])},V(e,t,o,"ln-autoresize",{attributes:n})})()})();
|
|
1
|
+
(function(){"use strict";function D(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function C(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 n=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){n=t[l];break}if(!C(n))return}e.apply(console,t)}}function G(e,t,o){const n=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,n),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function P(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function X(e,t){const o=!!(t&&t.typed),n=t&&t.exclude,l={},s=e.elements,i={};if(o)for(let c=0;c<s.length;c++){const r=s[c];r.name&&r.type==="checkbox"&&!r.disabled&&(i[r.name]=(i[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")&&!(n&&r.matches&&r.matches(n)))if(r.type==="checkbox")o&&i[r.name]===1?l[r.name]=r.checked:(l[r.name]||(l[r.name]=[]),r.checked&&l[r.name].push(r.value));else if(r.type==="radio")r.checked&&(l[r.name]=r.value);else if(r.type==="select-multiple"){l[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&l[r.name].push(r.options[u].value)}else if(o&&r.type==="hidden")l[r.name]=r.value;else if(o&&(r.type==="number"||r.type==="range")){const u=Number(r.value);l[r.name]=r.value===""||isNaN(u)?null:u}else l[r.name]=r.value}return l}function Y(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function Z(e,t){const o=e.elements,n=[],l={};for(let s=0;s<o.length;s++){const i=o[s];i.name&&i.type==="checkbox"&&(l[i.name]=(l[i.name]||0)+1)}for(let s=0;s<o.length;s++){const i=o[s];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const c=i.getAttribute("data-ln-fill-as")||i.name;if(!c||!(c in t))continue;const r=t[c];if(i.type==="checkbox"){if(Array.isArray(r))i.checked=r.indexOf(i.value)!==-1;else if(l[i.name]>1){const u=String(r).split(",").map(function(d){return d.trim()});i.checked=u.indexOf(i.value)!==-1}else i.checked=Y(r);n.push(i)}else if(i.type==="radio")i.checked=i.value===String(r),n.push(i);else if(i.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<i.options.length;u++)i.options[u].selected=r.indexOf(i.options[u].value)!==-1;n.push(i)}else i.value=r,i.tagName==="SELECT"&&r!=null&&i.setAttribute("data-ln-value",r),n.push(i)}return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=Z,window.lnCore.serializeForm=X,window.lnCore.resolveFormMethod=P);const I={};function ee(e,t){I[e]=t}function te(e){return I[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ee,window.lnCore.getDataMapper=te);function ne(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){G(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const q={};function oe(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];q[o]=t}function re(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return q[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=oe,window.lnCore.getLocaleFallback=re,window.lnCore.ensureLocaleObserver=ne);const m={};function ie(e,t){m[e]||(m[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=m[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let i=0;i<o.length;i++){const c=o[i],r=c.getAttribute("data-ln-field");t[r]!=null&&(c.textContent=t[r])}const n=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<n.length;i++){const c=n[i],r=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const d=r[u].trim().split(":");if(d.length!==2)continue;const a=d[0].trim(),f=d[1].trim();t[f]!=null&&c.setAttribute(a,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const c=l[i],r=c.getAttribute("data-ln-show");r in t&&c.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let i=0;i<s.length;i++){const c=s[i],r=c.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const d=r[u].trim().split(":");if(d.length!==2)continue;const a=d[0].trim(),f=d[1].trim();f in t&&c.classList.toggle(a,!!t[f])}}return e}function le(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let n=0;n<o.length;n++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[n],t??null),o[n].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)F(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function T(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const s=o.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,c){return t[c]!==void 0?t[c]:""}))}const n=function(s,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const i=l[s],c=i.attributes;for(let r=0;r<c.length;r++){const u=c[r];u.value.indexOf("{{")!==-1&&i.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,n))}}return e}function se(e,t,o,n,l,s){const i={};for(let r=0;r<e.children.length;r++){const u=e.children[r],d=u.getAttribute("data-ln-render-key");d&&(i[d]=u)}const c=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],d=String(n(u));let a=i[d];if(a)l(a,u,r);else{const f=ie(o,s);if(!f||(T(f,u),a=f.firstElementChild,!a))continue;a.setAttribute("data-ln-render-key",d),l(a,u,r)}c.appendChild(a)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=T,window.lnCore.fill=F,window.lnCore.lnFill=le,window.lnCore.renderList=se);function y(e,t,o){const n=e.getAttribute(t);return n===null?o:n}function $(e,t,o){const n=parseInt(e.getAttribute(t),10);return isNaN(n)?o:n}function N(e,t,o=!1){const n=e.getAttribute(t);if(n===null)return!!o;const l=n.trim().toLowerCase();return!(l==="false"||l==="0")}function M(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const A=new Map;function R(e,t){const o=(e?e.join("|"):"")+"::"+t;if(A.has(o))return A.get(o);const n=new Set(e||[]),l=function(s,i){const c=s.getAttribute(i);return c!==null&&n.has(c)?c:t};return A.set(o,l),l}function B(e,t,o){const n=parseFloat(e.getAttribute(t));return isNaN(n)?o:n}function j(e,t,o){const n=e.getAttribute(t);if(!n)return o;try{return JSON.parse(n)}catch{return o}}function W(e,t,o,n,l){if(!e||t===null)return!0;const s=n||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const c=r=>{l?console.warn(r,l):console.warn(r)};if(i==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const r=e.values||[];return r.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${o}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(c(`[${s}] Value ${r} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(c(`[${s}] Value ${r} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(r){return c(`[${s}] Invalid JSON for attribute "${o}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function ce(e,t,o){for(const n in o){const[l,s,i]=o[n];Object.defineProperty(e,n,{get:function(){return l(t,s,i)},enumerable:!0,configurable:!0})}return e}function ue(e){const t={};for(const o in e){const n=e[o];if(!n||!n.prop)continue;let l=n.read;if(!l&&n.type)switch(n.type){case"enum":l=R(n.values,n.fallback);break;case"integer":l=$;break;case"float":l=B;break;case"boolean":l=N;break;case"list":l=M;break;case"json":l=j;break;case"string":default:l=y;break}l||(l=y),t[n.prop]=[l,o,n.fallback]}return t}function ae(e){const t={};for(const o in e){const n=e[o];n&&n.effect&&(t[o]=n.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 o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ce,window.lnCore.attrSpec=ue,window.lnCore.attrStr=y,window.lnCore.attrInt=$,window.lnCore.attrBool=N,window.lnCore.attrList=M,window.lnCore.attrEnum=R,window.lnCore.attrFloat=B,window.lnCore.attrJson=j);function h(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function U(e,t,o,n){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:o,ComponentFn:n};if(e.matches&&e.matches(s)&&h(e,i),e.querySelectorAll){const c=e.querySelectorAll(s);for(let r=0;r<c.length;r++)h(c[r],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function fe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function we(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function V(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function he(e){const t=V(),o=e.observed||[];for(let n=0;n<o.length;n++){const l=o[n];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const n in e.attributes){t.byDeclaredAttr.has(n)||t.byDeclaredAttr.set(n,[]);const l=t.byDeclaredAttr.get(n);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[n],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const n=de(e);if(n===null)t.reactiveWildcard.push(e);else for(const l of n)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function z(e,t,o,n){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const i=s.effects&&s.effects[o];i?i(t,o,n):s.onAttrChange&&(!s.declared||s.declared.has(o))&&s.onAttrChange(t,o,n)}}function be(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,n=V(),l=n.byAttr.get(t),s=D()&&n.byDeclaredAttr&&n.byDeclaredAttr.has(t);if(!o&&!l&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&C(i)){const c=n.byDeclaredAttr.get(t),r=i.getAttribute(t);for(let u=0;u<c.length;u++)W(c[u].spec,r,t,c[u].componentTag,i)}if(window.lnCore._debugSink&&(o||l)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),o){const c=n.byReactive.get(t);c&&z(c,i,t,e.oldValue),n.reactiveWildcard.length&&z(n.reactiveWildcard,i,t,e.oldValue)}if(l)for(let c=0;c<l.length;c++){const r=l[c];if(r.handler){r.handler(i,t,e.oldValue);continue}r.onAttributeChange&&i[r.attribute]?r.onAttributeChange(i,t):(U(i,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(i))}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{be(t[o])}catch(n){console.error("[ln-core] mutation handler failed",t[o].target,n)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function x(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function v(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(n){console.error("["+t.attribute+"] destroy failed",e,n)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ge(e){const t=x();if(t.length){if(e.target)for(let o=0;o<t.length;o++){const n=t[o];if(n.onSubtreeChange&&n.query){const l=n.query,s=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;s&&n.onSubtreeChange(s,e)}}for(let o=0;o<e.addedNodes.length;o++){const n=e.addedNodes[o];if(n.nodeType===1){const l=!!(n.firstElementChild||n.children&&n.children.length);for(let s=0;s<t.length;s++){const i=t[s];if(i.selector&&i.attribute&&i.ComponentFn){if(!l)n.matches&&n.matches(i.query)&&h(n,i);else if(n.matches&&n.matches(i.query)&&h(n,i),n.querySelectorAll){const c=n.querySelectorAll(i.query);for(let r=0;r<c.length;r++)h(c[r],i)}}i.onInit&&i.onInit(n)}}}for(let o=0;o<e.removedNodes.length;o++){const n=e.removedNodes[o];if(n.nodeType===1){const l=!!(n.firstElementChild||n.children&&n.children.length);for(let s=0;s<t.length;s++){const i=t[s],c=i.query;if(c){if(!l)n.matches&&n.matches(c)&&v(n,i);else if(n.matches&&n.matches(c)&&v(n,i),n.querySelectorAll){const r=n.querySelectorAll(c);for(let u=0;u<r.length;u++)v(r[u],i)}}}}}}}function H(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const n=t[o];if(n.type==="childList")try{ge(n)}catch(l){console.error("[ln-core] lifecycle handler failed",n.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ce(e){x().push(e),H()}function Q(e,t,o,n,l={}){const s=l.extraAttributes||[],i=l.onAttributeChange||null,c=l.onSubtreeChange||null,r=l.onInit||null,u=l.onAttrChange||null,d=l.effects||null,a=l.attributes||null,f=a?ae(a):d,Ee=a?new Set(Object.keys(a)):null,Le=l.persist||null;function g(S){const w=S||document.body;if(U(w,e,t,o),a&&D())for(const b in a){const qe=a[b],O=Array.from(w.querySelectorAll("["+b+"]"));w.matches&&w.matches("["+b+"]")&&O.push(w);for(let E=0;E<O.length;E++){const L=O[E];C(L)&&W(qe,L.getAttribute(b),b,n,L)}}r&&r(w)}const k=[];if(e.indexOf("[")!==-1){const S=/\[([\w-]+)/g;let w;for(;(w=S.exec(e))!==null;)k.push(w[1])}else k.push(e);he({selector:e,attribute:t,componentTag:n,attributes:a,ComponentFn:o,onInit:r,observed:k.concat(s),onAttributeChange:i,onAttrChange:u,effects:f,declared:Ee,persist:Le}),pe();const De=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ie=l.subtreeQuery||(De?e:"["+e+"]");x().push({selector:e,attribute:t,ComponentFn:o,onInit:r,onSubtreeChange:c,query:Ie}),H(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Q,window.lnCore.observeLifecycle=Ce);function K(){fe()>0?we(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",K):K(),g}function J(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,o={},n=J(t);if(!n)return o;const l=n.split("&");for(let s=0;s<l.length;s++){const i=l[s];if(!i)continue;const c=i.indexOf(":"),r=c>-1?i.slice(0,c):i,u=c>-1?i.slice(c+1):"";if(r)try{o[r]=decodeURIComponent(u)}catch{o[r]=u}}return o}function me(e){if(!e)return null;const t=_();return e in t?t[e]:null}function ye(e,t){if(!e)return;const o=_();t==null?delete o[e]:o[e]=String(t);const l=Object.keys(o).map(function(s){const i=o[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");J(location.hash)!==l&&(location.hash=l)}function Ae(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function xe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const n=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return n?t?n+"-"+t:n:t||null}function ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function _e(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ke(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Se(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),n=e.slice(t+1),l=n?n.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=me,window.lnCore.hashSet=ye,window.lnCore.hashLinkClick=Ae,window.lnCore.resolveHashNamespace=xe,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=_e,window.lnCore.hashFilterEncode=ke,window.lnCore.hashFilterDecode=Se);function Oe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Oe),(function(){const e="data-ln-autoresize",t="lnAutoresize";if(window[t]!==void 0)return;const o={"data-ln-autoresize":{type:"marker",description:"Automatically adjusts textarea height to match its scrollable content"}};function n(l){if(l.tagName!=="TEXTAREA")return console.warn("[ln-autoresize] Can only be applied to <textarea>, got:",l.tagName),this;this.dom=l;const s=this;return this._onInput=function(){s._resize()},l.addEventListener("input",this._onInput),this._resize(),this}n.prototype._resize=function(){this.dom.style.height="auto",this.dom.style.height=this.dom.scrollHeight+"px"},n.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("input",this._onInput),this.dom.style.height="",delete this.dom[t])},Q(e,t,n,"ln-autoresize",{attributes:o})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function N(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function _(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){r=t[i];break}if(!_(r))return}e.apply(console,t)}}function v(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 Z(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r);const i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});return e.dispatchEvent(i),i}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ee(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function R(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,i={},s=e.elements,l={};if(n)for(let a=0;a<s.length;a++){const o=s[a];o.name&&o.type==="checkbox"&&!o.disabled&&(l[o.name]=(l[o.name]||0)+1)}for(let a=0;a<s.length;a++){const o=s[a];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(r&&o.matches&&o.matches(r)))if(o.type==="checkbox")n&&l[o.name]===1?i[o.name]=o.checked:(i[o.name]||(i[o.name]=[]),o.checked&&i[o.name].push(o.value));else if(o.type==="radio")o.checked&&(i[o.name]=o.value);else if(o.type==="select-multiple"){i[o.name]=[];for(let u=0;u<o.options.length;u++)o.options[u].selected&&i[o.name].push(o.options[u].value)}else if(n&&o.type==="hidden")i[o.name]=o.value;else if(n&&(o.type==="number"||o.type==="range")){const u=Number(o.value);i[o.name]=o.value===""||isNaN(u)?null:u}else i[o.name]=o.value}return i}function te(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function $(e,t){const n=e.elements,r=[],i={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(i[l.name]=(i[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 a=l.getAttribute("data-ln-fill-as")||l.name;if(!a||!(a in t))continue;const o=t[a];if(l.type==="checkbox"){if(Array.isArray(o))l.checked=o.indexOf(l.value)!==-1;else if(i[l.name]>1){const u=String(o).split(",").map(function(d){return d.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=te(o);r.push(l)}else if(l.type==="radio")l.checked=l.value===String(o),r.push(l);else if(l.type==="select-multiple"){if(Array.isArray(o))for(let u=0;u<l.options.length;u++)l.options[u].selected=o.indexOf(l.options[u].value)!==-1;r.push(l)}else l.value=o,l.tagName==="SELECT"&&o!=null&&l.setAttribute("data-ln-value",o),r.push(l)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=$,window.lnCore.serializeForm=R,window.lnCore.resolveFormMethod=ee);const M={};function ne(e,t){M[e]=t}function oe(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ne,window.lnCore.getDataMapper=oe);function re(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){v(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const B={};function ie(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];B[n]=t}function le(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return B[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ie,window.lnCore.getLocaleFallback=le,window.lnCore.ensureLocaleObserver=re);const x={};function se(e,t){x[e]||(x[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=x[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 l=0;l<n.length;l++){const a=n[l],o=a.getAttribute("data-ln-field");t[o]!=null&&(a.textContent=t[o])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const a=r[l],o=a.getAttribute("data-ln-attr").split(",");for(let u=0;u<o.length;u++){const d=o[u].trim().split(":");if(d.length!==2)continue;const c=d[0].trim(),h=d[1].trim();t[h]!=null&&a.setAttribute(c,t[h])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const a=i[l],o=a.getAttribute("data-ln-show");o in t&&a.classList.toggle("hidden",!t[o])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const a=s[l],o=a.getAttribute("data-ln-class").split(",");for(let u=0;u<o.length;u++){const d=o[u].trim().split(":");if(d.length!==2)continue;const c=d[0].trim(),h=d[1].trim();h in t&&a.classList.toggle(c,!!t[h])}}return e}function ae(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 j(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,a){return t[a]!==void 0?t[a]:""}))}const r=function(s,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let s=0;s<i.length;s++){const l=i[s],a=l.attributes;for(let o=0;o<a.length;o++){const u=a[o];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function ue(e,t,n,r,i,s){const l={};for(let o=0;o<e.children.length;o++){const u=e.children[o],d=u.getAttribute("data-ln-render-key");d&&(l[d]=u)}const a=document.createDocumentFragment();for(let o=0;o<t.length;o++){const u=t[o],d=String(r(u));let c=l[d];if(c)i(c,u,o);else{const h=se(n,s);if(!h||(j(h,u),c=h.firstElementChild,!c))continue;c.setAttribute("data-ln-render-key",d),i(c,u,o)}a.appendChild(c)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=j,window.lnCore.fill=q,window.lnCore.lnFill=ae,window.lnCore.renderList=ue);function k(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function U(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function W(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const i=r.trim().toLowerCase();return!(i==="false"||i==="0")}function H(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const S=new Map;function V(e,t){const n=(e?e.join("|"):"")+"::"+t;if(S.has(n))return S.get(n);const r=new Set(e||[]),i=function(s,l){const a=s.getAttribute(l);return a!==null&&r.has(a)?a:t};return S.set(n,i),i}function J(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function K(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function Q(e,t,n,r,i){if(!e||t===null)return!0;const s=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const a=o=>{i?console.warn(o,i):console.warn(o)};if(l==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const o=e.values||[];return o.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(a(`[${s}] Value ${o} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(a(`[${s}] Value ${o} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(o){return a(`[${s}] Invalid JSON for attribute "${n}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function ce(e,t,n){for(const r in n){const[i,s,l]=n[r];Object.defineProperty(e,r,{get:function(){return i(t,s,l)},enumerable:!0,configurable:!0})}return e}function de(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let i=r.read;if(!i&&r.type)switch(r.type){case"enum":i=V(r.values,r.fallback);break;case"integer":i=U;break;case"float":i=J;break;case"boolean":i=W;break;case"list":i=H;break;case"json":i=K;break;case"string":default:i=k;break}i||(i=k),t[r.prop]=[i,n,r.fallback]}return t}function fe(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 we(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=ce,window.lnCore.attrSpec=de,window.lnCore.attrStr=k,window.lnCore.attrInt=U,window.lnCore.attrBool=W,window.lnCore.attrList=H,window.lnCore.attrEnum=V,window.lnCore.attrFloat=J,window.lnCore.attrJson=K);function E(e,t,n,r){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&l.push(e);for(const a of l)if(!a[n]){window.lnCore._persistSink&&a.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(a,t);try{a[n]=new r(a)}catch(o){console.error("["+n+"] init failed",a,o)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function he(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function be(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 P(){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 pe(e){const t=P(),n=e.observed||[];for(let r=0;r<n.length;r++){const i=n[r];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const i=t.byDeclaredAttr.get(r);i.some(s=>s.componentTag===e.componentTag)||i.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=we(e);if(r===null)t.reactiveWildcard.push(e);else for(const i of r)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function X(e,t,n,r){for(let i=0;i<e.length;i++){const s=e[i];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,r):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,r)}}function ge(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=P(),i=r.byAttr.get(n);if(N()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&_(t)){const s=r.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let a=0;a<s.length;a++)Q(s[a].spec,l,n,s[a].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||i)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=r.byReactive.get(n);s&&X(s,t,n,e.oldValue),r.reactiveWildcard.length&&X(r.reactiveWildcard,t,n,e.oldValue)}if(i)for(let s=0;s<i.length;s++){const l=i[s];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(E(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ge(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 z(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function me(e){const t=z();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const i=r.query,s=e.target.nodeType===1?e.target.matches(i)?e.target:e.target.closest(i):e.target.parentElement?e.target.parentElement.closest(i):null;s&&r.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let i=0;i<t.length;i++){const s=t[i];E(r,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let i=0;i<t.length;i++){const s=t[i],l=s.query,a=Array.from(r.querySelectorAll(l));r.matches&&r.matches(l)&&a.push(r);for(let o=0;o<a.length;o++){const u=a[o];if(!document.contains(u)){const d=u[s.attribute];if(d&&typeof d.destroy=="function")try{d.destroy()}catch(c){console.error("["+s.attribute+"] destroy failed",u,c)}delete u[s.attribute]}}}}}}function ye(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{me(r)}catch(i){console.error("[ln-core] lifecycle handler failed",r.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function G(e,t,n,r,i={}){const s=i.extraAttributes||[],l=i.onAttributeChange||null,a=i.onSubtreeChange||null,o=i.onInit||null,u=i.onAttrChange||null,d=i.effects||null,c=i.attributes||null,h=c?fe(c):d,m=c?new Set(Object.keys(c)):null,O=i.persist||null;function p(g){const b=g||document.body;if(E(b,e,t,n),c&&N())for(const y in c){const Ne=c[y],I=Array.from(b.querySelectorAll("["+y+"]"));b.matches&&b.matches("["+y+"]")&&I.push(b);for(let D=0;D<I.length;D++){const F=I[D];_(F)&&Q(Ne,F.getAttribute(y),y,r,F)}}o&&o(b)}const C=[];if(e.indexOf("[")!==-1){const g=/\[([\w-]+)/g;let b;for(;(b=g.exec(e))!==null;)C.push(b[1])}else C.push(e);pe({selector:e,attribute:t,componentTag:r,attributes:c,ComponentFn:n,onInit:o,observed:C.concat(s),onAttributeChange:l,onAttrChange:u,effects:h,declared:m,persist:O}),Ce();const w=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,f=i.subtreeQuery||(w?e:"["+e+"]");z().push({selector:e,attribute:t,ComponentFn:n,onInit:o,onSubtreeChange:a,query:f}),ye(),window[t]=p,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=G);function T(){he()>0?be(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",T):T(),p}function Y(e){return(e||"").replace(/^#/,"")}function L(e){const t=e===void 0?location.hash:e,n={},r=Y(t);if(!r)return n;const i=r.split("&");for(let s=0;s<i.length;s++){const l=i[s];if(!l)continue;const a=l.indexOf(":"),o=a>-1?l.slice(0,a):l,u=a>-1?l.slice(a+1):"";if(o)try{n[o]=decodeURIComponent(u)}catch{n[o]=u}}return n}function ve(e){if(!e)return null;const t=L();return e in t?t[e]:null}function Ae(e,t){if(!e)return;const n=L();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");Y(location.hash)!==i&&(location.hash=i)}function _e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function xe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const 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 ke(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Se(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ee(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Le(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),i=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=L,window.lnCore.hashGet=ve,window.lnCore.hashSet=Ae,window.lnCore.hashLinkClick=_e,window.lnCore.resolveHashNamespace=xe,window.lnCore.hashSortEncode=ke,window.lnCore.hashSortDecode=Se,window.lnCore.hashFilterEncode=Ee,window.lnCore.hashFilterDecode=Le);function Oe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Oe);const Te="ln-autosave:",Ie=1e3;function De(e,t){return t?Te+(e||"")+":"+t:null}function Fe(e,t=Ie){if(e==null)return 0;if(e==="")return t;const n=parseInt(String(e),10);return isNaN(n)||n<0?t:n}(function(){const e="data-ln-autosave",t="lnAutosave",n="data-ln-autosave-clear",r="data-ln-autosave-debounce-input",i='[data-ln-autosave-exclude], input[type="password"]';if(window[t]!==void 0)return;const s={"data-ln-autosave":{type:"string",description:"Form autosave storage key identifier"},"data-ln-autosave-debounce-input":{type:"integer",fallback:500,min:0,description:"Debounce delay in milliseconds before saving on input events"},"data-ln-autosave-clear":{type:"marker",description:"Designates a button that clears saved form data from localStorage"},"data-ln-autosave-exclude":{type:"marker",description:"Excludes form control from autosave serialization"}};function l(o){const u=o.tagName;return u==="INPUT"||u==="TEXTAREA"||u==="SELECT"}function a(o){const d=o.getAttribute(e)||o.id,c=De(window.location.pathname,d);if(!c){console.warn("ln-autosave: form needs an id or data-ln-autosave value",o);return}this.dom=o,this.key=c;let h=null;function m(){const w=R(o,{exclude:i});try{localStorage.setItem(c,JSON.stringify(w))}catch{return}v(o,"ln-autosave:saved",{target:o,data:w})}function O(){let w;try{w=localStorage.getItem(c)}catch{return}if(!w)return;let f;try{f=JSON.parse(w)}catch{return}if(Z(o,"ln-autosave:before-restore",{target:o,data:f}).defaultPrevented)return;const g=$(o,f);for(let b=0;b<g.length;b++)g[b].dispatchEvent(new Event("input",{bubbles:!0})),g[b].dispatchEvent(new Event("change",{bubbles:!0}));v(o,"ln-autosave:restored",{target:o,data:f})}function p(){try{localStorage.removeItem(c)}catch{return}v(o,"ln-autosave:cleared",{target:o})}this._onFocusout=function(w){const f=w.target;l(f)&&f.name&&!f.matches(i)&&m()},this._onChange=function(w){const f=w.target;l(f)&&f.name&&!f.matches(i)&&m()},this._onSubmit=function(){p()},this._onReset=function(){p()},this._onClearClick=function(w){w.target.closest("["+n+"]")&&p()},o.addEventListener("focusout",this._onFocusout),o.addEventListener("change",this._onChange),o.addEventListener("submit",this._onSubmit),o.addEventListener("reset",this._onReset),o.addEventListener("click",this._onClearClick);const C=Fe(o.getAttribute(r));return C>0&&(this._onInput=function(w){const f=w.target;!l(f)||!f.name||f.matches(i)||(h!==null&&clearTimeout(h),h=setTimeout(m,C))},o.addEventListener("input",this._onInput)),this._getInputTimer=function(){return h},O(),this}a.prototype.destroy=function(){if(this.dom[t]){if(this.dom.removeEventListener("focusout",this._onFocusout),this.dom.removeEventListener("change",this._onChange),this.dom.removeEventListener("submit",this._onSubmit),this.dom.removeEventListener("reset",this._onReset),this.dom.removeEventListener("click",this._onClearClick),this._onInput){this.dom.removeEventListener("input",this._onInput);const o=this._getInputTimer();o!==null&&clearTimeout(o)}delete this.dom[t]}},G(e,t,a,"ln-autosave",{attributes:s})})()})();
|
|
1
|
+
(function(){"use strict";function q(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function x(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 o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!x(o))return}e.apply(console,t)}}function A(e,t,r){const o=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function ne(e,t,r){const o=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o);const l=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:o});return e.dispatchEvent(l),l}function _(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){_(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function oe(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function $(e,t){const r=!!(t&&t.typed),o=t&&t.exclude,l={},s=e.elements,i={};if(r)for(let a=0;a<s.length;a++){const n=s[a];n.name&&n.type==="checkbox"&&!n.disabled&&(i[n.name]=(i[n.name]||0)+1)}for(let a=0;a<s.length;a++){const n=s[a];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(o&&n.matches&&n.matches(o)))if(n.type==="checkbox")r&&i[n.name]===1?l[n.name]=n.checked:(l[n.name]||(l[n.name]=[]),n.checked&&l[n.name].push(n.value));else if(n.type==="radio")n.checked&&(l[n.name]=n.value);else if(n.type==="select-multiple"){l[n.name]=[];for(let c=0;c<n.options.length;c++)n.options[c].selected&&l[n.name].push(n.options[c].value)}else if(r&&n.type==="hidden")l[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const c=Number(n.value);l[n.name]=n.value===""||isNaN(c)?null:c}else l[n.name]=n.value}return l}function re(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function M(e,t){const r=e.elements,o=[],l={};for(let s=0;s<r.length;s++){const i=r[s];i.name&&i.type==="checkbox"&&(l[i.name]=(l[i.name]||0)+1)}for(let s=0;s<r.length;s++){const i=r[s];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const a=i.getAttribute("data-ln-fill-as")||i.name;if(!a||!(a in t))continue;const n=t[a];if(i.type==="checkbox"){if(Array.isArray(n))i.checked=n.indexOf(i.value)!==-1;else if(l[i.name]>1){const c=String(n).split(",").map(function(d){return d.trim()});i.checked=c.indexOf(i.value)!==-1}else i.checked=re(n);o.push(i)}else if(i.type==="radio")i.checked=i.value===String(n),o.push(i);else if(i.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<i.options.length;c++)i.options[c].selected=n.indexOf(i.options[c].value)!==-1;o.push(i)}else i.value=n,i.tagName==="SELECT"&&n!=null&&i.setAttribute("data-ln-value",n),o.push(i)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=M,window.lnCore.serializeForm=$,window.lnCore.resolveFormMethod=oe);const B={};function ie(e,t){B[e]=t}function le(e){return B[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ie,window.lnCore.getDataMapper=le);function se(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,_(function(){new MutationObserver(function(){A(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const j={};function ae(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];j[r]=t}function ce(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return j[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ae,window.lnCore.getLocaleFallback=ce,window.lnCore.ensureLocaleObserver=se);const S={};function ue(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=S[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function U(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let i=0;i<r.length;i++){const a=r[i],n=a.getAttribute("data-ln-field");t[n]!=null&&(a.textContent=t[n])}const o=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<o.length;i++){const a=o[i],n=a.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),h=d[1].trim();t[h]!=null&&a.setAttribute(u,t[h])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const a=l[i],n=a.getAttribute("data-ln-show");n in t&&a.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let i=0;i<s.length;i++){const a=s[i],n=a.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),h=d[1].trim();h in t&&a.classList.toggle(u,!!t[h])}}return e}function de(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<r.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[o],t??null),r[o].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)U(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function W(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const s=r.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,a){return t[a]!==void 0?t[a]:""}))}const o=function(s,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const i=l[s],a=i.attributes;for(let n=0;n<a.length;n++){const c=a[n];c.value.indexOf("{{")!==-1&&i.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function fe(e,t,r,o,l,s){const i={};for(let n=0;n<e.children.length;n++){const c=e.children[n],d=c.getAttribute("data-ln-render-key");d&&(i[d]=c)}const a=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],d=String(o(c));let u=i[d];if(u)l(u,c,n);else{const h=ue(r,s);if(!h||(W(h,c),u=h.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),l(u,c,n)}a.appendChild(u)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=U,window.lnCore.lnFill=de,window.lnCore.renderList=fe);function k(e,t,r){const o=e.getAttribute(t);return o===null?r:o}function H(e,t,r){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?r:o}function V(e,t,r=!1){const o=e.getAttribute(t);if(o===null)return!!r;const l=o.trim().toLowerCase();return!(l==="false"||l==="0")}function J(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const E=new Map;function K(e,t){const r=(e?e.join("|"):"")+"::"+t;if(E.has(r))return E.get(r);const o=new Set(e||[]),l=function(s,i){const a=s.getAttribute(i);return a!==null&&o.has(a)?a:t};return E.set(r,l),l}function Q(e,t,r){const o=parseFloat(e.getAttribute(t));return isNaN(o)?r:o}function P(e,t,r){const o=e.getAttribute(t);if(!o)return r;try{return JSON.parse(o)}catch{return r}}function X(e,t,r,o,l){if(!e||t===null)return!0;const s=o||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const a=n=>{l?console.warn(n,l):console.warn(n)};if(i==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const n=e.values||[];return n.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(a(`[${s}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(a(`[${s}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(n){return a(`[${s}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function we(e,t,r){for(const o in r){const[l,s,i]=r[o];Object.defineProperty(e,o,{get:function(){return l(t,s,i)},enumerable:!0,configurable:!0})}return e}function he(e){const t={};for(const r in e){const o=e[r];if(!o||!o.prop)continue;let l=o.read;if(!l&&o.type)switch(o.type){case"enum":l=K(o.values,o.fallback);break;case"integer":l=H;break;case"float":l=Q;break;case"boolean":l=V;break;case"list":l=J;break;case"json":l=P;break;case"string":default:l=k;break}l||(l=k),t[o.prop]=[l,r,o.fallback]}return t}function be(e){const t={};for(const r in e){const o=e[r];o&&o.effect&&(t[r]=o.effect)}return Object.keys(t).length?t:null}function pe(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=we,window.lnCore.attrSpec=he,window.lnCore.attrStr=k,window.lnCore.attrInt=H,window.lnCore.attrBool=V,window.lnCore.attrList=J,window.lnCore.attrEnum=K,window.lnCore.attrFloat=Q,window.lnCore.attrJson=P);function m(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(r){console.error("["+t.attribute+"] init failed",e,r)}}}function z(e,t,r,o){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:r,ComponentFn:o};if(e.matches&&e.matches(s)&&m(e,i),e.querySelectorAll){const a=e.querySelectorAll(s);for(let n=0;n<a.length;n++)m(a[n],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ge(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ce(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 G(){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 me(e){const t=G(),r=e.observed||[];for(let o=0;o<r.length;o++){const l=r[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=pe(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function Y(e,t,r,o){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const i=s.effects&&s.effects[r];i?i(t,r,o):s.onAttrChange&&(!s.declared||s.declared.has(r))&&s.onAttrChange(t,r,o)}}function ye(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,o=G(),l=o.byAttr.get(t),s=q()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!r&&!l&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&x(i)){const a=o.byDeclaredAttr.get(t),n=i.getAttribute(t);for(let c=0;c<a.length;c++)X(a[c].spec,n,t,a[c].componentTag,i)}if(window.lnCore._debugSink&&(r||l)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),r){const a=o.byReactive.get(t);a&&Y(a,i,t,e.oldValue),o.reactiveWildcard.length&&Y(o.reactiveWildcard,i,t,e.oldValue)}if(l)for(let a=0;a<l.length;a++){const n=l[a];if(n.handler){n.handler(i,t,e.oldValue);continue}n.onAttributeChange&&i[n.attribute]?n.onAttributeChange(i,t):(z(i,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(i))}}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,_(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{ye(t[r])}catch(o){console.error("[ln-core] mutation handler failed",t[r].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function L(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function O(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(o){console.error("["+t.attribute+"] destroy failed",e,o)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ae(e){const t=L();if(t.length){if(e.target)for(let r=0;r<t.length;r++){const o=t[r];if(o.onSubtreeChange&&o.query){const l=o.query,s=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;s&&o.onSubtreeChange(s,e)}}for(let r=0;r<e.addedNodes.length;r++){const o=e.addedNodes[r];if(o.nodeType===1){const l=!!(o.firstElementChild||o.children&&o.children.length);for(let s=0;s<t.length;s++){const i=t[s];if(i.selector&&i.attribute&&i.ComponentFn){if(!l)o.matches&&o.matches(i.query)&&m(o,i);else if(o.matches&&o.matches(i.query)&&m(o,i),o.querySelectorAll){const a=o.querySelectorAll(i.query);for(let n=0;n<a.length;n++)m(a[n],i)}}i.onInit&&i.onInit(o)}}}for(let r=0;r<e.removedNodes.length;r++){const o=e.removedNodes[r];if(o.nodeType===1){const l=!!(o.firstElementChild||o.children&&o.children.length);for(let s=0;s<t.length;s++){const i=t[s],a=i.query;if(a){if(!l)o.matches&&o.matches(a)&&O(o,i);else if(o.matches&&o.matches(a)&&O(o,i),o.querySelectorAll){const n=o.querySelectorAll(a);for(let c=0;c<n.length;c++)O(n[c],i)}}}}}}}function Z(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,_(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{Ae(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function _e(e){L().push(e),Z()}function ee(e,t,r,o,l={}){const s=l.extraAttributes||[],i=l.onAttributeChange||null,a=l.onSubtreeChange||null,n=l.onInit||null,c=l.onAttrChange||null,d=l.effects||null,u=l.attributes||null,h=u?be(u):d,y=u?new Set(Object.keys(u)):null,T=l.persist||null;function p(g){const b=g||document.body;if(z(b,e,t,r),u&&q())for(const v in u){const $e=u[v],F=Array.from(b.querySelectorAll("["+v+"]"));b.matches&&b.matches("["+v+"]")&&F.push(b);for(let N=0;N<F.length;N++){const R=F[N];x(R)&&X($e,R.getAttribute(v),v,o,R)}}n&&n(b)}const C=[];if(e.indexOf("[")!==-1){const g=/\[([\w-]+)/g;let b;for(;(b=g.exec(e))!==null;)C.push(b[1])}else C.push(e);me({selector:e,attribute:t,componentTag:o,attributes:u,ComponentFn:r,onInit:n,observed:C.concat(s),onAttributeChange:i,onAttrChange:c,effects:h,declared:y,persist:T}),ve();const w=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,f=l.subtreeQuery||(w?e:"["+e+"]");L().push({selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:a,query:f}),Z(),window[t]=p,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ee,window.lnCore.observeLifecycle=_e);function D(){ge()>0?Ce(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",D):D(),p}function te(e){return(e||"").replace(/^#/,"")}function I(e){const t=e===void 0?location.hash:e,r={},o=te(t);if(!o)return r;const l=o.split("&");for(let s=0;s<l.length;s++){const i=l[s];if(!i)continue;const a=i.indexOf(":"),n=a>-1?i.slice(0,a):i,c=a>-1?i.slice(a+1):"";if(n)try{r[n]=decodeURIComponent(c)}catch{r[n]=c}}return r}function xe(e){if(!e)return null;const t=I();return e in t?t[e]:null}function Se(e,t){if(!e)return;const r=I();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(s){const i=r[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");te(location.hash)!==l&&(location.hash=l)}function ke(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ee(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function Le(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ie(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Te(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=I,window.lnCore.hashGet=xe,window.lnCore.hashSet=Se,window.lnCore.hashLinkClick=ke,window.lnCore.resolveHashNamespace=Ee,window.lnCore.hashSortEncode=Le,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Ie,window.lnCore.hashFilterDecode=Te);function De(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=De);const Fe="ln-autosave:",Ne=1e3;function Re(e,t){return t?Fe+(e||"")+":"+t:null}function qe(e,t=Ne){if(e==null)return 0;if(e==="")return t;const r=parseInt(String(e),10);return isNaN(r)||r<0?t:r}(function(){const e="data-ln-autosave",t="lnAutosave",r="data-ln-autosave-clear",o="data-ln-autosave-debounce-input",l='[data-ln-autosave-exclude], input[type="password"]';if(window[t]!==void 0)return;const s={"data-ln-autosave":{type:"string",description:"Form autosave storage key identifier"},"data-ln-autosave-debounce-input":{type:"integer",fallback:500,min:0,description:"Debounce delay in milliseconds before saving on input events"},"data-ln-autosave-clear":{type:"marker",description:"Designates a button that clears saved form data from localStorage"},"data-ln-autosave-exclude":{type:"marker",description:"Excludes form control from autosave serialization"}};function i(n){const c=n.tagName;return c==="INPUT"||c==="TEXTAREA"||c==="SELECT"}function a(n){const d=n.getAttribute(e)||n.id,u=Re(window.location.pathname,d);if(!u){console.warn("ln-autosave: form needs an id or data-ln-autosave value",n);return}this.dom=n,this.key=u;let h=null;function y(){const w=$(n,{exclude:l});try{localStorage.setItem(u,JSON.stringify(w))}catch{return}A(n,"ln-autosave:saved",{target:n,data:w})}function T(){let w;try{w=localStorage.getItem(u)}catch{return}if(!w)return;let f;try{f=JSON.parse(w)}catch{return}if(ne(n,"ln-autosave:before-restore",{target:n,data:f}).defaultPrevented)return;const g=M(n,f);for(let b=0;b<g.length;b++)g[b].dispatchEvent(new Event("input",{bubbles:!0})),g[b].dispatchEvent(new Event("change",{bubbles:!0}));A(n,"ln-autosave:restored",{target:n,data:f})}function p(){try{localStorage.removeItem(u)}catch{return}A(n,"ln-autosave:cleared",{target:n})}this._onFocusout=function(w){const f=w.target;i(f)&&f.name&&!f.matches(l)&&y()},this._onChange=function(w){const f=w.target;i(f)&&f.name&&!f.matches(l)&&y()},this._onSubmit=function(){p()},this._onReset=function(){p()},this._onClearClick=function(w){w.target.closest("["+r+"]")&&p()},n.addEventListener("focusout",this._onFocusout),n.addEventListener("change",this._onChange),n.addEventListener("submit",this._onSubmit),n.addEventListener("reset",this._onReset),n.addEventListener("click",this._onClearClick);const C=qe(n.getAttribute(o));return C>0&&(this._onInput=function(w){const f=w.target;!i(f)||!f.name||f.matches(l)||(h!==null&&clearTimeout(h),h=setTimeout(y,C))},n.addEventListener("input",this._onInput)),this._getInputTimer=function(){return h},T(),this}a.prototype.destroy=function(){if(this.dom[t]){if(this.dom.removeEventListener("focusout",this._onFocusout),this.dom.removeEventListener("change",this._onChange),this.dom.removeEventListener("submit",this._onSubmit),this.dom.removeEventListener("reset",this._onReset),this.dom.removeEventListener("click",this._onClearClick),this._onInput){this.dom.removeEventListener("input",this._onInput);const n=this._getInputTimer();n!==null&&clearTimeout(n)}delete this.dom[t]}},ee(e,t,a,"ln-autosave",{attributes:s})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function R(){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 O(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 l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){r=t[l];break}if(!O(r))return}e.apply(console,t)}}function E(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 k(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function le(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ae(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,l={},a=e.elements,i={};if(n)for(let c=0;c<a.length;c++){const o=a[c];o.name&&o.type==="checkbox"&&!o.disabled&&(i[o.name]=(i[o.name]||0)+1)}for(let c=0;c<a.length;c++){const o=a[c];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(r&&o.matches&&o.matches(r)))if(o.type==="checkbox")n&&i[o.name]===1?l[o.name]=o.checked:(l[o.name]||(l[o.name]=[]),o.checked&&l[o.name].push(o.value));else if(o.type==="radio")o.checked&&(l[o.name]=o.value);else if(o.type==="select-multiple"){l[o.name]=[];for(let s=0;s<o.options.length;s++)o.options[s].selected&&l[o.name].push(o.options[s].value)}else if(n&&o.type==="hidden")l[o.name]=o.value;else if(n&&(o.type==="number"||o.type==="range")){const s=Number(o.value);l[o.name]=o.value===""||isNaN(s)?null:s}else l[o.name]=o.value}return l}function se(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ce(e,t){const n=e.elements,r=[],l={};for(let a=0;a<n.length;a++){const i=n[a];i.name&&i.type==="checkbox"&&(l[i.name]=(l[i.name]||0)+1)}for(let a=0;a<n.length;a++){const i=n[a];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const c=i.getAttribute("data-ln-fill-as")||i.name;if(!c||!(c in t))continue;const o=t[c];if(i.type==="checkbox"){if(Array.isArray(o))i.checked=o.indexOf(i.value)!==-1;else if(l[i.name]>1){const s=String(o).split(",").map(function(u){return u.trim()});i.checked=s.indexOf(i.value)!==-1}else i.checked=se(o);r.push(i)}else if(i.type==="radio")i.checked=i.value===String(o),r.push(i);else if(i.type==="select-multiple"){if(Array.isArray(o))for(let s=0;s<i.options.length;s++)i.options[s].selected=o.indexOf(i.options[s].value)!==-1;r.push(i)}else i.value=o,i.tagName==="SELECT"&&o!=null&&i.setAttribute("data-ln-value",o),r.push(i)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ce,window.lnCore.serializeForm=ae,window.lnCore.resolveFormMethod=le);const j={};function ue(e,t){j[e]=t}function de(e){return j[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ue,window.lnCore.getDataMapper=de);function W(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 fe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,k(function(){new MutationObserver(function(){E(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const V={};function he(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];V[n]=t}function we(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return V[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=he,window.lnCore.getLocaleFallback=we,window.lnCore.ensureLocaleObserver=fe);const N={};function P(e,t){N[e]||(N[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=N[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function pe(e,t,n){if(e){const r=e.querySelector('[data-ln-template="'+t+'"]');if(r)return r.content.cloneNode(!0)}return P(t,n)}function U(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let i=0;i<n.length;i++){const c=n[i],o=c.getAttribute("data-ln-field");t[o]!=null&&(c.textContent=t[o])}const r=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<r.length;i++){const c=r[i],o=c.getAttribute("data-ln-attr").split(",");for(let s=0;s<o.length;s++){const u=o[s].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const c=l[i],o=c.getAttribute("data-ln-show");o in t&&c.classList.toggle("hidden",!t[o])}const a=e.querySelectorAll("[data-ln-class]");for(let i=0;i<a.length;i++){const c=a[i],o=c.getAttribute("data-ln-class").split(",");for(let s=0;s<o.length;s++){const u=o[s].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function me(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)U(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 q(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(i,c){return t[c]!==void 0?t[c]:""}))}const r=function(a,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let a=0;a<l.length;a++){const i=l[a],c=i.attributes;for(let o=0;o<c.length;o++){const s=c[o];s.value.indexOf("{{")!==-1&&i.setAttribute(s.name,s.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function ge(e,t,n,r,l,a){const i={};for(let o=0;o<e.children.length;o++){const s=e.children[o],u=s.getAttribute("data-ln-render-key");u&&(i[u]=s)}const c=document.createDocumentFragment();for(let o=0;o<t.length;o++){const s=t[o],u=String(r(s));let d=i[u];if(d)l(d,s,o);else{const f=P(n,a);if(!f||(q(f,s),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),l(d,s,o)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=q,window.lnCore.fill=U,window.lnCore.lnFill=me,window.lnCore.renderList=ge);function L(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function H(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function K(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const l=r.trim().toLowerCase();return!(l==="false"||l==="0")}function Q(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const I=new Map;function z(e,t){const n=(e?e.join("|"):"")+"::"+t;if(I.has(n))return I.get(n);const r=new Set(e||[]),l=function(a,i){const c=a.getAttribute(i);return c!==null&&r.has(c)?c:t};return I.set(n,l),l}function G(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function J(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function Y(e,t,n,r,l){if(!e||t===null)return!0;const a=r||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const c=o=>{l?console.warn(o,l):console.warn(o)};if(i==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(c(`[${a}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const o=e.values||[];return o.includes(t)?!0:(c(`[${a}] Invalid value "${t}" for attribute "${n}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return c(`[${a}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(c(`[${a}] Value ${o} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(c(`[${a}] Value ${o} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(c(`[${a}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(o){return c(`[${a}] Invalid JSON for attribute "${n}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function X(e,t,n){for(const r in n){const[l,a,i]=n[r];Object.defineProperty(e,r,{get:function(){return l(t,a,i)},enumerable:!0,configurable:!0})}return e}function Z(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let l=r.read;if(!l&&r.type)switch(r.type){case"enum":l=z(r.values,r.fallback);break;case"integer":l=H;break;case"float":l=G;break;case"boolean":l=K;break;case"list":l=Q;break;case"json":l=J;break;case"string":default:l=L;break}l||(l=L),t[r.prop]=[l,n,r.fallback]}return t}function be(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 ye(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=X,window.lnCore.attrSpec=Z,window.lnCore.attrStr=L,window.lnCore.attrInt=H,window.lnCore.attrBool=K,window.lnCore.attrList=Q,window.lnCore.attrEnum=z,window.lnCore.attrFloat=G,window.lnCore.attrJson=J);function M(e,t,n,r){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i=Array.from(e.querySelectorAll(a));e.matches&&e.matches(a)&&i.push(e);for(const c of i)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new r(c)}catch(o){console.error("["+n+"] init failed",c,o)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ce(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function xe(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 ee(){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 Ae(e){const t=ee(),n=e.observed||[];for(let r=0;r<n.length;r++){const l=n[r];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).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 l=t.byDeclaredAttr.get(r);l.some(a=>a.componentTag===e.componentTag)||l.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ye(e);if(r===null)t.reactiveWildcard.push(e);else for(const l of r)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function te(e,t,n,r){for(let l=0;l<e.length;l++){const a=e[l];if(!t[a.attribute])continue;const i=a.effects&&a.effects[n];i?i(t,n,r):a.onAttrChange&&(!a.declared||a.declared.has(n))&&a.onAttrChange(t,n,r)}}function ve(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=ee(),l=r.byAttr.get(n);if(R()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&O(t)){const a=r.byDeclaredAttr.get(n),i=t.getAttribute(n);for(let c=0;c<a.length;c++)Y(a[c].spec,i,n,a[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const a=r.byReactive.get(n);a&&te(a,t,n,e.oldValue),r.reactiveWildcard.length&&te(r.reactiveWildcard,t,n,e.oldValue)}if(l)for(let a=0;a<l.length;a++){const i=l[a];if(i.handler){i.handler(t,n,e.oldValue);continue}i.onAttributeChange&&t[i.attribute]?i.onAttributeChange(t,n):(M(t,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(t))}}function _e(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ve(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 ne(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function Se(e){const t=ne();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const l=r.query,a=e.target.nodeType===1?e.target.matches(l)?e.target:e.target.closest(l):e.target.parentElement?e.target.parentElement.closest(l):null;a&&r.onSubtreeChange(a,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let l=0;l<t.length;l++){const a=t[l];M(r,a.selector,a.attribute,a.ComponentFn),a.onInit&&a.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let l=0;l<t.length;l++){const a=t[l],i=a.query,c=Array.from(r.querySelectorAll(i));r.matches&&r.matches(i)&&c.push(r);for(let o=0;o<c.length;o++){const s=c[o];if(!document.contains(s)){const u=s[a.attribute];if(u&&typeof u.destroy=="function")try{u.destroy()}catch(d){console.error("["+a.attribute+"] destroy failed",s,d)}delete s[a.attribute]}}}}}}function ke(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{Se(r)}catch(l){console.error("[ln-core] lifecycle handler failed",r.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function re(e,t,n,r,l={}){const a=l.extraAttributes||[],i=l.onAttributeChange||null,c=l.onSubtreeChange||null,o=l.onInit||null,s=l.onAttrChange||null,u=l.effects||null,d=l.attributes||null,f=d?be(d):u,_=d?new Set(Object.keys(d)):null,y=l.persist||null;function m(h){const w=h||document.body;if(M(w,e,t,n),d&&R())for(const p in d){const A=d[p],v=Array.from(w.querySelectorAll("["+p+"]"));w.matches&&w.matches("["+p+"]")&&v.push(w);for(let $=0;$<v.length;$++){const B=v[$];O(B)&&Y(A,B.getAttribute(p),p,r,B)}}o&&o(w)}const C=[];if(e.indexOf("[")!==-1){const h=/\[([\w-]+)/g;let w;for(;(w=h.exec(e))!==null;)C.push(w[1])}else C.push(e);Ae({selector:e,attribute:t,componentTag:r,attributes:d,ComponentFn:n,onInit:o,observed:C.concat(a),onAttributeChange:i,onAttrChange:s,effects:f,declared:_,persist:y}),_e();const g=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,D=l.subtreeQuery||(g?e:"["+e+"]");ne().push({selector:e,attribute:t,ComponentFn:n,onInit:o,onSubtreeChange:c,query:D}),ke(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=re);function S(){Ce()>0?xe(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",S):S(),m}function oe(e){return(e||"").replace(/^#/,"")}function T(e){const t=e===void 0?location.hash:e,n={},r=oe(t);if(!r)return n;const l=r.split("&");for(let a=0;a<l.length;a++){const i=l[a];if(!i)continue;const c=i.indexOf(":"),o=c>-1?i.slice(0,c):i,s=c>-1?i.slice(c+1):"";if(o)try{n[o]=decodeURIComponent(s)}catch{n[o]=s}}return n}function Le(e){if(!e)return null;const t=T();return e in t?t[e]:null}function Fe(e,t){if(!e)return;const n=T();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(a){const i=n[a];return i===""?a:a+":"+encodeURIComponent(i)}).join("&");oe(location.hash)!==l&&(location.hash=l)}function De(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Oe(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 Ee(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ne(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 qe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ie(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),l=r?r.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=T,window.lnCore.hashGet=Le,window.lnCore.hashSet=Fe,window.lnCore.hashLinkClick=De,window.lnCore.resolveHashNamespace=Oe,window.lnCore.hashSortEncode=Ee,window.lnCore.hashSortDecode=Ne,window.lnCore.hashFilterEncode=qe,window.lnCore.hashFilterDecode=Ie);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 b={};function Te(e){const t=e||"default";if(!b[t]){const n=new Intl.NumberFormat(e,{useGrouping:!0}),r=n.formatToParts(1234.5);let l="",a=".";for(let i=0;i<r.length;i++)r[i].type==="group"&&(l=r[i].value),r[i].type==="decimal"&&(a=r[i].value);b[t]={groupSep:l,decimalSep:a,fmt:n}}return b[t]}function F(e,t,n={}){if(typeof e!="number"||isNaN(e)||!Number.isFinite(e))return"";const r=t||"default",l=n.maxDecimals!=null?parseInt(n.maxDecimals,10):null,a=n.userDecimals!=null?n.userDecimals:null;if(l!==null){const i=r+"|max:"+l;return b[i]||(b[i]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:0,maximumFractionDigits:l})),b[i].format(e)}if(a!==null&&a>0){const i=r+"|exact:"+a;return b[i]||(b[i]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:a,maximumFractionDigits:a})),b[i].format(e)}return Te(t).fmt.format(e)}function ie(e){if(e==null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function x(e){return String(Math.round(e*1e3)/1e3)}function $e(e,t,n){const r=ie(e);return r===null||r<0?0:Math.min(r,Math.min(t,n)/2)}function Be(e){if(typeof e!="string")return null;const t=e.trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(n=>!Number.isFinite(n))||t[2]<=0||t[3]<=0?null:{x:t[0],y:t[1],width:t[2],height:t[3]}}function Re(e){if(!e||typeof e!="string")return null;const t=e.split(":"),n=t[0].trim();return n?{field:n,direction:t[1]&&t[1].trim().toLowerCase()==="desc"?"desc":"asc"}:null}function je(e,t){t=t||{};const n=t.viewBox||{x:0,y:0,width:1e3,height:320},r=t.xField||"label",l=t.yField||"value",a=t.includeZero!==!1,i=$e(t.padding,n.width,n.height),c=Array.isArray(e)?e:[],o=[];for(let h=0;h<c.length;h++){const w=c[h]||{},p=ie(w[l]);p!==null&&o.push({record:w,sourceIndex:h,label:w[r]==null?String(h+1):String(w[r]),value:p})}if(o.length===0)return{points:[],linePoints:"",areaPoints:"",count:0,min:null,max:null,domainMin:0,domainMax:1,baselineY:n.y+n.height-i};let s=o[0].value,u=o[0].value;for(let h=1;h<o.length;h++)o[h].value<s&&(s=o[h].value),o[h].value>u&&(u=o[h].value);let d=s,f=u;a&&(d=Math.min(0,d),f=Math.max(0,f)),d===f&&(f===0?f=1:f>0?d=0:f=0);const _=Math.max(1,n.width-i*2),y=Math.max(1,n.height-i*2),m=f-d,C=n.y+n.height-i-(0-d)/m*y,g=[];for(let h=0;h<o.length;h++){const w=o[h],p=o.length===1?.5:h/(o.length-1),A=n.x+i+p*_,v=n.y+n.height-i-(w.value-d)/m*y;g.push({record:w.record,sourceIndex:w.sourceIndex,label:w.label,value:w.value,x:A,y:v,pointString:x(A)+","+x(v)})}const D=g.map(h=>h.pointString).join(" ");let S="";if(g.length>0){const h=g[0],w=g[g.length-1],p=x(h.x)+","+x(C),A=x(w.x)+","+x(C);S=p+" "+D+" "+A}return{points:g,linePoints:D,areaPoints:S,count:g.length,min:s,max:u,domainMin:d,domainMax:f,baselineY:C}}(function(){const e="data-ln-chart",t="lnChart",n={x:0,y:0,width:1e3,height:320};if(window[t]!==void 0)return;function r(s){const u=s[t];u&&u.requestData()}function l(s){const u=s[t];u&&u._render()}const a={"data-ln-chart":{prop:"name",type:"string",read:L,fallback:"",effect:l,description:"Chart instance name or identifier"},"data-ln-chart-source":{type:"string",effect:r,description:"Source store or coordinator identifier"},"data-ln-chart-sort":{type:"string",effect:r,description:"Field name to sort chart series data by"},"data-ln-chart-type":{type:"enum",values:["line","bar","area","scatter"],fallback:"line",effect:l,description:"Visual chart render type"},"data-ln-chart-x":{type:"string",effect:l,description:"Field name mapping to X axis"},"data-ln-chart-y":{type:"string",effect:l,description:"Field name mapping to Y axis"},"data-ln-chart-padding":{type:"integer",fallback:20,min:0,effect:l,description:"Internal plot padding in pixels"},"data-ln-chart-zero":{type:"boolean",effect:l,description:"Forces Y axis scale to start at zero"}},i=Z(a);function c(s,u){s&&(s.textContent=u)}function o(s){this.dom=s,X(this,s,i),this.source=s.getAttribute("data-ln-chart-source")||this.name,this.plot=s.querySelector("[data-ln-chart-plot]"),this.line=s.querySelector("[data-ln-chart-line]"),this.area=s.querySelector("[data-ln-chart-area]"),this.labels=s.querySelector("[data-ln-chart-labels]"),this.empty=s.querySelector("[data-ln-chart-empty]"),this.minimum=s.querySelector("[data-ln-chart-min]"),this.maximum=s.querySelector("[data-ln-chart-max]"),this.count=s.querySelector("[data-ln-chart-count]"),this._data=[],this.model=null,this.isLoaded=!1;const u=this;return this._onSetData=function(d){const f=d.detail||{};u._data=Array.isArray(f.data)?f.data:[],u.isLoaded=!0,u._setLoading(!1),u._render()},this._onSetLoading=function(d){u._setLoading(!!(d.detail&&d.detail.loading))},this._onRefresh=function(){u.requestData()},s.addEventListener("ln-chart:set-data",this._onSetData),s.addEventListener("ln-chart:set-loading",this._onSetLoading),s.addEventListener("ln-chart:request-refresh",this._onRefresh),this.requestData(),this}o.prototype._readOptions=function(){const s=this.dom.getAttribute("data-ln-chart-padding"),u=s===null?NaN:Number(s),d=(this.dom.getAttribute("data-ln-chart-type")||"line").toLowerCase();return{xField:this.dom.getAttribute("data-ln-chart-x")||"label",yField:this.dom.getAttribute("data-ln-chart-y")||"value",includeZero:this.dom.getAttribute("data-ln-chart-zero")!=="false",padding:Number.isFinite(u)&&u>=0?u:16,type:d==="area"||d==="polygon"?"area":"line",viewBox:this.plot&&Be(this.plot.getAttribute("viewBox"))||n}},o.prototype._setLoading=function(s){this.dom.classList.toggle("ln-chart--loading",s),this.dom.setAttribute("aria-busy",s?"true":"false")},o.prototype._renderLabels=function(s){if(!this.labels||(this.labels.replaceChildren(),s.count===0))return;const u=this.name+"-label",d='[data-ln-template="'+u+'"]';if(!this.dom.querySelector(d)&&!document.querySelector(d))return;const f=pe(this.dom,u,"ln-chart");if(!f)return;const _=W(this.dom);for(const y of s.points){const m=f.cloneNode(!0);q(m,{label:y.label,value:F(y.value,_)}),this.labels.appendChild(m)}},o.prototype._render=function(){const s=this._readOptions(),u=je(this._data,s);this.model=u,this.line&&(this.line.setAttribute("points",u.linePoints),this.line.toggleAttribute("hidden",u.count===0)),this.area&&(this.area.setAttribute("points",u.areaPoints),this.area.toggleAttribute("hidden",u.count===0||s.type!=="area"));const d=u.count===0;this.dom.classList.toggle("ln-chart--empty",d),this.empty&&this.empty.toggleAttribute("hidden",!d);const f=W(this.dom);c(this.minimum,F(u.min,f)),c(this.maximum,F(u.max,f)),c(this.count,F(u.count,f)),this._renderLabels(u),E(this.dom,"ln-chart:rendered",{chart:this.name,count:u.count,min:u.min,max:u.max})},o.prototype.requestData=function(){this.source=this.dom.getAttribute("data-ln-chart-source")||this.name,E(this.dom,"ln-chart:request-data",{chart:this.name,source:this.source,sort:Re(this.dom.getAttribute("data-ln-chart-sort")),filters:{},search:""})},o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-chart:set-data",this._onSetData),this.dom.removeEventListener("ln-chart:set-loading",this._onSetLoading),this.dom.removeEventListener("ln-chart:request-refresh",this._onRefresh),this._data=[],this.model=null,delete this.dom[t])},re(e,t,o,"ln-chart",{attributes:a})})()})();
|
|
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 q(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 l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){r=t[l];break}if(!q(r))return}e.apply(console,t)}}function O(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 ce(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ue(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,l={},s=e.elements,i={};if(n)for(let c=0;c<s.length;c++){const o=s[c];o.name&&o.type==="checkbox"&&!o.disabled&&(i[o.name]=(i[o.name]||0)+1)}for(let c=0;c<s.length;c++){const o=s[c];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(r&&o.matches&&o.matches(r)))if(o.type==="checkbox")n&&i[o.name]===1?l[o.name]=o.checked:(l[o.name]||(l[o.name]=[]),o.checked&&l[o.name].push(o.value));else if(o.type==="radio")o.checked&&(l[o.name]=o.value);else if(o.type==="select-multiple"){l[o.name]=[];for(let a=0;a<o.options.length;a++)o.options[a].selected&&l[o.name].push(o.options[a].value)}else if(n&&o.type==="hidden")l[o.name]=o.value;else if(n&&(o.type==="number"||o.type==="range")){const a=Number(o.value);l[o.name]=o.value===""||isNaN(a)?null:a}else l[o.name]=o.value}return l}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=[],l={};for(let s=0;s<n.length;s++){const i=n[s];i.name&&i.type==="checkbox"&&(l[i.name]=(l[i.name]||0)+1)}for(let s=0;s<n.length;s++){const i=n[s];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const c=i.getAttribute("data-ln-fill-as")||i.name;if(!c||!(c in t))continue;const o=t[c];if(i.type==="checkbox"){if(Array.isArray(o))i.checked=o.indexOf(i.value)!==-1;else if(l[i.name]>1){const a=String(o).split(",").map(function(u){return u.trim()});i.checked=a.indexOf(i.value)!==-1}else i.checked=de(o);r.push(i)}else if(i.type==="radio")i.checked=i.value===String(o),r.push(i);else if(i.type==="select-multiple"){if(Array.isArray(o))for(let a=0;a<i.options.length;a++)i.options[a].selected=o.indexOf(i.options[a].value)!==-1;r.push(i)}else i.value=o,i.tagName==="SELECT"&&o!=null&&i.setAttribute("data-ln-value",o),r.push(i)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=fe,window.lnCore.serializeForm=ue,window.lnCore.resolveFormMethod=ce);const V={};function he(e,t){V[e]=t}function we(e){return V[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=he,window.lnCore.getDataMapper=we);function P(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 pe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,L(function(){new MutationObserver(function(){O(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const U={};function me(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];U[n]=t}function be(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return U[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=me,window.lnCore.getLocaleFallback=be,window.lnCore.ensureLocaleObserver=pe);const N={};function H(e,t){N[e]||(N[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=N[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function ge(e,t,n){if(e){const r=e.querySelector('[data-ln-template="'+t+'"]');if(r)return r.content.cloneNode(!0)}return H(t,n)}function K(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let i=0;i<n.length;i++){const c=n[i],o=c.getAttribute("data-ln-field");t[o]!=null&&(c.textContent=t[o])}const r=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<r.length;i++){const c=r[i],o=c.getAttribute("data-ln-attr").split(",");for(let a=0;a<o.length;a++){const u=o[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const c=l[i],o=c.getAttribute("data-ln-show");o in t&&c.classList.toggle("hidden",!t[o])}const s=e.querySelectorAll("[data-ln-class]");for(let i=0;i<s.length;i++){const c=s[i],o=c.getAttribute("data-ln-class").split(",");for(let a=0;a<o.length;a++){const u=o[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}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)K(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 I(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(i,c){return t[c]!==void 0?t[c]:""}))}const r=function(s,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const i=l[s],c=i.attributes;for(let o=0;o<c.length;o++){const a=c[o];a.value.indexOf("{{")!==-1&&i.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function Ce(e,t,n,r,l,s){const i={};for(let o=0;o<e.children.length;o++){const a=e.children[o],u=a.getAttribute("data-ln-render-key");u&&(i[u]=a)}const c=document.createDocumentFragment();for(let o=0;o<t.length;o++){const a=t[o],u=String(r(a));let d=i[u];if(d)l(d,a,o);else{const f=H(n,s);if(!f||(I(f,a),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),l(d,a,o)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=I,window.lnCore.fill=K,window.lnCore.lnFill=ye,window.lnCore.renderList=Ce);function D(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function Q(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 l=r.trim().toLowerCase();return!(l==="false"||l==="0")}function G(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const M=new Map;function J(e,t){const n=(e?e.join("|"):"")+"::"+t;if(M.has(n))return M.get(n);const r=new Set(e||[]),l=function(s,i){const c=s.getAttribute(i);return c!==null&&r.has(c)?c:t};return M.set(n,l),l}function Y(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function X(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function Z(e,t,n,r,l){if(!e||t===null)return!0;const s=r||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const c=o=>{l?console.warn(o,l):console.warn(o)};if(i==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const o=e.values||[];return o.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(c(`[${s}] Value ${o} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(c(`[${s}] Value ${o} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(o){return c(`[${s}] Invalid JSON for attribute "${n}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function ee(e,t,n){for(const r in n){const[l,s,i]=n[r];Object.defineProperty(e,r,{get:function(){return l(t,s,i)},enumerable:!0,configurable:!0})}return e}function te(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let l=r.read;if(!l&&r.type)switch(r.type){case"enum":l=J(r.values,r.fallback);break;case"integer":l=Q;break;case"float":l=Y;break;case"boolean":l=z;break;case"list":l=G;break;case"json":l=X;break;case"string":default:l=D;break}l||(l=D),t[r.prop]=[l,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=ee,window.lnCore.attrSpec=te,window.lnCore.attrStr=D,window.lnCore.attrInt=Q,window.lnCore.attrBool=z,window.lnCore.attrList=G,window.lnCore.attrEnum=J,window.lnCore.attrFloat=Y,window.lnCore.attrJson=X);function _(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 s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:n,ComponentFn:r};if(e.matches&&e.matches(s)&&_(e,i),e.querySelectorAll){const c=e.querySelectorAll(s);for(let o=0;o<c.length;o++)_(c[o],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ve(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function _e(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 re(){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 Se(e){const t=re(),n=e.observed||[];for(let r=0;r<n.length;r++){const l=n[r];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).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 l=t.byDeclaredAttr.get(r);l.some(s=>s.componentTag===e.componentTag)||l.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 l of r)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function oe(e,t,n,r){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const i=s.effects&&s.effects[n];i?i(t,n,r):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,r)}}function ke(e){const t=e.attributeName,n=t.indexOf("data-ln-")===0,r=re(),l=r.byAttr.get(t),s=W()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!n&&!l&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&q(i)){const c=r.byDeclaredAttr.get(t),o=i.getAttribute(t);for(let a=0;a<c.length;a++)Z(c[a].spec,o,t,c[a].componentTag,i)}if(window.lnCore._debugSink&&(n||l)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),n){const c=r.byReactive.get(t);c&&oe(c,i,t,e.oldValue),r.reactiveWildcard.length&&oe(r.reactiveWildcard,i,t,e.oldValue)}if(l)for(let c=0;c<l.length;c++){const o=l[c];if(o.handler){o.handler(i,t,e.oldValue);continue}o.onAttributeChange&&i[o.attribute]?o.onAttributeChange(i,t):(ne(i,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(i))}}}function Le(){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{ke(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 T(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function $(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 De(e){const t=T();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange&&r.query){const l=r.query,s=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;s&&r.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1){const l=!!(r.firstElementChild||r.children&&r.children.length);for(let s=0;s<t.length;s++){const i=t[s];if(i.selector&&i.attribute&&i.ComponentFn){if(!l)r.matches&&r.matches(i.query)&&_(r,i);else if(r.matches&&r.matches(i.query)&&_(r,i),r.querySelectorAll){const c=r.querySelectorAll(i.query);for(let o=0;o<c.length;o++)_(c[o],i)}}i.onInit&&i.onInit(r)}}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1){const l=!!(r.firstElementChild||r.children&&r.children.length);for(let s=0;s<t.length;s++){const i=t[s],c=i.query;if(c){if(!l)r.matches&&r.matches(c)&&$(r,i);else if(r.matches&&r.matches(c)&&$(r,i),r.querySelectorAll){const o=r.querySelectorAll(c);for(let a=0;a<o.length;a++)$(o[a],i)}}}}}}}function ie(){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{De(r)}catch(l){console.error("[ln-core] lifecycle handler failed",r.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Fe(e){T().push(e),ie()}function le(e,t,n,r,l={}){const s=l.extraAttributes||[],i=l.onAttributeChange||null,c=l.onSubtreeChange||null,o=l.onInit||null,a=l.onAttrChange||null,u=l.effects||null,d=l.attributes||null,f=d?xe(d):u,S=d?new Set(Object.keys(d)):null,y=l.persist||null;function m(h){const w=h||document.body;if(ne(w,e,t,n),d&&W())for(const p in d){const A=d[p],v=Array.from(w.querySelectorAll("["+p+"]"));w.matches&&w.matches("["+p+"]")&&v.push(w);for(let R=0;R<v.length;R++){const j=v[R];q(j)&&Z(A,j.getAttribute(p),p,r,j)}}o&&o(w)}const C=[];if(e.indexOf("[")!==-1){const h=/\[([\w-]+)/g;let w;for(;(w=h.exec(e))!==null;)C.push(w[1])}else C.push(e);Se({selector:e,attribute:t,componentTag:r,attributes:d,ComponentFn:n,onInit:o,observed:C.concat(s),onAttributeChange:i,onAttrChange:a,effects:f,declared:S,persist:y}),Le();const b=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,E=l.subtreeQuery||(b?e:"["+e+"]");T().push({selector:e,attribute:t,ComponentFn:n,onInit:o,onSubtreeChange:c,query:E}),ie(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=le,window.lnCore.observeLifecycle=Fe);function k(){ve()>0?_e(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k(),m}function se(e){return(e||"").replace(/^#/,"")}function B(e){const t=e===void 0?location.hash:e,n={},r=se(t);if(!r)return n;const l=r.split("&");for(let s=0;s<l.length;s++){const i=l[s];if(!i)continue;const c=i.indexOf(":"),o=c>-1?i.slice(0,c):i,a=c>-1?i.slice(c+1):"";if(o)try{n[o]=decodeURIComponent(a)}catch{n[o]=a}}return n}function Ee(e){if(!e)return null;const t=B();return e in t?t[e]:null}function qe(e,t){if(!e)return;const n=B();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(s){const i=n[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");se(location.hash)!==l&&(location.hash=l)}function Oe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ne(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 Ie(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Me(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 Te(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function $e(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),l=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=B,window.lnCore.hashGet=Ee,window.lnCore.hashSet=qe,window.lnCore.hashLinkClick=Oe,window.lnCore.resolveHashNamespace=Ne,window.lnCore.hashSortEncode=Ie,window.lnCore.hashSortDecode=Me,window.lnCore.hashFilterEncode=Te,window.lnCore.hashFilterDecode=$e);function Be(){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=Be);const g={};function Re(e){const t=e||"default";if(!g[t]){const n=new Intl.NumberFormat(e,{useGrouping:!0}),r=n.formatToParts(1234.5);let l="",s=".";for(let i=0;i<r.length;i++)r[i].type==="group"&&(l=r[i].value),r[i].type==="decimal"&&(s=r[i].value);g[t]={groupSep:l,decimalSep:s,fmt:n}}return g[t]}function F(e,t,n={}){if(typeof e!="number"||isNaN(e)||!Number.isFinite(e))return"";const r=t||"default",l=n.maxDecimals!=null?parseInt(n.maxDecimals,10):null,s=n.userDecimals!=null?n.userDecimals:null;if(l!==null){const i=r+"|max:"+l;return g[i]||(g[i]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:0,maximumFractionDigits:l})),g[i].format(e)}if(s!==null&&s>0){const i=r+"|exact:"+s;return g[i]||(g[i]=new Intl.NumberFormat(t,{useGrouping:!0,minimumFractionDigits:s,maximumFractionDigits:s})),g[i].format(e)}return Re(t).fmt.format(e)}function ae(e){if(e==null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function x(e){return String(Math.round(e*1e3)/1e3)}function je(e,t,n){const r=ae(e);return r===null||r<0?0:Math.min(r,Math.min(t,n)/2)}function We(e){if(typeof e!="string")return null;const t=e.trim().split(/[\s,]+/).map(Number);return t.length!==4||t.some(n=>!Number.isFinite(n))||t[2]<=0||t[3]<=0?null:{x:t[0],y:t[1],width:t[2],height:t[3]}}function Ve(e){if(!e||typeof e!="string")return null;const t=e.split(":"),n=t[0].trim();return n?{field:n,direction:t[1]&&t[1].trim().toLowerCase()==="desc"?"desc":"asc"}:null}function Pe(e,t){t=t||{};const n=t.viewBox||{x:0,y:0,width:1e3,height:320},r=t.xField||"label",l=t.yField||"value",s=t.includeZero!==!1,i=je(t.padding,n.width,n.height),c=Array.isArray(e)?e:[],o=[];for(let h=0;h<c.length;h++){const w=c[h]||{},p=ae(w[l]);p!==null&&o.push({record:w,sourceIndex:h,label:w[r]==null?String(h+1):String(w[r]),value:p})}if(o.length===0)return{points:[],linePoints:"",areaPoints:"",count:0,min:null,max:null,domainMin:0,domainMax:1,baselineY:n.y+n.height-i};let a=o[0].value,u=o[0].value;for(let h=1;h<o.length;h++)o[h].value<a&&(a=o[h].value),o[h].value>u&&(u=o[h].value);let d=a,f=u;s&&(d=Math.min(0,d),f=Math.max(0,f)),d===f&&(f===0?f=1:f>0?d=0:f=0);const S=Math.max(1,n.width-i*2),y=Math.max(1,n.height-i*2),m=f-d,C=n.y+n.height-i-(0-d)/m*y,b=[];for(let h=0;h<o.length;h++){const w=o[h],p=o.length===1?.5:h/(o.length-1),A=n.x+i+p*S,v=n.y+n.height-i-(w.value-d)/m*y;b.push({record:w.record,sourceIndex:w.sourceIndex,label:w.label,value:w.value,x:A,y:v,pointString:x(A)+","+x(v)})}const E=b.map(h=>h.pointString).join(" ");let k="";if(b.length>0){const h=b[0],w=b[b.length-1],p=x(h.x)+","+x(C),A=x(w.x)+","+x(C);k=p+" "+E+" "+A}return{points:b,linePoints:E,areaPoints:k,count:b.length,min:a,max:u,domainMin:d,domainMax:f,baselineY:C}}(function(){const e="data-ln-chart",t="lnChart",n={x:0,y:0,width:1e3,height:320};if(window[t]!==void 0)return;function r(a){const u=a[t];u&&u.requestData()}function l(a){const u=a[t];u&&u._render()}const s={"data-ln-chart":{prop:"name",type:"string",read:D,fallback:"",effect:l,description:"Chart instance name or identifier"},"data-ln-chart-source":{type:"string",effect:r,description:"Source store or coordinator identifier"},"data-ln-chart-sort":{type:"string",effect:r,description:"Field name to sort chart series data by"},"data-ln-chart-type":{type:"enum",values:["line","bar","area","scatter"],fallback:"line",effect:l,description:"Visual chart render type"},"data-ln-chart-x":{type:"string",effect:l,description:"Field name mapping to X axis"},"data-ln-chart-y":{type:"string",effect:l,description:"Field name mapping to Y axis"},"data-ln-chart-padding":{type:"integer",fallback:20,min:0,effect:l,description:"Internal plot padding in pixels"},"data-ln-chart-zero":{type:"boolean",effect:l,description:"Forces Y axis scale to start at zero"}},i=te(s);function c(a,u){a&&(a.textContent=u)}function o(a){this.dom=a,ee(this,a,i),this.source=a.getAttribute("data-ln-chart-source")||this.name,this.plot=a.querySelector("[data-ln-chart-plot]"),this.line=a.querySelector("[data-ln-chart-line]"),this.area=a.querySelector("[data-ln-chart-area]"),this.labels=a.querySelector("[data-ln-chart-labels]"),this.empty=a.querySelector("[data-ln-chart-empty]"),this.minimum=a.querySelector("[data-ln-chart-min]"),this.maximum=a.querySelector("[data-ln-chart-max]"),this.count=a.querySelector("[data-ln-chart-count]"),this._data=[],this.model=null,this.isLoaded=!1;const u=this;return this._onSetData=function(d){const f=d.detail||{};u._data=Array.isArray(f.data)?f.data:[],u.isLoaded=!0,u._setLoading(!1),u._render()},this._onSetLoading=function(d){u._setLoading(!!(d.detail&&d.detail.loading))},this._onRefresh=function(){u.requestData()},a.addEventListener("ln-chart:set-data",this._onSetData),a.addEventListener("ln-chart:set-loading",this._onSetLoading),a.addEventListener("ln-chart:request-refresh",this._onRefresh),this.requestData(),this}o.prototype._readOptions=function(){const a=this.dom.getAttribute("data-ln-chart-padding"),u=a===null?NaN:Number(a),d=(this.dom.getAttribute("data-ln-chart-type")||"line").toLowerCase();return{xField:this.dom.getAttribute("data-ln-chart-x")||"label",yField:this.dom.getAttribute("data-ln-chart-y")||"value",includeZero:this.dom.getAttribute("data-ln-chart-zero")!=="false",padding:Number.isFinite(u)&&u>=0?u:16,type:d==="area"||d==="polygon"?"area":"line",viewBox:this.plot&&We(this.plot.getAttribute("viewBox"))||n}},o.prototype._setLoading=function(a){this.dom.classList.toggle("ln-chart--loading",a),this.dom.setAttribute("aria-busy",a?"true":"false")},o.prototype._renderLabels=function(a){if(!this.labels||(this.labels.replaceChildren(),a.count===0))return;const u=this.name+"-label",d='[data-ln-template="'+u+'"]';if(!this.dom.querySelector(d)&&!document.querySelector(d))return;const f=ge(this.dom,u,"ln-chart");if(!f)return;const S=P(this.dom);for(const y of a.points){const m=f.cloneNode(!0);I(m,{label:y.label,value:F(y.value,S)}),this.labels.appendChild(m)}},o.prototype._render=function(){const a=this._readOptions(),u=Pe(this._data,a);this.model=u,this.line&&(this.line.setAttribute("points",u.linePoints),this.line.toggleAttribute("hidden",u.count===0)),this.area&&(this.area.setAttribute("points",u.areaPoints),this.area.toggleAttribute("hidden",u.count===0||a.type!=="area"));const d=u.count===0;this.dom.classList.toggle("ln-chart--empty",d),this.empty&&this.empty.toggleAttribute("hidden",!d);const f=P(this.dom);c(this.minimum,F(u.min,f)),c(this.maximum,F(u.max,f)),c(this.count,F(u.count,f)),this._renderLabels(u),O(this.dom,"ln-chart:rendered",{chart:this.name,count:u.count,min:u.min,max:u.max})},o.prototype.requestData=function(){this.source=this.dom.getAttribute("data-ln-chart-source")||this.name,O(this.dom,"ln-chart:request-data",{chart:this.name,source:this.source,sort:Ve(this.dom.getAttribute("data-ln-chart-sort")),filters:{},search:""})},o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-chart:set-data",this._onSetData),this.dom.removeEventListener("ln-chart:set-loading",this._onSetLoading),this.dom.removeEventListener("ln-chart:request-refresh",this._onRefresh),this._data=[],this.model=null,delete this.dom[t])},le(e,t,o,"ln-chart",{attributes:s})})()})();
|