@dmitryvim/form-builder 0.3.3 → 0.3.4
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/dist/browser/formbuilder.min.js +34 -34
- package/dist/browser/{formbuilder.v0.3.3.min.js → formbuilder.v0.3.4.min.js} +34 -34
- package/dist/cjs/index.cjs +14 -14
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +14 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/form-builder.js +34 -34
- package/package.json +1 -1
package/dist/form-builder.js
CHANGED
|
@@ -204,15 +204,15 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
204
204
|
overflow: hidden;
|
|
205
205
|
word-break: break-word;
|
|
206
206
|
overflow-wrap: anywhere;
|
|
207
|
-
`,s.name=r,s.placeholder=e.placeholder||"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442",s.value=t.prefill[e.key]||e.default||"",s.readOnly=i,Cr(s),Et(s),i||(s.addEventListener("focus",()=>{s.style.borderColor="var(--fb-border-focus-color)",s.style.outline="var(--fb-focus-ring-width) solid var(--fb-focus-ring-color)",s.style.outlineOffset="0"}),s.addEventListener("blur",()=>{s.style.borderColor="var(--fb-border-color)",s.style.outline="none"}),s.addEventListener("mouseenter",()=>{document.activeElement!==s&&(s.style.borderColor="var(--fb-border-hover-color)")}),s.addEventListener("mouseleave",()=>{document.activeElement!==s&&(s.style.borderColor="var(--fb-border-color)")})),!i&&t.instance){const c=()=>{const u=s.value===""?null:s.value;t.instance.triggerOnChange(r,u)};s.addEventListener("blur",c),s.addEventListener("input",c)}if(a.appendChild(s),l){const c=rt(e,s);a.appendChild(c)}n.appendChild(a)}function Sr(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:1,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"");kr(document);const f=document.createElement("div");f.className="fb-chip-list",n.appendChild(f);function p(){f.querySelectorAll(".fb-chip-input").forEach((h,y)=>{h.name=`${r}[${y}]`;const v=h.closest(".fb-chip"),w=v==null?void 0:v.nextElementSibling;w&&w.classList.contains("error-message")&&(w.id=`error-${h.name}`)})}function m(h=""){const y=document.createElement("div");y.className="fb-chip";const v=document.createElement("span");v.className="fb-chip-dot",v.setAttribute("aria-hidden","true"),y.appendChild(v);const w=document.createElement("input");if(w.type="text",w.className="fb-chip-input",w.value=h,w.placeholder=e.placeholder||k("placeholderText",a),w.readOnly=l,y.appendChild(w),!l&&t.instance){const E=()=>{t.instance.triggerOnChange(w.name,w.value===""?null:w.value)};w.addEventListener("blur",E),w.addEventListener("input",E)}if(!l){const E=document.createElement("button");E.type="button",E.className="fb-chip-remove",E.setAttribute("aria-label",k("removeElement",a)),E.innerHTML=Qt,E.onclick=()=>{const x=f.querySelectorAll(".fb-chip"),$=Array.prototype.indexOf.call(x,y);if($<0||x.length<=u)return;c.splice($,1);const M=y.nextElementSibling;M&&M.classList.contains("error-message")&&M.remove(),y.remove(),p(),C(),b()},y.appendChild(E)}return f.appendChild(y),p(),y}function b(){if(l)return;const h=f.querySelectorAll(".fb-chip").length<=u;f.querySelectorAll(".fb-chip-remove").forEach(y=>{y.disabled=h})}let g=null;if(!l){const h=Fe("text",()=>{c.push(e.default||""),m(e.default||""),C(),b()},{label:e.addLabel});g=h.update,Te(n,h.counter),n.appendChild(h.row)}function C(){g&&g(c.length,d)}c.forEach(h=>m(h)),C(),b()}function tn(e,t,n){var r,o,i;const a=[],{scopeRoot:l,skipValidation:s}=n,c=(d,f)=>{var p,m,b;if(!d)return;const g=`error-${d.getAttribute("name")||Math.random().toString(36).substring(7)}`;let C=document.getElementById(g);if(f){if(d.classList.add("invalid"),d.title=f,!C){C=document.createElement("div"),C.id=g,C.className="error-message",C.style.cssText=`
|
|
207
|
+
`,s.name=r,s.placeholder=e.placeholder||"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442",s.value=t.prefill[e.key]||e.default||"",s.readOnly=i,Cr(s),Et(s),i||(s.addEventListener("focus",()=>{s.style.borderColor="var(--fb-border-focus-color)",s.style.outline="var(--fb-focus-ring-width) solid var(--fb-focus-ring-color)",s.style.outlineOffset="0"}),s.addEventListener("blur",()=>{s.style.borderColor="var(--fb-border-color)",s.style.outline="none"}),s.addEventListener("mouseenter",()=>{document.activeElement!==s&&(s.style.borderColor="var(--fb-border-hover-color)")}),s.addEventListener("mouseleave",()=>{document.activeElement!==s&&(s.style.borderColor="var(--fb-border-color)")})),!i&&t.instance){const c=()=>{const u=s.value===""?null:s.value;t.instance.triggerOnChange(r,u)};s.addEventListener("blur",c),s.addEventListener("input",c)}if(a.appendChild(s),l){const c=rt(e,s);a.appendChild(c)}n.appendChild(a)}function Sr(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:e.required?1:0,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"");kr(document);const f=document.createElement("div");f.className="fb-chip-list",n.appendChild(f);function p(){f.querySelectorAll(".fb-chip-input").forEach((h,y)=>{h.name=`${r}[${y}]`;const v=h.closest(".fb-chip"),w=v==null?void 0:v.nextElementSibling;w&&w.classList.contains("error-message")&&(w.id=`error-${h.name}`)})}function m(h=""){const y=document.createElement("div");y.className="fb-chip";const v=document.createElement("span");v.className="fb-chip-dot",v.setAttribute("aria-hidden","true"),y.appendChild(v);const w=document.createElement("input");if(w.type="text",w.className="fb-chip-input",w.value=h,w.placeholder=e.placeholder||k("placeholderText",a),w.readOnly=l,y.appendChild(w),!l&&t.instance){const E=()=>{t.instance.triggerOnChange(w.name,w.value===""?null:w.value)};w.addEventListener("blur",E),w.addEventListener("input",E)}if(!l){const E=document.createElement("button");E.type="button",E.className="fb-chip-remove",E.setAttribute("aria-label",k("removeElement",a)),E.innerHTML=Qt,E.onclick=()=>{const x=f.querySelectorAll(".fb-chip"),$=Array.prototype.indexOf.call(x,y);if($<0||x.length<=u)return;c.splice($,1);const M=y.nextElementSibling;M&&M.classList.contains("error-message")&&M.remove(),y.remove(),p(),C(),b()},y.appendChild(E)}return f.appendChild(y),p(),y}function b(){if(l)return;const h=f.querySelectorAll(".fb-chip").length<=u;f.querySelectorAll(".fb-chip-remove").forEach(y=>{y.disabled=h})}let g=null;if(!l){const h=Fe("text",()=>{c.push(e.default||""),m(e.default||""),C(),b()},{label:e.addLabel});g=h.update,Te(n,h.counter),n.appendChild(h.row)}function C(){g&&g(c.length,d)}c.forEach(h=>m(h)),C(),b()}function tn(e,t,n){var r,o,i;const a=[],{scopeRoot:l,skipValidation:s}=n,c=(d,f)=>{var p,m,b;if(!d)return;const g=`error-${d.getAttribute("name")||Math.random().toString(36).substring(7)}`;let C=document.getElementById(g);if(f){if(d.classList.add("invalid"),d.title=f,!C){C=document.createElement("div"),C.id=g,C.className="error-message",C.style.cssText=`
|
|
208
208
|
color: var(--fb-error-color);
|
|
209
209
|
font-size: var(--fb-font-size-small);
|
|
210
210
|
margin-top: 0.25rem;
|
|
211
|
-
`;const h=((p=d.closest)==null?void 0:p.call(d,".fb-chip"))||d;h.nextSibling?(m=h.parentNode)==null||m.insertBefore(C,h.nextSibling):(b=h.parentNode)==null||b.appendChild(C)}C.textContent=f,C.style.display="block"}else d.classList.remove("invalid"),d.title="",C&&C.remove()},u=(d,f,p)=>{let m=!1;const{state:b}=n;if(!s&&f){if(e.minLength!==void 0&&e.minLength!==null&&f.length<e.minLength){const g=k("minLength",b,{min:e.minLength});a.push(`${p}: ${g}`),c(d,g),m=!0}else if(e.maxLength!==void 0&&e.maxLength!==null&&f.length>e.maxLength){const g=k("maxLength",b,{max:e.maxLength});a.push(`${p}: ${g}`),c(d,g),m=!0}else if(e.pattern)try{if(!new RegExp(e.pattern).test(f)){const g=k("patternMismatch",b);a.push(`${p}: ${g}`),c(d,g),m=!0}}catch(g){const C=k("invalidPattern",b);a.push(`${p}: ${C}`),c(d,C),m=!0}}m||c(d,null)};if(e.multiple){const d=l.querySelectorAll(`[name^="${t}\\["]`),f=[],p=[];if(d.forEach((m,b)=>{var g;const C=(g=m==null?void 0:m.value)!=null?g:"";p.push(C),f.push(C===""?null:C),u(m,C,`${t}[${b}]`)}),!s){const{state:m}=n,b=(r=e.minCount)!=null?r:
|
|
211
|
+
`;const h=((p=d.closest)==null?void 0:p.call(d,".fb-chip"))||d;h.nextSibling?(m=h.parentNode)==null||m.insertBefore(C,h.nextSibling):(b=h.parentNode)==null||b.appendChild(C)}C.textContent=f,C.style.display="block"}else d.classList.remove("invalid"),d.title="",C&&C.remove()},u=(d,f,p)=>{let m=!1;const{state:b}=n;if(!s&&f){if(e.minLength!==void 0&&e.minLength!==null&&f.length<e.minLength){const g=k("minLength",b,{min:e.minLength});a.push(`${p}: ${g}`),c(d,g),m=!0}else if(e.maxLength!==void 0&&e.maxLength!==null&&f.length>e.maxLength){const g=k("maxLength",b,{max:e.maxLength});a.push(`${p}: ${g}`),c(d,g),m=!0}else if(e.pattern)try{if(!new RegExp(e.pattern).test(f)){const g=k("patternMismatch",b);a.push(`${p}: ${g}`),c(d,g),m=!0}}catch(g){const C=k("invalidPattern",b);a.push(`${p}: ${C}`),c(d,C),m=!0}}m||c(d,null)};if(e.multiple){const d=l.querySelectorAll(`[name^="${t}\\["]`),f=[],p=[];if(d.forEach((m,b)=>{var g;const C=(g=m==null?void 0:m.value)!=null?g:"";p.push(C),f.push(C===""?null:C),u(m,C,`${t}[${b}]`)}),!s){const{state:m}=n,b=(r=e.minCount)!=null?r:0,g=(o=e.maxCount)!=null?o:1/0,C=p.filter(h=>h.trim()!=="");e.required&&C.length===0&&a.push(`${t}: ${k("required",m)}`),C.length<b&&a.push(`${t}: ${k("minItems",m,{min:b})}`),C.length>g&&a.push(`${t}: ${k("maxItems",m,{max:g})}`)}return{value:f,errors:a}}else{const d=l.querySelector(`[name$="${t}"]`),f=(i=d==null?void 0:d.value)!=null?i:"";if(!s&&e.required&&f===""){const p=k("required",n.state);return a.push(`${t}: ${p}`),c(d,p),{value:null,errors:a}}return d&&u(d,f,t),{value:f===""?null:f,errors:a}}}function nn(e,t,n,r){const{scopeRoot:o}=r;if(e.multiple){if(!Array.isArray(n)){console.warn(`updateTextField: Expected array for multiple field "${t}", got ${typeof n}`);return}const i=o.querySelectorAll(`[name^="${t}\\["]`);i.forEach((a,l)=>{l<n.length&&(a.value=n[l]!=null?String(n[l]):"",a.classList.remove("invalid"),a.title="",xe(a),a.dispatchEvent(new Event("input",{bubbles:!0})))}),n.length!==i.length&&console.warn(`updateTextField: Multiple field "${t}" has ${i.length} inputs but received ${n.length} values. Consider re-rendering for add/remove.`)}else{const i=o.querySelector(`[name="${t}"]`);i&&(i.value=n!=null?String(n):"",i.classList.remove("invalid"),i.title="",xe(i),i instanceof HTMLTextAreaElement&&i.dispatchEvent(new Event("input",{bubbles:!0})))}}function Lr(e,t,n,r){const o=t.state,i=ae(e,o,t),a=document.createElement("div");a.style.cssText="position: relative;";const l=document.createElement("textarea");if(l.className="w-full border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none",l.style.cssText=`
|
|
212
212
|
padding: var(--fb-input-padding-y) var(--fb-input-padding-x) 24px var(--fb-input-padding-x);
|
|
213
213
|
font-size: var(--fb-font-size);
|
|
214
214
|
font-family: var(--fb-font-family);
|
|
215
|
-
`,l.name=r,l.placeholder=e.placeholder||"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442",l.rows=e.rows||4,l.value=t.prefill[e.key]||e.default||"",l.readOnly=i,!i&&t.instance){const s=()=>{const c=l.value===""?null:l.value;t.instance.triggerOnChange(r,c)};l.addEventListener("blur",s),l.addEventListener("input",s)}if((e.autoExpand||i)&&Et(l),a.appendChild(l),!i&&(e.minLength!=null||e.maxLength!=null)){const s=rt(e,l);a.appendChild(s)}n.appendChild(a)}function Tr(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:1,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"");const f=document.createElement("div");f.className="space-y-2",n.appendChild(f);function p(){f.querySelectorAll(".multiple-textarea-item").forEach((h,y)=>{const v=h.querySelector("textarea");v&&(v.name=`${r}[${y}]`)})}function m(h="",y=-1){const v=document.createElement("div");v.className="multiple-textarea-item";const w=document.createElement("div");w.style.cssText="position: relative;";const E=document.createElement("textarea");if(E.className="w-full border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none",E.style.cssText=`
|
|
215
|
+
`,l.name=r,l.placeholder=e.placeholder||"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442",l.rows=e.rows||4,l.value=t.prefill[e.key]||e.default||"",l.readOnly=i,!i&&t.instance){const s=()=>{const c=l.value===""?null:l.value;t.instance.triggerOnChange(r,c)};l.addEventListener("blur",s),l.addEventListener("input",s)}if((e.autoExpand||i)&&Et(l),a.appendChild(l),!i&&(e.minLength!=null||e.maxLength!=null)){const s=rt(e,l);a.appendChild(s)}n.appendChild(a)}function Tr(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:e.required?1:0,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"");const f=document.createElement("div");f.className="space-y-2",n.appendChild(f);function p(){f.querySelectorAll(".multiple-textarea-item").forEach((h,y)=>{const v=h.querySelector("textarea");v&&(v.name=`${r}[${y}]`)})}function m(h="",y=-1){const v=document.createElement("div");v.className="multiple-textarea-item";const w=document.createElement("div");w.style.cssText="position: relative;";const E=document.createElement("textarea");if(E.className="w-full border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none",E.style.cssText=`
|
|
216
216
|
padding: var(--fb-input-padding-y) var(--fb-input-padding-x) 24px var(--fb-input-padding-x);
|
|
217
217
|
font-size: var(--fb-font-size);
|
|
218
218
|
font-family: var(--fb-font-family);
|
|
@@ -268,21 +268,21 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
268
268
|
font-family: var(--fb-font-family);
|
|
269
269
|
width: 100%;
|
|
270
270
|
box-sizing: border-box;
|
|
271
|
-
`),!i&&t.instance){const s=()=>{const c=l.value?parseFloat(l.value):null;t.instance.triggerOnChange(r,c)};l.addEventListener("blur",s),l.addEventListener("input",s)}if(e.stepper)a.appendChild(Mr(l,e,i));else if(a.appendChild(l),!i&&(e.min!=null||e.max!=null)){const s=rn(e,l);a.appendChild(s)}n.appendChild(a)}function Ir(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:1,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"");const f=document.createElement("div");f.className="space-y-2",n.appendChild(f);function p(){f.querySelectorAll(".multiple-number-item").forEach((h,y)=>{const v=h.querySelector("input");v&&(v.name=`${r}[${y}]`)})}function m(h="",y=-1){const v=document.createElement("div");v.className="multiple-number-item flex items-center gap-2";const w=document.createElement("div");w.style.cssText="position: relative; flex: 1;";const E=document.createElement("input");if(E.type="number",E.className="w-full border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",E.style.cssText=`
|
|
271
|
+
`),!i&&t.instance){const s=()=>{const c=l.value?parseFloat(l.value):null;t.instance.triggerOnChange(r,c)};l.addEventListener("blur",s),l.addEventListener("input",s)}if(e.stepper)a.appendChild(Mr(l,e,i));else if(a.appendChild(l),!i&&(e.min!=null||e.max!=null)){const s=rn(e,l);a.appendChild(s)}n.appendChild(a)}function Ir(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:e.required?1:0,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"");const f=document.createElement("div");f.className="space-y-2",n.appendChild(f);function p(){f.querySelectorAll(".multiple-number-item").forEach((h,y)=>{const v=h.querySelector("input");v&&(v.name=`${r}[${y}]`)})}function m(h="",y=-1){const v=document.createElement("div");v.className="multiple-number-item flex items-center gap-2";const w=document.createElement("div");w.style.cssText="position: relative; flex: 1;";const E=document.createElement("input");if(E.type="number",E.className="w-full border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",E.style.cssText=`
|
|
272
272
|
padding: var(--fb-input-padding-y) 60px var(--fb-input-padding-y) var(--fb-input-padding-x);
|
|
273
273
|
font-size: var(--fb-font-size);
|
|
274
274
|
font-family: var(--fb-font-family);
|
|
275
275
|
width: 100%;
|
|
276
276
|
box-sizing: border-box;
|
|
277
|
-
`,E.placeholder=e.placeholder||"0",e.min!==void 0&&(E.min=e.min.toString()),e.max!==void 0&&(E.max=e.max.toString()),e.step!==void 0&&(E.step=e.step.toString()),E.value=h.toString(),E.readOnly=l,!l&&t.instance){const x=()=>{const $=E.value?parseFloat(E.value):null;t.instance.triggerOnChange(E.name,$)};E.addEventListener("blur",x),E.addEventListener("input",x)}if(w.appendChild(E),!l&&(e.min!=null||e.max!=null)){const x=rn(e,E);w.appendChild(x)}return v.appendChild(w),y===-1?f.appendChild(v):f.insertBefore(v,f.children[y]),p(),v}function b(){if(l)return;const h=f.querySelectorAll(".multiple-number-item"),y=h.length;h.forEach(v=>{let w=v.querySelector(".remove-item-btn");w||(w=document.createElement("button"),w.type="button",w.className="remove-item-btn px-2 py-1 text-red-600 hover:bg-red-50 rounded",w.innerHTML="\u2715",w.onclick=()=>{const x=Array.from(f.children).indexOf(v);f.children.length>u&&(c.splice(x,1),v.remove(),p(),C(),b())},v.appendChild(w));const E=y<=u;w.disabled=E,w.style.opacity=E?"0.5":"1",w.style.pointerEvents=E?"none":"auto"})}let g=null;if(!l){const h=Fe("number",()=>{c.push(e.default||""),m(e.default||""),C(),b()},{label:e.addLabel});g=h.update,Te(n,h.counter),n.appendChild(h.row)}function C(){g&&g(c.length,d)}c.forEach(h=>m(h)),C(),b()}function
|
|
277
|
+
`,E.placeholder=e.placeholder||"0",e.min!==void 0&&(E.min=e.min.toString()),e.max!==void 0&&(E.max=e.max.toString()),e.step!==void 0&&(E.step=e.step.toString()),E.value=h.toString(),E.readOnly=l,!l&&t.instance){const x=()=>{const $=E.value?parseFloat(E.value):null;t.instance.triggerOnChange(E.name,$)};E.addEventListener("blur",x),E.addEventListener("input",x)}if(w.appendChild(E),!l&&(e.min!=null||e.max!=null)){const x=rn(e,E);w.appendChild(x)}return v.appendChild(w),y===-1?f.appendChild(v):f.insertBefore(v,f.children[y]),p(),v}function b(){if(l)return;const h=f.querySelectorAll(".multiple-number-item"),y=h.length;h.forEach(v=>{let w=v.querySelector(".remove-item-btn");w||(w=document.createElement("button"),w.type="button",w.className="remove-item-btn px-2 py-1 text-red-600 hover:bg-red-50 rounded",w.innerHTML="\u2715",w.onclick=()=>{const x=Array.from(f.children).indexOf(v);f.children.length>u&&(c.splice(x,1),v.remove(),p(),C(),b())},v.appendChild(w));const E=y<=u;w.disabled=E,w.style.opacity=E?"0.5":"1",w.style.pointerEvents=E?"none":"auto"})}let g=null;if(!l){const h=Fe("number",()=>{c.push(e.default||""),m(e.default||""),C(),b()},{label:e.addLabel});g=h.update,Te(n,h.counter),n.appendChild(h.row)}function C(){g&&g(c.length,d)}c.forEach(h=>m(h)),C(),b()}function qr(e,t,n){var r,o,i,a,l;const s=[],{scopeRoot:c,skipValidation:u}=n,d=(p,m)=>{var b,g;if(!p)return;const C=`error-${p.getAttribute("name")||Math.random().toString(36).substring(7)}`;let h=document.getElementById(C);m?(p.classList.add("invalid"),p.title=m,h||(h=document.createElement("div"),h.id=C,h.className="error-message",h.style.cssText=`
|
|
278
278
|
color: var(--fb-error-color);
|
|
279
279
|
font-size: var(--fb-font-size-small);
|
|
280
280
|
margin-top: 0.25rem;
|
|
281
|
-
`,p.nextSibling?(b=p.parentNode)==null||b.insertBefore(h,p.nextSibling):(g=p.parentNode)==null||g.appendChild(h)),h.textContent=m,h.style.display="block"):(p.classList.remove("invalid"),p.title="",h&&h.remove())},f=(p,m,b)=>{let g=!1;const{state:C}=n;if(!u&&e.min!==void 0&&e.min!==null&&m<e.min){const h=k("minValue",C,{min:e.min});s.push(`${b}: ${h}`),d(p,h),g=!0}else if(!u&&e.max!==void 0&&e.max!==null&&m>e.max){const h=k("maxValue",C,{max:e.max});s.push(`${b}: ${h}`),d(p,h),g=!0}g||d(p,null)};if(e.multiple){const p=c.querySelectorAll(`[name^="${t}["]`),m=[];if(p.forEach((b,g)=>{var C,h,y;const v=(C=b==null?void 0:b.value)!=null?C:"";if(v===""){m.push(null),d(b,null);return}const w=parseFloat(v);if(!u&&!Number.isFinite(w)){const x=k("notANumber",n.state);s.push(`${t}[${g}]: ${x}`),d(b,x),m.push(null);return}f(b,w,`${t}[${g}]`);const E=Number.isInteger((h=e.decimals)!=null?h:0)&&(y=e.decimals)!=null?y:0;m.push(Number(w.toFixed(E)))}),!u){const{state:b}=n,g=(r=e.minCount)!=null?r:
|
|
281
|
+
`,p.nextSibling?(b=p.parentNode)==null||b.insertBefore(h,p.nextSibling):(g=p.parentNode)==null||g.appendChild(h)),h.textContent=m,h.style.display="block"):(p.classList.remove("invalid"),p.title="",h&&h.remove())},f=(p,m,b)=>{let g=!1;const{state:C}=n;if(!u&&e.min!==void 0&&e.min!==null&&m<e.min){const h=k("minValue",C,{min:e.min});s.push(`${b}: ${h}`),d(p,h),g=!0}else if(!u&&e.max!==void 0&&e.max!==null&&m>e.max){const h=k("maxValue",C,{max:e.max});s.push(`${b}: ${h}`),d(p,h),g=!0}g||d(p,null)};if(e.multiple){const p=c.querySelectorAll(`[name^="${t}\\["]`),m=[];if(p.forEach((b,g)=>{var C,h,y;const v=(C=b==null?void 0:b.value)!=null?C:"";if(v===""){m.push(null),d(b,null);return}const w=parseFloat(v);if(!u&&!Number.isFinite(w)){const x=k("notANumber",n.state);s.push(`${t}[${g}]: ${x}`),d(b,x),m.push(null);return}f(b,w,`${t}[${g}]`);const E=Number.isInteger((h=e.decimals)!=null?h:0)&&(y=e.decimals)!=null?y:0;m.push(Number(w.toFixed(E)))}),!u){const{state:b}=n,g=(r=e.minCount)!=null?r:0,C=(o=e.maxCount)!=null?o:1/0,h=m.filter(y=>y!==null);e.required&&h.length===0&&s.push(`${t}: ${k("required",b)}`),h.length<g&&s.push(`${t}: ${k("minItems",b,{min:g})}`),h.length>C&&s.push(`${t}: ${k("maxItems",b,{max:C})}`)}return{value:m,errors:s}}else{const p=c.querySelector(`[name$="${t}"]`),m=(i=p==null?void 0:p.value)!=null?i:"",{state:b}=n;if(!u&&e.required&&m===""){const h=k("required",b);return s.push(`${t}: ${h}`),d(p,h),{value:null,errors:s}}if(m==="")return d(p,null),{value:null,errors:s};const g=parseFloat(m);if(!u&&!Number.isFinite(g)){const h=k("notANumber",b);return s.push(`${t}: ${h}`),d(p,h),{value:null,errors:s}}f(p,g,t);const C=Number.isInteger((a=e.decimals)!=null?a:0)&&(l=e.decimals)!=null?l:0;return{value:Number(g.toFixed(C)),errors:s}}}function Rr(e,t,n,r){const{scopeRoot:o}=r;if(e.multiple){if(!Array.isArray(n)){console.warn(`updateNumberField: Expected array for multiple field "${t}", got ${typeof n}`);return}const i=o.querySelectorAll(`[name^="${t}\\["]`);i.forEach((a,l)=>{l<n.length&&(a.value=n[l]!=null?String(n[l]):"",a.classList.remove("invalid"),a.title="",xe(a))}),n.length!==i.length&&console.warn(`updateNumberField: Multiple field "${t}" has ${i.length} inputs but received ${n.length} values. Consider re-rendering for add/remove.`)}else{const i=o.querySelector(`[name="${t}"]`);i&&(i.value=n!=null?String(n):"",i.classList.remove("invalid"),i.title="",xe(i))}}function Br(e,t,n,r){const o=t.state,i=ae(e,o,t),a=document.createElement("select");if(a.className="w-full border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",a.style.cssText=`
|
|
282
282
|
padding: var(--fb-input-padding-y) var(--fb-input-padding-x);
|
|
283
283
|
font-size: var(--fb-font-size);
|
|
284
284
|
font-family: var(--fb-font-family);
|
|
285
|
-
`,a.name=r,a.disabled=i,(e.options||[]).forEach(l=>{const s=document.createElement("option");s.value=l.value,s.textContent=l.label,(t.prefill[e.key]||e.default)===l.value&&(s.selected=!0),a.appendChild(s)}),!i&&t.instance){const l=()=>{t.instance.triggerOnChange(r,a.value)};a.addEventListener("change",l)}if(n.appendChild(a),!i){const l=document.createElement("p");l.className="text-xs text-gray-500 mt-1",l.textContent=Le(e,o),n.appendChild(l)}}function Hr(e,t,n,r){var o,i,a,l;const s=t.state,c=ae(e,s,t),u=t.prefill[e.key]||[],d=Array.isArray(u)?[...u]:[],f=(o=e.minCount)!=null?o:1,p=(i=e.maxCount)!=null?i:1/0;for(;d.length<f;)d.push(e.default||((l=(a=e.options)==null?void 0:a[0])==null?void 0:l.value)||"");const m=document.createElement("div");m.className="space-y-2",n.appendChild(m);function b(){m.querySelectorAll(".multiple-select-item").forEach((v,w)=>{const E=v.querySelector("select");E&&(E.name=`${r}[${w}]`)})}function g(v="",w=-1){const E=document.createElement("div");E.className="multiple-select-item flex items-center gap-2";const x=document.createElement("select");if(x.className="flex-1 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",x.style.cssText=`
|
|
285
|
+
`,a.name=r,a.disabled=i,(e.options||[]).forEach(l=>{const s=document.createElement("option");s.value=l.value,s.textContent=l.label,(t.prefill[e.key]||e.default)===l.value&&(s.selected=!0),a.appendChild(s)}),!i&&t.instance){const l=()=>{t.instance.triggerOnChange(r,a.value)};a.addEventListener("change",l)}if(n.appendChild(a),!i){const l=document.createElement("p");l.className="text-xs text-gray-500 mt-1",l.textContent=Le(e,o),n.appendChild(l)}}function Hr(e,t,n,r){var o,i,a,l;const s=t.state,c=ae(e,s,t),u=t.prefill[e.key]||[],d=Array.isArray(u)?[...u]:[],f=(o=e.minCount)!=null?o:e.required?1:0,p=(i=e.maxCount)!=null?i:1/0;for(;d.length<f;)d.push(e.default||((l=(a=e.options)==null?void 0:a[0])==null?void 0:l.value)||"");const m=document.createElement("div");m.className="space-y-2",n.appendChild(m);function b(){m.querySelectorAll(".multiple-select-item").forEach((v,w)=>{const E=v.querySelector("select");E&&(E.name=`${r}[${w}]`)})}function g(v="",w=-1){const E=document.createElement("div");E.className="multiple-select-item flex items-center gap-2";const x=document.createElement("select");if(x.className="flex-1 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",x.style.cssText=`
|
|
286
286
|
padding: var(--fb-input-padding-y) var(--fb-input-padding-x);
|
|
287
287
|
font-size: var(--fb-font-size);
|
|
288
288
|
font-family: var(--fb-font-family);
|
|
@@ -290,7 +290,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
290
290
|
color: var(--fb-error-color);
|
|
291
291
|
font-size: var(--fb-font-size-small);
|
|
292
292
|
margin-top: 0.25rem;
|
|
293
|
-
`,c.nextSibling?(d=c.parentNode)==null||d.insertBefore(m,c.nextSibling):(f=c.parentNode)==null||f.appendChild(m)),m.textContent=u,m.style.display="block"):(c.classList.remove("invalid"),c.title="",m&&m.remove())},s=(c,u,d,f)=>{var p,m;if(a)return;const{state:b}=n,g=u.filter(f),C="minCount"in d&&(p=d.minCount)!=null?p:
|
|
293
|
+
`,c.nextSibling?(d=c.parentNode)==null||d.insertBefore(m,c.nextSibling):(f=c.parentNode)==null||f.appendChild(m)),m.textContent=u,m.style.display="block"):(c.classList.remove("invalid"),c.title="",m&&m.remove())},s=(c,u,d,f)=>{var p,m;if(a)return;const{state:b}=n,g=u.filter(f),C="minCount"in d&&(p=d.minCount)!=null?p:0,h="maxCount"in d&&(m=d.maxCount)!=null?m:1/0;d.required&&g.length===0&&o.push(`${c}: ${k("required",b)}`),g.length<C&&o.push(`${c}: ${k("minItems",b,{min:C})}`),g.length>h&&o.push(`${c}: ${k("maxItems",b,{max:h})}`)};if("multiple"in e&&e.multiple){const c=i.querySelectorAll(`[name^="${t}\\["]`),u=[];return c.forEach(d=>{var f;const p=(f=d==null?void 0:d.value)!=null?f:"";u.push(p),l(d,null)}),s(t,u,e,d=>d!==""),{value:u,errors:o}}else{const c=i.querySelector(`[name$="${t}"]`),u=(r=c==null?void 0:c.value)!=null?r:"";if(!a&&e.required&&u===""){const d=k("required",n.state);return o.push(`${t}: ${d}`),l(c,d),{value:null,errors:o}}else l(c,null);return{value:u===""?null:u,errors:o}}}function jr(e,t,n,r){const{scopeRoot:o}=r;if("multiple"in e&&e.multiple){if(!Array.isArray(n)){console.warn(`updateSelectField: Expected array for multiple field "${t}", got ${typeof n}`);return}const i=o.querySelectorAll(`[name^="${t}\\["]`);i.forEach((a,l)=>{l<n.length&&(a.value=n[l]!=null?String(n[l]):"",a.querySelectorAll("option").forEach(s=>{s.selected=s.value===String(n[l])}),a.classList.remove("invalid"),a.title="",xe(a))}),n.length!==i.length&&console.warn(`updateSelectField: Multiple field "${t}" has ${i.length} selects but received ${n.length} values. Consider re-rendering for add/remove.`)}else{const i=o.querySelector(`[name="${t}"]`);i&&(i.value=n!=null?String(n):"",i.querySelectorAll("option").forEach(a=>{a.selected=a.value===String(n)}),i.classList.remove("invalid"),i.title="",xe(i))}}function ot(e,t){t?(e.style.backgroundColor="var(--fb-primary-soft-color)",e.style.color="var(--fb-primary-color)",e.style.borderColor="var(--fb-primary-color)"):(e.style.backgroundColor="var(--fb-primary-color)",e.style.color="#ffffff",e.style.borderColor="var(--fb-primary-color)")}function lt(e,t){e.style.backgroundColor=t?"var(--fb-background-color)":"transparent",e.style.color="var(--fb-text-color)",e.style.borderColor="var(--fb-border-color)"}function on(e){return e.classList.contains("fb-switcher-preset")}function Or(e,t){const n=document.createElement("button");if(n.type="button",n.className="fb-switcher-btn fb-switcher-preset",n.dataset.value=e.value,n.style.cssText=`
|
|
294
294
|
display: inline-flex;
|
|
295
295
|
align-items: center;
|
|
296
296
|
gap: 8px;
|
|
@@ -334,7 +334,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
334
334
|
white-space: nowrap;
|
|
335
335
|
line-height: 1.25;
|
|
336
336
|
outline: none;
|
|
337
|
-
`,i.length===1?d.style.borderRadius="var(--fb-border-radius)":u===0?(d.style.borderRadius="var(--fb-border-radius) 0 0 var(--fb-border-radius)",d.style.borderRightWidth="0"):u===i.length-1?d.style.borderRadius="0 var(--fb-border-radius) var(--fb-border-radius) 0":(d.style.borderRadius="0",d.style.borderRightWidth="0")),c.value===t?ot(d,a):lt(d,a),r||(d.addEventListener("click",()=>{n.value=c.value,s.forEach(f=>{f.dataset.value===c.value?ot(f,a):lt(f,a)}),o&&o(c.value)}),d.addEventListener("mouseenter",()=>{n.value!==c.value&&(d.style.backgroundColor="var(--fb-background-hover-color)")}),d.addEventListener("mouseleave",()=>{n.value!==c.value&&(d.style.backgroundColor=a?"var(--fb-background-color)":"transparent")})),s.push(d),l.appendChild(d)}),l}function Ur(e,t,n,r){var o,i;const a=t.state,l=String((i=(o=t.prefill[e.key])!=null?o:e.default)!=null?i:""),s=document.createElement("input");s.type="hidden",s.name=r,s.value=l;const c=ae(e,a,t),u=!c&&t.instance?f=>{t.instance.triggerOnChange(r,f)}:null,d=ln(e,l,s,c,u);if(n.appendChild(s),n.appendChild(d),!c){const f=document.createElement("p");f.className="text-xs text-gray-500 mt-1",f.textContent=Le(e,a),n.appendChild(f)}}function Pr(e,t,n,r){var o,i,a,l;const s=t.state,c=t.prefill[e.key]||[],u=Array.isArray(c)?[...c]:[],d=(o=e.minCount)!=null?o:1,f=(i=e.maxCount)!=null?i:1/0;for(;u.length<d;)u.push(e.default||((l=(a=e.options)==null?void 0:a[0])==null?void 0:l.value)||"");const p=ae(e,s,t),m=document.createElement("div");m.className="space-y-2",n.appendChild(m);function b(){m.querySelectorAll(".multiple-switcher-item").forEach((v,w)=>{const E=v.querySelector("input[type=hidden]");E&&(E.name=`${r}[${w}]`)})}function g(v="",w=-1){const E=w===-1?m.children.length:w,x=`${r}[${E}]`,$=document.createElement("div");$.className="multiple-switcher-item flex items-center gap-2";const M=document.createElement("input");M.type="hidden",M.name=x,M.value=v,$.appendChild(M);const
|
|
337
|
+
`,i.length===1?d.style.borderRadius="var(--fb-border-radius)":u===0?(d.style.borderRadius="var(--fb-border-radius) 0 0 var(--fb-border-radius)",d.style.borderRightWidth="0"):u===i.length-1?d.style.borderRadius="0 var(--fb-border-radius) var(--fb-border-radius) 0":(d.style.borderRadius="0",d.style.borderRightWidth="0")),c.value===t?ot(d,a):lt(d,a),r||(d.addEventListener("click",()=>{n.value=c.value,s.forEach(f=>{f.dataset.value===c.value?ot(f,a):lt(f,a)}),o&&o(c.value)}),d.addEventListener("mouseenter",()=>{n.value!==c.value&&(d.style.backgroundColor="var(--fb-background-hover-color)")}),d.addEventListener("mouseleave",()=>{n.value!==c.value&&(d.style.backgroundColor=a?"var(--fb-background-color)":"transparent")})),s.push(d),l.appendChild(d)}),l}function Ur(e,t,n,r){var o,i;const a=t.state,l=String((i=(o=t.prefill[e.key])!=null?o:e.default)!=null?i:""),s=document.createElement("input");s.type="hidden",s.name=r,s.value=l;const c=ae(e,a,t),u=!c&&t.instance?f=>{t.instance.triggerOnChange(r,f)}:null,d=ln(e,l,s,c,u);if(n.appendChild(s),n.appendChild(d),!c){const f=document.createElement("p");f.className="text-xs text-gray-500 mt-1",f.textContent=Le(e,a),n.appendChild(f)}}function Pr(e,t,n,r){var o,i,a,l;const s=t.state,c=t.prefill[e.key]||[],u=Array.isArray(c)?[...c]:[],d=(o=e.minCount)!=null?o:e.required?1:0,f=(i=e.maxCount)!=null?i:1/0;for(;u.length<d;)u.push(e.default||((l=(a=e.options)==null?void 0:a[0])==null?void 0:l.value)||"");const p=ae(e,s,t),m=document.createElement("div");m.className="space-y-2",n.appendChild(m);function b(){m.querySelectorAll(".multiple-switcher-item").forEach((v,w)=>{const E=v.querySelector("input[type=hidden]");E&&(E.name=`${r}[${w}]`)})}function g(v="",w=-1){const E=w===-1?m.children.length:w,x=`${r}[${E}]`,$=document.createElement("div");$.className="multiple-switcher-item flex items-center gap-2";const M=document.createElement("input");M.type="hidden",M.name=x,M.value=v,$.appendChild(M);const q=!p&&t.instance?B=>{t.instance.triggerOnChange(M.name,B)}:null,K=ln(e,v,M,p,q);return $.appendChild(K),w===-1?m.appendChild($):m.insertBefore($,m.children[w]),b(),$}function C(){if(p)return;const v=m.querySelectorAll(".multiple-switcher-item"),w=v.length;v.forEach(E=>{let x=E.querySelector(".remove-item-btn");x||(x=document.createElement("button"),x.type="button",x.className="remove-item-btn px-2 py-1 rounded",x.style.cssText=`
|
|
338
338
|
color: var(--fb-error-color);
|
|
339
339
|
background-color: transparent;
|
|
340
340
|
transition: background-color var(--fb-transition-duration);
|
|
@@ -342,7 +342,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
342
342
|
color: var(--fb-error-color);
|
|
343
343
|
font-size: var(--fb-font-size-small);
|
|
344
344
|
margin-top: 0.25rem;
|
|
345
|
-
`,u.nextSibling?(f=u.parentNode)==null||f.insertBefore(b,u.nextSibling):(p=u.parentNode)==null||p.appendChild(b)),b.textContent=d,b.style.display="block"):(u.classList.remove("invalid"),u.title="",b&&b.remove())},s=(u,d,f,p)=>{var m,b;if(a)return;const{state:g}=n,C=d.filter(p),h="minCount"in f&&(m=f.minCount)!=null?m:
|
|
345
|
+
`,u.nextSibling?(f=u.parentNode)==null||f.insertBefore(b,u.nextSibling):(p=u.parentNode)==null||p.appendChild(b)),b.textContent=d,b.style.display="block"):(u.classList.remove("invalid"),u.title="",b&&b.remove())},s=(u,d,f,p)=>{var m,b;if(a)return;const{state:g}=n,C=d.filter(p),h="minCount"in f&&(m=f.minCount)!=null?m:0,y="maxCount"in f&&(b=f.maxCount)!=null?b:1/0;f.required&&C.length===0&&o.push(`${u}: ${k("required",g)}`),C.length<h&&o.push(`${u}: ${k("minItems",g,{min:h})}`),C.length>y&&o.push(`${u}: ${k("maxItems",g,{max:y})}`)},c=new Set("options"in e?e.options.map(u=>u.value):[]);if("multiple"in e&&e.multiple){const u=i.querySelectorAll(`input[type="hidden"][name^="${t}\\["]`),d=[];return u.forEach(f=>{var p;const m=(p=f==null?void 0:f.value)!=null?p:"";if(d.push(m),!a&&m!==""&&!c.has(m)){const b=k("invalidOption",n.state);l(f,b),o.push(`${t}: ${b}`)}else l(f,null)}),s(t,d,e,f=>f!==""),{value:d,errors:o}}else{const u=i.querySelector(`input[type="hidden"][name$="${t}"]`),d=(r=u==null?void 0:u.value)!=null?r:"";if(!a&&e.required&&d===""){const f=k("required",n.state);return o.push(`${t}: ${f}`),l(u,f),{value:null,errors:o}}if(!a&&d!==""&&!c.has(d)){const f=k("invalidOption",n.state);return o.push(`${t}: ${f}`),l(u,f),{value:null,errors:o}}return l(u,null),{value:d===""?null:d,errors:o}}}function Vr(e,t,n,r){var o;const{scopeRoot:i}=r;if("multiple"in e&&e.multiple){if(!Array.isArray(n)){console.warn(`updateSwitcherField: Expected array for multiple field "${t}", got ${typeof n}`);return}const a=i.querySelectorAll(`input[type="hidden"][name^="${t}\\["]`);a.forEach((l,s)=>{var c;if(s<n.length){const u=n[s]!=null?String(n[s]):"";l.value=u;const d=(c=l.parentElement)==null?void 0:c.querySelector(".fb-switcher-group");d&&d.querySelectorAll(".fb-switcher-btn").forEach(f=>{const p=on(f);f.dataset.value===u?ot(f,p):lt(f,p)}),l.classList.remove("invalid"),l.title="",xe(l)}}),n.length!==a.length&&console.warn(`updateSwitcherField: Multiple field "${t}" has ${a.length} inputs but received ${n.length} values. Consider re-rendering for add/remove.`)}else{const a=i.querySelector(`input[type="hidden"][name="${t}"]`);if(a){const l=n!=null?String(n):"";a.value=l;const s=(o=a.parentElement)==null?void 0:o.querySelector(".fb-switcher-group");s&&s.querySelectorAll(".fb-switcher-btn").forEach(c=>{const u=on(c);c.dataset.value===l?ot(c,u):lt(c,u)}),a.classList.remove("invalid"),a.title="",xe(a)}}}const an=36,Je=20,De=16;function Kr(e){const t="fb-boolean-styles";if(e.getElementById(t))return;const n=e.createElement("style");n.id=t,n.textContent=`
|
|
346
346
|
.fb-toggle {
|
|
347
347
|
position: relative;
|
|
348
348
|
display: inline-block;
|
|
@@ -943,7 +943,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
943
943
|
<div class="text-sm text-center">${se(k("clickDragText",t))}</div>
|
|
944
944
|
|
|
945
945
|
</div>
|
|
946
|
-
`}const un=new WeakMap;function st(e,t){const n=un.get(e);n&&(e.removeEventListener("dragover",n.dragover),e.removeEventListener("dragleave",n.dragleave),e.removeEventListener("drop",n.drop));const r=a=>{a.preventDefault(),e.classList.add("border-blue-500","bg-blue-50")},o=a=>{a.preventDefault(),e.classList.remove("border-blue-500","bg-blue-50")},i=a=>{var l;a.preventDefault(),e.classList.remove("border-blue-500","bg-blue-50");const s=(l=a.dataTransfer)==null?void 0:l.files;s&&t(s)};e.addEventListener("dragover",r),e.addEventListener("dragleave",o),e.addEventListener("drop",i),un.set(e,{dragover:r,dragleave:o,drop:i})}const Qr='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',eo='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',to='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/></svg>',no='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 18a4 4 0 000-8 6 6 0 00-11.5 2A4 4 0 006 20h11M12 12v7M12 12l-3 3M12 12l3 3"/></svg>',ro='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h4v16H4z"/><path d="M10 4h4v16h-4z"/><path d="M16 5l3.5 1-3 14L13 19"/></svg>';function oo(e,t){return!!(e.config.downloadFile||e.config.getDownloadUrl||e.config.getThumbnail||t!=null&&t.file)}function lo(e,t){return!!(e.config.getDownloadUrl||e.config.getThumbnail||t!=null&&t.file)}function Tt(e){const{canRemove:t,removeHandler:n,state:r,resourceId:o,fileName:i,meta:a,replaceHandler:l,libraryHandler:s}=e,c=document.createElement("div");c.className="fb-tile-actions";const u=(d,f,p)=>{const m=document.createElement("button");return m.type="button",m.className=`fb-tile-action-btn ${p}`,m.innerHTML=d,m.title=f,m.setAttribute("aria-label",f),m.addEventListener("click",b=>{b.stopPropagation()}),m};if(l){const d=u(no,k("replaceFile",r),"fb-tile-action-replace");d.addEventListener("click",()=>l()),c.appendChild(d)}if(s){const d=u(ro,k("fromLibrary",r),"fb-tile-action-library");d.addEventListener("click",()=>s()),c.appendChild(d)}if(oo(r,a)){const d=u(Qr,k("downloadFile",r),"fb-tile-action-download");d.addEventListener("click",()=>{io(o,i,r,a)}),c.appendChild(d)}if(lo(r,a)){const d=u(eo,k("openInNewTab",r),"fb-tile-action-open");d.addEventListener("click",()=>{ao(o,r,a).catch(f=>{console.error("Open failed:",f)})}),c.appendChild(d)}if(t&&n){const d=u(to,k("removeElement",r),"fb-tile-action-remove");d.addEventListener("click",()=>{n()}),c.appendChild(d)}return c}const ct=new WeakMap;function At(e){let t=ct.get(e);return t||(t=URL.createObjectURL(e),ct.set(e,t)),t}function
|
|
946
|
+
`}const un=new WeakMap;function st(e,t){const n=un.get(e);n&&(e.removeEventListener("dragover",n.dragover),e.removeEventListener("dragleave",n.dragleave),e.removeEventListener("drop",n.drop));const r=a=>{a.preventDefault(),e.classList.add("border-blue-500","bg-blue-50")},o=a=>{a.preventDefault(),e.classList.remove("border-blue-500","bg-blue-50")},i=a=>{var l;a.preventDefault(),e.classList.remove("border-blue-500","bg-blue-50");const s=(l=a.dataTransfer)==null?void 0:l.files;s&&t(s)};e.addEventListener("dragover",r),e.addEventListener("dragleave",o),e.addEventListener("drop",i),un.set(e,{dragover:r,dragleave:o,drop:i})}const Qr='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',eo='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',to='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/></svg>',no='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 18a4 4 0 000-8 6 6 0 00-11.5 2A4 4 0 006 20h11M12 12v7M12 12l-3 3M12 12l3 3"/></svg>',ro='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h4v16H4z"/><path d="M10 4h4v16h-4z"/><path d="M16 5l3.5 1-3 14L13 19"/></svg>';function oo(e,t){return!!(e.config.downloadFile||e.config.getDownloadUrl||e.config.getThumbnail||t!=null&&t.file)}function lo(e,t){return!!(e.config.getDownloadUrl||e.config.getThumbnail||t!=null&&t.file)}function Tt(e){const{canRemove:t,removeHandler:n,state:r,resourceId:o,fileName:i,meta:a,replaceHandler:l,libraryHandler:s}=e,c=document.createElement("div");c.className="fb-tile-actions";const u=(d,f,p)=>{const m=document.createElement("button");return m.type="button",m.className=`fb-tile-action-btn ${p}`,m.innerHTML=d,m.title=f,m.setAttribute("aria-label",f),m.addEventListener("click",b=>{b.stopPropagation()}),m};if(l){const d=u(no,k("replaceFile",r),"fb-tile-action-replace");d.addEventListener("click",()=>l()),c.appendChild(d)}if(s){const d=u(ro,k("fromLibrary",r),"fb-tile-action-library");d.addEventListener("click",()=>s()),c.appendChild(d)}if(oo(r,a)){const d=u(Qr,k("downloadFile",r),"fb-tile-action-download");d.addEventListener("click",()=>{io(o,i,r,a)}),c.appendChild(d)}if(lo(r,a)){const d=u(eo,k("openInNewTab",r),"fb-tile-action-open");d.addEventListener("click",()=>{ao(o,r,a).catch(f=>{console.error("Open failed:",f)})}),c.appendChild(d)}if(t&&n){const d=u(to,k("removeElement",r),"fb-tile-action-remove");d.addEventListener("click",()=>{n()}),c.appendChild(d)}return c}const ct=new WeakMap;function At(e){let t=ct.get(e);return t||(t=URL.createObjectURL(e),ct.set(e,t)),t}function qe(e){if(!e)return;const t=ct.get(e);t&&(URL.revokeObjectURL(t),ct.delete(e))}function io(e,t,n,r){if(n.config.downloadFile){n.config.downloadFile(e,t);return}if((r==null?void 0:r.file)instanceof File){gn(r.file,t||r.file.name);return}vn(e,t,n).catch(o=>{console.error("Download failed:",o)})}async function ao(e,t,n){let r=null;t.config.getDownloadUrl?r=t.config.getDownloadUrl(e):t.config.getThumbnail?r=await t.config.getThumbnail(e):(n==null?void 0:n.file)instanceof File&&(r=At(n.file)),r&&window.open(r,"_blank")}let we=null,Me=null,Re=null,dt=null;function so(){if(!we){we=document.createElement("div"),we.className="fb-tile-zoom-preview";const e=document.createElement("img");e.className="fb-tile-zoom-preview-img",we.appendChild(e),we.addEventListener("mouseenter",pn),we.addEventListener("mouseleave",fn)}return we}function co(e,t){const n=t.getBoundingClientRect(),r=350,o=6,i=8;let a;n.top-r-o>=i?a=n.top-r-o:n.bottom+o+r+i<=window.innerHeight?a=n.bottom+o:a=Math.max(i,Math.min(window.innerHeight-r-i,n.top));let l=n.left+n.width/2-r/2;l=Math.max(i,Math.min(window.innerWidth-r-i,l)),e.style.top=`${a}px`,e.style.left=`${l}px`}function fn(){Re!==null&&clearTimeout(Re),Re=setTimeout(()=>{Re=null,mn()},100)}function pn(){Re!==null&&(clearTimeout(Re),Re=null)}function mn(){Me!==null&&(clearTimeout(Me),Me=null),we&&we.parentNode&&(we.classList.remove("fb-tile-zoom-preview--visible"),we.parentNode.removeChild(we)),dt=null}function Ft(e,t,n,r){e.dataset.zoomSrc=t,e.dataset.zoomAlt=n,e.addEventListener("mouseenter",()=>{pn(),dt!==e&&mn(),dt=e,Me=setTimeout(()=>{Me=null;const o=so(),i=o.querySelector(".fb-tile-actions");i&&i.remove();const a=o.querySelector(".fb-tile-zoom-preview-img");a.src=t,a.alt=n,r&&(o.appendChild(r.cloneNode(!0)),uo(o.querySelector(".fb-tile-actions"),r)),o.style.pointerEvents="auto",co(o,e),document.body.appendChild(o),o.getBoundingClientRect(),o.classList.add("fb-tile-zoom-preview--visible")},200)}),e.addEventListener("mouseleave",()=>{Me!==null?(clearTimeout(Me),Me=null,dt=null):fn()})}function uo(e,t){const n=Array.from(t.querySelectorAll(".fb-tile-action-btn"));Array.from(e.querySelectorAll(".fb-tile-action-btn")).forEach((r,o)=>{const i=n[o];i&&r.addEventListener("click",a=>{a.stopPropagation(),i.click()})})}function fo(e,t,n,r){const o=document.createElement("img");o.style.cssText="width:100%;height:100%;object-fit:contain;background:var(--fb-file-upload-bg-color,#f3f4f6);",o.alt=n||k("previewAlt",r);const i=new FileReader;i.onload=a=>{var l;o.src=((l=a.target)==null?void 0:l.result)||""},i.readAsDataURL(t),e.appendChild(o)}function po(e,t){e.onclick=null;const n=e.cloneNode(!1);return e.parentNode&&e.parentNode.replaceChild(n,e),n}function mo(e,t,n,r,o,i){const a=URL.createObjectURL(t),l=po(e);return l.innerHTML=`
|
|
947
947
|
<div class="fb-video-preview-wrap">
|
|
948
948
|
<video style="width:100%;height:100%;object-fit:contain;" controls preload="auto" muted src="${a}">
|
|
949
949
|
${se(k("videoNotSupported",o))}
|
|
@@ -1009,7 +1009,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1009
1009
|
<div style="display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:6px;padding:6px;">
|
|
1010
1010
|
<div class="fb-spinner"></div>
|
|
1011
1011
|
<div style="font-size:11px;color:var(--fb-text-secondary-color,#6b7280);text-align:center;">${se(k("uploadingFile",l))}</div>
|
|
1012
|
-
</div>`;let b;try{b=await yn(o,l)}catch(h){throw m&&s!=null&&s.onAfterUpload?s.onAfterUpload(i,m):s!=null&&s.onRemove?s.onRemove():Lt(i,l),h}l.resourceIndex.set(b,{name:o.name,type:o.type,size:o.size,uploadedAt:new Date,file:o}),m&&m!==b&&Re((n=l.resourceIndex.get(m))==null?void 0:n.file);let g=p;g||(g=document.createElement("input"),g.type="hidden",g.name=a,(r=i.parentElement)==null||r.appendChild(g)),g.value=b;const C=o.type.startsWith("video/");!C&&s!=null&&s.onAfterUpload?s.onAfterUpload(i,b):!C&&s?wo(i,b,l,s).catch(console.error):zt(i,b,l,{fileName:o.name,isReadonly:!1,deps:s}).catch(console.error),c&&!l.config.readonly&&c.triggerOnChange(a,b)}function ko(e,t,n,r){const o=e.filter(m=>!je(m.name,n.allowedExtensions)),i=e.filter(m=>je(m.name,n.allowedExtensions)),a=i.filter(m=>!Xe(m.type,n.allowedMimes)),l=i.filter(m=>Xe(m.type,n.allowedMimes)),s=l.filter(m=>!it(m,n.maxSize)),c=l.filter(m=>it(m,n.maxSize)),u=n.maxCount===1/0?c.length:Math.max(0,n.maxCount-t),d=c.slice(0,u),f=c.length-d.length,p=[];if(o.length>0){const m=n.allowedExtensions.join(", "),b=o.map(g=>g.name).join(", ");p.push(k("invalidFileExtension",r,{name:b,formats:m}))}if(a.length>0){const m=n.allowedMimes.join(", "),b=a.map(g=>g.name).join(", ");p.push(k("invalidFileMime",r,{name:b,type:a.map(g=>g.type).join(", "),mimes:m}))}if(s.length>0){const m=s.map(b=>b.name).join(", ");p.push(k("fileTooLarge",r,{name:m,maxSize:n.maxSize}))}return f>0&&p.push(k("filesLimitExceeded",r,{skipped:f,max:n.maxCount})),{accepted:d,errorMessage:p.join(" \u2022 ")}}async function $o(e){var t;const{accepted:n,listEl:r,state:o,shouldHideAddTile:i,buildSuccessTile:a,prepareForUpload:l}=e;if(r&&i){const u=St(r),d=(t=u.querySelector(".fb-multi-add-tile-js"))!=null?t:u.querySelector(".fb-tile-add");d&&(d.style.display="none")}l==null||l();const s=new Array(n.length).fill(null),c=[];return await Promise.allSettled(n.map(async(u,d)=>{const f=Zr(u.name,o);r&&St(r).appendChild(f);try{const p=await yn(u,o);o.resourceIndex.set(p,{name:u.name,type:u.type,size:u.size,uploadedAt:new Date,file:u}),s[d]=p,a&&f.parentNode?f.replaceWith(a(p)):f.remove()}catch(p){const m=p instanceof Error?p:new Error(String(p)),b=m.cause,g=b instanceof Error?b:b!==void 0?new Error(String(b)):m;c.push({file:u,error:g}),f.remove()}})),{failures:c,orderedIds:s}}function So(e,t,n){if(t.length===0)return e;const r=t.map(o=>k("uploadFailed",n,{name:o.file.name,error:o.error.message})).join(" \u2022 ");return e?`${e} \u2022 ${r}`:r}async function xn(e,t,n,r){const{resourceIds:o,state:i,updateCallback:a,constraints:l,pathKey:s,instance:c,buildSuccessTile:u,prepareForUpload:d,coordinator:f}=e,{accepted:p,errorMessage:m}=ko(t,f.getOccupiedCount(),l,i);r&&(m?Se(r,m):Ge(r));const b=f.beginBatch(p.length),g=f.getOccupiedCount()>=l.maxCount,{failures:C,orderedIds:h}=await $o({accepted:p,listEl:n,state:i,shouldHideAddTile:g,buildSuccessTile:u,prepareForUpload:d});b.setResults(h),c&&s&&!i.config.readonly&&c.triggerOnChange(s,o);const{wasLast:y}=b.end();if(y&&a(),r){const v=So(m,C,i);v?Se(r,v):Ge(r)}}function Lo(e){const{filesContainer:t}=e;st(t,async n=>{var r;const o=(r=t.querySelector(".files-list"))!=null?r:t;await xn(e,Array.from(n),o,t)})}function To(e){const{filesPicker:t}=e;t.onchange=async()=>{var n,r;if(!t.files)return;const o=(n=t.closest("[data-files-wrapper]"))!=null?n:t.parentElement,i=(r=o==null?void 0:o.querySelector(".files-list"))!=null?r:null;await xn(e,Array.from(t.files),i,o),t.value=""}}function wn(e){var t,n;if(!e.accept)return;if(typeof e.accept=="string"){const l=ze(e.accept);return l.length>0?{extensions:l}:void 0}const r=(t=e.accept.extensions)!=null?t:[],o=(n=e.accept.mime)!=null?n:[],i=r.map(l=>l.toLowerCase());if(i.length===0&&o.length===0)return;const a={};return i.length>0&&(a.extensions=i),o.length>0&&(a.mime=o),a}function Cn(e,t,n,r,o){if(!je(e.name,t)){const i=t.join(", ");return k("invalidFileExtension",o,{name:e.name,formats:i})}if(!Xe(e.type,n)){const i=n.join(", ");return k("invalidFileMime",o,{name:e.name,type:e.type,mimes:i})}return sn(e.size,r)?null:k("fileTooLarge",o,{name:e.name,maxSize:r})}function En(e,t){var n;const r=t.resourceIndex.get(e.resourceId);t.resourceIndex.set(e.resourceId,{name:e.name,type:e.type,size:e.size,uploadedAt:(n=r==null?void 0:r.uploadedAt)!=null?n:new Date,file:r==null?void 0:r.file})}function kn(e,t){return e instanceof Error&&e.message?e.message:k("pickerError",t)}async function Ao(e){var t;const{state:n,element:r,wrapper:o,fieldPath:i,resourceIds:a,maxCount:l,updateCallback:s,instance:c,coordinator:u,list:d,buildSuccessTile:f}=e;if(!n.config.pickExistingFiles)return;const p=ze(r.accept),m=Ye(r.accept),b=(t=r.maxSize)!=null?t:1/0,g=u.getAllKnownRids(),C=new Set(g),h=l===1/0?1/0:Math.max(0,l-u.getOccupiedCount());let y;try{y=await n.config.pickExistingFiles({fieldPath:i,mode:"multiple",accept:wn(r),maxSizeMB:b===1/0?void 0:b,remainingSlots:h===1/0?void 0:h,selectedResourceIds:g})}catch(B){Se(o,kn(B,n));return}if(y.length===0)return;const v=new Set,w=y.filter(B=>C.has(B.resourceId)||v.has(B.resourceId)?!1:(v.add(B.resourceId),!0)).filter(B=>Cn(B,p,m,b,n)===null),E=l===1/0?w.length:Math.max(0,l-u.getOccupiedCount()),x=w.slice(0,E),$=w.length-x.length;if(x.length===0){$>0&&Se(o,k("filesLimitExceeded",n,{skipped:$,max:l}));return}Ge(o),$>0&&Se(o,k("filesLimitExceeded",n,{skipped:$,max:l}));for(const B of x)En(B,n);const M=x.map(B=>B.resourceId),R=u.beginBatch(x.length);R.setResults(M),n.config.readonly||c.triggerOnChange(i,a);const{wasLast:K}=R.end();if(K)s();else{const B=St(d);for(const z of M)B.appendChild(f(z))}}async function Fo(e,t,n,r,o,i,a,l){var s,c;if(!e.config.pickExistingFiles)return;const u=ze(t.accept),d=Ye(t.accept),f=(s=t.maxSize)!=null?s:1/0;let p;try{p=await e.config.pickExistingFiles({fieldPath:i,mode:"single",accept:wn(t),maxSizeMB:f===1/0?void 0:f,selectedResourceIds:[]})}catch(h){Se(n,kn(h,e));return}if(p.length===0)return;const m=p[0],b=Cn(m,u,d,f,e);if(b!==null){Se(n,b);return}Ge(n),En(m,e);let g=r.querySelector('input[type="hidden"]');g||(g=document.createElement("input"),g.type="hidden",g.name=o,r.appendChild(g));const C=g.value||null;C&&C!==m.resourceId&&Re((c=e.resourceIndex.get(C))==null?void 0:c.file),g.value=m.resourceId,await a(m.resourceId),e.config.readonly||l.triggerOnChange(i,m.resourceId)}const $n='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 18a4 4 0 000-8 6 6 0 00-11.5 2A4 4 0 006 20h11M12 12v7M12 12l-3 3M12 12l3 3"/></svg>',Sn='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h4v16H4z"/><path d="M10 4h4v16h-4z"/><path d="M16 5l3.5 1-3 14L13 19"/></svg>';function zo(e,t,n,r,o,i,a){var l;at(e,o.resourceIndex);const s=o.resourceIndex.get(e);(l=s==null?void 0:s.type)!=null&&l.startsWith("video/")?zt(t,e,o,{fileName:e,isReadonly:!1,deps:i}).catch(console.error):Nt(t,e,o,i,a);const c=document.createElement("input");c.type="hidden",c.name=n,c.value=e,r.appendChild(c)}function Mo(e,t,n,r,o=!1,i=""){$e();const a=document.createElement("div");a.className=`fb-wide-tile${t?" fb-file-card-row":""}${o?" fb-drag-over":""}`;const l=document.createElement("button");l.type="button",l.className="fb-wide-tile-upload fb-file-dropzone";const s=document.createElement("span");s.style.cssText="width:36px;height:36px;display:block;flex-shrink:0;",s.innerHTML=$n,l.appendChild(s);const c=document.createElement("div");if(c.className="fb-wide-tile-label",c.style.cssText="font-size:14px;font-weight:600;",c.textContent=k(o?"dropToUpload":"clickDragText",e),l.appendChild(c),i){const u=document.createElement("div");u.style.cssText="font-size:11px;opacity:0.65;margin-top:2px;",u.textContent=i,l.appendChild(u)}if(l.onclick=u=>{u.stopPropagation(),n()},a.appendChild(l),t&&r){const u=document.createElement("button");u.type="button",u.className="fb-wide-tile-library fb-file-library-card";const d=document.createElement("span");d.className="fb-wide-tile-library-icon",d.style.cssText="width:28px;height:28px;display:block;flex-shrink:0;",d.innerHTML=Sn,u.appendChild(d);const f=document.createElement("div");f.className="fb-wide-tile-library-label",f.style.cssText="font-size:13px;font-weight:600;text-align:center;",f.textContent=k("fromLibrary",e),u.appendChild(f);const p=document.createElement("div");p.className="fb-wide-tile-library-hint",p.style.cssText="font-size:11px;opacity:0.75;text-align:center;",p.textContent=k("libraryHint",e),u.appendChild(p),u.onclick=m=>{m.stopPropagation(),r()},a.appendChild(u)}return Ln(a,{onEnter:()=>{const u=a.querySelector(".fb-wide-tile-label");u&&(u.textContent=k("dropToUpload",e))},onLeave:()=>{const u=a.querySelector(".fb-wide-tile-label");u&&(u.textContent=k("clickDragText",e))},activeClass:"fb-drag-over"}),a}function Ln(e,t){let n=0;e.addEventListener("dragover",r=>{r.preventDefault()}),e.addEventListener("dragenter",r=>{r.preventDefault(),n++,n===1&&(e.classList.add(t.activeClass),t.onEnter())}),e.addEventListener("dragleave",r=>{r.preventDefault(),n=Math.max(0,n-1),n===0&&(e.classList.remove(t.activeClass),t.onLeave())}),e.addEventListener("drop",()=>{n=0,e.classList.remove(t.activeClass),t.onLeave()})}function Nt(e,t,n,r,o){var i,a;const l=n.resourceIndex.get(t);if((i=l==null?void 0:l.type)!=null&&i.startsWith("video/")){zt(e,t,n,{fileName:(a=l==null?void 0:l.name)!=null?a:"",isReadonly:!1,deps:r}).catch(console.error);return}$e();const s=document.createElement("div");s.className="fb-multi-outer fb-multi-has-files";const c=document.createElement("div");c.className="fb-multi-grid fb-tiles-wrap",s.appendChild(c);const u=It(t,n,!!r.onRemove,r.onRemove?()=>{var d;return(d=r.onRemove)==null?void 0:d.call(r)}:null,o);for(c.appendChild(u),e.className="file-preview-container",e.removeAttribute("style");e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s)}function No(e,t,n,r,o=!1){const i=document.createElement("div");i.className=`fb-multi-add-tile fb-multi-add-tile-js${o?" fb-drag-over-tile":""}`;const a=document.createElement("button");a.type="button",a.className="fb-multi-add-upload fb-tile-add fb-file-dropzone";const l=document.createElement("span");l.style.cssText="width:28px;height:28px;display:block;flex-shrink:0;",l.innerHTML=$n,a.appendChild(l);const s=document.createElement("span");if(s.className="fb-multi-add-label",s.style.cssText="font-size:11px;font-weight:600;",s.textContent=k(o?"dropToUpload":"clickDragTextMultiple",e),a.appendChild(s),a.onclick=c=>{c.stopPropagation(),n()},i.appendChild(a),t&&r){const c=document.createElement("div");c.className="fb-multi-add-divider",i.appendChild(c);const u=document.createElement("button");u.type="button",u.className="fb-multi-add-library fb-tile-add-library fb-file-library-card",u.setAttribute("aria-label",k("fromLibrary",e));const d=document.createElement("span");d.style.cssText="width:14px;height:14px;display:block;flex-shrink:0;",d.innerHTML=Sn,u.appendChild(d),u.appendChild(document.createTextNode(k("fromLibrary",e))),u.onclick=f=>{f.stopPropagation(),r()},i.appendChild(u)}return i}function It(e,t,n,r,o){var i,a,l;$e();const s=t.resourceIndex.get(e),c=document.createElement("div");c.className="fb-preview-tile fb-checker fb-tile-resource resource-pill",c.dataset.resourceId=e;const u=Tt({canRemove:n&&r!==null,removeHandler:r,state:t,resourceId:e,fileName:(i=s==null?void 0:s.name)!=null?i:"",meta:s,replaceHandler:(a=o==null?void 0:o.replaceHandler)!=null?a:null,libraryHandler:(l=o==null?void 0:o.libraryHandler)!=null?l:null});return bn(c,e,s,t,u).catch(d=>{console.error("Failed to render tile:",d)}),c}function Tn(e=!1){const t=document.createElement("div");return t.className=`fb-multi-placeholder fb-checker${e?" fb-drag-over":""}`,t}function Io(e,t,n,r,o,i){const a=document.createElement("div");a.className="fb-meta-line";const l=document.createElement("div");if(l.className="fb-meta-text",t.maxSize&&t.maxSize!==1/0){const u=document.createElement("span");u.textContent=k("hintMaxSize",e,{size:t.maxSize}),l.appendChild(u),l.appendChild(An())}const s=ze(t.accept);if(s.length>0){const u=document.createElement("span");u.className="fb-meta-mono",u.textContent=s.map(d=>d.toUpperCase()).join(", "),l.appendChild(u),l.appendChild(An())}const c=document.createElement("span");if(r<1/0)c.textContent=k("fileCountWithMax",e,{count:n,max:r});else{const u=n===1?"fileCountSingle":"fileCountPlural";c.textContent=k(u,e,{count:n})}if(l.appendChild(c),a.appendChild(l),o&&n>1){const u=document.createElement("button");u.type="button",u.className="fb-clear-all-btn",u.textContent=k("clearAll",e),u.onclick=d=>{d.stopPropagation(),window.confirm(k("clearAll",e)+"?")&&i()},a.appendChild(u)}return a}function An(){const e=document.createElement("span");return e.className="fb-meta-dot",e}const Ze=new WeakMap;function Ro(e){const t=Ze.get(e);t&&(t.disconnect(),Ze.delete(e)),e.querySelectorAll(".fb-multi-placeholder").forEach(n=>n.remove())}function qo(e){var t;const{container:n,rids:r,state:o,onRemove:i,maxCount:a,isReadonly:l=!1,onLibraryPick:s,element:c,onClearAll:u,openPicker:d}=e;$e();const f=n.closest("[data-files-wrapper]");f&&(f.dataset.resourceIds=JSON.stringify(r!=null?r:[]));const p=Ze.get(n);for(p&&(p.disconnect(),Ze.delete(n));n.firstChild;)n.removeChild(n.firstChild);const m=r!=null?r:[],b=a!=null?a:1/0,g=b!==1/0&&m.length>=b,C=!l&&typeof s=="function",h=d!=null?d:(()=>{var x;const $=(x=n.closest("[data-files-wrapper]"))==null?void 0:x.querySelector('input[type="file"]');$&&$.click()});if(l){if(m.length===0){const x=document.createElement("div");x.className="fb-tile-empty-text",x.textContent=k("noFilesSelected",o),n.appendChild(x)}else{const x=document.createElement("div");x.className="fb-multi-readonly-grid",n.appendChild(x);for(const $ of m){const M=o.resourceIndex.get($),R=document.createElement("div");R.className="fb-readonly-tile fb-checker fb-tile fb-tile-resource",R.dataset.resourceId=$;const K=Tt({canRemove:!1,removeHandler:null,state:o,resourceId:$,fileName:(t=M==null?void 0:M.name)!=null?t:"",meta:M});bn(R,$,M,o,K).catch(console.error),R.onclick=async()=>{var B;let z=null;o.config.getDownloadUrl?z=o.config.getDownloadUrl($):o.config.getThumbnail?z=await o.config.getThumbnail($):(M==null?void 0:M.file)instanceof File&&(z=URL.createObjectURL(M.file)),z?window.open(z,"_blank"):o.config.downloadFile&&o.config.downloadFile($,(B=M==null?void 0:M.name)!=null?B:"")},x.appendChild(R)}}return}const y=document.createElement("div");y.className=`fb-multi-outer${m.length>0?" fb-multi-has-files":""}`;const v=document.createElement("div");v.className="fb-multi-grid fb-tiles-wrap",y.appendChild(v),n.appendChild(y);for(let x=0;x<m.length;x++){const $=m[x],M=It($,o,i!==null,i?()=>i($):null);v.appendChild(M)}if(!g){const x=No(o,C,h,s!=null?s:null);v.appendChild(x)}const w=m.length+(g?0:1),E=()=>{const x=getComputedStyle(v).gridTemplateColumns,$=x?x.split(" ").filter(Boolean).length:0;if(!$)return;const M=w%$,R=M===0?0:$-M,K=b===1/0?R:Math.max(0,b-w),B=Math.min(R,K),z=v.querySelectorAll(".fb-multi-placeholder");if(z.length>B)for(let D=z.length-1;D>=B;D--)z[D].remove();else if(z.length<B)for(let D=z.length;D<B;D++)v.appendChild(Tn())};if((b===1/0||b>w)&&v.appendChild(Tn()),requestAnimationFrame(E),typeof ResizeObserver!="undefined"){const x=new ResizeObserver(()=>E());x.observe(v),Ze.set(n,x)}if(Ln(y,{activeClass:"fb-drag-over",onEnter:()=>{v.querySelectorAll(".fb-multi-placeholder").forEach($=>{$.classList.add("fb-drag-over")});const x=v.querySelector(".fb-multi-add-tile-js");if(x){x.classList.add("fb-drag-over-tile");const $=x.querySelector(".fb-multi-add-label");$&&($.textContent=k("dropToUpload",o))}},onLeave:()=>{v.querySelectorAll(".fb-multi-placeholder").forEach($=>{$.classList.remove("fb-drag-over")});const x=v.querySelector(".fb-multi-add-tile-js");if(x){x.classList.remove("fb-drag-over-tile");const $=x.querySelector(".fb-multi-add-label");$&&($.textContent=k("clickDragTextMultiple",o))}}}),c){const x=Io(o,c,m.length,b,!!u,u!=null?u:(()=>{}));n.appendChild(x)}}function Bo(e,t,n,r){var o,i;const a=t.state,l=document.createElement("div");l.className="space-y-2",l.dataset.filesWrapper=r;const s=document.createElement("input");s.type="file",s.name=r,s.style.display="none",s.accept=Fn(e.accept);const c=document.createElement("div");c.className="file-preview-container";const u=t.prefill[e.key],d=ze(e.accept),f=Ye(e.accept),p=(o=e.maxSize)!=null?o:1/0,m={fileUploadHandler(){s.click()},dragHandler(h){h.length>0&&Eo({file:h[0],container:c,fieldName:r,state:a,deps:g(),instance:t.instance,allowedExtensions:d,allowedMimes:f,maxSizeMB:p})},setupDrop(h){st(h,m.dragHandler)},onRemove(){var h;const y=l.querySelector('input[type="hidden"]'),v=y==null?void 0:y.value;v&&Re((h=a.resourceIndex.get(v))==null?void 0:h.file),y&&(y.value=""),C()}},b=()=>{const h=!!(a.config.pickExistingFiles&&!e.disableLibrary);return{replaceHandler:a.config.uploadFile?()=>s.click():null,libraryHandler:h?()=>{Fo(a,e,c,l,r,r,async y=>{Nt(c,y,a,g(),b())},t.instance).catch(y=>{console.error("Library pick failed:",y)})}:null}},g=()=>({picker:s,fileUploadHandler:m.fileUploadHandler,dragHandler:m.dragHandler,setupDrop:m.setupDrop,onRemove:m.onRemove,onAfterUpload:(h,y)=>{Nt(h,y,a,g(),b())}}),C=()=>{for($e(),c.className="file-preview-container",c.removeAttribute("style");c.firstChild;)c.removeChild(c.firstChild);const h=b().libraryHandler,y=Mo(a,h!==null,m.fileUploadHandler,h,!1,Le(e,a));c.appendChild(y),st(c,m.dragHandler)};if(u){zo(u,c,r,l,a,g(),b());const h=a.resourceIndex.get(u);(i=h==null?void 0:h.type)!=null&&i.startsWith("video/")&&st(c,m.dragHandler)}else C();s.onchange=()=>{s.files&&s.files.length>0&&m.dragHandler(s.files)},l.appendChild(c),l.appendChild(s),n.appendChild(l)}function Fn(e){var t,n,r;return e?typeof e=="string"?e:[...(n=(t=e.extensions)==null?void 0:t.map(o=>`.${o}`))!=null?n:[],...(r=e.mime)!=null?r:[]].join(","):""}function zn(e,t,n,r,o){var i,a;const l=t.state,s=document.createElement("div");s.className="space-y-2",s.dataset.filesWrapper=r;const c=document.createElement("input");c.type="file",c.name=r,c.multiple=!0,c.style.display="none",c.accept=Fn(e.accept);const u=document.createElement("div");u.className="files-list-wrapper";const d=document.createElement("div");d.className="files-list",s.appendChild(c),s.appendChild(u),u.appendChild(d);const f=Array.isArray(t.prefill[e.key])?[...t.prefill[e.key]]:[];$t(f,l.resourceIndex),s.dataset.resourceIds=JSON.stringify(f);const p={maxCount:o,allowedExtensions:ze(e.accept),allowedMimes:Ye(e.accept),maxSize:(a=(i=e.maxSize)!=null?i:e.maxSizeMB)!=null?a:1/0},m=()=>{c.click()},b=l.config.pickExistingFiles&&!e.disableLibrary?()=>{Ao({state:l,element:e,wrapper:s,fieldPath:r,resourceIds:f,maxCount:o,updateCallback:g,instance:t.instance,coordinator:M,list:d,buildSuccessTile:R}).catch(z=>{console.error("Library pick failed:",z)})}:null;function g(){const z=ae(e,l);qo({container:d,rids:f,state:l,onRemove:z?null:D=>{var J,Q;Re((J=l.resourceIndex.get(D))==null?void 0:J.file);const ne=f.indexOf(D);ne>-1&&f.splice(ne,1),M.hasInFlightBatches()?(x.add(D),(Q=d.querySelector(`[data-resource-id="${D}"]`))==null||Q.remove(),s.dataset.resourceIds=JSON.stringify(f)):g(),t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f)},maxCount:o<1/0?o:void 0,isReadonly:z,onLibraryPick:z?null:b,element:e,onClearAll:z?void 0:()=>{var D,J;for(const Q of f)Re((D=l.resourceIndex.get(Q))==null?void 0:D.file);if(f.splice(0),M.hasInFlightBatches()){const Q=d.querySelectorAll("[data-resource-id]");for(const ne of Q){const he=ne.dataset.resourceId;he&&(Re((J=l.resourceIndex.get(he))==null?void 0:J.file),x.add(he)),ne.remove()}s.dataset.resourceIds=JSON.stringify(f)}else g();t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f)},openPicker:m})}let C=0,h=0,y=0,v=0;const w=new Map,E=new Map,x=new Set,$=()=>{for(var z;w.has(v);){const D=v,J=w.get(D);w.delete(D),v+=1;const Q=(z=E.get(D))!=null?z:0;E.delete(D),C-=Q;for(const ne of J)if(ne!==null){if(x.has(ne)){x.delete(ne);continue}f.push(ne)}}s.dataset.resourceIds=JSON.stringify(f)},M={getOccupiedCount:()=>f.length+C,getAllKnownRids:()=>{const z=[...f];for(const D of w.values())for(const J of D)J!==null&&z.push(J);return z},hasInFlightBatches:()=>h>0||E.size>0,wasRemovedDuringBatch:z=>x.has(z),beginBatch:z=>{C+=z,h+=1;const D=y++;return E.set(D,z),{setResults:J=>{w.set(D,J),$()},end:()=>{h-=1;const J=h===0&&E.size===0;return J&&x.clear(),{wasLast:J}}}}},R=z=>{const D=ae(e,l);return It(z,l,!D,D?null:()=>{var J,Q,ne;Re((J=l.resourceIndex.get(z))==null?void 0:J.file);const he=f.indexOf(z);if(he>-1){f.splice(he,1),M.hasInFlightBatches()?(x.add(z),(Q=d.querySelector(`[data-resource-id="${z}"]`))==null||Q.remove(),s.dataset.resourceIds=JSON.stringify(f)):g(),t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f);return}x.add(z),(ne=d.querySelector(`[data-resource-id="${z}"]`))==null||ne.remove(),t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f)})},K=()=>Ro(d),B={resourceIds:f,state:l,updateCallback:g,constraints:p,pathKey:r,instance:t.instance,buildSuccessTile:R,prepareForUpload:K,coordinator:M};Lo({...B,filesContainer:u}),To({...B,filesPicker:c}),g(),n.appendChild(s)}function Ho(e,t,n,r){zn(e,t,n,r,1/0)}function Do(e,t,n,r){var o;zn(e,t,n,r,(o=e.maxCount)!=null?o:1/0)}function jo(e,t){const n=e.querySelector(`[data-files-wrapper="${t}"]`);if(!n)return[];const r=n.dataset.resourceIds;if(r===void 0)throw new Error(`readMultiFileResourceIds: [data-files-wrapper="${t}"] is missing data-resource-ids attribute. This is a render bug.`);const o=JSON.parse(r);if(!Array.isArray(o))throw new Error(`readMultiFileResourceIds: data-resource-ids on [data-files-wrapper="${t}"] is not a JSON array. Got: ${r}`);return o}function Oo(e,t,n,r,o){var i,a;const l="minCount"in n&&(i=n.minCount)!=null?i:0,s="maxCount"in n&&(a=n.maxCount)!=null?a:1/0;n.required&&t.length===0&&o.push(`${e}: ${k("required",r)}`),t.length<l&&o.push(`${e}: ${k("minFiles",r,{min:l})}`),t.length>s&&o.push(`${e}: ${k("maxFiles",r,{max:s})}`)}function Mn(e,t,n,r,o){var i,a;const l="accept"in n?n.accept:void 0,s=ze(l),c=Ye(l);if(s.length===0&&c.length===0)return;const u=s.join(", "),d=c.join(", ");for(const f of t){const p=r.resourceIndex.get(f),m=(i=p==null?void 0:p.name)!=null?i:f;if(s.length>0&&!je(m,s)){o.push(`${e}: ${k("invalidFileExtension",r,{name:m,formats:u})}`);continue}if(c.length>0&&!(p!=null&&p.inferredFromExtension)){const b=(a=p==null?void 0:p.type)!=null?a:"";Xe(b,c)||o.push(`${e}: ${k("invalidFileMime",r,{name:m,type:b,mimes:d})}`)}}}function Nn(e,t,n,r,o){var i;const a="maxSize"in n&&(i=n.maxSize)!=null?i:1/0;if(a!==1/0)for(const l of t){const s=r.resourceIndex.get(l);s&&s.size>a*1024*1024&&o.push(`${e}: ${k("fileTooLarge",r,{name:s.name,maxSize:a})}`)}}function Uo(e,t,n){const{scopeRoot:r,skipValidation:o,path:i,state:a}=n,l=[],s=ke(i,t),c=jo(r,s);return o||(Oo(t,c,e,a,l),Mn(t,c,e,a,l),Nn(t,c,e,a,l)),{value:c,errors:l}}function Po(e,t,n){var r;const{scopeRoot:o,skipValidation:i,state:a}=n,l=[],s=o.querySelector(`input[name$="${t}"][type="hidden"]`),c=(r=s==null?void 0:s.value)!=null?r:"";return!i&&e.required&&c===""?(l.push(`${t}: ${k("required",a)}`),{value:null,errors:l}):(!i&&c!==""&&(Mn(t,[c],e,a,l),Nn(t,[c],e,a,l)),{value:c||null,errors:l})}function In(e,t,n){return e.type==="files"||"multiple"in e&&e.multiple?Uo(e,t,n):Po(e,t,n)}function Wo(e,t,n,r){const o=t.state,i=t.prefill[e.key],a=typeof i=="string"?i:"";if(a){$t([a],o.resourceIndex);const l=document.createElement("input");l.type="hidden",l.name=r,l.value=a,n.appendChild(l),Mt(a,o).then(s=>{s.classList.add("fb-single-readonly-filled","fb-readonly-tile","fb-checker"),n.appendChild(s)}).catch(console.error)}else n.appendChild(Vo(o))}function Vo(e){$e();const t=document.createElement("div");return t.style.cssText=`
|
|
1012
|
+
</div>`;let b;try{b=await yn(o,l)}catch(h){throw m&&s!=null&&s.onAfterUpload?s.onAfterUpload(i,m):s!=null&&s.onRemove?s.onRemove():Lt(i,l),h}l.resourceIndex.set(b,{name:o.name,type:o.type,size:o.size,uploadedAt:new Date,file:o}),m&&m!==b&&qe((n=l.resourceIndex.get(m))==null?void 0:n.file);let g=p;g||(g=document.createElement("input"),g.type="hidden",g.name=a,(r=i.parentElement)==null||r.appendChild(g)),g.value=b;const C=o.type.startsWith("video/");!C&&s!=null&&s.onAfterUpload?s.onAfterUpload(i,b):!C&&s?wo(i,b,l,s).catch(console.error):zt(i,b,l,{fileName:o.name,isReadonly:!1,deps:s}).catch(console.error),c&&!l.config.readonly&&c.triggerOnChange(a,b)}function ko(e,t,n,r){const o=e.filter(m=>!je(m.name,n.allowedExtensions)),i=e.filter(m=>je(m.name,n.allowedExtensions)),a=i.filter(m=>!Xe(m.type,n.allowedMimes)),l=i.filter(m=>Xe(m.type,n.allowedMimes)),s=l.filter(m=>!it(m,n.maxSize)),c=l.filter(m=>it(m,n.maxSize)),u=n.maxCount===1/0?c.length:Math.max(0,n.maxCount-t),d=c.slice(0,u),f=c.length-d.length,p=[];if(o.length>0){const m=n.allowedExtensions.join(", "),b=o.map(g=>g.name).join(", ");p.push(k("invalidFileExtension",r,{name:b,formats:m}))}if(a.length>0){const m=n.allowedMimes.join(", "),b=a.map(g=>g.name).join(", ");p.push(k("invalidFileMime",r,{name:b,type:a.map(g=>g.type).join(", "),mimes:m}))}if(s.length>0){const m=s.map(b=>b.name).join(", ");p.push(k("fileTooLarge",r,{name:m,maxSize:n.maxSize}))}return f>0&&p.push(k("filesLimitExceeded",r,{skipped:f,max:n.maxCount})),{accepted:d,errorMessage:p.join(" \u2022 ")}}async function $o(e){var t;const{accepted:n,listEl:r,state:o,shouldHideAddTile:i,buildSuccessTile:a,prepareForUpload:l}=e;if(r&&i){const u=St(r),d=(t=u.querySelector(".fb-multi-add-tile-js"))!=null?t:u.querySelector(".fb-tile-add");d&&(d.style.display="none")}l==null||l();const s=new Array(n.length).fill(null),c=[];return await Promise.allSettled(n.map(async(u,d)=>{const f=Zr(u.name,o);r&&St(r).appendChild(f);try{const p=await yn(u,o);o.resourceIndex.set(p,{name:u.name,type:u.type,size:u.size,uploadedAt:new Date,file:u}),s[d]=p,a&&f.parentNode?f.replaceWith(a(p)):f.remove()}catch(p){const m=p instanceof Error?p:new Error(String(p)),b=m.cause,g=b instanceof Error?b:b!==void 0?new Error(String(b)):m;c.push({file:u,error:g}),f.remove()}})),{failures:c,orderedIds:s}}function So(e,t,n){if(t.length===0)return e;const r=t.map(o=>k("uploadFailed",n,{name:o.file.name,error:o.error.message})).join(" \u2022 ");return e?`${e} \u2022 ${r}`:r}async function xn(e,t,n,r){const{resourceIds:o,state:i,updateCallback:a,constraints:l,pathKey:s,instance:c,buildSuccessTile:u,prepareForUpload:d,coordinator:f}=e,{accepted:p,errorMessage:m}=ko(t,f.getOccupiedCount(),l,i);r&&(m?Se(r,m):Ge(r));const b=f.beginBatch(p.length),g=f.getOccupiedCount()>=l.maxCount,{failures:C,orderedIds:h}=await $o({accepted:p,listEl:n,state:i,shouldHideAddTile:g,buildSuccessTile:u,prepareForUpload:d});b.setResults(h),c&&s&&!i.config.readonly&&c.triggerOnChange(s,o);const{wasLast:y}=b.end();if(y&&a(),r){const v=So(m,C,i);v?Se(r,v):Ge(r)}}function Lo(e){const{filesContainer:t}=e;st(t,async n=>{var r;const o=(r=t.querySelector(".files-list"))!=null?r:t;await xn(e,Array.from(n),o,t)})}function To(e){const{filesPicker:t}=e;t.onchange=async()=>{var n,r;if(!t.files)return;const o=(n=t.closest("[data-files-wrapper]"))!=null?n:t.parentElement,i=(r=o==null?void 0:o.querySelector(".files-list"))!=null?r:null;await xn(e,Array.from(t.files),i,o),t.value=""}}function wn(e){var t,n;if(!e.accept)return;if(typeof e.accept=="string"){const l=ze(e.accept);return l.length>0?{extensions:l}:void 0}const r=(t=e.accept.extensions)!=null?t:[],o=(n=e.accept.mime)!=null?n:[],i=r.map(l=>l.toLowerCase());if(i.length===0&&o.length===0)return;const a={};return i.length>0&&(a.extensions=i),o.length>0&&(a.mime=o),a}function Cn(e,t,n,r,o){if(!je(e.name,t)){const i=t.join(", ");return k("invalidFileExtension",o,{name:e.name,formats:i})}if(!Xe(e.type,n)){const i=n.join(", ");return k("invalidFileMime",o,{name:e.name,type:e.type,mimes:i})}return sn(e.size,r)?null:k("fileTooLarge",o,{name:e.name,maxSize:r})}function En(e,t){var n;const r=t.resourceIndex.get(e.resourceId);t.resourceIndex.set(e.resourceId,{name:e.name,type:e.type,size:e.size,uploadedAt:(n=r==null?void 0:r.uploadedAt)!=null?n:new Date,file:r==null?void 0:r.file})}function kn(e,t){return e instanceof Error&&e.message?e.message:k("pickerError",t)}async function Ao(e){var t;const{state:n,element:r,wrapper:o,fieldPath:i,resourceIds:a,maxCount:l,updateCallback:s,instance:c,coordinator:u,list:d,buildSuccessTile:f}=e;if(!n.config.pickExistingFiles)return;const p=ze(r.accept),m=Ye(r.accept),b=(t=r.maxSize)!=null?t:1/0,g=u.getAllKnownRids(),C=new Set(g),h=l===1/0?1/0:Math.max(0,l-u.getOccupiedCount());let y;try{y=await n.config.pickExistingFiles({fieldPath:i,mode:"multiple",accept:wn(r),maxSizeMB:b===1/0?void 0:b,remainingSlots:h===1/0?void 0:h,selectedResourceIds:g})}catch(B){Se(o,kn(B,n));return}if(y.length===0)return;const v=new Set,w=y.filter(B=>C.has(B.resourceId)||v.has(B.resourceId)?!1:(v.add(B.resourceId),!0)).filter(B=>Cn(B,p,m,b,n)===null),E=l===1/0?w.length:Math.max(0,l-u.getOccupiedCount()),x=w.slice(0,E),$=w.length-x.length;if(x.length===0){$>0&&Se(o,k("filesLimitExceeded",n,{skipped:$,max:l}));return}Ge(o),$>0&&Se(o,k("filesLimitExceeded",n,{skipped:$,max:l}));for(const B of x)En(B,n);const M=x.map(B=>B.resourceId),q=u.beginBatch(x.length);q.setResults(M),n.config.readonly||c.triggerOnChange(i,a);const{wasLast:K}=q.end();if(K)s();else{const B=St(d);for(const z of M)B.appendChild(f(z))}}async function Fo(e,t,n,r,o,i,a,l){var s,c;if(!e.config.pickExistingFiles)return;const u=ze(t.accept),d=Ye(t.accept),f=(s=t.maxSize)!=null?s:1/0;let p;try{p=await e.config.pickExistingFiles({fieldPath:i,mode:"single",accept:wn(t),maxSizeMB:f===1/0?void 0:f,selectedResourceIds:[]})}catch(h){Se(n,kn(h,e));return}if(p.length===0)return;const m=p[0],b=Cn(m,u,d,f,e);if(b!==null){Se(n,b);return}Ge(n),En(m,e);let g=r.querySelector('input[type="hidden"]');g||(g=document.createElement("input"),g.type="hidden",g.name=o,r.appendChild(g));const C=g.value||null;C&&C!==m.resourceId&&qe((c=e.resourceIndex.get(C))==null?void 0:c.file),g.value=m.resourceId,await a(m.resourceId),e.config.readonly||l.triggerOnChange(i,m.resourceId)}const $n='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 18a4 4 0 000-8 6 6 0 00-11.5 2A4 4 0 006 20h11M12 12v7M12 12l-3 3M12 12l3 3"/></svg>',Sn='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h4v16H4z"/><path d="M10 4h4v16h-4z"/><path d="M16 5l3.5 1-3 14L13 19"/></svg>';function zo(e,t,n,r,o,i,a){var l;at(e,o.resourceIndex);const s=o.resourceIndex.get(e);(l=s==null?void 0:s.type)!=null&&l.startsWith("video/")?zt(t,e,o,{fileName:e,isReadonly:!1,deps:i}).catch(console.error):Nt(t,e,o,i,a);const c=document.createElement("input");c.type="hidden",c.name=n,c.value=e,r.appendChild(c)}function Mo(e,t,n,r,o=!1,i=""){$e();const a=document.createElement("div");a.className=`fb-wide-tile${t?" fb-file-card-row":""}${o?" fb-drag-over":""}`;const l=document.createElement("button");l.type="button",l.className="fb-wide-tile-upload fb-file-dropzone";const s=document.createElement("span");s.style.cssText="width:36px;height:36px;display:block;flex-shrink:0;",s.innerHTML=$n,l.appendChild(s);const c=document.createElement("div");if(c.className="fb-wide-tile-label",c.style.cssText="font-size:14px;font-weight:600;",c.textContent=k(o?"dropToUpload":"clickDragText",e),l.appendChild(c),i){const u=document.createElement("div");u.style.cssText="font-size:11px;opacity:0.65;margin-top:2px;",u.textContent=i,l.appendChild(u)}if(l.onclick=u=>{u.stopPropagation(),n()},a.appendChild(l),t&&r){const u=document.createElement("button");u.type="button",u.className="fb-wide-tile-library fb-file-library-card";const d=document.createElement("span");d.className="fb-wide-tile-library-icon",d.style.cssText="width:28px;height:28px;display:block;flex-shrink:0;",d.innerHTML=Sn,u.appendChild(d);const f=document.createElement("div");f.className="fb-wide-tile-library-label",f.style.cssText="font-size:13px;font-weight:600;text-align:center;",f.textContent=k("fromLibrary",e),u.appendChild(f);const p=document.createElement("div");p.className="fb-wide-tile-library-hint",p.style.cssText="font-size:11px;opacity:0.75;text-align:center;",p.textContent=k("libraryHint",e),u.appendChild(p),u.onclick=m=>{m.stopPropagation(),r()},a.appendChild(u)}return Ln(a,{onEnter:()=>{const u=a.querySelector(".fb-wide-tile-label");u&&(u.textContent=k("dropToUpload",e))},onLeave:()=>{const u=a.querySelector(".fb-wide-tile-label");u&&(u.textContent=k("clickDragText",e))},activeClass:"fb-drag-over"}),a}function Ln(e,t){let n=0;e.addEventListener("dragover",r=>{r.preventDefault()}),e.addEventListener("dragenter",r=>{r.preventDefault(),n++,n===1&&(e.classList.add(t.activeClass),t.onEnter())}),e.addEventListener("dragleave",r=>{r.preventDefault(),n=Math.max(0,n-1),n===0&&(e.classList.remove(t.activeClass),t.onLeave())}),e.addEventListener("drop",()=>{n=0,e.classList.remove(t.activeClass),t.onLeave()})}function Nt(e,t,n,r,o){var i,a;const l=n.resourceIndex.get(t);if((i=l==null?void 0:l.type)!=null&&i.startsWith("video/")){zt(e,t,n,{fileName:(a=l==null?void 0:l.name)!=null?a:"",isReadonly:!1,deps:r}).catch(console.error);return}$e();const s=document.createElement("div");s.className="fb-multi-outer fb-multi-has-files";const c=document.createElement("div");c.className="fb-multi-grid fb-tiles-wrap",s.appendChild(c);const u=It(t,n,!!r.onRemove,r.onRemove?()=>{var d;return(d=r.onRemove)==null?void 0:d.call(r)}:null,o);for(c.appendChild(u),e.className="file-preview-container",e.removeAttribute("style");e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s)}function No(e,t,n,r,o=!1){const i=document.createElement("div");i.className=`fb-multi-add-tile fb-multi-add-tile-js${o?" fb-drag-over-tile":""}`;const a=document.createElement("button");a.type="button",a.className="fb-multi-add-upload fb-tile-add fb-file-dropzone";const l=document.createElement("span");l.style.cssText="width:28px;height:28px;display:block;flex-shrink:0;",l.innerHTML=$n,a.appendChild(l);const s=document.createElement("span");if(s.className="fb-multi-add-label",s.style.cssText="font-size:11px;font-weight:600;",s.textContent=k(o?"dropToUpload":"clickDragTextMultiple",e),a.appendChild(s),a.onclick=c=>{c.stopPropagation(),n()},i.appendChild(a),t&&r){const c=document.createElement("div");c.className="fb-multi-add-divider",i.appendChild(c);const u=document.createElement("button");u.type="button",u.className="fb-multi-add-library fb-tile-add-library fb-file-library-card",u.setAttribute("aria-label",k("fromLibrary",e));const d=document.createElement("span");d.style.cssText="width:14px;height:14px;display:block;flex-shrink:0;",d.innerHTML=Sn,u.appendChild(d),u.appendChild(document.createTextNode(k("fromLibrary",e))),u.onclick=f=>{f.stopPropagation(),r()},i.appendChild(u)}return i}function It(e,t,n,r,o){var i,a,l;$e();const s=t.resourceIndex.get(e),c=document.createElement("div");c.className="fb-preview-tile fb-checker fb-tile-resource resource-pill",c.dataset.resourceId=e;const u=Tt({canRemove:n&&r!==null,removeHandler:r,state:t,resourceId:e,fileName:(i=s==null?void 0:s.name)!=null?i:"",meta:s,replaceHandler:(a=o==null?void 0:o.replaceHandler)!=null?a:null,libraryHandler:(l=o==null?void 0:o.libraryHandler)!=null?l:null});return bn(c,e,s,t,u).catch(d=>{console.error("Failed to render tile:",d)}),c}function Tn(e=!1){const t=document.createElement("div");return t.className=`fb-multi-placeholder fb-checker${e?" fb-drag-over":""}`,t}function Io(e,t,n,r,o,i){const a=document.createElement("div");a.className="fb-meta-line";const l=document.createElement("div");if(l.className="fb-meta-text",t.maxSize&&t.maxSize!==1/0){const u=document.createElement("span");u.textContent=k("hintMaxSize",e,{size:t.maxSize}),l.appendChild(u),l.appendChild(An())}const s=ze(t.accept);if(s.length>0){const u=document.createElement("span");u.className="fb-meta-mono",u.textContent=s.map(d=>d.toUpperCase()).join(", "),l.appendChild(u),l.appendChild(An())}const c=document.createElement("span");if(r<1/0)c.textContent=k("fileCountWithMax",e,{count:n,max:r});else{const u=n===1?"fileCountSingle":"fileCountPlural";c.textContent=k(u,e,{count:n})}if(l.appendChild(c),a.appendChild(l),o&&n>1){const u=document.createElement("button");u.type="button",u.className="fb-clear-all-btn",u.textContent=k("clearAll",e),u.onclick=d=>{d.stopPropagation(),window.confirm(k("clearAll",e)+"?")&&i()},a.appendChild(u)}return a}function An(){const e=document.createElement("span");return e.className="fb-meta-dot",e}const Ze=new WeakMap;function qo(e){const t=Ze.get(e);t&&(t.disconnect(),Ze.delete(e)),e.querySelectorAll(".fb-multi-placeholder").forEach(n=>n.remove())}function Ro(e){var t;const{container:n,rids:r,state:o,onRemove:i,maxCount:a,isReadonly:l=!1,onLibraryPick:s,element:c,onClearAll:u,openPicker:d}=e;$e();const f=n.closest("[data-files-wrapper]");f&&(f.dataset.resourceIds=JSON.stringify(r!=null?r:[]));const p=Ze.get(n);for(p&&(p.disconnect(),Ze.delete(n));n.firstChild;)n.removeChild(n.firstChild);const m=r!=null?r:[],b=a!=null?a:1/0,g=b!==1/0&&m.length>=b,C=!l&&typeof s=="function",h=d!=null?d:(()=>{var x;const $=(x=n.closest("[data-files-wrapper]"))==null?void 0:x.querySelector('input[type="file"]');$&&$.click()});if(l){if(m.length===0){const x=document.createElement("div");x.className="fb-tile-empty-text",x.textContent=k("noFilesSelected",o),n.appendChild(x)}else{const x=document.createElement("div");x.className="fb-multi-readonly-grid",n.appendChild(x);for(const $ of m){const M=o.resourceIndex.get($),q=document.createElement("div");q.className="fb-readonly-tile fb-checker fb-tile fb-tile-resource",q.dataset.resourceId=$;const K=Tt({canRemove:!1,removeHandler:null,state:o,resourceId:$,fileName:(t=M==null?void 0:M.name)!=null?t:"",meta:M});bn(q,$,M,o,K).catch(console.error),q.onclick=async()=>{var B;let z=null;o.config.getDownloadUrl?z=o.config.getDownloadUrl($):o.config.getThumbnail?z=await o.config.getThumbnail($):(M==null?void 0:M.file)instanceof File&&(z=URL.createObjectURL(M.file)),z?window.open(z,"_blank"):o.config.downloadFile&&o.config.downloadFile($,(B=M==null?void 0:M.name)!=null?B:"")},x.appendChild(q)}}return}const y=document.createElement("div");y.className=`fb-multi-outer${m.length>0?" fb-multi-has-files":""}`;const v=document.createElement("div");v.className="fb-multi-grid fb-tiles-wrap",y.appendChild(v),n.appendChild(y);for(let x=0;x<m.length;x++){const $=m[x],M=It($,o,i!==null,i?()=>i($):null);v.appendChild(M)}if(!g){const x=No(o,C,h,s!=null?s:null);v.appendChild(x)}const w=m.length+(g?0:1),E=()=>{const x=getComputedStyle(v).gridTemplateColumns,$=x?x.split(" ").filter(Boolean).length:0;if(!$)return;const M=w%$,q=M===0?0:$-M,K=b===1/0?q:Math.max(0,b-w),B=Math.min(q,K),z=v.querySelectorAll(".fb-multi-placeholder");if(z.length>B)for(let D=z.length-1;D>=B;D--)z[D].remove();else if(z.length<B)for(let D=z.length;D<B;D++)v.appendChild(Tn())};if((b===1/0||b>w)&&v.appendChild(Tn()),requestAnimationFrame(E),typeof ResizeObserver!="undefined"){const x=new ResizeObserver(()=>E());x.observe(v),Ze.set(n,x)}if(Ln(y,{activeClass:"fb-drag-over",onEnter:()=>{v.querySelectorAll(".fb-multi-placeholder").forEach($=>{$.classList.add("fb-drag-over")});const x=v.querySelector(".fb-multi-add-tile-js");if(x){x.classList.add("fb-drag-over-tile");const $=x.querySelector(".fb-multi-add-label");$&&($.textContent=k("dropToUpload",o))}},onLeave:()=>{v.querySelectorAll(".fb-multi-placeholder").forEach($=>{$.classList.remove("fb-drag-over")});const x=v.querySelector(".fb-multi-add-tile-js");if(x){x.classList.remove("fb-drag-over-tile");const $=x.querySelector(".fb-multi-add-label");$&&($.textContent=k("clickDragTextMultiple",o))}}}),c){const x=Io(o,c,m.length,b,!!u,u!=null?u:(()=>{}));n.appendChild(x)}}function Bo(e,t,n,r){var o,i;const a=t.state,l=document.createElement("div");l.className="space-y-2",l.dataset.filesWrapper=r;const s=document.createElement("input");s.type="file",s.name=r,s.style.display="none",s.accept=Fn(e.accept);const c=document.createElement("div");c.className="file-preview-container";const u=t.prefill[e.key],d=ze(e.accept),f=Ye(e.accept),p=(o=e.maxSize)!=null?o:1/0,m={fileUploadHandler(){s.click()},dragHandler(h){h.length>0&&Eo({file:h[0],container:c,fieldName:r,state:a,deps:g(),instance:t.instance,allowedExtensions:d,allowedMimes:f,maxSizeMB:p})},setupDrop(h){st(h,m.dragHandler)},onRemove(){var h;const y=l.querySelector('input[type="hidden"]'),v=y==null?void 0:y.value;v&&qe((h=a.resourceIndex.get(v))==null?void 0:h.file),y&&(y.value=""),C()}},b=()=>{const h=!!(a.config.pickExistingFiles&&!e.disableLibrary);return{replaceHandler:a.config.uploadFile?()=>s.click():null,libraryHandler:h?()=>{Fo(a,e,c,l,r,r,async y=>{Nt(c,y,a,g(),b())},t.instance).catch(y=>{console.error("Library pick failed:",y)})}:null}},g=()=>({picker:s,fileUploadHandler:m.fileUploadHandler,dragHandler:m.dragHandler,setupDrop:m.setupDrop,onRemove:m.onRemove,onAfterUpload:(h,y)=>{Nt(h,y,a,g(),b())}}),C=()=>{for($e(),c.className="file-preview-container",c.removeAttribute("style");c.firstChild;)c.removeChild(c.firstChild);const h=b().libraryHandler,y=Mo(a,h!==null,m.fileUploadHandler,h,!1,Le(e,a));c.appendChild(y),st(c,m.dragHandler)};if(u){zo(u,c,r,l,a,g(),b());const h=a.resourceIndex.get(u);(i=h==null?void 0:h.type)!=null&&i.startsWith("video/")&&st(c,m.dragHandler)}else C();s.onchange=()=>{s.files&&s.files.length>0&&m.dragHandler(s.files)},l.appendChild(c),l.appendChild(s),n.appendChild(l)}function Fn(e){var t,n,r;return e?typeof e=="string"?e:[...(n=(t=e.extensions)==null?void 0:t.map(o=>`.${o}`))!=null?n:[],...(r=e.mime)!=null?r:[]].join(","):""}function zn(e,t,n,r,o){var i,a;const l=t.state,s=document.createElement("div");s.className="space-y-2",s.dataset.filesWrapper=r;const c=document.createElement("input");c.type="file",c.name=r,c.multiple=!0,c.style.display="none",c.accept=Fn(e.accept);const u=document.createElement("div");u.className="files-list-wrapper";const d=document.createElement("div");d.className="files-list",s.appendChild(c),s.appendChild(u),u.appendChild(d);const f=Array.isArray(t.prefill[e.key])?[...t.prefill[e.key]]:[];$t(f,l.resourceIndex),s.dataset.resourceIds=JSON.stringify(f);const p={maxCount:o,allowedExtensions:ze(e.accept),allowedMimes:Ye(e.accept),maxSize:(a=(i=e.maxSize)!=null?i:e.maxSizeMB)!=null?a:1/0},m=()=>{c.click()},b=l.config.pickExistingFiles&&!e.disableLibrary?()=>{Ao({state:l,element:e,wrapper:s,fieldPath:r,resourceIds:f,maxCount:o,updateCallback:g,instance:t.instance,coordinator:M,list:d,buildSuccessTile:q}).catch(z=>{console.error("Library pick failed:",z)})}:null;function g(){const z=ae(e,l);Ro({container:d,rids:f,state:l,onRemove:z?null:D=>{var J,Q;qe((J=l.resourceIndex.get(D))==null?void 0:J.file);const ne=f.indexOf(D);ne>-1&&f.splice(ne,1),M.hasInFlightBatches()?(x.add(D),(Q=d.querySelector(`[data-resource-id="${D}"]`))==null||Q.remove(),s.dataset.resourceIds=JSON.stringify(f)):g(),t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f)},maxCount:o<1/0?o:void 0,isReadonly:z,onLibraryPick:z?null:b,element:e,onClearAll:z?void 0:()=>{var D,J;for(const Q of f)qe((D=l.resourceIndex.get(Q))==null?void 0:D.file);if(f.splice(0),M.hasInFlightBatches()){const Q=d.querySelectorAll("[data-resource-id]");for(const ne of Q){const he=ne.dataset.resourceId;he&&(qe((J=l.resourceIndex.get(he))==null?void 0:J.file),x.add(he)),ne.remove()}s.dataset.resourceIds=JSON.stringify(f)}else g();t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f)},openPicker:m})}let C=0,h=0,y=0,v=0;const w=new Map,E=new Map,x=new Set,$=()=>{for(var z;w.has(v);){const D=v,J=w.get(D);w.delete(D),v+=1;const Q=(z=E.get(D))!=null?z:0;E.delete(D),C-=Q;for(const ne of J)if(ne!==null){if(x.has(ne)){x.delete(ne);continue}f.push(ne)}}s.dataset.resourceIds=JSON.stringify(f)},M={getOccupiedCount:()=>f.length+C,getAllKnownRids:()=>{const z=[...f];for(const D of w.values())for(const J of D)J!==null&&z.push(J);return z},hasInFlightBatches:()=>h>0||E.size>0,wasRemovedDuringBatch:z=>x.has(z),beginBatch:z=>{C+=z,h+=1;const D=y++;return E.set(D,z),{setResults:J=>{w.set(D,J),$()},end:()=>{h-=1;const J=h===0&&E.size===0;return J&&x.clear(),{wasLast:J}}}}},q=z=>{const D=ae(e,l);return It(z,l,!D,D?null:()=>{var J,Q,ne;qe((J=l.resourceIndex.get(z))==null?void 0:J.file);const he=f.indexOf(z);if(he>-1){f.splice(he,1),M.hasInFlightBatches()?(x.add(z),(Q=d.querySelector(`[data-resource-id="${z}"]`))==null||Q.remove(),s.dataset.resourceIds=JSON.stringify(f)):g(),t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f);return}x.add(z),(ne=d.querySelector(`[data-resource-id="${z}"]`))==null||ne.remove(),t.instance&&r&&!l.config.readonly&&t.instance.triggerOnChange(r,f)})},K=()=>qo(d),B={resourceIds:f,state:l,updateCallback:g,constraints:p,pathKey:r,instance:t.instance,buildSuccessTile:q,prepareForUpload:K,coordinator:M};Lo({...B,filesContainer:u}),To({...B,filesPicker:c}),g(),n.appendChild(s)}function Ho(e,t,n,r){zn(e,t,n,r,1/0)}function Do(e,t,n,r){var o;zn(e,t,n,r,(o=e.maxCount)!=null?o:1/0)}function jo(e,t){const n=e.querySelector(`[data-files-wrapper="${t}"]`);if(!n)return[];const r=n.dataset.resourceIds;if(r===void 0)throw new Error(`readMultiFileResourceIds: [data-files-wrapper="${t}"] is missing data-resource-ids attribute. This is a render bug.`);const o=JSON.parse(r);if(!Array.isArray(o))throw new Error(`readMultiFileResourceIds: data-resource-ids on [data-files-wrapper="${t}"] is not a JSON array. Got: ${r}`);return o}function Oo(e,t,n,r,o){var i,a;const l="minCount"in n&&(i=n.minCount)!=null?i:0,s="maxCount"in n&&(a=n.maxCount)!=null?a:1/0;n.required&&t.length===0&&o.push(`${e}: ${k("required",r)}`),t.length<l&&o.push(`${e}: ${k("minFiles",r,{min:l})}`),t.length>s&&o.push(`${e}: ${k("maxFiles",r,{max:s})}`)}function Mn(e,t,n,r,o){var i,a;const l="accept"in n?n.accept:void 0,s=ze(l),c=Ye(l);if(s.length===0&&c.length===0)return;const u=s.join(", "),d=c.join(", ");for(const f of t){const p=r.resourceIndex.get(f),m=(i=p==null?void 0:p.name)!=null?i:f;if(s.length>0&&!je(m,s)){o.push(`${e}: ${k("invalidFileExtension",r,{name:m,formats:u})}`);continue}if(c.length>0&&!(p!=null&&p.inferredFromExtension)){const b=(a=p==null?void 0:p.type)!=null?a:"";Xe(b,c)||o.push(`${e}: ${k("invalidFileMime",r,{name:m,type:b,mimes:d})}`)}}}function Nn(e,t,n,r,o){var i;const a="maxSize"in n&&(i=n.maxSize)!=null?i:1/0;if(a!==1/0)for(const l of t){const s=r.resourceIndex.get(l);s&&s.size>a*1024*1024&&o.push(`${e}: ${k("fileTooLarge",r,{name:s.name,maxSize:a})}`)}}function Uo(e,t,n){const{scopeRoot:r,skipValidation:o,path:i,state:a}=n,l=[],s=ke(i,t),c=jo(r,s);return o||(Oo(t,c,e,a,l),Mn(t,c,e,a,l),Nn(t,c,e,a,l)),{value:c,errors:l}}function Po(e,t,n){var r;const{scopeRoot:o,skipValidation:i,state:a}=n,l=[],s=o.querySelector(`input[name$="${t}"][type="hidden"]`),c=(r=s==null?void 0:s.value)!=null?r:"";return!i&&e.required&&c===""?(l.push(`${t}: ${k("required",a)}`),{value:null,errors:l}):(!i&&c!==""&&(Mn(t,[c],e,a,l),Nn(t,[c],e,a,l)),{value:c||null,errors:l})}function In(e,t,n){return e.type==="files"||"multiple"in e&&e.multiple?Uo(e,t,n):Po(e,t,n)}function Wo(e,t,n,r){const o=t.state,i=t.prefill[e.key],a=typeof i=="string"?i:"";if(a){$t([a],o.resourceIndex);const l=document.createElement("input");l.type="hidden",l.name=r,l.value=a,n.appendChild(l),Mt(a,o).then(s=>{s.classList.add("fb-single-readonly-filled","fb-readonly-tile","fb-checker"),n.appendChild(s)}).catch(console.error)}else n.appendChild(Vo(o))}function Vo(e){$e();const t=document.createElement("div");return t.style.cssText=`
|
|
1013
1013
|
height: 220px;
|
|
1014
1014
|
display:flex;
|
|
1015
1015
|
align-items:center;
|
|
@@ -1017,7 +1017,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1017
1017
|
background: repeating-linear-gradient(45deg, #fafafa 0 6px, #f3f4f6 6px 12px);
|
|
1018
1018
|
border-radius:0.75rem;
|
|
1019
1019
|
border:1px solid #e2e8f0;
|
|
1020
|
-
`,t.innerHTML=`<div style="font-size:11px;text-align:center;color:var(--fb-text-secondary-color,#6b7280);">${se(k("noFileSelected",e))}</div>`,t}function
|
|
1020
|
+
`,t.innerHTML=`<div style="font-size:11px;text-align:center;color:var(--fb-text-secondary-color,#6b7280);">${se(k("noFileSelected",e))}</div>`,t}function qn(e,t,n,r,o){$t(e,t.resourceIndex),$e();const i=document.createElement("div");if(i.dataset.filesWrapper=r,i.dataset.resourceIds=JSON.stringify(e),n.appendChild(i),e.length===0){const s=document.createElement("div");s.className="fb-tile-empty-text",s.textContent=k("noFilesSelected",t),i.appendChild(s);return}const a=document.createElement("div");a.className="fb-multi-readonly-grid",i.appendChild(a);const l=e.map(()=>{const s=document.createElement("div");return s.className="fb-readonly-tile fb-checker fb-tile",a.appendChild(s),s});for(let s=0;s<e.length;s++){const c=e[s],u=l[s],d=t.resourceIndex.get(c);Mt(c,t,d==null?void 0:d.name).then(f=>{f.classList.add("fb-readonly-tile","fb-checker","fb-tile-resource"),f.dataset.resourceId=c,u.replaceWith(f)}).catch(()=>{const f=document.createElement("div");f.className="fb-readonly-tile fb-checker fb-tile fb-tile-resource",f.dataset.resourceId=c,u.replaceWith(f)})}}function Ko(e,t,n,r){const o=t.prefill[e.key],i=Array.isArray(o)?o:[];qn(i,t.state,n,r)}function _o(e,t,n,r){const o=t.prefill[e.key],i=Array.isArray(o)?o:[];qn(i,t.state,n,r)}function Jo(e,t,n,r){ae(e,t.state,t)?Wo(e,t,n,r):Bo(e,t,n,r)}function Yo(e,t,n,r){ae(e,t.state,t)?Ko(e,t,n,r):Ho(e,t,n,r)}function Xo(e,t,n,r){ae(e,t.state,t)?_o(e,t,n,r):Do(e,t,n,r)}function Rn(e,t,n,r){const{scopeRoot:o,state:i}=r;if(e.type==="files"||"multiple"in e&&e.multiple){if(!Array.isArray(n)){console.warn(`updateFileField: Expected array for multiple file field "${t}", got ${typeof n}`);return}n.forEach(l=>{l&&typeof l=="string"&&at(l,i.resourceIndex)});const a=o.querySelector(`[data-files-wrapper="${t}"]`);a?a.dataset.resourceIds=JSON.stringify(n):console.warn(`updateFileField: [data-files-wrapper="${t}"] not found in DOM; data-resource-ids not updated`)}else{const a=o.querySelector(`input[name="${t}"][type="hidden"]`);if(!a){console.warn(`updateFileField: Hidden input not found for file field "${t}"`);return}a.value=n!=null?String(n):"",n&&typeof n=="string"&&(at(n,i.resourceIndex),console.info(`updateFileField: File field "${t}" updated. Preview update requires re-render.`))}}function Oe(e){return e?e.toUpperCase():"#000000"}function qt(e){return/^#[0-9A-F]{6}$/i.test(e)||/^#[0-9A-F]{3}$/i.test(e)}function Bn(e){if(/^#[0-9A-F]{3}$/i.test(e)){const t=e[1],n=e[2],r=e[3];return`#${t}${t}${n}${n}${r}${r}`.toUpperCase()}return e.toUpperCase()}function Hn(e){const t=document.createElement("div");t.className="flex items-center gap-2";const n=Oe(e),r=document.createElement("div");r.style.cssText=`
|
|
1021
1021
|
width: 32px;
|
|
1022
1022
|
height: 32px;
|
|
1023
1023
|
border-radius: var(--fb-border-radius);
|
|
@@ -1054,10 +1054,10 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1054
1054
|
position: absolute;
|
|
1055
1055
|
opacity: 0;
|
|
1056
1056
|
pointer-events: none;
|
|
1057
|
-
`,a.addEventListener("input",()=>{const s=a.value.trim();if(
|
|
1057
|
+
`,a.addEventListener("input",()=>{const s=a.value.trim();if(qt(s)){const c=Bn(s);i.style.backgroundColor=c,l.value=c.toLowerCase(),a.classList.remove("invalid"),n.instance&&n.instance.triggerOnChange(t,c)}else a.classList.add("invalid")}),a.addEventListener("blur",()=>{const s=a.value.trim();if(qt(s)){const c=Bn(s);a.value=c,i.style.backgroundColor=c,l.value=c.toLowerCase(),a.classList.remove("invalid")}}),l.addEventListener("change",()=>{const s=Oe(l.value);a.value=s,i.style.backgroundColor=s,n.instance&&n.instance.triggerOnChange(t,s)}),i.addEventListener("click",()=>{l.click()}),i.addEventListener("mouseenter",()=>{i.style.borderColor="var(--fb-border-hover-color)"}),i.addEventListener("mouseleave",()=>{i.style.borderColor="var(--fb-border-color)"}),a.addEventListener("focus",()=>{a.style.borderColor="var(--fb-border-focus-color)",a.style.outline="var(--fb-focus-ring-width) solid var(--fb-focus-ring-color)",a.style.outlineOffset="0"}),a.addEventListener("blur",()=>{a.style.borderColor="var(--fb-border-color)",a.style.outline="none"}),a.addEventListener("mouseenter",()=>{document.activeElement!==a&&(a.style.borderColor="var(--fb-border-hover-color)")}),a.addEventListener("mouseleave",()=>{document.activeElement!==a&&(a.style.borderColor="var(--fb-border-color)")}),o.appendChild(i),o.appendChild(a),o.appendChild(l),o}function Go(e,t,n,r){const o=t.state,i=ae(e,o,t),a=t.prefill[e.key]||e.default||"#000000";if(i){const l=Hn(a);n.appendChild(l)}else{const l=Dn(a,r,t);n.appendChild(l)}if(!i){const l=document.createElement("p");l.className="mt-1",l.style.cssText=`
|
|
1058
1058
|
font-size: var(--fb-font-size-small);
|
|
1059
1059
|
color: var(--fb-text-secondary-color);
|
|
1060
|
-
`,l.textContent=Le(e,o),n.appendChild(l)}}function Zo(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:1,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"#000000");const f=document.createElement("div");f.className="space-y-2",n.appendChild(f);function p(){f.querySelectorAll(".multiple-colour-item").forEach((h,y)=>{const v=h.querySelector("input");v&&(v.name=`${r}[${y}]`)})}function m(h="#000000",y=-1){const v=document.createElement("div");if(v.className="multiple-colour-item flex items-center gap-2",l){const w=Hn(h);for(;w.firstChild;)v.appendChild(w.firstChild)}else{const w=`${r}[${f.children.length}]`,E=Dn(h,w,t);E.style.flex="1",v.appendChild(E)}return y===-1?f.appendChild(v):f.insertBefore(v,f.children[y]),p(),v}function b(){if(l)return;const h=f.querySelectorAll(".multiple-colour-item"),y=h.length;h.forEach(v=>{let w=v.querySelector(".remove-item-btn");w||(w=document.createElement("button"),w.type="button",w.className="remove-item-btn px-2 py-1 rounded",w.style.cssText=`
|
|
1060
|
+
`,l.textContent=Le(e,o),n.appendChild(l)}}function Zo(e,t,n,r){var o,i;const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:e.required?1:0,d=(i=e.maxCount)!=null?i:1/0;for(;c.length<u;)c.push(e.default||"#000000");const f=document.createElement("div");f.className="space-y-2",n.appendChild(f);function p(){f.querySelectorAll(".multiple-colour-item").forEach((h,y)=>{const v=h.querySelector("input");v&&(v.name=`${r}[${y}]`)})}function m(h="#000000",y=-1){const v=document.createElement("div");if(v.className="multiple-colour-item flex items-center gap-2",l){const w=Hn(h);for(;w.firstChild;)v.appendChild(w.firstChild)}else{const w=`${r}[${f.children.length}]`,E=Dn(h,w,t);E.style.flex="1",v.appendChild(E)}return y===-1?f.appendChild(v):f.insertBefore(v,f.children[y]),p(),v}function b(){if(l)return;const h=f.querySelectorAll(".multiple-colour-item"),y=h.length;h.forEach(v=>{let w=v.querySelector(".remove-item-btn");w||(w=document.createElement("button"),w.type="button",w.className="remove-item-btn px-2 py-1 rounded",w.style.cssText=`
|
|
1061
1061
|
color: var(--fb-error-color);
|
|
1062
1062
|
background-color: transparent;
|
|
1063
1063
|
transition: background-color var(--fb-transition-duration);
|
|
@@ -1068,7 +1068,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1068
1068
|
color: var(--fb-error-color);
|
|
1069
1069
|
font-size: var(--fb-font-size-small);
|
|
1070
1070
|
margin-top: 0.25rem;
|
|
1071
|
-
`,d.nextSibling?(p=d.parentNode)==null||p.insertBefore(g,d.nextSibling):(m=d.parentNode)==null||m.appendChild(g)),g.textContent=f,g.style.display="block"):(d.classList.remove("invalid"),d.title="",g&&g.remove())},u=(d,f,p)=>{const{state:m}=n;if(!f){if(!s&&e.required){const g=k("required",m);return a.push(`${p}: ${g}`),c(d,g),""}return c(d,null),""}const b=Oe(f);if(!s&&!
|
|
1071
|
+
`,d.nextSibling?(p=d.parentNode)==null||p.insertBefore(g,d.nextSibling):(m=d.parentNode)==null||m.appendChild(g)),g.textContent=f,g.style.display="block"):(d.classList.remove("invalid"),d.title="",g&&g.remove())},u=(d,f,p)=>{const{state:m}=n;if(!f){if(!s&&e.required){const g=k("required",m);return a.push(`${p}: ${g}`),c(d,g),""}return c(d,null),""}const b=Oe(f);if(!s&&!qt(b)){const g=k("invalidHexColour",m);return a.push(`${p}: ${g}`),c(d,g),f}return c(d,null),b};if(e.multiple){const d=l.querySelectorAll(`[name^="${t}\\["].colour-hex-input`),f=[];if(d.forEach((p,m)=>{var b;const g=(b=p==null?void 0:p.value)!=null?b:"",C=u(p,g,`${t}[${m}]`);f.push(C)}),!s){const{state:p}=n,m=(r=e.minCount)!=null?r:0,b=(o=e.maxCount)!=null?o:1/0,g=f.filter(C=>C!=="");e.required&&g.length===0&&a.push(`${t}: ${k("required",p)}`),g.length<m&&a.push(`${t}: ${k("minItems",p,{min:m})}`),g.length>b&&a.push(`${t}: ${k("maxItems",p,{max:b})}`)}return{value:f,errors:a}}else{const d=l.querySelector(`[name="${t}"].colour-hex-input`),f=(i=d==null?void 0:d.value)!=null?i:"";if(!s&&e.required&&f===""){const p=k("required",n.state);return a.push(`${t}: ${p}`),c(d,p),{value:"",errors:a}}return{value:u(d,f,t),errors:a}}}function el(e,t,n,r){const{scopeRoot:o}=r;if(e.multiple){if(!Array.isArray(n)){console.warn(`updateColourField: Expected array for multiple field "${t}", got ${typeof n}`);return}const i=o.querySelectorAll(`[name^="${t}\\["].colour-hex-input`);i.forEach((a,l)=>{if(l<n.length){const s=Oe(n[l]);a.value=s,a.classList.remove("invalid"),a.title="",xe(a);const c=a.closest(".colour-picker-wrapper");if(c){const u=c.querySelector(".colour-swatch"),d=c.querySelector(".colour-picker-hidden");u&&(u.style.backgroundColor=s),d&&(d.value=s.toLowerCase())}}}),n.length!==i.length&&console.warn(`updateColourField: Multiple field "${t}" has ${i.length} inputs but received ${n.length} values. Consider re-rendering for add/remove.`)}else{const i=o.querySelector(`[name="${t}"].colour-hex-input`);if(i){const a=Oe(n);i.value=a,i.classList.remove("invalid"),i.title="",xe(i);const l=i.closest(".colour-picker-wrapper");if(l){const s=l.querySelector(".colour-swatch"),c=l.querySelector(".colour-picker-hidden");s&&(s.style.backgroundColor=a),c&&(c.value=a.toLowerCase())}}}}function jn(e,t,n){if(t<=0)throw new Error("Exponential scale requires min > 0");const r=Math.log(t),o=Math.log(n);return Math.exp(r+e*(o-r))}function Rt(e,t,n){if(t<=0)throw new Error("Exponential scale requires min > 0");const r=Math.log(t),o=Math.log(n);return(Math.log(e)-r)/(o-r)}function ut(e,t){return Math.round(e/t)*t}function On(e,t,n,r,o){var i;const a=document.createElement("div");a.className="slider-container";const l=document.createElement("div");l.className="flex items-start gap-3";const s=document.createElement("div");s.className="flex-1";const c=document.createElement("input");c.type="range",c.name=t,c.className="slider-input w-full",c.disabled=o;const u=n.scale||"linear",d=n.min,f=n.max,p=(i=n.step)!=null?i:1;if(u==="exponential"){if(d<=0)throw new Error(`Slider "${n.key}": exponential scale requires min > 0 (got ${d})`);c.min="0",c.max="1000",c.step="1";const h=Rt(e,d,f);c.value=(h*1e3).toString()}else c.min=d.toString(),c.max=f.toString(),c.step=p.toString(),c.value=e.toString();c.style.cssText=`
|
|
1072
1072
|
height: 6px;
|
|
1073
1073
|
border-radius: 3px;
|
|
1074
1074
|
background: linear-gradient(
|
|
@@ -1103,7 +1103,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1103
1103
|
)`,r.instance&&r.instance.triggerOnChange(t,y)};c.addEventListener("input",h),c.addEventListener("change",h)}return a}function tl(e,t,n,r){var o;if(e.min===void 0||e.min===null)throw new Error(`Slider field "${e.key}" requires "min" property`);if(e.max===void 0||e.max===null)throw new Error(`Slider field "${e.key}" requires "max" property`);if(e.min>=e.max)throw new Error(`Slider field "${e.key}": min (${e.min}) must be less than max (${e.max})`);const i=t.state,a=ae(e,i,t),l=e.default!==void 0?e.default:(e.min+e.max)/2,s=(o=t.prefill[e.key])!=null?o:l,c=On(s,r,e,t,a);if(n.appendChild(c),!a){const u=document.createElement("p");u.className="mt-1",u.style.cssText=`
|
|
1104
1104
|
font-size: var(--fb-font-size-small);
|
|
1105
1105
|
color: var(--fb-text-secondary-color);
|
|
1106
|
-
`,u.textContent=Le(e,i),n.appendChild(u)}}function nl(e,t,n,r){var o,i;if(e.min===void 0||e.min===null)throw new Error(`Slider field "${e.key}" requires "min" property`);if(e.max===void 0||e.max===null)throw new Error(`Slider field "${e.key}" requires "max" property`);if(e.min>=e.max)throw new Error(`Slider field "${e.key}": min (${e.min}) must be less than max (${e.max})`);const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:1,d=(i=e.maxCount)!=null?i:1/0,f=e.default!==void 0?e.default:(e.min+e.max)/2;for(;c.length<u;)c.push(f);const p=document.createElement("div");p.className="space-y-3",n.appendChild(p);function m(){p.querySelectorAll(".multiple-slider-item").forEach((y,v)=>{const w=y.querySelector("input[type=range]");w&&w.setAttribute("name",`${r}[${v}]`)})}function b(y=f,v=-1){const w=document.createElement("div");w.className="multiple-slider-item flex items-start gap-2";const E=`${r}[${p.children.length}]`,x=On(y,E,e,t,l);return x.style.flex="1",w.appendChild(x),v===-1?p.appendChild(w):p.insertBefore(w,p.children[v]),m(),w}function g(){if(l)return;const y=p.querySelectorAll(".multiple-slider-item"),v=y.length;y.forEach(w=>{let E=w.querySelector(".remove-item-btn");E||(E=document.createElement("button"),E.type="button",E.className="remove-item-btn px-2 py-1 rounded",E.style.cssText=`
|
|
1106
|
+
`,u.textContent=Le(e,i),n.appendChild(u)}}function nl(e,t,n,r){var o,i;if(e.min===void 0||e.min===null)throw new Error(`Slider field "${e.key}" requires "min" property`);if(e.max===void 0||e.max===null)throw new Error(`Slider field "${e.key}" requires "max" property`);if(e.min>=e.max)throw new Error(`Slider field "${e.key}": min (${e.min}) must be less than max (${e.max})`);const a=t.state,l=ae(e,a,t),s=t.prefill[e.key]||[],c=Array.isArray(s)?[...s]:[],u=(o=e.minCount)!=null?o:e.required?1:0,d=(i=e.maxCount)!=null?i:1/0,f=e.default!==void 0?e.default:(e.min+e.max)/2;for(;c.length<u;)c.push(f);const p=document.createElement("div");p.className="space-y-3",n.appendChild(p);function m(){p.querySelectorAll(".multiple-slider-item").forEach((y,v)=>{const w=y.querySelector("input[type=range]");w&&w.setAttribute("name",`${r}[${v}]`)})}function b(y=f,v=-1){const w=document.createElement("div");w.className="multiple-slider-item flex items-start gap-2";const E=`${r}[${p.children.length}]`,x=On(y,E,e,t,l);return x.style.flex="1",w.appendChild(x),v===-1?p.appendChild(w):p.insertBefore(w,p.children[v]),m(),w}function g(){if(l)return;const y=p.querySelectorAll(".multiple-slider-item"),v=y.length;y.forEach(w=>{let E=w.querySelector(".remove-item-btn");E||(E=document.createElement("button"),E.type="button",E.className="remove-item-btn px-2 py-1 rounded",E.style.cssText=`
|
|
1107
1107
|
color: var(--fb-error-color);
|
|
1108
1108
|
background-color: transparent;
|
|
1109
1109
|
transition: background-color var(--fb-transition-duration);
|
|
@@ -1115,13 +1115,13 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1115
1115
|
color: var(--fb-error-color);
|
|
1116
1116
|
font-size: var(--fb-font-size-small);
|
|
1117
1117
|
margin-top: 0.25rem;
|
|
1118
|
-
`;const w=b.closest(".slider-container");w&&w.nextSibling?(C=w.parentNode)==null||C.insertBefore(v,w.nextSibling):w&&((h=w.parentNode)==null||h.appendChild(v))}v.textContent=g,v.style.display="block"}else b.classList.remove("invalid"),b.title="",v&&v.remove()},m=(b,g)=>{const{state:C}=n,h=b.value;if(!h){if(!s&&e.required){const v=k("required",C);return a.push(`${g}: ${v}`),p(b,v),null}return p(b,null),null}let y;if(f==="exponential"){const v=parseFloat(h)/1e3;y=jn(v,c,u),y=ut(y,d)}else y=parseFloat(h),y=ut(y,d);if(!s){if(y<c){const v=k("minValue",C,{min:c});return a.push(`${g}: ${v}`),p(b,v),y}if(y>u){const v=k("maxValue",C,{max:u});return a.push(`${g}: ${v}`),p(b,v),y}}return p(b,null),y};if(e.multiple){const b=l.querySelectorAll(`input[type="range"][name^="${t}\\["]`),g=[];if(b.forEach((C,h)=>{const y=m(C,`${t}[${h}]`);g.push(y)}),!s){const{state:C}=n,h=(o=e.minCount)!=null?o:
|
|
1118
|
+
`;const w=b.closest(".slider-container");w&&w.nextSibling?(C=w.parentNode)==null||C.insertBefore(v,w.nextSibling):w&&((h=w.parentNode)==null||h.appendChild(v))}v.textContent=g,v.style.display="block"}else b.classList.remove("invalid"),b.title="",v&&v.remove()},m=(b,g)=>{const{state:C}=n,h=b.value;if(!h){if(!s&&e.required){const v=k("required",C);return a.push(`${g}: ${v}`),p(b,v),null}return p(b,null),null}let y;if(f==="exponential"){const v=parseFloat(h)/1e3;y=jn(v,c,u),y=ut(y,d)}else y=parseFloat(h),y=ut(y,d);if(!s){if(y<c){const v=k("minValue",C,{min:c});return a.push(`${g}: ${v}`),p(b,v),y}if(y>u){const v=k("maxValue",C,{max:u});return a.push(`${g}: ${v}`),p(b,v),y}}return p(b,null),y};if(e.multiple){const b=l.querySelectorAll(`input[type="range"][name^="${t}\\["]`),g=[];if(b.forEach((C,h)=>{const y=m(C,`${t}[${h}]`);g.push(y)}),!s){const{state:C}=n,h=(o=e.minCount)!=null?o:0,y=(i=e.maxCount)!=null?i:1/0,v=g.filter(w=>w!==null);e.required&&v.length===0&&a.push(`${t}: ${k("required",C)}`),v.length<h&&a.push(`${t}: ${k("minItems",C,{min:h})}`),v.length>y&&a.push(`${t}: ${k("maxItems",C,{max:y})}`)}return{value:g,errors:a}}else{const b=l.querySelector(`input[type="range"][name="${t}"]`);return b?{value:m(b,t),errors:a}:(!s&&e.required&&a.push(`${t}: ${k("required",n.state)}`),{value:null,errors:a})}}function ol(e,t,n,r){var o;const{scopeRoot:i}=r,a=e.min,l=e.max,s=(o=e.step)!=null?o:1,c=e.scale||"linear";if(e.multiple){if(!Array.isArray(n)){console.warn(`updateSliderField: Expected array for multiple field "${t}", got ${typeof n}`);return}const u=i.querySelectorAll(`input[type="range"][name^="${t}\\["]`);u.forEach((d,f)=>{if(f<n.length&&n[f]!==null){const p=Number(n[f]);if(c==="exponential"){const b=Rt(p,a,l);d.value=(b*1e3).toString()}else d.value=p.toString();const m=d.closest(".slider-container");if(m){const b=m.querySelector(".slider-value");b&&(b.textContent=p.toFixed(s<1?2:0));const g=(p-a)/(l-a)*100;d.style.background=`linear-gradient(
|
|
1119
1119
|
to right,
|
|
1120
1120
|
var(--fb-primary-color) 0%,
|
|
1121
1121
|
var(--fb-primary-color) ${g}%,
|
|
1122
1122
|
var(--fb-border-color) ${g}%,
|
|
1123
1123
|
var(--fb-border-color) 100%
|
|
1124
|
-
)`}d.classList.remove("invalid"),d.title="",xe(d)}}),n.length!==u.length&&console.warn(`updateSliderField: Multiple field "${t}" has ${u.length} sliders but received ${n.length} values. Consider re-rendering for add/remove.`)}else{const u=i.querySelector(`input[type="range"][name="${t}"]`);if(u&&n!==null&&n!==void 0){const d=Number(n);if(c==="exponential"){const p=
|
|
1124
|
+
)`}d.classList.remove("invalid"),d.title="",xe(d)}}),n.length!==u.length&&console.warn(`updateSliderField: Multiple field "${t}" has ${u.length} sliders but received ${n.length} values. Consider re-rendering for add/remove.`)}else{const u=i.querySelector(`input[type="range"][name="${t}"]`);if(u&&n!==null&&n!==void 0){const d=Number(n);if(c==="exponential"){const p=Rt(d,a,l);u.value=(p*1e3).toString()}else u.value=d.toString();const f=u.closest(".slider-container");if(f){const p=f.querySelector(".slider-value");p&&(p.textContent=d.toFixed(s<1?2:0));const m=(d-a)/(l-a)*100;u.style.background=`linear-gradient(
|
|
1125
1125
|
to right,
|
|
1126
1126
|
var(--fb-primary-color) 0%,
|
|
1127
1127
|
var(--fb-primary-color) ${m}%,
|
|
@@ -1138,7 +1138,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1138
1138
|
border-radius: 4px;
|
|
1139
1139
|
cursor: pointer;
|
|
1140
1140
|
flex-shrink: 0;
|
|
1141
|
-
`,r.innerHTML=Qt,r.onclick=t;const o=e.querySelector("[data-fb-label-row]");if(o){r.style.marginLeft="auto",o.appendChild(r);return}r.style.position="absolute",r.style.top="8px",r.style.right="8px",e.style.position="relative",e.appendChild(r)}function Kn(e,t,n,r){var o,i,a,l;const s=t.state,c=ae(e,s,t),u=c||t.inheritedReadonly,d=document.createElement("div");d.className="border border-gray-200 rounded-lg p-2 bg-gray-50";const f=document.createElement("div"),p=e.displayMode==="slides";if(p){f.className="fb-container-slides";const R=e.columns,K=typeof R=="number"&&R>0?`repeat(${R}, 1fr)`:"repeat(auto-fit, minmax(280px, 1fr))";f.style.cssText=`display:grid;grid-template-columns:${K};gap:var(--fb-slides-gap, 14px);align-items:start;`}else f.className="space-y-2";if(!c){const R=Wn(e,e.key);R&&d.appendChild(R)}const m=(o=e.minCount)!=null?o:0,b=(i=e.maxCount)!=null?i:1/0,g=Array.isArray((a=t.prefill)==null?void 0:a[e.key])?t.prefill[e.key]:null,C=Un(e.elements),h=()=>f.querySelectorAll(":scope > .containerItem").length,y=()=>{if(h()>=b)return;const R=h(),K=s.formRoot?Bt(s.formRoot):{},B={state:t.state,instance:t.instance,path:ke(t.path,`${e.key}[${R}]`),prefill:C,formData:K,inheritedReadonly:u},z=document.createElement("div");z.className="containerItem border border-gray-300 rounded-lg p-2 bg-white",z.setAttribute("data-container-item",`${e.key}[${R}]`),p&&z.setAttribute("data-fb-slide-card","");const D=document.createElement("div");D.className=il(p,e.columns),e.elements.forEach(J=>{var Q;J.type!=="markdown"&&(J.hidden||J.type==="hidden")?D.appendChild(_e(ke(B.path,J.key),(Q="default"in J?J.default:null)!=null?Q:null)):D.appendChild(ft(J,B))}),z.appendChild(D),c||Dt(z,()=>M(z),s),v&&v.parentElement===f?f.insertBefore(z,v):f.appendChild(z),$()};let v=null,w=null,E=null;const x=()=>{if(!v)return;const R=f.querySelector(":scope > .containerItem");R&&R.offsetHeight>0&&(v.style.minHeight=`${R.offsetHeight}px`)},$=()=>{const R=h();w&&w(R,b),E&&E(R,b),v&&x()},M=R=>{R.remove(),$()};if(g&&Array.isArray(g)&&g.forEach((R,K)=>{var B;const z=Pn(R||{},C),D={state:t.state,instance:t.instance,path:ke(t.path,`${e.key}[${K}]`),prefill:z,formData:(B=t.formData)!=null?B:t.prefill,inheritedReadonly:u},J=document.createElement("div");J.className="containerItem border border-gray-300 rounded-lg p-2 bg-white",J.setAttribute("data-container-item",`${e.key}[${K}]`),p&&J.setAttribute("data-fb-slide-card","");const Q=document.createElement("div");if(p)Q.className="space-y-2";else{const ne=e.columns||1;ne===1?Q.className="space-y-2":Q.className=`grid grid-cols-${ne} gap-2`}e.elements.forEach(ne=>{var he,Ce;if(ne.type!=="markdown"&&(ne.hidden||ne.type==="hidden")){const Ke=(Ce=(he=R==null?void 0:R[ne.key])!=null?he:"default"in ne?ne.default:null)!=null?Ce:null;Q.appendChild(_e(ke(D.path,ne.key),Ke))}else Q.appendChild(ft(ne,D))}),J.appendChild(Q),c||Dt(J,()=>M(J),t.state),f.appendChild(J)}),!c)for(;h()<m;){const R=h(),K={state:t.state,instance:t.instance,path:ke(t.path,`${e.key}[${R}]`),prefill:C,formData:(l=t.formData)!=null?l:t.prefill,inheritedReadonly:u},B=document.createElement("div");B.className="containerItem border border-gray-300 rounded-lg p-2 bg-white",B.setAttribute("data-container-item",`${e.key}[${R}]`),p&&B.setAttribute("data-fb-slide-card","");const z=document.createElement("div");if(p)z.className="space-y-2";else{const D=e.columns||1;D===1?z.className="space-y-2":z.className=`grid grid-cols-${D} gap-2`}e.elements.forEach(D=>{var J;D.type!=="markdown"&&(D.hidden||D.type==="hidden")?z.appendChild(_e(ke(K.path,D.key),(J="default"in D?D.default:null)!=null?J:null)):z.appendChild(ft(D,K))}),B.appendChild(z),Dt(B,()=>{h()>m&&M(B)},t.state),f.appendChild(B)}if(d.appendChild(f),!c)if(p){f.style.alignItems="stretch";const R=Er(y,{label:e.addLabel});v=R.tile,w=R.update,Te(n,R.counter),f.appendChild(R.tile)}else{const R=Fe("container",y,{label:e.addLabel});E=R.update,Te(n,R.counter),d.appendChild(R.row)}$(),n.appendChild(d),v&&(typeof requestAnimationFrame=="function"?requestAnimationFrame(x):x())}let jt=null;function al(e){jt=e}function _n(e,t,n){if(!jt)throw new Error("validateElement not initialized. Should be set from FormBuilderInstance");return jt(e,t,n)}function Jn(e,t,n){const r=[],{scopeRoot:o,skipValidation:i,path:a}=n;if(!("elements"in e))return{value:null,errors:r};const l=(s,c,u)=>{var d,f;if(i)return;const{state:p}=n,m="minCount"in u&&(d=u.minCount)!=null?d:0,b="maxCount"in u&&(f=u.maxCount)!=null?f:1/0;u.required&&c.length===0&&r.push(`${s}: ${k("required",p)}`),c.length<m&&r.push(`${s}: ${k("minItems",p,{min:m})}`),c.length>b&&r.push(`${s}: ${k("maxItems",p,{max:b})}`)};if("multiple"in e&&e.multiple){const s=[],c=o.querySelectorAll("[data-container-item]");return Array.from(c).filter(u=>{const d=u.getAttribute("data-container-item")||"";if(!d.startsWith(`${t}[`))return!1;const f=d.slice(t.length);return/^\[\d+\]$/.test(f)}).forEach(u=>{const d={},f=(u.getAttribute("data-container-item")||"").match(/\[(\d+)\]$/),p=f?parseInt(f[1],10):0;e.elements.forEach(m=>{var b;if(m.enableIf)try{const h=(b=n.instance)!=null&&b.getState().formRoot?Bt(n.instance.getState().formRoot):{};if(!He(m.enableIf,h,d))return}catch(h){console.error(`Error evaluating enableIf for field "${m.key}" in container "${t}[${p}]":`,h)}const g=`${t}[${p}].${m.key}`,C=_n({...m,key:g},{path:a},u);C.spread&&C.value!==null&&typeof C.value=="object"?Object.assign(d,C.value):d[m.key]=C.value}),s.push(d)}),l(t,s,e),{value:s,errors:r}}else{const s={},c=o.querySelector(`[data-container="${t}"]`)||o;return e.elements.forEach(u=>{var d;if(u.enableIf)try{const f=(d=n.instance)!=null&&d.getState().formRoot?Bt(n.instance.getState().formRoot):{};if(!He(u.enableIf,f,s))return}catch(f){console.error(`Error evaluating enableIf for field "${u.key}" in container "${t}":`,f)}{const f=`${t}.${u.key}`,p=_n({...u,key:f},{path:a},c);p.spread&&p.value!==null&&typeof p.value=="object"?Object.assign(s,p.value):s[u.key]=p.value}}),{value:s,errors:r}}}function Yn(e,t,n,r){const{instance:o,scopeRoot:i}=r;if("elements"in e)if("multiple"in e&&e.multiple){if(!Array.isArray(n)){console.warn(`updateContainerField: Expected array for multiple container field "${t}", got ${typeof n}`);return}n.forEach((l,s)=>{nt(l)&&e.elements.forEach(c=>{var u,d;if(c.type==="markdown"||!c.key)return;const f=`${t}[${s}].${c.key}`;if(c.type==="richinput"&&c.flatOutput){const p=c,m=(u=p.textKey)!=null?u:"text",b=(d=p.filesKey)!=null?d:"files",g=l,C={};m in g&&(C[m]=g[m]),b in g&&(C[b]=g[b]),Object.keys(C).length>0&&o.updateField(f,C)}else{const p=l[c.key];p!==void 0&&o.updateField(f,p)}})});const a=i.querySelectorAll(`[data-container-item^="${t}["]`);n.length!==a.length&&console.warn(`updateContainerField: Multiple container field "${t}" item count mismatch. Consider re-rendering for add/remove.`)}else{if(!nt(n)){console.warn(`updateContainerField: Expected object for container field "${t}", got ${typeof n}`);return}e.elements.forEach(a=>{var l,s;if(a.type==="markdown"||!a.key)return;const c=`${t}.${a.key}`;if(a.type==="richinput"&&a.flatOutput){const u=a,d=(l=u.textKey)!=null?l:"text",f=(s=u.filesKey)!=null?s:"files",p=n,m={};d in p&&(m[d]=p[d]),f in p&&(m[f]=p[f]),Object.keys(m).length>0&&o.updateField(c,m)}else{const u=n[a.key];u!==void 0&&o.updateField(c,u)}})}}function sl(e,t,n,r){var o,i;typeof console!="undefined"&&console.warn&&console.warn(`[Form Builder] The "group" field type is deprecated and will be removed in a future version. Please use type: "container" with multiple: true instead. Field key: "${e.key}"`);const a={key:e.key,label:e.label,description:e.description,hint:e.hint,required:e.required,hidden:e.hidden,default:e.default,actions:e.actions,elements:e.elements,multiple:!!(e.repeat&&nt(e.repeat)),minCount:(o=e.repeat)==null?void 0:o.min,maxCount:(i=e.repeat)==null?void 0:i.max};a.multiple?Kn(a,t,n):Vn(a,t,n,r)}function Xn(e){var t,n;const r=e;return{type:"container",key:r.key,label:r.label,description:r.description,hint:r.hint,required:r.required,hidden:r.hidden,default:r.default,actions:r.actions,elements:r.elements,multiple:!!(r.repeat&&nt(r.repeat)),minCount:(t=r.repeat)==null?void 0:t.min,maxCount:(n=r.repeat)==null?void 0:n.max}}function cl(e,t,n){typeof console!="undefined"&&console.warn&&console.warn(`[Form Builder] The "group" field type is deprecated. Please use type: "container" instead. Field key: "${t}"`);const r=Xn(e);return Jn(r,t,n)}function dl(e,t,n,r){typeof console!="undefined"&&console.warn&&console.warn(`[Form Builder] The "group" field type is deprecated. Please use type: "container" instead. Field path: "${t}"`);const o=Xn(e);return Yn(o,t,n,r)}function ul(e){return e!==null&&typeof e=="object"&&"row"in e&&"col"in e&&"rowspan"in e&&"colspan"in e}function fl(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.top=="number"&&typeof t.left=="number"&&typeof t.bottom=="number"&&typeof t.right=="number"}function pl(e){return ul(e)?{top:e.row,left:e.col,bottom:e.row+e.rowspan-1,right:e.col+e.colspan-1}:fl(e)?e:null}function Ue(e){return e.map(pl).filter(t=>t!==null)}function Gn(e,t){return Array.from({length:e},()=>Array.from({length:t},()=>""))}function Ot(e,t,n){for(let r=0;r<e.length;r++){const o=e[r];if(o.top<0||o.left<0||o.bottom>=t||o.right>=n||o.top>o.bottom||o.left>o.right)return`Merge ${r} out of bounds`;for(let i=r+1;i<e.length;i++){const a=e[i];if(o.top<=a.bottom&&o.bottom>=a.top&&o.left<=a.right&&o.right>=a.left)return`Merges ${r} and ${i} overlap`}}return null}function Zn(e,t,n){for(const r of n){if(r.top===e&&r.left===t)return null;if(e>=r.top&&e<=r.bottom&&t>=r.left&&t<=r.right)return r}return null}function pt(e,t,n){var r;return(r=n.find(o=>o.top===e&&o.left===t))!=null?r:null}function Ne(e){var t;if(!e.anchor)return null;const n=(t=e.focus)!=null?t:e.anchor;return{r1:Math.min(e.anchor.row,n.row),c1:Math.min(e.anchor.col,n.col),r2:Math.max(e.anchor.row,n.row),c2:Math.max(e.anchor.col,n.col)}}function Pe(e){const t=document.createElement("button");return t.type="button",t.textContent=e.label,t.title=e.title,t.style.cssText=`
|
|
1141
|
+
`,r.innerHTML=Qt,r.onclick=t;const o=e.querySelector("[data-fb-label-row]");if(o){r.style.marginLeft="auto",o.appendChild(r);return}r.style.position="absolute",r.style.top="8px",r.style.right="8px",e.style.position="relative",e.appendChild(r)}function Kn(e,t,n,r){var o,i,a,l;const s=t.state,c=ae(e,s,t),u=c||t.inheritedReadonly,d=document.createElement("div");d.className="border border-gray-200 rounded-lg p-2 bg-gray-50";const f=document.createElement("div"),p=e.displayMode==="slides";if(p){f.className="fb-container-slides";const q=e.columns,K=typeof q=="number"&&q>0?`repeat(${q}, 1fr)`:"repeat(auto-fit, minmax(280px, 1fr))";f.style.cssText=`display:grid;grid-template-columns:${K};gap:var(--fb-slides-gap, 14px);align-items:start;`}else f.className="space-y-2";if(!c){const q=Wn(e,e.key);q&&d.appendChild(q)}const m=(o=e.minCount)!=null?o:0,b=(i=e.maxCount)!=null?i:1/0,g=Array.isArray((a=t.prefill)==null?void 0:a[e.key])?t.prefill[e.key]:null,C=Un(e.elements),h=()=>f.querySelectorAll(":scope > .containerItem").length,y=()=>{if(h()>=b)return;const q=h(),K=s.formRoot?Bt(s.formRoot):{},B={state:t.state,instance:t.instance,path:ke(t.path,`${e.key}[${q}]`),prefill:C,formData:K,inheritedReadonly:u},z=document.createElement("div");z.className="containerItem border border-gray-300 rounded-lg p-2 bg-white",z.setAttribute("data-container-item",`${e.key}[${q}]`),p&&z.setAttribute("data-fb-slide-card","");const D=document.createElement("div");D.className=il(p,e.columns),e.elements.forEach(J=>{var Q;J.type!=="markdown"&&(J.hidden||J.type==="hidden")?D.appendChild(_e(ke(B.path,J.key),(Q="default"in J?J.default:null)!=null?Q:null)):D.appendChild(ft(J,B))}),z.appendChild(D),c||Dt(z,()=>M(z),s),v&&v.parentElement===f?f.insertBefore(z,v):f.appendChild(z),$()};let v=null,w=null,E=null;const x=()=>{if(!v)return;const q=f.querySelector(":scope > .containerItem");q&&q.offsetHeight>0&&(v.style.minHeight=`${q.offsetHeight}px`)},$=()=>{const q=h();w&&w(q,b),E&&E(q,b),v&&x()},M=q=>{q.remove(),$()};if(g&&Array.isArray(g)&&g.forEach((q,K)=>{var B;const z=Pn(q||{},C),D={state:t.state,instance:t.instance,path:ke(t.path,`${e.key}[${K}]`),prefill:z,formData:(B=t.formData)!=null?B:t.prefill,inheritedReadonly:u},J=document.createElement("div");J.className="containerItem border border-gray-300 rounded-lg p-2 bg-white",J.setAttribute("data-container-item",`${e.key}[${K}]`),p&&J.setAttribute("data-fb-slide-card","");const Q=document.createElement("div");if(p)Q.className="space-y-2";else{const ne=e.columns||1;ne===1?Q.className="space-y-2":Q.className=`grid grid-cols-${ne} gap-2`}e.elements.forEach(ne=>{var he,Ce;if(ne.type!=="markdown"&&(ne.hidden||ne.type==="hidden")){const Ke=(Ce=(he=q==null?void 0:q[ne.key])!=null?he:"default"in ne?ne.default:null)!=null?Ce:null;Q.appendChild(_e(ke(D.path,ne.key),Ke))}else Q.appendChild(ft(ne,D))}),J.appendChild(Q),c||Dt(J,()=>M(J),t.state),f.appendChild(J)}),!c)for(;h()<m;){const q=h(),K={state:t.state,instance:t.instance,path:ke(t.path,`${e.key}[${q}]`),prefill:C,formData:(l=t.formData)!=null?l:t.prefill,inheritedReadonly:u},B=document.createElement("div");B.className="containerItem border border-gray-300 rounded-lg p-2 bg-white",B.setAttribute("data-container-item",`${e.key}[${q}]`),p&&B.setAttribute("data-fb-slide-card","");const z=document.createElement("div");if(p)z.className="space-y-2";else{const D=e.columns||1;D===1?z.className="space-y-2":z.className=`grid grid-cols-${D} gap-2`}e.elements.forEach(D=>{var J;D.type!=="markdown"&&(D.hidden||D.type==="hidden")?z.appendChild(_e(ke(K.path,D.key),(J="default"in D?D.default:null)!=null?J:null)):z.appendChild(ft(D,K))}),B.appendChild(z),Dt(B,()=>{h()>m&&M(B)},t.state),f.appendChild(B)}if(d.appendChild(f),!c)if(p){f.style.alignItems="stretch";const q=Er(y,{label:e.addLabel});v=q.tile,w=q.update,Te(n,q.counter),f.appendChild(q.tile)}else{const q=Fe("container",y,{label:e.addLabel});E=q.update,Te(n,q.counter),d.appendChild(q.row)}$(),n.appendChild(d),v&&(typeof requestAnimationFrame=="function"?requestAnimationFrame(x):x())}let jt=null;function al(e){jt=e}function _n(e,t,n){if(!jt)throw new Error("validateElement not initialized. Should be set from FormBuilderInstance");return jt(e,t,n)}function Jn(e,t,n){const r=[],{scopeRoot:o,skipValidation:i,path:a}=n;if(!("elements"in e))return{value:null,errors:r};const l=(s,c,u)=>{var d,f;if(i)return;const{state:p}=n,m="minCount"in u&&(d=u.minCount)!=null?d:0,b="maxCount"in u&&(f=u.maxCount)!=null?f:1/0;u.required&&c.length===0&&r.push(`${s}: ${k("required",p)}`),c.length<m&&r.push(`${s}: ${k("minItems",p,{min:m})}`),c.length>b&&r.push(`${s}: ${k("maxItems",p,{max:b})}`)};if("multiple"in e&&e.multiple){const s=[],c=o.querySelectorAll("[data-container-item]");return Array.from(c).filter(u=>{const d=u.getAttribute("data-container-item")||"";if(!d.startsWith(`${t}[`))return!1;const f=d.slice(t.length);return/^\[\d+\]$/.test(f)}).forEach(u=>{const d={},f=(u.getAttribute("data-container-item")||"").match(/\[(\d+)\]$/),p=f?parseInt(f[1],10):0;e.elements.forEach(m=>{var b;if(m.enableIf)try{const h=(b=n.instance)!=null&&b.getState().formRoot?Bt(n.instance.getState().formRoot):{};if(!He(m.enableIf,h,d))return}catch(h){console.error(`Error evaluating enableIf for field "${m.key}" in container "${t}[${p}]":`,h)}const g=`${t}[${p}].${m.key}`,C=_n({...m,key:g},{path:a},u);C.spread&&C.value!==null&&typeof C.value=="object"?Object.assign(d,C.value):d[m.key]=C.value}),s.push(d)}),l(t,s,e),{value:s,errors:r}}else{const s={},c=o.querySelector(`[data-container="${t}"]`)||o;return e.elements.forEach(u=>{var d;if(u.enableIf)try{const f=(d=n.instance)!=null&&d.getState().formRoot?Bt(n.instance.getState().formRoot):{};if(!He(u.enableIf,f,s))return}catch(f){console.error(`Error evaluating enableIf for field "${u.key}" in container "${t}":`,f)}{const f=`${t}.${u.key}`,p=_n({...u,key:f},{path:a},c);p.spread&&p.value!==null&&typeof p.value=="object"?Object.assign(s,p.value):s[u.key]=p.value}}),{value:s,errors:r}}}function Yn(e,t,n,r){const{instance:o,scopeRoot:i}=r;if("elements"in e)if("multiple"in e&&e.multiple){if(!Array.isArray(n)){console.warn(`updateContainerField: Expected array for multiple container field "${t}", got ${typeof n}`);return}n.forEach((l,s)=>{nt(l)&&e.elements.forEach(c=>{var u,d;if(c.type==="markdown"||!c.key)return;const f=`${t}[${s}].${c.key}`;if(c.type==="richinput"&&c.flatOutput){const p=c,m=(u=p.textKey)!=null?u:"text",b=(d=p.filesKey)!=null?d:"files",g=l,C={};m in g&&(C[m]=g[m]),b in g&&(C[b]=g[b]),Object.keys(C).length>0&&o.updateField(f,C)}else{const p=l[c.key];p!==void 0&&o.updateField(f,p)}})});const a=i.querySelectorAll(`[data-container-item^="${t}["]`);n.length!==a.length&&console.warn(`updateContainerField: Multiple container field "${t}" item count mismatch. Consider re-rendering for add/remove.`)}else{if(!nt(n)){console.warn(`updateContainerField: Expected object for container field "${t}", got ${typeof n}`);return}e.elements.forEach(a=>{var l,s;if(a.type==="markdown"||!a.key)return;const c=`${t}.${a.key}`;if(a.type==="richinput"&&a.flatOutput){const u=a,d=(l=u.textKey)!=null?l:"text",f=(s=u.filesKey)!=null?s:"files",p=n,m={};d in p&&(m[d]=p[d]),f in p&&(m[f]=p[f]),Object.keys(m).length>0&&o.updateField(c,m)}else{const u=n[a.key];u!==void 0&&o.updateField(c,u)}})}}function sl(e,t,n,r){var o,i;typeof console!="undefined"&&console.warn&&console.warn(`[Form Builder] The "group" field type is deprecated and will be removed in a future version. Please use type: "container" with multiple: true instead. Field key: "${e.key}"`);const a={key:e.key,label:e.label,description:e.description,hint:e.hint,required:e.required,hidden:e.hidden,default:e.default,actions:e.actions,elements:e.elements,multiple:!!(e.repeat&&nt(e.repeat)),minCount:(o=e.repeat)==null?void 0:o.min,maxCount:(i=e.repeat)==null?void 0:i.max};a.multiple?Kn(a,t,n):Vn(a,t,n,r)}function Xn(e){var t,n;const r=e;return{type:"container",key:r.key,label:r.label,description:r.description,hint:r.hint,required:r.required,hidden:r.hidden,default:r.default,actions:r.actions,elements:r.elements,multiple:!!(r.repeat&&nt(r.repeat)),minCount:(t=r.repeat)==null?void 0:t.min,maxCount:(n=r.repeat)==null?void 0:n.max}}function cl(e,t,n){typeof console!="undefined"&&console.warn&&console.warn(`[Form Builder] The "group" field type is deprecated. Please use type: "container" instead. Field key: "${t}"`);const r=Xn(e);return Jn(r,t,n)}function dl(e,t,n,r){typeof console!="undefined"&&console.warn&&console.warn(`[Form Builder] The "group" field type is deprecated. Please use type: "container" instead. Field path: "${t}"`);const o=Xn(e);return Yn(o,t,n,r)}function ul(e){return e!==null&&typeof e=="object"&&"row"in e&&"col"in e&&"rowspan"in e&&"colspan"in e}function fl(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.top=="number"&&typeof t.left=="number"&&typeof t.bottom=="number"&&typeof t.right=="number"}function pl(e){return ul(e)?{top:e.row,left:e.col,bottom:e.row+e.rowspan-1,right:e.col+e.colspan-1}:fl(e)?e:null}function Ue(e){return e.map(pl).filter(t=>t!==null)}function Gn(e,t){return Array.from({length:e},()=>Array.from({length:t},()=>""))}function Ot(e,t,n){for(let r=0;r<e.length;r++){const o=e[r];if(o.top<0||o.left<0||o.bottom>=t||o.right>=n||o.top>o.bottom||o.left>o.right)return`Merge ${r} out of bounds`;for(let i=r+1;i<e.length;i++){const a=e[i];if(o.top<=a.bottom&&o.bottom>=a.top&&o.left<=a.right&&o.right>=a.left)return`Merges ${r} and ${i} overlap`}}return null}function Zn(e,t,n){for(const r of n){if(r.top===e&&r.left===t)return null;if(e>=r.top&&e<=r.bottom&&t>=r.left&&t<=r.right)return r}return null}function pt(e,t,n){var r;return(r=n.find(o=>o.top===e&&o.left===t))!=null?r:null}function Ne(e){var t;if(!e.anchor)return null;const n=(t=e.focus)!=null?t:e.anchor;return{r1:Math.min(e.anchor.row,n.row),c1:Math.min(e.anchor.col,n.col),r2:Math.max(e.anchor.row,n.row),c2:Math.max(e.anchor.col,n.col)}}function Pe(e){const t=document.createElement("button");return t.type="button",t.textContent=e.label,t.title=e.title,t.style.cssText=`
|
|
1142
1142
|
position: absolute;
|
|
1143
1143
|
width: ${e.size}px;
|
|
1144
1144
|
height: ${e.size}px;
|
|
@@ -1187,7 +1187,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1187
1187
|
font-family: var(--fb-font-family);
|
|
1188
1188
|
color: var(--fb-text-color);
|
|
1189
1189
|
table-layout: fixed;
|
|
1190
|
-
`,x.appendChild($);const M=(f=(d=e.importAccept)==null?void 0:d.map(A=>`.${A.toLowerCase()}`))!=null?f:[];async function
|
|
1190
|
+
`,x.appendChild($);const M=(f=(d=e.importAccept)==null?void 0:d.map(A=>`.${A.toLowerCase()}`))!=null?f:[];async function q(A){var T,L,O;if(!p.config.parseTableFile)return;if(M.length>0){const F=A.name.toLowerCase().replace(/^.*(\.[^.]+)$/,"$1");if(!M.includes(F))return}const U=vl(x,k("tableImporting",p));try{const F=await p.config.parseTableFile(A),re=F.cells,W=(T=F.merges)!=null?T:[];if(W.length>0){const V=Ot(W,re.length,(O=(L=re[0])==null?void 0:L.length)!=null?O:0);if(V)throw new Error(V)}h.length=0,re.forEach(V=>h.push([...V])),y.length=0,W.forEach(V=>y.push({...V})),v.anchor=null,v.focus=null,E(),N()}catch(F){const re=F instanceof Error?F.message:String(F);console.error(k("tableImportError",p).replace("{error}",re))}finally{U.remove()}}if(e.importAccept&&p.config.parseTableFile){const A=document.createElement("button");A.type="button",A.title=k("tableImportFile",p),A.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"/></svg>',A.style.cssText=`
|
|
1191
1191
|
position: absolute; top: 2px; left: 2px;
|
|
1192
1192
|
width: 20px; height: 20px;
|
|
1193
1193
|
padding: 0;
|
|
@@ -1197,7 +1197,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1197
1197
|
background: transparent;
|
|
1198
1198
|
cursor: pointer;
|
|
1199
1199
|
z-index: 2;
|
|
1200
|
-
`,A.addEventListener("mouseenter",()=>{A.style.color="var(--fb-primary-color, #0066cc)"}),A.addEventListener("mouseleave",()=>{A.style.color="var(--fb-text-color, #999)"});const T=document.createElement("input");T.type="file",T.accept=M.join(","),T.style.display="none",x.appendChild(T),A.addEventListener("click",()=>{T.click()}),T.addEventListener("change",()=>{var O;const U=(O=T.files)==null?void 0:O[0];U&&
|
|
1200
|
+
`,A.addEventListener("mouseenter",()=>{A.style.color="var(--fb-primary-color, #0066cc)"}),A.addEventListener("mouseleave",()=>{A.style.color="var(--fb-text-color, #999)"});const T=document.createElement("input");T.type="file",T.accept=M.join(","),T.style.display="none",x.appendChild(T),A.addEventListener("click",()=>{T.click()}),T.addEventListener("change",()=>{var O;const U=(O=T.files)==null?void 0:O[0];U&&q(U),T.value=""}),x.appendChild(A);let L=0;x.addEventListener("dragenter",O=>{O.preventDefault(),L++,L===1&&(x.style.outline="2px dashed var(--fb-primary-color, #0066cc)",x.style.outlineOffset="-2px")}),x.addEventListener("dragover",O=>{O.preventDefault(),O.dataTransfer&&(O.dataTransfer.dropEffect="copy")}),x.addEventListener("dragleave",O=>{O.preventDefault(),L--,L<=0&&(L=0,x.style.outline="",x.style.outlineOffset="")}),x.addEventListener("drop",O=>{var U,F;O.preventDefault(),L=0,x.style.outline="",x.style.outlineOffset="";const re=(F=(U=O.dataTransfer)==null?void 0:U.files)==null?void 0:F[0];re&&q(re)})}o.appendChild(x);const K=document.createElement("div");K.style.cssText=`
|
|
1201
1201
|
position: fixed;
|
|
1202
1202
|
display: none;
|
|
1203
1203
|
background: white;
|
|
@@ -1218,7 +1218,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1218
1218
|
cursor: pointer;
|
|
1219
1219
|
white-space: nowrap;
|
|
1220
1220
|
text-align: left;
|
|
1221
|
-
`,L.addEventListener("mouseenter",()=>{L.style.background="var(--fb-background-hover-color)"}),L.addEventListener("mouseleave",()=>{L.style.background="transparent"}),L.addEventListener("click",()=>{D(),T()}),L}function z(A,T){if(!b)return;K.innerHTML="",K.style.display="flex";const L=Ne(v),O=L&&(L.r1!==L.r2||L.c1!==L.c2),U=v.anchor&&pt(v.anchor.row,v.anchor.col,y);if(O&&K.appendChild(B(k("tableMergeCells",p),
|
|
1221
|
+
`,L.addEventListener("mouseenter",()=>{L.style.background="var(--fb-background-hover-color)"}),L.addEventListener("mouseleave",()=>{L.style.background="transparent"}),L.addEventListener("click",()=>{D(),T()}),L}function z(A,T){if(!b)return;K.innerHTML="",K.style.display="flex";const L=Ne(v),O=L&&(L.r1!==L.r2||L.c1!==L.c2),U=v.anchor&&pt(v.anchor.row,v.anchor.col,y);if(O&&K.appendChild(B(k("tableMergeCells",p),R)),U&&K.appendChild(B(k("tableSplitCell",p),I)),!K.firstChild){D();return}const F=140,re=K.children.length*32+8,W=window.innerWidth,V=window.innerHeight,Y=A+F>W?A-F:A,Z=T+re>V?T-re:T;K.style.left=`${Y}px`,K.style.top=`${Z}px`}function D(){K.style.display="none"}const J=new AbortController;document.addEventListener("mousedown",A=>{if(!o.isConnected){J.abort();return}K.contains(A.target)||D()},{signal:J.signal});function Q(){const A=Ne(v);$.querySelectorAll("td[data-row]").forEach(T=>{const L=parseInt(T.getAttribute("data-row")||"0",10),O=parseInt(T.getAttribute("data-col")||"0",10),U=v.anchor!==null&&v.anchor.row===L&&v.anchor.col===O,F=A!==null&&L>=A.r1&&L<=A.r2&&O>=A.c1&&O<=A.c2;T.style.outline=U?"2px solid var(--fb-primary-color, #0066cc)":"",T.style.outlineOffset=U?"-2px":"",L===0?T.style.backgroundColor="var(--fb-background-hover-color)":T.style.backgroundColor=F&&!U?"rgba(0,102,204,0.08)":""})}function ne(A,T){v.anchor={row:A,col:T},v.focus=null,Q(),$.focus()}function he(A,T){const L=$.querySelector(`td[data-row="${A}"][data-col="${T}"]`);if(!L)return;const O=L.querySelector("span");O&&(v.anchor={row:A,col:T},v.focus=null,Q(),hl(O,A,T,()=>h,E,ne))}function Ce(A){var T;const L=h.length>0?h[0].length:(T=e.columns)!=null?T:3,O=Array(L).fill(""),U=A!==void 0?A+1:h.length;h.splice(U,0,O),y=y.map(F=>F.top>=U?{...F,top:F.top+1,bottom:F.bottom+1}:F.top<U&&F.bottom>=U?{...F,bottom:F.bottom+1}:F),E(),N()}function Ke(A){if(h.length<=1)return;const T=A!==void 0?A:v.anchor?v.anchor.row:h.length-1;y=y.map(L=>L.top===T&&L.bottom===T?null:L.top===T?{...L,bottom:L.bottom-1}:L.bottom===T?{...L,bottom:L.bottom-1}:L.top<T&&L.bottom>T?{...L,bottom:L.bottom-1}:L.top>T?{...L,top:L.top-1,bottom:L.bottom-1}:L).filter(L=>L!==null),h.splice(T,1),v.anchor&&v.anchor.row>=h.length&&(v.anchor={row:h.length-1,col:v.anchor.col}),E(),N()}function et(A){var T,L;const O=A!==void 0?A+1:(L=(T=h[0])==null?void 0:T.length)!=null?L:0;h.forEach(U=>U.splice(O,0,"")),y=y.map(U=>U.left>=O?{...U,left:U.left+1,right:U.right+1}:U.left<O&&U.right>=O?{...U,right:U.right+1}:U),E(),N()}function S(A){if(h.length===0||h[0].length<=1)return;const T=A!==void 0?A:v.anchor?v.anchor.col:h[0].length-1;y=y.map(L=>L.left===T&&L.right===T?null:L.left===T?{...L,right:L.right-1}:L.right===T?{...L,right:L.right-1}:L.left<T&&L.right>T?{...L,right:L.right-1}:L.left>T?{...L,left:L.left-1,right:L.right-1}:L).filter(L=>L!==null),h.forEach(L=>L.splice(T,1)),v.anchor&&v.anchor.col>=h[0].length&&(v.anchor={row:v.anchor.row,col:h[0].length-1}),E(),N()}function R(){var A,T;if(!b)return;const L=Ne(v);if(!L)return;const{r1:O,c1:U,r2:F,c2:re}=L;if(O===F&&U===re)return;y=y.filter(P=>!(P.top<=F&&P.bottom>=O&&P.left<=re&&P.right>=U));const W=h[O][U];for(let P=O;P<=F;P++)for(let ee=U;ee<=re;ee++)(P!==O||ee!==U)&&(h[P][ee]="");h[O][U]=W;const V={top:O,left:U,bottom:F,right:re},Y=[...y,V],Z=Ot(Y,h.length,(T=(A=h[0])==null?void 0:A.length)!=null?T:0);if(Z){console.warn("Merge validation failed:",Z);return}y.push(V),v.anchor={row:O,col:U},v.focus=null,E(),N()}function I(){if(!b||!v.anchor)return;const{row:A,col:T}=v.anchor,L=y.findIndex(O=>O.top===A&&O.left===T);L!==-1&&(y.splice(L,1),v.focus=null,E(),N())}function N(){var A,T;$.innerHTML="";const L=h.length,O=L>0?h[0].length:0,U=Ne(v);for(let F=0;F<L;F++){const re=(F===0?(A=$.tHead)!=null?A:$.createTHead():(T=$.tBodies[0])!=null?T:$.createTBody()).insertRow();for(let W=0;W<O;W++){if(Zn(F,W,y))continue;const V=pt(F,W,y),Y=document.createElement("td");if(Y.setAttribute("data-row",String(F)),Y.setAttribute("data-col",String(W)),V){const te=V.bottom-V.top+1,X=V.right-V.left+1;te>1&&(Y.rowSpan=te),X>1&&(Y.colSpan=X)}const Z=U!==null&&F>=U.r1&&F<=U.r2&&W>=U.c1&&W<=U.c2,P=v.anchor!==null&&v.anchor.row===F&&v.anchor.col===W;Y.style.cssText=["border: var(--fb-border-width) solid var(--fb-border-color);","padding: 4px 8px;","min-width: 80px;","vertical-align: top;","cursor: text;","position: relative;",F===0?"background-color: var(--fb-background-hover-color); font-weight: 600;":"",Z&&!P?"background-color: rgba(0,102,204,0.08);":"",P?"outline: 2px solid var(--fb-primary-color, #0066cc); outline-offset: -2px;":""].join(" ");const ee=document.createElement("span");ee.textContent=h[F][W],ee.style.cssText="display: block; min-height: 1.4em; white-space: pre-wrap; word-break: break-word; outline: none;",Y.appendChild(ee);const G=F,ie=W;Y.addEventListener("mousedown",te=>{if(te.target.tagName!=="BUTTON"&&te.target.contentEditable!=="true"){if(te.button===2){const X=Ne(v);if(X&&G>=X.r1&&G<=X.r2&&ie>=X.c1&&ie<=X.c2)return}te.shiftKey&&v.anchor?(te.preventDefault(),v.focus={row:G,col:ie},v.dragging=!1,Q()):(v.anchor={row:G,col:ie},v.focus=null,v.dragging=!0,Q())}}),Y.addEventListener("mouseup",te=>{if(te.target.tagName!=="BUTTON"&&v.dragging){v.dragging=!1;const X=Ne(v);(!X||X.r1===X.r2&&X.c1===X.c2)&&he(G,ie)}}),Y.addEventListener("mousemove",te=>{if(v.dragging&&te.buttons===1){const X=v.anchor;X&&(X.row!==G||X.col!==ie)&&(v.focus={row:G,col:ie},Q())}}),Y.addEventListener("contextmenu",te=>{if(!b)return;const X=Ne(v),pe=X&&(X.r1!==X.r2||X.c1!==X.c2),fe=v.anchor&&pt(v.anchor.row,v.anchor.col,y);(pe||fe)&&(te.preventDefault(),z(te.clientX,te.clientY))}),re.appendChild(Y)}}be(),$.setAttribute("tabindex","0"),$.onkeydown=F=>{var re,W;if($.querySelector("[contenteditable='true']"))return;const V=v.anchor;if(!V)return;const Y=h.length,Z=Y>0?h[0].length:0,P={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]};if(P[F.key]){F.preventDefault();const[ee,G]=P[F.key],ie=Math.max(0,Math.min(Y-1,V.row+ee)),te=Math.max(0,Math.min(Z-1,V.col+G));F.shiftKey?(v.focus={row:ie,col:te},Q()):ne(ie,te);return}if(F.key==="Enter"){F.preventDefault(),he(V.row,V.col);return}if(F.key==="Tab"){F.preventDefault();const ee=(W=(re=h[0])==null?void 0:re.length)!=null?W:0;let G=V.row,ie=F.shiftKey?V.col-1:V.col+1;ie<0&&(ie=ee-1,G=Math.max(0,G-1)),ie>=ee&&(ie=0,G=Math.min(h.length-1,G+1)),ne(G,ie);return}if(b&&F.key==="m"&&F.ctrlKey&&!F.shiftKey){F.preventDefault(),R();return}b&&F.key==="M"&&F.ctrlKey&&F.shiftKey&&(F.preventDefault(),I())},$.oncopy=F=>{var re,W,V,Y;const Z=Ne(v);if(!Z)return;F.preventDefault();const{r1:P,c1:ee,r2:G,c2:ie}=Z,te=[],X=[];for(let _=P;_<=G;_++){const ue=[],ve=[];for(let ge=ee;ge<=ie;ge++){const Ee=(W=(re=h[_])==null?void 0:re[ge])!=null?W:"";ue.push(Ee);const Be=Ee.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");ve.push(`<td>${Be}</td>`)}te.push(ue.join(" ")),X.push(`<tr>${ve.join("")}</tr>`)}const pe=te.join(`
|
|
1222
1222
|
`),fe=`<table>${X.join("")}</table>`;(V=F.clipboardData)==null||V.setData("text/plain",pe),(Y=F.clipboardData)==null||Y.setData("text/html",fe)},$.onpaste=F=>{var re,W,V,Y,Z,P,ee,G,ie;const te=v.anchor;if(!te)return;const X=(W=(re=F.clipboardData)==null?void 0:re.getData("text/plain"))!=null?W:"",pe=X.includes(" ")||X.split(/\r?\n/).filter(me=>me).length>1,fe=$.querySelector("[contenteditable='true']");if(fe&&!pe)return;if(F.preventDefault(),fe){fe.contentEditable="inherit";const me=parseInt((Y=(V=fe.closest("td"))==null?void 0:V.getAttribute("data-row"))!=null?Y:"0",10),Ie=parseInt((P=(Z=fe.closest("td"))==null?void 0:Z.getAttribute("data-col"))!=null?P:"0",10);h[me]&&(h[me][Ie]=(ee=fe.textContent)!=null?ee:"")}if(!X.trim())return;const _=X.split(/\r?\n/).map(me=>me.split(" "));_.length>1&&_[_.length-1].length===1&&_[_.length-1][0]===""&&_.pop();const ue=te.row,ve=te.col,ge=ue+_.length;for(;h.length<ge;)h.push(Array((ie=(G=h[0])==null?void 0:G.length)!=null?ie:1).fill(""));const Ee=Math.max(..._.map(me=>me.length)),Be=ve+Ee;if(h[0]&&Be>h[0].length){const me=Be-h[0].length;h.forEach(Ie=>{for(let tt=0;tt<me;tt++)Ie.push("")})}for(let me=0;me<_.length;me++)for(let Ie=0;Ie<_[me].length;Ie++){const tt=ue+me,li=ve+Ie;h[tt]&&(h[tt][li]=_[me][Ie])}E(),N()}}const H=Pe({label:"+",title:k("tableAddColumn",p),size:20,color:"var(--fb-primary-color, #0066cc)",textColor:"white",onClick:()=>{var A;const T=parseInt((A=H.dataset.afterCol)!=null?A:"0",10);et(T)}});H.style.position="absolute",H.style.display="none",x.appendChild(H);const j=Pe({label:"+",title:k("tableAddRow",p),size:20,color:"var(--fb-primary-color, #0066cc)",textColor:"white",onClick:()=>{var A;const T=parseInt((A=j.dataset.afterRow)!=null?A:"0",10);Ce(T)}});j.style.position="absolute",j.style.display="none",x.appendChild(j);let oe=[],le=[];const de=Pe({label:"+",title:k("tableAddColumn",p),size:20,color:"var(--fb-primary-color, #0066cc)",textColor:"white",onClick:()=>et()});de.style.position="absolute",de.style.display="none",x.appendChild(de);const ce=Pe({label:"+",title:k("tableAddRow",p),size:20,color:"var(--fb-primary-color, #0066cc)",textColor:"white",onClick:()=>Ce()});ce.style.position="absolute",ce.style.display="none",x.appendChild(ce);function be(){var A,T;oe.forEach(W=>W.remove()),oe=[],le.forEach(W=>W.remove()),le=[];const L=h.length>0?h[0].length:0,O=h.length;if(L>1){const W=Array.from($.querySelectorAll("thead td[data-col]"));for(const V of W){const Y=parseInt((A=V.getAttribute("data-col"))!=null?A:"0",10),Z=Pe({label:"\xD7",title:k("tableRemoveColumn",p),size:16,color:"var(--fb-error-color, #dc3545)",textColor:"white",onClick:()=>S(Y)});Z.setAttribute("data-action","remove-col"),Z.setAttribute("data-col",String(Y)),Z.style.position="absolute",Z.style.display="none",x.appendChild(Z),oe.push(Z)}}if(O>1){const W=[...$.tHead?Array.from($.tHead.rows):[],...$.tBodies[0]?Array.from($.tBodies[0].rows):[]].filter(V=>V.querySelector("td[data-row]"));for(const V of W){const Y=V.querySelector("td[data-row]");if(!Y)continue;const Z=parseInt((T=Y.getAttribute("data-row"))!=null?T:"0",10),P=Pe({label:"\xD7",title:k("tableRemoveRow",p),size:16,color:"var(--fb-error-color, #dc3545)",textColor:"white",onClick:()=>Ke(Z)});P.setAttribute("data-action","remove-row"),P.setAttribute("data-row",String(Z)),P.style.position="absolute",P.style.display="none",x.appendChild(P),le.push(P)}}function U(W,V,Y,Z,P){var ee;const G=P?Array.from($.querySelectorAll("thead td[data-col]")):[];let ie=-1,te=1/0,X=-1,pe=-1,fe=1/0;for(let _=0;_<G.length;_++){const ue=G[_].getBoundingClientRect(),ve=(ue.left+ue.right)/2,ge=Math.abs(W-ve);ge<te&&(te=ge,ie=_);const Ee=Math.abs(W-ue.right);Ee<fe&&Ee<20&&(fe=Ee,X=ue.right-V.left+Z,pe=parseInt((ee=G[_].getAttribute("data-col"))!=null?ee:"0",10))}oe.forEach((_,ue)=>{if(!P||ue!==ie){_.style.display="none";return}const ve=G[ue].getBoundingClientRect(),ge=(ve.left+ve.right)/2-V.left+Z;_.style.left=`${ge-8}px`,_.style.top="2px",_.style.display="flex"}),P&&pe>=0?(H.style.display="flex",H.style.left=`${X-10}px`,H.style.top=`${Y.top-V.top-10}px`,H.dataset.afterCol=String(pe)):H.style.display="none"}function F(W,V,Y,Z,P){var ee;const G=[];if(P){if($.tHead)for(const _ of Array.from($.tHead.rows))_.querySelector("td[data-row]")&&G.push(_);if($.tBodies[0])for(const _ of Array.from($.tBodies[0].rows))_.querySelector("td[data-row]")&&G.push(_)}let ie=-1,te=1/0,X=-1,pe=-1,fe=1/0;for(let _=0;_<G.length;_++){const ue=G[_].getBoundingClientRect(),ve=(ue.top+ue.bottom)/2,ge=Math.abs(W-ve);ge<te&&(te=ge,ie=_);const Ee=Math.abs(W-ue.bottom);if(Ee<fe&&Ee<14){fe=Ee,X=ue.bottom-V.top;const Be=G[_].querySelector("td[data-row]");pe=parseInt((ee=Be==null?void 0:Be.getAttribute("data-row"))!=null?ee:"0",10)}}le.forEach((_,ue)=>{if(!P||ue!==ie){_.style.display="none";return}const ve=G[ue].getBoundingClientRect(),ge=(ve.top+ve.bottom)/2-V.top;_.style.left="4px",_.style.top=`${ge-8}px`,_.style.display="flex"}),P&&pe>=0?(j.style.display="flex",j.style.top=`${X-10}px`,j.style.left=`${Y.left-V.left+Z-10}px`,j.dataset.afterRow=String(pe)):j.style.display="none"}let re=!1;x.onmousemove=W=>{const V=W.target;if(V.tagName==="BUTTON"&&V.parentElement===x||re)return;re=!0;const Y=W.clientX,Z=W.clientY;requestAnimationFrame(()=>{re=!1;const P=x.getBoundingClientRect(),ee=$.getBoundingClientRect(),G=x.scrollLeft,ie=Z>=P.top&&Z<ee.top+4,te=Y>=P.left&&Y<ee.left+4,X=Math.min(ee.right,P.right),pe=Y>X-20&&Y<=P.right,fe=Z>ee.bottom-4&&Z<=P.bottom+20;if(U(Y,P,ee,G,ie),F(Z,P,ee,G,te),de.style.display=pe?"flex":"none",pe&&(de.style.left=`${P.right-P.left+G-20}px`,de.style.top=`${(ee.top+ee.bottom)/2-P.top-10}px`),ce.style.display=fe?"flex":"none",fe){const _=(P.left+P.right)/2-P.left+G;ce.style.left=`${_-10}px`,ce.style.top=`${ee.bottom-P.top-10}px`}})},x.onmouseleave=()=>{oe.forEach(W=>{W.style.display="none"}),le.forEach(W=>{W.style.display="none"}),H.style.display="none",j.style.display="none",de.style.display="none",ce.style.display="none"}}N()}function yl(e){var t,n;return{cells:Gn((t=e.rows)!=null?t:3,(n=e.columns)!=null?n:3),merges:[]}}function Ut(e){return e!==null&&typeof e=="object"&&"cells"in e&&Array.isArray(e.cells)}function Pt(e,t){return e!==null&&typeof e=="object"&&t in e&&Array.isArray(e[t])}function xl(e,t,n,r){var o,i,a,l;const s=t.state,c=ae(e,s,t),u=t.prefill[e.key],d=(i=(o=e.fieldNames)==null?void 0:o.cells)!=null?i:"cells",f=(l=(a=e.fieldNames)==null?void 0:a.merges)!=null?l:"merges";let p;if(Ut(u))p={cells:u.cells,merges:u.merges?Ue(u.merges):[]};else if(u&&Pt(u,d)){const m=u[f];p={cells:u[d],merges:m?Ue(m):[]}}else if(Ut(e.default))p={cells:e.default.cells,merges:e.default.merges?Ue(e.default.merges):[]};else if(e.default&&Pt(e.default,d)){const m=e.default[f];p={cells:e.default[d],merges:m?Ue(m):[]}}else p=yl(e);if(p.merges&&p.merges.length>0){const m=p.cells.length,b=m>0?p.cells[0].length:0,g=Ot(p.merges,m,b);g&&(console.warn(`Table "${e.key}": invalid prefill merges stripped (${g})`),p={...p,merges:[]})}c?ml(p,n):gl(e,p,r,t,n)}function wl(e,t,n){var r,o;const{scopeRoot:i,skipValidation:a}=n,l=[],s=(o=(r=e.fieldNames)==null?void 0:r.cells)!=null?o:"cells",c=i.querySelector(`[name="${t}"]`);if(!c)return{value:null,errors:l};let u=null;try{u=JSON.parse(c.value)}catch(d){return l.push(`${t}: invalid table data`),{value:null,errors:l}}if(!a&&e.required){const d=u[s];d!=null&&d.some(f=>f.some(p=>p.trim()!==""))||l.push(`${t}: ${k("required",n.state)}`)}return{value:u,errors:l}}function Cl(e,t,n,r){var o,i,a,l;const{scopeRoot:s}=r,c=(i=(o=e.fieldNames)==null?void 0:o.cells)!=null?i:"cells",u=(l=(a=e.fieldNames)==null?void 0:a.merges)!=null?l:"merges",d=s.querySelector(`[name="${t}"]`);if(!d){console.warn(`updateTableField: no hidden input found for "${t}". Re-render to reflect new data.`);return}let f=null;if(Ut(n))f={cells:n.cells,merges:n.merges?Ue(n.merges):[]};else if(n&&Pt(n,c)){const p=n[u];f={cells:n[c],merges:p?Ue(p):[]}}f&&d._applyExternalUpdate?d._applyExternalUpdate(f):d.value=JSON.stringify(n)}function El(e,t){e.style.overflow="hidden",e.style.resize="none";const n=(e.value.match(/\n/g)||[]).length+1;e.rows=Math.max(3,n);const r=()=>{e.isConnected&&(e.style.height="0",e.style.height=`${e.scrollHeight}px`,t&&(t.style.height=`${e.scrollHeight}px`))};if(e.addEventListener("input",r),setTimeout(()=>{e.isConnected&&r()},0),typeof ResizeObserver=="undefined")return;let o=-1;const i=new ResizeObserver(a=>{var l,s,c,u,d;if(!e.isConnected){i.disconnect();return}const f=a[0],p=(d=(u=(s=(l=f==null?void 0:f.contentBoxSize)==null?void 0:l[0])==null?void 0:s.inlineSize)!=null?u:(c=f==null?void 0:f.contentRect)==null?void 0:c.width)!=null?d:0;p!==o&&(o=p,r())});i.observe(e)}function Wt(e,t){var n,r,o,i;const a=new Map,l=new Map;for(const s of e){const c=t.resourceIndex.get(s),u=(n=c==null?void 0:c.name)!=null?n:s;l.set(u,((r=l.get(u))!=null?r:0)+1)}for(const s of e){const c=t.resourceIndex.get(s),u=(o=c==null?void 0:c.name)!=null?o:s;((i=l.get(u))!=null?i:1)>1&&c?a.set(s,`${u} (${yr(c.size)})`):a.set(s,u)}return a}function Vt(e){return e?e.type.startsWith("image/"):!1}function Qn(e,t){const n=Wt(e,t),r=new Map;for(const o of e){const i=n.get(o);i&&r.set(i,o)}return r}function Kt(e){return/\s/.test(e)||e.includes('"')?`@"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`@${e}`}function mt(e){const t=[],n=e.length;let r=0;for(;r<n;)if(e[r]==="@"){if(r>0&&!/\s/.test(e[r-1])){r++;continue}const o=r;if(r++,r<n&&e[r]==='"'){r++;let i="";for(;r<n&&e[r]!=='"';)e[r]==="\\"&&r+1<n?(i+=e[r+1],r+=2):(i+=e[r],r++);r<n&&e[r]==='"'&&(r++,(r>=n||/\s/.test(e[r]))&&t.push({start:o,end:r,raw:e.slice(o,r),name:i}))}else if(r<n&&!/\s/.test(e[r])){const i=r;for(;r<n&&!/\s/.test(e[r]);)r++;const a=e.slice(i,r);t.push({start:o,end:r,raw:e.slice(o,r),name:a})}}else r++;return t}function kl(e,t){if(t.size===0)return[];const n=mt(e),r=[];for(const o of n){const i=t.get(o.name);i&&r.push({start:o.start,end:o.end,name:o.name,rid:i})}return r}function $l(e,t){const n=kl(e,t);if(n.length===0)return e;let r="",o=0;for(const i of n)r+=e.slice(o,i.start),r+=`@${i.rid}`,o=i.end;return r+=e.slice(o),r}function er(e,t,n){const r=Wt(t,n),o=new Map;for(const s of t){const c=r.get(s);c&&o.set(s,c)}const i=mt(e);if(i.length===0)return e;let a="",l=0;for(const s of i){a+=e.slice(l,s.start);const c=o.get(s.name);c?a+=Kt(c):a+=s.raw,l=s.end}return a+=e.slice(l),a}function tr(e,t,n,r){if(ye(e),n!=null&&n.file&&Vt(n)){const o=document.createElement("img");o.alt=n.name,o.style.cssText="width: 100%; height: 100%; object-fit: cover; display: block;";const i=new FileReader;i.onload=a=>{var l;o.src=((l=a.target)==null?void 0:l.result)||""},i.readAsDataURL(n.file),e.appendChild(o)}else if(r.config.getThumbnail){r.config.getThumbnail(t).then(i=>{var a;if(!i||!e.isConnected)return;const l=document.createElement("img");l.alt=(a=n==null?void 0:n.name)!=null?a:t,l.src=i,l.style.cssText="width: 100%; height: 100%; object-fit: cover; display: block;",ye(e),e.appendChild(l)}).catch(i=>{var a,l;(l=(a=r.config).onThumbnailError)==null||l.call(a,i,t)});const o=document.createElement("div");o.style.cssText="width: 100%; height: 100%; background: var(--fb-background-hover-color, #f3f4f6); display: flex; align-items: center; justify-content: center;",o.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>',e.appendChild(o)}else{const o=document.createElement("div");if(o.style.cssText="width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px; box-sizing: border-box;",o.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>',n!=null&&n.name){const i=document.createElement("span");i.style.cssText="font-size: 9px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44px; color: var(--fb-text-color, #111827);",i.textContent=n.name,o.appendChild(i)}e.appendChild(o)}}function nr(e,t,n,r){if(ye(e),n!=null&&n.file&&Vt(n)){const o=document.createElement("img");o.alt=n.name,o.style.cssText="max-width: 120px; max-height: 120px; object-fit: contain; display: block;";const i=new FileReader;i.onload=a=>{var l;o.src=((l=a.target)==null?void 0:l.result)||""},i.readAsDataURL(n.file),e.appendChild(o)}else r.config.getThumbnail&&r.config.getThumbnail(t).then(o=>{var i;if(!o||!e.isConnected)return;const a=document.createElement("img");a.alt=(i=n==null?void 0:n.name)!=null?i:t,a.src=o,a.style.cssText="max-width: 120px; max-height: 120px; object-fit: contain; display: block;",ye(e),e.appendChild(a)}).catch(o=>{var i,a;(a=(i=r.config).onThumbnailError)==null||a.call(i,o,t)})}function rr(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=Math.max(4,Math.min(n.left+n.width/2-r.width/2,window.innerWidth-r.width-4)),i=n.top-r.height-8,a=n.bottom+8,l=i>=4?i:a;e.style.left=`${o}px`,e.style.top=`${Math.max(4,l)}px`}function or(e,t,n){const r=n.resourceIndex.get(t),o=document.createElement("div");o.className="fb-richinput-portal-tooltip fb-richinput-mention-tooltip",o.style.cssText=`
|
|
1223
1223
|
position: fixed;
|
|
1224
1224
|
z-index: 99999;
|
|
@@ -1241,13 +1241,13 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1241
1241
|
pointer-events: auto;
|
|
1242
1242
|
min-width: 80px;
|
|
1243
1243
|
max-width: 260px;
|
|
1244
|
-
`;const f=document.createElement("div");f.style.cssText="min-height: 60px; max-height: 120px; display: flex; align-items: center; justify-content: center;",nr(f,o,c,i),d.appendChild(f);const p=document.createElement("div");p.style.cssText="padding: 4px 6px 2px; font-size: 12px; color: var(--fb-text-color, #111827); word-break: break-word; border-top: 1px solid var(--fb-border-color, #d1d5db);",p.textContent=u,d.appendChild(p);const m=document.createElement("div");m.style.cssText="display: flex; align-items: center; gap: 2px; padding: 3px 4px 2px; border-top: 1px solid var(--fb-border-color, #d1d5db); justify-content: center;";const b="background: none; border: none; cursor: pointer; padding: 3px 5px; border-radius: 4px; color: var(--fb-text-muted-color, #6b7280); display: flex; align-items: center; transition: background 0.1s, color 0.1s;",g=h=>{h.style.background="var(--fb-background-hover-color, #f3f4f6)",h.style.color="var(--fb-text-color, #111827)"},C=h=>{h.style.background="none",h.style.color="var(--fb-text-muted-color, #6b7280)"};if(!a&&l){const h=document.createElement("button");h.type="button",h.title="Mention",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"/></svg>',h.addEventListener("mouseenter",()=>g(h)),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{y.stopPropagation(),l(),d.remove()}),m.appendChild(h)}if(i.config.downloadFile){const h=document.createElement("button");h.type="button",h.title="Download",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',h.addEventListener("mouseenter",()=>g(h)),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{var v,w;y.stopPropagation(),(w=(v=i.config).downloadFile)==null||w.call(v,o,u)}),m.appendChild(h)}if((r=i.config.getDownloadUrl)!=null?r:i.config.getThumbnail){const h=document.createElement("button");h.type="button",h.title="Open in new window",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',h.addEventListener("mouseenter",()=>g(h)),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{var v,w,E,x;if(y.stopPropagation(),i.config.getDownloadUrl){const $=i.config.getDownloadUrl(o);$?window.open($,"_blank"):(w=(v=i.config).getThumbnail)==null||w.call(v,o).then(M=>{M&&window.open(M,"_blank")}).catch(()=>{})}else(x=(E=i.config).getThumbnail)==null||x.call(E,o).then($=>{$&&window.open($,"_blank")}).catch(()=>{})}),m.appendChild(h)}if(!a&&s){const h=document.createElement("button");h.type="button",h.title="Remove",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>',h.addEventListener("mouseenter",()=>{h.style.background="var(--fb-background-hover-color, #f3f4f6)",h.style.color="var(--fb-error-color, #ef4444)"}),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{y.stopPropagation(),d.remove(),s()}),m.appendChild(h)}return m.children.length>0&&d.appendChild(m),document.body.appendChild(d),rr(d,e),d}function ir(){return{element:null,hideTimer:null}}function ht(e,t=150){e.hideTimer===null&&(e.hideTimer=setTimeout(()=>{e.hideTimer=null,e.element&&(e.element.remove(),e.element=null)},t))}function bt(e){e.hideTimer!==null&&(clearTimeout(e.hideTimer),e.hideTimer=null)}function We(e){return e&&e.remove(),null}function Sl(e){var t;const n=(t=e.selectionStart)!=null?t:0,r=e.value.slice(0,n);for(let o=r.length-1;o>=0;o--)if(r[o]==="@"){if(o===0||/\s/.test(r[o-1])){let i=r.slice(o+1);return i.startsWith('"')&&(i=i.slice(1)),{query:i,pos:o}}return null}return null}function ar(e,t,n){const r=e.toLowerCase();return t.filter(o=>{var i;return((i=n.get(o))!=null?i:o).toLowerCase().includes(r)})}const vt="font-size: var(--fb-font-size, 14px); font-family: var(--fb-font-family, inherit); line-height: 1.6;",sr="padding: 8px 40px 8px 10px;";function Ll(e,t,n,r,o){var i;const a=t.state,l=[...o.files],s={open:!1,query:"",triggerPos:-1,selectedIndex:0},c=new AbortController,u=document.createElement("input");u.type="hidden",u.name=r;function d(){var S,
|
|
1244
|
+
`;const f=document.createElement("div");f.style.cssText="min-height: 60px; max-height: 120px; display: flex; align-items: center; justify-content: center;",nr(f,o,c,i),d.appendChild(f);const p=document.createElement("div");p.style.cssText="padding: 4px 6px 2px; font-size: 12px; color: var(--fb-text-color, #111827); word-break: break-word; border-top: 1px solid var(--fb-border-color, #d1d5db);",p.textContent=u,d.appendChild(p);const m=document.createElement("div");m.style.cssText="display: flex; align-items: center; gap: 2px; padding: 3px 4px 2px; border-top: 1px solid var(--fb-border-color, #d1d5db); justify-content: center;";const b="background: none; border: none; cursor: pointer; padding: 3px 5px; border-radius: 4px; color: var(--fb-text-muted-color, #6b7280); display: flex; align-items: center; transition: background 0.1s, color 0.1s;",g=h=>{h.style.background="var(--fb-background-hover-color, #f3f4f6)",h.style.color="var(--fb-text-color, #111827)"},C=h=>{h.style.background="none",h.style.color="var(--fb-text-muted-color, #6b7280)"};if(!a&&l){const h=document.createElement("button");h.type="button",h.title="Mention",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"/></svg>',h.addEventListener("mouseenter",()=>g(h)),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{y.stopPropagation(),l(),d.remove()}),m.appendChild(h)}if(i.config.downloadFile){const h=document.createElement("button");h.type="button",h.title="Download",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>',h.addEventListener("mouseenter",()=>g(h)),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{var v,w;y.stopPropagation(),(w=(v=i.config).downloadFile)==null||w.call(v,o,u)}),m.appendChild(h)}if((r=i.config.getDownloadUrl)!=null?r:i.config.getThumbnail){const h=document.createElement("button");h.type="button",h.title="Open in new window",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',h.addEventListener("mouseenter",()=>g(h)),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{var v,w,E,x;if(y.stopPropagation(),i.config.getDownloadUrl){const $=i.config.getDownloadUrl(o);$?window.open($,"_blank"):(w=(v=i.config).getThumbnail)==null||w.call(v,o).then(M=>{M&&window.open(M,"_blank")}).catch(()=>{})}else(x=(E=i.config).getThumbnail)==null||x.call(E,o).then($=>{$&&window.open($,"_blank")}).catch(()=>{})}),m.appendChild(h)}if(!a&&s){const h=document.createElement("button");h.type="button",h.title="Remove",h.style.cssText=b,h.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>',h.addEventListener("mouseenter",()=>{h.style.background="var(--fb-background-hover-color, #f3f4f6)",h.style.color="var(--fb-error-color, #ef4444)"}),h.addEventListener("mouseleave",()=>C(h)),h.addEventListener("click",y=>{y.stopPropagation(),d.remove(),s()}),m.appendChild(h)}return m.children.length>0&&d.appendChild(m),document.body.appendChild(d),rr(d,e),d}function ir(){return{element:null,hideTimer:null}}function ht(e,t=150){e.hideTimer===null&&(e.hideTimer=setTimeout(()=>{e.hideTimer=null,e.element&&(e.element.remove(),e.element=null)},t))}function bt(e){e.hideTimer!==null&&(clearTimeout(e.hideTimer),e.hideTimer=null)}function We(e){return e&&e.remove(),null}function Sl(e){var t;const n=(t=e.selectionStart)!=null?t:0,r=e.value.slice(0,n);for(let o=r.length-1;o>=0;o--)if(r[o]==="@"){if(o===0||/\s/.test(r[o-1])){let i=r.slice(o+1);return i.startsWith('"')&&(i=i.slice(1)),{query:i,pos:o}}return null}return null}function ar(e,t,n){const r=e.toLowerCase();return t.filter(o=>{var i;return((i=n.get(o))!=null?i:o).toLowerCase().includes(r)})}const vt="font-size: var(--fb-font-size, 14px); font-family: var(--fb-font-family, inherit); line-height: 1.6;",sr="padding: 8px 40px 8px 10px;";function Ll(e,t,n,r,o){var i;const a=t.state,l=[...o.files],s={open:!1,query:"",triggerPos:-1,selectedIndex:0},c=new AbortController,u=document.createElement("input");u.type="hidden",u.name=r;function d(){var S,R;const I=x.value,N=Qn(l,a),H=I?$l(I,N):null,j=(S=e.textKey)!=null?S:"text",oe=(R=e.filesKey)!=null?R:"files";return{[j]:I===""?null:H,[oe]:[...l]}}function f(){u.value=JSON.stringify(d())}const p=document.createElement("div");p.className="fb-richinput-wrapper",p.style.cssText=`
|
|
1245
1245
|
position: relative;
|
|
1246
1246
|
border: 1px solid var(--fb-border-color, #d1d5db);
|
|
1247
1247
|
border-radius: 16px;
|
|
1248
1248
|
background: var(--fb-background-color, #f9fafb);
|
|
1249
1249
|
transition: box-shadow 0.15s, border-color 0.15s;
|
|
1250
|
-
`,p.addEventListener("focusin",()=>{p.style.borderColor="var(--fb-primary-color, #0066cc)",p.style.boxShadow="0 0 0 2px color-mix(in srgb, var(--fb-primary-color, #0066cc) 25%, transparent)"}),p.addEventListener("focusout",()=>{p.style.borderColor="var(--fb-border-color, #d1d5db)",p.style.boxShadow="none"});const m=document.createElement("div");m.className="fb-richinput-error",m.style.cssText="display: none; color: var(--fb-error-color, #ef4444); font-size: var(--fb-font-size-small, 12px); padding: 4px 10px 6px;";let b=null;function g(S){m.textContent=S,m.style.display="block",b&&clearTimeout(b),b=setTimeout(()=>{m.style.display="none",m.textContent="",b=null},5e3)}function C(S){var
|
|
1250
|
+
`,p.addEventListener("focusin",()=>{p.style.borderColor="var(--fb-primary-color, #0066cc)",p.style.boxShadow="0 0 0 2px color-mix(in srgb, var(--fb-primary-color, #0066cc) 25%, transparent)"}),p.addEventListener("focusout",()=>{p.style.borderColor="var(--fb-border-color, #d1d5db)",p.style.boxShadow="none"});const m=document.createElement("div");m.className="fb-richinput-error",m.style.cssText="display: none; color: var(--fb-error-color, #ef4444); font-size: var(--fb-font-size-small, 12px); padding: 4px 10px 6px;";let b=null;function g(S){m.textContent=S,m.style.display="block",b&&clearTimeout(b),b=setTimeout(()=>{m.style.display="none",m.textContent="",b=null},5e3)}function C(S){var R;const I=ze(e.accept);if(!je(S.name,I)){const H=I.join(", ");return g(k("invalidFileExtension",a,{name:S.name,formats:H})),!1}const N=(R=e.maxSize)!=null?R:1/0;return it(S,N)?!0:(g(k("fileTooLarge",a,{name:S.name,maxSize:N})),!1)}let h=0;p.addEventListener("dragenter",S=>{S.preventDefault(),h++,p.style.borderColor="var(--fb-primary-color, #0066cc)",p.style.boxShadow="0 0 0 2px color-mix(in srgb, var(--fb-primary-color, #0066cc) 25%, transparent)"}),p.addEventListener("dragover",S=>{S.preventDefault()}),p.addEventListener("dragleave",S=>{S.preventDefault(),h--,h<=0&&(h=0,p.style.borderColor="var(--fb-border-color, #d1d5db)",p.style.boxShadow="none")}),p.addEventListener("drop",S=>{var R,I;S.preventDefault(),h=0,p.style.borderColor="var(--fb-border-color, #d1d5db)",p.style.boxShadow="none";const N=(R=S.dataTransfer)==null?void 0:R.files;if(!N||!a.config.uploadFile)return;const H=(I=e.maxFiles)!=null?I:1/0;for(let j=0;j<N.length;j++){if(l.length>=H){g(k("filesLimitExceeded",a,{skipped:N.length-j,max:H}));break}C(N[j])&&Ke(N[j])}});const y=document.createElement("div");y.className="fb-richinput-files",y.style.cssText="display: none; flex-wrap: wrap; gap: 4px; padding: 6px 10px 0; align-items: center;";const v=document.createElement("input");v.type="file",v.multiple=!0,v.style.display="none",e.accept&&(typeof e.accept=="string"?v.accept=e.accept:v.accept=e.accept.extensions.map(S=>S.startsWith(".")?S:`.${S}`).join(","));const w=document.createElement("div");w.style.cssText="position: relative;";const E=document.createElement("div");E.className="fb-richinput-backdrop",E.style.cssText=`
|
|
1251
1251
|
position: absolute;
|
|
1252
1252
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
1253
1253
|
${sr}
|
|
@@ -1273,8 +1273,8 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1273
1273
|
position: relative;
|
|
1274
1274
|
z-index: 1;
|
|
1275
1275
|
caret-color: var(--fb-text-color, #111827);
|
|
1276
|
-
`,El(x,E),x.addEventListener("scroll",()=>{E.scrollTop=x.scrollTop});let M=null;E.addEventListener("mouseover",S=>{var
|
|
1277
|
-
`;return}let N="",H=0;for(const j of I){N+=se(S.slice(H,j.start));const oe=
|
|
1276
|
+
`,El(x,E),x.addEventListener("scroll",()=>{E.scrollTop=x.scrollTop});let M=null;E.addEventListener("mouseover",S=>{var R,I;const N=(I=(R=S.target).closest)==null?void 0:I.call(R,"mark");N!=null&&N.dataset.rid&&(M=We(M),M=or(N,N.dataset.rid,a))}),E.addEventListener("mouseout",S=>{var R,I,N;if(!((I=(R=S.target).closest)!=null&&I.call(R,"mark")))return;const H=S.relatedTarget;(N=H==null?void 0:H.closest)!=null&&N.call(H,"mark")||(M=We(M))}),E.addEventListener("mousedown",S=>{var R,I;if(!((I=(R=S.target).closest)!=null&&I.call(R,"mark")))return;M=We(M);const N=E.querySelectorAll("mark");N.forEach(j=>j.style.pointerEvents="none");const H=document.elementFromPoint(S.clientX,S.clientY);H&&H.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window,clientX:S.clientX,clientY:S.clientY,button:S.button,buttons:S.buttons,detail:S.detail})),document.addEventListener("mouseup",()=>{N.forEach(j=>j.style.pointerEvents="auto")},{once:!0})});function q(){const S=x.value,R=Qn(l,a),I=mt(S);if(I.length===0){E.innerHTML=se(S)+`
|
|
1277
|
+
`;return}let N="",H=0;for(const j of I){N+=se(S.slice(H,j.start));const oe=R.get(j.name);oe?N+=`<mark data-rid="${se(oe)}" style="background: color-mix(in srgb, var(--fb-primary-color, #0066cc) 15%, transparent); color: transparent; border-radius: 8px; padding: 0; border: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--fb-primary-color, #0066cc) 15%, transparent), 0 0 0 3px color-mix(in srgb, var(--fb-primary-color, #0066cc) 30%, transparent); box-decoration-break: clone; -webkit-box-decoration-break: clone; pointer-events: auto; cursor: text;">${se(S.slice(j.start,j.end))}</mark>`:N+=`<mark style="color: transparent; background: none; padding: 0; border: none; text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: rgba(239, 68, 68, 0.45); text-underline-offset: 2px;">${se(S.slice(j.start,j.end))}</mark>`,H=j.end}N+=se(S.slice(H)),E.innerHTML=N+`
|
|
1278
1278
|
`}const K=document.createElement("button");K.type="button",K.title=k("richinputAttachFile",a),K.style.cssText=`
|
|
1279
1279
|
position: absolute;
|
|
1280
1280
|
right: 6px;
|
|
@@ -1291,7 +1291,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1291
1291
|
justify-content: center;
|
|
1292
1292
|
color: var(--fb-text-muted-color, #9ca3af);
|
|
1293
1293
|
transition: color 0.15s, background 0.15s;
|
|
1294
|
-
`,K.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>',K.addEventListener("mouseenter",()=>{K.style.color="var(--fb-primary-color, #0066cc)",K.style.background="var(--fb-background-hover-color, #f3f4f6)"}),K.addEventListener("mouseleave",()=>{K.style.color="var(--fb-text-muted-color, #9ca3af)",K.style.background="transparent"}),K.addEventListener("click",()=>{var S;const
|
|
1294
|
+
`,K.innerHTML='<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>',K.addEventListener("mouseenter",()=>{K.style.color="var(--fb-primary-color, #0066cc)",K.style.background="var(--fb-background-hover-color, #f3f4f6)"}),K.addEventListener("mouseleave",()=>{K.style.color="var(--fb-text-muted-color, #9ca3af)",K.style.background="transparent"}),K.addEventListener("click",()=>{var S;const R=(S=e.maxFiles)!=null?S:1/0;if(l.length>=R){g(k("filesLimitExceeded",a,{skipped:1,max:R}));return}v.click()});const B=document.createElement("div");B.className="fb-richinput-dropdown",B.style.cssText=`
|
|
1295
1295
|
display: none;
|
|
1296
1296
|
position: absolute;
|
|
1297
1297
|
bottom: 100%;
|
|
@@ -1307,7 +1307,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1307
1307
|
overflow-y: auto;
|
|
1308
1308
|
margin-bottom: 4px;
|
|
1309
1309
|
${vt}
|
|
1310
|
-
`;function z(){return Wt(l,a)}function D(S){ye(B);const
|
|
1310
|
+
`;function z(){return Wt(l,a)}function D(S){ye(B);const R=z();if(S.length===0){B.style.display="none",s.open=!1;return}S.forEach((I,N)=>{var H;const j=a.resourceIndex.get(I),oe=document.createElement("div");oe.className="fb-richinput-dropdown-item",oe.dataset.rid=I,oe.style.cssText=`
|
|
1311
1311
|
padding: 5px 10px;
|
|
1312
1312
|
cursor: pointer;
|
|
1313
1313
|
color: var(--fb-text-color, #111827);
|
|
@@ -1315,7 +1315,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1315
1315
|
display: flex;
|
|
1316
1316
|
align-items: center;
|
|
1317
1317
|
gap: 8px;
|
|
1318
|
-
`;const le=document.createElement("div");if(le.style.cssText="width: 24px; height: 24px; border-radius: 4px; overflow: hidden; flex-shrink: 0; background: var(--fb-background-hover-color, #f3f4f6); display: flex; align-items: center; justify-content: center;",j!=null&&j.file&&Vt(j)){const ce=document.createElement("img");ce.style.cssText="width: 100%; height: 100%; object-fit: cover; display: block;";const be=new FileReader;be.onload=A=>{var T;ce.src=((T=A.target)==null?void 0:T.result)||""},be.readAsDataURL(j.file),le.appendChild(ce)}else a.config.getThumbnail&&a.config.getThumbnail(I).then(ce=>{if(!ce||!le.isConnected)return;const be=document.createElement("img");be.style.cssText="width: 100%; height: 100%; object-fit: cover; display: block;",be.src=ce,ye(le),le.appendChild(be)}).catch(()=>{}),le.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>';oe.appendChild(le);const de=document.createElement("span");de.style.cssText="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;",de.textContent=(H=
|
|
1318
|
+
`;const le=document.createElement("div");if(le.style.cssText="width: 24px; height: 24px; border-radius: 4px; overflow: hidden; flex-shrink: 0; background: var(--fb-background-hover-color, #f3f4f6); display: flex; align-items: center; justify-content: center;",j!=null&&j.file&&Vt(j)){const ce=document.createElement("img");ce.style.cssText="width: 100%; height: 100%; object-fit: cover; display: block;";const be=new FileReader;be.onload=A=>{var T;ce.src=((T=A.target)==null?void 0:T.result)||""},be.readAsDataURL(j.file),le.appendChild(ce)}else a.config.getThumbnail&&a.config.getThumbnail(I).then(ce=>{if(!ce||!le.isConnected)return;const be=document.createElement("img");be.style.cssText="width: 100%; height: 100%; object-fit: cover; display: block;",be.src=ce,ye(le),le.appendChild(be)}).catch(()=>{}),le.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>';oe.appendChild(le);const de=document.createElement("span");de.style.cssText="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;",de.textContent=(H=R.get(I))!=null?H:I,oe.appendChild(de),B.appendChild(oe)}),B.onmousemove=I=>{var N,H,j;const oe=(H=(N=I.target).closest)==null?void 0:H.call(N,".fb-richinput-dropdown-item");if(!oe)return;const le=S.indexOf((j=oe.dataset.rid)!=null?j:"");le===-1||le===s.selectedIndex||(B.querySelectorAll(".fb-richinput-dropdown-item").forEach((de,ce)=>{de.style.background=ce===le?"var(--fb-background-hover-color, #f3f4f6)":"transparent"}),s.selectedIndex=le)},B.onmousedown=I=>{var N,H;I.preventDefault(),I.stopPropagation();const j=(H=(N=I.target).closest)==null?void 0:H.call(N,".fb-richinput-dropdown-item");j!=null&&j.dataset.rid&&ne(j.dataset.rid)},B.style.display="block",s.open=!0}function J(){const S=Sl(x);if(!S){Q();return}s.query=S.query,s.triggerPos=S.pos,s.selectedIndex=0;const R=z(),I=ar(S.query,l,R);D(I)}function Q(){B.style.display="none",s.open=!1}function ne(S){var R,I,N,H;const j=(N=(I=z().get(S))!=null?I:(R=a.resourceIndex.get(S))==null?void 0:R.name)!=null?N:S,oe=(H=x.selectionStart)!=null?H:0,le=x.value.slice(0,s.triggerPos),de=x.value.slice(oe),ce=`${Kt(j)} `;x.value=`${le}${ce}${de}`;const be=le.length+ce.length;x.setSelectionRange(be,be),x.dispatchEvent(new Event("input")),Q()}x.addEventListener("input",()=>{var S;q(),f(),(S=t.instance)==null||S.triggerOnChange(r,d()),l.length>0?J():Q()});function he(){B.querySelectorAll(".fb-richinput-dropdown-item").forEach((S,R)=>{S.style.background=R===s.selectedIndex?"var(--fb-background-hover-color, #f3f4f6)":"transparent"})}x.addEventListener("keydown",S=>{if(!s.open)return;const R=z(),I=ar(s.query,l,R);S.key==="ArrowDown"?(S.preventDefault(),s.selectedIndex=Math.min(s.selectedIndex+1,I.length-1),he()):S.key==="ArrowUp"?(S.preventDefault(),s.selectedIndex=Math.max(s.selectedIndex-1,0),he()):S.key==="Enter"&&I.length>0?(S.preventDefault(),ne(I[s.selectedIndex])):S.key==="Escape"&&Q()}),document.addEventListener("click",S=>{!p.contains(S.target)&&!B.contains(S.target)&&Q()},{signal:c.signal});function Ce(){if(ye(y),l.length===0){y.style.display="none";return}y.style.display="flex",l.forEach(S=>{const R=a.resourceIndex.get(S),I=document.createElement("div");I.className="fb-richinput-file-thumb",I.style.cssText=`
|
|
1319
1319
|
position: relative;
|
|
1320
1320
|
width: 48px;
|
|
1321
1321
|
height: 48px;
|
|
@@ -1325,14 +1325,14 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1325
1325
|
flex-shrink: 0;
|
|
1326
1326
|
cursor: pointer;
|
|
1327
1327
|
background: #fff;
|
|
1328
|
-
`;const N=document.createElement("div");N.style.cssText="width: 48px; height: 48px; border-radius: inherit; overflow: hidden;",tr(N,S,
|
|
1329
|
-
`:""}${Kt(A)} `;x.value=`${T}${O}${L}`;const U=be+O.length;x.setSelectionRange(U,U),x.focus(),x.dispatchEvent(new Event("input"))},oe=()=>{var le;const de=l.indexOf(S);de!==-1&&l.splice(de,1),Ce(),
|
|
1328
|
+
`;const N=document.createElement("div");N.style.cssText="width: 48px; height: 48px; border-radius: inherit; overflow: hidden;",tr(N,S,R,a),I.appendChild(N);const H=ir(),j=()=>{var le,de,ce;const be=(le=x.selectionStart)!=null?le:x.value.length,A=(ce=(de=z().get(S))!=null?de:R==null?void 0:R.name)!=null?ce:S,T=x.value.slice(0,be),L=x.value.slice(be),O=`${T.length>0&&!/[\s\n]$/.test(T)?`
|
|
1329
|
+
`:""}${Kt(A)} `;x.value=`${T}${O}${L}`;const U=be+O.length;x.setSelectionRange(U,U),x.focus(),x.dispatchEvent(new Event("input"))},oe=()=>{var le;const de=l.indexOf(S);de!==-1&&l.splice(de,1),Ce(),q(),f(),(le=t.instance)==null||le.triggerOnChange(r,d())};I.addEventListener("mouseenter",()=>{bt(H),H.element||(H.element=lr(I,{rid:S,state:a,isReadonly:!1,onMention:j,onRemove:oe}),H.element.addEventListener("mouseenter",()=>{bt(H)}),H.element.addEventListener("mouseleave",()=>{ht(H)}))}),I.addEventListener("mouseleave",()=>{ht(H)}),y.appendChild(I)})}function Ke(S){if(!a.config.uploadFile)return;const R=`temp-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;a.resourceIndex.set(R,{name:S.name,type:S.type,size:S.size,uploadedAt:new Date,file:S}),l.push(R),Ce();const I=y.querySelectorAll(".fb-richinput-file-thumb"),N=I[I.length-1];N&&(N.style.opacity="0.5"),a.config.uploadFile(S).then(H=>{var j;const oe=l.indexOf(R);oe!==-1&&(l[oe]=H),a.resourceIndex.delete(R),a.resourceIndex.set(H,{name:S.name,type:S.type,size:S.size,uploadedAt:new Date,file:S}),Ce(),q(),f(),(j=t.instance)==null||j.triggerOnChange(r,d())}).catch(H=>{var j,oe;const le=l.indexOf(R);le!==-1&&l.splice(le,1),a.resourceIndex.delete(R),Ce(),(oe=(j=a.config).onUploadError)==null||oe.call(j,H,S)})}if(v.addEventListener("change",()=>{var S;const R=v.files;if(!R||R.length===0)return;const I=(S=e.maxFiles)!=null?S:1/0;for(let N=0;N<R.length;N++){if(l.length>=I){g(k("filesLimitExceeded",a,{skipped:R.length-N,max:I}));break}C(R[N])&&Ke(R[N])}v.value=""}),w.appendChild(E),w.appendChild(x),w.appendChild(K),w.appendChild(B),p.appendChild(y),p.appendChild(w),p.appendChild(m),e.minLength!=null||e.maxLength!=null){const S=document.createElement("div");S.style.cssText="position: relative; padding: 2px 10px 4px; text-align: right;";const R=rt(e,x);R.style.cssText=`
|
|
1330
1330
|
position: static;
|
|
1331
1331
|
display: inline-block;
|
|
1332
1332
|
font-size: var(--fb-font-size-small);
|
|
1333
1333
|
color: var(--fb-text-secondary-color);
|
|
1334
1334
|
pointer-events: none;
|
|
1335
|
-
`,S.appendChild(
|
|
1335
|
+
`,S.appendChild(R),p.appendChild(S)}p.appendChild(u),p.appendChild(v),f(),q(),u._applyExternalUpdate=S=>{var R;const I=(R=S.text)!=null?R:"";x.value=I?er(I,l,a):"",x.dispatchEvent(new Event("input")),l.length=0;for(const N of S.files)l.push(N);Ce(),q(),f()},n.appendChild(p),Ce();const et=new MutationObserver(()=>{p.isConnected||(c.abort(),M=We(M),et.disconnect())});p.parentElement&&et.observe(p.parentElement,{childList:!0})}function Tl(e,t,n,r,o){var i,a;const l=t.state,{text:s,files:c}=o,u=new Map;for(const d of c){const f=l.resourceIndex.get(d);f!=null&&f.name&&u.set(d,f.name)}if(c.length>0){const d=document.createElement("div");d.style.cssText="display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px;",c.forEach(f=>{const p=l.resourceIndex.get(f),m=document.createElement("div");m.style.cssText=`
|
|
1336
1336
|
position: relative;
|
|
1337
1337
|
width: 48px; height: 48px;
|
|
1338
1338
|
border: 1px solid var(--fb-border-color, #d1d5db);
|
|
@@ -1431,7 +1431,7 @@ var FormBuilder=(function(Ae){"use strict";function k(e,t,n){const r=t.config.lo
|
|
|
1431
1431
|
.fb-markdown strong { font-weight: var(--fb-font-weight-medium, 600); }
|
|
1432
1432
|
.fb-markdown em { font-style: italic; }
|
|
1433
1433
|
.fb-markdown s { text-decoration: line-through; }
|
|
1434
|
-
`,document.head.appendChild(e)}const Il=["javascript:","data:","vbscript:","blob:"],Rl=["javascript:","vbscript:","blob:"];function ql(e){return!!(Rl.some(t=>e.startsWith(t))||e.startsWith("data:")&&!e.startsWith("data:image/"))}function Bl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Hl(e){e.querySelectorAll("a[href]").forEach(t=>{var n;const r=((n=t.getAttribute("href"))!=null?n:"").trim().toLowerCase();Il.some(o=>r.startsWith(o))&&t.setAttribute("href","#"),t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer")}),e.querySelectorAll("img[src]").forEach(t=>{var n;const r=((n=t.getAttribute("src"))!=null?n:"").trim().toLowerCase();ql(r)&&t.setAttribute("src","")})}function Dl(e,t,n){if(typeof e.content!="string")throw new Error(`renderMarkdown: markdown element${e.key?` "${e.key}"`:""} requires "content" to be a string (got ${e.content===null?"null":typeof e.content})`);Nl();const r=document.createElement("div");r.className="fb-markdown";const o=Bl(e.content);return r.innerHTML=_t(o),Hl(r),n.appendChild(r),r}function jl(e,t,n){return{value:void 0,errors:[],skip:!0}}function Ol(e,t,n,r){}function Ul(e,t,n){var r;const{scopeRoot:o}=n,i=o.querySelector(`input[type="hidden"][data-hidden-field="true"][name="${t}"]`),a=(r=i==null?void 0:i.value)!=null?r:"";if(a===""){const l="default"in e?e.default:null;return{value:l!==void 0?l:null,errors:[]}}return{value:Zt(a),errors:[]}}function Pl(e,t,n,r){const{scopeRoot:o}=r,i=o.querySelector(`input[type="hidden"][data-hidden-field="true"][name="${t}"]`);i&&(i.value=Gt(n))}const Wl={text:{validate:tn,update:nn},textarea:{validate:Ar,update:Fr},number:{validate:Rr,update:qr},select:{validate:Dr,update:jr},switcher:{validate:Wr,update:Vr},boolean:{validate:Jr,update:Yr,ownsLabel:!0},file:{validate:In,update:qn},files:{validate:In,update:qn},colour:{validate:Qo,update:el},slider:{validate:rl,update:ol},container:{validate:Jn,update:Yn},group:{validate:cl,update:dl},table:{validate:wl,update:Cl},richinput:{validate:Fl,update:zl},hidden:{validate:Ul,update:Pl},markdown:{validate:jl,update:Ol}};function Jt(e){return Wl[e]||null}function Vl(e,t,n){const r=Jt(e.type);return r&&r.validate?r.validate(e,t,n):null}function Kl(e,t,n,r){const o=Jt(e.type);return o&&o.update?(o.update(e,t,n,r),!0):!1}function _l(e,t){const n=document.getElementById(e);if(!n)return;const r=!n.classList.contains("hidden");if(document.querySelectorAll('[id^="tooltip-"]').forEach(u=>{u.classList.add("hidden")}),r)return;const o=t.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight;n&&n.parentElement!==document.body&&document.body.appendChild(n),n.style.visibility="hidden",n.style.position="fixed",n.classList.remove("hidden");const l=n.getBoundingClientRect();n.classList.add("hidden"),n.style.visibility="visible";let s=o.left,c=o.bottom+5;s+l.width>i&&(s=o.right-l.width),c+l.height>a&&(c=o.top-l.height-5),s<10&&(s=10),c<10&&(c=o.bottom+5),n.style.left=`${s}px`,n.style.top=`${c}px`,n.classList.remove("hidden"),setTimeout(()=>{n.classList.add("hidden")},25e3)}typeof document!="undefined"&&document.addEventListener("click",e=>{const t=e.target,n=t.closest("button")&&t.closest("button").onclick,r=t.closest('[id^="tooltip-"]');!n&&!r&&document.querySelectorAll('[id^="tooltip-"]').forEach(o=>{o.classList.add("hidden")})});function ur(e,t){var n,r,o;if(!e.enableIf)return!1;try{const i=(r=(n=t.formData)!=null?n:t.prefill)!=null?r:{},a=((o=e.enableIf.scope)!=null?o:"relative")==="relative"&&t.path?t.prefill:void 0;return!He(e.enableIf,i,a)}catch(i){console.error(`Error evaluating enableIf for field "${e.key}":`,i)}return!1}function Jl(e,t){const n=t.querySelector(`[name="${e}"]`);if(n){if(n instanceof HTMLSelectElement)return n.value;if(n instanceof HTMLInputElement){if(n.type==="checkbox")return n.checked;if(n.type==="radio"){const r=t.querySelector(`[name="${e}"]:checked`);return r?r.value:void 0}else return n.value}else if(n instanceof HTMLTextAreaElement)return n.value}}function Yl(e,t){const n=e.match(/[^.[\]]+|\[\d+\]/g);if(!n||n.length===0)return{};const r={};let o=r;for(let a=0;a<n.length-1;a++){const l=n[a],s=n[a+1],c=s.startsWith("[")&&s.endsWith("]")?[]:{};if(l.startsWith("[")&&l.endsWith("]")){const u=parseInt(l.slice(1,-1),10);o[u]=c}else o[l]=c;o=c}const i=n[n.length-1];return i.startsWith("[")&&i.endsWith("]")?o[parseInt(i.slice(1,-1),10)]=t:o[i]=t,r}function gt(e,t,n){var r;if(!t.enableIf)return;const o=n.state.formRoot;if(!o){console.error("Cannot re-evaluate enableIf: formRoot is null");return}const i=t.enableIf,a=(r=i.scope)!=null?r:"relative",l=!n.path||n.path===""?"absolute":a,s=i.key,c=l==="relative"&&n.path?`${n.path}.${s}`:s,u=Jl(c,o),d=Yl(s,u),f=l==="relative"?{}:d,p=l==="relative"?d:void 0;try{He(i,f,p)?(e.style.display="",e.classList.remove("fb-field-wrapper-disabled"),e.removeAttribute("data-conditionally-disabled")):(e.style.display="none",e.classList.add("fb-field-wrapper-disabled"),e.setAttribute("data-conditionally-disabled","true"))}catch(m){console.error(`Error re-evaluating enableIf for field "${t.key}":`,m)}}function fr(e,t,n){var r;if(!t.enableIf)return;const o=n.state.formRoot;if(!o){console.error("Cannot setup enableIf listeners: formRoot is null");return}const i=t.enableIf,a=(r=i.scope)!=null?r:"relative",l=i.key;let s;a==="relative"&&n.path?s=`${n.path}.${l}`:s=l;const c=o.querySelector(`[name="${s}"]`);if(!c){const u=new MutationObserver(()=>{const d=o.querySelector(`[name="${s}"]`);d&&(d.addEventListener("change",()=>{gt(e,t,n)}),d.addEventListener("input",()=>{gt(e,t,n)}),u.disconnect(),n.state.enableIfObservers.delete(u))});n.state.enableIfObservers.add(u),u.observe(o,{childList:!0,subtree:!0});return}c.addEventListener("change",()=>{gt(e,t,n)}),c.addEventListener("input",()=>{gt(e,t,n)})}function Xl(e){var t,n;const r=document.createElement("label");if(r.className="text-sm font-medium text-gray-900",r.textContent=(n=(t=e.label)!=null?t:e.key)!=null?n:"",e.required){const o=document.createElement("span");o.className="text-red-500 ml-1",o.textContent="*",r.appendChild(o)}return r}function Gl(e){const t=document.createElement("button");t.type="button",t.className="ml-2 text-gray-400 hover:text-gray-600",t.innerHTML='<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>';const n=`tooltip-${e.key}-${Math.random().toString(36).substr(2,9)}`,r=document.createElement("div");return r.id=n,r.className="hidden absolute z-50 bg-gray-200 text-gray-900 text-sm rounded-lg p-3 max-w-sm border border-gray-300 shadow-lg",r.style.position="fixed",r.textContent=e.description||e.hint||"Field information",document.body.appendChild(r),t.onclick=o=>{o.preventDefault(),o.stopPropagation(),_l(n,t)},t}function Zl(e){const t=document.createElement("div");t.className="flex items-center mb-1",t.dataset.fbLabelRow="";const n=Xl(e);if(t.appendChild(n),e.description||e.hint){const r=Gl(e);t.appendChild(r)}return t}function Ql(e,t,n,r){const o="multiple"in e&&e.multiple;switch(e.type){case"text":o?Sr(e,t,n,r):$r(e,t,n,r);break;case"textarea":o?Tr(e,t,n,r):Lr(e,t,n,r);break;case"number":o?Ir(e,t,n,r):Nr(e,t,n,r);break;case"select":o?Hr(e,t,n,r):Br(e,t,n,r);break;case"switcher":o?Pr(e,t,n,r):Ur(e,t,n,r);break;case"boolean":_r(e,t,n,r);break;case"file":o?Xo(e,t,n,r):Jo(e,t,n,r);break;case"files":Yo(e,t,n,r);break;case"colour":o?Zo(e,t,n,r):Go(e,t,n,r);break;case"slider":o?nl(e,t,n,r):tl(e,t,n,r);break;case"group":sl(e,t,n,r);break;case"container":o?Kn(e,t,n):Vn(e,t,n,r);break;case"table":xl(e,t,n,r);break;case"richinput":Al(e,t,n,r);break;default:{const i=document.createElement("div");i.className="text-red-500 text-sm",i.textContent=k("unsupportedFieldType",t.state,{type:e.type}),n.appendChild(i)}}}function Yt(e,t){if(e.type==="markdown"){if(e.hidden===!0){const s=document.createElement("div");return s.style.display="none",s.setAttribute("data-fb-hidden-markdown","true"),s}const a=ur(e,t),l=document.createElement("div");return l.className="mb-2 fb-field-wrapper fb-markdown-wrapper",l.setAttribute("data-field-key",wt(e,t.state)),Dl(e,t,l),a&&(l.style.display="none",l.classList.add("fb-field-wrapper-disabled"),l.setAttribute("data-conditionally-disabled","true")),fr(l,e,t),l}const n=ur(e,t),r=document.createElement("div");r.className="mb-2 fb-field-wrapper",r.setAttribute("data-field-key",e.key);const o=Jt(e.type);if(!(o!=null&&o.ownsLabel)){const a=Zl(e);r.appendChild(a)}const i=ke(t.path,e.key);return Ql(e,t,r,i),n&&(r.style.display="none",r.classList.add("fb-field-wrapper-disabled"),r.setAttribute("data-conditionally-disabled","true")),fr(r,e,t),r}ll(Yt);const Xt={uploadFile:null,downloadFile:null,getThumbnail:null,getDownloadUrl:null,actionHandler:null,onChange:null,onFieldChange:null,onThumbnailError:null,onUploadError:null,onDownloadError:null,debounceMs:300,verboseErrors:!1,enableFilePreview:!0,maxPreviewSize:"200px",readonly:!1,pickExistingFiles:null,parseTableFile:null,locale:"en",translations:{en:{removeElement:"Remove",clickDragText:"Click or drag file",clickDragTextMultiple:"Click or drag files",noFileSelected:"No file selected",noFilesSelected:"No files selected",downloadButton:"Download",downloadFile:"Download",openInNewTab:"Open in new tab",changeButton:"Change",placeholderText:"Enter text",previewAlt:"Preview",previewUnavailable:"Preview unavailable",previewError:"Preview error",videoNotSupported:"Your browser does not support the video tag.",hintLengthRange:"{min}-{max} chars",hintMaxLength:"\u2264{max} chars",hintMinLength:"\u2265{min} chars",hintValueRange:"{min}-{max}",hintMaxValue:"\u2264{max}",hintMinValue:"\u2265{min}",hintMaxSize:"\u2264{size}MB",hintFormats:"{formats}",hintRequired:"Required",hintOptional:"Optional",hintPattern:"Format: {pattern}",fileCountSingle:"{count} file",fileCountPlural:"{count} files",fileCountWithMax:"{count} / {max} files",fileCountRange:"({min}-{max})",uploadingFile:"Uploading\u2026",filesCounter:"{count}/{max}",fromLibrary:"From library",libraryEmpty:"Library is empty",libraryHint:"Choose from previously uploaded files",dropToUpload:"Release to upload",replaceFile:"Replace",clearAll:"Clear all",pickerError:"Failed to load files from library",required:"Required",minItems:"Minimum {min} items required",maxItems:"Maximum {max} items allowed",minLength:"Minimum {min} characters",maxLength:"Maximum {max} characters",minValue:"Must be at least {min}",maxValue:"Must be at most {max}",patternMismatch:"Invalid format",invalidPattern:"Invalid pattern in schema",notANumber:"Must be a number",invalidHexColour:"Invalid hex color",minFiles:"Minimum {min} files required",maxFiles:"Maximum {max} files allowed",invalidFileExtension:'File "{name}" has unsupported format. Allowed: {formats}',invalidFileMime:'File "{name}": file type {type} not allowed (allowed: {mimes})',fileTooLarge:'File "{name}" exceeds maximum size of {maxSize}MB',uploadFailed:'Failed to upload "{name}": {error}',filesLimitExceeded:"{skipped} file(s) skipped: maximum {max} files allowed",unsupportedFieldType:"Unsupported field type: {type}",invalidOption:"Invalid option",tableAddRow:"Add row",tableAddColumn:"Add column",tableRemoveRow:"Remove row",tableRemoveColumn:"Remove column",tableMergeCells:"Merge cells (Ctrl+M)",tableSplitCell:"Split cell (Ctrl+Shift+M)",tableImportFile:"Import",tableImporting:"Importing...",tableImportError:"Import failed: {error}",richinputPlaceholder:"Type text...",richinputAttachFile:"Attach file",richinputMention:"Mention",richinputRemoveFile:"Remove"},ru:{removeElement:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",clickDragText:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B",clickDragTextMultiple:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B",noFileSelected:"\u0424\u0430\u0439\u043B \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D",noFilesSelected:"\u041D\u0435\u0442 \u0444\u0430\u0439\u043B\u043E\u0432",downloadButton:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C",downloadFile:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C",openInNewTab:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435",changeButton:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",placeholderText:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442",previewAlt:"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440",previewUnavailable:"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D",previewError:"\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430",videoNotSupported:"\u0412\u0430\u0448 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0438\u0434\u0435\u043E.",hintLengthRange:"{min}-{max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",hintMaxLength:"\u2264{max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",hintMinLength:"\u2265{min} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",hintValueRange:"{min}-{max}",hintMaxValue:"\u2264{max}",hintMinValue:"\u2265{min}",hintMaxSize:"\u2264{size}\u041C\u0411",hintFormats:"{formats}",hintRequired:"\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",hintOptional:"\u041D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",hintPattern:"\u0424\u043E\u0440\u043C\u0430\u0442: {pattern}",fileCountSingle:"{count} \u0444\u0430\u0439\u043B",fileCountPlural:"{count} \u0444\u0430\u0439\u043B\u043E\u0432",fileCountWithMax:"{count} / {max} \u0444\u0430\u0439\u043B\u043E\u0432",fileCountRange:"({min}-{max})",uploadingFile:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",filesCounter:"{count}/{max}",fromLibrary:"\u0418\u0437 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438",libraryEmpty:"\u0411\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0430 \u043F\u0443\u0441\u0442\u0430",libraryHint:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0440\u0430\u043D\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u0444\u0430\u0439\u043B\u043E\u0432",dropToUpload:"\u041E\u0442\u043F\u0443\u0441\u0442\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",replaceFile:"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C",clearAll:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0432\u0441\u0435",pickerError:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B\u044B \u0438\u0437 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438",required:"\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435",minItems:"\u041C\u0438\u043D\u0438\u043C\u0443\u043C {min} \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",maxItems:"\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",minLength:"\u041C\u0438\u043D\u0438\u043C\u0443\u043C {min} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",maxLength:"\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",minValue:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043D\u0435 \u043C\u0435\u043D\u0435\u0435 {min}",maxValue:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435 {max}",patternMismatch:"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442",invalidPattern:"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043F\u0430\u0442\u0442\u0435\u0440\u043D \u0432 \u0441\u0445\u0435\u043C\u0435",notANumber:"\u0414\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0447\u0438\u0441\u043B\u043E\u043C",invalidHexColour:"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u0446\u0432\u0435\u0442\u0430",minFiles:"\u041C\u0438\u043D\u0438\u043C\u0443\u043C {min} \u0444\u0430\u0439\u043B\u043E\u0432",maxFiles:"\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u0444\u0430\u0439\u043B\u043E\u0432",invalidFileExtension:'\u0424\u0430\u0439\u043B "{name}" \u0438\u043C\u0435\u0435\u0442 \u043D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442. \u0414\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0435: {formats}',invalidFileMime:'\u0424\u0430\u0439\u043B "{name}": \u0442\u0438\u043F \u0444\u0430\u0439\u043B\u0430 {type} \u043D\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043D (\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u044B: {mimes})',fileTooLarge:'\u0424\u0430\u0439\u043B "{name}" \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u0435\u0442 \u043C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 {maxSize}\u041C\u0411',uploadFailed:'\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C "{name}": {error}',filesLimitExceeded:"{skipped} \u0444\u0430\u0439\u043B(\u043E\u0432) \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043E: \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u0444\u0430\u0439\u043B\u043E\u0432",unsupportedFieldType:"\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0442\u0438\u043F \u043F\u043E\u043B\u044F: {type}",invalidOption:"\u041D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435",tableAddRow:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443",tableAddColumn:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446",tableRemoveRow:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443",tableRemoveColumn:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446",tableMergeCells:"\u041E\u0431\u044A\u0435\u0434\u0438\u043D\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0438 (Ctrl+M)",tableSplitCell:"\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0443 (Ctrl+Shift+M)",tableImportFile:"\u0418\u043C\u043F\u043E\u0440\u0442",tableImporting:"\u0418\u043C\u043F\u043E\u0440\u0442...",tableImportError:"\u041E\u0448\u0438\u0431\u043A\u0430 \u0438\u043C\u043F\u043E\u0440\u0442\u0430: {error}",richinputPlaceholder:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442...",richinputAttachFile:"\u041F\u0440\u0438\u043A\u0440\u0435\u043F\u0438\u0442\u044C \u0444\u0430\u0439\u043B",richinputMention:"\u0423\u043F\u043E\u043C\u044F\u043D\u0443\u0442\u044C",richinputRemoveFile:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C"}},theme:{}};function ei(e){const t={...Xt.translations};if(e!=null&&e.translations)for(const[n,r]of Object.entries(e.translations))t[n]={...Xt.translations[n]||{},...r};return{schema:null,formRoot:null,resourceIndex:new Map,externalActions:null,version:"1.0.0",config:{...Xt,...e,translations:t},debounceTimer:null,prefill:{},syntheticElementIds:new WeakMap,syntheticElementIdCounter:0,enableIfObservers:new Set}}function ti(){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,9);return`inst-${e}-${t}`}const Ve={primaryColor:"#3b82f6",primaryHoverColor:"#2563eb",primarySoftColor:"#dbeafe",primarySoftHoverColor:"#bfdbfe",errorColor:"#ef4444",errorHoverColor:"#dc2626",successColor:"#10b981",accentColor:"#f59e0b",accentSoftColor:"#fef3c7",accentBorderColor:"#fde68a",accentTextColor:"#92400e",borderColor:"#d1d5db",borderHoverColor:"#9ca3af",borderFocusColor:"#3b82f6",borderStrongColor:"#9ca3af",backgroundColor:"#ffffff",backgroundHoverColor:"#f9fafb",backgroundReadonlyColor:"#f3f4f6",pageBackgroundColor:"#f9fafb",surfaceSoftColor:"#eff6ff",surfaceTintColor:"#f8fafc",textColor:"#1f2937",textSecondaryColor:"#6b7280",textMutedColor:"#9ca3af",textFaintColor:"#cbd5e1",textPlaceholderColor:"#9ca3af",textDisabledColor:"#d1d5db",buttonBgColor:"#3b82f6",buttonTextColor:"#ffffff",buttonBorderColor:"#2563eb",buttonHoverBgColor:"#2563eb",buttonHoverBorderColor:"#1d4ed8",actionBgColor:"#ffffff",actionTextColor:"#374151",actionBorderColor:"#e5e7eb",actionHoverBgColor:"#f9fafb",actionHoverBorderColor:"#d1d5db",fileUploadBgColor:"#f3f4f6",fileUploadBorderColor:"#d1d5db",fileUploadTextColor:"#9ca3af",fileUploadHoverBorderColor:"#3b82f6",inputPaddingX:"0.5rem",inputPaddingY:"0.25rem",borderRadius:"0.5rem",borderRadiusSmall:"0.375rem",borderRadiusLarge:"0.75rem",borderRadiusXLarge:"1rem",borderWidth:"1px",fontSize:"0.875rem",fontSizeSmall:"0.75rem",fontSizeExtraSmall:"0.625rem",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontWeightNormal:"400",fontWeightMedium:"500",lineHeight:"1.5",shadowCard:"0 1px 2px rgba(15,23,42,.04), 0 1px 0 rgba(15,23,42,.02)",shadowPopover:"0 12px 32px -12px rgba(15,23,42,.18), 0 4px 12px -6px rgba(15,23,42,.08)",focusRingWidth:"2px",focusRingColor:"#3b82f6",focusRingOpacity:"0.5",transitionDuration:"200ms",slideCardBg:"#ffffff",slideCardShadow:"0 1px 2px rgba(15,23,42,.04), 0 1px 0 rgba(15,23,42,.02)",slideCardRadius:"0.5rem",slideCardMinHeight:"0",slideCardPadding:"12px",labelSectionFontSize:"0.875rem",labelSectionLetterSpacing:"normal",labelSectionTextTransform:"none"};function ni(e){const t={...Ve,...e},n=[];return Object.entries(t).forEach(([r,o])=>{const i=r.replace(/([A-Z])/g,"-$1").toLowerCase();n.push(` --fb-${i}: ${o};`)}),n.join(`
|
|
1434
|
+
`,document.head.appendChild(e)}const Il=["javascript:","data:","vbscript:","blob:"],ql=["javascript:","vbscript:","blob:"];function Rl(e){return!!(ql.some(t=>e.startsWith(t))||e.startsWith("data:")&&!e.startsWith("data:image/"))}function Bl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Hl(e){e.querySelectorAll("a[href]").forEach(t=>{var n;const r=((n=t.getAttribute("href"))!=null?n:"").trim().toLowerCase();Il.some(o=>r.startsWith(o))&&t.setAttribute("href","#"),t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer")}),e.querySelectorAll("img[src]").forEach(t=>{var n;const r=((n=t.getAttribute("src"))!=null?n:"").trim().toLowerCase();Rl(r)&&t.setAttribute("src","")})}function Dl(e,t,n){if(typeof e.content!="string")throw new Error(`renderMarkdown: markdown element${e.key?` "${e.key}"`:""} requires "content" to be a string (got ${e.content===null?"null":typeof e.content})`);Nl();const r=document.createElement("div");r.className="fb-markdown";const o=Bl(e.content);return r.innerHTML=_t(o),Hl(r),n.appendChild(r),r}function jl(e,t,n){return{value:void 0,errors:[],skip:!0}}function Ol(e,t,n,r){}function Ul(e,t,n){var r;const{scopeRoot:o}=n,i=o.querySelector(`input[type="hidden"][data-hidden-field="true"][name="${t}"]`),a=(r=i==null?void 0:i.value)!=null?r:"";if(a===""){const l="default"in e?e.default:null;return{value:l!==void 0?l:null,errors:[]}}return{value:Zt(a),errors:[]}}function Pl(e,t,n,r){const{scopeRoot:o}=r,i=o.querySelector(`input[type="hidden"][data-hidden-field="true"][name="${t}"]`);i&&(i.value=Gt(n))}const Wl={text:{validate:tn,update:nn},textarea:{validate:Ar,update:Fr},number:{validate:qr,update:Rr},select:{validate:Dr,update:jr},switcher:{validate:Wr,update:Vr},boolean:{validate:Jr,update:Yr,ownsLabel:!0},file:{validate:In,update:Rn},files:{validate:In,update:Rn},colour:{validate:Qo,update:el},slider:{validate:rl,update:ol},container:{validate:Jn,update:Yn},group:{validate:cl,update:dl},table:{validate:wl,update:Cl},richinput:{validate:Fl,update:zl},hidden:{validate:Ul,update:Pl},markdown:{validate:jl,update:Ol}};function Jt(e){return Wl[e]||null}function Vl(e,t,n){const r=Jt(e.type);return r&&r.validate?r.validate(e,t,n):null}function Kl(e,t,n,r){const o=Jt(e.type);return o&&o.update?(o.update(e,t,n,r),!0):!1}function _l(e,t){const n=document.getElementById(e);if(!n)return;const r=!n.classList.contains("hidden");if(document.querySelectorAll('[id^="tooltip-"]').forEach(u=>{u.classList.add("hidden")}),r)return;const o=t.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight;n&&n.parentElement!==document.body&&document.body.appendChild(n),n.style.visibility="hidden",n.style.position="fixed",n.classList.remove("hidden");const l=n.getBoundingClientRect();n.classList.add("hidden"),n.style.visibility="visible";let s=o.left,c=o.bottom+5;s+l.width>i&&(s=o.right-l.width),c+l.height>a&&(c=o.top-l.height-5),s<10&&(s=10),c<10&&(c=o.bottom+5),n.style.left=`${s}px`,n.style.top=`${c}px`,n.classList.remove("hidden"),setTimeout(()=>{n.classList.add("hidden")},25e3)}typeof document!="undefined"&&document.addEventListener("click",e=>{const t=e.target,n=t.closest("button")&&t.closest("button").onclick,r=t.closest('[id^="tooltip-"]');!n&&!r&&document.querySelectorAll('[id^="tooltip-"]').forEach(o=>{o.classList.add("hidden")})});function ur(e,t){var n,r,o;if(!e.enableIf)return!1;try{const i=(r=(n=t.formData)!=null?n:t.prefill)!=null?r:{},a=((o=e.enableIf.scope)!=null?o:"relative")==="relative"&&t.path?t.prefill:void 0;return!He(e.enableIf,i,a)}catch(i){console.error(`Error evaluating enableIf for field "${e.key}":`,i)}return!1}function Jl(e,t){const n=t.querySelector(`[name="${e}"]`);if(n){if(n instanceof HTMLSelectElement)return n.value;if(n instanceof HTMLInputElement){if(n.type==="checkbox")return n.checked;if(n.type==="radio"){const r=t.querySelector(`[name="${e}"]:checked`);return r?r.value:void 0}else return n.value}else if(n instanceof HTMLTextAreaElement)return n.value}}function Yl(e,t){const n=e.match(/[^.[\]]+|\[\d+\]/g);if(!n||n.length===0)return{};const r={};let o=r;for(let a=0;a<n.length-1;a++){const l=n[a],s=n[a+1],c=s.startsWith("[")&&s.endsWith("]")?[]:{};if(l.startsWith("[")&&l.endsWith("]")){const u=parseInt(l.slice(1,-1),10);o[u]=c}else o[l]=c;o=c}const i=n[n.length-1];return i.startsWith("[")&&i.endsWith("]")?o[parseInt(i.slice(1,-1),10)]=t:o[i]=t,r}function gt(e,t,n){var r;if(!t.enableIf)return;const o=n.state.formRoot;if(!o){console.error("Cannot re-evaluate enableIf: formRoot is null");return}const i=t.enableIf,a=(r=i.scope)!=null?r:"relative",l=!n.path||n.path===""?"absolute":a,s=i.key,c=l==="relative"&&n.path?`${n.path}.${s}`:s,u=Jl(c,o),d=Yl(s,u),f=l==="relative"?{}:d,p=l==="relative"?d:void 0;try{He(i,f,p)?(e.style.display="",e.classList.remove("fb-field-wrapper-disabled"),e.removeAttribute("data-conditionally-disabled")):(e.style.display="none",e.classList.add("fb-field-wrapper-disabled"),e.setAttribute("data-conditionally-disabled","true"))}catch(m){console.error(`Error re-evaluating enableIf for field "${t.key}":`,m)}}function fr(e,t,n){var r;if(!t.enableIf)return;const o=n.state.formRoot;if(!o){console.error("Cannot setup enableIf listeners: formRoot is null");return}const i=t.enableIf,a=(r=i.scope)!=null?r:"relative",l=i.key;let s;a==="relative"&&n.path?s=`${n.path}.${l}`:s=l;const c=o.querySelector(`[name="${s}"]`);if(!c){const u=new MutationObserver(()=>{const d=o.querySelector(`[name="${s}"]`);d&&(d.addEventListener("change",()=>{gt(e,t,n)}),d.addEventListener("input",()=>{gt(e,t,n)}),u.disconnect(),n.state.enableIfObservers.delete(u))});n.state.enableIfObservers.add(u),u.observe(o,{childList:!0,subtree:!0});return}c.addEventListener("change",()=>{gt(e,t,n)}),c.addEventListener("input",()=>{gt(e,t,n)})}function Xl(e){var t,n;const r=document.createElement("label");if(r.className="text-sm font-medium text-gray-900",r.textContent=(n=(t=e.label)!=null?t:e.key)!=null?n:"",e.required){const o=document.createElement("span");o.className="text-red-500 ml-1",o.textContent="*",r.appendChild(o)}return r}function Gl(e){const t=document.createElement("button");t.type="button",t.className="ml-2 text-gray-400 hover:text-gray-600",t.innerHTML='<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>';const n=`tooltip-${e.key}-${Math.random().toString(36).substr(2,9)}`,r=document.createElement("div");return r.id=n,r.className="hidden absolute z-50 bg-gray-200 text-gray-900 text-sm rounded-lg p-3 max-w-sm border border-gray-300 shadow-lg",r.style.position="fixed",r.textContent=e.description||e.hint||"Field information",document.body.appendChild(r),t.onclick=o=>{o.preventDefault(),o.stopPropagation(),_l(n,t)},t}function Zl(e){const t=document.createElement("div");t.className="flex items-center mb-1",t.dataset.fbLabelRow="";const n=Xl(e);if(t.appendChild(n),e.description||e.hint){const r=Gl(e);t.appendChild(r)}return t}function Ql(e,t,n,r){const o="multiple"in e&&e.multiple;switch(e.type){case"text":o?Sr(e,t,n,r):$r(e,t,n,r);break;case"textarea":o?Tr(e,t,n,r):Lr(e,t,n,r);break;case"number":o?Ir(e,t,n,r):Nr(e,t,n,r);break;case"select":o?Hr(e,t,n,r):Br(e,t,n,r);break;case"switcher":o?Pr(e,t,n,r):Ur(e,t,n,r);break;case"boolean":_r(e,t,n,r);break;case"file":o?Xo(e,t,n,r):Jo(e,t,n,r);break;case"files":Yo(e,t,n,r);break;case"colour":o?Zo(e,t,n,r):Go(e,t,n,r);break;case"slider":o?nl(e,t,n,r):tl(e,t,n,r);break;case"group":sl(e,t,n,r);break;case"container":o?Kn(e,t,n):Vn(e,t,n,r);break;case"table":xl(e,t,n,r);break;case"richinput":Al(e,t,n,r);break;default:{const i=document.createElement("div");i.className="text-red-500 text-sm",i.textContent=k("unsupportedFieldType",t.state,{type:e.type}),n.appendChild(i)}}}function Yt(e,t){if(e.type==="markdown"){if(e.hidden===!0){const s=document.createElement("div");return s.style.display="none",s.setAttribute("data-fb-hidden-markdown","true"),s}const a=ur(e,t),l=document.createElement("div");return l.className="mb-2 fb-field-wrapper fb-markdown-wrapper",l.setAttribute("data-field-key",wt(e,t.state)),Dl(e,t,l),a&&(l.style.display="none",l.classList.add("fb-field-wrapper-disabled"),l.setAttribute("data-conditionally-disabled","true")),fr(l,e,t),l}const n=ur(e,t),r=document.createElement("div");r.className="mb-2 fb-field-wrapper",r.setAttribute("data-field-key",e.key);const o=Jt(e.type);if(!(o!=null&&o.ownsLabel)){const a=Zl(e);r.appendChild(a)}const i=ke(t.path,e.key);return Ql(e,t,r,i),n&&(r.style.display="none",r.classList.add("fb-field-wrapper-disabled"),r.setAttribute("data-conditionally-disabled","true")),fr(r,e,t),r}ll(Yt);const Xt={uploadFile:null,downloadFile:null,getThumbnail:null,getDownloadUrl:null,actionHandler:null,onChange:null,onFieldChange:null,onThumbnailError:null,onUploadError:null,onDownloadError:null,debounceMs:300,verboseErrors:!1,enableFilePreview:!0,maxPreviewSize:"200px",readonly:!1,pickExistingFiles:null,parseTableFile:null,locale:"en",translations:{en:{removeElement:"Remove",clickDragText:"Click or drag file",clickDragTextMultiple:"Click or drag files",noFileSelected:"No file selected",noFilesSelected:"No files selected",downloadButton:"Download",downloadFile:"Download",openInNewTab:"Open in new tab",changeButton:"Change",placeholderText:"Enter text",previewAlt:"Preview",previewUnavailable:"Preview unavailable",previewError:"Preview error",videoNotSupported:"Your browser does not support the video tag.",hintLengthRange:"{min}-{max} chars",hintMaxLength:"\u2264{max} chars",hintMinLength:"\u2265{min} chars",hintValueRange:"{min}-{max}",hintMaxValue:"\u2264{max}",hintMinValue:"\u2265{min}",hintMaxSize:"\u2264{size}MB",hintFormats:"{formats}",hintRequired:"Required",hintOptional:"Optional",hintPattern:"Format: {pattern}",fileCountSingle:"{count} file",fileCountPlural:"{count} files",fileCountWithMax:"{count} / {max} files",fileCountRange:"({min}-{max})",uploadingFile:"Uploading\u2026",filesCounter:"{count}/{max}",fromLibrary:"From library",libraryEmpty:"Library is empty",libraryHint:"Choose from previously uploaded files",dropToUpload:"Release to upload",replaceFile:"Replace",clearAll:"Clear all",pickerError:"Failed to load files from library",required:"Required",minItems:"Minimum {min} items required",maxItems:"Maximum {max} items allowed",minLength:"Minimum {min} characters",maxLength:"Maximum {max} characters",minValue:"Must be at least {min}",maxValue:"Must be at most {max}",patternMismatch:"Invalid format",invalidPattern:"Invalid pattern in schema",notANumber:"Must be a number",invalidHexColour:"Invalid hex color",minFiles:"Minimum {min} files required",maxFiles:"Maximum {max} files allowed",invalidFileExtension:'File "{name}" has unsupported format. Allowed: {formats}',invalidFileMime:'File "{name}": file type {type} not allowed (allowed: {mimes})',fileTooLarge:'File "{name}" exceeds maximum size of {maxSize}MB',uploadFailed:'Failed to upload "{name}": {error}',filesLimitExceeded:"{skipped} file(s) skipped: maximum {max} files allowed",unsupportedFieldType:"Unsupported field type: {type}",invalidOption:"Invalid option",tableAddRow:"Add row",tableAddColumn:"Add column",tableRemoveRow:"Remove row",tableRemoveColumn:"Remove column",tableMergeCells:"Merge cells (Ctrl+M)",tableSplitCell:"Split cell (Ctrl+Shift+M)",tableImportFile:"Import",tableImporting:"Importing...",tableImportError:"Import failed: {error}",richinputPlaceholder:"Type text...",richinputAttachFile:"Attach file",richinputMention:"Mention",richinputRemoveFile:"Remove"},ru:{removeElement:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",clickDragText:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B",clickDragTextMultiple:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B",noFileSelected:"\u0424\u0430\u0439\u043B \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D",noFilesSelected:"\u041D\u0435\u0442 \u0444\u0430\u0439\u043B\u043E\u0432",downloadButton:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C",downloadFile:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C",openInNewTab:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435",changeButton:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",placeholderText:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442",previewAlt:"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440",previewUnavailable:"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D",previewError:"\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430",videoNotSupported:"\u0412\u0430\u0448 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0438\u0434\u0435\u043E.",hintLengthRange:"{min}-{max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",hintMaxLength:"\u2264{max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",hintMinLength:"\u2265{min} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",hintValueRange:"{min}-{max}",hintMaxValue:"\u2264{max}",hintMinValue:"\u2265{min}",hintMaxSize:"\u2264{size}\u041C\u0411",hintFormats:"{formats}",hintRequired:"\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",hintOptional:"\u041D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435",hintPattern:"\u0424\u043E\u0440\u043C\u0430\u0442: {pattern}",fileCountSingle:"{count} \u0444\u0430\u0439\u043B",fileCountPlural:"{count} \u0444\u0430\u0439\u043B\u043E\u0432",fileCountWithMax:"{count} / {max} \u0444\u0430\u0439\u043B\u043E\u0432",fileCountRange:"({min}-{max})",uploadingFile:"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",filesCounter:"{count}/{max}",fromLibrary:"\u0418\u0437 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438",libraryEmpty:"\u0411\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0430 \u043F\u0443\u0441\u0442\u0430",libraryHint:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0440\u0430\u043D\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445 \u0444\u0430\u0439\u043B\u043E\u0432",dropToUpload:"\u041E\u0442\u043F\u0443\u0441\u0442\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",replaceFile:"\u0417\u0430\u043C\u0435\u043D\u0438\u0442\u044C",clearAll:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0432\u0441\u0435",pickerError:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B\u044B \u0438\u0437 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438",required:"\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435",minItems:"\u041C\u0438\u043D\u0438\u043C\u0443\u043C {min} \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",maxItems:"\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",minLength:"\u041C\u0438\u043D\u0438\u043C\u0443\u043C {min} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",maxLength:"\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",minValue:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043D\u0435 \u043C\u0435\u043D\u0435\u0435 {min}",maxValue:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435 {max}",patternMismatch:"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442",invalidPattern:"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043F\u0430\u0442\u0442\u0435\u0440\u043D \u0432 \u0441\u0445\u0435\u043C\u0435",notANumber:"\u0414\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0447\u0438\u0441\u043B\u043E\u043C",invalidHexColour:"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u0446\u0432\u0435\u0442\u0430",minFiles:"\u041C\u0438\u043D\u0438\u043C\u0443\u043C {min} \u0444\u0430\u0439\u043B\u043E\u0432",maxFiles:"\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u0444\u0430\u0439\u043B\u043E\u0432",invalidFileExtension:'\u0424\u0430\u0439\u043B "{name}" \u0438\u043C\u0435\u0435\u0442 \u043D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442. \u0414\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0435: {formats}',invalidFileMime:'\u0424\u0430\u0439\u043B "{name}": \u0442\u0438\u043F \u0444\u0430\u0439\u043B\u0430 {type} \u043D\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043D (\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u044B: {mimes})',fileTooLarge:'\u0424\u0430\u0439\u043B "{name}" \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u0435\u0442 \u043C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 {maxSize}\u041C\u0411',uploadFailed:'\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C "{name}": {error}',filesLimitExceeded:"{skipped} \u0444\u0430\u0439\u043B(\u043E\u0432) \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043E: \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C {max} \u0444\u0430\u0439\u043B\u043E\u0432",unsupportedFieldType:"\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0442\u0438\u043F \u043F\u043E\u043B\u044F: {type}",invalidOption:"\u041D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435",tableAddRow:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443",tableAddColumn:"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446",tableRemoveRow:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0443",tableRemoveColumn:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0442\u043E\u043B\u0431\u0435\u0446",tableMergeCells:"\u041E\u0431\u044A\u0435\u0434\u0438\u043D\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0438 (Ctrl+M)",tableSplitCell:"\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u044C \u044F\u0447\u0435\u0439\u043A\u0443 (Ctrl+Shift+M)",tableImportFile:"\u0418\u043C\u043F\u043E\u0440\u0442",tableImporting:"\u0418\u043C\u043F\u043E\u0440\u0442...",tableImportError:"\u041E\u0448\u0438\u0431\u043A\u0430 \u0438\u043C\u043F\u043E\u0440\u0442\u0430: {error}",richinputPlaceholder:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442...",richinputAttachFile:"\u041F\u0440\u0438\u043A\u0440\u0435\u043F\u0438\u0442\u044C \u0444\u0430\u0439\u043B",richinputMention:"\u0423\u043F\u043E\u043C\u044F\u043D\u0443\u0442\u044C",richinputRemoveFile:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C"}},theme:{}};function ei(e){const t={...Xt.translations};if(e!=null&&e.translations)for(const[n,r]of Object.entries(e.translations))t[n]={...Xt.translations[n]||{},...r};return{schema:null,formRoot:null,resourceIndex:new Map,externalActions:null,version:"1.0.0",config:{...Xt,...e,translations:t},debounceTimer:null,prefill:{},syntheticElementIds:new WeakMap,syntheticElementIdCounter:0,enableIfObservers:new Set}}function ti(){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,9);return`inst-${e}-${t}`}const Ve={primaryColor:"#3b82f6",primaryHoverColor:"#2563eb",primarySoftColor:"#dbeafe",primarySoftHoverColor:"#bfdbfe",errorColor:"#ef4444",errorHoverColor:"#dc2626",successColor:"#10b981",accentColor:"#f59e0b",accentSoftColor:"#fef3c7",accentBorderColor:"#fde68a",accentTextColor:"#92400e",borderColor:"#d1d5db",borderHoverColor:"#9ca3af",borderFocusColor:"#3b82f6",borderStrongColor:"#9ca3af",backgroundColor:"#ffffff",backgroundHoverColor:"#f9fafb",backgroundReadonlyColor:"#f3f4f6",pageBackgroundColor:"#f9fafb",surfaceSoftColor:"#eff6ff",surfaceTintColor:"#f8fafc",textColor:"#1f2937",textSecondaryColor:"#6b7280",textMutedColor:"#9ca3af",textFaintColor:"#cbd5e1",textPlaceholderColor:"#9ca3af",textDisabledColor:"#d1d5db",buttonBgColor:"#3b82f6",buttonTextColor:"#ffffff",buttonBorderColor:"#2563eb",buttonHoverBgColor:"#2563eb",buttonHoverBorderColor:"#1d4ed8",actionBgColor:"#ffffff",actionTextColor:"#374151",actionBorderColor:"#e5e7eb",actionHoverBgColor:"#f9fafb",actionHoverBorderColor:"#d1d5db",fileUploadBgColor:"#f3f4f6",fileUploadBorderColor:"#d1d5db",fileUploadTextColor:"#9ca3af",fileUploadHoverBorderColor:"#3b82f6",inputPaddingX:"0.5rem",inputPaddingY:"0.25rem",borderRadius:"0.5rem",borderRadiusSmall:"0.375rem",borderRadiusLarge:"0.75rem",borderRadiusXLarge:"1rem",borderWidth:"1px",fontSize:"0.875rem",fontSizeSmall:"0.75rem",fontSizeExtraSmall:"0.625rem",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',fontWeightNormal:"400",fontWeightMedium:"500",lineHeight:"1.5",shadowCard:"0 1px 2px rgba(15,23,42,.04), 0 1px 0 rgba(15,23,42,.02)",shadowPopover:"0 12px 32px -12px rgba(15,23,42,.18), 0 4px 12px -6px rgba(15,23,42,.08)",focusRingWidth:"2px",focusRingColor:"#3b82f6",focusRingOpacity:"0.5",transitionDuration:"200ms",slideCardBg:"#ffffff",slideCardShadow:"0 1px 2px rgba(15,23,42,.04), 0 1px 0 rgba(15,23,42,.02)",slideCardRadius:"0.5rem",slideCardMinHeight:"0",slideCardPadding:"12px",labelSectionFontSize:"0.875rem",labelSectionLetterSpacing:"normal",labelSectionTextTransform:"none"};function ni(e){const t={...Ve,...e},n=[];return Object.entries(t).forEach(([r,o])=>{const i=r.replace(/([A-Z])/g,"-$1").toLowerCase();n.push(` --fb-${i}: ${o};`)}),n.join(`
|
|
1435
1435
|
`)}function ri(e,t){wr(e.ownerDocument||document);const n=ni(t);let r=e.querySelector("style[data-fb-theme]");r||(r=document.createElement("style"),r.setAttribute("data-fb-theme","true"),e.appendChild(r)),r.textContent=`
|
|
1436
1436
|
[data-fb-root="true"] {
|
|
1437
1437
|
${n}
|