domma-cms 1.26.3 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/admin/index.html +1 -1
- package/admin/js/templates/docs/tutorial-forms.html +3 -0
- package/admin/js/templates/form-editor.html +22 -0
- package/admin/js/views/form-editor.js +7 -7
- package/docs/DommaFeatures.md +1 -0
- package/package.json +1 -1
- package/public/js/form-logic-engine.js +1 -1
- package/public/js/form-submit.mjs +1 -1
- package/public/js/forms.js +2 -2
- package/public/js/site.js +1 -1
- package/server/templates/page.html +3 -3
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,d){typeof module<"u"&&module.exports?module.exports=d():c.FormLogicEngine=d()})(typeof globalThis<"u"?globalThis:this,function(){"use strict";function c(e){return e===""||e===null||e===void 0?"":String(e)}function d(e){const r=parseFloat(e);return isNaN(r)?null:r}function p(e){return e==null?!0:typeof e=="string"?e.trim()==="":Array.isArray(e)?e.length===0:!1}const Y={not_equals:"equals",not_contains:"contains",not_in:"in"};function q(e,r){const t=c(r),n=c(e.value);switch(e.operator){case"equals":return t===n;case"not_equals":return t!==n;case"contains":return t.toLowerCase().includes(n.toLowerCase());case"not_contains":return!t.toLowerCase().includes(n.toLowerCase());case"starts_with":return t.toLowerCase().startsWith(n.toLowerCase());case"ends_with":return t.toLowerCase().endsWith(n.toLowerCase());case"greater_than":{const i=d(r),s=d(e.value);return i!==null&&s!==null&&i>s}case"less_than":{const i=d(r),s=d(e.value);return i!==null&&s!==null&&i<s}case"is_empty":return p(r);case"is_not_empty":return!p(r);case"in":return(Array.isArray(e.value)?e.value.map(c):String(e.value).split(",").map(s=>s.trim())).includes(t);case"not_in":return!(Array.isArray(e.value)?e.value.map(c):String(e.value).split(",").map(s=>s.trim())).includes(t);case"matches_regex":try{const i=e.flags||"";return new RegExp(e.value,i).test(t)}catch(i){return typeof console<"u"&&console.warn&&console.warn('[FormLogicEngine] Invalid regex in condition for field "'+e.field+'": '+e.value,i&&i.message),!1}default:return!0}}function _(e,r){if(!e||!e.field||!e.operator)return!0;const t=r[e.field];if(!Array.isArray(t))return q(e,t);if(e.operator==="is_empty")return p(t);if(e.operator==="is_not_empty")return!p(t);const n=Y[e.operator];if(n){const i=Object.assign({},e,{operator:n});return!t.some(s=>q(i,s))}return t.some(i=>q(e,i))}function h(e,r){return e?Array.isArray(e.all)?e.all.every(t=>t.all||t.any?h(t,r):_(t,r)):Array.isArray(e.any)?e.any.some(t=>t.all||t.any?h(t,r):_(t,r)):e.field&&e.operator?_(e,r):!0:!0}function v(e,r){const t=e.logic;if(!t||!t.visibility)return"visible";const n=t.visibility,i=n.conditions||[];for(const s of i)if(s.when&&h(s.when,r))return s.then==="hidden"?"hidden":"visible";return n.default==="hidden"?"hidden":"visible"}function w(e,r){const t=e.logic;if(!t||!t.requirement)return e.required||!1;const n=t.requirement,i=n.conditions||[];for(const s of i)if(s.when&&h(s.when,r))return s.then===!0;return n.default===!0}function A(e){if(e==null||e==="")return null;const r=Number(e);return Number.isFinite(r)?r:null}function Z(e,r){if(p(r)||Array.isArray(r)||typeof r=="object")return[];const t=e.label||e.name;if(e.type==="number"){const a=Number(r);if(!Number.isFinite(a)||String(r).trim()==="")return[{message:`${t} must be a number.`}];const o=A(e.min),u=A(e.max);return o!==null&&a<o?[{message:`${t} must be at least ${o}.`}]:u!==null&&a>u?[{message:`${t} must be no more than ${u}.`}]:[]}const n=String(r).length,i=A(e.minLength),s=A(e.maxLength);return i!==null&&n<i?[{message:`${t} must be at least ${i} characters.`}]:s!==null&&n>s?[{message:`${t} must be no more than ${s} characters.`}]:[]}function k(e,r,t){const n=Z(e,r),i=e.logic;if(!i||!Array.isArray(i.validation))return n;for(const s of i.validation)switch(s.type){case"regex":{if(!p(r))try{new RegExp(s.pattern||"",s.flags||"").test(c(r))||n.push({message:s.message||"Invalid format."})}catch{}break}case"match":{const a=t[s.field];!p(r)&&c(r)!==c(a)&&n.push({message:s.message||"Fields do not match."});break}}return n}function N(e,r){const t=e.logic;if(!t||!t.cascade||!t.cascade.sourceField)return null;const n=t.cascade,i=n.mapping||{},s=r[n.sourceField];if(Array.isArray(s)){const o=new Set,u=[];return s.forEach(function(g){const f=c(g);Object.prototype.hasOwnProperty.call(i,f)&&(i[f]||[]).forEach(function(x){const G=c(x&&x.value);o.has(G)||(o.add(G),u.push(x))})}),u.length?u:n.defaultOptions||null}const a=c(s);return Object.prototype.hasOwnProperty.call(i,a)?i[a]||[]:n.defaultOptions||null}const X={fade:250,slide:300,scale:200},C=[{value:"none",label:"None (instant)"},{value:"fade",label:"Fade"},{value:"slide",label:"Slide (open and close)"},{value:"scale",label:"Scale"},{value:"slide-up",label:"Slide up"},{value:"slide-down",label:"Slide down"},{value:"slide-left",label:"Slide in from right"},{value:"slide-right",label:"Slide in from left"},{value:"zoom",label:"Zoom"},{value:"bubble-pop",label:"Bubble pop"},{value:"bounce",label:"Bounce"},{value:"drop",label:"Drop in"},{value:"elastic",label:"Elastic"},{value:"flip",label:"Flip"},{value:"rotate",label:"Rotate"},{value:"swing",label:"Swing"},{value:"unfold",label:"Unfold"},{value:"blur",label:"Blur"}],L=new Set(C.map(function(e){return e.value}).filter(function(e){return["none","fade","slide","scale"].indexOf(e)===-1})),J={"bubble-pop":450,bounce:550,drop:500,elastic:600,flip:400,swing:500,rotate:350};function T(e,r){const t=Number(r);return!isFinite(t)||t<0||t>5e3?X[e]||J[e]||300:Math.round(t)}function F(e,r,t,n,i){const s=(e._fbAnimToken||0)+1;e._fbAnimToken=s,e.removeAttribute("data-fb-anim"),e.offsetWidth,e.style.setProperty("--fb-anim-ms",n+"ms"),e.setAttribute("data-fb-anim",t+"-"+r),setTimeout(function(){e._fbAnimToken===s&&(e.removeAttribute("data-fb-anim"),e.style.removeProperty("--fb-anim-ms"),i&&i())},n+20)}function I(e,r,t){const n=T(r,t);if(L.has(r))F(e,r,"out",n,function(){e.classList.add("fb-field-hidden")});else if(r==="fade")e.style.transition="opacity "+n+"ms ease",e.style.opacity="1",requestAnimationFrame(function(){e.style.opacity="0",setTimeout(function(){e.classList.add("fb-field-hidden"),e.style.transition="",e.style.opacity=""},n+10)});else if(r==="slide"){const i=Math.round(n*.67);e.style.overflow="hidden",e.style.maxHeight=e.scrollHeight+"px",e.style.transition="max-height "+n+"ms ease, opacity "+i+"ms ease",requestAnimationFrame(function(){e.style.maxHeight="0",e.style.opacity="0",setTimeout(function(){e.classList.add("fb-field-hidden"),e.style.transition="",e.style.maxHeight="",e.style.opacity="",e.style.overflow=""},n+20)})}else r==="scale"&&(e.style.transition="opacity "+n+"ms ease, transform "+n+"ms ease",e.style.transform="scale(1)",e.style.opacity="1",requestAnimationFrame(function(){e.style.transform="scale(0.95)",e.style.opacity="0",setTimeout(function(){e.classList.add("fb-field-hidden"),e.style.transition="",e.style.transform="",e.style.opacity=""},n+20)}))}function M(e,r,t){const n=T(r,t);if(e.classList.remove("fb-field-hidden"),L.has(r))F(e,r,"in",n);else if(r==="fade")e.style.opacity="0",e.style.transition="opacity "+n+"ms ease",requestAnimationFrame(function(){e.style.opacity="1",setTimeout(function(){e.style.transition="",e.style.opacity=""},n+10)});else if(r==="slide"){const i=Math.round(n*.67);e.style.overflow="hidden",e.style.maxHeight="0",e.style.opacity="0",e.style.transition="max-height "+n+"ms ease, opacity "+i+"ms ease",requestAnimationFrame(function(){e.style.maxHeight=e.scrollHeight+"px",e.style.opacity="1",setTimeout(function(){e.style.transition="",e.style.maxHeight="",e.style.opacity="",e.style.overflow=""},n+20)})}else r==="scale"&&(e.style.transform="scale(0.95)",e.style.opacity="0",e.style.transition="opacity "+n+"ms ease, transform "+n+"ms ease",requestAnimationFrame(function(){e.style.transform="scale(1)",e.style.opacity="1",setTimeout(function(){e.style.transition="",e.style.transform="",e.style.opacity=""},n+20)}))}const R={banner:"state","disable-fields":"state","hide-fields":"state","require-fields":"state","block-submit":"state","end-form":"state",toast:"event",celebrate:"event","goto-step":"event",redirect:"event","run-action":"event",notify:"event"},Q=["block-submit","hide-fields","disable-fields","require-fields","end-form","redirect","run-action","notify"];function b(e){return!!e&&!!e.name&&e.type!=="page-break"&&e.type!=="spacer"}function y(e,r,t){const n=(t||[]).filter(b),i=e.target||(e.fields&&e.fields.length?"listed":"rest");if(i==="listed"){const a=new Set(e.fields||[]);return n.filter(o=>a.has(o.name)&&o.name!==r.name).map(o=>o.name)}if(i==="all")return n.filter(a=>a.name!==r.name).map(a=>a.name);const s=n.findIndex(a=>a.name===r.name);return s===-1?[]:n.slice(s+1).map(a=>a.name)}function S(e,r){for(const t of r)e.includes(t)||e.push(t)}function ee(e,r,t,n,i){if(!r||!r.type)return;const s=R[r.type];if(s){if(s==="event"){e.events.push({key:i,type:r.type,field:t.name,action:r});return}switch(r.type){case"banner":e.banners.push({key:i,field:t.name,message:r.message||"",level:r.level||"info",position:r.position||"field-below",dismissible:r.dismissible!==!1});break;case"hide-fields":S(e.hidden,y(r,t,n));break;case"disable-fields":S(e.disabled,y(r,t,n));break;case"require-fields":S(e.required,y(r,t,n));break;case"block-submit":e.blocks.push({key:i,message:r.message||"This form cannot be submitted yet."});break;case"end-form":S(e.masked,y({target:"rest"},t,n)),e.ends.push({key:i,field:t.name,message:r.message||"",finishLabel:r.finishLabel||"Finish",doneMessage:r.doneMessage||"",record:r.record!==!1,finish:r.finish!==!1}),r.finish===!1&&e.blocks.push({key:i,quiet:!0,message:r.message||"This form cannot be submitted."});break;default:break}}}const B=/\{\{\s*([A-Za-z_][A-Za-z0-9_-]*)\s*\}\}/g,te=["password","file","image","signature"],O=200,ne={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",pound:"\xA3",euro:"\u20AC",copy:"\xA9",reg:"\xAE"};function $(e){return String(e).replace(/<[^>]*>/g,"").replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(r,t)=>{if(t[0]==="#"){const n=t[1]==="x"||t[1]==="X"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)&&n>31?String.fromCodePoint(n):" "}return ne[t.toLowerCase()]??r})}function z(e,r){const t=Array.isArray(e.options)?e.options:[];for(const n of t)if(n&&typeof n=="object"){if(String(n.value)===String(r))return $(n.label!=null?n.label:n.value)}else if(String(n)===String(r))return $(n);return String(r)}function re(e,r){if(!e||te.includes(e.type)||r==null||r===!1)return"";let t;return Array.isArray(r)?t=r.filter(n=>n!==""&&n!=null).map(n=>z(e,n)).join(", "):e.type==="checkbox"?t=r&&r!=="false"?"Yes":"":Array.isArray(e.options)&&e.options.length?t=r===""?"":z(e,r):t=String(r),t=t.replace(/[\u0000-\u001f\u007f]+/g," ").replace(/\s+/g," ").trim(),t.length>O?t.slice(0,O-1).trimEnd()+"\u2026":t}function V(e,r,t,n){if(!e||typeof e!="string"||e.indexOf("{{")===-1)return e||"";const i=n instanceof Set?n:new Set(n||[]),s=new Map((r||[]).filter(b).map(a=>[a.name,a]));return e.replace(B,(a,o)=>{const u=s.get(o);return!u||i.has(o)?"":re(u,(t||{})[o])})}function ie(e){const r=[];return String(e||"").replace(B,(t,n)=>(r.includes(n)||r.push(n),t)),r}function se(e,r,t){const n=new Set([...e.hidden,...e.disabled,...e.masked]);(r||[]).forEach(s=>{b(s)&&v(s,t)==="hidden"&&n.add(s.name)});const i=s=>V(s,r,t,n);e.banners.forEach(s=>{s.message=i(s.message)}),e.blocks.forEach(s=>{s.message=i(s.message)}),e.ends.forEach(s=>{s.message=i(s.message),s.doneMessage=i(s.doneMessage)}),e.events.forEach(s=>{s.type==="toast"&&s.action&&s.action.message&&(s.action=Object.assign({},s.action,{message:i(s.action.message)}))})}function D(e,r){const t={active:[],banners:[],hidden:[],disabled:[],required:[],blocks:[],events:[],masked:[],ends:[]};return(e||[]).forEach(n=>{!b(n)||!Array.isArray(n.triggers)||n.triggers.forEach((i,s)=>{if(!i||i.enabled===!1)return;const a=i.id||`${n.name}::${s}`,o=h(i.when,r),u=`${a}:${o?"then":"else"}`,g=o?i.then:i.otherwise;!Array.isArray(g)||!g.length||(t.active.push(u),g.forEach(f=>ee(t,f,n,e,u)))})}),t.required=t.required.filter(n=>!t.hidden.includes(n)&&!t.masked.includes(n)),se(t,e,r||{}),t}function W(e){return(e||[]).some(r=>Array.isArray(r&&r.triggers)&&r.triggers.length>0)}function l(e,r,t){this._form=e,this._wrapper=r,this._fields=(e.fields||[]).filter(n=>n.type!=="page-break"),this._listeners=[],this._depMap=new Map,this._initialEval=!1,this._baseValues=t&&t.baseValues||null,this._hasTriggers=W(this._fields),this._triggerState=null,this._triggerPrev=new Set,this._triggerFired=new Set,this._triggerApplied={hidden:[],disabled:[],required:[],masked:[]},this._banners=new Map,this._dismissed=new Set,this._end=null}function m(e,r,t){const n=t||"",i=r||"";return n+'[name="'+e+'"]'+i+", "+n+'[name="'+e+'[]"]'+i}function ae(e){return String(e||"").replace(/\[\]$/,"")}l.prototype._fieldInputs=function(e){return this._wrapper.querySelectorAll(m(e))},l.prototype._fieldInput=function(e){return this._wrapper.querySelector(m(e))},l.prototype._buildDepMap=function(){this._depMap.clear();const e=this;e._fields.forEach(function(r){const t=r.logic;if(!t)return;function n(i){if(!i)return;(i.all||i.any||[]).forEach(function(a){a.field?(e._depMap.has(a.field)||e._depMap.set(a.field,new Set),e._depMap.get(a.field).add(r.name)):n(a)})}if(t.visibility&&(t.visibility.conditions||[]).forEach(function(i){n(i.when)}),t.requirement&&(t.requirement.conditions||[]).forEach(function(i){n(i.when)}),t.cascade&&t.cascade.sourceField){const i=t.cascade.sourceField;e._depMap.has(i)||e._depMap.set(i,new Set),e._depMap.get(i).add(r.name)}})};function P(e,r){const t={};return(r||[]).forEach(function(n){if(!n||!n.name)return;const i=e.querySelectorAll(m(n.name));if(!i.length)return;const s=i[0];if(s.type==="radio"){const a=e.querySelector(m(n.name,":checked"));t[n.name]=a?a.value:""}else if(s.type==="checkbox")if(i.length>1||/\[\]$/.test(s.name||"")){const a=[];i.forEach(function(o){o.checked&&a.push(o.value)}),t[n.name]=a}else t[n.name]=s.checked?s.value||"true":"";else t[n.name]=s.value}),t}function H(e,r){const t=P(e,r),n=[],i=[];return(r||[]).forEach(function(s){if(!s||!s.name||v(s,t)==="hidden")return;const a=t[s.name],o=Array.isArray(a)?a.length===0:!String(a??"").trim();if(w(s,t)&&o){n.push({name:s.name,label:s.label||s.name});return}if(o)return;const u=k(s,a,t);u.length&&i.push(u[0].message)}),{valid:n.length===0&&i.length===0,missing:n,errors:i,values:t}}l.prototype._getValues=function(){const e=this._baseValues?Object.assign({},this._baseValues):{};return this._fields.forEach(function(r){const t=this._fieldInputs(r.name);if(!t.length)return;const n=t[0];if(n.type==="radio"){const i=this._wrapper.querySelector(m(r.name,":checked"));e[r.name]=i?i.value:""}else if(n.type==="checkbox")if(t.length>1||/\[\]$/.test(n.name||"")){const i=[];t.forEach(function(s){s.checked&&i.push(s.value)}),e[r.name]=i}else e[r.name]=n.checked?n.value||"true":"";else e[r.name]=n.value},this),e},l.prototype._applyVisibility=function(e,r){const n=v(e,r)==="hidden",i=this._findFieldWrapper(e.name);if(!i)return;i.setAttribute("aria-hidden",String(n));const s=this._initialEval?"none":e.logic?.visibility?.transition||"none";if(s==="none"){i.classList.toggle("fb-field-hidden",n);return}const a=e.logic?.visibility?.duration;i.style.transition="",n?I(i,s,a):M(i,s,a)};function oe(e,r,t){if(!e||!r||r==="none")return;const n=T(r,t);I(e,r,t),setTimeout(function(){M(e,r,t)},n+250)}l.prototype._applyRequirement=function(e,r){const t=w(e,r),n=this._fieldInput(e.name);if(!n)return;if(/\[\]$/.test(n.name||"")||n.closest&&n.closest(".domma-chooser")){const s=this._findFieldWrapper(e.name);n.removeAttribute("required"),s&&(s.setAttribute("aria-required",String(t)),s.classList.toggle("fb-field-required",t));return}t?n.setAttribute("required",""):n.removeAttribute("required");const i=this._findFieldWrapper(e.name);i&&(i.setAttribute("aria-required",String(t)),i.classList.toggle("fb-field-required",t))},l.prototype._applyCascade=function(e,r){const t=N(e,r);if(t===null)return;const n=this._wrapper.querySelector(m(e.name,"","select"));if(!n)return;const i=n.value;n.textContent="",t.forEach(function(s){const a=document.createElement("option");a.value=s.value,a.textContent=s.label||s.value,s.value===i&&(a.selected=!0),n.appendChild(a)})},l.prototype._applyValidation=function(e,r){const t=this._fieldInput(e.name);if(!t)return;const n=k(e,r[e.name],r);let i=t.parentNode.querySelector(".fb-validation-error");n.length?(i||(i=document.createElement("div"),i.className="fb-validation-error",t.parentNode.appendChild(i)),i.textContent=n[0].message):i&&i.remove()},l.prototype._findFieldWrapper=function(e){const r=this._fieldInput(e);if(!r)return null;const t=r.closest("form")||this._wrapper;let n=r;for(;n.parentNode&&n.parentNode!==t;)n=n.parentNode;return n},l.prototype.evaluate=function(e){const r=this._getValues(),t=this;let n;if(e&&this._depMap.has(e)){const i=this._depMap.get(e);n=this._fields.filter(function(s){return i.has(s.name)})}else n=this._fields;n.forEach(function(i){i.logic&&(t._applyVisibility(i,r),t._applyRequirement(i,r),t._applyCascade(i,r))}),this._applyTriggers(r)},l.prototype.init=function(){this._buildDepMap();const e=this;if(this._wrapper.querySelectorAll("input, select, textarea").forEach(function(n){const i=ae(n.getAttribute("name"));if(!i)return;const s=function(){e.evaluate(i)};n.addEventListener("input",s),n.addEventListener("change",s),e._listeners.push({el:n,event:"input",fn:s}),e._listeners.push({el:n,event:"change",fn:s});const a=e._fields.find(function(o){return o.name===i});if(a&&a.logic&&Array.isArray(a.logic.validation)&&a.logic.validation.length){const o=function(){const u=e._getValues();e._applyValidation(a,u)};n.addEventListener("blur",o),e._listeners.push({el:n,event:"blur",fn:o})}}),this._wrapper.querySelectorAll("[data-chooser-field]").forEach(function(n){const i=n.getAttribute("data-chooser-field");if(!i)return;const s=function(){setTimeout(function(){e.evaluate(i)},0)};n.addEventListener("click",s),e._listeners.push({el:n,event:"click",fn:s})}),this._hasTriggers){const n=function(i){if(e._end&&!(i.type==="click"&&!(i.target&&i.target.closest&&i.target.closest(le)))){if(!e._end.spec.finish){i.preventDefault(),i.stopImmediatePropagation();return}e._wrapper.dataset.triggerBlocked!=="true"&&(i.preventDefault(),i.stopImmediatePropagation(),e._finishEnded())}};this._wrapper.addEventListener("click",n,!0),this._wrapper.addEventListener("submit",n,!0),this._listeners.push({el:this._wrapper,event:"click",fn:n,capture:!0}),this._listeners.push({el:this._wrapper,event:"submit",fn:n,capture:!0})}this._initialEval=!0,this.evaluate(),this._initialEval=!1},l.prototype.destroy=function(){this._listeners.forEach(function(e){e.el.removeEventListener(e.event,e.fn,!!e.capture)}),this._listeners=[],this._banners.forEach(function(e){e&&e.parentNode&&e.parentNode.removeChild(e)}),this._banners.clear(),this._syncEnd([])},l.prototype._applyTriggers=function(e){if(!this._hasTriggers)return;const r=D(this._fields,e);this._triggerState=r;const t=this._triggerApplied||{hidden:[],disabled:[],required:[]};t.hidden.forEach(n=>{r.hidden.indexOf(n)===-1&&this._setTriggerHidden(n,!1)}),r.hidden.forEach(n=>this._setTriggerHidden(n,!0)),t.disabled.forEach(n=>{r.disabled.indexOf(n)===-1&&this._setTriggerDisabled(n,!1)}),r.disabled.forEach(n=>this._setTriggerDisabled(n,!0)),t.required.forEach(n=>{r.required.indexOf(n)===-1&&this._restoreRequired(n,e)}),r.required.forEach(n=>this._setTriggerRequired(n,!0)),(t.masked||[]).forEach(n=>{r.masked.indexOf(n)===-1&&this._setTriggerMasked(n,!1)}),r.masked.forEach(n=>this._setTriggerMasked(n,!0)),this._triggerApplied={hidden:r.hidden.slice(),disabled:r.disabled.slice(),required:r.required.slice(),masked:r.masked.slice()},this._syncBanners(r.banners),this._syncSubmitBlock(r.blocks),this._syncEnd(r.ends),this._fireTriggerEvents(r)},l.prototype._setTriggerHidden=function(e,r){const t=this._findFieldWrapper(e);t&&(t.classList.toggle("fb-field-trigger-hidden",r),t.setAttribute("aria-hidden",String(r||t.classList.contains("fb-field-hidden"))))},l.prototype._setTriggerMasked=function(e,r){const t=this._findFieldWrapper(e);t&&(t.classList.toggle("fb-field-trigger-masked",r),t.setAttribute("aria-hidden",String(r||t.classList.contains("fb-field-hidden")||t.classList.contains("fb-field-trigger-hidden"))))},l.prototype._setTriggerDisabled=function(e,r){const t=this._findFieldWrapper(e);t&&t.classList.toggle("fb-field-disabled",r),this._fieldInputs(e).forEach(function(s){s.disabled=r});const n=this._wrapper.querySelector('[data-chooser-field="'+e+'"]');n&&(n.classList.toggle("fb-field-disabled",r),n.querySelectorAll('button, [role="radio"], [role="checkbox"]').forEach(function(s){r?s.setAttribute("aria-disabled","true"):s.removeAttribute("aria-disabled")}));const i=typeof window<"u"?window.E:null;if(i&&typeof i.get=="function"){const s=Array.prototype.slice.call(this._fieldInputs(e)),a=this._wrapper.querySelector('[data-dropzone-field="'+e+'"]');a&&s.push(a),s.forEach(function(o){const u=i.get(o,"dropzone");u&&typeof u.disable=="function"&&(r?u.disable():u.enable())})}},l.prototype._setTriggerRequired=function(e,r){const t=this._fieldInput(e),n=this._findFieldWrapper(e);if(n&&(n.setAttribute("aria-required",String(r)),n.classList.toggle("fb-field-required",r)),!!t){if(/\[\]$/.test(t.name||"")||t.closest&&t.closest(".domma-chooser")){t.removeAttribute("required");return}r?t.setAttribute("required",""):t.removeAttribute("required")}},l.prototype._restoreRequired=function(e,r){const t=this._fields.find(function(n){return n.name===e});t&&this._setTriggerRequired(e,w(t,r))},l.prototype._syncBanners=function(e){const r=new Map;e.forEach(function(t){r.set(t.key,t)}),this._banners.forEach(function(t,n){r.has(n)||(t.parentNode&&t.parentNode.removeChild(t),this._banners.delete(n))},this),this._dismissed.forEach(function(t){r.has(t)||this._dismissed.delete(t)},this),r.forEach(function(t,n){if(this._banners.has(n)){const a=this._banners.get(n).querySelector(".fb-trigger-banner-text");a&&a.textContent!==t.message&&(a.textContent=t.message);return}if(this._dismissed.has(n))return;const i=this._buildBanner(t,n);i&&this._banners.set(n,i)},this)},l.prototype._buildBanner=function(e,r){if(typeof document>"u"||!e.message)return null;const t=document.createElement("div");t.className="fb-trigger-banner fb-trigger-banner--"+(e.level||"info"),t.setAttribute("role",e.level==="error"?"alert":"status"),t.dataset.triggerKey=r;const n=document.createElement("span");if(n.className="fb-trigger-banner-text",n.textContent=e.message,t.appendChild(n),e.dismissible){const a=document.createElement("button");a.type="button",a.className="fb-trigger-banner-close",a.setAttribute("aria-label","Dismiss"),a.textContent="\xD7";const o=this;a.addEventListener("click",function(){o._dismissed.add(r),t.parentNode&&t.parentNode.removeChild(t),o._banners.delete(r)}),t.appendChild(a)}const i=this._findFieldWrapper(e.field),s=this._wrapper.querySelector("form")||this._wrapper;return e.position==="form-top"?s.insertBefore(t,s.firstChild):i&&i.parentNode?e.position==="field-above"?i.parentNode.insertBefore(t,i):i.parentNode.insertBefore(t,i.nextSibling):s.appendChild(t),t},l.prototype._syncSubmitBlock=function(e){const r=this._wrapper.querySelector("form")||this._wrapper,t=r.querySelector('button[type="submit"], input[type="submit"], .fb-form-submit'),n=e.length>0;this._wrapper.dataset.triggerBlocked=n?"true":"false",t&&(t.disabled=n,t.setAttribute("aria-disabled",String(n)));let i=r.querySelector(".fb-trigger-block-note");const s=e.filter(function(a){return!a.quiet}).map(function(a){return a.message});if(!s.length){i&&i.parentNode&&i.parentNode.removeChild(i);return}i||(i=document.createElement("p"),i.className="fb-trigger-block-note",i.setAttribute("role","status"),(t&&t.parentNode?t.parentNode:r).appendChild(i)),i.textContent=s.join(" ")};const le='button[type="submit"], input[type="submit"], .fb-form-submit, .wizard-next, .wizard-submit';l.prototype._primaryButton=function(){return this._wrapper.querySelector(".wizard-next, .wizard-submit")||this._wrapper.querySelector('button[type="submit"], input[type="submit"], .fb-form-submit')};function j(e){return!!(e.matches&&e.matches(".wizard-next, .wizard-submit"))}function K(e){return e.querySelector?e.querySelector(".fb-btn-label"):null}function ue(e){return e.tagName==="INPUT"?e.value:(K(e)||e).textContent}function U(e,r){if(e.tagName==="INPUT"){e.value=r;return}const t=K(e);(t||e).textContent=r}return l.prototype._syncEnd=function(e){const r=e&&e.length?e[0]:null,t=this._end;if(t&&(!r||t.spec.key!==r.key)&&(t.panel&&t.panel.parentNode&&t.panel.parentNode.removeChild(t.panel),t.button&&t.button.isConnected&&(t.spec.finish?U(t.button,t.label):j(t.button)&&(t.button.disabled=!1)),this._end=null),this._wrapper.dataset.triggerEnded=r?"true":"false",!r||typeof document>"u")return;if(this._end){const a=this._end.panel&&this._end.panel.querySelector(".fb-trigger-end-text");a&&a.textContent!==r.message&&(a.textContent=r.message),this._end.spec=r;return}let n=null;if(r.message){n=document.createElement("div"),n.className="fb-trigger-end",n.setAttribute("role","status"),n.dataset.triggerKey=r.key;const a=document.createElement("div");a.className="fb-trigger-end-text",a.textContent=r.message,n.appendChild(a);const o=this._findFieldWrapper(r.field);o&&o.parentNode?o.parentNode.insertBefore(n,o.nextSibling):(this._wrapper.querySelector("form")||this._wrapper).appendChild(n)}const i=this._primaryButton();let s="";i&&r.finish?(s=ue(i),U(i,r.finishLabel)):i&&j(i)&&(i.disabled=!0),this._end={spec:r,panel:n,button:i,label:s}},l.prototype._finishEnded=function(){const e=this._triggerState||{},r=new Set([].concat(e.masked||[],e.hidden||[],e.disabled||[])),t=this,n=this._fields.filter(function(a){return b(a)&&!r.has(a.name)&&t._fieldInput(a.name)}),i=this._getValues();(e.masked||[]).forEach(function(a){delete i[a]});const s=H(this._wrapper,n);(e.required||[]).forEach(function(a){const o=n.find(function(f){return f.name===a});if(!o)return;const u=i[a];(Array.isArray(u)?u.length===0:!String(u??"").trim())&&!s.missing.some(function(f){return f.name===a})&&(s.missing.push({name:a,label:o.label||a}),s.valid=!1)}),this._wrapper.dispatchEvent(new CustomEvent("dm-form-end",{bubbles:!0,detail:{values:i,validation:s,end:this._end?this._end.spec:null}}))},l.prototype._fireTriggerEvents=function(e){const r=new Set(e.active),t=this;e.events.forEach(function(n){t._triggerPrev.has(n.key)||n.action.once&&t._triggerFired.has(n.key)||t._initialEval&&n.action.onLoad!==!0||(t._triggerFired.add(n.key),t._runTriggerEvent(n))}),this._triggerPrev=r},l.prototype._runTriggerEvent=function(e){const r=e.action;switch(r.type){case"toast":typeof E<"u"&&E&&typeof E.toast=="function"&&E.toast(r.message||"",{type:r.level||"info",duration:Number(r.duration)||4e3});break;case"celebrate":this._celebrate(r);break;default:break}typeof CustomEvent<"u"&&this._wrapper.dispatchEvent&&this._wrapper.dispatchEvent(new CustomEvent("dm-form-trigger",{bubbles:!0,detail:{type:r.type,field:e.field,action:r}}))},l.prototype._celebrate=function(e){typeof window>"u"||typeof document>"u"||window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||import("/public/js/celebrations/index.js").then(function(r){const t=r.CelebrationsEffect;let n=e.theme||"auto";if(n==="auto"&&(n=t.getCurrentTheme(),!n))return;const i=new t({theme:n,intensity:e.intensity||"medium",enabled:!0,zIndex:999});i.init().then(function(){i.start()})}).catch(function(){})},l.prototype.submitBlock=function(){const e=this._triggerState&&this._triggerState.blocks||[];return{blocked:e.length>0,reasons:e.map(function(r){return r.message})}},{evaluateCondition:_,evaluateConditionGroup:h,evaluateFieldVisibility:v,evaluateFieldRequirement:w,validateField:k,collectValues:P,validateFields:H,getCascadeOptions:N,resolveTriggerState:D,resolveTriggerTargets:y,fillTriggerText:V,triggerTokens:ie,hasTriggers:W,TRIGGER_ACTION_KINDS:R,SERVER_TRIGGER_ACTIONS:Q,FIELD_TRANSITIONS:C,previewTransition:oe,FormLogicRuntime:l}});
|
|
1
|
+
(function(c,d){typeof module<"u"&&module.exports?module.exports=d():c.FormLogicEngine=d()})(typeof globalThis<"u"?globalThis:this,function(){"use strict";function c(e){return e===""||e===null||e===void 0?"":String(e)}function d(e){const n=parseFloat(e);return isNaN(n)?null:n}function p(e){return e==null?!0:typeof e=="string"?e.trim()==="":Array.isArray(e)?e.length===0:!1}const Y={not_equals:"equals",not_contains:"contains",not_in:"in"};function q(e,n){const t=c(n),r=c(e.value);switch(e.operator){case"equals":return t===r;case"not_equals":return t!==r;case"contains":return t.toLowerCase().includes(r.toLowerCase());case"not_contains":return!t.toLowerCase().includes(r.toLowerCase());case"starts_with":return t.toLowerCase().startsWith(r.toLowerCase());case"ends_with":return t.toLowerCase().endsWith(r.toLowerCase());case"greater_than":{const i=d(n),s=d(e.value);return i!==null&&s!==null&&i>s}case"less_than":{const i=d(n),s=d(e.value);return i!==null&&s!==null&&i<s}case"is_empty":return p(n);case"is_not_empty":return!p(n);case"in":return(Array.isArray(e.value)?e.value.map(c):String(e.value).split(",").map(s=>s.trim())).includes(t);case"not_in":return!(Array.isArray(e.value)?e.value.map(c):String(e.value).split(",").map(s=>s.trim())).includes(t);case"matches_regex":try{const i=e.flags||"";return new RegExp(e.value,i).test(t)}catch(i){return typeof console<"u"&&console.warn&&console.warn('[FormLogicEngine] Invalid regex in condition for field "'+e.field+'": '+e.value,i&&i.message),!1}default:return!0}}function _(e,n){if(!e||!e.field||!e.operator)return!0;const t=n[e.field];if(!Array.isArray(t))return q(e,t);if(e.operator==="is_empty")return p(t);if(e.operator==="is_not_empty")return!p(t);const r=Y[e.operator];if(r){const i=Object.assign({},e,{operator:r});return!t.some(s=>q(i,s))}return t.some(i=>q(e,i))}function h(e,n){return e?Array.isArray(e.all)?e.all.every(t=>t.all||t.any?h(t,n):_(t,n)):Array.isArray(e.any)?e.any.some(t=>t.all||t.any?h(t,n):_(t,n)):e.field&&e.operator?_(e,n):!0:!0}function v(e,n){const t=e.logic;if(!t||!t.visibility)return"visible";const r=t.visibility,i=r.conditions||[];for(const s of i)if(s.when&&h(s.when,n))return s.then==="hidden"?"hidden":"visible";return r.default==="hidden"?"hidden":"visible"}function w(e,n){const t=e.logic;if(!t||!t.requirement)return e.required||!1;const r=t.requirement,i=r.conditions||[];for(const s of i)if(s.when&&h(s.when,n))return s.then===!0;return r.default===!0}function A(e){if(e==null||e==="")return null;const n=Number(e);return Number.isFinite(n)?n:null}function Z(e,n){if(p(n)||Array.isArray(n)||typeof n=="object")return[];const t=e.label||e.name;if(e.type==="number"){const a=Number(n);if(!Number.isFinite(a)||String(n).trim()==="")return[{message:`${t} must be a number.`}];const o=A(e.min),u=A(e.max);return o!==null&&a<o?[{message:`${t} must be at least ${o}.`}]:u!==null&&a>u?[{message:`${t} must be no more than ${u}.`}]:[]}const r=String(n).length,i=A(e.minLength),s=A(e.maxLength);return i!==null&&r<i?[{message:`${t} must be at least ${i} characters.`}]:s!==null&&r>s?[{message:`${t} must be no more than ${s} characters.`}]:[]}function k(e,n,t){const r=Z(e,n),i=e.logic;if(!i||!Array.isArray(i.validation))return r;for(const s of i.validation)switch(s.type){case"regex":{if(!p(n))try{new RegExp(s.pattern||"",s.flags||"").test(c(n))||r.push({message:s.message||"Invalid format."})}catch{}break}case"match":{const a=t[s.field];!p(n)&&c(n)!==c(a)&&r.push({message:s.message||"Fields do not match."});break}}return r}function C(e,n){const t=e.logic;if(!t||!t.cascade||!t.cascade.sourceField)return null;const r=t.cascade,i=r.mapping||{},s=n[r.sourceField];if(Array.isArray(s)){const o=new Set,u=[];return s.forEach(function(g){const f=c(g);Object.prototype.hasOwnProperty.call(i,f)&&(i[f]||[]).forEach(function(N){const G=c(N&&N.value);o.has(G)||(o.add(G),u.push(N))})}),u.length?u:r.defaultOptions||null}const a=c(s);return Object.prototype.hasOwnProperty.call(i,a)?i[a]||[]:r.defaultOptions||null}const X={fade:250,slide:300,scale:200},L=[{value:"none",label:"None (instant)"},{value:"fade",label:"Fade"},{value:"slide",label:"Slide (open and close)"},{value:"scale",label:"Scale"},{value:"slide-up",label:"Slide up"},{value:"slide-down",label:"Slide down"},{value:"slide-left",label:"Slide in from right"},{value:"slide-right",label:"Slide in from left"},{value:"zoom",label:"Zoom"},{value:"bubble-pop",label:"Bubble pop"},{value:"bounce",label:"Bounce"},{value:"drop",label:"Drop in"},{value:"elastic",label:"Elastic"},{value:"flip",label:"Flip"},{value:"rotate",label:"Rotate"},{value:"swing",label:"Swing"},{value:"unfold",label:"Unfold"},{value:"blur",label:"Blur"}],F=new Set(L.map(function(e){return e.value}).filter(function(e){return["none","fade","slide","scale"].indexOf(e)===-1})),J={"bubble-pop":450,bounce:550,drop:500,elastic:600,flip:400,swing:500,rotate:350};function T(e,n){const t=Number(n);return!isFinite(t)||t<0||t>5e3?X[e]||J[e]||300:Math.round(t)}function I(e,n,t,r,i){const s=(e._fbAnimToken||0)+1;e._fbAnimToken=s,e.removeAttribute("data-fb-anim"),e.offsetWidth,e.style.setProperty("--fb-anim-ms",r+"ms"),e.setAttribute("data-fb-anim",t+"-"+n),setTimeout(function(){e._fbAnimToken===s&&(e.removeAttribute("data-fb-anim"),e.style.removeProperty("--fb-anim-ms"),i&&i())},r+20)}function M(e,n,t){const r=T(n,t);if(F.has(n))I(e,n,"out",r,function(){e.classList.add("fb-field-hidden")});else if(n==="fade")e.style.transition="opacity "+r+"ms ease",e.style.opacity="1",requestAnimationFrame(function(){e.style.opacity="0",setTimeout(function(){e.classList.add("fb-field-hidden"),e.style.transition="",e.style.opacity=""},r+10)});else if(n==="slide"){const i=Math.round(r*.67);e.style.overflow="hidden",e.style.maxHeight=e.scrollHeight+"px",e.style.transition="max-height "+r+"ms ease, opacity "+i+"ms ease",requestAnimationFrame(function(){e.style.maxHeight="0",e.style.opacity="0",setTimeout(function(){e.classList.add("fb-field-hidden"),e.style.transition="",e.style.maxHeight="",e.style.opacity="",e.style.overflow=""},r+20)})}else n==="scale"&&(e.style.transition="opacity "+r+"ms ease, transform "+r+"ms ease",e.style.transform="scale(1)",e.style.opacity="1",requestAnimationFrame(function(){e.style.transform="scale(0.95)",e.style.opacity="0",setTimeout(function(){e.classList.add("fb-field-hidden"),e.style.transition="",e.style.transform="",e.style.opacity=""},r+20)}))}function x(e,n,t){const r=T(n,t);if(e.classList.remove("fb-field-hidden"),F.has(n))I(e,n,"in",r);else if(n==="fade")e.style.opacity="0",e.style.transition="opacity "+r+"ms ease",requestAnimationFrame(function(){e.style.opacity="1",setTimeout(function(){e.style.transition="",e.style.opacity=""},r+10)});else if(n==="slide"){const i=Math.round(r*.67);e.style.overflow="hidden",e.style.maxHeight="0",e.style.opacity="0",e.style.transition="max-height "+r+"ms ease, opacity "+i+"ms ease",requestAnimationFrame(function(){e.style.maxHeight=e.scrollHeight+"px",e.style.opacity="1",setTimeout(function(){e.style.transition="",e.style.maxHeight="",e.style.opacity="",e.style.overflow=""},r+20)})}else n==="scale"&&(e.style.transform="scale(0.95)",e.style.opacity="0",e.style.transition="opacity "+r+"ms ease, transform "+r+"ms ease",requestAnimationFrame(function(){e.style.transform="scale(1)",e.style.opacity="1",setTimeout(function(){e.style.transition="",e.style.transform="",e.style.opacity=""},r+20)}))}const R={banner:"state","disable-fields":"state","hide-fields":"state","require-fields":"state","block-submit":"state","end-form":"state",toast:"event",celebrate:"event","goto-step":"event",redirect:"event","run-action":"event",notify:"event"},Q=["block-submit","hide-fields","disable-fields","require-fields","end-form","redirect","run-action","notify"];function b(e){return!!e&&!!e.name&&e.type!=="page-break"&&e.type!=="spacer"}function y(e,n,t){const r=(t||[]).filter(b),i=e.target||(e.fields&&e.fields.length?"listed":"rest");if(i==="listed"){const a=new Set(e.fields||[]);return r.filter(o=>a.has(o.name)&&o.name!==n.name).map(o=>o.name)}if(i==="all")return r.filter(a=>a.name!==n.name).map(a=>a.name);const s=r.findIndex(a=>a.name===n.name);return s===-1?[]:r.slice(s+1).map(a=>a.name)}function S(e,n){for(const t of n)e.includes(t)||e.push(t)}function ee(e,n,t,r,i){if(!n||!n.type)return;const s=R[n.type];if(s){if(s==="event"){e.events.push({key:i,type:n.type,field:t.name,action:n});return}switch(n.type){case"banner":e.banners.push({key:i,field:t.name,message:n.message||"",level:n.level||"info",position:n.position||"field-below",dismissible:n.dismissible!==!1});break;case"hide-fields":S(e.hidden,y(n,t,r));break;case"disable-fields":S(e.disabled,y(n,t,r));break;case"require-fields":S(e.required,y(n,t,r));break;case"block-submit":e.blocks.push({key:i,message:n.message||"This form cannot be submitted yet."});break;case"end-form":S(e.masked,y({target:"rest"},t,r)),e.ends.push({key:i,field:t.name,message:n.message||"",finishLabel:n.finishLabel||"Finish",doneMessage:n.doneMessage||"",record:n.record!==!1,finish:n.finish!==!1}),n.finish===!1&&e.blocks.push({key:i,quiet:!0,message:n.message||"This form cannot be submitted."});break;default:break}}}const B=/\{\{\s*([A-Za-z_][A-Za-z0-9_-]*)\s*\}\}/g,te=["password","file","image","signature"],O=200,ne={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",pound:"\xA3",euro:"\u20AC",copy:"\xA9",reg:"\xAE"};function $(e){return String(e).replace(/<[^>]*>/g,"").replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(n,t)=>{if(t[0]==="#"){const r=t[1]==="x"||t[1]==="X"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(r)&&r>31?String.fromCodePoint(r):" "}return ne[t.toLowerCase()]??n})}function z(e,n){const t=Array.isArray(e.options)?e.options:[];for(const r of t)if(r&&typeof r=="object"){if(String(r.value)===String(n))return $(r.label!=null?r.label:r.value)}else if(String(r)===String(n))return $(r);return String(n)}function re(e,n){if(!e||te.includes(e.type)||n==null||n===!1)return"";let t;return Array.isArray(n)?t=n.filter(r=>r!==""&&r!=null).map(r=>z(e,r)).join(", "):e.type==="checkbox"?t=n&&n!=="false"?"Yes":"":Array.isArray(e.options)&&e.options.length?t=n===""?"":z(e,n):t=String(n),t=t.replace(/[\u0000-\u001f\u007f]+/g," ").replace(/\s+/g," ").trim(),t.length>O?t.slice(0,O-1).trimEnd()+"\u2026":t}function V(e,n,t,r){if(!e||typeof e!="string"||e.indexOf("{{")===-1)return e||"";const i=r instanceof Set?r:new Set(r||[]),s=new Map((n||[]).filter(b).map(a=>[a.name,a]));return e.replace(B,(a,o)=>{const u=s.get(o);return!u||i.has(o)?"":re(u,(t||{})[o])})}function ie(e){const n=[];return String(e||"").replace(B,(t,r)=>(n.includes(r)||n.push(r),t)),n}function se(e,n,t){const r=new Set([...e.hidden,...e.disabled,...e.masked]);(n||[]).forEach(s=>{b(s)&&v(s,t)==="hidden"&&r.add(s.name)});const i=s=>V(s,n,t,r);e.banners.forEach(s=>{s.message=i(s.message)}),e.blocks.forEach(s=>{s.message=i(s.message)}),e.ends.forEach(s=>{s.message=i(s.message),s.doneMessage=i(s.doneMessage)}),e.events.forEach(s=>{s.type==="toast"&&s.action&&s.action.message&&(s.action=Object.assign({},s.action,{message:i(s.action.message)}))})}function D(e,n){const t={active:[],banners:[],hidden:[],disabled:[],required:[],blocks:[],events:[],masked:[],ends:[]};return(e||[]).forEach(r=>{!b(r)||!Array.isArray(r.triggers)||r.triggers.forEach((i,s)=>{if(!i||i.enabled===!1)return;const a=i.id||`${r.name}::${s}`,o=h(i.when,n),u=`${a}:${o?"then":"else"}`,g=o?i.then:i.otherwise;!Array.isArray(g)||!g.length||(t.active.push(u),g.forEach(f=>ee(t,f,r,e,u)))})}),t.required=t.required.filter(r=>!t.hidden.includes(r)&&!t.masked.includes(r)),se(t,e,n||{}),t}function W(e){return(e||[]).some(n=>Array.isArray(n&&n.triggers)&&n.triggers.length>0)}function l(e,n,t){this._form=e,this._wrapper=n,this._fields=(e.fields||[]).filter(r=>r.type!=="page-break"),this._listeners=[],this._depMap=new Map,this._initialEval=!1,this._baseValues=t&&t.baseValues||null,this._hasTriggers=W(this._fields),this._triggerState=null,this._triggerPrev=new Set,this._triggerFired=new Set,this._triggerApplied={hidden:[],disabled:[],required:[],masked:[]},this._banners=new Map,this._dismissed=new Set,this._end=null}function m(e,n,t){const r=t||"",i=n||"";return r+'[name="'+e+'"]'+i+", "+r+'[name="'+e+'[]"]'+i}function ae(e){return String(e||"").replace(/\[\]$/,"")}l.prototype._fieldInputs=function(e){return this._wrapper.querySelectorAll(m(e))},l.prototype._fieldInput=function(e){return this._wrapper.querySelector(m(e))},l.prototype._buildDepMap=function(){this._depMap.clear();const e=this;e._fields.forEach(function(n){const t=n.logic;if(!t)return;function r(i){if(!i)return;(i.all||i.any||[]).forEach(function(a){a.field?(e._depMap.has(a.field)||e._depMap.set(a.field,new Set),e._depMap.get(a.field).add(n.name)):r(a)})}if(t.visibility&&(t.visibility.conditions||[]).forEach(function(i){r(i.when)}),t.requirement&&(t.requirement.conditions||[]).forEach(function(i){r(i.when)}),t.cascade&&t.cascade.sourceField){const i=t.cascade.sourceField;e._depMap.has(i)||e._depMap.set(i,new Set),e._depMap.get(i).add(n.name)}})};function P(e,n){const t={};return(n||[]).forEach(function(r){if(!r||!r.name)return;const i=e.querySelectorAll(m(r.name));if(!i.length)return;const s=i[0];if(s.type==="radio"){const a=e.querySelector(m(r.name,":checked"));t[r.name]=a?a.value:""}else if(s.type==="checkbox")if(i.length>1||/\[\]$/.test(s.name||"")){const a=[];i.forEach(function(o){o.checked&&a.push(o.value)}),t[r.name]=a}else t[r.name]=s.checked?s.value||"true":"";else t[r.name]=s.value}),t}function H(e,n){const t=P(e,n),r=[],i=[];return(n||[]).forEach(function(s){if(!s||!s.name||v(s,t)==="hidden")return;const a=t[s.name],o=Array.isArray(a)?a.length===0:!String(a??"").trim();if(w(s,t)&&o){r.push({name:s.name,label:s.label||s.name});return}if(o)return;const u=k(s,a,t);u.length&&i.push(u[0].message)}),{valid:r.length===0&&i.length===0,missing:r,errors:i,values:t}}l.prototype._getValues=function(){const e=this._baseValues?Object.assign({},this._baseValues):{};return this._fields.forEach(function(n){const t=this._fieldInputs(n.name);if(!t.length)return;const r=t[0];if(r.type==="radio"){const i=this._wrapper.querySelector(m(n.name,":checked"));e[n.name]=i?i.value:""}else if(r.type==="checkbox")if(t.length>1||/\[\]$/.test(r.name||"")){const i=[];t.forEach(function(s){s.checked&&i.push(s.value)}),e[n.name]=i}else e[n.name]=r.checked?r.value||"true":"";else e[n.name]=r.value},this),e},l.prototype._applyVisibility=function(e,n){const r=v(e,n)==="hidden",i=this._findFieldWrapper(e.name);if(!i)return;i.setAttribute("aria-hidden",String(r));const s=this._initialEval?"none":e.logic?.visibility?.transition||"none";if(s==="none"){i.classList.toggle("fb-field-hidden",r);return}const a=e.logic?.visibility?.duration;i.style.transition="",r?M(i,s,a):x(i,s,a)};function oe(e,n,t){!e||!n||n==="none"||x(e,n,t)}function le(e,n,t){if(!e||!n||n==="none")return;const r=T(n,t);M(e,n,t),setTimeout(function(){x(e,n,t)},r+250)}l.prototype._applyRequirement=function(e,n){const t=w(e,n),r=this._fieldInput(e.name);if(!r)return;if(/\[\]$/.test(r.name||"")||r.closest&&r.closest(".domma-chooser")){const s=this._findFieldWrapper(e.name);r.removeAttribute("required"),s&&(s.setAttribute("aria-required",String(t)),s.classList.toggle("fb-field-required",t));return}t?r.setAttribute("required",""):r.removeAttribute("required");const i=this._findFieldWrapper(e.name);i&&(i.setAttribute("aria-required",String(t)),i.classList.toggle("fb-field-required",t))},l.prototype._applyCascade=function(e,n){const t=C(e,n);if(t===null)return;const r=this._wrapper.querySelector(m(e.name,"","select"));if(!r)return;const i=r.value;r.textContent="",t.forEach(function(s){const a=document.createElement("option");a.value=s.value,a.textContent=s.label||s.value,s.value===i&&(a.selected=!0),r.appendChild(a)})},l.prototype._applyValidation=function(e,n){const t=this._fieldInput(e.name);if(!t)return;const r=k(e,n[e.name],n);let i=t.parentNode.querySelector(".fb-validation-error");r.length?(i||(i=document.createElement("div"),i.className="fb-validation-error",t.parentNode.appendChild(i)),i.textContent=r[0].message):i&&i.remove()},l.prototype._findFieldWrapper=function(e){const n=this._fieldInput(e);if(!n)return null;const t=n.closest("form")||this._wrapper;let r=n;for(;r.parentNode&&r.parentNode!==t;)r=r.parentNode;return r},l.prototype.evaluate=function(e){const n=this._getValues(),t=this;let r;if(e&&this._depMap.has(e)){const i=this._depMap.get(e);r=this._fields.filter(function(s){return i.has(s.name)})}else r=this._fields;r.forEach(function(i){i.logic&&(t._applyVisibility(i,n),t._applyRequirement(i,n),t._applyCascade(i,n))}),this._applyTriggers(n)},l.prototype.init=function(){this._buildDepMap();const e=this;if(this._wrapper.querySelectorAll("input, select, textarea").forEach(function(r){const i=ae(r.getAttribute("name"));if(!i)return;const s=function(){e.evaluate(i)};r.addEventListener("input",s),r.addEventListener("change",s),e._listeners.push({el:r,event:"input",fn:s}),e._listeners.push({el:r,event:"change",fn:s});const a=e._fields.find(function(o){return o.name===i});if(a&&a.logic&&Array.isArray(a.logic.validation)&&a.logic.validation.length){const o=function(){const u=e._getValues();e._applyValidation(a,u)};r.addEventListener("blur",o),e._listeners.push({el:r,event:"blur",fn:o})}}),this._wrapper.querySelectorAll("[data-chooser-field]").forEach(function(r){const i=r.getAttribute("data-chooser-field");if(!i)return;const s=function(){setTimeout(function(){e.evaluate(i)},0)};r.addEventListener("click",s),e._listeners.push({el:r,event:"click",fn:s})}),this._hasTriggers){const r=function(i){if(e._end&&!(i.type==="click"&&!(i.target&&i.target.closest&&i.target.closest(ue)))){if(!e._end.spec.finish){i.preventDefault(),i.stopImmediatePropagation();return}e._wrapper.dataset.triggerBlocked!=="true"&&(i.preventDefault(),i.stopImmediatePropagation(),e._finishEnded())}};this._wrapper.addEventListener("click",r,!0),this._wrapper.addEventListener("submit",r,!0),this._listeners.push({el:this._wrapper,event:"click",fn:r,capture:!0}),this._listeners.push({el:this._wrapper,event:"submit",fn:r,capture:!0})}this._initialEval=!0,this.evaluate(),this._initialEval=!1},l.prototype.destroy=function(){this._listeners.forEach(function(e){e.el.removeEventListener(e.event,e.fn,!!e.capture)}),this._listeners=[],this._banners.forEach(function(e){e&&e.parentNode&&e.parentNode.removeChild(e)}),this._banners.clear(),this._syncEnd([])},l.prototype._applyTriggers=function(e){if(!this._hasTriggers)return;const n=D(this._fields,e);this._triggerState=n;const t=this._triggerApplied||{hidden:[],disabled:[],required:[]};t.hidden.forEach(r=>{n.hidden.indexOf(r)===-1&&this._setTriggerHidden(r,!1)}),n.hidden.forEach(r=>this._setTriggerHidden(r,!0)),t.disabled.forEach(r=>{n.disabled.indexOf(r)===-1&&this._setTriggerDisabled(r,!1)}),n.disabled.forEach(r=>this._setTriggerDisabled(r,!0)),t.required.forEach(r=>{n.required.indexOf(r)===-1&&this._restoreRequired(r,e)}),n.required.forEach(r=>this._setTriggerRequired(r,!0)),(t.masked||[]).forEach(r=>{n.masked.indexOf(r)===-1&&this._setTriggerMasked(r,!1)}),n.masked.forEach(r=>this._setTriggerMasked(r,!0)),this._triggerApplied={hidden:n.hidden.slice(),disabled:n.disabled.slice(),required:n.required.slice(),masked:n.masked.slice()},this._syncBanners(n.banners),this._syncSubmitBlock(n.blocks),this._syncEnd(n.ends),this._fireTriggerEvents(n)},l.prototype._setTriggerHidden=function(e,n){const t=this._findFieldWrapper(e);t&&(t.classList.toggle("fb-field-trigger-hidden",n),t.setAttribute("aria-hidden",String(n||t.classList.contains("fb-field-hidden"))))},l.prototype._setTriggerMasked=function(e,n){const t=this._findFieldWrapper(e);t&&(t.classList.toggle("fb-field-trigger-masked",n),t.setAttribute("aria-hidden",String(n||t.classList.contains("fb-field-hidden")||t.classList.contains("fb-field-trigger-hidden"))))},l.prototype._setTriggerDisabled=function(e,n){const t=this._findFieldWrapper(e);t&&t.classList.toggle("fb-field-disabled",n),this._fieldInputs(e).forEach(function(s){s.disabled=n});const r=this._wrapper.querySelector('[data-chooser-field="'+e+'"]');r&&(r.classList.toggle("fb-field-disabled",n),r.querySelectorAll('button, [role="radio"], [role="checkbox"]').forEach(function(s){n?s.setAttribute("aria-disabled","true"):s.removeAttribute("aria-disabled")}));const i=typeof window<"u"?window.E:null;if(i&&typeof i.get=="function"){const s=Array.prototype.slice.call(this._fieldInputs(e)),a=this._wrapper.querySelector('[data-dropzone-field="'+e+'"]');a&&s.push(a),s.forEach(function(o){const u=i.get(o,"dropzone");u&&typeof u.disable=="function"&&(n?u.disable():u.enable())})}},l.prototype._setTriggerRequired=function(e,n){const t=this._fieldInput(e),r=this._findFieldWrapper(e);if(r&&(r.setAttribute("aria-required",String(n)),r.classList.toggle("fb-field-required",n)),!!t){if(/\[\]$/.test(t.name||"")||t.closest&&t.closest(".domma-chooser")){t.removeAttribute("required");return}n?t.setAttribute("required",""):t.removeAttribute("required")}},l.prototype._restoreRequired=function(e,n){const t=this._fields.find(function(r){return r.name===e});t&&this._setTriggerRequired(e,w(t,n))},l.prototype._syncBanners=function(e){const n=new Map;e.forEach(function(t){n.set(t.key,t)}),this._banners.forEach(function(t,r){n.has(r)||(t.parentNode&&t.parentNode.removeChild(t),this._banners.delete(r))},this),this._dismissed.forEach(function(t){n.has(t)||this._dismissed.delete(t)},this),n.forEach(function(t,r){if(this._banners.has(r)){const a=this._banners.get(r).querySelector(".fb-trigger-banner-text");a&&a.textContent!==t.message&&(a.textContent=t.message);return}if(this._dismissed.has(r))return;const i=this._buildBanner(t,r);i&&this._banners.set(r,i)},this)},l.prototype._buildBanner=function(e,n){if(typeof document>"u"||!e.message)return null;const t=document.createElement("div");t.className="fb-trigger-banner fb-trigger-banner--"+(e.level||"info"),t.setAttribute("role",e.level==="error"?"alert":"status"),t.dataset.triggerKey=n;const r=document.createElement("span");if(r.className="fb-trigger-banner-text",r.textContent=e.message,t.appendChild(r),e.dismissible){const a=document.createElement("button");a.type="button",a.className="fb-trigger-banner-close",a.setAttribute("aria-label","Dismiss"),a.textContent="\xD7";const o=this;a.addEventListener("click",function(){o._dismissed.add(n),t.parentNode&&t.parentNode.removeChild(t),o._banners.delete(n)}),t.appendChild(a)}const i=this._findFieldWrapper(e.field),s=this._wrapper.querySelector("form")||this._wrapper;return e.position==="form-top"?s.insertBefore(t,s.firstChild):i&&i.parentNode?e.position==="field-above"?i.parentNode.insertBefore(t,i):i.parentNode.insertBefore(t,i.nextSibling):s.appendChild(t),t},l.prototype._syncSubmitBlock=function(e){const n=this._wrapper.querySelector("form")||this._wrapper,t=n.querySelector('button[type="submit"], input[type="submit"], .fb-form-submit'),r=e.length>0;this._wrapper.dataset.triggerBlocked=r?"true":"false",t&&(t.disabled=r,t.setAttribute("aria-disabled",String(r)));let i=n.querySelector(".fb-trigger-block-note");const s=e.filter(function(a){return!a.quiet}).map(function(a){return a.message});if(!s.length){i&&i.parentNode&&i.parentNode.removeChild(i);return}i||(i=document.createElement("p"),i.className="fb-trigger-block-note",i.setAttribute("role","status"),(t&&t.parentNode?t.parentNode:n).appendChild(i)),i.textContent=s.join(" ")};const ue='button[type="submit"], input[type="submit"], .fb-form-submit, .wizard-next, .wizard-submit';l.prototype._primaryButton=function(){return this._wrapper.querySelector(".wizard-next, .wizard-submit")||this._wrapper.querySelector('button[type="submit"], input[type="submit"], .fb-form-submit')};function j(e){return!!(e.matches&&e.matches(".wizard-next, .wizard-submit"))}function K(e){return e.querySelector?e.querySelector(".fb-btn-label"):null}function ce(e){return e.tagName==="INPUT"?e.value:(K(e)||e).textContent}function U(e,n){if(e.tagName==="INPUT"){e.value=n;return}const t=K(e);(t||e).textContent=n}return l.prototype._syncEnd=function(e){const n=e&&e.length?e[0]:null,t=this._end;if(t&&(!n||t.spec.key!==n.key)&&(t.panel&&t.panel.parentNode&&t.panel.parentNode.removeChild(t.panel),t.button&&t.button.isConnected&&(t.spec.finish?U(t.button,t.label):j(t.button)&&(t.button.disabled=!1)),this._end=null),this._wrapper.dataset.triggerEnded=n?"true":"false",!n||typeof document>"u")return;if(this._end){const a=this._end.panel&&this._end.panel.querySelector(".fb-trigger-end-text");a&&a.textContent!==n.message&&(a.textContent=n.message),this._end.spec=n;return}let r=null;if(n.message){r=document.createElement("div"),r.className="fb-trigger-end",r.setAttribute("role","status"),r.dataset.triggerKey=n.key;const a=document.createElement("div");a.className="fb-trigger-end-text",a.textContent=n.message,r.appendChild(a);const o=this._findFieldWrapper(n.field);o&&o.parentNode?o.parentNode.insertBefore(r,o.nextSibling):(this._wrapper.querySelector("form")||this._wrapper).appendChild(r)}const i=this._primaryButton();let s="";i&&n.finish?(s=ce(i),U(i,n.finishLabel)):i&&j(i)&&(i.disabled=!0),this._end={spec:n,panel:r,button:i,label:s}},l.prototype._finishEnded=function(){const e=this._triggerState||{},n=new Set([].concat(e.masked||[],e.hidden||[],e.disabled||[])),t=this,r=this._fields.filter(function(a){return b(a)&&!n.has(a.name)&&t._fieldInput(a.name)}),i=this._getValues();(e.masked||[]).forEach(function(a){delete i[a]});const s=H(this._wrapper,r);(e.required||[]).forEach(function(a){const o=r.find(function(f){return f.name===a});if(!o)return;const u=i[a];(Array.isArray(u)?u.length===0:!String(u??"").trim())&&!s.missing.some(function(f){return f.name===a})&&(s.missing.push({name:a,label:o.label||a}),s.valid=!1)}),this._wrapper.dispatchEvent(new CustomEvent("dm-form-end",{bubbles:!0,detail:{values:i,validation:s,end:this._end?this._end.spec:null}}))},l.prototype._fireTriggerEvents=function(e){const n=new Set(e.active),t=this;e.events.forEach(function(r){t._triggerPrev.has(r.key)||r.action.once&&t._triggerFired.has(r.key)||t._initialEval&&r.action.onLoad!==!0||(t._triggerFired.add(r.key),t._runTriggerEvent(r))}),this._triggerPrev=n},l.prototype._runTriggerEvent=function(e){const n=e.action;switch(n.type){case"toast":typeof E<"u"&&E&&typeof E.toast=="function"&&E.toast(n.message||"",{type:n.level||"info",duration:Number(n.duration)||4e3});break;case"celebrate":this._celebrate(n);break;default:break}typeof CustomEvent<"u"&&this._wrapper.dispatchEvent&&this._wrapper.dispatchEvent(new CustomEvent("dm-form-trigger",{bubbles:!0,detail:{type:n.type,field:e.field,action:n}}))},l.prototype._celebrate=function(e){typeof window>"u"||typeof document>"u"||window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||import("/public/js/celebrations/index.js").then(function(n){const t=n.CelebrationsEffect;let r=e.theme||"auto";if(r==="auto"&&(r=t.getCurrentTheme(),!r))return;const i=new t({theme:r,intensity:e.intensity||"medium",enabled:!0,zIndex:999});i.init().then(function(){i.start()})}).catch(function(){})},l.prototype.submitBlock=function(){const e=this._triggerState&&this._triggerState.blocks||[];return{blocked:e.length>0,reasons:e.map(function(n){return n.message})}},{evaluateCondition:_,evaluateConditionGroup:h,evaluateFieldVisibility:v,evaluateFieldRequirement:w,validateField:k,collectValues:P,validateFields:H,getCascadeOptions:C,resolveTriggerState:D,resolveTriggerTargets:y,fillTriggerText:V,triggerTokens:ie,hasTriggers:W,TRIGGER_ACTION_KINDS:R,SERVER_TRIGGER_ACTIONS:Q,FIELD_TRANSITIONS:L,previewTransition:le,animateIn:oe,FormLogicRuntime:l}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyClasses as
|
|
1
|
+
import{applyClasses as a,cssClasses as b,cssClassProblems as l}from"./css-classes.mjs";export const SUBMIT_ALIGNS=["left","center","right","full"];export function resolveSubmitAlign(e,t){const n=e||{};return SUBMIT_ALIGNS.includes(n.submitAlign)?n.submitAlign:t==="grid"&&n.submitSpan==="full"?"left":""}export function submitWrapperClasses(e,t){const n=resolveSubmitAlign(e,t);if(!n)return[];const r=["fb-submit",`fb-submit--${n}`];return t==="grid"&&r.push("col-span-full"),r}export function applySubmitPosition(e,t,n){const r=e&&e.querySelector?e.querySelector(".form-buttons"):null;return r?(submitWrapperClasses(t,n).forEach(s=>r.classList.add(s)),r):null}export const BUTTON_STYLES=["primary","secondary","success","danger","warning","info","outline","outline-success","outline-danger","outline-warning","outline-info","ghost"],BUTTON_SIZES=["sm","lg"],SECONDARY_KINDS=["reset","link"];const y={sm:14,"":16,lg:20},m=/^[a-z0-9][a-z0-9-]{0,63}$/i;export function isIconName(e){return typeof e=="string"&&m.test(e)}export function isSafeButtonUrl(e){if(typeof e!="string")return!1;const t=e.trim();if(!t||t.length>2048||/[\u0000-\u0020\u007f-\u009f\u2028\u2029\\]/.test(t))return!1;const n=/^([a-z][a-z0-9+.-]*):/i.exec(t);return n?["http","https","mailto","tel"].includes(n[1].toLowerCase()):!0}export function resolveSubmitButton(e){const t=e&&e.submitButton&&typeof e.submitButton=="object"?e.submitButton:{};return{style:BUTTON_STYLES.includes(t.style)?t.style:"primary",size:BUTTON_SIZES.includes(t.size)?t.size:"",iconStart:isIconName(t.iconStart)?t.iconStart:"",iconEnd:isIconName(t.iconEnd)?t.iconEnd:""}}export function resolveSecondaryButton(e){const t=e&&e.secondaryButton;if(!t||typeof t!="object"||!SECONDARY_KINDS.includes(t.kind)||t.kind==="link"&&!isSafeButtonUrl(t.url))return null;const n=typeof t.label=="string"&&t.label.trim()?t.label.trim().slice(0,80):t.kind==="reset"?"Clear form":"Cancel";return{kind:t.kind,label:n,url:t.kind==="link"?t.url.trim():"",style:BUTTON_STYLES.includes(t.style)?t.style:"secondary",iconStart:isIconName(t.iconStart)?t.iconStart:"",iconEnd:isIconName(t.iconEnd)?t.iconEnd:"",first:t.first===!0,stack:t.stack===!0}}export function buttonClasses(e,t){const n=["btn","btn-"+(BUTTON_STYLES.includes(e)?e:"primary")];return BUTTON_SIZES.includes(t)&&n.push("btn-"+t),n}export function escapeHtml(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}export function buttonInnerHtml(e,t,n){const r=y[BUTTON_SIZES.includes(n)?n:""],s=(o,i)=>isIconName(o)?`<span class="fb-btn-icon fb-btn-icon--${i}" data-icon="${o}" data-icon-size="${r}" aria-hidden="true"></span>`:"",c=t||{};return s(c.iconStart,"start")+`<span class="fb-btn-label">${escapeHtml(e)}</span>`+s(c.iconEnd,"end")}export function secondaryButtonHtml(e,t){if(!e||!SECONDARY_KINDS.includes(e.kind))return"";const n=buttonClasses(e.style,t).concat("fb-btn","fb-secondary-btn","fb-secondary-btn--"+e.kind).join(" "),r=buttonInnerHtml(e.label,e,t);return e.kind==="reset"?`<button type="reset" class="${n}">${r}</button>`:isSafeButtonUrl(e.url)?`<a class="${n}" href="${escapeHtml(e.url.trim())}">${r}</a>`:""}export function pairWrapperClasses(e){const t=resolveSecondaryButton(e);return t?t.stack?["fb-submit--pair","fb-submit--stack"]:["fb-submit--pair"]:[]}function f(e){if(typeof window>"u"||!e)return;const t=window.Domma&&window.Domma.icons||window.I;t&&typeof t.scan=="function"&&t.scan(e)}export function decorateButton(e,t){return!e||!t||(t.style&&t.style!=="primary"&&BUTTON_STYLES.includes(t.style)&&(e.classList.remove("btn-primary"),e.classList.add("btn-"+t.style)),BUTTON_SIZES.includes(t.size)&&e.classList.add("btn-"+t.size),(isIconName(t.iconStart)||isIconName(t.iconEnd))&&e.tagName!=="INPUT"&&!e.querySelector(".fb-btn-label")&&(e.innerHTML=buttonInnerHtml(e.textContent.trim(),t,t.size),e.classList.add("fb-btn"))),e}export function applySubmitButtons(e,t,n){const r=applySubmitPosition(e,t,n);if(!r){const i=e&&e.querySelector?e.querySelector('button[type="submit"]'):null;return i&&(decorateButton(i,resolveSubmitButton(t)),f(i)),null}const s=r.querySelector('button[type="submit"], input[type="submit"]');if(!s)return r;const c=resolveSubmitButton(t);decorateButton(s,c);const o=resolveSecondaryButton(t);if(o&&!r.querySelector(".fb-secondary-btn")){const i=r.ownerDocument.createElement("template");i.innerHTML=secondaryButtonHtml(o,c.size);const u=i.content.firstElementChild;u&&(s.parentNode.insertBefore(u,o.first?s:s.nextSibling),pairWrapperClasses(t).forEach(p=>r.classList.add(p)),o.kind==="reset"&&wireFormReset(s.form||r.closest("form")))}return f(r),r}export function applyWizardButtons(e,t){const n=e&&e.querySelector?e.querySelector(".wizard-nav"):null;if(!n)return null;const r=resolveSubmitButton(t),s=n.querySelector(".wizard-prev");s&&r.size&&s.classList.add("btn-"+r.size);const c=n.querySelector(".wizard-next");c&&decorateButton(c,{style:r.style,size:r.size,iconStart:"",iconEnd:""});const o=n.querySelector(".wizard-submit");return o&&decorateButton(o,r),f(n),n}const S='input:not([type="hidden"]):not([type="submit"]):not([type="reset"]):not([type="button"]), select, textarea';function d(e){return Array.from(e.querySelectorAll(S)).filter(t=>!(t.closest&&t.closest(".fb-form-honeypot")))}export function formHasAnswers(e){return d(e).some(t=>t.type==="checkbox"||t.type==="radio"?t.checked!==t.defaultChecked:t.tagName==="SELECT"?Array.from(t.options).some(n=>n.selected!==n.defaultSelected):t.value!==t.defaultValue)}function h(e){d(e).forEach(t=>{t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}),e.querySelectorAll(".fb-field-invalid").forEach(t=>t.classList.remove("fb-field-invalid")),e.querySelectorAll("[data-error-for]").forEach(t=>{t.textContent="",t.style.display="none",t.parentElement&&t.parentElement.classList.remove("has-error")})}export function wireFormReset(e){if(!e||e.__fbResetWired)return;e.__fbResetWired=!0;let t=!1;e.addEventListener("reset",n=>{const r=typeof window<"u"?window.E:null;if(!t&&r&&typeof r.confirm=="function"&&formHasAnswers(e)){n.preventDefault(),Promise.resolve(r.confirm("Clear everything you have entered in this form?")).then(s=>{s&&(t=!0,e.reset(),t=!1)});return}setTimeout(()=>h(e),0)})}export function buttonSettingsProblems(e){const t=e&&e.secondaryButton;return!t||typeof t!="object"||t.kind!=="link"?[]:typeof t.url!="string"||!t.url.trim()?["The Cancel button needs an address to go to."]:isSafeButtonUrl(t.url)?[]:["The Cancel button's address must be a page on this site (/contact) or a full http(s), mailto or tel address."]}export function publicButtonSettings(e){if(!e||typeof e!="object")return e;const t=e.secondaryButton;if(t&&typeof t=="object"&&t.kind==="link"&&!isSafeButtonUrl(t.url)){const{secondaryButton:n,...r}=e;return r}return e}export function applyFormEntrance(e,t){const n=t&&typeof t=="object"?t:{},r=n.entrance;if(!e||!e.dataset||!r||r==="none"||e.dataset.fbEntered)return;const s=typeof window<"u"?window.FormLogicEngine:null;if(!s||typeof s.animateIn!="function"||!(s.FIELD_TRANSITIONS||[]).some(i=>i.value===r)||window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;e.dataset.fbEntered="1";const c=()=>{e.style.visibility="",s.animateIn(e,r,n.entranceDuration)};if(typeof IntersectionObserver!="function")return c();e.style.visibility="hidden";const o=new IntersectionObserver(i=>{i.some(u=>u.isIntersecting)&&(o.disconnect(),c())},{rootMargin:"0px 0px -10% 0px",threshold:0});o.observe(e)}export function formClassProblems(e,t){const n=[],r=e&&typeof e=="object"?e:{};for(const s of l(r.class))n.push(`Form CSS classes: ${s}.`);for(const s of l(r.submitClass))n.push(`Submit button CSS classes: ${s}.`);for(const s of Array.isArray(t)?t:[])if(!(!s||typeof s!="object"))for(const c of l(s.class))n.push(`CSS classes on "${s.label||s.name||s.type}": ${c}.`);return n}export function applyFormClasses(e,t,n){if(!e||!e.querySelector)return null;const r=t&&typeof t=="object"?t:{},s=e.matches&&e.matches("form")?e:e.querySelector("form");s&&a(s,r.class);const c=e;r.submitClass&&c.querySelectorAll('button[type="submit"], input[type="submit"], .wizard-submit').forEach(i=>a(i,r.submitClass));const o=new Map;for(const i of Array.isArray(n)?n:[])i&&i.name&&b(i.class).length&&o.set(i.name,i.class);return o.size&&c.querySelectorAll("[data-field]").forEach(i=>{o.has(i.dataset.field)&&a(i,o.get(i.dataset.field))}),s}
|
package/public/js/forms.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{installSmoothCarets as
|
|
2
|
-
`).replace(/<[^>]+>/g,""))}function A(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function q(n,o){let t=!1;n.addEventListener("dm-form-end",function(e){const i=e.detail&&e.detail.validation;if(i&&!i.valid){markInvalidFields(n,i.missing),showValidationPopup(i);return}t||(t=!0,n.classList.add("fb-form-loading"),Promise.resolve(o(e.detail&&e.detail.values||{})).catch(function(){}).finally(function(){t=!1,n.classList.remove("fb-form-loading")}))})}function x(n,o,t){const e=n.querySelector(".fb-form-success, .fb-form-error");e&&e.remove();const i=document.createElement("div");i.className=t==="success"?"fb-form-success":"fb-form-error",i.textContent=o,n.appendChild(i)}function P(n,o){if(n._formLogicRuntime=o,n._formLogicObserver&&(n._formLogicObserver.disconnect(),n._formLogicObserver=null),!n.parentNode||typeof MutationObserver>"u"||n._formLogicObserved)return;n._formLogicObserved=!0;const t=new MutationObserver(function(e){for(const i of e)for(const r of i.removedNodes)if(r===n||r.nodeType===1&&r.contains&&r.contains(n)){n._formLogicRuntime&&n._formLogicRuntime.destroy(),t.disconnect();return}});t.observe(n.parentNode,{childList:!0,subtree:!1}),n._formLogicObserver=t}function ae(n){const o=n&&n.logic;return!!(o&&(o.visibility||o.requirement))}function z(n,o){const t={};return n.forEach(function(e){if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const i=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),r=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":i?"chooser":e.type,d={...e.formConfig||{}};d.span==="full"&&o&&(d.span=o);const s={type:r,label:e.label||e.name,required:ae(e)?!1:e.required||!1,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{helperText:e.helper},...e.tooltip&&{tooltip:e.tooltip},...d}};e.minLength!==void 0&&(s.minLength=e.minLength),e.maxLength!==void 0&&(s.maxLength=e.maxLength),e.min!==void 0&&(s.min=e.min),e.max!==void 0&&(s.max=e.max),i&&(e.variant&&(s.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(s.multiple=!0),e.density&&(s.density=e.density),e.columns&&(s.columns=e.columns),e.accent&&(s.accent=e.accent),e.accentStyle&&(s.accentStyle=e.accentStyle),e.glow&&(s.glow=!0),e.glowColour&&(s.glowColour=e.glowColour),e.shadow&&(s.shadow=e.shadow),e.shadowColour&&(s.shadowColour=e.shadowColour)),t[e.name]=e.type==="file"?ee(e,s):s}),t}function se(n){const o={};return n.forEach(function(t){if(!(!t.name||t.type==="page-break"||t.type==="spacer")&&(t.type==="select"||t.type==="multiselect")&&t.required){const e=(t.options||[])[0];e&&(o[t.name]=typeof e=="object"?e.value:e)}}),o}function O(n,o){(o||[]).forEach(function(t){if(t.type!=="date"||!t.name)return;const e=n.querySelector('[name="'+t.name+'"]');e&&e.type!=="date"&&(e.type="date")})}const D="padding:.45rem .7rem;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);background:transparent;color:inherit;cursor:pointer;font:inherit;font-size:.85em;flex-shrink:0;line-height:1.2;";function M(n){const o=document.createElement("div");o.style.cssText="position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:20px;";const t=document.createElement("div");t.style.cssText="background:var(--dm-surface-overlay,var(--dm-surface));color:var(--dm-text);border:1px solid var(--dm-border);border-radius:10px;width:100%;max-width:560px;max-height:75vh;display:flex;flex-direction:column;gap:.6rem;padding:1rem;box-shadow:var(--dm-shadow-lg,0 12px 40px rgba(0,0,0,.35));";const e=document.createElement("div");e.style.cssText="display:flex;align-items:center;justify-content:space-between;gap:.5rem;";const i=document.createElement("strong");i.textContent=n;const r=document.createElement("button");r.type="button",r.textContent="\xD7",r.setAttribute("aria-label","Close"),r.style.cssText=D+"font-size:1rem;padding:.15rem .55rem;",e.appendChild(i),e.appendChild(r),t.appendChild(e);const d=document.createElement("div");d.style.cssText="display:flex;flex-direction:column;gap:.6rem;overflow:hidden;min-height:0;",t.appendChild(d),o.appendChild(t);const s=l=>{l.key==="Escape"&&a()};function a(){document.removeEventListener("keydown",s),o.remove()}return r.addEventListener("click",a),o.addEventListener("click",l=>{l.target===o&&a()}),document.addEventListener("keydown",s),document.body.appendChild(o),{body:d,close:a}}function ce(n){const{body:o,close:t}=M("Choose an icon"),e=document.createElement("input");e.type="text",e.placeholder="Search icons\u2026",e.className="form-input",e.style.cssText="padding:.45rem .6rem;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);background:var(--dm-input-bg,transparent);color:var(--dm-text);",o.appendChild(e);const i=document.createElement("div");i.style.cssText="display:grid;grid-template-columns:repeat(auto-fill,minmax(46px,1fr));gap:4px;overflow-y:auto;min-height:0;",o.appendChild(i);const r=window.I&&typeof I.list=="function"?I.list():[],d=r.map(s=>{const a=document.createElement("button");a.type="button",a.title=s,a.dataset.iconName=s,a.style.cssText="display:flex;align-items:center;justify-content:center;padding:.55rem 0;border:1px solid transparent;border-radius:6px;background:transparent;color:inherit;cursor:pointer;";const l=document.createElement("span");return l.setAttribute("data-icon",s),l.setAttribute("data-icon-size","18"),a.appendChild(l),a.addEventListener("mouseenter",()=>{a.style.borderColor="var(--dm-border)"}),a.addEventListener("mouseleave",()=>{a.style.borderColor="transparent"}),a.addEventListener("click",()=>{t(),n(s)}),i.appendChild(a),a});if(!r.length){const s=document.createElement("p");s.textContent="Icon engine unavailable - type an icon name into the field instead.",i.appendChild(s)}window.I?.scan?.(i),e.addEventListener("input",()=>{const s=e.value.trim().toLowerCase();d.forEach(a=>{a.style.display=!s||a.dataset.iconName.includes(s)?"":"none"})}),e.focus()}async function le(){const n=typeof S<"u"&&S.get?S.get("auth_token"):null;if(!n)return{error:"auth"};const o=i=>fetch("/api/media",{headers:{Authorization:"Bearer "+i}});let t;try{if(t=await o(n),t.status===401&&S.get("auth_refresh_token")){const i=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:S.get("auth_refresh_token")})});if(i.ok){const{token:r}=await i.json();S.set("auth_token",r),t=await o(r)}}}catch{return{error:"load"}}if(!t.ok)return{error:t.status===401||t.status===403?"auth":"load"};const e=await t.json().catch(()=>[]);return{files:(Array.isArray(e)?e:[]).filter(i=>/\.(png|jpe?g|gif|webp|svg|avif)$/i.test(i.name||i.url||""))}}function ue(n){const{body:o,close:t}=M("Choose an image"),e=document.createElement("p");e.textContent="Loading media library\u2026",e.style.cssText="margin:0;font-size:.85em;color:var(--dm-text-muted);",o.appendChild(e),le().then(({files:i,error:r})=>{if(r){e.textContent=r==="auth"?"Sign in with media access to browse the library - or paste an image URL into the field.":"Could not load the media library - paste an image URL into the field instead.";return}if(!i.length){e.textContent="No images in the media library yet.";return}e.remove();const d=document.createElement("div");d.style.cssText="display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:8px;overflow-y:auto;min-height:0;",i.forEach(s=>{const a=document.createElement("button");a.type="button",a.title=s.name||s.url,a.style.cssText="display:flex;flex-direction:column;gap:.25rem;padding:.35rem;border:1px solid var(--dm-border);border-radius:8px;background:transparent;color:inherit;cursor:pointer;min-width:0;";const l=document.createElement("img");l.src=s.url,l.alt=s.name||"",l.loading="lazy",l.style.cssText="width:100%;height:72px;object-fit:cover;border-radius:5px;";const h=document.createElement("span");h.textContent=s.name||s.url,h.style.cssText="font-size:.68em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",a.appendChild(l),a.appendChild(h),a.addEventListener("click",()=>{t(),n(s.url)}),d.appendChild(a)}),o.appendChild(d)})}function V(n,o){n.value=o,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}function W(n){const o=document.createElement("div");return o.style.cssText="display:flex;align-items:center;gap:.5rem;",n.parentNode.insertBefore(o,n),o.appendChild(n),n.style.flex="1",n.style.minWidth="0",o}function U(n){const o=document.createElement("button");return o.type="button",o.textContent=n,o.style.cssText=D,o}function de(n){if(!window.I||typeof I.list!="function")return;const o=W(n),t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;flex-shrink:0;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);";const e=()=>{t.textContent="";const r=n.value.trim();if(!r)return;const d=document.createElement("span");d.setAttribute("data-icon",r),d.setAttribute("data-icon-size","16"),t.appendChild(d),window.I?.scan?.(t)};n.addEventListener("input",e),e();const i=U("Browse");i.addEventListener("click",()=>ce(r=>{V(n,r),e()})),o.appendChild(t),o.appendChild(i)}function me(n){const o=W(n),t=document.createElement("img");t.alt="",t.style.cssText="width:2rem;height:2rem;flex-shrink:0;object-fit:cover;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);display:none;";const e=()=>{const r=n.value.trim();t.style.display=r?"":"none",r&&(t.src=r)};n.addEventListener("input",e),e();const i=U("Browse");i.addEventListener("click",()=>ue(r=>{V(n,r),e()})),o.appendChild(t),o.appendChild(i)}export function enhancePickerFields(n,o){const t=typeof n=="string"?document.querySelector(n):n;t&&(o||[]).forEach(function(e){if(!e.name||e.type!=="icon"&&e.type!=="image")return;const i=t.querySelector('[name="'+e.name+'"]');!i||i.dataset.pickerEnhanced||(i.dataset.pickerEnhanced="1",e.type==="icon"?de(i):me(i))})}function N(n,o){const t=document.createElement("div");t.className="fb-form-honeypot",t.setAttribute("aria-hidden","true");const e=document.createElement("input");e.name=n.querySelector('[name="website"]')?"_website":"website",t.dataset.hpName=e.name,e.type="text",e.tabIndex=-1,e.autocomplete="url",e.placeholder="https://",t.appendChild(e);const i=document.createElement("input");i.name="_t",i.type="hidden",i.value=o||Date.now(),t.appendChild(i),n.appendChild(t)}function H(n,o){const t=n.querySelector("form");if(!t)return;const e=Array.from(t.querySelectorAll(".form-group"));let i=0;o.forEach(function(r){if(r.type==="spacer"){const d=document.createElement("div");d.className="fb-spacer";const s=e[i];if(s)t.insertBefore(d,s);else{const a=t.querySelector('[type="submit"]');a?t.insertBefore(d,a):t.appendChild(d)}}else r.type!=="page-break"&&i++})}function C(n,o,t,e,i,r,d){const s=i||e,a=s.querySelector(".fb-form-honeypot"),l=a?.querySelector('input[type="text"]')?.value||"",h=a?.querySelector('[name="_t"]')?.value||"",u=Object.assign({},o);delete u._t,a?.dataset.hpName&&delete u[a.dataset.hpName];const c=new Map(r||[]);L(s,c);const f=ne(u,d,c),p=re(e,f.files);if(p)return x(e,p,"error"),Promise.resolve();const{body:w,headers:b}=oe(Object.assign(f.values,{_hp:l,_t:h}),f.files);return fetch("/api/forms/submit/"+n,{method:"POST",headers:b,body:w}).then(y=>y.json().then(v=>({ok:y.ok,body:v}))).then(y=>{y.ok&&y.body.ok?(X(e),e.textContent="",x(e,y.body.message||t.successMessage||"Thank you.","success")):x(e,y.body.error||"Something went wrong.","error")}).catch(()=>{x(e,"Unable to submit. Please check your connection.","error")})}function pe(n,o,t,e,i){const r=document.createElement("form");r.noValidate=!0,o.forEach(function(a){const l=document.createElement("div");l.className="form-group",l.style.marginBottom="1.25rem",a.name&&(l.dataset.field=a.name);const h=document.createElement("label");if(h.className="form-label",h.textContent=a.label||a.name,a.required){const c=document.createElement("span");c.textContent=" *",c.style.color="var(--dm-danger)",h.appendChild(c)}let u;a.type==="textarea"?(u=document.createElement("textarea"),u.rows=a.formConfig?.rows||4,u.className="form-input"):a.type==="select"?(u=document.createElement("select"),u.className="form-input",(a.options||[]).forEach(function(c){const f=document.createElement("option");f.value=typeof c=="string"?c:c.value??"",f.textContent=typeof c=="string"?c:c.label||f.value,u.appendChild(f)})):(u=document.createElement("input"),u.type=a.type==="icon"||a.type==="image"?"text":a.type||"text",u.className="form-input",a.placeholder&&(u.placeholder=a.placeholder),a.type==="file"&&(a.file?.accept&&(u.accept=a.file.accept),a.multiple&&(u.multiple=!0))),u.name=a.name,u.required=a.required||!1,l.appendChild(h),l.appendChild(u),r.appendChild(l)}),t.honeypot&&N(r);const d=document.createElement("button");if(d.type="submit",d.className="btn btn-primary",d.textContent=t.submitText||"Submit",G(t,"stacked").length||$(t)){const a=document.createElement("div");a.className="form-group form-buttons",a.appendChild(d),r.appendChild(a)}else r.appendChild(d);if(r.addEventListener("submit",function(a){a.preventDefault();const l={};if(o.forEach(function(u){const c=r.querySelector('[name="'+u.name+'"]');c&&(l[u.name]=c.value)}),window.FormLogicEngine&&i){const u=window.FormLogicEngine,c=[],f=[];if(o.forEach(function(p){if(u.evaluateFieldVisibility(p,l)==="hidden"){delete l[p.name];return}const b=u.evaluateFieldRequirement(p,l),y=l[p.name];b&&(!y||!String(y).trim())&&c.push(p.label||p.name);const v=u.validateField(p,y||"",l);v.length&&f.push(v[0].message)}),c.length||f.length){const p=[];c.length&&p.push("Required: "+c.join(", ")),f.length&&p.push(f.join("; ")),x(n,p.join(". "),"error");return}}const h=Q(r,o);if(h.length){x(n,h.join(" "),"error");return}if(n.dataset.triggerBlocked==="true"){const u=n._formLogicRuntime,c=u&&u.submitBlock?u.submitBlock().reasons:[];x(n,c.join(" ")||"This form cannot be submitted yet.","error");return}n.classList.add("fb-form-loading"),d.disabled=!0,C(e,l,t,n,r,null,o).finally(function(){n.classList.remove("fb-form-loading"),d.disabled=!1})}),n.appendChild(r),_(r,t,"stacked"),F(r,t,o),enhancePickerFields(n,o),Z(n,o),q(n,function(a){return C(e,a,t,n,r,null,o)}),window.FormLogicEngine&&i&&T(o)){const a=new window.FormLogicEngine.FormLogicRuntime(i,n);a.init(),n._formLogicRuntime=a}}function fe(n){const o=n.getAttribute("data-form");o&&fetch("/api/forms/"+o+"/public").then(t=>{if(!t.ok)throw new Error("Form not found: "+o);return t.json()}).then(t=>{const e=t.fields||[],i=t.settings||{},r=document.createElement("div");r.className="fb-form-wrapper",n.appendChild(r),j(r,t.fileLimits);const d=e.some(s=>s.type==="page-break");if(typeof Domma<"u"&&Domma.forms){const s=Number(i.columns)===3?3:2,a=i.layout||"grid";if(d&&Domma.forms.wizard){const l=J(e,t.title),h=l.map(m=>m.fields),u=l.map(function(m){return{title:m.title,description:m.description,fields:z(m.fields,s)}});let c=0,f=null,p=null;const w=Date.now(),b=new Map;j(r,t.fileLimits,b),B(r,e);const y=function(m){const g=window.FormLogicEngine;if(!g||!g.validateFields)return;const k=g.validateFields(r,h[c]||[]);k.valid||(m.preventDefault(),m.stopImmediatePropagation(),markInvalidFields(r,k.missing),showValidationPopup(k))},v=function(){const m=h[c]||e;if(Y(r,i),F(r,i,m),O(r,m),enhancePickerFields(r,m),te(r,b),m.some(g=>g.type==="spacer")&&H(r,m),i.honeypot){const g=r.querySelector("form");g&&N(g,w)}window.FormLogicEngine&&T(e)&&(f&&f.destroy(),f=new window.FormLogicEngine.FormLogicRuntime(t,r,{baseValues:p&&p.getStepData?p.getStepData():{}}),f.init(),P(r,f)),r.querySelectorAll(".wizard-next, .wizard-submit").forEach(g=>g.addEventListener("click",y,!0))};p=Domma.forms.wizard(r,{schema:{steps:u},layout:a,columns:s,finishText:i.submitText||"Finish",onStepChange:function(m){L(r,b),c=m,setTimeout(v,0)},onSubmit:function(m){return L(r,b),C(o,m,i,r,null,b,e)}}),q(r,function(m){return L(r,b),C(o,m,i,r,null,b,e)}),r.addEventListener("dm-form-trigger",function(m){if(!m.detail||m.detail.type!=="goto-step"||!p||!p.goToStep)return;const g=Number(m.detail.action.step);!isFinite(g)||g<0||g>=u.length||g!==c&&p.goToStep(g)}),Promise.resolve(p).then(v)}else if(Domma.forms.render){const l=z(e,s),h=se(e);B(r,e),q(r,function(c){return C(o,c,i,r,null,null,e)});const u=Domma.forms.render(r,l,h,{submitText:i.submitText||"Submit",layout:a,columns:s,onSubmit:function(c){return C(o,c,i,r,null,null,e)}});Promise.resolve(u).then(function(){if(_(r,i,a),F(r,i,e),O(r,e),enhancePickerFields(r,e),window.FormLogicEngine&&T(e)){const c=new window.FormLogicEngine.FormLogicRuntime(t,r);c.init(),P(r,c)}if(e.some(c=>c.type==="spacer")&&H(r,e),i.honeypot){const c=r.querySelector("form");c&&N(c)}})}}else pe(r,e.filter(s=>s.type!=="page-break"&&s.type!=="spacer"),i,o,t)}).catch(t=>{const e=document.createElement("p");e.textContent="Form unavailable.",e.style.cssText="color:var(--dm-danger);font-style:italic;",n.appendChild(e),console.warn("[forms]",t.message)})}
|
|
1
|
+
import{installSmoothCarets as J}from"/public/js/smooth-caret.js";import{buildWizardSteps as Y}from"/public/js/form-steps.mjs";import{applyFormClasses as F,applyFormEntrance as T,applySubmitButtons as j,applyWizardButtons as $,resolveSecondaryButton as G,submitWrapperClasses as Q}from"/public/js/form-submit.mjs";import{captureFileFields as L,checkFileInputs as X,destroyDropzones as Z,enhanceFileInputs as ee,fileBlueprint as te,restoreFileFields as ne,setFileLimits as B,splitFiles as oe,submitBody as re,totalTooLarge as ie,wireFileFields as R}from"/public/js/form-files.mjs";J(document);const A=document.querySelectorAll("[data-form]");A.length&&A.forEach(he);function q(n){return(n||[]).some(r=>r.logic||Array.isArray(r.triggers)&&r.triggers.length)}function ae(n,r){const t=n.querySelector('[name="'+r+'"], [name="'+r+'[]"]')||n.querySelector('[data-chooser-field="'+r+'"]');if(!t)return null;const e=t.closest("form")||n;let i=t;for(;i.parentNode&&i.parentNode!==e;)i=i.parentNode;return i}export function markInvalidFields(n,r){n.querySelectorAll(".fb-field-invalid").forEach(e=>e.classList.remove("fb-field-invalid"));let t=null;(r||[]).forEach(function(e){const i=ae(n,e.name);i&&(i.classList.add("fb-field-invalid"),t||(t=i))}),t&&t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center"})}export function showValidationPopup(n){const r=(n.missing||[]).map(e=>"<strong>"+P(e.label)+"</strong> is required.").concat((n.errors||[]).map(P)),t=r.join("<br>");if(typeof E<"u"&&E.alert){E.alert(t,{title:"Please complete this step"});return}window.alert(r.join(`
|
|
2
|
+
`).replace(/<[^>]+>/g,""))}function P(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function N(n,r){let t=!1;n.addEventListener("dm-form-end",function(e){const i=e.detail&&e.detail.validation;if(i&&!i.valid){markInvalidFields(n,i.missing),showValidationPopup(i);return}t||(t=!0,n.classList.add("fb-form-loading"),Promise.resolve(r(e.detail&&e.detail.values||{})).catch(function(){}).finally(function(){t=!1,n.classList.remove("fb-form-loading")}))})}function x(n,r,t){const e=n.querySelector(".fb-form-success, .fb-form-error");e&&e.remove();const i=document.createElement("div");i.className=t==="success"?"fb-form-success":"fb-form-error",i.textContent=r,n.appendChild(i)}function z(n,r){if(n._formLogicRuntime=r,n._formLogicObserver&&(n._formLogicObserver.disconnect(),n._formLogicObserver=null),!n.parentNode||typeof MutationObserver>"u"||n._formLogicObserved)return;n._formLogicObserved=!0;const t=new MutationObserver(function(e){for(const i of e)for(const o of i.removedNodes)if(o===n||o.nodeType===1&&o.contains&&o.contains(n)){n._formLogicRuntime&&n._formLogicRuntime.destroy(),t.disconnect();return}});t.observe(n.parentNode,{childList:!0,subtree:!1}),n._formLogicObserver=t}function se(n){const r=n&&n.logic;return!!(r&&(r.visibility||r.requirement))}function O(n,r){const t={};return n.forEach(function(e){if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const i=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),o=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":i?"chooser":e.type,d={...e.formConfig||{}};d.span==="full"&&r&&(d.span=r);const s={type:o,label:e.label||e.name,required:se(e)?!1:e.required||!1,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{helperText:e.helper},...e.tooltip&&{tooltip:e.tooltip},...d}};e.minLength!==void 0&&(s.minLength=e.minLength),e.maxLength!==void 0&&(s.maxLength=e.maxLength),e.min!==void 0&&(s.min=e.min),e.max!==void 0&&(s.max=e.max),i&&(e.variant&&(s.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(s.multiple=!0),e.density&&(s.density=e.density),e.columns&&(s.columns=e.columns),e.accent&&(s.accent=e.accent),e.accentStyle&&(s.accentStyle=e.accentStyle),e.glow&&(s.glow=!0),e.glowColour&&(s.glowColour=e.glowColour),e.shadow&&(s.shadow=e.shadow),e.shadowColour&&(s.shadowColour=e.shadowColour)),t[e.name]=e.type==="file"?te(e,s):s}),t}function ce(n){const r={};return n.forEach(function(t){if(!(!t.name||t.type==="page-break"||t.type==="spacer")&&(t.type==="select"||t.type==="multiselect")&&t.required){const e=(t.options||[])[0];e&&(r[t.name]=typeof e=="object"?e.value:e)}}),r}function D(n,r){(r||[]).forEach(function(t){if(t.type!=="date"||!t.name)return;const e=n.querySelector('[name="'+t.name+'"]');e&&e.type!=="date"&&(e.type="date")})}const M="padding:.45rem .7rem;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);background:transparent;color:inherit;cursor:pointer;font:inherit;font-size:.85em;flex-shrink:0;line-height:1.2;";function V(n){const r=document.createElement("div");r.style.cssText="position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:20px;";const t=document.createElement("div");t.style.cssText="background:var(--dm-surface-overlay,var(--dm-surface));color:var(--dm-text);border:1px solid var(--dm-border);border-radius:10px;width:100%;max-width:560px;max-height:75vh;display:flex;flex-direction:column;gap:.6rem;padding:1rem;box-shadow:var(--dm-shadow-lg,0 12px 40px rgba(0,0,0,.35));";const e=document.createElement("div");e.style.cssText="display:flex;align-items:center;justify-content:space-between;gap:.5rem;";const i=document.createElement("strong");i.textContent=n;const o=document.createElement("button");o.type="button",o.textContent="\xD7",o.setAttribute("aria-label","Close"),o.style.cssText=M+"font-size:1rem;padding:.15rem .55rem;",e.appendChild(i),e.appendChild(o),t.appendChild(e);const d=document.createElement("div");d.style.cssText="display:flex;flex-direction:column;gap:.6rem;overflow:hidden;min-height:0;",t.appendChild(d),r.appendChild(t);const s=l=>{l.key==="Escape"&&a()};function a(){document.removeEventListener("keydown",s),r.remove()}return o.addEventListener("click",a),r.addEventListener("click",l=>{l.target===r&&a()}),document.addEventListener("keydown",s),document.body.appendChild(r),{body:d,close:a}}function le(n){const{body:r,close:t}=V("Choose an icon"),e=document.createElement("input");e.type="text",e.placeholder="Search icons\u2026",e.className="form-input",e.style.cssText="padding:.45rem .6rem;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);background:var(--dm-input-bg,transparent);color:var(--dm-text);",r.appendChild(e);const i=document.createElement("div");i.style.cssText="display:grid;grid-template-columns:repeat(auto-fill,minmax(46px,1fr));gap:4px;overflow-y:auto;min-height:0;",r.appendChild(i);const o=window.I&&typeof I.list=="function"?I.list():[],d=o.map(s=>{const a=document.createElement("button");a.type="button",a.title=s,a.dataset.iconName=s,a.style.cssText="display:flex;align-items:center;justify-content:center;padding:.55rem 0;border:1px solid transparent;border-radius:6px;background:transparent;color:inherit;cursor:pointer;";const l=document.createElement("span");return l.setAttribute("data-icon",s),l.setAttribute("data-icon-size","18"),a.appendChild(l),a.addEventListener("mouseenter",()=>{a.style.borderColor="var(--dm-border)"}),a.addEventListener("mouseleave",()=>{a.style.borderColor="transparent"}),a.addEventListener("click",()=>{t(),n(s)}),i.appendChild(a),a});if(!o.length){const s=document.createElement("p");s.textContent="Icon engine unavailable - type an icon name into the field instead.",i.appendChild(s)}window.I?.scan?.(i),e.addEventListener("input",()=>{const s=e.value.trim().toLowerCase();d.forEach(a=>{a.style.display=!s||a.dataset.iconName.includes(s)?"":"none"})}),e.focus()}async function ue(){const n=typeof S<"u"&&S.get?S.get("auth_token"):null;if(!n)return{error:"auth"};const r=i=>fetch("/api/media",{headers:{Authorization:"Bearer "+i}});let t;try{if(t=await r(n),t.status===401&&S.get("auth_refresh_token")){const i=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:S.get("auth_refresh_token")})});if(i.ok){const{token:o}=await i.json();S.set("auth_token",o),t=await r(o)}}}catch{return{error:"load"}}if(!t.ok)return{error:t.status===401||t.status===403?"auth":"load"};const e=await t.json().catch(()=>[]);return{files:(Array.isArray(e)?e:[]).filter(i=>/\.(png|jpe?g|gif|webp|svg|avif)$/i.test(i.name||i.url||""))}}function de(n){const{body:r,close:t}=V("Choose an image"),e=document.createElement("p");e.textContent="Loading media library\u2026",e.style.cssText="margin:0;font-size:.85em;color:var(--dm-text-muted);",r.appendChild(e),ue().then(({files:i,error:o})=>{if(o){e.textContent=o==="auth"?"Sign in with media access to browse the library - or paste an image URL into the field.":"Could not load the media library - paste an image URL into the field instead.";return}if(!i.length){e.textContent="No images in the media library yet.";return}e.remove();const d=document.createElement("div");d.style.cssText="display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:8px;overflow-y:auto;min-height:0;",i.forEach(s=>{const a=document.createElement("button");a.type="button",a.title=s.name||s.url,a.style.cssText="display:flex;flex-direction:column;gap:.25rem;padding:.35rem;border:1px solid var(--dm-border);border-radius:8px;background:transparent;color:inherit;cursor:pointer;min-width:0;";const l=document.createElement("img");l.src=s.url,l.alt=s.name||"",l.loading="lazy",l.style.cssText="width:100%;height:72px;object-fit:cover;border-radius:5px;";const h=document.createElement("span");h.textContent=s.name||s.url,h.style.cssText="font-size:.68em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",a.appendChild(l),a.appendChild(h),a.addEventListener("click",()=>{t(),n(s.url)}),d.appendChild(a)}),r.appendChild(d)})}function W(n,r){n.value=r,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}function U(n){const r=document.createElement("div");return r.style.cssText="display:flex;align-items:center;gap:.5rem;",n.parentNode.insertBefore(r,n),r.appendChild(n),n.style.flex="1",n.style.minWidth="0",r}function H(n){const r=document.createElement("button");return r.type="button",r.textContent=n,r.style.cssText=M,r}function me(n){if(!window.I||typeof I.list!="function")return;const r=U(n),t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;flex-shrink:0;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);";const e=()=>{t.textContent="";const o=n.value.trim();if(!o)return;const d=document.createElement("span");d.setAttribute("data-icon",o),d.setAttribute("data-icon-size","16"),t.appendChild(d),window.I?.scan?.(t)};n.addEventListener("input",e),e();const i=H("Browse");i.addEventListener("click",()=>le(o=>{W(n,o),e()})),r.appendChild(t),r.appendChild(i)}function pe(n){const r=U(n),t=document.createElement("img");t.alt="",t.style.cssText="width:2rem;height:2rem;flex-shrink:0;object-fit:cover;border:1px solid var(--dm-border);border-radius:var(--dm-radius-md,6px);display:none;";const e=()=>{const o=n.value.trim();t.style.display=o?"":"none",o&&(t.src=o)};n.addEventListener("input",e),e();const i=H("Browse");i.addEventListener("click",()=>de(o=>{W(n,o),e()})),r.appendChild(t),r.appendChild(i)}export function enhancePickerFields(n,r){const t=typeof n=="string"?document.querySelector(n):n;t&&(r||[]).forEach(function(e){if(!e.name||e.type!=="icon"&&e.type!=="image")return;const i=t.querySelector('[name="'+e.name+'"]');!i||i.dataset.pickerEnhanced||(i.dataset.pickerEnhanced="1",e.type==="icon"?me(i):pe(i))})}function _(n,r){const t=document.createElement("div");t.className="fb-form-honeypot",t.setAttribute("aria-hidden","true");const e=document.createElement("input");e.name=n.querySelector('[name="website"]')?"_website":"website",t.dataset.hpName=e.name,e.type="text",e.tabIndex=-1,e.autocomplete="url",e.placeholder="https://",t.appendChild(e);const i=document.createElement("input");i.name="_t",i.type="hidden",i.value=r||Date.now(),t.appendChild(i),n.appendChild(t)}function K(n,r){const t=n.querySelector("form");if(!t)return;const e=Array.from(t.querySelectorAll(".form-group"));let i=0;r.forEach(function(o){if(o.type==="spacer"){const d=document.createElement("div");d.className="fb-spacer";const s=e[i];if(s)t.insertBefore(d,s);else{const a=t.querySelector('[type="submit"]');a?t.insertBefore(d,a):t.appendChild(d)}}else o.type!=="page-break"&&i++})}function C(n,r,t,e,i,o,d){const s=i||e,a=s.querySelector(".fb-form-honeypot"),l=a?.querySelector('input[type="text"]')?.value||"",h=a?.querySelector('[name="_t"]')?.value||"",u=Object.assign({},r);delete u._t,a?.dataset.hpName&&delete u[a.dataset.hpName];const c=new Map(o||[]);L(s,c);const f=oe(u,d,c),p=ie(e,f.files);if(p)return x(e,p,"error"),Promise.resolve();const{body:w,headers:b}=re(Object.assign(f.values,{_hp:l,_t:h}),f.files);return fetch("/api/forms/submit/"+n,{method:"POST",headers:b,body:w}).then(y=>y.json().then(v=>({ok:y.ok,body:v}))).then(y=>{y.ok&&y.body.ok?(Z(e),e.textContent="",x(e,y.body.message||t.successMessage||"Thank you.","success")):x(e,y.body.error||"Something went wrong.","error")}).catch(()=>{x(e,"Unable to submit. Please check your connection.","error")})}function fe(n,r,t,e,i){const o=document.createElement("form");o.noValidate=!0,r.forEach(function(a){const l=document.createElement("div");l.className="form-group",l.style.marginBottom="1.25rem",a.name&&(l.dataset.field=a.name);const h=document.createElement("label");if(h.className="form-label",h.textContent=a.label||a.name,a.required){const c=document.createElement("span");c.textContent=" *",c.style.color="var(--dm-danger)",h.appendChild(c)}let u;a.type==="textarea"?(u=document.createElement("textarea"),u.rows=a.formConfig?.rows||4,u.className="form-input"):a.type==="select"?(u=document.createElement("select"),u.className="form-input",(a.options||[]).forEach(function(c){const f=document.createElement("option");f.value=typeof c=="string"?c:c.value??"",f.textContent=typeof c=="string"?c:c.label||f.value,u.appendChild(f)})):(u=document.createElement("input"),u.type=a.type==="icon"||a.type==="image"?"text":a.type||"text",u.className="form-input",a.placeholder&&(u.placeholder=a.placeholder),a.type==="file"&&(a.file?.accept&&(u.accept=a.file.accept),a.multiple&&(u.multiple=!0))),u.name=a.name,u.required=a.required||!1,l.appendChild(h),l.appendChild(u),o.appendChild(l)}),t.honeypot&&_(o);const d=document.createElement("button");if(d.type="submit",d.className="btn btn-primary",d.textContent=t.submitText||"Submit",Q(t,"stacked").length||G(t)){const a=document.createElement("div");a.className="form-group form-buttons",a.appendChild(d),o.appendChild(a)}else o.appendChild(d);if(o.addEventListener("submit",function(a){a.preventDefault();const l={};if(r.forEach(function(u){const c=o.querySelector('[name="'+u.name+'"]');c&&(l[u.name]=c.value)}),window.FormLogicEngine&&i){const u=window.FormLogicEngine,c=[],f=[];if(r.forEach(function(p){if(u.evaluateFieldVisibility(p,l)==="hidden"){delete l[p.name];return}const b=u.evaluateFieldRequirement(p,l),y=l[p.name];b&&(!y||!String(y).trim())&&c.push(p.label||p.name);const v=u.validateField(p,y||"",l);v.length&&f.push(v[0].message)}),c.length||f.length){const p=[];c.length&&p.push("Required: "+c.join(", ")),f.length&&p.push(f.join("; ")),x(n,p.join(". "),"error");return}}const h=X(o,r);if(h.length){x(n,h.join(" "),"error");return}if(n.dataset.triggerBlocked==="true"){const u=n._formLogicRuntime,c=u&&u.submitBlock?u.submitBlock().reasons:[];x(n,c.join(" ")||"This form cannot be submitted yet.","error");return}n.classList.add("fb-form-loading"),d.disabled=!0,C(e,l,t,n,o,null,r).finally(function(){n.classList.remove("fb-form-loading"),d.disabled=!1})}),n.appendChild(o),j(o,t,"stacked"),F(o,t,r),T(n,t),enhancePickerFields(n,r),ee(n,r),N(n,function(a){return C(e,a,t,n,o,null,r)}),window.FormLogicEngine&&i&&q(r)){const a=new window.FormLogicEngine.FormLogicRuntime(i,n);a.init(),n._formLogicRuntime=a}}function he(n){const r=n.getAttribute("data-form");r&&fetch("/api/forms/"+r+"/public").then(t=>{if(!t.ok)throw new Error("Form not found: "+r);return t.json()}).then(t=>{const e=t.fields||[],i=t.settings||{},o=document.createElement("div");o.className="fb-form-wrapper",n.appendChild(o),B(o,t.fileLimits);const d=e.some(s=>s.type==="page-break");if(typeof Domma<"u"&&Domma.forms){const s=Number(i.columns)===3?3:2,a=i.layout||"grid";if(d&&Domma.forms.wizard){const l=Y(e,t.title),h=l.map(m=>m.fields),u=l.map(function(m){return{title:m.title,description:m.description,fields:O(m.fields,s)}});let c=0,f=null,p=null;const w=Date.now(),b=new Map;B(o,t.fileLimits,b),R(o,e);const y=function(m){const g=window.FormLogicEngine;if(!g||!g.validateFields)return;const k=g.validateFields(o,h[c]||[]);k.valid||(m.preventDefault(),m.stopImmediatePropagation(),markInvalidFields(o,k.missing),showValidationPopup(k))},v=function(){const m=h[c]||e;if($(o,i),F(o,i,m),T(o,i),D(o,m),enhancePickerFields(o,m),ne(o,b),m.some(g=>g.type==="spacer")&&K(o,m),i.honeypot){const g=o.querySelector("form");g&&_(g,w)}window.FormLogicEngine&&q(e)&&(f&&f.destroy(),f=new window.FormLogicEngine.FormLogicRuntime(t,o,{baseValues:p&&p.getStepData?p.getStepData():{}}),f.init(),z(o,f)),o.querySelectorAll(".wizard-next, .wizard-submit").forEach(g=>g.addEventListener("click",y,!0))};p=Domma.forms.wizard(o,{schema:{steps:u},layout:a,columns:s,finishText:i.submitText||"Finish",onStepChange:function(m){L(o,b),c=m,setTimeout(v,0)},onSubmit:function(m){return L(o,b),C(r,m,i,o,null,b,e)}}),N(o,function(m){return L(o,b),C(r,m,i,o,null,b,e)}),o.addEventListener("dm-form-trigger",function(m){if(!m.detail||m.detail.type!=="goto-step"||!p||!p.goToStep)return;const g=Number(m.detail.action.step);!isFinite(g)||g<0||g>=u.length||g!==c&&p.goToStep(g)}),Promise.resolve(p).then(v)}else if(Domma.forms.render){const l=O(e,s),h=ce(e);R(o,e),N(o,function(c){return C(r,c,i,o,null,null,e)});const u=Domma.forms.render(o,l,h,{submitText:i.submitText||"Submit",layout:a,columns:s,onSubmit:function(c){return C(r,c,i,o,null,null,e)}});Promise.resolve(u).then(function(){if(j(o,i,a),F(o,i,e),T(o,i),D(o,e),enhancePickerFields(o,e),window.FormLogicEngine&&q(e)){const c=new window.FormLogicEngine.FormLogicRuntime(t,o);c.init(),z(o,c)}if(e.some(c=>c.type==="spacer")&&K(o,e),i.honeypot){const c=o.querySelector("form");c&&_(c)}})}}else fe(o,e.filter(s=>s.type!=="page-break"&&s.type!=="spacer"),i,r,t)}).catch(t=>{const e=document.createElement("p");e.textContent="Form unavailable.",e.style.cssText="color:var(--dm-danger);font-style:italic;",n.appendChild(e),console.warn("[forms]",t.message)})}
|
package/public/js/site.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyMobileMenu as ne,initCarouselPopup as ae}from"/public/js/mobile-ui.mjs?v=20261016-mobile-options";import{installSmoothCarets as se}from"/public/js/smooth-caret.js";import{decodeBase64Json as V}from"/public/js/utf8-base64.mjs";import{makeBadgeEl as U,applyColour as G,applyPill as ie,applyFloat as re,applyHighlight as Y,applyItemHighlight as ce,itemHighlightAttrs as le,isCurrentItem as K,menuAlign as de,applyClasses as P,cssClasses as X,applyEntrance as J}from"/public/js/menu-decor.mjs?v=20261014-menu-entrance";import{applyMenuLook as me,applyFooterLook as ue}from"/public/js/menu-cards.mjs?v=20261029-footer-bars";import{initPageMotion as pe}from"/public/js/page-motion.mjs?v=20261029-page-motion";import{applyFooterShowcase as fe}from"/public/js/footer-showcase.mjs?v=20261029-footer-showcase";import{initFloatingMenus as he}from"/public/js/menu-float.js?v=20260829-float-panel";import{enhancePickerFields as Q,markInvalidFields as Z,showValidationPopup as ee}from"/public/js/forms.js?v=20261025-forms-files-total";import{buildWizardSteps as ge}from"/public/js/form-steps.mjs";import{mountMotionControl as ye}from"/public/js/motion-control.mjs?v=20261029-motion-under-switcher";import{applyFormClasses as te,applySubmitButtons as ve,applyWizardButtons as be}from"/public/js/form-submit.mjs";import{captureFileFields as oe,destroyDropzones as we,fileBlueprint as Ce,restoreFileFields as Se,setFileLimits as xe,splitFiles as ke,submitBody as Le,totalTooLarge as $e,wireFileFields as Ee}from"/public/js/form-files.mjs";document.addEventListener("click",m=>{const i=m.target?.closest?.(".dm-banner__dismiss");i&&(m.preventDefault(),i.closest(".dm-banner")?.remove())}),$(()=>{se(document);const m=window.__CMS_NAV__||{},i=window.__CMS_SITE__||{},D=i.brandingEnabled!==!1&&m.brand?.enabled!==!1;if(i.autoTheme?.enabled){let o=function(r){const d=(r||"07:00").split(":");return+d[0]*60+(+d[1]||0)},e=function(){const r=new Date,d=r.getHours()*60+r.getMinutes();return d>=o(s.dayStart)&&d<o(s.nightStart)?s.dayTheme:s.nightTheme},t=function(r){const d=s.apply&&s.apply[r]||{theme:r,custom:""};Domma.theme.set(d.theme);for(const n of[...document.body.classList])n.startsWith("dm-custom-")&&document.body.classList.remove(n);d.custom&&document.body.classList.add(d.custom)};const s=i.autoTheme;t(e()),setInterval(()=>t(e()),6e4)}const L=$("#site-navbar");if(L.length&&m.brand){let e=function(u,f=0){return Array.isArray(u)?u.filter(h=>!(h&&(h.type==="spacer"||h.type==="theme-switcher"))).filter(h=>!(h&&h.type==="separator"&&f===0)).map(h=>h&&h.type==="separator"?{divider:!0}:Array.isArray(h?.items)?{...h,items:e(h.items,f+1)}:h):u};const s={...m.brand},o=s.size&&s.size!=="md"?` navbar-brand-${s.size}`:"";if(s.logo||s.icon||s.tagline){let u="";s.logo?u+=`<img src="${s.logo}" class="navbar-brand-logo" alt="${s.text||""}">`:s.icon&&(u+=`<span data-icon="${s.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`),s.text&&(u+=`<span class="navbar-brand-text${o}">${s.text}</span>`),s.tagline&&(u+=`<small class="navbar-brand-tagline">${s.tagline}</small>`),s.html=u}else o&&s.text&&(s.html=`<span class="navbar-brand-text${o}">${s.text}</span>`);const t=e(m.items||[]),r=m.position==="floating",d=m.orientation==="vertical";L.get(0).querySelector(":scope > .cms-nojs-links")?.remove(),Domma.elements.navbar("#site-navbar",{brand:D?s:null,items:t,variant:m.variant||"dark",position:r?"static":m.position||"sticky",collapsible:!0,appearOnHover:!!m.appearOnHover}),Domma.icons.scan("#site-navbar");const n=L.get(0);ne(n,m.mobile);const y=()=>{if(!d)return;const f=n.querySelector('a[aria-current="page"]')?.closest(".navbar-dropdown");f&&!f.classList.contains("open")&&f.querySelector(":scope > .navbar-dropdown-toggle")?.click()};n.classList.add(`dm-nav-align-${de(m)||"centre"}`),d&&L.get(0).classList.add("dm-nav-vertical",m.side==="right"?"dm-nav-vertical-right":"dm-nav-vertical-left");const g=m.dock||{};d&&!r&&Ae(n,m.side==="right"),!d&&g.hideOnScroll&&Te(n),Y(n,m),J(n,m),P(n,m.class),r&&(re(L.get(0),m),he(L.get(0).parentNode||document));const l=n.querySelector(".navbar-toggle"),b=n.querySelector(".navbar-collapse");if(l&&b){let u=null;const f=()=>{b.classList.contains("show")&&l.click()},h=()=>{u&&(u.remove(),u=null),document.body.classList.remove("dm-drawer-open")},p=()=>{u||(u=document.createElement("div"),u.className="dm-navbar-backdrop",u.addEventListener("click",f),document.body.appendChild(u),document.body.classList.add("dm-drawer-open"))};l.addEventListener("click",()=>{requestAnimationFrame(()=>{b.classList.contains("show")?(y(),p()):h()})}),b.addEventListener("click",x=>{x.target.closest("a")&&requestAnimationFrame(h)}),document.addEventListener("keydown",x=>{x.key==="Escape"&&b.classList.contains("show")&&f()})}const w=n.querySelector(".navbar-nav");if(w){const u=Array.from(w.children);let f=0;for(const h of m.items||[])if(!(h&&h.type==="separator")){if(h&&h.type==="spacer"){const p=document.createElement("li"),x=["xs","sm","md","lg","xl","flex"].includes(h.size)?h.size:"md";p.className=`dm-menu-spacer dm-menu-spacer--${x}`,p.setAttribute("aria-hidden","true"),w.insertBefore(p,u[f]||null);continue}if(h&&h.type==="theme-switcher"){const p=document.createElement("li");p.className="dm-menu-theme-switcher";const x=document.createElement("span");x.dataset.themeSwitcher="menu",x.dataset.position="inline",p.appendChild(x),w.insertBefore(p,u[f]||null);continue}f++}window.CMSThemeSwitcher?.scan(w)}n.querySelectorAll("[data-path]").forEach(u=>{const f=u.dataset.path.split(".").map(Number),h=f.length>1,p=f.reduce((M,N)=>M?.items?.[N],{items:t});if(!p)return;p.colour&&G(u,p.colour),p.pill&&!h&&ie(u,p.pill),ce(u,p),P(u.closest("li"),p.class);const x=U(p.badge);x&&u.appendChild(x),K(p.url,location.pathname)&&(u.classList.add("active"),u.setAttribute("aria-current","page"))}),me(n,m,t),y()}let I=null;const C=$("#site-footer");if(C.length){let r=function(c){return String(c??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},d=function(c){return r(c).replace(/'/g,"'")},n=function(c){if(c&&c.type==="separator")return'<li class="footer-sep"><hr></li>';if(c&&c.type==="spacer")return`<li class="dm-menu-spacer dm-menu-spacer--${["xs","sm","md","lg","xl","flex"].includes(c.size)?c.size:"md"}" aria-hidden="true"></li>`;if(c&&c.type==="theme-switcher")return'<li class="dm-menu-theme-switcher"><span data-theme-switcher="menu" data-position="inline"></span></li>';const v=d(c.url||"#"),k=r(c.text||""),q=Array.isArray(c.items)&&c.items.length?`<ul>${c.items.map(n).join("")}</ul>`:"",z=le(c),j=[z.hover&&` data-menu-item-hover="${d(z.hover)}"`,z.active&&` data-menu-item-active="${d(z.active)}"`].filter(Boolean).join(""),W=z.accent?` style="--dm-menu-highlight:${d(z.accent)}"`:"",B=X(c.class).join(" ");return`<li${B?` class="${d(B)}"`:""}><a href="${v}"${j}${W}>${k}</a>${q}</li>`},g=function(){if(!i.footer)return"";const c=Object.keys(o).filter(k=>s[k]);if(!c.length)return"";const v=X(i.footer.socialClass).join(" ");return`<div class="footer-social">${c.map(k=>{const{label:q,svg:z}=o[k];return`<a href="${s[k]}" target="_blank" rel="noopener noreferrer" aria-label="${q}" class="footer-social-link${v?` ${d(v)}`:""}">${z}</a>`}).join("")}</div>`},u=function(c){if(!c||c.type==="separator"||c.type==="spacer")return"";if(c.type==="theme-switcher")return`<li class="cms-footer-col">${n(c).replace(/^<li[^>]*>|<\/li>$/g,"")}</li>`;const v=Array.isArray(c.items)&&c.items.length?`<ul>${c.items.map(n).join("")}</ul>`:"",k=w(c)?`<span class="cms-footer-col-title">${r(c.text||"")}</span>`:`<a class="cms-footer-col-title" href="${d(c.url||"#")}">${r(c.text||"")}</a>`,q=["cms-footer-col",...X(c.class)].join(" ");return`<li class="${d(q)}">${k}${v}</li>`},p=function(c,v,k=!1){return(c||[]).forEach(q=>{q&&(q.type==="separator"||q.type==="spacer"||q.type==="theme-switcher")||(k&&w(q)||v.push(q),Array.isArray(q.items)&&q.items.length&&p(q.items,v))}),v};const s=i.social||{},o={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let e='<div class="footer-inner container">';const t=window.__CMS_FOOTER__||{primary:[],legal:[],copyright:""},y=(()=>{const c=i.cookieConsent;if(!c||c.showSettingsLink===!1)return"";const v=k=>(k||[]).some(q=>q&&(q.url==="#cookie-settings"||v(q.items)));return v(t.primary)||v(t.legal)?"":`<li class="cms-cookie-settings"><a href="#cookie-settings">${r(c.settingsLinkText||"Cookie settings")}</a></li>`})(),l=["columns","row"].includes(i.footer?.layout)?i.footer.layout:"auto",b=i.footer?.look==="showcase"||l==="columns"||l==="auto"&&t.primary.some(c=>Array.isArray(c?.items)&&c.items.length),w=c=>b&&!c.url&&Array.isArray(c.items)&&c.items.length>0;if(b){const c=m.brand||{},v=D&&(c.text||i.title)||"",k=D?c.logo?`<img src="${d(c.logo)}" class="cms-footer-brand-logo" alt="">`:c.icon?'<span class="cms-footer-brand-icon"></span>':"":"",q=String(i.footer?.blurb||"").trim();e='<div class="footer-inner footer-inner--columns container"><div class="cms-footer-top">',e+=`<div class="cms-footer-brand">${v||k?`<a class="cms-footer-brand-name" href="${d(c.url||"/")}">${k}<span>${r(v)}</span></a>`:""}${q?`<p class="cms-footer-blurb">${r(q)}</p>`:""}${g()}</div>`,t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary footer-nav--columns" aria-label="Footer"><ul>${t.primary.map(u).join("")}</ul></nav>`),e+='</div><div class="cms-footer-bottom">',t.copyright&&(e+=`<p class="cms-footer-copyright">${r(t.copyright)}</p>`),(t.legal.length||y)&&(e+=`<nav class="footer-nav footer-nav--legal" aria-label="Legal"><ul>${t.legal.map(n).join("")}${y}</ul></nav>`),e+="</div>"}else t.copyright&&(e+=`<p>${r(t.copyright)}</p>`),t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary"><ul>${t.primary.map(n).join("")}</ul></nav>`),(t.legal.length||y)&&(e+=`<nav class="footer-nav footer-nav--legal"><ul>${t.legal.map(n).join("")}${y}</ul></nav>`),e+=g();e+="</div>",C.get(0).querySelector(":scope > .cms-nojs-links")?.remove();const f=C.get(0).querySelector(":scope > .cms-footer-blocks");f?.remove(),C.html(e),f&&C.get(0).prepend(f),window.CMSThemeSwitcher?.scan(C.get(0));const h=C.get(0).querySelector(".cms-footer-brand-icon");h&&m.brand?.icon&&h.setAttribute("data-icon",m.brand.icon),P(C.get(0),i.footer?.class),b&&fe(C.get(0),i);const x=[...p(t.primary,[],!0),...p(t.legal,[])],M=C.get(0).querySelectorAll(".footer-nav a"),N=[];M.forEach((c,v)=>{const k=x[v];if(!k)return;if(N.push({a:c,item:k}),k.icon){const z=document.createElement("span");z.className="cms-footer-ic",z.setAttribute("data-icon",String(k.icon)),z.setAttribute("data-icon-size","15"),z.setAttribute("aria-hidden","true"),c.prepend(z)}k.colour&&G(c,k.colour);const q=U(k.badge);q&&c.appendChild(q),K(k.url,location.pathname)&&(c.classList.add("is-active"),c.setAttribute("aria-current","page"))}),Y(C.get(0).querySelector(".footer-nav--primary"),{highlight:t.primaryHighlight}),Y(C.get(0).querySelector(".footer-nav--legal"),{highlight:t.legalHighlight}),J(C.get(0).querySelector(".footer-nav--primary"),{entrance:t.primaryEntrance}),J(C.get(0).querySelector(".footer-nav--legal"),{entrance:t.legalEntrance}),P(C.get(0).querySelector(".footer-nav--primary"),t.primaryClass),P(C.get(0).querySelector(".footer-nav--legal"),t.legalClass),ue(C.get(0),t,N),I=C.get(0).querySelector(".cms-footer-bottom")||C.get(0).querySelector(".footer-inner")}ye(i.motion||{enabled:i.footer?.showMotionToggle!==!1,default:i.footer?.motionDefault,placement:"footer",control:i.footer?.motionControl,label:"Reduce motion"},{footer:I,navbar:document.querySelector("#site-navbar .navbar-container")?.closest("#site-navbar")||null});const A=document.getElementById("site-sidebar");A&&_e(A),Domma.icons.scan(),Domma.syntax?.scan&&Domma.syntax.scan();const a=$(".page-body");if(a.length){a.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),a.find(".tabs").each(function(){Domma.elements.tabs(this)}),a.find(".carousel").each(function(){const o={primary:"--dm-primary",secondary:"--dm-secondary",accent:"--dm-primary",text:"--dm-text",surface:"--dm-surface",background:"--dm-background",success:"--dm-success",warning:"--dm-warning",danger:"--dm-danger",info:"--dm-info"},e=g=>{const l=String(g||"").trim();return l?o[l.toLowerCase()]?`var(${o[l.toLowerCase()]})`:CSS.supports("color",l)?l:"":""},t=e(this.dataset.background),r=e(this.dataset.arrowBackground),d=e(this.dataset.arrowColor);t&&(this.style.setProperty("--dm-carousel-background",t),this.classList.add("dm-carousel-custom-background")),r&&this.style.setProperty("--dm-carousel-arrow-background",r),d&&this.style.setProperty("--dm-carousel-arrow-color",d);const n=["top","middle","bottom"].includes(this.dataset.arrowPosition)?this.dataset.arrowPosition:"middle";this.classList.add(`dm-carousel-arrows-${n}`);const y={autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide",heightMode:this.dataset.heightMode==="average"?"average":"crop"};if(this.dataset.height){const g=Number(this.dataset.height);Number.isFinite(g)&&g>0&&(y.height=g)}if(this.dataset.animationDuration){const g=parseInt(this.dataset.animationDuration,10);Number.isFinite(g)&&(y.animationDuration=g)}this.dataset.animationEasing&&(y.animationEasing=this.dataset.animationEasing),this.dataset.ctx&&(this._dmCtxSlides=Array.from(this.querySelectorAll(".carousel-slide")).map(g=>g.cloneNode(!0)),this._dmCarouselOpts=y),this._dmCarousel=Domma.elements.carousel(this,y),ae(this)}),a.find(".dm-countdown").each(function(){const o={autoStart:!0},e=String(this.dataset.format||"").trim(),t=String(this.dataset.to||"").trim(),r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t),d=r?new Date(+r[1],+r[2]-1,+r[3]).getTime():t?new Date(t).getTime():NaN;Number.isFinite(d)?o.duration=Math.max(0,d-Date.now()):this.dataset.duration&&(o.duration=(parseInt(this.dataset.duration,10)||0)*1e3);const n=/^dd:/i.test(e);o.format=n?"hh:mm:ss":e||(o.duration>=36e5?"hh:mm:ss":"mm:ss");const y=this,g=b=>String(b).padStart(2,"0"),l=b=>{const w=Math.max(0,Math.floor(b/1e3)),u=y.querySelector(".dm-timer-time");u&&(u.textContent=`${g(Math.floor(w/86400))}:${g(Math.floor(w%86400/3600))}:${g(Math.floor(w%3600/60))}:${g(w%60)}`)};n&&(o.onTick=l),Domma.elements.timer(this,o),n&&l(o.duration||0)}),a.find("[data-tooltip]:not(.dm-range-slider)").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),a.find(".dm-progression").each(function(){const o=Array.from(this.querySelectorAll(".dm-progression-item")).map(r=>{const d={title:r.querySelector(".dm-progression-item-title")?.textContent?.trim()||"",description:r.querySelector(".dm-progression-item-body")?.innerHTML?.trim()||""};return r.dataset.date&&(d.date=r.dataset.date),r.dataset.status&&(d.status=r.dataset.status),r.dataset.eventIcon&&(d.icon=r.dataset.eventIcon),r.dataset.entryId&&(d._entryId=r.dataset.entryId),d}),e=this.dataset.layout==="centred"?"centered":this.dataset.layout||"vertical",t=Domma.elements.progression(this,{layout:e,theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0,allowHtml:!0,...o.length?{items:o}:{}});if((this.dataset.mode||"timeline")==="timeline"){const r={completed:{label:"Completed",icon:"check-circle",tone:"success"},planned:{label:"Planned",icon:"circle",tone:"secondary"},"in-progress":{label:"In progress",icon:"clock",tone:"primary"},blocked:{label:"Blocked",icon:"alert-circle",tone:"danger"}};this.querySelectorAll(".dm-progression-item").forEach((d,n)=>{const y=o[n];if(!y)return;const g=d.querySelector(".dm-progression-title");if(y.icon&&g){const b=document.createElement("span");b.dataset.icon=y.icon,b.style.cssText="display:inline-flex;vertical-align:middle;margin-right:.4em",b.setAttribute("aria-hidden","true"),g.prepend(b)}const l=r[y.status];if(l&&g){const b=document.createElement("span");b.className=`badge badge-${l.tone} cms-timeline-status`,b.style.cssText="display:inline-flex;align-items:center;gap:.35em;margin:.4rem 0";const w=document.createElement("span");w.dataset.icon=l.icon,w.dataset.iconSize="14",w.setAttribute("aria-hidden","true"),b.append(w,document.createTextNode(l.label)),g.after(b)}})}Domma.icons.scan(this),o.length&&(this._dmCtx={instance:t,items:o})});try{Domma.effects.reveal(".page-body .hero",{animation:"slide-up",duration:480,threshold:.06,stagger:60,once:!1})}catch{}const s=matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.classList.contains("dm-reduced-motion");document.querySelectorAll(".page-body .row[data-reveal]").forEach(o=>{const e=o.dataset.revealMode||"stagger",t=o.dataset.revealAnimation||"slide-up",r=parseInt(o.dataset.revealDuration,10)||(t.startsWith("swoosh")?700:400),d=parseInt(o.dataset.revealStagger,10)||(t.startsWith("swoosh")?90:60),n=parseInt(o.dataset.revealDelay,10)||0,y=o.dataset.revealDirection==="rtl",g=o.dataset.revealReplay==="true",l=Array.from(o.children);if(s&&t.startsWith("swoosh"))return;const b={"slide-up":"translateY(30px)","slide-down":"translateY(-30px)","slide-left":"translateX(30px)","slide-right":"translateX(-30px)",zoom:"scale(0.85)",flip:"perspective(600px) rotateX(15deg)",swoosh:"translateY(36px) scale(0.96)"},w=p=>t!=="swoosh-sides"?b[t]||"":l.length>1&&p===0?"translateX(-64px) rotate(-1.5deg)":l.length>1&&p===l.length-1?"translateX(64px) rotate(1.5deg)":"translateY(40px) scale(0.94)",u=t.startsWith("swoosh"),f=u?"cubic-bezier(.2,.8,.2,1)":"ease",h=(p,x)=>{p.style.opacity="0",p.style.transform=w(x),u&&(p.style.filter="blur(10px)")};l.forEach((p,x)=>{p.style.transition="none",h(p,x)}),o.offsetWidth,l.forEach((p,x)=>{p.style.transition=`opacity ${r}ms ${f}, transform ${r}ms ${f}`+(u?`, filter ${r}ms ${f}`:"");const M=y?l.length-1-x:x;p.style.transitionDelay=e==="stagger"?`${n+M*d}ms`:`${n}ms`}),requestAnimationFrame(()=>requestAnimationFrame(()=>{const p=new IntersectionObserver(x=>{x.forEach(M=>{if(M.isIntersecting){if(M.target.offsetWidth,M.target.style.opacity="1",M.target.style.transform="",u&&(M.target.style.filter=""),!g){p.unobserve(M.target);const N=M.target;N.addEventListener("transitionend",function c(v){v.target!==N||v.propertyName!=="opacity"||(N.removeEventListener("transitionend",c),N.style.transition="",N.style.transitionDelay="")})}}else g&&M.boundingClientRect.top>0&&h(M.target,l.indexOf(M.target))})},{threshold:.1,rootMargin:"100000px 0px 0px 0px"});l.forEach(x=>p.observe(x))}))}),pe(document.querySelector(".page-body")||document),a.find(".card[data-collapsible]").each(function(){const o=this.querySelector(".card-header");o&&o.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),a.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const o=this.dataset.soTarget,e=document.getElementById(o);if(!e)return;const t=E.slideover({title:e.dataset.soTitle||"",size:e.dataset.soSize||"md",position:e.dataset.soPosition||"right"});e.style.display="",t.setContent(e),t.open()})})}if(typeof $.setup=="function"){const s=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(o=>{try{const e=V(o.dataset.config);Object.assign(s,e)}catch{}}),Object.keys(s).length>0){const o={};for(const[e,t]of Object.entries(s)){const r=t?.events?.click,{confirm:d,toast:n,alert:y,prompt:g,...l}=r||{};if(d||n||y||g){$(e).on("click",async function(W){if(W.preventDefault(),d&&!await E.confirm(d))return;let B=null;if(!(g&&(B=await E.prompt(g,{inputPlaceholder:l.promptPlaceholder||"",inputValue:l.promptDefault||""}),B===null))){{const O=$(l.target||this);l.toggleClass&&O.toggleClass(l.toggleClass),l.addClass&&O.addClass(l.addClass),l.removeClass&&O.removeClass(l.removeClass),B!==null&&(l.setText&&O.text(B),l.setVal&&O.val(B),l.setAttr&&O.attr(l.setAttr,B))}l.href&&(window.location.href=l.href),n&&E.toast(n,{type:l.toastType||"success"}),y&&E.alert(y)}});const{target:w,toggleClass:u,addClass:f,removeClass:h,setText:p,setVal:x,setAttr:M,href:N,toastType:c,promptPlaceholder:v,promptDefault:k,...q}=l,z={...t.events};Object.keys(q).length?z.click=w?{target:w,...q}:q:delete z.click;const j={...t,events:z};Object.keys(z).length||delete j.events,Object.keys(j).length&&(o[e]=j)}else o[e]=t}$.setup(o)}}a.length&&R(a.get(0))}),window.wireCTAButtons=R;function R(m){m.querySelectorAll(".dm-cta-trigger").forEach(i=>{i.__ctaWired||(i.__ctaWired=!0,i.addEventListener("click",async()=>{const D=i.dataset.action,L=i.dataset.entry,I=i.dataset.confirm;let C=S.get("auth_token");if(!C){E.toast("Please log in to perform this action.",{type:"warning"});return}if(I&&!await E.confirm(I))return;const A=Array.from(i.childNodes).map(s=>s.cloneNode(!0));i.disabled=!0,i.textContent="Running\u2026";const a=s=>fetch(`/api/actions/${D}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(i.dataset.scope?{entryId:L,scope:i.dataset.scope}:{entryId:L})});try{let s=await a(C);if(s.status===401){const e=S.get("auth_refresh_token");if(e){const t=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(t.ok){const{token:r}=await t.json();S.set("auth_token",r),C=r,s=await a(C)}}}const o=await s.json().catch(()=>({}));if(!s.ok||o.success===!1)throw new Error(o.error||o.message||`Error ${s.status}`);E.toast(o.message||"Action completed.",{type:"success"})}catch(s){E.toast(s.message||"Action failed.",{type:"error"})}finally{i.disabled=!1,i.textContent="",A.forEach(s=>i.appendChild(s)),Domma.icons.scan(i)}}))})}(function(){const i=document.querySelectorAll('.dm-collection-hydrate[data-collection-scope="mine"]');if(!i.length)return;const D=S.get("auth_token");function L(C,A){const a=document.createElement("div");a.className="dm-collection-display dm-collection-empty";const s=document.createElement("p");if(A){s.appendChild(document.createTextNode("Please "));const o=document.createElement("a");o.href="/login",o.textContent="sign in",s.appendChild(o),s.appendChild(document.createTextNode(" to view your entries."))}else s.textContent=C;return a.appendChild(s),a}function I(C,A){const a=document.createElement("template");a.innerHTML=A||"",C.replaceWith(a.content)}i.forEach(async C=>{const A=C.dataset.collectionAttrs;if(!A)return;if(!D){C.replaceChildren(L("",!0));return}const a=s=>fetch("/api/collections/render-scope",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({attrs:A})});try{let s=D,o=await a(s);if(o.status===401){const t=S.get("auth_refresh_token");if(t){const r=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(r.ok){const{token:d}=await r.json();S.set("auth_token",d),s=d,o=await a(s)}}}if(!o.ok){const{error:t}=await o.json().catch(()=>({}));C.replaceChildren(L(t||"Unable to load entries.",!1));return}const{html:e}=await o.json();I(C,e),window.DommaCollectionBrowser?.hydrate&&window.DommaCollectionBrowser.hydrate(document)}catch{C.replaceChildren(L("Unable to load entries.",!1))}}),setTimeout(()=>{typeof Domma<"u"&&Domma.icons?.scan&&Domma.icons.scan(),typeof Domma<"u"&&Domma.syntax?.scan&&Domma.syntax.scan(),R(document.body)},100)})(),(function(){const i=document.querySelectorAll("[data-collection-table]");!i.length||typeof T>"u"||!T.create||i.forEach(D=>{let L;try{L=V(D.dataset.payload)}catch{return}const{columns:I,rows:C,search:A,sortable:a,exportable:s,pageSize:o,empty:e,ctaConfig:t,slug:r,exportCfg:d}=L;if(!I?.length)return;if(t){const g=I.findIndex(l=>l.key==="_cta");g!==-1&&(I[g]={key:"_cta",title:"",render:(l,b)=>{const w=document.createElement("button");if(w.className=`btn btn-${t.style||"primary"} dm-cta-trigger`,w.dataset.action=t.action||"",t.scope&&(w.dataset.scope=t.scope),w.dataset.entry=b._entryId||"",t.confirm&&(w.dataset.confirm=t.confirm),t.icon){const u=document.createElement("span");u.dataset.icon=t.icon,w.appendChild(u),w.appendChild(document.createTextNode(" "))}return w.appendChild(document.createTextNode(t.label||"Run")),w}})}const n="col-table-"+Math.random().toString(36).slice(2,7),y=document.createElement("div");y.id=n,D.replaceChildren(y),T.create("#"+n,{data:C,columns:I,search:A,sortable:a,exportable:s,pageSize:o,emptyMessage:e}),t&&R(y),D._dmTable={columns:I,rows:C,slug:r,exportCfg:d,render(g){T.create("#"+n,{data:g,columns:I,search:A,sortable:a,exportable:s,pageSize:o,emptyMessage:e}),t&&R(y)}}})})(),(function(){const i=document.querySelectorAll("[data-form-inline]");if(!i.length||typeof F>"u")return;function D(a){const s=a&&a.logic;return!!(s&&(s.visibility||s.requirement))}function L(a,s){const o={};return(a||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const t=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),r=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":t?"chooser":e.type,d={...e.formConfig||{}};d.span==="full"&&s&&(d.span=s);const n={type:r,required:D(e)?!1:e.required,label:e.label,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...e.tooltip&&{tooltip:e.tooltip},...d}};e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),t&&(e.variant&&(n.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(n.multiple=!0),e.density&&(n.density=e.density),e.columns&&(n.columns=e.columns),e.accent&&(n.accent=e.accent),e.accentStyle&&(n.accentStyle=e.accentStyle),e.glow&&(n.glow=!0),e.glowColour&&(n.glowColour=e.glowColour),e.shadow&&(n.shadow=e.shadow),e.shadowColour&&(n.shadowColour=e.shadowColour)),o[e.name]=e.type==="file"?Ce(e,n):n}),o}function I(a){const s={};return(a||[]).forEach(o=>{if(!(!o.name||o.type==="page-break"||o.type==="spacer")&&(o.type==="select"||o.type==="multiselect")&&o.required){const e=(o.options||[])[0];e&&(s[o.name]=typeof e=="object"?e.value:e)}}),s}function C(a,s){(s||[]).forEach(o=>{if(o.type!=="date"||!o.name)return;const e=a.querySelector(`[name="${o.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function A(a,s,o){let e=a.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",a.appendChild(e)),e.textContent=s,e.style.cssText=o?"color:var(--dm-danger);margin-top:.75rem;":"color:var(--dm-success);margin-top:.75rem;"}i.forEach(a=>{let s;try{s=V(a.dataset.formInline)}catch{return}a.querySelector(":scope > .cms-form-embed-summary")?.remove();const o=s.fields||[],e=s.settings||{},t=Number(e.columns)===3?3:2,r=e.layout||"grid",d=o.some(u=>u.type==="page-break"),n=new Map;xe(a,s.fileLimits,n),Ee(a,o);const y=async u=>{if(a.dataset.triggerBlocked==="true"){const f=a._formLogicRuntime,h=f&&f.submitBlock?f.submitBlock().reasons:[];A(a,h.join(" ")||"This form cannot be submitted yet.",!0);const p=new Error("Blocked by a form trigger");throw p.formSubmitFailed=!0,p}try{const f=a.querySelector(".fb-form-honeypot"),h=f?.querySelector('input[type="text"]')||null,p=f?.querySelector('[name="_t"]')||null,x=Object.assign({},u);delete x._t,f?.dataset.hpName&&delete x[f.dataset.hpName],h!==null&&(x._hp=h.value),p!==null&&(x._t=p.value);const M=new Map(n);oe(a,M);const N=ke(x,o,M),c=$e(a,N.files);if(c){A(a,c,!0);const k=new Error(c);throw k.formSubmitFailed=!0,k}const v=await H.post(`/api/forms/submit/${s.slug}`,N.files.size?Le(N.values,N.files).body:N.values);if(v&&v.error){A(a,v.error,!0);const k=new Error(v.error);throw k.formSubmitFailed=!0,k}if(v?.redirect){window.location.href=v.redirect;return}for(we(a);a.firstChild;)a.removeChild(a.firstChild);A(a,v?.message||e.successMessage||"Thank you for your submission.",!1)}catch(f){throw f.formSubmitFailed||A(a,f.message||"Submission failed. Please try again.",!0),f}},g=Date.now();function l(u){const f=u.querySelector("form");if(!f||f.querySelector(".fb-form-honeypot"))return;const h=document.createElement("div");h.className="fb-form-honeypot",h.setAttribute("aria-hidden","true");const p=document.createElement("input");p.name=f.querySelector('[name="website"]')?"_website":"website",h.dataset.hpName=p.name,p.type="text",p.tabIndex=-1,p.autocomplete="url",p.placeholder="https://",h.appendChild(p);const x=document.createElement("input");x.name="_t",x.type="hidden",x.value=g,h.appendChild(x),f.appendChild(h)}function b(u){if(!window.FormLogicEngine||!o.some(h=>h.logic||Array.isArray(h.triggers)&&h.triggers.length))return null;const f=new window.FormLogicEngine.FormLogicRuntime(s,a,u?{baseValues:u}:void 0);if(f.init(),a._formLogicRuntime=f,a._formLogicObserved)return f;if(a._formLogicObserved=!0,a.parentNode&&typeof MutationObserver<"u"){const h=new MutationObserver(function(p){for(const x of p)for(const M of x.removedNodes)if(M===a||M.nodeType===1&&M.contains&&M.contains(a)){a._formLogicRuntime&&a._formLogicRuntime.destroy(),h.disconnect();return}});h.observe(a.parentNode,{childList:!0,subtree:!1}),a._formLogicObserver=h}return f}let w=!1;if(a.addEventListener("dm-form-end",u=>{const f=u.detail?.validation;if(f&&!f.valid){Z(a,f.missing),ee(f);return}w||(w=!0,y(u.detail?.values||{}).catch(()=>{}).finally(()=>{w=!1}))}),d&&F.wizard){const u=ge(o,s.title),f=u.map(v=>({title:v.title,description:v.description,fields:L(v.fields,t)})),h=u.map(v=>v.fields);let p=0,x=null,M=null;const N=v=>{const k=window.FormLogicEngine;if(!k||!k.validateFields)return;const q=k.validateFields(a,h[p]||[]);q.valid||(v.preventDefault(),v.stopImmediatePropagation(),Z(a,q.missing),ee(q))},c=()=>{const v=h[p]||o;be(a,e),te(a,e,v),C(a,v),Q(a,v),Se(a,n),e.honeypot!==!1&&l(a),x&&x.destroy(),x=b(M?.getStepData?M.getStepData():void 0),a.querySelectorAll(".wizard-next, .wizard-submit").forEach(k=>k.addEventListener("click",N,!0))};M=F.wizard(a,{schema:{steps:f},layout:r,columns:t,finishText:e.submitText||"Finish",onSubmit:y,onStepChange:v=>{oe(a,n),p=v,setTimeout(c,0)}}),a.addEventListener("dm-form-trigger",v=>{if(v.detail?.type!=="goto-step"||!M?.goToStep)return;const k=Number(v.detail.action.step);!Number.isFinite(k)||k<0||k>=f.length||k!==p&&M.goToStep(k)}),Promise.resolve(M).then(c)}else if(F.render){const u=F.render(a,L(o,t),I(o),{submitText:e.submitText||"Submit",layout:r,columns:t,onSubmit:y});Promise.resolve(u).then(function(){ve(a,e,r),te(a,e,o),C(a,o),Q(a,o),e.honeypot!==!1&&l(a),b()})}})})();function Ae(m,i){const D=document.body,L=D.classList,I=new Set((D.dataset.railSite||"").split(" ").filter(Boolean)),C=()=>window.matchMedia("(min-width: 993px)").matches;m.querySelectorAll(".navbar-link, .navbar-dropdown-toggle").forEach(t=>{const r=t.textContent.trim();r&&(t.setAttribute("title",r),t.querySelector("svg, [data-icon]")||(t.dataset.initial=r.charAt(0).toUpperCase()))});const A=document.createElement("button");A.type="button",A.className="dm-nav-collapse-toggle";const a=()=>{const t=L.contains("dm-vnav-collapsed");A.setAttribute("aria-pressed",String(t)),A.setAttribute("aria-label",t?"Expand menu":"Collapse menu"),A.title=A.getAttribute("aria-label");const r=i?"chevrons-left":"chevrons-right",d=i?"chevrons-right":"chevrons-left";A.innerHTML=`<span data-icon="${t?r:d}"></span>`,window.Domma&&Domma.icons&&Domma.icons.scan(A)},s=t=>{L.toggle("dm-vnav-collapsed",t),S.set("nav_collapsed",t),a()};A.addEventListener("click",()=>s(!L.contains("dm-vnav-collapsed"))),a();const o=m.querySelector(".navbar-container")||m;o.insertBefore(A,o.firstChild?.nextSibling||null);const e=t=>{L.toggle("dm-vnav-autohide",t),L.toggle("dm-vnav-collapsible",!t&&I.has("collapsible")),t?L.remove("dm-vnav-collapsed"):I.has("collapsible")&&S.get("nav_collapsed")===!0&&L.add("dm-vnav-collapsed"),m.classList.remove("dm-nav-revealed"),a()};m.addEventListener("pointerdown",t=>{L.contains("dm-vnav-autohide")&&t.pointerType!=="mouse"&&!m.classList.contains("dm-nav-revealed")&&(m.classList.add("dm-nav-revealed"),t.preventDefault())}),document.addEventListener("pointerdown",t=>{m.contains(t.target)||m.classList.remove("dm-nav-revealed")}),window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const t=L.contains("dm-vnav-autohide"),r=L.contains("dm-vnav-collapsed"),d=S.has("nav_autohide")||S.has("nav_collapsed");return[{header:"Menu"},{label:r?"Expand menu":"Collapse to icons",icon:r?"maximize":"minimize",disabled:!C()||t||!I.has("collapsible"),action:()=>s(!r)},{label:t?"Keep on screen":"Hide when not in use",icon:t?"eye":"eye-off",disabled:!C(),action:()=>{S.set("nav_autohide",!t),e(!t)}},{type:"divider"},{label:"Reset to the site's setting",icon:"refresh",disabled:!d,action:()=>{S.remove("nav_autohide"),S.remove("nav_collapsed"),e(I.has("autohide")),L.toggle("dm-vnav-collapsed",!I.has("autohide")&&I.has("start-collapsed")),a()}}]}})}function Te(m){m.classList.add("dm-nav-scroll-hide");let i=window.scrollY,D=!1;window.addEventListener("scroll",()=>{D||(D=!0,requestAnimationFrame(()=>{D=!1;const L=window.scrollY,I=m.matches(":focus-within")||m.querySelector(".navbar-dropdown.open, .navbar-collapse.show");L>i&&L>m.offsetHeight&&!I?m.classList.add("dm-nav-scrolled-away"):L<i&&m.classList.remove("dm-nav-scrolled-away"),i=L}))},{passive:!0})}function _e(m){let i={};try{i=JSON.parse(m.dataset.contents||"{}")}catch{}const D=m.closest(".site-main"),L=document.querySelector(".site-content"),I=new Set(String(i.exclude||"").split(",").map(n=>n.trim().toLowerCase()).filter(Boolean)),C=n=>!n.closest(".hero, .card, .accordion, .tabs, figure, #site-sidebar"),A=n=>(L?[...L.querySelectorAll(n)]:[]).filter(C).filter(y=>!I.has(y.textContent.trim().toLowerCase())),a=i.headings==="h2"?A("h2"):i.headings==="h3"?A("h3"):i.headings==="h2h3"?A("h2, h3"):A("h2").length?A("h2"):A("h3");if(!a.length){D?.classList.add("no-sidebar-items");return}const s=new Set([...document.querySelectorAll("[id]")].map(n=>n.id)),o=document.createElement("nav");o.className="dm-contents",o.setAttribute("aria-label",i.title||"Page contents"),i.hover&&(o.dataset.menuHover=i.hover),i.selected&&(o.dataset.menuActive=i.selected),i.accent&&o.style.setProperty("--dm-menu-highlight",i.accent.startsWith("#")?i.accent:`var(--dm-${i.accent})`),i.font&&(o.style.fontFamily=i.font),i.fontSize&&(o.style.fontSize=i.fontSize),i.fontWeight&&(o.style.fontWeight=i.fontWeight);const e=document.createElement("div");e.className="dm-contents-head";const t=document.createElement("p");t.className="dm-contents-title",t.textContent=i.title||"",e.appendChild(t),o.appendChild(e);const r=document.createElement("ol");r.className="dm-contents-list"+(i.numbered?" is-numbered":"");const d=[];for(const n of a){if(!n.id){const l=(n.textContent||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"section";let b=l;for(let w=2;s.has(b);w++)b=`${l}-${w}`;s.add(b),n.id=b}const y=document.createElement("li");y.className=`dm-contents-item dm-contents-${n.tagName.toLowerCase()}`;const g=document.createElement("a");g.href=`#${n.id}`,g.textContent=n.textContent.trim(),y.appendChild(g),r.appendChild(y),d.push([n,g])}if(o.appendChild(r),m.replaceChildren(o),i.scrollSpy!==!1&&"IntersectionObserver"in window){const n=new Map,y=()=>{const l=d.find(([b])=>n.get(b))||null;d.forEach(([,b])=>{const w=l&&b===l[1];b.classList.toggle("is-active",!!w),w?b.setAttribute("aria-current","location"):b.removeAttribute("aria-current")})},g=new IntersectionObserver(l=>{l.forEach(b=>n.set(b.target,b.isIntersecting)),y()},{rootMargin:"-80px 0px -60% 0px"});d.forEach(([l])=>g.observe(l))}if(D?.classList.contains("contents-collapsible")){const n=document.createElement("button");n.type="button",n.className="dm-contents-toggle";const y=()=>{const g=D.classList.contains("contents-collapsed");n.setAttribute("aria-expanded",String(!g)),n.setAttribute("aria-label",g?"Show the contents":"Hide the contents"),n.title=n.getAttribute("aria-label"),n.innerHTML=`<span data-icon="${g?"list":"x"}"></span>`,window.Domma?.icons&&Domma.icons.scan(n)};n.addEventListener("click",()=>{S.set("contents_collapsed",D.classList.toggle("contents-collapsed")),y()}),y(),e.insertBefore(n,e.firstChild)}if(D?.classList.contains("contents-floating")&&i.movable){o.classList.add("is-movable");const n=S.get("contents_position");n&&Number.isFinite(n.x)&&Object.assign(m.style,{left:`${n.x}px`,top:`${n.y}px`,right:"auto",bottom:"auto"}),e.addEventListener("pointerdown",y=>{if(y.target.closest("button"))return;const g=m.getBoundingClientRect(),l=y.clientX-g.left,b=y.clientY-g.top,w=f=>{const h=Math.max(0,Math.min(window.innerWidth-g.width,f.clientX-l)),p=Math.max(0,Math.min(window.innerHeight-40,f.clientY-b));Object.assign(m.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto"})},u=()=>{document.removeEventListener("pointermove",w),S.set("contents_position",{x:parseInt(m.style.left,10),y:parseInt(m.style.top,10)})};document.addEventListener("pointermove",w),document.addEventListener("pointerup",u,{once:!0})})}window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const n=D?.classList.contains("contents-collapsible"),y=D?.classList.contains("contents-collapsed"),g=d.find(([,l])=>l.classList.contains("is-active"));return[{header:"Contents"},...n?[{label:y?"Show the contents":"Collapse to a button",icon:y?"list":"minimize",action:()=>m.querySelector(".dm-contents-toggle")?.click()}]:[],{label:"Copy a link to this section",icon:"link",disabled:!g,action:async()=>{const l=`${location.origin}${location.pathname}#${g[0].id}`;try{await _.copyToClipboard(l),E.toast("Link copied.",{type:"success"})}catch{E.toast("Could not copy the link.",{type:"error"})}}},{label:"Back to the top",icon:"arrow-up",action:()=>window.scrollTo({top:0,behavior:"smooth"})}]}}),D?.classList.contains("contents-autohide")&&(m.addEventListener("pointerdown",n=>{n.pointerType!=="mouse"&&!m.classList.contains("is-revealed")&&(m.classList.add("is-revealed"),n.preventDefault())}),document.addEventListener("pointerdown",n=>{m.contains(n.target)||m.classList.remove("is-revealed")}))}
|
|
1
|
+
import{applyMobileMenu as ae,initCarouselPopup as se}from"/public/js/mobile-ui.mjs?v=20261016-mobile-options";import{installSmoothCarets as ie}from"/public/js/smooth-caret.js";import{decodeBase64Json as V}from"/public/js/utf8-base64.mjs";import{makeBadgeEl as U,applyColour as G,applyPill as re,applyFloat as ce,applyHighlight as Y,applyItemHighlight as le,itemHighlightAttrs as de,isCurrentItem as K,menuAlign as me,applyClasses as P,cssClasses as X,applyEntrance as J}from"/public/js/menu-decor.mjs?v=20261014-menu-entrance";import{applyMenuLook as ue,applyFooterLook as pe}from"/public/js/menu-cards.mjs?v=20261029-footer-bars";import{initPageMotion as fe}from"/public/js/page-motion.mjs?v=20261029-page-motion";import{applyFooterShowcase as he}from"/public/js/footer-showcase.mjs?v=20261029-footer-showcase";import{initFloatingMenus as ge}from"/public/js/menu-float.js?v=20260829-float-panel";import{enhancePickerFields as Q,markInvalidFields as Z,showValidationPopup as ee}from"/public/js/forms.js?v=20261031-form-entrance-forms";import{buildWizardSteps as ye}from"/public/js/form-steps.mjs";import{mountMotionControl as ve}from"/public/js/motion-control.mjs?v=20261029-motion-under-switcher";import{applyFormClasses as te,applyFormEntrance as oe,applySubmitButtons as be,applyWizardButtons as we}from"/public/js/form-submit.mjs";import{captureFileFields as ne,destroyDropzones as Ce,fileBlueprint as Se,restoreFileFields as xe,setFileLimits as ke,splitFiles as Le,submitBody as $e,totalTooLarge as Ee,wireFileFields as Ae}from"/public/js/form-files.mjs";document.addEventListener("click",m=>{const i=m.target?.closest?.(".dm-banner__dismiss");i&&(m.preventDefault(),i.closest(".dm-banner")?.remove())}),$(()=>{ie(document);const m=window.__CMS_NAV__||{},i=window.__CMS_SITE__||{},D=i.brandingEnabled!==!1&&m.brand?.enabled!==!1;if(i.autoTheme?.enabled){let o=function(r){const d=(r||"07:00").split(":");return+d[0]*60+(+d[1]||0)},e=function(){const r=new Date,d=r.getHours()*60+r.getMinutes();return d>=o(s.dayStart)&&d<o(s.nightStart)?s.dayTheme:s.nightTheme},t=function(r){const d=s.apply&&s.apply[r]||{theme:r,custom:""};Domma.theme.set(d.theme);for(const n of[...document.body.classList])n.startsWith("dm-custom-")&&document.body.classList.remove(n);d.custom&&document.body.classList.add(d.custom)};const s=i.autoTheme;t(e()),setInterval(()=>t(e()),6e4)}const L=$("#site-navbar");if(L.length&&m.brand){let e=function(u,f=0){return Array.isArray(u)?u.filter(h=>!(h&&(h.type==="spacer"||h.type==="theme-switcher"))).filter(h=>!(h&&h.type==="separator"&&f===0)).map(h=>h&&h.type==="separator"?{divider:!0}:Array.isArray(h?.items)?{...h,items:e(h.items,f+1)}:h):u};const s={...m.brand},o=s.size&&s.size!=="md"?` navbar-brand-${s.size}`:"";if(s.logo||s.icon||s.tagline){let u="";s.logo?u+=`<img src="${s.logo}" class="navbar-brand-logo" alt="${s.text||""}">`:s.icon&&(u+=`<span data-icon="${s.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`),s.text&&(u+=`<span class="navbar-brand-text${o}">${s.text}</span>`),s.tagline&&(u+=`<small class="navbar-brand-tagline">${s.tagline}</small>`),s.html=u}else o&&s.text&&(s.html=`<span class="navbar-brand-text${o}">${s.text}</span>`);const t=e(m.items||[]),r=m.position==="floating",d=m.orientation==="vertical";L.get(0).querySelector(":scope > .cms-nojs-links")?.remove(),Domma.elements.navbar("#site-navbar",{brand:D?s:null,items:t,variant:m.variant||"dark",position:r?"static":m.position||"sticky",collapsible:!0,appearOnHover:!!m.appearOnHover}),Domma.icons.scan("#site-navbar");const n=L.get(0);ae(n,m.mobile);const y=()=>{if(!d)return;const f=n.querySelector('a[aria-current="page"]')?.closest(".navbar-dropdown");f&&!f.classList.contains("open")&&f.querySelector(":scope > .navbar-dropdown-toggle")?.click()};n.classList.add(`dm-nav-align-${me(m)||"centre"}`),d&&L.get(0).classList.add("dm-nav-vertical",m.side==="right"?"dm-nav-vertical-right":"dm-nav-vertical-left");const g=m.dock||{};d&&!r&&Te(n,m.side==="right"),!d&&g.hideOnScroll&&_e(n),Y(n,m),J(n,m),P(n,m.class),r&&(ce(L.get(0),m),ge(L.get(0).parentNode||document));const l=n.querySelector(".navbar-toggle"),b=n.querySelector(".navbar-collapse");if(l&&b){let u=null;const f=()=>{b.classList.contains("show")&&l.click()},h=()=>{u&&(u.remove(),u=null),document.body.classList.remove("dm-drawer-open")},p=()=>{u||(u=document.createElement("div"),u.className="dm-navbar-backdrop",u.addEventListener("click",f),document.body.appendChild(u),document.body.classList.add("dm-drawer-open"))};l.addEventListener("click",()=>{requestAnimationFrame(()=>{b.classList.contains("show")?(y(),p()):h()})}),b.addEventListener("click",x=>{x.target.closest("a")&&requestAnimationFrame(h)}),document.addEventListener("keydown",x=>{x.key==="Escape"&&b.classList.contains("show")&&f()})}const w=n.querySelector(".navbar-nav");if(w){const u=Array.from(w.children);let f=0;for(const h of m.items||[])if(!(h&&h.type==="separator")){if(h&&h.type==="spacer"){const p=document.createElement("li"),x=["xs","sm","md","lg","xl","flex"].includes(h.size)?h.size:"md";p.className=`dm-menu-spacer dm-menu-spacer--${x}`,p.setAttribute("aria-hidden","true"),w.insertBefore(p,u[f]||null);continue}if(h&&h.type==="theme-switcher"){const p=document.createElement("li");p.className="dm-menu-theme-switcher";const x=document.createElement("span");x.dataset.themeSwitcher="menu",x.dataset.position="inline",p.appendChild(x),w.insertBefore(p,u[f]||null);continue}f++}window.CMSThemeSwitcher?.scan(w)}n.querySelectorAll("[data-path]").forEach(u=>{const f=u.dataset.path.split(".").map(Number),h=f.length>1,p=f.reduce((M,N)=>M?.items?.[N],{items:t});if(!p)return;p.colour&&G(u,p.colour),p.pill&&!h&&re(u,p.pill),le(u,p),P(u.closest("li"),p.class);const x=U(p.badge);x&&u.appendChild(x),K(p.url,location.pathname)&&(u.classList.add("active"),u.setAttribute("aria-current","page"))}),ue(n,m,t),y()}let I=null;const C=$("#site-footer");if(C.length){let r=function(c){return String(c??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},d=function(c){return r(c).replace(/'/g,"'")},n=function(c){if(c&&c.type==="separator")return'<li class="footer-sep"><hr></li>';if(c&&c.type==="spacer")return`<li class="dm-menu-spacer dm-menu-spacer--${["xs","sm","md","lg","xl","flex"].includes(c.size)?c.size:"md"}" aria-hidden="true"></li>`;if(c&&c.type==="theme-switcher")return'<li class="dm-menu-theme-switcher"><span data-theme-switcher="menu" data-position="inline"></span></li>';const v=d(c.url||"#"),k=r(c.text||""),q=Array.isArray(c.items)&&c.items.length?`<ul>${c.items.map(n).join("")}</ul>`:"",z=de(c),j=[z.hover&&` data-menu-item-hover="${d(z.hover)}"`,z.active&&` data-menu-item-active="${d(z.active)}"`].filter(Boolean).join(""),W=z.accent?` style="--dm-menu-highlight:${d(z.accent)}"`:"",B=X(c.class).join(" ");return`<li${B?` class="${d(B)}"`:""}><a href="${v}"${j}${W}>${k}</a>${q}</li>`},g=function(){if(!i.footer)return"";const c=Object.keys(o).filter(k=>s[k]);if(!c.length)return"";const v=X(i.footer.socialClass).join(" ");return`<div class="footer-social">${c.map(k=>{const{label:q,svg:z}=o[k];return`<a href="${s[k]}" target="_blank" rel="noopener noreferrer" aria-label="${q}" class="footer-social-link${v?` ${d(v)}`:""}">${z}</a>`}).join("")}</div>`},u=function(c){if(!c||c.type==="separator"||c.type==="spacer")return"";if(c.type==="theme-switcher")return`<li class="cms-footer-col">${n(c).replace(/^<li[^>]*>|<\/li>$/g,"")}</li>`;const v=Array.isArray(c.items)&&c.items.length?`<ul>${c.items.map(n).join("")}</ul>`:"",k=w(c)?`<span class="cms-footer-col-title">${r(c.text||"")}</span>`:`<a class="cms-footer-col-title" href="${d(c.url||"#")}">${r(c.text||"")}</a>`,q=["cms-footer-col",...X(c.class)].join(" ");return`<li class="${d(q)}">${k}${v}</li>`},p=function(c,v,k=!1){return(c||[]).forEach(q=>{q&&(q.type==="separator"||q.type==="spacer"||q.type==="theme-switcher")||(k&&w(q)||v.push(q),Array.isArray(q.items)&&q.items.length&&p(q.items,v))}),v};const s=i.social||{},o={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let e='<div class="footer-inner container">';const t=window.__CMS_FOOTER__||{primary:[],legal:[],copyright:""},y=(()=>{const c=i.cookieConsent;if(!c||c.showSettingsLink===!1)return"";const v=k=>(k||[]).some(q=>q&&(q.url==="#cookie-settings"||v(q.items)));return v(t.primary)||v(t.legal)?"":`<li class="cms-cookie-settings"><a href="#cookie-settings">${r(c.settingsLinkText||"Cookie settings")}</a></li>`})(),l=["columns","row"].includes(i.footer?.layout)?i.footer.layout:"auto",b=i.footer?.look==="showcase"||l==="columns"||l==="auto"&&t.primary.some(c=>Array.isArray(c?.items)&&c.items.length),w=c=>b&&!c.url&&Array.isArray(c.items)&&c.items.length>0;if(b){const c=m.brand||{},v=D&&(c.text||i.title)||"",k=D?c.logo?`<img src="${d(c.logo)}" class="cms-footer-brand-logo" alt="">`:c.icon?'<span class="cms-footer-brand-icon"></span>':"":"",q=String(i.footer?.blurb||"").trim();e='<div class="footer-inner footer-inner--columns container"><div class="cms-footer-top">',e+=`<div class="cms-footer-brand">${v||k?`<a class="cms-footer-brand-name" href="${d(c.url||"/")}">${k}<span>${r(v)}</span></a>`:""}${q?`<p class="cms-footer-blurb">${r(q)}</p>`:""}${g()}</div>`,t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary footer-nav--columns" aria-label="Footer"><ul>${t.primary.map(u).join("")}</ul></nav>`),e+='</div><div class="cms-footer-bottom">',t.copyright&&(e+=`<p class="cms-footer-copyright">${r(t.copyright)}</p>`),(t.legal.length||y)&&(e+=`<nav class="footer-nav footer-nav--legal" aria-label="Legal"><ul>${t.legal.map(n).join("")}${y}</ul></nav>`),e+="</div>"}else t.copyright&&(e+=`<p>${r(t.copyright)}</p>`),t.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary"><ul>${t.primary.map(n).join("")}</ul></nav>`),(t.legal.length||y)&&(e+=`<nav class="footer-nav footer-nav--legal"><ul>${t.legal.map(n).join("")}${y}</ul></nav>`),e+=g();e+="</div>",C.get(0).querySelector(":scope > .cms-nojs-links")?.remove();const f=C.get(0).querySelector(":scope > .cms-footer-blocks");f?.remove(),C.html(e),f&&C.get(0).prepend(f),window.CMSThemeSwitcher?.scan(C.get(0));const h=C.get(0).querySelector(".cms-footer-brand-icon");h&&m.brand?.icon&&h.setAttribute("data-icon",m.brand.icon),P(C.get(0),i.footer?.class),b&&he(C.get(0),i);const x=[...p(t.primary,[],!0),...p(t.legal,[])],M=C.get(0).querySelectorAll(".footer-nav a"),N=[];M.forEach((c,v)=>{const k=x[v];if(!k)return;if(N.push({a:c,item:k}),k.icon){const z=document.createElement("span");z.className="cms-footer-ic",z.setAttribute("data-icon",String(k.icon)),z.setAttribute("data-icon-size","15"),z.setAttribute("aria-hidden","true"),c.prepend(z)}k.colour&&G(c,k.colour);const q=U(k.badge);q&&c.appendChild(q),K(k.url,location.pathname)&&(c.classList.add("is-active"),c.setAttribute("aria-current","page"))}),Y(C.get(0).querySelector(".footer-nav--primary"),{highlight:t.primaryHighlight}),Y(C.get(0).querySelector(".footer-nav--legal"),{highlight:t.legalHighlight}),J(C.get(0).querySelector(".footer-nav--primary"),{entrance:t.primaryEntrance}),J(C.get(0).querySelector(".footer-nav--legal"),{entrance:t.legalEntrance}),P(C.get(0).querySelector(".footer-nav--primary"),t.primaryClass),P(C.get(0).querySelector(".footer-nav--legal"),t.legalClass),pe(C.get(0),t,N),I=C.get(0).querySelector(".cms-footer-bottom")||C.get(0).querySelector(".footer-inner")}ve(i.motion||{enabled:i.footer?.showMotionToggle!==!1,default:i.footer?.motionDefault,placement:"footer",control:i.footer?.motionControl,label:"Reduce motion"},{footer:I,navbar:document.querySelector("#site-navbar .navbar-container")?.closest("#site-navbar")||null});const A=document.getElementById("site-sidebar");A&&qe(A),Domma.icons.scan(),Domma.syntax?.scan&&Domma.syntax.scan();const a=$(".page-body");if(a.length){a.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),a.find(".tabs").each(function(){Domma.elements.tabs(this)}),a.find(".carousel").each(function(){const o={primary:"--dm-primary",secondary:"--dm-secondary",accent:"--dm-primary",text:"--dm-text",surface:"--dm-surface",background:"--dm-background",success:"--dm-success",warning:"--dm-warning",danger:"--dm-danger",info:"--dm-info"},e=g=>{const l=String(g||"").trim();return l?o[l.toLowerCase()]?`var(${o[l.toLowerCase()]})`:CSS.supports("color",l)?l:"":""},t=e(this.dataset.background),r=e(this.dataset.arrowBackground),d=e(this.dataset.arrowColor);t&&(this.style.setProperty("--dm-carousel-background",t),this.classList.add("dm-carousel-custom-background")),r&&this.style.setProperty("--dm-carousel-arrow-background",r),d&&this.style.setProperty("--dm-carousel-arrow-color",d);const n=["top","middle","bottom"].includes(this.dataset.arrowPosition)?this.dataset.arrowPosition:"middle";this.classList.add(`dm-carousel-arrows-${n}`);const y={autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide",heightMode:this.dataset.heightMode==="average"?"average":"crop"};if(this.dataset.height){const g=Number(this.dataset.height);Number.isFinite(g)&&g>0&&(y.height=g)}if(this.dataset.animationDuration){const g=parseInt(this.dataset.animationDuration,10);Number.isFinite(g)&&(y.animationDuration=g)}this.dataset.animationEasing&&(y.animationEasing=this.dataset.animationEasing),this.dataset.ctx&&(this._dmCtxSlides=Array.from(this.querySelectorAll(".carousel-slide")).map(g=>g.cloneNode(!0)),this._dmCarouselOpts=y),this._dmCarousel=Domma.elements.carousel(this,y),se(this)}),a.find(".dm-countdown").each(function(){const o={autoStart:!0},e=String(this.dataset.format||"").trim(),t=String(this.dataset.to||"").trim(),r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t),d=r?new Date(+r[1],+r[2]-1,+r[3]).getTime():t?new Date(t).getTime():NaN;Number.isFinite(d)?o.duration=Math.max(0,d-Date.now()):this.dataset.duration&&(o.duration=(parseInt(this.dataset.duration,10)||0)*1e3);const n=/^dd:/i.test(e);o.format=n?"hh:mm:ss":e||(o.duration>=36e5?"hh:mm:ss":"mm:ss");const y=this,g=b=>String(b).padStart(2,"0"),l=b=>{const w=Math.max(0,Math.floor(b/1e3)),u=y.querySelector(".dm-timer-time");u&&(u.textContent=`${g(Math.floor(w/86400))}:${g(Math.floor(w%86400/3600))}:${g(Math.floor(w%3600/60))}:${g(w%60)}`)};n&&(o.onTick=l),Domma.elements.timer(this,o),n&&l(o.duration||0)}),a.find("[data-tooltip]:not(.dm-range-slider)").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),a.find(".dm-progression").each(function(){const o=Array.from(this.querySelectorAll(".dm-progression-item")).map(r=>{const d={title:r.querySelector(".dm-progression-item-title")?.textContent?.trim()||"",description:r.querySelector(".dm-progression-item-body")?.innerHTML?.trim()||""};return r.dataset.date&&(d.date=r.dataset.date),r.dataset.status&&(d.status=r.dataset.status),r.dataset.eventIcon&&(d.icon=r.dataset.eventIcon),r.dataset.entryId&&(d._entryId=r.dataset.entryId),d}),e=this.dataset.layout==="centred"?"centered":this.dataset.layout||"vertical",t=Domma.elements.progression(this,{layout:e,theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0,allowHtml:!0,...o.length?{items:o}:{}});if((this.dataset.mode||"timeline")==="timeline"){const r={completed:{label:"Completed",icon:"check-circle",tone:"success"},planned:{label:"Planned",icon:"circle",tone:"secondary"},"in-progress":{label:"In progress",icon:"clock",tone:"primary"},blocked:{label:"Blocked",icon:"alert-circle",tone:"danger"}};this.querySelectorAll(".dm-progression-item").forEach((d,n)=>{const y=o[n];if(!y)return;const g=d.querySelector(".dm-progression-title");if(y.icon&&g){const b=document.createElement("span");b.dataset.icon=y.icon,b.style.cssText="display:inline-flex;vertical-align:middle;margin-right:.4em",b.setAttribute("aria-hidden","true"),g.prepend(b)}const l=r[y.status];if(l&&g){const b=document.createElement("span");b.className=`badge badge-${l.tone} cms-timeline-status`,b.style.cssText="display:inline-flex;align-items:center;gap:.35em;margin:.4rem 0";const w=document.createElement("span");w.dataset.icon=l.icon,w.dataset.iconSize="14",w.setAttribute("aria-hidden","true"),b.append(w,document.createTextNode(l.label)),g.after(b)}})}Domma.icons.scan(this),o.length&&(this._dmCtx={instance:t,items:o})});try{Domma.effects.reveal(".page-body .hero",{animation:"slide-up",duration:480,threshold:.06,stagger:60,once:!1})}catch{}const s=matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.classList.contains("dm-reduced-motion");document.querySelectorAll(".page-body .row[data-reveal]").forEach(o=>{const e=o.dataset.revealMode||"stagger",t=o.dataset.revealAnimation||"slide-up",r=parseInt(o.dataset.revealDuration,10)||(t.startsWith("swoosh")?700:400),d=parseInt(o.dataset.revealStagger,10)||(t.startsWith("swoosh")?90:60),n=parseInt(o.dataset.revealDelay,10)||0,y=o.dataset.revealDirection==="rtl",g=o.dataset.revealReplay==="true",l=Array.from(o.children);if(s&&t.startsWith("swoosh"))return;const b={"slide-up":"translateY(30px)","slide-down":"translateY(-30px)","slide-left":"translateX(30px)","slide-right":"translateX(-30px)",zoom:"scale(0.85)",flip:"perspective(600px) rotateX(15deg)",swoosh:"translateY(36px) scale(0.96)"},w=p=>t!=="swoosh-sides"?b[t]||"":l.length>1&&p===0?"translateX(-64px) rotate(-1.5deg)":l.length>1&&p===l.length-1?"translateX(64px) rotate(1.5deg)":"translateY(40px) scale(0.94)",u=t.startsWith("swoosh"),f=u?"cubic-bezier(.2,.8,.2,1)":"ease",h=(p,x)=>{p.style.opacity="0",p.style.transform=w(x),u&&(p.style.filter="blur(10px)")};l.forEach((p,x)=>{p.style.transition="none",h(p,x)}),o.offsetWidth,l.forEach((p,x)=>{p.style.transition=`opacity ${r}ms ${f}, transform ${r}ms ${f}`+(u?`, filter ${r}ms ${f}`:"");const M=y?l.length-1-x:x;p.style.transitionDelay=e==="stagger"?`${n+M*d}ms`:`${n}ms`}),requestAnimationFrame(()=>requestAnimationFrame(()=>{const p=new IntersectionObserver(x=>{x.forEach(M=>{if(M.isIntersecting){if(M.target.offsetWidth,M.target.style.opacity="1",M.target.style.transform="",u&&(M.target.style.filter=""),!g){p.unobserve(M.target);const N=M.target;N.addEventListener("transitionend",function c(v){v.target!==N||v.propertyName!=="opacity"||(N.removeEventListener("transitionend",c),N.style.transition="",N.style.transitionDelay="")})}}else g&&M.boundingClientRect.top>0&&h(M.target,l.indexOf(M.target))})},{threshold:.1,rootMargin:"100000px 0px 0px 0px"});l.forEach(x=>p.observe(x))}))}),fe(document.querySelector(".page-body")||document),a.find(".card[data-collapsible]").each(function(){const o=this.querySelector(".card-header");o&&o.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),a.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const o=this.dataset.soTarget,e=document.getElementById(o);if(!e)return;const t=E.slideover({title:e.dataset.soTitle||"",size:e.dataset.soSize||"md",position:e.dataset.soPosition||"right"});e.style.display="",t.setContent(e),t.open()})})}if(typeof $.setup=="function"){const s=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(o=>{try{const e=V(o.dataset.config);Object.assign(s,e)}catch{}}),Object.keys(s).length>0){const o={};for(const[e,t]of Object.entries(s)){const r=t?.events?.click,{confirm:d,toast:n,alert:y,prompt:g,...l}=r||{};if(d||n||y||g){$(e).on("click",async function(W){if(W.preventDefault(),d&&!await E.confirm(d))return;let B=null;if(!(g&&(B=await E.prompt(g,{inputPlaceholder:l.promptPlaceholder||"",inputValue:l.promptDefault||""}),B===null))){{const O=$(l.target||this);l.toggleClass&&O.toggleClass(l.toggleClass),l.addClass&&O.addClass(l.addClass),l.removeClass&&O.removeClass(l.removeClass),B!==null&&(l.setText&&O.text(B),l.setVal&&O.val(B),l.setAttr&&O.attr(l.setAttr,B))}l.href&&(window.location.href=l.href),n&&E.toast(n,{type:l.toastType||"success"}),y&&E.alert(y)}});const{target:w,toggleClass:u,addClass:f,removeClass:h,setText:p,setVal:x,setAttr:M,href:N,toastType:c,promptPlaceholder:v,promptDefault:k,...q}=l,z={...t.events};Object.keys(q).length?z.click=w?{target:w,...q}:q:delete z.click;const j={...t,events:z};Object.keys(z).length||delete j.events,Object.keys(j).length&&(o[e]=j)}else o[e]=t}$.setup(o)}}a.length&&R(a.get(0))}),window.wireCTAButtons=R;function R(m){m.querySelectorAll(".dm-cta-trigger").forEach(i=>{i.__ctaWired||(i.__ctaWired=!0,i.addEventListener("click",async()=>{const D=i.dataset.action,L=i.dataset.entry,I=i.dataset.confirm;let C=S.get("auth_token");if(!C){E.toast("Please log in to perform this action.",{type:"warning"});return}if(I&&!await E.confirm(I))return;const A=Array.from(i.childNodes).map(s=>s.cloneNode(!0));i.disabled=!0,i.textContent="Running\u2026";const a=s=>fetch(`/api/actions/${D}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(i.dataset.scope?{entryId:L,scope:i.dataset.scope}:{entryId:L})});try{let s=await a(C);if(s.status===401){const e=S.get("auth_refresh_token");if(e){const t=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(t.ok){const{token:r}=await t.json();S.set("auth_token",r),C=r,s=await a(C)}}}const o=await s.json().catch(()=>({}));if(!s.ok||o.success===!1)throw new Error(o.error||o.message||`Error ${s.status}`);E.toast(o.message||"Action completed.",{type:"success"})}catch(s){E.toast(s.message||"Action failed.",{type:"error"})}finally{i.disabled=!1,i.textContent="",A.forEach(s=>i.appendChild(s)),Domma.icons.scan(i)}}))})}(function(){const i=document.querySelectorAll('.dm-collection-hydrate[data-collection-scope="mine"]');if(!i.length)return;const D=S.get("auth_token");function L(C,A){const a=document.createElement("div");a.className="dm-collection-display dm-collection-empty";const s=document.createElement("p");if(A){s.appendChild(document.createTextNode("Please "));const o=document.createElement("a");o.href="/login",o.textContent="sign in",s.appendChild(o),s.appendChild(document.createTextNode(" to view your entries."))}else s.textContent=C;return a.appendChild(s),a}function I(C,A){const a=document.createElement("template");a.innerHTML=A||"",C.replaceWith(a.content)}i.forEach(async C=>{const A=C.dataset.collectionAttrs;if(!A)return;if(!D){C.replaceChildren(L("",!0));return}const a=s=>fetch("/api/collections/render-scope",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({attrs:A})});try{let s=D,o=await a(s);if(o.status===401){const t=S.get("auth_refresh_token");if(t){const r=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})});if(r.ok){const{token:d}=await r.json();S.set("auth_token",d),s=d,o=await a(s)}}}if(!o.ok){const{error:t}=await o.json().catch(()=>({}));C.replaceChildren(L(t||"Unable to load entries.",!1));return}const{html:e}=await o.json();I(C,e),window.DommaCollectionBrowser?.hydrate&&window.DommaCollectionBrowser.hydrate(document)}catch{C.replaceChildren(L("Unable to load entries.",!1))}}),setTimeout(()=>{typeof Domma<"u"&&Domma.icons?.scan&&Domma.icons.scan(),typeof Domma<"u"&&Domma.syntax?.scan&&Domma.syntax.scan(),R(document.body)},100)})(),(function(){const i=document.querySelectorAll("[data-collection-table]");!i.length||typeof T>"u"||!T.create||i.forEach(D=>{let L;try{L=V(D.dataset.payload)}catch{return}const{columns:I,rows:C,search:A,sortable:a,exportable:s,pageSize:o,empty:e,ctaConfig:t,slug:r,exportCfg:d}=L;if(!I?.length)return;if(t){const g=I.findIndex(l=>l.key==="_cta");g!==-1&&(I[g]={key:"_cta",title:"",render:(l,b)=>{const w=document.createElement("button");if(w.className=`btn btn-${t.style||"primary"} dm-cta-trigger`,w.dataset.action=t.action||"",t.scope&&(w.dataset.scope=t.scope),w.dataset.entry=b._entryId||"",t.confirm&&(w.dataset.confirm=t.confirm),t.icon){const u=document.createElement("span");u.dataset.icon=t.icon,w.appendChild(u),w.appendChild(document.createTextNode(" "))}return w.appendChild(document.createTextNode(t.label||"Run")),w}})}const n="col-table-"+Math.random().toString(36).slice(2,7),y=document.createElement("div");y.id=n,D.replaceChildren(y),T.create("#"+n,{data:C,columns:I,search:A,sortable:a,exportable:s,pageSize:o,emptyMessage:e}),t&&R(y),D._dmTable={columns:I,rows:C,slug:r,exportCfg:d,render(g){T.create("#"+n,{data:g,columns:I,search:A,sortable:a,exportable:s,pageSize:o,emptyMessage:e}),t&&R(y)}}})})(),(function(){const i=document.querySelectorAll("[data-form-inline]");if(!i.length||typeof F>"u")return;function D(a){const s=a&&a.logic;return!!(s&&(s.visibility||s.requirement))}function L(a,s){const o={};return(a||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const t=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),r=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":t?"chooser":e.type,d={...e.formConfig||{}};d.span==="full"&&s&&(d.span=s);const n={type:r,required:D(e)?!1:e.required,label:e.label,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...e.tooltip&&{tooltip:e.tooltip},...d}};e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.min!==void 0&&(n.min=e.min),e.max!==void 0&&(n.max=e.max),t&&(e.variant&&(n.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(n.multiple=!0),e.density&&(n.density=e.density),e.columns&&(n.columns=e.columns),e.accent&&(n.accent=e.accent),e.accentStyle&&(n.accentStyle=e.accentStyle),e.glow&&(n.glow=!0),e.glowColour&&(n.glowColour=e.glowColour),e.shadow&&(n.shadow=e.shadow),e.shadowColour&&(n.shadowColour=e.shadowColour)),o[e.name]=e.type==="file"?Se(e,n):n}),o}function I(a){const s={};return(a||[]).forEach(o=>{if(!(!o.name||o.type==="page-break"||o.type==="spacer")&&(o.type==="select"||o.type==="multiselect")&&o.required){const e=(o.options||[])[0];e&&(s[o.name]=typeof e=="object"?e.value:e)}}),s}function C(a,s){(s||[]).forEach(o=>{if(o.type!=="date"||!o.name)return;const e=a.querySelector(`[name="${o.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function A(a,s,o){let e=a.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",a.appendChild(e)),e.textContent=s,e.style.cssText=o?"color:var(--dm-danger);margin-top:.75rem;":"color:var(--dm-success);margin-top:.75rem;"}i.forEach(a=>{let s;try{s=V(a.dataset.formInline)}catch{return}a.querySelector(":scope > .cms-form-embed-summary")?.remove();const o=s.fields||[],e=s.settings||{},t=Number(e.columns)===3?3:2,r=e.layout||"grid",d=o.some(u=>u.type==="page-break"),n=new Map;ke(a,s.fileLimits,n),Ae(a,o);const y=async u=>{if(a.dataset.triggerBlocked==="true"){const f=a._formLogicRuntime,h=f&&f.submitBlock?f.submitBlock().reasons:[];A(a,h.join(" ")||"This form cannot be submitted yet.",!0);const p=new Error("Blocked by a form trigger");throw p.formSubmitFailed=!0,p}try{const f=a.querySelector(".fb-form-honeypot"),h=f?.querySelector('input[type="text"]')||null,p=f?.querySelector('[name="_t"]')||null,x=Object.assign({},u);delete x._t,f?.dataset.hpName&&delete x[f.dataset.hpName],h!==null&&(x._hp=h.value),p!==null&&(x._t=p.value);const M=new Map(n);ne(a,M);const N=Le(x,o,M),c=Ee(a,N.files);if(c){A(a,c,!0);const k=new Error(c);throw k.formSubmitFailed=!0,k}const v=await H.post(`/api/forms/submit/${s.slug}`,N.files.size?$e(N.values,N.files).body:N.values);if(v&&v.error){A(a,v.error,!0);const k=new Error(v.error);throw k.formSubmitFailed=!0,k}if(v?.redirect){window.location.href=v.redirect;return}for(Ce(a);a.firstChild;)a.removeChild(a.firstChild);A(a,v?.message||e.successMessage||"Thank you for your submission.",!1)}catch(f){throw f.formSubmitFailed||A(a,f.message||"Submission failed. Please try again.",!0),f}},g=Date.now();function l(u){const f=u.querySelector("form");if(!f||f.querySelector(".fb-form-honeypot"))return;const h=document.createElement("div");h.className="fb-form-honeypot",h.setAttribute("aria-hidden","true");const p=document.createElement("input");p.name=f.querySelector('[name="website"]')?"_website":"website",h.dataset.hpName=p.name,p.type="text",p.tabIndex=-1,p.autocomplete="url",p.placeholder="https://",h.appendChild(p);const x=document.createElement("input");x.name="_t",x.type="hidden",x.value=g,h.appendChild(x),f.appendChild(h)}function b(u){if(!window.FormLogicEngine||!o.some(h=>h.logic||Array.isArray(h.triggers)&&h.triggers.length))return null;const f=new window.FormLogicEngine.FormLogicRuntime(s,a,u?{baseValues:u}:void 0);if(f.init(),a._formLogicRuntime=f,a._formLogicObserved)return f;if(a._formLogicObserved=!0,a.parentNode&&typeof MutationObserver<"u"){const h=new MutationObserver(function(p){for(const x of p)for(const M of x.removedNodes)if(M===a||M.nodeType===1&&M.contains&&M.contains(a)){a._formLogicRuntime&&a._formLogicRuntime.destroy(),h.disconnect();return}});h.observe(a.parentNode,{childList:!0,subtree:!1}),a._formLogicObserver=h}return f}let w=!1;if(a.addEventListener("dm-form-end",u=>{const f=u.detail?.validation;if(f&&!f.valid){Z(a,f.missing),ee(f);return}w||(w=!0,y(u.detail?.values||{}).catch(()=>{}).finally(()=>{w=!1}))}),d&&F.wizard){const u=ye(o,s.title),f=u.map(v=>({title:v.title,description:v.description,fields:L(v.fields,t)})),h=u.map(v=>v.fields);let p=0,x=null,M=null;const N=v=>{const k=window.FormLogicEngine;if(!k||!k.validateFields)return;const q=k.validateFields(a,h[p]||[]);q.valid||(v.preventDefault(),v.stopImmediatePropagation(),Z(a,q.missing),ee(q))},c=()=>{const v=h[p]||o;we(a,e),te(a,e,v),oe(a,e),C(a,v),Q(a,v),xe(a,n),e.honeypot!==!1&&l(a),x&&x.destroy(),x=b(M?.getStepData?M.getStepData():void 0),a.querySelectorAll(".wizard-next, .wizard-submit").forEach(k=>k.addEventListener("click",N,!0))};M=F.wizard(a,{schema:{steps:f},layout:r,columns:t,finishText:e.submitText||"Finish",onSubmit:y,onStepChange:v=>{ne(a,n),p=v,setTimeout(c,0)}}),a.addEventListener("dm-form-trigger",v=>{if(v.detail?.type!=="goto-step"||!M?.goToStep)return;const k=Number(v.detail.action.step);!Number.isFinite(k)||k<0||k>=f.length||k!==p&&M.goToStep(k)}),Promise.resolve(M).then(c)}else if(F.render){const u=F.render(a,L(o,t),I(o),{submitText:e.submitText||"Submit",layout:r,columns:t,onSubmit:y});Promise.resolve(u).then(function(){be(a,e,r),te(a,e,o),oe(a,e),C(a,o),Q(a,o),e.honeypot!==!1&&l(a),b()})}})})();function Te(m,i){const D=document.body,L=D.classList,I=new Set((D.dataset.railSite||"").split(" ").filter(Boolean)),C=()=>window.matchMedia("(min-width: 993px)").matches;m.querySelectorAll(".navbar-link, .navbar-dropdown-toggle").forEach(t=>{const r=t.textContent.trim();r&&(t.setAttribute("title",r),t.querySelector("svg, [data-icon]")||(t.dataset.initial=r.charAt(0).toUpperCase()))});const A=document.createElement("button");A.type="button",A.className="dm-nav-collapse-toggle";const a=()=>{const t=L.contains("dm-vnav-collapsed");A.setAttribute("aria-pressed",String(t)),A.setAttribute("aria-label",t?"Expand menu":"Collapse menu"),A.title=A.getAttribute("aria-label");const r=i?"chevrons-left":"chevrons-right",d=i?"chevrons-right":"chevrons-left";A.innerHTML=`<span data-icon="${t?r:d}"></span>`,window.Domma&&Domma.icons&&Domma.icons.scan(A)},s=t=>{L.toggle("dm-vnav-collapsed",t),S.set("nav_collapsed",t),a()};A.addEventListener("click",()=>s(!L.contains("dm-vnav-collapsed"))),a();const o=m.querySelector(".navbar-container")||m;o.insertBefore(A,o.firstChild?.nextSibling||null);const e=t=>{L.toggle("dm-vnav-autohide",t),L.toggle("dm-vnav-collapsible",!t&&I.has("collapsible")),t?L.remove("dm-vnav-collapsed"):I.has("collapsible")&&S.get("nav_collapsed")===!0&&L.add("dm-vnav-collapsed"),m.classList.remove("dm-nav-revealed"),a()};m.addEventListener("pointerdown",t=>{L.contains("dm-vnav-autohide")&&t.pointerType!=="mouse"&&!m.classList.contains("dm-nav-revealed")&&(m.classList.add("dm-nav-revealed"),t.preventDefault())}),document.addEventListener("pointerdown",t=>{m.contains(t.target)||m.classList.remove("dm-nav-revealed")}),window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const t=L.contains("dm-vnav-autohide"),r=L.contains("dm-vnav-collapsed"),d=S.has("nav_autohide")||S.has("nav_collapsed");return[{header:"Menu"},{label:r?"Expand menu":"Collapse to icons",icon:r?"maximize":"minimize",disabled:!C()||t||!I.has("collapsible"),action:()=>s(!r)},{label:t?"Keep on screen":"Hide when not in use",icon:t?"eye":"eye-off",disabled:!C(),action:()=>{S.set("nav_autohide",!t),e(!t)}},{type:"divider"},{label:"Reset to the site's setting",icon:"refresh",disabled:!d,action:()=>{S.remove("nav_autohide"),S.remove("nav_collapsed"),e(I.has("autohide")),L.toggle("dm-vnav-collapsed",!I.has("autohide")&&I.has("start-collapsed")),a()}}]}})}function _e(m){m.classList.add("dm-nav-scroll-hide");let i=window.scrollY,D=!1;window.addEventListener("scroll",()=>{D||(D=!0,requestAnimationFrame(()=>{D=!1;const L=window.scrollY,I=m.matches(":focus-within")||m.querySelector(".navbar-dropdown.open, .navbar-collapse.show");L>i&&L>m.offsetHeight&&!I?m.classList.add("dm-nav-scrolled-away"):L<i&&m.classList.remove("dm-nav-scrolled-away"),i=L}))},{passive:!0})}function qe(m){let i={};try{i=JSON.parse(m.dataset.contents||"{}")}catch{}const D=m.closest(".site-main"),L=document.querySelector(".site-content"),I=new Set(String(i.exclude||"").split(",").map(n=>n.trim().toLowerCase()).filter(Boolean)),C=n=>!n.closest(".hero, .card, .accordion, .tabs, figure, #site-sidebar"),A=n=>(L?[...L.querySelectorAll(n)]:[]).filter(C).filter(y=>!I.has(y.textContent.trim().toLowerCase())),a=i.headings==="h2"?A("h2"):i.headings==="h3"?A("h3"):i.headings==="h2h3"?A("h2, h3"):A("h2").length?A("h2"):A("h3");if(!a.length){D?.classList.add("no-sidebar-items");return}const s=new Set([...document.querySelectorAll("[id]")].map(n=>n.id)),o=document.createElement("nav");o.className="dm-contents",o.setAttribute("aria-label",i.title||"Page contents"),i.hover&&(o.dataset.menuHover=i.hover),i.selected&&(o.dataset.menuActive=i.selected),i.accent&&o.style.setProperty("--dm-menu-highlight",i.accent.startsWith("#")?i.accent:`var(--dm-${i.accent})`),i.font&&(o.style.fontFamily=i.font),i.fontSize&&(o.style.fontSize=i.fontSize),i.fontWeight&&(o.style.fontWeight=i.fontWeight);const e=document.createElement("div");e.className="dm-contents-head";const t=document.createElement("p");t.className="dm-contents-title",t.textContent=i.title||"",e.appendChild(t),o.appendChild(e);const r=document.createElement("ol");r.className="dm-contents-list"+(i.numbered?" is-numbered":"");const d=[];for(const n of a){if(!n.id){const l=(n.textContent||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"section";let b=l;for(let w=2;s.has(b);w++)b=`${l}-${w}`;s.add(b),n.id=b}const y=document.createElement("li");y.className=`dm-contents-item dm-contents-${n.tagName.toLowerCase()}`;const g=document.createElement("a");g.href=`#${n.id}`,g.textContent=n.textContent.trim(),y.appendChild(g),r.appendChild(y),d.push([n,g])}if(o.appendChild(r),m.replaceChildren(o),i.scrollSpy!==!1&&"IntersectionObserver"in window){const n=new Map,y=()=>{const l=d.find(([b])=>n.get(b))||null;d.forEach(([,b])=>{const w=l&&b===l[1];b.classList.toggle("is-active",!!w),w?b.setAttribute("aria-current","location"):b.removeAttribute("aria-current")})},g=new IntersectionObserver(l=>{l.forEach(b=>n.set(b.target,b.isIntersecting)),y()},{rootMargin:"-80px 0px -60% 0px"});d.forEach(([l])=>g.observe(l))}if(D?.classList.contains("contents-collapsible")){const n=document.createElement("button");n.type="button",n.className="dm-contents-toggle";const y=()=>{const g=D.classList.contains("contents-collapsed");n.setAttribute("aria-expanded",String(!g)),n.setAttribute("aria-label",g?"Show the contents":"Hide the contents"),n.title=n.getAttribute("aria-label"),n.innerHTML=`<span data-icon="${g?"list":"x"}"></span>`,window.Domma?.icons&&Domma.icons.scan(n)};n.addEventListener("click",()=>{S.set("contents_collapsed",D.classList.toggle("contents-collapsed")),y()}),y(),e.insertBefore(n,e.firstChild)}if(D?.classList.contains("contents-floating")&&i.movable){o.classList.add("is-movable");const n=S.get("contents_position");n&&Number.isFinite(n.x)&&Object.assign(m.style,{left:`${n.x}px`,top:`${n.y}px`,right:"auto",bottom:"auto"}),e.addEventListener("pointerdown",y=>{if(y.target.closest("button"))return;const g=m.getBoundingClientRect(),l=y.clientX-g.left,b=y.clientY-g.top,w=f=>{const h=Math.max(0,Math.min(window.innerWidth-g.width,f.clientX-l)),p=Math.max(0,Math.min(window.innerHeight-40,f.clientY-b));Object.assign(m.style,{left:`${h}px`,top:`${p}px`,right:"auto",bottom:"auto"})},u=()=>{document.removeEventListener("pointermove",w),S.set("contents_position",{x:parseInt(m.style.left,10),y:parseInt(m.style.top,10)})};document.addEventListener("pointermove",w),document.addEventListener("pointerup",u,{once:!0})})}window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const n=D?.classList.contains("contents-collapsible"),y=D?.classList.contains("contents-collapsed"),g=d.find(([,l])=>l.classList.contains("is-active"));return[{header:"Contents"},...n?[{label:y?"Show the contents":"Collapse to a button",icon:y?"list":"minimize",action:()=>m.querySelector(".dm-contents-toggle")?.click()}]:[],{label:"Copy a link to this section",icon:"link",disabled:!g,action:async()=>{const l=`${location.origin}${location.pathname}#${g[0].id}`;try{await _.copyToClipboard(l),E.toast("Link copied.",{type:"success"})}catch{E.toast("Could not copy the link.",{type:"error"})}}},{label:"Back to the top",icon:"arrow-up",action:()=>window.scrollTo({top:0,behavior:"smooth"})}]}}),D?.classList.contains("contents-autohide")&&(m.addEventListener("pointerdown",n=>{n.pointerType!=="mouse"&&!m.classList.contains("is-revealed")&&(m.classList.add("is-revealed"),n.preventDefault())}),document.addEventListener("pointerdown",n=>{m.contains(n.target)||m.classList.remove("is-revealed")}))}
|
|
@@ -185,10 +185,10 @@
|
|
|
185
185
|
<script src="/public/js/collection-range.mjs?v=20261025-range-slider" type="module"></script>
|
|
186
186
|
<script src="/public/js/collection-browser.js?v=20261025-range-slider" defer></script>
|
|
187
187
|
<!-- Core Forms logic engine (must run before forms.js and site.js) -->
|
|
188
|
-
<script src="/public/js/form-logic-engine.js?v=20261031-
|
|
188
|
+
<script src="/public/js/form-logic-engine.js?v=20261031-form-entrance-engine" defer></script>
|
|
189
189
|
|
|
190
190
|
<!-- Site initialisation -->
|
|
191
|
-
<script src="/public/js/site.js?v=
|
|
191
|
+
<script src="/public/js/site.js?v=20261031-form-entrance" type="module"></script>
|
|
192
192
|
<script src="/public/js/collection-context.js?v=20261010-utf8-payloads" type="module"></script>
|
|
193
193
|
{{ctxMenusModule}}
|
|
194
194
|
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
<script src="/public/js/menu-float.js?v=20260927-float" type="module"></script>
|
|
199
199
|
|
|
200
200
|
<!-- Core Forms renderer -->
|
|
201
|
-
<script src="/public/js/forms.js?v=
|
|
201
|
+
<script src="/public/js/forms.js?v=20261031-form-entrance-forms" type="module"></script>
|
|
202
202
|
|
|
203
203
|
<!-- Core effects runtime -->
|
|
204
204
|
<script src="/public/js/effects.js?v=20261029-all-cms-fonts" defer></script>
|