@livenetworks/ashlar 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-core/lifecycle.js +9 -0
- 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-editor/src/ln-editor.js +45 -12
- package/components/ln-external-links/ln-external-links.js +1 -1
- 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-include/ln-include.js +1 -1
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-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 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
|
+
(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 i=null;for(let n=1;n<t.length;n++)if(t[n]&&t[n].nodeType===1){i=t[n];break}if(!C(i))return}e.apply(console,t)}}function I(e,t,r){const i=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,i),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))}function 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 r=!!(t&&t.typed),i=t&&t.exclude,n={},c=e.elements,l={};if(r)for(let s=0;s<c.length;s++){const o=c[s];o.name&&o.type==="checkbox"&&!o.disabled&&(l[o.name]=(l[o.name]||0)+1)}for(let s=0;s<c.length;s++){const o=c[s];if(!(!o.name||o.disabled||o.type==="file"||o.type==="submit"||o.type==="button")&&!(i&&o.matches&&o.matches(i)))if(o.type==="checkbox")r&&l[o.name]===1?n[o.name]=o.checked:(n[o.name]||(n[o.name]=[]),o.checked&&n[o.name].push(o.value));else if(o.type==="radio")o.checked&&(n[o.name]=o.value);else if(o.type==="select-multiple"){n[o.name]=[];for(let a=0;a<o.options.length;a++)o.options[a].selected&&n[o.name].push(o.options[a].value)}else if(r&&o.type==="hidden")n[o.name]=o.value;else if(r&&(o.type==="number"||o.type==="range")){const a=Number(o.value);n[o.name]=o.value===""||isNaN(a)?null:a}else n[o.name]=o.value}return n}function Y(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function Z(e,t){const r=e.elements,i=[],n={};for(let c=0;c<r.length;c++){const l=r[c];l.name&&l.type==="checkbox"&&(n[l.name]=(n[l.name]||0)+1)}for(let c=0;c<r.length;c++){const l=r[c];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const s=l.getAttribute("data-ln-fill-as")||l.name;if(!s||!(s in t))continue;const o=t[s];if(l.type==="checkbox"){if(Array.isArray(o))l.checked=o.indexOf(l.value)!==-1;else if(n[l.name]>1){const a=String(o).split(",").map(function(u){return u.trim()});l.checked=a.indexOf(l.value)!==-1}else l.checked=Y(o);i.push(l)}else if(l.type==="radio")l.checked=l.value===String(o),i.push(l);else if(l.type==="select-multiple"){if(Array.isArray(o))for(let a=0;a<l.options.length;a++)l.options[a].selected=o.indexOf(l.options[a].value)!==-1;i.push(l)}else l.value=o,l.tagName==="SELECT"&&o!=null&&l.setAttribute("data-ln-value",o),i.push(l)}return i}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=Z,window.lnCore.serializeForm=X,window.lnCore.resolveFormMethod=P);const T={};function ee(e,t){T[e]=t}function te(e){return T[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 q={};function oe(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];q[r]=t}function re(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return q[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=oe,window.lnCore.getLocaleFallback=re,window.lnCore.ensureLocaleObserver=ne);const m={};function ie(e,t){m[e]||(m[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=m[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function F(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let l=0;l<r.length;l++){const s=r[l],o=s.getAttribute("data-ln-field");t[o]!=null&&(s.textContent=t[o])}const i=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<i.length;l++){const s=i[l],o=s.getAttribute("data-ln-attr").split(",");for(let a=0;a<o.length;a++){const u=o[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();t[f]!=null&&s.setAttribute(d,t[f])}}const n=e.querySelectorAll("[data-ln-show]");for(let l=0;l<n.length;l++){const s=n[l],o=s.getAttribute("data-ln-show");o in t&&s.classList.toggle("hidden",!t[o])}const c=e.querySelectorAll("[data-ln-class]");for(let l=0;l<c.length;l++){const s=c[l],o=s.getAttribute("data-ln-class").split(",");for(let a=0;a<o.length;a++){const u=o[a].trim().split(":");if(u.length!==2)continue;const d=u[0].trim(),f=u[1].trim();f in t&&s.classList.toggle(d,!!t[f])}}return e}function le(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let i=0;i<r.length;i++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[i],t??null),r[i].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)F(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 $(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const c=r.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,s){return t[s]!==void 0?t[s]:""}))}const i=function(c,l){return t[l]!==void 0?t[l]:""},n=Array.from(e.querySelectorAll("*"));e.nodeType===1&&n.push(e);for(let c=0;c<n.length;c++){const l=n[c],s=l.attributes;for(let o=0;o<s.length;o++){const a=s[o];a.value.indexOf("{{")!==-1&&l.setAttribute(a.name,a.value.replace(/\{\{\s*(\w+)\s*\}\}/g,i))}}return e}function se(e,t,r,i,n,c){const l={};for(let o=0;o<e.children.length;o++){const a=e.children[o],u=a.getAttribute("data-ln-render-key");u&&(l[u]=a)}const s=document.createDocumentFragment();for(let o=0;o<t.length;o++){const a=t[o],u=String(i(a));let d=l[u];if(d)n(d,a,o);else{const f=ie(r,c);if(!f||($(f,a),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",u),n(d,a,o)}s.appendChild(d)}e.textContent="",e.appendChild(s)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=F,window.lnCore.lnFill=le,window.lnCore.renderList=se);function y(e,t,r){const i=e.getAttribute(t);return i===null?r:i}function N(e,t,r){const i=parseInt(e.getAttribute(t),10);return isNaN(i)?r:i}function M(e,t,r=!1){const i=e.getAttribute(t);if(i===null)return!!r;const n=i.trim().toLowerCase();return!(n==="false"||n==="0")}function R(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const A=new Map;function B(e,t){const r=(e?e.join("|"):"")+"::"+t;if(A.has(r))return A.get(r);const i=new Set(e||[]),n=function(c,l){const s=c.getAttribute(l);return s!==null&&i.has(s)?s:t};return A.set(r,n),n}function j(e,t,r){const i=parseFloat(e.getAttribute(t));return isNaN(i)?r:i}function W(e,t,r){const i=e.getAttribute(t);if(!i)return r;try{return JSON.parse(i)}catch{return r}}function U(e,t,r,i,n){if(!e||t===null)return!0;const c=i||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const s=o=>{n?console.warn(o,n):console.warn(o)};if(l==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(s(`[${c}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const o=e.values||[];return o.includes(t)?!0:(s(`[${c}] Invalid value "${t}" for attribute "${r}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return s(`[${c}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(s(`[${c}] Value ${o} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(s(`[${c}] Value ${o} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(s(`[${c}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(o){return s(`[${c}] Invalid JSON for attribute "${r}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function ce(e,t,r){for(const i in r){const[n,c,l]=r[i];Object.defineProperty(e,i,{get:function(){return n(t,c,l)},enumerable:!0,configurable:!0})}return e}function ae(e){const t={};for(const r in e){const i=e[r];if(!i||!i.prop)continue;let n=i.read;if(!n&&i.type)switch(i.type){case"enum":n=B(i.values,i.fallback);break;case"integer":n=N;break;case"float":n=j;break;case"boolean":n=M;break;case"list":n=R;break;case"json":n=W;break;case"string":default:n=y;break}n||(n=y),t[i.prop]=[n,r,i.fallback]}return t}function ue(e){const t={};for(const r in e){const i=e[r];i&&i.effect&&(t[r]=i.effect)}return Object.keys(t).length?t:null}function de(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=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(r){console.error("["+t.attribute+"] init failed",e,r)}}}function V(e,t,r,i){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:r,ComponentFn:i};if(e.matches&&e.matches(c)&&h(e,l),e.querySelectorAll){const s=e.querySelectorAll(c);for(let o=0;o<s.length;o++)h(s[o],l)}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function fe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function we(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function 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(),r=e.observed||[];for(let i=0;i<r.length;i++){const n=r[i];t.byAttr.has(n)||t.byAttr.set(n,[]),t.byAttr.get(n).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const i in e.attributes){t.byDeclaredAttr.has(i)||t.byDeclaredAttr.set(i,[]);const n=t.byDeclaredAttr.get(i);n.some(c=>c.componentTag===e.componentTag)||n.push({spec:e.attributes[i],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const i=de(e);if(i===null)t.reactiveWildcard.push(e);else for(const n of i)t.byReactive.has(n)||t.byReactive.set(n,[]),t.byReactive.get(n).push(e)}e.persist&&t.persist.push(e)}function Q(e,t,r,i){for(let n=0;n<e.length;n++){const c=e[n];if(!t[c.attribute])continue;const l=c.effects&&c.effects[r];l?l(t,r,i):c.onAttrChange&&(!c.declared||c.declared.has(r))&&c.onAttrChange(t,r,i)}}function be(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,i=H(),n=i.byAttr.get(t),c=D()&&i.byDeclaredAttr&&i.byDeclaredAttr.has(t);if(!r&&!n&&!c)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(c&&C(l)){const s=i.byDeclaredAttr.get(t),o=l.getAttribute(t);for(let a=0;a<s.length;a++)U(s[a].spec,o,t,s[a].componentTag,l)}if(window.lnCore._debugSink&&(r||n)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),r){const s=i.byReactive.get(t);s&&Q(s,l,t,e.oldValue),i.reactiveWildcard.length&&Q(i.reactiveWildcard,l,t,e.oldValue)}if(n)for(let s=0;s<n.length;s++){const o=n[s];if(o.handler){o.handler(l,t,e.oldValue);continue}o.onAttributeChange&&l[o.attribute]?o.onAttributeChange(l,t):(V(l,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(l))}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{be(t[r])}catch(i){console.error("[ln-core] mutation handler failed",t[r].target,i)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function x(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function v(e,t){if(!document.contains(e))if(t.attribute){const r=e[t.attribute];if(r&&typeof r.destroy=="function")try{r.destroy()}catch(i){console.error("["+t.attribute+"] destroy failed",e,i)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ge(e){const t=x();if(!t.length)return;const r=e.target;if(r){const i=r.nodeType===1?r:r.parentElement;if(i&&(i.isContentEditable||i.closest&&i.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let i=0;i<t.length;i++){const n=t[i];if(n.onSubtreeChange&&n.query){const c=n.query,l=e.target.nodeType===1?e.target.matches&&e.target.matches(c)?e.target:e.target.closest?e.target.closest(c):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(c):null;l&&n.onSubtreeChange(l,e)}}for(let i=0;i<e.addedNodes.length;i++){const n=e.addedNodes[i];if(n.nodeType===1){const c=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const s=t[l];if(s.selector&&s.attribute&&s.ComponentFn){if(!c)n.matches&&n.matches(s.query)&&h(n,s);else if(n.matches&&n.matches(s.query)&&h(n,s),n.querySelectorAll){const o=n.querySelectorAll(s.query);for(let a=0;a<o.length;a++)h(o[a],s)}}s.onInit&&s.onInit(n)}}}for(let i=0;i<e.removedNodes.length;i++){const n=e.removedNodes[i];if(n.nodeType===1){const c=!!(n.firstElementChild||n.children&&n.children.length);for(let l=0;l<t.length;l++){const s=t[l],o=s.query;if(o){if(!c)n.matches&&n.matches(o)&&v(n,s);else if(n.matches&&n.matches(o)&&v(n,s),n.querySelectorAll){const a=n.querySelectorAll(o);for(let u=0;u<a.length;u++)v(a[u],s)}}}}}}function J(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.type==="childList")try{ge(i)}catch(n){console.error("[ln-core] lifecycle handler failed",i.target,n)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ce(e){x().push(e),J()}function K(e,t,r,i,n={}){const c=n.extraAttributes||[],l=n.onAttributeChange||null,s=n.onSubtreeChange||null,o=n.onInit||null,a=n.onAttrChange||null,u=n.effects||null,d=n.attributes||null,f=d?ue(d):u,Ee=d?new Set(Object.keys(d)):null,Le=n.persist||null;function g(S){const w=S||document.body;if(V(w,e,t,r),d&&D())for(const b in d){const Te=d[b],O=Array.from(w.querySelectorAll("["+b+"]"));w.matches&&w.matches("["+b+"]")&&O.push(w);for(let E=0;E<O.length;E++){const L=O[E];C(L)&&U(Te,L.getAttribute(b),b,i,L)}}o&&o(w)}const k=[];if(e.indexOf("[")!==-1){const S=/\[([\w-]+)/g;let w;for(;(w=S.exec(e))!==null;)k.push(w[1])}else k.push(e);he({selector:e,attribute:t,componentTag:i,attributes:d,ComponentFn:r,onInit:o,observed:k.concat(c),onAttributeChange:l,onAttrChange:a,effects:f,declared:Ee,persist:Le}),pe();const De=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,Ie=n.subtreeQuery||(De?e:"["+e+"]");x().push({selector:e,attribute:t,ComponentFn:r,onInit:o,onSubtreeChange:s,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,r={},i=z(t);if(!i)return r;const n=i.split("&");for(let c=0;c<n.length;c++){const l=n[c];if(!l)continue;const s=l.indexOf(":"),o=s>-1?l.slice(0,s):l,a=s>-1?l.slice(s+1):"";if(o)try{r[o]=decodeURIComponent(a)}catch{r[o]=a}}return r}function me(e){if(!e)return null;const t=_();return e in t?t[e]:null}function ye(e,t){if(!e)return;const r=_();t==null?delete r[e]:r[e]=String(t);const n=Object.keys(r).map(function(c){const l=r[c];return l===""?c:c+":"+encodeURIComponent(l)}).join("&");z(location.hash)!==n&&(location.hash=n)}function Ae(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function xe(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const i=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return i?t?i+"-"+t:i:t||null}function 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 r=e.slice(0,t),i=e.slice(t+1),n=i?i.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:r,values:n}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=_,window.lnCore.hashGet=me,window.lnCore.hashSet=ye,window.lnCore.hashLinkClick=Ae,window.lnCore.resolveHashNamespace=xe,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=_e,window.lnCore.hashFilterEncode=ke,window.lnCore.hashFilterDecode=Se);function 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 r={"data-ln-accordion":{type:"marker",description:"Identifies container as an accordion that coordinates single-panel expansion"}};function i(n){return this.dom=n,this._onToggleOpen=function(c){if(!c.detail||!c.detail.target||c.detail.target.closest("[data-ln-accordion]")!==n)return;const l=n.querySelectorAll("[data-ln-toggle]");for(const s of l)s!==c.detail.target&&s.closest("[data-ln-accordion]")===n&&s.getAttribute("data-ln-toggle")==="open"&&s.setAttribute("data-ln-toggle","close");I(n,"ln-accordion:change",{target:c.detail.target})},n.addEventListener("ln-toggle:open",this._onToggleOpen),this}i.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("ln-toggle:open",this._onToggleOpen),delete this.dom[t])},K(e,t,i,"ln-accordion",{attributes:r})})()})();
|
|
@@ -1 +1 @@
|
|
|
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
|
+
(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 i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){n=t[i];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 i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});return e.dispatchEvent(i),i}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,i={},a=e.elements,l={};if(r)for(let s=0;s<a.length;s++){const o=a[s];o.name&&o.type==="checkbox"&&!o.disabled&&(l[o.name]=(l[o.name]||0)+1)}for(let s=0;s<a.length;s++){const o=a[s];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&&l[o.name]===1?i[o.name]=o.checked:(i[o.name]||(i[o.name]=[]),o.checked&&i[o.name].push(o.value));else if(o.type==="radio")o.checked&&(i[o.name]=o.value);else if(o.type==="select-multiple"){i[o.name]=[];for(let u=0;u<o.options.length;u++)o.options[u].selected&&i[o.name].push(o.options[u].value)}else if(r&&o.type==="hidden")i[o.name]=o.value;else if(r&&(o.type==="number"||o.type==="range")){const u=Number(o.value);i[o.name]=o.value===""||isNaN(u)?null:u}else i[o.name]=o.value}return i}function 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=[],i={};for(let a=0;a<r.length;a++){const l=r[a];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let a=0;a<r.length;a++){const l=r[a];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const s=l.getAttribute("data-ln-fill-as")||l.name;if(!s||!(s in t))continue;const o=t[s];if(l.type==="checkbox"){if(Array.isArray(o))l.checked=o.indexOf(l.value)!==-1;else if(i[l.name]>1){const u=String(o).split(",").map(function(w){return w.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=ie(o);n.push(l)}else if(l.type==="radio")l.checked=l.value===String(o),n.push(l);else if(l.type==="select-multiple"){if(Array.isArray(o))for(let u=0;u<l.options.length;u++)l.options[u].selected=o.indexOf(l.options[u].value)!==-1;n.push(l)}else l.value=o,l.tagName==="SELECT"&&o!=null&&l.setAttribute("data-ln-value",o),n.push(l)}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 l=0;l<r.length;l++){const s=r[l],o=s.getAttribute("data-ln-field");t[o]!=null&&(s.textContent=t[o])}const n=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<n.length;l++){const s=n[l],o=s.getAttribute("data-ln-attr").split(",");for(let u=0;u<o.length;u++){const w=o[u].trim().split(":");if(w.length!==2)continue;const b=w[0].trim(),c=w[1].trim();t[c]!=null&&s.setAttribute(b,t[c])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const s=i[l],o=s.getAttribute("data-ln-show");o in t&&s.classList.toggle("hidden",!t[o])}const a=e.querySelectorAll("[data-ln-class]");for(let l=0;l<a.length;l++){const s=a[l],o=s.getAttribute("data-ln-class").split(",");for(let u=0;u<o.length;u++){const w=o[u].trim().split(":");if(w.length!==2)continue;const b=w[0].trim(),c=w[1].trim();c in t&&s.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 a=r.currentNode;a.textContent.indexOf("{{")!==-1&&(a.textContent=a.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,s){return t[s]!==void 0?t[s]:""}))}const n=function(a,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let a=0;a<i.length;a++){const l=i[a],s=l.attributes;for(let o=0;o<s.length;o++){const u=s[o];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,n))}}return e}function he(e,t,r,n,i,a){const l={};for(let o=0;o<e.children.length;o++){const u=e.children[o],w=u.getAttribute("data-ln-render-key");w&&(l[w]=u)}const s=document.createDocumentFragment();for(let o=0;o<t.length;o++){const u=t[o],w=String(n(u));let b=l[w];if(b)i(b,u,o);else{const c=de(r,a);if(!c||(U(c,u),b=c.firstElementChild,!b))continue;b.setAttribute("data-ln-render-key",w),i(b,u,o)}s.appendChild(b)}e.textContent="",e.appendChild(s)}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 i=n.trim().toLowerCase();return!(i==="false"||i==="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||[]),i=function(a,l){const s=a.getAttribute(l);return s!==null&&n.has(s)?s:t};return F.set(r,i),i}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,i){if(!e||t===null)return!0;const a=n||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const s=o=>{i?console.warn(o,i):console.warn(o)};if(l==="boolean"){const o=t.trim().toLowerCase();return o!==""&&o!=="true"&&o!=="false"&&o!=="1"&&o!=="0"?(s(`[${a}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const o=e.values||[];return o.includes(t)?!0:(s(`[${a}] Invalid value "${t}" for attribute "${r}". Allowed: ${o.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return s(`[${a}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const o=parseInt(t,10);return e.min!==void 0&&o<e.min?(s(`[${a}] Value ${o} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&o>e.max?(s(`[${a}] Value ${o} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(s(`[${a}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(o){return s(`[${a}] Invalid JSON for attribute "${r}": ${o.message}. Fallback: ${e.fallback}.`),!1}return!0}function be(e,t,r){for(const n in r){const[i,a,l]=r[n];Object.defineProperty(e,n,{get:function(){return i(t,a,l)},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 i=n.read;if(!i&&n.type)switch(n.type){case"enum":i=H(n.values,n.fallback);break;case"integer":i=V;break;case"float":i=J;break;case"boolean":i=K;break;case"list":i=G;break;case"json":i=P;break;case"string":default:i=q;break}i||(i=q),t[n.prop]=[i,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 a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l={selector:t,attribute:r,ComponentFn:n};if(e.matches&&e.matches(a)&&_(e,l),e.querySelectorAll){const s=e.querySelectorAll(a);for(let o=0;o<s.length;o++)_(s[o],l)}}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 i=r[n];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 n in e.attributes){t.byDeclaredAttr.has(n)||t.byDeclaredAttr.set(n,[]);const i=t.byDeclaredAttr.get(n);i.some(a=>a.componentTag===e.componentTag)||i.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 i of n)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function z(e,t,r,n){for(let i=0;i<e.length;i++){const a=e[i];if(!t[a.attribute])continue;const l=a.effects&&a.effects[r];l?l(t,r,n):a.onAttrChange&&(!a.declared||a.declared.has(r))&&a.onAttrChange(t,r,n)}}function Ae(e){const t=e.attributeName,r=t.indexOf("data-ln-")===0,n=X(),i=n.byAttr.get(t),a=ee()&&n.byDeclaredAttr&&n.byDeclaredAttr.has(t);if(!r&&!i&&!a)return;const l=e.target;if(e.oldValue!==l.getAttribute(t)){if(a&&M(l)){const s=n.byDeclaredAttr.get(t),o=l.getAttribute(t);for(let u=0;u<s.length;u++)pe(s[u].spec,o,t,s[u].componentTag,l)}if(window.lnCore._debugSink&&(r||i)&&window.lnCore._debugSink("attr",t,l,{oldValue:e.oldValue,newValue:l.getAttribute(t)}),r){const s=n.byReactive.get(t);s&&z(s,l,t,e.oldValue),n.reactiveWildcard.length&&z(n.reactiveWildcard,l,t,e.oldValue)}if(i)for(let s=0;s<i.length;s++){const o=i[s];if(o.handler){o.handler(l,t,e.oldValue);continue}o.onAttributeChange&&l[o.attribute]?o.onAttributeChange(l,t):(ye(l,o.selector,o.attribute,o.ComponentFn),o.onInit&&o.onInit(l))}}}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)return;const r=e.target;if(r){const n=r.nodeType===1?r:r.parentElement;if(n&&(n.isContentEditable||n.closest&&n.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let n=0;n<t.length;n++){const i=t[n];if(i.onSubtreeChange&&i.query){const a=i.query,l=e.target.nodeType===1?e.target.matches&&e.target.matches(a)?e.target:e.target.closest?e.target.closest(a):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(a):null;l&&i.onSubtreeChange(l,e)}}for(let n=0;n<e.addedNodes.length;n++){const i=e.addedNodes[n];if(i.nodeType===1){const a=!!(i.firstElementChild||i.children&&i.children.length);for(let l=0;l<t.length;l++){const s=t[l];if(s.selector&&s.attribute&&s.ComponentFn){if(!a)i.matches&&i.matches(s.query)&&_(i,s);else if(i.matches&&i.matches(s.query)&&_(i,s),i.querySelectorAll){const o=i.querySelectorAll(s.query);for(let u=0;u<o.length;u++)_(o[u],s)}}s.onInit&&s.onInit(i)}}}for(let n=0;n<e.removedNodes.length;n++){const i=e.removedNodes[n];if(i.nodeType===1){const a=!!(i.firstElementChild||i.children&&i.children.length);for(let l=0;l<t.length;l++){const s=t[l],o=s.query;if(o){if(!a)i.matches&&i.matches(o)&&I(i,s);else if(i.matches&&i.matches(o)&&I(i,s),i.querySelectorAll){const u=i.querySelectorAll(o);for(let w=0;w<u.length;w++)I(u[w],s)}}}}}}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(i){console.error("[ln-core] lifecycle handler failed",n.target,i)}}}).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 i=n.split("&");for(let a=0;a<i.length;a++){const l=i[a];if(!l)continue;const s=l.indexOf(":"),o=s>-1?l.slice(0,s):l,u=s>-1?l.slice(s+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 i=Object.keys(r).map(function(a){const l=r[a];return l===""?a:a+":"+encodeURIComponent(l)}).join("&");Y(location.hash)!==i&&(location.hash=i)}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),i=n?n.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:r,values:i}}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 i(c){if(!c.hasAttribute(e)||c[t])return;c[t]=!0;const f=u(c);a(f.links),l(f.forms)}function a(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 h=function(A){if(!ne(A,f))return;A.preventDefault();const E=f.getAttribute("href");E&&o("GET",E,null,f)};f.addEventListener("click",h),f[t+"Trigger"]=h}}function l(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(h){if(h.defaultPrevented)return;h.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 s(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,h,A){if(te(h,"ln-ajax:before-start",{method:c,url:f}).defaultPrevented)return;c==="GET"&&n&&n(),y(h,"ln-ajax:start",{method:c,url:f}),h.classList.add("ln-ajax--loading");const T=document.createElement("span");T.className="ln-ajax-spinner",h.appendChild(T);function x(){h.classList.remove("ln-ajax--loading");const p=h.querySelector(".ln-ajax-spinner");p&&p.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 p=new URLSearchParams(d);m=f+(f.includes("?")?"&":"?")+p.toString()}else c!=="GET"&&d&&(O.body=d);let k=null;if(c==="GET"){const p=new AbortController;O.signal=p.signal,k=function(){n=null,p.abort(),x(),y(h,"ln-ajax:aborted",{method:c,url:m})},n=k}fetch(m,O).then(function(p){const $=p.ok,g=p.status;return p.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(p){k&&n===k&&(n=null);const $=p.status,g=p.data,v=p.parseError;if(p.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(h.tagName==="A"){const C=h.getAttribute("href");C&&window.history.pushState({ajax:!0},"",C)}else h.tagName==="FORM"&&h.method.toUpperCase()==="GET"&&window.history.pushState({ajax:!0},"",m);y(h,"ln-ajax:success",{method:c,url:m,data:g})}else y(h,"ln-ajax:error",{method:c,url:m,status:$,data:g,error:v||null});x(),y(h,"ln-ajax:complete",{method:c,url:m})}).catch(function(p){p&&p.name==="AbortError"||(k&&n===k&&(n=null),y(h,"ln-ajax:error",{method:c,url:m,status:0,data:null,error:p}),x(),y(h,"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 w(){S(function(){_e({onInit:function(c){if(i(c),!c.hasAttribute(e)){for(const d of c.querySelectorAll("["+e+"]"))i(d);const f=c.closest&&c.closest("["+e+"]");if(f&&f.getAttribute(e)!=="false"){const d=u(c);a(d.links),l(d.forms)}}}}),Se([e],function(c){i(c)})},"ln-ajax")}function b(){for(const c of document.querySelectorAll("["+e+"]"))i(c)}window[t]=i,window[t].destroy=s,w(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",b):b()})()})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function N(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function 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})})()})();
|
|
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 r=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){r=t[i];break}if(!S(r))return}e.apply(console,t)}}function b(e,t,o){const r=o||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function 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 o=!!(t&&t.typed),r=t&&t.exclude,i={},u=e.elements,a={};if(o)for(let c=0;c<u.length;c++){const l=u[c];l.name&&l.type==="checkbox"&&!l.disabled&&(a[l.name]=(a[l.name]||0)+1)}for(let c=0;c<u.length;c++){const l=u[c];if(!(!l.name||l.disabled||l.type==="file"||l.type==="submit"||l.type==="button")&&!(r&&l.matches&&l.matches(r)))if(l.type==="checkbox")o&&a[l.name]===1?i[l.name]=l.checked:(i[l.name]||(i[l.name]=[]),l.checked&&i[l.name].push(l.value));else if(l.type==="radio")l.checked&&(i[l.name]=l.value);else if(l.type==="select-multiple"){i[l.name]=[];for(let n=0;n<l.options.length;n++)l.options[n].selected&&i[l.name].push(l.options[n].value)}else if(o&&l.type==="hidden")i[l.name]=l.value;else if(o&&(l.type==="number"||l.type==="range")){const n=Number(l.value);i[l.name]=l.value===""||isNaN(n)?null:n}else i[l.name]=l.value}return i}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 o=e.elements,r=[],i={};for(let u=0;u<o.length;u++){const a=o[u];a.name&&a.type==="checkbox"&&(i[a.name]=(i[a.name]||0)+1)}for(let u=0;u<o.length;u++){const a=o[u];if(a.type==="file"||a.type==="submit"||a.type==="button")continue;const c=a.getAttribute("data-ln-fill-as")||a.name;if(!c||!(c in t))continue;const l=t[c];if(a.type==="checkbox"){if(Array.isArray(l))a.checked=l.indexOf(a.value)!==-1;else if(i[a.name]>1){const n=String(l).split(",").map(function(f){return f.trim()});a.checked=n.indexOf(a.value)!==-1}else a.checked=le(l);r.push(a)}else if(a.type==="radio")a.checked=a.value===String(l),r.push(a);else if(a.type==="select-multiple"){if(Array.isArray(l))for(let n=0;n<a.options.length;n++)a.options[n].selected=l.indexOf(a.options[n].value)!==-1;r.push(a)}else a.value=l,a.tagName==="SELECT"&&l!=null&&a.setAttribute("data-ln-value",l),r.push(a)}return r}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(o){return console.error(`[${t}] Invalid headers JSON:`,o),{}}}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 o=e.toLowerCase().split("-")[0];U[o]=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 o=q[e];return o?o.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function M(e,t){if(!e||!t)return e;const o=e.querySelectorAll("[data-ln-field]");for(let a=0;a<o.length;a++){const c=o[a],l=c.getAttribute("data-ln-field");t[l]!=null&&(c.textContent=t[l])}const r=e.querySelectorAll("[data-ln-attr]");for(let a=0;a<r.length;a++){const c=r[a],l=c.getAttribute("data-ln-attr").split(",");for(let n=0;n<l.length;n++){const f=l[n].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),d=f[1].trim();t[d]!=null&&c.setAttribute(s,t[d])}}const i=e.querySelectorAll("[data-ln-show]");for(let a=0;a<i.length;a++){const c=i[a],l=c.getAttribute("data-ln-show");l in t&&c.classList.toggle("hidden",!t[l])}const u=e.querySelectorAll("[data-ln-class]");for(let a=0;a<u.length;a++){const c=u[a],l=c.getAttribute("data-ln-class").split(",");for(let n=0;n<l.length;n++){const f=l[n].trim().split(":");if(f.length!==2)continue;const s=f[0].trim(),d=f[1].trim();d in t&&c.classList.toggle(s,!!t[d])}}return e}function we(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const o=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<o.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",o[r],t??null),o[r].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)M(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 B(e,t){if(!e||!t)return e;const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;o.nextNode();){const u=o.currentNode;u.textContent.indexOf("{{")!==-1&&(u.textContent=u.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(a,c){return t[c]!==void 0?t[c]:""}))}const r=function(u,a){return t[a]!==void 0?t[a]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let u=0;u<i.length;u++){const a=i[u],c=a.attributes;for(let l=0;l<c.length;l++){const n=c[l];n.value.indexOf("{{")!==-1&&a.setAttribute(n.name,n.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function me(e,t,o,r,i,u){const a={};for(let l=0;l<e.children.length;l++){const n=e.children[l],f=n.getAttribute("data-ln-render-key");f&&(a[f]=n)}const c=document.createDocumentFragment();for(let l=0;l<t.length;l++){const n=t[l],f=String(r(n));let s=a[f];if(s)i(s,n,l);else{const d=he(o,u);if(!d||(B(d,n),s=d.firstElementChild,!s))continue;s.setAttribute("data-ln-render-key",f),i(s,n,l)}c.appendChild(s)}e.textContent="",e.appendChild(c)}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,o){const r=e.getAttribute(t);return r===null?o:r}function H(e,t,o){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?o:r}function W(e,t,o=!1){const r=e.getAttribute(t);if(r===null)return!!o;const i=r.trim().toLowerCase();return!(i==="false"||i==="0")}function Q(e,t){return(e.getAttribute(t)||"").split(",").map(o=>o.trim()).filter(Boolean)}const L=new Map;function J(e,t){const o=(e?e.join("|"):"")+"::"+t;if(L.has(o))return L.get(o);const r=new Set(e||[]),i=function(u,a){const c=u.getAttribute(a);return c!==null&&r.has(c)?c:t};return L.set(o,i),i}function K(e,t,o){const r=parseFloat(e.getAttribute(t));return isNaN(r)?o:r}function V(e,t,o){const r=e.getAttribute(t);if(!r)return o;try{return JSON.parse(r)}catch{return o}}function G(e,t,o,r,i){if(!e||t===null)return!0;const u=r||"ln-component",a=e.type;if(a==="trigger"||a==="marker"||a==="string"||a==="list"||!a||t===""&&e.fallback!==void 0)return!0;const c=l=>{i?console.warn(l,i):console.warn(l)};if(a==="boolean"){const l=t.trim().toLowerCase();return l!==""&&l!=="true"&&l!=="false"&&l!=="1"&&l!=="0"?(c(`[${u}] Invalid value "${t}" for boolean attribute "${o}". Allowed: "true", "false", or presence-only.`),!1):!0}if(a==="enum"){const l=e.values||[];return l.includes(t)?!0:(c(`[${u}] Invalid value "${t}" for attribute "${o}". Allowed: ${l.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(a==="integer"){if(!/^-?\d+$/.test(t))return c(`[${u}] Invalid integer "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1;const l=parseInt(t,10);return e.min!==void 0&&l<e.min?(c(`[${u}] Value ${l} for attribute "${o}" is less than min (${e.min}).`),!1):e.max!==void 0&&l>e.max?(c(`[${u}] Value ${l} for attribute "${o}" is greater than max (${e.max}).`),!1):!0}if(a==="float")return isNaN(Number(t))?(c(`[${u}] Invalid float "${t}" for attribute "${o}". Fallback: ${e.fallback}.`),!1):!0;if(a==="json")try{return JSON.parse(t),!0}catch(l){return c(`[${u}] Invalid JSON for attribute "${o}": ${l.message}. Fallback: ${e.fallback}.`),!1}return!0}function z(e,t,o){for(const r in o){const[i,u,a]=o[r];Object.defineProperty(e,r,{get:function(){return i(t,u,a)},enumerable:!0,configurable:!0})}return e}function X(e){const t={};for(const o in e){const r=e[o];if(!r||!r.prop)continue;let i=r.read;if(!i&&r.type)switch(r.type){case"enum":i=J(r.values,r.fallback);break;case"integer":i=H;break;case"float":i=K;break;case"boolean":i=W;break;case"list":i=Q;break;case"json":i=V;break;case"string":default:i=C;break}i||(i=C),t[r.prop]=[i,o,r.fallback]}return t}function be(e){const t={};for(const o in e){const r=e[o];r&&r.effect&&(t[o]=r.effect)}return Object.keys(t).length?t:null}function ge(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=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(o){console.error("["+t.attribute+"] init failed",e,o)}}}function Y(e,t,o,r){if(e.nodeType!==1)return;const u=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",a={selector:t,attribute:o,ComponentFn:r};if(e.matches&&e.matches(u)&&v(e,a),e.querySelectorAll){const c=e.querySelectorAll(u);for(let l=0;l<c.length;l++)v(c[l],a)}}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(),o=e.observed||[];for(let r=0;r<o.length;r++){const i=o[r];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const i=t.byDeclaredAttr.get(r);i.some(u=>u.componentTag===e.componentTag)||i.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=ge(e);if(r===null)t.reactiveWildcard.push(e);else for(const i of r)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function P(e,t,o,r){for(let i=0;i<e.length;i++){const u=e[i];if(!t[u.attribute])continue;const a=u.effects&&u.effects[o];a?a(t,o,r):u.onAttrChange&&(!u.declared||u.declared.has(o))&&u.onAttrChange(t,o,r)}}function Ae(e){const t=e.attributeName,o=t.indexOf("data-ln-")===0,r=Z(),i=r.byAttr.get(t),u=N()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(t);if(!o&&!i&&!u)return;const a=e.target;if(e.oldValue!==a.getAttribute(t)){if(u&&S(a)){const c=r.byDeclaredAttr.get(t),l=a.getAttribute(t);for(let n=0;n<c.length;n++)G(c[n].spec,l,t,c[n].componentTag,a)}if(window.lnCore._debugSink&&(o||i)&&window.lnCore._debugSink("attr",t,a,{oldValue:e.oldValue,newValue:a.getAttribute(t)}),o){const c=r.byReactive.get(t);c&&P(c,a,t,e.oldValue),r.reactiveWildcard.length&&P(r.reactiveWildcard,a,t,e.oldValue)}if(i)for(let c=0;c<i.length;c++){const l=i[c];if(l.handler){l.handler(a,t,e.oldValue);continue}l.onAttributeChange&&a[l.attribute]?l.onAttributeChange(a,t):(Y(a,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(a))}}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,E(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++)try{Ae(t[o])}catch(r){console.error("[ln-core] mutation handler failed",t[o].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function O(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function T(e,t){if(!document.contains(e))if(t.attribute){const o=e[t.attribute];if(o&&typeof o.destroy=="function")try{o.destroy()}catch(r){console.error("["+t.attribute+"] destroy failed",e,r)}delete e[t.attribute]}else t.onDestroy&&t.onDestroy(e)}function ke(e){const t=O();if(!t.length)return;const o=e.target;if(o){const r=o.nodeType===1?o:o.parentElement;if(r&&(r.isContentEditable||r.closest&&r.closest('[contenteditable]:not([contenteditable="false"])')))return}if(e.target)for(let r=0;r<t.length;r++){const i=t[r];if(i.onSubtreeChange&&i.query){const u=i.query,a=e.target.nodeType===1?e.target.matches&&e.target.matches(u)?e.target:e.target.closest?e.target.closest(u):null:e.target.parentElement&&e.target.parentElement.closest?e.target.parentElement.closest(u):null;a&&i.onSubtreeChange(a,e)}}for(let r=0;r<e.addedNodes.length;r++){const i=e.addedNodes[r];if(i.nodeType===1){const u=!!(i.firstElementChild||i.children&&i.children.length);for(let a=0;a<t.length;a++){const c=t[a];if(c.selector&&c.attribute&&c.ComponentFn){if(!u)i.matches&&i.matches(c.query)&&v(i,c);else if(i.matches&&i.matches(c.query)&&v(i,c),i.querySelectorAll){const l=i.querySelectorAll(c.query);for(let n=0;n<l.length;n++)v(l[n],c)}}c.onInit&&c.onInit(i)}}}for(let r=0;r<e.removedNodes.length;r++){const i=e.removedNodes[r];if(i.nodeType===1){const u=!!(i.firstElementChild||i.children&&i.children.length);for(let a=0;a<t.length;a++){const c=t[a],l=c.query;if(l){if(!u)i.matches&&i.matches(l)&&T(i,c);else if(i.matches&&i.matches(l)&&T(i,c),i.querySelectorAll){const n=i.querySelectorAll(l);for(let f=0;f<n.length;f++)T(n[f],c)}}}}}}function ee(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,E(function(){new MutationObserver(function(t){for(let o=0;o<t.length;o++){const r=t[o];if(r.type==="childList")try{ke(r)}catch(i){console.error("[ln-core] lifecycle handler failed",r.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Ee(e){O().push(e),ee()}function te(e,t,o,r,i={}){const u=i.extraAttributes||[],a=i.onAttributeChange||null,c=i.onSubtreeChange||null,l=i.onInit||null,n=i.onAttrChange||null,f=i.effects||null,s=i.attributes||null,d=s?be(s):f,p=s?new Set(Object.keys(s)):null,h=i.persist||null;function m(k){const w=k||document.body;if(Y(w,e,t,o),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,r,$)}}l&&l(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:r,attributes:s,ComponentFn:o,onInit:l,observed:y.concat(u),onAttributeChange:a,onAttrChange:n,effects:d,declared:p,persist:h}),ve();const I=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1,x=i.subtreeQuery||(I?e:"["+e+"]");O().push({selector:e,attribute:t,ComponentFn:o,onInit:l,onSubtreeChange:c,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,o={},r=ne(t);if(!r)return o;const i=r.split("&");for(let u=0;u<i.length;u++){const a=i[u];if(!a)continue;const c=a.indexOf(":"),l=c>-1?a.slice(0,c):a,n=c>-1?a.slice(c+1):"";if(l)try{o[l]=decodeURIComponent(n)}catch{o[l]=n}}return o}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 o=D();t==null?delete o[e]:o[e]=String(t);const i=Object.keys(o).map(function(u){const a=o[u];return a===""?u:u+":"+encodeURIComponent(a)}).join("&");ne(location.hash)!==i&&(location.hash=i)}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 o=e.getAttribute("data-ln-hash");if(o&&o.trim()!=="")return o.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function 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 o=e.slice(0,t),r=e.slice(t+1),i=r?r.split(",").map(function(u){try{return decodeURIComponent(u)}catch{return u}}).filter(Boolean):[];return{key:o,values:i}}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,o)=>{const r=String(t);return o===0?r.replace(/\/+$/,""):r.replace(/^\/+/,"").replace(/\/+$/,"")}).filter(Boolean).join("/")}function $e(e,t){if(!e||typeof e!="object")return"";const o=Object.assign({},je);if(t&&typeof t=="object")for(const i in t)t[i]!==void 0&&t[i]!==null&&t[i]!==""&&(o[i]=t[i]);const r=new URLSearchParams;return e.search&&r.append(o.search,e.search),e.offset!=null&&r.append(o.offset,e.offset),e.limit!=null&&r.append(o.limit,e.limit),e.sort&&e.sort.field&&e.sort.direction&&(r.append(o.sortField,e.sort.field),r.append(o.sortDir,e.sort.direction)),e.filters&&typeof e.filters=="object"&&Object.keys(e.filters).forEach(i=>{const u=e.filters[i];Array.isArray(u)&&u.length>0&&r.append(i,u.join(","))}),r.toString()}function Ne(e,t,o){let r=_(e,t);return o&&(r+=(r.indexOf("?")!==-1?"&":"?")+o),r}function re(e){const t=e&&e.content!==void 0?e.content:e,o=e&&e.message?e.message:null;return{record:t,message:o}}(function(){const e="data-ln-api-connector",t="lnApiConnector",o="lnConnector";if(window[t]!==void 0)return;function r(n){const f=n[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:r,description:"Base URL endpoint for API requests"},"data-ln-api-path":{prop:"path",read:C,type:"string",fallback:"",effect:r,description:"Resource path appended to base URL"},"data-ln-api-endpoint":{prop:"path",read:C,type:"string",fallback:"",effect:r,description:"Alias for data-ln-api-path"},"data-ln-api-headers":{prop:"rawHeaders",read:C,type:"json",fallback:null,effect:r,description:"Custom HTTP headers in JSON format or semicolon-separated pairs"},"data-ln-api-param-offset":{effect:r,type:"string",fallback:"offset",description:"Query parameter name for pagination offset"},"data-ln-api-param-limit":{effect:r,type:"string",fallback:"limit",description:"Query parameter name for pagination page size"},"data-ln-api-param-search":{effect:r,type:"string",fallback:"search",description:"Query parameter name for text search filter"},"data-ln-api-param-sort-field":{effect:r,type:"string",fallback:"sort_by",description:"Query parameter name for sort field"},"data-ln-api-param-sort-dir":{effect:r,type:"string",fallback:"sort_dir",description:"Query parameter name for sort direction"},"data-ln-api-connector-query-debounce":{effect:r,type:"integer",fallback:200,min:0,description:"Debounce delay in milliseconds before dispatching query requests"}},u=X(i);function a(n){return n.ok?n.status===204?null:n.json():n.json().catch(()=>null).then(f=>{const s=new Error("HTTP "+n.status+": "+n.statusText);throw s.status=n.status,s.data=f,s})}function c(n){return this.dom=n,z(this,n,u),n[t]=this,n[o]=this,this.namespace="ln-api-connector",this._inflight=new Map,this._queryTimers=new Map,this.refreshConfig(),this._handlers=null,l(this),this}c.prototype.refreshConfig=function(){const n=this.dom;this.credentials="same-origin",this.headers=se(this.rawHeaders);const f={},s=n.getAttribute("data-ln-api-param-offset");s&&(f.offset=s);const d=n.getAttribute("data-ln-api-param-limit");d&&(f.limit=d);const p=n.getAttribute("data-ln-api-param-search");p&&(f.search=p);const h=n.getAttribute("data-ln-api-param-sort-field");h&&(f.sortField=h);const m=n.getAttribute("data-ln-api-param-sort-dir");m&&(f.sortDir=m),this.paramKeys=f;const y=n.getAttribute("data-ln-api-connector-query-debounce");this.queryDebounce=y!==null?+y:300,b(this.dom,"ln-api-connector:config-changed",{baseUrl:this.baseUrl,path:this.path,headers:this.headers,paramKeys:this.paramKeys})},c.prototype._reqHeaders=function(n){const f=Object.assign({},this.headers);return!f.Accept&&!f.accept&&(f.Accept="application/json"),!f["Content-Type"]&&!f["content-type"]&&(f["Content-Type"]="application/json"),n&&(f["X-Idempotency-Key"]=n),f},c.prototype.cancel=function(n){return n&&this._inflight.has(n)?(this._inflight.get(n).abort(),this._inflight.delete(n),!0):!1},c.prototype.fetchDelta=function(n,f){const s=this;let d=_(s.baseUrl,s.path);n!=null&&n!==""&&(d+=(d.indexOf("?")!==-1?"&":"?")+"since="+encodeURIComponent(n));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(d,{method:"GET",headers:s._reqHeaders(),credentials:s.credentials,signal:h.signal}).then(a).finally(function(){s._inflight.get(p)===h&&s._inflight.delete(p)})},c.prototype.query=function(n,f){const s=this,d=$e(n,s.paramKeys),p=Ne(s.baseUrl,s.path,d),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(a).finally(function(){s._inflight.get(h)===m&&s._inflight.delete(h)})},c.prototype.create=function(n,f,s){const d=this;return window.fetch(_(d.baseUrl,f||d.path),{method:"POST",headers:d._reqHeaders(s),credentials:d.credentials,body:JSON.stringify(n)}).then(a)},c.prototype.update=function(n,f,s,d,p){const h=this;s!=null&&(f=Object.assign({},f,{expected_version:s}));const m=d?_(h.baseUrl,d):_(h.baseUrl,h.path,n);return window.fetch(m,{method:"PUT",headers:h._reqHeaders(p),credentials:h.credentials,body:JSON.stringify(f)}).then(a)},c.prototype.delete=function(n,f,s){const d=this;return window.fetch(_(d.baseUrl,f||d.path,n),{method:"DELETE",headers:d._reqHeaders(s),credentials:d.credentials}).then(a)},c.prototype.bulkDelete=function(n,f,s){const d=this;return window.fetch(_(d.baseUrl,f||d.path,"bulk-delete"),{method:"DELETE",headers:d._reqHeaders(s),credentials:d.credentials,body:JSON.stringify({ids:n})}).then(a)};function l(n){n._handlers={sync:function(f){const s=f.detail||{},d=s.meta&&s.meta.targetEl?s.meta.targetEl:null;n.fetchDelta(s.since,d).then(function(p){b(n.dom,"ln-api-connector:fetched",{data:p,since:s.since,meta:s.meta||null})}).catch(function(p){p&&p.name==="AbortError"||b(n.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||{},d=s.query||s,p=s.meta&&s.meta.targetEl?s.meta.targetEl:null,h=p||"query",m=n.queryDebounce;function y(x,A,k){n.query(A,k).then(function(w){const g=w||{};b(n.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(n.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,d,p);return}n._queryTimers.has(h)&&clearTimeout(n._queryTimers.get(h));const I=setTimeout(function(){n._queryTimers.delete(h),y(s,d,p)},m);n._queryTimers.set(h,I)},cancel:function(f){const s=f.detail||{},d=s.meta&&s.meta.targetEl?s.meta.targetEl:s.targetEl||s.key;d&&n.cancel(d)},create:function(f){const s=f.detail||{};n.create(s.data,s.url,s.idempotencyKey).then(function(d){const p=re(d);b(n.dom,"ln-api-connector:created",{record:p.record,tempId:s.tempId,message:p.message,meta:s.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"create",error:d.message,status:d.status||0,data:d.data||null,tempId:s.tempId,meta:s.meta||null})})},update:function(f){const s=f.detail||{};n.update(s.id,s.data,s.expected_version,s.url,s.idempotencyKey).then(function(d){const p=re(d);b(n.dom,"ln-api-connector:updated",{record:p.record,id:s.id,message:p.message,meta:s.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"update",error:d.message,status:d.status||0,data:d.data||null,id:s.id,conflictData:d.status===409?d.data:null,meta:s.meta||null})})},delete:function(f){const s=f.detail||{};n.delete(s.id,s.url,s.idempotencyKey).then(function(d){const p=d&&d.message?d.message:null;b(n.dom,"ln-api-connector:deleted",{response:d,id:s.id,message:p,meta:s.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"delete",error:d.message,status:d.status||0,data:d.data||null,id:s.id,meta:s.meta||null})})},bulkDelete:function(f){const s=f.detail||{};n.bulkDelete(s.ids,s.url,s.idempotencyKey).then(function(d){const p=d&&d.message?d.message:null;b(n.dom,"ln-api-connector:bulk-deleted",{response:d,ids:s.ids,message:p,meta:s.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(n.dom,"ln-api-connector:error",{action:"bulk-delete",error:d.message,status:d.status||0,data:d.data||null,ids:s.ids,meta:s.meta||null})})}},n.dom.addEventListener("ln-api-connector:request-sync",n._handlers.sync),n.dom.addEventListener("ln-api-connector:request-query",n._handlers.query),n.dom.addEventListener("ln-api-connector:request-cancel",n._handlers.cancel),n.dom.addEventListener("ln-api-connector:request-create",n._handlers.create),n.dom.addEventListener("ln-api-connector:request-update",n._handlers.update),n.dom.addEventListener("ln-api-connector:request-delete",n._handlers.delete),n.dom.addEventListener("ln-api-connector:request-bulk-delete",n._handlers.bulkDelete)}c.prototype.destroy=function(){if(!this.dom[t])return;const n=this;n._inflight&&(n._inflight.forEach(function(f){f.abort()}),n._inflight.clear()),this._queryTimers&&(this._queryTimers.forEach(function(f){f&&clearTimeout(f)}),this._queryTimers.clear()),this._handlers&&(n.dom.removeEventListener("ln-api-connector:request-sync",n._handlers.sync),n.dom.removeEventListener("ln-api-connector:request-query",n._handlers.query),n.dom.removeEventListener("ln-api-connector:request-cancel",n._handlers.cancel),n.dom.removeEventListener("ln-api-connector:request-create",n._handlers.create),n.dom.removeEventListener("ln-api-connector:request-update",n._handlers.update),n.dom.removeEventListener("ln-api-connector:request-delete",n._handlers.delete),n.dom.removeEventListener("ln-api-connector:request-bulk-delete",n._handlers.bulkDelete),n._handlers=null),delete this.dom[t],delete this.dom[o]},te(e,t,c,"ln-api-connector",{attributes:i})})()})();
|