@livenetworks/ashlar 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autoresize/src/ln-autoresize.js +3 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/lifecycle.js +24 -12
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-date/src/ln-date.js +22 -12
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
- package/components/ln-dropdown/src/ln-dropdown.js +18 -5
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +1 -1
- package/components/ln-filter/src/ln-filter.js +11 -10
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-form/src/ln-form.js +11 -0
- package/components/ln-icon/ln-icon.js +1 -1
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-list/src/ln-list.js +14 -5
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-number/src/ln-number.js +21 -10
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-popover/ln-popover.schema.json +82 -82
- package/components/ln-popover/src/ln-popover.js +22 -5
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-search/ln-search.schema.json +103 -103
- package/components/ln-search/src/ln-search.js +9 -5
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-sortable/src/ln-sortable.js +52 -7
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-tabs/src/ln-tabs.js +12 -8
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-time/src/ln-time.js +17 -7
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-validate/src/ln-validate.js +21 -7
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function 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 o=null;for(let s=1;s<t.length;s++)if(t[s]&&t[s].nodeType===1){o=t[s];break}if(!E(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 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 r=!!(t&&t.typed),o=t&&t.exclude,s={},l=e.elements,i={};if(r)for(let u=0;u<l.length;u++){const a=l[u];a.name&&a.type==="checkbox"&&!a.disabled&&(i[a.name]=(i[a.name]||0)+1)}for(let u=0;u<l.length;u++){const a=l[u];if(!(!a.name||a.disabled||a.type==="file"||a.type==="submit"||a.type==="button")&&!(o&&a.matches&&a.matches(o)))if(a.type==="checkbox")r&&i[a.name]===1?s[a.name]=a.checked:(s[a.name]||(s[a.name]=[]),a.checked&&s[a.name].push(a.value));else if(a.type==="radio")a.checked&&(s[a.name]=a.value);else if(a.type==="select-multiple"){s[a.name]=[];for(let n=0;n<a.options.length;n++)a.options[n].selected&&s[a.name].push(a.options[n].value)}else if(r&&a.type==="hidden")s[a.name]=a.value;else if(r&&(a.type==="number"||a.type==="range")){const n=Number(a.value);s[a.name]=a.value===""||isNaN(n)?null:n}else s[a.name]=a.value}return s}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 r=e.elements,o=[],s={};for(let l=0;l<r.length;l++){const i=r[l];i.name&&i.type==="checkbox"&&(s[i.name]=(s[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 a=t[u];if(i.type==="checkbox"){if(Array.isArray(a))i.checked=a.indexOf(i.value)!==-1;else if(s[i.name]>1){const n=String(a).split(",").map(function(c){return c.trim()});i.checked=n.indexOf(i.value)!==-1}else i.checked=le(a);o.push(i)}else if(i.type==="radio")i.checked=i.value===String(a),o.push(i);else if(i.type==="select-multiple"){if(Array.isArray(a))for(let n=0;n<i.options.length;n++)i.options[n].selected=a.indexOf(i.options[n].value)!==-1;o.push(i)}else i.value=a,i.tagName==="SELECT"&&a!=null&&i.setAttribute("data-ln-value",a),o.push(i)}return o}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 r=e.toLowerCase().split("-")[0];K[r]=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 r=S[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function j(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],a=u.getAttribute("data-ln-field");t[a]!=null&&(u.textContent=t[a])}const o=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<o.length;i++){const u=o[i],a=u.getAttribute("data-ln-attr").split(",");for(let n=0;n<a.length;n++){const c=a[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 s=e.querySelectorAll("[data-ln-show]");for(let i=0;i<s.length;i++){const u=s[i],a=u.getAttribute("data-ln-show");a in t&&u.classList.toggle("hidden",!t[a])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const u=l[i],a=u.getAttribute("data-ln-class").split(",");for(let n=0;n<a.length;n++){const c=a[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 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)j(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 U(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]:""},s=Array.from(e.querySelectorAll("*"));e.nodeType===1&&s.push(e);for(let l=0;l<s.length;l++){const i=s[l],u=i.attributes;for(let a=0;a<u.length;a++){const n=u[a];n.value.indexOf("{{")!==-1&&i.setAttribute(n.name,n.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function ye(e,t,r,o,s,l){const i={};for(let a=0;a<e.children.length;a++){const n=e.children[a],c=n.getAttribute("data-ln-render-key");c&&(i[c]=n)}const u=document.createDocumentFragment();for(let a=0;a<t.length;a++){const n=t[a],c=String(o(n));let d=i[c];if(d)s(d,n,a);else{const f=me(r,l);if(!f||(U(f,n),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",c),s(d,n,a)}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,r){const o=e.getAttribute(t);return o===null?r:o}function V(e,t,r){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?r:o}function W(e,t,r=!1){const o=e.getAttribute(t);if(o===null)return!!r;const s=o.trim().toLowerCase();return!(s==="false"||s==="0")}function H(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const D=new Map;function z(e,t){const r=(e?e.join("|"):"")+"::"+t;if(D.has(r))return D.get(r);const o=new Set(e||[]),s=function(l,i){const u=l.getAttribute(i);return u!==null&&o.has(u)?u:t};return D.set(r,s),s}function J(e,t,r){const o=parseFloat(e.getAttribute(t));return isNaN(o)?r:o}function X(e,t,r){const o=e.getAttribute(t);if(!o)return r;try{return JSON.parse(o)}catch{return r}}function G(e,t,r,o,s){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=a=>{s?console.warn(a,s):console.warn(a)};if(i==="boolean"){const a=t.trim().toLowerCase();return a!==""&&a!=="true"&&a!=="false"&&a!=="1"&&a!=="0"?(u(`[${l}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const a=e.values||[];return a.includes(t)?!0:(u(`[${l}] Invalid value "${t}" for attribute "${r}". Allowed: ${a.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 a=parseInt(t,10);return e.min!==void 0&&a<e.min?(u(`[${l}] Value ${a} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&a>e.max?(u(`[${l}] Value ${a} 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(a){return u(`[${l}] Invalid JSON for attribute "${r}": ${a.message}. Fallback: ${e.fallback}.`),!1}return!0}function ge(e,t,r){for(const o in r){const[s,l,i]=r[o];Object.defineProperty(e,o,{get:function(){return s(t,l,i)},enumerable:!0,configurable:!0})}return e}function _e(e){const t={};for(const r in e){const o=e[r];if(!o||!o.prop)continue;let s=o.read;if(!s&&o.type)switch(o.type){case"enum":s=z(o.values,o.fallback);break;case"integer":s=V;break;case"float":s=J;break;case"boolean":s=W;break;case"list":s=H;break;case"json":s=X;break;case"string":default:s=I;break}s||(s=I),t[o.prop]=[s,r,o.fallback]}return t}function Ce(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 qe(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=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(r){console.error("["+t.attribute+"] init failed",e,r)}}}function Y(e,t,r,o){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:r,ComponentFn:o};if(e.matches&&e.matches(l)&&x(e,i),e.querySelectorAll){const u=e.querySelectorAll(l);for(let a=0;a<u.length;a++)x(u[a],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(),r=e.observed||[];for(let o=0;o<r.length;o++){const s=r[o];t.byAttr.has(s)||t.byAttr.set(s,[]),t.byAttr.get(s).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 s=t.byDeclaredAttr.get(o);s.some(l=>l.componentTag===e.componentTag)||s.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=qe(e);if(o===null)t.reactiveWildcard.push(e);else for(const s of o)t.byReactive.has(s)||t.byReactive.set(s,[]),t.byReactive.get(s).push(e)}e.persist&&t.persist.push(e)}function ee(e,t,r,o){for(let s=0;s<e.length;s++){const l=e[s];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 ke(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,o=Z(),s=o.byAttr.get(t),l=M()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!r&&!s&&!l)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(l&&E(i)){const u=o.byDeclaredAttr.get(t),a=i.getAttribute(t);for(let n=0;n<u.length;n++)G(u[n].spec,a,t,u[n].componentTag,i)}if(window.lnCore._debugSink&&(r||s)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),r){const u=o.byReactive.get(t);u&&ee(u,i,t,e.oldValue),o.reactiveWildcard.length&&ee(o.reactiveWildcard,i,t,e.oldValue)}if(s)for(let u=0;u<s.length;u++){const a=s[u];if(a.handler){a.handler(i,t,e.oldValue);continue}a.onAttributeChange&&i[a.attribute]?a.onAttributeChange(i,t):(Y(i,a.selector,a.attribute,a.ComponentFn),a.onInit&&a.onInit(i))}}}function Ee(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{ke(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 Se(e){const t=L();if(!t.length)return;const r=e.target;if(r){const o=r.nodeType===1?r:r.parentElement;if(o&&(o.isContentEditable||o.closest&&o.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let o=0;o<t.length;o++){const s=t[o];if(s.onSubtreeChange&&s.query){const l=s.query,i=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;i&&s.onSubtreeChange(i,e)}}for(let o=0;o<e.addedNodes.length;o++){const s=e.addedNodes[o];if(s.nodeType===1){const l=!!(s.firstElementChild||s.children&&s.children.length);for(let i=0;i<t.length;i++){const u=t[i];if(u.selector&&u.attribute&&u.ComponentFn){if(!l)s.matches&&s.matches(u.query)&&x(s,u);else if(s.matches&&s.matches(u.query)&&x(s,u),s.querySelectorAll){const a=s.querySelectorAll(u.query);for(let n=0;n<a.length;n++)x(a[n],u)}}u.onInit&&u.onInit(s)}}}for(let o=0;o<e.removedNodes.length;o++){const s=e.removedNodes[o];if(s.nodeType===1){const l=!!(s.firstElementChild||s.children&&s.children.length);for(let i=0;i<t.length;i++){const u=t[i],a=u.query;if(a){if(!l)s.matches&&s.matches(a)&&O(s,u);else if(s.matches&&s.matches(a)&&O(s,u),s.querySelectorAll){const n=s.querySelectorAll(a);for(let c=0;c<n.length;c++)O(n[c],u)}}}}}}function te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{Se(o)}catch(s){console.error("[ln-core] lifecycle handler failed",o.target,s)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ie(e){L().push(e),te()}function ne(e,t,r,o,s={}){const l=s.extraAttributes||[],i=s.onAttributeChange||null,u=s.onSubtreeChange||null,a=s.onInit||null,n=s.onAttrChange||null,c=s.effects||null,d=s.attributes||null,f=d?Ce(d):c,m=d?new Set(Object.keys(d)):null,b=s.persist||null;function p(B){const _=B||document.body;if(Y(_,e,t,r),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,o,F)}}a&&a(_)}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:o,attributes:d,ComponentFn:r,onInit:a,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=s.subtreeQuery||(P?e:"["+e+"]");L().push({selector:e,attribute:t,ComponentFn:r,onInit:a,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,r={},o=re(t);if(!o)return r;const s=o.split("&");for(let l=0;l<s.length;l++){const i=s[l];if(!i)continue;const u=i.indexOf(":"),a=u>-1?i.slice(0,u):i,n=u>-1?i.slice(u+1):"";if(a)try{r[a]=decodeURIComponent(n)}catch{r[a]=n}}return r}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 r=T();t==null?delete r[e]:r[e]=String(t);const s=Object.keys(r).map(function(l){const i=r[l];return i===""?l:l+":"+encodeURIComponent(i)}).join("&");re(location.hash)!==s&&(location.hash=s)}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 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 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 r=e.slice(0,t),o=e.slice(t+1),s=o?o.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:r,values:s}}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,r){return typeof e!="string"||e.indexOf(t)===-1?e:e.split(t).join(r)}function $e(e,t,r,o){const s=new Map,l=[],i=[];for(const u of e||[])s.has(u.chainKey)||s.set(u.chainKey,[]),s.get(u.chainKey).push(u);return s.forEach((u,a)=>{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:a,at:n.leaseUntil});return}if((n.nextAttemptAt||0)>o){i.push({chainKey:a,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 Ke(e,t,r,o,s){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=Me(u.meta.action,r,o)),u.updatedAt=s,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,r)=>{const o=this.indexedDB.open(this.dbName,Fe);o.onupgradeneeded=s=>{const l=s.target.result;let i;l.objectStoreNames.contains(w)?i=s.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=s=>{this._db=s.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,s)=>{const i=r.transaction(w,"readonly").objectStore(w).index("by_scope_seq").getAll(q(this.keyRange,t));i.onsuccess=()=>o(i.result||[]),i.onerror=()=>s(g(i,"Queue scope read failed"))}):[])}enqueue(t,r){return r=r||{},this.open().then(o=>o?new Promise((s,l)=>{const i=o.transaction([y,w],"readwrite"),u=i.objectStore(y),a=i.objectStore(w),n=oe(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}),a.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=a.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=()=>s(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(s=>s?new Promise((l,i)=>{const u=s.transaction(w,"readwrite"),a=u.objectStore(w),n=a.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||[],r,o,c);for(const f of d.entries)a.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,s)=>(s.delete(o.entryId),{status:"acked",entry:o}))}nack(t,r,o,s){s=s||{};const l=s.maxAttempts||8,i=s.backoff||[2e3,5e3,15e3,6e4,3e5];return this.open().then(u=>u?new Promise((a,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(ie(p),p.updatedAt=this.now(),o==="auth"){p.status="pending",d.put(p),f.put({key:k(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=()=>a(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,s){return this._remapTransaction(t,r,o,s)}_remapTransaction(t,r,o,s){return this.open().then(l=>l?new Promise((i,u)=>{const a=l.transaction(w,"readwrite"),n=a.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||[],r,o,s,this.now());for(const f of d.deleted)n.delete(f);for(const f of d.changed)n.put(f)},a.oncomplete=()=>i(d.changed),a.onerror=()=>u(a.error||new Error("Queue remap transaction failed")),a.onabort=()=>u(a.error||new Error("Queue remap transaction aborted"))}):[])}resetFailed(t){return this.open().then(r=>r?new Promise((o,s)=>{const l=r.transaction(w,"readwrite"),i=l.objectStore(w),u=i.index("by_scope_seq").getAll(q(this.keyRange,t));let a=0;u.onerror=()=>s(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),a++)},l.oncomplete=()=>o(a),l.onerror=()=>s(l.error||new Error("Queue failed-entry reset failed")),l.onabort=()=>s(l.error||new Error("Queue failed-entry reset aborted"))}):0)}getPaused(t){return this.open().then(r=>r?new Promise((o,s)=>{const i=r.transaction(y,"readonly").objectStore(y).get(k(t));i.onsuccess=()=>{const u=i.result?i.result.value:!1;o(u||!1)},i.onerror=()=>s(g(i,"Queue pause-state read failed"))}):!1)}setPaused(t,r){return this.open().then(o=>{if(o)return new Promise((s,l)=>{const i=o.transaction(y,"readwrite"),u=typeof r=="string"?r:r?"manual":!1;i.objectStore(y).put({key:k(t),value:u}),i.oncomplete=()=>s(),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,s)=>{const l=r.transaction([w,y],"readwrite"),u=l.objectStore(w).index("by_scope_seq").openCursor(q(this.keyRange,t));u.onsuccess=a=>{const n=a.target.result;n&&(n.delete(),n.continue())},u.onerror=()=>s(g(u,"Queue clear failed")),l.objectStore(y).delete(oe(t)),l.objectStore(y).delete(k(t)),l.oncomplete=()=>o(),l.onerror=()=>s(l.error||new Error("Queue clear transaction failed")),l.onabort=()=>s(l.error||new Error("Queue clear transaction aborted"))})})}_updateEntry(t,r,o){return this.open().then(s=>s?new Promise((l,i)=>{const u=s.transaction(w,"readwrite"),a=u.objectStore(w),n=a.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,a))},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,s=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 a(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}a.prototype._isOnline=function(){const n=this.dom.getAttribute("data-ln-api-queue-online");return n==="true"?!0:n==="false"?!1:navigator.onLine},a.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))},a.prototype._clearTimer=function(n){const c=this._timers.get(n);c&&(clearTimeout(c),this._timers.delete(n))},a.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)},a.prototype._drain=function(){const n=this;return n._paused||!n._isOnline()?Promise.resolve():(n._drainPromise||(n._drainPromise=u.claimReady(n.scope,n._workerId,s).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)},a.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})})},a.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})})},a.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})})},a.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})})},a.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})})},a.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})})},a.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})})},a.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})})},a.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})})},a.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)},a.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,a,"ln-api-queue",{attributes:i})})()})();
|
|
1
|
+
(function(){"use strict";function $(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function E(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 s=null;for(let a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){s=t[a];break}if(!E(s))return}e.apply(console,t)}}function h(e,t,o){const s=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,s),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:s}))}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 ce(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function de(e,t){const o=!!(t&&t.typed),s=t&&t.exclude,a={},l=e.elements,i={};if(o)for(let u=0;u<l.length;u++){const r=l[u];r.name&&r.type==="checkbox"&&!r.disabled&&(i[r.name]=(i[r.name]||0)+1)}for(let u=0;u<l.length;u++){const r=l[u];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(s&&r.matches&&r.matches(s)))if(r.type==="checkbox")o&&i[r.name]===1?a[r.name]=r.checked:(a[r.name]||(a[r.name]=[]),r.checked&&a[r.name].push(r.value));else if(r.type==="radio")r.checked&&(a[r.name]=r.value);else if(r.type==="select-multiple"){a[r.name]=[];for(let n=0;n<r.options.length;n++)r.options[n].selected&&a[r.name].push(r.options[n].value)}else if(o&&r.type==="hidden")a[r.name]=r.value;else if(o&&(r.type==="number"||r.type==="range")){const n=Number(r.value);a[r.name]=r.value===""||isNaN(n)?null:n}else a[r.name]=r.value}return a}function fe(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function pe(e,t){const o=e.elements,s=[],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 r=t[u];if(i.type==="checkbox"){if(Array.isArray(r))i.checked=r.indexOf(i.value)!==-1;else if(a[i.name]>1){const n=String(r).split(",").map(function(c){return c.trim()});i.checked=n.indexOf(i.value)!==-1}else i.checked=fe(r);s.push(i)}else if(i.type==="radio")i.checked=i.value===String(r),s.push(i);else if(i.type==="select-multiple"){if(Array.isArray(r))for(let n=0;n<i.options.length;n++)i.options[n].selected=r.indexOf(i.options[n].value)!==-1;s.push(i)}else i.value=r,i.tagName==="SELECT"&&r!=null&&i.setAttribute("data-ln-value",r),s.push(i)}return s}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=pe,window.lnCore.serializeForm=de,window.lnCore.resolveFormMethod=ce);const K={};function he(e,t){K[e]=t}function we(e){return K[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=he,window.lnCore.getDataMapper=we);function me(){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 j={};function be(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];j[o]=t}function ye(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=be,window.lnCore.getLocaleFallback=ye,window.lnCore.ensureLocaleObserver=me);const S={};function ge(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 U(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],r=u.getAttribute("data-ln-field");t[r]!=null&&(u.textContent=t[r])}const s=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<s.length;i++){const u=s[i],r=u.getAttribute("data-ln-attr").split(",");for(let n=0;n<r.length;n++){const c=r[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],r=u.getAttribute("data-ln-show");r in t&&u.classList.toggle("hidden",!t[r])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const u=l[i],r=u.getAttribute("data-ln-class").split(",");for(let n=0;n<r.length;n++){const c=r[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 _e(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 s=0;s<o.length;s++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[s],t??null),o[s].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 o=0;o<t.length;o++)t[o].textContent=""}})));function V(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 s=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 r=0;r<u.length;r++){const n=u[r];n.value.indexOf("{{")!==-1&&i.setAttribute(n.name,n.value.replace(/\{\{\s*(\w+)\s*\}\}/g,s))}}return e}function Ce(e,t,o,s,a,l){const i={};for(let r=0;r<e.children.length;r++){const n=e.children[r],c=n.getAttribute("data-ln-render-key");c&&(i[c]=n)}const u=document.createDocumentFragment();for(let r=0;r<t.length;r++){const n=t[r],c=String(s(n));let d=i[c];if(d)a(d,n,r);else{const f=ge(o,l);if(!f||(V(f,n),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",c),a(d,n,r)}u.appendChild(d)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=V,window.lnCore.fill=U,window.lnCore.lnFill=_e,window.lnCore.renderList=Ce);function I(e,t,o){const s=e.getAttribute(t);return s===null?o:s}function W(e,t,o){const s=parseInt(e.getAttribute(t),10);return isNaN(s)?o:s}function H(e,t,o=!1){const s=e.getAttribute(t);if(s===null)return!!o;const a=s.trim().toLowerCase();return!(a==="false"||a==="0")}function z(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const D=new Map;function J(e,t){const o=(e?e.join("|"):"")+"::"+t;if(D.has(o))return D.get(o);const s=new Set(e||[]),a=function(l,i){const u=l.getAttribute(i);return u!==null&&s.has(u)?u:t};return D.set(o,a),a}function X(e,t,o){const s=parseFloat(e.getAttribute(t));return isNaN(s)?o:s}function G(e,t,o){const s=e.getAttribute(t);if(!s)return o;try{return JSON.parse(s)}catch{return o}}function Y(e,t,o,s,a){if(!e||t===null)return!0;const l=s||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const u=r=>{a?console.warn(r,a):console.warn(r)};if(i==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(u(`[${l}] 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:(u(`[${l}] Invalid value "${t}" for attribute "${o}". Allowed: ${r.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 r=parseInt(t,10);return e.min!==void 0&&r<e.min?(u(`[${l}] Value ${r} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(u(`[${l}] Value ${r} 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(r){return u(`[${l}] Invalid JSON for attribute "${o}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function qe(e,t,o){for(const s in o){const[a,l,i]=o[s];Object.defineProperty(e,s,{get:function(){return a(t,l,i)},enumerable:!0,configurable:!0})}return e}function xe(e){const t={};for(const o in e){const s=e[o];if(!s||!s.prop)continue;let a=s.read;if(!a&&s.type)switch(s.type){case"enum":a=J(s.values,s.fallback);break;case"integer":a=W;break;case"float":a=X;break;case"boolean":a=H;break;case"list":a=z;break;case"json":a=G;break;case"string":default:a=I;break}a||(a=I),t[s.prop]=[a,o,s.fallback]}return t}function ve(e){const t={};for(const o in e){const s=e[o];s&&s.effect&&(t[o]=s.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 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=qe,window.lnCore.attrSpec=xe,window.lnCore.attrStr=I,window.lnCore.attrInt=W,window.lnCore.attrBool=H,window.lnCore.attrList=z,window.lnCore.attrEnum=J,window.lnCore.attrFloat=X,window.lnCore.attrJson=G);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 Z(e,t,o,s){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:o,ComponentFn:s};if(e.matches&&e.matches(l)&&x(e,i),e.querySelectorAll){const u=e.querySelectorAll(l);for(let r=0;r<u.length;r++)x(u[r],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ke(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ee(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 Se(e){const t=ee(),o=e.observed||[];for(let s=0;s<o.length;s++){const a=o[s];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 s in e.attributes){t.byDeclaredAttr.has(s)||t.byDeclaredAttr.set(s,[]);const a=t.byDeclaredAttr.get(s);a.some(l=>l.componentTag===e.componentTag)||a.push({spec:e.attributes[s],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const s=Ae(e);if(s===null)t.reactiveWildcard.push(e);else for(const a of s)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function te(e,t,o,s){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,s):l.onAttrChange&&(!l.declared||l.declared.has(o))&&l.onAttrChange(t,o,s)}}function Ie(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,s=ee(),a=s.byAttr.get(t),l=$()&&s.byDeclaredAttr&&s.byDeclaredAttr.has(t);if(!o&&!a&&!l)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(l&&E(i)){const u=s.byDeclaredAttr.get(t),r=i.getAttribute(t);for(let n=0;n<u.length;n++)Y(u[n].spec,r,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=s.byReactive.get(t);u&&te(u,i,t,e.oldValue),s.reactiveWildcard.length&&te(s.reactiveWildcard,i,t,e.oldValue)}if(a)for(let u=0;u<a.length;u++){const r=a[u];if(r.handler){r.handler(i,t,e.oldValue);continue}r.onAttributeChange&&i[r.attribute]?r.onAttributeChange(i,t):(Z(i,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(i))}}}function De(){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{Ie(t[o])}catch(s){console.error("[ln-core] mutation handler failed",t[o].target,s)}}).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(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function T(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(s){console.error("["+t.attribute+"] destroy failed",e,s)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Le(e){const t=L();if(!t.length)return;const o=e.target;if(o){const a=o.nodeType===1?o:o.parentElement;if(a&&(a.isContentEditable||a.closest&&a.closest('[contenteditable]:not([contenteditable="false"])')))return}const s=O();if(e.target&&s.length)for(let a=0;a<s.length;a++){const l=s[a],i=l.query,u=e.target.nodeType===1?e.target.matches&&e.target.matches(i)?e.target:e.target.closest?e.target.closest(i):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(i):null;u&&l.onSubtreeChange(u,e)}for(let a=0;a<e.addedNodes.length;a++){const l=e.addedNodes[a];if(l.nodeType===1){const i=!!(l.firstElementChild||l.children&&l.children.length);for(let u=0;u<t.length;u++){const r=t[u];if(r.selector&&r.attribute&&r.ComponentFn){if(!i)l.matches&&l.matches(r.query)&&x(l,r);else if(l.matches&&l.matches(r.query)&&x(l,r),l.querySelectorAll){const n=l.querySelectorAll(r.query);for(let c=0;c<n.length;c++)x(n[c],r)}}r.onInit&&r.onInit(l)}}}for(let a=0;a<e.removedNodes.length;a++){const l=e.removedNodes[a];if(l.nodeType===1){const i=!!(l.firstElementChild||l.children&&l.children.length);for(let u=0;u<t.length;u++){const r=t[u],n=r.query;if(n){if(!i)l.matches&&l.matches(n)&&T(l,r);else if(l.matches&&l.matches(n)&&T(l,r),l.querySelectorAll){const c=l.querySelectorAll(n);for(let d=0;d<c.length;d++)T(c[d],r)}}}}}}function ne(){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 s=t[o];if(s.type==="childList")try{Le(s)}catch(a){console.error("[ln-core] lifecycle handler failed",s.target,a)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Oe(e){L().push(e),e.onSubtreeChange&&e.query&&O().push(e),ne()}function re(e,t,o,s,a={}){const l=a.extraAttributes||[],i=a.onAttributeChange||null,u=a.onSubtreeChange||null,r=a.onInit||null,n=a.onAttrChange||null,c=a.effects||null,d=a.attributes||null,f=d?ve(d):c,m=d?new Set(Object.keys(d)):null,b=a.persist||null;function p(Q){const _=Q||document.body;if(Z(_,e,t,o),d&&$())for(const v in d){const He=d[v],N=Array.from(_.querySelectorAll("["+v+"]"));_.matches&&_.matches("["+v+"]")&&N.push(_);for(let F=0;F<N.length;F++){const M=N[F];E(M)&&Y(He,M.getAttribute(v),v,s,M)}}r&&r(_)}const C=[];if(e.indexOf("[")!==-1){const Q=/\[([\w-]+)/g;let _;for(;(_=Q.exec(e))!==null;)C.push(_[1])}else C.push(e);Se({selector:e,attribute:t,componentTag:s,attributes:d,ComponentFn:o,onInit:r,observed:C.concat(l),onAttributeChange:i,onAttrChange:n,effects:f,declared:m,persist:b}),De();const B=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,ae=a.subtreeQuery||(B?e:"["+e+"]"),ue={selector:e,attribute:t,ComponentFn:o,onInit:r,onSubtreeChange:u,query:ae};L().push(ue),u&&ae&&O().push(ue),ne(),window[t]=p,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=re,window.lnCore.observeLifecycle=Oe);function le(){ke()>0?Ee(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",le):le(),p}function oe(e){return(e||"").replace(/^#/,"")}function R(e){const t=e===void 0?location.hash:e,o={},s=oe(t);if(!s)return o;const a=s.split("&");for(let l=0;l<a.length;l++){const i=a[l];if(!i)continue;const u=i.indexOf(":"),r=u>-1?i.slice(0,u):i,n=u>-1?i.slice(u+1):"";if(r)try{o[r]=decodeURIComponent(n)}catch{o[r]=n}}return o}function Te(e){if(!e)return null;const t=R();return e in t?t[e]:null}function Re(e,t){if(!e)return;const o=R();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("&");oe(location.hash)!==a&&(location.hash=a)}function Pe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Be(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 s=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return s?t?s+"-"+t:s:t||null}function Qe(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 Fe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Me(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),s=e.slice(t+1),a=s?s.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=R,window.lnCore.hashGet=Te,window.lnCore.hashSet=Re,window.lnCore.hashLinkClick=Pe,window.lnCore.resolveHashNamespace=Be,window.lnCore.hashSortEncode=Qe,window.lnCore.hashSortDecode=Ne,window.lnCore.hashFilterEncode=Fe,window.lnCore.hashFilterDecode=Me);function P(){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=P);const $e="ln_api_queue",Ke=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 ie(e){return"seq:"+e}function k(e){return"paused:"+e}function se(e){e.leaseOwner=null,e.leaseUntil=0}function je(e,t,o){return typeof e!="string"||e.indexOf(t)===-1?e:e.split(t).join(o)}function Ue(e,t,o,s){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,r)=>{u.sort((c,d)=>c.seq-d.seq);const n=u[0];if(!(!n||n.status==="failed")){if(n.status==="inflight"&&(n.leaseUntil||0)>s){i.push({chainKey:r,at:n.leaseUntil});return}if((n.nextAttemptAt||0)>s){i.push({chainKey:r,at:n.nextAttemptAt});return}n.status="inflight",n.leaseOwner=t,n.leaseUntil=s+o,n.updatedAt=s,l.push(n)}}),{entries:l,wakeups:i}}function Ve(e,t,o,s,a){const l=[],i=[];for(const u of e||[]){if(u.entryId===t){i.push(u.entryId);continue}u.chainKey===o&&(u.chainKey=s,u.targetId===o&&(u.targetId=s),u.meta&&u.meta.id===o&&(u.meta.id=s),u.meta&&typeof u.meta.action=="string"&&(u.meta.action=je(u.meta.action,o,s)),u.updatedAt=a,l.push(u))}return{changed:l,deleted:i}}class We{constructor(t){t=t||{},this.indexedDB=t.indexedDB||globalThis.indexedDB,this.keyRange=t.IDBKeyRange||globalThis.IDBKeyRange,this.dbName=t.dbName||$e,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 s=this.indexedDB.open(this.dbName,Ke);s.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"})},s.onerror=()=>o(g(s,"Queue database open failed")),s.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 s=this.indexedDB.deleteDatabase(this.dbName);s.onsuccess=()=>t(),s.onerror=()=>o(g(s,"Queue database delete failed")),s.onblocked=()=>o(new Error("Queue database delete blocked"))}):Promise.resolve()}allForScope(t){return this.open().then(o=>o?new Promise((s,a)=>{const i=o.transaction(w,"readonly").objectStore(w).index("by_scope_seq").getAll(q(this.keyRange,t));i.onsuccess=()=>s(i.result||[]),i.onerror=()=>a(g(i,"Queue scope read failed"))}):[])}enqueue(t,o){return o=o||{},this.open().then(s=>s?new Promise((a,l)=>{const i=s.transaction([y,w],"readwrite"),u=i.objectStore(y),r=i.objectStore(w),n=ie(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}),r.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=r.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,B)=>Math.max(C,B.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,s){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),r=u.objectStore(w),n=r.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=Ue(n.result||[],o,s,c);for(const f of d.entries)r.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,(s,a)=>(a.delete(s.entryId),{status:"acked",entry:s}))}nack(t,o,s,a){a=a||{};const l=a.maxAttempts||8,i=a.backoff||[2e3,5e3,15e3,6e4,3e5];return this.open().then(u=>u?new Promise((r,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(s==="drop"){d.delete(p.entryId),b={status:"dropped",entry:p};return}if(se(p),p.updatedAt=this.now(),s==="auth"){p.status="pending",d.put(p),f.put({key:k(t),value:"auth"}),b={status:"auth",entry:p};return}if(s==="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=()=>r(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,s){return this._remapTransaction(t,null,o,s)}resolveCreate(t,o,s,a){return this._remapTransaction(t,o,s,a)}_remapTransaction(t,o,s,a){return this.open().then(l=>l?new Promise((i,u)=>{const r=l.transaction(w,"readwrite"),n=r.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=Ve(c.result||[],o,s,a,this.now());for(const f of d.deleted)n.delete(f);for(const f of d.changed)n.put(f)},r.oncomplete=()=>i(d.changed),r.onerror=()=>u(r.error||new Error("Queue remap transaction failed")),r.onabort=()=>u(r.error||new Error("Queue remap transaction aborted"))}):[])}resetFailed(t){return this.open().then(o=>o?new Promise((s,a)=>{const l=o.transaction(w,"readwrite"),i=l.objectStore(w),u=i.index("by_scope_seq").getAll(q(this.keyRange,t));let r=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(),se(n),i.put(n),r++)},l.oncomplete=()=>s(r),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((s,a)=>{const i=o.transaction(y,"readonly").objectStore(y).get(k(t));i.onsuccess=()=>{const u=i.result?i.result.value:!1;s(u||!1)},i.onerror=()=>a(g(i,"Queue pause-state read failed"))}):!1)}setPaused(t,o){return this.open().then(s=>{if(s)return new Promise((a,l)=>{const i=s.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((s,a)=>{const l=o.transaction([w,y],"readwrite"),u=l.objectStore(w).index("by_scope_seq").openCursor(q(this.keyRange,t));u.onsuccess=r=>{const n=r.target.result;n&&(n.delete(),n.continue())},u.onerror=()=>a(g(u,"Queue clear failed")),l.objectStore(y).delete(ie(t)),l.objectStore(y).delete(k(t)),l.oncomplete=()=>s(),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,s){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),r=u.objectStore(w),n=r.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=s(d,r))},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],s=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 We({indexedDB:window.indexedDB,IDBKeyRange:window.IDBKeyRange,uuid:P});function r(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=P(),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}r.prototype._isOnline=function(){const n=this.dom.getAttribute("data-ln-api-queue-online");return n==="true"?!0:n==="false"?!1:navigator.onLine},r.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))},r.prototype._clearTimer=function(n){const c=this._timers.get(n);c&&(clearTimeout(c),this._timers.delete(n))},r.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)},r.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)},r.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})})},r.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})})},r.prototype._onNack=function(n){const c=this,d=n.detail||{};return u.nack(c.scope,d.entryId,d.reason,{maxAttempts:s,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})})},r.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})})},r.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})})},r.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})})},r.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})})},r.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})})},r.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})})},r.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)},r.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]},re(e,t,r,"ln-api-queue",{attributes:i})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function D(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function 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 r=null;for(let n=1;n<t.length;n++)if(t[n]&&t[n].nodeType===1){r=t[n];break}if(!C(r))return}e.apply(console,t)}}function G(e,t,i){const r=i||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}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 i=!!(t&&t.typed),r=t&&t.exclude,n={},c=e.elements,l={};if(i)for(let s=0;s<c.length;s++){const o=c[s];o.name&&o.type==="checkbox"&&!o.disabled&&(l[o.name]=(l[o.name]||0)+1)}for(let s=0;s<c.length;s++){const o=c[s];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(r&&o.matches&&o.matches(r)))if(o.type==="checkbox")i&&l[o.name]===1?n[o.name]=o.checked:(n[o.name]||(n[o.name]=[]),o.checked&&n[o.name].push(o.value));else if(o.type==="radio")o.checked&&(n[o.name]=o.value);else if(o.type==="select-multiple"){n[o.name]=[];for(let a=0;a<o.options.length;a++)o.options[a].selected&&n[o.name].push(o.options[a].value)}else if(i&&o.type==="hidden")n[o.name]=o.value;else if(i&&(o.type==="number"||o.type==="range")){const a=Number(o.value);n[o.name]=o.value===""||isNaN(a)?null:a}else n[o.name]=o.value}return n}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 i=e.elements,r=[],n={};for(let c=0;c<i.length;c++){const l=i[c];l.name&&l.type==="checkbox"&&(n[l.name]=(n[l.name]||0)+1)}for(let c=0;c<i.length;c++){const l=i[c];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const s=l.getAttribute("data-ln-fill-as")||l.name;if(!s||!(s in t))continue;const o=t[s];if(l.type==="checkbox"){if(Array.isArray(o))l.checked=o.indexOf(l.value)!==-1;else if(n[l.name]>1){const a=String(o).split(",").map(function(u){return u.trim()});l.checked=a.indexOf(l.value)!==-1}else l.checked=Y(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 a=0;a<l.options.length;a++)l.options[a].selected=o.indexOf(l.options[a].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=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 T={};function oe(e,t){if(!e||typeof t!="object")return;const i=e.toLowerCase().split("-")[0];T[i]=t}function re(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=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 i=m[e];return i?i.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function q(e,t){if(!e||!t)return e;const i=e.querySelectorAll("[data-ln-field]");for(let l=0;l<i.length;l++){const s=i[l],o=s.getAttribute("data-ln-field");t[o]!=null&&(s.textContent=t[o])}const r=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<r.length;l++){const s=r[l],o=s.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&&s.setAttribute(d,t[f])}}const n=e.querySelectorAll("[data-ln-show]");for(let l=0;l<n.length;l++){const s=n[l],o=s.getAttribute("data-ln-show");o in t&&s.classList.toggle("hidden",!t[o])}const c=e.querySelectorAll("[data-ln-class]");for(let l=0;l<c.length;l++){const s=c[l],o=s.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&&s.classList.toggle(d,!!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 i=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<i.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",i[r],t??null),i[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 i=0;i<t.length;i++)t[i].textContent=""}})));function F(e,t){if(!e||!t)return e;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;i.nextNode();){const c=i.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,s){return t[s]!==void 0?t[s]:""}))}const r=function(c,l){return t[l]!==void 0?t[l]:""},n=Array.from(e.querySelectorAll("*"));e.nodeType===1&&n.push(e);for(let c=0;c<n.length;c++){const l=n[c],s=l.attributes;for(let o=0;o<s.length;o++){const a=s[o];a.value.indexOf("{{")!==-1&&l.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function se(e,t,i,r,n,c){const l={};for(let o=0;o<e.children.length;o++){const a=e.children[o],u=a.getAttribute("data-ln-render-key");u&&(l[u]=a)}const s=document.createDocumentFragment();for(let o=0;o<t.length;o++){const a=t[o],u=String(r(a));let d=l[u];if(d)n(d,a,o);else{const f=ie(i,c);if(!f||(F(f,a),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),n(d,a,o)}s.appendChild(d)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=F,window.lnCore.fill=q,window.lnCore.lnFill=le,window.lnCore.renderList=se);function y(e,t,i){const r=e.getAttribute(t);return r===null?i:r}function $(e,t,i){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?i:r}function N(e,t,i=!1){const r=e.getAttribute(t);if(r===null)return!!i;const n=r.trim().toLowerCase();return!(n==="false"||n==="0")}function M(e,t){return(e.getAttribute(t)||"").split(",").map(i=>i.trim()).filter(Boolean)}const A=new Map;function R(e,t){const i=(e?e.join("|"):"")+"::"+t;if(A.has(i))return A.get(i);const r=new Set(e||[]),n=function(c,l){const s=c.getAttribute(l);return s!==null&&r.has(s)?s:t};return A.set(i,n),n}function B(e,t,i){const r=parseFloat(e.getAttribute(t));return isNaN(r)?i:r}function j(e,t,i){const r=e.getAttribute(t);if(!r)return i;try{return JSON.parse(r)}catch{return i}}function W(e,t,i,r,n){if(!e||t===null)return!0;const c=r||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const s=o=>{n?console.warn(o,n):console.warn(o)};if(l==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(s(`[${c}] Invalid value "${t}" for boolean attribute "${i}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const o=e.values||[];return o.includes(t)?!0:(s(`[${c}] Invalid value "${t}" for attribute "${i}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return s(`[${c}] Invalid integer "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(s(`[${c}] Value ${o} for attribute "${i}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(s(`[${c}] Value ${o} for attribute "${i}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(s(`[${c}] Invalid float "${t}" for attribute "${i}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(o){return s(`[${c}] Invalid JSON for attribute "${i}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function ce(e,t,i){for(const r in i){const[n,c,l]=i[r];Object.defineProperty(e,r,{get:function(){return n(t,c,l)},enumerable:!0,configurable:!0})}return e}function ae(e){const t={};for(const i in e){const r=e[i];if(!r||!r.prop)continue;let n=r.read;if(!n&&r.type)switch(r.type){case"enum":n=R(r.values,r.fallback);break;case"integer":n=$;break;case"float":n=B;break;case"boolean":n=N;break;case"list":n=M;break;case"json":n=j;break;case"string":default:n=y;break}n||(n=y),t[r.prop]=[n,i,r.fallback]}return t}function ue(e){const t={};for(const i in e){const r=e[i];r&&r.effect&&(t[i]=r.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 i in e.effects)t.add(i);if(e.onAttrChange&&e.declared)for(const i of e.declared)t.add(i);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ce,window.lnCore.attrSpec=ae,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(i){console.error("["+t.attribute+"] init failed",e,i)}}}function U(e,t,i,r){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:i,ComponentFn:r};if(e.matches&&e.matches(c)&&h(e,l),e.querySelectorAll){const s=e.querySelectorAll(c);for(let o=0;o<s.length;o++)h(s[o],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function fe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function we(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function 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(),i=e.observed||[];for(let r=0;r<i.length;r++){const n=i[r];t.byAttr.has(n)||t.byAttr.set(n,[]),t.byAttr.get(n).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const n=t.byDeclaredAttr.get(r);n.some(c=>c.componentTag===e.componentTag)||n.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=de(e);if(r===null)t.reactiveWildcard.push(e);else for(const n of r)t.byReactive.has(n)||t.byReactive.set(n,[]),t.byReactive.get(n).push(e)}e.persist&&t.persist.push(e)}function z(e,t,i,r){for(let n=0;n<e.length;n++){const c=e[n];if(!t[c.attribute])continue;const l=c.effects&&c.effects[i];l?l(t,i,r):c.onAttrChange&&(!c.declared||c.declared.has(i))&&c.onAttrChange(t,i,r)}}function be(e){const t=e.attributeName,i=t.indexOf("data-ln-")===0,r=V(),n=r.byAttr.get(t),c=D()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!i&&!n&&!c)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(c&&C(l)){const s=r.byDeclaredAttr.get(t),o=l.getAttribute(t);for(let a=0;a<s.length;a++)W(s[a].spec,o,t,s[a].componentTag,l)}if(window.lnCore._debugSink&&(i||n)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),i){const s=r.byReactive.get(t);s&&z(s,l,t,e.oldValue),r.reactiveWildcard.length&&z(r.reactiveWildcard,l,t,e.oldValue)}if(n)for(let s=0;s<n.length;s++){const o=n[s];if(o.handler){o.handler(l,t,e.oldValue);continue}o.onAttributeChange&&l[o.attribute]?o.onAttributeChange(l,t):(U(l,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(l))}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let i=0;i<t.length;i++)try{be(t[i])}catch(r){console.error("[ln-core] mutation handler failed",t[i].target,r)}}).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 i=e[t.attribute];if(i&&typeof i.destroy=="function")try{i.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ge(e){const t=x();if(!t.length)return;const i=e.target;if(i){const r=i.nodeType===1?i:i.parentElement;if(r&&(r.isContentEditable||r.closest&&r.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let r=0;r<t.length;r++){const n=t[r];if(n.onSubtreeChange&&n.query){const c=n.query,l=e.target.nodeType===1?e.target.matches&&e.target.matches(c)?e.target:e.target.closest?e.target.closest(c):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(c):null;l&&n.onSubtreeChange(l,e)}}for(let r=0;r<e.addedNodes.length;r++){const n=e.addedNodes[r];if(n.nodeType===1){const c=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const s=t[l];if(s.selector&&s.attribute&&s.ComponentFn){if(!c)n.matches&&n.matches(s.query)&&h(n,s);else if(n.matches&&n.matches(s.query)&&h(n,s),n.querySelectorAll){const o=n.querySelectorAll(s.query);for(let a=0;a<o.length;a++)h(o[a],s)}}s.onInit&&s.onInit(n)}}}for(let r=0;r<e.removedNodes.length;r++){const n=e.removedNodes[r];if(n.nodeType===1){const c=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const s=t[l],o=s.query;if(o){if(!c)n.matches&&n.matches(o)&&v(n,s);else if(n.matches&&n.matches(o)&&v(n,s),n.querySelectorAll){const a=n.querySelectorAll(o);for(let u=0;u<a.length;u++)v(a[u],s)}}}}}}function H(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.type==="childList")try{ge(r)}catch(n){console.error("[ln-core] lifecycle handler failed",r.target,n)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ce(e){x().push(e),H()}function Q(e,t,i,r,n={}){const c=n.extraAttributes||[],l=n.onAttributeChange||null,s=n.onSubtreeChange||null,o=n.onInit||null,a=n.onAttrChange||null,u=n.effects||null,d=n.attributes||null,f=d?ue(d):u,Oe=d?new Set(Object.keys(d)):null,Le=n.persist||null;function g(S){const w=S||document.body;if(U(w,e,t,i),d&&D())for(const b in d){const Te=d[b],E=Array.from(w.querySelectorAll("["+b+"]"));w.matches&&w.matches("["+b+"]")&&E.push(w);for(let O=0;O<E.length;O++){const L=E[O];C(L)&&W(Te,L.getAttribute(b),b,r,L)}}o&&o(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:r,attributes:d,ComponentFn:i,onInit:o,observed:k.concat(c),onAttributeChange:l,onAttrChange:a,effects:f,declared:Oe,persist:Le}),pe();const De=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ie=n.subtreeQuery||(De?e:"["+e+"]");x().push({selector:e,attribute:t,ComponentFn:i,onInit:o,onSubtreeChange:s,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,i={},r=J(t);if(!r)return i;const n=r.split("&");for(let c=0;c<n.length;c++){const l=n[c];if(!l)continue;const s=l.indexOf(":"),o=s>-1?l.slice(0,s):l,a=s>-1?l.slice(s+1):"";if(o)try{i[o]=decodeURIComponent(a)}catch{i[o]=a}}return i}function me(e){if(!e)return null;const t=_();return e in t?t[e]:null}function ye(e,t){if(!e)return;const i=_();t==null?delete i[e]:i[e]=String(t);const n=Object.keys(i).map(function(c){const l=i[c];return l===""?c:c+":"+encodeURIComponent(l)}).join("&");J(location.hash)!==n&&(location.hash=n)}function Ae(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function xe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const i=e.getAttribute("data-ln-hash");if(i&&i.trim()!=="")return i.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 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 i=e.slice(0,t),r=e.slice(t+1),n=r?r.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:i,values:n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=me,window.lnCore.hashSet=ye,window.lnCore.hashLinkClick=Ae,window.lnCore.resolveHashNamespace=xe,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=_e,window.lnCore.hashFilterEncode=ke,window.lnCore.hashFilterDecode=Se);function Ee(){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=Ee),(function(){const e="data-ln-autoresize",t="lnAutoresize";if(window[t]!==void 0)return;const i={"data-ln-autoresize":{type:"marker",description:"Automatically adjusts textarea height to match its scrollable content"}};function r(n){if(n.tagName!=="TEXTAREA")return console.warn("[ln-autoresize] Can only be applied to <textarea>, got:",n.tagName),this;this.dom=n;const c=this;return this._onInput=function(){c._resize()},n.addEventListener("input",this._onInput),this._resize(),this}r.prototype._resize=function(){this.dom.style.height="auto",this.dom.style.height=this.dom.scrollHeight+"px"},r.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("input",this._onInput),this.dom.style.height="",delete this.dom[t])},Q(e,t,r,"ln-autoresize",{attributes:i})})()})();
|
|
1
|
+
(function(){"use strict";function I(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function 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 i=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){i=t[r];break}if(!C(i))return}e.apply(console,t)}}function Y(e,t,o){const i=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}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 Z(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ee(e,t){const o=!!(t&&t.typed),i=t&&t.exclude,r={},s=e.elements,l={};if(o)for(let c=0;c<s.length;c++){const n=s[c];n.name&&n.type==="checkbox"&&!n.disabled&&(l[n.name]=(l[n.name]||0)+1)}for(let c=0;c<s.length;c++){const n=s[c];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(i&&n.matches&&n.matches(i)))if(n.type==="checkbox")o&&l[n.name]===1?r[n.name]=n.checked:(r[n.name]||(r[n.name]=[]),n.checked&&r[n.name].push(n.value));else if(n.type==="radio")n.checked&&(r[n.name]=n.value);else if(n.type==="select-multiple"){r[n.name]=[];for(let u=0;u<n.options.length;u++)n.options[u].selected&&r[n.name].push(n.options[u].value)}else if(o&&n.type==="hidden")r[n.name]=n.value;else if(o&&(n.type==="number"||n.type==="range")){const u=Number(n.value);r[n.name]=n.value===""||isNaN(u)?null:u}else r[n.name]=n.value}return r}function te(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ne(e,t){const o=e.elements,i=[],r={};for(let s=0;s<o.length;s++){const l=o[s];l.name&&l.type==="checkbox"&&(r[l.name]=(r[l.name]||0)+1)}for(let s=0;s<o.length;s++){const l=o[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 n=t[c];if(l.type==="checkbox"){if(Array.isArray(n))l.checked=n.indexOf(l.value)!==-1;else if(r[l.name]>1){const u=String(n).split(",").map(function(a){return a.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=te(n);i.push(l)}else if(l.type==="radio")l.checked=l.value===String(n),i.push(l);else if(l.type==="select-multiple"){if(Array.isArray(n))for(let u=0;u<l.options.length;u++)l.options[u].selected=n.indexOf(l.options[u].value)!==-1;i.push(l)}else l.value=n,l.tagName==="SELECT"&&n!=null&&l.setAttribute("data-ln-value",n),i.push(l)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ne,window.lnCore.serializeForm=ee,window.lnCore.resolveFormMethod=Z);const T={};function oe(e,t){T[e]=t}function re(e){return T[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=oe,window.lnCore.getDataMapper=re);function ie(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){Y(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const q={};function le(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];q[o]=t}function se(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=le,window.lnCore.getLocaleFallback=se,window.lnCore.ensureLocaleObserver=ie);const m={};function ce(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 l=0;l<o.length;l++){const c=o[l],n=c.getAttribute("data-ln-field");t[n]!=null&&(c.textContent=t[n])}const i=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<i.length;l++){const c=i[l],n=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<n.length;u++){const a=n[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const r=e.querySelectorAll("[data-ln-show]");for(let l=0;l<r.length;l++){const c=r[l],n=c.getAttribute("data-ln-show");n in t&&c.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],n=c.getAttribute("data-ln-class").split(",");for(let u=0;u<n.length;u++){const a=n[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function ue(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 i=0;i<o.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[i],t??null),o[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)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 $(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(l,c){return t[c]!==void 0?t[c]:""}))}const i=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 n=0;n<c.length;n++){const u=c[n];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function ae(e,t,o,i,r,s){const l={};for(let n=0;n<e.children.length;n++){const u=e.children[n],a=u.getAttribute("data-ln-render-key");a&&(l[a]=u)}const c=document.createDocumentFragment();for(let n=0;n<t.length;n++){const u=t[n],a=String(i(u));let d=l[a];if(d)r(d,u,n);else{const f=ce(o,s);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),r(d,u,n)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=F,window.lnCore.lnFill=ue,window.lnCore.renderList=ae);function y(e,t,o){const i=e.getAttribute(t);return i===null?o:i}function N(e,t,o){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?o:i}function R(e,t,o=!1){const i=e.getAttribute(t);if(i===null)return!!o;const r=i.trim().toLowerCase();return!(r==="false"||r==="0")}function M(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const A=new Map;function B(e,t){const o=(e?e.join("|"):"")+"::"+t;if(A.has(o))return A.get(o);const i=new Set(e||[]),r=function(s,l){const c=s.getAttribute(l);return c!==null&&i.has(c)?c:t};return A.set(o,r),r}function j(e,t,o){const i=parseFloat(e.getAttribute(t));return isNaN(i)?o:i}function W(e,t,o){const i=e.getAttribute(t);if(!i)return o;try{return JSON.parse(i)}catch{return o}}function U(e,t,o,i,r){if(!e||t===null)return!0;const s=i||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=n=>{r?console.warn(n,r):console.warn(n)};if(l==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const n=e.values||[];return n.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${o}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(c(`[${s}] Value ${n} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(c(`[${s}] Value ${n} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(n){return c(`[${s}] Invalid JSON for attribute "${o}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function de(e,t,o){for(const i in o){const[r,s,l]=o[i];Object.defineProperty(e,i,{get:function(){return r(t,s,l)},enumerable:!0,configurable:!0})}return e}function fe(e){const t={};for(const o in e){const i=e[o];if(!i||!i.prop)continue;let r=i.read;if(!r&&i.type)switch(i.type){case"enum":r=B(i.values,i.fallback);break;case"integer":r=N;break;case"float":r=j;break;case"boolean":r=R;break;case"list":r=M;break;case"json":r=W;break;case"string":default:r=y;break}r||(r=y),t[i.prop]=[r,o,i.fallback]}return t}function we(e){const t={};for(const o in e){const i=e[o];i&&i.effect&&(t[o]=i.effect)}return Object.keys(t).length?t:null}function he(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const 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=de,window.lnCore.attrSpec=fe,window.lnCore.attrStr=y,window.lnCore.attrInt=N,window.lnCore.attrBool=R,window.lnCore.attrList=M,window.lnCore.attrEnum=B,window.lnCore.attrFloat=j,window.lnCore.attrJson=W);function 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 V(e,t,o,i){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:o,ComponentFn:i};if(e.matches&&e.matches(s)&&h(e,l),e.querySelectorAll){const c=e.querySelectorAll(s);for(let n=0;n<c.length;n++)h(c[n],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function be(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function pe(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function 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 ge(e){const t=z(),o=e.observed||[];for(let i=0;i<o.length;i++){const r=o[i];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 i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const r=t.byDeclaredAttr.get(i);r.some(s=>s.componentTag===e.componentTag)||r.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=he(e);if(i===null)t.reactiveWildcard.push(e);else for(const r of i)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function H(e,t,o,i){for(let r=0;r<e.length;r++){const s=e[r];if(!t[s.attribute])continue;const l=s.effects&&s.effects[o];l?l(t,o,i):s.onAttrChange&&(!s.declared||s.declared.has(o))&&s.onAttrChange(t,o,i)}}function Ce(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,i=z(),r=i.byAttr.get(t),s=I()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!o&&!r&&!s)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(s&&C(l)){const c=i.byDeclaredAttr.get(t),n=l.getAttribute(t);for(let u=0;u<c.length;u++)U(c[u].spec,n,t,c[u].componentTag,l)}if(window.lnCore._debugSink&&(o||r)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),o){const c=i.byReactive.get(t);c&&H(c,l,t,e.oldValue),i.reactiveWildcard.length&&H(i.reactiveWildcard,l,t,e.oldValue)}if(r)for(let c=0;c<r.length;c++){const n=r[c];if(n.handler){n.handler(l,t,e.oldValue);continue}n.onAttributeChange&&l[n.attribute]?n.onAttributeChange(l,t):(V(l,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(l))}}}function me(){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{Ce(t[o])}catch(i){console.error("[ln-core] mutation handler failed",t[o].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function x(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function v(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function _(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ye(e){const t=x();if(!t.length)return;const o=e.target;if(o){const r=o.nodeType===1?o:o.parentElement;if(r&&(r.isContentEditable||r.closest&&r.closest('[contenteditable]:not([contenteditable="false"])')))return}const i=v();if(e.target&&i.length)for(let r=0;r<i.length;r++){const s=i[r],l=s.query,c=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;c&&s.onSubtreeChange(c,e)}for(let r=0;r<e.addedNodes.length;r++){const s=e.addedNodes[r];if(s.nodeType===1){const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const n=t[c];if(n.selector&&n.attribute&&n.ComponentFn){if(!l)s.matches&&s.matches(n.query)&&h(s,n);else if(s.matches&&s.matches(n.query)&&h(s,n),s.querySelectorAll){const u=s.querySelectorAll(n.query);for(let a=0;a<u.length;a++)h(u[a],n)}}n.onInit&&n.onInit(s)}}}for(let r=0;r<e.removedNodes.length;r++){const s=e.removedNodes[r];if(s.nodeType===1){const l=!!(s.firstElementChild||s.children&&s.children.length);for(let c=0;c<t.length;c++){const n=t[c],u=n.query;if(u){if(!l)s.matches&&s.matches(u)&&_(s,n);else if(s.matches&&s.matches(u)&&_(s,n),s.querySelectorAll){const a=s.querySelectorAll(u);for(let d=0;d<a.length;d++)_(a[d],n)}}}}}}function Q(){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 i=t[o];if(i.type==="childList")try{ye(i)}catch(r){console.error("[ln-core] lifecycle handler failed",i.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ae(e){x().push(e),e.onSubtreeChange&&e.query&&v().push(e),Q()}function J(e,t,o,i,r={}){const s=r.extraAttributes||[],l=r.onAttributeChange||null,c=r.onSubtreeChange||null,n=r.onInit||null,u=r.onAttrChange||null,a=r.effects||null,d=r.attributes||null,f=d?we(d):a,Ie=d?new Set(Object.keys(d)):null,Te=r.persist||null;function g(E){const w=E||document.body;if(V(w,e,t,o),d&&I())for(const b in d){const Fe=d[b],O=Array.from(w.querySelectorAll("["+b+"]"));w.matches&&w.matches("["+b+"]")&&O.push(w);for(let L=0;L<O.length;L++){const D=O[L];C(D)&&U(Fe,D.getAttribute(b),b,i,D)}}n&&n(w)}const S=[];if(e.indexOf("[")!==-1){const E=/\[([\w-]+)/g;let w;for(;(w=E.exec(e))!==null;)S.push(w[1])}else S.push(e);ge({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:o,onInit:n,observed:S.concat(s),onAttributeChange:l,onAttrChange:u,effects:f,declared:Ie,persist:Te}),me();const qe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,G=r.subtreeQuery||(qe?e:"["+e+"]"),P={selector:e,attribute:t,ComponentFn:o,onInit:n,onSubtreeChange:c,query:G};x().push(P),c&&G&&v().push(P),Q(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=J,window.lnCore.observeLifecycle=Ae);function X(){be()>0?pe(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",X):X(),g}function K(e){return(e||"").replace(/^#/,"")}function k(e){const t=e===void 0?location.hash:e,o={},i=K(t);if(!i)return o;const r=i.split("&");for(let s=0;s<r.length;s++){const l=r[s];if(!l)continue;const c=l.indexOf(":"),n=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(n)try{o[n]=decodeURIComponent(u)}catch{o[n]=u}}return o}function xe(e){if(!e)return null;const t=k();return e in t?t[e]:null}function ve(e,t){if(!e)return;const o=k();t==null?delete o[e]:o[e]=String(t);const r=Object.keys(o).map(function(s){const l=o[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");K(location.hash)!==r&&(location.hash=r)}function _e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ke(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function Se(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ee(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 Oe(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 o=e.slice(0,t),i=e.slice(t+1),r=i?i.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=k,window.lnCore.hashGet=xe,window.lnCore.hashSet=ve,window.lnCore.hashLinkClick=_e,window.lnCore.resolveHashNamespace=ke,window.lnCore.hashSortEncode=Se,window.lnCore.hashSortDecode=Ee,window.lnCore.hashFilterEncode=Oe,window.lnCore.hashFilterDecode=Le);function De(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=De),(function(){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 i(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}i.prototype._resize=function(){const r=this.dom.style.height;this.dom.style.height="auto";const s=this.dom.scrollHeight+"px";this.dom.style.height=r===s?r:s},i.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("input",this._onInput),this.dom.style.height="",delete this.dom[t])},J(e,t,i,"ln-autoresize",{attributes:o})})()})();
|
|
@@ -35,8 +35,10 @@ import { registerComponent } from '../../ln-core';
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
_component.prototype._resize = function () {
|
|
38
|
+
const prev = this.dom.style.height;
|
|
38
39
|
this.dom.style.height = 'auto';
|
|
39
|
-
|
|
40
|
+
const next = this.dom.scrollHeight + 'px';
|
|
41
|
+
this.dom.style.height = (prev === next) ? prev : next;
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
_component.prototype.destroy = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function q(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function 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 i=null;for(let o=1;o<t.length;o++)if(t[o]&&t[o].nodeType===1){i=t[o];break}if(!x(i))return}e.apply(console,t)}}function A(e,t,r){const i=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function ne(e,t,r){const i=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i);const o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:i});return e.dispatchEvent(o),o}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),i=t&&t.exclude,o={},a=e.elements,l={};if(r)for(let s=0;s<a.length;s++){const n=a[s];n.name&&n.type==="checkbox"&&!n.disabled&&(l[n.name]=(l[n.name]||0)+1)}for(let s=0;s<a.length;s++){const n=a[s];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(i&&n.matches&&n.matches(i)))if(n.type==="checkbox")r&&l[n.name]===1?o[n.name]=n.checked:(o[n.name]||(o[n.name]=[]),n.checked&&o[n.name].push(n.value));else if(n.type==="radio")n.checked&&(o[n.name]=n.value);else if(n.type==="select-multiple"){o[n.name]=[];for(let c=0;c<n.options.length;c++)n.options[c].selected&&o[n.name].push(n.options[c].value)}else if(r&&n.type==="hidden")o[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const c=Number(n.value);o[n.name]=n.value===""||isNaN(c)?null:c}else o[n.name]=n.value}return o}function 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,i=[],o={};for(let a=0;a<r.length;a++){const l=r[a];l.name&&l.type==="checkbox"&&(o[l.name]=(o[l.name]||0)+1)}for(let a=0;a<r.length;a++){const l=r[a];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const s=l.getAttribute("data-ln-fill-as")||l.name;if(!s||!(s in t))continue;const n=t[s];if(l.type==="checkbox"){if(Array.isArray(n))l.checked=n.indexOf(l.value)!==-1;else if(o[l.name]>1){const c=String(n).split(",").map(function(d){return d.trim()});l.checked=c.indexOf(l.value)!==-1}else l.checked=re(n);i.push(l)}else if(l.type==="radio")l.checked=l.value===String(n),i.push(l);else if(l.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<l.options.length;c++)l.options[c].selected=n.indexOf(l.options[c].value)!==-1;i.push(l)}else l.value=n,l.tagName==="SELECT"&&n!=null&&l.setAttribute("data-ln-value",n),i.push(l)}return i}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 l=0;l<r.length;l++){const s=r[l],n=s.getAttribute("data-ln-field");t[n]!=null&&(s.textContent=t[n])}const i=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<i.length;l++){const s=i[l],n=s.getAttribute("data-ln-attr").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),h=d[1].trim();t[h]!=null&&s.setAttribute(u,t[h])}}const o=e.querySelectorAll("[data-ln-show]");for(let l=0;l<o.length;l++){const s=o[l],n=s.getAttribute("data-ln-show");n in t&&s.classList.toggle("hidden",!t[n])}const a=e.querySelectorAll("[data-ln-class]");for(let l=0;l<a.length;l++){const s=a[l],n=s.getAttribute("data-ln-class").split(",");for(let c=0;c<n.length;c++){const d=n[c].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),h=d[1].trim();h in t&&s.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 i=0;i<r.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[i],t??null),r[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)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 a=r.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,s){return t[s]!==void 0?t[s]:""}))}const i=function(a,l){return t[l]!==void 0?t[l]:""},o=Array.from(e.querySelectorAll("*"));e.nodeType===1&&o.push(e);for(let a=0;a<o.length;a++){const l=o[a],s=l.attributes;for(let n=0;n<s.length;n++){const c=s[n];c.value.indexOf("{{")!==-1&&l.setAttribute(c.name,c.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function fe(e,t,r,i,o,a){const l={};for(let n=0;n<e.children.length;n++){const c=e.children[n],d=c.getAttribute("data-ln-render-key");d&&(l[d]=c)}const s=document.createDocumentFragment();for(let n=0;n<t.length;n++){const c=t[n],d=String(i(c));let u=l[d];if(u)o(u,c,n);else{const h=ue(r,a);if(!h||(W(h,c),u=h.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),o(u,c,n)}s.appendChild(u)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=U,window.lnCore.lnFill=de,window.lnCore.renderList=fe);function k(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function H(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function V(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const o=i.trim().toLowerCase();return!(o==="false"||o==="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 i=new Set(e||[]),o=function(a,l){const s=a.getAttribute(l);return s!==null&&i.has(s)?s:t};return E.set(r,o),o}function Q(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function P(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function X(e,t,r,i,o){if(!e||t===null)return!0;const a=i||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const s=n=>{o?console.warn(n,o):console.warn(n)};if(l==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(s(`[${a}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const n=e.values||[];return n.includes(t)?!0:(s(`[${a}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return s(`[${a}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(s(`[${a}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(s(`[${a}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(s(`[${a}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(n){return s(`[${a}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function we(e,t,r){for(const i in r){const[o,a,l]=r[i];Object.defineProperty(e,i,{get:function(){return o(t,a,l)},enumerable:!0,configurable:!0})}return e}function he(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let o=i.read;if(!o&&i.type)switch(i.type){case"enum":o=K(i.values,i.fallback);break;case"integer":o=H;break;case"float":o=Q;break;case"boolean":o=V;break;case"list":o=J;break;case"json":o=P;break;case"string":default:o=k;break}o||(o=k),t[i.prop]=[o,r,i.fallback]}return t}function be(e){const t={};for(const r in e){const i=e[r];i&&i.effect&&(t[r]=i.effect)}return Object.keys(t).length?t:null}function 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,i){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:r,ComponentFn:i};if(e.matches&&e.matches(a)&&m(e,l),e.querySelectorAll){const s=e.querySelectorAll(a);for(let n=0;n<s.length;n++)m(s[n],l)}}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 i=0;i<r.length;i++){const o=r[i];t.byAttr.has(o)||t.byAttr.set(o,[]),t.byAttr.get(o).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const o=t.byDeclaredAttr.get(i);o.some(a=>a.componentTag===e.componentTag)||o.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=pe(e);if(i===null)t.reactiveWildcard.push(e);else for(const o of i)t.byReactive.has(o)||t.byReactive.set(o,[]),t.byReactive.get(o).push(e)}e.persist&&t.persist.push(e)}function Y(e,t,r,i){for(let o=0;o<e.length;o++){const a=e[o];if(!t[a.attribute])continue;const l=a.effects&&a.effects[r];l?l(t,r,i):a.onAttrChange&&(!a.declared||a.declared.has(r))&&a.onAttrChange(t,r,i)}}function ye(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,i=G(),o=i.byAttr.get(t),a=q()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!r&&!o&&!a)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(a&&x(l)){const s=i.byDeclaredAttr.get(t),n=l.getAttribute(t);for(let c=0;c<s.length;c++)X(s[c].spec,n,t,s[c].componentTag,l)}if(window.lnCore._debugSink&&(r||o)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),r){const s=i.byReactive.get(t);s&&Y(s,l,t,e.oldValue),i.reactiveWildcard.length&&Y(i.reactiveWildcard,l,t,e.oldValue)}if(o)for(let s=0;s<o.length;s++){const n=o[s];if(n.handler){n.handler(l,t,e.oldValue);continue}n.onAttributeChange&&l[n.attribute]?n.onAttributeChange(l,t):(z(l,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(l))}}}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(i){console.error("[ln-core] mutation handler failed",t[r].target,i)}}).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(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function Ae(e){const t=L();if(!t.length)return;const r=e.target;if(r){const i=r.nodeType===1?r:r.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let i=0;i<t.length;i++){const o=t[i];if(o.onSubtreeChange&&o.query){const a=o.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&&o.onSubtreeChange(l,e)}}for(let i=0;i<e.addedNodes.length;i++){const o=e.addedNodes[i];if(o.nodeType===1){const a=!!(o.firstElementChild||o.children&&o.children.length);for(let l=0;l<t.length;l++){const s=t[l];if(s.selector&&s.attribute&&s.ComponentFn){if(!a)o.matches&&o.matches(s.query)&&m(o,s);else if(o.matches&&o.matches(s.query)&&m(o,s),o.querySelectorAll){const n=o.querySelectorAll(s.query);for(let c=0;c<n.length;c++)m(n[c],s)}}s.onInit&&s.onInit(o)}}}for(let i=0;i<e.removedNodes.length;i++){const o=e.removedNodes[i];if(o.nodeType===1){const a=!!(o.firstElementChild||o.children&&o.children.length);for(let l=0;l<t.length;l++){const s=t[l],n=s.query;if(n){if(!a)o.matches&&o.matches(n)&&O(o,s);else if(o.matches&&o.matches(n)&&O(o,s),o.querySelectorAll){const c=o.querySelectorAll(n);for(let d=0;d<c.length;d++)O(c[d],s)}}}}}}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 i=t[r];if(i.type==="childList")try{Ae(i)}catch(o){console.error("[ln-core] lifecycle handler failed",i.target,o)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function _e(e){L().push(e),Z()}function ee(e,t,r,i,o={}){const a=o.extraAttributes||[],l=o.onAttributeChange||null,s=o.onSubtreeChange||null,n=o.onInit||null,c=o.onAttrChange||null,d=o.effects||null,u=o.attributes||null,h=u?be(u):d,y=u?new Set(Object.keys(u)):null,I=o.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,i,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:i,attributes:u,ComponentFn:r,onInit:n,observed:C.concat(a),onAttributeChange:l,onAttrChange:c,effects:h,declared:y,persist:I}),ve();const w=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,f=o.subtreeQuery||(w?e:"["+e+"]");L().push({selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:s,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 T(e){const t=e===void 0?location.hash:e,r={},i=te(t);if(!i)return r;const o=i.split("&");for(let a=0;a<o.length;a++){const l=o[a];if(!l)continue;const s=l.indexOf(":"),n=s>-1?l.slice(0,s):l,c=s>-1?l.slice(s+1):"";if(n)try{r[n]=decodeURIComponent(c)}catch{r[n]=c}}return r}function xe(e){if(!e)return null;const t=T();return e in t?t[e]:null}function Se(e,t){if(!e)return;const r=T();t==null?delete r[e]:r[e]=String(t);const o=Object.keys(r).map(function(a){const l=r[a];return l===""?a:a+":"+encodeURIComponent(l)}).join("&");te(location.hash)!==o&&(location.hash=o)}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 i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function 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 Te(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 r=e.slice(0,t),i=e.slice(t+1),o=i?i.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:r,values:o}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=T,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=Te,window.lnCore.hashFilterDecode=Ie);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",i="data-ln-autosave-debounce-input",o='[data-ln-autosave-exclude], input[type="password"]';if(window[t]!==void 0)return;const a={"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(n){const c=n.tagName;return c==="INPUT"||c==="TEXTAREA"||c==="SELECT"}function s(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:o});try{localStorage.setItem(u,JSON.stringify(w))}catch{return}A(n,"ln-autosave:saved",{target:n,data:w})}function I(){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;l(f)&&f.name&&!f.matches(o)&&y()},this._onChange=function(w){const f=w.target;l(f)&&f.name&&!f.matches(o)&&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(i));return C>0&&(this._onInput=function(w){const f=w.target;!l(f)||!f.name||f.matches(o)||(h!==null&&clearTimeout(h),h=setTimeout(y,C))},n.addEventListener("input",this._onInput)),this._getInputTimer=function(){return h},I(),this}s.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,s,"ln-autosave",{attributes:a})})()})();
|
|
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 l=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){l=t[r];break}if(!E(l))return}e.apply(console,t)}}function A(e,t,o){const l=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:l}))}function re(e,t,o){const l=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,l);const r=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:l});return e.dispatchEvent(r),r}function x(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){x(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function ie(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function B(e,t){const o=!!(t&&t.typed),l=t&&t.exclude,r={},s=e.elements,i={};if(o)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")&&!(l&&n.matches&&n.matches(l)))if(n.type==="checkbox")o&&i[n.name]===1?r[n.name]=n.checked:(r[n.name]||(r[n.name]=[]),n.checked&&r[n.name].push(n.value));else if(n.type==="radio")n.checked&&(r[n.name]=n.value);else if(n.type==="select-multiple"){r[n.name]=[];for(let c=0;c<n.options.length;c++)n.options[c].selected&&r[n.name].push(n.options[c].value)}else if(o&&n.type==="hidden")r[n.name]=n.value;else if(o&&(n.type==="number"||n.type==="range")){const c=Number(n.value);r[n.name]=n.value===""||isNaN(c)?null:c}else r[n.name]=n.value}return r}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 j(e,t){const o=e.elements,l=[],r={};for(let s=0;s<o.length;s++){const i=o[s];i.name&&i.type==="checkbox"&&(r[i.name]=(r[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 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(r[i.name]>1){const c=String(n).split(",").map(function(d){return d.trim()});i.checked=c.indexOf(i.value)!==-1}else i.checked=le(n);l.push(i)}else if(i.type==="radio")i.checked=i.value===String(n),l.push(i);else if(i.type==="select-multiple"){if(Array.isArray(n))for(let c=0;c<i.options.length;c++)i.options[c].selected=n.indexOf(i.options[c].value)!==-1;l.push(i)}else i.value=n,i.tagName==="SELECT"&&n!=null&&i.setAttribute("data-ln-value",n),l.push(i)}return l}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=j,window.lnCore.serializeForm=B,window.lnCore.resolveFormMethod=ie);const U={};function se(e,t){U[e]=t}function ae(e){return U[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=se,window.lnCore.getDataMapper=ae);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,x(function(){new MutationObserver(function(){A(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const W={};function ue(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];W[o]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return W[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ue,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=ce);const S={};function fe(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 H(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let i=0;i<o.length;i++){const a=o[i],n=a.getAttribute("data-ln-field");t[n]!=null&&(a.textContent=t[n])}const l=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<l.length;i++){const a=l[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 r=e.querySelectorAll("[data-ln-show]");for(let i=0;i<r.length;i++){const a=r[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 we(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let l=0;l<o.length;l++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[l],t??null),o[l].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)H(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 V(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,a){return t[a]!==void 0?t[a]:""}))}const l=function(s,i){return t[i]!==void 0?t[i]:""},r=Array.from(e.querySelectorAll("*"));e.nodeType===1&&r.push(e);for(let s=0;s<r.length;s++){const i=r[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,l))}}return e}function he(e,t,o,l,r,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(l(c));let u=i[d];if(u)r(u,c,n);else{const h=fe(o,s);if(!h||(V(h,c),u=h.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),r(u,c,n)}a.appendChild(u)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=V,window.lnCore.fill=H,window.lnCore.lnFill=we,window.lnCore.renderList=he);function k(e,t,o){const l=e.getAttribute(t);return l===null?o:l}function J(e,t,o){const l=parseInt(e.getAttribute(t),10);return isNaN(l)?o:l}function K(e,t,o=!1){const l=e.getAttribute(t);if(l===null)return!!o;const r=l.trim().toLowerCase();return!(r==="false"||r==="0")}function Q(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const L=new Map;function P(e,t){const o=(e?e.join("|"):"")+"::"+t;if(L.has(o))return L.get(o);const l=new Set(e||[]),r=function(s,i){const a=s.getAttribute(i);return a!==null&&l.has(a)?a:t};return L.set(o,r),r}function X(e,t,o){const l=parseFloat(e.getAttribute(t));return isNaN(l)?o:l}function z(e,t,o){const l=e.getAttribute(t);if(!l)return o;try{return JSON.parse(l)}catch{return o}}function G(e,t,o,l,r){if(!e||t===null)return!0;const s=l||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const a=n=>{r?console.warn(n,r):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 "${o}". 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 "${o}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(a(`[${s}] Value ${n} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(a(`[${s}] Value ${n} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(n){return a(`[${s}] Invalid JSON for attribute "${o}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function be(e,t,o){for(const l in o){const[r,s,i]=o[l];Object.defineProperty(e,l,{get:function(){return r(t,s,i)},enumerable:!0,configurable:!0})}return e}function pe(e){const t={};for(const o in e){const l=e[o];if(!l||!l.prop)continue;let r=l.read;if(!r&&l.type)switch(l.type){case"enum":r=P(l.values,l.fallback);break;case"integer":r=J;break;case"float":r=X;break;case"boolean":r=K;break;case"list":r=Q;break;case"json":r=z;break;case"string":default:r=k;break}r||(r=k),t[l.prop]=[r,o,l.fallback]}return t}function ge(e){const t={};for(const o in e){const l=e[o];l&&l.effect&&(t[o]=l.effect)}return Object.keys(t).length?t:null}function Ce(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=be,window.lnCore.attrSpec=pe,window.lnCore.attrStr=k,window.lnCore.attrInt=J,window.lnCore.attrBool=K,window.lnCore.attrList=Q,window.lnCore.attrEnum=P,window.lnCore.attrFloat=X,window.lnCore.attrJson=z);function y(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,l){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:o,ComponentFn:l};if(e.matches&&e.matches(s)&&y(e,i),e.querySelectorAll){const a=e.querySelectorAll(s);for(let n=0;n<a.length;n++)y(a[n],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function me(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ye(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function 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 ve(e){const t=Z(),o=e.observed||[];for(let l=0;l<o.length;l++){const r=o[l];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 l in e.attributes){t.byDeclaredAttr.has(l)||t.byDeclaredAttr.set(l,[]);const r=t.byDeclaredAttr.get(l);r.some(s=>s.componentTag===e.componentTag)||r.push({spec:e.attributes[l],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const l=Ce(e);if(l===null)t.reactiveWildcard.push(e);else for(const r of l)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function ee(e,t,o,l){for(let r=0;r<e.length;r++){const s=e[r];if(!t[s.attribute])continue;const i=s.effects&&s.effects[o];i?i(t,o,l):s.onAttrChange&&(!s.declared||s.declared.has(o))&&s.onAttrChange(t,o,l)}}function _e(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,l=Z(),r=l.byAttr.get(t),s=M()&&l.byDeclaredAttr&&l.byDeclaredAttr.has(t);if(!o&&!r&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&E(i)){const a=l.byDeclaredAttr.get(t),n=i.getAttribute(t);for(let c=0;c<a.length;c++)G(a[c].spec,n,t,a[c].componentTag,i)}if(window.lnCore._debugSink&&(o||r)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),o){const a=l.byReactive.get(t);a&&ee(a,i,t,e.oldValue),l.reactiveWildcard.length&&ee(l.reactiveWildcard,i,t,e.oldValue)}if(r)for(let a=0;a<r.length;a++){const n=r[a];if(n.handler){n.handler(i,t,e.oldValue);continue}n.onAttributeChange&&i[n.attribute]?n.onAttributeChange(i,t):(Y(i,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(i))}}}function Ae(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,x(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{_e(t[o])}catch(l){console.error("[ln-core] mutation handler failed",t[o].target,l)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function O(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function T(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function I(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(l){console.error("["+t.attribute+"] destroy failed",e,l)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function xe(e){const t=O();if(!t.length)return;const o=e.target;if(o){const r=o.nodeType===1?o:o.parentElement;if(r&&(r.isContentEditable||r.closest&&r.closest('[contenteditable]:not([contenteditable="false"])')))return}const l=T();if(e.target&&l.length)for(let r=0;r<l.length;r++){const s=l[r],i=s.query,a=e.target.nodeType===1?e.target.matches&&e.target.matches(i)?e.target:e.target.closest?e.target.closest(i):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(i):null;a&&s.onSubtreeChange(a,e)}for(let r=0;r<e.addedNodes.length;r++){const s=e.addedNodes[r];if(s.nodeType===1){const i=!!(s.firstElementChild||s.children&&s.children.length);for(let a=0;a<t.length;a++){const n=t[a];if(n.selector&&n.attribute&&n.ComponentFn){if(!i)s.matches&&s.matches(n.query)&&y(s,n);else if(s.matches&&s.matches(n.query)&&y(s,n),s.querySelectorAll){const c=s.querySelectorAll(n.query);for(let d=0;d<c.length;d++)y(c[d],n)}}n.onInit&&n.onInit(s)}}}for(let r=0;r<e.removedNodes.length;r++){const s=e.removedNodes[r];if(s.nodeType===1){const i=!!(s.firstElementChild||s.children&&s.children.length);for(let a=0;a<t.length;a++){const n=t[a],c=n.query;if(c){if(!i)s.matches&&s.matches(c)&&I(s,n);else if(s.matches&&s.matches(c)&&I(s,n),s.querySelectorAll){const d=s.querySelectorAll(c);for(let u=0;u<d.length;u++)I(d[u],n)}}}}}}function te(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,x(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const l=t[o];if(l.type==="childList")try{xe(l)}catch(r){console.error("[ln-core] lifecycle handler failed",l.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ee(e){O().push(e),e.onSubtreeChange&&e.query&&T().push(e),te()}function ne(e,t,o,l,r={}){const s=r.extraAttributes||[],i=r.onAttributeChange||null,a=r.onSubtreeChange||null,n=r.onInit||null,c=r.onAttrChange||null,d=r.effects||null,u=r.attributes||null,h=u?ge(u):d,v=u?new Set(Object.keys(u)):null,F=r.persist||null;function g(b){const p=b||document.body;if(Y(p,e,t,o),u&&M())for(const _ in u){const Be=u[_],N=Array.from(p.querySelectorAll("["+_+"]"));p.matches&&p.matches("["+_+"]")&&N.push(p);for(let q=0;q<N.length;q++){const $=N[q];E($)&&G(Be,$.getAttribute(_),_,l,$)}}n&&n(p)}const C=[];if(e.indexOf("[")!==-1){const b=/\[([\w-]+)/g;let p;for(;(p=b.exec(e))!==null;)C.push(p[1])}else C.push(e);ve({selector:e,attribute:t,componentTag:l,attributes:u,ComponentFn:o,onInit:n,observed:C.concat(s),onAttributeChange:i,onAttrChange:c,effects:h,declared:v,persist:F}),Ae();const w=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,f=r.subtreeQuery||(w?e:"["+e+"]"),R={selector:e,attribute:t,ComponentFn:o,onInit:n,onSubtreeChange:a,query:f};O().push(R),a&&f&&T().push(R),te(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ne,window.lnCore.observeLifecycle=Ee);function m(){me()>0?ye(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m):m(),g}function oe(e){return(e||"").replace(/^#/,"")}function D(e){const t=e===void 0?location.hash:e,o={},l=oe(t);if(!l)return o;const r=l.split("&");for(let s=0;s<r.length;s++){const i=r[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{o[n]=decodeURIComponent(c)}catch{o[n]=c}}return o}function Se(e){if(!e)return null;const t=D();return e in t?t[e]:null}function ke(e,t){if(!e)return;const o=D();t==null?delete o[e]:o[e]=String(t);const r=Object.keys(o).map(function(s){const i=o[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");oe(location.hash)!==r&&(location.hash=r)}function Le(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 o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const l=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return l?t?l+"-"+t:l:t||null}function Te(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ie(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 De(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Fe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),l=e.slice(t+1),r=l?l.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=D,window.lnCore.hashGet=Se,window.lnCore.hashSet=ke,window.lnCore.hashLinkClick=Le,window.lnCore.resolveHashNamespace=Oe,window.lnCore.hashSortEncode=Te,window.lnCore.hashSortDecode=Ie,window.lnCore.hashFilterEncode=De,window.lnCore.hashFilterDecode=Fe);function Re(){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=Re);const Ne="ln-autosave:",qe=1e3;function $e(e,t){return t?Ne+(e||"")+":"+t:null}function Me(e,t=qe){if(e==null)return 0;if(e==="")return t;const o=parseInt(String(e),10);return isNaN(o)||o<0?t:o}(function(){const e="data-ln-autosave",t="lnAutosave",o="data-ln-autosave-clear",l="data-ln-autosave-debounce-input",r='[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=$e(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 v(){const w=B(n,{exclude:r});try{localStorage.setItem(u,JSON.stringify(w))}catch{return}A(n,"ln-autosave:saved",{target:n,data:w})}function F(){let w;try{w=localStorage.getItem(u)}catch{return}if(!w)return;let f;try{f=JSON.parse(w)}catch{return}if(re(n,"ln-autosave:before-restore",{target:n,data:f}).defaultPrevented)return;const m=j(n,f);for(let b=0;b<m.length;b++)m[b].dispatchEvent(new Event("input",{bubbles:!0})),m[b].dispatchEvent(new Event("change",{bubbles:!0}));A(n,"ln-autosave:restored",{target:n,data:f})}function g(){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(r)&&v()},this._onChange=function(w){const f=w.target;i(f)&&f.name&&!f.matches(r)&&v()},this._onSubmit=function(){g()},this._onReset=function(){g()},this._onClearClick=function(w){w.target.closest("["+o+"]")&&g()},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=Me(n.getAttribute(l));return C>0&&(this._onInput=function(w){const f=w.target;!i(f)||!f.name||f.matches(r)||(h!==null&&clearTimeout(h),h=setTimeout(v,C))},n.addEventListener("input",this._onInput)),this._getInputTimer=function(){return h},F(),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]}},ne(e,t,a,"ln-autosave",{attributes:s})})()})();
|