@livenetworks/ashlar 2.0.10 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-ajax/src/ln-ajax.js +15 -26
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/helpers.js +1 -1
- package/components/ln-core/index.js +1 -1
- package/components/ln-core/lifecycle.js +97 -40
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-external-links/src/ln-external-links.js +9 -21
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-icon/ln-icon.js +1 -1
- package/components/ln-icon/src/ln-icon.js +14 -16
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-link/src/ln-link.js +16 -26
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-nav/src/ln-nav.js +5 -4
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-persist/ln-persist.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-progress/src/ln-progress.js +9 -21
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function L(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){o=t[r];break}if(!g(o))return}e.apply(console,t)}}function E(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function b(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){b(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 z(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,r={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const i=s[c];i.name&&i.type==="checkbox"&&!i.disabled&&(l[i.name]=(l[i.name]||0)+1)}for(let c=0;c<s.length;c++){const i=s[c];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(o&&i.matches&&i.matches(o)))if(i.type==="checkbox")n&&l[i.name]===1?r[i.name]=i.checked:(r[i.name]||(r[i.name]=[]),i.checked&&r[i.name].push(i.value));else if(i.type==="radio")i.checked&&(r[i.name]=i.value);else if(i.type==="select-multiple"){r[i.name]=[];for(let a=0;a<i.options.length;a++)i.options[a].selected&&r[i.name].push(i.options[a].value)}else if(n&&i.type==="hidden")r[i.name]=i.value;else if(n&&(i.type==="number"||i.type==="range")){const a=Number(i.value);r[i.name]=i.value===""||isNaN(a)?null:a}else r[i.name]=i.value}return r}function G(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function P(e,t){const n=e.elements,o=[],r={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(r[l.name]=(r[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const i=t[c];if(l.type==="checkbox"){if(Array.isArray(i))l.checked=i.indexOf(l.value)!==-1;else if(r[l.name]>1){const a=String(i).split(",").map(function(u){return u.trim()});l.checked=a.indexOf(l.value)!==-1}else l.checked=G(i);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(i),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(i))for(let a=0;a<l.options.length;a++)l.options[a].selected=i.indexOf(l.options[a].value)!==-1;o.push(l)}else l.value=i,l.tagName==="SELECT"&&i!=null&&l.setAttribute("data-ln-value",i),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=P,window.lnCore.serializeForm=z,window.lnCore.resolveFormMethod=K);const I={};function X(e,t){I[e]=t}function Y(e){return I[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=X,window.lnCore.getDataMapper=Y);function Z(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,b(function(){new MutationObserver(function(){E(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function ee(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];T[n]=t}function te(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ee,window.lnCore.getLocaleFallback=te,window.lnCore.ensureLocaleObserver=Z);const C={};function ne(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function $(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],i=c.getAttribute("data-ln-field");t[i]!=null&&(c.textContent=t[i])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const c=o[l],i=c.getAttribute("data-ln-attr").split(",");for(let a=0;a<i.length;a++){const u=i[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const r=e.querySelectorAll("[data-ln-show]");for(let l=0;l<r.length;l++){const c=r[l],i=c.getAttribute("data-ln-show");i in t&&c.classList.toggle("hidden",!t[i])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],i=c.getAttribute("data-ln-class").split(",");for(let a=0;a<i.length;a++){const u=i[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function oe(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)$(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function D(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const o=function(s,l){return t[l]!==void 0?t[l]:""},r=Array.from(e.querySelectorAll("*"));e.nodeType===1&&r.push(e);for(let s=0;s<r.length;s++){const l=r[s],c=l.attributes;for(let i=0;i<c.length;i++){const a=c[i];a.value.indexOf("{{")!==-1&&l.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function re(e,t,n,o,r,s){const l={};for(let i=0;i<e.children.length;i++){const a=e.children[i],u=a.getAttribute("data-ln-render-key");u&&(l[u]=a)}const c=document.createDocumentFragment();for(let i=0;i<t.length;i++){const a=t[i],u=String(o(a));let d=l[u];if(d)r(d,a,i);else{const f=ne(n,s);if(!f||(D(f,a),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),r(d,a,i)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=D,window.lnCore.fill=$,window.lnCore.lnFill=oe,window.lnCore.renderList=re);function m(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function F(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function N(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const r=o.trim().toLowerCase();return!(r==="false"||r==="0")}function q(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function M(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const o=new Set(e||[]),r=function(s,l){const c=s.getAttribute(l);return c!==null&&o.has(c)?c:t};return y.set(n,r),r}function R(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function B(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function j(e,t,n,o,r){if(!e||t===null)return!0;const s=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=i=>{r?console.warn(i,r):console.warn(i)};if(l==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const i=e.values||[];return i.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(c(`[${s}] Value ${i} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(c(`[${s}] Value ${i} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(i){return c(`[${s}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function ie(e,t,n){for(const o in n){const[r,s,l]=n[o];Object.defineProperty(e,o,{get:function(){return r(t,s,l)},enumerable:!0,configurable:!0})}return e}function le(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let r=o.read;if(!r&&o.type)switch(o.type){case"enum":r=M(o.values,o.fallback);break;case"integer":r=F;break;case"float":r=R;break;case"boolean":r=N;break;case"list":r=q;break;case"json":r=B;break;case"string":default:r=m;break}r||(r=m),t[o.prop]=[r,n,o.fallback]}return t}function se(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ce(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ie,window.lnCore.attrSpec=le,window.lnCore.attrStr=m,window.lnCore.attrInt=F,window.lnCore.attrBool=N,window.lnCore.attrList=q,window.lnCore.attrEnum=M,window.lnCore.attrFloat=R,window.lnCore.attrJson=B);function A(e,t,n,o){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&l.push(e);for(const c of l)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(i){console.error("["+n+"] init failed",c,i)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ae(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ue(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 W(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function de(e){const t=W(),n=e.observed||[];for(let o=0;o<n.length;o++){const r=n[o];t.byAttr.has(r)||t.byAttr.set(r,[]),t.byAttr.get(r).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const r=t.byDeclaredAttr.get(o);r.some(s=>s.componentTag===e.componentTag)||r.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ce(e);if(o===null)t.reactiveWildcard.push(e);else for(const r of o)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function U(e,t,n,o){for(let r=0;r<e.length;r++){const s=e[r];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,o):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,o)}}function fe(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=W(),r=o.byAttr.get(n);if(L()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&g(t)){const s=o.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let c=0;c<s.length;c++)j(s[c].spec,l,n,s[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||r)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=o.byReactive.get(n);s&&U(s,t,n,e.oldValue),o.reactiveWildcard.length&&U(o.reactiveWildcard,t,n,e.oldValue)}if(r)for(let s=0;s<r.length;s++){const l=r[s];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(A(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function we(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{fe(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function V(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function he(e){const t=V();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const r=o.query,s=e.target.nodeType===1?e.target.matches(r)?e.target:e.target.closest(r):e.target.parentElement?e.target.parentElement.closest(r):null;s&&o.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let r=0;r<t.length;r++){const s=t[r];A(o,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let r=0;r<t.length;r++){const s=t[r],l=s.query,c=Array.from(o.querySelectorAll(l));o.matches&&o.matches(l)&&c.push(o);for(let i=0;i<c.length;i++){const a=c[i];if(!document.contains(a)){const u=a[s.attribute];if(u&&typeof u.destroy=="function")try{u.destroy()}catch(d){console.error("["+s.attribute+"] destroy failed",a,d)}delete a[s.attribute]}}}}}}function be(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{he(o)}catch(r){console.error("[ln-core] lifecycle handler failed",o.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function H(e,t,n,o,r={}){const s=r.extraAttributes||[],l=r.onAttributeChange||null,c=r.onSubtreeChange||null,i=r.onInit||null,a=r.onAttrChange||null,u=r.effects||null,d=r.attributes||null,f=d?se(d):u,_e=d?new Set(Object.keys(d)):null,Se=r.persist||null;function p(k){const w=k||document.body;if(A(w,e,t,n),d&&L())for(const h in d){const Ee=d[h],_=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&_.push(w);for(let S=0;S<_.length;S++){const O=_[S];g(O)&&j(Ee,O.getAttribute(h),h,o,O)}}i&&i(w)}const v=[];if(e.indexOf("[")!==-1){const k=/\[([\w-]+)/g;let w;for(;(w=k.exec(e))!==null;)v.push(w[1])}else v.push(e);de({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:i,observed:v.concat(s),onAttributeChange:l,onAttrChange:a,effects:f,declared:_e,persist:Se}),we();const Oe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Le=r.subtreeQuery||(Oe?e:"["+e+"]");V().push({selector:e,attribute:t,ComponentFn:n,onInit:i,onSubtreeChange:c,query:Le}),be(),window[t]=p,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=H);function J(){ae()>0?ue(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",J):J(),p}function Q(e){return(e||"").replace(/^#/,"")}function x(e){const t=e===void 0?location.hash:e,n={},o=Q(t);if(!o)return n;const r=o.split("&");for(let s=0;s<r.length;s++){const l=r[s];if(!l)continue;const c=l.indexOf(":"),i=c>-1?l.slice(0,c):l,a=c>-1?l.slice(c+1):"";if(i)try{n[i]=decodeURIComponent(a)}catch{n[i]=a}}return n}function pe(e){if(!e)return null;const t=x();return e in t?t[e]:null}function ge(e,t){if(!e)return;const n=x();t==null?delete n[e]:n[e]=String(t);const r=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");Q(location.hash)!==r&&(location.hash=r)}function Ce(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function me(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function ye(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ae(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function xe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ve(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),r=o?o.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=x,window.lnCore.hashGet=pe,window.lnCore.hashSet=ge,window.lnCore.hashLinkClick=Ce,window.lnCore.resolveHashNamespace=me,window.lnCore.hashSortEncode=ye,window.lnCore.hashSortDecode=Ae,window.lnCore.hashFilterEncode=xe,window.lnCore.hashFilterDecode=ve);function ke(){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=ke),(function(){const e="data-ln-accordion",t="lnAccordion";if(window[t]!==void 0)return;const n={"data-ln-accordion":{type:"marker",description:"Identifies container as an accordion that coordinates single-panel expansion"}};function o(r){return this.dom=r,this._onToggleOpen=function(s){if(!s.detail||!s.detail.target||s.detail.target.closest("[data-ln-accordion]")!==r)return;const l=r.querySelectorAll("[data-ln-toggle]");for(const c of l)c!==s.detail.target&&c.closest("[data-ln-accordion]")===r&&c.getAttribute("data-ln-toggle")==="open"&&c.setAttribute("data-ln-toggle","close");E(r,"ln-accordion:change",{target:s.detail.target})},r.addEventListener("ln-toggle:open",this._onToggleOpen),this}o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-toggle:open",this._onToggleOpen),delete this.dom[t])},H(e,t,o,"ln-accordion",{attributes:n})})()})();
|
|
1
|
+
(function(){"use strict";function D(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function C(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let n=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){n=t[l];break}if(!C(n))return}e.apply(console,t)}}function I(e,t,o){const n=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,n),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function P(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function X(e,t){const o=!!(t&&t.typed),n=t&&t.exclude,l={},s=e.elements,i={};if(o)for(let c=0;c<s.length;c++){const r=s[c];r.name&&r.type==="checkbox"&&!r.disabled&&(i[r.name]=(i[r.name]||0)+1)}for(let c=0;c<s.length;c++){const r=s[c];if(!(!r.name||r.disabled||r.type==="file"||r.type==="submit"||r.type==="button")&&!(n&&r.matches&&r.matches(n)))if(r.type==="checkbox")o&&i[r.name]===1?l[r.name]=r.checked:(l[r.name]||(l[r.name]=[]),r.checked&&l[r.name].push(r.value));else if(r.type==="radio")r.checked&&(l[r.name]=r.value);else if(r.type==="select-multiple"){l[r.name]=[];for(let a=0;a<r.options.length;a++)r.options[a].selected&&l[r.name].push(r.options[a].value)}else if(o&&r.type==="hidden")l[r.name]=r.value;else if(o&&(r.type==="number"||r.type==="range")){const a=Number(r.value);l[r.name]=r.value===""||isNaN(a)?null:a}else l[r.name]=r.value}return l}function Y(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function Z(e,t){const o=e.elements,n=[],l={};for(let s=0;s<o.length;s++){const i=o[s];i.name&&i.type==="checkbox"&&(l[i.name]=(l[i.name]||0)+1)}for(let s=0;s<o.length;s++){const i=o[s];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const c=i.getAttribute("data-ln-fill-as")||i.name;if(!c||!(c in t))continue;const r=t[c];if(i.type==="checkbox"){if(Array.isArray(r))i.checked=r.indexOf(i.value)!==-1;else if(l[i.name]>1){const a=String(r).split(",").map(function(d){return d.trim()});i.checked=a.indexOf(i.value)!==-1}else i.checked=Y(r);n.push(i)}else if(i.type==="radio")i.checked=i.value===String(r),n.push(i);else if(i.type==="select-multiple"){if(Array.isArray(r))for(let a=0;a<i.options.length;a++)i.options[a].selected=r.indexOf(i.options[a].value)!==-1;n.push(i)}else i.value=r,i.tagName==="SELECT"&&r!=null&&i.setAttribute("data-ln-value",r),n.push(i)}return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=Z,window.lnCore.serializeForm=X,window.lnCore.resolveFormMethod=P);const q={};function ee(e,t){q[e]=t}function te(e){return q[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ee,window.lnCore.getDataMapper=te);function ne(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){I(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const T={};function oe(e,t){if(!e||typeof t!="object")return;const o=e.toLowerCase().split("-")[0];T[o]=t}function re(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return T[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=oe,window.lnCore.getLocaleFallback=re,window.lnCore.ensureLocaleObserver=ne);const m={};function ie(e,t){m[e]||(m[e]=document.querySelector('[data-ln-template="'+e+'"]'));const o=m[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let i=0;i<o.length;i++){const c=o[i],r=c.getAttribute("data-ln-field");t[r]!=null&&(c.textContent=t[r])}const n=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<n.length;i++){const c=n[i],r=c.getAttribute("data-ln-attr").split(",");for(let a=0;a<r.length;a++){const d=r[a].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();t[f]!=null&&c.setAttribute(u,t[f])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const c=l[i],r=c.getAttribute("data-ln-show");r in t&&c.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let i=0;i<s.length;i++){const c=s[i],r=c.getAttribute("data-ln-class").split(",");for(let a=0;a<r.length;a++){const d=r[a].trim().split(":");if(d.length!==2)continue;const u=d[0].trim(),f=d[1].trim();f in t&&c.classList.toggle(u,!!t[f])}}return e}function le(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let n=0;n<o.length;n++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[n],t??null),o[n].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)F(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let o=0;o<t.length;o++)t[o].textContent=""}})));function $(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const s=o.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,c){return t[c]!==void 0?t[c]:""}))}const n=function(s,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const i=l[s],c=i.attributes;for(let r=0;r<c.length;r++){const a=c[r];a.value.indexOf("{{")!==-1&&i.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,n))}}return e}function se(e,t,o,n,l,s){const i={};for(let r=0;r<e.children.length;r++){const a=e.children[r],d=a.getAttribute("data-ln-render-key");d&&(i[d]=a)}const c=document.createDocumentFragment();for(let r=0;r<t.length;r++){const a=t[r],d=String(n(a));let u=i[d];if(u)l(u,a,r);else{const f=ie(o,s);if(!f||($(f,a),u=f.firstElementChild,!u))continue;u.setAttribute("data-ln-render-key",d),l(u,a,r)}c.appendChild(u)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=F,window.lnCore.lnFill=le,window.lnCore.renderList=se);function y(e,t,o){const n=e.getAttribute(t);return n===null?o:n}function N(e,t,o){const n=parseInt(e.getAttribute(t),10);return isNaN(n)?o:n}function M(e,t,o=!1){const n=e.getAttribute(t);if(n===null)return!!o;const l=n.trim().toLowerCase();return!(l==="false"||l==="0")}function R(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const A=new Map;function B(e,t){const o=(e?e.join("|"):"")+"::"+t;if(A.has(o))return A.get(o);const n=new Set(e||[]),l=function(s,i){const c=s.getAttribute(i);return c!==null&&n.has(c)?c:t};return A.set(o,l),l}function j(e,t,o){const n=parseFloat(e.getAttribute(t));return isNaN(n)?o:n}function W(e,t,o){const n=e.getAttribute(t);if(!n)return o;try{return JSON.parse(n)}catch{return o}}function U(e,t,o,n,l){if(!e||t===null)return!0;const s=n||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const c=r=>{l?console.warn(r,l):console.warn(r)};if(i==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const r=e.values||[];return r.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${o}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(c(`[${s}] Value ${r} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(c(`[${s}] Value ${r} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(r){return c(`[${s}] Invalid JSON for attribute "${o}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function ce(e,t,o){for(const n in o){const[l,s,i]=o[n];Object.defineProperty(e,n,{get:function(){return l(t,s,i)},enumerable:!0,configurable:!0})}return e}function ae(e){const t={};for(const o in e){const n=e[o];if(!n||!n.prop)continue;let l=n.read;if(!l&&n.type)switch(n.type){case"enum":l=B(n.values,n.fallback);break;case"integer":l=N;break;case"float":l=j;break;case"boolean":l=M;break;case"list":l=R;break;case"json":l=W;break;case"string":default:l=y;break}l||(l=y),t[n.prop]=[l,o,n.fallback]}return t}function ue(e){const t={};for(const o in e){const n=e[o];n&&n.effect&&(t[o]=n.effect)}return Object.keys(t).length?t:null}function de(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const o in e.effects)t.add(o);if(e.onAttrChange&&e.declared)for(const o of e.declared)t.add(o);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ce,window.lnCore.attrSpec=ae,window.lnCore.attrStr=y,window.lnCore.attrInt=N,window.lnCore.attrBool=M,window.lnCore.attrList=R,window.lnCore.attrEnum=B,window.lnCore.attrFloat=j,window.lnCore.attrJson=W);function h(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(o){console.error("["+t.attribute+"] init failed",e,o)}}}function V(e,t,o,n){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:o,ComponentFn:n};if(e.matches&&e.matches(s)&&h(e,i),e.querySelectorAll){const c=e.querySelectorAll(s);for(let r=0;r<c.length;r++)h(c[r],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function fe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function we(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function H(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function he(e){const t=H(),o=e.observed||[];for(let n=0;n<o.length;n++){const l=o[n];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const n in e.attributes){t.byDeclaredAttr.has(n)||t.byDeclaredAttr.set(n,[]);const l=t.byDeclaredAttr.get(n);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[n],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const n=de(e);if(n===null)t.reactiveWildcard.push(e);else for(const l of n)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function Q(e,t,o,n){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const i=s.effects&&s.effects[o];i?i(t,o,n):s.onAttrChange&&(!s.declared||s.declared.has(o))&&s.onAttrChange(t,o,n)}}function be(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,n=H(),l=n.byAttr.get(t),s=D()&&n.byDeclaredAttr&&n.byDeclaredAttr.has(t);if(!o&&!l&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&C(i)){const c=n.byDeclaredAttr.get(t),r=i.getAttribute(t);for(let a=0;a<c.length;a++)U(c[a].spec,r,t,c[a].componentTag,i)}if(window.lnCore._debugSink&&(o||l)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),o){const c=n.byReactive.get(t);c&&Q(c,i,t,e.oldValue),n.reactiveWildcard.length&&Q(n.reactiveWildcard,i,t,e.oldValue)}if(l)for(let c=0;c<l.length;c++){const r=l[c];if(r.handler){r.handler(i,t,e.oldValue);continue}r.onAttributeChange&&i[r.attribute]?r.onAttributeChange(i,t):(V(i,r.selector,r.attribute,r.ComponentFn),r.onInit&&r.onInit(i))}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{be(t[o])}catch(n){console.error("[ln-core] mutation handler failed",t[o].target,n)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function x(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function v(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(n){console.error("["+t.attribute+"] destroy failed",e,n)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ge(e){const t=x();if(t.length){if(e.target)for(let o=0;o<t.length;o++){const n=t[o];if(n.onSubtreeChange&&n.query){const l=n.query,s=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;s&&n.onSubtreeChange(s,e)}}for(let o=0;o<e.addedNodes.length;o++){const n=e.addedNodes[o];if(n.nodeType===1){const l=!!(n.firstElementChild||n.children&&n.children.length);for(let s=0;s<t.length;s++){const i=t[s];if(i.selector&&i.attribute&&i.ComponentFn){if(!l)n.matches&&n.matches(i.query)&&h(n,i);else if(n.matches&&n.matches(i.query)&&h(n,i),n.querySelectorAll){const c=n.querySelectorAll(i.query);for(let r=0;r<c.length;r++)h(c[r],i)}}i.onInit&&i.onInit(n)}}}for(let o=0;o<e.removedNodes.length;o++){const n=e.removedNodes[o];if(n.nodeType===1){const l=!!(n.firstElementChild||n.children&&n.children.length);for(let s=0;s<t.length;s++){const i=t[s],c=i.query;if(c){if(!l)n.matches&&n.matches(c)&&v(n,i);else if(n.matches&&n.matches(c)&&v(n,i),n.querySelectorAll){const r=n.querySelectorAll(c);for(let a=0;a<r.length;a++)v(r[a],i)}}}}}}}function J(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const n=t[o];if(n.type==="childList")try{ge(n)}catch(l){console.error("[ln-core] lifecycle handler failed",n.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ce(e){x().push(e),J()}function K(e,t,o,n,l={}){const s=l.extraAttributes||[],i=l.onAttributeChange||null,c=l.onSubtreeChange||null,r=l.onInit||null,a=l.onAttrChange||null,d=l.effects||null,u=l.attributes||null,f=u?ue(u):d,Le=u?new Set(Object.keys(u)):null,Ee=l.persist||null;function g(S){const w=S||document.body;if(V(w,e,t,o),u&&D())for(const b in u){const qe=u[b],O=Array.from(w.querySelectorAll("["+b+"]"));w.matches&&w.matches("["+b+"]")&&O.push(w);for(let L=0;L<O.length;L++){const E=O[L];C(E)&&U(qe,E.getAttribute(b),b,n,E)}}r&&r(w)}const k=[];if(e.indexOf("[")!==-1){const S=/\[([\w-]+)/g;let w;for(;(w=S.exec(e))!==null;)k.push(w[1])}else k.push(e);he({selector:e,attribute:t,componentTag:n,attributes:u,ComponentFn:o,onInit:r,observed:k.concat(s),onAttributeChange:i,onAttrChange:a,effects:f,declared:Le,persist:Ee}),pe();const De=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ie=l.subtreeQuery||(De?e:"["+e+"]");x().push({selector:e,attribute:t,ComponentFn:o,onInit:r,onSubtreeChange:c,query:Ie}),J(),window[t]=g,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=K,window.lnCore.observeLifecycle=Ce);function G(){fe()>0?we(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",G):G(),g}function z(e){return(e||"").replace(/^#/,"")}function _(e){const t=e===void 0?location.hash:e,o={},n=z(t);if(!n)return o;const l=n.split("&");for(let s=0;s<l.length;s++){const i=l[s];if(!i)continue;const c=i.indexOf(":"),r=c>-1?i.slice(0,c):i,a=c>-1?i.slice(c+1):"";if(r)try{o[r]=decodeURIComponent(a)}catch{o[r]=a}}return o}function me(e){if(!e)return null;const t=_();return e in t?t[e]:null}function ye(e,t){if(!e)return;const o=_();t==null?delete o[e]:o[e]=String(t);const l=Object.keys(o).map(function(s){const i=o[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");z(location.hash)!==l&&(location.hash=l)}function Ae(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function xe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const n=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return n?t?n+"-"+t:n:t||null}function ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function _e(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ke(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Se(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const o=e.slice(0,t),n=e.slice(t+1),l=n?n.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:o,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=me,window.lnCore.hashSet=ye,window.lnCore.hashLinkClick=Ae,window.lnCore.resolveHashNamespace=xe,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=_e,window.lnCore.hashFilterEncode=ke,window.lnCore.hashFilterDecode=Se);function Oe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Oe),(function(){const e="data-ln-accordion",t="lnAccordion";if(window[t]!==void 0)return;const o={"data-ln-accordion":{type:"marker",description:"Identifies container as an accordion that coordinates single-panel expansion"}};function n(l){return this.dom=l,this._onToggleOpen=function(s){if(!s.detail||!s.detail.target||s.detail.target.closest("[data-ln-accordion]")!==l)return;const i=l.querySelectorAll("[data-ln-toggle]");for(const c of i)c!==s.detail.target&&c.closest("[data-ln-accordion]")===l&&c.getAttribute("data-ln-toggle")==="open"&&c.setAttribute("data-ln-toggle","close");I(l,"ln-accordion:change",{target:s.detail.target})},l.addEventListener("ln-toggle:open",this._onToggleOpen),this}n.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-toggle:open",this._onToggleOpen),delete this.dom[t])},K(e,t,n,"ln-accordion",{attributes:o})})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function Q(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function N(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let r=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){r=t[l];break}if(!N(r))return}e.apply(console,t)}}function A(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function Y(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r);const l=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});return e.dispatchEvent(l),l}function E(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function Z(e,t){if(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||e.button!==0||!t)return!1;const n=t.getAttribute("href");return!(!n||t.getAttribute("target")==="_blank"||t.hasAttribute("download")||n.startsWith("mailto:")||n.startsWith("tel:")||n==="#"||n.startsWith("#")||t.hostname&&t.hostname!==window.location.hostname)}function ee(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function te(e,t){const n=!!(t&&t.typed),r=t&&t.exclude,l={},a=e.elements,o={};if(n)for(let s=0;s<a.length;s++){const i=a[s];i.name&&i.type==="checkbox"&&!i.disabled&&(o[i.name]=(o[i.name]||0)+1)}for(let s=0;s<a.length;s++){const i=a[s];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(r&&i.matches&&i.matches(r)))if(i.type==="checkbox")n&&o[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 f=0;f<i.options.length;f++)i.options[f].selected&&l[i.name].push(i.options[f].value)}else if(n&&i.type==="hidden")l[i.name]=i.value;else if(n&&(i.type==="number"||i.type==="range")){const f=Number(i.value);l[i.name]=i.value===""||isNaN(f)?null:f}else l[i.name]=i.value}return l}function ne(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function re(e,t){const n=e.elements,r=[],l={};for(let a=0;a<n.length;a++){const o=n[a];o.name&&o.type==="checkbox"&&(l[o.name]=(l[o.name]||0)+1)}for(let a=0;a<n.length;a++){const o=n[a];if(o.type==="file"||o.type==="submit"||o.type==="button")continue;const s=o.getAttribute("data-ln-fill-as")||o.name;if(!s||!(s in t))continue;const i=t[s];if(o.type==="checkbox"){if(Array.isArray(i))o.checked=i.indexOf(o.value)!==-1;else if(l[o.name]>1){const f=String(i).split(",").map(function(b){return b.trim()});o.checked=f.indexOf(o.value)!==-1}else o.checked=ne(i);r.push(o)}else if(o.type==="radio")o.checked=o.value===String(i),r.push(o);else if(o.type==="select-multiple"){if(Array.isArray(i))for(let f=0;f<o.options.length;f++)o.options[f].selected=i.indexOf(o.options[f].value)!==-1;r.push(o)}else o.value=i,o.tagName==="SELECT"&&i!=null&&o.setAttribute("data-ln-value",i),r.push(o)}return r}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=re,window.lnCore.serializeForm=te,window.lnCore.resolveFormMethod=ee);const M={};function oe(e,t){M[e]=t}function ie(e){return M[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=oe,window.lnCore.getDataMapper=ie);function le(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,E(function(){new MutationObserver(function(){A(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const q={};function ae(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];q[n]=t}function se(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return q[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ae,window.lnCore.getLocaleFallback=se,window.lnCore.ensureLocaleObserver=le);const O={};function ue(e,t){O[e]||(O[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=O[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function W(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let o=0;o<n.length;o++){const s=n[o],i=s.getAttribute("data-ln-field");t[i]!=null&&(s.textContent=t[i])}const r=e.querySelectorAll("[data-ln-attr]");for(let o=0;o<r.length;o++){const s=r[o],i=s.getAttribute("data-ln-attr").split(",");for(let f=0;f<i.length;f++){const b=i[f].trim().split(":");if(b.length!==2)continue;const h=b[0].trim(),u=b[1].trim();t[u]!=null&&s.setAttribute(h,t[u])}}const l=e.querySelectorAll("[data-ln-show]");for(let o=0;o<l.length;o++){const s=l[o],i=s.getAttribute("data-ln-show");i in t&&s.classList.toggle("hidden",!t[i])}const a=e.querySelectorAll("[data-ln-class]");for(let o=0;o<a.length;o++){const s=a[o],i=s.getAttribute("data-ln-class").split(",");for(let f=0;f<i.length;f++){const b=i[f].trim().split(":");if(b.length!==2)continue;const h=b[0].trim(),u=b[1].trim();u in t&&s.classList.toggle(h,!!t[u])}}return e}function ce(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)W(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function B(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const a=n.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(o,s){return t[s]!==void 0?t[s]:""}))}const r=function(a,o){return t[o]!==void 0?t[o]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let a=0;a<l.length;a++){const o=l[a],s=o.attributes;for(let i=0;i<s.length;i++){const f=s[i];f.value.indexOf("{{")!==-1&&o.setAttribute(f.name,f.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function fe(e,t,n,r,l,a){const o={};for(let i=0;i<e.children.length;i++){const f=e.children[i],b=f.getAttribute("data-ln-render-key");b&&(o[b]=f)}const s=document.createDocumentFragment();for(let i=0;i<t.length;i++){const f=t[i],b=String(r(f));let h=o[b];if(h)l(h,f,i);else{const u=ue(n,a);if(!u||(B(u,f),h=u.firstElementChild,!h))continue;h.setAttribute("data-ln-render-key",b),l(h,f,i)}s.appendChild(h)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=W,window.lnCore.lnFill=ce,window.lnCore.renderList=fe);function D(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function U(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function R(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const l=r.trim().toLowerCase();return!(l==="false"||l==="0")}function V(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const F=new Map;function K(e,t){const n=(e?e.join("|"):"")+"::"+t;if(F.has(n))return F.get(n);const r=new Set(e||[]),l=function(a,o){const s=a.getAttribute(o);return s!==null&&r.has(s)?s:t};return F.set(n,l),l}function G(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function H(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function de(e,t,n,r,l){if(!e||t===null)return!0;const a=r||"ln-component",o=e.type;if(o==="trigger"||o==="marker"||o==="string"||o==="list"||!o||t===""&&e.fallback!==void 0)return!0;const s=i=>{l?console.warn(i,l):console.warn(i)};if(o==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(s(`[${a}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(o==="enum"){const i=e.values||[];return i.includes(t)?!0:(s(`[${a}] Invalid value "${t}" for attribute "${n}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(o==="integer"){if(!/^-?\d+$/.test(t))return s(`[${a}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(s(`[${a}] Value ${i} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(s(`[${a}] Value ${i} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(o==="float")return isNaN(Number(t))?(s(`[${a}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(o==="json")try{return JSON.parse(t),!0}catch(i){return s(`[${a}] Invalid JSON for attribute "${n}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function we(e,t,n){for(const r in n){const[l,a,o]=n[r];Object.defineProperty(e,r,{get:function(){return l(t,a,o)},enumerable:!0,configurable:!0})}return e}function pe(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let l=r.read;if(!l&&r.type)switch(r.type){case"enum":l=K(r.values,r.fallback);break;case"integer":l=U;break;case"float":l=G;break;case"boolean":l=R;break;case"list":l=V;break;case"json":l=H;break;case"string":default:l=D;break}l||(l=D),t[r.prop]=[l,n,r.fallback]}return t}function be(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=we,window.lnCore.attrSpec=pe,window.lnCore.attrStr=D,window.lnCore.attrInt=U,window.lnCore.attrBool=R,window.lnCore.attrList=V,window.lnCore.attrEnum=K,window.lnCore.attrFloat=G,window.lnCore.attrJson=H);function he(e,t,n,r){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",o=Array.from(e.querySelectorAll(a));e.matches&&e.matches(a)&&o.push(e);for(const s of o)if(!s[n]){window.lnCore._persistSink&&s.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(s,t);try{s[n]=new r(s)}catch(i){console.error("["+n+"] init failed",s,i)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function J(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ge(e){const t=J(),n=e.observed||[];for(let r=0;r<n.length;r++){const l=n[r];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const l=t.byDeclaredAttr.get(r);l.some(a=>a.componentTag===e.componentTag)||l.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=be(e);if(r===null)t.reactiveWildcard.push(e);else for(const l of r)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function P(e,t,n,r){for(let l=0;l<e.length;l++){const a=e[l];if(!t[a.attribute])continue;const o=a.effects&&a.effects[n];o?o(t,n,r):a.onAttrChange&&(!a.declared||a.declared.has(n))&&a.onAttrChange(t,n,r)}}function me(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=J(),l=r.byAttr.get(n);if(Q()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&N(t)){const a=r.byDeclaredAttr.get(n),o=t.getAttribute(n);for(let s=0;s<a.length;s++)de(a[s].spec,o,n,a[s].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||l)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const a=r.byReactive.get(n);a&&P(a,t,n,e.oldValue),r.reactiveWildcard.length&&P(r.reactiveWildcard,t,n,e.oldValue)}if(l)for(let a=0;a<l.length;a++){const o=l[a];if(o.handler){o.handler(t,n,e.oldValue);continue}o.onAttributeChange&&t[o.attribute]?o.onAttributeChange(t,n):(he(t,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(t))}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,E(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{me(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function ye(e,t){ge({observed:e,handler:t}),Ce()}function X(e){return(e||"").replace(/^#/,"")}function $(e){const t=e===void 0?location.hash:e,n={},r=X(t);if(!r)return n;const l=r.split("&");for(let a=0;a<l.length;a++){const o=l[a];if(!o)continue;const s=o.indexOf(":"),i=s>-1?o.slice(0,s):o,f=s>-1?o.slice(s+1):"";if(i)try{n[i]=decodeURIComponent(f)}catch{n[i]=f}}return n}function Ae(e){if(!e)return null;const t=$();return e in t?t[e]:null}function xe(e,t){if(!e)return;const n=$();t==null?delete n[e]:n[e]=String(t);const l=Object.keys(n).map(function(a){const o=n[a];return o===""?a:a+":"+encodeURIComponent(o)}).join("&");X(location.hash)!==l&&(location.hash=l)}function ke(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ve(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function Se(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function _e(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ee(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Te(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),l=r?r.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:n,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=$,window.lnCore.hashGet=Ae,window.lnCore.hashSet=xe,window.lnCore.hashLinkClick=ke,window.lnCore.resolveHashNamespace=ve,window.lnCore.hashSortEncode=Se,window.lnCore.hashSortDecode=_e,window.lnCore.hashFilterEncode=Ee,window.lnCore.hashFilterDecode=Te);function Le(){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=Le),(function(){const e="data-ln-ajax",t="lnAjax",n="data-ln-data-coordinator-scope";if(window[t]!==void 0)return;let r=null;function l(u){if(!u.hasAttribute(e)||u[t])return;u[t]=!0;const c=f(u);a(c.links),o(c.forms)}function a(u){for(const c of u){if(c[t+"Trigger"]||c.hostname&&c.hostname!==window.location.hostname)continue;const w=c.getAttribute("href");if(w&&w.includes("#"))continue;const d=function(m){if(!Z(m,c))return;m.preventDefault();const C=c.getAttribute("href");C&&i("GET",C,null,c)};c.addEventListener("click",d),c[t+"Trigger"]=d}}function o(u){for(const c of u){if(c[t+"Trigger"])continue;if(c.hasAttribute(n)){c[t+"ScopeWarned"]||(c[t+"ScopeWarned"]=!0,console.warn("[ln-ajax] Form has data-ln-data-coordinator-scope — the ln-data-coordinator write pipeline takes precedence; skipping ajax interception for this form."));continue}const w=function(d){if(d.defaultPrevented)return;d.preventDefault();const m=c.method.toUpperCase(),C=c.action,T=new FormData(c);for(const k of c.querySelectorAll('button, input[type="submit"]'))k.disabled=!0;i(m,C,T,c,function(){for(const k of c.querySelectorAll('button, input[type="submit"]'))k.disabled=!1})};c.addEventListener("submit",w),c[t+"Trigger"]=w}}function s(u){if(!u[t])return;const c=f(u);for(const w of c.links)w[t+"Trigger"]&&(w.removeEventListener("click",w[t+"Trigger"]),delete w[t+"Trigger"]);for(const w of c.forms)w[t+"Trigger"]&&(w.removeEventListener("submit",w[t+"Trigger"]),delete w[t+"Trigger"]);delete u[t]}function i(u,c,w,d,m){if(Y(d,"ln-ajax:before-start",{method:u,url:c}).defaultPrevented)return;u==="GET"&&r&&r(),A(d,"ln-ajax:start",{method:u,url:c}),d.classList.add("ln-ajax--loading");const T=document.createElement("span");T.className="ln-ajax-spinner",d.appendChild(T);function k(){d.classList.remove("ln-ajax--loading");const p=d.querySelector(".ln-ajax-spinner");p&&p.remove(),m&&m()}let y=c;const z=document.querySelector('meta[name="csrf-token"]'),L=z?z.getAttribute("content"):null;w instanceof FormData&&L&&w.append("_token",L);const j={method:u,headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}};if(L&&(j.headers["X-CSRF-TOKEN"]=L),u==="GET"&&w){const p=new URLSearchParams(w);y=c+(c.includes("?")?"&":"?")+p.toString()}else u!=="GET"&&w&&(j.body=w);let v=null;if(u==="GET"){const p=new AbortController;j.signal=p.signal,v=function(){r=null,p.abort(),k(),A(d,"ln-ajax:aborted",{method:u,url:y})},r=v}fetch(y,j).then(function(p){const I=p.ok,g=p.status;return p.text().then(function(S){let x=null,_=null;if(S&&S.trim())try{x=JSON.parse(S)}catch(je){_=je}return{ok:I,status:g,data:x,parseError:_}})}).then(function(p){v&&r===v&&(r=null);const I=p.status,g=p.data,S=p.parseError;if(p.ok&&!S){if(g&&g.title&&(document.title=g.title),g&&g.content)for(const x in g.content){const _=document.getElementById(x);_&&(_.innerHTML=g.content[x])}if(d.tagName==="A"){const x=d.getAttribute("href");x&&window.history.pushState({ajax:!0},"",x)}else d.tagName==="FORM"&&d.method.toUpperCase()==="GET"&&window.history.pushState({ajax:!0},"",y);A(d,"ln-ajax:success",{method:u,url:y,data:g})}else A(d,"ln-ajax:error",{method:u,url:y,status:I,data:g,error:S||null});k(),A(d,"ln-ajax:complete",{method:u,url:y})}).catch(function(p){p&&p.name==="AbortError"||(v&&r===v&&(r=null),A(d,"ln-ajax:error",{method:u,url:y,status:0,data:null,error:p}),k(),A(d,"ln-ajax:complete",{method:u,url:y}))})}function f(u){const c={links:[],forms:[]};return u.tagName==="A"&&u.getAttribute(e)!=="false"?c.links.push(u):u.tagName==="FORM"&&u.getAttribute(e)!=="false"?c.forms.push(u):(c.links=Array.from(u.querySelectorAll('a:not([data-ln-ajax="false"])')),c.forms=Array.from(u.querySelectorAll('form:not([data-ln-ajax="false"])'))),c}function b(){E(function(){new MutationObserver(function(c){for(const w of c)if(w.type==="childList"){for(const d of w.addedNodes)if(d.nodeType===1&&(l(d),!d.hasAttribute(e))){for(const C of d.querySelectorAll("["+e+"]"))l(C);const m=d.closest&&d.closest("["+e+"]");if(m&&m.getAttribute(e)!=="false"){const C=f(d);a(C.links),o(C.forms)}}}}).observe(document.body,{childList:!0,subtree:!0}),ye([e],function(c){l(c)})},"ln-ajax")}function h(){for(const u of document.querySelectorAll("["+e+"]"))l(u)}window[t]=l,window[t].destroy=s,b(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",h):h()})()})();
|
|
1
|
+
(function(){"use strict";function ee(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function M(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let n=null;for(let l=1;l<t.length;l++)if(t[l]&&t[l].nodeType===1){n=t[l];break}if(!M(n))return}e.apply(console,t)}}function y(e,t,r){const n=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,n),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function te(e,t,r){const n=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,n);const l=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});return e.dispatchEvent(l),l}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 ne(e,t){if(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||e.button!==0||!t)return!1;const r=t.getAttribute("href");return!(!r||t.getAttribute("target")==="_blank"||t.hasAttribute("download")||r.startsWith("mailto:")||r.startsWith("tel:")||r==="#"||r.startsWith("#")||t.hostname&&t.hostname!==window.location.hostname)}function re(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function oe(e,t){const r=!!(t&&t.typed),n=t&&t.exclude,l={},s=e.elements,i={};if(r)for(let a=0;a<s.length;a++){const o=s[a];o.name&&o.type==="checkbox"&&!o.disabled&&(i[o.name]=(i[o.name]||0)+1)}for(let a=0;a<s.length;a++){const o=s[a];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(n&&o.matches&&o.matches(n)))if(o.type==="checkbox")r&&i[o.name]===1?l[o.name]=o.checked:(l[o.name]||(l[o.name]=[]),o.checked&&l[o.name].push(o.value));else if(o.type==="radio")o.checked&&(l[o.name]=o.value);else if(o.type==="select-multiple"){l[o.name]=[];for(let u=0;u<o.options.length;u++)o.options[u].selected&&l[o.name].push(o.options[u].value)}else if(r&&o.type==="hidden")l[o.name]=o.value;else if(r&&(o.type==="number"||o.type==="range")){const u=Number(o.value);l[o.name]=o.value===""||isNaN(u)?null:u}else l[o.name]=o.value}return l}function ie(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function le(e,t){const r=e.elements,n=[],l={};for(let s=0;s<r.length;s++){const i=r[s];i.name&&i.type==="checkbox"&&(l[i.name]=(l[i.name]||0)+1)}for(let s=0;s<r.length;s++){const i=r[s];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const a=i.getAttribute("data-ln-fill-as")||i.name;if(!a||!(a in t))continue;const o=t[a];if(i.type==="checkbox"){if(Array.isArray(o))i.checked=o.indexOf(i.value)!==-1;else if(l[i.name]>1){const u=String(o).split(",").map(function(p){return p.trim()});i.checked=u.indexOf(i.value)!==-1}else i.checked=ie(o);n.push(i)}else if(i.type==="radio")i.checked=i.value===String(o),n.push(i);else if(i.type==="select-multiple"){if(Array.isArray(o))for(let u=0;u<i.options.length;u++)i.options[u].selected=o.indexOf(i.options[u].value)!==-1;n.push(i)}else i.value=o,i.tagName==="SELECT"&&o!=null&&i.setAttribute("data-ln-value",o),n.push(i)}return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=le,window.lnCore.serializeForm=oe,window.lnCore.resolveFormMethod=re);const W={};function se(e,t){W[e]=t}function ae(e){return W[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=se,window.lnCore.getDataMapper=ae);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,S(function(){new MutationObserver(function(){y(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const B={};function ue(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];B[r]=t}function fe(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=ue,window.lnCore.getLocaleFallback=fe,window.lnCore.ensureLocaleObserver=ce);const D={};function de(e,t){D[e]||(D[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=D[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function R(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let i=0;i<r.length;i++){const a=r[i],o=a.getAttribute("data-ln-field");t[o]!=null&&(a.textContent=t[o])}const n=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<n.length;i++){const a=n[i],o=a.getAttribute("data-ln-attr").split(",");for(let u=0;u<o.length;u++){const p=o[u].trim().split(":");if(p.length!==2)continue;const b=p[0].trim(),c=p[1].trim();t[c]!=null&&a.setAttribute(b,t[c])}}const l=e.querySelectorAll("[data-ln-show]");for(let i=0;i<l.length;i++){const a=l[i],o=a.getAttribute("data-ln-show");o in t&&a.classList.toggle("hidden",!t[o])}const s=e.querySelectorAll("[data-ln-class]");for(let i=0;i<s.length;i++){const a=s[i],o=a.getAttribute("data-ln-class").split(",");for(let u=0;u<o.length;u++){const p=o[u].trim().split(":");if(p.length!==2)continue;const b=p[0].trim(),c=p[1].trim();c in t&&a.classList.toggle(b,!!t[c])}}return e}function we(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let n=0;n<r.length;n++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[n],t??null),r[n].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)R(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let r=0;r<t.length;r++)t[r].textContent=""}})));function U(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const s=r.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,a){return t[a]!==void 0?t[a]:""}))}const n=function(s,i){return t[i]!==void 0?t[i]:""},l=Array.from(e.querySelectorAll("*"));e.nodeType===1&&l.push(e);for(let s=0;s<l.length;s++){const i=l[s],a=i.attributes;for(let o=0;o<a.length;o++){const u=a[o];u.value.indexOf("{{")!==-1&&i.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,n))}}return e}function he(e,t,r,n,l,s){const i={};for(let o=0;o<e.children.length;o++){const u=e.children[o],p=u.getAttribute("data-ln-render-key");p&&(i[p]=u)}const a=document.createDocumentFragment();for(let o=0;o<t.length;o++){const u=t[o],p=String(n(u));let b=i[p];if(b)l(b,u,o);else{const c=de(r,s);if(!c||(U(c,u),b=c.firstElementChild,!b))continue;b.setAttribute("data-ln-render-key",p),l(b,u,o)}a.appendChild(b)}e.textContent="",e.appendChild(a)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=U,window.lnCore.fill=R,window.lnCore.lnFill=we,window.lnCore.renderList=he);function q(e,t,r){const n=e.getAttribute(t);return n===null?r:n}function V(e,t,r){const n=parseInt(e.getAttribute(t),10);return isNaN(n)?r:n}function K(e,t,r=!1){const n=e.getAttribute(t);if(n===null)return!!r;const l=n.trim().toLowerCase();return!(l==="false"||l==="0")}function G(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const F=new Map;function H(e,t){const r=(e?e.join("|"):"")+"::"+t;if(F.has(r))return F.get(r);const n=new Set(e||[]),l=function(s,i){const a=s.getAttribute(i);return a!==null&&n.has(a)?a:t};return F.set(r,l),l}function J(e,t,r){const n=parseFloat(e.getAttribute(t));return isNaN(n)?r:n}function P(e,t,r){const n=e.getAttribute(t);if(!n)return r;try{return JSON.parse(n)}catch{return r}}function pe(e,t,r,n,l){if(!e||t===null)return!0;const s=n||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const a=o=>{l?console.warn(o,l):console.warn(o)};if(i==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(a(`[${s}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const o=e.values||[];return o.includes(t)?!0:(a(`[${s}] Invalid value "${t}" for attribute "${r}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return a(`[${s}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(a(`[${s}] Value ${o} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(a(`[${s}] Value ${o} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(a(`[${s}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(o){return a(`[${s}] Invalid JSON for attribute "${r}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function be(e,t,r){for(const n in r){const[l,s,i]=r[n];Object.defineProperty(e,n,{get:function(){return l(t,s,i)},enumerable:!0,configurable:!0})}return e}function ge(e){const t={};for(const r in e){const n=e[r];if(!n||!n.prop)continue;let l=n.read;if(!l&&n.type)switch(n.type){case"enum":l=H(n.values,n.fallback);break;case"integer":l=V;break;case"float":l=J;break;case"boolean":l=K;break;case"list":l=G;break;case"json":l=P;break;case"string":default:l=q;break}l||(l=q),t[n.prop]=[l,r,n.fallback]}return t}function me(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=be,window.lnCore.attrSpec=ge,window.lnCore.attrStr=q,window.lnCore.attrInt=V,window.lnCore.attrBool=K,window.lnCore.attrList=G,window.lnCore.attrEnum=H,window.lnCore.attrFloat=J,window.lnCore.attrJson=P);function _(e,t){if(!e[t.attribute]){window.lnCore._persistSink&&e.hasAttribute&&e.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(e,t.selector);try{e[t.attribute]=new t.ComponentFn(e)}catch(r){console.error("["+t.attribute+"] init failed",e,r)}}}function ye(e,t,r,n){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i={selector:t,attribute:r,ComponentFn:n};if(e.matches&&e.matches(s)&&_(e,i),e.querySelectorAll){const a=e.querySelectorAll(s);for(let o=0;o<a.length;o++)_(a[o],i)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function X(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function Ce(e){const t=X(),r=e.observed||[];for(let n=0;n<r.length;n++){const l=r[n];t.byAttr.has(l)||t.byAttr.set(l,[]),t.byAttr.get(l).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const n in e.attributes){t.byDeclaredAttr.has(n)||t.byDeclaredAttr.set(n,[]);const l=t.byDeclaredAttr.get(n);l.some(s=>s.componentTag===e.componentTag)||l.push({spec:e.attributes[n],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const n=me(e);if(n===null)t.reactiveWildcard.push(e);else for(const l of n)t.byReactive.has(l)||t.byReactive.set(l,[]),t.byReactive.get(l).push(e)}e.persist&&t.persist.push(e)}function z(e,t,r,n){for(let l=0;l<e.length;l++){const s=e[l];if(!t[s.attribute])continue;const i=s.effects&&s.effects[r];i?i(t,r,n):s.onAttrChange&&(!s.declared||s.declared.has(r))&&s.onAttrChange(t,r,n)}}function Ae(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,n=X(),l=n.byAttr.get(t),s=ee()&&n.byDeclaredAttr&&n.byDeclaredAttr.has(t);if(!r&&!l&&!s)return;const i=e.target;if(e.oldValue!==i.getAttribute(t)){if(s&&M(i)){const a=n.byDeclaredAttr.get(t),o=i.getAttribute(t);for(let u=0;u<a.length;u++)pe(a[u].spec,o,t,a[u].componentTag,i)}if(window.lnCore._debugSink&&(r||l)&&window.lnCore._debugSink("attr",t,i,{oldValue:e.oldValue,newValue:i.getAttribute(t)}),r){const a=n.byReactive.get(t);a&&z(a,i,t,e.oldValue),n.reactiveWildcard.length&&z(n.reactiveWildcard,i,t,e.oldValue)}if(l)for(let a=0;a<l.length;a++){const o=l[a];if(o.handler){o.handler(i,t,e.oldValue);continue}o.onAttributeChange&&i[o.attribute]?o.onAttributeChange(i,t):(ye(i,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(i))}}}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{Ae(t[r])}catch(n){console.error("[ln-core] mutation handler failed",t[r].target,n)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function Q(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}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(n){console.error("["+t.attribute+"] destroy failed",e,n)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ke(e){const t=Q();if(t.length){if(e.target)for(let r=0;r<t.length;r++){const n=t[r];if(n.onSubtreeChange&&n.query){const l=n.query,s=e.target.nodeType===1?e.target.matches&&e.target.matches(l)?e.target:e.target.closest?e.target.closest(l):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(l):null;s&&n.onSubtreeChange(s,e)}}for(let r=0;r<e.addedNodes.length;r++){const n=e.addedNodes[r];if(n.nodeType===1){const l=!!(n.firstElementChild||n.children&&n.children.length);for(let s=0;s<t.length;s++){const i=t[s];if(i.selector&&i.attribute&&i.ComponentFn){if(!l)n.matches&&n.matches(i.query)&&_(n,i);else if(n.matches&&n.matches(i.query)&&_(n,i),n.querySelectorAll){const a=n.querySelectorAll(i.query);for(let o=0;o<a.length;o++)_(a[o],i)}}i.onInit&&i.onInit(n)}}}for(let r=0;r<e.removedNodes.length;r++){const n=e.removedNodes[r];if(n.nodeType===1){const l=!!(n.firstElementChild||n.children&&n.children.length);for(let s=0;s<t.length;s++){const i=t[s],a=i.query;if(a){if(!l)n.matches&&n.matches(a)&&I(n,i);else if(n.matches&&n.matches(a)&&I(n,i),n.querySelectorAll){const o=n.querySelectorAll(a);for(let u=0;u<o.length;u++)I(o[u],i)}}}}}}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,S(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const n=t[r];if(n.type==="childList")try{ke(n)}catch(l){console.error("[ln-core] lifecycle handler failed",n.target,l)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Se(e,t){Ce({observed:e,handler:t}),xe()}function _e(e){Q().push(e),ve()}function Y(e){return(e||"").replace(/^#/,"")}function N(e){const t=e===void 0?location.hash:e,r={},n=Y(t);if(!n)return r;const l=n.split("&");for(let s=0;s<l.length;s++){const i=l[s];if(!i)continue;const a=i.indexOf(":"),o=a>-1?i.slice(0,a):i,u=a>-1?i.slice(a+1):"";if(o)try{r[o]=decodeURIComponent(u)}catch{r[o]=u}}return r}function Ee(e){if(!e)return null;const t=N();return e in t?t[e]:null}function Le(e,t){if(!e)return;const r=N();t==null?delete r[e]:r[e]=String(t);const l=Object.keys(r).map(function(s){const i=r[s];return i===""?s:s+":"+encodeURIComponent(i)}).join("&");Y(location.hash)!==l&&(location.hash=l)}function Te(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function je(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 n=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return n?t?n+"-"+t:n:t||null}function Oe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function De(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function qe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Fe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),n=e.slice(t+1),l=n?n.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:r,values:l}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=N,window.lnCore.hashGet=Ee,window.lnCore.hashSet=Le,window.lnCore.hashLinkClick=Te,window.lnCore.resolveHashNamespace=je,window.lnCore.hashSortEncode=Oe,window.lnCore.hashSortDecode=De,window.lnCore.hashFilterEncode=qe,window.lnCore.hashFilterDecode=Fe);function Ie(){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=Ie),(function(){const e="data-ln-ajax",t="lnAjax",r="data-ln-data-coordinator-scope";if(window[t]!==void 0)return;let n=null;function l(c){if(!c.hasAttribute(e)||c[t])return;c[t]=!0;const f=u(c);s(f.links),i(f.forms)}function s(c){for(const f of c){if(f[t+"Trigger"]||f.hostname&&f.hostname!==window.location.hostname)continue;const d=f.getAttribute("href");if(d&&d.includes("#"))continue;const w=function(A){if(!ne(A,f))return;A.preventDefault();const E=f.getAttribute("href");E&&o("GET",E,null,f)};f.addEventListener("click",w),f[t+"Trigger"]=w}}function i(c){for(const f of c){if(f[t+"Trigger"])continue;if(f.hasAttribute(r)){f[t+"ScopeWarned"]||(f[t+"ScopeWarned"]=!0,console.warn("[ln-ajax] Form has data-ln-data-coordinator-scope — the ln-data-coordinator write pipeline takes precedence; skipping ajax interception for this form."));continue}const d=function(w){if(w.defaultPrevented)return;w.preventDefault();const A=f.method.toUpperCase(),E=f.action,T=new FormData(f);for(const x of f.querySelectorAll('button, input[type="submit"]'))x.disabled=!0;o(A,E,T,f,function(){for(const x of f.querySelectorAll('button, input[type="submit"]'))x.disabled=!1})};f.addEventListener("submit",d),f[t+"Trigger"]=d}}function a(c){if(!c[t])return;const f=u(c);for(const d of f.links)d[t+"Trigger"]&&(d.removeEventListener("click",d[t+"Trigger"]),delete d[t+"Trigger"]);for(const d of f.forms)d[t+"Trigger"]&&(d.removeEventListener("submit",d[t+"Trigger"]),delete d[t+"Trigger"]);delete c[t]}function o(c,f,d,w,A){if(te(w,"ln-ajax:before-start",{method:c,url:f}).defaultPrevented)return;c==="GET"&&n&&n(),y(w,"ln-ajax:start",{method:c,url:f}),w.classList.add("ln-ajax--loading");const T=document.createElement("span");T.className="ln-ajax-spinner",w.appendChild(T);function x(){w.classList.remove("ln-ajax--loading");const h=w.querySelector(".ln-ajax-spinner");h&&h.remove(),A&&A()}let m=f;const Z=document.querySelector('meta[name="csrf-token"]'),j=Z?Z.getAttribute("content"):null;d instanceof FormData&&j&&d.append("_token",j);const O={method:c,headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/json"}};if(j&&(O.headers["X-CSRF-TOKEN"]=j),c==="GET"&&d){const h=new URLSearchParams(d);m=f+(f.includes("?")?"&":"?")+h.toString()}else c!=="GET"&&d&&(O.body=d);let k=null;if(c==="GET"){const h=new AbortController;O.signal=h.signal,k=function(){n=null,h.abort(),x(),y(w,"ln-ajax:aborted",{method:c,url:m})},n=k}fetch(m,O).then(function(h){const $=h.ok,g=h.status;return h.text().then(function(v){let C=null,L=null;if(v&&v.trim())try{C=JSON.parse(v)}catch(Ne){L=Ne}return{ok:$,status:g,data:C,parseError:L}})}).then(function(h){k&&n===k&&(n=null);const $=h.status,g=h.data,v=h.parseError;if(h.ok&&!v){if(g&&g.title&&(document.title=g.title),g&&g.content)for(const C in g.content){const L=document.getElementById(C);L&&(L.innerHTML=g.content[C])}if(w.tagName==="A"){const C=w.getAttribute("href");C&&window.history.pushState({ajax:!0},"",C)}else w.tagName==="FORM"&&w.method.toUpperCase()==="GET"&&window.history.pushState({ajax:!0},"",m);y(w,"ln-ajax:success",{method:c,url:m,data:g})}else y(w,"ln-ajax:error",{method:c,url:m,status:$,data:g,error:v||null});x(),y(w,"ln-ajax:complete",{method:c,url:m})}).catch(function(h){h&&h.name==="AbortError"||(k&&n===k&&(n=null),y(w,"ln-ajax:error",{method:c,url:m,status:0,data:null,error:h}),x(),y(w,"ln-ajax:complete",{method:c,url:m}))})}function u(c){const f={links:[],forms:[]};return c.tagName==="A"&&c.getAttribute(e)!=="false"?f.links.push(c):c.tagName==="FORM"&&c.getAttribute(e)!=="false"?f.forms.push(c):(f.links=Array.from(c.querySelectorAll('a:not([data-ln-ajax="false"])')),f.forms=Array.from(c.querySelectorAll('form:not([data-ln-ajax="false"])'))),f}function p(){S(function(){_e({onInit:function(c){if(l(c),!c.hasAttribute(e)){for(const d of c.querySelectorAll("["+e+"]"))l(d);const f=c.closest&&c.closest("["+e+"]");if(f&&f.getAttribute(e)!=="false"){const d=u(c);s(d.links),i(d.forms)}}}}),Se([e],function(c){l(c)})},"ln-ajax")}function b(){for(const c of document.querySelectorAll("["+e+"]"))l(c)}window[t]=l,window[t].destroy=a,p(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",b):b()})()})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { guardBody, dispatch, dispatchCancelable, shouldInterceptLink, observeAttributes } from '../../ln-core';
|
|
1
|
+
import { guardBody, dispatch, dispatchCancelable, shouldInterceptLink, observeAttributes, observeLifecycle } from '../../ln-core';
|
|
2
2
|
|
|
3
3
|
(function () {
|
|
4
4
|
const DOM_SELECTOR = 'data-ln-ajax';
|
|
@@ -257,36 +257,25 @@ import { guardBody, dispatch, dispatchCancelable, shouldInterceptLink, observeAt
|
|
|
257
257
|
|
|
258
258
|
function _domObserver() {
|
|
259
259
|
guardBody(function () {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const items = findElements(node);
|
|
275
|
-
_attachLinksAjax(items.links);
|
|
276
|
-
_attachFormsAjax(items.forms);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
260
|
+
observeLifecycle({
|
|
261
|
+
onInit: function (node) {
|
|
262
|
+
_constructor(node);
|
|
263
|
+
|
|
264
|
+
if (!node.hasAttribute(DOM_SELECTOR)) {
|
|
265
|
+
for (const el of node.querySelectorAll('[' + DOM_SELECTOR + ']')) {
|
|
266
|
+
_constructor(el);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const ajaxRoot = node.closest && node.closest('[' + DOM_SELECTOR + ']');
|
|
270
|
+
if (ajaxRoot && ajaxRoot.getAttribute(DOM_SELECTOR) !== 'false') {
|
|
271
|
+
const items = findElements(node);
|
|
272
|
+
_attachLinksAjax(items.links);
|
|
273
|
+
_attachFormsAjax(items.forms);
|
|
280
274
|
}
|
|
281
275
|
}
|
|
282
276
|
}
|
|
283
277
|
});
|
|
284
278
|
|
|
285
|
-
observer.observe(document.body, {
|
|
286
|
-
childList: true,
|
|
287
|
-
subtree: true
|
|
288
|
-
});
|
|
289
|
-
|
|
290
279
|
observeAttributes([DOM_SELECTOR], function (el) {
|
|
291
280
|
_constructor(el);
|
|
292
281
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function F(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function E(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){o=t[i];break}if(!E(o))return}e.apply(console,t)}}function b(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function k(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function te(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ne(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,i={},c=e.elements,l={};if(n)for(let u=0;u<c.length;u++){const s=c[u];s.name&&s.type==="checkbox"&&!s.disabled&&(l[s.name]=(l[s.name]||0)+1)}for(let u=0;u<c.length;u++){const s=c[u];if(!(!s.name||s.disabled||s.type==="file"||s.type==="submit"||s.type==="button")&&!(o&&s.matches&&s.matches(o)))if(s.type==="checkbox")n&&l[s.name]===1?i[s.name]=s.checked:(i[s.name]||(i[s.name]=[]),s.checked&&i[s.name].push(s.value));else if(s.type==="radio")s.checked&&(i[s.name]=s.value);else if(s.type==="select-multiple"){i[s.name]=[];for(let r=0;r<s.options.length;r++)s.options[r].selected&&i[s.name].push(s.options[r].value)}else if(n&&s.type==="hidden")i[s.name]=s.value;else if(n&&(s.type==="number"||s.type==="range")){const r=Number(s.value);i[s.name]=s.value===""||isNaN(r)?null:r}else i[s.name]=s.value}return i}function re(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function oe(e,t){const n=e.elements,o=[],i={};for(let c=0;c<n.length;c++){const l=n[c];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let c=0;c<n.length;c++){const l=n[c];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const u=l.getAttribute("data-ln-fill-as")||l.name;if(!u||!(u in t))continue;const s=t[u];if(l.type==="checkbox"){if(Array.isArray(s))l.checked=s.indexOf(l.value)!==-1;else if(i[l.name]>1){const r=String(s).split(",").map(function(f){return f.trim()});l.checked=r.indexOf(l.value)!==-1}else l.checked=re(s);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(s),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(s))for(let r=0;r<l.options.length;r++)l.options[r].selected=s.indexOf(l.options[r].value)!==-1;o.push(l)}else l.value=s,l.tagName==="SELECT"&&s!=null&&l.setAttribute("data-ln-value",s),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=oe,window.lnCore.serializeForm=ne,window.lnCore.resolveFormMethod=te);function ie(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(n){return console.error(`[${t}] Invalid headers JSON:`,n),{}}}const $={};function le(e,t){$[e]=t}function ae(e){return $[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=le,window.lnCore.getDataMapper=ae);function se(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,k(function(){new MutationObserver(function(){b(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const N={};function ce(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];N[n]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return N[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ce,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=se);const S={};function ue(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=S[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function R(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const u=n[l],s=u.getAttribute("data-ln-field");t[s]!=null&&(u.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const u=o[l],s=u.getAttribute("data-ln-attr").split(",");for(let r=0;r<s.length;r++){const f=s[r].trim().split(":");if(f.length!==2)continue;const a=f[0].trim(),d=f[1].trim();t[d]!=null&&u.setAttribute(a,t[d])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const u=i[l],s=u.getAttribute("data-ln-show");s in t&&u.classList.toggle("hidden",!t[s])}const c=e.querySelectorAll("[data-ln-class]");for(let l=0;l<c.length;l++){const u=c[l],s=u.getAttribute("data-ln-class").split(",");for(let r=0;r<s.length;r++){const f=s[r].trim().split(":");if(f.length!==2)continue;const a=f[0].trim(),d=f[1].trim();d in t&&u.classList.toggle(a,!!t[d])}}return e}function fe(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)R(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function U(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const c=n.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,u){return t[u]!==void 0?t[u]:""}))}const o=function(c,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let c=0;c<i.length;c++){const l=i[c],u=l.attributes;for(let s=0;s<u.length;s++){const r=u[s];r.value.indexOf("{{")!==-1&&l.setAttribute(r.name,r.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function pe(e,t,n,o,i,c){const l={};for(let s=0;s<e.children.length;s++){const r=e.children[s],f=r.getAttribute("data-ln-render-key");f&&(l[f]=r)}const u=document.createDocumentFragment();for(let s=0;s<t.length;s++){const r=t[s],f=String(o(r));let a=l[f];if(a)i(a,r,s);else{const d=ue(n,c);if(!d||(U(d,r),a=d.firstElementChild,!a))continue;a.setAttribute("data-ln-render-key",f),i(a,r,s)}u.appendChild(a)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=U,window.lnCore.fill=R,window.lnCore.lnFill=fe,window.lnCore.renderList=pe);function C(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function M(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function B(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const i=o.trim().toLowerCase();return!(i==="false"||i==="0")}function H(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const O=new Map;function W(e,t){const n=(e?e.join("|"):"")+"::"+t;if(O.has(n))return O.get(n);const o=new Set(e||[]),i=function(c,l){const u=c.getAttribute(l);return u!==null&&o.has(u)?u:t};return O.set(n,i),i}function Q(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function J(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function K(e,t,n,o,i){if(!e||t===null)return!0;const c=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const u=s=>{i?console.warn(s,i):console.warn(s)};if(l==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(u(`[${c}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const s=e.values||[];return s.includes(t)?!0:(u(`[${c}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return u(`[${c}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(u(`[${c}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(u(`[${c}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(u(`[${c}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(s){return u(`[${c}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function V(e,t,n){for(const o in n){const[i,c,l]=n[o];Object.defineProperty(e,o,{get:function(){return i(t,c,l)},enumerable:!0,configurable:!0})}return e}function G(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let i=o.read;if(!i&&o.type)switch(o.type){case"enum":i=W(o.values,o.fallback);break;case"integer":i=M;break;case"float":i=Q;break;case"boolean":i=B;break;case"list":i=H;break;case"json":i=J;break;case"string":default:i=C;break}i||(i=C),t[o.prop]=[i,n,o.fallback]}return t}function he(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function we(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=V,window.lnCore.attrSpec=G,window.lnCore.attrStr=C,window.lnCore.attrInt=M,window.lnCore.attrBool=B,window.lnCore.attrList=H,window.lnCore.attrEnum=W,window.lnCore.attrFloat=Q,window.lnCore.attrJson=J);function T(e,t,n,o){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(c));e.matches&&e.matches(c)&&l.push(e);for(const u of l)if(!u[n]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[n]=new o(u)}catch(s){console.error("["+n+"] init failed",u,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function me(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function be(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function z(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ge(e){const t=z(),n=e.observed||[];for(let o=0;o<n.length;o++){const i=n[o];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const i=t.byDeclaredAttr.get(o);i.some(c=>c.componentTag===e.componentTag)||i.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=we(e);if(o===null)t.reactiveWildcard.push(e);else for(const i of o)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function X(e,t,n,o){for(let i=0;i<e.length;i++){const c=e[i];if(!t[c.attribute])continue;const l=c.effects&&c.effects[n];l?l(t,n,o):c.onAttrChange&&(!c.declared||c.declared.has(n))&&c.onAttrChange(t,n,o)}}function ye(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=z(),i=o.byAttr.get(n);if(F()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&E(t)){const c=o.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let u=0;u<c.length;u++)K(c[u].spec,l,n,c[u].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||i)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const c=o.byReactive.get(n);c&&X(c,t,n,e.oldValue),o.reactiveWildcard.length&&X(o.reactiveWildcard,t,n,e.oldValue)}if(i)for(let c=0;c<i.length;c++){const l=i[c];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(T(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ye(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function Y(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function _e(e){const t=Y();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const i=o.query,c=e.target.nodeType===1?e.target.matches(i)?e.target:e.target.closest(i):e.target.parentElement?e.target.parentElement.closest(i):null;c&&o.onSubtreeChange(c,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let i=0;i<t.length;i++){const c=t[i];T(o,c.selector,c.attribute,c.ComponentFn),c.onInit&&c.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let i=0;i<t.length;i++){const c=t[i],l=c.query,u=Array.from(o.querySelectorAll(l));o.matches&&o.matches(l)&&u.push(o);for(let s=0;s<u.length;s++){const r=u[s];if(!document.contains(r)){const f=r[c.attribute];if(f&&typeof f.destroy=="function")try{f.destroy()}catch(a){console.error("["+c.attribute+"] destroy failed",r,a)}delete r[c.attribute]}}}}}}function Ae(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{_e(o)}catch(i){console.error("[ln-core] lifecycle handler failed",o.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Z(e,t,n,o,i={}){const c=i.extraAttributes||[],l=i.onAttributeChange||null,u=i.onSubtreeChange||null,s=i.onInit||null,r=i.onAttrChange||null,f=i.effects||null,a=i.attributes||null,d=a?he(a):f,p=a?new Set(Object.keys(a)):null,h=i.persist||null;function m(v){const w=v||document.body;if(T(w,e,t,n),a&&F())for(const g in a){const Fe=a[g],D=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&D.push(w);for(let I=0;I<D.length;I++){const j=D[I];E(j)&&K(Fe,j.getAttribute(g),g,o,j)}}s&&s(w)}const y=[];if(e.indexOf("[")!==-1){const v=/\[([\w-]+)/g;let w;for(;(w=v.exec(e))!==null;)y.push(w[1])}else y.push(e);ge({selector:e,attribute:t,componentTag:o,attributes:a,ComponentFn:n,onInit:s,observed:y.concat(c),onAttributeChange:l,onAttrChange:r,effects:d,declared:p,persist:h}),Ce();const L=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,x=i.subtreeQuery||(L?e:"["+e+"]");Y().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:u,query:x}),Ae(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Z);function A(){me()>0?be(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A):A(),m}function P(e){return(e||"").replace(/^#/,"")}function q(e){const t=e===void 0?location.hash:e,n={},o=P(t);if(!o)return n;const i=o.split("&");for(let c=0;c<i.length;c++){const l=i[c];if(!l)continue;const u=l.indexOf(":"),s=u>-1?l.slice(0,u):l,r=u>-1?l.slice(u+1):"";if(s)try{n[s]=decodeURIComponent(r)}catch{n[s]=r}}return n}function ve(e){if(!e)return null;const t=q();return e in t?t[e]:null}function ke(e,t){if(!e)return;const n=q();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(c){const l=n[c];return l===""?c:c+":"+encodeURIComponent(l)}).join("&");P(location.hash)!==i&&(location.hash=i)}function xe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ee(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function Se(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Te(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function qe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),i=o?o.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=q,window.lnCore.hashGet=ve,window.lnCore.hashSet=ke,window.lnCore.hashLinkClick=xe,window.lnCore.resolveHashNamespace=Ee,window.lnCore.hashSortEncode=Se,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Te,window.lnCore.hashFilterDecode=qe);function Le(){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=Le);const De={offset:"offset",limit:"limit",search:"search",sortField:"sort_field",sortDir:"sort_dir"};function _(...e){return e.filter(t=>t!=null&&t!=="").map((t,n)=>{const o=String(t);return n===0?o.replace(/\/+$/,""):o.replace(/^\/+/,"").replace(/\/+$/,"")}).filter(Boolean).join("/")}function Ie(e,t){if(!e||typeof e!="object")return"";const n=Object.assign({},De);if(t&&typeof t=="object")for(const i in t)t[i]!==void 0&&t[i]!==null&&t[i]!==""&&(n[i]=t[i]);const o=new URLSearchParams;return e.search&&o.append(n.search,e.search),e.offset!=null&&o.append(n.offset,e.offset),e.limit!=null&&o.append(n.limit,e.limit),e.sort&&e.sort.field&&e.sort.direction&&(o.append(n.sortField,e.sort.field),o.append(n.sortDir,e.sort.direction)),e.filters&&typeof e.filters=="object"&&Object.keys(e.filters).forEach(i=>{const c=e.filters[i];Array.isArray(c)&&c.length>0&&o.append(i,c.join(","))}),o.toString()}function je(e,t,n){let o=_(e,t);return n&&(o+=(o.indexOf("?")!==-1?"&":"?")+n),o}function ee(e){const t=e&&e.content!==void 0?e.content:e,n=e&&e.message?e.message:null;return{record:t,message:n}}(function(){const e="data-ln-api-connector",t="lnApiConnector",n="lnConnector";if(window[t]!==void 0)return;function o(r){const f=r[t];f&&f.refreshConfig()}const i={"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:C,type:"string",fallback:"",effect:o,description:"Resource path appended to base URL"},"data-ln-api-endpoint":{prop:"path",read:C,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=G(i);function l(r){return r.ok?r.status===204?null:r.json():r.json().catch(()=>null).then(f=>{const a=new Error("HTTP "+r.status+": "+r.statusText);throw a.status=r.status,a.data=f,a})}function u(r){return this.dom=r,V(this,r,c),r[t]=this,r[n]=this,this.namespace="ln-api-connector",this._inflight=new Map,this._queryTimers=new Map,this.refreshConfig(),this._handlers=null,s(this),this}u.prototype.refreshConfig=function(){const r=this.dom;this.credentials="same-origin",this.headers=ie(this.rawHeaders);const f={},a=r.getAttribute("data-ln-api-param-offset");a&&(f.offset=a);const d=r.getAttribute("data-ln-api-param-limit");d&&(f.limit=d);const p=r.getAttribute("data-ln-api-param-search");p&&(f.search=p);const h=r.getAttribute("data-ln-api-param-sort-field");h&&(f.sortField=h);const m=r.getAttribute("data-ln-api-param-sort-dir");m&&(f.sortDir=m),this.paramKeys=f;const y=r.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})},u.prototype._reqHeaders=function(r){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"),r&&(f["X-Idempotency-Key"]=r),f},u.prototype.cancel=function(r){return r&&this._inflight.has(r)?(this._inflight.get(r).abort(),this._inflight.delete(r),!0):!1},u.prototype.fetchDelta=function(r,f){const a=this;let d=_(a.baseUrl,a.path);r!=null&&r!==""&&(d+=(d.indexOf("?")!==-1?"&":"?")+"since="+encodeURIComponent(r));const p=f||"sync";a._inflight.has(p)&&a._inflight.get(p).abort();const h=new AbortController;return a._inflight.set(p,h),window.fetch(d,{method:"GET",headers:a._reqHeaders(),credentials:a.credentials,signal:h.signal}).then(l).finally(function(){a._inflight.get(p)===h&&a._inflight.delete(p)})},u.prototype.query=function(r,f){const a=this,d=Ie(r,a.paramKeys),p=je(a.baseUrl,a.path,d),h=f||"query";a._inflight.has(h)&&a._inflight.get(h).abort();const m=new AbortController;return a._inflight.set(h,m),window.fetch(p,{method:"GET",headers:a._reqHeaders(),credentials:a.credentials,signal:m.signal}).then(l).finally(function(){a._inflight.get(h)===m&&a._inflight.delete(h)})},u.prototype.create=function(r,f,a){const d=this;return window.fetch(_(d.baseUrl,f||d.path),{method:"POST",headers:d._reqHeaders(a),credentials:d.credentials,body:JSON.stringify(r)}).then(l)},u.prototype.update=function(r,f,a,d,p){const h=this;a!=null&&(f=Object.assign({},f,{expected_version:a}));const m=d?_(h.baseUrl,d):_(h.baseUrl,h.path,r);return window.fetch(m,{method:"PUT",headers:h._reqHeaders(p),credentials:h.credentials,body:JSON.stringify(f)}).then(l)},u.prototype.delete=function(r,f,a){const d=this;return window.fetch(_(d.baseUrl,f||d.path,r),{method:"DELETE",headers:d._reqHeaders(a),credentials:d.credentials}).then(l)},u.prototype.bulkDelete=function(r,f,a){const d=this;return window.fetch(_(d.baseUrl,f||d.path,"bulk-delete"),{method:"DELETE",headers:d._reqHeaders(a),credentials:d.credentials,body:JSON.stringify({ids:r})}).then(l)};function s(r){r._handlers={sync:function(f){const a=f.detail||{},d=a.meta&&a.meta.targetEl?a.meta.targetEl:null;r.fetchDelta(a.since,d).then(function(p){b(r.dom,"ln-api-connector:fetched",{data:p,since:a.since,meta:a.meta||null})}).catch(function(p){p&&p.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"sync",error:p.message,status:p.status||0,data:p.data||null,since:a.since,meta:a.meta||null})})},query:function(f){const a=f.detail||{},d=a.query||a,p=a.meta&&a.meta.targetEl?a.meta.targetEl:null,h=p||"query",m=r.queryDebounce;function y(x,A,v){r.query(A,v).then(function(w){const g=w||{};b(r.dom,"ln-api-connector:fetched",{data:g.data||(Array.isArray(g)?g:[]),total:g.total,filtered:g.filtered,offset:A.offset,queryGen:A.queryGen,meta:x.meta||null})}).catch(function(w){w&&w.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"query",error:w.message,status:w.status||0,data:w.data||null,meta:x.meta||null})})}if(m===0){y(a,d,p);return}r._queryTimers.has(h)&&clearTimeout(r._queryTimers.get(h));const L=setTimeout(function(){r._queryTimers.delete(h),y(a,d,p)},m);r._queryTimers.set(h,L)},cancel:function(f){const a=f.detail||{},d=a.meta&&a.meta.targetEl?a.meta.targetEl:a.targetEl||a.key;d&&r.cancel(d)},create:function(f){const a=f.detail||{};r.create(a.data,a.url,a.idempotencyKey).then(function(d){const p=ee(d);b(r.dom,"ln-api-connector:created",{record:p.record,tempId:a.tempId,message:p.message,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"create",error:d.message,status:d.status||0,data:d.data||null,tempId:a.tempId,meta:a.meta||null})})},update:function(f){const a=f.detail||{};r.update(a.id,a.data,a.expected_version,a.url,a.idempotencyKey).then(function(d){const p=ee(d);b(r.dom,"ln-api-connector:updated",{record:p.record,id:a.id,message:p.message,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"update",error:d.message,status:d.status||0,data:d.data||null,id:a.id,conflictData:d.status===409?d.data:null,meta:a.meta||null})})},delete:function(f){const a=f.detail||{};r.delete(a.id,a.url,a.idempotencyKey).then(function(d){const p=d&&d.message?d.message:null;b(r.dom,"ln-api-connector:deleted",{response:d,id:a.id,message:p,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"delete",error:d.message,status:d.status||0,data:d.data||null,id:a.id,meta:a.meta||null})})},bulkDelete:function(f){const a=f.detail||{};r.bulkDelete(a.ids,a.url,a.idempotencyKey).then(function(d){const p=d&&d.message?d.message:null;b(r.dom,"ln-api-connector:bulk-deleted",{response:d,ids:a.ids,message:p,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"bulk-delete",error:d.message,status:d.status||0,data:d.data||null,ids:a.ids,meta:a.meta||null})})}},r.dom.addEventListener("ln-api-connector:request-sync",r._handlers.sync),r.dom.addEventListener("ln-api-connector:request-query",r._handlers.query),r.dom.addEventListener("ln-api-connector:request-cancel",r._handlers.cancel),r.dom.addEventListener("ln-api-connector:request-create",r._handlers.create),r.dom.addEventListener("ln-api-connector:request-update",r._handlers.update),r.dom.addEventListener("ln-api-connector:request-delete",r._handlers.delete),r.dom.addEventListener("ln-api-connector:request-bulk-delete",r._handlers.bulkDelete)}u.prototype.destroy=function(){if(!this.dom[t])return;const r=this;r._inflight&&(r._inflight.forEach(function(f){f.abort()}),r._inflight.clear()),this._queryTimers&&(this._queryTimers.forEach(function(f){f&&clearTimeout(f)}),this._queryTimers.clear()),this._handlers&&(r.dom.removeEventListener("ln-api-connector:request-sync",r._handlers.sync),r.dom.removeEventListener("ln-api-connector:request-query",r._handlers.query),r.dom.removeEventListener("ln-api-connector:request-cancel",r._handlers.cancel),r.dom.removeEventListener("ln-api-connector:request-create",r._handlers.create),r.dom.removeEventListener("ln-api-connector:request-update",r._handlers.update),r.dom.removeEventListener("ln-api-connector:request-delete",r._handlers.delete),r.dom.removeEventListener("ln-api-connector:request-bulk-delete",r._handlers.bulkDelete),r._handlers=null),delete this.dom[t],delete this.dom[n]},Z(e,t,u,"ln-api-connector",{attributes:i})})()})();
|
|
1
|
+
(function(){"use strict";function N(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function S(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let n=null;for(let a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){n=t[a];break}if(!S(n))return}e.apply(console,t)}}function b(e,t,r){const n=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,n),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}function E(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){E(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function oe(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ie(e,t){const r=!!(t&&t.typed),n=t&&t.exclude,a={},u=e.elements,l={};if(r)for(let d=0;d<u.length;d++){const i=u[d];i.name&&i.type==="checkbox"&&!i.disabled&&(l[i.name]=(l[i.name]||0)+1)}for(let d=0;d<u.length;d++){const i=u[d];if(!(!i.name||i.disabled||i.type==="file"||i.type==="submit"||i.type==="button")&&!(n&&i.matches&&i.matches(n)))if(i.type==="checkbox")r&&l[i.name]===1?a[i.name]=i.checked:(a[i.name]||(a[i.name]=[]),i.checked&&a[i.name].push(i.value));else if(i.type==="radio")i.checked&&(a[i.name]=i.value);else if(i.type==="select-multiple"){a[i.name]=[];for(let o=0;o<i.options.length;o++)i.options[o].selected&&a[i.name].push(i.options[o].value)}else if(r&&i.type==="hidden")a[i.name]=i.value;else if(r&&(i.type==="number"||i.type==="range")){const o=Number(i.value);a[i.name]=i.value===""||isNaN(o)?null:o}else a[i.name]=i.value}return a}function le(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ae(e,t){const r=e.elements,n=[],a={};for(let u=0;u<r.length;u++){const l=r[u];l.name&&l.type==="checkbox"&&(a[l.name]=(a[l.name]||0)+1)}for(let u=0;u<r.length;u++){const l=r[u];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const d=l.getAttribute("data-ln-fill-as")||l.name;if(!d||!(d in t))continue;const i=t[d];if(l.type==="checkbox"){if(Array.isArray(i))l.checked=i.indexOf(l.value)!==-1;else if(a[l.name]>1){const o=String(i).split(",").map(function(f){return f.trim()});l.checked=o.indexOf(l.value)!==-1}else l.checked=le(i);n.push(l)}else if(l.type==="radio")l.checked=l.value===String(i),n.push(l);else if(l.type==="select-multiple"){if(Array.isArray(i))for(let o=0;o<l.options.length;o++)l.options[o].selected=i.indexOf(l.options[o].value)!==-1;n.push(l)}else l.value=i,l.tagName==="SELECT"&&i!=null&&l.setAttribute("data-ln-value",i),n.push(l)}return n}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ae,window.lnCore.serializeForm=ie,window.lnCore.resolveFormMethod=oe);function se(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(r){return console.error(`[${t}] Invalid headers JSON:`,r),{}}}const R={};function ce(e,t){R[e]=t}function de(e){return R[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ce,window.lnCore.getDataMapper=de);function ue(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,E(function(){new MutationObserver(function(){b(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const U={};function fe(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];U[r]=t}function pe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return U[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=fe,window.lnCore.getLocaleFallback=pe,window.lnCore.ensureLocaleObserver=ue);const q={};function he(e,t){q[e]||(q[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=q[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function M(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let l=0;l<r.length;l++){const d=r[l],i=d.getAttribute("data-ln-field");t[i]!=null&&(d.textContent=t[i])}const n=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<n.length;l++){const d=n[l],i=d.getAttribute("data-ln-attr").split(",");for(let o=0;o<i.length;o++){const f=i[o].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),c=f[1].trim();t[c]!=null&&d.setAttribute(s,t[c])}}const a=e.querySelectorAll("[data-ln-show]");for(let l=0;l<a.length;l++){const d=a[l],i=d.getAttribute("data-ln-show");i in t&&d.classList.toggle("hidden",!t[i])}const u=e.querySelectorAll("[data-ln-class]");for(let l=0;l<u.length;l++){const d=u[l],i=d.getAttribute("data-ln-class").split(",");for(let o=0;o<i.length;o++){const f=i[o].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),c=f[1].trim();c in t&&d.classList.toggle(s,!!t[c])}}return e}function we(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let n=0;n<r.length;n++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[n],t??null),r[n].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)M(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 B(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(l,d){return t[d]!==void 0?t[d]:""}))}const n=function(u,l){return t[l]!==void 0?t[l]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let u=0;u<a.length;u++){const l=a[u],d=l.attributes;for(let i=0;i<d.length;i++){const o=d[i];o.value.indexOf("{{")!==-1&&l.setAttribute(o.name,o.value.replace(/\{\{\s*(\w+)\s*\}\}/g,n))}}return e}function me(e,t,r,n,a,u){const l={};for(let i=0;i<e.children.length;i++){const o=e.children[i],f=o.getAttribute("data-ln-render-key");f&&(l[f]=o)}const d=document.createDocumentFragment();for(let i=0;i<t.length;i++){const o=t[i],f=String(n(o));let s=l[f];if(s)a(s,o,i);else{const c=he(r,u);if(!c||(B(c,o),s=c.firstElementChild,!s))continue;s.setAttribute("data-ln-render-key",f),a(s,o,i)}d.appendChild(s)}e.textContent="",e.appendChild(d)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=B,window.lnCore.fill=M,window.lnCore.lnFill=we,window.lnCore.renderList=me);function C(e,t,r){const n=e.getAttribute(t);return n===null?r:n}function H(e,t,r){const n=parseInt(e.getAttribute(t),10);return isNaN(n)?r:n}function W(e,t,r=!1){const n=e.getAttribute(t);if(n===null)return!!r;const a=n.trim().toLowerCase();return!(a==="false"||a==="0")}function Q(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const L=new Map;function J(e,t){const r=(e?e.join("|"):"")+"::"+t;if(L.has(r))return L.get(r);const n=new Set(e||[]),a=function(u,l){const d=u.getAttribute(l);return d!==null&&n.has(d)?d:t};return L.set(r,a),a}function K(e,t,r){const n=parseFloat(e.getAttribute(t));return isNaN(n)?r:n}function V(e,t,r){const n=e.getAttribute(t);if(!n)return r;try{return JSON.parse(n)}catch{return r}}function G(e,t,r,n,a){if(!e||t===null)return!0;const u=n||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const d=i=>{a?console.warn(i,a):console.warn(i)};if(l==="boolean"){const i=t.trim().toLowerCase();return i!==""&&i!=="true"&&i!=="false"&&i!=="1"&&i!=="0"?(d(`[${u}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const i=e.values||[];return i.includes(t)?!0:(d(`[${u}] Invalid value "${t}" for attribute "${r}". Allowed: ${i.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return d(`[${u}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const i=parseInt(t,10);return e.min!==void 0&&i<e.min?(d(`[${u}] Value ${i} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&i>e.max?(d(`[${u}] Value ${i} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(d(`[${u}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(i){return d(`[${u}] Invalid JSON for attribute "${r}": ${i.message}. Fallback: ${e.fallback}.`),!1}return!0}function z(e,t,r){for(const n in r){const[a,u,l]=r[n];Object.defineProperty(e,n,{get:function(){return a(t,u,l)},enumerable:!0,configurable:!0})}return e}function X(e){const t={};for(const r in e){const n=e[r];if(!n||!n.prop)continue;let a=n.read;if(!a&&n.type)switch(n.type){case"enum":a=J(n.values,n.fallback);break;case"integer":a=H;break;case"float":a=K;break;case"boolean":a=W;break;case"list":a=Q;break;case"json":a=V;break;case"string":default:a=C;break}a||(a=C),t[n.prop]=[a,r,n.fallback]}return t}function be(e){const t={};for(const r in e){const n=e[r];n&&n.effect&&(t[r]=n.effect)}return Object.keys(t).length?t:null}function ge(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=z,window.lnCore.attrSpec=X,window.lnCore.attrStr=C,window.lnCore.attrInt=H,window.lnCore.attrBool=W,window.lnCore.attrList=Q,window.lnCore.attrEnum=J,window.lnCore.attrFloat=K,window.lnCore.attrJson=V);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 Y(e,t,r,n){if(e.nodeType!==1)return;const u=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:r,ComponentFn:n};if(e.matches&&e.matches(u)&&v(e,l),e.querySelectorAll){const d=e.querySelectorAll(u);for(let i=0;i<d.length;i++)v(d[i],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ye(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ce(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function Z(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function _e(e){const t=Z(),r=e.observed||[];for(let n=0;n<r.length;n++){const a=r[n];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const n in e.attributes){t.byDeclaredAttr.has(n)||t.byDeclaredAttr.set(n,[]);const a=t.byDeclaredAttr.get(n);a.some(u=>u.componentTag===e.componentTag)||a.push({spec:e.attributes[n],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const n=ge(e);if(n===null)t.reactiveWildcard.push(e);else for(const a of n)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function P(e,t,r,n){for(let a=0;a<e.length;a++){const u=e[a];if(!t[u.attribute])continue;const l=u.effects&&u.effects[r];l?l(t,r,n):u.onAttrChange&&(!u.declared||u.declared.has(r))&&u.onAttrChange(t,r,n)}}function Ae(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,n=Z(),a=n.byAttr.get(t),u=N()&&n.byDeclaredAttr&&n.byDeclaredAttr.has(t);if(!r&&!a&&!u)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(u&&S(l)){const d=n.byDeclaredAttr.get(t),i=l.getAttribute(t);for(let o=0;o<d.length;o++)G(d[o].spec,i,t,d[o].componentTag,l)}if(window.lnCore._debugSink&&(r||a)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),r){const d=n.byReactive.get(t);d&&P(d,l,t,e.oldValue),n.reactiveWildcard.length&&P(n.reactiveWildcard,l,t,e.oldValue)}if(a)for(let d=0;d<a.length;d++){const i=a[d];if(i.handler){i.handler(l,t,e.oldValue);continue}i.onAttributeChange&&l[i.attribute]?i.onAttributeChange(l,t):(Y(l,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(l))}}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,E(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{Ae(t[r])}catch(n){console.error("[ln-core] mutation handler failed",t[r].target,n)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function O(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function T(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(n){console.error("["+t.attribute+"] destroy failed",e,n)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ke(e){const t=O();if(t.length){if(e.target)for(let r=0;r<t.length;r++){const n=t[r];if(n.onSubtreeChange&&n.query){const a=n.query,u=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;u&&n.onSubtreeChange(u,e)}}for(let r=0;r<e.addedNodes.length;r++){const n=e.addedNodes[r];if(n.nodeType===1){const a=!!(n.firstElementChild||n.children&&n.children.length);for(let u=0;u<t.length;u++){const l=t[u];if(l.selector&&l.attribute&&l.ComponentFn){if(!a)n.matches&&n.matches(l.query)&&v(n,l);else if(n.matches&&n.matches(l.query)&&v(n,l),n.querySelectorAll){const d=n.querySelectorAll(l.query);for(let i=0;i<d.length;i++)v(d[i],l)}}l.onInit&&l.onInit(n)}}}for(let r=0;r<e.removedNodes.length;r++){const n=e.removedNodes[r];if(n.nodeType===1){const a=!!(n.firstElementChild||n.children&&n.children.length);for(let u=0;u<t.length;u++){const l=t[u],d=l.query;if(d){if(!a)n.matches&&n.matches(d)&&T(n,l);else if(n.matches&&n.matches(d)&&T(n,l),n.querySelectorAll){const i=n.querySelectorAll(d);for(let o=0;o<i.length;o++)T(i[o],l)}}}}}}}function ee(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,E(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const n=t[r];if(n.type==="childList")try{ke(n)}catch(a){console.error("[ln-core] lifecycle handler failed",n.target,a)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ee(e){O().push(e),ee()}function te(e,t,r,n,a={}){const u=a.extraAttributes||[],l=a.onAttributeChange||null,d=a.onSubtreeChange||null,i=a.onInit||null,o=a.onAttrChange||null,f=a.effects||null,s=a.attributes||null,c=s?be(s):f,p=s?new Set(Object.keys(s)):null,h=a.persist||null;function m(k){const w=k||document.body;if(Y(w,e,t,r),s&&N())for(const g in s){const Re=s[g],F=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&F.push(w);for(let j=0;j<F.length;j++){const $=F[j];S($)&&G(Re,$.getAttribute(g),g,n,$)}}i&&i(w)}const y=[];if(e.indexOf("[")!==-1){const k=/\[([\w-]+)/g;let w;for(;(w=k.exec(e))!==null;)y.push(w[1])}else y.push(e);_e({selector:e,attribute:t,componentTag:n,attributes:s,ComponentFn:r,onInit:i,observed:y.concat(u),onAttributeChange:l,onAttrChange:o,effects:c,declared:p,persist:h}),ve();const I=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,x=a.subtreeQuery||(I?e:"["+e+"]");O().push({selector:e,attribute:t,ComponentFn:r,onInit:i,onSubtreeChange:d,query:x}),ee(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=te,window.lnCore.observeLifecycle=Ee);function A(){ye()>0?Ce(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A):A(),m}function ne(e){return(e||"").replace(/^#/,"")}function D(e){const t=e===void 0?location.hash:e,r={},n=ne(t);if(!n)return r;const a=n.split("&");for(let u=0;u<a.length;u++){const l=a[u];if(!l)continue;const d=l.indexOf(":"),i=d>-1?l.slice(0,d):l,o=d>-1?l.slice(d+1):"";if(i)try{r[i]=decodeURIComponent(o)}catch{r[i]=o}}return r}function xe(e){if(!e)return null;const t=D();return e in t?t[e]:null}function Se(e,t){if(!e)return;const r=D();t==null?delete r[e]:r[e]=String(t);const a=Object.keys(r).map(function(u){const l=r[u];return l===""?u:u+":"+encodeURIComponent(l)}).join("&");ne(location.hash)!==a&&(location.hash=a)}function qe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Le(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const n=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return n?t?n+"-"+t:n:t||null}function Oe(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Te(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function De(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Ie(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),n=e.slice(t+1),a=n?n.split(",").map(function(u){try{return decodeURIComponent(u)}catch{return u}}).filter(Boolean):[];return{key:r,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=D,window.lnCore.hashGet=xe,window.lnCore.hashSet=Se,window.lnCore.hashLinkClick=qe,window.lnCore.resolveHashNamespace=Le,window.lnCore.hashSortEncode=Oe,window.lnCore.hashSortDecode=Te,window.lnCore.hashFilterEncode=De,window.lnCore.hashFilterDecode=Ie);function Fe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Fe);const je={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 n=String(t);return r===0?n.replace(/\/+$/,""):n.replace(/^\/+/,"").replace(/\/+$/,"")}).filter(Boolean).join("/")}function $e(e,t){if(!e||typeof e!="object")return"";const r=Object.assign({},je);if(t&&typeof t=="object")for(const a in t)t[a]!==void 0&&t[a]!==null&&t[a]!==""&&(r[a]=t[a]);const n=new URLSearchParams;return e.search&&n.append(r.search,e.search),e.offset!=null&&n.append(r.offset,e.offset),e.limit!=null&&n.append(r.limit,e.limit),e.sort&&e.sort.field&&e.sort.direction&&(n.append(r.sortField,e.sort.field),n.append(r.sortDir,e.sort.direction)),e.filters&&typeof e.filters=="object"&&Object.keys(e.filters).forEach(a=>{const u=e.filters[a];Array.isArray(u)&&u.length>0&&n.append(a,u.join(","))}),n.toString()}function Ne(e,t,r){let n=_(e,t);return r&&(n+=(n.indexOf("?")!==-1?"&":"?")+r),n}function re(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 n(o){const f=o[t];f&&f.refreshConfig()}const a={"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:n,description:"Base URL endpoint for API requests"},"data-ln-api-path":{prop:"path",read:C,type:"string",fallback:"",effect:n,description:"Resource path appended to base URL"},"data-ln-api-endpoint":{prop:"path",read:C,type:"string",fallback:"",effect:n,description:"Alias for data-ln-api-path"},"data-ln-api-headers":{prop:"rawHeaders",read:C,type:"json",fallback:null,effect:n,description:"Custom HTTP headers in JSON format or semicolon-separated pairs"},"data-ln-api-param-offset":{effect:n,type:"string",fallback:"offset",description:"Query parameter name for pagination offset"},"data-ln-api-param-limit":{effect:n,type:"string",fallback:"limit",description:"Query parameter name for pagination page size"},"data-ln-api-param-search":{effect:n,type:"string",fallback:"search",description:"Query parameter name for text search filter"},"data-ln-api-param-sort-field":{effect:n,type:"string",fallback:"sort_by",description:"Query parameter name for sort field"},"data-ln-api-param-sort-dir":{effect:n,type:"string",fallback:"sort_dir",description:"Query parameter name for sort direction"},"data-ln-api-connector-query-debounce":{effect:n,type:"integer",fallback:200,min:0,description:"Debounce delay in milliseconds before dispatching query requests"}},u=X(a);function l(o){return o.ok?o.status===204?null:o.json():o.json().catch(()=>null).then(f=>{const s=new Error("HTTP "+o.status+": "+o.statusText);throw s.status=o.status,s.data=f,s})}function d(o){return this.dom=o,z(this,o,u),o[t]=this,o[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 o=this.dom;this.credentials="same-origin",this.headers=se(this.rawHeaders);const f={},s=o.getAttribute("data-ln-api-param-offset");s&&(f.offset=s);const c=o.getAttribute("data-ln-api-param-limit");c&&(f.limit=c);const p=o.getAttribute("data-ln-api-param-search");p&&(f.search=p);const h=o.getAttribute("data-ln-api-param-sort-field");h&&(f.sortField=h);const m=o.getAttribute("data-ln-api-param-sort-dir");m&&(f.sortDir=m),this.paramKeys=f;const y=o.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(o){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"),o&&(f["X-Idempotency-Key"]=o),f},d.prototype.cancel=function(o){return o&&this._inflight.has(o)?(this._inflight.get(o).abort(),this._inflight.delete(o),!0):!1},d.prototype.fetchDelta=function(o,f){const s=this;let c=_(s.baseUrl,s.path);o!=null&&o!==""&&(c+=(c.indexOf("?")!==-1?"&":"?")+"since="+encodeURIComponent(o));const p=f||"sync";s._inflight.has(p)&&s._inflight.get(p).abort();const h=new AbortController;return s._inflight.set(p,h),window.fetch(c,{method:"GET",headers:s._reqHeaders(),credentials:s.credentials,signal:h.signal}).then(l).finally(function(){s._inflight.get(p)===h&&s._inflight.delete(p)})},d.prototype.query=function(o,f){const s=this,c=$e(o,s.paramKeys),p=Ne(s.baseUrl,s.path,c),h=f||"query";s._inflight.has(h)&&s._inflight.get(h).abort();const m=new AbortController;return s._inflight.set(h,m),window.fetch(p,{method:"GET",headers:s._reqHeaders(),credentials:s.credentials,signal:m.signal}).then(l).finally(function(){s._inflight.get(h)===m&&s._inflight.delete(h)})},d.prototype.create=function(o,f,s){const c=this;return window.fetch(_(c.baseUrl,f||c.path),{method:"POST",headers:c._reqHeaders(s),credentials:c.credentials,body:JSON.stringify(o)}).then(l)},d.prototype.update=function(o,f,s,c,p){const h=this;s!=null&&(f=Object.assign({},f,{expected_version:s}));const m=c?_(h.baseUrl,c):_(h.baseUrl,h.path,o);return window.fetch(m,{method:"PUT",headers:h._reqHeaders(p),credentials:h.credentials,body:JSON.stringify(f)}).then(l)},d.prototype.delete=function(o,f,s){const c=this;return window.fetch(_(c.baseUrl,f||c.path,o),{method:"DELETE",headers:c._reqHeaders(s),credentials:c.credentials}).then(l)},d.prototype.bulkDelete=function(o,f,s){const c=this;return window.fetch(_(c.baseUrl,f||c.path,"bulk-delete"),{method:"DELETE",headers:c._reqHeaders(s),credentials:c.credentials,body:JSON.stringify({ids:o})}).then(l)};function i(o){o._handlers={sync:function(f){const s=f.detail||{},c=s.meta&&s.meta.targetEl?s.meta.targetEl:null;o.fetchDelta(s.since,c).then(function(p){b(o.dom,"ln-api-connector:fetched",{data:p,since:s.since,meta:s.meta||null})}).catch(function(p){p&&p.name==="AbortError"||b(o.dom,"ln-api-connector:error",{action:"sync",error:p.message,status:p.status||0,data:p.data||null,since:s.since,meta:s.meta||null})})},query:function(f){const s=f.detail||{},c=s.query||s,p=s.meta&&s.meta.targetEl?s.meta.targetEl:null,h=p||"query",m=o.queryDebounce;function y(x,A,k){o.query(A,k).then(function(w){const g=w||{};b(o.dom,"ln-api-connector:fetched",{data:g.data||(Array.isArray(g)?g:[]),total:g.total,filtered:g.filtered,offset:A.offset,queryGen:A.queryGen,meta:x.meta||null})}).catch(function(w){w&&w.name==="AbortError"||b(o.dom,"ln-api-connector:error",{action:"query",error:w.message,status:w.status||0,data:w.data||null,meta:x.meta||null})})}if(m===0){y(s,c,p);return}o._queryTimers.has(h)&&clearTimeout(o._queryTimers.get(h));const I=setTimeout(function(){o._queryTimers.delete(h),y(s,c,p)},m);o._queryTimers.set(h,I)},cancel:function(f){const s=f.detail||{},c=s.meta&&s.meta.targetEl?s.meta.targetEl:s.targetEl||s.key;c&&o.cancel(c)},create:function(f){const s=f.detail||{};o.create(s.data,s.url,s.idempotencyKey).then(function(c){const p=re(c);b(o.dom,"ln-api-connector:created",{record:p.record,tempId:s.tempId,message:p.message,meta:s.meta||null})}).catch(function(c){c&&c.name==="AbortError"||b(o.dom,"ln-api-connector:error",{action:"create",error:c.message,status:c.status||0,data:c.data||null,tempId:s.tempId,meta:s.meta||null})})},update:function(f){const s=f.detail||{};o.update(s.id,s.data,s.expected_version,s.url,s.idempotencyKey).then(function(c){const p=re(c);b(o.dom,"ln-api-connector:updated",{record:p.record,id:s.id,message:p.message,meta:s.meta||null})}).catch(function(c){c&&c.name==="AbortError"||b(o.dom,"ln-api-connector:error",{action:"update",error:c.message,status:c.status||0,data:c.data||null,id:s.id,conflictData:c.status===409?c.data:null,meta:s.meta||null})})},delete:function(f){const s=f.detail||{};o.delete(s.id,s.url,s.idempotencyKey).then(function(c){const p=c&&c.message?c.message:null;b(o.dom,"ln-api-connector:deleted",{response:c,id:s.id,message:p,meta:s.meta||null})}).catch(function(c){c&&c.name==="AbortError"||b(o.dom,"ln-api-connector:error",{action:"delete",error:c.message,status:c.status||0,data:c.data||null,id:s.id,meta:s.meta||null})})},bulkDelete:function(f){const s=f.detail||{};o.bulkDelete(s.ids,s.url,s.idempotencyKey).then(function(c){const p=c&&c.message?c.message:null;b(o.dom,"ln-api-connector:bulk-deleted",{response:c,ids:s.ids,message:p,meta:s.meta||null})}).catch(function(c){c&&c.name==="AbortError"||b(o.dom,"ln-api-connector:error",{action:"bulk-delete",error:c.message,status:c.status||0,data:c.data||null,ids:s.ids,meta:s.meta||null})})}},o.dom.addEventListener("ln-api-connector:request-sync",o._handlers.sync),o.dom.addEventListener("ln-api-connector:request-query",o._handlers.query),o.dom.addEventListener("ln-api-connector:request-cancel",o._handlers.cancel),o.dom.addEventListener("ln-api-connector:request-create",o._handlers.create),o.dom.addEventListener("ln-api-connector:request-update",o._handlers.update),o.dom.addEventListener("ln-api-connector:request-delete",o._handlers.delete),o.dom.addEventListener("ln-api-connector:request-bulk-delete",o._handlers.bulkDelete)}d.prototype.destroy=function(){if(!this.dom[t])return;const o=this;o._inflight&&(o._inflight.forEach(function(f){f.abort()}),o._inflight.clear()),this._queryTimers&&(this._queryTimers.forEach(function(f){f&&clearTimeout(f)}),this._queryTimers.clear()),this._handlers&&(o.dom.removeEventListener("ln-api-connector:request-sync",o._handlers.sync),o.dom.removeEventListener("ln-api-connector:request-query",o._handlers.query),o.dom.removeEventListener("ln-api-connector:request-cancel",o._handlers.cancel),o.dom.removeEventListener("ln-api-connector:request-create",o._handlers.create),o.dom.removeEventListener("ln-api-connector:request-update",o._handlers.update),o.dom.removeEventListener("ln-api-connector:request-delete",o._handlers.delete),o.dom.removeEventListener("ln-api-connector:request-bulk-delete",o._handlers.bulkDelete),o._handlers=null),delete this.dom[t],delete this.dom[r]},te(e,t,d,"ln-api-connector",{attributes:a})})()})();
|