PageSourceSearch

https://denmark.dk/dist/assets/index-BJ7Xl7eU.js

js denmark.dk collected 2026-10-02 02:30:14 UTC 4,575 bytes, 1 lines download raw bytes

1import{R as T,r as F,j as e}from"./main-react-CFd9PtBB.js";import{c as J,C as B,u as G,F as H,a as Z,b as K,g as L,s as Q}from"./index-CwWl34Fz.js";import{a as _,E as X}from"./api-fetcher-CICcxupP.js";import{F as h,a as A}from"./index-4zeMR2ST.js";import{L as Y}from"./index-DmizOqwa.js";const P=(s,r,o)=>{const f=Array.isArray(o)?J(o):[o];return s.alias&&s.fieldTypeId===h.HoneyPot&&r[s.alias]===""?[]:f},ee=s=>{const r=s;return Object.hasOwn(r,"errors")&&Object.hasOwn(r,"status")&&Object.hasOwn(r,"title")&&Object.hasOwn(r,"type")},se=s=>s.replace(/^\w|[A-Z]|\b\w/g,(r,o)=>o===0?r.toLowerCase():r.toUpperCase()).replace(/\s+/g,""),I=T.forwardRef(({error:s,errorMessage:r,name:o,onCheckedChange:f,mandatory:p,...d},b)=>{const{formConsent:n}=F.useContext(y);return e.jsxs("div",{className:"form-field form-field__data-consent",children:[e.jsx("div",{className:"form-field__data-consent-wrapper",children:e.jsx(Y,{children:e.jsxs("div",{className:"form-field__data-consent-inner-wrapper",children:[e.jsx(B,{ref:b,name:o,...d,onCheckedChange:f,checked:d.value,mandatory:p,value:o,className:"form-field__checkbox"}),e.jsxs("span",{children:[p&&"* ",e.jsx(w,{...n})]})]})})}),s&&r&&e.jsx(A,{children:r})]})}),w=({termsLink:s,termsText:r})=>e.jsxs(e.Fragment,{children:[r," ",s&&e.jsx("a",{href:s.url,...s.target&&{target:s.target},className:"link-default",children:s.name})]}),ne=Object.freeze(Object.defineProperty({__proto__:null,FormConsent:I,FormConsentText:w,default:I},Symbol.toStringTag,{value:"Module"})),y=F.createContext({}),re=s=>{const{formId:r,requestToken:o,culture:f,mailFrom:p,translations:d,formConsent:b}=s,n=G(),[c,R]=T.useState(null),[O,g]=T.useState(!1),{getUmbracoPublifyFormById:$,submitUmbracoPublifyForm:C}=X,E=n.formState.isSubmitSuccessful,N=n.formState.isSubmitting,k=!!(c!=null&&c.redirectUrl)&&(c==null?void 0:c.redirectUrl)!=="",q=!E||k;if(F.useEffect(()=>{_(`${$}${r}`).then(i=>{R(i)})},[]),!c)return e.jsx("div",{className:"form__loading-container",children:e.jsx("p",{children:d.loadingForm})});const{title:v,buttonText:M,confirmationText:U,redirectUrl:x,contentProperties:j}=c,W=j.some(i=>i.fieldTypeId===h.DataConsent),V=async({data:i})=>{if(E||O)return;const z=j.some(a=>a.fieldTypeId===h.File),D=j.reduce((a,t)=>{if(!t.alias||!t.guid)return console.error("Missing guid or alias",t),a;const l=i[t.alias];return l==null||t.fieldTypeId===h.Label||t.fieldTypeId===h.File||a.push({alias:t.alias,guid:t.guid,values:P(t,i,l)}),a},[]);try{if(z){const a=new FormData;a.append("FormId",r.toString()),a.append("MailFrom",p),a.append("Culture",f),j.forEach(l=>{var m;if(l.fieldTypeId===h.File){const u=(m=document.querySelector("#"+l.alias))==null?void 0:m.files;u!=null&&Array.from(u).forEach(S=>{a.append("files",S)})}}),D.forEach((l,m)=>{a.append(`Data[${m}].Alias`,l.alias),a.append(`Data[${m}].Guid`,l.guid),l.values.forEach((u,S)=>{a.append(`Data[${m}].Values[${S}]`,typeof u=="object"?JSON.stringify(u):String(u))})});const t=await _(C,{method:"POST",body:a,headers:{RequestVerificationToken:o}});x&&t?(g(!0),window.location.href=x):g(!1);return}await _(C,{method:"POST",body:JSON.stringify({formId:r,culture:f,mailFrom:p,Data:D}),headers:{"Content-Type":"application/json; charset=utf-8",RequestVerificationToken:o}}),x&&(g(!0),window.location.href=x)}catch(a){if(ee(a)){const{errors:t}=a;Object.entries(t).forEach(([l,m])=>{n.setError(se(l),{type:"custom",message:m.join(", ")},{shouldFocus:!0})})}else n.setError("root.serverError",{type:"other",message:d.somethingWentWrong})}};return e.jsx(y.Provider,{value:s,children:e.jsxs("div",{children:[v&&e.jsx("h2",{className:"module-headline module-headline--small",children:v}),q?e.jsx(H,{...n,children:e.jsxs(Z,{onSubmit:V,control:n.control,children:[j.map(i=>F.createElement(K,{...i,name:i.alias,rules:L(i,d),key:i.alias,translations:d})),e.jsxs("button",{className:"btn btn--a",type:"submit",disabled:O||N,children:[N&&e.jsx("span",{className:"loader-wrapper","aria-hidden":"true",children:e.jsx("span",{className:"loader"})}),M]}),e.jsx(A,{children:n.formState.errors.root&&e.jsx(Q,{errors:n.formState.errors,name:"root.serverError"})}),d.fieldsWithAsteriskAreRequired&&e.jsx("p",{className:"form-field__description",children:d.fieldsWithAsteriskAreRequired}),!W&&b.termsText&&e.jsx("p",{className:"form-field__description form-field__description--anonymous",children:e.jsx(w,{...b})})]})}):e.jsx("div",{children:e.jsx("p",{children:U})})]})})},de=Object.freeze(Object.defineProperty({__proto__:null,FormContext:y,FormModule:re},Symbol.toStringTag,{value:"Module"}));
1export{de as a,ne as i};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.