@livenetworks/ashlar 2.1.6 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(){"use strict";function U(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function q(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!q(o))return}e.apply(console,t)}}function b(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 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 ae(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function se(e,t){const r=!!(t&&t.typed),o=t&&t.exclude,l={},c=e.elements,a={};if(r)for(let d=0;d<c.length;d++){const i=c[d];i.name&&i.type==="checkbox"&&!i.disabled&&(a[i.name]=(a[i.name]||0)+1)}for(let d=0;d<c.length;d++){const i=c[d];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(o&&i.matches&&i.matches(o)))if(i.type==="checkbox")r&&a[i.name]===1?l[i.name]=i.checked:(l[i.name]||(l[i.name]=[]),i.checked&&l[i.name].push(i.value));else if(i.type==="radio")i.checked&&(l[i.name]=i.value);else if(i.type==="select-multiple"){l[i.name]=[];for(let n=0;n<i.options.length;n++)i.options[n].selected&&l[i.name].push(i.options[n].value)}else if(r&&i.type==="hidden")l[i.name]=i.value;else if(r&&(i.type==="number"||i.type==="range")){const n=Number(i.value);l[i.name]=i.value===""||isNaN(n)?null:n}else l[i.name]=i.value}return l}function ce(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function de(e,t){const r=e.elements,o=[],l={};for(let c=0;c<r.length;c++){const a=r[c];a.name&&a.type==="checkbox"&&(l[a.name]=(l[a.name]||0)+1)}for(let c=0;c<r.length;c++){const a=r[c];if(a.type==="file"||a.type==="submit"||a.type==="button")continue;const d=a.getAttribute("data-ln-fill-as")||a.name;if(!d||!(d in t))continue;const i=t[d];if(a.type==="checkbox"){if(Array.isArray(i))a.checked=i.indexOf(a.value)!==-1;else if(l[a.name]>1){const n=String(i).split(",").map(function(f){return f.trim()});a.checked=n.indexOf(a.value)!==-1}else a.checked=ce(i);o.push(a)}else if(a.type==="radio")a.checked=a.value===String(i),o.push(a);else if(a.type==="select-multiple"){if(Array.isArray(i))for(let n=0;n<a.options.length;n++)a.options[n].selected=i.indexOf(a.options[n].value)!==-1;o.push(a)}else a.value=i,a.tagName==="SELECT"&&i!=null&&a.setAttribute("data-ln-value",i),o.push(a)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=de,window.lnCore.serializeForm=se,window.lnCore.resolveFormMethod=ae);function ue(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(r){return console.error(`[${t}] Invalid headers JSON:`,r),{}}}const M={};function fe(e,t){M[e]=t}function he(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=fe,window.lnCore.getDataMapper=he);function pe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,x(function(){new MutationObserver(function(){b(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const B={};function we(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];B[r]=t}function me(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return B[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=we,window.lnCore.getLocaleFallback=me,window.lnCore.ensureLocaleObserver=pe);const L={};function be(e,t){L[e]||(L[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=L[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function H(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let a=0;a<r.length;a++){const d=r[a],i=d.getAttribute("data-ln-field");t[i]!=null&&(d.textContent=t[i])}const o=e.querySelectorAll("[data-ln-attr]");for(let a=0;a<o.length;a++){const d=o[a],i=d.getAttribute("data-ln-attr").split(",");for(let n=0;n<i.length;n++){const f=i[n].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),u=f[1].trim();t[u]!=null&&d.setAttribute(s,t[u])}}const l=e.querySelectorAll("[data-ln-show]");for(let a=0;a<l.length;a++){const d=l[a],i=d.getAttribute("data-ln-show");i in t&&d.classList.toggle("hidden",!t[i])}const c=e.querySelectorAll("[data-ln-class]");for(let a=0;a<c.length;a++){const d=c[a],i=d.getAttribute("data-ln-class").split(",");for(let n=0;n<i.length;n++){const f=i[n].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),u=f[1].trim();u in t&&d.classList.toggle(s,!!t[u])}}return e}function ge(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)H(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 c=r.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(a,d){return t[d]!==void 0?t[d]:""}))}const o=function(c,a){return t[a]!==void 0?t[a]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let c=0;c<l.length;c++){const a=l[c],d=a.attributes;for(let i=0;i<d.length;i++){const n=d[i];n.value.indexOf("{{")!==-1&&a.setAttribute(n.name,n.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function ye(e,t,r,o,l,c){const a={};for(let i=0;i<e.children.length;i++){const n=e.children[i],f=n.getAttribute("data-ln-render-key");f&&(a[f]=n)}const d=document.createDocumentFragment();for(let i=0;i<t.length;i++){const n=t[i],f=String(o(n));let s=a[f];if(s)l(s,n,i);else{const u=be(r,c);if(!u||(W(u,n),s=u.firstElementChild,!s))continue;s.setAttribute("data-ln-render-key",f),l(s,n,i)}d.appendChild(s)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=H,window.lnCore.lnFill=ge,window.lnCore.renderList=ye);function C(e,t,r){const o=e.getAttribute(t);return o===null?r:o}function Q(e,t,r){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?r:o}function J(e,t,r=!1){const o=e.getAttribute(t);if(o===null)return!!r;const l=o.trim().toLowerCase();return!(l==="false"||l==="0")}function K(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const O=new Map;function V(e,t){const r=(e?e.join("|"):"")+"::"+t;if(O.has(r))return O.get(r);const o=new Set(e||[]),l=function(c,a){const d=c.getAttribute(a);return d!==null&&o.has(d)?d:t};return O.set(r,l),l}function G(e,t,r){const o=parseFloat(e.getAttribute(t));return isNaN(o)?r:o}function z(e,t,r){const o=e.getAttribute(t);if(!o)return r;try{return JSON.parse(o)}catch{return r}}function X(e,t,r,o,l){if(!e||t===null)return!0;const c=o||"ln-component",a=e.type;if(a==="trigger"||a==="marker"||a==="string"||a==="list"||!a||t===""&&e.fallback!==void 0)return!0;const d=i=>{l?console.warn(i,l):console.warn(i)};if(a==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(d(`[${c}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(a==="enum"){const i=e.values||[];return i.includes(t)?!0:(d(`[${c}] Invalid value "${t}" for attribute "${r}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(a==="integer"){if(!/^-?\d+$/.test(t))return d(`[${c}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(d(`[${c}] Value ${i} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(d(`[${c}] Value ${i} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(a==="float")return isNaN(Number(t))?(d(`[${c}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(a==="json")try{return JSON.parse(t),!0}catch(i){return d(`[${c}] Invalid JSON for attribute "${r}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function Y(e,t,r){for(const o in r){const[l,c,a]=r[o];Object.defineProperty(e,o,{get:function(){return l(t,c,a)},enumerable:!0,configurable:!0})}return e}function Z(e){const t={};for(const r in e){const o=e[r];if(!o||!o.prop)continue;let l=o.read;if(!l&&o.type)switch(o.type){case"enum":l=V(o.values,o.fallback);break;case"integer":l=Q;break;case"float":l=G;break;case"boolean":l=J;break;case"list":l=K;break;case"json":l=z;break;case"string":default:l=C;break}l||(l=C),t[o.prop]=[l,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 _e(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=Y,window.lnCore.attrSpec=Z,window.lnCore.attrStr=C,window.lnCore.attrInt=Q,window.lnCore.attrBool=J,window.lnCore.attrList=K,window.lnCore.attrEnum=V,window.lnCore.attrFloat=G,window.lnCore.attrJson=z);function v(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 P(e,t,r,o){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",a={selector:t,attribute:r,ComponentFn:o};if(e.matches&&e.matches(c)&&v(e,a),e.querySelectorAll){const d=e.querySelectorAll(c);for(let i=0;i<d.length;i++)v(d[i],a)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ae(){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 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 ke(e){const t=ee(),r=e.observed||[];for(let o=0;o<r.length;o++){const l=r[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(c=>c.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=_e(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function te(e,t,r,o){for(let l=0;l<e.length;l++){const c=e[l];if(!t[c.attribute])continue;const a=c.effects&&c.effects[r];a?a(t,r,o):c.onAttrChange&&(!c.declared||c.declared.has(r))&&c.onAttrChange(t,r,o)}}function Ee(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,o=ee(),l=o.byAttr.get(t),c=U()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!r&&!l&&!c)return;const a=e.target;if(e.oldValue!==a.getAttribute(t)){if(c&&q(a)){const d=o.byDeclaredAttr.get(t),i=a.getAttribute(t);for(let n=0;n<d.length;n++)X(d[n].spec,i,t,d[n].componentTag,a)}if(window.lnCore._debugSink&&(r||l)&&window.lnCore._debugSink("attr",t,a,{oldValue:e.oldValue,newValue:a.getAttribute(t)}),r){const d=o.byReactive.get(t);d&&te(d,a,t,e.oldValue),o.reactiveWildcard.length&&te(o.reactiveWildcard,a,t,e.oldValue)}if(l)for(let d=0;d<l.length;d++){const i=l[d];if(i.handler){i.handler(a,t,e.oldValue);continue}i.onAttributeChange&&a[i.attribute]?i.onAttributeChange(a,t):(P(a,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(a))}}}function xe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,x(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Ee(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 T(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function D(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function I(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 ne(e){const t=T();if(!t.length)return;const r=e.target;if(r){const l=r.nodeType===1?r:r.parentElement;if(l&&(l.isContentEditable||l.closest&&l.closest('[contenteditable]:not([contenteditable="false"])')))return}const o=D();if(e.target&&o.length)for(let l=0;l<o.length;l++){const c=o[l],a=c.query,d=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;d&&c.onSubtreeChange(d,e)}for(let l=0;l<e.addedNodes.length;l++){const c=e.addedNodes[l];if(c.nodeType===1){const a=!!(c.firstElementChild||c.children&&c.children.length);for(let d=0;d<t.length;d++){const i=t[d];if(i.selector&&i.attribute&&i.ComponentFn){if(!a)c.matches&&c.matches(i.query)&&v(c,i);else if(c.matches&&c.matches(i.query)&&v(c,i),c.querySelectorAll){const n=c.querySelectorAll(i.query);for(let f=0;f<n.length;f++)v(n[f],i)}}i.onInit&&i.onInit(c)}}}for(let l=0;l<e.removedNodes.length;l++){const c=e.removedNodes[l];if(c.nodeType===1){if(document.contains(c))continue;const a=!!(c.firstElementChild||c.children&&c.children.length);for(let d=0;d<t.length;d++){const i=t[d],n=i.query;if(n){if(!a)c.matches&&c.matches(n)&&I(c,i);else if(c.matches&&c.matches(n)&&I(c,i),c.querySelectorAll){const f=c.querySelectorAll(n);for(let s=0;s<f.length;s++)I(f[s],i)}}}}}}function re(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,x(function(){const e=new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{ne(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Se(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const r=t.takeRecords();for(let o=0;o<r.length;o++){const l=r[o];if(l.type==="childList")try{ne(l)}catch(c){console.error("[ln-core] lifecycle handler failed",l.target,c)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function qe(e){T().push(e),e.onSubtreeChange&&e.query&&D().push(e),re()}function oe(e,t,r,o,l={}){const c=l.extraAttributes||[],a=l.onAttributeChange||null,d=l.onSubtreeChange||null,i=l.onInit||null,n=l.onAttrChange||null,f=l.effects||null,s=l.attributes||null,u=s?Ce(s):f,h=s?new Set(Object.keys(s)):null,p=l.persist||null;function w(g){const m=g||document.body;if(P(m,e,t,r),s&&U())for(const E in s){const Be=s[E],R=Array.from(m.querySelectorAll("["+E+"]"));m.matches&&m.matches("["+E+"]")&&R.push(m);for(let $=0;$<R.length;$++){const N=R[$];q(N)&&X(Be,N.getAttribute(E),E,o,N)}}i&&i(m)}const y=[];if(e.indexOf("[")!==-1){const g=/\[([\w-]+)/g;let m;for(;(m=g.exec(e))!==null;)y.push(m[1])}else y.push(e);ke({selector:e,attribute:t,componentTag:o,attributes:s,ComponentFn:r,onInit:i,observed:y.concat(c),onAttributeChange:a,onAttrChange:n,effects:u,declared:h,persist:p}),xe();const j=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,k=l.subtreeQuery||(j?e:"["+e+"]"),A={selector:e,attribute:t,ComponentFn:r,onInit:i,onSubtreeChange:d,query:k};T().push(A),d&&k&&D().push(A),re(),window[t]=w,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=oe,window.lnCore.observeLifecycle=qe,window.lnCore.withoutLifecycle=Se);function S(){Ae()>0?ve(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",S):S(),w}function ie(e){return(e||"").replace(/^#/,"")}function F(e){const t=e===void 0?location.hash:e,r={},o=ie(t);if(!o)return r;const l=o.split("&");for(let c=0;c<l.length;c++){const a=l[c];if(!a)continue;const d=a.indexOf(":"),i=d>-1?a.slice(0,d):a,n=d>-1?a.slice(d+1):"";if(i)try{r[i]=decodeURIComponent(n)}catch{r[i]=n}}return r}function Le(e){if(!e)return null;const t=F();return e in t?t[e]:null}function Oe(e,t){if(!e)return;const r=F();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(c){const a=r[c];return a===""?c:c+":"+encodeURIComponent(a)}).join("&");ie(location.hash)!==l&&(location.hash=l)}function Te(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function De(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const 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 Ie(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Fe(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 je(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Re(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=F,window.lnCore.hashGet=Le,window.lnCore.hashSet=Oe,window.lnCore.hashLinkClick=Te,window.lnCore.resolveHashNamespace=De,window.lnCore.hashSortEncode=Ie,window.lnCore.hashSortDecode=Fe,window.lnCore.hashFilterEncode=je,window.lnCore.hashFilterDecode=Re);function $e(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=$e);const Ne={offset:"offset",limit:"limit",search:"search",sortField:"sort_field",sortDir:"sort_dir"};function _(...e){return e.filter(t=>t!=null&&t!=="").map((t,r)=>{const o=String(t);return r===0?o.replace(/\/+$/,""):o.replace(/^\/+/,"").replace(/\/+$/,"")}).filter(Boolean).join("/")}function Ue(e,t){if(!e||typeof e!="object")return"";const r=Object.assign({},Ne);if(t&&typeof t=="object")for(const l in t)t[l]!==void 0&&t[l]!==null&&t[l]!==""&&(r[l]=t[l]);const o=new URLSearchParams;return e.search&&o.append(r.search,e.search),e.offset!=null&&o.append(r.offset,e.offset),e.limit!=null&&o.append(r.limit,e.limit),e.sort&&e.sort.field&&e.sort.direction&&(o.append(r.sortField,e.sort.field),o.append(r.sortDir,e.sort.direction)),e.filters&&typeof e.filters=="object"&&Object.keys(e.filters).forEach(l=>{const c=e.filters[l];Array.isArray(c)&&c.length>0&&o.append(l,c.join(","))}),o.toString()}function Me(e,t,r){let o=_(e,t);return r&&(o+=(o.indexOf("?")!==-1?"&":"?")+r),o}function le(e){const t=e&&e.content!==void 0?e.content:e,r=e&&e.message?e.message:null;return{record:t,message:r}}(function(){const e="data-ln-api-connector",t="lnApiConnector",r="lnConnector";if(window[t]!==void 0)return;function o(n){const f=n[t];f&&f.refreshConfig()}const l={"data-ln-api-connector":{type:"marker",description:"Mounts API connector bridging REST backend and ln-ashlar data coordinators"},"data-ln-api-base-url":{prop:"baseUrl",read:C,type:"string",fallback:"",effect:o,description:"Base URL endpoint for API requests"},"data-ln-api-path":{prop:"path",read:function(n){return n.getAttribute("data-ln-api-path")||n.getAttribute("data-ln-api-endpoint")||""},type:"string",fallback:"",effect:o,description:"Resource path appended to base URL"},"data-ln-api-endpoint":{read:function(n){return n.getAttribute("data-ln-api-path")||n.getAttribute("data-ln-api-endpoint")||""},type:"string",fallback:"",effect:o,description:"Alias for data-ln-api-path"},"data-ln-api-headers":{prop:"rawHeaders",read:C,type:"json",fallback:null,effect:o,description:"Custom HTTP headers in JSON format or semicolon-separated pairs"},"data-ln-api-param-offset":{effect:o,type:"string",fallback:"offset",description:"Query parameter name for pagination offset"},"data-ln-api-param-limit":{effect:o,type:"string",fallback:"limit",description:"Query parameter name for pagination page size"},"data-ln-api-param-search":{effect:o,type:"string",fallback:"search",description:"Query parameter name for text search filter"},"data-ln-api-param-sort-field":{effect:o,type:"string",fallback:"sort_by",description:"Query parameter name for sort field"},"data-ln-api-param-sort-dir":{effect:o,type:"string",fallback:"sort_dir",description:"Query parameter name for sort direction"},"data-ln-api-connector-query-debounce":{effect:o,type:"integer",fallback:200,min:0,description:"Debounce delay in milliseconds before dispatching query requests"}},c=Z(l);function a(n){return n.ok?n.status===204?null:n.json():n.json().catch(()=>null).then(f=>{const s=new Error("HTTP "+n.status+": "+n.statusText);throw s.status=n.status,s.data=f,s})}function d(n){return this.dom=n,Y(this,n,c),n[t]=this,n[r]=this,this.namespace="ln-api-connector",this._inflight=new Map,this._queryTimers=new Map,this.refreshConfig(),this._handlers=null,i(this),this}d.prototype.refreshConfig=function(){const n=this.dom;this.credentials="same-origin",this.headers=ue(this.rawHeaders);const f={},s=n.getAttribute("data-ln-api-param-offset");s&&(f.offset=s);const u=n.getAttribute("data-ln-api-param-limit");u&&(f.limit=u);const h=n.getAttribute("data-ln-api-param-search");h&&(f.search=h);const p=n.getAttribute("data-ln-api-param-sort-field");p&&(f.sortField=p);const w=n.getAttribute("data-ln-api-param-sort-dir");w&&(f.sortDir=w),this.paramKeys=f;const y=n.getAttribute("data-ln-api-connector-query-debounce");this.queryDebounce=y!==null?+y:300,b(this.dom,"ln-api-connector:config-changed",{baseUrl:this.baseUrl,path:this.path,headers:this.headers,paramKeys:this.paramKeys})},d.prototype._reqHeaders=function(n){const f=Object.assign({},this.headers);return!f.Accept&&!f.accept&&(f.Accept="application/json"),!f["Content-Type"]&&!f["content-type"]&&(f["Content-Type"]="application/json"),n&&(f["X-Idempotency-Key"]=n),f},d.prototype.cancel=function(n){return n&&this._inflight.has(n)?(this._inflight.get(n).abort(),this._inflight.delete(n),!0):!1},d.prototype.fetchDelta=function(n,f){const s=this;let u=_(s.baseUrl,s.path);n!=null&&n!==""&&(u+=(u.indexOf("?")!==-1?"&":"?")+"since="+encodeURIComponent(n));const h=f||"sync";s._inflight.has(h)&&s._inflight.get(h).abort();const p=new AbortController;return s._inflight.set(h,p),window.fetch(u,{method:"GET",headers:s._reqHeaders(),credentials:s.credentials,signal:p.signal}).then(a).finally(function(){s._inflight.get(h)===p&&s._inflight.delete(h)})},d.prototype.query=function(n,f){const s=this,u=Ue(n,s.paramKeys),h=Me(s.baseUrl,s.path,u),p=f||"query";s._inflight.has(p)&&s._inflight.get(p).abort();const w=new AbortController;return s._inflight.set(p,w),window.fetch(h,{method:"GET",headers:s._reqHeaders(),credentials:s.credentials,signal:w.signal}).then(a).finally(function(){s._inflight.get(p)===w&&s._inflight.delete(p)})},d.prototype.create=function(n,f,s){const u=this;return window.fetch(_(u.baseUrl,f||u.path),{method:"POST",headers:u._reqHeaders(s),credentials:u.credentials,body:JSON.stringify(n)}).then(a)},d.prototype.update=function(n,f,s,u,h){const p=this;s!=null&&(f=Object.assign({},f,{expected_version:s}));const w=u?_(p.baseUrl,u):_(p.baseUrl,p.path,n);return window.fetch(w,{method:"PUT",headers:p._reqHeaders(h),credentials:p.credentials,body:JSON.stringify(f)}).then(a)},d.prototype.delete=function(n,f,s){const u=this;return window.fetch(_(u.baseUrl,f||u.path,n),{method:"DELETE",headers:u._reqHeaders(s),credentials:u.credentials}).then(a)},d.prototype.bulkDelete=function(n,f,s){const u=this;return window.fetch(_(u.baseUrl,f||u.path,"bulk-delete"),{method:"DELETE",headers:u._reqHeaders(s),credentials:u.credentials,body:JSON.stringify({ids:n})}).then(a)};function i(n){n._handlers={sync:function(f){const s=f.detail||{},u=s.meta&&s.meta.targetEl?s.meta.targetEl:null;n.fetchDelta(s.since,u).then(function(h){b(n.dom,"ln-api-connector:fetched",{data:h,since:s.since,meta:s.meta||null})}).catch(function(h){h&&h.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"sync",error:h.message,status:h.status||0,data:h.data||null,since:s.since,meta:s.meta||null})})},query:function(f){const s=f.detail||{},u=s.query||s,h=s.meta&&s.meta.targetEl?s.meta.targetEl:null,p=h||"query",w=n.queryDebounce;function y(k,A,S){n.query(A,S).then(function(g){const m=g||{};b(n.dom,"ln-api-connector:fetched",{data:m.data||(Array.isArray(m)?m:[]),total:m.total,filtered:m.filtered,offset:A.offset,queryGen:A.queryGen,meta:k.meta||null})}).catch(function(g){g&&g.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"query",error:g.message,status:g.status||0,data:g.data||null,meta:k.meta||null})})}if(w===0){y(s,u,h);return}n._queryTimers.has(p)&&clearTimeout(n._queryTimers.get(p));const j=setTimeout(function(){n._queryTimers.delete(p),y(s,u,h)},w);n._queryTimers.set(p,j)},cancel:function(f){const s=f.detail||{},u=s.meta&&s.meta.targetEl?s.meta.targetEl:s.targetEl||s.key;u&&n.cancel(u)},create:function(f){const s=f.detail||{};n.create(s.data,s.url,s.idempotencyKey).then(function(u){const h=le(u);b(n.dom,"ln-api-connector:created",{record:h.record,tempId:s.tempId,message:h.message,meta:s.meta||null})}).catch(function(u){u&&u.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"create",error:u.message,status:u.status||0,data:u.data||null,tempId:s.tempId,meta:s.meta||null})})},update:function(f){const s=f.detail||{};n.update(s.id,s.data,s.expected_version,s.url,s.idempotencyKey).then(function(u){const h=le(u);b(n.dom,"ln-api-connector:updated",{record:h.record,id:s.id,message:h.message,meta:s.meta||null})}).catch(function(u){u&&u.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"update",error:u.message,status:u.status||0,data:u.data||null,id:s.id,conflictData:u.status===409?u.data:null,meta:s.meta||null})})},delete:function(f){const s=f.detail||{};n.delete(s.id,s.url,s.idempotencyKey).then(function(u){const h=u&&u.message?u.message:null;b(n.dom,"ln-api-connector:deleted",{response:u,id:s.id,message:h,meta:s.meta||null})}).catch(function(u){u&&u.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"delete",error:u.message,status:u.status||0,data:u.data||null,id:s.id,meta:s.meta||null})})},bulkDelete:function(f){const s=f.detail||{};n.bulkDelete(s.ids,s.url,s.idempotencyKey).then(function(u){const h=u&&u.message?u.message:null;b(n.dom,"ln-api-connector:bulk-deleted",{response:u,ids:s.ids,message:h,meta:s.meta||null})}).catch(function(u){u&&u.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"bulk-delete",error:u.message,status:u.status||0,data:u.data||null,ids:s.ids,meta:s.meta||null})})}},n.dom.addEventListener("ln-api-connector:request-sync",n._handlers.sync),n.dom.addEventListener("ln-api-connector:request-query",n._handlers.query),n.dom.addEventListener("ln-api-connector:request-cancel",n._handlers.cancel),n.dom.addEventListener("ln-api-connector:request-create",n._handlers.create),n.dom.addEventListener("ln-api-connector:request-update",n._handlers.update),n.dom.addEventListener("ln-api-connector:request-delete",n._handlers.delete),n.dom.addEventListener("ln-api-connector:request-bulk-delete",n._handlers.bulkDelete)}d.prototype.destroy=function(){if(!this.dom[t])return;const n=this;n._inflight&&(n._inflight.forEach(function(f){f.abort()}),n._inflight.clear()),this._queryTimers&&(this._queryTimers.forEach(function(f){f&&clearTimeout(f)}),this._queryTimers.clear()),this._handlers&&(n.dom.removeEventListener("ln-api-connector:request-sync",n._handlers.sync),n.dom.removeEventListener("ln-api-connector:request-query",n._handlers.query),n.dom.removeEventListener("ln-api-connector:request-cancel",n._handlers.cancel),n.dom.removeEventListener("ln-api-connector:request-create",n._handlers.create),n.dom.removeEventListener("ln-api-connector:request-update",n._handlers.update),n.dom.removeEventListener("ln-api-connector:request-delete",n._handlers.delete),n.dom.removeEventListener("ln-api-connector:request-bulk-delete",n._handlers.bulkDelete),n._handlers=null),delete this.dom[t],delete this.dom[r]},oe(e,t,d,"ln-api-connector",{attributes:l})})()})();
1
+ (function(){"use strict";function U(){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 L(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){o=t[l];break}if(!L(o))return}e.apply(console,t)}}function g(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 S(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){S(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 se(e,t){const r=!!(t&&t.typed),o=t&&t.exclude,l={},s=e.elements,a={};if(r)for(let d=0;d<s.length;d++){const n=s[d];n.name&&n.type==="checkbox"&&!n.disabled&&(a[n.name]=(a[n.name]||0)+1)}for(let d=0;d<s.length;d++){const n=s[d];if(!(!n.name||n.disabled||n.type==="file"||n.type==="submit"||n.type==="button")&&!(o&&n.matches&&n.matches(o)))if(n.type==="checkbox")r&&a[n.name]===1?l[n.name]=n.checked:(l[n.name]||(l[n.name]=[]),n.checked&&l[n.name].push(n.value));else if(n.type==="radio")n.checked&&(l[n.name]=n.value);else if(n.type==="select-multiple"){l[n.name]=[];for(let h=0;h<n.options.length;h++)n.options[h].selected&&l[n.name].push(n.options[h].value)}else if(r&&n.type==="hidden")l[n.name]=n.value;else if(r&&(n.type==="number"||n.type==="range")){const h=Number(n.value);l[n.name]=n.value===""||isNaN(h)?null:h}else l[n.name]=n.value}return l}function ce(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function de(e,t){const r=e.elements,o=[],l={};for(let s=0;s<r.length;s++){const a=r[s];a.name&&a.type==="checkbox"&&(l[a.name]=(l[a.name]||0)+1)}for(let s=0;s<r.length;s++){const a=r[s];if(a.type==="file"||a.type==="submit"||a.type==="button")continue;const d=a.getAttribute("data-ln-fill-as")||a.name;if(!d||!(d in t))continue;const n=t[d];if(a.type==="checkbox"){if(Array.isArray(n))a.checked=n.indexOf(a.value)!==-1;else if(l[a.name]>1){const h=String(n).split(",").map(function(i){return i.trim()});a.checked=h.indexOf(a.value)!==-1}else a.checked=ce(n);o.push(a)}else if(a.type==="radio")a.checked=a.value===String(n),o.push(a);else if(a.type==="select-multiple"){if(Array.isArray(n))for(let h=0;h<a.options.length;h++)a.options[h].selected=n.indexOf(a.options[h].value)!==-1;o.push(a)}else a.value=n,a.tagName==="SELECT"&&n!=null&&a.setAttribute("data-ln-value",n),o.push(a)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=de,window.lnCore.serializeForm=se,window.lnCore.resolveFormMethod=ae);function ue(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(r){return console.error(`[${t}] Invalid headers JSON:`,r),{}}}const M={};function fe(e,t){M[e]=t}function he(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=fe,window.lnCore.getDataMapper=he);function pe(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,S(function(){new MutationObserver(function(){g(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const B={};function we(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];B[r]=t}function me(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return B[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=we,window.lnCore.getLocaleFallback=me,window.lnCore.ensureLocaleObserver=pe);const O={};function be(e,t){O[e]||(O[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=O[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function H(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let a=0;a<r.length;a++){const d=r[a],n=d.getAttribute("data-ln-field");t[n]!=null&&(d.textContent=t[n])}const o=e.querySelectorAll("[data-ln-attr]");for(let a=0;a<o.length;a++){const d=o[a],n=d.getAttribute("data-ln-attr").split(",");for(let h=0;h<n.length;h++){const i=n[h].trim().split(":");if(i.length!==2)continue;const u=i[0].trim(),c=i[1].trim();t[c]!=null&&d.setAttribute(u,t[c])}}const l=e.querySelectorAll("[data-ln-show]");for(let a=0;a<l.length;a++){const d=l[a],n=d.getAttribute("data-ln-show");n in t&&d.classList.toggle("hidden",!t[n])}const s=e.querySelectorAll("[data-ln-class]");for(let a=0;a<s.length;a++){const d=s[a],n=d.getAttribute("data-ln-class").split(",");for(let h=0;h<n.length;h++){const i=n[h].trim().split(":");if(i.length!==2)continue;const u=i[0].trim(),c=i[1].trim();c in t&&d.classList.toggle(u,!!t[c])}}return e}function ge(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)H(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function W(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const s=r.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(a,d){return t[d]!==void 0?t[d]:""}))}const o=function(s,a){return t[a]!==void 0?t[a]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const a=l[s],d=a.attributes;for(let n=0;n<d.length;n++){const h=d[n];h.value.indexOf("{{")!==-1&&a.setAttribute(h.name,h.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function ye(e,t,r,o,l,s){const a={};for(let n=0;n<e.children.length;n++){const h=e.children[n],i=h.getAttribute("data-ln-render-key");i&&(a[i]=h)}const d=document.createDocumentFragment();for(let n=0;n<t.length;n++){const h=t[n],i=String(o(h));let u=a[i];if(u)l(u,h,n);else{const c=be(r,s);if(!c||(W(c,h),u=c.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",i),l(u,h,n)}d.appendChild(u)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=W,window.lnCore.fill=H,window.lnCore.lnFill=ge,window.lnCore.renderList=ye);function v(e,t,r){const o=e.getAttribute(t);return o===null?r:o}function Q(e,t,r){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?r:o}function J(e,t,r=!1){const o=e.getAttribute(t);if(o===null)return!!r;const l=o.trim().toLowerCase();return!(l==="false"||l==="0")}function K(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const T=new Map;function V(e,t){const r=(e?e.join("|"):"")+"::"+t;if(T.has(r))return T.get(r);const o=new Set(e||[]),l=function(s,a){const d=s.getAttribute(a);return d!==null&&o.has(d)?d:t};return T.set(r,l),l}function G(e,t,r){const o=parseFloat(e.getAttribute(t));return isNaN(o)?r:o}function z(e,t,r){const o=e.getAttribute(t);if(!o)return r;try{return JSON.parse(o)}catch{return r}}function X(e,t,r,o,l){if(!e||t===null)return!0;const s=o||"ln-component",a=e.type;if(a==="trigger"||a==="marker"||a==="string"||a==="list"||!a||t===""&&e.fallback!==void 0)return!0;const d=n=>{l?console.warn(n,l):console.warn(n)};if(a==="boolean"){const n=t.trim().toLowerCase();return n!==""&&n!=="true"&&n!=="false"&&n!=="1"&&n!=="0"?(d(`[${s}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(a==="enum"){const n=e.values||[];return n.includes(t)?!0:(d(`[${s}] Invalid value "${t}" for attribute "${r}". Allowed: ${n.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(a==="integer"){if(!/^-?\d+$/.test(t))return d(`[${s}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const n=parseInt(t,10);return e.min!==void 0&&n<e.min?(d(`[${s}] Value ${n} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&n>e.max?(d(`[${s}] Value ${n} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(a==="float")return isNaN(Number(t))?(d(`[${s}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(a==="json")try{return JSON.parse(t),!0}catch(n){return d(`[${s}] Invalid JSON for attribute "${r}": ${n.message}. Fallback: ${e.fallback}.`),!1}return!0}function Y(e,t,r){for(const o in r){const[l,s,a]=r[o];Object.defineProperty(e,o,{get:function(){return l(t,s,a)},enumerable:!0,configurable:!0})}return e}function Z(e){const t={};for(const r in e){const o=e[r];if(!o||!o.prop)continue;let l=o.read;if(!l&&o.type)switch(o.type){case"enum":l=V(o.values,o.fallback);break;case"integer":l=Q;break;case"float":l=G;break;case"boolean":l=J;break;case"list":l=K;break;case"json":l=z;break;case"string":default:l=v;break}l||(l=v),t[o.prop]=[l,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 _e(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=Y,window.lnCore.attrSpec=Z,window.lnCore.attrStr=v,window.lnCore.attrInt=Q,window.lnCore.attrBool=J,window.lnCore.attrList=K,window.lnCore.attrEnum=V,window.lnCore.attrFloat=G,window.lnCore.attrJson=z);function k(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 P(e,t,r,o){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",a={selector:t,attribute:r,ComponentFn:o};if(e.matches&&e.matches(s)&&k(e,a),e.querySelectorAll){const d=e.querySelectorAll(s);for(let n=0;n<d.length;n++)k(d[n],a)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function Ae(){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 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 ke(e){const t=ee(),r=e.observed||[];for(let o=0;o<r.length;o++){const l=r[o];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const l=t.byDeclaredAttr.get(o);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=_e(e);if(o===null)t.reactiveWildcard.push(e);else for(const l of o)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function te(e,t,r,o){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const a=s.effects&&s.effects[r];a?a(t,r,o):s.onAttrChange&&(!s.declared||s.declared.has(r))&&s.onAttrChange(t,r,o)}}function Ee(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,o=ee(),l=o.byAttr.get(t),s=U()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(t);if(!r&&!l&&!s)return;const a=e.target;if(e.oldValue!==a.getAttribute(t)){if(s&&L(a)){const d=o.byDeclaredAttr.get(t),n=a.getAttribute(t);for(let h=0;h<d.length;h++)X(d[h].spec,n,t,d[h].componentTag,a)}if(window.lnCore._debugSink&&(r||l)&&window.lnCore._debugSink("attr",t,a,{oldValue:e.oldValue,newValue:a.getAttribute(t)}),r){const d=o.byReactive.get(t);d&&te(d,a,t,e.oldValue),o.reactiveWildcard.length&&te(o.reactiveWildcard,a,t,e.oldValue)}if(l)for(let d=0;d<l.length;d++){const n=l[d];if(n.handler){n.handler(a,t,e.oldValue);continue}n.onAttributeChange&&a[n.attribute]?n.onAttributeChange(a,t):(P(a,n.selector,n.attribute,n.ComponentFn),n.onInit&&n.onInit(a))}}}function xe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,S(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Ee(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 D(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function I(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function F(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 ne(e){const t=D();if(!t.length)return;const r=e.target;if(r){const l=r.nodeType===1?r:r.parentElement;if(l&&(l.isContentEditable||l.closest&&l.closest('[contenteditable]:not([contenteditable="false"])')))return}const o=I();if(e.target&&o.length)for(let l=0;l<o.length;l++){const s=o[l],a=s.query,d=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;d&&s.onSubtreeChange(d,e)}for(let l=0;l<e.addedNodes.length;l++){const s=e.addedNodes[l];if(s.nodeType===1){const a=!!(s.firstElementChild||s.children&&s.children.length);for(let d=0;d<t.length;d++){const n=t[d];if(n.selector&&n.attribute&&n.ComponentFn){if(!a)s.matches&&s.matches(n.query)&&k(s,n);else if(s.matches&&s.matches(n.query)&&k(s,n),s.querySelectorAll){const h=s.querySelectorAll(n.query);for(let i=0;i<h.length;i++)k(h[i],n)}}n.onInit&&n.onInit(s)}}}for(let l=0;l<e.removedNodes.length;l++){const s=e.removedNodes[l];if(s.nodeType===1){if(document.contains(s))continue;const a=!!(s.firstElementChild||s.children&&s.children.length);for(let d=0;d<t.length;d++){const n=t[d],h=n.query;if(h){if(!a)s.matches&&s.matches(h)&&F(s,n);else if(s.matches&&s.matches(h)&&F(s,n),s.querySelectorAll){const i=s.querySelectorAll(h);for(let u=0;u<i.length;u++)F(i[u],n)}}}}}}function re(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,S(function(){const e=new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{ne(o)}catch(l){console.error("[ln-core] lifecycle handler failed",o.target,l)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Se(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const r=t.takeRecords();for(let o=0;o<r.length;o++){const l=r[o];if(l.type==="childList")try{ne(l)}catch(s){console.error("[ln-core] lifecycle handler failed",l.target,s)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function qe(e){D().push(e),e.onSubtreeChange&&e.query&&I().push(e),re()}function oe(e,t,r,o,l={}){const s=l.extraAttributes||[],a=l.onAttributeChange||null,d=l.onSubtreeChange||null,n=l.onInit||null,h=l.onAttrChange||null,i=l.effects||null,u=l.attributes||null,c=u?Ce(u):i,f=u?new Set(Object.keys(u)):null,p=l.persist||null;function w(x){const m=x||document.body;if(P(m,e,t,r),u&&U())for(const y in u){const Be=u[y],R=Array.from(m.querySelectorAll("["+y+"]"));m.matches&&m.matches("["+y+"]")&&R.push(m);for(let $=0;$<R.length;$++){const N=R[$];L(N)&&X(Be,N.getAttribute(y),y,o,N)}}n&&n(m)}const b=[];if(e.indexOf("[")!==-1){const x=/\[([\w-]+)/g;let m;for(;(m=x.exec(e))!==null;)b.push(m[1])}else b.push(e);ke({selector:e,attribute:t,componentTag:o,attributes:u,ComponentFn:r,onInit:n,observed:b.concat(s),onAttributeChange:a,onAttrChange:h,effects:c,declared:f,persist:p}),xe();const _=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,q=l.subtreeQuery||(_?e:"["+e+"]"),E={selector:e,attribute:t,ComponentFn:r,onInit:n,onSubtreeChange:d,query:q};D().push(E),d&&q&&I().push(E),re(),window[t]=w,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=oe,window.lnCore.observeLifecycle=qe,window.lnCore.withoutLifecycle=Se);function A(){Ae()>0?ve(function(){w(document.body)}):w(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A):A(),w}function ie(e){return(e||"").replace(/^#/,"")}function j(e){const t=e===void 0?location.hash:e,r={},o=ie(t);if(!o)return r;const l=o.split("&");for(let s=0;s<l.length;s++){const a=l[s];if(!a)continue;const d=a.indexOf(":"),n=d>-1?a.slice(0,d):a,h=d>-1?a.slice(d+1):"";if(n)try{r[n]=decodeURIComponent(h)}catch{r[n]=h}}return r}function Le(e){if(!e)return null;const t=j();return e in t?t[e]:null}function Oe(e,t){if(!e)return;const r=j();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(s){const a=r[s];return a===""?s:s+":"+encodeURIComponent(a)}).join("&");ie(location.hash)!==l&&(location.hash=l)}function Te(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function De(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const 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 Ie(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Fe(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 je(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Re(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),o=e.slice(t+1),l=o?o.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=j,window.lnCore.hashGet=Le,window.lnCore.hashSet=Oe,window.lnCore.hashLinkClick=Te,window.lnCore.resolveHashNamespace=De,window.lnCore.hashSortEncode=Ie,window.lnCore.hashSortDecode=Fe,window.lnCore.hashFilterEncode=je,window.lnCore.hashFilterDecode=Re);function $e(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=$e);const Ne={offset:"offset",limit:"limit",search:"search",sortField:"sort_field",sortDir:"sort_dir"};function C(...e){return e.filter(t=>t!=null&&t!=="").map((t,r)=>{const o=String(t);return r===0?o.replace(/\/+$/,""):o.replace(/^\/+/,"").replace(/\/+$/,"")}).filter(Boolean).join("/")}function Ue(e,t){if(!e||typeof e!="object")return"";const r=Object.assign({},Ne);if(t&&typeof t=="object")for(const l in t)t[l]!==void 0&&t[l]!==null&&t[l]!==""&&(r[l]=t[l]);const o=new URLSearchParams;return e.search&&o.append(r.search,e.search),e.offset!=null&&o.append(r.offset,e.offset),e.limit!=null&&o.append(r.limit,e.limit),e.sort&&e.sort.field&&e.sort.direction&&(o.append(r.sortField,e.sort.field),o.append(r.sortDir,e.sort.direction)),e.filters&&typeof e.filters=="object"&&Object.keys(e.filters).forEach(l=>{const s=e.filters[l];Array.isArray(s)&&s.length>0&&o.append(l,s.join(","))}),o.toString()}function Me(e,t,r){let o=C(e,t);return r&&(o+=(o.indexOf("?")!==-1?"&":"?")+r),o}function le(e){const t=e&&e.content!==void 0?e.content:e,r=e&&e.message?e.message:null;return{record:t,message:r}}(function(){const e="data-ln-api-connector",t="lnApiConnector",r="lnConnector";if(window[t]!==void 0)return;function o(i){const u=i[t];u&&u.refreshConfig()}function l(i){return i.getAttribute("data-ln-api-path")||i.getAttribute("data-ln-api-endpoint")||""}const s={"data-ln-api-connector":{type:"marker",description:"Mounts API connector bridging REST backend and ln-ashlar data coordinators"},"data-ln-api-base-url":{prop:"baseUrl",read:v,type:"string",fallback:"",effect:o,description:"Base URL endpoint for API requests"},"data-ln-api-path":{prop:"path",read:l,type:"string",fallback:"",effect:o,description:"Resource path appended to base URL"},"data-ln-api-endpoint":{read:l,type:"string",fallback:"",effect:o,description:"Alias for data-ln-api-path"},"data-ln-api-headers":{prop:"rawHeaders",read:v,type:"json",fallback:null,effect:o,description:"Custom HTTP headers in JSON format or semicolon-separated pairs"},"data-ln-api-param-offset":{effect:o,type:"string",fallback:"offset",description:"Query parameter name for pagination offset"},"data-ln-api-param-limit":{effect:o,type:"string",fallback:"limit",description:"Query parameter name for pagination page size"},"data-ln-api-param-search":{effect:o,type:"string",fallback:"search",description:"Query parameter name for text search filter"},"data-ln-api-param-sort-field":{effect:o,type:"string",fallback:"sort_by",description:"Query parameter name for sort field"},"data-ln-api-param-sort-dir":{effect:o,type:"string",fallback:"sort_dir",description:"Query parameter name for sort direction"},"data-ln-api-connector-query-debounce":{effect:o,type:"integer",fallback:200,min:0,description:"Debounce delay in milliseconds before dispatching query requests"}},a=Z(s);function d(i){return i.ok?i.status===204?null:i.json():i.json().catch(()=>null).then(u=>{const c=new Error("HTTP "+i.status+": "+i.statusText);throw c.status=i.status,c.data=u,c})}function n(i){return this.dom=i,Y(this,i,a),i[t]=this,i[r]=this,this.namespace="ln-api-connector",this._inflight=new Map,this._queryTimers=new Map,this.refreshConfig(),this._handlers=null,h(this),this}n.prototype.refreshConfig=function(){const i=this.dom;this.credentials="same-origin",this.headers=ue(this.rawHeaders);const u={},c=i.getAttribute("data-ln-api-param-offset");c&&(u.offset=c);const f=i.getAttribute("data-ln-api-param-limit");f&&(u.limit=f);const p=i.getAttribute("data-ln-api-param-search");p&&(u.search=p);const w=i.getAttribute("data-ln-api-param-sort-field");w&&(u.sortField=w);const b=i.getAttribute("data-ln-api-param-sort-dir");b&&(u.sortDir=b),this.paramKeys=u;const _=i.getAttribute("data-ln-api-connector-query-debounce");this.queryDebounce=_!==null?+_:300,g(this.dom,"ln-api-connector:config-changed",{baseUrl:this.baseUrl,path:this.path,headers:this.headers,paramKeys:this.paramKeys})},n.prototype._reqHeaders=function(i){const u=Object.assign({},this.headers);return!u.Accept&&!u.accept&&(u.Accept="application/json"),!u["Content-Type"]&&!u["content-type"]&&(u["Content-Type"]="application/json"),i&&(u["X-Idempotency-Key"]=i),u},n.prototype.cancel=function(i){return i&&this._inflight.has(i)?(this._inflight.get(i).abort(),this._inflight.delete(i),!0):!1},n.prototype.fetchDelta=function(i,u){const c=this;let f=C(c.baseUrl,c.path);i!=null&&i!==""&&(f+=(f.indexOf("?")!==-1?"&":"?")+"since="+encodeURIComponent(i));const p=u||"sync";c._inflight.has(p)&&c._inflight.get(p).abort();const w=new AbortController;return c._inflight.set(p,w),window.fetch(f,{method:"GET",headers:c._reqHeaders(),credentials:c.credentials,signal:w.signal}).then(d).finally(function(){c._inflight.get(p)===w&&c._inflight.delete(p)})},n.prototype.query=function(i,u){const c=this,f=Ue(i,c.paramKeys),p=Me(c.baseUrl,c.path,f),w=u||"query";c._inflight.has(w)&&c._inflight.get(w).abort();const b=new AbortController;return c._inflight.set(w,b),window.fetch(p,{method:"GET",headers:c._reqHeaders(),credentials:c.credentials,signal:b.signal}).then(d).finally(function(){c._inflight.get(w)===b&&c._inflight.delete(w)})},n.prototype.create=function(i,u,c){const f=this;return window.fetch(C(f.baseUrl,u||f.path),{method:"POST",headers:f._reqHeaders(c),credentials:f.credentials,body:JSON.stringify(i)}).then(d)},n.prototype.update=function(i,u,c,f,p){const w=this;c!=null&&(u=Object.assign({},u,{expected_version:c}));const b=f?C(w.baseUrl,f):C(w.baseUrl,w.path,i);return window.fetch(b,{method:"PUT",headers:w._reqHeaders(p),credentials:w.credentials,body:JSON.stringify(u)}).then(d)},n.prototype.delete=function(i,u,c){const f=this;return window.fetch(C(f.baseUrl,u||f.path,i),{method:"DELETE",headers:f._reqHeaders(c),credentials:f.credentials}).then(d)},n.prototype.bulkDelete=function(i,u,c){const f=this;return window.fetch(C(f.baseUrl,u||f.path,"bulk-delete"),{method:"DELETE",headers:f._reqHeaders(c),credentials:f.credentials,body:JSON.stringify({ids:i})}).then(d)};function h(i){i._handlers={sync:function(u){const c=u.detail||{},f=c.meta&&c.meta.targetEl?c.meta.targetEl:null;i.fetchDelta(c.since,f).then(function(p){g(i.dom,"ln-api-connector:fetched",{data:p,since:c.since,meta:c.meta||null})}).catch(function(p){p&&p.name==="AbortError"||g(i.dom,"ln-api-connector:error",{action:"sync",error:p.message,status:p.status||0,data:p.data||null,since:c.since,meta:c.meta||null})})},query:function(u){const c=u.detail||{},f=c.query||c,p=c.meta&&c.meta.targetEl?c.meta.targetEl:null,w=p||"query",b=i.queryDebounce;function _(E,A,x){i.query(A,x).then(function(m){const y=m||{};g(i.dom,"ln-api-connector:fetched",{data:y.data||(Array.isArray(y)?y:[]),total:y.total,filtered:y.filtered,offset:A.offset,queryGen:A.queryGen,meta:E.meta||null})}).catch(function(m){m&&m.name==="AbortError"||g(i.dom,"ln-api-connector:error",{action:"query",error:m.message,status:m.status||0,data:m.data||null,meta:E.meta||null})})}if(b===0){_(c,f,p);return}i._queryTimers.has(w)&&clearTimeout(i._queryTimers.get(w));const q=setTimeout(function(){i._queryTimers.delete(w),_(c,f,p)},b);i._queryTimers.set(w,q)},cancel:function(u){const c=u.detail||{},f=c.meta&&c.meta.targetEl?c.meta.targetEl:c.targetEl||c.key;f&&i.cancel(f)},create:function(u){const c=u.detail||{};i.create(c.data,c.url,c.idempotencyKey).then(function(f){const p=le(f);g(i.dom,"ln-api-connector:created",{record:p.record,tempId:c.tempId,message:p.message,meta:c.meta||null})}).catch(function(f){f&&f.name==="AbortError"||g(i.dom,"ln-api-connector:error",{action:"create",error:f.message,status:f.status||0,data:f.data||null,tempId:c.tempId,meta:c.meta||null})})},update:function(u){const c=u.detail||{};i.update(c.id,c.data,c.expected_version,c.url,c.idempotencyKey).then(function(f){const p=le(f);g(i.dom,"ln-api-connector:updated",{record:p.record,id:c.id,message:p.message,meta:c.meta||null})}).catch(function(f){f&&f.name==="AbortError"||g(i.dom,"ln-api-connector:error",{action:"update",error:f.message,status:f.status||0,data:f.data||null,id:c.id,conflictData:f.status===409?f.data:null,meta:c.meta||null})})},delete:function(u){const c=u.detail||{};i.delete(c.id,c.url,c.idempotencyKey).then(function(f){const p=f&&f.message?f.message:null;g(i.dom,"ln-api-connector:deleted",{response:f,id:c.id,message:p,meta:c.meta||null})}).catch(function(f){f&&f.name==="AbortError"||g(i.dom,"ln-api-connector:error",{action:"delete",error:f.message,status:f.status||0,data:f.data||null,id:c.id,meta:c.meta||null})})},bulkDelete:function(u){const c=u.detail||{};i.bulkDelete(c.ids,c.url,c.idempotencyKey).then(function(f){const p=f&&f.message?f.message:null;g(i.dom,"ln-api-connector:bulk-deleted",{response:f,ids:c.ids,message:p,meta:c.meta||null})}).catch(function(f){f&&f.name==="AbortError"||g(i.dom,"ln-api-connector:error",{action:"bulk-delete",error:f.message,status:f.status||0,data:f.data||null,ids:c.ids,meta:c.meta||null})})}},i.dom.addEventListener("ln-api-connector:request-sync",i._handlers.sync),i.dom.addEventListener("ln-api-connector:request-query",i._handlers.query),i.dom.addEventListener("ln-api-connector:request-cancel",i._handlers.cancel),i.dom.addEventListener("ln-api-connector:request-create",i._handlers.create),i.dom.addEventListener("ln-api-connector:request-update",i._handlers.update),i.dom.addEventListener("ln-api-connector:request-delete",i._handlers.delete),i.dom.addEventListener("ln-api-connector:request-bulk-delete",i._handlers.bulkDelete)}n.prototype.destroy=function(){if(!this.dom[t])return;const i=this;i._inflight&&(i._inflight.forEach(function(u){u.abort()}),i._inflight.clear()),this._queryTimers&&(this._queryTimers.forEach(function(u){u&&clearTimeout(u)}),this._queryTimers.clear()),this._handlers&&(i.dom.removeEventListener("ln-api-connector:request-sync",i._handlers.sync),i.dom.removeEventListener("ln-api-connector:request-query",i._handlers.query),i.dom.removeEventListener("ln-api-connector:request-cancel",i._handlers.cancel),i.dom.removeEventListener("ln-api-connector:request-create",i._handlers.create),i.dom.removeEventListener("ln-api-connector:request-update",i._handlers.update),i.dom.removeEventListener("ln-api-connector:request-delete",i._handlers.delete),i.dom.removeEventListener("ln-api-connector:request-bulk-delete",i._handlers.bulkDelete),i._handlers=null),delete this.dom[t],delete this.dom[r]},oe(e,t,n,"ln-api-connector",{attributes:s})})()})();
@@ -31,7 +31,7 @@
31
31
  "description": "Debounce delay in milliseconds before dispatching query requests"
32
32
  },
33
33
  "data-ln-api-endpoint": {
34
- "direction": null,
34
+ "direction": "author",
35
35
  "sources": [
36
36
  "src/ln-api-connector.js"
37
37
  ],
@@ -93,7 +93,7 @@
93
93
  "description": "Query parameter name for sort field"
94
94
  },
95
95
  "data-ln-api-path": {
96
- "direction": null,
96
+ "direction": "author",
97
97
  "sources": [
98
98
  "src/ln-api-connector.js"
99
99
  ],
@@ -1 +1 @@
1
- (function(){"use strict";function K(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function T(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let a=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){a=t[l];break}if(!T(a))return}e.apply(console,t)}}function g(e,t,r){const a=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,a),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:a}))}function D(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){D(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Q(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function P(e,t){const r=!!(t&&t.typed),a=t&&t.exclude,l={},u=e.elements,c={};if(r)for(let p=0;p<u.length;p++){const i=u[p];i.name&&i.type==="checkbox"&&!i.disabled&&(c[i.name]=(c[i.name]||0)+1)}for(let p=0;p<u.length;p++){const i=u[p];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(a&&i.matches&&i.matches(a)))if(i.type==="checkbox")r&&c[i.name]===1?l[i.name]=i.checked:(l[i.name]||(l[i.name]=[]),i.checked&&l[i.name].push(i.value));else if(i.type==="radio")i.checked&&(l[i.name]=i.value);else if(i.type==="select-multiple"){l[i.name]=[];for(let m=0;m<i.options.length;m++)i.options[m].selected&&l[i.name].push(i.options[m].value)}else if(r&&i.type==="hidden")l[i.name]=i.value;else if(r&&(i.type==="number"||i.type==="range")){const m=Number(i.value);l[i.name]=i.value===""||isNaN(m)?null:m}else l[i.name]=i.value}return l}function we(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function me(e,t){const r=e.elements,a=[],l={};for(let u=0;u<r.length;u++){const c=r[u];c.name&&c.type==="checkbox"&&(l[c.name]=(l[c.name]||0)+1)}for(let u=0;u<r.length;u++){const c=r[u];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const p=c.getAttribute("data-ln-fill-as")||c.name;if(!p||!(p in t))continue;const i=t[p];if(c.type==="checkbox"){if(Array.isArray(i))c.checked=i.indexOf(c.value)!==-1;else if(l[c.name]>1){const m=String(i).split(",").map(function(A){return A.trim()});c.checked=m.indexOf(c.value)!==-1}else c.checked=we(i);a.push(c)}else if(c.type==="radio")c.checked=c.value===String(i),a.push(c);else if(c.type==="select-multiple"){if(Array.isArray(i))for(let m=0;m<c.options.length;m++)c.options[m].selected=i.indexOf(c.options[m].value)!==-1;a.push(c)}else c.value=i,c.tagName==="SELECT"&&i!=null&&c.setAttribute("data-ln-value",i),a.push(c)}return a}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=me,window.lnCore.serializeForm=P,window.lnCore.resolveFormMethod=Q);const V={};function be(e,t){V[e]=t}function ye(e){return V[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=be,window.lnCore.getDataMapper=ye);function ge(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,D(function(){new MutationObserver(function(){g(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const z={};function Ce(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];z[r]=t}function _e(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return z[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Ce,window.lnCore.getLocaleFallback=_e,window.lnCore.ensureLocaleObserver=ge);const L={};function Ae(e,t){L[e]||(L[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=L[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function H(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let c=0;c<r.length;c++){const p=r[c],i=p.getAttribute("data-ln-field");t[i]!=null&&(p.textContent=t[i])}const a=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<a.length;c++){const p=a[c],i=p.getAttribute("data-ln-attr").split(",");for(let m=0;m<i.length;m++){const A=i[m].trim().split(":");if(A.length!==2)continue;const _=A[0].trim(),C=A[1].trim();t[C]!=null&&p.setAttribute(_,t[C])}}const l=e.querySelectorAll("[data-ln-show]");for(let c=0;c<l.length;c++){const p=l[c],i=p.getAttribute("data-ln-show");i in t&&p.classList.toggle("hidden",!t[i])}const u=e.querySelectorAll("[data-ln-class]");for(let c=0;c<u.length;c++){const p=u[c],i=p.getAttribute("data-ln-class").split(",");for(let m=0;m<i.length;m++){const A=i[m].trim().split(":");if(A.length!==2)continue;const _=A[0].trim(),C=A[1].trim();C in t&&p.classList.toggle(_,!!t[C])}}return e}function ve(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let a=0;a<r.length;a++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[a],t??null),r[a].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 r=0;r<t.length;r++)t[r].textContent=""}})));function J(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const u=r.currentNode;u.textContent.indexOf("{{")!==-1&&(u.textContent=u.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,p){return t[p]!==void 0?t[p]:""}))}const a=function(u,c){return t[c]!==void 0?t[c]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let u=0;u<l.length;u++){const c=l[u],p=c.attributes;for(let i=0;i<p.length;i++){const m=p[i];m.value.indexOf("{{")!==-1&&c.setAttribute(m.name,m.value.replace(/\{\{\s*(\w+)\s*\}\}/g,a))}}return e}function Ee(e,t,r,a,l,u){const c={};for(let i=0;i<e.children.length;i++){const m=e.children[i],A=m.getAttribute("data-ln-render-key");A&&(c[A]=m)}const p=document.createDocumentFragment();for(let i=0;i<t.length;i++){const m=t[i],A=String(a(m));let _=c[A];if(_)l(_,m,i);else{const C=Ae(r,u);if(!C||(J(C,m),_=C.firstElementChild,!_))continue;_.setAttribute("data-ln-render-key",A),l(_,m,i)}p.appendChild(_)}e.textContent="",e.appendChild(p)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=J,window.lnCore.fill=H,window.lnCore.lnFill=ve,window.lnCore.renderList=Ee);function F(e,t,r){const a=e.getAttribute(t);return a===null?r:a}function X(e,t,r){const a=parseInt(e.getAttribute(t),10);return isNaN(a)?r:a}function Y(e,t,r=!1){const a=e.getAttribute(t);if(a===null)return!!r;const l=a.trim().toLowerCase();return!(l==="false"||l==="0")}function Z(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const j=new Map;function ee(e,t){const r=(e?e.join("|"):"")+"::"+t;if(j.has(r))return j.get(r);const a=new Set(e||[]),l=function(u,c){const p=u.getAttribute(c);return p!==null&&a.has(p)?p:t};return j.set(r,l),l}function te(e,t,r){const a=parseFloat(e.getAttribute(t));return isNaN(a)?r:a}function ne(e,t,r){const a=e.getAttribute(t);if(!a)return r;try{return JSON.parse(a)}catch{return r}}function re(e,t,r,a,l){if(!e||t===null)return!0;const u=a||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const p=i=>{l?console.warn(i,l):console.warn(i)};if(c==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(p(`[${u}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const i=e.values||[];return i.includes(t)?!0:(p(`[${u}] Invalid value "${t}" for attribute "${r}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return p(`[${u}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(p(`[${u}] Value ${i} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(p(`[${u}] Value ${i} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(p(`[${u}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(i){return p(`[${u}] Invalid JSON for attribute "${r}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function oe(e,t,r){for(const a in r){const[l,u,c]=r[a];Object.defineProperty(e,a,{get:function(){return l(t,u,c)},enumerable:!0,configurable:!0})}return e}function ie(e){const t={};for(const r in e){const a=e[r];if(!a||!a.prop)continue;let l=a.read;if(!l&&a.type)switch(a.type){case"enum":l=ee(a.values,a.fallback);break;case"integer":l=X;break;case"float":l=te;break;case"boolean":l=Y;break;case"list":l=Z;break;case"json":l=ne;break;case"string":default:l=F;break}l||(l=F),t[a.prop]=[l,r,a.fallback]}return t}function qe(e){const t={};for(const r in e){const a=e[r];a&&a.effect&&(t[r]=a.effect)}return Object.keys(t).length?t:null}function Se(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=oe,window.lnCore.attrSpec=ie,window.lnCore.attrStr=F,window.lnCore.attrInt=X,window.lnCore.attrBool=Y,window.lnCore.attrList=Z,window.lnCore.attrEnum=ee,window.lnCore.attrFloat=te,window.lnCore.attrJson=ne);function I(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 ae(e,t,r,a){if(e.nodeType!==1)return;const u=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:r,ComponentFn:a};if(e.matches&&e.matches(u)&&I(e,c),e.querySelectorAll){const p=e.querySelectorAll(u);for(let i=0;i<p.length;i++)I(p[i],c)}}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 ke(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 le(){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 Ie(e){const t=le(),r=e.observed||[];for(let a=0;a<r.length;a++){const l=r[a];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const a in e.attributes){t.byDeclaredAttr.has(a)||t.byDeclaredAttr.set(a,[]);const l=t.byDeclaredAttr.get(a);l.some(u=>u.componentTag===e.componentTag)||l.push({spec:e.attributes[a],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const a=Se(e);if(a===null)t.reactiveWildcard.push(e);else for(const l of a)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function se(e,t,r,a){for(let l=0;l<e.length;l++){const u=e[l];if(!t[u.attribute])continue;const c=u.effects&&u.effects[r];c?c(t,r,a):u.onAttrChange&&(!u.declared||u.declared.has(r))&&u.onAttrChange(t,r,a)}}function Oe(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,a=le(),l=a.byAttr.get(t),u=K()&&a.byDeclaredAttr&&a.byDeclaredAttr.has(t);if(!r&&!l&&!u)return;const c=e.target;if(e.oldValue!==c.getAttribute(t)){if(u&&T(c)){const p=a.byDeclaredAttr.get(t),i=c.getAttribute(t);for(let m=0;m<p.length;m++)re(p[m].spec,i,t,p[m].componentTag,c)}if(window.lnCore._debugSink&&(r||l)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),r){const p=a.byReactive.get(t);p&&se(p,c,t,e.oldValue),a.reactiveWildcard.length&&se(a.reactiveWildcard,c,t,e.oldValue)}if(l)for(let p=0;p<l.length;p++){const i=l[p];if(i.handler){i.handler(c,t,e.oldValue);continue}i.onAttributeChange&&c[i.attribute]?i.onAttributeChange(c,t):(ae(c,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(c))}}}function De(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,D(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Oe(t[r])}catch(a){console.error("[ln-core] mutation handler failed",t[r].target,a)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function $(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function M(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function B(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(a){console.error("["+t.attribute+"] destroy failed",e,a)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ce(e){const t=$();if(!t.length)return;const r=e.target;if(r){const l=r.nodeType===1?r:r.parentElement;if(l&&(l.isContentEditable||l.closest&&l.closest('[contenteditable]:not([contenteditable="false"])')))return}const a=M();if(e.target&&a.length)for(let l=0;l<a.length;l++){const u=a[l],c=u.query,p=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;p&&u.onSubtreeChange(p,e)}for(let l=0;l<e.addedNodes.length;l++){const u=e.addedNodes[l];if(u.nodeType===1){const c=!!(u.firstElementChild||u.children&&u.children.length);for(let p=0;p<t.length;p++){const i=t[p];if(i.selector&&i.attribute&&i.ComponentFn){if(!c)u.matches&&u.matches(i.query)&&I(u,i);else if(u.matches&&u.matches(i.query)&&I(u,i),u.querySelectorAll){const m=u.querySelectorAll(i.query);for(let A=0;A<m.length;A++)I(m[A],i)}}i.onInit&&i.onInit(u)}}}for(let l=0;l<e.removedNodes.length;l++){const u=e.removedNodes[l];if(u.nodeType===1){if(document.contains(u))continue;const c=!!(u.firstElementChild||u.children&&u.children.length);for(let p=0;p<t.length;p++){const i=t[p],m=i.query;if(m){if(!c)u.matches&&u.matches(m)&&B(u,i);else if(u.matches&&u.matches(m)&&B(u,i),u.querySelectorAll){const A=u.querySelectorAll(m);for(let _=0;_<A.length;_++)B(A[_],i)}}}}}}function de(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,D(function(){const e=new MutationObserver(function(t){for(let r=0;r<t.length;r++){const a=t[r];if(a.type==="childList")try{ce(a)}catch(l){console.error("[ln-core] lifecycle handler failed",a.target,l)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Re(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const r=t.takeRecords();for(let a=0;a<r.length;a++){const l=r[a];if(l.type==="childList")try{ce(l)}catch(u){console.error("[ln-core] lifecycle handler failed",l.target,u)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function Te(e){$().push(e),e.onSubtreeChange&&e.query&&M().push(e),de()}function ue(e,t,r,a,l={}){const u=l.extraAttributes||[],c=l.onAttributeChange||null,p=l.onSubtreeChange||null,i=l.onInit||null,m=l.onAttrChange||null,A=l.effects||null,_=l.attributes||null,C=_?qe(_):A,N=_?new Set(Object.keys(_)):null,U=l.persist||null;function n(q){const E=q||document.body;if(ae(E,e,t,r),_&&K())for(const d in _){const h=_[d],b=Array.from(E.querySelectorAll("["+d+"]"));E.matches&&E.matches("["+d+"]")&&b.push(E);for(let v=0;v<b.length;v++){const S=b[v];T(S)&&re(h,S.getAttribute(d),d,a,S)}}i&&i(E)}const o=[];if(e.indexOf("[")!==-1){const q=/\[([\w-]+)/g;let E;for(;(E=q.exec(e))!==null;)o.push(E[1])}else o.push(e);Ie({selector:e,attribute:t,componentTag:a,attributes:_,ComponentFn:r,onInit:i,observed:o.concat(u),onAttributeChange:c,onAttrChange:m,effects:C,declared:N,persist:U}),De();const s=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,f=l.subtreeQuery||(s?e:"["+e+"]"),w={selector:e,attribute:t,ComponentFn:r,onInit:i,onSubtreeChange:p,query:f};$().push(w),p&&f&&M().push(w),de(),window[t]=n,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ue,window.lnCore.observeLifecycle=Te,window.lnCore.withoutLifecycle=Re);function y(){xe()>0?ke(function(){n(document.body)}):n(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y):y(),n}function Le(e,t){let r=!1;return function(){r||(r=!0,queueMicrotask(function(){r=!1,e()}))}}function fe(e){return(e||"").replace(/^#/,"")}function W(e){const t=e===void 0?location.hash:e,r={},a=fe(t);if(!a)return r;const l=a.split("&");for(let u=0;u<l.length;u++){const c=l[u];if(!c)continue;const p=c.indexOf(":"),i=p>-1?c.slice(0,p):c,m=p>-1?c.slice(p+1):"";if(i)try{r[i]=decodeURIComponent(m)}catch{r[i]=m}}return r}function Fe(e){if(!e)return null;const t=W();return e in t?t[e]:null}function je(e,t){if(!e)return;const r=W();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(u){const c=r[u];return c===""?u:u+":"+encodeURIComponent(c)}).join("&");fe(location.hash)!==l&&(location.hash=l)}function $e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Me(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const a=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return a?t?a+"-"+t:a:t||null}function Be(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function We(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 Ne(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ue(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),a=e.slice(t+1),l=a?a.split(",").map(function(u){try{return decodeURIComponent(u)}catch{return u}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=W,window.lnCore.hashGet=Fe,window.lnCore.hashSet=je,window.lnCore.hashLinkClick=$e,window.lnCore.resolveHashNamespace=Me,window.lnCore.hashSortEncode=Be,window.lnCore.hashSortDecode=We,window.lnCore.hashFilterEncode=Ne,window.lnCore.hashFilterDecode=Ue);function k(){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=k);function Ge(e){return e=e||{},{sort:e.sort,filters:e.filters,search:e.search,offset:e.offset,limit:e.limit,queryGen:e.queryGen}}function Ke(e,t){const r=!e||!!e.initializationError,a=!!(e&&e.noLocalQuery&&!e.windowed);return t&&(r||!e.canServe||a)?"remote":e&&!e.initializationError?"store":"none"}function pe(e,t){const r=Object.assign({},e);return t&&(r.filters=t.filters,r.search=t.search,r.sort=t.sort),r}class Qe{constructor(){this._pending=new Map}wait(t){return new Promise((r,a)=>{this._pending.set(t,{resolve:r,reject:a})})}resolve(t){return this._settle(t,!1)}reject(t){return this._settle(t,!0)}close(t){const r=t||new Error("Mutation receipt registry closed");for(const a of this._pending.values())a.reject(r);this._pending.clear()}_settle(t,r){const a=t&&t.requestId;if(!a)return!1;const l=this._pending.get(a);return l?(this._pending.delete(a),r?l.reject(t.error||new Error("Store mutation failed")):l.resolve(t),!0):!1}}(function(){const e="data-ln-data-coordinator",t="lnDataCoordinator",r="data-ln-data-coordinator-scope";if(window[t]!==void 0)return;const a="data-ln-data-coordinator-search",l="data-ln-data-coordinator-filters",u="data-ln-data-coordinator-sort-field",c="data-ln-data-coordinator-sort-direction",i=ie({"data-ln-data-coordinator":{prop:"_name",type:"string",description:"Coordinator name or identifier for data routing"},"data-ln-data-coordinator-scope":{type:"string",description:"Scope name addressing the bound data store and connector"},"data-ln-data-coordinator-connector":{type:"string",description:"Selector, identifier, or namespace of the bound connector"},"data-ln-data-coordinator-mapper":{type:"string",description:"Name of the registered data mapper transform"},"data-ln-data-coordinator-search":{prop:"_searchAttr",type:"string",description:"Active search query term"},"data-ln-data-coordinator-filters":{prop:"_filtersAttr",type:"string",description:"Active encoded filter parameters"},"data-ln-data-coordinator-sort-field":{prop:"_sortFieldAttr",type:"string",description:"Sort field name"},"data-ln-data-coordinator-sort-direction":{prop:"_sortDirAttr",type:"enum",values:["asc","desc"],fallback:"asc",description:"Sort direction"},"data-ln-data-coordinator-stale":{type:"marker",description:"Flag indicating data needs re-synchronization"},"data-ln-data-coordinator-no-autosync":{type:"boolean",description:"Disables automatic synchronization upon state changes"}}),m=[["[data-ln-table-source]","data-ln-table-source","table"],["[data-ln-list-source]","data-ln-list-source","list"],["[data-ln-chart-source]","data-ln-chart-source","chart"],["[data-ln-options]","data-ln-options","options"],["[data-ln-stat]","data-ln-stat","stat"]];function A(n){const o=n.getAttribute("data-ln-data-coordinator-connector");if(o)return n.querySelector(o)||document.querySelector(o)||document.getElementById(o);const s=n.querySelector("[data-ln-connector], [data-ln-api-connector], [data-ln-couchdb-connector], [data-ln-websocket-connector]");if(s)return s;for(const f of n.querySelectorAll("*")){if(f.lnConnector)return f;for(const w of f.attributes)if(w.name.startsWith("data-ln-")&&w.name.endsWith("-connector"))return f}return null}function _(n){var s;if(!n)return"ln-connector";if((s=n.lnConnector)!=null&&s.namespace)return n.lnConnector.namespace;const o=n.getAttribute("data-ln-connector");if(o&&o!=="true")return o.startsWith("ln-")?o:"ln-"+o+(o.endsWith("-connector")?"":"-connector");for(const f of n.attributes)if(f.name.startsWith("data-ln-")&&f.name.endsWith("-connector"))return f.name.replace(/^data-/,"");return"ln-connector"}function C(n){const o=this;return this.dom=n,oe(this,n,i),this._name||console.warn("[ln-data-coordinator] missing id — the coordinator cannot be addressed",n),n[t]=this,this._destroyed=!1,this.mapper=null,this._unsubs=[],this._boundQueries=new WeakMap,this._boundDelivered=new WeakMap,this._mutationReceipts=new Qe,this._queueQueryRefresh=Le(()=>{o._destroyed||o._refreshAll(null,!0)}),this.refreshMapper(),N(this),this._checkInitialSync(),this}C.prototype._noAutosync=function(n){var o;return this.dom.hasAttribute("data-ln-data-coordinator-no-autosync")||!!((o=n.storeEl)!=null&&o.hasAttribute("data-ln-data-store-no-autosync"))},C.prototype._isStale=function(n){var s,f;const o=this.dom.getAttribute("data-ln-data-coordinator-stale")||((s=n.storeEl)==null?void 0:s.getAttribute("data-ln-data-store-stale"));return o==="never"||o==="-1"?!1:!((f=n.store)!=null&&f.lastSyncedAt)||Date.now()/1e3-n.store.lastSyncedAt>(parseInt(o,10)||300)},C.prototype._checkInitialSync=function(){const n=this,o=this.findChildren();o.store&&Promise.resolve(o.store.ready).then(()=>{if(n._destroyed)return;const s=n.findChildren();s.store&&s.connector&&!n._noAutosync(s)&&!s.store.isSyncing&&(!s.store.hasCache||n._isStale(s))&&s.store.forceSync()}).catch(s=>n._reportError("store-initialize",s,null))},C.prototype.refreshMapper=function(){var s,f;const n=this.dom.getAttribute("data-ln-data-coordinator-mapper")||this.dom.id,o=n&&((f=(s=window.lnCore)==null?void 0:s.getDataMapper)==null?void 0:f.call(s,n))||null;this.mapper={ingress:(o==null?void 0:o.ingress)||(w=>w),egress:(o==null?void 0:o.egress)||(w=>w)}},C.prototype.findChildren=function(){const n=this.dom.querySelector("[data-ln-data-store]"),o=A(this.dom),s=this.dom.querySelector("[data-ln-api-queue]");return{storeEl:n,connectorEl:o,queueEl:s,store:(n==null?void 0:n.lnDataStore)||null,connector:(o==null?void 0:o.lnConnector)||(o==null?void 0:o.lnApiConnector)||(o==null?void 0:o.lnCouchDbConnector)||(o==null?void 0:o.lnWebsocketConnector)||null,queue:(s==null?void 0:s.lnApiQueue)||null}},C.prototype._fanOutRemote=function(n,o,s,f){this.refreshMapper(),n.queue?g(n.queueEl,"ln-api-queue:request-enqueue",s):n.connector&&g(n.connectorEl,_(n.connectorEl)+":request-"+o,f)},C.prototype._fanOutCreate=function(n,o,s){const f="_temp_"+k(),w=this.mapper.egress(o);n.storeEl&&g(n.storeEl,"ln-data-store:request-create",{tempId:f,data:w}),this._fanOutRemote(n,"create",{chainKey:f,op:"create",targetId:null,payload:w,expectedVersion:null,meta:{tempId:f,action:s}},{data:w,url:s,meta:{entryId:k(),queued:!1,op:"create",tempId:f}})},C.prototype._fanOutUpdate=function(n,o,s,f,w){const y=this.mapper.egress(s);n.storeEl&&g(n.storeEl,"ln-data-store:request-update",{id:o,data:y}),this._fanOutRemote(n,"update",{chainKey:o,op:"update",targetId:o,payload:y,expectedVersion:f,meta:{id:o,action:w}},{id:o,data:y,expected_version:f,url:w,meta:{entryId:k(),queued:!1,op:"update",id:o}})},C.prototype._fanOutDelete=function(n,o){n.storeEl&&g(n.storeEl,"ln-data-store:request-delete",{id:o}),this._fanOutRemote(n,"delete",{chainKey:o,op:"delete",targetId:o,payload:null,expectedVersion:null,meta:{id:o}},{id:o,meta:{entryId:k(),queued:!1,op:"delete",id:o}})},C.prototype._fanOutBulkDelete=function(n,o){const s=o.join(",");n.storeEl&&g(n.storeEl,"ln-data-store:request-bulk-delete",{ids:o}),this._fanOutRemote(n,"bulk-delete",{chainKey:s,op:"bulk-delete",targetId:null,payload:{ids:o},expectedVersion:null,meta:{bulkKey:s,ids:o}},{ids:o,meta:{entryId:k(),queued:!1,op:"bulk-delete",bulkKey:s}})},C.prototype._requestStoreMutation=function(n,o,s){if(!n.storeEl)return Promise.reject(new Error("Store element not found"));const f=k(),w=this._mutationReceipts.wait(f);return g(n.storeEl,"ln-data-store:request-"+o,Object.assign({},s,{requestId:f})),w},C.prototype._reportError=function(n,o,s){this._destroyed||g(this.dom,"ln-data-coordinator:error",{operation:n,error:o,meta:s||null})},C.prototype._owns=function(n){var s;const o=this._name||((s=this.findChildren().storeEl)==null?void 0:s.id);return!!n&&n===o},C.prototype._currentQuery=function(){const n=this.dom.getAttribute(u),o=this.dom.getAttribute(c),s=new URLSearchParams(this.dom.getAttribute(l)||""),f={};for(const w of new Set(s.keys()))f[w]=s.getAll(w);return{search:this.dom.getAttribute(a)||"",filters:f,sort:n&&o?{field:n,direction:o}:null}},C.prototype._refreshAll=function(n,o){for(const[s,f,w]of m)for(const y of this.dom.ownerDocument.querySelectorAll(s))if(this._owns(y.getAttribute(f))){if((w==="table"||w==="list")&&y.hasAttribute(w==="table"?"data-ln-table-window":"data-ln-list-window")){g(y,"ln-"+w+(o?":request-invalidate":":request-revalidate"),{});continue}this._serveElement(y,w,null,n)}},C.prototype._serveElement=function(n,o,s,f){const w=this.findChildren(),y=w.store;if(!y)return;s&&this._boundQueries.set(n,s);const q=this._boundQueries.get(n)||{sort:null,filters:{},search:""},E=pe(q,this._currentQuery()),d=this;return Promise.resolve(y.ready).then(()=>{if(d._destroyed)return;const h=Ke(y,w.connector);if(o==="table"||o==="list"||o==="chart")return h==="remote"?(g(n,"ln-"+o+":set-loading",{loading:!0}),g(w.connectorEl,_(w.connectorEl)+":request-query",{query:E,meta:{targetEl:n,kind:o,offset:E.offset,limit:E.limit,queryGen:q.queryGen}})):h!=="store"?g(n,"ln-"+o+":set-loading",{loading:!1}):y.getAll(E).then(b=>{d._destroyed||!d._boundDelivered||(g(n,"ln-"+o+":set-loading",{loading:!1}),g(n,"ln-"+o+":set-data",{data:b.data,total:(f==null?void 0:f.total)??b.total,filtered:(f==null?void 0:f.filtered)??b.filtered,offset:b.offset??(f==null?void 0:f.offset)??q.offset,queryGen:q.queryGen!==void 0?q.queryGen:(f==null?void 0:f.queryGen)??b.queryGen,provisional:b.provisional===!0}),d._boundDelivered.set(n,!0))});if(o==="options"){if(h==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{},meta:{targetEl:n,kind:o}});if(h==="store")return y.getAll({}).then(b=>!d._destroyed&&g(n,"ln-options:set-data",{data:b.data}))}if(o==="stat"){let b=s==null?void 0:s.filters;if(!b){const S=n.getAttribute("data-ln-stat-filter");if(S!=null&&S.includes(":")){const x=S.split(":");b={[x[0].trim()]:[x.slice(1).join(":").trim()]}}}const v=w.connector&&y&&(y.windowed&&b&&Object.keys(b).length||y.noLocalQuery)?"remote":h;if(v==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{filters:b},meta:{targetEl:n,kind:o}});if(v==="store")return y.count(b).then(S=>!d._destroyed&&g(n,"ln-stat:set-count",{count:S}))}}).catch(h=>{d._destroyed||((o==="table"||o==="list"||o==="chart")&&g(n,"ln-"+o+":set-loading",{loading:!1}),d._reportError(o+"-query",h,{targetEl:n,kind:o}))})};function N(n){const o=n._unsubs=[],s=(d,h,b)=>{d.addEventListener(h,b),o.push(()=>d.removeEventListener(h,b))};s(n.dom,"ln-data-store:request-remote-sync",d=>{n.refreshMapper();const h=n.findChildren();h.store&&h.connector&&g(h.connectorEl,_(h.connectorEl)+":request-sync",{since:d.detail.since,meta:{op:"sync"}})}),s(n.dom,"ln-data-store:request-page",d=>{const h=n.findChildren(),b=d.detail||{};if(!h.connectorEl)return;const v=pe(b.query||{},n._currentQuery());g(h.connectorEl,_(h.connectorEl)+":request-query",{query:Object.assign({},v,{offset:b.offset,limit:b.limit,queryGen:b.queryGen})})}),s(n.dom,"ln-data-coordinator:request-create",d=>n._fanOutCreate(n.findChildren(),d.detail.data||{},d.detail.action)),s(n.dom,"ln-data-coordinator:request-update",d=>n._fanOutUpdate(n.findChildren(),d.detail.id,d.detail.data||{},d.detail.expected_version,d.detail.action)),s(n.dom,"ln-data-coordinator:request-delete",d=>n._fanOutDelete(n.findChildren(),d.detail.id)),s(n.dom,"ln-data-coordinator:request-bulk-delete",d=>n._fanOutBulkDelete(n.findChildren(),d.detail.ids||[])),s(n.dom,"ln-api-queue:send",d=>n._onQueueSend(d.detail||{})),s(n.dom,"ln-api-queue:failed",d=>{var h;return n._reportError("queue-failed",((h=d==null?void 0:d.detail)==null?void 0:h.error)||new Error("Queue failed"),(d==null?void 0:d.detail)||null)}),s(n.dom,"ln-data-store:initialized",d=>{var b;const h=n.findChildren();h.store&&!h.store.initializationError&&h.connector&&!n._noAutosync(h)&&!h.store.isSyncing&&(!((b=d.detail)!=null&&b.hasCache)||n._isStale(h))&&h.store.forceSync()});const f=()=>{const d=n.findChildren();d.store&&!d.store.initializationError&&d.connector&&!n._noAutosync(d)&&d.store.isInitialized&&!d.store.isSyncing&&d.store.forceSync()};s(n.dom,"ln-websocket-connector:connected",f),s(document,"submit",d=>n._onFormSubmit(d));const w=(d,h,b)=>{var v;n._owns(d.target.getAttribute(b))&&n._serveElement(d.target,h,h==="stat"?{filters:((v=d.detail)==null?void 0:v.filters)||null}:h==="options"?null:Ge(d.detail||{}),null)};s(document,"ln-table:request-data",d=>w(d,"table","data-ln-table-source")),s(document,"ln-list:request-data",d=>w(d,"list","data-ln-list-source")),s(document,"ln-chart:request-data",d=>w(d,"chart","data-ln-chart-source")),s(document,"ln-options:request-data",d=>w(d,"options","data-ln-options")),s(document,"ln-stat:request-count",d=>w(d,"stat","data-ln-stat"));const y=d=>{n._mutationReceipts.resolve(d.detail),n._refreshAll(null,!1)};s(n.dom,"ln-data-store:ready",y),s(n.dom,"ln-data-store:created",y),s(n.dom,"ln-data-store:updated",y),s(n.dom,"ln-data-store:deleted",y),s(n.dom,"ln-data-store:mutation-error",d=>n._mutationReceipts.reject(d.detail)),s(n.dom,"ln-data-store:synced",d=>{var h;(h=d.detail)!=null&&h.changed&&n._refreshAll(d.detail.meta,!1)}),s(n.dom,"ln-data-store:query-changed",()=>n._refreshAll(null,!0)),s(n.dom,"ln-search:change",d=>{var b;d.preventDefault();const h=((b=d.detail)==null?void 0:b.term)!=null?d.detail.term:"";h!==(n.dom.getAttribute(a)||"")&&n.dom.setAttribute(a,h)}),s(n.dom,"ln-filter:change",d=>{var he;d.preventDefault();const h=(he=d.detail)==null?void 0:he.key;if(!h)return;const b=(d.detail.values||[]).slice(),v=n._currentQuery().filters,S=v[h];if(S?S.length===b.length&&S.every((R,G)=>R===b[G]):!b.length)return;b.length?v[h]=b:delete v[h];const x=new URLSearchParams;Object.keys(v).forEach(R=>v[R].forEach(G=>x.append(R,G)));const O=x.toString();O?n.dom.setAttribute(l,O):n.dom.removeAttribute(l)}),s(n.dom,"ln-sort:change",d=>{var x,O;d.preventDefault();const h=(x=d.detail)==null?void 0:x.field,b=(O=d.detail)==null?void 0:O.direction,v=h&&b&&b!=="none"?{field:h,direction:b}:null,S=n._currentQuery().sort;!S&&!v||S&&v&&S.field===v.field&&S.direction===v.direction||(v?(n.dom.setAttribute(u,v.field),n.dom.setAttribute(c,v.direction)):(n.dom.removeAttribute(u),n.dom.removeAttribute(c)))});const q=new Set(["ln-api-connector","ln-couchdb-connector","ln-websocket-connector","ln-connector"]),E=n.findChildren().connectorEl;if(E){const d=_(E);q.add(d),s(n.dom,d+":connected",f)}q.forEach(d=>{s(n.dom,d+":fetched",h=>n._reconcileServerFetch(h.detail)),s(n.dom,d+":created",h=>n._reconcileServerMutation("create",h.detail)),s(n.dom,d+":updated",h=>n._reconcileServerMutation("update",h.detail)),s(n.dom,d+":deleted",h=>n._reconcileServerMutation("ack",h.detail)),s(n.dom,d+":bulk-deleted",h=>n._reconcileServerMutation("ack",h.detail)),s(n.dom,d+":error",h=>n._reconcileServerMutation("error",h.detail))})}C.prototype._onQueueSend=function(n){this.refreshMapper();const o=this.findChildren();if(!o.store||!o.connector||!o.queue)return;const s=n.meta||{},f=_(o.connectorEl),w=n.idempotencyKey||n.entryId,y={create:()=>g(o.connectorEl,f+":request-create",{data:n.payload,url:s.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"create",tempId:s.tempId}}),update:()=>g(o.connectorEl,f+":request-update",{id:n.targetId,data:n.payload,expected_version:n.expectedVersion,url:s.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"update",id:n.targetId}}),delete:()=>g(o.connectorEl,f+":request-delete",{id:n.targetId,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"delete",id:n.targetId}}),"bulk-delete":()=>{var q;return g(o.connectorEl,f+":request-bulk-delete",{ids:((q=n.payload)==null?void 0:q.ids)||[],idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"bulk-delete",bulkKey:s.bulkKey}})}};y[n.op]&&y[n.op]()},C.prototype._onFormSubmit=function(n){const o=n.target;if(n.defaultPrevented)return;const s=o.hasAttribute(r)?o.getAttribute(r):null;if(s===null||(s?!this._owns(s):o.closest("["+e+"]")!==this.dom))return;const f=Q(o);if(f!=="POST"&&f!=="PUT"&&f!=="PATCH")return;n.preventDefault();const w=P(o);delete w._method,delete w._token;const y=w.id,q=w.expected_version,E=o.getAttribute("action")||"",d=this.findChildren();delete w.id,delete w.expected_version,f==="POST"?this._fanOutCreate(d,w,E):this._fanOutUpdate(d,y,w,q,E)},C.prototype._reconcileServerFetch=function(n){if(!n)return;const o=n.meta||{},s=this.findChildren(),f=n.data;this.refreshMapper();const w=Array.isArray(f)?f:(f==null?void 0:f.data)||[],y=Array.isArray(f==null?void 0:f.deleted)?f.deleted:[],q=Array.isArray(f)?Math.floor(Date.now()/1e3):(f==null?void 0:f.synced_at)??(f==null?void 0:f.since)??Math.floor(Date.now()/1e3),E=w.map(d=>this.mapper.ingress(d));if(!(!s.store||s.store.initializationError)){if(!o.kind)return s.store.applySync(E,y,q,{total:n.total,filtered:n.filtered,offset:n.offset,queryGen:n.queryGen,targetEl:o.targetEl});s.store.applyQuery(E,{total:n.total}).then(d=>{const h=o.kind;h==="table"||h==="list"||h==="chart"?(g(o.targetEl,"ln-"+h+":set-loading",{loading:!1}),g(o.targetEl,"ln-"+h+":set-data",{data:d,total:n.total??d.length,filtered:n.filtered??d.length,offset:n.offset,queryGen:o.queryGen}),this._boundDelivered.set(o.targetEl,!0)):h==="options"?s.store.getAll({}).then(b=>g(o.targetEl,"ln-options:set-data",{data:b.data})):h==="stat"&&g(o.targetEl,"ln-stat:set-count",{count:n.filtered??n.total??E.length})})}},C.prototype._reconcileServerMutation=function(n,o){var w;if(!o)return;const s=this.findChildren(),f=o.meta||{};if(n==="create"){if(!o.record)return this._reportError("create-empty-response",new Error("Create response missing record payload"),f);const y=this.mapper.ingress(o.record);(s.storeEl?this._requestStoreMutation(s,"update",{id:f.tempId,data:y}):Promise.resolve()).then(()=>{f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:resolve-create",{entryId:f.entryId,oldKey:f.tempId,newId:y.id})}).catch(q=>this._reportError("create-reconcile",q,f))}else if(n==="update"){const y=o.record?this.mapper.ingress(o.record):null;(s.storeEl&&y?this._requestStoreMutation(s,"update",{id:f.id,data:y}):Promise.resolve()).then(()=>{f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:ack",{entryId:f.entryId})}).catch(q=>this._reportError("update-reconcile",q,f))}else if(n==="ack")f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:ack",{entryId:f.entryId});else if(n==="error"){const y=o.status||((w=o.error)==null?void 0:w.status)||0;f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:nack",{entryId:f.entryId,reason:y===401||y===419?"auth":y===0||y>=500?"retry":"drop"}),s.storeEl&&g(s.storeEl,"ln-data-store:request-sync-failed",{error:o.error||o,status:y}),this._reportError("connector-error",o.error||o,f)}},C.prototype.destroy=function(){var n;if(this.dom[t]){for(this._destroyed=!0;(n=this._unsubs)!=null&&n.length;)this._unsubs.pop()();this._unsubs=this._boundQueries=this._boundDelivered=this._queueQueryRefresh=null,this._mutationReceipts.close(new Error("Data coordinator destroyed")),this._mutationReceipts=null,delete this.dom[t]}};function U(n,o){const s=n[t];s&&(o==="data-ln-data-coordinator-mapper"?s.refreshMapper():(o===a||o===l||o===u||o===c)&&s._queueQueryRefresh())}ue(e,t,C,"ln-data-coordinator",{extraAttributes:["data-ln-data-coordinator-mapper",a,l,u,c],onAttributeChange:U}),window[t].init=window[t]})()})();
1
+ (function(){"use strict";function G(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function T(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let a=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){a=t[l];break}if(!T(a))return}e.apply(console,t)}}function g(e,t,r){const a=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,a),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:a}))}function D(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){D(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function K(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function P(e,t){const r=!!(t&&t.typed),a=t&&t.exclude,l={},u=e.elements,c={};if(r)for(let p=0;p<u.length;p++){const i=u[p];i.name&&i.type==="checkbox"&&!i.disabled&&(c[i.name]=(c[i.name]||0)+1)}for(let p=0;p<u.length;p++){const i=u[p];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(a&&i.matches&&i.matches(a)))if(i.type==="checkbox")r&&c[i.name]===1?l[i.name]=i.checked:(l[i.name]||(l[i.name]=[]),i.checked&&l[i.name].push(i.value));else if(i.type==="radio")i.checked&&(l[i.name]=i.value);else if(i.type==="select-multiple"){l[i.name]=[];for(let m=0;m<i.options.length;m++)i.options[m].selected&&l[i.name].push(i.options[m].value)}else if(r&&i.type==="hidden")l[i.name]=i.value;else if(r&&(i.type==="number"||i.type==="range")){const m=Number(i.value);l[i.name]=i.value===""||isNaN(m)?null:m}else l[i.name]=i.value}return l}function we(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function me(e,t){const r=e.elements,a=[],l={};for(let u=0;u<r.length;u++){const c=r[u];c.name&&c.type==="checkbox"&&(l[c.name]=(l[c.name]||0)+1)}for(let u=0;u<r.length;u++){const c=r[u];if(c.type==="file"||c.type==="submit"||c.type==="button")continue;const p=c.getAttribute("data-ln-fill-as")||c.name;if(!p||!(p in t))continue;const i=t[p];if(c.type==="checkbox"){if(Array.isArray(i))c.checked=i.indexOf(c.value)!==-1;else if(l[c.name]>1){const m=String(i).split(",").map(function(A){return A.trim()});c.checked=m.indexOf(c.value)!==-1}else c.checked=we(i);a.push(c)}else if(c.type==="radio")c.checked=c.value===String(i),a.push(c);else if(c.type==="select-multiple"){if(Array.isArray(i))for(let m=0;m<c.options.length;m++)c.options[m].selected=i.indexOf(c.options[m].value)!==-1;a.push(c)}else c.value=i,c.tagName==="SELECT"&&i!=null&&c.setAttribute("data-ln-value",i),a.push(c)}return a}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=me,window.lnCore.serializeForm=P,window.lnCore.resolveFormMethod=K);const V={};function be(e,t){V[e]=t}function ye(e){return V[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=be,window.lnCore.getDataMapper=ye);function ge(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,D(function(){new MutationObserver(function(){g(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const z={};function Ce(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];z[r]=t}function _e(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return z[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=Ce,window.lnCore.getLocaleFallback=_e,window.lnCore.ensureLocaleObserver=ge);const L={};function Ae(e,t){L[e]||(L[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=L[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function H(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let c=0;c<r.length;c++){const p=r[c],i=p.getAttribute("data-ln-field");t[i]!=null&&(p.textContent=t[i])}const a=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<a.length;c++){const p=a[c],i=p.getAttribute("data-ln-attr").split(",");for(let m=0;m<i.length;m++){const A=i[m].trim().split(":");if(A.length!==2)continue;const _=A[0].trim(),C=A[1].trim();t[C]!=null&&p.setAttribute(_,t[C])}}const l=e.querySelectorAll("[data-ln-show]");for(let c=0;c<l.length;c++){const p=l[c],i=p.getAttribute("data-ln-show");i in t&&p.classList.toggle("hidden",!t[i])}const u=e.querySelectorAll("[data-ln-class]");for(let c=0;c<u.length;c++){const p=u[c],i=p.getAttribute("data-ln-class").split(",");for(let m=0;m<i.length;m++){const A=i[m].trim().split(":");if(A.length!==2)continue;const _=A[0].trim(),C=A[1].trim();C in t&&p.classList.toggle(_,!!t[C])}}return e}function ve(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let a=0;a<r.length;a++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[a],t??null),r[a].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 r=0;r<t.length;r++)t[r].textContent=""}})));function J(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const u=r.currentNode;u.textContent.indexOf("{{")!==-1&&(u.textContent=u.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,p){return t[p]!==void 0?t[p]:""}))}const a=function(u,c){return t[c]!==void 0?t[c]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let u=0;u<l.length;u++){const c=l[u],p=c.attributes;for(let i=0;i<p.length;i++){const m=p[i];m.value.indexOf("{{")!==-1&&c.setAttribute(m.name,m.value.replace(/\{\{\s*(\w+)\s*\}\}/g,a))}}return e}function Ee(e,t,r,a,l,u){const c={};for(let i=0;i<e.children.length;i++){const m=e.children[i],A=m.getAttribute("data-ln-render-key");A&&(c[A]=m)}const p=document.createDocumentFragment();for(let i=0;i<t.length;i++){const m=t[i],A=String(a(m));let _=c[A];if(_)l(_,m,i);else{const C=Ae(r,u);if(!C||(J(C,m),_=C.firstElementChild,!_))continue;_.setAttribute("data-ln-render-key",A),l(_,m,i)}p.appendChild(_)}e.textContent="",e.appendChild(p)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=J,window.lnCore.fill=H,window.lnCore.lnFill=ve,window.lnCore.renderList=Ee);function F(e,t,r){const a=e.getAttribute(t);return a===null?r:a}function X(e,t,r){const a=parseInt(e.getAttribute(t),10);return isNaN(a)?r:a}function Y(e,t,r=!1){const a=e.getAttribute(t);if(a===null)return!!r;const l=a.trim().toLowerCase();return!(l==="false"||l==="0")}function Z(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const j=new Map;function ee(e,t){const r=(e?e.join("|"):"")+"::"+t;if(j.has(r))return j.get(r);const a=new Set(e||[]),l=function(u,c){const p=u.getAttribute(c);return p!==null&&a.has(p)?p:t};return j.set(r,l),l}function te(e,t,r){const a=parseFloat(e.getAttribute(t));return isNaN(a)?r:a}function ne(e,t,r){const a=e.getAttribute(t);if(!a)return r;try{return JSON.parse(a)}catch{return r}}function re(e,t,r,a,l){if(!e||t===null)return!0;const u=a||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const p=i=>{l?console.warn(i,l):console.warn(i)};if(c==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(p(`[${u}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const i=e.values||[];return i.includes(t)?!0:(p(`[${u}] Invalid value "${t}" for attribute "${r}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return p(`[${u}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(p(`[${u}] Value ${i} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(p(`[${u}] Value ${i} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(p(`[${u}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(i){return p(`[${u}] Invalid JSON for attribute "${r}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function oe(e,t,r){for(const a in r){const[l,u,c]=r[a];Object.defineProperty(e,a,{get:function(){return l(t,u,c)},enumerable:!0,configurable:!0})}return e}function ie(e){const t={};for(const r in e){const a=e[r];if(!a||!a.prop)continue;let l=a.read;if(!l&&a.type)switch(a.type){case"enum":l=ee(a.values,a.fallback);break;case"integer":l=X;break;case"float":l=te;break;case"boolean":l=Y;break;case"list":l=Z;break;case"json":l=ne;break;case"string":default:l=F;break}l||(l=F),t[a.prop]=[l,r,a.fallback]}return t}function qe(e){const t={};for(const r in e){const a=e[r];a&&a.effect&&(t[r]=a.effect)}return Object.keys(t).length?t:null}function Se(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=oe,window.lnCore.attrSpec=ie,window.lnCore.attrStr=F,window.lnCore.attrInt=X,window.lnCore.attrBool=Y,window.lnCore.attrList=Z,window.lnCore.attrEnum=ee,window.lnCore.attrFloat=te,window.lnCore.attrJson=ne);function I(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 ae(e,t,r,a){if(e.nodeType!==1)return;const u=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c={selector:t,attribute:r,ComponentFn:a};if(e.matches&&e.matches(u)&&I(e,c),e.querySelectorAll){const p=e.querySelectorAll(u);for(let i=0;i<p.length;i++)I(p[i],c)}}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 ke(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 le(){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 Ie(e){const t=le(),r=e.observed||[];for(let a=0;a<r.length;a++){const l=r[a];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const a in e.attributes){t.byDeclaredAttr.has(a)||t.byDeclaredAttr.set(a,[]);const l=t.byDeclaredAttr.get(a);l.some(u=>u.componentTag===e.componentTag)||l.push({spec:e.attributes[a],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const a=Se(e);if(a===null)t.reactiveWildcard.push(e);else for(const l of a)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function se(e,t,r,a){for(let l=0;l<e.length;l++){const u=e[l];if(!t[u.attribute])continue;const c=u.effects&&u.effects[r];c?c(t,r,a):u.onAttrChange&&(!u.declared||u.declared.has(r))&&u.onAttrChange(t,r,a)}}function Oe(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,a=le(),l=a.byAttr.get(t),u=G()&&a.byDeclaredAttr&&a.byDeclaredAttr.has(t);if(!r&&!l&&!u)return;const c=e.target;if(e.oldValue!==c.getAttribute(t)){if(u&&T(c)){const p=a.byDeclaredAttr.get(t),i=c.getAttribute(t);for(let m=0;m<p.length;m++)re(p[m].spec,i,t,p[m].componentTag,c)}if(window.lnCore._debugSink&&(r||l)&&window.lnCore._debugSink("attr",t,c,{oldValue:e.oldValue,newValue:c.getAttribute(t)}),r){const p=a.byReactive.get(t);p&&se(p,c,t,e.oldValue),a.reactiveWildcard.length&&se(a.reactiveWildcard,c,t,e.oldValue)}if(l)for(let p=0;p<l.length;p++){const i=l[p];if(i.handler){i.handler(c,t,e.oldValue);continue}i.onAttributeChange&&c[i.attribute]?i.onAttributeChange(c,t):(ae(c,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(c))}}}function De(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,D(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Oe(t[r])}catch(a){console.error("[ln-core] mutation handler failed",t[r].target,a)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function $(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function M(){return window.lnCore=window.lnCore||{},window.lnCore._subtreeRegistry=window.lnCore._subtreeRegistry||[]}function B(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(a){console.error("["+t.attribute+"] destroy failed",e,a)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ce(e){const t=$();if(!t.length)return;const r=e.target;if(r){const l=r.nodeType===1?r:r.parentElement;if(l&&(l.isContentEditable||l.closest&&l.closest('[contenteditable]:not([contenteditable="false"])')))return}const a=M();if(e.target&&a.length)for(let l=0;l<a.length;l++){const u=a[l],c=u.query,p=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;p&&u.onSubtreeChange(p,e)}for(let l=0;l<e.addedNodes.length;l++){const u=e.addedNodes[l];if(u.nodeType===1){const c=!!(u.firstElementChild||u.children&&u.children.length);for(let p=0;p<t.length;p++){const i=t[p];if(i.selector&&i.attribute&&i.ComponentFn){if(!c)u.matches&&u.matches(i.query)&&I(u,i);else if(u.matches&&u.matches(i.query)&&I(u,i),u.querySelectorAll){const m=u.querySelectorAll(i.query);for(let A=0;A<m.length;A++)I(m[A],i)}}i.onInit&&i.onInit(u)}}}for(let l=0;l<e.removedNodes.length;l++){const u=e.removedNodes[l];if(u.nodeType===1){if(document.contains(u))continue;const c=!!(u.firstElementChild||u.children&&u.children.length);for(let p=0;p<t.length;p++){const i=t[p],m=i.query;if(m){if(!c)u.matches&&u.matches(m)&&B(u,i);else if(u.matches&&u.matches(m)&&B(u,i),u.querySelectorAll){const A=u.querySelectorAll(m);for(let _=0;_<A.length;_++)B(A[_],i)}}}}}}function de(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,D(function(){const e=new MutationObserver(function(t){for(let r=0;r<t.length;r++){const a=t[r];if(a.type==="childList")try{ce(a)}catch(l){console.error("[ln-core] lifecycle handler failed",a.target,l)}}});window.lnCore._lifecycleObserver=e,e.observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Re(e){if(typeof window>"u")return e();window.lnCore=window.lnCore||{};const t=window.lnCore._lifecycleObserver;if(!t)return e();const r=t.takeRecords();for(let a=0;a<r.length;a++){const l=r[a];if(l.type==="childList")try{ce(l)}catch(u){console.error("[ln-core] lifecycle handler failed",l.target,u)}}t.disconnect();try{return e()}finally{t.observe(document.body,{childList:!0,subtree:!0})}}function Te(e){$().push(e),e.onSubtreeChange&&e.query&&M().push(e),de()}function ue(e,t,r,a,l={}){const u=l.extraAttributes||[],c=l.onAttributeChange||null,p=l.onSubtreeChange||null,i=l.onInit||null,m=l.onAttrChange||null,A=l.effects||null,_=l.attributes||null,C=_?qe(_):A,N=_?new Set(Object.keys(_)):null,Q=l.persist||null;function n(q){const E=q||document.body;if(ae(E,e,t,r),_&&G())for(const d in _){const h=_[d],b=Array.from(E.querySelectorAll("["+d+"]"));E.matches&&E.matches("["+d+"]")&&b.push(E);for(let v=0;v<b.length;v++){const S=b[v];T(S)&&re(h,S.getAttribute(d),d,a,S)}}i&&i(E)}const o=[];if(e.indexOf("[")!==-1){const q=/\[([\w-]+)/g;let E;for(;(E=q.exec(e))!==null;)o.push(E[1])}else o.push(e);Ie({selector:e,attribute:t,componentTag:a,attributes:_,ComponentFn:r,onInit:i,observed:o.concat(u),onAttributeChange:c,onAttrChange:m,effects:C,declared:N,persist:Q}),De();const s=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,f=l.subtreeQuery||(s?e:"["+e+"]"),w={selector:e,attribute:t,ComponentFn:r,onInit:i,onSubtreeChange:p,query:f};$().push(w),p&&f&&M().push(w),de(),window[t]=n,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=ue,window.lnCore.observeLifecycle=Te,window.lnCore.withoutLifecycle=Re);function y(){xe()>0?ke(function(){n(document.body)}):n(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y):y(),n}function Le(e,t){let r=!1;return function(){r||(r=!0,queueMicrotask(function(){r=!1,e()}))}}function fe(e){return(e||"").replace(/^#/,"")}function W(e){const t=e===void 0?location.hash:e,r={},a=fe(t);if(!a)return r;const l=a.split("&");for(let u=0;u<l.length;u++){const c=l[u];if(!c)continue;const p=c.indexOf(":"),i=p>-1?c.slice(0,p):c,m=p>-1?c.slice(p+1):"";if(i)try{r[i]=decodeURIComponent(m)}catch{r[i]=m}}return r}function Fe(e){if(!e)return null;const t=W();return e in t?t[e]:null}function je(e,t){if(!e)return;const r=W();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(u){const c=r[u];return c===""?u:u+":"+encodeURIComponent(c)}).join("&");fe(location.hash)!==l&&(location.hash=l)}function $e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Me(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const a=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return a?t?a+"-"+t:a:t||null}function Be(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function We(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 Ne(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),a=e.slice(t+1),l=a?a.split(",").map(function(u){try{return decodeURIComponent(u)}catch{return u}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=W,window.lnCore.hashGet=Fe,window.lnCore.hashSet=je,window.lnCore.hashLinkClick=$e,window.lnCore.resolveHashNamespace=Me,window.lnCore.hashSortEncode=Be,window.lnCore.hashSortDecode=We,window.lnCore.hashFilterEncode=Ne,window.lnCore.hashFilterDecode=Qe);function k(){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=k);function Ue(e){return e=e||{},{sort:e.sort,filters:e.filters,search:e.search,offset:e.offset,limit:e.limit,queryGen:e.queryGen}}function Ge(e,t){const r=!e||!!e.initializationError,a=!!(e&&e.noLocalQuery&&!e.windowed);return t&&(r||!e.canServe||a)?"remote":e&&!e.initializationError?"store":"none"}function pe(e,t){const r=Object.assign({},e);return t&&(r.filters=t.filters,r.search=t.search,r.sort=t.sort),r}class Ke{constructor(){this._pending=new Map}wait(t){return new Promise((r,a)=>{this._pending.set(t,{resolve:r,reject:a})})}resolve(t){return this._settle(t,!1)}reject(t){return this._settle(t,!0)}close(t){const r=t||new Error("Mutation receipt registry closed");for(const a of this._pending.values())a.reject(r);this._pending.clear()}_settle(t,r){const a=t&&t.requestId;if(!a)return!1;const l=this._pending.get(a);return l?(this._pending.delete(a),r?l.reject(t.error||new Error("Store mutation failed")):l.resolve(t),!0):!1}}(function(){const e="data-ln-data-coordinator",t="lnDataCoordinator",r="data-ln-data-coordinator-scope";if(window[t]!==void 0)return;const a="data-ln-data-coordinator-search",l="data-ln-data-coordinator-filters",u="data-ln-data-coordinator-sort-field",c="data-ln-data-coordinator-sort-direction",i=ie({"data-ln-data-coordinator":{prop:"_name",type:"string",description:"Coordinator name or identifier for data routing"},"data-ln-data-coordinator-scope":{type:"string",description:"Scope name addressing the bound data store and connector"},"data-ln-data-coordinator-connector":{type:"string",description:"Selector, identifier, or namespace of the bound connector"},"data-ln-data-coordinator-mapper":{type:"string",description:"Name of the registered data mapper transform"},"data-ln-data-coordinator-search":{prop:"_searchAttr",type:"string",description:"Active search query term"},"data-ln-data-coordinator-filters":{prop:"_filtersAttr",type:"string",description:"Active encoded filter parameters"},"data-ln-data-coordinator-sort-field":{prop:"_sortFieldAttr",type:"string",description:"Sort field name"},"data-ln-data-coordinator-sort-direction":{prop:"_sortDirAttr",type:"enum",values:["asc","desc"],fallback:"asc",description:"Sort direction"},"data-ln-data-coordinator-stale":{type:"marker",description:"Flag indicating data needs re-synchronization"},"data-ln-data-coordinator-no-autosync":{type:"boolean",description:"Disables automatic synchronization upon state changes"}}),m=[["[data-ln-table-source]","data-ln-table-source","table"],["[data-ln-list-source]","data-ln-list-source","list"],["[data-ln-chart-source]","data-ln-chart-source","chart"],["[data-ln-options]","data-ln-options","options"],["[data-ln-stat]","data-ln-stat","stat"]];function A(n){const o=n.getAttribute("data-ln-data-coordinator-connector");if(o)return n.querySelector(o)||document.querySelector(o)||document.getElementById(o);const s=n.querySelector("[data-ln-connector], [data-ln-api-connector], [data-ln-couchdb-connector], [data-ln-websocket-connector]");if(s)return s;for(const f of n.querySelectorAll("*")){if(f.lnConnector)return f;for(const w of f.attributes)if(w.name.startsWith("data-ln-")&&w.name.endsWith("-connector"))return f}return null}function _(n){var s;if(!n)return"ln-connector";if((s=n.lnConnector)!=null&&s.namespace)return n.lnConnector.namespace;const o=n.getAttribute("data-ln-connector");if(o&&o!=="true")return o.startsWith("ln-")?o:"ln-"+o+(o.endsWith("-connector")?"":"-connector");for(const f of n.attributes)if(f.name.startsWith("data-ln-")&&f.name.endsWith("-connector"))return f.name.replace(/^data-/,"");return"ln-connector"}function C(n){const o=this;return this.dom=n,oe(this,n,i),this._name||console.warn("[ln-data-coordinator] missing id — the coordinator cannot be addressed",n),n[t]=this,this._destroyed=!1,this.mapper=null,this._unsubs=[],this._boundQueries=new WeakMap,this._boundDelivered=new WeakMap,this._mutationReceipts=new Ke,this._queueQueryRefresh=Le(()=>{o._destroyed||o._refreshAll(null,!0)}),this.refreshMapper(),N(this),this._checkInitialSync(),this}C.prototype._noAutosync=function(n){var o;return this.dom.hasAttribute("data-ln-data-coordinator-no-autosync")||!!((o=n.storeEl)!=null&&o.hasAttribute("data-ln-data-store-no-autosync"))},C.prototype._isStale=function(n){var s,f;const o=this.dom.getAttribute("data-ln-data-coordinator-stale")||((s=n.storeEl)==null?void 0:s.getAttribute("data-ln-data-store-stale"));return o==="never"||o==="-1"?!1:!((f=n.store)!=null&&f.lastSyncedAt)||Date.now()/1e3-n.store.lastSyncedAt>(parseInt(o,10)||300)},C.prototype._checkInitialSync=function(){const n=this,o=this.findChildren();o.store&&Promise.resolve(o.store.ready).then(()=>{if(n._destroyed)return;const s=n.findChildren();s.store&&s.connector&&!n._noAutosync(s)&&!s.store.isSyncing&&(!s.store.hasCache||n._isStale(s))&&s.store.forceSync()}).catch(s=>n._reportError("store-initialize",s,null))},C.prototype.refreshMapper=function(){var s,f;const n=this.dom.getAttribute("data-ln-data-coordinator-mapper")||this.dom.id,o=n&&((f=(s=window.lnCore)==null?void 0:s.getDataMapper)==null?void 0:f.call(s,n))||null;this.mapper={ingress:(o==null?void 0:o.ingress)||(w=>w),egress:(o==null?void 0:o.egress)||(w=>w)}},C.prototype.findChildren=function(){const n=this.dom.querySelector("[data-ln-data-store]"),o=A(this.dom),s=this.dom.querySelector("[data-ln-api-queue]");return{storeEl:n,connectorEl:o,queueEl:s,store:(n==null?void 0:n.lnDataStore)||null,connector:(o==null?void 0:o.lnConnector)||(o==null?void 0:o.lnApiConnector)||(o==null?void 0:o.lnCouchDbConnector)||(o==null?void 0:o.lnWebsocketConnector)||null,queue:(s==null?void 0:s.lnApiQueue)||null}},C.prototype._fanOutRemote=function(n,o,s,f){this.refreshMapper(),n.queue?g(n.queueEl,"ln-api-queue:request-enqueue",s):n.connector&&g(n.connectorEl,_(n.connectorEl)+":request-"+o,f)},C.prototype._fanOutCreate=function(n,o,s){const f="_temp_"+k(),w=this.mapper.egress(o);n.storeEl&&g(n.storeEl,"ln-data-store:request-create",{tempId:f,data:w}),this._fanOutRemote(n,"create",{chainKey:f,op:"create",targetId:null,payload:w,expectedVersion:null,meta:{tempId:f,action:s}},{data:w,url:s,meta:{entryId:k(),queued:!1,op:"create",tempId:f}})},C.prototype._fanOutUpdate=function(n,o,s,f,w){const y=this.mapper.egress(s);n.storeEl&&g(n.storeEl,"ln-data-store:request-update",{id:o,data:y}),this._fanOutRemote(n,"update",{chainKey:o,op:"update",targetId:o,payload:y,expectedVersion:f,meta:{id:o,action:w}},{id:o,data:y,expected_version:f,url:w,meta:{entryId:k(),queued:!1,op:"update",id:o}})},C.prototype._fanOutDelete=function(n,o){n.storeEl&&g(n.storeEl,"ln-data-store:request-delete",{id:o}),this._fanOutRemote(n,"delete",{chainKey:o,op:"delete",targetId:o,payload:null,expectedVersion:null,meta:{id:o}},{id:o,meta:{entryId:k(),queued:!1,op:"delete",id:o}})},C.prototype._fanOutBulkDelete=function(n,o){const s=o.join(",");n.storeEl&&g(n.storeEl,"ln-data-store:request-bulk-delete",{ids:o}),this._fanOutRemote(n,"bulk-delete",{chainKey:s,op:"bulk-delete",targetId:null,payload:{ids:o},expectedVersion:null,meta:{bulkKey:s,ids:o}},{ids:o,meta:{entryId:k(),queued:!1,op:"bulk-delete",bulkKey:s}})},C.prototype._requestStoreMutation=function(n,o,s){if(!n.storeEl)return Promise.reject(new Error("Store element not found"));const f=k(),w=this._mutationReceipts.wait(f);return g(n.storeEl,"ln-data-store:request-"+o,Object.assign({},s,{requestId:f})),w},C.prototype._reportError=function(n,o,s){this._destroyed||g(this.dom,"ln-data-coordinator:error",{operation:n,error:o,meta:s||null})},C.prototype._owns=function(n){var s;const o=this._name||((s=this.findChildren().storeEl)==null?void 0:s.id);return!!n&&n===o},C.prototype._currentQuery=function(){const n=this.dom.getAttribute(u),o=this.dom.getAttribute(c),s=new URLSearchParams(this.dom.getAttribute(l)||""),f={};for(const w of new Set(s.keys()))f[w]=s.getAll(w);return{search:this.dom.getAttribute(a)||"",filters:f,sort:n&&o?{field:n,direction:o}:null}},C.prototype._refreshAll=function(n,o){for(const[s,f,w]of m)for(const y of this.dom.ownerDocument.querySelectorAll(s))if(this._owns(y.getAttribute(f))){if((w==="table"||w==="list")&&y.hasAttribute(w==="table"?"data-ln-table-window":"data-ln-list-window")){g(y,"ln-"+w+(o?":request-invalidate":":request-revalidate"),{query:this._currentQuery()});continue}this._serveElement(y,w,null,n)}},C.prototype._serveElement=function(n,o,s,f){const w=this.findChildren(),y=w.store;if(!y)return;s&&this._boundQueries.set(n,s);const q=this._boundQueries.get(n)||{sort:null,filters:{},search:""},E=pe(q,this._currentQuery()),d=this;return Promise.resolve(y.ready).then(()=>{if(d._destroyed)return;const h=Ge(y,w.connector);if(o==="table"||o==="list"||o==="chart")return h==="remote"?(g(n,"ln-"+o+":set-loading",{loading:!0}),g(w.connectorEl,_(w.connectorEl)+":request-query",{query:E,meta:{targetEl:n,kind:o,offset:E.offset,limit:E.limit,queryGen:q.queryGen}})):h!=="store"?g(n,"ln-"+o+":set-loading",{loading:!1}):y.getAll(E).then(b=>{d._destroyed||!d._boundDelivered||(g(n,"ln-"+o+":set-loading",{loading:!1}),g(n,"ln-"+o+":set-data",{data:b.data,total:(f==null?void 0:f.total)??b.total,filtered:(f==null?void 0:f.filtered)??b.filtered,offset:b.offset??(f==null?void 0:f.offset)??q.offset,queryGen:q.queryGen!==void 0?q.queryGen:(f==null?void 0:f.queryGen)??b.queryGen,provisional:b.provisional===!0}),d._boundDelivered.set(n,!0))});if(o==="options"){if(h==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{},meta:{targetEl:n,kind:o}});if(h==="store")return y.getAll({}).then(b=>!d._destroyed&&g(n,"ln-options:set-data",{data:b.data}))}if(o==="stat"){let b=s==null?void 0:s.filters;if(!b){const S=n.getAttribute("data-ln-stat-filter");if(S!=null&&S.includes(":")){const x=S.split(":");b={[x[0].trim()]:[x.slice(1).join(":").trim()]}}}const v=w.connector&&y&&(y.windowed&&b&&Object.keys(b).length||y.noLocalQuery)?"remote":h;if(v==="remote")return g(w.connectorEl,_(w.connectorEl)+":request-query",{query:{filters:b},meta:{targetEl:n,kind:o}});if(v==="store")return y.count(b).then(S=>!d._destroyed&&g(n,"ln-stat:set-count",{count:S}))}}).catch(h=>{d._destroyed||((o==="table"||o==="list"||o==="chart")&&g(n,"ln-"+o+":set-loading",{loading:!1}),d._reportError(o+"-query",h,{targetEl:n,kind:o}))})};function N(n){const o=n._unsubs=[],s=(d,h,b)=>{d.addEventListener(h,b),o.push(()=>d.removeEventListener(h,b))};s(n.dom,"ln-data-store:request-remote-sync",d=>{n.refreshMapper();const h=n.findChildren();h.store&&h.connector&&g(h.connectorEl,_(h.connectorEl)+":request-sync",{since:d.detail.since,meta:{op:"sync"}})}),s(n.dom,"ln-data-store:request-page",d=>{const h=n.findChildren(),b=d.detail||{};if(!h.connectorEl)return;const v=pe(b.query||{},n._currentQuery());g(h.connectorEl,_(h.connectorEl)+":request-query",{query:Object.assign({},v,{offset:b.offset,limit:b.limit,queryGen:b.queryGen})})}),s(n.dom,"ln-data-coordinator:request-create",d=>n._fanOutCreate(n.findChildren(),d.detail.data||{},d.detail.action)),s(n.dom,"ln-data-coordinator:request-update",d=>n._fanOutUpdate(n.findChildren(),d.detail.id,d.detail.data||{},d.detail.expected_version,d.detail.action)),s(n.dom,"ln-data-coordinator:request-delete",d=>n._fanOutDelete(n.findChildren(),d.detail.id)),s(n.dom,"ln-data-coordinator:request-bulk-delete",d=>n._fanOutBulkDelete(n.findChildren(),d.detail.ids||[])),s(n.dom,"ln-api-queue:send",d=>n._onQueueSend(d.detail||{})),s(n.dom,"ln-api-queue:failed",d=>{var h;return n._reportError("queue-failed",((h=d==null?void 0:d.detail)==null?void 0:h.error)||new Error("Queue failed"),(d==null?void 0:d.detail)||null)}),s(n.dom,"ln-data-store:initialized",d=>{var b;const h=n.findChildren();h.store&&!h.store.initializationError&&h.connector&&!n._noAutosync(h)&&!h.store.isSyncing&&(!((b=d.detail)!=null&&b.hasCache)||n._isStale(h))&&h.store.forceSync()});const f=()=>{const d=n.findChildren();d.store&&!d.store.initializationError&&d.connector&&!n._noAutosync(d)&&d.store.isInitialized&&!d.store.isSyncing&&d.store.forceSync()};s(n.dom,"ln-websocket-connector:connected",f),s(document,"submit",d=>n._onFormSubmit(d));const w=(d,h,b)=>{var v;n._owns(d.target.getAttribute(b))&&n._serveElement(d.target,h,h==="stat"?{filters:((v=d.detail)==null?void 0:v.filters)||null}:h==="options"?null:Ue(d.detail||{}),null)};s(document,"ln-table:request-data",d=>w(d,"table","data-ln-table-source")),s(document,"ln-list:request-data",d=>w(d,"list","data-ln-list-source")),s(document,"ln-chart:request-data",d=>w(d,"chart","data-ln-chart-source")),s(document,"ln-options:request-data",d=>w(d,"options","data-ln-options")),s(document,"ln-stat:request-count",d=>w(d,"stat","data-ln-stat"));const y=d=>{n._mutationReceipts.resolve(d.detail),n._refreshAll(null,!1)};s(n.dom,"ln-data-store:ready",y),s(n.dom,"ln-data-store:created",y),s(n.dom,"ln-data-store:updated",y),s(n.dom,"ln-data-store:deleted",y),s(n.dom,"ln-data-store:mutation-error",d=>n._mutationReceipts.reject(d.detail)),s(n.dom,"ln-data-store:synced",d=>{var h;(h=d.detail)!=null&&h.changed&&n._refreshAll(d.detail.meta,!1)}),s(n.dom,"ln-data-store:query-changed",()=>n._refreshAll(null,!0)),s(n.dom,"ln-search:change",d=>{var b;d.preventDefault();const h=((b=d.detail)==null?void 0:b.term)!=null?d.detail.term:"";h!==(n.dom.getAttribute(a)||"")&&n.dom.setAttribute(a,h)}),s(n.dom,"ln-filter:change",d=>{var he;d.preventDefault();const h=(he=d.detail)==null?void 0:he.key;if(!h)return;const b=(d.detail.values||[]).slice(),v=n._currentQuery().filters,S=v[h];if(S?S.length===b.length&&S.every((R,U)=>R===b[U]):!b.length)return;b.length?v[h]=b:delete v[h];const x=new URLSearchParams;Object.keys(v).forEach(R=>v[R].forEach(U=>x.append(R,U)));const O=x.toString();O?n.dom.setAttribute(l,O):n.dom.removeAttribute(l)}),s(n.dom,"ln-sort:change",d=>{var x,O;d.preventDefault();const h=(x=d.detail)==null?void 0:x.field,b=(O=d.detail)==null?void 0:O.direction,v=h&&b&&b!=="none"?{field:h,direction:b}:null,S=n._currentQuery().sort;!S&&!v||S&&v&&S.field===v.field&&S.direction===v.direction||(v?(n.dom.setAttribute(u,v.field),n.dom.setAttribute(c,v.direction)):(n.dom.removeAttribute(u),n.dom.removeAttribute(c)))});const q=new Set(["ln-api-connector","ln-couchdb-connector","ln-websocket-connector","ln-connector"]),E=n.findChildren().connectorEl;if(E){const d=_(E);q.add(d),s(n.dom,d+":connected",f)}q.forEach(d=>{s(n.dom,d+":fetched",h=>n._reconcileServerFetch(h.detail)),s(n.dom,d+":created",h=>n._reconcileServerMutation("create",h.detail)),s(n.dom,d+":updated",h=>n._reconcileServerMutation("update",h.detail)),s(n.dom,d+":deleted",h=>n._reconcileServerMutation("ack",h.detail)),s(n.dom,d+":bulk-deleted",h=>n._reconcileServerMutation("ack",h.detail)),s(n.dom,d+":error",h=>n._reconcileServerMutation("error",h.detail))})}C.prototype._onQueueSend=function(n){this.refreshMapper();const o=this.findChildren();if(!o.store||!o.connector||!o.queue)return;const s=n.meta||{},f=_(o.connectorEl),w=n.idempotencyKey||n.entryId,y={create:()=>g(o.connectorEl,f+":request-create",{data:n.payload,url:s.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"create",tempId:s.tempId}}),update:()=>g(o.connectorEl,f+":request-update",{id:n.targetId,data:n.payload,expected_version:n.expectedVersion,url:s.action||null,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"update",id:n.targetId}}),delete:()=>g(o.connectorEl,f+":request-delete",{id:n.targetId,idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"delete",id:n.targetId}}),"bulk-delete":()=>{var q;return g(o.connectorEl,f+":request-bulk-delete",{ids:((q=n.payload)==null?void 0:q.ids)||[],idempotencyKey:w,meta:{entryId:n.entryId,queued:!0,op:"bulk-delete",bulkKey:s.bulkKey}})}};y[n.op]&&y[n.op]()},C.prototype._onFormSubmit=function(n){const o=n.target;if(n.defaultPrevented)return;const s=o.hasAttribute(r)?o.getAttribute(r):null;if(s===null||(s?!this._owns(s):o.closest("["+e+"]")!==this.dom))return;const f=K(o);if(f!=="POST"&&f!=="PUT"&&f!=="PATCH")return;n.preventDefault();const w=P(o);delete w._method,delete w._token;const y=w.id,q=w.expected_version,E=o.getAttribute("action")||"",d=this.findChildren();delete w.id,delete w.expected_version,f==="POST"?this._fanOutCreate(d,w,E):this._fanOutUpdate(d,y,w,q,E)},C.prototype._reconcileServerFetch=function(n){if(!n)return;const o=n.meta||{},s=this.findChildren(),f=n.data;this.refreshMapper();const w=Array.isArray(f)?f:(f==null?void 0:f.data)||[],y=Array.isArray(f==null?void 0:f.deleted)?f.deleted:[],q=Array.isArray(f)?Math.floor(Date.now()/1e3):(f==null?void 0:f.synced_at)??(f==null?void 0:f.since)??Math.floor(Date.now()/1e3),E=w.map(d=>this.mapper.ingress(d));if(!(!s.store||s.store.initializationError)){if(!o.kind)return s.store.applySync(E,y,q,{total:n.total,filtered:n.filtered,offset:n.offset,queryGen:n.queryGen,targetEl:o.targetEl});s.store.applyQuery(E,{total:n.total}).then(d=>{const h=o.kind;h==="table"||h==="list"||h==="chart"?(g(o.targetEl,"ln-"+h+":set-loading",{loading:!1}),g(o.targetEl,"ln-"+h+":set-data",{data:d,total:n.total??d.length,filtered:n.filtered??d.length,offset:n.offset,queryGen:o.queryGen}),this._boundDelivered.set(o.targetEl,!0)):h==="options"?s.store.getAll({}).then(b=>g(o.targetEl,"ln-options:set-data",{data:b.data})):h==="stat"&&g(o.targetEl,"ln-stat:set-count",{count:n.filtered??n.total??E.length})})}},C.prototype._reconcileServerMutation=function(n,o){var w;if(!o)return;const s=this.findChildren(),f=o.meta||{};if(n==="create"){if(!o.record)return this._reportError("create-empty-response",new Error("Create response missing record payload"),f);const y=this.mapper.ingress(o.record);(s.storeEl?this._requestStoreMutation(s,"update",{id:f.tempId,data:y}):Promise.resolve()).then(()=>{f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:resolve-create",{entryId:f.entryId,oldKey:f.tempId,newId:y.id})}).catch(q=>this._reportError("create-reconcile",q,f))}else if(n==="update"){const y=o.record?this.mapper.ingress(o.record):null;(s.storeEl&&y?this._requestStoreMutation(s,"update",{id:f.id,data:y}):Promise.resolve()).then(()=>{f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:ack",{entryId:f.entryId})}).catch(q=>this._reportError("update-reconcile",q,f))}else if(n==="ack")f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:ack",{entryId:f.entryId});else if(n==="error"){const y=o.status||((w=o.error)==null?void 0:w.status)||0;f.queued&&s.queue&&g(s.queueEl,"ln-api-queue:nack",{entryId:f.entryId,reason:y===401||y===419?"auth":y===0||y>=500?"retry":"drop"}),s.storeEl&&g(s.storeEl,"ln-data-store:request-sync-failed",{error:o.error||o,status:y}),this._reportError("connector-error",o.error||o,f)}},C.prototype.destroy=function(){var n;if(this.dom[t]){for(this._destroyed=!0;(n=this._unsubs)!=null&&n.length;)this._unsubs.pop()();this._unsubs=this._boundQueries=this._boundDelivered=this._queueQueryRefresh=null,this._mutationReceipts.close(new Error("Data coordinator destroyed")),this._mutationReceipts=null,delete this.dom[t]}};function Q(n,o){const s=n[t];s&&(o==="data-ln-data-coordinator-mapper"?s.refreshMapper():(o===a||o===l||o===u||o===c)&&s._queueQueryRefresh())}ue(e,t,C,"ln-data-coordinator",{extraAttributes:["data-ln-data-coordinator-mapper",a,l,u,c],onAttributeChange:Q}),window[t].init=window[t]})()})();
@@ -171,7 +171,7 @@ import { MutationReceipts } from './mutation-receipts';
171
171
  for (const el of this.dom.ownerDocument.querySelectorAll(sel)) {
172
172
  if (!this._owns(el.getAttribute(attr))) continue;
173
173
  if ((kind === 'table' || kind === 'list') && el.hasAttribute(kind === 'table' ? 'data-ln-table-window' : 'data-ln-list-window')) {
174
- dispatch(el, 'ln-' + kind + (isQueryChange ? ':request-invalidate' : ':request-revalidate'), {});
174
+ dispatch(el, 'ln-' + kind + (isQueryChange ? ':request-invalidate' : ':request-revalidate'), { query: this._currentQuery() });
175
175
  continue;
176
176
  }
177
177
  this._serveElement(el, kind, null, syncMeta);