Loheide-eu-mitarbeiterplatt.../public/build/assets/useMediaPicker-CXIrAu89.js
Friederich Loheide 50ee85c06b
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m31s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m39s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m57s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m46s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m9s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m13s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m30s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m27s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m7s
IT-Service: Baumstruktur, HTML-Antworten, Fehlermeldungen, geschlossene Tickets, Meine IT im Profilkasten
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 20:30:24 +00:00

1 line
No EOL
43 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{$ as e,D as t,E as n,Ft as r,Ht as i,J as a,On as o,St as s,Yt as c,Zn as l,_ as u,b as d,bt as f,g as p,gn as m,mt as h,o as g,qt as _,tr as v,tt as y,v as b,vn as x,wt as S,y as C}from"./runtime-core.esm-bundler-B8D2lM98.js";import{S as w,w as T,x as E}from"./runtime-dom.esm-bundler-BEWGoe8n.js";import{O as D,k as O}from"./dist-DtGNiYlK.js";import{$ as ee,F as k,K as A,N as te,Z as ne,n as re,nt as ie,p as ae,r as oe,t as se,tt as j}from"./AppIcon-BsAgzB7_.js";import{n as M,t as N}from"./arrow-up-Djq_2Npz.js";import{n as P}from"./RichTextEditor-CP8QLbBr.js";import{a as ce,i as F,n as le,r as I,s as L,v as R,w as z,x as B}from"./http-CAG9BrJF.js";import{t as ue}from"./chevron-up-DJvyZPom.js";import{c as de,i as V,n as fe,r as pe,s as me,t as H,u as he}from"./useMediaList-Cpw6m1Nv.js";import{t as U}from"./copy-DsLby0sm.js";import{t as ge}from"./external-link-8-VtmLK9.js";import{t as W}from"./eye-off-myis3scV.js";import{t as G}from"./folder-tree-ZY-sbGXb.js";import{a as K,i as q,n as J,r as _e,t as ve}from"./Switch-DtqyAsXz.js";import{t as ye}from"./image-off-IDPmIoA8.js";import{t as be}from"./image-plus-C1A_7CFG.js";import{t as Y}from"./images-47Nc0alu.js";import{t as X}from"./message-square-warning-BFfa_vqd.js";import{t as xe}from"./minus-CmsbcqBG.js";import{t as Se}from"./play-GbhjcPFH.js";import{t as Z}from"./plus-B_ij2ng2.js";import{t as Ce}from"./quote-CAgJDpoy.js";import{t as we}from"./search-x-BVofHEe_.js";import{t as Te}from"./trash-DUqnVIgb.js";import{t as Ee}from"./upload-M7dd6qr8.js";import{n as De}from"./button-CwUSbS9X.js";import{t as Oe}from"./NativeSelect-G3km7PmI.js";import{t as Q}from"./Input-FGSb2-yK.js";import{t as ke}from"./Textarea-DEFXqC2w.js";import{i as Ae,r as je,t as Me}from"./dialog-CZ7bvgg5.js";import{t as Ne}from"./DialogDescription-BLGVbOj1.js";import{t as Pe}from"./registry-gO6JQwR_.js";var Fe=O({name:`box`,size:24,node:[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]}),Ie=O({name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]}),Le=O({name:`contact`,size:24,node:[[`path`,{d:`M16 2v2`,key:`scm5qe`}],[`path`,{d:`M7 21v-2a2 2 0 012-2h6a2 2 0 012 2v2`,key:`k82dct`}],[`path`,{d:`M8 2v2`,key:`pbkmx`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]}),Re=O({name:`gallery-horizontal-end`,size:24,node:[[`path`,{d:`M2 7v10`,key:`a2pl2d`}],[`path`,{d:`M6 5v14`,key:`1kq3d7`}],[`rect`,{width:`12`,height:`18`,x:`10`,y:`3`,rx:`2`,key:`13i7bc`}]]}),ze=O({name:`list-collapse`,size:24,node:[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]}),Be=O({name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]}),Ve=O({name:`move-vertical`,size:24,node:[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m8 18 4 4 4-4`,key:`bh5tu3`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}]]}),He=O({name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]}),Ue=O({name:`square-dashed`,size:24,node:[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]],aliases:[`box-select`]}),We=O({name:`table`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]}),Ge=O({name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]}),Ke={"square-dashed":Ue,"columns-3":Ie,"panel-top":He,"list-collapse":ze,"message-square-warning":X,heading:q,text:_e,quote:Ce,"mouse-pointer-click":Be,"list-checks":B,table:We,minus:xe,"move-vertical":Ve,image:A,images:Y,play:Se,panorama:Re,contact:Le,"file-down":ne,"folder-tree":G,newspaper:k,"calendar-days":j,"clipboard-list":ee,cake:ie};function qe(e){return Ke[e]??Fe}function $(){return Math.random().toString(36).slice(2,8)+Date.now().toString(36).slice(-6)}function Je(e){return JSON.parse(JSON.stringify(e))}function Ye(e,t){return e.container?e.key===`columns`?(t.layout??`1-1`).split(`-`).length:e.key===`tabs`?2:e.key===`accordion`?3:e.container.min:0}function Xe(e){let t=Je(e.defaults??{}),n={id:$(),type:e.key,data:t};return e.container&&(n.items=Array.from({length:Ye(e,t)},(t,n)=>({id:$(),title:e.container.titled?`${e.container.label} ${n+1}`:void 0,blocks:[]}))),n}function Ze(e){let t=Je(e),n=e=>{e.id=$(),(e.items??[]).forEach(e=>{e.id=$(),e.blocks.forEach(n)})};return n(t),t}function Qe(e,t,n=null){for(let r=0;r<e.length;r++){let i=e[r];if(i.id===t)return{block:i,list:e,index:r,parent:n};for(let e of i.items??[]){let n=Qe(e.blocks,t,i);if(n)return n}}return null}function $e(e,t){for(let n of e)t(n),(n.items??[]).forEach(e=>$e(e.blocks,t))}function et(e){let t=(e.data.layout??`1-1`).split(`-`).length;for(;e.items.length<t;)e.items.push({id:$(),blocks:[]});if(e.items.length>t){let n=e.items.splice(t).flatMap(e=>e.blocks);e.items[t-1].blocks.push(...n)}}var tt={class:`grid gap-4`},nt={class:`mb-2 text-xs font-semibold tracking-wide text-muted-foreground uppercase`},rt=[`title`,`disabled`,`onClick`],it={class:`truncate`},at={__name:`BlockPalette`,props:{compact:{type:Boolean,default:!1}},emits:[`pick`],setup(e,{emit:n}){let r=n,i=a(`pagebuilder:editor`),s=p(()=>Object.entries(i.groups).map(([e,t])=>({key:e,label:t,types:Object.values(i.types).filter(t=>t.group===e)})).filter(e=>e.types.length));return(n,a)=>(h(),d(`div`,tt,[(h(!0),d(g,null,f(s.value,n=>(h(),d(`section`,{key:n.key},[u(`h3`,nt,v(n.label),1),t(o(J),{"model-value":n.types,group:{name:`pagebuilder`,pull:`clone`,put:!1},clone:e=>o(Xe)(e),sort:!1,disabled:e.compact||o(i).readOnly.value,class:`grid grid-cols-2 gap-2`},{default:_(()=>[(h(!0),d(g,null,f(n.types,t=>(h(),d(`button`,{key:t.key,type:`button`,class:l([`flex items-center gap-2 rounded-md border bg-card px-2.5 py-2 text-left text-[13px] font-medium transition-colors hover:border-brand-300 hover:bg-brand-soft/60`,e.compact?``:`cursor-grab active:cursor-grabbing`]),title:t.description||t.label,disabled:o(i).readOnly.value,onClick:e=>r(`pick`,t)},[(h(),b(S(o(qe)(t.icon)),{class:`size-4 shrink-0 text-brand-text`})),u(`span`,it,v(t.label),1)],10,rt))),128))]),_:2},1032,[`model-value`,`clone`,`disabled`])]))),128))]))}},ot={class:`grid gap-1.5`},st=[`for`],ct=[`for`],lt={key:8,class:`grid gap-2`},ut={class:`grid max-h-56 grid-cols-6 gap-1.5 overflow-y-auto`},dt=[`title`,`aria-pressed`,`onClick`],ft={key:0,class:`col-span-6 py-2 text-center text-xs text-muted-foreground`},pt={key:0,class:`relative overflow-hidden rounded-md border bg-muted`},mt=[`src`],ht=[`disabled`],gt=[`disabled`],_t={key:10,class:`grid gap-2`},vt={key:0,class:`grid gap-1`},yt={class:`min-w-0 flex-1 truncate text-[13px]`},bt=[`onClick`],xt=[`onClick`],St={class:`relative`},Ct={key:0,class:`absolute inset-x-0 top-full z-30 mt-1 max-h-60 overflow-y-auto rounded-md border bg-popover p-1 shadow-md`},wt=[`onClick`],Tt={class:`min-w-0`},Et={class:`block truncate font-medium`},Dt={class:`block truncate text-xs text-muted-foreground`},Ot={key:11,class:`grid gap-2`},kt={class:`overflow-x-auto rounded-md border`},At={class:`w-full text-[13px]`},jt=[`value`,`aria-label`,`onInput`],Mt={class:`w-7 p-0 text-center`},Nt=[`onClick`],Pt=[`onClick`],Ft={class:`flex gap-2`},It={key:12,class:`grid gap-2`},Lt=[`open`],Rt={class:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-[13px] font-medium`},zt={class:`min-w-0 flex-1 truncate`},Bt=[`onClick`],Vt=[`onClick`],Ht=[`onClick`],Ut={class:`grid gap-3 border-t px-3 py-3`},Wt={key:0,class:`grid gap-2`},Gt={key:13,class:`grid gap-2`},Kt={key:0,class:`grid gap-1`},qt={class:`min-w-0 flex-1 truncate`},Jt={key:0,class:`shrink-0 text-xs text-muted-foreground`},Yt=[`onClick`],Xt=[`onClick`],Zt=[`disabled`],Qt={key:14,class:`text-xs text-muted-foreground`},$t={__name:`FieldInput`,props:e({field:{type:Object,required:!0},id:{type:String,required:!0}},{modelValue:{default:null},modelModifiers:{}}),emits:e([`image-uploaded`,`image-picked`],[`update:modelValue`]),setup(e,{emit:c}){let m=e,_=r(e,`modelValue`),y=a(`pagebuilder:editor`),S=c,w=x(!1),E=x(null),O=x(!1);async function ee(e){if(e){w.value=!0;try{let t=await y.uploadImage(e);_.value=t.path,S(`image-uploaded`,t)}catch(e){L.error(e.fieldErrors?.image??e.message)}finally{w.value=!1}}}function k(e){let t=e.target.files?.[0];e.target.value=``,ee(t)}function A(e){O.value=!1,ee([...e.dataTransfer?.files??[]].find(e=>e.type.startsWith(`image/`)))}async function ie(){let e=await y.pickMedia({multiple:!1});e?.length&&(_.value=e[0].path,S(`image-picked`,e[0]))}let j=p(()=>m.field.type===`repeater`?m.field.fields.find(e=>e.type===`image`):null);async function ce(){let e=await y.pickMedia({multiple:!0,title:`${m.field.label} aus der Mediathek hinzufügen`});if(!e?.length)return;let t=Math.max(0,m.field.max-(_.value??[]).length),n=e.slice(0,t).map(e=>{let t=pe();return t[j.value.name]=e.path,`alt`in t&&(t.alt=e.alt??``),`caption`in t&&(t.caption=e.caption??``),t});_.value=[..._.value??[],...n],e.length>t&&L.warning(`Nur ${t} von ${e.length} Bildern übernommen – höchstens ${m.field.max} möglich.`)}function F(e,t){`alt`in e&&!e.alt&&t.alt&&(e.alt=t.alt),`caption`in e&&!e.caption&&t.caption&&(e.caption=t.caption)}let I=x(``),z=x([]),B=y.peopleCache,ue;if(i(I,e=>{if(clearTimeout(ue),e.trim().length<2){z.value=[];return}ue=setTimeout(async()=>{let t=await le.get(`/personen/suche?q=${encodeURIComponent(e.trim())}`);t.people.forEach(e=>B[e.id]=e),z.value=t.people.filter(e=>!(_.value??[]).includes(e.id))},250)}),m.field.type===`people`&&(_.value??[]).some(e=>!B[e])){let e=_.value.filter(e=>!B[e]);le.get(`/personen/suche?${e.map(e=>`ids[]=${e}`).join(`&`)}`).then(e=>e.people.forEach(e=>B[e.id]=e))}function de(e){_.value=[..._.value??[],e.id],I.value=``,z.value=[]}function V(e,t,n){let r=t+n;if(r<0||r>=e.length)return;let i=[...e];[i[t],i[r]]=[i[r],i[t]],_.value=i}function fe(e){_.value=_.value.filter((t,n)=>n!==e)}function pe(){return Object.fromEntries(m.field.fields.map(e=>[e.name,structuredClone(e.default??(e.type===`toggle`?!1:e.type===`repeater`?[]:``))]))}function me(){_.value=[..._.value??[],pe()]}let H=p(()=>_.value??[[``]]);function he(e,t,n){let r=H.value.map(e=>[...e]);r[e][t]=n,_.value=r}function U(){_.value=[...H.value,Array(H.value[0]?.length??1).fill(``)]}function ge(){_.value=H.value.map(e=>[...e,``])}function W(e){H.value.length>1&&(_.value=H.value.filter((t,n)=>n!==e))}function G(e){(H.value[0]?.length??1)>1&&(_.value=H.value.map(t=>t.filter((t,n)=>n!==e)))}let K=x(null),q=p(()=>Object.fromEntries(y.files.value.map(e=>[e.id,e])));async function J(e){let t=[...e.target.files??[]];e.target.value=``,w.value=!0;try{for(let e of t){let t=await y.uploadFile(e);_.value=[..._.value??[],t.id]}}catch(e){L.error(e.fieldErrors?.file??e.message)}finally{w.value=!1}}let _e=p(()=>y.files.value.filter(e=>!(_.value??[]).includes(e.id))),ye=e=>e>1048576?`${(e/1024/1024).toFixed(1).replace(`.`,`,`)} MB`:`${Math.max(1,Math.round(e/1024))} KB`,X=x(``),xe=p(()=>{let e=X.value.trim().toLowerCase(),t=(m.field.choices??[]).map(e=>({value:e.value,label:e.label}));if(!e)return _.value&&!t.some(e=>e.value===_.value)?[{value:_.value,label:_.value},...t]:t;let n=t.filter(t=>t.label.toLowerCase().includes(e)||t.value.includes(e)),r=re.value?Object.keys(re.value.icons).filter(t=>t.includes(e)&&!n.some(e=>e.value===t)):[];return[...n,...r.map(e=>({value:e,label:e}))].slice(0,60)});return i(X,e=>e.trim()&&oe()),(r,i)=>{let a=s(`FieldInput`,!0);return h(),d(`div`,ot,[e.field.type===`toggle`?C(``,!0):(h(),d(`label`,{key:0,for:e.id,class:`text-[13px] font-medium`},v(e.field.label),9,st)),e.field.type===`text`?(h(),b(o(Q),{key:1,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[0]||=e=>_.value=e,maxlength:e.field.max,placeholder:e.field.placeholder??``},null,8,[`id`,`modelValue`,`maxlength`,`placeholder`])):e.field.type===`url`?(h(),b(o(Q),{key:2,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[1]||=e=>_.value=e,type:`text`,inputmode:`url`,placeholder:`https://… oder /seiten/…`},null,8,[`id`,`modelValue`])):e.field.type===`textarea`?(h(),b(o(ke),{key:3,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[2]||=e=>_.value=e,maxlength:e.field.max,rows:`3`},null,8,[`id`,`modelValue`,`maxlength`])):e.field.type===`html`?(h(),b(P,{key:4,modelValue:_.value,"onUpdate:modelValue":i[3]||=e=>_.value=e,bordered:``,"min-height":`[&_.tiptap]:min-h-24`},null,8,[`modelValue`])):e.field.type===`number`?(h(),b(o(Q),{key:5,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[4]||=e=>_.value=e,modelModifiers:{number:!0},type:`number`,min:e.field.min,max:e.field.max},null,8,[`id`,`modelValue`,`min`,`max`])):e.field.type===`select`?(h(),b(Oe,{key:6,id:e.id,modelValue:_.value,"onUpdate:modelValue":i[5]||=e=>_.value=e,options:e.field.choices},null,8,[`id`,`modelValue`,`options`])):e.field.type===`toggle`?(h(),d(`label`,{key:7,for:e.id,class:`flex items-center justify-between gap-3 py-0.5 text-[13px] font-medium`},[n(v(e.field.label)+` `,1),t(o(ve),{id:e.id,modelValue:_.value,"onUpdate:modelValue":i[6]||=e=>_.value=e},null,8,[`id`,`modelValue`])],8,ct)):e.field.type===`icon`?(h(),d(`div`,lt,[t(o(Q),{modelValue:X.value,"onUpdate:modelValue":i[7]||=e=>X.value=e,type:`search`,placeholder:`Alle Symbole durchsuchen (englisch, z. B. calendar)`,class:`h-8 text-[13px]`},null,8,[`modelValue`]),u(`div`,ut,[(h(!0),d(g,null,f(xe.value,e=>(h(),d(`button`,{key:e.value,type:`button`,class:l([`grid aspect-square place-items-center rounded-md border transition-colors`,_.value===e.value?`border-brand-400 bg-brand-soft text-brand-soft-foreground`:`text-muted-foreground hover:bg-accent`]),title:e.label,"aria-pressed":_.value===e.value,onClick:t=>_.value=e.value},[t(se,{name:e.value,class:`size-4`},null,8,[`name`])],10,dt))),128)),X.value&&!xe.value.length?(h(),d(`p`,ft,`Kein Symbol gefunden.`)):C(``,!0)])])):e.field.type===`image`?(h(),d(`div`,{key:9,class:l([`grid gap-2 rounded-md`,O.value&&`ring-2 ring-brand-400 ring-offset-2 ring-offset-card`]),onDragover:i[10]||=T(e=>O.value=!0,[`prevent`]),onDragleave:i[11]||=e=>O.value=!1,onDrop:T(A,[`prevent`])},[_.value?(h(),d(`div`,pt,[u(`img`,{src:o(y).imageUrl(_.value),alt:``,class:`aspect-video w-full object-cover`},null,8,mt),u(`button`,{type:`button`,class:`absolute top-1.5 right-1.5 grid size-7 place-items-center rounded-md bg-card/90 shadow-sm hover:bg-card`,title:`Bild entfernen`,onClick:i[8]||=e=>_.value=null},[t(o(R),{class:`size-4`})])])):C(``,!0),u(`div`,{class:l([`grid gap-2`,o(y).pickMedia?`grid-cols-2`:``])},[u(`button`,{type:`button`,class:`flex h-9 items-center justify-center gap-1.5 rounded-md border border-dashed px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,disabled:w.value,title:`Bild hochladen – oder eine Datei hierher ziehen`,onClick:i[9]||=e=>E.value?.click()},[w.value?(h(),b(o(D),{key:0,class:`size-4 animate-spin`})):(h(),b(o(be),{key:1,class:`size-4`})),n(` `+v(o(y).pickMedia?`Hochladen`:_.value?`Anderes Bild wählen`:`Bild hochladen`),1)],8,ht),o(y).pickMedia?(h(),d(`button`,{key:0,type:`button`,class:`flex h-9 items-center justify-center gap-1.5 rounded-md border px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,disabled:w.value,onClick:ie},[t(o(Y),{class:`size-4`}),i[15]||=n(` Aus Mediathek `,-1)],8,gt)):C(``,!0)],2),u(`input`,{ref_key:`imageInput`,ref:E,type:`file`,accept:`image/jpeg,image/png,image/webp,image/gif`,class:`hidden`,onChange:k},null,544)],34)):e.field.type===`people`?(h(),d(`div`,_t,[(_.value??[]).length?(h(),d(`ul`,vt,[(h(!0),d(g,null,f(_.value,(e,n)=>(h(),d(`li`,{key:e,class:`flex items-center gap-2 rounded-md border bg-card px-2 py-1.5`},[o(B)[e]?(h(),b(ae,{key:0,person:o(B)[e],class:`size-7 text-[10px]`},null,8,[`person`])):C(``,!0),u(`span`,yt,v(o(B)[e]?.name??`…`),1),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:e=>V(_.value,n,-1)},[t(o(N),{class:`size-3.5`})],8,bt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Entfernen`,onClick:e=>fe(n)},[t(o(R),{class:`size-3.5`})],8,xt)]))),128))])):C(``,!0),u(`div`,St,[t(o(te),{class:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),t(o(Q),{id:e.id,modelValue:I.value,"onUpdate:modelValue":i[12]||=e=>I.value=e,class:`pl-8`,placeholder:`Person suchen …`,autocomplete:`off`},null,8,[`id`,`modelValue`]),z.value.length?(h(),d(`ul`,Ct,[(h(!0),d(g,null,f(z.value,e=>(h(),d(`li`,{key:e.id},[u(`button`,{type:`button`,class:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[13px] hover:bg-accent`,onClick:t=>de(e)},[t(ae,{person:e,class:`size-7 text-[10px]`},null,8,[`person`]),u(`span`,Tt,[u(`span`,Et,v(e.name),1),u(`span`,Dt,v(e.job_title),1)])],8,wt)]))),128))])):C(``,!0)])])):e.field.type===`table`?(h(),d(`div`,Ot,[u(`div`,kt,[u(`table`,At,[u(`tbody`,null,[(h(!0),d(g,null,f(H.value,(e,n)=>(h(),d(`tr`,{key:n,class:`border-b last:border-0`},[(h(!0),d(g,null,f(e,(e,t)=>(h(),d(`td`,{key:t,class:`border-r p-0 last:border-r-0`},[u(`input`,{value:e,class:`h-8 w-full min-w-20 bg-transparent px-2 focus:bg-brand-soft/50 focus:outline-none`,"aria-label":`Zeile ${n+1}, Spalte ${t+1}`,onInput:e=>he(n,t,e.target.value)},null,40,jt)]))),128)),u(`td`,Mt,[u(`button`,{type:`button`,class:`grid size-7 place-items-center text-muted-foreground hover:text-destructive`,title:`Zeile entfernen`,onClick:e=>W(n)},[t(o(R),{class:`size-3.5`})],8,Nt)])]))),128)),u(`tr`,null,[(h(!0),d(g,null,f(H.value[0],(e,n)=>(h(),d(`td`,{key:n,class:`p-0 text-center`},[u(`button`,{type:`button`,class:`mx-auto grid size-7 place-items-center text-muted-foreground hover:text-destructive`,title:`Spalte entfernen`,onClick:e=>G(n)},[t(o(R),{class:`size-3.5`})],8,Pt)]))),128)),i[16]||=u(`td`,null,null,-1)])])])]),u(`div`,Ft,[u(`button`,{type:`button`,class:`inline-flex items-center gap-1 text-[13px] font-medium text-brand-text hover:underline`,onClick:U},[t(o(Z),{class:`size-3.5`}),i[17]||=n(` Zeile`,-1)]),u(`button`,{type:`button`,class:`inline-flex items-center gap-1 text-[13px] font-medium text-brand-text hover:underline`,onClick:ge},[t(o(Z),{class:`size-3.5`}),i[18]||=n(` Spalte`,-1)])])])):e.field.type===`repeater`?(h(),d(`div`,It,[(h(!0),d(g,null,f(_.value??[],(n,r)=>(h(),d(`details`,{key:r,class:`group rounded-md border bg-card`,open:r===(_.value??[]).length-1},[u(`summary`,Rt,[u(`span`,zt,v(n.label||n.title||n.alt||`${e.field.itemLabel} ${r+1}`),1),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:T(e=>V(_.value,r,-1),[`prevent`])},[t(o(N),{class:`size-3.5`})],8,Bt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach unten`,onClick:T(e=>V(_.value,r,1),[`prevent`])},[t(o(M),{class:`size-3.5`})],8,Vt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded text-destructive hover:bg-destructive/10`,title:`Entfernen`,onClick:T(e=>fe(r),[`prevent`])},[t(o(Te),{class:`size-3.5`})],8,Ht)]),u(`div`,Ut,[(h(!0),d(g,null,f(e.field.fields,t=>(h(),b(a,{id:`${e.id}-${r}-${t.name}`,key:t.name,modelValue:n[t.name],"onUpdate:modelValue":e=>n[t.name]=e,field:t,onImagePicked:e=>F(n,e)},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`field`,`onImagePicked`]))),128))])],8,Lt))),128)),(_.value??[]).length<e.field.max?(h(),d(`div`,Wt,[u(`button`,{type:`button`,class:`flex h-8 items-center justify-center gap-1.5 rounded-md border border-dashed px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,onClick:me},[t(o(Z),{class:`size-3.5`}),n(` `+v(e.field.itemLabel)+` hinzufügen `,1)]),j.value&&o(y).pickMedia?(h(),d(`button`,{key:0,type:`button`,class:`flex h-8 items-center justify-center gap-1.5 rounded-md border px-2 text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,onClick:ce},[t(o(Y),{class:`size-3.5`}),i[19]||=n(` Mehrere aus der Mediathek hinzufügen `,-1)])):C(``,!0)])):C(``,!0)])):e.field.type===`ids`&&e.field.kind===`page-file`?(h(),d(`div`,Gt,[(_.value??[]).length?(h(),d(`ul`,Kt,[(h(!0),d(g,null,f(_.value,(e,n)=>(h(),d(`li`,{key:e,class:`flex items-center gap-2 rounded-md border bg-card px-2 py-1.5 text-[13px]`},[t(o(ne),{class:`size-4 shrink-0 text-muted-foreground`}),u(`span`,qt,v(q.value[e]?.name??`Datei nicht mehr vorhanden`),1),q.value[e]?(h(),d(`span`,Jt,v(ye(q.value[e].size)),1)):C(``,!0),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:e=>V(_.value,n,-1)},[t(o(N),{class:`size-3.5`})],8,Yt),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Entfernen`,onClick:e=>fe(n)},[t(o(R),{class:`size-3.5`})],8,Xt)]))),128))])):C(``,!0),u(`button`,{type:`button`,class:`flex h-9 items-center justify-center gap-2 rounded-md border border-dashed text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,disabled:w.value,onClick:i[13]||=e=>K.value?.click()},[w.value?(h(),b(o(D),{key:0,class:`size-4 animate-spin`})):(h(),b(o(Ee),{key:1,class:`size-4`})),i[20]||=n(` Dateien hochladen `,-1)],8,Zt),u(`input`,{ref_key:`fileInput`,ref:K,type:`file`,multiple:``,class:`hidden`,onChange:J},null,544),_e.value.length?(h(),b(Oe,{key:1,"model-value":null,options:_e.value.map(e=>({value:e.id,label:e.name})),placeholder:`Bereits hochgeladene Datei wählen …`,"onUpdate:modelValue":i[14]||=e=>e&&(_.value=[..._.value??[],e])},null,8,[`options`])):C(``,!0)])):C(``,!0),e.field.help?(h(),d(`p`,Qt,v(e.field.help),1)):C(``,!0)])}}},en={key:0,class:`grid gap-5`},tn={class:`flex items-start gap-3`},nn={class:`grid size-9 shrink-0 place-items-center rounded-md bg-brand-soft text-brand-text`},rn={class:`min-w-0`},an={class:`font-semibold`},on={key:0,class:`text-xs text-muted-foreground`},sn={key:0,class:`rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground`},cn={key:1,class:`grid gap-2`},ln={class:`text-[13px] font-medium`},un={key:1,class:`flex-1 text-[13px]`},dn=[`onClick`],fn=[`onClick`],pn=[`disabled`,`onClick`],mn=[`open`],hn={class:`flex cursor-pointer items-center gap-2 px-3 py-2 text-[13px] font-medium`},gn={key:0,class:`ml-auto rounded bg-amber-100 px-1.5 py-0.5 text-[11px] text-amber-800 dark:bg-amber-900/50 dark:text-amber-200`},_n={class:`grid gap-3 border-t px-3 py-3`},vn={class:`mb-1 text-xs font-semibold text-muted-foreground`},yn={key:0,class:`-mt-1 mb-1 text-[11px] text-muted-foreground`},bn={class:`grid max-h-36 gap-0.5 overflow-y-auto`},xn=[`checked`,`onChange`],Sn={__name:`BlockSettings`,props:{block:{type:Object,required:!0}},setup(e){let r=e,s=a(`pagebuilder:editor`),c=p(()=>s.types[r.block.type]),l=p(()=>(c.value?.fields??[]).filter(e=>e.type!==`html`));i(()=>r.block.data.layout,()=>{r.block.type===`columns`&&et(r.block)});function m(e){let t=r.block.data;`alt`in t&&!t.alt&&e.alt&&(t.alt=e.alt),`caption`in t&&!t.caption&&e.caption&&(t.caption=e.caption)}function _(){r.block.items.push({id:$(),title:`${c.value.container.label} ${r.block.items.length+1}`,blocks:[]})}function y(e,t){let n=r.block.items,i=e+t;i>=0&&i<n.length&&([n[e],n[i]]=[n[i],n[e]])}function x(e){let t=r.block.items[e];(!t.blocks.length||window.confirm(`„${t.title||c.value.container.label}“ enthält Inhalte. Trotzdem entfernen?`))&&r.block.items.splice(e,1)}let w=p(()=>r.block.visibility??{}),T=p(()=>Object.values(w.value).some(e=>e?.length));function E(e,t){let n=new Set(w.value[e]??[]);n.has(t)?n.delete(t):n.add(t),r.block.visibility={...w.value,[e]:[...n]}}let D=p(()=>[{key:`role`,label:`Rollen`,options:s.audienceOptions.role},{key:`department`,label:`Abteilungen`,options:s.audienceOptions.department.map(e=>({value:e,label:e}))},{key:`location`,label:`Standorte`,options:s.audienceOptions.location.map(e=>({value:e,label:e}))},{key:`exclude_role`,label:`Ausgeschlossene Rollen`,hint:`Sehen den Block nie – auch wenn oben etwas passt.`,options:s.audienceOptions.role}].filter(e=>e.options.length));return(r,i)=>c.value?(h(),d(`div`,en,[u(`header`,tn,[u(`span`,nn,[(h(),b(S(o(qe)(c.value.icon)),{class:`size-4.5`}))]),u(`div`,rn,[u(`h2`,an,v(c.value.label),1),c.value.description?(h(),d(`p`,on,v(c.value.description),1)):C(``,!0)])]),c.value.fields.some(e=>e.type===`html`)?(h(),d(`p`,sn,` Den Text bearbeiten Sie direkt im Block. Markieren Sie Text für Fettdruck, Links und Listen. `)):C(``,!0),(h(!0),d(g,null,f(l.value,t=>(h(),b($t,{id:`field-${e.block.id}-${t.name}`,key:`${e.block.id}-${t.name}`,modelValue:e.block.data[t.name],"onUpdate:modelValue":n=>e.block.data[t.name]=n,field:t,onImagePicked:m},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`field`]))),128)),c.value.container&&c.value.container.max>1&&c.value.key!==`columns`?(h(),d(`section`,cn,[u(`h3`,ln,v(c.value.container.label)+`s`,1),(h(!0),d(g,null,f(e.block.items,(n,r)=>(h(),d(`div`,{key:n.id,class:`flex items-center gap-1`},[c.value.container.titled?(h(),b(o(Q),{key:0,modelValue:n.title,"onUpdate:modelValue":e=>n.title=e,class:`h-8`,"aria-label":`Titel ${r+1}`,maxlength:`120`},null,8,[`modelValue`,`onUpdate:modelValue`,`aria-label`])):(h(),d(`span`,un,v(c.value.container.label)+` `+v(r+1),1)),u(`button`,{type:`button`,class:`grid size-7 shrink-0 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:e=>y(r,-1)},[t(o(N),{class:`size-3.5`})],8,dn),u(`button`,{type:`button`,class:`grid size-7 shrink-0 place-items-center rounded hover:bg-accent`,title:`Nach unten`,onClick:e=>y(r,1)},[t(o(M),{class:`size-3.5`})],8,fn),u(`button`,{type:`button`,class:`grid size-7 shrink-0 place-items-center rounded text-destructive hover:bg-destructive/10 disabled:opacity-30`,title:`Entfernen`,disabled:e.block.items.length<=c.value.container.min,onClick:e=>x(r)},[t(o(Te),{class:`size-3.5`})],8,pn)]))),128)),e.block.items.length<c.value.container.max?(h(),d(`button`,{key:0,type:`button`,class:`flex h-8 items-center justify-center gap-1.5 rounded-md border border-dashed text-[13px] font-medium text-muted-foreground hover:border-brand-300 hover:text-foreground`,onClick:_},[t(o(Z),{class:`size-3.5`}),n(` `+v(c.value.container.label)+` hinzufügen `,1)])):C(``,!0)])):C(``,!0),D.value.length?(h(),d(`details`,{key:2,class:`rounded-md border`,open:T.value},[u(`summary`,hn,[t(o(W),{class:`size-4 text-muted-foreground`}),i[0]||=n(` Sichtbarkeit `,-1),T.value?(h(),d(`span`,gn,`eingeschränkt`)):C(``,!0)]),u(`div`,_n,[i[1]||=u(`p`,{class:`text-xs text-muted-foreground`},`Leer = für alle, die die Seite sehen. Sonst nur für Personen, die mindestens eine Angabe erfüllen.`,-1),(h(!0),d(g,null,f(D.value,e=>(h(),d(`fieldset`,{key:e.key,class:`grid gap-1`},[u(`legend`,vn,v(e.label),1),e.hint?(h(),d(`p`,yn,v(e.hint),1)):C(``,!0),u(`div`,bn,[(h(!0),d(g,null,f(e.options,t=>(h(),d(`label`,{key:t.value,class:`flex items-center gap-2 rounded px-1 py-0.5 text-[13px] hover:bg-accent`},[u(`input`,{type:`checkbox`,class:`size-4 accent-[var(--brand)]`,checked:(w.value[e.key]??[]).includes(t.value),onChange:n=>E(e.key,t.value)},null,40,xn),n(` `+v(t.label),1)]))),128))])]))),128))])],8,mn)):C(``,!0)])):C(``,!0)}},Cn=[`data-block-id`],wn={class:`pb-handle flex cursor-grab items-center gap-1 rounded px-1 py-0.5 font-medium text-muted-foreground active:cursor-grabbing`,title:`Ziehen zum Verschieben`},Tn={key:2,class:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`},En={__name:`EditorBlock`,props:{block:{type:Object,required:!0}},setup(e){let r=e,i=a(`pagebuilder:editor`),s=p(()=>i.types[r.block.type]),c=p(()=>i.selectedId.value===r.block.id),f=p(()=>i.hoveredId.value===r.block.id),m=p(()=>Object.values(r.block.visibility??{}).some(e=>e?.length)),g=p(()=>({...r.block,props:i.previews[r.block.id]??r.block.props}));return(r,a)=>(h(),d(`div`,{class:l([`relative rounded-md outline-offset-4 transition-[outline-color]`,[c.value?`outline-2 outline-brand-500`:f.value?`outline-1 outline-brand-300`:`outline-1 outline-transparent`,s.value?``:`opacity-60`]]),"data-block-id":e.block.id,onClick:a[5]||=T(t=>o(i).select(e.block.id),[`stop`]),onMouseover:a[6]||=T(t=>o(i).hoveredId.value=e.block.id,[`stop`]),onMouseleave:a[7]||=t=>o(i).hoveredId.value===e.block.id&&(o(i).hoveredId.value=null)},[(c.value||f.value)&&!o(i).readOnly.value?(h(),d(`div`,{key:0,class:`absolute -top-3.5 right-2 z-20 flex items-center gap-0.5 rounded-md border bg-card px-1 py-0.5 text-xs shadow-sm`,onClick:a[4]||=T(()=>{},[`stop`])},[u(`span`,wn,[t(o(K),{class:`size-3.5`}),(h(),b(S(o(qe)(s.value?.icon)),{class:`size-3.5`})),n(` `+v(s.value?.label??e.block.type),1)]),m.value?(h(),b(o(W),{key:0,class:`mx-1 size-3.5 text-amber-600`,title:`Nur für bestimmte Personen sichtbar`})):C(``,!0),a[8]||=u(`span`,{class:`mx-0.5 h-4 w-px bg-border`},null,-1),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach oben`,onClick:a[0]||=t=>o(i).move(e.block.id,-1)},[t(o(ue),{class:`size-3.5`})]),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Nach unten`,onClick:a[1]||=t=>o(i).move(e.block.id,1)},[t(o(z),{class:`size-3.5`})]),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded hover:bg-accent`,title:`Duplizieren`,onClick:a[2]||=t=>o(i).duplicate(e.block.id)},[t(o(U),{class:`size-3.5`})]),u(`button`,{type:`button`,class:`grid size-6 place-items-center rounded text-destructive hover:bg-destructive/10`,title:`Entfernen`,onClick:a[3]||=t=>o(i).remove(e.block.id)},[t(o(Te),{class:`size-3.5`})])])):C(``,!0),s.value&&o(Pe)(s.value.component)?(h(),b(S(o(Pe)(s.value.component)),{key:1,block:g.value},null,8,[`block`])):(h(),d(`div`,Tn,` Dieser Block (`+v(e.block.type)+`) ist nicht verfügbar – vermutlich ist das zugehörige Plugin deaktiviert. Er wird nicht angezeigt. `,1))],42,Cn))}},Dn={key:0,class:`pointer-events-none text-center text-xs text-muted-foreground`},On={__name:`EditorBlockList`,props:{item:{type:Object,required:!0},root:{type:Boolean,default:!1}},setup(e){let r=e,i=a(`pagebuilder:editor`),s=p(()=>r.root||i.containsActive(r.item));return(r,a)=>(h(),d(`div`,{class:l([`grid`,e.root?`gap-6`:`gap-4`])},[t(o(J),{modelValue:e.item.blocks,"onUpdate:modelValue":a[0]||=t=>e.item.blocks=t,group:{name:`pagebuilder`},handle:`.pb-handle`,animation:150,disabled:o(i).readOnly.value,"ghost-class":`pb-ghost`,class:l([`grid min-h-6`,[e.root?`gap-6`:`gap-4`,e.item.blocks.length?``:`rounded-md border border-dashed border-border bg-muted/40 p-3`]]),onAdd:a[1]||=t=>o(i).select(e.item.blocks[t.newIndex]?.id)},{default:_(()=>[(h(!0),d(g,null,f(e.item.blocks,e=>(h(),b(En,{key:e.id,block:e},null,8,[`block`]))),128)),e.item.blocks.length?C(``,!0):(h(),d(`p`,Dn,v(e.root?`Noch keine Inhalte. Blöcke aus der rechten Spalte hierher ziehen oder hinzufügen.`:`Blöcke hierher ziehen`),1))]),_:1},8,[`modelValue`,`disabled`,`class`]),!o(i).readOnly.value&&(s.value||!e.item.blocks.length)?(h(),b(o(ce),{key:0},{default:_(()=>[t(o(I),{class:`flex h-8 items-center justify-center gap-1.5 rounded-md border border-dashed text-xs font-medium text-muted-foreground transition-colors hover:border-brand-300 hover:bg-brand-soft hover:text-brand-soft-foreground`,onClick:a[2]||=T(()=>{},[`stop`])},{default:_(()=>[t(o(Z),{class:`size-3.5`}),a[5]||=n(` Block hinzufügen `,-1)]),_:1}),t(o(F),{class:`max-h-[70vh] w-[22rem] overflow-y-auto p-3`,align:`center`,onClick:a[4]||=T(()=>{},[`stop`])},{default:_(()=>[t(at,{compact:``,onPick:a[3]||=t=>o(i).insert(e.item.blocks,e.item.blocks.length,t)})]),_:1})]),_:1})):C(``,!0)],2))}},kn={class:`flex flex-wrap items-center gap-x-6 gap-y-2 border-b px-5 pt-4 pr-12`},An={class:`pb-3`},jn={class:`-mb-px flex gap-1 self-end`,role:`tablist`},Mn=[`aria-selected`,`onClick`],Nn={class:`min-h-0 flex-1 overflow-y-auto p-5`},Pn={class:`flex min-h-0 flex-1`},Fn={class:`flex min-w-0 flex-1 flex-col`},In={class:`flex flex-wrap items-center gap-2 border-b px-4 py-2.5`},Ln={class:`relative min-w-48 flex-1`},Rn={class:`flex flex-wrap gap-1`},zn=[`aria-pressed`,`onClick`],Bn={key:0,class:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4`},Vn={key:1,class:`grid place-items-center px-6 py-16 text-center`},Hn={class:`mt-3 text-sm font-medium`},Un={class:`hidden w-72 shrink-0 overflow-y-auto border-l bg-muted/30 p-4 md:block`},Wn={key:0,class:`grid gap-3`},Gn={class:`grid place-items-center overflow-hidden rounded-md border bg-card`},Kn=[`src`,`alt`],qn={class:`text-[13px]`},Jn={class:`font-medium break-all`},Yn={class:`text-muted-foreground`},Xn={class:`grid gap-1`},Zn={class:`flex items-center justify-between text-[13px] font-medium`},Qn={class:`text-[13px]`},$n={key:0,class:`mb-1 font-medium text-brand-text`},er={key:1,class:`text-muted-foreground`},tr=[`href`],nr={key:1,class:`text-[13px] text-muted-foreground`},rr={class:`flex flex-wrap items-center gap-3 border-t bg-card px-5 py-3`},ir={class:`flex min-w-0 flex-1 items-center gap-2`},ar={class:`flex -space-x-2`},or=[`src`],sr={class:`text-[13px] font-medium`},cr={key:1,class:`text-[13px] text-muted-foreground`},lr={__name:`MediaPicker`,props:{open:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},contextPaths:{type:Array,default:()=>[]},contextLabel:{type:String,default:`Hier verwendet`},upload:{type:Function,default:null},title:{type:String,default:``}},emits:[`update:open`,`select`],setup(e,{emit:r}){let a=e,s=r,m=x(`library`),T=x(`all`),O=x(``),ee=p(()=>({q:O.value,sortierung:T.value===`recent`?`verwendet`:`neu`,status:T.value===`unused`?`unbenutzt`:T.value===`recent`?`verwendet`:``,pfade:T.value===`here`?a.contextPaths.slice(0,500):void 0})),{items:k,total:A,loading:ne,nextPage:re,load:ie,observe:ae,replaceItem:oe,prepend:se}=H(ee),j=x(null),M=x(null),N=x([]),P=x(null),ce=p(()=>new Set(a.contextPaths)),F=p(()=>k.value.find(e=>e.id===P.value)??N.value.find(e=>e.id===P.value)??null);i(()=>a.open,async e=>{e&&(N.value=[],P.value=null,O.value=``,T.value=`all`,m.value=`library`,await ie(!0),await y(),ae(j.value,M.value))},{immediate:!0}),i(m,async e=>{e===`library`&&(await y(),ae(j.value,M.value))});let le=e=>N.value.some(t=>t.id===e.id);function I(e){if(!e.missing){if(P.value=e.id,!a.multiple){N.value=[e];return}N.value=le(e)?N.value.filter(t=>t.id!==e.id):[...N.value,e]}}function z(e,t){if(!a.multiple&&t?.detail===2&&!e.missing){N.value=[e],J();return}I(e)}async function B(e,t){let n=a.upload?await a.upload(e,t):await de.upload(e,t);return n?.media??n}function ue(e){let t=e.map(e=>({...e,usage_count:e.usage_count??0}));T.value=`all`,se(t),N.value=a.multiple?[...N.value,...t.filter(e=>!le(e))]:[t[t.length-1]],P.value=t[t.length-1].id,m.value=`library`}let U=x(``),W=x(!1),G=x(null);i(F,(e,t)=>{e?.id!==t?.id&&(U.value=e?.alt??``,G.value=null)});async function K(){let e=F.value;if(e&&U.value.trim()!==(e.alt??``)){W.value=!0;try{let t=await de.update(e.id,{alt:U.value.trim()});oe(t.media),N.value=N.value.map(n=>n.id===e.id?{...n,alt:t.media.alt}:n)}catch(e){L.error(e.message)}finally{W.value=!1}}}async function q(){try{G.value=(await de.show(F.value.id)).usages}catch(e){L.error(e.message)}}async function J(){await K(),s(`select`,N.value.map(e=>he(k.value.find(t=>t.id===e.id)??e))),s(`update:open`,!1)}let _e=p(()=>[{key:`all`,label:`Alle`},{key:`recent`,label:`Zuletzt verwendet`},...a.contextPaths.length?[{key:`here`,label:a.contextLabel}]:[],{key:`unused`,label:`Nicht verwendet`}]);return(r,i)=>(h(),b(o(Ae),{open:e.open,"onUpdate:open":i[6]||=e=>s(`update:open`,e)},{default:_(()=>[t(o(je),{class:`flex h-[min(88vh,820px)] max-w-6xl flex-col gap-0 overflow-hidden p-0 sm:max-w-6xl`},{default:_(()=>[u(`header`,kn,[u(`div`,An,[t(o(Me),{class:`text-base`},{default:_(()=>[n(v(e.title||(e.multiple?`Bilder auswählen`:`Bild auswählen`)),1)]),_:1}),t(o(Ne),{class:`text-[13px]`},{default:_(()=>[n(v(e.multiple?`Mehrere Bilder anklicken – die Reihenfolge der Auswahl bleibt erhalten.`:`Ein Bild anklicken, mit Doppelklick direkt übernehmen.`),1)]),_:1})]),u(`nav`,jn,[(h(!0),d(g,null,f([{key:`upload`,label:`Hochladen`,icon:o(Ee)},{key:`library`,label:`Mediathek`,icon:o(Y)}],e=>(h(),d(`button`,{key:e.key,type:`button`,role:`tab`,"aria-selected":m.value===e.key,class:l([`inline-flex items-center gap-1.5 border-b-2 px-3 pb-2.5 text-sm font-medium transition-colors`,m.value===e.key?`border-brand text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`]),onClick:t=>m.value=e.key},[(h(),b(S(e.icon),{class:`size-4`})),n(` `+v(e.label),1)],10,Mn))),128))])]),c(u(`div`,Nn,[e.open?(h(),b(pe,{key:0,upload:B,paste:m.value===`upload`,onDone:ue},null,8,[`paste`])):C(``,!0),i[7]||=u(`p`,{class:`mt-4 text-[13px] text-muted-foreground`},`Hochgeladene Bilder landen in der Mediathek und sind danach ausgewählt. Große Fotos werden automatisch verkleinert.`,-1)],512),[[w,m.value===`upload`]]),c(u(`div`,Pn,[u(`div`,Fn,[u(`div`,In,[u(`label`,Ln,[i[8]||=u(`span`,{class:`sr-only`},`Suchen`,-1),t(o(te),{class:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),c(u(`input`,{"onUpdate:modelValue":i[0]||=e=>O.value=e,type:`search`,placeholder:`Suchen: Name, Alternativtext, Schlagwort …`,class:`h-8 w-full rounded-md border border-input bg-card pr-3 pl-8 text-sm placeholder:text-muted-foreground focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none`},null,512),[[E,O.value]])]),u(`div`,Rn,[(h(!0),d(g,null,f(_e.value,e=>(h(),d(`button`,{key:e.key,type:`button`,class:l([`h-8 rounded-md px-2.5 text-[13px] font-medium transition-colors`,T.value===e.key?`bg-brand-soft text-brand-soft-foreground`:`text-muted-foreground hover:bg-accent hover:text-foreground`]),"aria-pressed":T.value===e.key,onClick:t=>T.value=e.key},v(e.label),11,zn))),128))])]),u(`div`,{ref_key:`scroller`,ref:M,class:`min-h-0 flex-1 overflow-y-auto p-4`},[o(k).length?(h(),d(`ul`,Bn,[(h(!0),d(g,null,f(o(k),n=>(h(),d(`li`,{key:n.id},[t(V,{item:n,selected:le(n),checkable:e.multiple,here:ce.value.has(n.path),onOpen:z,onToggle:I},null,8,[`item`,`selected`,`checkable`,`here`])]))),128))])):o(ne)?C(``,!0):(h(),d(`div`,Vn,[(h(),b(S(O.value||T.value!==`all`?o(we):o(Y)),{class:`size-8 text-muted-foreground`,"stroke-width":1.5})),u(`p`,Hn,v(O.value||T.value!==`all`?`Keine Bilder gefunden`:`Die Mediathek ist noch leer`),1),t(o(De),{variant:`outline`,size:`sm`,class:`mt-3`,onClick:i[1]||=e=>m.value=`upload`},{default:_(()=>[t(o(Ee)),i[9]||=n(` Bilder hochladen`,-1)]),_:1})])),u(`div`,{ref_key:`sentinel`,ref:j,class:`grid h-12 place-items-center`},[o(ne)?(h(),b(o(D),{key:0,class:`size-5 animate-spin text-muted-foreground`})):o(re)&&o(k).length?(h(),b(o(De),{key:1,variant:`ghost`,size:`sm`,onClick:i[2]||=e=>o(ie)()},{default:_(()=>[...i[10]||=[n(`Weitere laden`,-1)]]),_:1})):C(``,!0)],512)],512)]),u(`aside`,Un,[F.value?(h(),d(`div`,Wn,[u(`div`,Gn,[F.value.thumb_url||F.value.url?(h(),d(`img`,{key:0,src:F.value.url||F.value.thumb_url,alt:F.value.alt,class:`max-h-44 w-auto object-contain`},null,8,Kn)):(h(),b(o(ye),{key:1,class:`my-10 size-6 text-muted-foreground`}))]),u(`div`,qn,[u(`p`,Jn,v(F.value.name),1),u(`p`,Yn,[F.value.width?(h(),d(g,{key:0},[n(v(F.value.width)+` × `+v(F.value.height)+` · `,1)],64)):C(``,!0),n(v(o(me)(F.value.size)),1)])]),u(`label`,Xn,[u(`span`,Zn,[i[11]||=n(` Alternativtext `,-1),W.value?(h(),b(o(D),{key:0,class:`size-3.5 animate-spin text-muted-foreground`})):C(``,!0)]),c(u(`textarea`,{"onUpdate:modelValue":i[3]||=e=>U.value=e,rows:`3`,maxlength:`300`,placeholder:`Was ist auf dem Bild zu sehen?`,class:`w-full resize-none rounded-md border border-input bg-card px-2.5 py-1.5 text-[13px] focus-visible:border-brand-400 focus-visible:ring-3 focus-visible:ring-ring/30 focus-visible:outline-none`,onBlur:K},null,544),[[E,U.value]]),i[12]||=u(`span`,{class:`text-[11px] text-muted-foreground`},`Wird in der Mediathek gespeichert und beim Einfügen übernommen.`,-1)]),u(`div`,Qn,[ce.value.has(F.value.path)?(h(),d(`p`,$n,v(e.contextLabel),1)):C(``,!0),F.value.usage_count?(h(),d(g,{key:2},[G.value?(h(),b(fe,{key:1,usages:G.value},null,8,[`usages`])):(h(),d(`button`,{key:0,type:`button`,class:`font-medium text-brand-text hover:underline`,onClick:q},` In `+v(F.value.usage_count)+` `+v(F.value.usage_count===1?`Inhalt`:`Inhalten`)+` verwendet `,1))],64)):(h(),d(`p`,er,`Noch nirgends verwendet.`))]),u(`a`,{href:`/redaktion/mediathek?q=${encodeURIComponent(F.value.name)}`,target:`_blank`,class:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground hover:underline`},[i[13]||=n(` In der Mediathek öffnen `,-1),t(o(ge),{class:`size-3`})],8,tr)])):(h(),d(`p`,nr,`Bild anklicken, um Details zu sehen und den Alternativtext zu ergänzen.`))])],512),[[w,m.value===`library`]]),u(`footer`,rr,[u(`div`,ir,[N.value.length?(h(),d(g,{key:0},[u(`div`,ar,[(h(!0),d(g,null,f(N.value.slice(-5),e=>(h(),d(`img`,{key:e.id,src:e.thumb_url,alt:``,class:`size-8 rounded border-2 border-card object-cover`},null,8,or))),128))]),u(`span`,sr,v(N.value.length===1?`1 Bild ausgewählt`:`${N.value.length} Bilder ausgewählt`),1),e.multiple?(h(),d(`button`,{key:0,type:`button`,class:`inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground`,onClick:i[4]||=e=>N.value=[]},[t(o(R),{class:`size-3`}),i[14]||=n(` Auswahl leeren`,-1)])):C(``,!0)],64)):o(A)!==null&&m.value===`library`?(h(),d(`span`,cr,v(o(A).toLocaleString(`de-DE`))+` `+v(o(A)===1?`Bild`:`Bilder`),1)):C(``,!0)]),t(o(De),{variant:`outline`,onClick:i[5]||=e=>s(`update:open`,!1)},{default:_(()=>[...i[15]||=[n(`Abbrechen`,-1)]]),_:1}),t(o(De),{disabled:!N.value.length,onClick:J},{default:_(()=>[n(v(e.multiple&&N.value.length>1?`${N.value.length} Bilder übernehmen`:`Übernehmen`),1)]),_:1},8,[`disabled`])])]),_:1})]),_:1},8,[`open`]))}},ur={__name:`MediaPickerHost`,props:{picker:{type:Object,required:!0}},setup(e){return(t,n)=>(h(),b(lr,{open:e.picker.state.open,multiple:e.picker.state.multiple,title:e.picker.state.title,"context-paths":e.picker.state.contextPaths,"context-label":e.picker.state.contextLabel,upload:e.picker.state.upload,onSelect:n[0]||=t=>e.picker.finish(t),"onUpdate:open":n[1]||=t=>!t&&e.picker.finish(null)},null,8,[`open`,`multiple`,`title`,`context-paths`,`context-label`,`upload`]))}};function dr(e={}){let t=m({open:!1,multiple:!1,title:``,contextPaths:[],contextLabel:e.contextLabel??`Hier verwendet`,upload:e.upload??null,resolve:null});function n(n={}){return t.resolve?.(null),new Promise(r=>{Object.assign(t,{multiple:!!n.multiple,title:n.title??``,contextPaths:n.contextPaths??e.contextPaths?.()??[],resolve:r,open:!0})})}function r(e){let n=t.resolve;t.resolve=null,t.open=!1,n?.(e)}return{state:t,pick:n,finish:r}}export{at as a,Ze as c,Ge as d,Sn as i,Qe as l,ur as n,Je as o,On as r,Xe as s,dr as t,$e as u};