1import{d as V,J as $,b as Y,r as A,a as se,o as ae,ab as ke,h as T,j as y,O as H,l as _,c as ne,K as G,Q as re,R as P,u as M,S as J,a1 as K,M as Z,y as ye,V as ce,W as he,a0 as U,T as Ee,G as oe,g as Te,L as q,U as j}from"./vue-CSYLiKZT.js";import{a as Me}from"./vue-router-77CM7DbG.js";import{g as Q}from"./gsap-Bljl09Y3.js";import{k as F,t as Re,N as xe,m as De}from"./index-D4RReWuu.js";import{V as We}from"./DivorLeaf-DHeFaqGw-C1F9v94U.js";import"./bootstrap-osdmIVU2.js";import"./pinia-BI_HQOKK.js";import"./element-plus-DvPwvndo.js";import"./axios-B9ygI19o.js";import"./tiptap-CbUb9w_u.js";import"./vue-i18n-idGm9z_4.js";import"./ui-plugins-BmhUzZXX.js";import"./leaflet-WWpJW0t2.js";var Pe=Object.defineProperty,Oe=(e,i,o)=>i in e?Pe(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,c=(e,i,o)=>Oe(e,typeof i!="symbol"?i+"":i,o);const B={mobile:768,tablet:1024};function He(){const e=A(!1),i=A(!1),o=A(!0);let l=null,s=null;function t(){typeof window>"u"||(e.value=window.innerWidth<B.mobile,i.value=window.innerWidth>=B.mobile&&window.innerWidth<B.tablet,o.value=window.innerWidth>=B.tablet)}return ae(()=>{t(),l=window.matchMedia(`(max-width: ${B.mobile-1}px)`),s=window.matchMedia(`(min-width: ${B.mobile}px) and (max-width: ${B.tablet-1}px)`),l.addEventListener("change",t),s.addEventListener("change",t)}),ce(()=>{l==null||l.removeEventListener("change",t),s==null||s.removeEventListener("change",t)}),{isMobile:e,isTablet:i,isDesktop:o}}const Ae={class:"pg-divor-float__title"},Ie={class:"pg-divor-float__controls"},Ye={class:"pg-divor-float__content"},$e=V({__name:"DivorFloating",props:{divor:{},position:{}},emits:["update-position","dock"],setup(e,{emit:i}){const o=e,l=i,s=A(null),t=A({...o.position});se(()=>o.position,w=>{t.value={...w}},{deep:!0});const m=Y(()=>{var w;return((w=o.divor.page_component_detail)==null?void 0:w.blueprint_name)||(o.divor.is_leaf?"Panneau":"Branche")}),d=Y(()=>({left:`${t.value.x}px`,top:`${t.value.y}px`,width:`${t.value.w}px`,height:`${t.value.h}px`}));let n=!1,v=0,S=0,b=0,a=0;function z(w){w.target.closest(".pg-divor-float__btn")||(n=!0,v=w.clientX,S=w.clientY,b=t.value.x,a=t.value.y,window.addEventListener("mousemove",p),window.addEventListener("mouseup",r),w.preventDefault())}function p(w){n&&(t.value.x=b+(w.clientX-v),t.value.y=a+(w.clientY-S))}function r(){n&&(n=!1,window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",r),s.value&&(t.value.w=s.value.offsetWidth,t.value.h=s.value.offsetHeight),l("update-position",{...t.value}))}function u(){s.value&&(s.value.style.zIndex=String(8e3+Math.floor(Date.now()/1e3)%1e3))}return ce(()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",r)}),(w,x)=>(y(),$(Te,{to:"body"},[_("div",{ref_key:"floatRef",ref:s,class:"pg-divor-float",style:he(d.value),onMousedown:u},[_("div",{class:"pg-divor-float__titlebar",onMousedown:z},[_("span",Ae,P(m.value),1),_("div",Ie,[_("button",{type:"button",class:"pg-divor-float__btn",title:"Ancrer (retour dans le layout)",onClick:x[0]||(x[0]=U(L=>w.$emit("dock"),["stop"]))},"â"),_("button",{type:"button",class:"pg-divor-float__btn",title:"Fermer (ancrer)",onClick:x[1]||(x[1]=U(L=>w.$emit("dock"),["stop"]))},"Ã")])],32),_("div",Ye,[oe(w.$slots,"default",{},void 0,!0)])],36)]))}}),Xe=F($e,[["__scopeId","data-v-3f26a7f2"]]),Ve=["title"],Be={class:"pg-divor-min__label"},Fe=V({__name:"DivorMinimized",props:{divor:{}},emits:["restore"],setup(e){const i=e,o=Y(()=>{var l;return((l=i.divor.page_component_detail)==null?void 0:l.blueprint_name)||(i.divor.is_leaf?"Panneau reduit":`Branche (${i.divor.direction}) reduite`)});return(l,s)=>(y(),T("div",{class:"pg-divor-min",onClick:s[1]||(s[1]=t=>l.$emit("restore")),title:o.value},[s[2]||(s[2]=_("span",{class:"pg-divor-min__icon"},"â¸",-1)),_("span",Be,P(o.value),1),_("button",{type:"button",class:"pg-divor-min__restore",onClick:s[0]||(s[0]=U(t=>l.$emit("restore"),["stop"]))},"Restaurer")],8,Ve))}}),Ue=F(Fe,[["__scopeId","data-v-780c46e4"]]),qe=["title"],je={class:"pg-divor-overlay__hidden-label"},Je={class:"pg-divor-overlay pg-divor-overlay--fullscreen"},Ke={class:"pg-divor-overlay__fs-content"},Qe=["title"],Ge={key:0,class:"pg-divor-overlay__locked"},Ze=V({__name:"DivorOverlay",props:{divor:{}},setup(e){const i=e,o=xe(),l=A(!1),s={divor:0,hidden:!1,locked:!1,minimized:!1,fullscreen:!1,float_position:null},t=Y(()=>
1o.divorStates[i.divor.id]||{...s,divor:i.divor.id}),m=Y(()=>o.focusedDivorId===i.divor.id),d=Y(()=>{var k;return((k=i.divor.page_component_detail)==null?void 0:k.blueprint_name)||(i.divor.is_leaf?"Panneau":`Branche ${i.divor.direction}`)});function n(k){return o.persistDivorState(i.divor.id,k)}function v(){n({fullscreen:!t.value.fullscreen,minimized:!1})}function S(){n({hidden:!t.value.hidden})}function b(){n({minimized:!t.value.minimized,fullscreen:!1})}function a(){n({locked:!t.value.locked})}function z(){if(t.value.float_position)n({float_position:null});else{const k=typeof window<"u"?window.innerWidth:1200,N=typeof window<"u"?window.innerHeight:800,D=420,h=320;n({float_position:{x:Math.max(24,Math.floor(k/2-D/2)),y:Math.max(80,Math.floor(N/2-h/2)),w:D,h}})}}function p(){n({hidden:!1,minimized:!1,fullscreen:!1,float_position:null})}function r(){n({fullscreen:!1})}function u(){n({float_position:null})}function w(k){n({float_position:k})}function x(){l.value=!0,o.setFocusedDivor(i.divor.id)}function L(){l.value=!1}return(k,N)=>t.value.hidden?(y(),T("div",{key:0,class:"pg-divor-overlay pg-divor-overlay--hidden",title:"Afficher "+d.value,onClick:p},[N[2]||(N[2]=_("span",{class:"pg-divor-overlay__hidden-icon"},"â",-1)),_("span",je,P(d.value),1)],8,qe)):t.value.minimized?(y(),$(Ue,{key:1,divor:e.divor,onRestore:p},null,8,["divor"])):t.value.fullscreen?(y(),$(Te,{key:2,to:"body"},[_("div",Je,[_("button",{type:"button",class:"pg-divor-overlay__exit-fs",onClick:r},"à Quitter plein ecran (Esc)"),_("div",Ke,[oe(k.$slots,"default",{},void 0,!0)])])])):t.value.float_position?(y(),$(Xe,{key:3,divor:e.divor,position:t.value.float_position,onUpdatePosition:w,onDock:u},{default:G(()=>[oe(k.$slots,"default",{},void 0,!0)]),_:3},8,["divor","position"])):(y(),T("div",{key:4,class:Z(["pg-divor-overlay pg-divor-overlay--normal",{"pg-divor-overlay--focused":m.value,"pg-divor-overlay--leaf":e.divor.is_leaf,"pg-divor-overlay--branch":!e.divor.is_leaf}]),onMouseenter:x,onMouseleave:L},[oe(k.$slots,"default",{},void 0,!0),ne(Ee,{name:"pg-divor-menu"},{default:G(()=>[q(_("div",{class:"pg-divor-overlay__menu",onMousedown:N[0]||(N[0]=U(()=>{},["stop"])),onClick:N[1]||(N[1]=U(()=>{},["stop"]))},[q(_("button",{type:"button",class:"pg-divor-overlay__btn",title:"Plein ecran (F)",onClick:v},"â¶",512),[[j,!t.value.locked]]),q(_("button",{type:"button",class:"pg-divor-overlay__btn",title:"Masquer (H)",onClick:S},"ð",512),[[j,!t.value.locked]]),e.divor.is_leaf?q((y(),T("button",{key:0,type:"button",class:"pg-divor-overlay__btn",title:"Flotter",onClick:z},"â±",512)),[[j,!t.value.locked]]):H("",!0),q(_("button",{type:"button",class:"pg-divor-overlay__btn",title:"Reduire",onClick:b},"â",512),[[j,!t.value.locked]]),_("button",{type:"button",class:Z(["pg-divor-overlay__btn",{"pg-divor-overlay__btn--active":t.value.locked}]),title:t.value.locked?"Deverouiller":"Verrouiller",onClick:a},P(t.value.locked?"ð":"ð"),11,Qe)],544),[[j,l.value]])]),_:1}),t.value.locked?(y(),T("div",Ge)):H("",!0)],34))}}),et=F(Ze,[["__scopeId","data-v-aacbbfec"]]),tt=V({__name:"DivorNode",props:{divor:{}},setup(e){const i=e,{isMobile:o,isTablet:l}=He(),s=Y(()=>[...i.divor.children].sort((d,n)=>d.position===n.position?d.id-n.id:(d.position||"z")<(n.position||"z")?-1:1)),t=Y(()=>o.value?"horizontal":i.divor.direction);function m(d){if(o.value)return{flex:"0 0 auto",width:"100%",minHeight:"50vh"};if(l.value&&(i.divor.depth??0)>=2)return{flex:"0 0 100%",width:"100%"};const[n,v]=i.divor.phi_ratio;return{flex:`0 0 ${(d.position==="a"?n:v)*100}%`}}return(d,n)=>{const v=ke("DivorNode",!0);return y(),$(et,{divor:e.divor},{default:G(()=>[_("div",{class:Z(["pg-divor-node",[`pg-divor-node--${t.value}`,{"pg-divor-node--swap":(e.divor.ratio_a??.618)<.5&&!M(o),"pg-divor-node--leaf":e.divor.is_leaf,"pg-divor-node--mobile":M(o)}]])},[e.divor.is_leaf?(y(),$(We,{key:0,divor:e.divor},null,8,["divor"])):(y(!0),T(J,{key:1},K(s.value,S=>(y(),T("div",{key:S.id,class:"pg-divor-node__child",style:he(m(S))},[ne(v,{divor:S},null,8,["divor"])],4))),128))],2)]),_:1},8,["divor"])}}}),it=F(tt,[["__scopeId","data-v-6c68d542"]]),ot=["data-snap-page","data-active"],st={key:0,class:"pg-page-snap__divor"},nt={key:1,class:"pg-page-snap__empty"},lt=V({__name:"PageSnap",props:{page:{},isActive:{type:Boolean}},setup(e){const i=e,o=A(null),l=Y(()=>i.page.root_divor_detail??null);return se(()=>i.isActive,s=>{o.value&&Q.to(o.value,{opacity:s?1:.4,scale:s?1:.97,duration:.5,ease:"power2.out"})},{immediate:!0}),(s,t)=>(y(),T("section",{ref_key:"sectionRef",ref:o,class:"pg-page-snap","data-snap-page":e.page.id,"data-active":e.isActive?"true":"false",style:he(e.page.background_color?{background:e.page.background_color}:void 0)},[l.value?(y(),T("div",st,[ne(it,{divor:l.value},null,8,["divor"])])):(y(),T("div",nt," Page sans Divor racine. Crée un Divor depuis l'admin ou le Builder. "))],12,ot))}}),rt=F(lt,[["__scopeId","data-v-5a81bdc5"]]),at={class:"pg-radar__panel"},ct={class:"pg-radar__head"},ht={class:"pg-radar__pages"},ut=["onClick"],dt={key:0,class:"pg-radar__exits"},pt=V({__name:"WorkspaceRadar",props:{visible:{type:Boolean},workspace:{},currentPage:{}},emits:["close","snap-to","navigate"],setup(e,{emit:i}){const o=e,l=i,s=Y(()=>{var d;const n=(d=o.workspace)==null?void 0:d.exits;return!!(n!=null&&n.top||n!=null&&n.bottom||n!=null&&n.left||n!=null&&n.right)});function t(d){l("snap-to",d),l("close")}function m(d){l("navigate",d),l("close")}return(d,n)=>(y(),$(Ee,{name:"pg-radar"},{default:G(()=>{var v,S,b,a,z,p;return[e.visible?(y(),T("div",{key:0,class:"pg-radar",onClick:n[5]||(n[5]=U(r=>d.$emit("close"),["self"]))},[_("div",at,[_("header",ct,[_("strong",null,P(((v=e.workspace)==null?void 0:v.title)||"â"),1),_("button",{class:"pg-radar__close",onClick:n[0]||(n[0]=r=>d.$emit("close"))},"Ã")]),_("div",ht,[(y(!0),T(J,null,K(((S=e.workspace)==null?void 0:S.pages)||[],(r,u)=>(y(),T("button",{key:u,type:"button",class:Z(["pg-radar__page",{"pg-radar__page--active":u===e.currentPage}]),onClick:w=>t(u)}," P"+P(u+1),11,ut))),128))]),s.value?(y(),T("div",dt,[n[6]||(n[6]=_("div",{class:"pg-radar__exitlabel"},"Workspaces voisins",-1)),(b=e.workspace)!=null&&b.exits.top?(y(),T("button",{key:0,class:"pg-radar__exit",onClick:n[1]||(n[1]=r=>m("top"))}," â "+P(e.workspace.exits.top),1)):H("",!0),(a=e.workspace)!=null&&a.exits.left?(y(),T("button",{key:1,class:"pg-radar__exit",onClick:n[2]||(n[2]=r=>m("left"))}," â "+P(e.workspace.exits.left),1)):H("",!0),(z=e.workspace)!=null&&z.exits.right?(y(),T("button",{key:2,class:"pg-radar__exit",onClick:n[3]||(n[3]=r=>m("right"))}," â "+P(e.workspace.exits.right),1)):H("",!0),(p=e.workspace)!=null&&p.exits.bottom?(y(),T("button",{key:3,class:"pg-radar__exit",onClick:n[4]||(n[4]=r=>m("bottom"))}," â "+P(e.workspace.exits.bottom),1)):H("",!0)])):H("",!0),n[7]||(n[7]=_("footer",{class:"pg-radar__hint"},[re(" Touche "),_("kbd",null,"R"),re(" pour fermer · ââ pour naviguer ")],-1))])])):H("",!0)]}),_:1}))}}),vt=F(pt,[["__scopeId","data-v-7b439f9e"]]);var _e="1.3.21";function ze(e,i,o){return Math.max(e,Math.min(i,o))}function mt(e,i,o){return(1-o)*e+o*i}function ft(e,i,o,l){return mt(e,i,1-Math.exp(-o*l))}
1function gt(e,i){return(e%i+i)%i}var wt=class{constructor(){c(this,"isRunning",!1),c(this,"value",0),c(this,"from",0),c(this,"to",0),c(this,"currentTime",0),c(this,"lerp"),c(this,"duration"),c(this,"easing"),c(this,"onUpdate")}advance(e){var i;if(!this.isRunning)return;let o=!1;if(this.duration&&this.easing){this.currentTime+=e;const l=ze(0,this.currentTime/this.duration,1);o=l>=1;const s=o?1:this.easing(l);this.value=this.from+(this.to-this.from)*s}else this.lerp?(this.value=ft(this.value,this.to,this.lerp*60,e),Math.round(this.value)===this.to&&(this.value=this.to,o=!0)):(this.value=this.to,o=!0);o&&this.stop(),(i=this.onUpdate)==null||i.call(this,this.value,o)}stop(){this.isRunning=!1}fromTo(e,i,{lerp:o,duration:l,easing:s,onStart:t,onUpdate:m}){this.from=this.value=e,this.to=i,this.lerp=o,this.duration=l,this.easing=s,this.currentTime=0,this.isRunning=!0,t==null||t(),this.onUpdate=m}};function yt(e,i){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>{o=void 0,e.apply(this,l)},i)}}var _t=class{constructor(e,i,{autoResize:o=!0,debounce:l=250}={}){c(this,"width",0),c(this,"height",0),c(this,"scrollHeight",0),c(this,"scrollWidth",0),c(this,"debouncedResize"),c(this,"wrapperResizeObserver"),c(this,"contentResizeObserver"),c(this,"resize",()=>{this.onWrapperResize(),this.onContentResize()}),c(this,"onWrapperResize",()=>{this.wrapper instanceof Window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)}),c(this,"onContentResize",()=>{this.wrapper instanceof Window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)}),this.wrapper=e,this.content=i,o&&(this.debouncedResize=yt(this.resize,l),this.wrapper instanceof Window?window.addEventListener("resize",this.debouncedResize):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){var e,i;(e=this.wrapperResizeObserver)==null||e.disconnect(),(i=this.contentResizeObserver)==null||i.disconnect(),this.wrapper===window&&this.debouncedResize&&window.removeEventListener("resize",this.debouncedResize)}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},Le=class{constructor(){c(this,"events",{})}emit(e,...i){var o;const l=this.events[e]||[];for(let s=0,t=l.length;s<t;s++)(o=l[s])==null||o.call(l,...i)}on(e,i){return this.events[e]?this.events[e].push(i):this.events[e]=[i],()=>{var o;this.events[e]=(o=this.events[e])==null?void 0:o.filter(l=>i!==l)}}off(e,i){var o;this.events[e]=(o=this.events[e])==null?void 0:o.filter(l=>i!==l)}destroy(){this.events={}}};const St=100/6,X={passive:!1};function Se(e,i){return e===1?St:e===2?i:1}var bt=class{constructor(e,i={wheelMultiplier:1,touchMultiplier:1}){c(this,"touchStart",{x:0,y:0}),c(this,"lastDelta",{x:0,y:0}),c(this,"window",{width:0,height:0}),c(this,"emitter",new Le),c(this,"onTouchStart",o=>{const{clientX:l,clientY:s}=o.targetTouches?o.targetTouches[0]:o;this.touchStart.x=l,this.touchStart.y=s,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:o})}),c(this,"onTouchMove",o=>{const{clientX:l,clientY:s}=o.targetTouches?o.targetTouches[0]:o,t=-(l-this.touchStart.x)*this.options.touchMultiplier,m=-(s-this.touchStart.y)*this.options.touchMultiplier;this.touchStart.x=l,this.touchStart.y=s,this.lastDelta={x:t,y:m},this.emitter.emit("scroll",{deltaX:t,deltaY:m,event:o})}),c(this,"onTouchEnd",o=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:o})}),c(this,"onWheel",o=>{let{deltaX:l,deltaY:s,deltaMode:t}=o;const m=Se(t,this.window.width),d=Se(t,this.window.height);l*=m,s*=d,l*=this.options.wheelMultiplier,s*=this.options.wheelMultiplier,this.emitter.emit("scroll",{deltaX:l,deltaY:s,event:o})}),c(this,"onWindowResize",()=>{this.window={width:window.innerWidth,height:window.innerHeight}}),this.element=e,this.options=i,window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,X),this.element.addEventListener("touchstart",this.onTouchStart,X),this.element.addEventListener("touchmove",this.onTouchMove,X),this.element.addEventListener("touchend",this.onTouchEnd,X)}on(e,i){return this.emitter.on(e,i)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize),this.element.removeEventListener("wheel",this.onWheel,X),this.element.removeEventListener("touchstart",this.onTouchStart,X),this.element.removeEventListener("touchmove",this.onTouchMove,X),this.element.removeEventListener("touchend",this.onTouchEnd,X)}};const be=e=>Math.min(1,1.001-2**(-10*e));var kt=class{constructor({wrapper:e=window,content:i=document.documentElement,eventsTarget:o=e,smoothWheel:l=!0,syncTouch:s=!1,syncTouchLerp:t=.075,touchInertiaExponent:m=1.7,duration:d,easing:n,lerp:v=.1,infinite:S=!1,orientation:b="vertical",gestureOrientation:a=b==="horizontal"?"both":"vertical",touchMultiplier:z=1,wheelMultiplier:p=1,autoResize:r=!0,prevent:u,virtualScroll:w,overscroll:x=!0,autoRaf:L=!1,anchors:k=!1,autoToggle:N=!1,allowNestedScroll:D=!1,__experimental__naiveDimensions:h=!1,naiveDimensions:f=h,stopInertiaOnNavigate:C=!1}={}){c(this,"_isScrolling",!1),c(this,"_isStopped",!1),c(this,"_isLocked",!1),c(this,"_preventNextNativeScrollEvent",!1),c(this,"_resetVelocityTimeout",null),c(this,"_rafId",null),c(this,"isTouching"),c(this,"time",0),c(this,"userData",{}),c(this,"lastVelocity",0),c(this,"velocity",0),c(this,"direction",0),c(this,"options"),c(this,"targetScroll"),c(this,"animatedScroll"),c(this,"animate",new wt),c(this,"emitter",new Le),c(this,"dimensions"),c(this,"virtualScroll"),c(this,"onScrollEnd",g=>{g instanceof CustomEvent||(this.isScrolling==="smooth"||this.isScrolling===!1)&&g.stopPropagation()}),c(this,"dispatchScrollendEvent",()=>{this.options.wrapper.dispatchEvent(new CustomEvent("scrollend",{bubbles:this.options.wrapper===window,detail:{lenisScrollEnd:!0}}))}),c(this,"onTransitionEnd",g=>{var R;(R=g.propertyName)!=null&&R.includes("overflow")&&g.target===this.rootElement&&this.checkOverflow()}),c(this,"onClick",g=>{const R=g.composedPath().filter(E=>E instanceof HTMLAnchorElement&&E.href).map(E=>
1new URL(E.href)),W=new URL(window.location.href);if(this.options.anchors){const E=R.find(I=>W.host===I.host&&W.pathname===I.pathname&&I.hash);if(E){const I=typeof this.options.anchors=="object"&&this.options.anchors?this.options.anchors:void 0,ee=`#${E.hash.split("#")[1]}`;this.scrollTo(ee,I);return}}if(this.options.stopInertiaOnNavigate&&R.some(E=>W.host===E.host&&W.pathname!==E.pathname)){this.reset();return}}),c(this,"onPointerDown",g=>{g.button===1&&this.reset()}),c(this,"onVirtualScroll",g=>{if(typeof this.options.virtualScroll=="function"&&this.options.virtualScroll(g)===!1)return;const{deltaX:R,deltaY:W,event:E}=g;if(this.emitter.emit("virtual-scroll",{deltaX:R,deltaY:W,event:E}),E.ctrlKey||E.lenisStopPropagation)return;const I=E.type.includes("touch"),ee=E.type.includes("wheel");this.isTouching=E.type==="touchstart"||E.type==="touchmove";const ue=R===0&&W===0;if(this.options.syncTouch&&I&&E.type==="touchstart"&&ue&&!this.isStopped&&!this.isLocked){this.reset();return}const Ne=this.options.gestureOrientation==="vertical"&&W===0||this.options.gestureOrientation==="horizontal"&&R===0;if(ue||Ne)return;let te=E.composedPath();te=te.slice(0,te.indexOf(this.rootElement));const le=this.options.prevent,de=Math.abs(R)>=Math.abs(W)?"horizontal":"vertical";if(te.find(O=>{var ve,me,fe,ge,we;return O instanceof HTMLElement&&(typeof le=="function"&&(le==null?void 0:le(O))||((ve=O.hasAttribute)==null?void 0:ve.call(O,"data-lenis-prevent"))||de==="vertical"&&((me=O.hasAttribute)==null?void 0:me.call(O,"data-lenis-prevent-vertical"))||de==="horizontal"&&((fe=O.hasAttribute)==null?void 0:fe.call(O,"data-lenis-prevent-horizontal"))||I&&((ge=O.hasAttribute)==null?void 0:ge.call(O,"data-lenis-prevent-touch"))||ee&&((we=O.hasAttribute)==null?void 0:we.call(O,"data-lenis-prevent-wheel"))||this.options.allowNestedScroll&&this.hasNestedScroll(O,{deltaX:R,deltaY:W}))}))return;if(this.isStopped||this.isLocked){E.cancelable&&E.preventDefault();return}if(!(this.options.syncTouch&&I||this.options.smoothWheel&&ee)){this.isScrolling="native",this.animate.stop(),E.lenisStopPropagation=!0;return}let ie=W;this.options.gestureOrientation==="both"?ie=Math.abs(W)>Math.abs(R)?W:R:this.options.gestureOrientation==="horizontal"&&(ie=R),(!this.options.overscroll||this.options.infinite||this.options.wrapper!==window&&this.limit>0&&(this.animatedScroll>0&&this.animatedScroll<this.limit||this.animatedScroll===0&&W>0||this.animatedScroll===this.limit&&W<0))&&(E.lenisStopPropagation=!0),E.cancelable&&E.preventDefault();const Ce=I&&this.options.syncTouch,pe=I&&E.type==="touchend";pe&&(ie=Math.sign(this.velocity)*Math.abs(this.velocity)**this.options.touchInertiaExponent),this.scrollTo(this.targetScroll+ie,{programmatic:!1,...Ce?{lerp:pe?this.options.syncTouchLerp:1}:{lerp:this.options.lerp,duration:this.options.duration,easing:this.options.easing}})}),c(this,"onNativeScroll",()=>{if(this._resetVelocityTimeout!==null&&(clearTimeout(this._resetVelocityTimeout),this._resetVelocityTimeout=null),this._preventNextNativeScrollEvent){this._preventNextNativeScrollEvent=!1;return}if(this.isScrolling===!1||this.isScrolling==="native"){const g=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity,this.velocity=this.animatedScroll-g,this.direction=Math.sign(this.animatedScroll-g),this.isStopped||(this.isScrolling="native"),this.emit(),this.velocity!==0&&(this._resetVelocityTimeout=setTimeout(()=>{this.lastVelocity=this.velocity,this.velocity=0,this.isScrolling=!1,this.emit()},400))}}),c(this,"raf",g=>{const R=g-(this.time||g);this.time=g,this.animate.advance(R*.001),this.options.autoRaf&&(this._rafId=requestAnimationFrame(this.raf))}),window.lenisVersion=_e,window.lenis||(window.lenis={}),window.lenis.version=_e,b==="horizontal"&&(window.lenis.horizontal=!0),s===!0&&(window.lenis.touch=!0),(!e||e===document.documentElement)&&(e=window),typeof d=="number"&&typeof n!="function"?n=be:typeof n=="function"&&typeof d!="number"&&(d=1),this.options={wrapper:e,content:i,eventsTarget:o,smoothWheel:l,syncTouch:s,syncTouchLerp:t,touchInertiaExponent:m,duration:d,easing:n,lerp:v,infinite:S,gestureOrientation:a,orientation:b,touchMultiplier:z,
1wheelMultiplier:p,autoResize:r,prevent:u,virtualScroll:w,overscroll:x,autoRaf:L,anchors:k,autoToggle:N,allowNestedScroll:D,naiveDimensions:f,stopInertiaOnNavigate:C},this.dimensions=new _t(e,i,{autoResize:r}),this.updateClassName(),this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll),this.options.wrapper.addEventListener("scrollend",this.onScrollEnd,{capture:!0}),(this.options.anchors||this.options.stopInertiaOnNavigate)&&this.options.wrapper.addEventListener("click",this.onClick),this.options.wrapper.addEventListener("pointerdown",this.onPointerDown),this.virtualScroll=new bt(o,{touchMultiplier:z,wheelMultiplier:p}),this.virtualScroll.on("scroll",this.onVirtualScroll),this.options.autoToggle&&(this.checkOverflow(),this.rootElement.addEventListener("transitionend",this.onTransitionEnd)),this.options.autoRaf&&(this._rafId=requestAnimationFrame(this.raf))}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll),this.options.wrapper.removeEventListener("scrollend",this.onScrollEnd,{capture:!0}),this.options.wrapper.removeEventListener("pointerdown",this.onPointerDown),(this.options.anchors||this.options.stopInertiaOnNavigate)&&this.options.wrapper.removeEventListener("click",this.onClick),this.virtualScroll.destroy(),this.dimensions.destroy(),this.cleanUpClassName(),this._rafId&&cancelAnimationFrame(this._rafId)}on(e,i){return this.emitter.on(e,i)}off(e,i){return this.emitter.off(e,i)}get overflow(){const e=this.isHorizontal?"overflow-x":"overflow-y";return getComputedStyle(this.rootElement)[e]}checkOverflow(){["hidden","clip"].includes(this.overflow)?this.internalStop():this.internalStart()}setScroll(e){this.isHorizontal?this.options.wrapper.scrollTo({left:e,behavior:"instant"}):this.options.wrapper.scrollTo({top:e,behavior:"instant"})}resize(){this.dimensions.resize(),this.animatedScroll=this.targetScroll=this.actualScroll,this.emit()}emit(){this.emitter.emit("scroll",this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity=0,this.animate.stop()}start(){if(this.isStopped){if(this.options.autoToggle){this.rootElement.style.removeProperty("overflow");return}this.internalStart()}}internalStart(){this.isStopped&&(this.reset(),this.isStopped=!1,this.emit())}stop(){if(!this.isStopped){if(this.options.autoToggle){this.rootElement.style.setProperty("overflow","clip");return}this.internalStop()}}internalStop(){this.isStopped||(this.reset(),this.isStopped=!0,this.emit())}scrollTo(e,{offset:i=0,immediate:o=!1,lock:l=!1,programmatic:s=!0,lerp:t=s?this.options.lerp:void 0,duration:m=s?this.options.duration:void 0,easing:d=s?this.options.easing:void 0,onStart:n,onComplete:v,force:S=!1,userData:b}={}){if((this.isStopped||this.isLocked)&&!S)return;let a=e,z=i;if(typeof a=="string"&&["top","left","start","#"].includes(a))a=0;else if(typeof a=="string"&&["bottom","right","end"].includes(a))a=this.limit;else{let p=null;if(typeof a=="string"?(p=document.querySelector(a),p||(a==="#top"?a=0:console.warn("Lenis: Target not found",a))):a instanceof HTMLElement&&a!=null&&a.nodeType&&(p=a),p){if(this.options.wrapper!==window){const k=this.rootElement.getBoundingClientRect();z-=this.isHorizontal?k.left:k.top}const r=p.getBoundingClientRect(),u=getComputedStyle(p),w=this.isHorizontal?Number.parseFloat(u.scrollMarginLeft):Number.parseFloat(u.scrollMarginTop),x=getComputedStyle(this.rootElement),L=this.isHorizontal?Number.parseFloat(x.scrollPaddingLeft):Number.parseFloat(x.scrollPaddingTop);a=(this.isHorizontal?r.left:r.top)+this.animatedScroll-(Number.isNaN(w)?0:w)-(Number.isNaN(L)?0:L)}}if(typeof a=="number"){if(a+=z,a=Math.round(a),this.options.infinite){if(s){this.targetScroll=this.animatedScroll=this.scroll;const p=a-this.animatedScroll;p>this.limit/2?a-=this.limit:p<-this.limit/2&&(a+=this.limit)}}else a=ze(0,a,this.limit);if(a===this.targetScroll){n==null||n(this),v==null||v(this);return}if(this.userData=b??{},o){this.animatedScroll=this.targetScroll=a,this.setScroll(this.scroll),this.reset(),this.preventNextNativeScrollEvent(),this.emit
1(),v==null||v(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()});return}s||(this.targetScroll=a),typeof m=="number"&&typeof d!="function"?d=be:typeof d=="function"&&typeof m!="number"&&(m=1),this.animate.fromTo(this.animatedScroll,a,{duration:m,easing:d,lerp:t,onStart:()=>{l&&(this.isLocked=!0),this.isScrolling="smooth",n==null||n(this)},onUpdate:(p,r)=>{this.isScrolling="smooth",this.lastVelocity=this.velocity,this.velocity=p-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=p,this.setScroll(this.scroll),s&&(this.targetScroll=p),r||this.emit(),r&&(this.reset(),this.emit(),v==null||v(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()}),this.preventNextNativeScrollEvent())}})}}preventNextNativeScrollEvent(){this._preventNextNativeScrollEvent=!0,requestAnimationFrame(()=>{this._preventNextNativeScrollEvent=!1})}hasNestedScroll(e,{deltaX:i,deltaY:o}){const l=Date.now();e._lenis||(e._lenis={});const s=e._lenis;let t,m,d,n,v,S,b,a,z,p;if(l-(s.time??0)>2e3){s.time=Date.now();const D=window.getComputedStyle(e);if(s.computedStyle=D,t=["auto","overlay","scroll"].includes(D.overflowX),m=["auto","overlay","scroll"].includes(D.overflowY),v=["auto"].includes(D.overscrollBehaviorX),S=["auto"].includes(D.overscrollBehaviorY),s.hasOverflowX=t,s.hasOverflowY=m,!(t||m))return!1;b=e.scrollWidth,a=e.scrollHeight,z=e.clientWidth,p=e.clientHeight,d=b>z,n=a>p,s.isScrollableX=d,s.isScrollableY=n,s.scrollWidth=b,s.scrollHeight=a,s.clientWidth=z,s.clientHeight=p,s.hasOverscrollBehaviorX=v,s.hasOverscrollBehaviorY=S}else d=s.isScrollableX,n=s.isScrollableY,t=s.hasOverflowX,m=s.hasOverflowY,b=s.scrollWidth,a=s.scrollHeight,z=s.clientWidth,p=s.clientHeight,v=s.hasOverscrollBehaviorX,S=s.hasOverscrollBehaviorY;if(!(t&&d||m&&n))return!1;const r=Math.abs(i)>=Math.abs(o)?"horizontal":"vertical";let u,w,x,L,k,N;if(r==="horizontal")u=Math.round(e.scrollLeft),w=b-z,x=i,L=t,k=d,N=v;else if(r==="vertical")u=Math.round(e.scrollTop),w=a-p,x=o,L=m,k=n,N=S;else return!1;return!N&&(u>=w||u<=0)?!0:(x>0?u<w:u>0)&&L&&k}get rootElement(){return this.options.wrapper===window?document.documentElement:this.options.wrapper}get limit(){return this.options.naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]}get isHorizontal(){return this.options.orientation==="horizontal"}get actualScroll(){const e=this.options.wrapper;return this.isHorizontal?e.scrollX??e.scrollLeft:e.scrollY??e.scrollTop}get scroll(){return this.options.infinite?gt(this.animatedScroll,this.limit):this.animatedScroll}get progress(){return this.limit===0?1:this.scroll/this.limit}get isScrolling(){return this._isScrolling}set isScrolling(e){this._isScrolling!==e&&(this._isScrolling=e,this.updateClassName())}get isStopped(){return this._isStopped}set isStopped(e){this._isStopped!==e&&(this._isStopped=e,this.updateClassName())}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this.updateClassName())}get isSmooth(){return this.isScrolling==="smooth"}get className(){let e="lenis";return this.options.autoToggle&&(e+=" lenis-autoToggle"),this.isStopped&&(e+=" lenis-stopped"),this.isLocked&&(e+=" lenis-locked"),this.isScrolling&&(e+=" lenis-scrolling"),this.isScrolling==="smooth"&&(e+=" lenis-smooth"),e}updateClassName(){this.cleanUpClassName(),this.rootElement.className=`${this.rootElement.className} ${this.className}`.trim()}cleanUpClassName(){this.rootElement.className=this.rootElement.className.replace(/lenis(-\w+)?/g,"").trim()}};const Et=768;function Tt(e,i={}){const{pageSelector:o="[data-snap-page]",onPageChange:l,onExitRequest:s}=i,t=A(0),m=A(!1),d=A(!1);let n=null,v=[],S=null,b=0;function a(){const h=e.value;h&&(v=Array.from(h.querySelectorAll(o)))}function z(h=!0){if(a(),d.value){v.forEach(f=>{f.style.scrollSnapAlign="start",f.style.scrollSnapStop="normal"});return}h&&v.length>0&&p(0,!0)}function p(h,f=!1){n&&(!v[h]&&(a(),!v[h])||h===t.value&&!f||(m.value=!0,t.value=h,l==null||l(h),n.scrollTo(v[h],{duration:f?0:1.1,easing:C=>1-Math.pow(1-C,4),onComplete:()=>{m.value=!1,b=performance.now()+250}})))}function r(){if(v.length===0&&a(),t.value>=v.length-1){s==null||s("bottom");return}p(t.value+1)}function u(){if(v.length===0&&a(),t.value<=0){s==null||s("top");return}p(t.value-1)}function w(h){var f;const C=document.body;let g=h.target;for(;g&&g!==C;){if((f=g.hasAttribute)!=null&&f.call(g,"data-lenis-prevent")&&(h.deltaY>0?g.scrollTop+g.clientHeight<g.scrollHeight-1:g.scrollTop>0))return!0;g=g.parentElement}return!1}function x(h){if(!d.value&&!w(h)){if(m.value){h.preventDefault();return}if(performance.now()<b){h.preventDefault();return}
1h.preventDefault(),!(Math.abs(h.deltaY)<5)&&(h.deltaY>0?r():u())}}function L(h){var f,C;const g=(f=h.target)==null?void 0:f.tagName;["INPUT","TEXTAREA","SELECT"].includes(g)||(C=h.target)!=null&&C.isContentEditable||(h.key==="ArrowDown"||h.key==="PageDown"?(h.preventDefault(),r()):(h.key==="ArrowUp"||h.key==="PageUp")&&(h.preventDefault(),u()))}let k=0;function N(h){var f;d.value||(k=((f=h.touches[0])==null?void 0:f.clientY)??0)}function D(h){var f;if(d.value)return;const C=((f=h.changedTouches[0])==null?void 0:f.clientY)??0,g=k-C;Math.abs(g)<40||(g>0?r():u())}return ae(()=>{const h=e.value;if(h){if(d.value=window.innerWidth<Et,a(),d.value){h.style.scrollSnapType="y proximity",v.forEach(f=>{f.style.scrollSnapAlign="start",f.style.scrollSnapStop="normal"}),window.addEventListener("keydown",L);return}n=new kt({wrapper:h,content:h.firstElementChild,duration:1.1,smoothWheel:!1,wheelMultiplier:0,touchMultiplier:0}),S=f=>n==null?void 0:n.raf(f*1e3),Q.ticker.add(S),Q.ticker.lagSmoothing(0),h.addEventListener("wheel",x,{passive:!1}),h.addEventListener("touchstart",N,{passive:!0}),h.addEventListener("touchend",D,{passive:!0}),window.addEventListener("keydown",L),p(0,!0)}}),ce(()=>{const h=e.value;h&&(h.removeEventListener("wheel",x),h.removeEventListener("touchstart",N),h.removeEventListener("touchend",D)),window.removeEventListener("keydown",L),S&&(Q.ticker.remove(S),S=null),n==null||n.destroy(),n=null}),{currentPage:t,isSnapping:m,isMobile:d,snapToPage:p,nextPage:r,previousPage:u,refresh:z}}const xt={class:"pg-workspace-container"},zt={class:"pg-workspace-container__header"},Lt={class:"pg-workspace-container__title"},Nt={class:"pg-workspace-container__exits"},Ct=["disabled","onClick","title"],Mt={key:1,class:"pg-workspace-container__error"},Rt={class:"pg-workspace-container__inner"},Dt={key:0,class:"pg-workspace-container__empty"},Wt={key:2,class:"pg-workspace-container__pager"},Pt=["onClick","title"],Ot=V({__name:"WorkspaceContainer",props:{slug:{}},setup(e){const i=Re(),o=Y(()=>{var r;const u=((r=i.user)==null?void 0:r.groups)??i.groups??[],w=L=>L.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),""),x=u.map(w);return!!i.isAuthenticated&&(i.isAdmin||x.includes("administrateur")||x.includes("redacteur"))}),l=e,s=Me(),t=xe(),m=A(null),d={top:"â",bottom:"â",left:"â",right:"â"},{currentPage:n,snapToPage:v,refresh:S}=Tt(m,{onPageChange:r=>t.setPageIndex(r),onExitRequest:r=>t.navigateToExit(r)}),b=A(!1);function a(r){const u=t.focusedDivorId;u!=null&&t.persistDivorState(u,r)}De([{key:"ArrowLeft",handler:()=>t.navigateToExit("left")},{key:"ArrowRight",handler:()=>t.navigateToExit("right")},{key:"r",handler:()=>b.value=!b.value},{key:"h",handler:()=>{const r=t.focusedDivorId;if(r==null)return;const u=t.divorStates[r];a({hidden:!(u!=null&&u.hidden)})}},{key:"f",handler:()=>{const r=t.focusedDivorId;if(r==null)return;const u=t.divorStates[r];a({fullscreen:!(u!=null&&u.fullscreen),minimized:!1})}},{key:"Escape",handler:()=>{const r=t.focusedDivorId;if(r==null)return;const u=t.divorStates[r];u&&(u.fullscreen?a({fullscreen:!1}):u.float_position&&a({float_position:null}))}}]);async function z(){await ye(),S();const r=document.querySelectorAll("[data-snap-page]");r.length!==0&&Q.from(r,{y:40,opacity:0,duration:.7,stagger:.08,ease:"power3.out",delay:.1,clearProps:"transform"})}function p(){const r=s.query.page;if(r==null)return;const u=Number(Array.isArray(r)?r[0]:r);!Number.isFinite(u)||u<0||(t.setPageIndex(u),ye(()=>v(u,!0)))}return se(()=>s.query.page,()=>p()),ae(async()=>{await t.fetchSettings(),await t.fetchWorkspace(l.slug),p(),z()}),se(()=>l.slug,async r=>{await t.fetchWorkspace(r),z()}),(r,u)=>{var w,x,L,k,N,D;const h=ke("router-link");return y(),T("div",xt,[o.value?(y(),$(h,{key:0,to:"/builder-structure",class:"pg-workspace-container__back pg-workspace-container__back--floating",title:"Retour à l'éditeur de structure"},{default:G(()=>[...u[2]||(u[2]=[re(" â Builder ",-1)])]),_:1})):H("",!0),_("header",zt,[_("h1",Lt,P(((w=M(t).current)==null?void 0:w.title)||"â¦"),1),_("nav",Nt,[(y(),T(J,null,K(["top","left","right","bottom"],f=>{var C,g,R;return _("button",{key:f,type:"button",class:"pg-exit",disabled:!((C=M(t).current)!=null&&C.exits[f]),onClick:W=>M(t).navigateToExit(f),title:((g=M(t).current)==null?void 0:g.exits[f])||`Pas de sortie ${f}`},P(d[f])+" "+P(((R=M(t).current)==null?void 0:R.exits[f])||"â"),9,Ct)}),64))])]),M(t).error?(y(),T("div",Mt,P(M(t).error),1)):H("",!0),_("div",{ref_key:"scrollerRef",ref:m,class:"pg-workspace-container__scroller"},[_("div",Rt,[(y(!0),T(J,null,K(((x=M(t).current)==null?void 0:x.pages)||[],(f,C)=>(y(),$(rt,{key:f.id,page:f,"is-active":M(n)===C,"data-snap-page":""},null,8,["page","is-active"]))),128)),(k=(L=M(t).current)==null?void 0:L.pages)!=null&&k.length?H("",!0):(y(),T("div",Dt," Ce workspace n'a pas de page. Crée-en une depuis l'admin. "))])],512),ne(vt,{visible:b.value,workspace:M(t).current,"current-page":M(n),onClose:u[0]||(u[0]=f=>b.value=!1),onSnapTo:M(v),onNavigate:u[1]||(u[1]=f=>M(t).navigateToExit(f))},null,8,["visible","workspace","current-page","onSnapTo"]),(((D=(N=M(t).current)==null?void 0:N.pages)==null?void 0:D.length)||0)>1?(y(),T("div",Wt,[(y(!0),T(J,null,K(M(t).current.pages,(f,C)=>(y(),T("button",{key:C,type:"button",class:Z(["pg-workspace-container__dot",{"pg-workspace-container__dot--active":C===M(n)}]),onClick:g=>M(v)(C),title:`Page ${C+1}`},null,10,Pt))),128))])):H("",!0)])}}}),Ht=F(Ot,[["__scopeId","data-v-d90ae5b0"]]),Qt=V({__name:"WorkspaceView",props:{slug:{}},setup(e){return(i,o)=>(y(),$(Ht,{slug:e.slug},null,8,["slug"]))}});
1export{Qt 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.