1import{u as j}from"./CtDd3rhm.js";import{g as q,u as i,h as G,i as C,j as f,k as d,l as N}from"./eoZLS6Xr.js";import{u as s}from"./DdDfUc8w.js";import{u as O}from"./ilLso-WW.js";import{u as h,a as g}from"./t7BP-0uL.js";import{H as $,G as z}from"./BqJpZGcT.js";const le=()=>{const{setIndex:x}=j(),U=q(),{isStructureBlock:V}=s(),{logToCCreateBlock:I}=O(),B=i("toc-selected-uuid",()=>""),u=i("toc-expanded-blocks",()=>new Set),m=i("toc-hovered-uuid",()=>""),k=i("toc-highlighted-uuid",()=>""),v=i("toc-highlight-token",()=>0),S=i("toc-filters",()=>new Set),{allBlocks:a}=G();$(()=>U.fullPath,()=>{u.value.clear(),B.value="",m.value="",k.value="",v.value++,S.value=new Set});const D=(o,e=0)=>{const t=[];for(const n of o)n.meta?.uuid&&t.push({uuid:n.meta.uuid,label:C(n.name),depth:e,block:n});return t},E=(o,e=0)=>({uuid:o.meta.uuid,label:C(o.name),depth:e,block:o}),y=z(()=>a.value.length?D(a.value):[]),F=o=>{u.value.has(o)?u.value.delete(o):u.value.add(o)},H=o=>{const e=[];if(Array.isArray(o.block.content))for(const t of o.block.content)t.meta?.uuid&&e.push({uuid:t.meta.uuid,label:C(t.name),depth:o.depth+1,block:t});return e},P=o=>{B.value=o;const e=document.querySelector(`[data-uuid="${o}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"center"}),k.value=o;const t=++v.value;setTimeout(()=>{v.value===t&&(k.value="")},1500)},L=o=>{const{openDrawerWithView:e}=d();if(P(o.meta.uuid),a.value){for(const t of a.value)if(t.name==="Carousel"&&Array.isArray(t.content)){const n=t.content.findIndex(l=>l.meta?.uuid===o.meta.uuid);if(n!==-1){x(t.meta.uuid,n);break}}}e("blocksSettings",o)},W=(o,e)=>{const t=o.currentTarget;if(f().public.enableAddBlockPopover){const{openAddBlockPopover:n}=h();n({anchorEl:t,targetUuid:e.meta.uuid,position:"inside"})}else{const{openDrawerWithView:n}=d(),{setInsertColumnUuid:l}=g();l(e.meta.uuid),n("blocksList")}},b=o=>{const{scrollIntoBlockView:e}=s(),t=a.value;if(!t.length)return;const n=t.findIndex(c=>N(c)),l=n>=0?t[n]:null;if(l){if(f().public.enableAddBlockPopover){const{openAddBlockPopover:c}=h();c({anchorEl:o.currentTarget,targetUuid:l.meta.uuid,position:"top"})}else{const{openDrawerWithView:c}=d(),{togglePlaceholder:r}=s(),{clearInsertColumnUuid:p}=g();r(l.meta.uuid,"top"),c("blocksList"),p()}e(l)}},T=(o,e)=>{if(!e)return;const{scrollIntoBlockView:t}=s(),n=e.content??[],l=n[n.length-1],c=o.currentTarget,r=l?.meta?.uuid??e.meta.uuid,p=l?"bottom":"top";if(f().public.enableAddBlockPopover){const{openAddBlockPopover:A}=h();A({anchorEl:c,targetUuid:r,position:p})}else{const{openDrawerWithView:A}=d(),{togglePlaceholder:M}=s(),{clearInsertColumnUuid:R}=g();M(r,p),A("blocksList"),R()}t(l??e)},w=(o,e)=>{if(!e)return;const{scrollIntoBlockView:t}=s(),n=o.currentTarget;if(f().public.enableAddBlockPopover){const{openAddBlockPopover:l}=h();l({anchorEl:n,targetUuid:e.meta.uuid,position:"top"})}else{const{openDrawerWithView:l}=d(),{togglePlaceholder:c}=s(),{clearInsertColumnUuid:r}=g();c(e.meta.uuid,"top"),l("blocksList"),r()}t(e)};return{selectedUuid:B,hoveredUuid:m,highlightedUuid:k,expandedBlocks:u,filters:S,data:a,flatBlocks:y,isStructureBlock:V,toggleBlockExpansion:F,getChildren:H,scrollToBlock:P,editBlock:L,replaceEmptyBlock:W,addBlockAtBottom:b,addBlockAtContainerEnd:T,addBlockAtContainerStart:w,addAtTopForSection:(o,e)=>{if(e.id==="content"){const t=e.elements[0];t?w(o,t):b(o)}else e.container&&w(o,e.elements[0]??e.container);I()},addAtBottomForSection:(o,e)=>{e.id==="content"?b(o):e.container&&T(o,e.container),I()},handleSectionDragChange:(o,e)=>{if(!e.moved||e.moved.oldIndex===e.moved.newIndex)return;const{scrollIntoBlockView:t}=s(),n=o.elements[e.moved.newIndex];n&&t(n)},blockToFlatBlock:E,setHoveredBlock:o=>{m.value=o},clearHoveredBlock:()=>{m.value=""}}};export{le as u};
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.