@livenetworks/ashlar 2.0.7 → 2.0.9
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/LICENSE +641 -641
- package/components/COMPONENTS.md +1116 -1116
- package/components/index.js +81 -81
- package/components/ln-accordion/ln-accordion-dev.scss +8 -8
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-accordion/ln-accordion.schema.json +30 -30
- package/components/ln-ajax/ln-ajax-dev.scss +8 -8
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-ajax/ln-ajax.schema.json +30 -30
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-connector/ln-api-connector.schema.json +9 -0
- package/components/ln-api-connector/src/ln-api-connector.js +2 -0
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-api-queue/ln-api-queue.schema.json +34 -34
- package/components/ln-api-queue/src/ln-api-queue.js +3 -13
- package/components/ln-autoresize/ln-autoresize-dev.scss +8 -8
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autoresize/ln-autoresize.schema.json +22 -22
- package/components/ln-autosave/ln-autosave-dev.scss +13 -13
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-autosave/ln-autosave.schema.json +48 -48
- package/components/ln-autosave/src/autosave-model.js +34 -34
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-chart/ln-chart.schema.json +146 -146
- package/components/ln-chart/src/chart-model.js +154 -154
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.schema.json +42 -42
- package/components/ln-confirm/ln-confirm-dev.scss +24 -24
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-confirm/ln-confirm.schema.json +66 -66
- package/components/ln-confirm/src/ln-confirm.js +178 -178
- package/components/ln-core/attrs.js +13 -0
- package/components/ln-core/crypto.js +286 -265
- package/components/ln-core/dom.js +115 -115
- package/components/ln-core/form.js +146 -136
- package/components/ln-core/helpers.js +33 -33
- package/components/ln-core/http.js +48 -48
- package/components/ln-core/index.js +1 -1
- package/components/ln-core/lifecycle.js +5 -0
- package/components/ln-core/ln-core.schema.json +3 -2
- package/components/ln-core/locale.js +55 -55
- package/components/ln-core/matching.js +78 -78
- package/components/ln-core/number.js +125 -125
- package/components/ln-core/template.js +206 -206
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-couchdb-connector/ln-couchdb-connector.schema.json +50 -50
- package/components/ln-couchdb-connector/src/ln-couchdb-connector.js +1 -0
- package/components/ln-data-coordinator/README.md +9 -38
- package/components/ln-data-coordinator/ln-data-coordinator-dev.scss +8 -8
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.schema.json +16 -16
- package/components/ln-data-coordinator/src/data-read-policy.js +0 -7
- package/components/ln-data-coordinator/src/ln-data-coordinator.js +432 -1308
- package/components/ln-data-store/ln-data-store-dev.scss +13 -13
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-data-store/ln-data-store.schema.json +84 -84
- package/components/ln-data-store/src/data-store-model.js +184 -184
- package/components/ln-data-store/src/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-date/ln-date.schema.json +92 -92
- package/components/ln-date/src/date-model.js +186 -186
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/ln-debug.schema.json +28 -28
- package/components/ln-debug/src/console-sink.js +19 -19
- package/components/ln-debug/src/gate.js +95 -95
- package/components/ln-debug/src/generated-attributes.js +4 -2
- package/components/ln-dropdown/ln-dropdown-dev.scss +13 -13
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-editor/ln-editor.schema.json +58 -58
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-external-links/ln-external-links.schema.json +18 -18
- package/components/ln-fill/ln-fill.js +1 -1
- package/components/ln-fill/ln-fill.schema.json +23 -23
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +153 -153
- package/components/ln-filter/src/filter-model.js +185 -185
- package/components/ln-form/ln-form-dev.scss +8 -8
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-form/ln-form.schema.json +6 -0
- package/components/ln-form/src/ln-form.js +21 -0
- package/components/ln-http/ln-http.js +1 -1
- package/components/ln-http/ln-http.schema.json +6 -6
- package/components/ln-icon/ln-icon.schema.json +6 -6
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-include/ln-include.schema.json +23 -23
- package/components/ln-key/ln-key-dev.scss +18 -18
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-key/ln-key.schema.json +56 -56
- package/components/ln-key/src/ln-key.js +10 -10
- package/components/ln-link/ln-link-dev.scss +8 -8
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-link/ln-link.schema.json +22 -22
- package/components/ln-list/README.md +152 -152
- package/components/ln-list/ln-list-dev.scss +8 -8
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-list/ln-list.schema.json +166 -166
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-modal/ln-modal.schema.json +65 -65
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-nav/ln-nav.schema.json +25 -25
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-number/ln-number.schema.json +63 -63
- package/components/ln-number/src/ln-number.js +26 -0
- package/components/ln-number/src/number-model.js +31 -31
- package/components/ln-obfuscator/README.md +60 -60
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.schema.json +49 -49
- package/components/ln-obfuscator/src/ln-obfuscator.js +159 -159
- package/components/ln-obfuscator/src/obfuscator-model.js +250 -250
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-options/ln-options.schema.json +6 -0
- package/components/ln-options/src/ln-options.js +4 -4
- package/components/ln-persist/README.md +151 -151
- package/components/ln-persist/ln-persist.js +1 -1
- package/components/ln-persist/ln-persist.schema.json +28 -28
- package/components/ln-persist/src/ln-persist.js +83 -83
- package/components/ln-picklist/README.md +230 -230
- package/components/ln-picklist/ln-picklist-dev.scss +22 -22
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-picklist/ln-picklist.schema.json +49 -49
- package/components/ln-picklist/src/ln-picklist.js +228 -228
- package/components/ln-popover/ln-popover-dev.scss +13 -13
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-popover/ln-popover.schema.json +82 -82
- package/components/ln-progress/ln-progress-dev.scss +8 -8
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-progress/ln-progress.schema.json +40 -40
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-router/ln-router.schema.json +76 -76
- package/components/ln-scroll/README.md +45 -45
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-scroll/ln-scroll.schema.json +85 -85
- package/components/ln-scroll/src/ln-scroll.js +150 -150
- package/components/ln-search/README.md +188 -188
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-search/ln-search.schema.json +103 -103
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-slug/ln-slug.schema.json +23 -23
- package/components/ln-slug/src/ln-slug.js +25 -1
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sort/ln-sort.schema.json +104 -104
- package/components/ln-sort/src/ln-sort.js +321 -321
- package/components/ln-sort/src/sort-model.js +117 -117
- package/components/ln-sortable/ln-sortable-dev.scss +13 -13
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-sortable/ln-sortable.schema.json +36 -36
- package/components/ln-stat/ln-stat-dev.scss +8 -8
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-stat/ln-stat.schema.json +32 -32
- package/components/ln-stat/src/stat-model.js +28 -28
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table/ln-table.schema.json +211 -211
- package/components/ln-table/src/table-model.js +98 -98
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.schema.json +93 -93
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-tabs/ln-tabs.schema.json +75 -75
- package/components/ln-tabs/src/ln-tabs.js +208 -208
- package/components/ln-tabs/src/tabs-model.js +82 -82
- package/components/ln-time/ln-time-dev.scss +13 -13
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-time/ln-time.schema.json +38 -38
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toast/ln-toast.schema.json +65 -65
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-toggle/ln-toggle.schema.json +52 -52
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-tooltip/ln-tooltip.schema.json +86 -86
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-translations/ln-translations.schema.json +120 -120
- package/components/ln-ui-coordinator/README.md +62 -62
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +28 -28
- package/components/ln-ui-coordinator/src/ln-ui-coordinator.js +140 -140
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-upload/ln-upload.schema.json +193 -193
- package/components/ln-upload/src/upload-model.js +78 -78
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-validate/ln-validate.schema.json +50 -50
- package/components/ln-validate/src/validate-model.js +64 -64
- package/components/ln-websocket-connector/README.md +166 -166
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.schema.json +29 -29
- package/components/ln-websocket-connector/src/ln-websocket-connector.js +283 -279
- package/ln-ashlar.html-data.json +15 -8
- package/package.json +85 -84
- package/theme/brand.css +73 -73
- package/theme/components/_confirm.scss +6 -6
- package/theme/components/_picklist.scss +3 -3
- package/theme/config/_palette.scss +274 -274
- package/theme/config/_theme.scss +292 -292
- package/theme/config/_tokens.scss +285 -285
- package/theme/config/mixins/_index.scss +62 -62
- package/theme/config/mixins/_picklist.scss +66 -66
- package/theme/ln-ashlar-dev.scss +66 -66
- package/theme/ln-ashlar-landing.scss +56 -56
- package/theme/ln-ashlar-theme.scss +63 -63
- package/theme/presentation/_bento.scss +151 -151
- package/theme/presentation/_cta.scss +111 -111
- package/theme/presentation/_effects.scss +216 -216
- package/theme/presentation/_features.scss +108 -108
- package/theme/presentation/_footer.scss +129 -129
- package/theme/presentation/_hero.scss +158 -158
- package/theme/presentation/_layout.scss +170 -170
- package/theme/presentation/_navbar.scss +140 -140
- package/theme/presentation/_pricing.scss +262 -262
- package/theme/presentation/_stats.scss +87 -87
- package/theme/presentation/_testimonials.scss +124 -124
- package/theme/presentation/_tokens.scss +39 -39
- package/theme/presentation/_typography.scss +163 -163
- package/web-types.json +26 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function $(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function 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 a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){r=t[a];break}if(!S(r))return}e.apply(console,t)}}function g(e,t,n){const r=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,r),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:r}))}function k(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function K(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(n){return console.error(`[${t}] Invalid headers JSON:`,n),{}}}const j={};function V(e,t){j[e]=t}function G(e){return j[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=V,window.lnCore.getDataMapper=G);function X(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,k(function(){new MutationObserver(function(){g(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const R={};function z(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];R[n]=t}function Y(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return R[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=z,window.lnCore.getLocaleFallback=Y,window.lnCore.ensureLocaleObserver=X);const O={};function Z(e,t){O[e]||(O[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=O[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function N(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let c=0;c<n.length;c++){const u=n[c],f=u.getAttribute("data-ln-field");t[f]!=null&&(u.textContent=t[f])}const r=e.querySelectorAll("[data-ln-attr]");for(let c=0;c<r.length;c++){const u=r[c],f=u.getAttribute("data-ln-attr").split(",");for(let o=0;o<f.length;o++){const d=f[o].trim().split(":");if(d.length!==2)continue;const i=d[0].trim(),l=d[1].trim();t[l]!=null&&u.setAttribute(i,t[l])}}const a=e.querySelectorAll("[data-ln-show]");for(let c=0;c<a.length;c++){const u=a[c],f=u.getAttribute("data-ln-show");f in t&&u.classList.toggle("hidden",!t[f])}const s=e.querySelectorAll("[data-ln-class]");for(let c=0;c<s.length;c++){const u=s[c],f=u.getAttribute("data-ln-class").split(",");for(let o=0;o<f.length;o++){const d=f[o].trim().split(":");if(d.length!==2)continue;const i=d[0].trim(),l=d[1].trim();l in t&&u.classList.toggle(i,!!t[l])}}return e}function P(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let r=0;r<n.length;r++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[r],t??null),n[r].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)N(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function F(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(c,u){return t[u]!==void 0?t[u]:""}))}const r=function(s,c){return t[c]!==void 0?t[c]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let s=0;s<a.length;s++){const c=a[s],u=c.attributes;for(let f=0;f<u.length;f++){const o=u[f];o.value.indexOf("{{")!==-1&&c.setAttribute(o.name,o.value.replace(/\{\{\s*(\w+)\s*\}\}/g,r))}}return e}function ee(e,t,n,r,a,s){const c={};for(let f=0;f<e.children.length;f++){const o=e.children[f],d=o.getAttribute("data-ln-render-key");d&&(c[d]=o)}const u=document.createDocumentFragment();for(let f=0;f<t.length;f++){const o=t[f],d=String(r(o));let i=c[d];if(i)a(i,o,f);else{const l=Z(n,s);if(!l||(F(l,o),i=l.firstElementChild,!i))continue;i.setAttribute("data-ln-render-key",d),a(i,o,f)}u.appendChild(i)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=F,window.lnCore.fill=N,window.lnCore.lnFill=P,window.lnCore.renderList=ee);function A(e,t,n){const r=e.getAttribute(t);return r===null?n:r}function te(e,t,n){const r=parseInt(e.getAttribute(t),10);return isNaN(r)?n:r}function ne(e,t,n=!1){const r=e.getAttribute(t);if(r===null)return!!n;const a=r.trim().toLowerCase();return!(a==="false"||a==="0")}function re(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const T=new Map;function oe(e,t){const n=(e?e.join("|"):"")+"::"+t;if(T.has(n))return T.get(n);const r=new Set(e||[]),a=function(s,c){const u=s.getAttribute(c);return u!==null&&r.has(u)?u:t};return T.set(n,a),a}function ie(e,t,n){const r=parseFloat(e.getAttribute(t));return isNaN(r)?n:r}function ae(e,t,n){const r=e.getAttribute(t);if(!r)return n;try{return JSON.parse(r)}catch{return n}}function M(e,t,n,r,a){if(!e||t===null)return!0;const s=r||"ln-component",c=e.type;if(c==="trigger"||c==="marker"||c==="string"||c==="list"||!c||t===""&&e.fallback!==void 0)return!0;const u=f=>{a?console.warn(f,a):console.warn(f)};if(c==="boolean"){const f=t.trim().toLowerCase();return f!==""&&f!=="true"&&f!=="false"&&f!=="1"&&f!=="0"?(u(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(c==="enum"){const f=e.values||[];return f.includes(t)?!0:(u(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${f.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(c==="integer"){if(!/^-?\d+$/.test(t))return u(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const f=parseInt(t,10);return e.min!==void 0&&f<e.min?(u(`[${s}] Value ${f} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&f>e.max?(u(`[${s}] Value ${f} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(c==="float")return isNaN(Number(t))?(u(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(c==="json")try{return JSON.parse(t),!0}catch(f){return u(`[${s}] Invalid JSON for attribute "${n}": ${f.message}. Fallback: ${e.fallback}.`),!1}return!0}function le(e,t,n){for(const r in n){const[a,s,c]=n[r];Object.defineProperty(e,r,{get:function(){return a(t,s,c)},enumerable:!0,configurable:!0})}return e}function se(e){const t={};for(const n in e){const r=e[n];if(!r||!r.prop)continue;let a=r.read;if(!a&&r.type)switch(r.type){case"enum":a=oe(r.values,r.fallback);break;case"integer":a=te;break;case"float":a=ie;break;case"boolean":a=ne;break;case"list":a=re;break;case"json":a=ae;break;case"string":default:a=A;break}a||(a=A),t[r.prop]=[a,n,r.fallback]}return t}function ce(e){const t={};for(const n in e){const r=e[n];r&&r.effect&&(t[n]=r.effect)}return Object.keys(t).length?t:null}function de(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}function q(e,t,n,r){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",c=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&c.push(e);for(const u of c)if(!u[n]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[n]=new r(u)}catch(f){console.error("["+n+"] init failed",u,f)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ue(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function fe(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 U(){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=U(),n=e.observed||[];for(let r=0;r<n.length;r++){const a=n[r];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const r in e.attributes){t.byDeclaredAttr.has(r)||t.byDeclaredAttr.set(r,[]);const a=t.byDeclaredAttr.get(r);a.some(s=>s.componentTag===e.componentTag)||a.push({spec:e.attributes[r],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const r=de(e);if(r===null)t.reactiveWildcard.push(e);else for(const a of r)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function H(e,t,n,r){for(let a=0;a<e.length;a++){const s=e[a];if(!t[s.attribute])continue;const c=s.effects&&s.effects[n];c?c(t,n,r):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,r)}}function pe(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const r=U(),a=r.byAttr.get(n);if($()&&r.byDeclaredAttr&&r.byDeclaredAttr.has(n)&&S(t)){const s=r.byDeclaredAttr.get(n),c=t.getAttribute(n);for(let u=0;u<s.length;u++)M(s[u].spec,c,n,s[u].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||a)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=r.byReactive.get(n);s&&H(s,t,n,e.oldValue),r.reactiveWildcard.length&&H(r.reactiveWildcard,t,n,e.oldValue)}if(a)for(let s=0;s<a.length;s++){const c=a[s];if(c.handler){c.handler(t,n,e.oldValue);continue}c.onAttributeChange&&t[c.attribute]?c.onAttributeChange(t,n):(q(t,c.selector,c.attribute,c.ComponentFn),c.onInit&&c.onInit(t))}}function we(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{pe(t[n])}catch(r){console.error("[ln-core] mutation handler failed",t[n].target,r)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function B(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function be(e){const t=B();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const r=t[n];if(r.onSubtreeChange){const a=r.query,s=e.target.nodeType===1?e.target.matches(a)?e.target:e.target.closest(a):e.target.parentElement?e.target.parentElement.closest(a):null;s&&r.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const r=e.addedNodes[n];if(r.nodeType===1)for(let a=0;a<t.length;a++){const s=t[a];q(r,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(r)}}for(let n=0;n<e.removedNodes.length;n++){const r=e.removedNodes[n];if(r.nodeType===1)for(let a=0;a<t.length;a++){const s=t[a],c=s.query,u=Array.from(r.querySelectorAll(c));r.matches&&r.matches(c)&&u.push(r);for(let f=0;f<u.length;f++){const o=u[f];if(!document.contains(o)){const d=o[s.attribute];if(d&&typeof d.destroy=="function")try{d.destroy()}catch(i){console.error("["+s.attribute+"] destroy failed",o,i)}delete o[s.attribute]}}}}}}function ge(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.type==="childList")try{be(r)}catch(a){console.error("[ln-core] lifecycle handler failed",r.target,a)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function me(e,t,n,r,a={}){const s=a.extraAttributes||[],c=a.onAttributeChange||null,u=a.onSubtreeChange||null,f=a.onInit||null,o=a.onAttrChange||null,d=a.effects||null,i=a.attributes||null,l=i?ce(i):d,h=i?new Set(Object.keys(i)):null,p=a.persist||null;function b(v){const w=v||document.body;if(q(w,e,t,n),i&&$())for(const m in i){const Le=i[m],D=Array.from(w.querySelectorAll("["+m+"]"));w.matches&&w.matches("["+m+"]")&&D.push(w);for(let x=0;x<D.length;x++){const I=D[x];S(I)&&M(Le,I.getAttribute(m),m,r,I)}}f&&f(w)}const y=[];if(e.indexOf("[")!==-1){const v=/\[([\w-]+)/g;let w;for(;(w=v.exec(e))!==null;)y.push(w[1])}else y.push(e);he({selector:e,attribute:t,componentTag:r,attributes:i,ComponentFn:n,onInit:f,observed:y.concat(s),onAttributeChange:c,onAttrChange:o,effects:l,declared:h,persist:p}),we();const E=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";B().push({selector:e,attribute:t,ComponentFn:n,onInit:f,onSubtreeChange:u,query:E}),ge(),window[t]=b;function _(){ue()>0?fe(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",_):_(),b}function W(e){return(e||"").replace(/^#/,"")}function L(e){const t=e===void 0?location.hash:e,n={},r=W(t);if(!r)return n;const a=r.split("&");for(let s=0;s<a.length;s++){const c=a[s];if(!c)continue;const u=c.indexOf(":"),f=u>-1?c.slice(0,u):c,o=u>-1?c.slice(u+1):"";if(f)try{n[f]=decodeURIComponent(o)}catch{n[f]=o}}return n}function ye(e){if(!e)return null;const t=L();return e in t?t[e]:null}function Ce(e,t){if(!e)return;const n=L();t==null?delete n[e]:n[e]=String(t);const a=Object.keys(n).map(function(s){const c=n[s];return c===""?s:s+":"+encodeURIComponent(c)}).join("&");W(location.hash)!==a&&(location.hash=a)}function _e(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ae(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const r=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return r?t?r+"-"+t:r:t||null}function ve(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function ke(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Ee(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Se(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),r=e.slice(t+1),a=r?r.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=L,window.lnCore.hashGet=ye,window.lnCore.hashSet=Ce,window.lnCore.hashLinkClick=_e,window.lnCore.resolveHashNamespace=Ae,window.lnCore.hashSortEncode=ve,window.lnCore.hashSortDecode=ke,window.lnCore.hashFilterEncode=Ee,window.lnCore.hashFilterDecode=Se);const Oe={offset:"offset",limit:"limit",search:"search",sortField:"sort_field",sortDir:"sort_dir"};function C(...e){return e.filter(t=>t!=null&&t!=="").map((t,n)=>{const r=String(t);return n===0?r.replace(/\/+$/,""):r.replace(/^\/+/,"").replace(/\/+$/,"")}).filter(Boolean).join("/")}function Te(e,t){if(!e||typeof e!="object")return"";const n=Object.assign({},Oe);if(t&&typeof t=="object")for(const a in t)t[a]!==void 0&&t[a]!==null&&t[a]!==""&&(n[a]=t[a]);const r=new URLSearchParams;return e.search&&r.append(n.search,e.search),e.offset!=null&&r.append(n.offset,e.offset),e.limit!=null&&r.append(n.limit,e.limit),e.sort&&e.sort.field&&e.sort.direction&&(r.append(n.sortField,e.sort.field),r.append(n.sortDir,e.sort.direction)),e.filters&&typeof e.filters=="object"&&Object.keys(e.filters).forEach(a=>{const s=e.filters[a];Array.isArray(s)&&s.length>0&&r.append(a,s.join(","))}),r.toString()}function qe(e,t,n){let r=C(e,t);return n&&(r+=(r.indexOf("?")!==-1?"&":"?")+n),r}function Q(e){const t=e&&e.content!==void 0?e.content:e,n=e&&e.message?e.message:null;return{record:t,message:n}}(function(){const e="data-ln-api-connector",t="lnApiConnector",n="lnConnector";if(window[t]!==void 0)return;function r(o){const d=o[t];d&&d.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:A,type:"string",fallback:"",effect:r,description:"Base URL endpoint for API requests"},"data-ln-api-path":{prop:"path",read:A,type:"string",fallback:"",effect:r,description:"Resource path appended to base URL"},"data-ln-api-headers":{prop:"rawHeaders",read:A,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"}},s=se(a);function c(o){return o.ok?o.status===204?null:o.json():o.json().catch(()=>null).then(d=>{const i=new Error("HTTP "+o.status+": "+o.statusText);throw i.status=o.status,i.data=d,i})}function u(o){return this.dom=o,le(this,o,s),o[t]=this,o[n]=this,this._inflight=new Map,this._queryTimers=new Map,this.refreshConfig(),this._handlers=null,f(this),this}u.prototype.refreshConfig=function(){const o=this.dom;this.credentials="same-origin",this.headers=K(this.rawHeaders);const d={},i=o.getAttribute("data-ln-api-param-offset");i&&(d.offset=i);const l=o.getAttribute("data-ln-api-param-limit");l&&(d.limit=l);const h=o.getAttribute("data-ln-api-param-search");h&&(d.search=h);const p=o.getAttribute("data-ln-api-param-sort-field");p&&(d.sortField=p);const b=o.getAttribute("data-ln-api-param-sort-dir");b&&(d.sortDir=b),this.paramKeys=d;const y=o.getAttribute("data-ln-api-connector-query-debounce");this.queryDebounce=y!==null?+y:300,g(this.dom,"ln-api-connector:config-changed",{baseUrl:this.baseUrl,path:this.path,headers:this.headers,paramKeys:this.paramKeys})},u.prototype._reqHeaders=function(o){const d=Object.assign({},this.headers);return!d.Accept&&!d.accept&&(d.Accept="application/json"),!d["Content-Type"]&&!d["content-type"]&&(d["Content-Type"]="application/json"),o&&(d["X-Idempotency-Key"]=o),d},u.prototype.cancel=function(o){return o&&this._inflight.has(o)?(this._inflight.get(o).abort(),this._inflight.delete(o),!0):!1},u.prototype.fetchDelta=function(o,d){const i=this;let l=C(i.baseUrl,i.path);o!=null&&o!==""&&(l+=(l.indexOf("?")!==-1?"&":"?")+"since="+encodeURIComponent(o));const h=d||"sync";i._inflight.has(h)&&i._inflight.get(h).abort();const p=new AbortController;return i._inflight.set(h,p),window.fetch(l,{method:"GET",headers:i._reqHeaders(),credentials:i.credentials,signal:p.signal}).then(c).finally(function(){i._inflight.get(h)===p&&i._inflight.delete(h)})},u.prototype.query=function(o,d){const i=this,l=Te(o,i.paramKeys),h=qe(i.baseUrl,i.path,l),p=d||"query";i._inflight.has(p)&&i._inflight.get(p).abort();const b=new AbortController;return i._inflight.set(p,b),window.fetch(h,{method:"GET",headers:i._reqHeaders(),credentials:i.credentials,signal:b.signal}).then(c).finally(function(){i._inflight.get(p)===b&&i._inflight.delete(p)})},u.prototype.create=function(o,d,i){const l=this;return window.fetch(C(l.baseUrl,d||l.path),{method:"POST",headers:l._reqHeaders(i),credentials:l.credentials,body:JSON.stringify(o)}).then(c)},u.prototype.update=function(o,d,i,l,h){const p=this;i!=null&&(d=Object.assign({},d,{expected_version:i}));const b=l?C(p.baseUrl,l):C(p.baseUrl,p.path,o);return window.fetch(b,{method:"PUT",headers:p._reqHeaders(h),credentials:p.credentials,body:JSON.stringify(d)}).then(c)},u.prototype.delete=function(o,d,i){const l=this;return window.fetch(C(l.baseUrl,d||l.path,o),{method:"DELETE",headers:l._reqHeaders(i),credentials:l.credentials}).then(c)},u.prototype.bulkDelete=function(o,d,i){const l=this;return window.fetch(C(l.baseUrl,d||l.path,"bulk-delete"),{method:"DELETE",headers:l._reqHeaders(i),credentials:l.credentials,body:JSON.stringify({ids:o})}).then(c)};function f(o){o._handlers={sync:function(d){const i=d.detail||{},l=i.meta&&i.meta.targetEl?i.meta.targetEl:null;o.fetchDelta(i.since,l).then(function(h){g(o.dom,"ln-api-connector:fetched",{data:h,since:i.since,meta:i.meta||null})}).catch(function(h){h&&h.name==="AbortError"||g(o.dom,"ln-api-connector:error",{action:"sync",error:h.message,status:h.status||0,data:h.data||null,since:i.since,meta:i.meta||null})})},query:function(d){const i=d.detail||{},l=i.query||i,h=i.meta&&i.meta.targetEl?i.meta.targetEl:null,p=h||"query",b=o.queryDebounce;function y(E,_,v){o.query(_,v).then(function(w){const m=w||{};g(o.dom,"ln-api-connector:fetched",{data:m.data||(Array.isArray(m)?m:[]),total:m.total,filtered:m.filtered,offset:_.offset,queryGen:_.queryGen,meta:E.meta||null})}).catch(function(w){w&&w.name==="AbortError"||g(o.dom,"ln-api-connector:error",{action:"query",error:w.message,status:w.status||0,data:w.data||null,meta:E.meta||null})})}if(b===0){y(i,l,h);return}o._queryTimers.has(p)&&clearTimeout(o._queryTimers.get(p));const J=setTimeout(function(){o._queryTimers.delete(p),y(i,l,h)},b);o._queryTimers.set(p,J)},cancel:function(d){const i=d.detail||{},l=i.meta&&i.meta.targetEl?i.meta.targetEl:i.targetEl||i.key;l&&o.cancel(l)},create:function(d){const i=d.detail||{};o.create(i.data,i.url,i.idempotencyKey).then(function(l){const h=Q(l);g(o.dom,"ln-api-connector:created",{record:h.record,tempId:i.tempId,message:h.message,meta:i.meta||null})}).catch(function(l){l&&l.name==="AbortError"||g(o.dom,"ln-api-connector:error",{action:"create",error:l.message,status:l.status||0,data:l.data||null,tempId:i.tempId,meta:i.meta||null})})},update:function(d){const i=d.detail||{};o.update(i.id,i.data,i.expected_version,i.url,i.idempotencyKey).then(function(l){const h=Q(l);g(o.dom,"ln-api-connector:updated",{record:h.record,id:i.id,message:h.message,meta:i.meta||null})}).catch(function(l){l&&l.name==="AbortError"||g(o.dom,"ln-api-connector:error",{action:"update",error:l.message,status:l.status||0,data:l.data||null,id:i.id,conflictData:l.status===409?l.data:null,meta:i.meta||null})})},delete:function(d){const i=d.detail||{};o.delete(i.id,i.url,i.idempotencyKey).then(function(l){const h=l&&l.message?l.message:null;g(o.dom,"ln-api-connector:deleted",{response:l,id:i.id,message:h,meta:i.meta||null})}).catch(function(l){l&&l.name==="AbortError"||g(o.dom,"ln-api-connector:error",{action:"delete",error:l.message,status:l.status||0,data:l.data||null,id:i.id,meta:i.meta||null})})},bulkDelete:function(d){const i=d.detail||{};o.bulkDelete(i.ids,i.url,i.idempotencyKey).then(function(l){const h=l&&l.message?l.message:null;g(o.dom,"ln-api-connector:bulk-deleted",{response:l,ids:i.ids,message:h,meta:i.meta||null})}).catch(function(l){l&&l.name==="AbortError"||g(o.dom,"ln-api-connector:error",{action:"bulk-delete",error:l.message,status:l.status||0,data:l.data||null,ids:i.ids,meta:i.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)}u.prototype.destroy=function(){if(!this.dom[t])return;const o=this;o._inflight&&(o._inflight.forEach(function(d){d.abort()}),o._inflight.clear()),this._queryTimers&&(this._queryTimers.forEach(function(d){d&&clearTimeout(d)}),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[n]},me(e,t,u,"ln-api-connector",{attributes:a})})()})();
|
|
1
|
+
(function(){"use strict";function j(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function E(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){o=t[i];break}if(!E(o))return}e.apply(console,t)}}function b(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function k(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){k(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function te(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ne(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,i={},c=e.elements,l={};if(n)for(let u=0;u<c.length;u++){const s=c[u];s.name&&s.type==="checkbox"&&!s.disabled&&(l[s.name]=(l[s.name]||0)+1)}for(let u=0;u<c.length;u++){const s=c[u];if(!(!s.name||s.disabled||s.type==="file"||s.type==="submit"||s.type==="button")&&!(o&&s.matches&&s.matches(o)))if(s.type==="checkbox")n&&l[s.name]===1?i[s.name]=s.checked:(i[s.name]||(i[s.name]=[]),s.checked&&i[s.name].push(s.value));else if(s.type==="radio")s.checked&&(i[s.name]=s.value);else if(s.type==="select-multiple"){i[s.name]=[];for(let r=0;r<s.options.length;r++)s.options[r].selected&&i[s.name].push(s.options[r].value)}else if(n&&s.type==="hidden")i[s.name]=s.value;else if(n&&(s.type==="number"||s.type==="range")){const r=Number(s.value);i[s.name]=s.value===""||isNaN(r)?null:r}else i[s.name]=s.value}return i}function re(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function oe(e,t){const n=e.elements,o=[],i={};for(let c=0;c<n.length;c++){const l=n[c];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let c=0;c<n.length;c++){const l=n[c];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const u=l.getAttribute("data-ln-fill-as")||l.name;if(!u||!(u in t))continue;const s=t[u];if(l.type==="checkbox"){if(Array.isArray(s))l.checked=s.indexOf(l.value)!==-1;else if(i[l.name]>1){const r=String(s).split(",").map(function(f){return f.trim()});l.checked=r.indexOf(l.value)!==-1}else l.checked=re(s);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(s),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(s))for(let r=0;r<l.options.length;r++)l.options[r].selected=s.indexOf(l.options[r].value)!==-1;o.push(l)}else l.value=s,l.tagName==="SELECT"&&s!=null&&l.setAttribute("data-ln-value",s),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=oe,window.lnCore.serializeForm=ne,window.lnCore.resolveFormMethod=te);function ie(e,t="ln-core"){try{return e?JSON.parse(e):{}}catch(n){return console.error(`[${t}] Invalid headers JSON:`,n),{}}}const F={};function le(e,t){F[e]=t}function ae(e){return F[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=le,window.lnCore.getDataMapper=ae);function se(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,k(function(){new MutationObserver(function(){b(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const $={};function ce(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];$[n]=t}function de(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return $[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ce,window.lnCore.getLocaleFallback=de,window.lnCore.ensureLocaleObserver=se);const S={};function ue(e,t){S[e]||(S[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=S[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function N(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const u=n[l],s=u.getAttribute("data-ln-field");t[s]!=null&&(u.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const u=o[l],s=u.getAttribute("data-ln-attr").split(",");for(let r=0;r<s.length;r++){const f=s[r].trim().split(":");if(f.length!==2)continue;const a=f[0].trim(),d=f[1].trim();t[d]!=null&&u.setAttribute(a,t[d])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const u=i[l],s=u.getAttribute("data-ln-show");s in t&&u.classList.toggle("hidden",!t[s])}const c=e.querySelectorAll("[data-ln-class]");for(let l=0;l<c.length;l++){const u=c[l],s=u.getAttribute("data-ln-class").split(",");for(let r=0;r<s.length;r++){const f=s[r].trim().split(":");if(f.length!==2)continue;const a=f[0].trim(),d=f[1].trim();d in t&&u.classList.toggle(a,!!t[d])}}return e}function fe(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)N(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function R(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const c=n.currentNode;c.textContent.indexOf("{{")!==-1&&(c.textContent=c.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,u){return t[u]!==void 0?t[u]:""}))}const o=function(c,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let c=0;c<i.length;c++){const l=i[c],u=l.attributes;for(let s=0;s<u.length;s++){const r=u[s];r.value.indexOf("{{")!==-1&&l.setAttribute(r.name,r.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function pe(e,t,n,o,i,c){const l={};for(let s=0;s<e.children.length;s++){const r=e.children[s],f=r.getAttribute("data-ln-render-key");f&&(l[f]=r)}const u=document.createDocumentFragment();for(let s=0;s<t.length;s++){const r=t[s],f=String(o(r));let a=l[f];if(a)i(a,r,s);else{const d=ue(n,c);if(!d||(R(d,r),a=d.firstElementChild,!a))continue;a.setAttribute("data-ln-render-key",f),i(a,r,s)}u.appendChild(a)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=R,window.lnCore.fill=N,window.lnCore.lnFill=fe,window.lnCore.renderList=pe);function C(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function U(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function M(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const i=o.trim().toLowerCase();return!(i==="false"||i==="0")}function B(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const O=new Map;function H(e,t){const n=(e?e.join("|"):"")+"::"+t;if(O.has(n))return O.get(n);const o=new Set(e||[]),i=function(c,l){const u=c.getAttribute(l);return u!==null&&o.has(u)?u:t};return O.set(n,i),i}function W(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function Q(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function J(e,t,n,o,i){if(!e||t===null)return!0;const c=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const u=s=>{i?console.warn(s,i):console.warn(s)};if(l==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(u(`[${c}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const s=e.values||[];return s.includes(t)?!0:(u(`[${c}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return u(`[${c}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(u(`[${c}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(u(`[${c}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(u(`[${c}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(s){return u(`[${c}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function K(e,t,n){for(const o in n){const[i,c,l]=n[o];Object.defineProperty(e,o,{get:function(){return i(t,c,l)},enumerable:!0,configurable:!0})}return e}function V(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let i=o.read;if(!i&&o.type)switch(o.type){case"enum":i=H(o.values,o.fallback);break;case"integer":i=U;break;case"float":i=W;break;case"boolean":i=M;break;case"list":i=B;break;case"json":i=Q;break;case"string":default:i=C;break}i||(i=C),t[o.prop]=[i,n,o.fallback]}return t}function he(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function we(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=K,window.lnCore.attrSpec=V,window.lnCore.attrStr=C,window.lnCore.attrInt=U,window.lnCore.attrBool=M,window.lnCore.attrList=B,window.lnCore.attrEnum=H,window.lnCore.attrFloat=W,window.lnCore.attrJson=Q);function T(e,t,n,o){if(e.nodeType!==1)return;const c=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(c));e.matches&&e.matches(c)&&l.push(e);for(const u of l)if(!u[n]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[n]=new o(u)}catch(s){console.error("["+n+"] init failed",u,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function me(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function be(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function G(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function ge(e){const t=G(),n=e.observed||[];for(let o=0;o<n.length;o++){const i=n[o];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const i=t.byDeclaredAttr.get(o);i.some(c=>c.componentTag===e.componentTag)||i.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=we(e);if(o===null)t.reactiveWildcard.push(e);else for(const i of o)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function z(e,t,n,o){for(let i=0;i<e.length;i++){const c=e[i];if(!t[c.attribute])continue;const l=c.effects&&c.effects[n];l?l(t,n,o):c.onAttrChange&&(!c.declared||c.declared.has(n))&&c.onAttrChange(t,n,o)}}function ye(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=G(),i=o.byAttr.get(n);if(j()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&E(t)){const c=o.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let u=0;u<c.length;u++)J(c[u].spec,l,n,c[u].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||i)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const c=o.byReactive.get(n);c&&z(c,t,n,e.oldValue),o.reactiveWildcard.length&&z(o.reactiveWildcard,t,n,e.oldValue)}if(i)for(let c=0;c<i.length;c++){const l=i[c];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(T(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function Ce(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{ye(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function X(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function _e(e){const t=X();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const i=o.query,c=e.target.nodeType===1?e.target.matches(i)?e.target:e.target.closest(i):e.target.parentElement?e.target.parentElement.closest(i):null;c&&o.onSubtreeChange(c,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let i=0;i<t.length;i++){const c=t[i];T(o,c.selector,c.attribute,c.ComponentFn),c.onInit&&c.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let i=0;i<t.length;i++){const c=t[i],l=c.query,u=Array.from(o.querySelectorAll(l));o.matches&&o.matches(l)&&u.push(o);for(let s=0;s<u.length;s++){const r=u[s];if(!document.contains(r)){const f=r[c.attribute];if(f&&typeof f.destroy=="function")try{f.destroy()}catch(a){console.error("["+c.attribute+"] destroy failed",r,a)}delete r[c.attribute]}}}}}}function Ae(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,k(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{_e(o)}catch(i){console.error("[ln-core] lifecycle handler failed",o.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Y(e,t,n,o,i={}){const c=i.extraAttributes||[],l=i.onAttributeChange||null,u=i.onSubtreeChange||null,s=i.onInit||null,r=i.onAttrChange||null,f=i.effects||null,a=i.attributes||null,d=a?he(a):f,p=a?new Set(Object.keys(a)):null,h=i.persist||null;function m(v){const w=v||document.body;if(T(w,e,t,n),a&&j())for(const g in a){const Fe=a[g],L=Array.from(w.querySelectorAll("["+g+"]"));w.matches&&w.matches("["+g+"]")&&L.push(w);for(let D=0;D<L.length;D++){const I=L[D];E(I)&&J(Fe,I.getAttribute(g),g,o,I)}}s&&s(w)}const y=[];if(e.indexOf("[")!==-1){const v=/\[([\w-]+)/g;let w;for(;(w=v.exec(e))!==null;)y.push(w[1])}else y.push(e);ge({selector:e,attribute:t,componentTag:o,attributes:a,ComponentFn:n,onInit:s,observed:y.concat(c),onAttributeChange:l,onAttrChange:r,effects:d,declared:p,persist:h}),Ce();const x=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";X().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:u,query:x}),Ae(),window[t]=m,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Y);function A(){me()>0?be(function(){m(document.body)}):m(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",A):A(),m}function Z(e){return(e||"").replace(/^#/,"")}function q(e){const t=e===void 0?location.hash:e,n={},o=Z(t);if(!o)return n;const i=o.split("&");for(let c=0;c<i.length;c++){const l=i[c];if(!l)continue;const u=l.indexOf(":"),s=u>-1?l.slice(0,u):l,r=u>-1?l.slice(u+1):"";if(s)try{n[s]=decodeURIComponent(r)}catch{n[s]=r}}return n}function ve(e){if(!e)return null;const t=q();return e in t?t[e]:null}function ke(e,t){if(!e)return;const n=q();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(c){const l=n[c];return l===""?c:c+":"+encodeURIComponent(l)}).join("&");Z(location.hash)!==i&&(location.hash=i)}function xe(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Ee(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function Se(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Te(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function qe(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),i=o?o.split(",").map(function(c){try{return decodeURIComponent(c)}catch{return c}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=q,window.lnCore.hashGet=ve,window.lnCore.hashSet=ke,window.lnCore.hashLinkClick=xe,window.lnCore.resolveHashNamespace=Ee,window.lnCore.hashSortEncode=Se,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Te,window.lnCore.hashFilterDecode=qe);function Le(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=Le);const De={offset:"offset",limit:"limit",search:"search",sortField:"sort_field",sortDir:"sort_dir"};function _(...e){return e.filter(t=>t!=null&&t!=="").map((t,n)=>{const o=String(t);return n===0?o.replace(/\/+$/,""):o.replace(/^\/+/,"").replace(/\/+$/,"")}).filter(Boolean).join("/")}function Ie(e,t){if(!e||typeof e!="object")return"";const n=Object.assign({},De);if(t&&typeof t=="object")for(const i in t)t[i]!==void 0&&t[i]!==null&&t[i]!==""&&(n[i]=t[i]);const o=new URLSearchParams;return e.search&&o.append(n.search,e.search),e.offset!=null&&o.append(n.offset,e.offset),e.limit!=null&&o.append(n.limit,e.limit),e.sort&&e.sort.field&&e.sort.direction&&(o.append(n.sortField,e.sort.field),o.append(n.sortDir,e.sort.direction)),e.filters&&typeof e.filters=="object"&&Object.keys(e.filters).forEach(i=>{const c=e.filters[i];Array.isArray(c)&&c.length>0&&o.append(i,c.join(","))}),o.toString()}function je(e,t,n){let o=_(e,t);return n&&(o+=(o.indexOf("?")!==-1?"&":"?")+n),o}function P(e){const t=e&&e.content!==void 0?e.content:e,n=e&&e.message?e.message:null;return{record:t,message:n}}(function(){const e="data-ln-api-connector",t="lnApiConnector",n="lnConnector";if(window[t]!==void 0)return;function o(r){const f=r[t];f&&f.refreshConfig()}const i={"data-ln-api-connector":{type:"marker",description:"Mounts API connector bridging REST backend and ln-ashlar data coordinators"},"data-ln-api-base-url":{prop:"baseUrl",read:C,type:"string",fallback:"",effect:o,description:"Base URL endpoint for API requests"},"data-ln-api-path":{prop:"path",read:C,type:"string",fallback:"",effect:o,description:"Resource path appended to base URL"},"data-ln-api-endpoint":{prop:"path",read:C,type:"string",fallback:"",effect:o,description:"Alias for data-ln-api-path"},"data-ln-api-headers":{prop:"rawHeaders",read:C,type:"json",fallback:null,effect:o,description:"Custom HTTP headers in JSON format or semicolon-separated pairs"},"data-ln-api-param-offset":{effect:o,type:"string",fallback:"offset",description:"Query parameter name for pagination offset"},"data-ln-api-param-limit":{effect:o,type:"string",fallback:"limit",description:"Query parameter name for pagination page size"},"data-ln-api-param-search":{effect:o,type:"string",fallback:"search",description:"Query parameter name for text search filter"},"data-ln-api-param-sort-field":{effect:o,type:"string",fallback:"sort_by",description:"Query parameter name for sort field"},"data-ln-api-param-sort-dir":{effect:o,type:"string",fallback:"sort_dir",description:"Query parameter name for sort direction"},"data-ln-api-connector-query-debounce":{effect:o,type:"integer",fallback:200,min:0,description:"Debounce delay in milliseconds before dispatching query requests"}},c=V(i);function l(r){return r.ok?r.status===204?null:r.json():r.json().catch(()=>null).then(f=>{const a=new Error("HTTP "+r.status+": "+r.statusText);throw a.status=r.status,a.data=f,a})}function u(r){return this.dom=r,K(this,r,c),r[t]=this,r[n]=this,this.namespace="ln-api-connector",this._inflight=new Map,this._queryTimers=new Map,this.refreshConfig(),this._handlers=null,s(this),this}u.prototype.refreshConfig=function(){const r=this.dom;this.credentials="same-origin",this.headers=ie(this.rawHeaders);const f={},a=r.getAttribute("data-ln-api-param-offset");a&&(f.offset=a);const d=r.getAttribute("data-ln-api-param-limit");d&&(f.limit=d);const p=r.getAttribute("data-ln-api-param-search");p&&(f.search=p);const h=r.getAttribute("data-ln-api-param-sort-field");h&&(f.sortField=h);const m=r.getAttribute("data-ln-api-param-sort-dir");m&&(f.sortDir=m),this.paramKeys=f;const y=r.getAttribute("data-ln-api-connector-query-debounce");this.queryDebounce=y!==null?+y:300,b(this.dom,"ln-api-connector:config-changed",{baseUrl:this.baseUrl,path:this.path,headers:this.headers,paramKeys:this.paramKeys})},u.prototype._reqHeaders=function(r){const f=Object.assign({},this.headers);return!f.Accept&&!f.accept&&(f.Accept="application/json"),!f["Content-Type"]&&!f["content-type"]&&(f["Content-Type"]="application/json"),r&&(f["X-Idempotency-Key"]=r),f},u.prototype.cancel=function(r){return r&&this._inflight.has(r)?(this._inflight.get(r).abort(),this._inflight.delete(r),!0):!1},u.prototype.fetchDelta=function(r,f){const a=this;let d=_(a.baseUrl,a.path);r!=null&&r!==""&&(d+=(d.indexOf("?")!==-1?"&":"?")+"since="+encodeURIComponent(r));const p=f||"sync";a._inflight.has(p)&&a._inflight.get(p).abort();const h=new AbortController;return a._inflight.set(p,h),window.fetch(d,{method:"GET",headers:a._reqHeaders(),credentials:a.credentials,signal:h.signal}).then(l).finally(function(){a._inflight.get(p)===h&&a._inflight.delete(p)})},u.prototype.query=function(r,f){const a=this,d=Ie(r,a.paramKeys),p=je(a.baseUrl,a.path,d),h=f||"query";a._inflight.has(h)&&a._inflight.get(h).abort();const m=new AbortController;return a._inflight.set(h,m),window.fetch(p,{method:"GET",headers:a._reqHeaders(),credentials:a.credentials,signal:m.signal}).then(l).finally(function(){a._inflight.get(h)===m&&a._inflight.delete(h)})},u.prototype.create=function(r,f,a){const d=this;return window.fetch(_(d.baseUrl,f||d.path),{method:"POST",headers:d._reqHeaders(a),credentials:d.credentials,body:JSON.stringify(r)}).then(l)},u.prototype.update=function(r,f,a,d,p){const h=this;a!=null&&(f=Object.assign({},f,{expected_version:a}));const m=d?_(h.baseUrl,d):_(h.baseUrl,h.path,r);return window.fetch(m,{method:"PUT",headers:h._reqHeaders(p),credentials:h.credentials,body:JSON.stringify(f)}).then(l)},u.prototype.delete=function(r,f,a){const d=this;return window.fetch(_(d.baseUrl,f||d.path,r),{method:"DELETE",headers:d._reqHeaders(a),credentials:d.credentials}).then(l)},u.prototype.bulkDelete=function(r,f,a){const d=this;return window.fetch(_(d.baseUrl,f||d.path,"bulk-delete"),{method:"DELETE",headers:d._reqHeaders(a),credentials:d.credentials,body:JSON.stringify({ids:r})}).then(l)};function s(r){r._handlers={sync:function(f){const a=f.detail||{},d=a.meta&&a.meta.targetEl?a.meta.targetEl:null;r.fetchDelta(a.since,d).then(function(p){b(r.dom,"ln-api-connector:fetched",{data:p,since:a.since,meta:a.meta||null})}).catch(function(p){p&&p.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"sync",error:p.message,status:p.status||0,data:p.data||null,since:a.since,meta:a.meta||null})})},query:function(f){const a=f.detail||{},d=a.query||a,p=a.meta&&a.meta.targetEl?a.meta.targetEl:null,h=p||"query",m=r.queryDebounce;function y(x,A,v){r.query(A,v).then(function(w){const g=w||{};b(r.dom,"ln-api-connector:fetched",{data:g.data||(Array.isArray(g)?g:[]),total:g.total,filtered:g.filtered,offset:A.offset,queryGen:A.queryGen,meta:x.meta||null})}).catch(function(w){w&&w.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"query",error:w.message,status:w.status||0,data:w.data||null,meta:x.meta||null})})}if(m===0){y(a,d,p);return}r._queryTimers.has(h)&&clearTimeout(r._queryTimers.get(h));const ee=setTimeout(function(){r._queryTimers.delete(h),y(a,d,p)},m);r._queryTimers.set(h,ee)},cancel:function(f){const a=f.detail||{},d=a.meta&&a.meta.targetEl?a.meta.targetEl:a.targetEl||a.key;d&&r.cancel(d)},create:function(f){const a=f.detail||{};r.create(a.data,a.url,a.idempotencyKey).then(function(d){const p=P(d);b(r.dom,"ln-api-connector:created",{record:p.record,tempId:a.tempId,message:p.message,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"create",error:d.message,status:d.status||0,data:d.data||null,tempId:a.tempId,meta:a.meta||null})})},update:function(f){const a=f.detail||{};r.update(a.id,a.data,a.expected_version,a.url,a.idempotencyKey).then(function(d){const p=P(d);b(r.dom,"ln-api-connector:updated",{record:p.record,id:a.id,message:p.message,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"update",error:d.message,status:d.status||0,data:d.data||null,id:a.id,conflictData:d.status===409?d.data:null,meta:a.meta||null})})},delete:function(f){const a=f.detail||{};r.delete(a.id,a.url,a.idempotencyKey).then(function(d){const p=d&&d.message?d.message:null;b(r.dom,"ln-api-connector:deleted",{response:d,id:a.id,message:p,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"delete",error:d.message,status:d.status||0,data:d.data||null,id:a.id,meta:a.meta||null})})},bulkDelete:function(f){const a=f.detail||{};r.bulkDelete(a.ids,a.url,a.idempotencyKey).then(function(d){const p=d&&d.message?d.message:null;b(r.dom,"ln-api-connector:bulk-deleted",{response:d,ids:a.ids,message:p,meta:a.meta||null})}).catch(function(d){d&&d.name==="AbortError"||b(r.dom,"ln-api-connector:error",{action:"bulk-delete",error:d.message,status:d.status||0,data:d.data||null,ids:a.ids,meta:a.meta||null})})}},r.dom.addEventListener("ln-api-connector:request-sync",r._handlers.sync),r.dom.addEventListener("ln-api-connector:request-query",r._handlers.query),r.dom.addEventListener("ln-api-connector:request-cancel",r._handlers.cancel),r.dom.addEventListener("ln-api-connector:request-create",r._handlers.create),r.dom.addEventListener("ln-api-connector:request-update",r._handlers.update),r.dom.addEventListener("ln-api-connector:request-delete",r._handlers.delete),r.dom.addEventListener("ln-api-connector:request-bulk-delete",r._handlers.bulkDelete)}u.prototype.destroy=function(){if(!this.dom[t])return;const r=this;r._inflight&&(r._inflight.forEach(function(f){f.abort()}),r._inflight.clear()),this._queryTimers&&(this._queryTimers.forEach(function(f){f&&clearTimeout(f)}),this._queryTimers.clear()),this._handlers&&(r.dom.removeEventListener("ln-api-connector:request-sync",r._handlers.sync),r.dom.removeEventListener("ln-api-connector:request-query",r._handlers.query),r.dom.removeEventListener("ln-api-connector:request-cancel",r._handlers.cancel),r.dom.removeEventListener("ln-api-connector:request-create",r._handlers.create),r.dom.removeEventListener("ln-api-connector:request-update",r._handlers.update),r.dom.removeEventListener("ln-api-connector:request-delete",r._handlers.delete),r.dom.removeEventListener("ln-api-connector:request-bulk-delete",r._handlers.bulkDelete),r._handlers=null),delete this.dom[t],delete this.dom[n]},Y(e,t,u,"ln-api-connector",{attributes:i})})()})();
|
|
@@ -30,6 +30,15 @@
|
|
|
30
30
|
"min": 0,
|
|
31
31
|
"description": "Debounce delay in milliseconds before dispatching query requests"
|
|
32
32
|
},
|
|
33
|
+
"data-ln-api-endpoint": {
|
|
34
|
+
"direction": null,
|
|
35
|
+
"sources": [
|
|
36
|
+
"src/ln-api-connector.js"
|
|
37
|
+
],
|
|
38
|
+
"type": "string",
|
|
39
|
+
"fallback": "",
|
|
40
|
+
"description": "Alias for data-ln-api-path"
|
|
41
|
+
},
|
|
33
42
|
"data-ln-api-headers": {
|
|
34
43
|
"direction": null,
|
|
35
44
|
"sources": [
|
|
@@ -18,6 +18,7 @@ import { buildQueryParams, buildQueryUrl, joinUrl, unwrapEnvelope } from './conn
|
|
|
18
18
|
'data-ln-api-connector': { type: 'marker', description: 'Mounts API connector bridging REST backend and ln-ashlar data coordinators' },
|
|
19
19
|
'data-ln-api-base-url': { prop: 'baseUrl', read: attrStr, type: 'string', fallback: '', effect: _syncAttribute, description: 'Base URL endpoint for API requests' },
|
|
20
20
|
'data-ln-api-path': { prop: 'path', read: attrStr, type: 'string', fallback: '', effect: _syncAttribute, description: 'Resource path appended to base URL' },
|
|
21
|
+
'data-ln-api-endpoint': { prop: 'path', read: attrStr, type: 'string', fallback: '', effect: _syncAttribute, description: 'Alias for data-ln-api-path' },
|
|
21
22
|
'data-ln-api-headers': { prop: 'rawHeaders', read: attrStr, type: 'json', fallback: null, effect: _syncAttribute, description: 'Custom HTTP headers in JSON format or semicolon-separated pairs' },
|
|
22
23
|
'data-ln-api-param-offset': { effect: _syncAttribute, type: 'string', fallback: 'offset', description: 'Query parameter name for pagination offset' },
|
|
23
24
|
'data-ln-api-param-limit': { effect: _syncAttribute, type: 'string', fallback: 'limit', description: 'Query parameter name for pagination page size' },
|
|
@@ -47,6 +48,7 @@ import { buildQueryParams, buildQueryUrl, joinUrl, unwrapEnvelope } from './conn
|
|
|
47
48
|
defineAttrs(this, dom, ATTR_SPEC);
|
|
48
49
|
dom[DOM_ATTRIBUTE] = this;
|
|
49
50
|
dom[DOM_ALIAS] = this; // Set alias for compatibility
|
|
51
|
+
this.namespace = 'ln-api-connector';
|
|
50
52
|
|
|
51
53
|
this._inflight = new Map();
|
|
52
54
|
this._queryTimers = new Map(); // per-key: { timer, pendingDetail, pendingParams, pendingTarget }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function R(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function k(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let u=1;u<t.length;u++)if(t[u]&&t[u].nodeType===1){o=t[u];break}if(!k(o))return}e.apply(console,t)}}function w(e,t,r){const o=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function A(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){A(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}const P={};function z(e,t){P[e]=t}function X(e){return P[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=z,window.lnCore.getDataMapper=X);function G(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,A(function(){new MutationObserver(function(){w(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const Q={};function J(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];Q[r]=t}function Y(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=J,window.lnCore.getLocaleFallback=Y,window.lnCore.ensureLocaleObserver=G);const E={};function Z(e,t){E[e]||(E[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=E[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function B(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let i=0;i<r.length;i++){const l=r[i],c=l.getAttribute("data-ln-field");t[c]!=null&&(l.textContent=t[c])}const o=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<o.length;i++){const l=o[i],c=l.getAttribute("data-ln-attr").split(",");for(let d=0;d<c.length;d++){const n=c[d].trim().split(":");if(n.length!==2)continue;const s=n[0].trim(),f=n[1].trim();t[f]!=null&&l.setAttribute(s,t[f])}}const u=e.querySelectorAll("[data-ln-show]");for(let i=0;i<u.length;i++){const l=u[i],c=l.getAttribute("data-ln-show");c in t&&l.classList.toggle("hidden",!t[c])}const a=e.querySelectorAll("[data-ln-class]");for(let i=0;i<a.length;i++){const l=a[i],c=l.getAttribute("data-ln-class").split(",");for(let d=0;d<c.length;d++){const n=c[d].trim().split(":");if(n.length!==2)continue;const s=n[0].trim(),f=n[1].trim();f in t&&l.classList.toggle(s,!!t[f])}}return e}function ee(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<r.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[o],t??null),r[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)B(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 M(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(i,l){return t[l]!==void 0?t[l]:""}))}const o=function(a,i){return t[i]!==void 0?t[i]:""},u=Array.from(e.querySelectorAll("*"));e.nodeType===1&&u.push(e);for(let a=0;a<u.length;a++){const i=u[a],l=i.attributes;for(let c=0;c<l.length;c++){const d=l[c];d.value.indexOf("{{")!==-1&&i.setAttribute(d.name,d.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function te(e,t,r,o,u,a){const i={};for(let c=0;c<e.children.length;c++){const d=e.children[c],n=d.getAttribute("data-ln-render-key");n&&(i[n]=d)}const l=document.createDocumentFragment();for(let c=0;c<t.length;c++){const d=t[c],n=String(o(d));let s=i[n];if(s)u(s,d,c);else{const f=Z(r,a);if(!f||(M(f,d),s=f.firstElementChild,!s))continue;s.setAttribute("data-ln-render-key",n),u(s,d,c)}l.appendChild(s)}e.textContent="",e.appendChild(l)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=M,window.lnCore.fill=B,window.lnCore.lnFill=ee,window.lnCore.renderList=te);function $(e,t,r,o,u){if(!e||t===null)return!0;const a=o||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const l=c=>{u?console.warn(c,u):console.warn(c)};if(i==="boolean"){const c=t.trim().toLowerCase();return c!==""&&c!=="true"&&c!=="false"&&c!=="1"&&c!=="0"?(l(`[${a}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const c=e.values||[];return c.includes(t)?!0:(l(`[${a}] Invalid value "${t}" for attribute "${r}". Allowed: ${c.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return l(`[${a}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const c=parseInt(t,10);return e.min!==void 0&&c<e.min?(l(`[${a}] Value ${c} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&c>e.max?(l(`[${a}] Value ${c} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(l(`[${a}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(c){return l(`[${a}] Invalid JSON for attribute "${r}": ${c.message}. Fallback: ${e.fallback}.`),!1}return!0}function ne(e){const t={};for(const r in e){const o=e[r];o&&o.effect&&(t[r]=o.effect)}return Object.keys(t).length?t:null}function re(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}function S(e,t,r,o){if(e.nodeType!==1)return;const a=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i=Array.from(e.querySelectorAll(a));e.matches&&e.matches(a)&&i.push(e);for(const l of i)if(!l[r]){window.lnCore._persistSink&&l.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(l,t);try{l[r]=new o(l)}catch(c){console.error("["+r+"] init failed",l,c)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function oe(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ie(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 N(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function se(e){const t=N(),r=e.observed||[];for(let o=0;o<r.length;o++){const u=r[o];t.byAttr.has(u)||t.byAttr.set(u,[]),t.byAttr.get(u).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const u=t.byDeclaredAttr.get(o);u.some(a=>a.componentTag===e.componentTag)||u.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=re(e);if(o===null)t.reactiveWildcard.push(e);else for(const u of o)t.byReactive.has(u)||t.byReactive.set(u,[]),t.byReactive.get(u).push(e)}e.persist&&t.persist.push(e)}function F(e,t,r,o){for(let u=0;u<e.length;u++){const a=e[u];if(!t[a.attribute])continue;const i=a.effects&&a.effects[r];i?i(t,r,o):a.onAttrChange&&(!a.declared||a.declared.has(r))&&a.onAttrChange(t,r,o)}}function ae(e){const t=e.target,r=e.attributeName;if(e.oldValue===t.getAttribute(r))return;const o=N(),u=o.byAttr.get(r);if(R()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(r)&&k(t)){const a=o.byDeclaredAttr.get(r),i=t.getAttribute(r);for(let l=0;l<a.length;l++)$(a[l].spec,i,r,a[l].componentTag,t)}if(window.lnCore._debugSink&&(r.indexOf("data-ln-")===0||u)&&window.lnCore._debugSink("attr",r,t,{oldValue:e.oldValue,newValue:t.getAttribute(r)}),r.indexOf("data-ln-")===0){const a=o.byReactive.get(r);a&&F(a,t,r,e.oldValue),o.reactiveWildcard.length&&F(o.reactiveWildcard,t,r,e.oldValue)}if(u)for(let a=0;a<u.length;a++){const i=u[a];if(i.handler){i.handler(t,r,e.oldValue);continue}i.onAttributeChange&&t[i.attribute]?i.onAttributeChange(t,r):(S(t,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(t))}}function ue(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,A(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{ae(t[r])}catch(o){console.error("[ln-core] mutation handler failed",t[r].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function K(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function le(e){const t=K();if(t.length){if(e.target)for(let r=0;r<t.length;r++){const o=t[r];if(o.onSubtreeChange){const u=o.query,a=e.target.nodeType===1?e.target.matches(u)?e.target:e.target.closest(u):e.target.parentElement?e.target.parentElement.closest(u):null;a&&o.onSubtreeChange(a,e)}}for(let r=0;r<e.addedNodes.length;r++){const o=e.addedNodes[r];if(o.nodeType===1)for(let u=0;u<t.length;u++){const a=t[u];S(o,a.selector,a.attribute,a.ComponentFn),a.onInit&&a.onInit(o)}}for(let r=0;r<e.removedNodes.length;r++){const o=e.removedNodes[r];if(o.nodeType===1)for(let u=0;u<t.length;u++){const a=t[u],i=a.query,l=Array.from(o.querySelectorAll(i));o.matches&&o.matches(i)&&l.push(o);for(let c=0;c<l.length;c++){const d=l[c];if(!document.contains(d)){const n=d[a.attribute];if(n&&typeof n.destroy=="function")try{n.destroy()}catch(s){console.error("["+a.attribute+"] destroy failed",d,s)}delete d[a.attribute]}}}}}}function ce(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,A(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{le(o)}catch(u){console.error("[ln-core] lifecycle handler failed",o.target,u)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function de(e,t,r,o,u={}){const a=u.extraAttributes||[],i=u.onAttributeChange||null,l=u.onSubtreeChange||null,c=u.onInit||null,d=u.onAttrChange||null,n=u.effects||null,s=u.attributes||null,f=s?ne(s):n,p=s?new Set(Object.keys(s)):null,m=u.persist||null;function h(D){const _=D||document.body;if(S(_,e,t,r),s&&R())for(const x in s){const Ee=s[x],L=Array.from(_.querySelectorAll("["+x+"]"));_.matches&&_.matches("["+x+"]")&&L.push(_);for(let O=0;O<L.length;O++){const T=L[O];k(T)&&$(Ee,T.getAttribute(x),x,o,T)}}c&&c(_)}const C=[];if(e.indexOf("[")!==-1){const D=/\[([\w-]+)/g;let _;for(;(_=D.exec(e))!==null;)C.push(_[1])}else C.push(e);se({selector:e,attribute:t,componentTag:o,attributes:s,ComponentFn:r,onInit:c,observed:C.concat(a),onAttributeChange:i,onAttrChange:d,effects:f,declared:p,persist:m}),ue();const ke=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";K().push({selector:e,attribute:t,ComponentFn:r,onInit:c,onSubtreeChange:l,query:ke}),ce(),window[t]=h;function H(){oe()>0?ie(function(){h(document.body)}):h(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",H):H(),h}function U(e){return(e||"").replace(/^#/,"")}function I(e){const t=e===void 0?location.hash:e,r={},o=U(t);if(!o)return r;const u=o.split("&");for(let a=0;a<u.length;a++){const i=u[a];if(!i)continue;const l=i.indexOf(":"),c=l>-1?i.slice(0,l):i,d=l>-1?i.slice(l+1):"";if(c)try{r[c]=decodeURIComponent(d)}catch{r[c]=d}}return r}function fe(e){if(!e)return null;const t=I();return e in t?t[e]:null}function pe(e,t){if(!e)return;const r=I();t==null?delete r[e]:r[e]=String(t);const u=Object.keys(r).map(function(a){const i=r[a];return i===""?a:a+":"+encodeURIComponent(i)}).join("&");U(location.hash)!==u&&(location.hash=u)}function he(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function we(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function me(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function be(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 ye(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ge(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),o=e.slice(t+1),u=o?o.split(",").map(function(a){try{return decodeURIComponent(a)}catch{return a}}).filter(Boolean):[];return{key:r,values:u}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=I,window.lnCore.hashGet=fe,window.lnCore.hashSet=pe,window.lnCore.hashLinkClick=he,window.lnCore.resolveHashNamespace=we,window.lnCore.hashSortEncode=me,window.lnCore.hashSortDecode=be,window.lnCore.hashFilterEncode=ye,window.lnCore.hashFilterDecode=ge);const _e="ln_api_queue",Ce=2,b="outbox",y="_queue_meta";function g(e,t){return e.error||new Error(t)}function q(e,t){return e.bound([t,-1/0],[t,1/0])}function V(e){return"seq:"+e}function v(e){return"paused:"+e}function j(e){e.leaseOwner=null,e.leaseUntil=0}function qe(e,t,r){return typeof e!="string"||e.indexOf(t)===-1?e:e.split(t).join(r)}function xe(e,t,r,o){const u=new Map,a=[],i=[];for(const l of e||[])u.has(l.chainKey)||u.set(l.chainKey,[]),u.get(l.chainKey).push(l);return u.forEach((l,c)=>{l.sort((n,s)=>n.seq-s.seq);const d=l[0];if(!(!d||d.status==="failed")){if(d.status==="inflight"&&(d.leaseUntil||0)>o){i.push({chainKey:c,at:d.leaseUntil});return}if((d.nextAttemptAt||0)>o){i.push({chainKey:c,at:d.nextAttemptAt});return}d.status="inflight",d.leaseOwner=t,d.leaseUntil=o+r,d.updatedAt=o,a.push(d)}}),{entries:a,wakeups:i}}function Ae(e,t,r,o,u){const a=[],i=[];for(const l of e||[]){if(l.entryId===t){i.push(l.entryId);continue}l.chainKey===r&&(l.chainKey=o,l.targetId===r&&(l.targetId=o),l.meta&&l.meta.id===r&&(l.meta.id=o),l.meta&&typeof l.meta.action=="string"&&(l.meta.action=qe(l.meta.action,r,o)),l.updatedAt=u,a.push(l))}return{changed:a,deleted:i}}class ve{constructor(t){t=t||{},this.indexedDB=t.indexedDB||globalThis.indexedDB,this.keyRange=t.IDBKeyRange||globalThis.IDBKeyRange,this.dbName=t.dbName||_e,this.now=t.now||(()=>Date.now()),this.uuid=t.uuid||(()=>crypto.randomUUID()),this._db=null,this._ready=null}open(){return this._ready?this._ready:!this.indexedDB||!this.keyRange?Promise.resolve(null):(this._ready=new Promise((t,r)=>{const o=this.indexedDB.open(this.dbName,Ce);o.onupgradeneeded=u=>{const a=u.target.result;let i;a.objectStoreNames.contains(b)?i=u.target.transaction.objectStore(b):i=a.createObjectStore(b,{keyPath:"entryId"}),i.indexNames.contains("by_scope_chain")||i.createIndex("by_scope_chain",["scope","chainKey"],{unique:!1}),i.indexNames.contains("by_scope_seq")||i.createIndex("by_scope_seq",["scope","seq"],{unique:!1}),a.objectStoreNames.contains(y)||a.createObjectStore(y,{keyPath:"key"})},o.onerror=()=>r(g(o,"Queue database open failed")),o.onsuccess=u=>{this._db=u.target.result,this._db.onversionchange=()=>this.close(),t(this._db)}}),this._ready)}close(){this._db&&this._db.close(),this._db=null,this._ready=null}deleteDatabase(){return this.close(),this.indexedDB?new Promise((t,r)=>{const o=this.indexedDB.deleteDatabase(this.dbName);o.onsuccess=()=>t(),o.onerror=()=>r(g(o,"Queue database delete failed")),o.onblocked=()=>r(new Error("Queue database delete blocked"))}):Promise.resolve()}allForScope(t){return this.open().then(r=>r?new Promise((o,u)=>{const i=r.transaction(b,"readonly").objectStore(b).index("by_scope_seq").getAll(q(this.keyRange,t));i.onsuccess=()=>o(i.result||[]),i.onerror=()=>u(g(i,"Queue scope read failed"))}):[])}enqueue(t,r){return r=r||{},this.open().then(o=>o?new Promise((u,a)=>{const i=o.transaction([y,b],"readwrite"),l=i.objectStore(y),c=i.objectStore(b),d=V(t);let n=null;const s=p=>{const m=p+1;n={entryId:this.uuid(),scope:t,chainKey:r.chainKey,seq:m,op:r.op,targetId:r.targetId!==void 0?r.targetId:null,payload:r.payload,expectedVersion:r.expectedVersion!==void 0?r.expectedVersion:null,meta:r.meta||{},attempts:0,nextAttemptAt:0,status:"pending",leaseOwner:null,leaseUntil:0,createdAt:this.now(),updatedAt:this.now()},l.put({key:d,value:m}),c.put(n)},f=l.get(d);f.onerror=()=>a(g(f,"Queue sequence read failed")),f.onsuccess=()=>{const p=f.result;if(p&&typeof p.value=="number"){s(p.value);return}const m=c.index("by_scope_seq").getAll(q(this.keyRange,t));m.onerror=()=>a(g(m,"Queue sequence migration failed")),m.onsuccess=()=>{const h=(m.result||[]).reduce((C,W)=>Math.max(C,W.seq||0),0);s(h)}},i.oncomplete=()=>u(n),i.onerror=()=>a(i.error||new Error("Queue enqueue transaction failed")),i.onabort=()=>a(i.error||new Error("Queue enqueue transaction aborted"))}):null)}claimReady(t,r,o){return this.open().then(u=>u?new Promise((a,i)=>{const l=u.transaction(b,"readwrite"),c=l.objectStore(b),d=c.index("by_scope_seq").getAll(q(this.keyRange,t)),n=this.now();let s={entries:[],wakeups:[]};d.onerror=()=>i(g(d,"Queue claim read failed")),d.onsuccess=()=>{s=xe(d.result||[],r,o,n);for(const f of s.entries)c.put(f)},l.oncomplete=()=>a(s),l.onerror=()=>i(l.error||new Error("Queue claim transaction failed")),l.onabort=()=>i(l.error||new Error("Queue claim transaction aborted"))}):{entries:[],wakeups:[]})}ack(t,r){return this._updateEntry(t,r,(o,u)=>(u.delete(o.entryId),{status:"acked",entry:o}))}nack(t,r,o,u){u=u||{};const a=u.maxAttempts||8,i=u.backoff||[2e3,5e3,15e3,6e4,3e5];return this.open().then(l=>l?new Promise((c,d)=>{const n=l.transaction([b,y],"readwrite"),s=n.objectStore(b),f=n.objectStore(y),p=s.get(r);let m=null;p.onerror=()=>d(g(p,"Queue nack read failed")),p.onsuccess=()=>{const h=p.result;if(!(!h||h.scope!==t)){if(o==="drop"){s.delete(h.entryId),m={status:"dropped",entry:h};return}if(j(h),h.updatedAt=this.now(),o==="auth"){h.status="pending",s.put(h),f.put({key:v(t),value:"auth"}),m={status:"auth",entry:h};return}if(o==="retry"){if(h.attempts=(h.attempts||0)+1,h.attempts>=a){h.status="failed",h.nextAttemptAt=0,s.put(h),m={status:"failed",entry:h};return}const C=i[Math.min(h.attempts-1,i.length-1)];h.status="pending",h.nextAttemptAt=this.now()+C,s.put(h),m={status:"retry",entry:h,delay:C}}}},n.oncomplete=()=>c(m),n.onerror=()=>d(n.error||new Error("Queue nack transaction failed")),n.onabort=()=>d(n.error||new Error("Queue nack transaction aborted"))}):null)}remap(t,r,o){return this._remapTransaction(t,null,r,o)}resolveCreate(t,r,o,u){return this._remapTransaction(t,r,o,u)}_remapTransaction(t,r,o,u){return this.open().then(a=>a?new Promise((i,l)=>{const c=a.transaction(b,"readwrite"),d=c.objectStore(b),n=d.index("by_scope_seq").getAll(q(this.keyRange,t));let s={changed:[],deleted:[]};n.onerror=()=>l(g(n,"Queue remap read failed")),n.onsuccess=()=>{s=Ae(n.result||[],r,o,u,this.now());for(const f of s.deleted)d.delete(f);for(const f of s.changed)d.put(f)},c.oncomplete=()=>i(s.changed),c.onerror=()=>l(c.error||new Error("Queue remap transaction failed")),c.onabort=()=>l(c.error||new Error("Queue remap transaction aborted"))}):[])}resetFailed(t){return this.open().then(r=>r?new Promise((o,u)=>{const a=r.transaction(b,"readwrite"),i=a.objectStore(b),l=i.index("by_scope_seq").getAll(q(this.keyRange,t));let c=0;l.onerror=()=>u(g(l,"Queue failed-entry read failed")),l.onsuccess=()=>{for(const d of l.result||[])d.status==="failed"&&(d.status="pending",d.attempts=0,d.nextAttemptAt=0,d.updatedAt=this.now(),j(d),i.put(d),c++)},a.oncomplete=()=>o(c),a.onerror=()=>u(a.error||new Error("Queue failed-entry reset failed")),a.onabort=()=>u(a.error||new Error("Queue failed-entry reset aborted"))}):0)}getPaused(t){return this.open().then(r=>r?new Promise((o,u)=>{const i=r.transaction(y,"readonly").objectStore(y).get(v(t));i.onsuccess=()=>{const l=i.result?i.result.value:!1;o(l||!1)},i.onerror=()=>u(g(i,"Queue pause-state read failed"))}):!1)}setPaused(t,r){return this.open().then(o=>{if(o)return new Promise((u,a)=>{const i=o.transaction(y,"readwrite"),l=typeof r=="string"?r:r?"manual":!1;i.objectStore(y).put({key:v(t),value:l}),i.oncomplete=()=>u(),i.onerror=()=>a(i.error||new Error("Queue pause-state write failed")),i.onabort=()=>a(i.error||new Error("Queue pause-state write aborted"))})})}clear(t){return this.open().then(r=>{if(r)return new Promise((o,u)=>{const a=r.transaction([b,y],"readwrite"),l=a.objectStore(b).index("by_scope_seq").openCursor(q(this.keyRange,t));l.onsuccess=c=>{const d=c.target.result;d&&(d.delete(),d.continue())},l.onerror=()=>u(g(l,"Queue clear failed")),a.objectStore(y).delete(V(t)),a.objectStore(y).delete(v(t)),a.oncomplete=()=>o(),a.onerror=()=>u(a.error||new Error("Queue clear transaction failed")),a.onabort=()=>u(a.error||new Error("Queue clear transaction aborted"))})})}_updateEntry(t,r,o){return this.open().then(u=>u?new Promise((a,i)=>{const l=u.transaction(b,"readwrite"),c=l.objectStore(b),d=c.get(r);let n=null;d.onerror=()=>i(g(d,"Queue entry read failed")),d.onsuccess=()=>{const s=d.result;!s||s.scope!==t||(n=o(s,c))},l.oncomplete=()=>a(n),l.onerror=()=>i(l.error||new Error("Queue entry transaction failed")),l.onabort=()=>i(l.error||new Error("Queue entry transaction aborted"))}):null)}}(function(){const e="data-ln-api-queue",t="lnApiQueue",r=[2e3,5e3,15e3,6e4,3e5],o=8,u=6e4;if(window[t]!==void 0)return;function a(n){const s=n[t];s&&s._drain()}const i={"data-ln-api-queue":{type:"marker",description:"Mounts offline API synchronization queue backed by IndexedDB"},"data-ln-api-queue-online":{effect:a,type:"enum",values:["true","false"],fallback:"auto",description:"Network connectivity override (true/false, or auto-detect from navigator.onLine)"}};function l(){try{return crypto.randomUUID()}catch{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const f=Math.random()*16|0;return(s==="x"?f:f&3|8).toString(16)})}}const c=new ve({indexedDB:window.indexedDB,IDBKeyRange:window.IDBKeyRange,uuid:l});function d(n){this.dom=n,n[t]=this;const s=n.closest("[data-ln-data-coordinator]");this.scope=n.id||(s?s.id:null)||"default",this._paused=!1,this._timers=new Map,this._workerId=l(),this._drainPromise=null,this._onlineHandler=()=>this._drain(),this._bindEvents(),window.addEventListener("online",this._onlineHandler);const f=this;return c.open().then(p=>p?c.getPaused(f.scope):(console.warn("[ln-api-queue] IndexedDB not available — queue disabled"),!1)).then(p=>{if(f._paused=!!p,f._paused){const m=typeof p=="string"?p:"auth";w(f.dom,"ln-api-queue:paused",{reason:m,restored:!0})}return f._emitPendingCount()}).then(()=>f._drain()).catch(p=>{console.error("[ln-api-queue] Initialization failed:",p),w(f.dom,"ln-api-queue:error",{operation:"initialize",error:p})}),this}d.prototype._isOnline=function(){const n=this.dom.getAttribute("data-ln-api-queue-online");return n==="true"?!0:n==="false"?!1:navigator.onLine},d.prototype._emitPendingCount=function(){const n=this;return c.allForScope(n.scope).then(s=>(w(n.dom,"ln-api-queue:pending-count",{count:s.length,scope:n.scope}),s.length===0&&w(n.dom,"ln-api-queue:drained",{scope:n.scope}),s))},d.prototype._clearTimer=function(n){const s=this._timers.get(n);s&&(clearTimeout(s),this._timers.delete(n))},d.prototype._scheduleTimer=function(n,s){const f=Math.max(0,s),p=this._timers.get(n);p&&clearTimeout(p);const m=this,h=setTimeout(()=>{m._timers.delete(n),m._drain()},f);this._timers.set(n,h)},d.prototype._drain=function(){const n=this;return n._paused||!n._isOnline()?Promise.resolve():(n._drainPromise||(n._drainPromise=c.claimReady(n.scope,n._workerId,u).then(s=>{for(const f of s.wakeups)n._scheduleTimer(f.chainKey,f.at-Date.now());for(const f of s.entries)n._clearTimer(f.chainKey),w(n.dom,"ln-api-queue:send",{entryId:f.entryId,chainKey:f.chainKey,op:f.op,targetId:f.targetId,payload:f.payload,expectedVersion:f.expectedVersion,idempotencyKey:f.entryId,meta:f.meta})}).catch(s=>{console.error("[ln-api-queue] Drain failed:",s),w(n.dom,"ln-api-queue:error",{operation:"drain",error:s})}).finally(()=>{n._drainPromise=null})),n._drainPromise)},d.prototype._onEnqueue=function(n){const s=this;return c.enqueue(s.scope,n.detail||{}).then(f=>{if(f)return s._emitPendingCount().then(p=>(w(s.dom,"ln-api-queue:enqueued",{entryId:f.entryId,chainKey:f.chainKey,count:p.length}),s._drain()))}).catch(f=>{w(s.dom,"ln-api-queue:error",{operation:"enqueue",error:f})})},d.prototype._onAck=function(n){const s=this,f=n.detail||{};return c.ack(s.scope,f.entryId).then(()=>s._emitPendingCount()).then(()=>s._drain()).catch(p=>{w(s.dom,"ln-api-queue:error",{operation:"ack",entryId:f.entryId,error:p})})},d.prototype._onNack=function(n){const s=this,f=n.detail||{};return c.nack(s.scope,f.entryId,f.reason,{maxAttempts:o,backoff:r}).then(p=>{if(p)return p.status==="failed"?w(s.dom,"ln-api-queue:failed",{entryId:p.entry.entryId,chainKey:p.entry.chainKey,attempts:p.entry.attempts}):p.status==="retry"?s._scheduleTimer(p.entry.chainKey,p.delay):p.status==="auth"&&(s._paused=!0,w(s.dom,"ln-api-queue:paused",{reason:"auth"}),w(s.dom,"ln-api-queue:auth-required",{entryId:p.entry.entryId,chainKey:p.entry.chainKey})),s._emitPendingCount().then(()=>{if(p.status==="dropped")return s._drain()})}).catch(p=>{w(s.dom,"ln-api-queue:error",{operation:"nack",entryId:f.entryId,error:p})})},d.prototype._onRemap=function(n){const s=this,f=n.detail||{};return c.remap(s.scope,f.oldKey,f.newId).catch(p=>{w(s.dom,"ln-api-queue:error",{operation:"remap",error:p})})},d.prototype._onResolveCreate=function(n){const s=this,f=n.detail||{};return c.resolveCreate(s.scope,f.entryId,f.oldKey,f.newId).then(()=>s._emitPendingCount()).then(()=>s._drain()).catch(p=>{w(s.dom,"ln-api-queue:error",{operation:"resolve-create",entryId:f.entryId,error:p})})},d.prototype._onResume=function(){const n=this;return c.setPaused(n.scope,!1).then(()=>(n._paused=!1,w(n.dom,"ln-api-queue:resumed",{}),n._drain())).catch(s=>{w(n.dom,"ln-api-queue:error",{operation:"resume",error:s})})},d.prototype._onPause=function(){const n=this;return c.setPaused(n.scope,"manual").then(()=>{n._paused=!0,w(n.dom,"ln-api-queue:paused",{reason:"manual"})}).catch(s=>{w(n.dom,"ln-api-queue:error",{operation:"pause",error:s})})},d.prototype._onDrain=function(){const n=this;return c.resetFailed(n.scope).then(()=>{const s=n._drainPromise;return s?s.then(()=>n._drain()):n._drain()}).catch(s=>{w(n.dom,"ln-api-queue:error",{operation:"manual-drain",error:s})})},d.prototype._onClear=function(){const n=this;return n._timers.forEach(s=>clearTimeout(s)),n._timers.clear(),c.clear(n.scope).then(()=>{n._paused=!1,w(n.dom,"ln-api-queue:pending-count",{count:0,scope:n.scope}),w(n.dom,"ln-api-queue:drained",{scope:n.scope})}).catch(s=>{w(n.dom,"ln-api-queue:error",{operation:"clear",error:s})})},d.prototype._bindEvents=function(){const n=this;n._handlers={enqueue:s=>n._onEnqueue(s),ack:s=>n._onAck(s),nack:s=>n._onNack(s),remap:s=>n._onRemap(s),resolveCreate:s=>n._onResolveCreate(s),resume:()=>n._onResume(),pause:()=>n._onPause(),drain:()=>n._onDrain(),clear:()=>n._onClear()},n.dom.addEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.addEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.addEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.addEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.addEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.addEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.addEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.addEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.addEventListener("ln-api-queue:request-clear",n._handlers.clear)},d.prototype.destroy=function(){if(!this.dom[t])return;const n=this;n.dom.removeEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.removeEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.removeEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.removeEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.removeEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.removeEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.removeEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.removeEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.removeEventListener("ln-api-queue:request-clear",n._handlers.clear),window.removeEventListener("online",n._onlineHandler),n._timers.forEach(s=>clearTimeout(s)),n._timers.clear(),delete n.dom[t]},de(e,t,d,"ln-api-queue",{attributes:i})})()})();
|
|
1
|
+
(function(){"use strict";function Q(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function k(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let a=1;a<t.length;a++)if(t[a]&&t[a].nodeType===1){o=t[a];break}if(!k(o))return}e.apply(console,t)}}function h(e,t,r){const o=r||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function v(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){v(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function oe(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function ie(e,t){const r=!!(t&&t.typed),o=t&&t.exclude,a={},l=e.elements,i={};if(r)for(let u=0;u<l.length;u++){const s=l[u];s.name&&s.type==="checkbox"&&!s.disabled&&(i[s.name]=(i[s.name]||0)+1)}for(let u=0;u<l.length;u++){const s=l[u];if(!(!s.name||s.disabled||s.type==="file"||s.type==="submit"||s.type==="button")&&!(o&&s.matches&&s.matches(o)))if(s.type==="checkbox")r&&i[s.name]===1?a[s.name]=s.checked:(a[s.name]||(a[s.name]=[]),s.checked&&a[s.name].push(s.value));else if(s.type==="radio")s.checked&&(a[s.name]=s.value);else if(s.type==="select-multiple"){a[s.name]=[];for(let n=0;n<s.options.length;n++)s.options[n].selected&&a[s.name].push(s.options[n].value)}else if(r&&s.type==="hidden")a[s.name]=s.value;else if(r&&(s.type==="number"||s.type==="range")){const n=Number(s.value);a[s.name]=s.value===""||isNaN(n)?null:n}else a[s.name]=s.value}return a}function se(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function ae(e,t){const r=e.elements,o=[],a={};for(let l=0;l<r.length;l++){const i=r[l];i.name&&i.type==="checkbox"&&(a[i.name]=(a[i.name]||0)+1)}for(let l=0;l<r.length;l++){const i=r[l];if(i.type==="file"||i.type==="submit"||i.type==="button")continue;const u=i.getAttribute("data-ln-fill-as")||i.name;if(!u||!(u in t))continue;const s=t[u];if(i.type==="checkbox"){if(Array.isArray(s))i.checked=s.indexOf(i.value)!==-1;else if(a[i.name]>1){const n=String(s).split(",").map(function(c){return c.trim()});i.checked=n.indexOf(i.value)!==-1}else i.checked=se(s);o.push(i)}else if(i.type==="radio")i.checked=i.value===String(s),o.push(i);else if(i.type==="select-multiple"){if(Array.isArray(s))for(let n=0;n<i.options.length;n++)i.options[n].selected=s.indexOf(i.options[n].value)!==-1;o.push(i)}else i.value=s,i.tagName==="SELECT"&&s!=null&&i.setAttribute("data-ln-value",s),o.push(i)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=ae,window.lnCore.serializeForm=ie,window.lnCore.resolveFormMethod=oe);const N={};function ue(e,t){N[e]=t}function le(e){return N[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=ue,window.lnCore.getDataMapper=le);function ce(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,v(function(){new MutationObserver(function(){h(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const F={};function de(e,t){if(!e||typeof t!="object")return;const r=e.toLowerCase().split("-")[0];F[r]=t}function fe(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return F[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=de,window.lnCore.getLocaleFallback=fe,window.lnCore.ensureLocaleObserver=ce);const E={};function pe(e,t){E[e]||(E[e]=document.querySelector('[data-ln-template="'+e+'"]'));const r=E[e];return r?r.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function M(e,t){if(!e||!t)return e;const r=e.querySelectorAll("[data-ln-field]");for(let i=0;i<r.length;i++){const u=r[i],s=u.getAttribute("data-ln-field");t[s]!=null&&(u.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let i=0;i<o.length;i++){const u=o[i],s=u.getAttribute("data-ln-attr").split(",");for(let n=0;n<s.length;n++){const c=s[n].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),f=c[1].trim();t[f]!=null&&u.setAttribute(d,t[f])}}const a=e.querySelectorAll("[data-ln-show]");for(let i=0;i<a.length;i++){const u=a[i],s=u.getAttribute("data-ln-show");s in t&&u.classList.toggle("hidden",!t[s])}const l=e.querySelectorAll("[data-ln-class]");for(let i=0;i<l.length;i++){const u=l[i],s=u.getAttribute("data-ln-class").split(",");for(let n=0;n<s.length;n++){const c=s[n].trim().split(":");if(c.length!==2)continue;const d=c[0].trim(),f=c[1].trim();f in t&&u.classList.toggle(d,!!t[f])}}return e}function he(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const r=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<r.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",r[o],t??null),r[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)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 $(e,t){if(!e||!t)return e;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;r.nextNode();){const l=r.currentNode;l.textContent.indexOf("{{")!==-1&&(l.textContent=l.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(i,u){return t[u]!==void 0?t[u]:""}))}const o=function(l,i){return t[i]!==void 0?t[i]:""},a=Array.from(e.querySelectorAll("*"));e.nodeType===1&&a.push(e);for(let l=0;l<a.length;l++){const i=a[l],u=i.attributes;for(let s=0;s<u.length;s++){const n=u[s];n.value.indexOf("{{")!==-1&&i.setAttribute(n.name,n.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function we(e,t,r,o,a,l){const i={};for(let s=0;s<e.children.length;s++){const n=e.children[s],c=n.getAttribute("data-ln-render-key");c&&(i[c]=n)}const u=document.createDocumentFragment();for(let s=0;s<t.length;s++){const n=t[s],c=String(o(n));let d=i[c];if(d)a(d,n,s);else{const f=pe(r,l);if(!f||($(f,n),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",c),a(d,n,s)}u.appendChild(d)}e.textContent="",e.appendChild(u)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=M,window.lnCore.lnFill=he,window.lnCore.renderList=we);function S(e,t,r){const o=e.getAttribute(t);return o===null?r:o}function K(e,t,r){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?r:o}function j(e,t,r=!1){const o=e.getAttribute(t);if(o===null)return!!r;const a=o.trim().toLowerCase();return!(a==="false"||a==="0")}function U(e,t){return(e.getAttribute(t)||"").split(",").map(r=>r.trim()).filter(Boolean)}const I=new Map;function V(e,t){const r=(e?e.join("|"):"")+"::"+t;if(I.has(r))return I.get(r);const o=new Set(e||[]),a=function(l,i){const u=l.getAttribute(i);return u!==null&&o.has(u)?u:t};return I.set(r,a),a}function W(e,t,r){const o=parseFloat(e.getAttribute(t));return isNaN(o)?r:o}function H(e,t,r){const o=e.getAttribute(t);if(!o)return r;try{return JSON.parse(o)}catch{return r}}function z(e,t,r,o,a){if(!e||t===null)return!0;const l=o||"ln-component",i=e.type;if(i==="trigger"||i==="marker"||i==="string"||i==="list"||!i||t===""&&e.fallback!==void 0)return!0;const u=s=>{a?console.warn(s,a):console.warn(s)};if(i==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(u(`[${l}] Invalid value "${t}" for boolean attribute "${r}". Allowed: "true", "false", or presence-only.`),!1):!0}if(i==="enum"){const s=e.values||[];return s.includes(t)?!0:(u(`[${l}] Invalid value "${t}" for attribute "${r}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(i==="integer"){if(!/^-?\d+$/.test(t))return u(`[${l}] Invalid integer "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(u(`[${l}] Value ${s} for attribute "${r}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(u(`[${l}] Value ${s} for attribute "${r}" is greater than max (${e.max}).`),!1):!0}if(i==="float")return isNaN(Number(t))?(u(`[${l}] Invalid float "${t}" for attribute "${r}". Fallback: ${e.fallback}.`),!1):!0;if(i==="json")try{return JSON.parse(t),!0}catch(s){return u(`[${l}] Invalid JSON for attribute "${r}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function me(e,t,r){for(const o in r){const[a,l,i]=r[o];Object.defineProperty(e,o,{get:function(){return a(t,l,i)},enumerable:!0,configurable:!0})}return e}function be(e){const t={};for(const r in e){const o=e[r];if(!o||!o.prop)continue;let a=o.read;if(!a&&o.type)switch(o.type){case"enum":a=V(o.values,o.fallback);break;case"integer":a=K;break;case"float":a=W;break;case"boolean":a=j;break;case"list":a=U;break;case"json":a=H;break;case"string":default:a=S;break}a||(a=S),t[o.prop]=[a,r,o.fallback]}return t}function ye(e){const t={};for(const r in e){const o=e[r];o&&o.effect&&(t[r]=o.effect)}return Object.keys(t).length?t:null}function ge(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const r in e.effects)t.add(r);if(e.onAttrChange&&e.declared)for(const r of e.declared)t.add(r);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=me,window.lnCore.attrSpec=be,window.lnCore.attrStr=S,window.lnCore.attrInt=K,window.lnCore.attrBool=j,window.lnCore.attrList=U,window.lnCore.attrEnum=V,window.lnCore.attrFloat=W,window.lnCore.attrJson=H);function L(e,t,r,o){if(e.nodeType!==1)return;const l=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",i=Array.from(e.querySelectorAll(l));e.matches&&e.matches(l)&&i.push(e);for(const u of i)if(!u[r]){window.lnCore._persistSink&&u.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(u,t);try{u[r]=new o(u)}catch(s){console.error("["+r+"] init failed",u,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function _e(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function Ce(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function J(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function xe(e){const t=J(),r=e.observed||[];for(let o=0;o<r.length;o++){const a=r[o];t.byAttr.has(a)||t.byAttr.set(a,[]),t.byAttr.get(a).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const a=t.byDeclaredAttr.get(o);a.some(l=>l.componentTag===e.componentTag)||a.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ge(e);if(o===null)t.reactiveWildcard.push(e);else for(const a of o)t.byReactive.has(a)||t.byReactive.set(a,[]),t.byReactive.get(a).push(e)}e.persist&&t.persist.push(e)}function X(e,t,r,o){for(let a=0;a<e.length;a++){const l=e[a];if(!t[l.attribute])continue;const i=l.effects&&l.effects[r];i?i(t,r,o):l.onAttrChange&&(!l.declared||l.declared.has(r))&&l.onAttrChange(t,r,o)}}function qe(e){const t=e.target,r=e.attributeName;if(e.oldValue===t.getAttribute(r))return;const o=J(),a=o.byAttr.get(r);if(Q()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(r)&&k(t)){const l=o.byDeclaredAttr.get(r),i=t.getAttribute(r);for(let u=0;u<l.length;u++)z(l[u].spec,i,r,l[u].componentTag,t)}if(window.lnCore._debugSink&&(r.indexOf("data-ln-")===0||a)&&window.lnCore._debugSink("attr",r,t,{oldValue:e.oldValue,newValue:t.getAttribute(r)}),r.indexOf("data-ln-")===0){const l=o.byReactive.get(r);l&&X(l,t,r,e.oldValue),o.reactiveWildcard.length&&X(o.reactiveWildcard,t,r,e.oldValue)}if(a)for(let l=0;l<a.length;l++){const i=a[l];if(i.handler){i.handler(t,r,e.oldValue);continue}i.onAttributeChange&&t[i.attribute]?i.onAttributeChange(t,r):(L(t,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(t))}}function ve(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,v(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++)try{qe(t[r])}catch(o){console.error("[ln-core] mutation handler failed",t[r].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function G(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function Ae(e){const t=G();if(t.length){if(e.target)for(let r=0;r<t.length;r++){const o=t[r];if(o.onSubtreeChange){const a=o.query,l=e.target.nodeType===1?e.target.matches(a)?e.target:e.target.closest(a):e.target.parentElement?e.target.parentElement.closest(a):null;l&&o.onSubtreeChange(l,e)}}for(let r=0;r<e.addedNodes.length;r++){const o=e.addedNodes[r];if(o.nodeType===1)for(let a=0;a<t.length;a++){const l=t[a];L(o,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(o)}}for(let r=0;r<e.removedNodes.length;r++){const o=e.removedNodes[r];if(o.nodeType===1)for(let a=0;a<t.length;a++){const l=t[a],i=l.query,u=Array.from(o.querySelectorAll(i));o.matches&&o.matches(i)&&u.push(o);for(let s=0;s<u.length;s++){const n=u[s];if(!document.contains(n)){const c=n[l.attribute];if(c&&typeof c.destroy=="function")try{c.destroy()}catch(d){console.error("["+l.attribute+"] destroy failed",n,d)}delete n[l.attribute]}}}}}}function ke(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,v(function(){new MutationObserver(function(t){for(let r=0;r<t.length;r++){const o=t[r];if(o.type==="childList")try{Ae(o)}catch(a){console.error("[ln-core] lifecycle handler failed",o.target,a)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function Y(e,t,r,o,a={}){const l=a.extraAttributes||[],i=a.onAttributeChange||null,u=a.onSubtreeChange||null,s=a.onInit||null,n=a.onAttrChange||null,c=a.effects||null,d=a.attributes||null,f=d?ye(d):c,m=d?new Set(Object.keys(d)):null,b=a.persist||null;function p(T){const _=T||document.body;if(L(_,e,t,r),d&&Q())for(const q in d){const Ke=d[q],R=Array.from(_.querySelectorAll("["+q+"]"));_.matches&&_.matches("["+q+"]")&&R.push(_);for(let P=0;P<R.length;P++){const B=R[P];k(B)&&z(Ke,B.getAttribute(q),q,o,B)}}s&&s(_)}const C=[];if(e.indexOf("[")!==-1){const T=/\[([\w-]+)/g;let _;for(;(_=T.exec(e))!==null;)C.push(_[1])}else C.push(e);xe({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:r,onInit:s,observed:C.concat(l),onAttributeChange:i,onAttrChange:n,effects:f,declared:m,persist:b}),ve();const $e=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";G().push({selector:e,attribute:t,ComponentFn:r,onInit:s,onSubtreeChange:u,query:$e}),ke(),window[t]=p,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=Y);function re(){_e()>0?Ce(function(){p(document.body)}):p(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",re):re(),p}function Z(e){return(e||"").replace(/^#/,"")}function D(e){const t=e===void 0?location.hash:e,r={},o=Z(t);if(!o)return r;const a=o.split("&");for(let l=0;l<a.length;l++){const i=a[l];if(!i)continue;const u=i.indexOf(":"),s=u>-1?i.slice(0,u):i,n=u>-1?i.slice(u+1):"";if(s)try{r[s]=decodeURIComponent(n)}catch{r[s]=n}}return r}function Ee(e){if(!e)return null;const t=D();return e in t?t[e]:null}function Se(e,t){if(!e)return;const r=D();t==null?delete r[e]:r[e]=String(t);const a=Object.keys(r).map(function(l){const i=r[l];return i===""?l:l+":"+encodeURIComponent(i)}).join("&");Z(location.hash)!==a&&(location.hash=a)}function Ie(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function Le(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const r=e.getAttribute("data-ln-hash");if(r&&r.trim()!=="")return r.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function De(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Oe(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function Te(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function Re(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const r=e.slice(0,t),o=e.slice(t+1),a=o?o.split(",").map(function(l){try{return decodeURIComponent(l)}catch{return l}}).filter(Boolean):[];return{key:r,values:a}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=D,window.lnCore.hashGet=Ee,window.lnCore.hashSet=Se,window.lnCore.hashLinkClick=Ie,window.lnCore.resolveHashNamespace=Le,window.lnCore.hashSortEncode=De,window.lnCore.hashSortDecode=Oe,window.lnCore.hashFilterEncode=Te,window.lnCore.hashFilterDecode=Re);function O(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=O);const Pe="ln_api_queue",Be=2,w="outbox",y="_queue_meta";function g(e,t){return e.error||new Error(t)}function x(e,t){return e.bound([t,-1/0],[t,1/0])}function ee(e){return"seq:"+e}function A(e){return"paused:"+e}function te(e){e.leaseOwner=null,e.leaseUntil=0}function Qe(e,t,r){return typeof e!="string"||e.indexOf(t)===-1?e:e.split(t).join(r)}function Ne(e,t,r,o){const a=new Map,l=[],i=[];for(const u of e||[])a.has(u.chainKey)||a.set(u.chainKey,[]),a.get(u.chainKey).push(u);return a.forEach((u,s)=>{u.sort((c,d)=>c.seq-d.seq);const n=u[0];if(!(!n||n.status==="failed")){if(n.status==="inflight"&&(n.leaseUntil||0)>o){i.push({chainKey:s,at:n.leaseUntil});return}if((n.nextAttemptAt||0)>o){i.push({chainKey:s,at:n.nextAttemptAt});return}n.status="inflight",n.leaseOwner=t,n.leaseUntil=o+r,n.updatedAt=o,l.push(n)}}),{entries:l,wakeups:i}}function Fe(e,t,r,o,a){const l=[],i=[];for(const u of e||[]){if(u.entryId===t){i.push(u.entryId);continue}u.chainKey===r&&(u.chainKey=o,u.targetId===r&&(u.targetId=o),u.meta&&u.meta.id===r&&(u.meta.id=o),u.meta&&typeof u.meta.action=="string"&&(u.meta.action=Qe(u.meta.action,r,o)),u.updatedAt=a,l.push(u))}return{changed:l,deleted:i}}class Me{constructor(t){t=t||{},this.indexedDB=t.indexedDB||globalThis.indexedDB,this.keyRange=t.IDBKeyRange||globalThis.IDBKeyRange,this.dbName=t.dbName||Pe,this.now=t.now||(()=>Date.now()),this.uuid=t.uuid||(()=>crypto.randomUUID()),this._db=null,this._ready=null}open(){return this._ready?this._ready:!this.indexedDB||!this.keyRange?Promise.resolve(null):(this._ready=new Promise((t,r)=>{const o=this.indexedDB.open(this.dbName,Be);o.onupgradeneeded=a=>{const l=a.target.result;let i;l.objectStoreNames.contains(w)?i=a.target.transaction.objectStore(w):i=l.createObjectStore(w,{keyPath:"entryId"}),i.indexNames.contains("by_scope_chain")||i.createIndex("by_scope_chain",["scope","chainKey"],{unique:!1}),i.indexNames.contains("by_scope_seq")||i.createIndex("by_scope_seq",["scope","seq"],{unique:!1}),l.objectStoreNames.contains(y)||l.createObjectStore(y,{keyPath:"key"})},o.onerror=()=>r(g(o,"Queue database open failed")),o.onsuccess=a=>{this._db=a.target.result,this._db.onversionchange=()=>this.close(),t(this._db)}}),this._ready)}close(){this._db&&this._db.close(),this._db=null,this._ready=null}deleteDatabase(){return this.close(),this.indexedDB?new Promise((t,r)=>{const o=this.indexedDB.deleteDatabase(this.dbName);o.onsuccess=()=>t(),o.onerror=()=>r(g(o,"Queue database delete failed")),o.onblocked=()=>r(new Error("Queue database delete blocked"))}):Promise.resolve()}allForScope(t){return this.open().then(r=>r?new Promise((o,a)=>{const i=r.transaction(w,"readonly").objectStore(w).index("by_scope_seq").getAll(x(this.keyRange,t));i.onsuccess=()=>o(i.result||[]),i.onerror=()=>a(g(i,"Queue scope read failed"))}):[])}enqueue(t,r){return r=r||{},this.open().then(o=>o?new Promise((a,l)=>{const i=o.transaction([y,w],"readwrite"),u=i.objectStore(y),s=i.objectStore(w),n=ee(t);let c=null;const d=m=>{const b=m+1;c={entryId:this.uuid(),scope:t,chainKey:r.chainKey,seq:b,op:r.op,targetId:r.targetId!==void 0?r.targetId:null,payload:r.payload,expectedVersion:r.expectedVersion!==void 0?r.expectedVersion:null,meta:r.meta||{},attempts:0,nextAttemptAt:0,status:"pending",leaseOwner:null,leaseUntil:0,createdAt:this.now(),updatedAt:this.now()},u.put({key:n,value:b}),s.put(c)},f=u.get(n);f.onerror=()=>l(g(f,"Queue sequence read failed")),f.onsuccess=()=>{const m=f.result;if(m&&typeof m.value=="number"){d(m.value);return}const b=s.index("by_scope_seq").getAll(x(this.keyRange,t));b.onerror=()=>l(g(b,"Queue sequence migration failed")),b.onsuccess=()=>{const p=(b.result||[]).reduce((C,ne)=>Math.max(C,ne.seq||0),0);d(p)}},i.oncomplete=()=>a(c),i.onerror=()=>l(i.error||new Error("Queue enqueue transaction failed")),i.onabort=()=>l(i.error||new Error("Queue enqueue transaction aborted"))}):null)}claimReady(t,r,o){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),s=u.objectStore(w),n=s.index("by_scope_seq").getAll(x(this.keyRange,t)),c=this.now();let d={entries:[],wakeups:[]};n.onerror=()=>i(g(n,"Queue claim read failed")),n.onsuccess=()=>{d=Ne(n.result||[],r,o,c);for(const f of d.entries)s.put(f)},u.oncomplete=()=>l(d),u.onerror=()=>i(u.error||new Error("Queue claim transaction failed")),u.onabort=()=>i(u.error||new Error("Queue claim transaction aborted"))}):{entries:[],wakeups:[]})}ack(t,r){return this._updateEntry(t,r,(o,a)=>(a.delete(o.entryId),{status:"acked",entry:o}))}nack(t,r,o,a){a=a||{};const l=a.maxAttempts||8,i=a.backoff||[2e3,5e3,15e3,6e4,3e5];return this.open().then(u=>u?new Promise((s,n)=>{const c=u.transaction([w,y],"readwrite"),d=c.objectStore(w),f=c.objectStore(y),m=d.get(r);let b=null;m.onerror=()=>n(g(m,"Queue nack read failed")),m.onsuccess=()=>{const p=m.result;if(!(!p||p.scope!==t)){if(o==="drop"){d.delete(p.entryId),b={status:"dropped",entry:p};return}if(te(p),p.updatedAt=this.now(),o==="auth"){p.status="pending",d.put(p),f.put({key:A(t),value:"auth"}),b={status:"auth",entry:p};return}if(o==="retry"){if(p.attempts=(p.attempts||0)+1,p.attempts>=l){p.status="failed",p.nextAttemptAt=0,d.put(p),b={status:"failed",entry:p};return}const C=i[Math.min(p.attempts-1,i.length-1)];p.status="pending",p.nextAttemptAt=this.now()+C,d.put(p),b={status:"retry",entry:p,delay:C}}}},c.oncomplete=()=>s(b),c.onerror=()=>n(c.error||new Error("Queue nack transaction failed")),c.onabort=()=>n(c.error||new Error("Queue nack transaction aborted"))}):null)}remap(t,r,o){return this._remapTransaction(t,null,r,o)}resolveCreate(t,r,o,a){return this._remapTransaction(t,r,o,a)}_remapTransaction(t,r,o,a){return this.open().then(l=>l?new Promise((i,u)=>{const s=l.transaction(w,"readwrite"),n=s.objectStore(w),c=n.index("by_scope_seq").getAll(x(this.keyRange,t));let d={changed:[],deleted:[]};c.onerror=()=>u(g(c,"Queue remap read failed")),c.onsuccess=()=>{d=Fe(c.result||[],r,o,a,this.now());for(const f of d.deleted)n.delete(f);for(const f of d.changed)n.put(f)},s.oncomplete=()=>i(d.changed),s.onerror=()=>u(s.error||new Error("Queue remap transaction failed")),s.onabort=()=>u(s.error||new Error("Queue remap transaction aborted"))}):[])}resetFailed(t){return this.open().then(r=>r?new Promise((o,a)=>{const l=r.transaction(w,"readwrite"),i=l.objectStore(w),u=i.index("by_scope_seq").getAll(x(this.keyRange,t));let s=0;u.onerror=()=>a(g(u,"Queue failed-entry read failed")),u.onsuccess=()=>{for(const n of u.result||[])n.status==="failed"&&(n.status="pending",n.attempts=0,n.nextAttemptAt=0,n.updatedAt=this.now(),te(n),i.put(n),s++)},l.oncomplete=()=>o(s),l.onerror=()=>a(l.error||new Error("Queue failed-entry reset failed")),l.onabort=()=>a(l.error||new Error("Queue failed-entry reset aborted"))}):0)}getPaused(t){return this.open().then(r=>r?new Promise((o,a)=>{const i=r.transaction(y,"readonly").objectStore(y).get(A(t));i.onsuccess=()=>{const u=i.result?i.result.value:!1;o(u||!1)},i.onerror=()=>a(g(i,"Queue pause-state read failed"))}):!1)}setPaused(t,r){return this.open().then(o=>{if(o)return new Promise((a,l)=>{const i=o.transaction(y,"readwrite"),u=typeof r=="string"?r:r?"manual":!1;i.objectStore(y).put({key:A(t),value:u}),i.oncomplete=()=>a(),i.onerror=()=>l(i.error||new Error("Queue pause-state write failed")),i.onabort=()=>l(i.error||new Error("Queue pause-state write aborted"))})})}clear(t){return this.open().then(r=>{if(r)return new Promise((o,a)=>{const l=r.transaction([w,y],"readwrite"),u=l.objectStore(w).index("by_scope_seq").openCursor(x(this.keyRange,t));u.onsuccess=s=>{const n=s.target.result;n&&(n.delete(),n.continue())},u.onerror=()=>a(g(u,"Queue clear failed")),l.objectStore(y).delete(ee(t)),l.objectStore(y).delete(A(t)),l.oncomplete=()=>o(),l.onerror=()=>a(l.error||new Error("Queue clear transaction failed")),l.onabort=()=>a(l.error||new Error("Queue clear transaction aborted"))})})}_updateEntry(t,r,o){return this.open().then(a=>a?new Promise((l,i)=>{const u=a.transaction(w,"readwrite"),s=u.objectStore(w),n=s.get(r);let c=null;n.onerror=()=>i(g(n,"Queue entry read failed")),n.onsuccess=()=>{const d=n.result;!d||d.scope!==t||(c=o(d,s))},u.oncomplete=()=>l(c),u.onerror=()=>i(u.error||new Error("Queue entry transaction failed")),u.onabort=()=>i(u.error||new Error("Queue entry transaction aborted"))}):null)}}(function(){const e="data-ln-api-queue",t="lnApiQueue",r=[2e3,5e3,15e3,6e4,3e5],o=8,a=6e4;if(window[t]!==void 0)return;function l(n){const c=n[t];c&&c._drain()}const i={"data-ln-api-queue":{type:"marker",description:"Mounts offline API synchronization queue backed by IndexedDB"},"data-ln-api-queue-online":{effect:l,type:"enum",values:["true","false"],fallback:"auto",description:"Network connectivity override (true/false, or auto-detect from navigator.onLine)"}},u=new Me({indexedDB:window.indexedDB,IDBKeyRange:window.IDBKeyRange,uuid:O});function s(n){this.dom=n,n[t]=this;const c=n.closest("[data-ln-data-coordinator]");this.scope=n.id||(c?c.id:null)||"default",this._paused=!1,this._timers=new Map,this._workerId=O(),this._drainPromise=null,this._onlineHandler=()=>this._drain(),this._bindEvents(),window.addEventListener("online",this._onlineHandler);const d=this;return u.open().then(f=>f?u.getPaused(d.scope):(console.warn("[ln-api-queue] IndexedDB not available — queue disabled"),!1)).then(f=>{if(d._paused=!!f,d._paused){const m=typeof f=="string"?f:"auth";h(d.dom,"ln-api-queue:paused",{reason:m,restored:!0})}return d._emitPendingCount()}).then(()=>d._drain()).catch(f=>{console.error("[ln-api-queue] Initialization failed:",f),h(d.dom,"ln-api-queue:error",{operation:"initialize",error:f})}),this}s.prototype._isOnline=function(){const n=this.dom.getAttribute("data-ln-api-queue-online");return n==="true"?!0:n==="false"?!1:navigator.onLine},s.prototype._emitPendingCount=function(){const n=this;return u.allForScope(n.scope).then(c=>(h(n.dom,"ln-api-queue:pending-count",{count:c.length,scope:n.scope}),c.length===0&&h(n.dom,"ln-api-queue:drained",{scope:n.scope}),c))},s.prototype._clearTimer=function(n){const c=this._timers.get(n);c&&(clearTimeout(c),this._timers.delete(n))},s.prototype._scheduleTimer=function(n,c){const d=Math.max(0,c),f=this._timers.get(n);f&&clearTimeout(f);const m=this,b=setTimeout(()=>{m._timers.delete(n),m._drain()},d);this._timers.set(n,b)},s.prototype._drain=function(){const n=this;return n._paused||!n._isOnline()?Promise.resolve():(n._drainPromise||(n._drainPromise=u.claimReady(n.scope,n._workerId,a).then(c=>{for(const d of c.wakeups)n._scheduleTimer(d.chainKey,d.at-Date.now());for(const d of c.entries)n._clearTimer(d.chainKey),h(n.dom,"ln-api-queue:send",{entryId:d.entryId,chainKey:d.chainKey,op:d.op,targetId:d.targetId,payload:d.payload,expectedVersion:d.expectedVersion,idempotencyKey:d.entryId,meta:d.meta})}).catch(c=>{console.error("[ln-api-queue] Drain failed:",c),h(n.dom,"ln-api-queue:error",{operation:"drain",error:c})}).finally(()=>{n._drainPromise=null})),n._drainPromise)},s.prototype._onEnqueue=function(n){const c=this;return u.enqueue(c.scope,n.detail||{}).then(d=>{if(d)return c._emitPendingCount().then(f=>(h(c.dom,"ln-api-queue:enqueued",{entryId:d.entryId,chainKey:d.chainKey,count:f.length}),c._drain()))}).catch(d=>{h(c.dom,"ln-api-queue:error",{operation:"enqueue",error:d})})},s.prototype._onAck=function(n){const c=this,d=n.detail||{};return u.ack(c.scope,d.entryId).then(()=>c._emitPendingCount()).then(()=>c._drain()).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"ack",entryId:d.entryId,error:f})})},s.prototype._onNack=function(n){const c=this,d=n.detail||{};return u.nack(c.scope,d.entryId,d.reason,{maxAttempts:o,backoff:r}).then(f=>{if(f)return f.status==="failed"?h(c.dom,"ln-api-queue:failed",{entryId:f.entry.entryId,chainKey:f.entry.chainKey,attempts:f.entry.attempts}):f.status==="retry"?c._scheduleTimer(f.entry.chainKey,f.delay):f.status==="auth"&&(c._paused=!0,h(c.dom,"ln-api-queue:paused",{reason:"auth"}),h(c.dom,"ln-api-queue:auth-required",{entryId:f.entry.entryId,chainKey:f.entry.chainKey})),c._emitPendingCount().then(()=>{if(f.status==="dropped")return c._drain()})}).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"nack",entryId:d.entryId,error:f})})},s.prototype._onRemap=function(n){const c=this,d=n.detail||{};return u.remap(c.scope,d.oldKey,d.newId).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"remap",error:f})})},s.prototype._onResolveCreate=function(n){const c=this,d=n.detail||{};return u.resolveCreate(c.scope,d.entryId,d.oldKey,d.newId).then(()=>c._emitPendingCount()).then(()=>c._drain()).catch(f=>{h(c.dom,"ln-api-queue:error",{operation:"resolve-create",entryId:d.entryId,error:f})})},s.prototype._onResume=function(){const n=this;return u.setPaused(n.scope,!1).then(()=>(n._paused=!1,h(n.dom,"ln-api-queue:resumed",{}),n._drain())).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"resume",error:c})})},s.prototype._onPause=function(){const n=this;return u.setPaused(n.scope,"manual").then(()=>{n._paused=!0,h(n.dom,"ln-api-queue:paused",{reason:"manual"})}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"pause",error:c})})},s.prototype._onDrain=function(){const n=this;return u.resetFailed(n.scope).then(()=>{const c=n._drainPromise;return c?c.then(()=>n._drain()):n._drain()}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"manual-drain",error:c})})},s.prototype._onClear=function(){const n=this;return n._timers.forEach(c=>clearTimeout(c)),n._timers.clear(),u.clear(n.scope).then(()=>{n._paused=!1,h(n.dom,"ln-api-queue:pending-count",{count:0,scope:n.scope}),h(n.dom,"ln-api-queue:drained",{scope:n.scope})}).catch(c=>{h(n.dom,"ln-api-queue:error",{operation:"clear",error:c})})},s.prototype._bindEvents=function(){const n=this;n._handlers={enqueue:c=>n._onEnqueue(c),ack:c=>n._onAck(c),nack:c=>n._onNack(c),remap:c=>n._onRemap(c),resolveCreate:c=>n._onResolveCreate(c),resume:()=>n._onResume(),pause:()=>n._onPause(),drain:()=>n._onDrain(),clear:()=>n._onClear()},n.dom.addEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.addEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.addEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.addEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.addEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.addEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.addEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.addEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.addEventListener("ln-api-queue:request-clear",n._handlers.clear)},s.prototype.destroy=function(){if(!this.dom[t])return;const n=this;n.dom.removeEventListener("ln-api-queue:request-enqueue",n._handlers.enqueue),n.dom.removeEventListener("ln-api-queue:ack",n._handlers.ack),n.dom.removeEventListener("ln-api-queue:nack",n._handlers.nack),n.dom.removeEventListener("ln-api-queue:request-remap",n._handlers.remap),n.dom.removeEventListener("ln-api-queue:resolve-create",n._handlers.resolveCreate),n.dom.removeEventListener("ln-api-queue:request-resume",n._handlers.resume),n.dom.removeEventListener("ln-api-queue:request-pause",n._handlers.pause),n.dom.removeEventListener("ln-api-queue:request-drain",n._handlers.drain),n.dom.removeEventListener("ln-api-queue:request-clear",n._handlers.clear),window.removeEventListener("online",n._onlineHandler),n._timers.forEach(c=>clearTimeout(c)),n._timers.clear(),delete n.dom[t]},Y(e,t,s,"ln-api-queue",{attributes:i})})()})();
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
-
"component": "ln-api-queue",
|
|
4
|
-
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
-
"attributes": {
|
|
6
|
-
"data-ln-api-queue": {
|
|
7
|
-
"direction": null,
|
|
8
|
-
"sources": [
|
|
9
|
-
"src/ln-api-queue.js"
|
|
10
|
-
],
|
|
11
|
-
"type": "marker",
|
|
12
|
-
"description": "Mounts offline API synchronization queue backed by IndexedDB"
|
|
13
|
-
},
|
|
14
|
-
"data-ln-api-queue-online": {
|
|
15
|
-
"direction": "author",
|
|
16
|
-
"sources": [
|
|
17
|
-
"src/ln-api-queue.js"
|
|
18
|
-
],
|
|
19
|
-
"type": "enum",
|
|
20
|
-
"values": [
|
|
21
|
-
"true",
|
|
22
|
-
"false"
|
|
23
|
-
],
|
|
24
|
-
"fallback": "auto",
|
|
25
|
-
"description": "Network connectivity override (true/false, or auto-detect from navigator.onLine)"
|
|
26
|
-
},
|
|
27
|
-
"data-ln-data-coordinator": {
|
|
28
|
-
"direction": "author",
|
|
29
|
-
"sources": [
|
|
30
|
-
"src/ln-api-queue.js"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
+
"component": "ln-api-queue",
|
|
4
|
+
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"data-ln-api-queue": {
|
|
7
|
+
"direction": null,
|
|
8
|
+
"sources": [
|
|
9
|
+
"src/ln-api-queue.js"
|
|
10
|
+
],
|
|
11
|
+
"type": "marker",
|
|
12
|
+
"description": "Mounts offline API synchronization queue backed by IndexedDB"
|
|
13
|
+
},
|
|
14
|
+
"data-ln-api-queue-online": {
|
|
15
|
+
"direction": "author",
|
|
16
|
+
"sources": [
|
|
17
|
+
"src/ln-api-queue.js"
|
|
18
|
+
],
|
|
19
|
+
"type": "enum",
|
|
20
|
+
"values": [
|
|
21
|
+
"true",
|
|
22
|
+
"false"
|
|
23
|
+
],
|
|
24
|
+
"fallback": "auto",
|
|
25
|
+
"description": "Network connectivity override (true/false, or auto-detect from navigator.onLine)"
|
|
26
|
+
},
|
|
27
|
+
"data-ln-data-coordinator": {
|
|
28
|
+
"direction": "author",
|
|
29
|
+
"sources": [
|
|
30
|
+
"src/ln-api-queue.js"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerComponent, dispatch } from '../../ln-core';
|
|
1
|
+
import { registerComponent, dispatch, uuid } from '../../ln-core';
|
|
2
2
|
import { QueueStorage } from './queue-storage';
|
|
3
3
|
|
|
4
4
|
(function () {
|
|
@@ -21,20 +21,10 @@ import { QueueStorage } from './queue-storage';
|
|
|
21
21
|
'data-ln-api-queue-online': { effect: _syncOnline, type: 'enum', values: ['true', 'false'], fallback: 'auto', description: 'Network connectivity override (true/false, or auto-detect from navigator.onLine)' }
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
function _uuid() {
|
|
25
|
-
try { return crypto.randomUUID(); }
|
|
26
|
-
catch (_) {
|
|
27
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
28
|
-
const r = Math.random() * 16 | 0;
|
|
29
|
-
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
24
|
const _storage = new QueueStorage({
|
|
35
25
|
indexedDB: window.indexedDB,
|
|
36
26
|
IDBKeyRange: window.IDBKeyRange,
|
|
37
|
-
uuid:
|
|
27
|
+
uuid: uuid
|
|
38
28
|
});
|
|
39
29
|
|
|
40
30
|
function _component(dom) {
|
|
@@ -46,7 +36,7 @@ import { QueueStorage } from './queue-storage';
|
|
|
46
36
|
|
|
47
37
|
this._paused = false;
|
|
48
38
|
this._timers = new Map();
|
|
49
|
-
this._workerId =
|
|
39
|
+
this._workerId = uuid();
|
|
50
40
|
this._drainPromise = null;
|
|
51
41
|
this._onlineHandler = () => this._drain();
|
|
52
42
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@use '../../theme/config/mixins' as *;
|
|
2
|
-
|
|
3
|
-
[data-ln-debug] {
|
|
4
|
-
// 1. Host Element Check: data-ln-autoresize belongs only on <textarea>
|
|
5
|
-
[data-ln-autoresize]:not(textarea) {
|
|
6
|
-
@include dev-inline-error("data-ln-autoresize belongs only on <textarea> elements");
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
@use '../../theme/config/mixins' as *;
|
|
2
|
+
|
|
3
|
+
[data-ln-debug] {
|
|
4
|
+
// 1. Host Element Check: data-ln-autoresize belongs only on <textarea>
|
|
5
|
+
[data-ln-autoresize]:not(textarea) {
|
|
6
|
+
@include dev-inline-error("data-ln-autoresize belongs only on <textarea> elements");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function O(){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 p(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let r=1;r<t.length;r++)if(t[r]&&t[r].nodeType===1){o=t[r];break}if(!p(o))return}e.apply(console,t)}}function M(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function b(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){b(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}const x={};function B(e,t){x[e]=t}function N(e){return x[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=B,window.lnCore.getDataMapper=N);function W(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,b(function(){new MutationObserver(function(){M(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const E={};function j(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];E[n]=t}function V(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return E[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=j,window.lnCore.getLocaleFallback=V,window.lnCore.ensureLocaleObserver=W);const C={};function H(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function L(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],s=c.getAttribute("data-ln-field");t[s]!=null&&(c.textContent=t[s])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const c=o[l],s=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const r=e.querySelectorAll("[data-ln-show]");for(let l=0;l<r.length;l++){const c=r[l],s=c.getAttribute("data-ln-show");s in t&&c.classList.toggle("hidden",!t[s])}const i=e.querySelectorAll("[data-ln-class]");for(let l=0;l<i.length;l++){const c=i[l],s=c.getAttribute("data-ln-class").split(",");for(let u=0;u<s.length;u++){const a=s[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function z(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)L(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const i=n.currentNode;i.textContent.indexOf("{{")!==-1&&(i.textContent=i.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const o=function(i,l){return t[l]!==void 0?t[l]:""},r=Array.from(e.querySelectorAll("*"));e.nodeType===1&&r.push(e);for(let i=0;i<r.length;i++){const l=r[i],c=l.attributes;for(let s=0;s<c.length;s++){const u=c[s];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function U(e,t,n,o,r,i){const l={};for(let s=0;s<e.children.length;s++){const u=e.children[s],a=u.getAttribute("data-ln-render-key");a&&(l[a]=u)}const c=document.createDocumentFragment();for(let s=0;s<t.length;s++){const u=t[s],a=String(o(u));let d=l[a];if(d)r(d,u,s);else{const f=H(n,i);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),r(d,u,s)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=L,window.lnCore.lnFill=z,window.lnCore.renderList=U);function T(e,t,n,o,r){if(!e||t===null)return!0;const i=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=s=>{r?console.warn(s,r):console.warn(s)};if(l==="boolean"){const s=t.trim().toLowerCase();return s!==""&&s!=="true"&&s!=="false"&&s!=="1"&&s!=="0"?(c(`[${i}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const s=e.values||[];return s.includes(t)?!0:(c(`[${i}] Invalid value "${t}" for attribute "${n}". Allowed: ${s.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${i}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const s=parseInt(t,10);return e.min!==void 0&&s<e.min?(c(`[${i}] Value ${s} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&s>e.max?(c(`[${i}] Value ${s} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${i}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(s){return c(`[${i}] Invalid JSON for attribute "${n}": ${s.message}. Fallback: ${e.fallback}.`),!1}return!0}function Q(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function K(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}function y(e,t,n,o){if(e.nodeType!==1)return;const i=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(i));e.matches&&e.matches(i)&&l.push(e);for(const c of l)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(s){console.error("["+n+"] init failed",c,s)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function G(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function J(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 D(){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 X(e){const t=D(),n=e.observed||[];for(let o=0;o<n.length;o++){const r=n[o];t.byAttr.has(r)||t.byAttr.set(r,[]),t.byAttr.get(r).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const r=t.byDeclaredAttr.get(o);r.some(i=>i.componentTag===e.componentTag)||r.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=K(e);if(o===null)t.reactiveWildcard.push(e);else for(const r of o)t.byReactive.has(r)||t.byReactive.set(r,[]),t.byReactive.get(r).push(e)}e.persist&&t.persist.push(e)}function I(e,t,n,o){for(let r=0;r<e.length;r++){const i=e[r];if(!t[i.attribute])continue;const l=i.effects&&i.effects[n];l?l(t,n,o):i.onAttrChange&&(!i.declared||i.declared.has(n))&&i.onAttrChange(t,n,o)}}function P(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=D(),r=o.byAttr.get(n);if(O()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&p(t)){const i=o.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let c=0;c<i.length;c++)T(i[c].spec,l,n,i[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||r)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const i=o.byReactive.get(n);i&&I(i,t,n,e.oldValue),o.reactiveWildcard.length&&I(o.reactiveWildcard,t,n,e.oldValue)}if(r)for(let i=0;i<r.length;i++){const l=r[i];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(y(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function Y(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{P(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function R(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function Z(e){const t=R();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const r=o.query,i=e.target.nodeType===1?e.target.matches(r)?e.target:e.target.closest(r):e.target.parentElement?e.target.parentElement.closest(r):null;i&&o.onSubtreeChange(i,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let r=0;r<t.length;r++){const i=t[r];y(o,i.selector,i.attribute,i.ComponentFn),i.onInit&&i.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let r=0;r<t.length;r++){const i=t[r],l=i.query,c=Array.from(o.querySelectorAll(l));o.matches&&o.matches(l)&&c.push(o);for(let s=0;s<c.length;s++){const u=c[s];if(!document.contains(u)){const a=u[i.attribute];if(a&&typeof a.destroy=="function")try{a.destroy()}catch(d){console.error("["+i.attribute+"] destroy failed",u,d)}delete u[i.attribute]}}}}}}function ee(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,b(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{Z(o)}catch(r){console.error("[ln-core] lifecycle handler failed",o.target,r)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function te(e,t,n,o,r={}){const i=r.extraAttributes||[],l=r.onAttributeChange||null,c=r.onSubtreeChange||null,s=r.onInit||null,u=r.onAttrChange||null,a=r.effects||null,d=r.attributes||null,f=d?Q(d):a,de=d?new Set(Object.keys(d)):null,ae=r.persist||null;function g(_){const w=_||document.body;if(y(w,e,t,n),d&&O())for(const h in d){const we=d[h],v=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&v.push(w);for(let S=0;S<v.length;S++){const k=v[S];p(k)&&T(we,k.getAttribute(h),h,o,k)}}s&&s(w)}const A=[];if(e.indexOf("[")!==-1){const _=/\[([\w-]+)/g;let w;for(;(w=_.exec(e))!==null;)A.push(w[1])}else A.push(e);X({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:s,observed:A.concat(i),onAttributeChange:l,onAttrChange:u,effects:f,declared:de,persist:ae}),Y();const fe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";R().push({selector:e,attribute:t,ComponentFn:n,onInit:s,onSubtreeChange:c,query:fe}),ee(),window[t]=g;function F(){G()>0?J(function(){g(document.body)}):g(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",F):F(),g}function q(e){return(e||"").replace(/^#/,"")}function m(e){const t=e===void 0?location.hash:e,n={},o=q(t);if(!o)return n;const r=o.split("&");for(let i=0;i<r.length;i++){const l=r[i];if(!l)continue;const c=l.indexOf(":"),s=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(s)try{n[s]=decodeURIComponent(u)}catch{n[s]=u}}return n}function ne(e){if(!e)return null;const t=m();return e in t?t[e]:null}function oe(e,t){if(!e)return;const n=m();t==null?delete n[e]:n[e]=String(t);const r=Object.keys(n).map(function(i){const l=n[i];return l===""?i:i+":"+encodeURIComponent(l)}).join("&");q(location.hash)!==r&&(location.hash=r)}function re(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function ie(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function le(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function se(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function ce(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ue(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),r=o?o.split(",").map(function(i){try{return decodeURIComponent(i)}catch{return i}}).filter(Boolean):[];return{key:n,values:r}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=m,window.lnCore.hashGet=ne,window.lnCore.hashSet=oe,window.lnCore.hashLinkClick=re,window.lnCore.resolveHashNamespace=ie,window.lnCore.hashSortEncode=le,window.lnCore.hashSortDecode=se,window.lnCore.hashFilterEncode=ce,window.lnCore.hashFilterDecode=ue),(function(){const e="data-ln-autoresize",t="lnAutoresize";if(window[t]!==void 0)return;const n={"data-ln-autoresize":{type:"marker",description:"Automatically adjusts textarea height to match its scrollable content"}};function o(r){if(r.tagName!=="TEXTAREA")return console.warn("[ln-autoresize] Can only be applied to <textarea>, got:",r.tagName),this;this.dom=r;const i=this;return this._onInput=function(){i._resize()},r.addEventListener("input",this._onInput),this._resize(),this}o.prototype._resize=function(){this.dom.style.height="auto",this.dom.style.height=this.dom.scrollHeight+"px"},o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("input",this._onInput),this.dom.style.height="",delete this.dom[t])},te(e,t,o,"ln-autoresize",{attributes:n})})()})();
|
|
1
|
+
(function(){"use strict";function E(){return typeof window>"u"?!1:window.lnDebug===!0||window.lnCore&&window.lnCore._debugSink?!0:typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug")||document.body.querySelector("[data-ln-debug]")!==null:!1}function g(e){if(typeof window>"u")return!1;if(window.lnDebug===!0)return!0;if(window.lnCore&&window.lnCore._debugIsContained)return e?window.lnCore._debugIsContained(e):window.lnCore._debugSink!==null;if(e&&e.closest){const t=e.closest("[data-ln-debug]");return!(!t||typeof document<"u"&&t===document.documentElement)}return typeof document<"u"&&document.body?document.body.hasAttribute("data-ln-debug"):!1}if(typeof window<"u"&&(window.lnCore=window.lnCore||{},!window.lnCore._warnBound)){window.lnCore._warnBound=!0;const e=console.warn;console.warn=function(...t){if(typeof t[0]=="string"&&(t[0].startsWith("[ln-")||t[0].startsWith("[lnCore"))){let o=null;for(let i=1;i<t.length;i++)if(t[i]&&t[i].nodeType===1){o=t[i];break}if(!g(o))return}e.apply(console,t)}}function J(e,t,n){const o=n||{};window.lnCore._debugSink&&window.lnCore._debugSink("event",t,e,o),e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:o}))}function p(e,t){if(!document.body){document.addEventListener("DOMContentLoaded",function(){p(e,t)}),console.warn("["+t+'] Script loaded before <body> — add "defer" to your <script> tag');return}e()}function K(e){const t=e.querySelector('input[name="_method"]');return((t&&t.value!==""?t.value:e.method)||"").toUpperCase()}function Q(e,t){const n=!!(t&&t.typed),o=t&&t.exclude,i={},s=e.elements,l={};if(n)for(let c=0;c<s.length;c++){const r=s[c];r.name&&r.type==="checkbox"&&!r.disabled&&(l[r.name]=(l[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")&&!(o&&r.matches&&r.matches(o)))if(r.type==="checkbox")n&&l[r.name]===1?i[r.name]=r.checked:(i[r.name]||(i[r.name]=[]),r.checked&&i[r.name].push(r.value));else if(r.type==="radio")r.checked&&(i[r.name]=r.value);else if(r.type==="select-multiple"){i[r.name]=[];for(let u=0;u<r.options.length;u++)r.options[u].selected&&i[r.name].push(r.options[u].value)}else if(n&&r.type==="hidden")i[r.name]=r.value;else if(n&&(r.type==="number"||r.type==="range")){const u=Number(r.value);i[r.name]=r.value===""||isNaN(u)?null:u}else i[r.name]=r.value}return i}function G(e){if(typeof e!="string")return!!e;const t=e.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!==""&&t!=="off"&&t!=="no"}function P(e,t){const n=e.elements,o=[],i={};for(let s=0;s<n.length;s++){const l=n[s];l.name&&l.type==="checkbox"&&(i[l.name]=(i[l.name]||0)+1)}for(let s=0;s<n.length;s++){const l=n[s];if(l.type==="file"||l.type==="submit"||l.type==="button")continue;const c=l.getAttribute("data-ln-fill-as")||l.name;if(!c||!(c in t))continue;const r=t[c];if(l.type==="checkbox"){if(Array.isArray(r))l.checked=r.indexOf(l.value)!==-1;else if(i[l.name]>1){const u=String(r).split(",").map(function(a){return a.trim()});l.checked=u.indexOf(l.value)!==-1}else l.checked=G(r);o.push(l)}else if(l.type==="radio")l.checked=l.value===String(r),o.push(l);else if(l.type==="select-multiple"){if(Array.isArray(r))for(let u=0;u<l.options.length;u++)l.options[u].selected=r.indexOf(l.options[u].value)!==-1;o.push(l)}else l.value=r,l.tagName==="SELECT"&&r!=null&&l.setAttribute("data-ln-value",r),o.push(l)}return o}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.populateForm=P,window.lnCore.serializeForm=Q,window.lnCore.resolveFormMethod=K);const L={};function X(e,t){L[e]=t}function Y(e){return L[e]||{ingress:t=>t,egress:t=>t}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerDataMapper=X,window.lnCore.getDataMapper=Y);function Z(){typeof window>"u"||(window.lnCore=window.lnCore||{},!window.lnCore._localeObserverBound&&(window.lnCore._localeObserverBound=!0,p(function(){new MutationObserver(function(){J(document,"ln-core:locale-change",{})}).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0})},"ln-core")))}const I={};function ee(e,t){if(!e||typeof t!="object")return;const n=e.toLowerCase().split("-")[0];I[n]=t}function te(e){if(!e)return null;const t=e.toLowerCase().split("-")[0];return I[t]||null}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerLocaleFallback=ee,window.lnCore.getLocaleFallback=te,window.lnCore.ensureLocaleObserver=Z);const C={};function ne(e,t){C[e]||(C[e]=document.querySelector('[data-ln-template="'+e+'"]'));const n=C[e];return n?n.content.cloneNode(!0):(console.warn("["+(t||"ln-core")+'] Template "'+e+'" not found'),null)}function T(e,t){if(!e||!t)return e;const n=e.querySelectorAll("[data-ln-field]");for(let l=0;l<n.length;l++){const c=n[l],r=c.getAttribute("data-ln-field");t[r]!=null&&(c.textContent=t[r])}const o=e.querySelectorAll("[data-ln-attr]");for(let l=0;l<o.length;l++){const c=o[l],r=c.getAttribute("data-ln-attr").split(",");for(let u=0;u<r.length;u++){const a=r[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();t[f]!=null&&c.setAttribute(d,t[f])}}const i=e.querySelectorAll("[data-ln-show]");for(let l=0;l<i.length;l++){const c=i[l],r=c.getAttribute("data-ln-show");r in t&&c.classList.toggle("hidden",!t[r])}const s=e.querySelectorAll("[data-ln-class]");for(let l=0;l<s.length;l++){const c=s[l],r=c.getAttribute("data-ln-class").split(",");for(let u=0;u<r.length;u++){const a=r[u].trim().split(":");if(a.length!==2)continue;const d=a[0].trim(),f=a[1].trim();f in t&&c.classList.toggle(d,!!t[f])}}return e}function oe(e,t){e.matches&&e.matches("[data-ln-form], [data-ln-fillable]")&&(window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",e,t??null),e.dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0})));const n=e.querySelectorAll("[data-ln-form], [data-ln-fillable]");for(let o=0;o<n.length;o++)window.lnCore._debugSink&&window.lnCore._debugSink("event","ln-fill",n[o],t??null),n[o].dispatchEvent(new CustomEvent("ln-fill",{detail:t??null,bubbles:!0}));return e}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._fillBound||(window.lnCore._fillBound=!0,document.addEventListener("ln-fill",function(e){if(!(!e.target.matches||!e.target.matches("[data-ln-fillable]")))if(e.detail)T(e.target,e.detail);else{const t=e.target.querySelectorAll("[data-ln-field]");for(let n=0;n<t.length;n++)t[n].textContent=""}})));function $(e,t){if(!e||!t)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;n.nextNode();){const s=n.currentNode;s.textContent.indexOf("{{")!==-1&&(s.textContent=s.textContent.replace(/\{\{\s*(\w+)\s*\}\}/g,function(l,c){return t[c]!==void 0?t[c]:""}))}const o=function(s,l){return t[l]!==void 0?t[l]:""},i=Array.from(e.querySelectorAll("*"));e.nodeType===1&&i.push(e);for(let s=0;s<i.length;s++){const l=i[s],c=l.attributes;for(let r=0;r<c.length;r++){const u=c[r];u.value.indexOf("{{")!==-1&&l.setAttribute(u.name,u.value.replace(/\{\{\s*(\w+)\s*\}\}/g,o))}}return e}function re(e,t,n,o,i,s){const l={};for(let r=0;r<e.children.length;r++){const u=e.children[r],a=u.getAttribute("data-ln-render-key");a&&(l[a]=u)}const c=document.createDocumentFragment();for(let r=0;r<t.length;r++){const u=t[r],a=String(o(u));let d=l[a];if(d)i(d,u,r);else{const f=ne(n,s);if(!f||($(f,u),d=f.firstElementChild,!d))continue;d.setAttribute("data-ln-render-key",a),i(d,u,r)}c.appendChild(d)}e.textContent="",e.appendChild(c)}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.fillTemplate=$,window.lnCore.fill=T,window.lnCore.lnFill=oe,window.lnCore.renderList=re);function m(e,t,n){const o=e.getAttribute(t);return o===null?n:o}function D(e,t,n){const o=parseInt(e.getAttribute(t),10);return isNaN(o)?n:o}function F(e,t,n=!1){const o=e.getAttribute(t);if(o===null)return!!n;const i=o.trim().toLowerCase();return!(i==="false"||i==="0")}function N(e,t){return(e.getAttribute(t)||"").split(",").map(n=>n.trim()).filter(Boolean)}const y=new Map;function M(e,t){const n=(e?e.join("|"):"")+"::"+t;if(y.has(n))return y.get(n);const o=new Set(e||[]),i=function(s,l){const c=s.getAttribute(l);return c!==null&&o.has(c)?c:t};return y.set(n,i),i}function R(e,t,n){const o=parseFloat(e.getAttribute(t));return isNaN(o)?n:o}function q(e,t,n){const o=e.getAttribute(t);if(!o)return n;try{return JSON.parse(o)}catch{return n}}function B(e,t,n,o,i){if(!e||t===null)return!0;const s=o||"ln-component",l=e.type;if(l==="trigger"||l==="marker"||l==="string"||l==="list"||!l||t===""&&e.fallback!==void 0)return!0;const c=r=>{i?console.warn(r,i):console.warn(r)};if(l==="boolean"){const r=t.trim().toLowerCase();return r!==""&&r!=="true"&&r!=="false"&&r!=="1"&&r!=="0"?(c(`[${s}] Invalid value "${t}" for boolean attribute "${n}". Allowed: "true", "false", or presence-only.`),!1):!0}if(l==="enum"){const r=e.values||[];return r.includes(t)?!0:(c(`[${s}] Invalid value "${t}" for attribute "${n}". Allowed: ${r.join(", ")}. Fallback: "${e.fallback}".`),!1)}if(l==="integer"){if(!/^-?\d+$/.test(t))return c(`[${s}] Invalid integer "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1;const r=parseInt(t,10);return e.min!==void 0&&r<e.min?(c(`[${s}] Value ${r} for attribute "${n}" is less than min (${e.min}).`),!1):e.max!==void 0&&r>e.max?(c(`[${s}] Value ${r} for attribute "${n}" is greater than max (${e.max}).`),!1):!0}if(l==="float")return isNaN(Number(t))?(c(`[${s}] Invalid float "${t}" for attribute "${n}". Fallback: ${e.fallback}.`),!1):!0;if(l==="json")try{return JSON.parse(t),!0}catch(r){return c(`[${s}] Invalid JSON for attribute "${n}": ${r.message}. Fallback: ${e.fallback}.`),!1}return!0}function ie(e,t,n){for(const o in n){const[i,s,l]=n[o];Object.defineProperty(e,o,{get:function(){return i(t,s,l)},enumerable:!0,configurable:!0})}return e}function le(e){const t={};for(const n in e){const o=e[n];if(!o||!o.prop)continue;let i=o.read;if(!i&&o.type)switch(o.type){case"enum":i=M(o.values,o.fallback);break;case"integer":i=D;break;case"float":i=R;break;case"boolean":i=F;break;case"list":i=N;break;case"json":i=q;break;case"string":default:i=m;break}i||(i=m),t[o.prop]=[i,n,o.fallback]}return t}function se(e){const t={};for(const n in e){const o=e[n];o&&o.effect&&(t[n]=o.effect)}return Object.keys(t).length?t:null}function ce(e){if(e.onAttrChange&&!e.declared)return null;const t=new Set;if(e.effects)for(const n in e.effects)t.add(n);if(e.onAttrChange&&e.declared)for(const n of e.declared)t.add(n);return t}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.defineAttrs=ie,window.lnCore.attrSpec=le,window.lnCore.attrStr=m,window.lnCore.attrInt=D,window.lnCore.attrBool=F,window.lnCore.attrList=N,window.lnCore.attrEnum=M,window.lnCore.attrFloat=R,window.lnCore.attrJson=q);function A(e,t,n,o){if(e.nodeType!==1)return;const s=t.indexOf("[")!==-1||t.indexOf(".")!==-1||t.indexOf("#")!==-1?t:"["+t+"]",l=Array.from(e.querySelectorAll(s));e.matches&&e.matches(s)&&l.push(e);for(const c of l)if(!c[n]){window.lnCore._persistSink&&c.hasAttribute("data-ln-persist")&&window.lnCore._persistSink(c,t);try{c[n]=new o(c)}catch(r){console.error("["+n+"] init failed",c,r)}}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[]);function ue(){return typeof window<"u"&&window.lnCore&&window.lnCore._bootHolds||0}function ae(e){typeof window<"u"?(window.lnCore=window.lnCore||{},window.lnCore._bootHolds=window.lnCore._bootHolds||0,window.lnCore._bootQueue=window.lnCore._bootQueue||[],window.lnCore._bootHolds>0?window.lnCore._bootQueue.push(e):setTimeout(e,0)):e()}function j(){window.lnCore=window.lnCore||{};const e=window.lnCore._attrRegistry=window.lnCore._attrRegistry||{byAttr:new Map,reactive:[],persist:[]};return e.byReactive=e.byReactive||new Map,e.reactiveWildcard=e.reactiveWildcard||[],e}function de(e){const t=j(),n=e.observed||[];for(let o=0;o<n.length;o++){const i=n[o];t.byAttr.has(i)||t.byAttr.set(i,[]),t.byAttr.get(i).push(e)}if(t.byDeclaredAttr=t.byDeclaredAttr||new Map,e.attributes)for(const o in e.attributes){t.byDeclaredAttr.has(o)||t.byDeclaredAttr.set(o,[]);const i=t.byDeclaredAttr.get(o);i.some(s=>s.componentTag===e.componentTag)||i.push({spec:e.attributes[o],componentTag:e.componentTag})}if(e.onAttrChange||e.effects){t.reactive.push(e);const o=ce(e);if(o===null)t.reactiveWildcard.push(e);else for(const i of o)t.byReactive.has(i)||t.byReactive.set(i,[]),t.byReactive.get(i).push(e)}e.persist&&t.persist.push(e)}function W(e,t,n,o){for(let i=0;i<e.length;i++){const s=e[i];if(!t[s.attribute])continue;const l=s.effects&&s.effects[n];l?l(t,n,o):s.onAttrChange&&(!s.declared||s.declared.has(n))&&s.onAttrChange(t,n,o)}}function fe(e){const t=e.target,n=e.attributeName;if(e.oldValue===t.getAttribute(n))return;const o=j(),i=o.byAttr.get(n);if(E()&&o.byDeclaredAttr&&o.byDeclaredAttr.has(n)&&g(t)){const s=o.byDeclaredAttr.get(n),l=t.getAttribute(n);for(let c=0;c<s.length;c++)B(s[c].spec,l,n,s[c].componentTag,t)}if(window.lnCore._debugSink&&(n.indexOf("data-ln-")===0||i)&&window.lnCore._debugSink("attr",n,t,{oldValue:e.oldValue,newValue:t.getAttribute(n)}),n.indexOf("data-ln-")===0){const s=o.byReactive.get(n);s&&W(s,t,n,e.oldValue),o.reactiveWildcard.length&&W(o.reactiveWildcard,t,n,e.oldValue)}if(i)for(let s=0;s<i.length;s++){const l=i[s];if(l.handler){l.handler(t,n,e.oldValue);continue}l.onAttributeChange&&t[l.attribute]?l.onAttributeChange(t,n):(A(t,l.selector,l.attribute,l.ComponentFn),l.onInit&&l.onInit(t))}}function we(){window.lnCore=window.lnCore||{},!window.lnCore._attrObserverBound&&(window.lnCore._attrObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++)try{fe(t[n])}catch(o){console.error("[ln-core] mutation handler failed",t[n].target,o)}}).observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0})},"ln-core"))}function U(){return window.lnCore=window.lnCore||{},window.lnCore._lifecycleRegistry=window.lnCore._lifecycleRegistry||[]}function he(e){const t=U();if(t.length){if(e.target)for(let n=0;n<t.length;n++){const o=t[n];if(o.onSubtreeChange){const i=o.query,s=e.target.nodeType===1?e.target.matches(i)?e.target:e.target.closest(i):e.target.parentElement?e.target.parentElement.closest(i):null;s&&o.onSubtreeChange(s,e)}}for(let n=0;n<e.addedNodes.length;n++){const o=e.addedNodes[n];if(o.nodeType===1)for(let i=0;i<t.length;i++){const s=t[i];A(o,s.selector,s.attribute,s.ComponentFn),s.onInit&&s.onInit(o)}}for(let n=0;n<e.removedNodes.length;n++){const o=e.removedNodes[n];if(o.nodeType===1)for(let i=0;i<t.length;i++){const s=t[i],l=s.query,c=Array.from(o.querySelectorAll(l));o.matches&&o.matches(l)&&c.push(o);for(let r=0;r<c.length;r++){const u=c[r];if(!document.contains(u)){const a=u[s.attribute];if(a&&typeof a.destroy=="function")try{a.destroy()}catch(d){console.error("["+s.attribute+"] destroy failed",u,d)}delete u[s.attribute]}}}}}}function pe(){window.lnCore=window.lnCore||{},!window.lnCore._lifecycleObserverBound&&(window.lnCore._lifecycleObserverBound=!0,p(function(){new MutationObserver(function(t){for(let n=0;n<t.length;n++){const o=t[n];if(o.type==="childList")try{he(o)}catch(i){console.error("[ln-core] lifecycle handler failed",o.target,i)}}}).observe(document.body,{childList:!0,subtree:!0})},"ln-core"))}function V(e,t,n,o,i={}){const s=i.extraAttributes||[],l=i.onAttributeChange||null,c=i.onSubtreeChange||null,r=i.onInit||null,u=i.onAttrChange||null,a=i.effects||null,d=i.attributes||null,f=d?se(d):a,ke=d?new Set(Object.keys(d)):null,Se=i.persist||null;function b(_){const w=_||document.body;if(A(w,e,t,n),d&&E())for(const h in d){const Ee=d[h],k=Array.from(w.querySelectorAll("["+h+"]"));w.matches&&w.matches("["+h+"]")&&k.push(w);for(let S=0;S<k.length;S++){const O=k[S];g(O)&&B(Ee,O.getAttribute(h),h,o,O)}}r&&r(w)}const v=[];if(e.indexOf("[")!==-1){const _=/\[([\w-]+)/g;let w;for(;(w=_.exec(e))!==null;)v.push(w[1])}else v.push(e);de({selector:e,attribute:t,componentTag:o,attributes:d,ComponentFn:n,onInit:r,observed:v.concat(s),onAttributeChange:l,onAttrChange:u,effects:f,declared:ke,persist:Se}),we();const Oe=e.indexOf("[")!==-1||e.indexOf(".")!==-1||e.indexOf("#")!==-1?e:"["+e+"]";U().push({selector:e,attribute:t,ComponentFn:n,onInit:r,onSubtreeChange:c,query:Oe}),pe(),window[t]=b,typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.registerComponent=V);function H(){ue()>0?ae(function(){b(document.body)}):b(document.body)}return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",H):H(),b}function z(e){return(e||"").replace(/^#/,"")}function x(e){const t=e===void 0?location.hash:e,n={},o=z(t);if(!o)return n;const i=o.split("&");for(let s=0;s<i.length;s++){const l=i[s];if(!l)continue;const c=l.indexOf(":"),r=c>-1?l.slice(0,c):l,u=c>-1?l.slice(c+1):"";if(r)try{n[r]=decodeURIComponent(u)}catch{n[r]=u}}return n}function be(e){if(!e)return null;const t=x();return e in t?t[e]:null}function ge(e,t){if(!e)return;const n=x();t==null?delete n[e]:n[e]=String(t);const i=Object.keys(n).map(function(s){const l=n[s];return l===""?s:s+":"+encodeURIComponent(l)}).join("&");z(location.hash)!==i&&(location.hash=i)}function Ce(e){return e.button===1||e.ctrlKey||e.metaKey||e.shiftKey?!1:(e.preventDefault(),!0)}function me(e,t){if(!e||!e.hasAttribute("data-ln-hash"))return null;const n=e.getAttribute("data-ln-hash");if(n&&n.trim()!=="")return n.trim();const o=e.getAttribute("data-ln-sort")||e.getAttribute("data-ln-search-for")||e.getAttribute("data-ln-search")||e.getAttribute("data-ln-filter")||e.id;return o?t?o+"-"+t:o:t||null}function ye(e,t){return!t||t==="none"||e===null||e===void 0?null:String(e)+"."+t}function Ae(e){return!e||typeof e!="string"?null:e.endsWith(".asc")?{fieldOrColumn:e.slice(0,-4),direction:"asc"}:e.endsWith(".desc")?{fieldOrColumn:e.slice(0,-5),direction:"desc"}:null}function xe(e,t){return!e||!Array.isArray(t)||t.length===0?null:e+":"+t.map(encodeURIComponent).join(",")}function ve(e){if(!e||typeof e!="string")return null;const t=e.indexOf(":");if(t===-1)return null;const n=e.slice(0,t),o=e.slice(t+1),i=o?o.split(",").map(function(s){try{return decodeURIComponent(s)}catch{return s}}).filter(Boolean):[];return{key:n,values:i}}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.hashParse=x,window.lnCore.hashGet=be,window.lnCore.hashSet=ge,window.lnCore.hashLinkClick=Ce,window.lnCore.resolveHashNamespace=me,window.lnCore.hashSortEncode=ye,window.lnCore.hashSortDecode=Ae,window.lnCore.hashFilterEncode=xe,window.lnCore.hashFilterDecode=ve);function _e(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}typeof window<"u"&&(window.lnCore=window.lnCore||{},window.lnCore.uuid=_e),(function(){const e="data-ln-autoresize",t="lnAutoresize";if(window[t]!==void 0)return;const n={"data-ln-autoresize":{type:"marker",description:"Automatically adjusts textarea height to match its scrollable content"}};function o(i){if(i.tagName!=="TEXTAREA")return console.warn("[ln-autoresize] Can only be applied to <textarea>, got:",i.tagName),this;this.dom=i;const s=this;return this._onInput=function(){s._resize()},i.addEventListener("input",this._onInput),this._resize(),this}o.prototype._resize=function(){this.dom.style.height="auto",this.dom.style.height=this.dom.scrollHeight+"px"},o.prototype.destroy=function(){this.dom[t]&&(this.dom.removeEventListener("input",this._onInput),this.dom.style.height="",delete this.dom[t])},V(e,t,o,"ln-autoresize",{attributes:n})})()})();
|