PageSourceSearch

https://flottegulve.lovable.app/assets/SocialMediaAdmin-DKqNKj_Q.js

js flottegulve.lovable.app collected 2026-10-03 03:32:17 UTC 34,037 bytes, 2 lines download raw bytes

1import{j as s,r as w,u as we}from"./index-If4P5t44.js";import{T as ve,a as Se,b as Z,c as X}from"./tabs-g3V4PLAH.js";import{B as R}from"./button-CO1UM39t.js";import{C as b}from"./card-BXtirX8f.js";import{I as j}from"./input-CHQSMs9m.js";import{L as h}from"./label-20_1edRh.js";import{S as P,a as k,b as E,c as L,d as y}from"./select-CLlElsRq.js";import{S as ae}from"./slider-CvDGJvib.js";import{u as I}from"./index-fwc8i9GA.js";import{c as v}from"./campaignProducts-DaYF1mh1.js";import{C as Ce}from"./copy-DaFUdEyl.js";import{D as le}from"./download-B5Hzb1jP.js";import{S as H}from"./switch-DYs3tbhl.js";import{A as $e}from"./arrow-left-gN1P5YyH.js";import"./index-BHk7Wn1T.js";import"./utils-ClF6eiV5.js";import"./index-BSXfGfzY.js";import"./index-CkcNIVng.js";import"./index-BpFHpKBX.js";import"./index-IwD7A4tH.js";import"./index-BdQq_4o_.js";import"./index-CIYSN-nV.js";import"./Combination-DxhRFPMF.js";import"./index-CpNrbBok.js";import"./tslib.es6-Ds0fHAFP.js";import"./chevron-up-7_fqqLnM.js";const Fe=({size:e})=>{const t=e/2,n=e/2,r=e/2-4,l=Array.from({length:6},(a,o)=>{const d=Math.PI/3*o-Math.PI/2;return`${t+r*Math.cos(d)},${n+r*Math.sin(d)}`}).join(" ");return s.jsx("polygon",{points:l})},Te=({size:e})=>{const t=e/2,n=e*.08;return s.jsx("polygon",{points:`${t},${n} ${e-n},${t} ${t},${e-n} ${n},${t}`})},Pe=({size:e})=>{const t=e,n=e;return s.jsx("path",{d:`M${t*.1},${n*.15} L${t*.9},${n*.15} Q${t*.95},${n*.15} ${t*.95},${n*.2} L${t*.95},${n*.75} Q${t*.95},${n*.8} ${t*.9},${n*.8} L${t*.55},${n*.8} L${t*.5},${n*.9} L${t*.45},${n*.8} L${t*.1},${n*.8} Q${t*.05},${n*.8} ${t*.05},${n*.75} L${t*.05},${n*.2} Q${t*.05},${n*.15} ${t*.1},${n*.15} Z`})},ke=({size:e,fillColor:t,strokeColor:n})=>{const r=e/2,l=e/2,a=e/2-4,o=a-6,d=o-4;return s.jsxs("g",{children:[s.jsx("circle",{cx:r,cy:l,r:a,fill:"none",stroke:n||t,strokeWidth:2,opacity:.4}),s.jsx("circle",{cx:r,cy:l,r:o,fill:t,stroke:n||"none",strokeWidth:n?1.5:0}),s.jsx("circle",{cx:r,cy:l,r:d,fill:"none",stroke:n||"rgba(255,255,255,0.25)",strokeWidth:1})]})},Ee=({size:e})=>{const t=e,n=e;return s.jsx("path",{d:`M${t*.5},${n*.05} L${t*.9},${n*.2} L${t*.9},${n*.55} Q${t*.9},${n*.85} ${t*.5},${n*.95} Q${t*.1},${n*.85} ${t*.1},${n*.55} L${t*.1},${n*.2} Z`})},Le=({shape:e,fillColor:t,strokeColor:n,size:r=200,children:l})=>{const a=()=>{const o={fill:t,stroke:n||"none",strokeWidth:n?2:0};switch(e){case"circle":return s.jsx("circle",{cx:r/2,cy:r/2,r:r/2-4,...o});case"rounded-rect":return s.jsx("rect",{x:4,y:r*.15,width:r-8,height:r*.7,rx:16,...o});case"ribbon":return s.jsxs("g",{...o,children:[s.jsx("path",{d:`M0,${r*.25} L${r*.1},${r*.2} L${r*.9},${r*.2} L${r},${r*.25} L${r},${r*.75} L${r*.9},${r*.8} L${r*.1},${r*.8} L0,${r*.75} Z`}),s.jsx("path",{d:`M0,${r*.75} L${r*.05},${r*.85} L${r*.1},${r*.8} Z`,fill:n||t,opacity:.6}),s.jsx("path",{d:`M${r},${r*.75} L${r*.95},${r*.85} L${r*.9},${r*.8} Z`,fill:n||t,opacity:.6})]});case"shield":return s.jsx("g",{...o,children:s.jsx(Ee,{size:r})});case"hexagon":return s.jsx("g",{...o,children:s.jsx(Fe,{size:r})});case"diamond":return s.jsx("g",{...o,children:s.jsx(Te,{size:r})});case"tag":return s.jsx("g",{...o,children:s.jsx(Pe,{size:r})});case"seal":return s.jsx(ke,{size:r,fillColor:t,strokeColor:n});default:return s.jsx("circle",{cx:r/2,cy:r/2,r:r/2-4,...o})}};return s.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,xmlns:"http://www.w3.org/2000/svg",children:[a(),l]})},W=[{value:"circle",label:"Cirkel"},{value:"seal",label:"Segl"},{value:"hexagon",label:"Hexagon"},{value:"diamond",label:"Diamant"},{value:"shield",label:"Skjold"},{value:"tag",label:"Mærke"},{value:"ribbon",label:"Bånd"},{value:"rounded-rect",label:"Afrundet"}],_=({config:e,size:t=200})=>{const{shape:n,text:r,subText:l,thirdText:a,fourthText:o,fillColor:d,textColor:u,accentColor:g,strokeColor:x}=e,i=[];r&&i.push({text:r}),l&&i.push({text:l,accent:!0}),a&&i.push({text:a}),o&&i.push({text:o,accent:!0});const c=t*.7,m=Math.max(...i.map(B=>B.text.length),1),C=c/(m*.6),G=t*.55/Math.max(i.length,1),pe=Math.min(C,G,t*.18),be=t/200,N=Math.max(pe,8*be),ye=i.length*N*1.25,je=t/2-ye/2+N*.5;return s.jsx(Le,{shape:n,fillColor:d,strokeColor:x,size:t,children:i.map((B,A)=>s.jsx("text",{x:t/2,y:je+A*N*1.25,textAnchor:"middle",dominantBaseline:"central",fill:B.accent&&g?g:u,fontSize:A===0||A===1&&i.length<=2?N:N*.75,fontWeight:A<=1?"bold":"600",fontFamily:"system-ui, sans-serif",children:B.text},A))})},Re=[{label:"Sort",fill:"#18181B",text:"#FFFFFF"},{label:"Mørk Træ",fill:"#3D2B1F",text:"#FFFFFF"},{label:"Varm Amber",fill:"hsl(35,65%,55%)",text:"#FFFFFF"},{label:"Guld",fill:"#CA8A04",text:"#18181B"},{label:"Terracotta",fill:"hsl(17,88%,40%)",text:"#FFFFFF"},{label:"Skov",fill:"#166534",text:"#FFFFFF"}],Ne=[{label:"Spar %",config:{text:"Laminatgulv",subText:"Spar 50%",thirdText:"Tilbudspris",fourthText:"99 kr./m²",shape:"circle",fillColor:"#18181B",textColor:"#FFFFFF",accentColor:"#CA8A04"}},{label:"Månedens Tilbud",config:{text:"Månedens",subText:"Tilbud",thirdText:"",fourthText:"",shape:"seal",fillColor:"#3D2B1F",textColor:"#FFFFFF",accentColor:"#CA8A04"}},{label:"Tilbudspris",config:{text:"Tilbudspris",subText:"Fra 89 kr./m²",thirdText:"",fourthText:"",shape:"hexagon",fillColor:"hsl(35,65%,55%)",textColor:"#FFFFFF",accentColor:""}},{label:"Gratis Prøver",config:{text:"Gratis",subText:"Prøver",thirdText:"",fourthText:"",shape:"shield",fillColor:"#166534",textColor:"#FFFFFF",accentColor:""}},{label:"Bestseller",config:{text:"Bestseller",subText:"",thirdText:"",fourthText:"",shape:"diamond",fillColor:"#CA8A04",textColor:"#18181B",accentColor:""}},{label:"Nyt Produkt",config:{text:"NYT!",subText:"Lige Landet",thirdText:"",fourthText:"",shape:"tag",fillColor:"hsl(17,88%,40%)",textColor:"#FFFFFF",accentColor:""}}],Ae=()=>{const e=w.useRef(null),[t,n]=w.useState({shape:"circle",text:"Laminatgulv",subText:"Spar 50%",thirdText:"Tilbudspris",fourthText:"99 kr./m²",fillColor:"#18181B",textColor:"#FFFFFF",accentColor:"#CA8A04",strokeColor:""}),[r,l]=w.useState(""),[a,o]=w.useState(200),d=i=>({traegulv:"Trægulv",laminat:"Laminatgulv",vinyl:"Vinylgulv",sildeben:"Sildeben",klinker:"Klinker",hybrid:"Hybridgulv",taepper:"Tæpper"})[i]||i,u=i=>{const c=v.find(m=>m.id===i);c&&(l(i),n(m=>({...m,text:d(c.category),subText:c.discount>0?`Spar ${c.discount}%`:"",thirdText:"Tilbudspris",fourthText:`${c.campaignPrice} kr./${c.unit}`})))},g=()=>{var c;const i=(c=e.current)==null?void 0:c.querySelector("svg");i&&(navigator.clipboard.writeText(i.outerHTML),I.success("SVG kopieret til udklipsholder"))},x=()=>{var C;const i=(C=e.current)==null?void 0:C.querySelector("svg");if(!i)return;const c=new Blob([i.outerHTML],{type:"image/svg+xml"}),m=URL.createObjectURL(c),$=document.createElement("a");$.href=m,$.download=`badge-${t.shape}-${Date.now()}.svg`,$.click(),URL.revokeObjectURL(m),I.success("SVG downloadet")};return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-5",children:[s.jsxs(b,{className:"p-4",children:[s.jsx(h,{className:"text-sm font-semibold mb-2 block",children:"Forudindstillinger"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:Ne.map(i=>s.jsx(R,{variant:"outline",size:"sm",onClick:()=>n(c=>({...c,...i.config})),children:i.label},i.label))})]}),s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsx(h,{className:"text-sm font-semibold",children:"Auto-udfyld fra produkt"}),s.jsxs(P,{value:r,onValueChange:u,children:[s.jsx(k,{children:s.jsx(E,{placeholder:"Vælg produkt..."})}),s.jsx(L,{children:v.map(i=>s.jsx(y,{value:i.id,children:i.name},i.id))})]})]}),s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsxs("div",{children:[s.jsx(h,{className:"text-sm font-semibold",children:"Form"}),s.jsxs(P,{value:t.shape,onValueChange:i=>n(c=>({...c,shape:i})),children:[s.jsx(k,{children:s.jsx(E,{})}),s.jsx(L,{children:W.map(i=>s.jsx(y,{value:i.value,children:i.label},i.value))})]})]}),s.jsxs("div",{children:[s.jsx(h,{className:"text-sm font-semibold",children:"Linje 1"}),s.jsx(j,{value:t.text,onChange:i=>n(c=>({...c,text:i.target.value}))})]}),s.jsxs("div",{children:[s.jsx(h,{className:"text-sm font-semibold",children:"Linje 2"}),s.jsx(j,{value:t.subText||"",onChange:i=>n(c=>({...c,subText:i.target.value}))})]}),s.jsxs("div",{children:[s.jsx(h,{className:"text-sm font-semibold",children:"Linje 3"}),s.jsx(j,{value:t.thirdText||"",onChange:i=>n(c=>({...c,thirdText:i.target.value}))})]}),s.jsxs("div",{children:[s.jsx(h,{className:"text-sm font-semibold",children:"Linje 4"}),s.jsx(j,{value:t.fourthText||"",onChange:i=>n(c=>({...c,fourthText:i.target.value}))})]})]}),s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsx(h,{className:"text-sm font-semibold",children:"Hurtigfarver"}),s.jsx("div",{className:"flex gap-2 flex-wrap",children:Re.map(i=>s.jsx("button",{className:"w-8 h-8 rounded-full border-2 border-border hover:scale-110 transition-transform",style:{background:i.fill},title:i.label,onClick:()=>n(c=>({...c,fillColor:i.fill,textColor:i.text}))},i.label))}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx(h,{className:"text-xs",children:"Baggrundsfarve"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx("input",{type:"color",value:t.fillColor,onChange:i=>n(c=>({...c,fillColor:i.target.value})),className:"w-8 h-8 rounded cursor-pointer"}),s.jsx(j,{value:t.fillColor,onChange:i=>n(c=>({...c,fillColor:i.target.value})),className:"text-xs"})]})]}),s.jsxs("div",{children:[s.jsx(h,{className:"text-xs",children:"Tekstfarve"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx("input",{type:"color",value:t.textColor,onChange:i=>n(c=>({...c,textColor:i.target.value})),className:"w-8 h-8 rounded cursor-pointer"}),s.jsx(j,{value:t.textColor,onChange:i=>n(c=>({...c,textColor:i.target.value})),className:"text-xs"})]})]}),s.jsxs("div",{children:[s.jsx(h,{className:"text-xs",children:"Accent farve"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx("input",{type:"color",value:t.accentColor||"#CA8A04",onCh
1ange:i=>n(c=>({...c,accentColor:i.target.value})),className:"w-8 h-8 rounded cursor-pointer"}),s.jsx(j,{value:t.accentColor||"",placeholder:"#CA8A04",onChange:i=>n(c=>({...c,accentColor:i.target.value})),className:"text-xs"})]})]})]})]}),s.jsxs(b,{className:"p-4",children:[s.jsxs(h,{className:"text-sm font-semibold",children:["Preview størrelse: ",a,"px"]}),s.jsx(ae,{value:[a],min:80,max:400,step:10,onValueChange:([i])=>o(i)})]})]}),s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx(b,{className:"p-8 flex items-center justify-center bg-muted/30",style:{minHeight:300},children:s.jsx("div",{ref:e,children:s.jsx(_,{config:t,size:a})})}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(R,{variant:"outline",onClick:g,children:[s.jsx(Ce,{className:"mr-2 h-4 w-4"}),"Kopiér SVG"]}),s.jsxs(R,{onClick:x,children:[s.jsx(le,{className:"mr-2 h-4 w-4"}),"Download SVG"]})]}),s.jsxs(b,{className:"p-4 w-full",children:[s.jsx(h,{className:"text-sm font-semibold mb-3 block",children:"Alle former"}),s.jsx("div",{className:"grid grid-cols-4 gap-3",children:W.map(i=>s.jsxs("button",{onClick:()=>n(c=>({...c,shape:i.value})),className:`p-2 rounded-lg border-2 transition-all hover:scale-105 ${t.shape===i.value?"border-primary bg-primary/10":"border-border"}`,children:[s.jsx(_,{config:{...t,shape:i.value},size:60}),s.jsx("p",{className:"text-xs text-center mt-1",children:i.label})]},i.value))})]})]})]})};function Be(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),l=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(l),t&&(r.href=t),l.href=e,l.href}const Ie=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function S(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let F=null;function ie(e={}){return F||(e.includeStyleProperties?(F=e.includeStyleProperties,F):(F=S(window.getComputedStyle(document.documentElement)),F))}function M(e,t){const r=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function Me(e){const t=M(e,"border-left-width"),n=M(e,"border-right-width");return e.clientWidth+t+n}function Ve(e){const t=M(e,"border-top-width"),n=M(e,"border-bottom-width");return e.clientHeight+t+n}function oe(e,t={}){const n=t.width||Me(e),r=t.height||Ve(e);return{width:n,height:r}}function De(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const p=16384;function Oe(e){(e.width>p||e.height>p)&&(e.width>p&&e.height>p?e.width>e.height?(e.height*=p/e.width,e.width=p):(e.width*=p/e.height,e.height=p):e.width>p?(e.height*=p/e.width,e.width=p):(e.width*=p/e.height,e.height=p))}function V(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function Ge(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function He(e,t,n){const r="http://www.w3.org/2000/svg",l=document.createElementNS(r,"svg"),a=document.createElementNS(r,"foreignObject");return l.setAttribute("width",`${t}`),l.setAttribute("height",`${n}`),l.setAttribute("viewBox",`0 0 ${t} ${n}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),l.appendChild(a),a.appendChild(e),Ge(l)}const f=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||f(n,t)};function Ue(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function We(e,t){return ie(t).map(n=>{const r=e.getPropertyValue(n),l=e.getPropertyPriority(n);return`${n}: ${r}${l?" !important":""};`}).join(" ")}function _e(e,t,n,r){const l=`.${e}:${t}`,a=n.cssText?Ue(n):We(n,r);return document.createTextNode(`${l}{${a}}`)}function Y(e,t,n,r){const l=window.getComputedStyle(e,n),a=l.getPropertyValue("content");
1if(a===""||a==="none")return;const o=Ie();try{t.className=`${t.className} ${o}`}catch{return}const d=document.createElement("style");d.appendChild(_e(o,n,l,r)),t.appendChild(d)}function qe(e,t,n){Y(e,t,":before",n),Y(e,t,":after",n)}const J="application/font-woff",z="image/jpeg",Ke={woff:J,woff2:J,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:z,jpeg:z,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Qe(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function K(e){const t=Qe(e).toLowerCase();return Ke[t]||""}function Ze(e){return e.split(/,/)[1]}function q(e){return e.search(/^(data:)/)!==-1}function Xe(e,t){return`data:${t};base64,${e}`}async function ce(e,t,n){const r=await fetch(e,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const l=await r.blob();return new Promise((a,o)=>{const d=new FileReader;d.onerror=o,d.onloadend=()=>{try{a(n({res:r,result:d.result}))}catch(u){o(u)}},d.readAsDataURL(l)})}const U={};function Ye(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function Q(e,t,n){const r=Ye(e,t,n.includeQueryParams);if(U[r]!=null)return U[r];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let l;try{const a=await ce(e,n.fetchRequestInit,({res:o,result:d})=>(t||(t=o.headers.get("Content-Type")||""),Ze(d)));l=Xe(a,t)}catch(a){l=n.imagePlaceholder||"";let o=`Failed to fetch resource: ${e}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return U[r]=l,l}async function Je(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):V(t)}async function ze(e,t){if(e.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,o==null||o.drawImage(e,0,0,a.width,a.height);const d=a.toDataURL();return V(d)}const n=e.poster,r=K(n),l=await Q(n,r,t);return V(l)}async function et(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await O(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function tt(e,t){return f(e,HTMLCanvasElement)?Je(e):f(e,HTMLVideoElement)?ze(e,t):f(e,HTMLIFrameElement)?et(e,t):e.cloneNode(de(e))}const rt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",de=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function st(e,t,n){var r,l;if(de(t))return t;let a=[];return rt(e)&&e.assignedNodes?a=S(e.assignedNodes()):f(e,HTMLIFrameElement)&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?a=S(e.contentDocument.body.childNodes):a=S(((l=e.shadowRoot)!==null&&l!==void 0?l:e).childNodes),a.length===0||f(e,HTMLVideoElement)||await a.reduce((o,d)=>o.then(()=>O(d,n)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function nt(e,t,n){const r=t.style;if(!r)return;const l=window.getComputedStyle(e);l.cssText?(r.cssText=l.cssText,r.transformOrigin=l.transformOrigin):ie(n).forEach(a=>{let o=l.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),f(e,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(a,o,l.getPropertyPriority(a))})}function at(e,t){f(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),f(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lt(e,t){if(f(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find(l=>e.value===l.getAttribute("value"));r&&r.setAttribute("selected","")}}function it(e,t,n){return f(t,Element)&&(nt(e,t,n),qe(e,t,n),at(e,t),lt(e,t)),t}async function ot(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const r={};for(let a=0;a<n.length;a++){const d=n[a].getAttribute("xlink:href");if(d){const u=e.querySelector(d),g=document.querySelector(d);!u&&g&&!r[d]&&(r[d]=await O(g,t,!0))}}const l=Object.values(r);if(l.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const d=document.createElementNS(a,"defs");o.appendChild(d);for(let u=0;u<l.length;u++)d.appendChild(l[u]);e.appendChild(o)}return e}async function O(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(r=>tt(r,t)).then(r=>st(e,r,t)).then(r=>it(e,r,t)).then(r=>ot(r,t))}const ue=/url\((['"]?)([^'"]+?)\1\)/g,ct=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,dt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ut(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function ht(e){const t=[];return e.replace(ue,(n,r,l)=>(t.push(l),n)),t.filter(n=>!q(n))}async function mt(e,t,n,r,l){try{const a=n?Be(t,n):t,o=K(t);let d;return l||(d=await Q(a,o,r)),e.replace(ut(t),`$1${d}$3`)}catch{}return e}function gt(e,{preferredFontFormat:t}){return t?e.replace(dt,n=>{for(;;){const[r,,l]=ct.exec(n)||[];if(!l)return"";if(l===t)return`src: ${r};`}}):e}function he(e){return e.search(ue)!==-1}async function me(e,t,n){if(!he(e))return e;const r=gt(e,n);return ht(r).reduce((a,o)=>a.then(d=>mt(d,o,t,n)),Promise.resolve(r))}async function T(e,t,n){var r;const l=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(e);if(l){const a=await me(l,null,n);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function xt(e,t){await T("background",e,t)||await T("background-image",e,t),await T("mask",e,t)||await T("-webkit-mask",e,t)||await T("mask-image",e,t)||await T("-webkit-mask-image",e,t)}async function ft(e,t){const n=f(e,HTMLImageElement);if(!(n&&!q(e.src))&&!(f(e,SVGImageElement)&&!q(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,l=await Q(r,K(r),t);await new Promise((a,o)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...u)=>{try{a(t.onImageErrorHandler(...u))}catch(g){o(g)}}:o;const d=e;d.decode&&(d.decode=a),d.loading==="lazy"&&(d.loading="eager"),n?(e.srcset="",e.src=l):e.href.baseVal=l})}async function pt(e,t){const r=S(e.childNodes).map(l=>ge(l,t));await Promise.all(r).then(()=>e)}async function ge(e,t){f(e,Element)&&(await xt(e,t),await ft(e,t),await pt(e,t))}function bt(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;return r!=null&&Object.keys(r).forEach(l=>{n[l]=r[l]}),e}const ee={};async function te(e){let t=ee[e];if(t!=null)return t;const r=await(await fetch(e)).text();return t={url:e,cssText:r},ee[e]=t,t}async function re(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,a=(n.match(/url\([^)]+\)/g)||[]).map(async o=>{let d=o.replace(r,"$1");return d.startsWith("https://")||(d=new URL(d,e.url).href),ce(d,t.fetchRequestInit,({result:u})=>(n=n.replace(o,`url(${u})`),[o,u]))});return Promise.all(a).then(()=>n)}function se(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=e.replace(n,"");const l=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)}
1)","gi");for(;;){const u=l.exec(r);if(u===null)break;t.push(u[0])}r=r.replace(l,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",d=new RegExp(o,"gi");for(;;){let u=a.exec(r);if(u===null){if(u=d.exec(r),u===null)break;a.lastIndex=d.lastIndex}else d.lastIndex=a.lastIndex;t.push(u[0])}return t}async function yt(e,t){const n=[],r=[];return e.forEach(l=>{if("cssRules"in l)try{S(l.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let d=o+1;const u=a.href,g=te(u).then(x=>re(x,t)).then(x=>se(x).forEach(i=>{try{l.insertRule(i,i.startsWith("@import")?d+=1:l.cssRules.length)}catch(c){console.error("Error inserting rule from remote css",{rule:i,error:c})}})).catch(x=>{console.error("Error loading remote css",x.toString())});r.push(g)}})}catch(a){const o=e.find(d=>d.href==null)||document.styleSheets[0];l.href!=null&&r.push(te(l.href).then(d=>re(d,t)).then(d=>se(d).forEach(u=>{o.insertRule(u,o.cssRules.length)})).catch(d=>{console.error("Error loading remote stylesheet",d)})),console.error("Error inlining remote css file",a)}}),Promise.all(r).then(()=>(e.forEach(l=>{if("cssRules"in l)try{S(l.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${l.href}`,a)}}),n))}function jt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>he(t.style.getPropertyValue("src")))}async function wt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=S(e.ownerDocument.styleSheets),r=await yt(n,t);return jt(r)}function xe(e){return e.trim().replace(/["']/g,"")}function vt(e){const t=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{t.add(xe(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(e),t}async function St(e,t){const n=await wt(e,t),r=vt(e);return(await Promise.all(n.filter(a=>r.has(xe(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return me(a.cssText,o,t)}))).join(`
2`)}async function Ct(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await St(e,t);if(n){const r=document.createElement("style"),l=document.createTextNode(n);r.appendChild(l),e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}}async function $t(e,t={}){const{width:n,height:r}=oe(e,t),l=await O(e,t,!0);return await Ct(l,t),await ge(l,t),bt(l,t),await He(l,n,r)}async function Ft(e,t={}){const{width:n,height:r}=oe(e,t),l=await $t(e,t),a=await V(l),o=document.createElement("canvas"),d=o.getContext("2d"),u=t.pixelRatio||De(),g=t.canvasWidth||n,x=t.canvasHeight||r;return o.width=g*u,o.height=x*u,t.skipAutoScale||Oe(o),o.style.width=`${g}`,o.style.height=`${x}`,t.backgroundColor&&(d.fillStyle=t.backgroundColor,d.fillRect(0,0,o.width,o.height)),d.drawImage(a,0,0,o.width,o.height),o}async function Tt(e,t={}){return(await Ft(e,t)).toDataURL()}const D=[{id:"ig-square",label:"Kvadrat",platform:"Instagram",width:1080,height:1080},{id:"ig-portrait",label:"Portræt",platform:"Instagram",width:1080,height:1350},{id:"fb-landscape",label:"Landskab",platform:"Facebook",width:1200,height:630},{id:"fb-square",label:"Kvadrat",platform:"Facebook",width:1080,height:1080}],Pt=({selectedFormat:e,onSelect:t})=>{const n={Instagram:D.filter(r=>r.platform==="Instagram"),Facebook:D.filter(r=>r.platform==="Facebook")};return s.jsx("div",{className:"space-y-3",children:Object.entries(n).map(([r,l])=>s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:r}),s.jsx("div",{className:"flex gap-2",children:l.map(a=>s.jsxs(R,{size:"sm",variant:e===a.id?"default":"outline",onClick:()=>t(a.id),className:"text-xs",children:[a.label,s.jsxs("span",{className:"ml-1 opacity-60",children:[a.width,"×",a.height]})]},a.id))})]},r))})},kt={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-20 left-4","bottom-right":"bottom-20 right-4"},fe=w.forwardRef(({config:e,width:t,height:n,previewScale:r=.4},l)=>{const{product:a,badge:o,showBadge:d,bgStyle:u,bgColor:g,bgGradient:x,overlayOpacity:i,showPriceBar:c,showBrandBar:m,badgePosition:$}=e,C=a?/^https?:\/\//.test(a.image)?a.image:`/images/products/${a.image}`:"",G=u==="product-image"&&C?{backgroundImage:`url(${C})`,backgroundSize:"cover",backgroundPosition:"center"}:u==="gradient"?{background:x}:{backgroundColor:g};return s.jsx("div",{style:{width:t*r,height:n*r,overflow:"hidden",borderRadius:8,position:"relative",boxShadow:"0 4px 24px rgba(0,0,0,0.15)"},children:s.jsxs("div",{ref:l,style:{width:t,height:n,transform:`scale(${r})`,transformOrigin:"top left",position:"relative",...G,fontFamily:"system-ui, sans-serif"},children:[u==="product-image"&&s.jsx("div",{style:{position:"absolute",inset:0,backgroundColor:`rgba(0,0,0,${i})`}}),d&&s.jsx("div",{style:{position:"absolute",zIndex:10},className:kt[$],children:s.jsx(_,{config:o,size:Math.min(t,n)*.25})}),c&&a&&s.jsxs("div",{style:{position:"absolute",bottom:m?80:0,left:0,right:0,padding:"24px 32px",background:"linear-gradient(transparent, rgba(0,0,0,0.85))",color:"#fff",zIndex:5},children:[s.jsx("p",{style:{fontSize:28,fontWeight:600,marginBottom:8,lineHeight:1.2},children:a.name}),s.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:16},children:[s.jsxs("span",{style:{fontSize:42,fontWeight:800},children:[a.campaignPrice," ",a.unit]}),a.originalPrice>0&&a.discount>0&&s.jsxs("span",{style:{fontSize:24,textDecoration:"line-through",opacity:.6},children:[a.originalPrice," ",a.unit]})]})]}),m&&s.jsxs("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:72,background:"#18181B",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 32px",zIndex:5},children:[s.jsx("span",{style:{color:"#fff",fontSize:26,fontWeight:700},children:"FlotteGulve.dk"}),s.jsx("span",{style:{color:"#a1a1aa",fontSize:18},children:"flottegulve.dk/kampagne"})]})]})})});fe.displayName="PostPreview";
2const ne=["linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%)","linear-gradient(135deg, #232526 0%, #414345 100%)","linear-gradient(135deg, #2d1b69 0%, #6b21a8 100%)","linear-gradient(135deg, #1e3a5f 0%, #4a90d9 100%)"],Et=()=>{var x;const e=w.useRef(null),[t,n]=w.useState("ig-square"),r=D.find(i=>i.id===t)||D[0],[l,a]=w.useState({product:v[0],badge:{shape:"circle",text:`-${v[0].discount}%`,subText:`Spar ${v[0].originalPrice-v[0].campaignPrice} kr`,fillColor:"#DC2626",textColor:"#FFFFFF"},showBadge:!0,bgStyle:"product-image",bgColor:"#18181B",bgGradient:ne[0],overlayOpacity:.35,showPriceBar:!0,showBrandBar:!0,badgePosition:"top-right"}),o=i=>{const c=v.find(m=>m.id===i);c&&a(m=>({...m,product:c,badge:{...m.badge,text:c.discount>0?`-${c.discount}%`:`${c.campaignPrice} kr`,subText:c.discount>0?`Spar ${c.originalPrice-c.campaignPrice} kr`:c.unit}}))},u=Math.min(500/r.width,.45),g=w.useCallback(async()=>{if(e.current)try{const i=e.current,c=await Tt(i,{width:r.width,height:r.height,pixelRatio:2,style:{transform:"none",transformOrigin:"top left"}}),m=document.createElement("a");m.href=c,m.download=`post-${r.id}-${Date.now()}.png`,m.click(),I.success("PNG downloadet")}catch(i){I.error("Kunne ikke generere billede"),console.error(i)}},[r]);return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-6",children:[s.jsxs("div",{className:"space-y-4 max-h-[calc(100vh-200px)] overflow-y-auto pr-1",children:[s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsx(h,{className:"text-sm font-semibold",children:"Format"}),s.jsx(Pt,{selectedFormat:t,onSelect:n})]}),s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsx(h,{className:"text-sm font-semibold",children:"Produkt"}),s.jsxs(P,{value:((x=l.product)==null?void 0:x.id)||"",onValueChange:o,children:[s.jsx(k,{children:s.jsx(E,{placeholder:"Vælg produkt..."})}),s.jsx(L,{children:v.map(i=>s.jsx(y,{value:i.id,children:i.name},i.id))})]})]}),s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsx(h,{className:"text-sm font-semibold",children:"Baggrund"}),s.jsxs(P,{value:l.bgStyle,onValueChange:i=>a(c=>({...c,bgStyle:i})),children:[s.jsx(k,{children:s.jsx(E,{})}),s.jsxs(L,{children:[s.jsx(y,{value:"product-image",children:"Produktbillede"}),s.jsx(y,{value:"gradient",children:"Gradient"}),s.jsx(y,{value:"solid",children:"Ensfarvet"})]})]}),l.bgStyle==="solid"&&s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx("input",{type:"color",value:l.bgColor,onChange:i=>a(c=>({...c,bgColor:i.target.value})),className:"w-8 h-8 rounded cursor-pointer"}),s.jsx(j,{value:l.bgColor,onChange:i=>a(c=>({...c,bgColor:i.target.value})),className:"text-xs"})]}),l.bgStyle==="gradient"&&s.jsx("div",{className:"grid grid-cols-2 gap-2",children:ne.map((i,c)=>s.jsx("button",{className:`h-10 rounded-lg border-2 ${l.bgGradient===i?"border-primary":"border-border"}`,style:{background:i},onClick:()=>a(m=>({...m,bgGradient:i}))},c))}),l.bgStyle==="product-image"&&s.jsxs("div",{children:[s.jsxs(h,{className:"text-xs",children:["Mørk overlay: ",Math.round(l.overlayOpacity*100),"%"]}),s.jsx(ae,{value:[l.overlayOpacity],min:0,max:.8,step:.05,onValueChange:([i])=>a(c=>({...c,overlayOpacity:i}))})]})]}),s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsx(h,{className:"text-sm font-semibold",children:"Badge"}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(h,{className:"text-xs",children:"Vis badge"}),s.jsx(H,{checked:l.showBadge,onCheckedChange:i=>a(c=>({...c,showBadge:i}))})]}),l.showBadge&&s.jsxs(s.Fragment,{children:[s.jsxs(P,{value:l.badge.shape,onValueChange:i=>a(c=>({...c,badge:{...c.badge,shape:i}})),children:[s.jsx(k,{children:s.jsx(E,{})}),s.jsx(L,{children:W.map(i=>s.jsx(y,{value:i.value,children:i.label},i.value))})]}),s.jsx(j,{value:l.badge.text,onChange:i=>a(c=>({...c,badge:{...c.badge,text:i.target.value}})),placeholder:"Badge tekst"}),s.jsx(j,{value:l.badge.subText||"",onChange:i=>a(c=>({...c,badge:{...c.badge,subText:i.target.value}})),placeholder:"Undertekst"}),s.jsxs(P,{value:l.badgePosition,onValueChange:i=>a(c=>({...c,badgePosition:i})),children:[s.jsx(k,{children:s.jsx(E,{})}),s.jsxs(L,{children:[s.jsx(y,{value:"top-left",children:"Øverst venstre"}),s.jsx(y,{value:"top-right",children:"Øverst højre"}),s.jsx(y,{value:"bottom-left",children:"Nederst venstre"}),s.jsx(y,{value:"bottom-right",children:"Nederst højre"})]})]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(h,{className:"text-xs whitespace-nowrap",children:"Farve"}),s.jsx("input",{type:"color",value:l.badge.fillColor,onChange:i=>a(c=>({...c,badge:{...c.badge,fillColor:i.target.value}})),className:"w-6 h-6 rounded cursor-pointer"})]})]})]}),s.jsxs(b,{className:"p-4 space-y-3",children:[s.jsx(h,{className:"text-sm font-semibold",children:"Elementer"}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(h,{className:"text-xs",children:"Prisbar"}),s.jsx(H,{checked:l.showPriceBar,onCheckedChange:i=>a(c=>({...c,showPriceBar:i}))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(h,{className:"text-xs",children:"Brand bar"}),s.jsx(H,{checked:l.showBrandBar,onCheckedChange:i=>a(c=>({...c,showBrandBar:i}))})]})]})]}),s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.platform," ",r.label," — ",r.width,"×",r.height]}),s.jsx(fe,{ref:e,config:l,width:r.width,height:r.height,previewScale:u}),s.jsxs(R,{onClick:g,size:"lg",children:[s.jsx(le,{className:"mr-2 h-4 w-4"}),"Download PNG (",r.width,"×",r.height,")"]})]})]})},sr=()=>{const e=we();return s.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[s.jsxs("div",{className:"border-b border-border px-6 py-4 flex items-center gap-4",children:[s.jsx(R,{variant:"ghost",size:"icon",onClick:()=>e(-1),children:s.jsx($e,{className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold",children:"Social Media Generator"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Opret badges og opslag til kampagner"})]})]}),s.jsx("div",{className:"p-6",children:s.jsxs(ve,{defaultValue:"badges",children:[s.jsxs(Se,{className:"mb-6",children:[s.jsx(Z,{value:"badges",children:"Badge Generator"}),s.jsx(Z,{value:"posts",children:"Post Designer"})]}),s.jsx(X,{value:"badges",children:s.jsx(Ae,{})}),s.jsx(X,{value:"posts",children:s.jsx(Et,{})})]})})]})};export{sr as default};

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.