@kvass/widgets 1.9.52 → 1.9.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/finn.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Q as inject,q as defineComponent,c as createElementBlock,o as openBlock,j as createVNode,w as withCtx,v as unref,f as ref,a as createBaseVNode,J as normalizeProps,K as guardReactiveProps,m as mergeProps,b as createCommentVNode,F as Fragment,d as createBlock,_ as _export_sfc,i as onMounted,e as computed,l as renderList,C as createTextVNode,t as toDisplayString,n as normalizeClass,H as mergeModels,I as useModel,z as withDirectives,N as createSlots,E as watch,g as renderSlot,a9 as useId,aa as resolveDirective,ab as withKeys,ac as toRef,V as onUnmounted,ad as KeepAlive,D as onBeforeUnmount,a8 as onBeforeMount,r as resolveDynamicComponent,a4 as provide,p as defineCustomElement}from"./_plugin-vue_export-helper.js";import{a as Se,u as up,G as Go,T as TB,v as vB,_ as _r,B as Bf,U as Ue,S as SC,W as Wo,z as zB,f as fB,A as AB,g as gx,h as hy,I as IB,e as BB,$ as $B,N as NB,L as LB,b as hd,m as mB,E as EB}from"./index.es2.js";import{u as useCurrentElement}from"./index2.js";import{V as Vt,b as bt,M as Mt,f as floatingUi}from"./style.js";import{e as toCurrency,C as Clone,h as hasDiff,u as uploadFunction,i as Diff}from"./index.js";import{n as nbMessages}from"./nb_NO.js";const PropsInjectionKey=Symbol("props");function _isPlaceholder(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function _curry1(e){return function t(a){return arguments.length===0||_isPlaceholder(a)?t:e.apply(this,arguments)}}function _curry2(e){return function t(a,r){switch(arguments.length){case 0:return t;case 1:return _isPlaceholder(a)?t:_curry1(function(i){return e(a,i)});default:return _isPlaceholder(a)&&_isPlaceholder(r)?t:_isPlaceholder(a)?_curry1(function(i){return e(i,r)}):_isPlaceholder(r)?_curry1(function(i){return e(a,i)}):e(a,r)}}}function _curry3(e){return function t(a,r,i){switch(arguments.length){case 0:return t;case 1:return _isPlaceholder(a)?t:_curry2(function(n,s){return e(a,n,s)});case 2:return _isPlaceholder(a)&&_isPlaceholder(r)?t:_isPlaceholder(a)?_curry2(function(n,s){return e(n,r,s)}):_isPlaceholder(r)?_curry2(function(n,s){return e(a,n,s)}):_curry1(function(n){return e(a,r,n)});default:return _isPlaceholder(a)&&_isPlaceholder(r)&&_isPlaceholder(i)?t:_isPlaceholder(a)&&_isPlaceholder(r)?_curry2(function(n,s){return e(n,s,i)}):_isPlaceholder(a)&&_isPlaceholder(i)?_curry2(function(n,s){return e(n,r,s)}):_isPlaceholder(r)&&_isPlaceholder(i)?_curry2(function(n,s){return e(a,n,s)}):_isPlaceholder(a)?_curry1(function(n){return e(n,r,i)}):_isPlaceholder(r)?_curry1(function(n){return e(a,n,i)}):_isPlaceholder(i)?_curry1(function(n){return e(a,r,n)}):e(a,r,i)}}}function _has(e,t){return Object.prototype.hasOwnProperty.call(t,e)}function _isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}var mergeWithKey=_curry3(function(t,a,r){var i={},n;a=a||{},r=r||{};for(n in a)_has(n,a)&&(i[n]=_has(n,r)?t(n,a[n],r[n]):a[n]);for(n in r)_has(n,r)&&!_has(n,i)&&(i[n]=r[n]);return i}),mergeDeepWithKey=_curry3(function e(t,a,r){return mergeWithKey(function(i,n,s){return _isObject(n)&&_isObject(s)?e(t,n,s):t(i,n,s)},a,r)}),mergeDeepRight=_curry2(function(t,a){return mergeDeepWithKey(function(r,i,n){return n},t,a)});async function fetch$1(e,t={}){return fetch(e,mergeDeepRight({headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"include"},t)).then(r=>{if(!r.ok)throw r;return r})}function SSE(e){const t=new TextDecoder,a=[],r=s=>t.decode(s).split(`
1
+ import{P as inject,q as defineComponent,o as openBlock,c as createElementBlock,j as createVNode,w as withCtx,v as unref,a as createBaseVNode,I as normalizeProps,J as guardReactiveProps,m as mergeProps,F as Fragment,d as createBlock,b as createCommentVNode,f as ref,_ as _export_sfc,i as onMounted,l as renderList,B as createTextVNode,t as toDisplayString,e as computed,n as normalizeClass,G as useModel,y as withDirectives,M as createSlots,H as mergeModels,D as watch,g as renderSlot,a8 as useId,a9 as resolveDirective,aa as withKeys,ab as toRef,R as onUnmounted,ac as KeepAlive,C as onBeforeUnmount,a7 as onBeforeMount,r as resolveDynamicComponent,a3 as provide,p as defineCustomElement}from"./_plugin-vue_export-helper.js";import{a as Se,u as up,G as Go,T as TB,v as vB,_ as _r,B as Bf,U as Ue,S as SC,W as Wo,z as zB,f as fB,A as AB,g as gx,h as hy,I as IB,e as BB,$ as $B,N as NB,L as LB,b as hd,m as mB,E as EB}from"./index.es2.js";import{u as useCurrentElement}from"./index2.js";import{V as Vt,b as bt,M as Mt,f as floatingUi}from"./style.js";import{e as toCurrency,C as Clone,h as hasDiff,u as uploadFunction,i as Diff}from"./index.js";import{n as nbMessages}from"./nb_NO.js";const PropsInjectionKey=Symbol("props");function _isPlaceholder(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function _curry1(e){return function t(a){return arguments.length===0||_isPlaceholder(a)?t:e.apply(this,arguments)}}function _curry2(e){return function t(a,r){switch(arguments.length){case 0:return t;case 1:return _isPlaceholder(a)?t:_curry1(function(i){return e(a,i)});default:return _isPlaceholder(a)&&_isPlaceholder(r)?t:_isPlaceholder(a)?_curry1(function(i){return e(i,r)}):_isPlaceholder(r)?_curry1(function(i){return e(a,i)}):e(a,r)}}}function _curry3(e){return function t(a,r,i){switch(arguments.length){case 0:return t;case 1:return _isPlaceholder(a)?t:_curry2(function(n,s){return e(a,n,s)});case 2:return _isPlaceholder(a)&&_isPlaceholder(r)?t:_isPlaceholder(a)?_curry2(function(n,s){return e(n,r,s)}):_isPlaceholder(r)?_curry2(function(n,s){return e(a,n,s)}):_curry1(function(n){return e(a,r,n)});default:return _isPlaceholder(a)&&_isPlaceholder(r)&&_isPlaceholder(i)?t:_isPlaceholder(a)&&_isPlaceholder(r)?_curry2(function(n,s){return e(n,s,i)}):_isPlaceholder(a)&&_isPlaceholder(i)?_curry2(function(n,s){return e(n,r,s)}):_isPlaceholder(r)&&_isPlaceholder(i)?_curry2(function(n,s){return e(a,n,s)}):_isPlaceholder(a)?_curry1(function(n){return e(n,r,i)}):_isPlaceholder(r)?_curry1(function(n){return e(a,n,i)}):_isPlaceholder(i)?_curry1(function(n){return e(a,r,n)}):e(a,r,i)}}}function _has(e,t){return Object.prototype.hasOwnProperty.call(t,e)}function _isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}var mergeWithKey=_curry3(function(t,a,r){var i={},n;a=a||{},r=r||{};for(n in a)_has(n,a)&&(i[n]=_has(n,r)?t(n,a[n],r[n]):a[n]);for(n in r)_has(n,r)&&!_has(n,i)&&(i[n]=r[n]);return i}),mergeDeepWithKey=_curry3(function e(t,a,r){return mergeWithKey(function(i,n,s){return _isObject(n)&&_isObject(s)?e(t,n,s):t(i,n,s)},a,r)}),mergeDeepRight=_curry2(function(t,a){return mergeDeepWithKey(function(r,i,n){return n},t,a)});async function fetch$1(e,t={}){return fetch(e,mergeDeepRight({headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"include"},t)).then(r=>{if(!r.ok)throw r;return r})}function SSE(e){const t=new TextDecoder,a=[],r=s=>t.decode(s).split(`
2
2
  `).map(l=>{if(l)return JSON.parse(l.replace("data: ",""))}).filter(Boolean),i=e.body.getReader(),n=(s,l)=>a.filter(o=>o.event===s).forEach(o=>o.callback(l));return i.read().then(function s({done:l,value:o}){return l?n("finished"):(r(o).forEach(m=>n(m.event,m.payload)),i.read().then(s))}),{on:(s,l)=>{a.push({event:s,callback:l})},cancel:()=>{i.cancel()}}}function useAPI(e){const t=inject(PropsInjectionKey),a=y=>new URL(`${t.tenant}/api/integration/${t.integrationId}/callbacks/${y}`);return{getAds:y=>{const c=a("data");return y&&c.searchParams.append("id",y),fetch$1(c.toString(),{method:"GET",headers:{authorization:`Bearer ${t.token}`}}).then(x=>x.json())},navigateView:(y,c)=>{const x=a(y);x.searchParams.append("token",t.token),x.searchParams.append("project",t.project),c&&x.searchParams.append("id",c),e.value.dispatchEvent(new CustomEvent("action",{detail:{type:"navigate",value:{name:"form",query:{target:x.toString()}}},bubbles:!0,composed:!0}))},remove:y=>{const c=a("unpublish");return c.searchParams.append("id",y),fetch$1(c.toString(),{method:"DELETE",headers:{authorization:`Bearer ${t.token}`}}).catch(x=>{throw console.error(x),x})},publish:async(y,c={})=>{const{preview:x=!1,publish:k=!0}=c,g=a("publish"),S=await fetch$1(g.toString(),{method:"POST",cache:"no-cache",keepalive:!0,headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({data:y,preview:x,publish:k})});return SSE(S)},unpublish:y=>{const c=a("unpublish");return c.searchParams.append("id",y),fetch$1(c.toString(),{method:"POST",headers:{authorization:`Bearer ${t.token}`}})},navigateProjectStep:y=>{e.value.dispatchEvent(new CustomEvent("action",{detail:{type:"navigate",value:{name:"project-edit",params:{id:t.project,step:y}}},bubbles:!0,composed:!0}))},getUnits:()=>{const y=a("units");return fetch$1(y.toString(),{method:"GET",headers:{authorization:`Bearer ${t.token}`}}).then(c=>c.json())},fields:y=>{const c=a("fields");return fetch$1(c.toString(),{method:"POST",headers:{authorization:`Bearer ${t.token}`},body:JSON.stringify({type:y.type,units:y.units.map(x=>x.id)})}).then(x=>x.json())}}}const _sfc_main$k=defineComponent({__name:"Options.ce",props:{item:{type:Object}},emits:["refetch"],setup(e,{emit:t}){const a=useCurrentElement(),r=useAPI(a),i=t,n=ref(),s=ref(),l=ref(),o=(f,y)=>{sessionStorage.setItem("k-finn-step",y?"preview":"publish"),r.navigateView("mutate",f)},m=f=>{sessionStorage.setItem("k-finn-step","ad"),r.navigateView("mutate",f)};return(f,y)=>(openBlock(),createElementBlock(Fragment,null,[createVNode(unref(up),{teleport:!1,closeOnOutsideClick:!0,variant:"prompt",ref_key:"removedialog",ref:s,class:"remove-dialog",title:"Du er i ferd med å slette annonsen"},{trigger:withCtx(({triggerProps:c})=>[createVNode(unref(Se),mergeProps({style:{display:"none"}},c),null,16)]),default:withCtx(({descriptionProps:c})=>[createBaseVNode("div",normalizeProps(guardReactiveProps(c))," Du er i ferd med å slette din Finn-annonse. Vi gjør oppmerksom på at annonsen avsluttes i sin helhet, du vil eventuelt miste resterende betalt periode hos Finn. Er du sikker? ",16)]),actions:withCtx(({close:c})=>[createVNode(unref(Se),{label:"Nei, ta meg tilbake",onClick:c},null,8,["onClick"]),createVNode(unref(Se),{label:"Ja, jeg ønsker å slette",variant:"primary",promise:n.value,onSuccess:()=>{c(),i("refetch")},onClick:y[0]||(y[0]=()=>n.value=unref(r).remove(e.item.id))},null,8,["promise","onSuccess"])]),_:1},512),createVNode(unref(up),{teleport:!1,closeOnOutsideClick:!0,variant:"prompt",ref_key:"unpublishdialog",ref:l,class:"unpublish-dialog",title:"Du er i ferd med å avpublisere annonsen"},{trigger:withCtx(({triggerProps:c})=>[createVNode(unref(Se),mergeProps({style:{display:"none"}},c),null,16)]),default:withCtx(({descriptionProps:c})=>[createBaseVNode("div",normalizeProps(guardReactiveProps(c))," Du er i ferd med å avpublisere din Finn-annonse. Vi gjør oppmerksom på at perioden for annonsen vil fortsette å løpe til utløpsdato. ",16)]),actions:withCtx(({close:c})=>[createVNode(unref(Se),{label:"Nei, ta meg tilbake",onClick:c},null,8,["onClick"]),createVNode(unref(Se),{label:"Ja, jeg ønsker å avpublisere",variant:"primary",promise:n.value,onSuccess:()=>{c(),i("refetch")},onClick:y[1]||(y[1]=()=>n.value=unref(r).unpublish(e.item.id))},null,8,["promise","onSuccess"])]),_:1},512),createVNode(unref(Go),{label:"Endre",keepOpen:"",teleport:!1,class:"options"},{default:withCtx(()=>[createVNode(unref(Se),{iconRight:"fa-pro-light:pen",label:"Rediger",onClick:y[2]||(y[2]=()=>m(e.item.id)),variant:"tertiary"}),e.item.code?(openBlock(),createElementBlock(Fragment,{key:0},[!e.item.publishedAt||e.item.preview?(openBlock(),createBlock(unref(Se),{key:0,iconRight:"fa-pro-light:arrow-right",label:"Publiser",onClick:y[3]||(y[3]=()=>o(e.item.id,e.item.preview)),variant:"tertiary"})):createCommentVNode("",!0),e.item.publishedAt?(openBlock(),createBlock(unref(Se),{key:1,iconRight:"fa-pro-light:play-pause",label:"Avpubliser",onClick:y[4]||(y[4]=()=>{l.value.open()}),variant:"tertiary"})):createCommentVNode("",!0)],64)):createCommentVNode("",!0),createVNode(unref(Se),{"data-type":"delete",class:"options__delete",variant:"danger",label:"Slett",iconRight:"fa-pro-light:trash-xmark",onClick:y[5]||(y[5]=()=>{s.value.open()})})]),_:1})],64))}}),_style_0$e=".k-button.options__delete{color:var(--k-button-danger-background, var(--k-ui-color-danger));background-color:var(--k-button-danger-text, white)}.k-button.options__delete:focus,.k-button.options__delete:active,.k-button.options__delete:hover{color:var(--k-button-danger-text, white)}.unpublish-dialog,.remove-dialog{--k-dialog-min-width: 400px;--k-dialog-max-width: 600px}",Options=_export_sfc(_sfc_main$k,[["styles",[_style_0$e]]]),_sfc_main$j=defineComponent({__name:"Dashboard.ce",setup(e){const t=useCurrentElement(),a=useAPI(t),r=ref([]),i=ref(!1),n=computed(()=>[{id:"name",label:"Kampanjenavn"},{id:"status",label:"Status"},{id:"published",label:"Publisert"},{id:"insight",label:""},{id:"url",label:""},{id:"edit",label:""}]),s=m=>m.code?m.publishedAt?m.preview?{label:"Utkast - Forhåndsvisning",variant:"info"}:{label:"Aktiv",variant:"success"}:{label:"Avpublisert",variant:"danger"}:{label:"Utkast",variant:"neutral"},l=m=>{if(!m.code||!m.publishedAt||m.preview)return"-";const f={year:"numeric",month:"numeric",day:"numeric"};return new Date(m.publishedAt).toLocaleString("nb-NO",f)},o=()=>{i.value=!0,a.getAds().then(m=>{r.value=m}).finally(()=>{i.value=!1})};return onMounted(()=>{o()}),(m,f)=>(openBlock(),createBlock(unref(SC),{class:"ads",title:"Dine Finn-annonser",subtitle:"Her får du en oversikt over dine Finn-annonser.",variant:"prompt",appearance:"shadow"},{default:withCtx(()=>[r.value.length&&!i.value?(openBlock(),createBlock(unref(TB),{key:0,items:r.value,columns:n.value},{name:withCtx(({item:y})=>[createTextVNode(toDisplayString(y.name),1)]),status:withCtx(({item:y})=>[createVNode(unref(vB),mergeProps(s(y),{appearance:"filled"}),null,16)]),published:withCtx(({item:y})=>[createTextVNode(toDisplayString(l(y)),1)]),url:withCtx(({item:y})=>[y.url?(openBlock(),createElementBlock(Fragment,{key:0},[y.units.some(c=>c.url)?(openBlock(),createBlock(unref(Go),{key:0,label:"Se annonser"},{default:withCtx(()=>[createVNode(unref(Se),{variant:"tertiary",iconRight:"fa-pro-light:arrow-up-right-from-square",label:"Prosjektannonse",target:"_blank",is:"a",href:y.url},null,8,["href"]),(openBlock(!0),createElementBlock(Fragment,null,renderList(y.units,c=>(openBlock(),createBlock(unref(Se),{variant:"tertiary",label:`${c.name}`,target:"_blank",is:"a",href:c.url,iconRight:"fa-pro-light:arrow-up-right-from-square"},null,8,["label","href"]))),256))]),_:2},1024)):(openBlock(),createBlock(unref(Se),{key:1,iconRight:"fa-pro-light:arrow-up-right-from-square",label:"Se annonse",target:"_blank",is:"a",href:y.url},null,8,["href"]))],64)):createCommentVNode("",!0)]),insight:withCtx(({item:y})=>[!y.preview&&y.statistics?(openBlock(),createBlock(unref(Se),{key:0,iconRight:"fa-pro-light:arrow-up-right-from-square",label:"Se innsikt",target:"_blank",is:"a",href:y.statistics},null,8,["href"])):createCommentVNode("",!0)]),edit:withCtx(({item:y})=>[(openBlock(),createBlock(Options,{item:y,onRefetch:f[0]||(f[0]=()=>o()),key:y.id},null,8,["item"]))]),_:1},8,["items","columns"])):createCommentVNode("",!0),i.value?(openBlock(),createBlock(unref(_r),{key:1,direction:"column",align:"center"},{default:withCtx(()=>[createVNode(unref(Bf),{size:"large"})]),_:1})):createCommentVNode("",!0),!i.value&&!r.value.length?(openBlock(),createBlock(unref(_r),{key:2,direction:"column",align:"center",class:"ads__empty"},{default:withCtx(()=>[createVNode(unref(Ue),{icon:"fa-pro-thin:face-sleeping"}),f[1]||(f[1]=createBaseVNode("div",null,"Fant ingen annonser",-1))]),_:1})):createCommentVNode("",!0)]),_:1}))}}),_style_0$d=".ads .k-datatable{position:initial}.ads__empty{font-size:1rem}.ads__empty svg{padding-block:var(--k-ui-spacing);opacity:var(--k-ui-opacity-faded);font-size:5rem}",Dashboard=_export_sfc(_sfc_main$j,[["styles",[_style_0$d]]]),_sfc_main$i=defineComponent({__name:"Tooltip.ce",props:{src:{type:String},content:{type:String}},setup(e){return(t,a)=>(openBlock(),createBlock(unref(Vt),{container:!1},{popper:withCtx(()=>[e.content?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass({"k-mb-sm":e.src})},toDisplayString(e.content),3)):createCommentVNode("",!0),e.src?(openBlock(),createBlock(unref(Wo),{key:1,class:"tooltip__image",src:e.src,width:"100%",size:"cover","aspect-ratio":"16/9"},null,8,["src"])):createCommentVNode("",!0)]),default:withCtx(()=>[createVNode(unref(Ue),{icon:"material-symbols:question-mark",class:"v-popper__icon"})]),_:1}))}}),_style_0$c=".tooltip__image{border-radius:var(--k-ui-rounding)}",Tooltip=_export_sfc(_sfc_main$i,[["styles",[_style_0$c]]]),houseBuildingTypes=["detached","flat","semidetached","terraced","leisure","fourPlex","chainLinkedHouse","boatBerth","boathouse"],Categories=[{type:"ESTATE_PLANNED",label:"Kommer for salg",sublabel:"Nye boliger, kommer for salg",group:"Nybygg",disabled:e=>{if(!e.length)return!1;const t=["draft","upcoming"];return!e.some(a=>a.saleType==="sale"&&t.includes(a.status.value))},disabledReason:'Du må ha enheter merket som "kommer for salg".'},{type:"ESTATE_PROJECT",label:"Boliger",sublabel:"Nye boliger til salgs",group:"Nybygg",unitType:"ESTATE_PROJECT_UNIT",disabled:e=>{if(!e.length)return!0;const t=houseBuildingTypes.filter(a=>a!=="leisure");return!e.some(a=>a.saleType==="sale"&&t.includes(a.propertyType.value))},disabledReason:"Du må ha boligtypeenheter til salgs"},{type:"ESTATE_PROJECT_SINGLE",label:"Enkelt enhet",sublabel:"Nye boliger til salgs enkelt enhet",group:"Nybygg",disabled:e=>{if(!e.length)return!1;const t=houseBuildingTypes;return!e.some(a=>a.saleType==="sale"&&t.includes(a.propertyType.value))},disabledReason:"Du må ha boligtypeenheter eller hytteenheter til salgs."},{type:"ESTATE_PROJECT_LEISURE",label:"Hytter",sublabel:"Nye boliger til salgs hytte",group:"Nybygg",unitType:"ESTATE_PROJECT_UNIT_LEISURE",disabled:e=>{if(!e.length)return!0;const t=["leisure"];return!e.some(a=>a.saleType==="sale"&&t.includes(a.propertyType.value))},disabledReason:"Du må ha hytteenheter til salgs"},{type:"ESTATE_BUSINESS_SALE",label:"Til salgs",sublabel:"Næringseiendommer til salgs",group:"Næring",disabled:e=>{if(!e.length)return!1;const t=houseBuildingTypes;return!e.some(a=>a.saleType==="sale"&&!t.includes(a.propertyType.value))},disabledReason:"Du må ha flere enheter til salgs enn bare boligtyper og hytter"},{type:"ESTATE_BUSINESS_RENT",label:"Til leie",sublabel:"Næringseiendommer til leie",group:"Næring",disabled:e=>e.length?!e.some(t=>t.saleType==="rent"):!1,disabledReason:"Du må ha enheter til leie"},{type:"PLOT_SALE",label:"Tomt/Fritidstomt",sublabel:"Boligtomt/Fritidstomt til salgs",group:"Tomter",disabled:e=>{if(!e.length)return!1;const t=["plot","leisurePlot"];return!e.some(a=>a.saleType==="sale"&&t.includes(a.propertyType.value))},disabledReason:"Du må ha tomteenheter eller fritidstomter til salgs"},{type:"ESTATE_RENT",label:"Bruktbolig",sublabel:"Bolig til leie",group:"Leie",disabled:e=>e.length?!e.some(t=>t.saleType==="rent"):!1,disabledReason:"Du må ha enheter til leie"}];zB.setLabels(nbMessages);const _hoisted_1$3={class:"category__label"},_hoisted_2$1={class:"category__sublabel"},_hoisted_3={class:"category__group"},_hoisted_4={class:"category__label"},_hoisted_5={class:"category__sublabel"},_sfc_main$h=defineComponent({__name:"Type.ce",props:mergeModels({onNext:{type:null},onPrev:{type:null},units:{type:Array}},{modelValue:{default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=useCurrentElement(),a=useAPI(t),r=inject(PropsInjectionKey),i=e,n=useModel(e,"modelValue"),s=computed(()=>{const T=Categories.reduce((R,B)=>(R[B.group]||(R[B.group]=[]),R[B.group].push(B),R),{});return Object.entries(T).map(([R,B])=>({group:R,items:B}))}),l=computed(()=>Categories.find(T=>T.type===n.value.type)),o=computed(()=>[{id:"name",label:"Navn",sort:!0},{id:"type",label:"Enhetstype",sort:!0},{id:"status",label:"Status",sort:!0},{id:"price",label:"Pris",sort:!0}]),m=T=>{switch(T){case"upcoming":return"info";case"sale":return"success";case"reserved":return"warning";case"sold":return"danger";default:return"neutral"}};function f(T){return T.disabled}const y=()=>{i.onNext()},c=ref({name:1}),x=computed(()=>i.units.sort((T,M)=>{let[R]=Object.keys(c.value),[B]=Object.values(c.value);const G=P=>R==="status"?P[R].label:R==="type"?P.propertyType.label:P[R],L=G(T),N=G(M),U=B<0,O=!isNaN(L),z=!isNaN(N);return O&&z?U?N-L:L-N:typeof L=="string"&&typeof N=="string"?U?N.localeCompare(L,"nb-NO",{numeric:!0,sensitivity:"base"}):L.localeCompare(N,"nb-NO",{numeric:!0,sensitivity:"base"}):0})),k=computed({get(){return x.value.filter(T=>n.value.units.some(M=>M.id===T.id))},set(T){n.value.units=T.map(M=>{const{price:R,propertyType:B,status:G,disabled:L,saleType:N,disabledReason:U,...O}=M;return{fields:{},...O}})}}),g=computed(()=>o.value.filter(T=>T.sort).map(T=>T.id)),S=computed(()=>{const T={name:"required",type:"required"};return l.value?.type==="ESTATE_PROJECT_SINGLE"&&n.value.units.length?{units:"size:1",...T}:["ESTATE_PROJECT","ESTATE_PROJECT_LEISURE"].includes(l.value?.type||"")?{units:"min:1",...T}:T}),d=computed(()=>({name:"Internt navn",type:"Annonse-kategori",units:"enhet"})),p=computed(()=>({min:`Du må minimum velge :min :attribute når "${Categories.find(T=>T.type==="ESTATE_PROJECT")?.label}" eller "${Categories.find(T=>T.type==="ESTATE_PROJECT_LEISURE")?.label}" er valgt som annonse-kategori`,size:`Du kan kun velge :size :attribute når "${Categories.find(T=>T.type==="ESTATE_PROJECT_SINGLE")?.label}" er valgt som annonse-kategori`})),u=fB({rules:S,labels:d,data:n,customMessages:p}),{bind:b}=u,E=ref();return onMounted(()=>{const T=E.value?.$el;if(!T)return;let M=T.querySelectorAll('[data-scope="checkbox"][data-part="root"][data-disabled]');const R=x.value.filter(B=>B.disabled);M.forEach((B,G)=>{const L=R[G].disabledReason;bt(B,{container:!1,triggers:["hover","focus"],content:L,placements:"auto",preventOverflow:!0},null)})}),(T,M)=>(openBlock(),createBlock(unref(SC),{class:"type",title:"Grunnlag for Finn-annonsen",variant:"prompt",appearance:"shadow",subtitle:"Definer annonsen sitt interne navn, annonse-kategorien definerer hvor den plasseres på Finn."},{default:withCtx(()=>[createVNode(unref(AB),{columns:"2",gap:"4rem 2rem"},{default:withCtx(()=>[createVNode(unref(gx),normalizeProps(guardReactiveProps(unref(b)("name"))),{label:withCtx(()=>[M[5]||(M[5]=createBaseVNode("span",null,"Internt navn på Finn-annonse ",-1)),createVNode(Tooltip,{content:"Det interne navnet gjør det lettere å finne annonsen i oversikten over Finn-annonsene på prosjektet, spesielt hvis du planlegger å ha flere annonser på samme prosjekt!"})]),default:withCtx(()=>[createVNode(unref(hy),{modelValue:n.value.name,"onUpdate:modelValue":M[0]||(M[0]=R=>n.value.name=R)},null,8,["modelValue"])]),_:1},16),createVNode(unref(gx),mergeProps(unref(b)("type"),{help:"Dette legger annonsen på riktig boligtype på Finn"}),{label:withCtx(()=>[M[6]||(M[6]=createBaseVNode("span",null," Velg annonse-kategori ",-1)),createVNode(Tooltip,{content:"En annonse-kategori gjør det mulig å bestemme ønsket plass i Finn for din type annonse. Dersom du for eksempel skal leie ut en bolig kan du benytte bolig til leie. Annonsen vil deretter plasseres på bolig til leie på Finn."})]),default:withCtx(()=>[createVNode(unref(Go),{teleport:!1,disabled:!!unref(r).id,label:"Velg...",class:"category"},createSlots({default:withCtx(({close:R})=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(s.value,B=>(openBlock(),createElementBlock(Fragment,null,[createBaseVNode("div",_hoisted_3,toDisplayString(B.group),1),(openBlock(!0),createElementBlock(Fragment,null,renderList(B.items,G=>withDirectives((openBlock(),createBlock(unref(Se),{variant:"tertiary",onClick:()=>{n.value.type=G.type,R()},disabled:G.disabled(e.units)},{default:withCtx(()=>[createVNode(unref(_r),{class:"category__label-wrapper"},{default:withCtx(()=>[createBaseVNode("div",_hoisted_4,toDisplayString(G.label),1),createBaseVNode("div",_hoisted_5,toDisplayString(G.sublabel),1)]),_:2},1024)]),_:2},1032,["onClick","disabled"])),[[unref(Mt),{content:G.disabledReason,disabled:!G.disabled(e.units),container:!1}]])),256))],64))),256))]),_:2},[l.value?{name:"trigger",fn:withCtx(()=>[createVNode(unref(_r),{class:"category__label-wrapper"},{default:withCtx(()=>[createBaseVNode("div",_hoisted_1$3,toDisplayString(l.value.label),1),createBaseVNode("div",_hoisted_2$1,toDisplayString(l.value.sublabel),1)]),_:1})]),key:"0"}:void 0]),1032,["disabled"])]),_:1},16),x.value.length?(openBlock(),createBlock(unref(gx),{key:0,label:"Velg hvilke enheter du vil publisere i Finn-annonse",class:"k-grid-span-full"},{default:withCtx(()=>[createVNode(unref(IB),{is:"div",appearance:"indicator",treshhold:200,class:"table-scroller"},{default:withCtx(()=>[createVNode(unref(TB),{ref_key:"unitTable",ref:E,sticky:!0,sortableBy:g.value,sortBy:c.value,"onUpdate:sortBy":M[1]||(M[1]=R=>c.value=R),columns:o.value,items:x.value,selected:k.value,"onUpdate:selected":M[2]||(M[2]=R=>k.value=R),isDisabled:f},{name:withCtx(({item:R})=>[createTextVNode(toDisplayString(R.name),1)]),type:withCtx(({item:R})=>[createTextVNode(toDisplayString(R.propertyType.label),1)]),status:withCtx(({item:R})=>[createVNode(unref(vB),{appearance:"filled",variant:m(R.status.value),rounded:!0},{default:withCtx(()=>[createTextVNode(toDisplayString(R.status.label),1)]),_:2},1032,["variant"])]),price:withCtx(({item:R})=>[createTextVNode(toDisplayString(unref(toCurrency)(R.price)),1)]),_:1},8,["sortableBy","sortBy","columns","items","selected"])]),_:1})]),_:1})):createCommentVNode("",!0)]),_:1})]),actions:withCtx(()=>[createVNode(unref(Se),{label:"Avbryt",variant:"secondary",onClick:M[3]||(M[3]=()=>unref(a).navigateView("dashboard"))}),withDirectives(createVNode(unref(Se),{label:"Neste",variant:"primary","icon-right":"fa-pro-solid:arrow-right",disabled:!unref(u).passes.value,onClick:M[4]||(M[4]=()=>y())},null,8,["disabled"]),[[unref(Mt),{content:Object.entries(unref(u).errors.value.errors).map(([R,B])=>B).flat().join(`
3
3
  `),disabled:unref(u).passes.value,container:!1}]])]),_:1}))}}),_style_0$b=".type .table-scroller{max-height:650px;position:relative}.type .category__group{font-weight:700;padding-inline:var(--k-ui-spacing-sm);padding-top:var(--k-ui-spacing-xs)}.type .category__label-wrapper{flex-direction:column;gap:var(--k-ui-spacing-xxs);align-items:start}.type .category__sublabel{font-size:var(--k-ui-font-size-sm);opacity:var(--k-ui-opacity-faded)}",StepType=_export_sfc(_sfc_main$h,[["styles",[_style_0$b]]]),_hoisted_1$2={style:{"margin-left":"auto"}},_sfc_main$g=defineComponent({__name:"ExpandableList.ce",props:{modelValue:{type:Array},title:{default:"",type:String},subtitle:{default:"",type:String},limit:{type:Number},template:{type:null}},emits:["update:modelValue","remove"],setup(e,{emit:t}){const a=e,r=t,i=ref(Clone(a.modelValue));watch(()=>a.modelValue,(f,y)=>{hasDiff({value:f},{value:i.value})&&(i.value=Clone(f))},{deep:!0}),watch(()=>[...i.value],(f,y)=>{if(!f.length)return i.value.push(Clone(a.template));f.length===y.length&&r("update:modelValue",f)},{deep:!0});const n=ref([]),s=f=>(n.value[f]||(n.value[f]=useId()),n.value[f]),l=()=>{const f=[...i.value,Clone(a.template)];i.value=f,r("update:modelValue",[...f])},o=f=>{n.value.splice(f,1);const y=[...i.value];y.splice(f,1),i.value=y,r("update:modelValue",[...y]),r("remove",f)},m=(f,y)=>{const c=n.value.splice(f,1)[0];n.value.splice(f+y,0,c);const x=[...i.value],k=x.splice(f,1)[0];x.splice(f+y,0,k),i.value=x,r("update:modelValue",[...x])};return onMounted(()=>{i.value.length||i.value.push(Clone(a.template))}),(f,y)=>(openBlock(),createBlock(unref(BB),{class:"expandable-list",title:e.title,subtitle:e.subtitle},createSlots({actions:withCtx(()=>[renderSlot(f.$slots,"actions",{},()=>[createBaseVNode("span",_hoisted_1$2,toDisplayString(i.value.length)+toDisplayString(e.limit?` / ${e.limit}`:"")+" "+toDisplayString(i.value.length>=2||e.limit?"felter":"felt"),1)])]),default:withCtx(()=>[renderSlot(f.$slots,"before-content"),(openBlock(!0),createElementBlock(Fragment,null,renderList(i.value,(c,x)=>(openBlock(),createElementBlock(Fragment,{key:s(x)},[createVNode(unref(_r),{justify:"end",gap:"4px",class:"expandable-list__actions"},{default:withCtx(()=>[withDirectives(createVNode(unref(Se),{size:"small",icon:"fa-pro-light:trash",onClick:k=>o(x),class:"expandable-list__remove"},null,8,["onClick"]),[[unref(Mt),{content:"Fjern",container:!1}]]),withDirectives(createVNode(unref(Se),{size:"small",icon:"fa-pro-light:arrow-up",disabled:x===0,onClick:k=>m(x,-1),class:"expandable-list__move-up"},null,8,["disabled","onClick"]),[[unref(Mt),{content:"Flytt opp",container:!1}]]),withDirectives(createVNode(unref(Se),{size:"small",icon:"fa-pro-light:arrow-down",disabled:x===i.value.length-1,onClick:k=>m(x,1),class:"expandable-list__move-down"},null,8,["disabled","onClick"]),[[unref(Mt),{content:"Flytt ned",container:!1}]])]),_:2},1024),createVNode(unref(_r),{direction:"column",class:"expandable-list__content"},{default:withCtx(()=>[renderSlot(f.$slots,"default",{item:c,index:x})]),_:2},1024)],64))),128))]),footer:withCtx(()=>[withDirectives(createVNode(unref(Se),{variant:"tertiary",disabled:e.limit&&i.value.length>=e.limit,onClick:l,icon:"fa-pro-solid:plus",label:"Opprett nytt felt",class:"expandable-list__add"},null,8,["disabled"]),[[unref(Mt),{content:"Maks antall felter lagt til",disabled:!(e.limit&&i.value.length>=e.limit),container:!1}]])]),_:2},[f.$slots.title?{name:"title",fn:withCtx(()=>[renderSlot(f.$slots,"title")]),key:"0"}:void 0]),1032,["title","subtitle"]))}}),_style_0$a=".expandable-list__actions:hover+.expandable-list__content{border-radius:var(--k-ui-rounding-sm);outline:2px dashed var(--k-ui-color-neutral-dark);outline-offset:6px}.expandable-list .k-expandable__footer{--k-expandable-spacing: 0rem}.expandable-list .k-expandable__footer .k-button{width:100%;--k-button-tertiary-background: #eaeaea;padding:1rem;border-top-right-radius:0;border-top-left-radius:0}.expandable-list .k-expandable__footer .k-button__content{flex-direction:column}.expandable-list .k-expandable__footer .k-button__icon{padding:.5rem;color:#fff;background-color:var(--k-ui-color-primary);border-radius:var(--k-ui-rounding-full)}.expandable-list .k-expandable__footer .k-button__icon svg{height:1em;width:1em}",ExpandableList=_export_sfc(_sfc_main$g,[["styles",[_style_0$a]]]),_sfc_main$f=defineComponent({__name:"UnitLinks.ce",props:{modelValue:{type:Object},hasFields:{type:Function},hasField:{type:Function},getIsEditedBind:{type:Function},isEdited:{type:Function},rules:{type:Object},labels:{type:Object},initialUnitField:{type:Object}},emits:["update:modelValue"],setup(e,{expose:t,emit:a}){const r=e,i=a,n=ref(Clone(r.modelValue)),s=ref({});watch(()=>r.modelValue,(d,p)=>{hasDiff({value:d},{value:n.value})&&(n.value=Clone(d))},{deep:!0});const l=d=>{const p=["MOREINFO.*.URL","MOREINFO.0.URL","MOREINFO.1.URL","MOREINFO.2.URL","MOREINFO.3.URL"];return Object.fromEntries(Object.entries(d).filter(([u,b])=>p.includes(u)))},o=computed(()=>l(r.rules)),m=computed(()=>l(r.labels)),f=fB({rules:o,labels:m,data:n}),{bind:y}=f,c=ref(),x=d=>hasDiff({value:n.value[d]},{value:r.initialUnitField[d]}),k=(...d)=>r.getIsEditedBind(x(...d)),g=()=>{n.value=Clone(r.modelValue)},S=()=>{i("update:modelValue",Clone(n.value))};return t({open:()=>{c.value.open()},close:()=>{c.value.close()}}),(d,p)=>(openBlock(),createBlock(unref(up),{ref_key:"linkDialog",ref:c,variant:"prompt",title:"Tilpass enhetens nyttige lenker i Finn-annonsen",subtitle:"Lenker vil være synlig under kontakt informasjon på enhetsannonsen",teleport:!1,closeOnOutsideClick:!1},{trigger:withCtx(({triggerProps:u})=>[createVNode(unref(Se),{style:{display:"none"}})]),default:withCtx(()=>[e.hasFields("MOREINFO")?(openBlock(),createBlock(ExpandableList,{key:0,limit:4,template:{URL:"",URLTEXT:""},expanded:!0,modelValue:n.value.MOREINFO,"onUpdate:modelValue":p[2]||(p[2]=u=>n.value.MOREINFO=u),onRemove:p[3]||(p[3]=u=>{const b=Object.keys(s.value).reverse().find(E=>E.startsWith("MOREINFO.")&&E.endsWith(".URL")&&s.value[E]);b&&(s.value[b]=!1)})},createSlots({title:withCtx(()=>[p[4]||(p[4]=createBaseVNode("span",null,"Nyttige lenker i Finn-annonsen",-1)),createVNode(Tooltip,{class:"k-ml-xxs",content:"Nyttige lenker vises her i enhetsannonsen. Noen felt er standard og låst av Finn, derfor vises lenken til prosjektsiden alltid automatisk. Du kan fritt legge til egne lenker og lenker til andre nettsteder.",src:"https://assets.kvass.no/67c80a5e92504cdf70aba756"})]),actions:withCtx(()=>[withDirectives(createVNode(unref(Ue),{class:normalizeClass(["ad__expandable-list-field-icon",{"ad__expandable-list-field-icon--edited":x("MOREINFO")}]),icon:k("MOREINFO").icon},null,8,["class","icon"]),[[unref(Mt),{content:k("MOREINFO").label,container:!1}]])]),default:withCtx(({item:u,index:b})=>[createVNode(unref(AB),{columns:"2"},{default:withCtx(()=>[createVNode(unref(gx),{label:"URL til nyttig lenke",onBlur:()=>s.value[`MOREINFO.${b}.URL`]=!0,error:s.value[`MOREINFO.${b}.URL`]?Object.entries(unref(f).errors.value.errors).filter(([E,T])=>E===`MOREINFO.${b}.URL`).map(([E,T])=>T).flat().join(`
4
4
  `):void 0},{default:withCtx(()=>[createVNode(unref(hy),{modelValue:u.URL,"onUpdate:modelValue":E=>u.URL=E,suffix:"URL"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["onBlur","error"]),createVNode(unref(gx),{label:"Visningsnavn på lenken på Finn-annonsen"},{default:withCtx(()=>[createVNode(unref(hy),{modelValue:u.URLTEXT,"onUpdate:modelValue":E=>u.URLTEXT=E},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1024)]),_:2},[e.hasFields("ESTATE_EXTERNAL_URL","ESTATE_EXTERNAL_ORDER_URL")?{name:"before-content",fn:withCtx(()=>[createVNode(unref(AB),{columns:"2"},{default:withCtx(()=>[e.hasField("ESTATE_EXTERNAL_URL")?(openBlock(),createElementBlock(Fragment,{key:0},[createVNode(unref(gx),{label:"URL til nyttig lenke"},{default:withCtx(()=>[createVNode(unref(hy),{modelValue:d.data.ESTATE_EXTERNAL_URL,"onUpdate:modelValue":p[0]||(p[0]=u=>d.data.ESTATE_EXTERNAL_URL=u),suffix:"URL",disabled:""},null,8,["modelValue"])]),_:1}),createVNode(unref(gx),{label:"Visningsnavn på lenken på Finn-annonsen"},{default:withCtx(()=>[createVNode(unref(hy),{modelValue:"Se prosjektets hjemmeside",disabled:""})]),_:1})],64)):createCommentVNode("",!0),e.hasField("ESTATE_EXTERNAL_ORDER_URL")?(openBlock(),createElementBlock(Fragment,{key:1},[createVNode(unref(gx),{label:"URL til nyttig lenke"},{default:withCtx(()=>[createVNode(unref(hy),{modelValue:d.data.ESTATE_EXTERNAL_ORDER_URL,"onUpdate:modelValue":p[1]||(p[1]=u=>d.data.ESTATE_EXTERNAL_ORDER_URL=u),suffix:"URL",disabled:""},null,8,["modelValue"])]),_:1}),createVNode(unref(gx),{label:"Visningsnavn på lenken på Finn-annonsen"},{default:withCtx(()=>[createVNode(unref(hy),{modelValue:"Bestill salgsoppgave",disabled:""})]),_:1})],64)):createCommentVNode("",!0)]),_:1}),p[5]||(p[5]=createBaseVNode("div",{class:"ad__expandable-list-divider"},null,-1))]),key:"0"}:void 0]),1032,["modelValue"])):createCommentVNode("",!0)]),actions:withCtx(({close:u})=>[createVNode(unref(Se),{label:"Avbryt",onClick:()=>{g(),u()},variant:"secondary"},null,8,["onClick"]),withDirectives(createVNode(unref(Se),{disabled:!unref(f).passes.value,label:"Bekreft",onClick:()=>{unref(f).passes&&(S(),u())},variant:"primary"},null,8,["disabled","onClick"]),[[unref(Mt),{content:Object.entries(unref(f).errors.value.errors).map(([b,E])=>E).flat().join(`
@@ -1,4 +1,4 @@
1
- import{G as mp,q as Ge,d as Ee,o as F,E as Xe,w as Ie,z as wk,b as ne,c as Y,a as le,g as me,j as qe,v as _e,C as ht,t as ye,A as Tk,e as oe,m as Ze,f as ee,r as ka,i as jt,n as Gt,y as Ur,H as _a,I as Qd,F as ft,l as er,s as Xt,J as Xn,K as ys,L as ql,D as ll,M as Ek,N as Hf,B as qf,O as Sk,P as ec,u as cS,Q as pS,R as Ck,S as tc,U as hS,V as Ak,W as Uf,X as Ar,Y as dr,Z as fS,$ as Nt,a0 as Ok,k as mS,a1 as Mk,h as gS,a2 as vS,a3 as bS,a4 as Wf,a5 as Gf,a6 as Zf,a7 as Er,_ as yS,p as kS}from"./_plugin-vue_export-helper.js";import{F as _S}from"./index.es2.js";function xS(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in e)){const o=Object.getOwnPropertyDescriptor(i,n);o&&Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}class to extends Error{response;request;constructor(t,r){const i=`${to.extractMessage(t)}: ${JSON.stringify({response:t,request:r})}`;super(i),Object.setPrototypeOf(this,to.prototype),this.response=t,this.request=r,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,to)}static extractMessage(t){return t.errors?.[0]?.message??`GraphQL Error (Code: ${String(t.status)})`}}const _v=e=>e.toUpperCase(),gp=e=>typeof e=="function"?e():e,Lk=(e,t)=>e.map((r,i)=>[r,t[i]]),Uo=e=>{let t={};return e instanceof Headers?t=wS(e):Array.isArray(e)?e.forEach(([r,i])=>{r&&i!==void 0&&(t[r]=i)}):e&&(t=e),t},wS=e=>{const t={};return e.forEach((r,i)=>{t[i]=r}),t},TS=e=>{try{const t=e();return ES(t)?t.catch(r=>xv(r)):t}catch(t){return xv(t)}},xv=e=>e instanceof Error?e:new Error(String(e)),ES=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"&&"catch"in e&&typeof e.catch=="function"&&"finally"in e&&typeof e.finally=="function",Kf=e=>{throw new Error(`Unhandled case: ${String(e)}`)},vu=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),SS=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0},CS=(e,t,r)=>e.query?e:{query:e,variables:t,requestHeaders:r,signal:void 0};function bu(e,t){throw new Error(t)}function AS(e){return typeof e=="object"&&e!==null}function OS(e,t){throw new Error("Unexpected invariant triggered.")}const MS=/\r\n|[\n\r]/g;function Th(e,t){let r=0,i=1;for(const n of e.body.matchAll(MS)){if(typeof n.index=="number"||OS(),n.index>=t)break;r=n.index+n[0].length,i+=1}return{line:i,column:t+1-r}}function LS(e){return Pk(e.source,Th(e.source,e.start))}function Pk(e,t){const r=e.locationOffset.column-1,i="".padStart(r)+e.body,n=t.line-1,o=e.locationOffset.line-1,a=t.line+o,l=t.line===1?r:0,u=t.column+l,c=`${e.name}:${a}:${u}
1
+ import{E as mp,q as Ge,o as F,d as Ee,D as Xe,w as Ie,y as wk,a as le,c as Y,g as me,j as qe,v as _e,b as ne,B as ht,t as ye,z as Tk,m as Ze,r as ka,e as oe,f as ee,i as jt,n as Gt,x as Ur,G as Qd,F as ft,l as er,H as _a,s as Xt,I as Xn,J as ys,K as ql,C as ll,L as Ek,M as Hf,A as qf,N as Sk,O as ec,u as cS,P as pS,Q as Ck,R as Ak,S as hS,U as Uf,V as Ar,W as fS,X as dr,Y as tc,Z as Nt,$ as Ok,k as mS,a0 as Mk,h as gS,a1 as vS,a2 as bS,a3 as Wf,a4 as Gf,a5 as Zf,a6 as Er,_ as yS,p as kS}from"./_plugin-vue_export-helper.js";import{F as _S}from"./index.es2.js";function xS(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in e)){const o=Object.getOwnPropertyDescriptor(i,n);o&&Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}class to extends Error{response;request;constructor(t,r){const i=`${to.extractMessage(t)}: ${JSON.stringify({response:t,request:r})}`;super(i),Object.setPrototypeOf(this,to.prototype),this.response=t,this.request=r,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,to)}static extractMessage(t){return t.errors?.[0]?.message??`GraphQL Error (Code: ${String(t.status)})`}}const _v=e=>e.toUpperCase(),gp=e=>typeof e=="function"?e():e,Lk=(e,t)=>e.map((r,i)=>[r,t[i]]),Uo=e=>{let t={};return e instanceof Headers?t=wS(e):Array.isArray(e)?e.forEach(([r,i])=>{r&&i!==void 0&&(t[r]=i)}):e&&(t=e),t},wS=e=>{const t={};return e.forEach((r,i)=>{t[i]=r}),t},TS=e=>{try{const t=e();return ES(t)?t.catch(r=>xv(r)):t}catch(t){return xv(t)}},xv=e=>e instanceof Error?e:new Error(String(e)),ES=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"&&"catch"in e&&typeof e.catch=="function"&&"finally"in e&&typeof e.finally=="function",Kf=e=>{throw new Error(`Unhandled case: ${String(e)}`)},vu=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),SS=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0},CS=(e,t,r)=>e.query?e:{query:e,variables:t,requestHeaders:r,signal:void 0};function bu(e,t){throw new Error(t)}function AS(e){return typeof e=="object"&&e!==null}function OS(e,t){throw new Error("Unexpected invariant triggered.")}const MS=/\r\n|[\n\r]/g;function Th(e,t){let r=0,i=1;for(const n of e.body.matchAll(MS)){if(typeof n.index=="number"||OS(),n.index>=t)break;r=n.index+n[0].length,i+=1}return{line:i,column:t+1-r}}function LS(e){return Pk(e.source,Th(e.source,e.start))}function Pk(e,t){const r=e.locationOffset.column-1,i="".padStart(r)+e.body,n=t.line-1,o=e.locationOffset.line-1,a=t.line+o,l=t.line===1?r:0,u=t.column+l,c=`${e.name}:${a}:${u}
2
2
  `,p=i.split(/\r\n|[\n\r]/g),f=p[n];if(f.length>120){const g=Math.floor(u/80),m=u%80,b=[];for(let y=0;y<f.length;y+=80)b.push(f.slice(y,y+80));return c+wv([[`${a} |`,b[0]],...b.slice(1,g+1).map(y=>["|",y]),["|","^".padStart(m)],["|",b[g+1]]])}return c+wv([[`${a-1} |`,p[n-1]],[`${a} |`,f],["|","^".padStart(u)],[`${a+1} |`,p[n+1]]])}function wv(e){const t=e.filter(([i,n])=>n!==void 0),r=Math.max(...t.map(([i])=>i.length));return t.map(([i,n])=>i.padStart(r)+(n?" "+n:"")).join(`
3
3
  `)}function PS(e){const t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}class Yf extends Error{constructor(t,...r){var i,n,o;const{nodes:a,source:l,positions:u,path:c,originalError:p,extensions:f}=PS(r);super(t),this.name="GraphQLError",this.path=c??void 0,this.originalError=p??void 0,this.nodes=Tv(Array.isArray(a)?a:a?[a]:void 0);const g=Tv((i=this.nodes)===null||i===void 0?void 0:i.map(b=>b.loc).filter(b=>b!=null));this.source=l??(g==null||(n=g[0])===null||n===void 0?void 0:n.source),this.positions=u??g?.map(b=>b.start),this.locations=u&&l?u.map(b=>Th(l,b)):g?.map(b=>Th(b.source,b.start));const m=AS(p?.extensions)?p?.extensions:void 0;this.extensions=(o=f??m)!==null&&o!==void 0?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),p!=null&&p.stack?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Yf):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const r of this.nodes)r.loc&&(t+=`
4
4