PageSourceSearch

https://www.aalborg.dk/_nuxt/Bi0KqFvA2.js

js aalborg.dk collected 2026-09-24 09:32:34 UTC 6,737 bytes, 1 lines download raw bytes

1import{C as e,D as t,Ft as a,It as n,J as s,Pt as l,R as i,Wt as o,ct as c,fn as u,ht as r,it as d,kt as p,tt as f,xt as m}from"./A7A7LHMD.js";import{Dt as h}from"#entry";var v=(e,t={})=>{t={clone:!1,populate:!1,enrichMagicKeys:!1,setDefaultValues:!0,includeList:[],excludeList:[],fetchOptions:{dataAppendage:{},includeList:[],excludeList:[],useNativeFormDataOnPost:!1},...t||{}},(e=t.clone?JSON.parse(JSON.stringify(e||{})):{...e||{}}).title=e.title??"",e.method=e.method??"GET",e.endpointUrl=e.endpointUrl??"",e.fields=e.fields??[],e.labels=e.labels??{},y(e?.fields,t);const s={dataAppendage:{},includeList:[],excludeList:[],useNativeFormDataOnPost:!1,...t.fetchOptions||{}},i=n(e.endpointUrl);if(e={...e,get endpointUrl(){let e=i.value,a={};return t?.enrichMagicKeys&&"object"==typeof t.enrichMagicKeys&&(a=t.enrichMagicKeys,e&&Object.keys(a).forEach(t=>{e=e.replaceAll(`{${t}}`,a[t])})),e},set endpointUrl(e){i.value=e},get fieldByName(){return this.fields?.reduce((e,t)=>(e[t.name]=t,e),{})??{}},get fieldsByName(){return this.fields?.reduce((e,t)=>(e[t.name]=e[t.name]??[],e[t.name].push(t),e),{})??{}},get fieldByType(){return this.fields?.reduce((e,t)=>(e[t.type]=t,e),{})??{}},get fieldsByType(){return this.fields?.reduce((e,t)=>(e[t.type]=e[t.type]??[],e[t.type].push(t),e),{})??{}},async fetch(e=s){e={...s,...e||{}};const t={...e};delete t.dataAppendage,delete t.includeList,delete t.excludeList,delete t.useNativeFormDataOnPost;const a=new FormData;try{if(this.fields.filter(t=>t&&!e.excludeList?.includes?.(t.name)&&!["button","submit"].includes(t.type)).forEach(e=>{e.name&&a.set(e.name,e.value)}),e.includeList?.length)for(const[t]of a.entries())e.includeList?.includes?.(t)||a.delete(t);for(const t in e.dataAppendage)e.excludeList?.includes?.(t)||a.set(t,e.dataAppendage[t]);const n=e.useNativeFormDataOnPost&&["POST","PUT","PATCH"].includes(this.method?.toUpperCase?.())?a:Object.fromEntries(a.entries());if(["GET","DELETE"].includes(this.method?.toUpperCase?.())||!this.method){const e=new URL(this.endpointUrl,"https://example.com");return e.search=new URLSearchParams(n).toString(),await h(e.toString().startsWith("https://example.com")?e.toString().replace("https://example.com",""):e.toString(),{method:this.method||"GET",...t}).then(e=>e).finally(()=>{a.forEach((e,t)=>a.delete(t))})}return await h(this.endpointUrl,{method:this.method,body:n,...t}).then(e=>e).finally(()=>{a instanceof FormData&&a.forEach((e,t)=>a.delete(t))})}catch(n){throw a.forEach((e,t)=>a.delete(t)),n}}},t.includeList?.length)for(const a in e)t.includeList.includes(a)||delete e[a];t.excludeList?.forEach(t=>{delete e[t]});const o=a({});e.fields?.forEach(e=>{e.name&&(o[e.name]=e.value)}),Object.defineProperty(e,"fieldValues",{get(){return this.fields?.forEach(e=>{e.name&&(o[e.name]=e.value)}),o},set(e){"object"==typeof e&&null!==e&&this.fields?.forEach(t=>{t.name&&t.name in e&&(t.value=e[t.name],o[t.name]=e[t.name],t.items&&t.items.forEach(a=>{a.checked=a.value===e[t.name]||e[t.name]?.split(",").includes?.(a.value)}))})},enumerable:!0,configurable:!0});const c=m(o,t=>{e.fieldValues=t});return p()&&l(()=>{c()},!0),e};function y(e,t){let a={};t?.populate&&"object"==typeof t.populate&&(a=t.populate);let n={};t?.enrichMagicKeys&&"object"==typeof t.enrichMagicKeys&&(n=t.enrichMagicKeys),e?.forEach((e,s,l)=>{if(t?.setDefaultValues&&!("defaultValue"in e)&&(e.defaultValue="value"in e?e.value:e.items?.filter(e=>e.checked)?.map?.(e=>e.value)?.join?.(",")??e.items?.find(e=>!e.value)?.value),"checked"in e&&!("defaultChecked"in e)&&(e.defaultChecked=e.checked),!("value"in e)&&(e.value=e.defaultValue,e.items?.length)){const t=e.items.reduce((e,t)=>(t.checked&&e.push(t.value),e),[]);e.value=t.length?t.join(","):e.defaultValue}if(t?.populate&&Object.keys(a).length>0)for(const t in a)e?.name===t&&("checked"in e?"boolean"==typeof a[t]?e.checked=a[t]:e.value===a[t]?e.checked=!0:e.checked=!1:(e.value=a[t],e.items&&e.items.forEach(e=>{e.checked=e.value===a[t]})));if(t?.enrichMagicKeys&&Object.keys(n).length>0)for(const t in n)e?.value===`{${t}}`?(e.value=n[t],e.items&&e.items.forEach(a=>{a.checked=a.value===e.value[t]})):e?.value?.includes?.(`{${t}}`)&&(e.value=e.value.replaceAll(`{${t}}
1`,n[t]),e.items&&e.items.forEach(a=>{a.checked=a.value===e.value[t]}));"fields"in e&&y(e.fields,t)})}var g=["onsubmit","action","enctype","method"],b=Object.assign({inheritAttrs:!1},{__name:"FetchForm",props:{action:String,enctype:{type:String,default:"application/x-www-form-urlencoded"},method:String,options:{type:Object,default:()=>({})},dataAppendage:{type:Object,default:()=>({})},dataTransformation:{type:Function,default:e=>e},useNativeFormDataOnPost:Boolean,mockupResponse:null,disabled:Boolean},emits:["fetch","request","response","error","complete"],setup(a,{expose:l,emit:p}){const m=r(),v=a,y=p,b=n(null),E=n(!1),k=e(()=>(v.method||"GET").toUpperCase()),O=e(()=>({method:k.value,...v.options,onRequest:(...e)=>{v.options?.onRequest?.(...e),y("request",...e)}})),L=n(0),D=e(()=>L.value>0),P=n(null),T=n(null),j=e(()=>{const e={...m};return delete e.onSubmit,e});async function S(e){v.disabled?e.preventDefault():(m.onSubmit?.(e),e.defaultPrevented||"DIALOG"===v.method?.toUpperCase?.()||(e.preventDefault(),await U()))}async function U(e){e??={},e={...v,...e};const t=n({key:String(Math.random()),...O.value,...e.options,onRequest:(...t)=>{e.options?.onRequest?.(...t),y("request",...t)}});if(e.action){const a=new URL(e.action,"https://example.com");let n=b.value?.formData?b.value.formData():new FormData(b.value),s="https://example.com"===a.origin?"":a.origin,l=n;if(e.dataAppendage)for(const[t,c]of Object.entries(e.dataAppendage))l.set(t,c);e.dataTransformation&&(l=e.dataTransformation(l)),e.useNativeFormDataOnPost||(l=Object.fromEntries(l)),["GET","DELETE"].includes(k.value)&&(a.search=new URLSearchParams(l));let i=!0;if(L.value++,e.mockupResponse){const t="function"==typeof e.mockupResponse?e.mockupResponse?.(l):e.mockupResponse;return y("fetch",new Promise(a=>{y("response",t),y("complete",!0),a({meta:{code:200},data:t,error:null}),P.value=e.mockupResponse,T.value=null,L.value--})),t}const o=h(s+a.pathname+a.search,{body:["POST","PUT","PATCH"].includes(k.value)?l:void 0,...t.value}).then(e=>{y("response",e),P.value=e,T.value=null}).catch(e=>{y("error",e),i=!1,P.value=null,T.value=e}).finally(()=>{L.value--,y("complete",i)});return y("fetch",o),await o,P.value}}return f(()=>{E.value=!0}),l({isFetching:D.value,submit:U}),(e,n)=>(d(),t("form",s({ref_key:"$el",ref:b,onsubmit:o(E)?null:"return false;",action:a.action,enctype:a.enctype,method:o(k),class:"c-fetch-form"},o(j),{onSubmit:S}),[c(e.$slots,"default",u(i({isFetching:o(D),currentResponse:o(P),currentError:o(T)})))],16,g))}});export{v as n,b as t};

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.