react-luna-form 0.0.78 → 0.0.80

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.
@@ -1 +1 @@
1
- "use strict";var he=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Br=Object.prototype.hasOwnProperty;var Ur=(e,t)=>{for(var n in t)he(e,n,{get:t[n],enumerable:!0})},Hr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vr(t))!Br.call(e,o)&&o!==n&&he(e,o,{get:()=>t[o],enumerable:!(r=zr(t,o))||r.enumerable});return e};var Gr=e=>Hr(he({},"__esModule",{value:!0}),e);var Mo={};Ur(Mo,{Fallback:()=>_r,Form:()=>be});module.exports=Gr(Mo);var We=require("react/jsx-runtime");function Ze(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return(0,We.jsx)("div",{"data-slot":"field-control",className:"w-full",children:t})}var Re=require("react/jsx-runtime");function E(e){return(0,Re.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:(0,Re.jsx)("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}var Qe=require("react");var qe=require("react"),Je=(0,qe.createContext)(!1);var Ce=require("react/jsx-runtime");function B({children:e,visible:t}){return(0,Ce.jsx)(Qe.Activity,{mode:t?"visible":"hidden",children:(0,Ce.jsx)(Je,{value:!0,children:e})})}var J="input",je="input/date",et="input/email",tt="input/number";var nt="input/time";var rt="textarea",ot="radio",it="checkbox",Fe="list";var lt="select",at="select/active",st="select/day",ct="select/month",dt="select/timezone",ut="select/year";var ft="chips",mt="chips/day",gt="chips/month",U="column",pt="description",Ae="fields",xt="label",Ne="value",Q="options",Se="email",yt="number",bt="password",Tt="tel",H="text",ht="aria-errormessage",Rt="aria-invalid",Ct="data-invalid",Ft="data-readonly",At="aria",Nt="data",St="max",vt="maxLength",It="min",wt="minLength",L="$ref";var kt="type",Et={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};var g=require("date-fns"),I=require("date-fns/locale");function f(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function x(e){return d(e)||typeof e=="number"||$r(e)}function d(e){return typeof e=="string"}function $r(e){return typeof e=="boolean"}var Lt={en:I.enUS,"en-US":I.enUS,es:I.es,"es-ES":I.es,"es-MX":I.es},Yr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},Kr={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function Ot(e){if(e)return Lt[e]??Lt[e.split("-")[0]]}function j(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(d(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function Dt(e,t,n){let r=Kr[t];if(r===void 0)return String(e);let o=e*r,i=(0,g.intervalToDuration)({start:0,end:o});return(0,g.formatDuration)(i,{locale:n})}function Pt(e){if(e instanceof Date)return(0,g.isValid)(e)?e:null;if(d(e)){let t=(0,g.parseISO)(e);if((0,g.isValid)(t))return t;let n=new Date(e);return(0,g.isValid)(n)?n:null}if(typeof e=="number"){let t=new Date(e);return(0,g.isValid)(t)?t:null}return null}var Xr={currency:(e,t,n)=>{let r=j(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=j(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=j(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=Pt(e);if(!r)return String(e);let o=t[0]??"short",i=Ot(n.locale);if(o==="relative")return(0,g.formatDistanceToNow)(r,{addSuffix:!0,locale:i});let l=Yr[o]??o;return(0,g.format)(r,l,{locale:i})},duration:(e,t,n)=>{let r=Ot(n.locale);if(typeof e=="number")return Dt(e,t[0]??"ms",r);if(d(e)){let i=j(e);if(i!==null)return Dt(i,t[0]??"ms",r)}let o=Pt(e);return o?(0,g.formatDistanceToNow)(o,{addSuffix:!0,locale:r}):String(e)}};function Mt(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=Xr[o];if(l)return l(e,i,n)}function _t(e,t=Ne){if(e!=null){if(Array.isArray(e)&&e.every(x)||x(e))return e;if(f(e)){let n=Zr(e,t);if(x(n))return n}}}function Zr(e,t){let n=y(e,t);if(x(n))return n}function y(e,t){if(!t||!f(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(f(r)&&o in r)r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function zt(e,t={description:pt,label:xt,value:Ne}){return e.map(n=>{if(f(n)){let r=y(n,t.label),o=y(n,t.value);if(x(r)&&x(o)){let i=y(n,t.description);return{label:`${r}`,value:`${o}`,...x(i)&&{description:`${i}`}}}}return n})}function Vt(e=H){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==J?n.trim().toLowerCase():H}var Wr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g;function G(e,t={},n={}){if(d(e))return qr(e,t,n);if(Array.isArray(e))return e.map(r=>G(r,t,n));if(f(e)){let r={};for(let o in e)r[o]=G(e[o],t,n);return r}return e}function $(e,t={},n={}){return ve(e)?G(e,t,n):e}function ve(e){return d(e)?/{([^}]{1,200})}/.test(e):Array.isArray(e)?e.some(t=>ve(t)):f(e)?Object.values(e).some(t=>ve(t)):!1}function qr(e,t={},n={}){return e.replace(/{([^}]{1,200})}/g,(r,o)=>{let i=String(o).split("|").map(p=>p.trim()),[l,...a]=i;if(!l)return r;let s=l.includes(".")?y(t,l):t[l];if(a.length===0)return x(s)?String(s):r;if(s==null)return r;let u=s;for(let p of a){let q=Mt(u,p,{locale:n.locale});if(q===void 0)return r;u=q}return String(u)})}function Bt(e,t){if(!d(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=Wr.exec(e))!==null;){let[l,a,s]=n,u=n.index;o=!0,u>r&&i.push(e.substring(r,u));let p=t?t(u,s,a):l;i.push(p),r=u+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var Ut=e=>m(at)(e),Ht=e=>m(st)(e),Gt=e=>m(ct)(e),$t=e=>m(ut)(e),Yt=e=>m(dt)(e),Kt=e=>m(mt)(e),Xt=e=>m(gt)(e),Zt=m(je),Ie=m(nt),b=m(it),O=m(ft),w=m(ot),Wt=m(J),A=m(lt),qt=m(rt),Jt=m(H,Se,bt,Tt),ni=m(et,Se),Qt=m(tt,yt);function jt(e){return w(e)||b(e)}function ee(e){return e.type===Fe}function D(e){return e.type===U}function te(e){return e.type!==U&&e.type!==Fe}function we(e){return A(e)||w(e)||O(e)}function P(e){return e!=null&&e!==""}function m(...e){return t=>{let n=d(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function en(e,t={}){if(A(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&f(n))return[n]}}function tn(e){return w(e)||b(e)?!0:e.advanced?.horizontal??!1}function nn(e){return b(e)?e.advanced?.reverse!==!1:!1}function rn(e,t){let n=e.readonly??!1;return t||n}function ke(e){if(Jr(e)){let t=e.source;if(Array.isArray(t)||f(t)&&!(L in t))return t}}function on(e){return Array.isArray(ke(e))}function Jr(e){return w(e)||O(e)||A(e)&&!e.disabled}var R=require("date-fns"),Qr=/^\d+$/,sn=new Date(2e3,0,1),jr=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],Ee="default";function cn(e){if(!e)return Ee;try{return Intl.getCanonicalLocales(e)[0]??Ee}catch{return Ee}}function Le(e){let t=cn(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function Oe(e){let t=cn(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function dn(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function De(){return new Date().getFullYear()}function eo(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function to(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return Et[n]??"Other"}function no(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function ln(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=no(r,e);return{offset:i,longName:l}}function an(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function un(){let e=new Date,t=eo(),n=new Map,r=an(t),{offset:o,longName:i}=ln(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of jr()){if(s===t)continue;let u=an(s),{offset:p,longName:q}=ln(s,e),Ke={value:s,label:`${u} - ${q} (${p})`},Te=to(s);if(Te==="Other")continue;let Xe=n.get(Te);Xe?Xe.push(Ke):n.set(Te,[Ke])}for(let s of n.values())s.sort((u,p)=>u.label.localeCompare(p.label));let a=Array.from(n.entries()).sort(([s],[u])=>s.localeCompare(u)).map(([s,u])=>({label:s,items:u}));return[{label:"Suggested",items:[l]},...a]}function Pe(e,t){if(typeof e=="number")return e;let n=t??De(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return Qr.test(r)?parseInt(r,10):n}function fn(e,t){if(!e)return"";try{let n=(0,R.parse)(e,t,sn);return(0,R.isValid)(n)?(0,R.format)(n,"yyyy-MM-dd"):""}catch{return""}}function mn(e,t){if(!e)return"";try{let n=(0,R.parse)(e,t,sn);return(0,R.isValid)(n)?(0,R.format)(n,"HH:mm:ss"):""}catch{return""}}function Me(e){return e.advanced?.format??"HH:mm"}function gn(e){return e.advanced?.format??"MMMM d, yyyy"}var ro={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function ne(e,t){return T(e,t)}function xn(e,t){let n=t?.[e??""],r=e?ro[oo(e)]:void 0;return r?n?{...r,...n}:r:n}function oo(e){return e.toLowerCase().split(/[-_]/)[0]}function T(e,t){return e?t?t[e]??e:e:""}function M(e,t){return e?T(e,t):void 0}function re(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=io(o,t);return i!==o&&(n=!0),i});return n?r:e}function io(e,t){if(!f(e))return e;let n=pn(e.label,t),r=e.items;if(Array.isArray(r)){let i=re(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=pn(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function pn(e,t){return d(e)?T(e,t):e}var oe=De();function lo(e,t){if(O(e))return ao(e,t?.lang)}function ao(e,t){if(Kt(e))return Oe(t);if(Xt(e))return Le(t)}function so(e,t){if(A(e))return co(e,t)}function co(e,t){let{lang:n,translations:r}=t??{};if(Ht(e))return Oe(n);if(Gt(e))return Le(n);if($t(e)){let o=e.advanced?.length?.min??oe,i=e.advanced?.length?.max??oe+5;return dn(Pe(o,oe),Pe(i,oe))}if(Yt(e))return un();if(Ut(e))return re([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function yn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return Wt(e)?{...r,...uo(e)}:A(e)?{...r,...bn(so(e,n))}:qt(e)?{...r,...mo(e)}:O(e)?{...r,...fo(e,n)}:r}function uo(e){let t=Vt(e.type),n={...e,type:t};return{...po(e),...Tn(e),...go(n),...Jt(n)?hn(n):{},type:t}}function bn(e){return e?{options:e}:{}}function fo(e,t){let n=bn(lo(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function mo(e){return{...Tn(e),...hn(e)}}function Tn(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function go(e){return Qt(e)?xo(e):{}}function po(e){if(Ie(e)){let t=Me(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function hn(e){return Rn(e,{min:wt,max:vt})}function xo(e){return Rn(e,{min:It,max:St})}function Rn(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function Cn(e,t){let n=ke(e);return n||en(e,t)}function yo(e,t){let n=f(t)&&e.name in t?t[e.name]:t,r=_t(n,e.advanced?.entity),o=P(r)?r:e.defaultValue;return Ie(e)&&P(o)?bo(e,o):Zt(e)&&P(o)?Co(e,o):o}function bo(e,t){let n=Me(e);return d(t)?mn(t,n):t}function To(e,t,n){return we(e)&&Array.isArray(n)?{...t,[Q]:n}:t}function ho(e,t,n){if(e.required&&!P(n)&&A(e)&&e.advanced?.preselected!==!1&&Q in t){let r=t[Q];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function Ro(e,t,n){if(we(e)&&Array.isArray(t)){let r=zt(t,e.advanced?.options);return on(e)?re(r,n):r}return t}function Fn(e,t,n,r,o){let i=yo(e,r),l=Array.isArray(n)?Ro(e,n,o):n,a=To(e,t,l),s=ho(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function An(e,t){return b(e)?{defaultChecked:P(t)}:{defaultValue:t}}function Co(e,t){let n=gn(e);return d(t)?fn(t,n):t}var Fo=/^#\/definition\//;function le(e=[],t){let n=ie(e,t);return Array.isArray(n)?n.filter(No).sort((r,o)=>Nn(r)-Nn(o)):[]}function ie(e,t,n=new Map,r=new WeakSet){if(!Ao(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>ie(i,t,n,r));if(L in e&&d(e[L])){let i=e[L].replace(Fo,""),l=y(t,i);return l!==null?ie(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=ie(l,t,n,r);return r.delete(e),n.set(e,o),o}function Sn(e){return Object.entries(e??{})}function Nn(e){return e.order??Number.MAX_VALUE}function Ao(e){return e!==void 0&&f(e)&&Object.keys(e).length>0}function No(e){return kt in e?!0:Array.isArray(e[Ae])?e[Ae].length>0:!0}function vn(e,t){let n={};for(let[r,o]of Sn(t))n[`${e}-${r}`]=o;return n}function So(e){return vn(At,e)}function vo(e){return vn(Nt,e)}function In(e,t){let n=So(e.advanced?.aria);return t&&t.length>0&&(n[Rt]="true",n[ht]=`${e.name}-error`),n}function wn(e){return vo(e.advanced?.data)}var kn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},En={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function Ln(e,t=2){return kn[e&&e in kn?e:t]}function On(e){if(e&&e in En)return En[e]}function Io(e,t){let n=e.advanced?.length?.min??1;if(t){let r=y(t,e.name);if(Array.isArray(r))return Math.max(r.length,n)}return Math.max(n,0)}function Dn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===U}function Pn(e,t){let n=Io(e,t);return Array.from({length:n},(r,o)=>o)}function Mn(e){return e.advanced?.title??e.label??e.name}function ae(e,t){return{...e,...t}}var _n=require("react/jsx-runtime");function C(e){return Bt(e,(t,n,r)=>(0,_n.jsx)("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}var se=require("react"),h=require("react/jsx-runtime");function zn(e){let{fields:t=[]}=e.section,[n,r]=(0,se.useState)(!1),o=(0,se.useCallback)(()=>r(i=>!i),[]);return(0,h.jsxs)("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[(0,h.jsx)("legend",{children:(0,h.jsxs)("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:o,type:"button",children:[(0,h.jsx)(E,{expanded:n}),(0,h.jsx)("span",{children:C(e.title)})]})}),(0,h.jsx)(B,{visible:n,children:(0,h.jsxs)("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&(0,h.jsx)("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:C(e.description)}),e.group]})})]})}var N=require("react/jsx-runtime");function Vn(e){let t=(0,N.jsxs)("div",{className:"flex flex-col",children:[e.title&&(0,N.jsx)("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:C(e.title)}),e.description&&(0,N.jsx)("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:C(e.description)})]});return e.step?(0,N.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,N.jsx)("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,N.jsx)("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}var Y=require("react/jsx-runtime");function ce(e){return(0,Y.jsxs)("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[(0,Y.jsx)(Vn,{description:e.description,step:e.step,title:e.title}),(0,Y.jsx)("div",{className:"w-full min-w-0",children:e.children})]})}var Bn=require("react/jsx-runtime");function S(e){return(0,Bn.jsx)("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}var de=require("react/jsx-runtime");function Un(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=ae(e.style,{compact:e.section.advanced?.compact}),o=(0,de.jsx)(S,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=M(e.section.title,e.translations),l=M(e.section.description,e.translations);return e.section.advanced?.collapsible?(0,de.jsx)(zn,{description:l,group:o,section:e.section,title:i}):(0,de.jsx)(ce,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}var _e=require("react/jsx-runtime");function Hn(){return(0,_e.jsx)("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:(0,_e.jsx)("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}var Xn=require("jotai");var _=require("jotai"),Gn=require("jotai-family"),ze=require("fast-equals");function wo(e,t){let{[t]:n,...r}=e;return r}function ko(e){return(0,Gn.atomFamily)(t=>(0,_.atom)(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];(0,ze.deepEqual)(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,wo(i,t))}))}function Eo(e){return(0,_.atom)(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function Lo(e){return(0,_.atom)(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function Oo(e){return(0,_.atom)(null,(t,n,r)=>{let o=t(e);(0,ze.deepEqual)(o,r)||n(e,r)})}function ue(e={}){let t=(0,_.atom)(e);return{atom:t,clearAll:Eo(t),clear:Lo(t),bulkReport:Oo(t),report:ko(t)}}var $n=ue(),Yn=$n.atom,Kn=$n.report;function Do(e,t){return e.fields.every(n=>Zn(n,t))}function Zn(e,t){return t[e.name]?.hidden??e.hidden??!1}function Po(e,t){return D(e)?Do(e,t):Zn(e,t)}function Wn(e){let t=(0,Xn.useAtomValue)(Yn);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>Po(r,t))?null:e.children}var F=require("react/jsx-runtime");function qn(e){let t=le(e.sections,e.definition);return(0,F.jsx)("div",{className:"h-full w-full",children:(0,F.jsx)("form",{noValidate:e.noValidate,action:e.action,children:(0,F.jsxs)(S,{children:[t.map((n,r)=>(0,F.jsxs)(Wn,{fields:n.fields??[],children:[(0,F.jsx)(Un,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&(0,F.jsx)(Hn,{})]},`key-${n.id}-${r}`)),e.control&&(0,F.jsx)(Ze,{isPending:e.isPending,children:e.control})]})})})}var Qn=require("react/jsx-runtime");function Jn(e){return(0,Qn.jsx)("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}var jn=require("react"),z=require("react/jsx-runtime");function fe(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=(0,jn.useState)(()=>f(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(p=>!p),a=f(e.text)&&d(e.text.title)?C(T($(e.text.title,t,r),e.translations)):void 0,s=T($(d(e.text)?e.text:e.text?.message,t,r),e.translations),u=C(s);return u?(0,z.jsxs)("div",{className:"flex flex-col gap-2",children:[a&&(0,z.jsxs)("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:l,type:"button",children:[a,(0,z.jsx)(E,{expanded:o})]}),o&&(0,z.jsx)(Jn,{title:s,children:u})]}):null}var Ve=require("jotai");var me=ue(),xl=me.atom,yl=me.clearAll,bl=me.clear,er=me.report,Tl=(0,Ve.atom)({}),hl=(0,Ve.atom)(null);var Be=require("jotai"),tr=require("react/jsx-runtime");function ge(e){let t=(0,Be.useAtomValue)(er(e.field.name)),r=(0,Be.useAtomValue)(Kn(e.field.name))?.description??e.field.description;return(0,tr.jsx)(fe,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}var nr=require("tailwind-merge"),K=require("react/jsx-runtime");function rr(e){let t=e.style?.showOptionalLabel??!0,n=w(e.field)||b(e.field);return(0,K.jsxs)("label",{"data-slot":"field-label","data-normal":n,className:(0,nr.twMerge)("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:d(e.children)?e.children:void 0,children:[(0,K.jsx)("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&(0,K.jsx)("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:ne("(Optional)",e.translations)})]})}var X=require("react/jsx-runtime");function or(e){let t={context:e.context,env:e.config?.env},n=$(e.field.label,t);return(0,X.jsxs)("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[(0,X.jsx)(rr,{field:e.field,style:e.config?.style,translations:e.translations,children:T(n,e.translations)}),e.horizontal===!0&&(0,X.jsx)(ge,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}var k=require("react/jsx-runtime");function ir(e){return(0,k.jsxs)(k.Fragment,{children:[e.field.name&&e.field.label&&(0,k.jsx)(or,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&(0,k.jsx)(ge,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function lr(e,t){return e?t(e):null}var Ue=require("react/jsx-runtime");function ar(e){let t=Cn(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=Fn(e.field,e.commonProps,t,e.value,e.translations),o=An(e.field,r);return lr(e.config.inputs[e.field.type],i=>(0,Ue.jsx)(ir,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:(0,Ue.jsx)(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}var He=require("react/jsx-runtime");function sr(e){return!e.errors||e.errors.length===0?null:(0,He.jsx)("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors?.map((t,n)=>(0,He.jsx)("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}var cr=require("tailwind-merge"),dr=require("react/jsx-runtime");function pe(e){let t=e.errors&&e.errors.length>0;return(0,dr.jsx)("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[Ct]:"true"},...e.disabled&&{[Ft]:"true"},"data-orientation":e.orientation,className:(0,cr.twMerge)("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}var ur=require("tailwind-merge"),mr=require("react/jsx-runtime");function fr(e){return(0,mr.jsx)(pe,{...e,orientation:"vertical",className:(0,ur.twMerge)("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}var gr=require("tailwind-merge"),xr=require("react/jsx-runtime");function pr(e){return(0,xr.jsx)(pe,{...e,orientation:"horizontal",className:(0,gr.twMerge)("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}var Ge=require("react/jsx-runtime");function yr(e){let t=jt(e.field),n=b(e.field),r=nn(e.field);return e.horizontal?(0,Ge.jsx)(pr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):(0,Ge.jsx)(fr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function br(e){if(!e.field.type)return null;let t=yn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=wn(e.field),r=In(e.field,e.errors),o={...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal})}var Tr=require("tailwind-merge"),V=require("react/jsx-runtime");function hr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r}=ae(e.style,{horizontal:tn(e.field)}),o=rn(e.field,e.disabled);return(0,V.jsxs)("div",{className:(0,Tr.twMerge)("flex flex-col gap-3",On(t)),children:[(0,V.jsx)(yr,{disabled:o,errors:n,field:e.field,horizontal:r,children:(0,V.jsx)(br,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,translations:e.translations,children:e.children})}),(0,V.jsx)(sr,{errors:n,name:e.field.name})]})}var xe=require("tailwind-merge"),Rr=require("react"),c=require("react/jsx-runtime");function Cr(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=(0,Rr.useState)(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(p=>!p)}let l=p=>G(ne(p,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&(0,c.jsx)("button",{"aria-label":l("Remove {label} item {index}"),className:(0,xe.twMerge)("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:o,type:"button",children:(0,c.jsx)("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=(0,c.jsxs)("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[(0,c.jsx)("span",{className:"text-base",children:e.previewLabel??(0,c.jsxs)(c.Fragment,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&(0,c.jsx)("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),u=(0,c.jsxs)("div",{className:(0,xe.twMerge)("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?(0,c.jsxs)("div",{className:"flex min-w-0 grow items-center gap-2",children:[(0,c.jsxs)("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:(0,xe.twMerge)("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:i,type:"button",children:[(0,c.jsx)(E,{expanded:n}),s]}),!n&&e.previewBadge&&(0,c.jsx)("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?(0,c.jsxs)("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[u,(0,c.jsx)(B,{visible:n,children:(0,c.jsx)(S,{children:e.children})})]}):t?(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[u,(0,c.jsx)(B,{visible:n,children:(0,c.jsx)(S,{children:e.children})})]}):(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[(0,c.jsx)("div",{className:"flex min-w-0 grow flex-col",children:(0,c.jsx)(S,{children:e.children})}),a&&(0,c.jsx)("div",{className:"shrink-0",children:a})]})}var Ar=require("react/jsx-runtime");function Fr(e){let t=T(Mn(e.field),e.translations),n=Dn(e.field);return Pn(e.field,e.value).map(r=>(0,Ar.jsx)(Cr,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}var Sr=require("react/jsx-runtime");function Nr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=M(e.field.label,e.translations),r=M(e.field.description,e.translations);return(0,Sr.jsx)(ce,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}var $e=require("react/jsx-runtime");function vr({children:e,field:t,lang:n,translations:r,value:o}){return(0,$e.jsx)(Nr,{field:t,translations:r,children:(0,$e.jsx)(Fr,{field:t,lang:n,translations:r,value:o,children:e})})}var Ir=require("tailwind-merge");var Z=require("react/jsx-runtime");function wr(e){let t=Ln(e.column?.advanced?.cols);return(0,Z.jsxs)("div",{className:"flex w-full flex-col gap-4",children:[(0,Z.jsx)("div",{"data-slot":"column",className:(0,Ir.twMerge)("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&(0,Z.jsx)(fe,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}var Lr=require("react");var Er=require("react/jsx-runtime");function kr(e){let t=Array.isArray(e.field.fields)?e.field.fields.map(n=>te(n)||ee(n)?{...n,name:`${e.field.name}.${e.index}.${n.name}`}:D(n)?{...n,fields:n.fields.map(r=>({...r,name:`${e.field.name}.${e.index}.${r.name}`}))}:n):[];return(0,Er.jsx)(W,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:t,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}var v=require("react/jsx-runtime");function W(e){let{field:t,list:n}=e.components;return le(e.fields).map((r,o)=>(0,v.jsxs)(Lr.Fragment,{children:[D(r)&&(0,v.jsx)(wr,{column:r,config:e.config,context:e.context,translations:e.translations,children:(0,v.jsx)(W,{...e,fields:r.fields})}),te(r)&&(0,v.jsx)(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),ee(r)&&(0,v.jsx)(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>(0,v.jsx)(kr,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}var Dr=require("react/jsx-runtime");function Or(e){return n=>(0,Dr.jsx)(W,{...n,components:e})}var Pr=Or({field:hr,list:vr});var ye=require("react/jsx-runtime");function be(e){let t=xn(e.lang,e.translations);return(0,ye.jsx)(qn,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>(0,ye.jsx)(Pr,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>(0,ye.jsx)(ar,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}var Mr=require("react");var Ye=require("react/jsx-runtime");function _r(e){return(0,Ye.jsx)(Mr.Suspense,{fallback:(0,Ye.jsx)(be,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}
1
+ "use strict";var Te=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Br=Object.prototype.hasOwnProperty;var Hr=(e,t)=>{for(var n in t)Te(e,n,{get:t[n],enumerable:!0})},Gr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vr(t))!Br.call(e,o)&&o!==n&&Te(e,o,{get:()=>t[o],enumerable:!(r=zr(t,o))||r.enumerable});return e};var Ur=e=>Gr(Te({},"__esModule",{value:!0}),e);var Vo={};Hr(Vo,{Fallback:()=>_r,Form:()=>be});module.exports=Ur(Vo);var Ze=require("react/jsx-runtime");function We(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return(0,Ze.jsx)("div",{"data-slot":"field-control",className:"w-full",children:t})}var he=require("react/jsx-runtime");function k(e){return(0,he.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:(0,he.jsx)("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}var Qe=require("react");var qe=require("react"),Je=(0,qe.createContext)(!1);var Ae=require("react/jsx-runtime");function B({children:e,visible:t}){return(0,Ae.jsx)(Qe.Activity,{mode:t?"visible":"hidden",children:(0,Ae.jsx)(Je,{value:!0,children:e})})}var J="input",je="input/date",et="input/email",tt="input/number";var nt="input/time";var rt="textarea",ot="radio",it="checkbox",Ce="list";var lt="select",at="select/active",st="select/day",ct="select/month",dt="select/timezone",ut="select/year";var ft="chips",mt="chips/day",gt="chips/month",H="column",pt="description",Fe="fields",xt="label",Se="value",Q="options",Ne="email",yt="number",bt="password",Rt="tel",G="text",Tt="aria-errormessage",ht="aria-invalid",At="data-invalid",Ct="data-readonly",Ft="aria",St="data",Nt="max",vt="maxLength",It="min",wt="minLength",L="$ref";var Et="type",kt={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};var g=require("date-fns"),I=require("date-fns/locale");function f(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function x(e){return d(e)||typeof e=="number"||$r(e)}function d(e){return typeof e=="string"}function $r(e){return typeof e=="boolean"}var Lt={en:I.enUS,"en-US":I.enUS,es:I.es,"es-ES":I.es,"es-MX":I.es},Yr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},Xr={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function Ot(e){if(e)return Lt[e]??Lt[e.split("-")[0]]}function j(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(d(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function Dt(e,t,n){let r=Xr[t];if(r===void 0)return String(e);let o=e*r,i=(0,g.intervalToDuration)({start:0,end:o});return(0,g.formatDuration)(i,{locale:n})}function Pt(e){if(e instanceof Date)return(0,g.isValid)(e)?e:null;if(d(e)){let t=(0,g.parseISO)(e);if((0,g.isValid)(t))return t;let n=new Date(e);return(0,g.isValid)(n)?n:null}if(typeof e=="number"){let t=new Date(e);return(0,g.isValid)(t)?t:null}return null}var Kr={currency:(e,t,n)=>{let r=j(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=j(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=j(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=Pt(e);if(!r)return String(e);let o=t[0]??"short",i=Ot(n.locale);if(o==="relative")return(0,g.formatDistanceToNow)(r,{addSuffix:!0,locale:i});let l=Yr[o]??o;return(0,g.format)(r,l,{locale:i})},duration:(e,t,n)=>{let r=Ot(n.locale);if(typeof e=="number")return Dt(e,t[0]??"ms",r);if(d(e)){let i=j(e);if(i!==null)return Dt(i,t[0]??"ms",r)}let o=Pt(e);return o?(0,g.formatDistanceToNow)(o,{addSuffix:!0,locale:r}):String(e)}};function Mt(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=Kr[o];if(l)return l(e,i,n)}function _t(e,t=Se){if(e!=null){if(Array.isArray(e)&&e.every(x)||x(e))return e;if(f(e)){let n=Wr(e,t);if(x(n))return n}}}function Wr(e,t){let n=y(e,t);if(x(n))return n}function y(e,t){if(!t||!f(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(f(r)&&o in r)r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function zt(e,t={description:pt,label:xt,value:Se}){return e.map(n=>{if(f(n)){let r=y(n,t.label),o=y(n,t.value);if(x(r)&&x(o)){let i=y(n,t.description);return{label:`${r}`,value:`${o}`,...x(i)&&{description:`${i}`}}}}return n})}function Vt(e=G){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==J?n.trim().toLowerCase():G}var Zr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g,qr=/{([^}]{1,200})}/,Jr=/{([^}]{1,200})}/g;function U(e,t={},n={}){if(d(e))return jr(e,t,n);if(Array.isArray(e))return e.map(r=>U(r,t,n));if(f(e)){let r={};for(let o in e)r[o]=U(e[o],t,n);return r}return e}function $(e,t={},n={}){return ve(e)?U(e,t,n):e}function ve(e){return d(e)?qr.test(e):Array.isArray(e)?e.some(t=>ve(t)):f(e)?Object.values(e).some(t=>ve(t)):!1}function Qr(e,t){return t.includes(".")?y(e,t):e[t]}function jr(e,t={},n={}){return e.replace(Jr,(r,o)=>{let i=String(o).split("|").map(p=>p.trim()),[l,...a]=i;if(!l)return r;let s=Qr(t,l);if(a.length===0)return x(s)?String(s):r;if(s==null)return r;let u=s;for(let p of a){let q=Mt(u,p,{locale:n.locale});if(q===void 0)return r;u=q}return String(u)})}function Bt(e,t){if(!d(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=Zr.exec(e))!==null;){let[l,a,s]=n,u=n.index;o=!0,u>r&&i.push(e.substring(r,u));let p=t?t(u,s,a):l;i.push(p),r=u+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var Ht=e=>m(at)(e),Gt=e=>m(st)(e),Ut=e=>m(ct)(e),$t=e=>m(ut)(e),Yt=e=>m(dt)(e),Xt=e=>m(mt)(e),Kt=e=>m(gt)(e),Wt=m(je),Ie=m(nt),b=m(it),O=m(ft),w=m(ot),Zt=m(J),F=m(lt),qt=m(rt),Jt=m(G,Ne,bt,Rt),ii=m(et,Ne),Qt=m(tt,yt);function jt(e){return w(e)||b(e)}function ee(e){return e.type===Ce}function D(e){return e.type===H}function te(e){return e.type!==H&&e.type!==Ce}function we(e){return F(e)||w(e)||O(e)}function P(e){return e!=null&&e!==""}function m(...e){return t=>{let n=d(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function en(e,t={}){if(F(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&f(n))return[n]}}function tn(e){return w(e)||b(e)?!0:e.advanced?.horizontal??!1}function nn(e){return b(e)?e.advanced?.reverse!==!1:!1}function rn(e,t){let n=e.readonly??!1;return t||n}function Ee(e){if(eo(e)){let t=e.source;if(Array.isArray(t)||f(t)&&!(L in t))return t}}function on(e){return Array.isArray(Ee(e))}function eo(e){return w(e)||O(e)||F(e)&&!e.disabled}var h=require("date-fns"),to=/^\d+$/,sn=new Date(2e3,0,1),no=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],ke="default";function cn(e){if(!e)return ke;try{return Intl.getCanonicalLocales(e)[0]??ke}catch{return ke}}function Le(e){let t=cn(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function Oe(e){let t=cn(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function dn(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function De(){return new Date().getFullYear()}function ro(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function oo(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return kt[n]??"Other"}function io(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function ln(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=io(r,e);return{offset:i,longName:l}}function an(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function un(){let e=new Date,t=ro(),n=new Map,r=an(t),{offset:o,longName:i}=ln(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of no()){if(s===t)continue;let u=an(s),{offset:p,longName:q}=ln(s,e),Xe={value:s,label:`${u} - ${q} (${p})`},Re=oo(s);if(Re==="Other")continue;let Ke=n.get(Re);Ke?Ke.push(Xe):n.set(Re,[Xe])}for(let s of n.values())s.sort((u,p)=>u.label.localeCompare(p.label));let a=Array.from(n.entries()).sort(([s],[u])=>s.localeCompare(u)).map(([s,u])=>({label:s,items:u}));return[{label:"Suggested",items:[l]},...a]}function Pe(e,t){if(typeof e=="number")return e;let n=t??De(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return to.test(r)?parseInt(r,10):n}function fn(e,t){if(!e)return"";try{let n=(0,h.parse)(e,t,sn);return(0,h.isValid)(n)?(0,h.format)(n,"yyyy-MM-dd"):""}catch{return""}}function mn(e,t){if(!e)return"";try{let n=(0,h.parse)(e,t,sn);return(0,h.isValid)(n)?(0,h.format)(n,"HH:mm:ss"):""}catch{return""}}function Me(e){return e.advanced?.format??"HH:mm"}function gn(e){return e.advanced?.format??"MMMM d, yyyy"}var lo={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function ne(e,t){return R(e,t)}function xn(e,t){let n=t?.[e??""],r=e?lo[ao(e)]:void 0;return r?n?{...r,...n}:r:n}function ao(e){return e.toLowerCase().split(/[-_]/)[0]}function R(e,t){return e?t?t[e]??e:e:""}function M(e,t){return e?R(e,t):void 0}function re(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=so(o,t);return i!==o&&(n=!0),i});return n?r:e}function so(e,t){if(!f(e))return e;let n=pn(e.label,t),r=e.items;if(Array.isArray(r)){let i=re(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=pn(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function pn(e,t){return d(e)?R(e,t):e}var oe=De();function co(e,t){if(O(e))return uo(e,t?.lang)}function uo(e,t){if(Xt(e))return Oe(t);if(Kt(e))return Le(t)}function fo(e,t){if(F(e))return mo(e,t)}function mo(e,t){let{lang:n,translations:r}=t??{};if(Gt(e))return Oe(n);if(Ut(e))return Le(n);if($t(e)){let o=e.advanced?.length?.min??oe,i=e.advanced?.length?.max??oe+5;return dn(Pe(o,oe),Pe(i,oe))}if(Yt(e))return un();if(Ht(e))return re([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function yn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return Zt(e)?{...r,...go(e)}:F(e)?{...r,...bn(fo(e,n))}:qt(e)?{...r,...xo(e)}:O(e)?{...r,...po(e,n)}:r}function go(e){let t=Vt(e.type),n={...e,type:t};return{...bo(e),...Rn(e),...yo(n),...Jt(n)?Tn(n):{},type:t}}function bn(e){return e?{options:e}:{}}function po(e,t){let n=bn(co(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function xo(e){return{...Rn(e),...Tn(e)}}function Rn(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function yo(e){return Qt(e)?Ro(e):{}}function bo(e){if(Ie(e)){let t=Me(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function Tn(e){return hn(e,{min:wt,max:vt})}function Ro(e){return hn(e,{min:It,max:Nt})}function hn(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function An(e,t){let n=Ee(e);return n||en(e,t)}function To(e,t){let n=f(t)&&e.name in t?t[e.name]:t,r=_t(n,e.advanced?.entity),o=P(r)?r:e.defaultValue;return Ie(e)&&P(o)?ho(e,o):Wt(e)&&P(o)?So(e,o):o}function ho(e,t){let n=Me(e);return d(t)?mn(t,n):t}function Ao(e,t,n){return we(e)&&Array.isArray(n)?{...t,[Q]:n}:t}function Co(e,t,n){if(e.required&&!P(n)&&F(e)&&e.advanced?.preselected!==!1&&Q in t){let r=t[Q];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function Fo(e,t,n){if(we(e)&&Array.isArray(t)){let r=zt(t,e.advanced?.options);return on(e)?re(r,n):r}return t}function Cn(e,t,n,r,o){let i=To(e,r),l=Array.isArray(n)?Fo(e,n,o):n,a=Ao(e,t,l),s=Co(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function Fn(e,t){return b(e)?{defaultChecked:P(t)}:{defaultValue:t}}function So(e,t){let n=gn(e);return d(t)?fn(t,n):t}var No=/^#\/definition\//;function le(e=[],t){let n=ie(e,t);return Array.isArray(n)?n.filter(Io).sort((r,o)=>Sn(r)-Sn(o)):[]}function ie(e,t,n=new Map,r=new WeakSet){if(!vo(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>ie(i,t,n,r));if(L in e&&d(e[L])){let i=e[L].replace(No,""),l=y(t,i);return l!==null?ie(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=ie(l,t,n,r);return r.delete(e),n.set(e,o),o}function Nn(e){return Object.entries(e??{})}function Sn(e){return e.order??Number.MAX_VALUE}function vo(e){return e!==void 0&&f(e)&&Object.keys(e).length>0}function Io(e){return Et in e?!0:Array.isArray(e[Fe])?e[Fe].length>0:!0}function vn(e,t){let n={};for(let[r,o]of Nn(t))n[`${e}-${r}`]=o;return n}function wo(e){return vn(Ft,e)}function Eo(e){return vn(St,e)}function In(e,t){let n=wo(e.advanced?.aria);return t&&t.length>0&&(n[ht]="true",n[Tt]=`${e.name}-error`),n}function wn(e){return Eo(e.advanced?.data)}var En={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},kn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function Ln(e,t=2){return En[e&&e in En?e:t]}function On(e){if(e&&e in kn)return kn[e]}function ko(e,t){let n=e.advanced?.length?.min??1;if(t){let r=y(t,e.name);if(Array.isArray(r))return Math.max(r.length,n)}return Math.max(n,0)}function Dn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===H}function Pn(e,t){let n=ko(e,t);return Array.from({length:n},(r,o)=>o)}function Mn(e){return e.advanced?.title??e.label??e.name}function ae(e,t){return{...e,...t}}var _n=require("react/jsx-runtime");function A(e){return Bt(e,(t,n,r)=>(0,_n.jsx)("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}var se=require("react"),T=require("react/jsx-runtime");function zn(e){let{fields:t=[]}=e.section,[n,r]=(0,se.useState)(!1),o=(0,se.useCallback)(()=>r(i=>!i),[]);return(0,T.jsxs)("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[(0,T.jsx)("legend",{children:(0,T.jsxs)("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:o,type:"button",children:[(0,T.jsx)(k,{expanded:n}),(0,T.jsx)("span",{children:A(e.title)})]})}),(0,T.jsx)(B,{visible:n,children:(0,T.jsxs)("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&(0,T.jsx)("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:A(e.description)}),e.group]})})]})}var S=require("react/jsx-runtime");function Vn(e){let t=(0,S.jsxs)("div",{className:"flex flex-col",children:[e.title&&(0,S.jsx)("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:A(e.title)}),e.description&&(0,S.jsx)("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:A(e.description)})]});return e.step?(0,S.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,S.jsx)("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:(0,S.jsx)("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}var Y=require("react/jsx-runtime");function ce(e){return(0,Y.jsxs)("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[(0,Y.jsx)(Vn,{description:e.description,step:e.step,title:e.title}),(0,Y.jsx)("div",{className:"w-full min-w-0",children:e.children})]})}var Bn=require("react/jsx-runtime");function N(e){return(0,Bn.jsx)("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}var de=require("react/jsx-runtime");function Hn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=ae(e.style,{compact:e.section.advanced?.compact}),o=(0,de.jsx)(N,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=M(e.section.title,e.translations),l=M(e.section.description,e.translations);return e.section.advanced?.collapsible?(0,de.jsx)(zn,{description:l,group:o,section:e.section,title:i}):(0,de.jsx)(ce,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}var _e=require("react/jsx-runtime");function Gn(){return(0,_e.jsx)("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:(0,_e.jsx)("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}var Kn=require("jotai");var _=require("jotai"),Un=require("jotai-family"),ze=require("fast-equals");function Lo(e,t){let{[t]:n,...r}=e;return r}function Oo(e){return(0,Un.atomFamily)(t=>(0,_.atom)(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];(0,ze.deepEqual)(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,Lo(i,t))}))}function Do(e){return(0,_.atom)(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function Po(e){return(0,_.atom)(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function Mo(e){return(0,_.atom)(null,(t,n,r)=>{let o=t(e);(0,ze.deepEqual)(o,r)||n(e,r)})}function ue(e={}){let t=(0,_.atom)(e);return{atom:t,clearAll:Do(t),clear:Po(t),bulkReport:Mo(t),report:Oo(t)}}var $n=ue(),Yn=$n.atom,Xn=$n.report;function _o(e,t){return e.fields.every(n=>Wn(n,t))}function Wn(e,t){return t[e.name]?.hidden??e.hidden??!1}function zo(e,t){return D(e)?_o(e,t):Wn(e,t)}function Zn(e){let t=(0,Kn.useAtomValue)(Yn);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>zo(r,t))?null:e.children}var C=require("react/jsx-runtime");function qn(e){let t=le(e.sections,e.definition);return(0,C.jsx)("div",{className:"h-full w-full",children:(0,C.jsx)("form",{noValidate:e.noValidate,action:e.action,children:(0,C.jsxs)(N,{children:[t.map((n,r)=>(0,C.jsxs)(Zn,{fields:n.fields??[],children:[(0,C.jsx)(Hn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&(0,C.jsx)(Gn,{})]},`key-${n.id}-${r}`)),e.control&&(0,C.jsx)(We,{isPending:e.isPending,children:e.control})]})})})}var Qn=require("react/jsx-runtime");function Jn(e){return(0,Qn.jsx)("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}var jn=require("react"),z=require("react/jsx-runtime");function fe(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=(0,jn.useState)(()=>f(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(p=>!p),a=f(e.text)&&d(e.text.title)?A(R($(e.text.title,t,r),e.translations)):void 0,s=R($(d(e.text)?e.text:e.text?.message,t,r),e.translations),u=A(s);return u?(0,z.jsxs)("div",{className:"flex flex-col gap-2",children:[a&&(0,z.jsxs)("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:l,type:"button",children:[a,(0,z.jsx)(k,{expanded:o})]}),o&&(0,z.jsx)(Jn,{title:s,children:u})]}):null}var Ve=require("jotai");var me=ue(),Rl=me.atom,Tl=me.clearAll,hl=me.clear,er=me.report,Al=(0,Ve.atom)({}),Cl=(0,Ve.atom)(null);var Be=require("jotai"),tr=require("react/jsx-runtime");function ge(e){let t=(0,Be.useAtomValue)(er(e.field.name)),r=(0,Be.useAtomValue)(Xn(e.field.name))?.description??e.field.description;return(0,tr.jsx)(fe,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}var nr=require("tailwind-merge"),X=require("react/jsx-runtime");function rr(e){let t=e.style?.showOptionalLabel??!0,n=w(e.field)||b(e.field);return(0,X.jsxs)("label",{"data-slot":"field-label","data-normal":n,className:(0,nr.twMerge)("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:d(e.children)?e.children:void 0,children:[(0,X.jsx)("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&(0,X.jsx)("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:ne("(Optional)",e.translations)})]})}var K=require("react/jsx-runtime");function or(e){let t={context:e.context,env:e.config?.env},n=$(e.field.label,t);return(0,K.jsxs)("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[(0,K.jsx)(rr,{field:e.field,style:e.config?.style,translations:e.translations,children:R(n,e.translations)}),e.horizontal===!0&&(0,K.jsx)(ge,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}var E=require("react/jsx-runtime");function ir(e){return(0,E.jsxs)(E.Fragment,{children:[e.field.name&&e.field.label&&(0,E.jsx)(or,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&(0,E.jsx)(ge,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function lr(e,t){return e?t(e):null}var He=require("react/jsx-runtime");function ar(e){let t=An(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=Cn(e.field,e.commonProps,t,e.value,e.translations),o=Fn(e.field,r);return lr(e.config.inputs[e.field.type],i=>(0,He.jsx)(ir,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:(0,He.jsx)(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}var Ge=require("react/jsx-runtime");function sr(e){return!e.errors||e.errors.length===0?null:(0,Ge.jsx)("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors?.map((t,n)=>(0,Ge.jsx)("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}var cr=require("tailwind-merge"),dr=require("react/jsx-runtime");function pe(e){let t=e.errors&&e.errors.length>0;return(0,dr.jsx)("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[At]:"true"},...e.disabled&&{[Ct]:"true"},"data-orientation":e.orientation,className:(0,cr.twMerge)("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}var ur=require("tailwind-merge"),mr=require("react/jsx-runtime");function fr(e){return(0,mr.jsx)(pe,{...e,orientation:"vertical",className:(0,ur.twMerge)("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}var gr=require("tailwind-merge"),xr=require("react/jsx-runtime");function pr(e){return(0,xr.jsx)(pe,{...e,orientation:"horizontal",className:(0,gr.twMerge)("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}var Ue=require("react/jsx-runtime");function yr(e){let t=jt(e.field),n=b(e.field),r=nn(e.field);return e.horizontal?(0,Ue.jsx)(pr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):(0,Ue.jsx)(fr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function br(e){if(!e.field.type)return null;let t=yn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=wn(e.field),r=In(e.field,e.errors),o={...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal})}var Rr=require("tailwind-merge"),V=require("react/jsx-runtime");function Tr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r}=ae(e.style,{horizontal:tn(e.field)}),o=rn(e.field,e.disabled);return(0,V.jsxs)("div",{className:(0,Rr.twMerge)("flex flex-col gap-3",On(t)),children:[(0,V.jsx)(yr,{disabled:o,errors:n,field:e.field,horizontal:r,children:(0,V.jsx)(br,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,translations:e.translations,children:e.children})}),(0,V.jsx)(sr,{errors:n,name:e.field.name})]})}var xe=require("tailwind-merge"),hr=require("react"),c=require("react/jsx-runtime");function Ar(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=(0,hr.useState)(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(p=>!p)}let l=p=>U(ne(p,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&(0,c.jsx)("button",{"aria-label":l("Remove {label} item {index}"),className:(0,xe.twMerge)("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:o,type:"button",children:(0,c.jsx)("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=(0,c.jsxs)("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[(0,c.jsx)("span",{className:"text-base",children:e.previewLabel??(0,c.jsxs)(c.Fragment,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&(0,c.jsx)("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),u=(0,c.jsxs)("div",{className:(0,xe.twMerge)("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?(0,c.jsxs)("div",{className:"flex min-w-0 grow items-center gap-2",children:[(0,c.jsxs)("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:(0,xe.twMerge)("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:i,type:"button",children:[(0,c.jsx)(k,{expanded:n}),s]}),!n&&e.previewBadge&&(0,c.jsx)("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?(0,c.jsxs)("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[u,(0,c.jsx)(B,{visible:n,children:(0,c.jsx)(N,{children:e.children})})]}):t?(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[u,(0,c.jsx)(B,{visible:n,children:(0,c.jsx)(N,{children:e.children})})]}):(0,c.jsxs)("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[(0,c.jsx)("div",{className:"flex min-w-0 grow flex-col",children:(0,c.jsx)(N,{children:e.children})}),a&&(0,c.jsx)("div",{className:"shrink-0",children:a})]})}var Fr=require("react/jsx-runtime");function Cr(e){let t=R(Mn(e.field),e.translations),n=Dn(e.field);return Pn(e.field,e.value).map(r=>(0,Fr.jsx)(Ar,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}var Nr=require("react/jsx-runtime");function Sr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=M(e.field.label,e.translations),r=M(e.field.description,e.translations);return(0,Nr.jsx)(ce,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}var $e=require("react/jsx-runtime");function vr({children:e,field:t,lang:n,translations:r,value:o}){return(0,$e.jsx)(Sr,{field:t,translations:r,children:(0,$e.jsx)(Cr,{field:t,lang:n,translations:r,value:o,children:e})})}var Ir=require("tailwind-merge");var W=require("react/jsx-runtime");function wr(e){let t=Ln(e.column?.advanced?.cols);return(0,W.jsxs)("div",{className:"flex w-full flex-col gap-4",children:[(0,W.jsx)("div",{"data-slot":"column",className:(0,Ir.twMerge)("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&(0,W.jsx)(fe,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}var Lr=require("react");var kr=require("react/jsx-runtime");function Er(e){let t=Array.isArray(e.field.fields)?e.field.fields.map(n=>te(n)||ee(n)?{...n,name:`${e.field.name}.${e.index}.${n.name}`}:D(n)?{...n,fields:n.fields.map(r=>({...r,name:`${e.field.name}.${e.index}.${r.name}`}))}:n):[];return(0,kr.jsx)(Z,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:t,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}var v=require("react/jsx-runtime");function Z(e){let{field:t,list:n}=e.components;return le(e.fields).map((r,o)=>(0,v.jsxs)(Lr.Fragment,{children:[D(r)&&(0,v.jsx)(wr,{column:r,config:e.config,context:e.context,translations:e.translations,children:(0,v.jsx)(Z,{...e,fields:r.fields})}),te(r)&&(0,v.jsx)(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),ee(r)&&(0,v.jsx)(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>(0,v.jsx)(Er,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}var Dr=require("react/jsx-runtime");function Or(e){return n=>(0,Dr.jsx)(Z,{...n,components:e})}var Pr=Or({field:Tr,list:vr});var ye=require("react/jsx-runtime");function be(e){let t=xn(e.lang,e.translations);return(0,ye.jsx)(qn,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>(0,ye.jsx)(Pr,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>(0,ye.jsx)(ar,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}var Mr=require("react");var Ye=require("react/jsx-runtime");function _r(e){return(0,Ye.jsx)(Mr.Suspense,{fallback:(0,Ye.jsx)(be,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}
@@ -1 +1 @@
1
- import{jsx as br}from"react/jsx-runtime";function ke(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return br("div",{"data-slot":"field-control",className:"w-full",children:t})}import{jsx as Ee}from"react/jsx-runtime";function A(e){return Ee("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:Ee("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}import{Activity as hr}from"react";import{createContext as Tr}from"react";var Le=Tr(!1);import{jsx as Oe}from"react/jsx-runtime";function k({children:e,visible:t}){return Oe(hr,{mode:t?"visible":"hidden",children:Oe(Le,{value:!0,children:e})})}var U="input",De="input/date",Pe="input/email",Me="input/number";var _e="input/time";var ze="textarea",Ve="radio",Be="checkbox",ae="list";var Ue="select",He="select/active",Ge="select/day",$e="select/month",Ye="select/timezone",Ke="select/year";var Xe="chips",Ze="chips/day",We="chips/month",E="column",qe="description",se="fields",Je="label",ce="value",H="options",de="email",Qe="number",je="password",et="tel",L="text",tt="aria-errormessage",nt="aria-invalid",rt="data-invalid",ot="data-readonly",it="aria",lt="data",at="max",st="maxLength",ct="min",dt="minLength",N="$ref";var ut="type",ft={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};import{format as Cr,formatDistanceToNow as mt,formatDuration as Fr,intervalToDuration as Ar,isValid as G,parseISO as Nr}from"date-fns";import{enUS as gt,es as ue}from"date-fns/locale";function u(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function p(e){return c(e)||typeof e=="number"||Rr(e)}function c(e){return typeof e=="string"}function Rr(e){return typeof e=="boolean"}var pt={en:gt,"en-US":gt,es:ue,"es-ES":ue,"es-MX":ue},Sr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},vr={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function xt(e){if(e)return pt[e]??pt[e.split("-")[0]]}function $(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(c(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function yt(e,t,n){let r=vr[t];if(r===void 0)return String(e);let o=e*r,i=Ar({start:0,end:o});return Fr(i,{locale:n})}function bt(e){if(e instanceof Date)return G(e)?e:null;if(c(e)){let t=Nr(e);if(G(t))return t;let n=new Date(e);return G(n)?n:null}if(typeof e=="number"){let t=new Date(e);return G(t)?t:null}return null}var Ir={currency:(e,t,n)=>{let r=$(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=$(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=$(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=bt(e);if(!r)return String(e);let o=t[0]??"short",i=xt(n.locale);if(o==="relative")return mt(r,{addSuffix:!0,locale:i});let l=Sr[o]??o;return Cr(r,l,{locale:i})},duration:(e,t,n)=>{let r=xt(n.locale);if(typeof e=="number")return yt(e,t[0]??"ms",r);if(c(e)){let i=$(e);if(i!==null)return yt(i,t[0]??"ms",r)}let o=bt(e);return o?mt(o,{addSuffix:!0,locale:r}):String(e)}};function Tt(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=Ir[o];if(l)return l(e,i,n)}function ht(e,t=ce){if(e!=null){if(Array.isArray(e)&&e.every(p)||p(e))return e;if(u(e)){let n=wr(e,t);if(p(n))return n}}}function wr(e,t){let n=x(e,t);if(p(n))return n}function x(e,t){if(!t||!u(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(u(r)&&o in r)r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function Rt(e,t={description:qe,label:Je,value:ce}){return e.map(n=>{if(u(n)){let r=x(n,t.label),o=x(n,t.value);if(p(r)&&p(o)){let i=x(n,t.description);return{label:`${r}`,value:`${o}`,...p(i)&&{description:`${i}`}}}}return n})}function Ct(e=L){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==U?n.trim().toLowerCase():L}var kr=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g;function O(e,t={},n={}){if(c(e))return Er(e,t,n);if(Array.isArray(e))return e.map(r=>O(r,t,n));if(u(e)){let r={};for(let o in e)r[o]=O(e[o],t,n);return r}return e}function D(e,t={},n={}){return fe(e)?O(e,t,n):e}function fe(e){return c(e)?/{([^}]{1,200})}/.test(e):Array.isArray(e)?e.some(t=>fe(t)):u(e)?Object.values(e).some(t=>fe(t)):!1}function Er(e,t={},n={}){return e.replace(/{([^}]{1,200})}/g,(r,o)=>{let i=String(o).split("|").map(m=>m.trim()),[l,...a]=i;if(!l)return r;let s=l.includes(".")?x(t,l):t[l];if(a.length===0)return p(s)?String(s):r;if(s==null)return r;let d=s;for(let m of a){let B=Tt(d,m,{locale:n.locale});if(B===void 0)return r;d=B}return String(d)})}function Ft(e,t){if(!c(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=kr.exec(e))!==null;){let[l,a,s]=n,d=n.index;o=!0,d>r&&i.push(e.substring(r,d));let m=t?t(d,s,a):l;i.push(m),r=d+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var At=e=>f(He)(e),Nt=e=>f(Ge)(e),St=e=>f($e)(e),vt=e=>f(Ke)(e),It=e=>f(Ye)(e),wt=e=>f(Ze)(e),kt=e=>f(We)(e),Et=f(De),me=f(_e),y=f(Be),S=f(Xe),F=f(Ve),Lt=f(U),h=f(Ue),Ot=f(ze),Dt=f(L,de,je,et),Fi=f(Pe,de),Pt=f(Me,Qe);function Mt(e){return F(e)||y(e)}function Y(e){return e.type===ae}function v(e){return e.type===E}function K(e){return e.type!==E&&e.type!==ae}function ge(e){return h(e)||F(e)||S(e)}function I(e){return e!=null&&e!==""}function f(...e){return t=>{let n=c(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function _t(e,t={}){if(h(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&u(n))return[n]}}function zt(e){return F(e)||y(e)?!0:e.advanced?.horizontal??!1}function Vt(e){return y(e)?e.advanced?.reverse!==!1:!1}function Bt(e,t){let n=e.readonly??!1;return t||n}function pe(e){if(Lr(e)){let t=e.source;if(Array.isArray(t)||u(t)&&!(N in t))return t}}function Ut(e){return Array.isArray(pe(e))}function Lr(e){return F(e)||S(e)||h(e)&&!e.disabled}import{isValid as $t,parse as Yt,format as Kt}from"date-fns";var Or=/^\d+$/,Xt=new Date(2e3,0,1),Dr=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],xe="default";function Zt(e){if(!e)return xe;try{return Intl.getCanonicalLocales(e)[0]??xe}catch{return xe}}function ye(e){let t=Zt(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function be(e){let t=Zt(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function Wt(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function Te(){return new Date().getFullYear()}function Pr(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Mr(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return ft[n]??"Other"}function _r(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function Ht(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=_r(r,e);return{offset:i,longName:l}}function Gt(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function qt(){let e=new Date,t=Pr(),n=new Map,r=Gt(t),{offset:o,longName:i}=Ht(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of Dr()){if(s===t)continue;let d=Gt(s),{offset:m,longName:B}=Ht(s,e),Ie={value:s,label:`${d} - ${B} (${m})`},le=Mr(s);if(le==="Other")continue;let we=n.get(le);we?we.push(Ie):n.set(le,[Ie])}for(let s of n.values())s.sort((d,m)=>d.label.localeCompare(m.label));let a=Array.from(n.entries()).sort(([s],[d])=>s.localeCompare(d)).map(([s,d])=>({label:s,items:d}));return[{label:"Suggested",items:[l]},...a]}function he(e,t){if(typeof e=="number")return e;let n=t??Te(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return Or.test(r)?parseInt(r,10):n}function Jt(e,t){if(!e)return"";try{let n=Yt(e,t,Xt);return $t(n)?Kt(n,"yyyy-MM-dd"):""}catch{return""}}function Qt(e,t){if(!e)return"";try{let n=Yt(e,t,Xt);return $t(n)?Kt(n,"HH:mm:ss"):""}catch{return""}}function Re(e){return e.advanced?.format??"HH:mm"}function jt(e){return e.advanced?.format??"MMMM d, yyyy"}var zr={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function X(e,t){return b(e,t)}function tn(e,t){let n=t?.[e??""],r=e?zr[Vr(e)]:void 0;return r?n?{...r,...n}:r:n}function Vr(e){return e.toLowerCase().split(/[-_]/)[0]}function b(e,t){return e?t?t[e]??e:e:""}function w(e,t){return e?b(e,t):void 0}function Z(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=Br(o,t);return i!==o&&(n=!0),i});return n?r:e}function Br(e,t){if(!u(e))return e;let n=en(e.label,t),r=e.items;if(Array.isArray(r)){let i=Z(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=en(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function en(e,t){return c(e)?b(e,t):e}var W=Te();function Ur(e,t){if(S(e))return Hr(e,t?.lang)}function Hr(e,t){if(wt(e))return be(t);if(kt(e))return ye(t)}function Gr(e,t){if(h(e))return $r(e,t)}function $r(e,t){let{lang:n,translations:r}=t??{};if(Nt(e))return be(n);if(St(e))return ye(n);if(vt(e)){let o=e.advanced?.length?.min??W,i=e.advanced?.length?.max??W+5;return Wt(he(o,W),he(i,W))}if(It(e))return qt();if(At(e))return Z([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function nn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return Lt(e)?{...r,...Yr(e)}:h(e)?{...r,...rn(Gr(e,n))}:Ot(e)?{...r,...Xr(e)}:S(e)?{...r,...Kr(e,n)}:r}function Yr(e){let t=Ct(e.type),n={...e,type:t};return{...Wr(e),...on(e),...Zr(n),...Dt(n)?ln(n):{},type:t}}function rn(e){return e?{options:e}:{}}function Kr(e,t){let n=rn(Ur(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function Xr(e){return{...on(e),...ln(e)}}function on(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function Zr(e){return Pt(e)?qr(e):{}}function Wr(e){if(me(e)){let t=Re(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function ln(e){return an(e,{min:dt,max:st})}function qr(e){return an(e,{min:ct,max:at})}function an(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function sn(e,t){let n=pe(e);return n||_t(e,t)}function Jr(e,t){let n=u(t)&&e.name in t?t[e.name]:t,r=ht(n,e.advanced?.entity),o=I(r)?r:e.defaultValue;return me(e)&&I(o)?Qr(e,o):Et(e)&&I(o)?no(e,o):o}function Qr(e,t){let n=Re(e);return c(t)?Qt(t,n):t}function jr(e,t,n){return ge(e)&&Array.isArray(n)?{...t,[H]:n}:t}function eo(e,t,n){if(e.required&&!I(n)&&h(e)&&e.advanced?.preselected!==!1&&H in t){let r=t[H];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function to(e,t,n){if(ge(e)&&Array.isArray(t)){let r=Rt(t,e.advanced?.options);return Ut(e)?Z(r,n):r}return t}function cn(e,t,n,r,o){let i=Jr(e,r),l=Array.isArray(n)?to(e,n,o):n,a=jr(e,t,l),s=eo(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function dn(e,t){return y(e)?{defaultChecked:I(t)}:{defaultValue:t}}function no(e,t){let n=jt(e);return c(t)?Jt(t,n):t}var ro=/^#\/definition\//;function J(e=[],t){let n=q(e,t);return Array.isArray(n)?n.filter(io).sort((r,o)=>un(r)-un(o)):[]}function q(e,t,n=new Map,r=new WeakSet){if(!oo(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>q(i,t,n,r));if(N in e&&c(e[N])){let i=e[N].replace(ro,""),l=x(t,i);return l!==null?q(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=q(l,t,n,r);return r.delete(e),n.set(e,o),o}function fn(e){return Object.entries(e??{})}function un(e){return e.order??Number.MAX_VALUE}function oo(e){return e!==void 0&&u(e)&&Object.keys(e).length>0}function io(e){return ut in e?!0:Array.isArray(e[se])?e[se].length>0:!0}function mn(e,t){let n={};for(let[r,o]of fn(t))n[`${e}-${r}`]=o;return n}function lo(e){return mn(it,e)}function ao(e){return mn(lt,e)}function gn(e,t){let n=lo(e.advanced?.aria);return t&&t.length>0&&(n[nt]="true",n[tt]=`${e.name}-error`),n}function pn(e){return ao(e.advanced?.data)}var xn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},yn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function bn(e,t=2){return xn[e&&e in xn?e:t]}function Tn(e){if(e&&e in yn)return yn[e]}function so(e,t){let n=e.advanced?.length?.min??1;if(t){let r=x(t,e.name);if(Array.isArray(r))return Math.max(r.length,n)}return Math.max(n,0)}function hn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===E}function Rn(e,t){let n=so(e,t);return Array.from({length:n},(r,o)=>o)}function Cn(e){return e.advanced?.title??e.label??e.name}function Q(e,t){return{...e,...t}}import{jsx as co}from"react/jsx-runtime";function T(e){return Ft(e,(t,n,r)=>co("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}import{useCallback as uo,useState as fo}from"react";import{jsx as P,jsxs as Ce}from"react/jsx-runtime";function Fn(e){let{fields:t=[]}=e.section,[n,r]=fo(!1),o=uo(()=>r(i=>!i),[]);return Ce("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[P("legend",{children:Ce("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:o,type:"button",children:[P(A,{expanded:n}),P("span",{children:T(e.title)})]})}),P(k,{visible:n,children:Ce("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&P("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:T(e.description)}),e.group]})})]})}import{jsx as j,jsxs as An}from"react/jsx-runtime";function Nn(e){let t=An("div",{className:"flex flex-col",children:[e.title&&j("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:T(e.title)}),e.description&&j("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:T(e.description)})]});return e.step?An("div",{className:"flex flex-row items-start gap-4",children:[j("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:j("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}import{jsx as Sn,jsxs as mo}from"react/jsx-runtime";function ee(e){return mo("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[Sn(Nn,{description:e.description,step:e.step,title:e.title}),Sn("div",{className:"w-full min-w-0",children:e.children})]})}import{jsx as go}from"react/jsx-runtime";function R(e){return go("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}import{jsx as Fe}from"react/jsx-runtime";function vn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=Q(e.style,{compact:e.section.advanced?.compact}),o=Fe(R,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=w(e.section.title,e.translations),l=w(e.section.description,e.translations);return e.section.advanced?.collapsible?Fe(Fn,{description:l,group:o,section:e.section,title:i}):Fe(ee,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}import{jsx as In}from"react/jsx-runtime";function wn(){return In("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:In("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}import{useAtomValue as Ro}from"jotai";import{atom as M}from"jotai";import{atomFamily as po}from"jotai-family";import{deepEqual as kn}from"fast-equals";function xo(e,t){let{[t]:n,...r}=e;return r}function yo(e){return po(t=>M(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];kn(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,xo(i,t))}))}function bo(e){return M(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function To(e){return M(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function ho(e){return M(null,(t,n,r)=>{let o=t(e);kn(o,r)||n(e,r)})}function te(e={}){let t=M(e);return{atom:t,clearAll:bo(t),clear:To(t),bulkReport:ho(t),report:yo(t)}}var En=te(),Ln=En.atom,On=En.report;function Co(e,t){return e.fields.every(n=>Dn(n,t))}function Dn(e,t){return t[e.name]?.hidden??e.hidden??!1}function Fo(e,t){return v(e)?Co(e,t):Dn(e,t)}function Pn(e){let t=Ro(Ln);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>Fo(r,t))?null:e.children}import{jsx as _,jsxs as Mn}from"react/jsx-runtime";function _n(e){let t=J(e.sections,e.definition);return _("div",{className:"h-full w-full",children:_("form",{noValidate:e.noValidate,action:e.action,children:Mn(R,{children:[t.map((n,r)=>Mn(Pn,{fields:n.fields??[],children:[_(vn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&_(wn,{})]},`key-${n.id}-${r}`)),e.control&&_(ke,{isPending:e.isPending,children:e.control})]})})})}import{jsx as Ao}from"react/jsx-runtime";function zn(e){return Ao("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}import{useState as No}from"react";import{jsx as Vn,jsxs as Bn}from"react/jsx-runtime";function ne(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=No(()=>u(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(m=>!m),a=u(e.text)&&c(e.text.title)?T(b(D(e.text.title,t,r),e.translations)):void 0,s=b(D(c(e.text)?e.text:e.text?.message,t,r),e.translations),d=T(s);return d?Bn("div",{className:"flex flex-col gap-2",children:[a&&Bn("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:l,type:"button",children:[a,Vn(A,{expanded:o})]}),o&&Vn(zn,{title:s,children:d})]}):null}import{atom as Un}from"jotai";var re=te(),ta=re.atom,na=re.clearAll,ra=re.clear,Hn=re.report,oa=Un({}),ia=Un(null);import{useAtomValue as Gn}from"jotai";import{jsx as So}from"react/jsx-runtime";function oe(e){let t=Gn(Hn(e.field.name)),r=Gn(On(e.field.name))?.description??e.field.description;return So(ne,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}import{twMerge as vo}from"tailwind-merge";import{jsx as $n,jsxs as Io}from"react/jsx-runtime";function Yn(e){let t=e.style?.showOptionalLabel??!0,n=F(e.field)||y(e.field);return Io("label",{"data-slot":"field-label","data-normal":n,className:vo("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:c(e.children)?e.children:void 0,children:[$n("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&$n("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:X("(Optional)",e.translations)})]})}import{jsx as Kn,jsxs as wo}from"react/jsx-runtime";function Xn(e){let t={context:e.context,env:e.config?.env},n=D(e.field.label,t);return wo("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[Kn(Yn,{field:e.field,style:e.config?.style,translations:e.translations,children:b(n,e.translations)}),e.horizontal===!0&&Kn(oe,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}import{Fragment as ko,jsx as Zn,jsxs as Eo}from"react/jsx-runtime";function Wn(e){return Eo(ko,{children:[e.field.name&&e.field.label&&Zn(Xn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&Zn(oe,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function qn(e,t){return e?t(e):null}import{jsx as Jn}from"react/jsx-runtime";function Qn(e){let t=sn(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=cn(e.field,e.commonProps,t,e.value,e.translations),o=dn(e.field,r);return qn(e.config.inputs[e.field.type],i=>Jn(Wn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:Jn(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}import{jsx as jn}from"react/jsx-runtime";function er(e){return!e.errors||e.errors.length===0?null:jn("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors?.map((t,n)=>jn("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}import{twMerge as Lo}from"tailwind-merge";import{jsx as Oo}from"react/jsx-runtime";function ie(e){let t=e.errors&&e.errors.length>0;return Oo("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[rt]:"true"},...e.disabled&&{[ot]:"true"},"data-orientation":e.orientation,className:Lo("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}import{twMerge as Do}from"tailwind-merge";import{jsx as Po}from"react/jsx-runtime";function tr(e){return Po(ie,{...e,orientation:"vertical",className:Do("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}import{twMerge as Mo}from"tailwind-merge";import{jsx as _o}from"react/jsx-runtime";function nr(e){return _o(ie,{...e,orientation:"horizontal",className:Mo("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}import{jsx as rr}from"react/jsx-runtime";function or(e){let t=Mt(e.field),n=y(e.field),r=Vt(e.field);return e.horizontal?rr(nr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):rr(tr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function ir(e){if(!e.field.type)return null;let t=nn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=pn(e.field),r=gn(e.field,e.errors),o={...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal})}import{twMerge as zo}from"tailwind-merge";import{jsx as Ae,jsxs as Vo}from"react/jsx-runtime";function lr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r}=Q(e.style,{horizontal:zt(e.field)}),o=Bt(e.field,e.disabled);return Vo("div",{className:zo("flex flex-col gap-3",Tn(t)),children:[Ae(or,{disabled:o,errors:n,field:e.field,horizontal:r,children:Ae(ir,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,translations:e.translations,children:e.children})}),Ae(er,{errors:n,name:e.field.name})]})}import{twMerge as Ne}from"tailwind-merge";import{useState as Bo}from"react";import{Fragment as Uo,jsx as g,jsxs as C}from"react/jsx-runtime";function ar(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=Bo(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(m=>!m)}let l=m=>O(X(m,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&g("button",{"aria-label":l("Remove {label} item {index}"),className:Ne("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:o,type:"button",children:g("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=C("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[g("span",{className:"text-base",children:e.previewLabel??C(Uo,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&g("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),d=C("div",{className:Ne("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?C("div",{className:"flex min-w-0 grow items-center gap-2",children:[C("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:Ne("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:i,type:"button",children:[g(A,{expanded:n}),s]}),!n&&e.previewBadge&&g("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?C("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[d,g(k,{visible:n,children:g(R,{children:e.children})})]}):t?C("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[d,g(k,{visible:n,children:g(R,{children:e.children})})]}):C("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[g("div",{className:"flex min-w-0 grow flex-col",children:g(R,{children:e.children})}),a&&g("div",{className:"shrink-0",children:a})]})}import{jsx as Ho}from"react/jsx-runtime";function sr(e){let t=b(Cn(e.field),e.translations),n=hn(e.field);return Rn(e.field,e.value).map(r=>Ho(ar,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}import{jsx as Go}from"react/jsx-runtime";function cr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=w(e.field.label,e.translations),r=w(e.field.description,e.translations);return Go(ee,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}import{jsx as dr}from"react/jsx-runtime";function ur({children:e,field:t,lang:n,translations:r,value:o}){return dr(cr,{field:t,translations:r,children:dr(sr,{field:t,lang:n,translations:r,value:o,children:e})})}import{twMerge as $o}from"tailwind-merge";import{jsx as fr,jsxs as Yo}from"react/jsx-runtime";function mr(e){let t=bn(e.column?.advanced?.cols);return Yo("div",{className:"flex w-full flex-col gap-4",children:[fr("div",{"data-slot":"column",className:$o("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&fr(ne,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}import{Fragment as Xo}from"react";import{jsx as Ko}from"react/jsx-runtime";function gr(e){let t=Array.isArray(e.field.fields)?e.field.fields.map(n=>K(n)||Y(n)?{...n,name:`${e.field.name}.${e.index}.${n.name}`}:v(n)?{...n,fields:n.fields.map(r=>({...r,name:`${e.field.name}.${e.index}.${r.name}`}))}:n):[];return Ko(z,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:t,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}import{jsx as V,jsxs as Zo}from"react/jsx-runtime";function z(e){let{field:t,list:n}=e.components;return J(e.fields).map((r,o)=>Zo(Xo,{children:[v(r)&&V(mr,{column:r,config:e.config,context:e.context,translations:e.translations,children:V(z,{...e,fields:r.fields})}),K(r)&&V(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),Y(r)&&V(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>V(gr,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}import{jsx as Wo}from"react/jsx-runtime";function pr(e){return n=>Wo(z,{...n,components:e})}var xr=pr({field:lr,list:ur});import{jsx as Se}from"react/jsx-runtime";function ve(e){let t=tn(e.lang,e.translations);return Se(_n,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>Se(xr,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>Se(Qn,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}import{Suspense as qo}from"react";import{jsx as yr}from"react/jsx-runtime";function Jo(e){return yr(qo,{fallback:yr(ve,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}export{Jo as Fallback,ve as Form};
1
+ import{jsx as br}from"react/jsx-runtime";function Ee(e){let t=typeof e.children=="function"?e.children({isPending:e.isPending}):e.children;return br("div",{"data-slot":"field-control",className:"w-full",children:t})}import{jsx as ke}from"react/jsx-runtime";function F(e){return ke("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`size-4 transition-transform duration-200 ${e.expanded?"rotate-90":""}`,children:ke("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})})}import{Activity as Tr}from"react";import{createContext as Rr}from"react";var Le=Rr(!1);import{jsx as Oe}from"react/jsx-runtime";function E({children:e,visible:t}){return Oe(Tr,{mode:t?"visible":"hidden",children:Oe(Le,{value:!0,children:e})})}var H="input",De="input/date",Pe="input/email",Me="input/number";var _e="input/time";var ze="textarea",Ve="radio",Be="checkbox",ae="list";var He="select",Ge="select/active",Ue="select/day",$e="select/month",Ye="select/timezone",Xe="select/year";var Ke="chips",We="chips/day",Ze="chips/month",k="column",qe="description",se="fields",Je="label",ce="value",G="options",de="email",Qe="number",je="password",et="tel",L="text",tt="aria-errormessage",nt="aria-invalid",rt="data-invalid",ot="data-readonly",it="aria",lt="data",at="max",st="maxLength",ct="min",dt="minLength",S="$ref";var ut="type",ft={Africa:"Africa",America:"Americas",Asia:"Asia / Pacific",Atlantic:"Atlantic",Australia:"Asia / Pacific",Europe:"Europe",Indian:"Asia / Pacific",Pacific:"Asia / Pacific"};import{format as Ar,formatDistanceToNow as mt,formatDuration as Cr,intervalToDuration as Fr,isValid as U,parseISO as Sr}from"date-fns";import{enUS as gt,es as ue}from"date-fns/locale";function u(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function p(e){return c(e)||typeof e=="number"||hr(e)}function c(e){return typeof e=="string"}function hr(e){return typeof e=="boolean"}var pt={en:gt,"en-US":gt,es:ue,"es-ES":ue,"es-MX":ue},Nr={short:"M/d/yy",medium:"MMM d, yyyy",long:"MMMM d, yyyy",full:"EEEE, MMMM d, yyyy"},vr={ms:1,s:1e3,min:6e4,h:36e5,d:864e5};function xt(e){if(e)return pt[e]??pt[e.split("-")[0]]}function $(e){if(typeof e=="number"&&!Number.isNaN(e))return e;if(c(e)&&e.trim()!==""){let t=Number(e);return Number.isNaN(t)?null:t}return null}function yt(e,t,n){let r=vr[t];if(r===void 0)return String(e);let o=e*r,i=Fr({start:0,end:o});return Cr(i,{locale:n})}function bt(e){if(e instanceof Date)return U(e)?e:null;if(c(e)){let t=Sr(e);if(U(t))return t;let n=new Date(e);return U(n)?n:null}if(typeof e=="number"){let t=new Date(e);return U(t)?t:null}return null}var Ir={currency:(e,t,n)=>{let r=$(e);if(r===null)return String(e);let o=t[0]??"USD";return new Intl.NumberFormat(n.locale,{style:"currency",currency:o}).format(r)},percent:(e,t,n)=>{let r=$(e);return r===null?String(e):new Intl.NumberFormat(n.locale,{style:"percent"}).format(r)},number:(e,t,n)=>{let r=$(e);return r===null?String(e):new Intl.NumberFormat(n.locale).format(r)},date:(e,t,n)=>{let r=bt(e);if(!r)return String(e);let o=t[0]??"short",i=xt(n.locale);if(o==="relative")return mt(r,{addSuffix:!0,locale:i});let l=Nr[o]??o;return Ar(r,l,{locale:i})},duration:(e,t,n)=>{let r=xt(n.locale);if(typeof e=="number")return yt(e,t[0]??"ms",r);if(c(e)){let i=$(e);if(i!==null)return yt(i,t[0]??"ms",r)}let o=bt(e);return o?mt(o,{addSuffix:!0,locale:r}):String(e)}};function Rt(e,t,n){let r=t.split(":").map(a=>a.trim()).filter(a=>a.length>0);if(r.length===0)return;let[o,...i]=r,l=Ir[o];if(l)return l(e,i,n)}function Tt(e,t=ce){if(e!=null){if(Array.isArray(e)&&e.every(p)||p(e))return e;if(u(e)){let n=wr(e,t);if(p(n))return n}}}function wr(e,t){let n=x(e,t);if(p(n))return n}function x(e,t){if(!t||!u(e))return null;let n=t.split(".").filter(o=>o!=="");if(n.length===0)return null;let r=e;for(let o of n)if(u(r)&&o in r)r=r[o];else if(Array.isArray(r)){let i=Number(o);if(!Number.isInteger(i)||i<0||i>=r.length)return null;r=r[i]}else return null;return r}function ht(e,t={description:qe,label:Je,value:ce}){return e.map(n=>{if(u(n)){let r=x(n,t.label),o=x(n,t.value);if(p(r)&&p(o)){let i=x(n,t.description);return{label:`${r}`,value:`${o}`,...p(i)&&{description:`${i}`}}}}return n})}function At(e=L){let t=e.lastIndexOf("/"),n=t===-1?e:e.slice(t+1);return n&&n!==H?n.trim().toLowerCase():L}var Er=/\[([^\]]{1,500})\]\(([^)]{1,2000})\)/g,kr=/{([^}]{1,200})}/,Lr=/{([^}]{1,200})}/g;function O(e,t={},n={}){if(c(e))return Dr(e,t,n);if(Array.isArray(e))return e.map(r=>O(r,t,n));if(u(e)){let r={};for(let o in e)r[o]=O(e[o],t,n);return r}return e}function D(e,t={},n={}){return fe(e)?O(e,t,n):e}function fe(e){return c(e)?kr.test(e):Array.isArray(e)?e.some(t=>fe(t)):u(e)?Object.values(e).some(t=>fe(t)):!1}function Or(e,t){return t.includes(".")?x(e,t):e[t]}function Dr(e,t={},n={}){return e.replace(Lr,(r,o)=>{let i=String(o).split("|").map(m=>m.trim()),[l,...a]=i;if(!l)return r;let s=Or(t,l);if(a.length===0)return p(s)?String(s):r;if(s==null)return r;let d=s;for(let m of a){let B=Rt(d,m,{locale:n.locale});if(B===void 0)return r;d=B}return String(d)})}function Ct(e,t){if(!c(e)||!e||e.trim().length===0)return null;let n,r=0,o=!1,i=[];for(;(n=Er.exec(e))!==null;){let[l,a,s]=n,d=n.index;o=!0,d>r&&i.push(e.substring(r,d));let m=t?t(d,s,a):l;i.push(m),r=d+l.length}return o?(r<e.length&&i.push(e.substring(r)),i):e}var Ft=e=>f(Ge)(e),St=e=>f(Ue)(e),Nt=e=>f($e)(e),vt=e=>f(Xe)(e),It=e=>f(Ye)(e),wt=e=>f(We)(e),Et=e=>f(Ze)(e),kt=f(De),me=f(_e),y=f(Be),N=f(Ke),C=f(Ve),Lt=f(H),T=f(He),Ot=f(ze),Dt=f(L,de,je,et),Ni=f(Pe,de),Pt=f(Me,Qe);function Mt(e){return C(e)||y(e)}function Y(e){return e.type===ae}function v(e){return e.type===k}function X(e){return e.type!==k&&e.type!==ae}function ge(e){return T(e)||C(e)||N(e)}function I(e){return e!=null&&e!==""}function f(...e){return t=>{let n=c(t.type)?t.type:void 0;return n?e.some(r=>n===r||n?.startsWith(`${r}/`)):!1}}function _t(e,t={}){if(T(e)&&e.disabled){let n=e.name?t?.[e.name]:void 0;if(n&&u(n))return[n]}}function zt(e){return C(e)||y(e)?!0:e.advanced?.horizontal??!1}function Vt(e){return y(e)?e.advanced?.reverse!==!1:!1}function Bt(e,t){let n=e.readonly??!1;return t||n}function pe(e){if(Pr(e)){let t=e.source;if(Array.isArray(t)||u(t)&&!(S in t))return t}}function Ht(e){return Array.isArray(pe(e))}function Pr(e){return C(e)||N(e)||T(e)&&!e.disabled}import{isValid as $t,parse as Yt,format as Xt}from"date-fns";var Mr=/^\d+$/,Kt=new Date(2e3,0,1),_r=()=>"supportedValuesOf"in Intl?Intl.supportedValuesOf("timeZone"):[],xe="default";function Wt(e){if(!e)return xe;try{return Intl.getCanonicalLocales(e)[0]??xe}catch{return xe}}function ye(e){let t=Wt(e);return Array.from({length:12},(n,r)=>({value:(r+1).toString(),label:new Date(0,r).toLocaleString(t,{month:"long"})}))}function be(e){let t=Wt(e);return Array.from({length:7},(n,r)=>({value:r.toString(),label:new Date(2e3,0,2+r).toLocaleString(t,{weekday:"long"})}))}function Zt(e,t){return t>=e?Array.from({length:t-e+1},(n,r)=>{let o=e+r;return{value:o.toString(),label:o.toString()}}):[]}function Re(){return new Date().getFullYear()}function zr(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function Vr(e){let t=e.indexOf("/"),n=t===-1?e:e.slice(0,t);return ft[n]??"Other"}function Br(e,t){return(e.find(r=>r.type==="timeZoneName")?.value??t).replace(/\s+(?:Standard|Daylight(?: Saving)?|Summer|Winter)\s+Time$/,"")}function Gt(e,t){let n=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t),r=new Intl.DateTimeFormat("en",{timeZone:e,timeZoneName:"long"}).formatToParts(t),i=(n.find(a=>a.type==="timeZoneName")?.value??"GMT+00:00").replace("GMT","UTC"),l=Br(r,e);return{offset:i,longName:l}}function Ut(e){return e.slice(e.lastIndexOf("/")+1).replace(/_/g," ")}function qt(){let e=new Date,t=zr(),n=new Map,r=Ut(t),{offset:o,longName:i}=Gt(t,e),l={value:t,label:`${r} - ${i} (${o})`};for(let s of _r()){if(s===t)continue;let d=Ut(s),{offset:m,longName:B}=Gt(s,e),Ie={value:s,label:`${d} - ${B} (${m})`},le=Vr(s);if(le==="Other")continue;let we=n.get(le);we?we.push(Ie):n.set(le,[Ie])}for(let s of n.values())s.sort((d,m)=>d.label.localeCompare(m.label));let a=Array.from(n.entries()).sort(([s],[d])=>s.localeCompare(d)).map(([s,d])=>({label:s,items:d}));return[{label:"Suggested",items:[l]},...a]}function Te(e,t){if(typeof e=="number")return e;let n=t??Re(),r=e.trim().toLowerCase();if(r.startsWith("current")){let o=r.match(/^current([+-])(\d+)$/);if(o){let[,i,l]=o,a=parseInt(l,10);if(!isNaN(a))return i==="+"?n+a:n-a}return n}return Mr.test(r)?parseInt(r,10):n}function Jt(e,t){if(!e)return"";try{let n=Yt(e,t,Kt);return $t(n)?Xt(n,"yyyy-MM-dd"):""}catch{return""}}function Qt(e,t){if(!e)return"";try{let n=Yt(e,t,Kt);return $t(n)?Xt(n,"HH:mm:ss"):""}catch{return""}}function he(e){return e.advanced?.format??"HH:mm"}function jt(e){return e.advanced?.format??"MMMM d, yyyy"}var Hr={es:{"(Optional)":"(Opcional)","Add item":"A\xF1adir elemento","An unexpected error occurred submitting the form.":"Ocurri\xF3 un error inesperado al enviar el formulario.","Collapse {label} {index}":"Contraer {label} {index}","Expand {label} {index}":"Expandir {label} {index}","Please correct the errors and try again.":"Corrige los errores e int\xE9ntalo de nuevo.","Remove {label} item {index}":"Eliminar {label} {index}","There were validation errors submitting the form.":"Se encontraron errores de validaci\xF3n al enviar el formulario.","Unknown error":"Error desconocido",No:"No",Yes:"S\xED"}};function K(e,t){return b(e,t)}function tn(e,t){let n=t?.[e??""],r=e?Hr[Gr(e)]:void 0;return r?n?{...r,...n}:r:n}function Gr(e){return e.toLowerCase().split(/[-_]/)[0]}function b(e,t){return e?t?t[e]??e:e:""}function w(e,t){return e?b(e,t):void 0}function W(e,t){if(!t)return e;let n=!1,r=e.map(o=>{let i=Ur(o,t);return i!==o&&(n=!0),i});return n?r:e}function Ur(e,t){if(!u(e))return e;let n=en(e.label,t),r=e.items;if(Array.isArray(r)){let i=W(r,t);return i===r&&n===e.label?e:{...e,...n!==void 0&&{label:n},items:i}}let o=en(e.description,t);return n===e.label&&o===e.description?e:{...e,...n!==void 0&&{label:n},...o!==void 0&&{description:o}}}function en(e,t){return c(e)?b(e,t):e}var Z=Re();function $r(e,t){if(N(e))return Yr(e,t?.lang)}function Yr(e,t){if(wt(e))return be(t);if(Et(e))return ye(t)}function Xr(e,t){if(T(e))return Kr(e,t)}function Kr(e,t){let{lang:n,translations:r}=t??{};if(St(e))return be(n);if(Nt(e))return ye(n);if(vt(e)){let o=e.advanced?.length?.min??Z,i=e.advanced?.length?.max??Z+5;return Zt(Te(o,Z),Te(i,Z))}if(It(e))return qt();if(Ft(e))return W([{value:"true",label:"Yes"},{value:"false",label:"No"}],r)}function nn(e,t=!1,n){let r={disabled:t,id:e.name,name:e.name,placeholder:e.placeholder,required:e.required};return Lt(e)?{...r,...Wr(e)}:T(e)?{...r,...rn(Xr(e,n))}:Ot(e)?{...r,...qr(e)}:N(e)?{...r,...Zr(e,n)}:r}function Wr(e){let t=At(e.type),n={...e,type:t};return{...Qr(e),...on(e),...Jr(n),...Dt(n)?ln(n):{},type:t}}function rn(e){return e?{options:e}:{}}function Zr(e,t){let n=rn($r(e,t)),r=e.advanced?.multiple??!0;return{...n,multiple:r}}function qr(e){return{...on(e),...ln(e)}}function on(e){let t=e.advanced?.autocomplete;return t?{autoComplete:t}:{}}function Jr(e){return Pt(e)?jr(e):{}}function Qr(e){if(me(e)){let t=he(e);return{step:t==="HH:mm:ss"||t==="hh:mm:ss a"?"1":"60"}}return{}}function ln(e){return an(e,{min:dt,max:st})}function jr(e){return an(e,{min:ct,max:at})}function an(e,t){let n={},r=e.advanced?.length;return r&&(r.min!==void 0&&(n[t.min]=r.min),r.max!==void 0&&(n[t.max]=r.max)),n}function sn(e,t){let n=pe(e);return n||_t(e,t)}function eo(e,t){let n=u(t)&&e.name in t?t[e.name]:t,r=Tt(n,e.advanced?.entity),o=I(r)?r:e.defaultValue;return me(e)&&I(o)?to(e,o):kt(e)&&I(o)?io(e,o):o}function to(e,t){let n=he(e);return c(t)?Qt(t,n):t}function no(e,t,n){return ge(e)&&Array.isArray(n)?{...t,[G]:n}:t}function ro(e,t,n){if(e.required&&!I(n)&&T(e)&&e.advanced?.preselected!==!1&&G in t){let r=t[G];if(Array.isArray(r)&&r.length===1)return r[0]}return n}function oo(e,t,n){if(ge(e)&&Array.isArray(t)){let r=ht(t,e.advanced?.options);return Ht(e)?W(r,n):r}return t}function cn(e,t,n,r,o){let i=eo(e,r),l=Array.isArray(n)?oo(e,n,o):n,a=no(e,t,l),s=ro(e,a,i);return{commonPropsWithOptions:a,defaultValue:s}}function dn(e,t){return y(e)?{defaultChecked:I(t)}:{defaultValue:t}}function io(e,t){let n=jt(e);return c(t)?Jt(t,n):t}var lo=/^#\/definition\//;function J(e=[],t){let n=q(e,t);return Array.isArray(n)?n.filter(so).sort((r,o)=>un(r)-un(o)):[]}function q(e,t,n=new Map,r=new WeakSet){if(!ao(t)||!e||typeof e!="object")return e;if(n.has(e))return n.get(e);if(r.has(e))return e;if(r.add(e),Array.isArray(e))return e.map(i=>q(i,t,n,r));if(S in e&&c(e[S])){let i=e[S].replace(lo,""),l=x(t,i);return l!==null?q(l,t,n,r):e}let o={};for(let[i,l]of Object.entries(e))o[i]=q(l,t,n,r);return r.delete(e),n.set(e,o),o}function fn(e){return Object.entries(e??{})}function un(e){return e.order??Number.MAX_VALUE}function ao(e){return e!==void 0&&u(e)&&Object.keys(e).length>0}function so(e){return ut in e?!0:Array.isArray(e[se])?e[se].length>0:!0}function mn(e,t){let n={};for(let[r,o]of fn(t))n[`${e}-${r}`]=o;return n}function co(e){return mn(it,e)}function uo(e){return mn(lt,e)}function gn(e,t){let n=co(e.advanced?.aria);return t&&t.length>0&&(n[nt]="true",n[tt]=`${e.name}-error`),n}function pn(e){return uo(e.advanced?.data)}var xn={1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3"},yn={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3"};function bn(e,t=2){return xn[e&&e in xn?e:t]}function Rn(e){if(e&&e in yn)return yn[e]}function fo(e,t){let n=e.advanced?.length?.min??1;if(t){let r=x(t,e.name);if(Array.isArray(r))return Math.max(r.length,n)}return Math.max(n,0)}function Tn(e){return!Array.isArray(e.fields)||e.fields.length===0?!1:e.fields.length>1||e.fields[0].type===k}function hn(e,t){let n=fo(e,t);return Array.from({length:n},(r,o)=>o)}function An(e){return e.advanced?.title??e.label??e.name}function Q(e,t){return{...e,...t}}import{jsx as mo}from"react/jsx-runtime";function R(e){return Ct(e,(t,n,r)=>mo("a",{className:"underline",href:n,rel:"noopener noreferrer",target:"_blank",children:r},`${n}-${t}`))}import{useCallback as go,useState as po}from"react";import{jsx as P,jsxs as Ae}from"react/jsx-runtime";function Cn(e){let{fields:t=[]}=e.section,[n,r]=po(!1),o=go(()=>r(i=>!i),[]);return Ae("fieldset",{"data-slot":"field-set","data-advanced":"true","data-expanded":n,"data-empty":t.length===0,className:"flex flex-col",id:e.section.id?.toString(),children:[P("legend",{children:Ae("button",{className:"flex cursor-pointer items-center gap-2 text-base font-medium text-zinc-600 dark:text-zinc-400",onClick:o,type:"button",children:[P(F,{expanded:n}),P("span",{children:R(e.title)})]})}),P(E,{visible:n,children:Ae("div",{className:"mt-3 ml-1.5 flex flex-col gap-4 border-l-2 border-zinc-300 pl-4 dark:border-zinc-600","data-slot":"field-set-content",children:[e.description&&P("p",{className:"text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:R(e.description)}),e.group]})})]})}import{jsx as j,jsxs as Fn}from"react/jsx-runtime";function Sn(e){let t=Fn("div",{className:"flex flex-col",children:[e.title&&j("legend",{className:"mb-3 font-medium text-zinc-800 dark:text-zinc-200",children:R(e.title)}),e.description&&j("p",{className:"-mt-2 text-sm leading-normal font-normal text-zinc-600 dark:text-zinc-400",children:R(e.description)})]});return e.step?Fn("div",{className:"flex flex-row items-start gap-4",children:[j("div",{className:"bg-primary text-primary-foreground flex size-6 shrink-0 items-center justify-center rounded-full",children:j("span",{className:"text-sm font-bold",children:e.step})}),t]}):t}import{jsx as Nn,jsxs as xo}from"react/jsx-runtime";function ee(e){return xo("fieldset",{className:"flex w-full min-w-0 flex-col data-[empty=false]:gap-6","data-empty":e.empty,"data-slot":"field-set",id:e.id,children:[Nn(Sn,{description:e.description,step:e.step,title:e.title}),Nn("div",{className:"w-full min-w-0",children:e.children})]})}import{jsx as yo}from"react/jsx-runtime";function h(e){return yo("div",{"data-slot":"field-group","data-compact":e.compact,className:"flex w-full flex-col gap-8 data-[compact=true]:gap-3",children:e.children})}import{jsx as Ce}from"react/jsx-runtime";function vn(e){let{fields:t=[]}=e.section,n=e.advanced?.step?e.step:void 0,{compact:r}=Q(e.style,{compact:e.section.advanced?.compact}),o=Ce(h,{compact:r,children:e.children});if(!e.section.title&&!e.section.description)return o;let i=w(e.section.title,e.translations),l=w(e.section.description,e.translations);return e.section.advanced?.collapsible?Ce(Cn,{description:l,group:o,section:e.section,title:i}):Ce(ee,{description:l,empty:t.length===0,id:e.section.id?.toString(),step:n,title:i,children:o})}import{jsx as In}from"react/jsx-runtime";function wn(){return In("div",{"data-slot":"field-separator",className:"relative -my-2 h-5 text-sm",children:In("div",{className:"absolute inset-0 top-1/2 h-px w-full bg-zinc-200 dark:bg-zinc-800"})})}import{useAtomValue as Fo}from"jotai";import{atom as M}from"jotai";import{atomFamily as bo}from"jotai-family";import{deepEqual as En}from"fast-equals";function Ro(e,t){let{[t]:n,...r}=e;return r}function To(e){return bo(t=>M(n=>n(e)[t]??void 0,(n,r,o)=>{let i=n(e);if(o!=null){let l=i[t];En(l,o)||r(e,{...i,[t]:o})}else t in i&&r(e,Ro(i,t))}))}function ho(e){return M(null,(t,n)=>{let r=t(e);r&&Object.keys(r).length>0&&n(e,{})})}function Ao(e){return M(null,(t,n,r)=>{let i={...t(e)},l=!1;for(let a of r)a in i&&(delete i[a],l=!0);l&&n(e,i)})}function Co(e){return M(null,(t,n,r)=>{let o=t(e);En(o,r)||n(e,r)})}function te(e={}){let t=M(e);return{atom:t,clearAll:ho(t),clear:Ao(t),bulkReport:Co(t),report:To(t)}}var kn=te(),Ln=kn.atom,On=kn.report;function So(e,t){return e.fields.every(n=>Dn(n,t))}function Dn(e,t){return t[e.name]?.hidden??e.hidden??!1}function No(e,t){return v(e)?So(e,t):Dn(e,t)}function Pn(e){let t=Fo(Ln);return e.container&&(t[e.container.name]?.hidden??e.container.hidden??!1)||e.fields.length===0||e.fields.every(r=>No(r,t))?null:e.children}import{jsx as _,jsxs as Mn}from"react/jsx-runtime";function _n(e){let t=J(e.sections,e.definition);return _("div",{className:"h-full w-full",children:_("form",{noValidate:e.noValidate,action:e.action,children:Mn(h,{children:[t.map((n,r)=>Mn(Pn,{fields:n.fields??[],children:[_(vn,{advanced:e.advanced,section:n,step:r+1,style:e.config.style,translations:e.translations,children:e.children({disabled:e.readOnly,fields:n.fields})}),n.advanced?.separator&&_(wn,{})]},`key-${n.id}-${r}`)),e.control&&_(Ee,{isPending:e.isPending,children:e.control})]})})})}import{jsx as vo}from"react/jsx-runtime";function zn(e){return vo("p",{className:"-mt-2 text-xs leading-normal font-normal text-zinc-600 dark:text-zinc-400 [[data-slot=column]_&]:md:line-clamp-2",title:e.title,children:e.children})}import{useState as Io}from"react";import{jsx as Vn,jsxs as Bn}from"react/jsx-runtime";function ne(e){let t={context:e.context,env:e.config?.env,value:e.value},r={locale:e.config?.env?.locale},[o,i]=Io(()=>u(e.text)&&"collapsed"in e.text?!e.text.collapsed:!0),l=()=>i(m=>!m),a=u(e.text)&&c(e.text.title)?R(b(D(e.text.title,t,r),e.translations)):void 0,s=b(D(c(e.text)?e.text:e.text?.message,t,r),e.translations),d=R(s);return d?Bn("div",{className:"flex flex-col gap-2",children:[a&&Bn("button",{className:"flex items-center gap-1 text-left text-xs font-medium text-zinc-700 hover:text-zinc-900 dark:text-zinc-300 dark:hover:text-zinc-100",onClick:l,type:"button",children:[a,Vn(F,{expanded:o})]}),o&&Vn(zn,{title:s,children:d})]}):null}import{atom as Hn}from"jotai";var re=te(),oa=re.atom,ia=re.clearAll,la=re.clear,Gn=re.report,aa=Hn({}),sa=Hn(null);import{useAtomValue as Un}from"jotai";import{jsx as wo}from"react/jsx-runtime";function oe(e){let t=Un(Gn(e.field.name)),r=Un(On(e.field.name))?.description??e.field.description;return wo(ne,{config:e.config,context:e.context,text:r,translations:e.translations,value:t})}import{twMerge as Eo}from"tailwind-merge";import{jsx as $n,jsxs as ko}from"react/jsx-runtime";function Yn(e){let t=e.style?.showOptionalLabel??!0,n=C(e.field)||y(e.field);return ko("label",{"data-slot":"field-label","data-normal":n,className:Eo("flex w-fit items-center text-sm leading-snug font-medium select-none","data-[normal=true]:font-normal [[data-slot=column]_&]:md:w-full","group-data-[readonly=true]:cursor-not-allowed group-data-[readonly=true]:opacity-50"),htmlFor:e.field.name,title:c(e.children)?e.children:void 0,children:[$n("span",{className:"[[data-slot=column]_&]:md:truncate",children:e.children}),t&&!e.field.required&&$n("span",{className:"ml-2 flex-shrink-0 text-sm text-zinc-600 dark:text-zinc-400",children:K("(Optional)",e.translations)})]})}import{jsx as Xn,jsxs as Lo}from"react/jsx-runtime";function Kn(e){let t={context:e.context,env:e.config?.env},n=D(e.field.label,t);return Lo("div",{"data-slot":"field-content",className:"flex w-full flex-1 flex-col gap-1.5 leading-snug",children:[Xn(Yn,{field:e.field,style:e.config?.style,translations:e.translations,children:b(n,e.translations)}),e.horizontal===!0&&Xn(oe,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}import{Fragment as Oo,jsx as Wn,jsxs as Do}from"react/jsx-runtime";function Zn(e){return Do(Oo,{children:[e.field.name&&e.field.label&&Wn(Kn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations}),e.children,e.horizontal===!1&&Wn(oe,{config:e.config,context:e.context,field:e.field,translations:e.translations})]})}function qn(e,t){return e?t(e):null}import{jsx as Jn}from"react/jsx-runtime";function Qn(e){let t=sn(e.field,e.value),{commonPropsWithOptions:n,defaultValue:r}=cn(e.field,e.commonProps,t,e.value,e.translations),o=dn(e.field,r);return qn(e.config.inputs[e.field.type],i=>Jn(Zn,{config:e.config,context:e.context,field:e.field,horizontal:e.horizontal,translations:e.translations,children:Jn(i,{...e.ariaAttributes,...n,...e.dataAttributes,...o})}))}import{jsx as jn}from"react/jsx-runtime";function er(e){return!e.errors||e.errors.length===0?null:jn("ul",{className:"text-sm text-red-600 dark:text-red-500",id:e.name?`${e.name}-error`:void 0,children:e.errors?.map((t,n)=>jn("li",{children:t},e.name?`${e.name}-error-${n}`:n))})}import{twMerge as Po}from"tailwind-merge";import{jsx as Mo}from"react/jsx-runtime";function ie(e){let t=e.errors&&e.errors.length>0;return Mo("div",{"data-slot":"field","data-clickable":e.isClickable?"true":"false",...t&&{[rt]:"true"},...e.disabled&&{[ot]:"true"},"data-orientation":e.orientation,className:Po("group flex w-full flex-col items-center data-[invalid=true]:text-red-600 data-[invalid=true]:dark:text-red-500","data-[clickable=true]:items-start",e.isCheckbox&&(e.isReversed?"flex-row-reverse!":"flex-row!"),"data-[clickable=true]:has-[>[data-slot=field-content]]:[&>:first-child]:mt-px",e.className),children:e.children})}import{twMerge as _o}from"tailwind-merge";import{jsx as zo}from"react/jsx-runtime";function tr(e){return zo(ie,{...e,orientation:"vertical",className:_o("gap-3 has-[>[data-slot=field-content]]:items-start",!e.isClickable&&"[&>*]:w-full"),children:e.children})}import{twMerge as Vo}from"tailwind-merge";import{jsx as Bo}from"react/jsx-runtime";function nr(e){return Bo(ie,{...e,orientation:"horizontal",className:Vo("gap-2 md:flex-row md:gap-4","[&>[data-slot=field-content]]:min-w-0 [&>[data-slot=field-content]]:flex-grow [&>[data-slot=field-content]]:self-start","[&_[role=checkbox]]:mt-[1.5px]",e.isClickable&&"md:flex-col",!e.isClickable&&["md:justify-between","[&>*:not([data-slot=field-content])]:w-full","[&>*:not([data-slot=field-content])]:md:w-1/2","[&>*:not([data-slot=field-content])]:xl:w-2/5"]),children:e.children})}import{jsx as rr}from"react/jsx-runtime";function or(e){let t=Mt(e.field),n=y(e.field),r=Vt(e.field);return e.horizontal?rr(nr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children}):rr(tr,{disabled:e.disabled,errors:e.errors,isCheckbox:n,isReversed:r,isClickable:t,children:e.children})}function ir(e){if(!e.field.type)return null;let t=nn(e.field,e.disabled,{lang:e.lang,translations:e.translations}),n=pn(e.field),r=gn(e.field,e.errors),o={...e.field,disabled:t.disabled};return e.children({ariaAttributes:r,commonProps:t,dataAttributes:n,field:o,horizontal:e.horizontal})}import{twMerge as Ho}from"tailwind-merge";import{jsx as Fe,jsxs as Go}from"react/jsx-runtime";function lr(e){let t=e.field.advanced?.cols,n=e.field.name?e.errors?.[e.field.name]:void 0,{horizontal:r}=Q(e.style,{horizontal:zt(e.field)}),o=Bt(e.field,e.disabled);return Go("div",{className:Ho("flex flex-col gap-3",Rn(t)),children:[Fe(or,{disabled:o,errors:n,field:e.field,horizontal:r,children:Fe(ir,{disabled:o,errors:n,field:e.field,horizontal:r,lang:e.lang,translations:e.translations,children:e.children})}),Fe(er,{errors:n,name:e.field.name})]})}import{twMerge as Se}from"tailwind-merge";import{useState as Uo}from"react";import{Fragment as $o,jsx as g,jsxs as A}from"react/jsx-runtime";function ar(e){let t=e.isMultiField||e.collapsed!=null,[n,r]=Uo(t?!e.collapsed:!0);function o(){e.canRemove&&e.onRemove&&e.onRemove(e.index)}function i(){r(m=>!m)}let l=m=>O(K(m,e.translations),{index:e.index+1,label:e.label}),a=e.canRemove&&e.onRemove!=null&&g("button",{"aria-label":l("Remove {label} item {index}"),className:Se("flex size-6 items-center justify-center rounded text-xl leading-none text-zinc-400","transition-colors duration-150","hover:text-red-500","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500 dark:hover:text-red-400"),onClick:o,type:"button",children:g("span",{"aria-hidden":"true",className:"leading-none",children:"\xD7"})}),s=A("div",{className:"flex min-w-0 flex-col font-medium text-zinc-700 dark:text-zinc-400",children:[g("span",{className:"text-base",children:e.previewLabel??A($o,{children:[e.label," ",e.index+1]})}),!n&&e.previewTags&&g("div",{className:"flex items-center gap-2 overflow-hidden text-xs font-normal text-ellipsis whitespace-nowrap text-zinc-500 dark:text-zinc-500",children:e.previewTags})]}),d=A("div",{className:Se("flex items-center justify-between gap-2",e.isMultiField&&n&&"mb-3"),children:[t?A("div",{className:"flex min-w-0 grow items-center gap-2",children:[A("button",{"aria-expanded":n,"aria-label":l(n?"Collapse {label} {index}":"Expand {label} {index}"),className:Se("group flex grow items-center gap-2 rounded p-1 text-left text-zinc-400","focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:outline-none","dark:text-zinc-500"),onClick:i,type:"button",children:[g(F,{expanded:n}),s]}),!n&&e.previewBadge&&g("div",{className:"ml-auto shrink-0",children:e.previewBadge})]}):s,a]});return e.isMultiField?A("div",{"data-slot":"list-item-card",className:"box-border w-full min-w-0 rounded-lg border border-zinc-100 p-4 dark:border-zinc-900",children:[d,g(E,{visible:n,children:g(h,{children:e.children})})]}):t?A("div",{className:"box-border flex w-full min-w-0 flex-col gap-2",children:[d,g(E,{visible:n,children:g(h,{children:e.children})})]}):A("div",{className:"box-border flex w-full min-w-0 items-start gap-2",children:[g("div",{className:"flex min-w-0 grow flex-col",children:g(h,{children:e.children})}),a&&g("div",{className:"shrink-0",children:a})]})}import{jsx as Yo}from"react/jsx-runtime";function sr(e){let t=b(An(e.field),e.translations),n=Tn(e.field);return hn(e.field,e.value).map(r=>Yo(ar,{collapsed:e.field.advanced?.collapsed,index:r,isMultiField:n,label:t,translations:e.translations,children:e.children(r)},r))}import{jsx as Xo}from"react/jsx-runtime";function cr(e){let t=Array.isArray(e.field.fields)&&e.field.fields.length===0,n=w(e.field.label,e.translations),r=w(e.field.description,e.translations);return Xo(ee,{description:r,empty:t,id:e.field.name,title:n,children:e.children})}import{jsx as dr}from"react/jsx-runtime";function ur({children:e,field:t,lang:n,translations:r,value:o}){return dr(cr,{field:t,translations:r,children:dr(sr,{field:t,lang:n,translations:r,value:o,children:e})})}import{twMerge as Ko}from"tailwind-merge";import{jsx as fr,jsxs as Wo}from"react/jsx-runtime";function mr(e){let t=bn(e.column?.advanced?.cols);return Wo("div",{className:"flex w-full flex-col gap-4",children:[fr("div",{"data-slot":"column",className:Ko("grid grid-cols-1 gap-3 sm:gap-4",t),children:e.children}),e.column?.description&&fr(ne,{config:e.config,context:e.context,text:e.column.description,translations:e.translations})]})}import{Fragment as qo}from"react";import{jsx as Zo}from"react/jsx-runtime";function gr(e){let t=Array.isArray(e.field.fields)?e.field.fields.map(n=>X(n)||Y(n)?{...n,name:`${e.field.name}.${e.index}.${n.name}`}:v(n)?{...n,fields:n.fields.map(r=>({...r,name:`${e.field.name}.${e.index}.${r.name}`}))}:n):[];return Zo(z,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,fields:t,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})}import{jsx as V,jsxs as Jo}from"react/jsx-runtime";function z(e){let{field:t,list:n}=e.components;return J(e.fields).map((r,o)=>Jo(qo,{children:[v(r)&&V(mr,{column:r,config:e.config,context:e.context,translations:e.translations,children:V(z,{...e,fields:r.fields})}),X(r)&&V(t,{disabled:e.disabled,field:r,lang:e.lang,style:e.style,translations:e.translations,children:e.children}),Y(r)&&V(n,{field:r,lang:e.lang,onValueChange:e.onValueChange,translations:e.translations,value:e.value,children:i=>V(gr,{components:e.components,config:e.config,context:e.context,disabled:e.disabled,field:r,index:i,lang:e.lang,onValueChange:e.onValueChange,style:e.style,translations:e.translations,value:e.value,children:e.children})})]},o))}import{jsx as Qo}from"react/jsx-runtime";function pr(e){return n=>Qo(z,{...n,components:e})}var xr=pr({field:lr,list:ur});import{jsx as Ne}from"react/jsx-runtime";function ve(e){let t=tn(e.lang,e.translations);return Ne(_n,{advanced:e.advanced,config:e.config,control:e.children,definition:e.definition,readOnly:e.readOnly,sections:e.sections,translations:t,children:({disabled:n,fields:r})=>Ne(xr,{config:e.config,context:e.context,disabled:n,fields:r,lang:e.lang,style:e.config.style,translations:t,value:e.value,children:o=>Ne(Qn,{...o,config:e.config,context:e.context,translations:t,value:e.value})})})}import{Suspense as jo}from"react";import{jsx as yr}from"react/jsx-runtime";function ei(e){return yr(jo,{fallback:yr(ve,{config:e.config,sections:e.sections,readOnly:!0}),children:e.children})}export{ei as Fallback,ve as Form};
@@ -176,6 +176,28 @@ export type Field = CommonProps & {
176
176
  entity?: string;
177
177
  horizontal?: boolean;
178
178
  reverse?: boolean;
179
+ /**
180
+ * Marks a field that fires its change events and keeps nothing of its own:
181
+ * not stored, and never reported to the consumer.
182
+ *
183
+ * For a control whose whole job is to act on *another* field -- a button
184
+ * that adds a row, a picker that fills a sibling. Without it the emitter
185
+ * also saves whatever it emitted, so a value the user can neither see nor
186
+ * edit ends up in the submitted form and in whatever the consumer
187
+ * persists.
188
+ *
189
+ * Three consequences to know before reaching for it. The field shows
190
+ * nothing back, because there is no value to show -- put it on a visible
191
+ * text input and the typing will not stick. Choosing the same value twice
192
+ * in a row fires twice, where an ordinary field swallows the second as a
193
+ * no-op: for a command that is the point, since pressing a button again is
194
+ * meant to do the thing again. And it does not go with `required` or
195
+ * `validation`, which would demand a value that by definition never
196
+ * arrives and block the submit with nothing on screen to explain it --
197
+ * nothing stops you writing that pair, so this note is the only thing
198
+ * standing between you and an afternoon.
199
+ */
200
+ transient?: boolean;
179
201
  };
180
202
  defaultValue?: Value;
181
203
  event?: {
@@ -5,8 +5,35 @@ export type InterpolateOptions = {
5
5
  * Replaces placeholders in the format {key} with values from the provided object.
6
6
  * Supports nested objects using dot notation (e.g., {user.id}) and pipe filters
7
7
  * (e.g., {price | currency:USD}).
8
+ *
9
+ * Gives back what it was given: a string stays a string, an object of templates
10
+ * stays an object of the same shape. Callers that want the *value* behind a
11
+ * placeholder rather than the text of it want {@link interpolateValue}.
8
12
  */
9
13
  export declare function interpolate<T>(template: T, values?: Record<string, unknown>, options?: InterpolateOptions): T;
14
+ /**
15
+ * Interpolates a template that stands for a *value* rather than for text.
16
+ *
17
+ * Identical to {@link interpolate} but for one case: a template that is nothing
18
+ * but a placeholder -- `{value}`, not `a {value}` and not
19
+ * `{value | currency:USD}` -- gives back the object or array behind it as it
20
+ * is, instead of the text of it.
21
+ *
22
+ * That case has no text to produce, and `interpolate` leaves the placeholder
23
+ * standing, so `{ "rows": "{value}" }` writes the literal `"{value}"`. Which is
24
+ * what makes a target declared as `Array<Record<string, unknown>>` unreachable
25
+ * from a definition.
26
+ *
27
+ * Kept apart from `interpolate` rather than folded into it because
28
+ * `interpolate` promises to give back what it was given, and three of its four
29
+ * callers depend on that -- a url, a request body, a preview label. Only a
30
+ * `value` event asks for data, and the consumer it hands the result to already
31
+ * takes `unknown`.
32
+ *
33
+ * Only the template as a whole is considered: a placeholder *inside* something
34
+ * longer is still text, wherever it appears.
35
+ */
36
+ export declare function interpolateValue(template: unknown, values?: Record<string, unknown>, options?: InterpolateOptions): unknown;
10
37
  export declare function interpolateIfNeeded<T>(template: T, values?: Record<string, unknown>, options?: InterpolateOptions): T;
11
38
  export declare function isInterpolated(template: unknown): boolean;
12
39
  export declare function formatMarkdown<K>(text?: string, callback?: (index: number, url: string, text?: string) => K): (string | K)[] | string | null;
@@ -0,0 +1,41 @@
1
+ import type { MountedList } from './list-store';
2
+ import type { Nullable } from '../../../../luna-core/index';
3
+ export declare function itemKey(listName: string, stableId: number, leafName: string): string;
4
+ /**
5
+ * The three places a leaf can be found, declared in the order they are tried.
6
+ *
7
+ * They travel together because they are one thing -- where values come from --
8
+ * and because none of them changes as `composeListValue` descends: only the
9
+ * list being read does. Passing them as one argument is what keeps the
10
+ * recursion from carrying the same three the whole way down.
11
+ */
12
+ export type ValueSources = {
13
+ /**
14
+ * The lists on screen, by name, already read out of the store.
15
+ *
16
+ * The record rather than a lookup function, on purpose: reading the atom per
17
+ * leaf instead of once per call cost more than everything else here put
18
+ * together (46.59us against 13.80us for ten groups of five rules). Reading
19
+ * it once is also no less correct -- this traversal is synchronous, so there
20
+ * is no point at which the registry could change underneath it.
21
+ */
22
+ mounted: Record<string, MountedList>;
23
+ /** The flat value atom, keyed by stable id. */
24
+ values: Record<string, unknown>;
25
+ /** The value the list was mounted with, if it had one. */
26
+ initial?: Nullable<Record<string, unknown>>;
27
+ };
28
+ /**
29
+ * Reads a list back out of the flat value atom, as the rows a consumer is
30
+ * given. Where each leaf comes from is `readLeaf`; the two recurse into each
31
+ * other, so a list nested two deep reads back the same way.
32
+ *
33
+ * Every leaf is written down, including the ones worth `undefined`. That is
34
+ * the shape `toListValue` normalises an incoming assignment to before
35
+ * comparing, and a row that spelled out only the leaves it had would compare
36
+ * unequal to an identical row already stored.
37
+ *
38
+ * @param listName - The list's name, already carrying its ancestors' stable
39
+ * ids (`rules.0.rule`), which is what makes the keys unambiguous.
40
+ */
41
+ export declare function composeListValue(listName: string, { items, leafNames }: MountedList, sources: ValueSources): Array<Record<string, unknown>>;
@@ -0,0 +1,19 @@
1
+ export declare const pendingListRowsAtom: import("jotai").PrimitiveAtom<Record<string, Record<string, unknown>[]>> & {
2
+ init: Record<string, Record<string, unknown>[]>;
3
+ };
4
+ export declare const reportPendingListRowsAtom: import("jotai-family").AtomFamily<string, import("jotai").WritableAtom<Record<string, unknown>[] | undefined, [newValue: Record<string, unknown>[] | undefined], void>>;
5
+ /**
6
+ * What a list on screen is holding: the stable ids of its live rows, in the
7
+ * order they are shown, and the name of every leaf a row owns.
8
+ *
9
+ * Enough to read the list back out of the flat value atom, which is the whole
10
+ * reason it is published. See `composeListValue`.
11
+ */
12
+ export type MountedList = {
13
+ items: readonly number[];
14
+ leafNames: readonly string[];
15
+ };
16
+ export declare const mountedListsAtom: import("jotai").PrimitiveAtom<Record<string, MountedList>> & {
17
+ init: Record<string, MountedList>;
18
+ };
19
+ export declare const reportMountedListAtom: import("jotai-family").AtomFamily<string, import("jotai").WritableAtom<MountedList | undefined, [newValue: MountedList | undefined], void>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-luna-form",
3
- "version": "0.0.78",
3
+ "version": "0.0.80",
4
4
  "description": "A React library for building forms based on JSON",
5
5
  "main": "./dist/client/cjs/index.js",
6
6
  "module": "./dist/client/esm/index.js",
@@ -33,8 +33,8 @@
33
33
  "@types/react-dom": "19.2.4",
34
34
  "eslint-plugin-react": "7.37.5",
35
35
  "eslint-plugin-react-hooks": "7.1.1",
36
- "eslint-plugin-react-refresh": "0.5.3",
37
- "@luna-form/core": "0.0.78"
36
+ "eslint-plugin-react-refresh": "0.5.4",
37
+ "@luna-form/core": "0.0.80"
38
38
  },
39
39
  "license": "Apache-2.0",
40
40
  "repository": {