1var B=["bottom","height","left","right","top","width"],M=function(e,t){return e===void 0&&(e={}),t===void 0&&(t={}),B.some(function(s){return e[s]!==t[s]})},A=new Map,R,H=function d(){var e=[];A.forEach(function(t,s){var n=s.getBoundingClientRect();M(n,t.rect)&&(t.rect=n,e.push(t))}),e.forEach(function(t){t.callbacks.forEach(function(s){return s(t.rect)})}),R=window.requestAnimationFrame(d)};function U(d,e){return{observe:function(){var s=A.size===0;A.has(d)?A.get(d).callbacks.push(e):A.set(d,{rect:void 0,hasRectChanged:!1,callbacks:[e]}),s&&H()},unobserve:function(){var s=A.get(d);if(s){var n=s.callbacks.indexOf(e);n>=0&&s.callbacks.splice(n,1),s.callbacks.length||A.delete(d),A.size||cancelAnimationFrame(R)}}}}function V(d,e){try{return new URL(d).origin===new URL(e).origin}catch{return!1}}var E=class i{static CSS_VAR_Z_INDEX="--directus-visual-editing--overlay--z-index";static CSS_VAR_BORDER_SPACING="--directus-visual-editing--rect--border-spacing";static CSS_VAR_BORDER_WIDTH="--directus-visual-editing--rect--border-width";static CSS_VAR_BORDER_COLOR="--directus-visual-editing--rect--border-color";static CSS_VAR_BORDER_RADIUS="--directus-visual-editing--rect--border-radius";static CSS_VAR_HOVER_OPACITY="--directus-visual-editing--rect-hover--opacity";static CSS_VAR_HIGHLIGHT_OPACITY="--directus-visual-editing--rect-highlight--opacity";static CSS_VAR_ACTIONS_GAP="--directus-visual-editing--actions--gap";static CSS_VAR_ACTIONS_OFFSET="--directus-visual-editing--actions--offset";static CSS_VAR_FOCUS_RING_COLOR="--directus-visual-editing--actions--focus-ring-color";static CSS_VAR_FOCUS_RING_WIDTH="--directus-visual-editing--actions--focus-ring-width";static CSS_VAR_FOCUS_RING_OFFSET="--directus-visual-editing--actions--focus-ring-offset";static CSS_VAR_BUTTON_WIDTH="--directus-visual-editing--edit-btn--width";static CSS_VAR_BUTTON_HEIGHT="--directus-visual-editing--edit-btn--height";static CSS_VAR_BUTTON_RADIUS="--directus-visual-editing--edit-btn--radius";static CSS_VAR_EDIT_BUTTON_BG_COLOR="--directus-visual-editing--edit-btn--bg-color";static CSS_VAR_EDIT_BUTTON_HOVER_BG_COLOR="--directus-visual-editing--edit-btn-hover--bg-color";static CSS_VAR_EDIT_BUTTON_ICON_BG_IMAGE="--directus-visual-editing--edit-btn--icon-bg-image";static CSS_VAR_EDIT_BUTTON_ICON_BG_SIZE="--directus-visual-editing--edit-btn--icon-bg-size";static CSS_VAR_AI_BUTTON_BG_COLOR="--directus-visual-editing--ai-btn--bg-color";static CSS_VAR_AI_BUTTON_HOVER_BG_COLOR="--directus-visual-editing--ai-btn-hover--bg-color";static CSS_VAR_AI_BUTTON_ICON_BG_IMAGE="--directus-visual-editing--ai-btn--icon-bg-image";static CSS_VAR_AI_BUTTON_ICON_BG_SIZE="--directus-visual-editing--ai-btn--icon-bg-size";static ICON_EDIT=`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="%23ffffff"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z"/></svg>')`;static ICON_AI=`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"><path fill="%23ffffff" d="M10 14.175L11 12l2.175-1L11 10l-1-2.175L9 10l-2.175 1L9 12l1 2.175ZM10 19l-2.5-5.5L2 11l5.5-2.5L10 3l2.5 5.5L18 11l-5.5 2.5L10 19Zm8 2l-1.25-2.75L14 17l2.75-1.25L18 13l1.25 2.75L22 17l-2.75 1.25L18 21Zm-8-10Z"/></svg>')`;static OVERLAY_ID="directus-visual-editing";static STYLE_ID="directus-visual-editing-style";static CONTAINER_RECT_CLASS_NAME="directus-visual-editing-overlay";static RECT_CLASS_NAME="directus-visual-editing-rect";static RECT_HIGHLIGHT_CLASS_NAME="directus-visual-editing-rect-highlight";static RECT_HIGHLIGHT_ACTIVE_CLASS_NAME="directus-visual-editing-rect-highlight-active";static RECT_PARENT_HOVER_CLASS_NAME="directus-visual-editing-rect-parent-hover";static RECT_HOVER_CLASS_NAME="directus-visual-editing-rect-hover";static RECT_INNER_CLASS_NAME="directus-visual-editing-rect-inner";static RECT_BUTTON_CLASS_NAME="directus-visual-editing-button";static RECT_EDIT_BUTTON_CLASS_NAME="directus-visual-editing-edit-button";static RECT_AI_BUTTON_CLASS_NAME="directus-visual-editing-ai-button";static RECT_ACTIONS_FLIPPED_CLASS_NAME="directus-visual-editing-actions-flipped";static getGlobalOverlay(){let e=document.getElementById(i.OVERLAY_ID);if(e)return e;let t=document.createElement("div");return t.id=i.OVERLAY_ID,document.body.insertAdjacentElement("afterend",t),t}static addStyles(){if(document.getElementById(i.STYLE_ID))return;let e=document.createElement("style");e.id=i.STYLE_ID;let t=new g().getTheme(),s={primaryColor:t?.primaryColor?.trim()||"#6644ff",primaryAccentColor:t?.primaryAccentColor?.trim()||"color-mix(in srgb, #6644ff, #2e3C43 25%)",borderRadius:t?.borderRadius?.trim()||"6px",buttonSize:t?.buttonSize?.trim()||"24px",focusRingWidth:t?.focusRingWidth?.trim()||"2px",focusRingOffset:t?.focusRingOffset?.trim()||"2px"},n=`var(${i.CSS_VAR_ACTIONS_GAP}, 4px)`,r=`var(${i.CSS_VAR_ACTIONS_OFFSET}, 4px)`,a=`var(${i.CSS_VAR_EDIT_BUTTON_BG_COLOR}, ${s.primaryColor})`,l=`var(${i.CSS_VAR_AI_BUTTON_BG_COLOR}, ${s.primaryColor})`,_=`var(${i.CSS_VAR_EDIT_BUTTON_HOVER_BG_COLOR}, ${s.primaryAccentColor})`,S=`var(${i.CSS_VAR_AI_BUTTON_HOVER_BG_COLOR}, ${s.primaryAccentColor})`,h=`var(${i.CSS_VAR_BUTTON_WIDTH}, ${s.buttonSize})`,f=`var(${i.CSS_VAR_BUTTON_HEIGHT}, ${s.buttonSize})`,O=`var(${i.CSS_VAR_BUTTON_RADIUS}, ${s.borderRadius})`,u=`var(${i.CSS_VAR_BORDER_SPACING}, 8px)`,I=`var(${i.CSS_VAR_BORDER_WIDTH}, ${s.focusRingWidth})`,L=`var(${i.CSS_VAR_BORDER_COLOR}, ${s.primaryColor})`,b=`var(${i.CSS_VAR_BORDER_RADIUS}, ${s.borderRadius})`,$=`var(${i.CSS_VAR_FOCUS_RING_COLOR}, ${s.primaryColor})`,p=`var(${i.CSS_VAR_FOCUS_RING_WIDTH}, ${s.focusRingWidth})`,y=`var(${i.CSS_VAR_FOCUS_RING_OFFSET}, ${s.focusRingOffset})`;e.appendChild(document.createTextNode(` 2 #${i.OVERLAY_ID} { 3 display: contents; 4 } 5 .${i.CONTAINER_RECT_CLASS_NAME} { 6 pointer-events: none; 7 position: fixed; 8 inset: 0; 9 z-index: var(${i.CSS_VAR_Z_INDEX}, 999999999); 10 } 11 .${i.RECT_CLASS_NAME} { 12 position: absolute; 13 /* Use non-logical properties to correctly position the rect with transform translate in RTL mode */ 14 top: 0; 15 left: 0; 16 } 17 .${i.RECT_INNER_CLASS_NAME} { 18 position: absolute; 19 box-sizing: border-box; 20 inset-block-start: calc(-1 * ${u}); 21 inset-inline-start: calc(-1 * ${u}); 22 inset-inline-end: calc(-1 * ${u}); 23 inset-block-end: calc(-1 * ${u}); 24 border: ${I}
24 solid ${L}; 25 border-radius: ${b}; 26 opacity: 0; 27 } 28 .${i.RECT_CLASS_NAME}.${i.RECT_HOVER_CLASS_NAME} .${i.RECT_INNER_CLASS_NAME} { 29 --hover-opacity: var(${i.CSS_VAR_HOVER_OPACITY}, 0.333); 30 opacity: var(--hover-opacity); 31 } 32 .${i.RECT_CLASS_NAME}.${i.RECT_PARENT_HOVER_CLASS_NAME} .${i.RECT_INNER_CLASS_NAME} { 33 opacity: calc(var(--hover-opacity) / 3); 34 } 35 .${i.RECT_HIGHLIGHT_CLASS_NAME} { 36 pointer-events: all; 37 cursor: pointer; 38 } 39 .${i.RECT_HIGHLIGHT_CLASS_NAME} .${i.RECT_INNER_CLASS_NAME} { 40 opacity: var(${i.CSS_VAR_HIGHLIGHT_OPACITY}, 0.333); 41 } 42 .${i.RECT_BUTTON_CLASS_NAME}:visited, 43 .${i.RECT_BUTTON_CLASS_NAME}:active, 44 .${i.RECT_BUTTON_CLASS_NAME}:hover, 45 .${i.RECT_BUTTON_CLASS_NAME}:focus, 46 .${i.RECT_BUTTON_CLASS_NAME} { 47 all: initial; 48 pointer-events: all; 49 cursor: pointer; 50 position: absolute; 51 z-index: 1; 52 inset-block-end: 100%; 53 margin-block-end: calc((${u} + ${r})); 54 inline-size: ${h}; 55 block-size: ${f}; 56 border-radius: ${O}; 57 background-position: center; 58 background-repeat: no-repeat; 59 opacity: 0; 60 } 61 .${i.RECT_BUTTON_CLASS_NAME}::after { 62 content: ''; 63 position: absolute; 64 inset-inline: calc(-1 * ${n} / 2); 65 inset-block-start: 0; 66 inset-block-end: calc(-1 * ${r}); 67 } 68 .${i.RECT_BUTTON_CLASS_NAME}.${i.RECT_EDIT_BUTTON_CLASS_NAME} { 69 inset-inline-start: calc(-1 * ${u}); 70 background-color: ${a}; 71 background-image: var(${i.CSS_VAR_EDIT_BUTTON_ICON_BG_IMAGE}, ${i.ICON_EDIT}); 72 background-size: var(${i.CSS_VAR_EDIT_BUTTON_ICON_BG_SIZE}, 66.6%); 73 } 74 .${i.RECT_BUTTON_CLASS_NAME}.${i.RECT_AI_BUTTON_CLASS_NAME} { 75 inset-inline-start: calc(-1 * ${u} + ${h} + ${n}); 76 background-color: ${l}; 77 background-image: var(${i.CSS_VAR_AI_BUTTON_ICON_BG_IMAGE}, ${i.ICON_AI}); 78 background-size: var(${i.CSS_VAR_AI_BUTTON_ICON_BG_SIZE}, 66.6%); 79 } 80 .${i.RECT_CLASS_NAME}.${i.RECT_HOVER_CLASS_NAME}:not(.${i.RECT_PARENT_HOVER_CLASS_NAME}) .${i.RECT_BUTTON_CLASS_NAME}, 81 .${i.RECT_HIGHLIGHT_ACTIVE_CLASS_NAME} .${i.RECT_INNER_CLASS_NAME}, 82 .${i.RECT_HIGHLIGHT_CLASS_NAME}:hover .${i.RECT_BUTTON_CLASS_NAME}, 83 .${i.RECT_BUTTON_CLASS_NAME}:hover, 84 .${i.RECT_BUTTON_CLASS_NAME}:hover ~ .${i.RECT_INNER_CLASS_NAME}, 85 .${i.RECT_HIGHLIGHT_CLASS_NAME}:hover .${i.RECT_INNER_CLASS_NAME}, 86 .${i.RECT_CLASS_NAME}:has(.${i.RECT_BUTTON_CLASS_NAME}:hover) .${i.RECT_BUTTON_CLASS_NAME}, 87 .${i.RECT_HIGHLIGHT_CLASS_NAME}:focus-within .${i.RECT_BUTTON_CLASS_NAME}, 88 .${i.RECT_BUTTON_CLASS_NAME}:focus-visible, 89 .${i.RECT_BUTTON_CLASS_NAME}:focus-visible ~ .${i.RECT_INNER_CLASS_NAME}, 90 .${i.RECT_HIGHLIGHT_CLASS_NAME}:focus-within .${i.RECT_INNER_CLASS_NAME}, 91 .${i.RECT_CLASS_NAME}:has(.${i.RECT_BUTTON_CLASS_NAME}:focus-within) .${i.RECT_BUTTON_CLASS_NAME} { 92 opacity: 1; 93 } 94 .${i.RECT_BUTTON_CLASS_NAME}.${i.RECT_EDIT_BUTTON_CLASS_NAME}:hover { 95 background-color: ${_}; 96 } 97 .${i.RECT_BUTTON_CLASS_NAME}.${i.RECT_AI_BUTTON_CLASS_NAME}:hover { 98 background-color: ${S}; 99 } 100 .${i.RECT_CLASS_NAME}.${i.RECT_ACTIONS_FLIPPED_CLASS_NAME} .${i.RECT_BUTTON_CLASS_NAME} { 101 inset-block-end: auto; 102 inset-block-start: 100%; 103 margin-block-start: calc(${u} + ${r}); 104 } 105 .${i.RECT_CLASS_NAME}.${i.RECT_ACTIONS_FLIPPED_CLASS_NAME} .${i.RECT_BUTTON_CLASS_NAME}::after { 106 inset-block-start: calc(-1 * ${r}); 107 inset-block-end: 0; 108 } 109 .${i.RECT_BUTTON_CLASS_NAME}:focus-visible { 110 outline: ${p} solid ${$}; 111 outline-offset: ${y}; 112 } 113 `)),document.head.appendChild(e)}},D=class N{static NEAR_TOP_THRESHOLD=54;hasNoDimensions=!1;element;container;editButton;aiButton;constructor(){this.container=this.createContainer(),this.element=this.createElement(),this.editButton=this.createEditButton();let e=new g;this.aiButton=e.isAiEnabled()?this.createAiButton():null,this.setMessages(e.getMessages()),this.createRectElement(),E.getGlobalOverlay().appendChild(this.container),c.highlightOverlayElements&&this.toggleHighlight(!0),this.element.addEventListener("click",t=>{let s=t.target;s&&(this.editButton.contains(s)||this.aiButton?.contains(s))||this.editButton.click()})}createContainer(){let e=document.createElement("div");return e.classList.add(E.CONTAINER_RECT_CLASS_NAME),e}createElement(){let e=document.createElement("div");return e.classList.add(E.RECT_CLASS_NAME),this.container.appendChild(e),e}createRectElement(){let e=document.createElement("div");e.classList.add(E.RECT_INNER_CLASS_NAME),this.element.appendChild(e)}createEditButton(){let e=document.createElement("button");return e.type="button",e.classList.add(E.RECT_BUTTON_CLASS_NAME),e.classList.add(E.RECT_EDIT_BUTTON_CLASS_NAME),this.element.appendChild(e),e}createAiButton(){let e=document.createElement("button");return e.type="button",e.classList.add(E.RECT_BUTTON_CLASS_NAME),e.classList.add(E.RECT_AI_BUTTON_CLASS_NAME),this.element.appendChild(e),e}setMessages(e){e&&(this.editButton.title=e.edit,this.editButton.setAttribute("aria-label",e.edit),this.aiButton&&(this.aiButton.title=e.addToContext,this.aiButton.setAttribute("aria-label",e.addToContext)))}updateRect(e){let t=e.width!==0&&e.height!==0;if(!this.hasNoDimensions&&!t){this.hasNoDimensions=!0,this.disable();return}this.hasNoDimensions&&t&&(this.hasNoDimensions=!1,this.enable()),this.element.style.width=`${e.width}px`,this.element.style.height=`${e.height}px`,this.element.style.transform=`translate(${e.left}px,${e.top}px)`,this.element.classList.toggle(E.RECT_ACTIONS_FLIPPED_CLASS_NAME,e.top<N.NEAR_TOP_THRESHOLD)}setCustomClass(e){e!==void 0&&/^[a-zA-Z_][\w-]*$/.test(e)&&this.container.classList.add(e)}toggleHover(e){this.element.classList.toggle(E.RECT_HOVER_CLASS_NAME,e)}toggleParentHover(e){this.element.classList.toggle(E.RECT_PARENT_HOVER_CLASS_NAME,e)}toggleHighlight(e){this.element.classList.toggle(E.RECT_HIGHLIGHT_CLASS_NAME,e)}toggleHighlightActive(e){this.element.classList.toggle(E.RECT_HIGHLIGHT_ACTIVE_CLASS_NAME,e)}disable(){this.element.style.display="none"}enable(){this.element.style.removeProperty("display")}remove(){this.container.remove()}},v=class C{static DATASET="directus";static DATA_ATTRIBUTE_VALID_KEYS=["collection","item","fields","mode"];activated=!1;optionsWritable=!0;customClass=void 0;element;key;editConfig;rectObserver;overlayElement;rect;hover=!1;disabled=!1;onSaved=void 0;boundMouseenter;boundMouseleave;constructor(e){this.element=e,this.key=crypto.randomUUID(),this.editConfig=C.editAttrToObject(this.element.dataset[C.DATASET])}activate(){this.activated||(this.activated=!0,this.boundMouseenter=this.onMouseenter.bind(this),this.boundMouseleave=this.onMouseleave.bind(this),this.element.addEventListener("mouseenter",this.boundMouseenter),this.element.addEventListener("mouseleave",this.boundMouseleave),this.rect=this.element.getBoundingClientRect(),this.overlayElement=new D,this.overlayElement.setCustomClass(this.customClass),this.overlayElement.updateRect(this.rect),this.overlayElement.editButton.addEventListener("click",this.onClickEdit.bind(this)),this.overlayElement.aiButton?.addEventListener("click",this.onClickAddToContext.bind(this)),this.rectObserver=U(this.element,this.onObserveRect.bind(this)),this.rectObserver.observe())}static query(e){return e?(Array.isArray(e)?e:[e]).filter(t=>t instanceof HTMLElement).flatMap(t=>t.dataset[C.DATASET]===void 0?Array.from(t.querySelectorAll(`[data-${C.DATASET}]`)):t).filter(t=>t!==null):Array.from(document.querySelectorAll(`[data-${C.DATASET}]`))}static objectToEditAttr(e){let t=[];for(let[s,n]of Object.entries(e))C.validEditConfigKey(s)&&(s==="fields"&&Array.isArray(n)?t.push(`${s}:${n.join(",")}`):t.push(`${s}:${n}`));return t.join(";")}static editAttrToObject(e){let t=e.split(";"),s={};return t.forEach(n=>{let r=n.split(":");if(r[0]===void 0||r?.[1]===void 0)return;let a=r[0].trim();if(!C.validEditConfigKey(a))return;let l=r[1];if(a==="fields"){s.fields=l.split(",").map(_=>_.trim());return}s[a]=l.trim()}),s}static validEditConfigKey(e){return C.DATA_ATTRIBUTE_VALID_KEYS.includes(e)}applyOptions({customClass:e,onSaved:t},s=!1){this.optionsWritable&&(s&&(this.optionsWritable=!1),t!==void 0&&(this.onSaved=t),this.overlayElement?this.overlayElement.setCustomClass(e):this.customClass=e)}removeHoverListener(){this.boundMouseenter&&(this.element.removeEventListener("mouseenter",this.boundMouseenter),this.element.removeEventListener("mouseleave",this.boundMouseleave))}onClickEdit(){new g().send("edit",{key:this.key,editConfig:this.editConfig,rect:this.rect})}onClickAddToContext(e){e.stopPropagation(),new g().send("addToContext",{key:this.key,editConfig:this.editConfig,rect:this.rect})}onMouseenter(e){this.toggleItemHover(!0,e)}onMouseleave(e){this.toggleItemHover(!1,e)}toggleItemHover(e,t){this.element!==t.currentTarget||this.hover===e||(this.hover=e,this.setParentsHover(),this.overlayElement.toggleHover(e))}setParentsHover(){let e=c.getHoveredItems();e.forEach(t=>{let s=e.filter(n=>n.element!==t.element).some(n=>t.element.contains(n.element));t.overlayElement.toggleParentHover(s)})}onObserveRect(e){this.disabled||(this.rect=e,this.overlayElement?.updateRect(e))}},c=class o{static items=[];static highlightOverlayElements=!1;static highlightedKey=null;static getItem(e){return o.items.find(t=>t.element===e)}static getItemByKey(e){return o.items.find(t=>t.key===e)}static getItemByEditConfig(e,t,s){return o.items.find(n=>{if(n.editConfig.collection!==e||String(n.editConfig.item)!==String(t))return!1;let r=n.editConfig.fields??[],a=s??[];return r.length===a.length?r.every(l=>a.includes(l)):!1})}static getHoveredItems(){return o.items.filter(e=>e.hover)}static addItem(e){o.items.push(e)}
113static activateItems(e){o.items.forEach(t=>{e.includes(t.key)&&t.activate()})}static enableItems(e){(e??o.items).forEach(t=>{t.disabled=!1,t.rectObserver?.observe(),t.overlayElement?.enable()})}static disableItems(e){let t=e??o.items.filter(s=>!s.disabled);return t.forEach(s=>{s.disabled=!0,s.hover=!1,s.rectObserver?.unobserve(),s.overlayElement?.disable()}),[...t]}static removeItems(e){let t=e??o.items;t.forEach(s=>{s.rectObserver?.unobserve(),s.overlayElement?.remove(),s.removeHoverListener()}),o.items=o.items.filter(s=>!t.includes(s))}static highlightItems(e){this.highlightOverlayElements!==e&&(this.highlightOverlayElements=e,o.items.forEach(t=>{t.overlayElement?.toggleHighlight(e)}))}static highlightElement(e){if(this.highlightedKey!==null&&o.getItemByKey(this.highlightedKey)?.overlayElement?.toggleHighlightActive(!1),e===null){this.highlightedKey=null;return}let t;t="key"in e?o.getItemByKey(e.key):o.getItemByEditConfig(e.collection,e.item,e.fields),t?(this.highlightedKey=t.key,t.overlayElement?.toggleHighlightActive(!0)):this.highlightedKey=null}},g=class T{static SINGLETON;static ERROR_PARENT_NOT_FOUND="Error sending message to Directus in parent frame:";origin=null;confirmed=!1;aiEnabled=!1;theme=null;messages=null;constructor(){if(T.SINGLETON)return T.SINGLETON;T.SINGLETON=this,window?.addEventListener("message",this.receive.bind(this))}isAiEnabled(){return this.aiEnabled}getTheme(){return this.theme}getMessages(){return this.messages}send(e,t){try{if(!this.origin)throw Error();return window.parent.postMessage({action:e,data:t},this.origin),!0}catch(s){return console.error(T.ERROR_PARENT_NOT_FOUND,s),!1}}connect(e){return this.origin=e,this.send("connect")}receive(e){if(!this.origin||!V(e.origin,this.origin))return;let{action:t,data:s}=e.data;t==="confirm"&&this.receiveConfirmAction(s),t==="activateElements"&&this.receiveActivateElements(s),t==="showEditableElements"&&this.receiveShowEditableElements(s),t==="saved"&&this.receiveSaved(s),t==="highlightElement"&&this.receiveHighlightElement(s)}receiveConfirm(){let e=0;return new Promise(t=>{let s=()=>{if(e>=10)return t(!1);e++,this.confirmed?t(!0):setTimeout(s,100)};s()})}receiveConfirmAction(e){let t=e;this.confirmed=!0,this.aiEnabled=!!t?.aiEnabled,this.theme=t?.theme??null,this.messages=t?.messages??null}receiveActivateElements(e){let t=Array.isArray(e)?e:[];c.activateItems(t)}receiveShowEditableElements(e){let t=!!e;c.highlightItems(t)}receiveSaved(e){let{key:t="",collection:s="",item:n=null,payload:r={}}=e,a=c.getItemByKey(t);if(a&&s&&typeof a.onSaved=="function"){a.onSaved({collection:s,item:n,payload:r});return}window.location.reload()}receiveHighlightElement(e){if(!e||typeof e!="object"){c.highlightElement(null);return}let{key:t,collection:s,item:n,fields:r}=e;t===null?c.highlightElement(null):s&&n!==void 0?c.highlightElement(r?{collection:s,item:n,fields:r}:{collection:s,item:n}):typeof t=="string"&&c.highlightElement({key:t})}},G=class m{static navigationInitialized=!1;static onNavigation(e){if(m.navigationInitialized)return;let t="",s="",n,r=l=>{clearTimeout(n),n=setTimeout(l,100)},a=()=>{let l=window.location.href,_=document.title,S=t!==l||s!==_;S&&(r(()=>e({url:l,title:_})),t=l,s=_),setTimeout(a,S?50:200)};a(),m.navigationInitialized=!0}};async function k({directusUrl:d,elements:e=void 0,customClass:t=void 0,onSaved:s=void 0}){let n=new g;if(!n.connect(d)||!await n.receiveConfirm())return;G.onNavigation(_=>n.send("navigation",_)),E.addStyles();let r=v.query(e),a=[],l=[];return r.forEach(_=>{let S=c.getItem(_),h=S??new v(_);h.applyOptions({customClass:t,onSaved:s},!!e),a.push(h),S||(c.addItem(h),l.push({key:h.key,collection:h.editConfig.collection,item:h.editConfig.item,fields:h.editConfig.fields??[]}))}),l.length&&n.send("checkFieldAccess",l),{remove(){c.removeItems(a)},enable(){c.enableItems(a)},disable(){c.disableItems(a)}}}function w(){c.removeItems()}function x(d){return v.objectToEditAttr(d)}export{k as apply,w as remove,x as setAttr}; 114//# sourceMappingURL=DQkcaaBu.js.map
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.