@gouvfr-lasuite/ui-kit 0.19.2 → 0.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -95,5 +95,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
95
95
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nb(t,e){if(t){if(typeof t=="string")return e2(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e2(t,e)}}function e2(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ib(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,l;try{for(r=r.call(t);!(i=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));i=!0);}catch(s){o=!0,l=s}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw l}}return n}}function ob(t){if(Array.isArray(t))return t}function ab(t,e,r){var n=Kt(),i=eb(t,e),o=q6(t);Mt(function(){var l=d6(o,i,n),s=tb(l,2),c=s[0],d=s[1];return e.receiveHandlerId(c),r.receiveHandlerId(c),d},[n,e,i,r,o.map(function(a){return a.toString()}).join("|")])}function lb(){var t=Kt();return u.useMemo(function(){return new Qv(t)},[t])}function sb(t){var e=Kt(),r=u.useMemo(function(){return new u6(e.getBackend())},[e]);return Mt(function(){return r.dropTargetOptions=t||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[t]),r}function cb(t){return u.useMemo(function(){return t.hooks.dropTarget()},[t])}function Y1(t,e){var r=Z1(t,e),n=lb(),i=sb(r.options);return ab(r,n,i),[q1(r.collect,n,i),cb(i)]}function ub(t,e){return pb(t)||hb(t,e)||fb(t,e)||db()}function db(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
96
96
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fb(t,e){if(t){if(typeof t=="string")return t2(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t2(t,e)}}function t2(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function hb(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,l;try{for(r=r.call(t);!(i=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));i=!0);}catch(s){o=!0,l=s}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw l}}return n}}function pb(t){if(Array.isArray(t))return t}function gb(t){var e=Kt(),r=e.getMonitor(),n=G1(r,t),i=ub(n,2),o=i[0],a=i[1];return u.useEffect(function(){return r.subscribeToOffsetChange(a)}),u.useEffect(function(){return r.subscribeToStateChange(a)}),o}function X1(t){var e=null,r=function(){return e==null&&(e=t()),e};return r}function vb(t,e){return t.filter(function(r){return r!==e})}function bb(t,e){var r=new Set,n=function(a){return r.add(a)};t.forEach(n),e.forEach(n);var i=[];return r.forEach(function(o){return i.push(o)}),i}function mb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Cb(t,e,r){return e&&yb(t.prototype,e),t}function r2(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Eb=function(){function t(e){mb(this,t),r2(this,"entered",[]),r2(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return Cb(t,[{key:"enter",value:function(r){var n=this,i=this.entered.length,o=function(l){return n.isNodeInDocument(l)&&(!l.contains||l.contains(r))};return this.entered=bb(this.entered.filter(o),[r]),i===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=vb(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),t}(),wb=X1(function(){return/firefox/i.test(navigator.userAgent)}),J1=X1(function(){return!!window.safari});function xb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Db(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Sb(t,e,r){return e&&Db(t.prototype,e),t}function Rr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var n2=function(){function t(e,r){xb(this,t),Rr(this,"xs",void 0),Rr(this,"ys",void 0),Rr(this,"c1s",void 0),Rr(this,"c2s",void 0),Rr(this,"c3s",void 0);for(var n=e.length,i=[],o=0;o<n;o++)i.push(o);i.sort(function(O,K){return e[O]<e[K]?-1:1});for(var a=[],l=[],s,c,d=0;d<n-1;d++)s=e[d+1]-e[d],c=r[d+1]-r[d],a.push(s),l.push(c/s);for(var f=[l[0]],p=0;p<a.length-1;p++){var g=l[p],y=l[p+1];if(g*y<=0)f.push(0);else{s=a[p];var h=a[p+1],v=s+h;f.push(3*v/((v+h)/g+(v+s)/y))}}f.push(l[l.length-1]);for(var m=[],C=[],E,F=0;F<f.length-1;F++){E=l[F];var D=f[F],w=1/a[F],S=D+f[F+1]-E-E;m.push((E-D-S)*w),C.push(S*w*w)}this.xs=e,this.ys=r,this.c1s=f,this.c2s=m,this.c3s=C}return Sb(t,[{key:"interpolate",value:function(r){var n=this.xs,i=this.ys,o=this.c1s,a=this.c2s,l=this.c3s,s=n.length-1;if(r===n[s])return i[s];for(var c=0,d=l.length-1,f;c<=d;){f=Math.floor(.5*(c+d));var p=n[f];if(p<r)c=f+1;else if(p>r)d=f-1;else return i[f]}s=Math.max(0,d);var g=r-n[s],y=g*g;return i[s]+o[s]*g+a[s]*y+l[s]*g*y}}]),t}(),Fb=1;function Q1(t){var e=t.nodeType===Fb?t:t.parentElement;if(!e)return null;var r=e.getBoundingClientRect(),n=r.top,i=r.left;return{x:i,y:n}}function Pn(t){return{x:t.clientX,y:t.clientY}}function $b(t){var e;return t.nodeName==="IMG"&&(wb()||!((e=document.documentElement)!==null&&e!==void 0&&e.contains(t)))}function _b(t,e,r,n){var i=t?e.width:r,o=t?e.height:n;return J1()&&t&&(o/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:o}}function Pb(t,e,r,n,i){var o=$b(e),a=o?t:e,l=Q1(a),s={x:r.x-l.x,y:r.y-l.y},c=t.offsetWidth,d=t.offsetHeight,f=n.anchorX,p=n.anchorY,g=_b(o,e,c,d),y=g.dragPreviewWidth,h=g.dragPreviewHeight,v=function(){var S=new n2([0,.5,1],[s.y,s.y/d*h,s.y+h-d]),O=S.interpolate(p);return J1()&&o&&(O+=(window.devicePixelRatio-1)*h),O},m=function(){var S=new n2([0,.5,1],[s.x,s.x/c*y,s.x+y-c]);return S.interpolate(f)},C=i.offsetX,E=i.offsetY,F=C===0||C,D=E===0||E;return{x:F?C:m(),y:D?E:v()}}var ef="__NATIVE_FILE__",tf="__NATIVE_URL__",rf="__NATIVE_TEXT__",nf="__NATIVE_HTML__";const i2=Object.freeze(Object.defineProperty({__proto__:null,FILE:ef,HTML:nf,TEXT:rf,URL:tf},Symbol.toStringTag,{value:"Module"}));function No(t,e,r){var n=e.reduce(function(i,o){return i||t.getData(o)},"");return n??r}var er;function An(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var $a=(er={},An(er,ef,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),An(er,nf,{exposeProperties:{html:function(e,r){return No(e,r,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),An(er,tf,{exposeProperties:{urls:function(e,r){return No(e,r,"").split(`
97
97
  `)},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),An(er,rf,{exposeProperties:{text:function(e,r){return No(e,r,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),er);function Ab(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function kb(t,e,r){return e&&Tb(t.prototype,e),t}function o2(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Ib=function(){function t(e){Ab(this,t),o2(this,"item",void 0),o2(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return kb(t,[{key:"initializeExposedProperties",value:function(){var r=this;Object.keys(this.config.exposeProperties).forEach(function(n){Object.defineProperty(r.item,n,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(n,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(r){var n=this;if(r){var i={};Object.keys(this.config.exposeProperties).forEach(function(o){i[o]={value:n.config.exposeProperties[o](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,i)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(r,n){return n===r.getSourceId()}},{key:"endDrag",value:function(){}}]),t}();function Ob(t,e){var r=new Ib($a[t]);return r.loadDataTransfer(e),r}function Ro(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys($a).filter(function(r){var n=$a[r].matchesTypes;return n.some(function(i){return e.indexOf(i)>-1})})[0]||null}function Mb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Nb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Rb(t,e,r){return e&&Nb(t.prototype,e),t}function Bo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Bb=function(){function t(e,r){Mb(this,t),Bo(this,"ownerDocument",null),Bo(this,"globalContext",void 0),Bo(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=r}return Rb(t,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),t}();function a2(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function l2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?a2(Object(r),!0).forEach(function(n){ee(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Lb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Kb(t,e,r){return e&&jb(t.prototype,e),t}function ee(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Vb=function(){function t(e,r,n){var i=this;Lb(this,t),ee(this,"options",void 0),ee(this,"actions",void 0),ee(this,"monitor",void 0),ee(this,"registry",void 0),ee(this,"enterLeaveCounter",void 0),ee(this,"sourcePreviewNodes",new Map),ee(this,"sourcePreviewNodeOptions",new Map),ee(this,"sourceNodes",new Map),ee(this,"sourceNodeOptions",new Map),ee(this,"dragStartSourceIds",null),ee(this,"dropTargetIds",[]),ee(this,"dragEnterTargetIds",[]),ee(this,"currentNativeSource",null),ee(this,"currentNativeHandle",null),ee(this,"currentDragSourceNode",null),ee(this,"altKeyPressed",!1),ee(this,"mouseMoveTimeoutTimer",null),ee(this,"asyncEndDragFrameId",null),ee(this,"dragOverTargetIds",null),ee(this,"lastClientOffset",null),ee(this,"hoverRafId",null),ee(this,"getSourceClientOffset",function(o){var a=i.sourceNodes.get(o);return a&&Q1(a)||null}),ee(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),ee(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),ee(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),ee(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),ee(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var a=i.dragStartSourceIds;i.dragStartSourceIds=null;var l=Pn(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:l});var s=o.dataTransfer,c=Ro(s);if(i.monitor.isDragging()){if(s&&typeof s.setDragImage=="function"){var d=i.monitor.getSourceId(),f=i.sourceNodes.get(d),p=i.sourcePreviewNodes.get(d)||f;if(p){var g=i.getCurrentSourcePreviewNodeOptions(),y=g.anchorX,h=g.anchorY,v=g.offsetX,m=g.offsetY,C={anchorX:y,anchorY:h},E={offsetX:v,offsetY:m},F=Pb(f,p,l,C,E);s.setDragImage(p,F.x,F.y)}}try{s==null||s.setData("application/json",{})}catch{}i.setCurrentDragSourceNode(o.target);var D=i.getCurrentSourcePreviewNodeOptions(),w=D.captureDraggingState;w?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(c)i.beginDragNativeItem(c);else{if(s&&!s.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}}}),ee(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),ee(this,"handleTopDragEnterCapture",function(o){i.dragEnterTargetIds=[];var a=i.enterLeaveCounter.enter(o.target);if(!(!a||i.monitor.isDragging())){var l=o.dataTransfer,s=Ro(l);s&&i.beginDragNativeItem(s,l)}}),ee(this,"handleTopDragEnter",function(o){var a=i.dragEnterTargetIds;if(i.dragEnterTargetIds=[],!!i.monitor.isDragging()){i.altKeyPressed=o.altKey,a.length>0&&i.actions.hover(a,{clientOffset:Pn(o)});var l=a.some(function(s){return i.monitor.canDropOnTarget(s)});l&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect()))}}),ee(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),ee(this,"handleTopDragOver",function(o){var a=i.dragOverTargetIds;if(i.dragOverTargetIds=[],!i.monitor.isDragging()){o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none");return}i.altKeyPressed=o.altKey,i.lastClientOffset=Pn(o),i.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(i.hoverRafId=requestAnimationFrame(function(){i.monitor.isDragging()&&i.actions.hover(a||[],{clientOffset:i.lastClientOffset}),i.hoverRafId=null}));var l=(a||[]).some(function(s){return i.monitor.canDropOnTarget(s)});l?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))}),ee(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault();var a=i.enterLeaveCounter.leave(o.target);a&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),ee(this,"handleTopDropCapture",function(o){if(i.dropTargetIds=[],i.isDraggingNativeItem()){var a;o.preventDefault(),(a=i.currentNativeSource)===null||a===void 0||a.loadDataTransfer(o.dataTransfer)}else Ro(o.dataTransfer)&&o.preventDefault();i.enterLeaveCounter.reset()}),ee(this,"handleTopDrop",function(o){var a=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(a,{clientOffset:Pn(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),ee(this,"handleSelectStart",function(o){var a=o.target;typeof a.dragDrop=="function"&&(a.tagName==="INPUT"||a.tagName==="SELECT"||a.tagName==="TEXTAREA"||a.isContentEditable||(o.preventDefault(),a.dragDrop()))}),this.options=new Bb(r,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Eb(this.isNodeInDocument)}return Kb(t,[{key:"profile",value:function(){var r,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((r=this.dragStartSourceIds)===null||r===void 0?void 0:r.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var r=this.rootElement;if(r!==void 0){if(r.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");r.__isReactDndBackendSetUp=!0,this.addEventListeners(r)}}},{key:"teardown",value:function(){var r=this.rootElement;if(r!==void 0&&(r.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(r,n,i){var o=this;return this.sourcePreviewNodeOptions.set(r,i),this.sourcePreviewNodes.set(r,n),function(){o.sourcePreviewNodes.delete(r),o.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,i){var o=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,i);var a=function(c){return o.handleDragStart(c,r)},l=function(c){return o.handleSelectStart(c)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",a),n.addEventListener("selectstart",l),function(){o.sourceNodes.delete(r),o.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",a),n.removeEventListener("selectstart",l),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var i=this,o=function(c){return i.handleDragEnter(c,r)},a=function(c){return i.handleDragOver(c,r)},l=function(c){return i.handleDrop(c,r)};return n.addEventListener("dragenter",o),n.addEventListener("dragover",a),n.addEventListener("drop",l),function(){n.removeEventListener("dragenter",o),n.removeEventListener("dragover",a),n.removeEventListener("drop",l)}}},{key:"addEventListeners",value:function(r){r.addEventListener&&(r.addEventListener("dragstart",this.handleTopDragStart),r.addEventListener("dragstart",this.handleTopDragStartCapture,!0),r.addEventListener("dragend",this.handleTopDragEndCapture,!0),r.addEventListener("dragenter",this.handleTopDragEnter),r.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.addEventListener("dragover",this.handleTopDragOver),r.addEventListener("dragover",this.handleTopDragOverCapture,!0),r.addEventListener("drop",this.handleTopDrop),r.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(r){r.removeEventListener&&(r.removeEventListener("dragstart",this.handleTopDragStart),r.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),r.removeEventListener("dragend",this.handleTopDragEndCapture,!0),r.removeEventListener("dragenter",this.handleTopDragEnter),r.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.removeEventListener("dragover",this.handleTopDragOver),r.removeEventListener("dragover",this.handleTopDragOverCapture,!0),r.removeEventListener("drop",this.handleTopDrop),r.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(r);return l2({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(r);return l2({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(i2).some(function(n){return i2[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=Ob(r,n),this.currentNativeHandle=this.registry.addSource(r,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(r){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=r;var i=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var o;return(o=n.rootElement)===null||o===void 0?void 0:o.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},i)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var r;(r=this.window)===null||r===void 0||r.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(r,n){r.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(r,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(r,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(r,n){this.dropTargetIds.unshift(n)}}]),t}(),Tn;function Hb(){return Tn||(Tn=new Image,Tn.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Tn}var zb=function(e,r,n){return new Vb(e,r,n)};function Ub(t){const e=ke(),r=e.selectedIds,[n,i,o]=G6(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const a=e.isSelected(t.id)?Array.from(r):[t.id];return e.dispatch(Er.dragStart(t.id,a)),{id:t.id,dragIds:a}},end:()=>{e.hideCursor(),e.dispatch(Er.dragEnd())}}),[r,t]);return u.useEffect(()=>{o(Hb())},[o]),i}function Wb(t,e){const r=t.getBoundingClientRect(),n=e.x-Math.round(r.x),i=e.y-Math.round(r.y),o=r.height,a=i<o/2,l=!a,s=o/4,c=i>s&&i<o-s;return{x:n,inTopHalf:a,inBottomHalf:l,inMiddle:c,atTop:!c&&a,atBottom:!c&&l}}function Zb(t,e,r,n){return t?t.isInternal?n.atTop?[e,t]:n.inMiddle?[t,t]:[t,r]:n.inTopHalf?[e,t]:[t,r]:[e,null]}function kn(t,e){return{parentId:t||null,index:e}}function tr(t,e){return{type:"line",index:t,level:e}}function Gb(t){return{type:"highlight",id:t}}function Lo(t,e){var r;let n=t;for(;n.parent&&n.level>e;)n=n.parent;const i=((r=n.parent)===null||r===void 0?void 0:r.id)||null,o=_1(n)+1;return{parentId:i,index:o}}function of(t){var e;const r=Wb(t.element,t.offset),n=t.indent,i=Math.round(Math.max(0,r.x-n)/n),{node:o,nextNode:a,prevNode:l}=t,[s,c]=Zb(o,l,a,r);if(o&&o.isInternal&&r.inMiddle)return{drop:kn(o.id,null),cursor:Gb(o.id)};if(!s)return{drop:kn((e=c==null?void 0:c.parent)===null||e===void 0?void 0:e.id,0),cursor:tr(0,0)};if(D1(s)){const d=Ln(i,(c==null?void 0:c.level)||0,s.level);return{drop:Lo(s,d),cursor:tr(s.rowIndex+1,d)}}if(S1(s)){const d=Ln(i,(c==null?void 0:c.level)||0,s.level);return{drop:Lo(s,d),cursor:tr(s.rowIndex+1,d)}}if(F1(s)){const d=Ln(i,0,s.level+1);return d>s.level?{drop:kn(s.id,0),cursor:tr(s.rowIndex+1,d)}:{drop:Lo(s,d),cursor:tr(s.rowIndex+1,d)}}return{drop:kn(s==null?void 0:s.id,0),cursor:tr(s.rowIndex+1,s.level+1)}}function qb(t,e){const r=ke(),[n,i]=Y1(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(o,a)=>{const l=a.getClientOffset();if(!t.current||!l)return;const{cursor:s,drop:c}=of({element:t.current,offset:l,indent:r.indent,node:e,prevNode:e.prev,nextNode:e.next});c&&r.dispatch(Er.hovering(c.parentId,c.index)),a.canDrop()?s&&r.showCursor(s):r.hideCursor()},drop:(o,a)=>{if(!a.canDrop())return null;let{parentId:l,index:s,dragIds:c}=r.state.dnd;I1(r.props.onMove,{dragIds:c,parentId:l===ln?null:l,index:s===null?0:s,dragNodes:r.dragNodes,parentNode:r.get(l)}),r.open(l)}}),[e,t.current,r.props]);return i}function Yb(t){const e=ke(),r=e.at(t);if(!r)throw new Error(`Could not find node for index: ${t}`);return u.useMemo(()=>{const n=r.clone();return e.visibleNodes[t]=n,n},[...Object.values(r.state),r])}const Xb=u.memo(function({index:e,style:r}){x1(),bg();const n=ke(),i=Yb(e),o=u.useRef(null),a=Ub(i),l=qb(o,i),s=u.useCallback(h=>{o.current=h,l(h)},[l]),c=n.indent*i.level,d=u.useMemo(()=>({paddingLeft:c}),[c]),f=u.useMemo(()=>{var h,v;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((v=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&v!==void 0?v:0)})},[r,n.props.padding,n.props.paddingTop]),p={role:"treeitem","aria-level":i.level+1,"aria-selected":i.isSelected,"aria-expanded":i.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};u.useEffect(()=>{var h;!i.isEditing&&i.isFocused&&((h=o.current)===null||h===void 0||h.focus({preventScroll:!0}))},[i.isEditing,i.isFocused,o.current]);const g=n.renderNode,y=n.renderRow;return b.jsx(y,{node:i,innerRef:s,attrs:p,children:b.jsx(g,{node:i,tree:n,style:d,dragHandle:a})})});let jo="",s2=null;function af(){x1();const t=ke();return b.jsx("div",{role:"tree",style:{height:t.height,width:t.width,minHeight:0,minWidth:0},onContextMenu:t.props.onContextMenu,onClick:t.props.onClick,tabIndex:0,onFocus:e=>{e.currentTarget.contains(e.relatedTarget)||t.onFocus()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t.onBlur()},onKeyDown:e=>{var r;if(t.isEditing)return;if(e.key==="Backspace"){if(!t.props.onDelete)return;const i=Array.from(t.selectedIds);if(i.length>1){let o=t.mostRecentNode;for(;o&&o.isSelected;)o=o.nextSibling;o||(o=t.lastNode),t.focus(o,{scroll:!1}),t.delete(Array.from(i))}else{const o=t.focusedNode;if(o){const a=o.nextSibling,l=o.parent;t.focus(a||l,{scroll:!1}),t.delete(o)}}return}if(e.key==="Tab"&&!e.shiftKey){e.preventDefault(),P1(e.currentTarget);return}if(e.key==="Tab"&&e.shiftKey){e.preventDefault(),A1(e.currentTarget);return}if(e.key==="ArrowDown"){e.preventDefault();const i=t.nextNode;if(e.metaKey){t.select(t.focusedNode),t.activate(t.focusedNode);return}else if(!e.shiftKey||t.props.disableMultiSelection){t.focus(i);return}else{if(!i)return;const o=t.focusedNode;o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.firstNode);return}}if(e.key==="ArrowUp"){e.preventDefault();const i=t.prevNode;if(!e.shiftKey||t.props.disableMultiSelection){t.focus(i);return}else{if(!i)return;const o=t.focusedNode;o?o.isSelected?t.selectContiguous(i):t.selectMulti(i):t.focus(t.lastNode);return}}if(e.key==="ArrowRight"){const i=t.focusedNode;if(!i)return;i.isInternal&&i.isOpen?t.focus(t.nextNode):i.isInternal&&t.open(i.id);return}if(e.key==="ArrowLeft"){const i=t.focusedNode;if(!i||i.isRoot)return;i.isInternal&&i.isOpen?t.close(i.id):!((r=i.parent)===null||r===void 0)&&r.isRoot||t.focus(i.parent);return}if(e.key==="a"&&e.metaKey&&!t.props.disableMultiSelection){e.preventDefault(),t.selectAll();return}if(e.key==="a"&&!e.metaKey&&t.props.onCreate){t.createLeaf();return}if(e.key==="A"&&!e.metaKey){if(!t.props.onCreate)return;t.createInternal();return}if(e.key==="Home"){e.preventDefault(),t.focus(t.firstNode);return}if(e.key==="End"){e.preventDefault(),t.focus(t.lastNode);return}if(e.key==="Enter"){const i=t.focusedNode;if(!i||!i.isEditable||!t.props.onRename)return;setTimeout(()=>{i&&t.edit(i)});return}if(e.key===" "){e.preventDefault();const i=t.focusedNode;if(!i)return;i.isLeaf?(i.select(),i.activate()):i.toggle();return}if(e.key==="*"){const i=t.focusedNode;if(!i)return;t.openSiblings(i);return}if(e.key==="PageUp"){e.preventDefault(),t.pageUp();return}e.key==="PageDown"&&(e.preventDefault(),t.pageDown()),clearTimeout(s2),jo+=e.key,s2=setTimeout(()=>{jo=""},600);const n=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"?o.toLowerCase().startsWith(jo):!1});n&&t.focus(n.id)},children:b.jsx(e8,{className:t.props.className,outerRef:t.listEl,itemCount:t.visibleNodes.length,height:t.height,width:t.width,itemSize:t.rowHeight,overscanCount:t.overscanCount,itemKey:e=>{var r;return((r=t.visibleNodes[e])===null||r===void 0?void 0:r.id)||e},outerElementType:n8,innerElementType:a8,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:Xb})})}function c2(t){return t.isFiltered?Qb(t.root,t.isMatch.bind(t)):Jb(t.root)}function Jb(t){const e=[];function r(n){var i;n.level>=0&&e.push(n),n.isOpen&&((i=n.children)===null||i===void 0||i.forEach(r))}return r(t),e.forEach(lf),e}function Qb(t,e){const r={},n=[];function i(a){if(!a.isRoot&&e(a)){r[a.id]=!0;let s=a.parent;for(;s;)r[s.id]=!0,s=s.parent}if(a.children)for(let s of a.children)i(s)}function o(a){var l;a.level>=0&&r[a.id]&&n.push(a),a.isOpen&&((l=a.children)===null||l===void 0||l.forEach(o))}return i(t),o(t),n.forEach(lf),n}function lf(t,e){t.rowIndex=e}const u2=t=>t.reduce((e,r,n)=>(e[r.id]=n,e),{});var Ko=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(d){try{c(n.next(d))}catch(f){a(f)}}function s(d){try{c(n.throw(d))}catch(f){a(f)}}function c(d){d.done?o(d.value):i(d.value).then(l,s)}c((n=n.apply(t,e||[])).next())})};const{safeRun:ye,identify:Je,identifyNull:je}=xg;class pr{constructor(e,r,n,i){this.store=e,this.props=r,this.list=n,this.listEl=i,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=y0(this),this.visibleNodes=c2(this),this.idToIndex=u2(this.visibleNodes)}update(e){this.props=e,this.root=y0(this),this.visibleNodes=c2(this),this.idToIndex=u2(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return(e=this.props.width)!==null&&e!==void 0?e:300}get height(){var e;return(e=this.props.height)!==null&&e!==void 0?e:500}get indent(){var e;return(e=this.props.indent)!==null&&e!==void 0?e:24}get rowHeight(){var e;return(e=this.props.rowHeight)!==null&&e!==void 0?e:24}get overscanCount(){var e;return(e=this.props.overscanCount)!==null&&e!==void 0?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;const r=(e=this.props.searchMatch)!==null&&e!==void 0?e:(n,i)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(e){var r;const n=this.props.childrenAccessor||"children";return(r=Hr(e,n))!==null&&r!==void 0?r:null}accessId(e){const r=this.props.idAccessor||"id",n=Hr(e,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}get firstNode(){var e;return(e=this.visibleNodes[0])!==null&&e!==void 0?e:null}get lastNode(){var e;return(e=this.visibleNodes[this.visibleNodes.length-1])!==null&&e!==void 0?e:null}get focusedNode(){var e;return(e=this.get(this.state.nodes.focus.id))!==null&&e!==void 0?e:null}get mostRecentNode(){var e;return(e=this.get(this.state.nodes.selection.mostRecent))!==null&&e!==void 0?e:null}get nextNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e+1)}get prevNode(){const e=this.indexOf(this.focusedNode);return e===null?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,r){var n;if(e===null||r===null)return[];const i=(n=this.indexOf(e))!==null&&n!==void 0?n:0,o=this.indexOf(r);if(o===null)return[];const a=Math.min(i,o),l=Math.max(i,o);return this.visibleNodes.slice(a,l+1)}indexOf(e){const r=k1(e);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Ko(this,arguments,void 0,function*(e={}){var r,n;const i=e.parentId===void 0?N1(this):e.parentId,o=(r=e.index)!==null&&r!==void 0?r:M1(this),a=(n=e.type)!==null&&n!==void 0?n:"leaf",l=yield ye(this.props.onCreate,{type:a,parentId:i,index:o,parentNode:this.get(i)});l&&(this.focus(l),setTimeout(()=>{this.edit(l).then(()=>{this.select(l),this.activate(l)})}))})}delete(e){return Ko(this,void 0,void 0,function*(){if(!e)return;const n=(Array.isArray(e)?e:[e]).map(Je),i=n.map(o=>this.get(o)).filter(o=>!!o);yield ye(this.props.onDelete,{nodes:i,ids:n})})}edit(e){const r=Je(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(r),this.dispatch(_o(r)),new Promise(n=>{pr.editPromise=n})}submit(e,r){return Ko(this,void 0,void 0,function*(){if(!e)return;const n=Je(e);yield ye(this.props.onRename,{id:n,name:r,node:this.get(n)}),this.dispatch(_o(null)),this.resolveEdit({cancelled:!1,value:r}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(_o(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const r=this.get(je(e));r&&ye(this.props.onActivate,r)}resolveEdit(e){const r=pr.editPromise;r&&r(e),pr.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&e.push(n)}return e}focus(e,r={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Yt(Je(e))),r.scroll!==!1&&this.scrollTo(e),this.focusedNode&&ye(this.props.onFocus,this.focusedNode)))}pageUp(){var e,r;const n=this.visibleStartIndex,o=this.visibleStopIndex-n;let a=(r=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&r!==void 0?r:0;a>n?a=n:a=Math.max(n-o,0),this.focus(this.at(a))}pageDown(){var e,r;const n=this.visibleStartIndex,i=this.visibleStopIndex,o=i-n;let a=(r=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&r!==void 0?r:0;a<i?a=i:a=Math.min(a+o,this.visibleNodes.length-1),this.focus(this.at(a))}select(e,r={}){if(!e)return;const n=r.focus!==!1,i=Je(e);n&&this.dispatch(Yt(i)),this.dispatch(Le.only(i)),this.dispatch(Le.anchor(i)),this.dispatch(Le.mostRecent(i)),this.scrollTo(i,r.align),this.focusedNode&&n&&ye(this.props.onFocus,this.focusedNode),ye(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const r=Je(e);this.dispatch(Le.remove(r)),ye(this.props.onSelect,this.selectedNodes)}selectMulti(e){const r=this.get(je(e));r&&(this.dispatch(Yt(r.id)),this.dispatch(Le.add(r.id)),this.dispatch(Le.anchor(r.id)),this.dispatch(Le.mostRecent(r.id)),this.scrollTo(r),this.focusedNode&&ye(this.props.onFocus,this.focusedNode),ye(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const r=Je(e),{anchor:n,mostRecent:i}=this.state.nodes.selection;this.dispatch(Yt(r)),this.dispatch(Le.remove(this.nodesBetween(n,i))),this.dispatch(Le.add(this.nodesBetween(n,je(r)))),this.dispatch(Le.mostRecent(r)),this.scrollTo(r),this.focusedNode&&ye(this.props.onFocus,this.focusedNode),ye(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),ye(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Yt((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&ye(this.props.onFocus,this.focusedNode),ye(this.props.onSelect,this.selectedNodes)}setSelection(e){var r;const n=new Set((r=e.ids)===null||r===void 0?void 0:r.map(Je)),i=je(e.anchor),o=je(e.mostRecent);this.dispatch(Le.set({ids:n,anchor:i,mostRecent:o})),ye(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:e}=this.state.dnd;switch(e.type){case"highlight":return e.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var e;if(this.isFiltered)return!1;const r=(e=this.get(this.state.dnd.parentId))!==null&&e!==void 0?e:this.root,n=this.dragNodes,i=this.props.disableDrop;for(const o of n)if(!o||!r||o.isInternal&&$1(r,o))return!1;return typeof i=="function"?!i({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof i=="string"?!r.data[i]:typeof i=="boolean"?!i:!0}hideCursor(){this.dispatch(Er.cursor({type:"none"}))}showCursor(e){this.dispatch(Er.cursor(e))}open(e){const r=je(e);r&&(this.isOpen(r)||(this.dispatch(ya.open(r,this.isFiltered)),ye(this.props.onToggle,r)))}close(e){const r=je(e);r&&this.isOpen(r)&&(this.dispatch(ya.close(r,this.isFiltered)),ye(this.props.onToggle,r))}toggle(e){const r=je(e);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(e){const r=je(e);if(!r)return;const n=Cl(this.root,r);let i=n==null?void 0:n.parent;for(;i;)this.open(i.id),i=i.parent}openSiblings(e){const r=e.parent;if(!r)this.toggle(e.id);else if(r.children){const n=e.isOpen;for(let i of r.children)i.isInternal&&(n?this.close(i.id):this.open(i.id));this.scrollTo(this.focusedNode)}}openAll(){ci(this.root,e=>{e.isInternal&&e.open()})}closeAll(){ci(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,r="smart"){if(!e)return;const n=Je(e);return this.openParents(n),O1(()=>n in this.idToIndex).then(()=>{var i;const o=this.idToIndex[n];o!==void 0&&((i=this.list.current)===null||i===void 0||i.scrollToItem(o,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var e;return!!(!((e=this.props.searchTerm)===null||e===void 0)&&e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return e?this.state.nodes.selection.ids.has(e):!1}isOpen(e){var r,n,i;if(!e)return!1;if(e===ln)return!0;const o=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[e])!==null&&n!==void 0?n:!0:(i=this.state.nodes.open.unfiltered[e])!==null&&i!==void 0?i:o}isEditable(e){const r=this.props.disableEdit||(()=>!1);return!Hr(e,r)}isDraggable(e){const r=this.props.disableDrag||(()=>!1);return!Hr(e,r)}isDragging(e){const r=je(e);return r?this.state.nodes.drag.id===r:!1}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const r=je(e);if(!r)return!1;const{destinationParentId:n,destinationIndex:i}=this.state.nodes.drag;return r===n&&i===null}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(Yt(e.id))}onBlur(){this.dispatch(Ig())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||af}get renderRow(){return this.props.renderRow||_g}get renderNode(){return this.props.children||Pg}get renderDragPreview(){return this.props.renderDragPreview||R1}get renderCursor(){return this.props.renderCursor||$g}}function we(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var em=typeof Symbol=="function"&&Symbol.observable||"@@observable",d2=em,Vo=()=>Math.random().toString(36).substring(7).split("").join("."),tm={INIT:`@@redux/INIT${Vo()}`,REPLACE:`@@redux/REPLACE${Vo()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Vo()}`},_t=tm;function sf(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function rm(t){if(t===void 0)return"undefined";if(t===null)return"null";const e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(om(t))return"date";if(im(t))return"error";const r=nm(t);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function nm(t){return typeof t.constructor=="function"?t.constructor.name:null}function im(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function om(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function st(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=rm(t)),e}function cf(t,e,r){if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?we(2):`Expected the root reducer to be a function. Instead, received: '${st(t)}'`);if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?we(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?we(1):`Expected the enhancer to be a function. Instead, received: '${st(r)}'`);return r(cf)(t,e)}let n=t,i=e,o=new Map,a=o,l=0,s=!1;function c(){a===o&&(a=new Map,o.forEach((v,m)=>{a.set(m,v)}))}function d(){if(s)throw new Error(process.env.NODE_ENV==="production"?we(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?we(4):`Expected the listener to be a function. Instead, received: '${st(v)}'`);if(s)throw new Error(process.env.NODE_ENV==="production"?we(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let m=!0;c();const C=l++;return a.set(C,v),function(){if(m){if(s)throw new Error(process.env.NODE_ENV==="production"?we(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");m=!1,c(),a.delete(C),o=null}}}function p(v){if(!sf(v))throw new Error(process.env.NODE_ENV==="production"?we(7):`Actions must be plain objects. Instead, the actual type was: '${st(v)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof v.type>"u")throw new Error(process.env.NODE_ENV==="production"?we(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof v.type!="string")throw new Error(process.env.NODE_ENV==="production"?we(17):`Action "type" property must be a string. Instead, the actual type was: '${st(v.type)}'. Value was: '${v.type}' (stringified)`);if(s)throw new Error(process.env.NODE_ENV==="production"?we(9):"Reducers may not dispatch actions.");try{s=!0,i=n(i,v)}finally{s=!1}return(o=a).forEach(C=>{C()}),v}function g(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?we(10):`Expected the nextReducer to be a function. Instead, received: '${st(v)}`);n=v,p({type:_t.REPLACE})}function y(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?we(11):`Expected the observer to be an object. Instead, received: '${st(m)}'`);function C(){const F=m;F.next&&F.next(d())}return C(),{unsubscribe:v(C)}},[d2](){return this}}}return p({type:_t.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:g,[d2]:y}}function f2(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function am(t,e,r,n){const i=Object.keys(e),o=r&&r.type===_t.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(i.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!sf(t))return`The ${o} has unexpected type of "${st(t)}". Expected argument to be an object with the following keys: "${i.join('", "')}"`;const a=Object.keys(t).filter(l=>!e.hasOwnProperty(l)&&!n[l]);if(a.forEach(l=>{n[l]=!0}),!(r&&r.type===_t.REPLACE)&&a.length>0)return`Unexpected ${a.length>1?"keys":"key"} "${a.join('", "')}" found in ${o}. Expected to find one of the known reducer keys instead: "${i.join('", "')}". Unexpected keys will be ignored.`}function lm(t){Object.keys(t).forEach(e=>{const r=t[e];if(typeof r(void 0,{type:_t.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?we(12):`The slice reducer for key "${e}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:_t.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?we(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${_t.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function h2(t){const e=Object.keys(t),r={};for(let a=0;a<e.length;a++){const l=e[a];process.env.NODE_ENV!=="production"&&typeof t[l]>"u"&&f2(`No reducer provided for key "${l}"`),typeof t[l]=="function"&&(r[l]=t[l])}const n=Object.keys(r);let i;process.env.NODE_ENV!=="production"&&(i={});let o;try{lm(r)}catch(a){o=a}return function(l={},s){if(o)throw o;if(process.env.NODE_ENV!=="production"){const f=am(l,r,s,i);f&&f2(f)}let c=!1;const d={};for(let f=0;f<n.length;f++){const p=n[f],g=r[p],y=l[p],h=g(y,s);if(typeof h>"u"){const v=s&&s.type;throw new Error(process.env.NODE_ENV==="production"?we(14):`When called with an action of type ${v?`"${String(v)}"`:"(unknown type)"}, the slice reducer for key "${p}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}d[p]=h,c=c||h!==y}return c=c||n.length!==Object.keys(l).length,c?d:l}}function sm(t=Cr().nodes.drag,e){switch(e.type){case"DND_DRAG_START":return Object.assign(Object.assign({},t),{id:e.id,selectedIds:e.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},t),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return e.parentId!==t.destinationParentId||e.index!=t.destinationIndex?Object.assign(Object.assign({},t),{destinationParentId:e.parentId,destinationIndex:e.index}):t;default:return t}}const cm=h2({nodes:h2({focus:Og,edit:kg,open:Mg,selection:Ng,drag:sm}),dnd:Rg}),um=Cr();function dm({treeProps:t,imperativeHandle:e,children:r}){const n=u.useRef(null),i=u.useRef(null),o=u.useRef(cf(cm,Cr(t))),a=Za.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>um),l=u.useMemo(()=>new pr(o.current,t,n,i),[]),s=u.useRef(0);return u.useMemo(()=>{s.current+=1,l.update(t)},[...Object.values(t),a.nodes.open]),u.useImperativeHandle(e,()=>l),u.useEffect(()=>{l.props.selection?l.select(l.props.selection,{focus:!1}):l.deselectAll()},[l.props.selection]),u.useEffect(()=>{l.props.searchTerm||o.current.dispatch(ya.clear(!0))},[l.props.searchTerm]),b.jsx(y1.Provider,{value:l,children:b.jsx(w1.Provider,{value:s.current,children:b.jsx(C1.Provider,{value:a.nodes,children:b.jsx(E1.Provider,{value:a.dnd,children:b.jsx(Hv,Object.assign({backend:zb,options:{rootElement:l.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:r}))})})})})}function fm(){const t=ke(),[,e]=Y1(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?t.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const i=n.getClientOffset();if(!t.listEl.current||!i)return;const{cursor:o,drop:a}=of({element:t.listEl.current,offset:i,indent:t.indent,node:null,prevNode:t.visibleNodes[t.visibleNodes.length-1],nextNode:null});a&&t.dispatch(Er.hovering(a.parentId,a.index)),n.canDrop()?o&&t.showCursor(o):t.hideCursor()}}),[t]);e(t.listEl)}function hm(t){return fm(),t.children}function pm(){const e=ke().props.renderContainer||af;return b.jsx(b.Fragment,{children:b.jsx(e,{})})}function gm(){const t=ke(),{offset:e,mouse:r,item:n,isDragging:i}=gb(a=>({offset:a.getSourceClientOffset(),mouse:a.getClientOffset(),item:a.getItem(),isDragging:a.isDragging()})),o=t.props.renderDragPreview||R1;return b.jsx(o,{offset:e,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:i})}class vm{constructor(e){this.root=bm(e)}get data(){var e,r;return(r=(e=this.root.children)===null||e===void 0?void 0:e.map(n=>n.data))!==null&&r!==void 0?r:[]}create(e){const r=e.parentId?this.find(e.parentId):this.root;if(!r)return null;r.addChild(e.data,e.index)}move(e){const r=this.find(e.id),n=e.parentId?this.find(e.parentId):this.root;!r||!n||(n.addChild(r.data,e.index),r.drop())}update(e){const r=this.find(e.id);r&&r.update(e.changes)}drop(e){const r=this.find(e.id);r&&r.drop()}find(e,r=this.root){if(!r)return null;if(r.id===e)return r;if(r.children){for(let n of r.children){const i=this.find(e,n);if(i)return i}return null}return null}}function bm(t){const e=new uf({id:"ROOT"},null);return e.children=t.map(r=>$l(r,e)),e}function $l(t,e){const r=new uf(t,e);return t.children&&(r.children=t.children.map(n=>$l(n,r))),r}class uf{constructor(e,r){this.data=e,this.parent=r,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,r){var n,i;const o=$l(e,this);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,o),this.data.children=(i=this.data.children)!==null&&i!==void 0?i:[],this.data.children.splice(r,0,e)}removeChild(e){var r,n;(r=this.children)===null||r===void 0||r.splice(e,1),(n=this.data.children)===null||n===void 0||n.splice(e,1)}update(e){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let mm=0;function ym(t){const[e,r]=u.useState(t),n=u.useMemo(()=>new vm(e),[e]);return[e,{onMove:c=>{for(const d of c.dragIds)n.move({id:d,parentId:c.parentId,index:c.index});r(n.data)},onRename:({name:c,id:d})=>{n.update({id:d,changes:{name:c}}),r(n.data)},onCreate:({parentId:c,index:d,type:f})=>{const p={id:`simple-tree-id-${mm++}`,name:""};return f==="internal"&&(p.children=[]),n.create({parentId:c,index:d,data:p}),r(n.data),p},onDelete:c=>{c.ids.forEach(d=>n.drop({id:d})),r(n.data)}}]}function Cm(t){if(t.initialData&&t.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(t.initialData&&(t.onCreate||t.onDelete||t.onMove||t.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
98
- Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,r]=ym(t.initialData);return Object.assign(Object.assign(Object.assign({},t),r),{data:e})}else return t}function Em(t,e){const r=Cm(t);return b.jsxs(dm,{treeProps:r,imperativeHandle:e,children:[b.jsx(hm,{children:b.jsx(pm,{})}),b.jsx(gm,{})]})}const wm=u.forwardRef(Em),df=({top:t,left:e})=>b.jsx("div",{className:"c__tree-view__cursor",style:{top:t-2,left:e+10,width:`calc(100% - ${24+e}px)`}});function xm(t,e){var r=u.useRef(null),n=u.useRef(null);n.current=e;var i=u.useRef(null);u.useEffect(function(){o()});var o=u.useCallback(function(){var a=i.current,l=n.current,s=a||(l?l instanceof Element?l:l.current:null);r.current&&r.current.element===s&&r.current.subscriber===t||(r.current&&r.current.cleanup&&r.current.cleanup(),r.current={element:s,subscriber:t,cleanup:s?t(s):void 0})},[t]);return u.useEffect(function(){return function(){r.current&&r.current.cleanup&&(r.current.cleanup(),r.current=null)}},[]),u.useCallback(function(a){i.current=a,o()},[o])}function p2(t,e,r){return t[e]?t[e][0]?t[e][0][r]:t[e][r]:e==="contentBoxSize"?t.contentRect[r==="inlineSize"?"width":"height"]:void 0}function Dm(t){t===void 0&&(t={});var e=t.onResize,r=u.useRef(void 0);r.current=e;var n=t.round||Math.round,i=u.useRef(),o=u.useState({width:void 0,height:void 0}),a=o[0],l=o[1],s=u.useRef(!1);u.useEffect(function(){return s.current=!1,function(){s.current=!0}},[]);var c=u.useRef({width:void 0,height:void 0}),d=xm(u.useCallback(function(f){return(!i.current||i.current.box!==t.box||i.current.round!==n)&&(i.current={box:t.box,round:n,instance:new ResizeObserver(function(p){var g=p[0],y=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=p2(g,y,"inlineSize"),v=p2(g,y,"blockSize"),m=h?n(h):void 0,C=v?n(v):void 0;if(c.current.width!==m||c.current.height!==C){var E={width:m,height:C};c.current.width=m,c.current.height=C,r.current?r.current(E):s.current||l(E)}})}),i.current.instance.observe(f,{box:t.box}),function(){i.current&&i.current.instance.unobserve(f)}},[t.box,n]),t.ref);return u.useMemo(function(){return{ref:d,width:a.width,height:a.height}},[d,a.width,a.height])}var se=(t=>(t.NODE="node",t.SEPARATOR="separator",t.TITLE="title",t.SIMPLE_NODE="simpleNode",t.VIEW_MORE="viewMore",t))(se||{}),wt=(t=>(t.FIRST_CHILD="first-child",t.LAST_CHILD="last-child",t.LEFT="left",t.RIGHT="right",t))(wt||{});const fi=t=>t?t.nodeType===se.SEPARATOR:!1,hi=t=>t?t.nodeType===se.TITLE:!1,ff=t=>t?t.nodeType===se.VIEW_MORE:!1,zr=t=>!fi(t)&&!hi(t)&&!ff(t),hf=(t,e,r)=>{const{t:n}=X.useCunningham(),{remove:i,update:o,insert:a,insertBefore:l,insertAfter:s,append:c,prepend:d,getItem:f,move:p,items:g}=dh({initialItems:JSON.parse(JSON.stringify(t)),getKey:R=>R.id,getChildren:R=>R.children||[]}),[y,h]=u.useState(),v=(R=[])=>{const $=g.map(T=>T.key);i(...$);const P=JSON.parse(JSON.stringify(R));P.length>0&&a(null,0,...P),h(void 0)},m=R=>{const $=f(R);$&&h($.value)},C=(R,$,P)=>{var T,M,j,H;if(R){const Z=f(R);if(Z){const q=(M=Z.children)==null?void 0:M[((T=Z.children)==null?void 0:T.length)-1];let Y=P??((j=Z.children)==null?void 0:j.length)??0;P===((H=Z.children)==null?void 0:H.length)&&q&&q.value.nodeType===se.VIEW_MORE&&(Y=Y-1),a(R,Y,$)}}else a(null,P??g.length,$)},E=R=>{var $;return($=f(R))==null?void 0:$.value},F=(R,$)=>{var Z,q;const P=f(R);if(!P){console.error("No item found");return}let T=((Z=P.children)==null?void 0:Z.map(Y=>Y.value))??null;const M=$.childrenCount??P.value.childrenCount??0;if((T==null?void 0:T.length)===0&&M>0&&(T=null),$.children){const Y=[...T??[],...$.children],le=new Map;for(const G of Y)le.set(G.id,G);T=Array.from(le.values())}T&&(T=T.sort((Y,le)=>Y.nodeType===se.VIEW_MORE&&le.nodeType!==se.VIEW_MORE?1:Y.nodeType!==se.VIEW_MORE&&le.nodeType===se.VIEW_MORE?-1:0));const j=((q=$.pagination)==null?void 0:q.hasMore)??!1;T&&(T=T.filter(Y=>Y.nodeType!==se.VIEW_MORE)),j&&T&&T.push({id:`view-more-${R}`,nodeType:se.VIEW_MORE,label:n("components.treeView.viewMore")});const H={...P.value,...$,children:T,childrenCount:(T==null?void 0:T.length)??M};o(R,H)},D=R=>{i(R)},w=R=>{i(...R)},S=async R=>{if(!e){console.error("No refresh callback provided");return}try{const $=await e(R);F(R,$)}catch($){console.error("error while refreshing node:",$)}},O=(R,$)=>{a(null,$??g.length,R)},K=(R,$)=>{a(null,$??g.length,...R)},V=(R,$)=>{const P=f(R);if(!P){console.error("No item found");return}const T={...P.value,children:$,childrenCount:$.length,hasLoadedChildren:$.length>0};o(R,T)},x=R=>{const $=[],P=f(R);if(!P)return[];$.push(P.value);const T=M=>{const j=B(M);if(!j)return;const H=f(j);H&&($.push(H.value),T(j))};return T(R),$.reverse()},B=R=>{var $;return(($=f(R))==null?void 0:$.parentKey)??null},U=R=>{const $=B(R);if(!$)return null;const P=f($);return P?P.value:null},k=(R,$)=>{l(R,$)},W=(R,$)=>{s(R,$)},_=(R,$)=>{c(R,$)},I=(R,$)=>{d(R,$)},z=(R,$,P)=>{p(R,$,P)},L=R=>{z(R.sourceId,R.newParentId,R.index)},N=async R=>{var Y;if(!r)return console.error("No load paginated children callback provided"),[];const $=f(R);if(!$){console.error("No parent found");return}const T=(((Y=$==null?void 0:$.value.pagination)==null?void 0:Y.currentPage)??0)+1,M=await r(R,T);if(!M){console.error("No result found");return}const j=M.children,H=M.pagination,Z=T,q=(H==null?void 0:H.hasMore)??!1;F(R,{children:j,hasLoadedChildren:!0,pagination:{currentPage:Z,hasMore:q}})};return u.useEffect(()=>{const R=$=>{$.forEach(P=>{var T;if(P.children&&P.children.length>0){const M=P.value.hasLoadedChildren||((T=P.children)==null?void 0:T.length)>0||P.value.children&&P.value.children.length>0;P.value.children=P.children.map(H=>H.value);const j=M?P.children.length:P.value.childrenCount??0;P.value.childrenCount=j,M&&!P.value.hasLoadedChildren&&(P.value.hasLoadedChildren=!0),R(P.children)}else{const j=P.value.hasLoadedChildren||P.value.children&&P.value.children.length>0?0:P.value.childrenCount;P.value.children=[],P.value.childrenCount=j}})};R(g)},[g]),{nodes:g,addChild:C,updateNode:F,deleteNode:D,deleteNodes:w,addRootNode:O,addRootNodes:K,selectedNode:y,setSelectedNode:h,refreshNode:S,setChildren:V,insertBeforeNode:k,insertAfterNode:W,handleMove:L,prependToNode:I,moveNode:z,appendToNode:_,move:p,resetTree:v,handleLoadChildren:N,selectNodeById:m,getParent:U,getNode:E,getParentId:B,getAncestors:x}},_l=u.createContext(null),Sm=({children:t,onRefresh:e,initialNodeId:r,onLoadChildren:n,initialTreeData:i})=>{const o=u.useRef(null),[a,l]=u.useState(null),[s,c]=u.useState(r??null),d=hf(i??[],e,n);return b.jsx(_l.Provider,{value:{treeApiRef:o,treeData:d,root:a,initialTargetId:s,setInitialTargetId:c,setRoot:l},children:t})},Pl=()=>{const t=u.useContext(_l);if(!t)throw new Error("TreeContext not found");return t},Fm=({initialOpenState:t,dndRootElement:e,selectedNodeId:r,rootNodeId:n,renderNode:i,canDrop:o,canDrag:a,afterMove:l,beforeMove:s,paddingTop:c=10,paddingBottom:d=10,rowProps:f})=>{const[p,g]=u.useState(400),{ref:y,width:h}=Dm(),v=Pl(),m=(v==null?void 0:v.treeData.nodes)??[];u.useEffect(()=>{const D=document.querySelector(".c__tree-view"),w=D==null?void 0:D.firstElementChild;let S=null;return D&&w&&(S=new ResizeObserver(()=>{if(w&&w instanceof HTMLElement){const O=w.style.height;g(parseInt(O,10)+20)}}),S.observe(w)),()=>S==null?void 0:S.disconnect()},[]);const C=D=>{var $,P,T,M;const w=JSON.parse(JSON.stringify(m)),S=D.dragNodes[0],O=D.parentId?(($=D.parentNode)==null?void 0:$.data.children)??[]:w,K=D.dragNodes[0].data.value.id,V=D.dragNodes[0].data,x=(P=D.parentNode)==null?void 0:P.data;if((x==null?void 0:x.value.nodeType)===se.TITLE||(x==null?void 0:x.value.nodeType)===se.SEPARATOR||(x==null?void 0:x.value.nodeType)===se.VIEW_MORE)return null;const B=V.parentKey??n,U=D.parentId??n;let k=D.index+0,W=null,_=U;const I=((M=(T=S.parent)==null?void 0:T.children)==null?void 0:M.findIndex(j=>j.data.value.id===K))??0;if(B===U){if(I===k)return null;k=k<I?k:k-1}const z=D.index-1,L=O[z],N=D.index,R=O[N];return D.index===0?(_=D.parentId??n,W=wt.FIRST_CHILD):!x&&D.index===1&&!zr(L.value)?(_=n,k=1,W=wt.FIRST_CHILD):D.index===O.length?(_=_??n,W=wt.LAST_CHILD):L&&zr(L.value)?(_=L.value.id,W=wt.RIGHT):R&&zr(R.value)&&(W=wt.LEFT,_=R.value.id),W&&_?{targetModeId:_,mode:W,oldParentId:B,index:k,newParentId:D.parentId,sourceId:K}:null},E=D=>{const w=C(D);w&&(s?s(w,()=>{v==null||v.treeData.handleMove(w),l==null||l(w)}):(v==null||v.treeData.handleMove(w),l==null||l(w)))},F=u.useCallback(D=>a?!a(D):!1,[a]);if(v)return b.jsx("div",{ref:y,style:{height:p},className:"c__tree-view--container",children:b.jsx(wm,{dndRootElement:e,data:m,ref:v.treeApiRef,openByDefault:!1,selectionFollowsFocus:!1,disableMultiSelection:!0,disableEdit:!0,className:"c__tree-view",idAccessor:"key",onMove:E,height:p,width:h,paddingTop:c,paddingBottom:d,rowHeight:34,disableDrag:F,disableDrop:({parentNode:D,dragNodes:w,index:S})=>{var B,U,k;if(o&&!o({parentNode:D,dragNodes:w,index:S}))return D.id!=="__REACT_ARBORIST_INTERNAL_ROOT__"&&(D.data.value.canDrop=!1),!0;const O=w[0];if(O&&O.isDragging&&O.willReceiveDrop||((B=D.data.value)==null?void 0:B.nodeType)===se.TITLE||((U=D.data.value)==null?void 0:U.nodeType)===se.SEPARATOR||((k=D.data.value)==null?void 0:k.nodeType)===se.VIEW_MORE)return!0;if(D.id==="__REACT_ARBORIST_INTERNAL_ROOT__"){const W=m[S-1],_=m[S],I=m[S+1],z=fi(W==null?void 0:W.value),L=fi(_==null?void 0:_.value),N=hi(W==null?void 0:W.value),R=hi(_==null?void 0:_.value),$=zr(I==null?void 0:I.value);return!!(S===0&&(L||R)||z&&R&&$||N&&L&&$)}const K=D==null?void 0:D.isOpen,V=(D==null?void 0:D.data.value.childrenCount)&&D.data.value.childrenCount>0||(D==null?void 0:D.data.children)&&D.data.children.length>0;if(!V)return D.data.value.canDrop=!0,!1;let x=D.data.value.childrenCount&&D.data.value.childrenCount>0&&(D==null?void 0:D.data.children)&&D.data.children.length>0;return x=x??!0,!K&&!x&&V?(D.data.value.canDrop=!0,!0):(D.data.value.canDrop=!0,!1)},initialOpenState:t,overscanCount:20,selection:r,renderCursor:df,renderRow:D=>b.jsx($m,{...D,customRowProps:f}),rowClassName:"c__tree-view--row",children:i})})},$m=({children:t,customRowProps:e,...r})=>{const n=r.node.data.value.nodeType===se.TITLE,i=r.node.data.value.nodeType===se.SEPARATOR,o=r.node.data.value.nodeType===se.VIEW_MORE,{onKeyDown:a,onClick:l,...s}=e??{},{style:c}=r.attrs,d={...c},f=p=>{a==null||a(p);const g=p.target;if(g){const y=g.closest(".actions"),v=g.closest('button, a[href], input, textarea, select, [role="menuitem"], [role="button"]');if(y||v)return}if((p.key==="Enter"||p.key===" ")&&p.currentTarget.click(),p.key==="F2"){p.preventDefault();const y=p.currentTarget.querySelector("button");y&&y.focus()}};return n||i||o?u.createElement("div",{...r.attrs,key:r.node.id,style:d,ref:r.innerRef,onFocus:p=>p.stopPropagation(),onClick:p=>{l==null||l(p),r.node.handleClick(p)},onKeyDown:a,...s},t):u.createElement("div",{...r.attrs,style:d,key:r.node.id,ref:r.innerRef,onFocus:p=>p.stopPropagation(),onClick:p=>{l==null||l(p),p.preventDefault(),p.stopPropagation(),r.node.select()},onKeyDown:f,...s},b.jsx("div",{className:"c__tree-view--row-content",children:t}))},_m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pf=_m?u.useLayoutEffect:u.useEffect;function gf(t){const e=u.useRef(t);return pf(()=>{e.current=t}),u.useCallback(function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}function g2(t,e){e===void 0&&(e=[t]);const r=u.useRef(t);return pf(()=>{r.current!==t&&(r.current=t)},e),r}function Pm(t){const e=gf(t),r=u.useRef(null),n=u.useCallback(i=>{i!==r.current&&(e==null||e(i,r.current)),r.current=i},[]);return[r,n]}let Ho={};function Am(t,e){return u.useMemo(()=>{const r=Ho[t]==null?0:Ho[t]+1;return Ho[t]=r,t+"-"+r},[t,e])}var Wr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Wr||(Wr={}));function v2(){}const Tm=Object.freeze({x:0,y:0});var lr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(lr||(lr={}));var b2;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(b2||(b2={}));var ct;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(ct||(ct={}));ct.Space,ct.Enter,ct.Esc,ct.Space,ct.Enter,ct.Tab;var m2;(function(t){t[t.RightClick=2]="RightClick"})(m2||(m2={}));var y2;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(y2||(y2={}));var C2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(C2||(C2={}));lr.Backward+"",lr.Forward+"",lr.Backward+"",lr.Forward+"";var _a;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(_a||(_a={}));var Pa;(function(t){t.Optimized="optimized"})(Pa||(Pa={}));function km(t){let{callback:e,disabled:r}=t;const n=gf(e),i=u.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(n)},[r]);return u.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}_a.WhileDragging,Pa.Optimized;const Im={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:v2,draggableNodes:new Map,over:null,measureDroppableContainers:v2},Om=u.createContext(Im);({...Tm});var E2;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(E2||(E2={}));const Mm="Droppable",Nm={timeout:25};function Rm(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:i}=t;const o=Am(Mm),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=u.useContext(Om),d=u.useRef({disabled:r}),f=u.useRef(!1),p=u.useRef(null),g=u.useRef(null),{disabled:y,updateMeasurementsFor:h,timeout:v}={...Nm,...i},m=g2(h??n),C=u.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(m.current)?m.current:[m.current]),g.current=null},v)},[v]),E=km({callback:C,disabled:y||!a}),F=u.useCallback((O,K)=>{E&&(K&&(E.unobserve(K),f.current=!1),O&&E.observe(O))},[E]),[D,w]=Pm(F),S=g2(e);return u.useEffect(()=>{!E||!D.current||(E.disconnect(),f.current=!1,E.observe(D.current))},[D,E]),u.useEffect(()=>(l({type:Wr.RegisterDroppable,element:{id:n,key:o,disabled:r,node:D,rect:p,data:S}}),()=>l({type:Wr.UnregisterDroppable,key:o,id:n})),[n]),u.useEffect(()=>{r!==d.current.disabled&&(l({type:Wr.SetDroppableDisabled,id:n,key:o,disabled:r}),d.current.disabled=r)},[n,o,r,l]),{active:a,rect:p,isOver:(s==null?void 0:s.id)===n,node:D,over:s,setNodeRef:w}}const Bm=t=>{const{isOver:e,setNodeRef:r}=Rm({id:t.id,data:t.data});return u.useEffect(()=>{var n;(n=t.onOver)==null||n.call(t,e,t.data)},[e,t.data,t.onOver]),b.jsx("div",{className:"c__dnd--droppable",ref:r,children:t.children})},Lm=({children:t,itemProps:e,testId:r,onClick:n,onKeyDown:i,node:o,dragHandle:a,style:l,forceLoading:s})=>{var O,K;const{t:c}=X.useCunningham(),d=Pl(),f=u.useRef(null),[p,g]=u.useState(!1),[y,h]=u.useState(!1),[v,m]=u.useState(!1),C=s??p,E=o.willReceiveDrop||v,F=o.data.value.childrenCount!==void 0&&o.data.value.childrenCount>0||(((O=o.data.children)==null?void 0:O.length)??0)>0,D=((K=o.children)==null?void 0:K.length)??!1,w=o.isLeaf||!F,S=u.useCallback(V=>{V.stopPropagation(),o.data.value.nodeType===se.VIEW_MORE&&(h(!0),d==null||d.treeData.handleLoadChildren(o.data.parentKey).then(()=>h(!1)).catch(()=>h(!1)))},[o.data.value.nodeType,o.data.parentKey,d==null?void 0:d.treeData]);return u.useEffect(()=>{w||D||o.data.value.hasLoadedChildren||o.isOpen&&(g(!0),d==null||d.treeData.handleLoadChildren(o.data.value.id).then(()=>g(!1)))},[o.isOpen,w,D,o.data.value.hasLoadedChildren,o.data.value.id,d==null?void 0:d.treeData]),u.useEffect(()=>(E&&!o.isOpen&&!o.isDragging&&(f.current=setTimeout(()=>{o.open()},500)),()=>{f.current&&clearTimeout(f.current)}),[E,o.isOpen,o.isDragging,o]),o.data.value.nodeType===se.SEPARATOR?b.jsx("div",{className:"c__tree-view--node__separator","data-testid":r}):o.data.value.nodeType===se.TITLE?b.jsx("div",{className:"c__tree-view--node__title","data-testid":r,children:o.data.value.headerTitle}):o.data.value.nodeType===se.VIEW_MORE?b.jsx("div",{className:"c__tree-view--row-content","data-testid":r,children:b.jsx("div",{className:"c__tree-view--node",style:l,children:b.jsxs("div",{role:"button",className:"c__tree-view--node__view-more-button",style:{paddingLeft:0,marginLeft:20},onClick:S,children:[y?b.jsx("div",{className:"c__tree-view--node__loading",children:b.jsx(li,{})}):b.jsx("span",{className:"material-icons c__tree-view--node__view-more-button__icon",children:"arrow_downward"}),b.jsxs("span",{className:"c__tree-view--node__view-more-text",children:[o.data.value.nodeType===se.VIEW_MORE,c("components.treeView.viewMore")]})]})})}):b.jsx(Bm,{id:o.id,data:{data:o.data,nodeApi:o},onOver:m,children:b.jsxs("div",{onClick:V=>{if(!V.target.closest(".c__tree-view--node")){V.stopPropagation();return}n==null||n()},onKeyDown:V=>{i==null||i(V),V.target.closest(".c__tree-view--node")||V.stopPropagation()},ref:a,style:l,className:ve("c__tree-view--node",{...o.state,simpleNode:o.data.value.nodeType===se.SIMPLE_NODE,canDrop:o.data.value.canDrop??!0,externalDrop:v}),"data-testid":r,...e,children:[w&&b.jsx("div",{className:"c__tree-view--node__leaf"}),!w&&b.jsxs(b.Fragment,{children:[C&&b.jsx("div",{className:"c__tree-view--node__loading",children:b.jsx(li,{})}),!C&&b.jsx("span",{onClick:V=>{V.stopPropagation(),o.toggle()},className:"c__tree-view--node__arrow material-icons",children:o.isOpen?"keyboard_arrow_down":"keyboard_arrow_right"})]}),t]})})},jm=({children:t,uppercased:e=!1,type:r="accent",className:n,...i})=>b.jsx("div",{className:ve(n,"c__badge",{"c__badge--uppercased":e,[`c__badge--${r}`]:r}),...i,children:t});function Km(t){u.useEffect(()=>{if(!t)return;let e=!1;const r=()=>Array.from(t.querySelectorAll("button")).filter(a=>!a.disabled&&a.getAttribute("aria-disabled")!=="true"),n=a=>{const l=a.key==="ArrowLeft"||a.key==="ArrowRight",s=a.key===" ";if(!(a.target instanceof HTMLElement))return;if(s){const h=a.target.closest("button");h instanceof HTMLButtonElement&&t.contains(h)&&h.click();return}if(!l)return;const d=a.target.closest("button");if(!(d instanceof HTMLButtonElement&&t.contains(d)))return;const p=r(),g=p.indexOf(d);if(g<0)return;a.preventDefault(),a.stopPropagation();const y=a.key==="ArrowRight"?(g+1)%p.length:(g-1+p.length)%p.length;p[y].focus(),e=!0},i=a=>{e&&((a.key===" "||a.key==="Enter")&&(a.preventDefault(),a.stopPropagation()),e=!1)},o={capture:!0};return t.addEventListener("keydown",n,o),t.addEventListener("keyup",i,o),()=>{t.removeEventListener("keydown",n,o),t.removeEventListener("keyup",i,o)}},[t])}const Zi=({roles:t,onSelect:e,canUpdate:r=!0,selectedRole:n,isOpen:i,onOpenChange:o,roleTopMessage:a,onDelete:l})=>{const{t:s}=X.useCunningham(),c=t.find(f=>f.value===n),d=u.useMemo(()=>l?[...t,{type:"separator"},{label:s("components.share.access.delete"),callback:l}]:t,[t,l,s]);return r?b.jsx(Yr,{isOpen:i,shouldCloseOnInteractOutside:f=>!f.closest(".c__access-role-dropdown"),onOpenChange:o,options:d,selectedValues:[n],onSelectValue:e,topMessage:a,children:b.jsxs("div",{role:"button",className:"c__access-role-dropdown","data-testid":"access-role-dropdown-button",onClick:()=>{o==null||o(!i)},children:[b.jsx("span",{className:"c__access-role-dropdown__role-label",children:c==null?void 0:c.label}),b.jsx("span",{className:"material-icons c__access-role-dropdown__icon",children:i?"arrow_drop_up":"arrow_drop_down"})]})}):b.jsx("span",{className:"c__access-role-dropdown__role-label-can-not-update",children:c==null?void 0:c.label})},vf=({users:t,onRemoveUser:e,rightActions:r,onShare:n,shareButtonLabel:i,roles:o,selectedRole:a,onSelectRole:l})=>{const{t:s}=X.useCunningham(),[c,d]=u.useState(!1);return b.jsxs("div",{className:"c__add-share-user-list","data-testid":"selected-users-list",children:[b.jsx("div",{className:"c__add-share-user-list__items",children:t.map(f=>b.jsx(bf,{user:f,onRemoveUser:e},f.id))}),b.jsxs("div",{className:"c__add-share-user-list__right-actions",children:[r,b.jsx(Zi,{roles:o,selectedRole:a,onSelect:l,isOpen:c,onOpenChange:d}),b.jsx(X.Button,{onClick:n,children:i??s("components.share.shareButton")})]})]})},bf=({user:t,onRemoveUser:e})=>b.jsxs("div",{className:"c__add-share-user-item","data-testid":"selected-user-item",children:[b.jsx("span",{children:t.full_name||t.email}),b.jsx(X.Button,{variant:"tertiary",color:"neutral",size:"nano",onClick:()=>e==null?void 0:e(t),icon:b.jsx("span",{className:"material-icons",children:"close"})})]}),Aa=["gray","brand","red","orange","brown","green","blue-1","blue-2","pink","yellow","purple"],mf=t=>t.split(/[\s-_]+/).slice(0,2).map(e=>e[0]).join("").toUpperCase(),Al=t=>{let e=0;for(let r=0;r<t.length;r++)e+=t.charCodeAt(r);return Aa[e%Aa.length]},Gi=({fullName:t,size:e="medium",forceColor:r,backgroundColor:n})=>{const i=mf(t),o=n||Al(t);return b.jsx("div",{style:{backgroundColor:r||void 0},className:ve(`c__avatar ${e}`,{[o]:!r&&o}),children:b.jsx("div",{className:"c__avatar__initials",children:i})})},qi=({fullName:t,email:e,showEmail:r=!0})=>{const n=t&&t!==""?t:e??"";return b.jsxs("div",{className:"c__user-row",children:[b.jsx(Gi,{fullName:n,size:"small"}),b.jsxs("div",{className:"c__user-row__info",children:[b.jsx("span",{className:"c__user-row__name",children:t}),r&&e&&b.jsx("span",{className:ve("c__user-row__email",{"has-only-email":e&&(t===""||!t)}),children:e})]})]})},Ta=({user:t})=>{const{t:e}=X.useCunningham();return b.jsx(Ki,{testId:"search-user-item",left:b.jsx(qi,{fullName:t.full_name,email:t.email}),alwaysShowRight:!1,right:b.jsxs("div",{className:"c__search-user-item-right",children:[b.jsx("span",{children:e("components.share.item.add")}),b.jsx("span",{className:"material-icons",children:"add"})]})})},yf=({accessData:t,accessRoleKey:e="role",roles:r,updateRole:n,deleteAccess:i,canUpdate:o=!0,roleTopMessage:a})=>{const l=mr();return b.jsx("div",{className:"c__share-member-item",children:b.jsx(Ki,{testId:"share-member-item",left:b.jsx(qi,{fullName:t.user.full_name,email:t.user.email,showEmail:!0}),alwaysShowRight:!0,right:b.jsx("div",{className:"c__share-member-item__right",children:b.jsx(Zi,{roles:r,selectedRole:t[e],onSelect:s=>n==null?void 0:n(t,s),isOpen:l.isOpen,onOpenChange:l.setIsOpen,canUpdate:o,roleTopMessage:a,onDelete:t.is_explicit!==!1&&t.can_delete!==!1&&i?()=>i(t):void 0})})})})},Cf=({invitation:t,roles:e,updateRole:r,deleteInvitation:n,canUpdate:i=!0,roleTopMessage:o})=>{const a=mr();return b.jsx("div",{className:"c__share-member-item",children:b.jsx(Ki,{testId:"share-invitation-item",left:b.jsx(qi,{fullName:"",email:t.email,showEmail:!0}),alwaysShowRight:!0,right:b.jsx("div",{className:"c__share-member-item__right",children:b.jsx(Zi,{roles:e,selectedRole:t.role,onSelect:l=>r==null?void 0:r(t,l),isOpen:a.isOpen,canUpdate:i,onOpenChange:a.setIsOpen,roleTopMessage:o,onDelete:n?()=>n(t):void 0})})})})},Vm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6167%2022%209.31667%2021.7375%208.1%2021.2125C6.88333%2020.6875%205.825%2019.975%204.925%2019.075C4.025%2018.175%203.3125%2017.1167%202.7875%2015.9C2.2625%2014.6833%202%2013.3833%202%2012C2%2010.6167%202.2625%209.31667%202.7875%208.1C3.3125%206.88333%204.025%205.825%204.925%204.925C5.825%204.025%206.88333%203.3125%208.1%202.7875C9.31667%202.2625%2010.6167%202%2012%202C13.3833%202%2014.6833%202.2625%2015.9%202.7875C17.1167%203.3125%2018.175%204.025%2019.075%204.925C19.975%205.825%2020.6875%206.88333%2021.2125%208.1C21.7375%209.31667%2022%2010.6167%2022%2012C22%2013.3833%2021.7375%2014.6833%2021.2125%2015.9C20.6875%2017.1167%2019.975%2018.175%2019.075%2019.075C18.175%2019.975%2017.1167%2020.6875%2015.9%2021.2125C14.6833%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0167%204.6625%2015.7833%205.9875%2017.3C7.3125%2018.8167%208.98333%2019.7%2011%2019.95ZM17.9%2017.4C18.2333%2017.0333%2018.5333%2016.6375%2018.8%2016.2125C19.0667%2015.7875%2019.2875%2015.3458%2019.4625%2014.8875C19.6375%2014.4292%2019.7708%2013.9583%2019.8625%2013.475C19.9542%2012.9917%2020%2012.5%2020%2012C20%2010.3667%2019.5458%208.875%2018.6375%207.525C17.7292%206.175%2016.5167%205.2%2015%204.6V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.4333%2016%2016.825%2016.1292%2017.175%2016.3875C17.525%2016.6458%2017.7667%2016.9833%2017.9%2017.4Z'%20fill='%23222631'/%3e%3c/svg%3e",Hm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18%2018C18.4167%2018%2018.7708%2017.8542%2019.0625%2017.5625C19.3542%2017.2708%2019.5%2016.9167%2019.5%2016.5C19.5%2016.0833%2019.3542%2015.7292%2019.0625%2015.4375C18.7708%2015.1458%2018.4167%2015%2018%2015C17.5833%2015%2017.2292%2015.1458%2016.9375%2015.4375C16.6458%2015.7292%2016.5%2016.0833%2016.5%2016.5C16.5%2016.9167%2016.6458%2017.2708%2016.9375%2017.5625C17.2292%2017.8542%2017.5833%2018%2018%2018ZM18%2021C18.5%2021%2018.9667%2020.8833%2019.4%2020.65C19.8333%2020.4167%2020.1917%2020.0917%2020.475%2019.675C20.0917%2019.4417%2019.6917%2019.2708%2019.275%2019.1625C18.8583%2019.0542%2018.4333%2019%2018%2019C17.5667%2019%2017.1417%2019.0542%2016.725%2019.1625C16.3083%2019.2708%2015.9083%2019.4417%2015.525%2019.675C15.8083%2020.0917%2016.1667%2020.4167%2016.6%2020.65C17.0333%2020.8833%2017.5%2021%2018%2021ZM9%208H15V6C15%205.16667%2014.7083%204.45833%2014.125%203.875C13.5417%203.29167%2012.8333%203%2012%203C11.1667%203%2010.4583%203.29167%209.875%203.875C9.29167%204.45833%209%205.16667%209%206V8ZM12.25%2022H6C5.45%2022%204.97917%2021.8042%204.5875%2021.4125C4.19583%2021.0208%204%2020.55%204%2020V10C4%209.45%204.19583%208.97917%204.5875%208.5875C4.97917%208.19583%205.45%208%206%208H7V6C7%204.61667%207.4875%203.4375%208.4625%202.4625C9.4375%201.4875%2010.6167%201%2012%201C13.3833%201%2014.5625%201.4875%2015.5375%202.4625C16.5125%203.4375%2017%204.61667%2017%206V8H18C18.55%208%2019.0208%208.19583%2019.4125%208.5875C19.8042%208.97917%2020%209.45%2020%2010V11.3C19.7%2011.2%2019.3875%2011.125%2019.0625%2011.075C18.7375%2011.025%2018.3833%2011%2018%2011V10H6V20H11.3C11.4333%2020.4%2011.5667%2020.7458%2011.7%2021.0375C11.8333%2021.3292%2012.0167%2021.65%2012.25%2022ZM18%2023C16.6167%2023%2015.4375%2022.5125%2014.4625%2021.5375C13.4875%2020.5625%2013%2019.3833%2013%2018C13%2016.6167%2013.4875%2015.4375%2014.4625%2014.4625C15.4375%2013.4875%2016.6167%2013%2018%2013C19.3833%2013%2020.5625%2013.4875%2021.5375%2014.4625C22.5125%2015.4375%2023%2016.6167%2023%2018C23%2019.3833%2022.5125%2020.5625%2021.5375%2021.5375C20.5625%2022.5125%2019.3833%2023%2018%2023Z'%20fill='%23222631'/%3e%3c/svg%3e",zm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6333%2022%209.34167%2021.7375%208.125%2021.2125C6.90833%2020.6875%205.84583%2019.9708%204.9375%2019.0625C4.02917%2018.1542%203.3125%2017.0917%202.7875%2015.875C2.2625%2014.6583%202%2013.3667%202%2012C2%2010.6167%202.2625%209.32083%202.7875%208.1125C3.3125%206.90417%204.02917%205.84583%204.9375%204.9375C5.84583%204.02917%206.90833%203.3125%208.125%202.7875C9.34167%202.2625%2010.6333%202%2012%202C12.5333%202%2013.0458%202.0375%2013.5375%202.1125C14.0292%202.1875%2014.5167%202.3%2015%202.45V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.45%2016%2016.8458%2016.1333%2017.1875%2016.4C17.5292%2016.6667%2017.7667%2017%2017.9%2017.4C18.55%2016.6667%2019.0625%2015.8458%2019.4375%2014.9375C19.8125%2014.0292%2020%2013.05%2020%2012C20%2011.8167%2019.9917%2011.65%2019.975%2011.5C19.9583%2011.35%2019.9333%2011.1833%2019.9%2011H21.95C21.9833%2011.1833%2022%2011.35%2022%2011.5V12C22%2013.3667%2021.7375%2014.6583%2021.2125%2015.875C20.6875%2017.0917%2019.9708%2018.1542%2019.0625%2019.0625C18.1542%2019.9708%2017.0958%2020.6875%2015.8875%2021.2125C14.6792%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0667%204.67083%2015.8458%206.0125%2017.3375C7.35417%2018.8292%209.01667%2019.7%2011%2019.95ZM18%209C17.7167%209%2017.4792%208.90417%2017.2875%208.7125C17.0958%208.52083%2017%208.28333%2017%208V5C17%204.71667%2017.0958%204.47917%2017.2875%204.2875C17.4792%204.09583%2017.7167%204%2018%204V3C18%202.45%2018.1958%201.97917%2018.5875%201.5875C18.9792%201.19583%2019.45%201%2020%201C20.55%201%2021.0208%201.19583%2021.4125%201.5875C21.8042%201.97917%2022%202.45%2022%203V4C22.2833%204%2022.5208%204.09583%2022.7125%204.2875C22.9042%204.47917%2023%204.71667%2023%205V8C23%208.28333%2022.9042%208.52083%2022.7125%208.7125C22.5208%208.90417%2022.2833%209%2022%209H18ZM19%204H21V3C21%202.71667%2020.9042%202.47917%2020.7125%202.2875C20.5208%202.09583%2020.2833%202%2020%202C19.7167%202%2019.4792%202.09583%2019.2875%202.2875C19.0958%202.47917%2019%202.71667%2019%203V4Z'%20fill='%23222631'/%3e%3c/svg%3e",Um="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6167%2022%209.31667%2021.7375%208.1%2021.2125C6.88333%2020.6875%205.825%2019.975%204.925%2019.075C4.025%2018.175%203.3125%2017.1167%202.7875%2015.9C2.2625%2014.6833%202%2013.3833%202%2012C2%2010.6167%202.2625%209.31667%202.7875%208.1C3.3125%206.88333%204.025%205.825%204.925%204.925C5.825%204.025%206.88333%203.3125%208.1%202.7875C9.31667%202.2625%2010.6167%202%2012%202C13.3833%202%2014.6833%202.2625%2015.9%202.7875C17.1167%203.3125%2018.175%204.025%2019.075%204.925C19.975%205.825%2020.6875%206.88333%2021.2125%208.1C21.7375%209.31667%2022%2010.6167%2022%2012C22%2013.3833%2021.7375%2014.6833%2021.2125%2015.9C20.6875%2017.1167%2019.975%2018.175%2019.075%2019.075C18.175%2019.975%2017.1167%2020.6875%2015.9%2021.2125C14.6833%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0167%204.6625%2015.7833%205.9875%2017.3C7.3125%2018.8167%208.98333%2019.7%2011%2019.95ZM17.9%2017.4C18.2333%2017.0333%2018.5333%2016.6375%2018.8%2016.2125C19.0667%2015.7875%2019.2875%2015.3458%2019.4625%2014.8875C19.6375%2014.4292%2019.7708%2013.9583%2019.8625%2013.475C19.9542%2012.9917%2020%2012.5%2020%2012C20%2010.3667%2019.5458%208.875%2018.6375%207.525C17.7292%206.175%2016.5167%205.2%2015%204.6V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.4333%2016%2016.825%2016.1292%2017.175%2016.3875C17.525%2016.6458%2017.7667%2016.9833%2017.9%2017.4Z'%20fill='%233E5DE7'/%3e%3c/svg%3e",Wm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18%2018C18.4167%2018%2018.7708%2017.8542%2019.0625%2017.5625C19.3542%2017.2708%2019.5%2016.9167%2019.5%2016.5C19.5%2016.0833%2019.3542%2015.7292%2019.0625%2015.4375C18.7708%2015.1458%2018.4167%2015%2018%2015C17.5833%2015%2017.2292%2015.1458%2016.9375%2015.4375C16.6458%2015.7292%2016.5%2016.0833%2016.5%2016.5C16.5%2016.9167%2016.6458%2017.2708%2016.9375%2017.5625C17.2292%2017.8542%2017.5833%2018%2018%2018ZM18%2021C18.5%2021%2018.9667%2020.8833%2019.4%2020.65C19.8333%2020.4167%2020.1917%2020.0917%2020.475%2019.675C20.0917%2019.4417%2019.6917%2019.2708%2019.275%2019.1625C18.8583%2019.0542%2018.4333%2019%2018%2019C17.5667%2019%2017.1417%2019.0542%2016.725%2019.1625C16.3083%2019.2708%2015.9083%2019.4417%2015.525%2019.675C15.8083%2020.0917%2016.1667%2020.4167%2016.6%2020.65C17.0333%2020.8833%2017.5%2021%2018%2021ZM9%208H15V6C15%205.16667%2014.7083%204.45833%2014.125%203.875C13.5417%203.29167%2012.8333%203%2012%203C11.1667%203%2010.4583%203.29167%209.875%203.875C9.29167%204.45833%209%205.16667%209%206V8ZM12.25%2022H6C5.45%2022%204.97917%2021.8042%204.5875%2021.4125C4.19583%2021.0208%204%2020.55%204%2020V10C4%209.45%204.19583%208.97917%204.5875%208.5875C4.97917%208.19583%205.45%208%206%208H7V6C7%204.61667%207.4875%203.4375%208.4625%202.4625C9.4375%201.4875%2010.6167%201%2012%201C13.3833%201%2014.5625%201.4875%2015.5375%202.4625C16.5125%203.4375%2017%204.61667%2017%206V8H18C18.55%208%2019.0208%208.19583%2019.4125%208.5875C19.8042%208.97917%2020%209.45%2020%2010V11.3C19.7%2011.2%2019.3875%2011.125%2019.0625%2011.075C18.7375%2011.025%2018.3833%2011%2018%2011V10H6V20H11.3C11.4333%2020.4%2011.5667%2020.7458%2011.7%2021.0375C11.8333%2021.3292%2012.0167%2021.65%2012.25%2022ZM18%2023C16.6167%2023%2015.4375%2022.5125%2014.4625%2021.5375C13.4875%2020.5625%2013%2019.3833%2013%2018C13%2016.6167%2013.4875%2015.4375%2014.4625%2014.4625C15.4375%2013.4875%2016.6167%2013%2018%2013C19.3833%2013%2020.5625%2013.4875%2021.5375%2014.4625C22.5125%2015.4375%2023%2016.6167%2023%2018C23%2019.3833%2022.5125%2020.5625%2021.5375%2021.5375C20.5625%2022.5125%2019.3833%2023%2018%2023Z'%20fill='%23304DDF'/%3e%3c/svg%3e",Zm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6333%2022%209.34167%2021.7375%208.125%2021.2125C6.90833%2020.6875%205.84583%2019.9708%204.9375%2019.0625C4.02917%2018.1542%203.3125%2017.0917%202.7875%2015.875C2.2625%2014.6583%202%2013.3667%202%2012C2%2010.6167%202.2625%209.32083%202.7875%208.1125C3.3125%206.90417%204.02917%205.84583%204.9375%204.9375C5.84583%204.02917%206.90833%203.3125%208.125%202.7875C9.34167%202.2625%2010.6333%202%2012%202C12.5333%202%2013.0458%202.0375%2013.5375%202.1125C14.0292%202.1875%2014.5167%202.3%2015%202.45V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.45%2016%2016.8458%2016.1333%2017.1875%2016.4C17.5292%2016.6667%2017.7667%2017%2017.9%2017.4C18.55%2016.6667%2019.0625%2015.8458%2019.4375%2014.9375C19.8125%2014.0292%2020%2013.05%2020%2012C20%2011.8167%2019.9917%2011.65%2019.975%2011.5C19.9583%2011.35%2019.9333%2011.1833%2019.9%2011H21.95C21.9833%2011.1833%2022%2011.35%2022%2011.5V12C22%2013.3667%2021.7375%2014.6583%2021.2125%2015.875C20.6875%2017.0917%2019.9708%2018.1542%2019.0625%2019.0625C18.1542%2019.9708%2017.0958%2020.6875%2015.8875%2021.2125C14.6792%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0667%204.67083%2015.8458%206.0125%2017.3375C7.35417%2018.8292%209.01667%2019.7%2011%2019.95ZM18%209C17.7167%209%2017.4792%208.90417%2017.2875%208.7125C17.0958%208.52083%2017%208.28333%2017%208V5C17%204.71667%2017.0958%204.47917%2017.2875%204.2875C17.4792%204.09583%2017.7167%204%2018%204V3C18%202.45%2018.1958%201.97917%2018.5875%201.5875C18.9792%201.19583%2019.45%201%2020%201C20.55%201%2021.0208%201.19583%2021.4125%201.5875C21.8042%201.97917%2022%202.45%2022%203V4C22.2833%204%2022.5208%204.09583%2022.7125%204.2875C22.9042%204.47917%2023%204.71667%2023%205V8C23%208.28333%2022.9042%208.52083%2022.7125%208.7125C22.5208%208.90417%2022.2833%209%2022%209H18ZM19%204H21V3C21%202.71667%2020.9042%202.47917%2020.7125%202.2875C20.5208%202.09583%2020.2833%202%2020%202C19.7167%202%2019.4792%202.09583%2019.2875%202.2875C19.0958%202.47917%2019%202.71667%2019%203V4Z'%20fill='%233E5DE7'/%3e%3c/svg%3e",Ef=t=>{const{t:e}=X.useCunningham();return{t:r=>(t==null?void 0:t[r])??e(r)}},In=(t,e=!1)=>{switch(t){case"public":return b.jsx("img",{src:e?Um:Vm,alt:""});case"restricted":return b.jsx("img",{src:e?Wm:Hm,alt:""});case"authenticated":return b.jsx("img",{src:e?Zm:zm,alt:""});default:return null}},Gm=({linkReachChoices:t=[],canUpdate:e,linkReach:r="public",onUpdateLinkReach:n,showLinkRole:i=!1,linkRoleChoices:o=[],linkRole:a="reader",onUpdateLinkRole:l,customTranslations:s,topLinkReachMessage:c,topLinkRoleMessage:d})=>{const f=mr(),p=mr(),[g,y]=u.useState([r]),h=g[0],[v,m]=u.useState([a]),C=v[0],{t:E}=Ef(s),F=u.useMemo(()=>t.map(x=>({icon:x.icon??In(x.value),value:x.value,label:E("components.share.linkSettings.reach.choices."+x.value+".title"),...x})),[t]),D=u.useMemo(()=>F.find(x=>x.value===h),[F,h]),w=u.useMemo(()=>o.map(x=>({value:x.value,label:E("components.share.linkSettings.role.choices."+x.value+".title"),...x})),[o]),S=u.useMemo(()=>w.find(x=>x.value===C),[w,C]),O=i&&o.length>0,K=()=>b.jsx("div",{className:"c__share-modal__link-settings__content__select",children:e?b.jsx(Yr,{onSelectValue:x=>{y([x]),n==null||n(x)},options:F,isOpen:f.isOpen,topMessage:c,onOpenChange:f.setIsOpen,selectedValues:g,children:b.jsxs(X.Button,{variant:"tertiary",icon:In(h,!0),iconPosition:"left","data-testid":"share-link-reach-dropdown-button",onClick:()=>{e&&f.setIsOpen(!f.isOpen)},children:[D==null?void 0:D.label,b.jsx("span",{className:"material-icons",children:f.isOpen?"arrow_drop_up":"arrow_drop_down"})]})}):b.jsxs("span",{className:"c__share-modal__link-settings__content__select__value",children:[In(h),D==null?void 0:D.label]})}),V=()=>O?b.jsx("div",{className:"c__share-modal__link-settings__content__select-role",children:e?b.jsx(Yr,{onSelectValue:x=>{m([x]),l==null||l(x)},options:w,isOpen:p.isOpen,onOpenChange:p.setIsOpen,selectedValues:v,topMessage:d,children:b.jsx(X.Button,{variant:"tertiary","data-testid":"share-link-role-dropdown-button",icon:b.jsx("span",{className:"material-icons",children:p.isOpen?"arrow_drop_up":"arrow_drop_down"}),iconPosition:"right",onClick:()=>{e&&p.setIsOpen(!p.isOpen)},size:"small",children:S==null?void 0:S.label})}):b.jsxs("span",{className:"c__share-modal__link-settings__content__select-role__value",children:[In(C,!0),S==null?void 0:S.label]})}):null;return b.jsxs("div",{className:"c__share-modal__link-settings","data-testid":"share-link-settings",children:[b.jsx("span",{className:"c__share-modal__link-settings__title",children:E("components.share.linkSettings.title")}),b.jsxs("div",{className:"c__share-modal__link-settings__content",children:[K(),b.jsx("div",{className:"c__share-modal__link-settings__content__description desktop",children:E(`components.share.linkSettings.reach.choices.${h}.description`)}),V()]}),b.jsx("div",{className:"c__share-modal__link-settings__content__description mobile",children:E(`components.share.linkSettings.reach.choices.${h}.description`)})]})},qm=({searchUsersResult:t,children:e,outsideSearchContent:r,accesses:n=[],invitations:i=[],hasNextMembers:o=!1,canUpdate:a=!0,canView:l=!0,hasNextInvitations:s=!1,hideInvitations:c=!1,hideMembers:d=!1,cannotViewChildren:f,customTranslations:p,...g})=>{var T,M;if(!(c&&d)){if(!g.invitationRoles)throw new Error("invitationRoles is required");if(!g.onSearchUsers)throw new Error("onSearchUsers is required")}if(!c&&!g.onInviteUser)throw new Error("onInviteUser is required");if(a&&!l)throw new Error("canView cannot be false if canUpdate is true");const{t:y}=X.useCunningham(),{isMobile:h}=ot(),v=u.useRef(null),[m,C]=u.useState("400px"),E=u.useRef(null),[F,D]=u.useState(""),[w,S]=u.useState(""),[O,K]=u.useState([]),[V,x]=u.useState(((M=(T=g.invitationRoles)==null?void 0:T[0])==null?void 0:M.value)??""),B=h?"calc(100dvh - 32px)":"min(690px, calc(100dvh - 2em - 12px - 32px))",U=j=>{if(v.current&&clearTimeout(v.current),j===""){S(""),g.onSearchUsers("");return}v.current=setTimeout(()=>{g.onSearchUsers(j),S(j)},300)},k=j=>{D(j),U(j)},W=w!==""||O.length>0,_=u.useCallback(j=>{K(H=>[...H,j]),D(""),S(""),g.onSearchUsers("")},[g]),I=j=>{K(H=>H.filter(Z=>Z.id!==j.id))},z=u.useMemo(()=>{const j=t==null?void 0:t.filter(G=>!O.includes(G));let H=y(w!==""?"components.share.user.no_result":"components.share.user.placeholder");const q=(G=>!!G.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z\-0-9]{2,}))$/))(w??"")&&!(j!=null&&j.some(G=>G.email===w)),Y={id:w,full_name:"",email:w};return q&&(H=void 0),{groupName:y("components.share.search.group_name"),elements:j??[],showWhenEmpty:!0,emptyString:H,endActions:q?[{content:b.jsx(Ta,{user:Y}),onSelect:()=>void _(Y)}]:void 0}},[t,w,y,O,_]),L=j=>{var le;const Z=(j==null?void 0:j.clientHeight)??0,q=((le=E.current)==null?void 0:le.clientHeight)??0,Y=`calc(${B} - ${Z}px - ${q}px - 70px - 10px)`;C(Y)},N=!c&&!W&&!g.loading&&i.length>0,R=!d&&!W&&!g.loading&&n.length>0,P=l?c&&d?"empty":"search":"cannot_view";return b.jsx(X.Modal,{title:g.modalTitle??y("components.share.modalTitle"),isOpen:g.isOpen,onClose:g.onClose,"aria-label":y("components.share.modalAriaLabel"),closeOnClickOutside:!0,size:h?X.ModalSize.FULL:X.ModalSize.LARGE,children:b.jsxs("div",{className:"c__share-modal no-padding",children:[a&&O.length>0&&b.jsx("div",{className:"c__share-modal__selected-users",ref:E,children:b.jsx(vf,{users:O,onRemoveUser:I,roles:g.invitationRoles,selectedRole:V,onSelectRole:x,onShare:()=>{g.onInviteUser(O,V),K([])}})}),P==="cannot_view"&&b.jsxs("div",{className:"c__share-modal__cannot-view",style:{height:m},children:[b.jsx("div",{className:"c__share-modal__cannot-view__content",children:b.jsx("p",{children:g.cannotViewMessage??y("components.share.cannot_view.message")})}),f]}),P==="search"&&b.jsx(b1,{onFilter:k,inputValue:F,showInput:a,loading:g.loading,placeholder:y("components.share.user.placeholder"),children:b.jsxs("div",{style:{height:m,overflowY:"auto"},children:[W&&b.jsx("div",{className:"c__share-modal__search-users","data-testid":"search-users-list",children:b.jsx(m1,{group:z,onSelect:j=>{_(j)},renderElement:j=>b.jsx(Ta,{user:j})})}),!W&&e,N&&b.jsxs("div",{className:"c__share-modal__invitations","data-testid":"invitations-list",children:[b.jsx("span",{className:"c__share-modal__invitations-title",children:y("components.share.invitations.title")}),i.map(j=>{var H;return b.jsx(Cf,{invitation:j,roles:g.invitationRoles,updateRole:g.onUpdateInvitation,deleteInvitation:g.onDeleteInvitation,canUpdate:a,roleTopMessage:(H=g.invitationRoleTopMessage)==null?void 0:H.call(g,j)},j.id)}),b.jsx(w2,{show:s,onShowMore:g.onLoadNextInvitations})]}),R&&b.jsxs("div",{className:"c__share-modal__members","data-testid":"members-list",children:[b.jsx("span",{className:"c__share-modal__members-title",children:y(n.length>1?"components.share.members.title_plural":"components.share.members.title_singular",{count:n.length})}),n.map(j=>{var H,Z;return b.jsx(yf,{accessData:j,accessRoleKey:g.accessRoleKey??"role",canUpdate:a,roleTopMessage:(H=g.accessRoleTopMessage)==null?void 0:H.call(g,j),roles:((Z=g.getAccessRoles)==null?void 0:Z.call(g,j))??g.invitationRoles,updateRole:g.onUpdateAccess,deleteAccess:g.onDeleteAccess},j.id)}),b.jsx(w2,{show:o,onShowMore:g.onLoadNextMembers})]})]})}),b.jsx("div",{ref:L,children:!W&&b.jsxs("div",{className:"c__share-modal__footer",children:[g.linkSettings&&b.jsx(Gm,{linkReachChoices:g.linkReachChoices,canUpdate:a,onUpdateLinkReach:g.onUpdateLinkReach,linkReach:g.linkReach,linkRoleChoices:g.linkRoleChoices,linkRole:g.linkRole,onUpdateLinkRole:g.onUpdateLinkRole,showLinkRole:g.showLinkRole,customTranslations:p,topLinkReachMessage:g.topLinkReachMessage,topLinkRoleMessage:g.topLinkRoleMessage}),r]})})]})})},w2=({show:t,onShowMore:e})=>{const{t:r}=X.useCunningham();return t?b.jsx("div",{className:"c__share-modal__show-more-button",children:b.jsx(X.Button,{variant:"tertiary",size:"small",icon:b.jsx("span",{className:"material-icons",children:"arrow_downward"}),onClick:e,children:r("components.share.members.load_more")})}):null},Ym=({onCopyLink:t,onOk:e})=>{const{t:r}=X.useCunningham();return b.jsxs("div",{className:"c__share-modal__copy-link-footer",children:[b.jsx(X.Button,{variant:"secondary",icon:b.jsx("span",{className:"material-icons",children:"link"}),onClick:t,children:r("components.share.copyLink")}),b.jsx(X.Button,{variant:"primary",onClick:e,children:r("components.share.ok")})]})},wf=({user:t,settingsItems:e,showSettings:r,actions:n,termOfServiceUrl:i})=>{const o=!!n||!!i,{t:a}=X.useCunningham(),l=t?t.full_name??t.email:void 0,s=l?Al(l):void 0;return t?b.jsx(b.Fragment,{children:b.jsxs("div",{className:"user-menu__content__body",children:[b.jsxs("div",{className:"user-menu__content__body__user-info",style:{"--gradient-color":`var(--c--contextuals--background--palette--${s}--primary)`},children:[b.jsx(Gi,{fullName:l}),b.jsx("div",{className:"user-menu__content__identity__name",children:t.full_name?b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"user-menu__content__identity__name",children:b.jsx("strong",{children:t.full_name})}),b.jsx("p",{className:"user-menu__content__identity__email",children:t.email})]}):b.jsx("p",{className:"user-menu__content__identity__email",children:b.jsx("strong",{children:t.email})})})]}),r&&b.jsxs(b.Fragment,{children:[b.jsx(an,{withPadding:!1}),b.jsx("div",{className:"user-menu__content__body__settings",children:e.map(c=>b.jsx(xf,{label:c.label,icon:c.icon,onClick:c.onClick},c.label))})]}),o&&b.jsxs(b.Fragment,{children:[b.jsx(an,{withPadding:!1}),b.jsxs("div",{className:"user-menu__actions user-menu__actions--mobile",children:[n&&b.jsx("div",{className:"user-menu__actions__left",children:n}),i&&b.jsx("div",{className:"user-menu__actions__right",children:b.jsx(X.Button,{variant:"tertiary",target:"_blank",href:i,size:"small",color:"neutral",children:a("components.userMenu.term_of_service")})})]})]})]})}):null},Xm=({...t})=>{const{t:e}=X.useCunningham(),r=Sf();return b.jsxs(b.Fragment,{children:[b.jsx(Df,{user:t.user,...r}),b.jsx(X.Modal,{isOpen:r.openState,onClose:()=>r.setOpenState(!1),"aria-label":e("components.userMenu.dialogTitle"),size:X.ModalSize.FULL,children:b.jsxs("div",{className:"user-menu__popover user-menu__popover--mobile",children:[b.jsx(X.Button,{variant:"tertiary",className:"user-menu__close-button",onClick:r.toggleUserMenu,"aria-label":e("components.userMenu.close"),color:"neutral",icon:b.jsx(Jr,{name:"close"}),size:"small"}),b.jsx(wf,{...t}),b.jsx("div",{className:"user-menu__footer--mobile",children:b.jsx(X.Button,{variant:"primary",onClick:r.toggleUserMenu,children:e("components.share.ok")})})]})})]})},Jm=({user:t,settingsItems:e,showSettings:r,actions:n,termOfServiceUrl:i})=>{const{t:o}=X.useCunningham(),a=Sf();return b.jsxs(b.Fragment,{children:[b.jsx(Df,{user:t,...a}),b.jsx(Pi,{className:"c__dropdown-menu user-menu__popover",triggerRef:a.triggerRef,isOpen:a.openState,onOpenChange:a.setOpenState,children:b.jsx(Rh,{"aria-label":o("components.userMenu.dialogTitle"),children:b.jsx(wf,{user:t,settingsItems:e,showSettings:r,actions:n,termOfServiceUrl:i})})})]})},Qm=({user:t,settingsCTA:e,logout:r,termOfServiceUrl:n,actions:i})=>{const{t:o}=X.useCunningham(),{isTablet:a}=ot(),l=u.useMemo(()=>{const c=[];return e&&c.push({label:o("components.userMenu.manage_account"),icon:"settings",onClick:typeof e=="function"?e:typeof e=="string"?()=>window.open(e,"_blank","noopener,noreferrer"):void 0}),r&&c.push({label:o("components.userMenu.logout"),icon:"logout",onClick:r}),c},[e,r,o]),s=l.length>0;return t?b.jsx(b.Fragment,{children:a?b.jsx(Xm,{user:t,settingsItems:l,showSettings:s,actions:i,termOfServiceUrl:n}):b.jsx(Jm,{user:t,settingsItems:l,showSettings:s,actions:i,termOfServiceUrl:n})}):null},xf=({label:t,icon:e,onClick:r})=>b.jsxs("div",{className:"user-menu__item",onClick:r,children:[b.jsx(Jr,{name:e}),b.jsx("span",{className:"user-menu__item__label",children:t})]}),Df=({user:t,triggerRef:e,id:r,openState:n,toggleUserMenu:i})=>{const{t:o}=X.useCunningham();return t?b.jsx(X.Button,{variant:"tertiary",size:"small",ref:e,id:r,onClick:i,"aria-label":o(n?"components.userMenu.close":"components.userMenu.open"),title:o(n?"components.userMenu.close":"components.userMenu.open"),children:b.jsx(Gi,{fullName:t.full_name??t.email})}):null},Sf=()=>{const t=u.useId(),[e,r]=u.useState(!1),n=()=>{r(!e)},i=u.useRef(null);return{id:t,openState:e,setOpenState:r,toggleUserMenu:n,triggerRef:i}},Tl=(t,e)=>e&&t.activeIcon?t.activeIcon:t.icon,Ff=u.forwardRef(({step:t,isActive:e,onClick:r,index:n,ariaLabel:i},o)=>{const a=Tl(t,e);return b.jsxs("button",{ref:o,type:"button",className:ve("c__onboarding-modal__step",{"c__onboarding-modal__step--active":e}),onClick:r,"aria-current":e?"step":void 0,"aria-label":i,tabIndex:e?0:-1,"data-testid":`onboarding-step-${n}`,children:[b.jsx("div",{className:"c__onboarding-modal__step__icon","aria-hidden":"true",children:a}),b.jsxs("div",{className:"c__onboarding-modal__step__content",children:[b.jsx("span",{className:"c__onboarding-modal__step__title",children:t.title}),t.description&&b.jsx("div",{className:"c__onboarding-modal__step__description-wrapper",children:b.jsx("span",{className:"c__onboarding-modal__step__description",children:t.description})})]})]})});Ff.displayName="OnboardingStepItem";const ey=200,$f=({isOpen:t,size:e=X.ModalSize.LARGE,appName:r,mainTitle:n,steps:i,initialStep:o=0,footerLink:a,hideContent:l,onSkip:s,onComplete:c,onClose:d,labels:f})=>{const{t:p}=X.useCunningham(),{isMobile:g}=ot(),[y,h]=u.useState(o),[v,m]=u.useState(o),[C,E]=u.useState(!1),F=u.useRef([]),D=u.useRef(null),w=u.useRef(null),S=y===i.length-1,O=y===0,K=(f==null?void 0:f.skip)??p("components.onboarding.skip"),V=(f==null?void 0:f.next)??p("components.onboarding.next"),x=(f==null?void 0:f.previous)??p("components.onboarding.previous"),B=(f==null?void 0:f.complete)??p("components.onboarding.complete"),U=i[v],k=!l&&!!(U!=null&&U.content),W=u.useCallback((T,M)=>{const j=p("components.onboarding.stepLabel").replace("{current}",String(T+1)).replace("{total}",String(i.length)).replace("{title}",M);return T===y?j+p("components.onboarding.currentStepSuffix"):j},[p,i.length,y]),_=u.useCallback(()=>p("components.onboarding.contentRegionLabel").replace("{current}",String(v+1)).replace("{total}",String(i.length)),[p,v,i.length]);u.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]),u.useEffect(()=>{const T=F.current[y];T&&T.scrollIntoView({behavior:"smooth",block:"nearest"})},[y]),u.useEffect(()=>{if(t){w.current&&(clearTimeout(w.current),w.current=null),h(o),m(o),E(!1);const T=setTimeout(()=>{requestAnimationFrame(()=>{const M=F.current[o];M&&!g&&M.focus()})},150);return()=>clearTimeout(T)}},[t,o,g]);const I=u.useCallback(T=>{T!==y&&(w.current&&clearTimeout(w.current),E(!0),h(T),w.current=setTimeout(()=>{m(T),E(!1),w.current=null},ey))},[y]);u.useEffect(()=>{const T=D.current;if(!T)return;const M=j=>{if(j.key!=="ArrowUp"&&j.key!=="ArrowDown"||!j.target.closest(".c__onboarding-modal__step"))return;j.preventDefault();const Z=j.key==="ArrowDown"?(y+1)%i.length:(y-1+i.length)%i.length;I(Z),setTimeout(()=>{var q;(q=F.current[Z])==null||q.focus()},0)};return T.addEventListener("keydown",M),()=>T.removeEventListener("keydown",M)},[y,i.length,I]);const z=u.useCallback(()=>{S?c():I(y+1)},[S,c,I,y]),L=u.useCallback(()=>{O||I(y-1)},[O,I,y]),N=u.useCallback(()=>{s==null||s()},[s]);if(i.length===0)return null;const R=Math.max(0,Math.min(o,i.length-1));R!==o&&process.env.NODE_ENV==="development"&&console.warn(`OnboardingModal: initialStep (${o}) is out of bounds. Using ${R} instead.`);const $=a?b.jsxs("a",{className:"c__onboarding-modal__footer-link",href:a.href,onClick:T=>{a.onClick&&(a.href||T.preventDefault(),a.onClick())},children:[b.jsx("span",{className:"material-icons","aria-hidden":"true",children:"info"}),b.jsx("span",{className:"c__onboarding-modal__footer-link__label",children:a.label})]}):void 0,P=b.jsxs(b.Fragment,{children:[g&&!O&&b.jsx(X.Button,{variant:"secondary",onClick:L,"data-testid":"onboarding-previous",children:x}),s&&b.jsx(X.Button,{variant:"tertiary",onClick:N,"data-testid":"onboarding-skip",children:K}),b.jsx(X.Button,{variant:"primary",onClick:z,"data-testid":"onboarding-next",children:S?B:V})]});return b.jsx(X.Modal,{isOpen:t,onClose:d,size:g?X.ModalSize.FULL:e,closeOnClickOutside:!0,title:"","aria-label":n,leftActions:$,rightActions:P,children:b.jsxs("div",{className:"c__onboarding-modal","data-testid":"onboarding-modal",children:[b.jsxs("div",{className:"c__onboarding-modal__header",children:[r&&b.jsx("div",{className:"c__onboarding-modal__app-name",children:r}),b.jsx("h2",{className:"c__onboarding-modal__main-title",children:n})]}),b.jsxs("div",{className:ve("c__onboarding-modal__body",{"c__onboarding-modal__body--text-only":!k}),children:[b.jsx("div",{ref:D,className:"c__onboarding-modal__steps",role:"tablist","aria-orientation":"vertical","aria-label":n,children:i.map((T,M)=>b.jsx(Ff,{ref:j=>{F.current[M]=j},step:T,index:M,totalSteps:i.length,isActive:M===y,ariaLabel:W(M,T.title),onClick:()=>I(M)},M))}),k&&b.jsx("div",{className:"c__onboarding-modal__content",role:"tabpanel","aria-live":"polite","aria-atomic":"true","aria-label":_(),children:b.jsx("div",{className:ve("c__onboarding-modal__content-inner",{"c__onboarding-modal__content-inner--fading":C}),children:U==null?void 0:U.content})}),(k||l)&&b.jsxs("div",{className:"c__onboarding-modal__mobile-step",children:[b.jsx("div",{className:"c__onboarding-modal__mobile-step__icon","aria-hidden":"true",children:U&&Tl(U,!0)}),b.jsxs("div",{className:"c__onboarding-modal__mobile-step__content",children:[b.jsx("span",{className:"c__onboarding-modal__mobile-step__title",children:U==null?void 0:U.title}),(U==null?void 0:U.description)&&b.jsx("span",{className:"c__onboarding-modal__mobile-step__description",children:U.description})]})]})]})]})})},ty=({steps:t,...e})=>b.jsx($f,{...e,steps:t,size:X.ModalSize.MEDIUM,hideContent:!0}),ry=(t,e={})=>Ti.getThemesFromGlobals(gr(Xr,t),{...e,overrides:gr(ki,e.overrides??{})});Object.defineProperty(exports,"ModalSize",{enumerable:!0,get:()=>X.ModalSize});exports.AVATAR_COLORS=Aa;exports.AccessRoleDropdown=Zi;exports.Badge=jm;exports.ContextMenu=qh;exports.ContextMenuProvider=Gh;exports.CunninghamProvider=Bf;exports.CustomTabs=vg;exports.DropdownMenu=Yr;exports.Filter=Jh;exports.Footer=Xh;exports.Header=cd;exports.Hero=e7;exports.HomeGutter=t7;exports.HorizontalSeparator=an;exports.Icon=Jr;exports.IconSize=De;exports.IconType=ii;exports.InvitationUserSelectorItem=bf;exports.InvitationUserSelectorList=vf;exports.LaGaufre=f7;exports.LaGaufreV2=od;exports.Label=Id;exports.LanguagePicker=sd;exports.LeftPanel=ud;exports.MainLayout=np;exports.OnboardingModal=$f;exports.ProConnectButton=S2;exports.QuickSearch=b1;exports.QuickSearchGroup=m1;exports.QuickSearchInput=v1;exports.QuickSearchItem=Bn;exports.QuickSearchItemTemplate=Ki;exports.ReleaseNoteModal=ty;exports.SearchUserItem=Ta;exports.ShareInvitationItem=Cf;exports.ShareMemberItem=yf;exports.ShareModal=qm;exports.ShareModalCopyLinkFooter=Ym;exports.Spinner=li;exports.TreeApi=pr;exports.TreeContext=_l;exports.TreeProvider=Sm;exports.TreeView=Fm;exports.TreeViewItem=Lm;exports.TreeViewMoveModeEnum=wt;exports.TreeViewNodeTypeEnum=se;exports.TreeViewSeparator=df;exports.UserAvatar=Gi;exports.UserMenu=Qm;exports.UserMenuItem=xf;exports.UserRow=qi;exports.VerticalSeparator=gg;exports.WithLabel=op;exports.anctGlobals=id;exports.containerSizeMap=ld;exports.cunninghamConfig=fa;exports.dsfrGlobals=nd;exports.getContainerSize=x7;exports.getIconSize=D7;exports.getStepIcon=Tl;exports.getUIKitThemesFromGlobals=ry;exports.getUserColor=Al;exports.getUserInitials=mf;exports.headerHeight=ip;exports.iconSizeMap=ad;exports.isNode=zr;exports.isSeparator=fi;exports.isTitle=hi;exports.isViewMore=ff;exports.locales=D2;exports.useArrowRoving=Km;exports.useContextMenuContext=Qu;exports.useCustomTranslations=Ef;exports.useDropdownMenu=mr;exports.useResponsive=ot;exports.useTree=hf;exports.useTreeContext=Pl;exports.whiteLabelGlobals=rd;
98
+ Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,r]=ym(t.initialData);return Object.assign(Object.assign(Object.assign({},t),r),{data:e})}else return t}function Em(t,e){const r=Cm(t);return b.jsxs(dm,{treeProps:r,imperativeHandle:e,children:[b.jsx(hm,{children:b.jsx(pm,{})}),b.jsx(gm,{})]})}const wm=u.forwardRef(Em),df=({top:t,left:e})=>b.jsx("div",{className:"c__tree-view__cursor",style:{top:t-2,left:e+10,width:`calc(100% - ${24+e}px)`}});function xm(t,e){var r=u.useRef(null),n=u.useRef(null);n.current=e;var i=u.useRef(null);u.useEffect(function(){o()});var o=u.useCallback(function(){var a=i.current,l=n.current,s=a||(l?l instanceof Element?l:l.current:null);r.current&&r.current.element===s&&r.current.subscriber===t||(r.current&&r.current.cleanup&&r.current.cleanup(),r.current={element:s,subscriber:t,cleanup:s?t(s):void 0})},[t]);return u.useEffect(function(){return function(){r.current&&r.current.cleanup&&(r.current.cleanup(),r.current=null)}},[]),u.useCallback(function(a){i.current=a,o()},[o])}function p2(t,e,r){return t[e]?t[e][0]?t[e][0][r]:t[e][r]:e==="contentBoxSize"?t.contentRect[r==="inlineSize"?"width":"height"]:void 0}function Dm(t){t===void 0&&(t={});var e=t.onResize,r=u.useRef(void 0);r.current=e;var n=t.round||Math.round,i=u.useRef(),o=u.useState({width:void 0,height:void 0}),a=o[0],l=o[1],s=u.useRef(!1);u.useEffect(function(){return s.current=!1,function(){s.current=!0}},[]);var c=u.useRef({width:void 0,height:void 0}),d=xm(u.useCallback(function(f){return(!i.current||i.current.box!==t.box||i.current.round!==n)&&(i.current={box:t.box,round:n,instance:new ResizeObserver(function(p){var g=p[0],y=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=p2(g,y,"inlineSize"),v=p2(g,y,"blockSize"),m=h?n(h):void 0,C=v?n(v):void 0;if(c.current.width!==m||c.current.height!==C){var E={width:m,height:C};c.current.width=m,c.current.height=C,r.current?r.current(E):s.current||l(E)}})}),i.current.instance.observe(f,{box:t.box}),function(){i.current&&i.current.instance.unobserve(f)}},[t.box,n]),t.ref);return u.useMemo(function(){return{ref:d,width:a.width,height:a.height}},[d,a.width,a.height])}var se=(t=>(t.NODE="node",t.SEPARATOR="separator",t.TITLE="title",t.SIMPLE_NODE="simpleNode",t.VIEW_MORE="viewMore",t))(se||{}),wt=(t=>(t.FIRST_CHILD="first-child",t.LAST_CHILD="last-child",t.LEFT="left",t.RIGHT="right",t))(wt||{});const fi=t=>t?t.nodeType===se.SEPARATOR:!1,hi=t=>t?t.nodeType===se.TITLE:!1,ff=t=>t?t.nodeType===se.VIEW_MORE:!1,zr=t=>!fi(t)&&!hi(t)&&!ff(t),hf=(t,e,r)=>{const{t:n}=X.useCunningham(),{remove:i,update:o,insert:a,insertBefore:l,insertAfter:s,append:c,prepend:d,getItem:f,move:p,items:g}=dh({initialItems:JSON.parse(JSON.stringify(t)),getKey:R=>R.id,getChildren:R=>R.children||[]}),[y,h]=u.useState(),v=(R=[])=>{const $=g.map(T=>T.key);i(...$);const P=JSON.parse(JSON.stringify(R));P.length>0&&a(null,0,...P),h(void 0)},m=R=>{const $=f(R);$&&h($.value)},C=(R,$,P)=>{var T,M,j,H;if(R){const Z=f(R);if(Z){const q=(M=Z.children)==null?void 0:M[((T=Z.children)==null?void 0:T.length)-1];let Y=P??((j=Z.children)==null?void 0:j.length)??0;P===((H=Z.children)==null?void 0:H.length)&&q&&q.value.nodeType===se.VIEW_MORE&&(Y=Y-1),a(R,Y,$)}}else a(null,P??g.length,$)},E=R=>{var $;return($=f(R))==null?void 0:$.value},F=(R,$)=>{var Z,q;const P=f(R);if(!P){console.error("No item found");return}let T=((Z=P.children)==null?void 0:Z.map(Y=>Y.value))??null;const M=$.childrenCount??P.value.childrenCount??0;if((T==null?void 0:T.length)===0&&M>0&&(T=null),$.children){const Y=[...T??[],...$.children],le=new Map;for(const G of Y)le.set(G.id,G);T=Array.from(le.values())}T&&(T=T.sort((Y,le)=>Y.nodeType===se.VIEW_MORE&&le.nodeType!==se.VIEW_MORE?1:Y.nodeType!==se.VIEW_MORE&&le.nodeType===se.VIEW_MORE?-1:0));const j=((q=$.pagination)==null?void 0:q.hasMore)??!1;T&&(T=T.filter(Y=>Y.nodeType!==se.VIEW_MORE)),j&&T&&T.push({id:`view-more-${R}`,nodeType:se.VIEW_MORE,label:n("components.treeView.viewMore")});const H={...P.value,...$,children:T,childrenCount:(T==null?void 0:T.length)??M};o(R,H)},D=R=>{i(R)},w=R=>{i(...R)},S=async R=>{if(!e){console.error("No refresh callback provided");return}try{const $=await e(R);F(R,$)}catch($){console.error("error while refreshing node:",$)}},O=(R,$)=>{a(null,$??g.length,R)},K=(R,$)=>{a(null,$??g.length,...R)},V=(R,$)=>{const P=f(R);if(!P){console.error("No item found");return}const T={...P.value,children:$,childrenCount:$.length,hasLoadedChildren:$.length>0};o(R,T)},x=R=>{const $=[],P=f(R);if(!P)return[];$.push(P.value);const T=M=>{const j=B(M);if(!j)return;const H=f(j);H&&($.push(H.value),T(j))};return T(R),$.reverse()},B=R=>{var $;return(($=f(R))==null?void 0:$.parentKey)??null},U=R=>{const $=B(R);if(!$)return null;const P=f($);return P?P.value:null},k=(R,$)=>{l(R,$)},W=(R,$)=>{s(R,$)},_=(R,$)=>{c(R,$)},I=(R,$)=>{d(R,$)},z=(R,$,P)=>{p(R,$,P)},L=R=>{z(R.sourceId,R.newParentId,R.index)},N=async R=>{var Y;if(!r)return console.error("No load paginated children callback provided"),[];const $=f(R);if(!$){console.error("No parent found");return}const T=(((Y=$==null?void 0:$.value.pagination)==null?void 0:Y.currentPage)??0)+1,M=await r(R,T);if(!M){console.error("No result found");return}const j=M.children,H=M.pagination,Z=T,q=(H==null?void 0:H.hasMore)??!1;F(R,{children:j,hasLoadedChildren:!0,pagination:{currentPage:Z,hasMore:q}})};return u.useEffect(()=>{const R=$=>{$.forEach(P=>{var T;if(P.children&&P.children.length>0){const M=P.value.hasLoadedChildren||((T=P.children)==null?void 0:T.length)>0||P.value.children&&P.value.children.length>0;P.value.children=P.children.map(H=>H.value);const j=M?P.children.length:P.value.childrenCount??0;P.value.childrenCount=j,M&&!P.value.hasLoadedChildren&&(P.value.hasLoadedChildren=!0),R(P.children)}else{const j=P.value.hasLoadedChildren||P.value.children&&P.value.children.length>0?0:P.value.childrenCount;P.value.children=[],P.value.childrenCount=j}})};R(g)},[g]),{nodes:g,addChild:C,updateNode:F,deleteNode:D,deleteNodes:w,addRootNode:O,addRootNodes:K,selectedNode:y,setSelectedNode:h,refreshNode:S,setChildren:V,insertBeforeNode:k,insertAfterNode:W,handleMove:L,prependToNode:I,moveNode:z,appendToNode:_,move:p,resetTree:v,handleLoadChildren:N,selectNodeById:m,getParent:U,getNode:E,getParentId:B,getAncestors:x}},_l=u.createContext(null),Sm=({children:t,onRefresh:e,initialNodeId:r,onLoadChildren:n,initialTreeData:i})=>{const o=u.useRef(null),[a,l]=u.useState(null),[s,c]=u.useState(r??null),d=hf(i??[],e,n);return b.jsx(_l.Provider,{value:{treeApiRef:o,treeData:d,root:a,initialTargetId:s,setInitialTargetId:c,setRoot:l},children:t})},Pl=()=>{const t=u.useContext(_l);if(!t)throw new Error("TreeContext not found");return t},Fm=({initialOpenState:t,dndRootElement:e,selectedNodeId:r,rootNodeId:n,renderNode:i,canDrop:o,canDrag:a,afterMove:l,beforeMove:s,paddingTop:c=10,paddingBottom:d=10,rowProps:f})=>{const[p,g]=u.useState(400),{ref:y,width:h}=Dm(),v=Pl(),m=(v==null?void 0:v.treeData.nodes)??[];u.useEffect(()=>{const D=document.querySelector(".c__tree-view"),w=D==null?void 0:D.firstElementChild;let S=null;return D&&w&&(S=new ResizeObserver(()=>{if(w&&w instanceof HTMLElement){const O=w.style.height;g(parseInt(O,10)+20)}}),S.observe(w)),()=>S==null?void 0:S.disconnect()},[]);const C=D=>{var $,P,T,M;const w=JSON.parse(JSON.stringify(m)),S=D.dragNodes[0],O=D.parentId?(($=D.parentNode)==null?void 0:$.data.children)??[]:w,K=D.dragNodes[0].data.value.id,V=D.dragNodes[0].data,x=(P=D.parentNode)==null?void 0:P.data;if((x==null?void 0:x.value.nodeType)===se.TITLE||(x==null?void 0:x.value.nodeType)===se.SEPARATOR||(x==null?void 0:x.value.nodeType)===se.VIEW_MORE)return null;const B=V.parentKey??n,U=D.parentId??n;let k=D.index+0,W=null,_=U;const I=((M=(T=S.parent)==null?void 0:T.children)==null?void 0:M.findIndex(j=>j.data.value.id===K))??0;if(B===U){if(I===k)return null;k=k<I?k:k-1}const z=D.index-1,L=O[z],N=D.index,R=O[N];return D.index===0?(_=D.parentId??n,W=wt.FIRST_CHILD):!x&&D.index===1&&!zr(L.value)?(_=n,k=1,W=wt.FIRST_CHILD):D.index===O.length?(_=_??n,W=wt.LAST_CHILD):L&&zr(L.value)?(_=L.value.id,W=wt.RIGHT):R&&zr(R.value)&&(W=wt.LEFT,_=R.value.id),W&&_?{targetModeId:_,mode:W,oldParentId:B,index:k,newParentId:D.parentId,sourceId:K}:null},E=D=>{const w=C(D);w&&(s?s(w,()=>{v==null||v.treeData.handleMove(w),l==null||l(w)}):(v==null||v.treeData.handleMove(w),l==null||l(w)))},F=u.useCallback(D=>a?!a(D):!1,[a]);if(v)return b.jsx("div",{ref:y,style:{height:p},className:"c__tree-view--container",children:b.jsx(wm,{dndRootElement:e,data:m,ref:v.treeApiRef,openByDefault:!1,selectionFollowsFocus:!1,disableMultiSelection:!0,disableEdit:!0,className:"c__tree-view",idAccessor:"key",onMove:E,height:p,width:h,paddingTop:c,paddingBottom:d,rowHeight:34,disableDrag:F,disableDrop:({parentNode:D,dragNodes:w,index:S})=>{var B,U,k;if(o&&!o({parentNode:D,dragNodes:w,index:S}))return D.id!=="__REACT_ARBORIST_INTERNAL_ROOT__"&&(D.data.value.canDrop=!1),!0;const O=w[0];if(O&&O.isDragging&&O.willReceiveDrop||((B=D.data.value)==null?void 0:B.nodeType)===se.TITLE||((U=D.data.value)==null?void 0:U.nodeType)===se.SEPARATOR||((k=D.data.value)==null?void 0:k.nodeType)===se.VIEW_MORE)return!0;if(D.id==="__REACT_ARBORIST_INTERNAL_ROOT__"){const W=m[S-1],_=m[S],I=m[S+1],z=fi(W==null?void 0:W.value),L=fi(_==null?void 0:_.value),N=hi(W==null?void 0:W.value),R=hi(_==null?void 0:_.value),$=zr(I==null?void 0:I.value);return!!(S===0&&(L||R)||z&&R&&$||N&&L&&$)}const K=D==null?void 0:D.isOpen,V=(D==null?void 0:D.data.value.childrenCount)&&D.data.value.childrenCount>0||(D==null?void 0:D.data.children)&&D.data.children.length>0;if(!V)return D.data.value.canDrop=!0,!1;let x=D.data.value.childrenCount&&D.data.value.childrenCount>0&&(D==null?void 0:D.data.children)&&D.data.children.length>0;return x=x??!0,!K&&!x&&V?(D.data.value.canDrop=!0,!0):(D.data.value.canDrop=!0,!1)},initialOpenState:t,overscanCount:20,selection:r,renderCursor:df,renderRow:D=>b.jsx($m,{...D,customRowProps:f}),rowClassName:"c__tree-view--row",children:i})})},$m=({children:t,customRowProps:e,...r})=>{const n=r.node.data.value.nodeType===se.TITLE,i=r.node.data.value.nodeType===se.SEPARATOR,o=r.node.data.value.nodeType===se.VIEW_MORE,{onKeyDown:a,onClick:l,...s}=e??{},{style:c}=r.attrs,d={...c},f=p=>{a==null||a(p);const g=p.target;if(g){const y=g.closest(".actions"),v=g.closest('button, a[href], input, textarea, select, [role="menuitem"], [role="button"]');if(y||v)return}if((p.key==="Enter"||p.key===" ")&&p.currentTarget.click(),p.key==="F2"){p.preventDefault();const y=p.currentTarget.querySelector("button");y&&y.focus()}};return n||i||o?u.createElement("div",{...r.attrs,key:r.node.id,style:d,ref:r.innerRef,onFocus:p=>p.stopPropagation(),onClick:p=>{l==null||l(p),r.node.handleClick(p)},onKeyDown:a,...s},t):u.createElement("div",{...r.attrs,style:d,key:r.node.id,ref:r.innerRef,onFocus:p=>p.stopPropagation(),onClick:p=>{l==null||l(p),p.preventDefault(),p.stopPropagation(),r.node.select()},onKeyDown:f,...s},b.jsx("div",{className:"c__tree-view--row-content",children:t}))},_m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pf=_m?u.useLayoutEffect:u.useEffect;function gf(t){const e=u.useRef(t);return pf(()=>{e.current=t}),u.useCallback(function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return e.current==null?void 0:e.current(...n)},[])}function g2(t,e){e===void 0&&(e=[t]);const r=u.useRef(t);return pf(()=>{r.current!==t&&(r.current=t)},e),r}function Pm(t){const e=gf(t),r=u.useRef(null),n=u.useCallback(i=>{i!==r.current&&(e==null||e(i,r.current)),r.current=i},[]);return[r,n]}let Ho={};function Am(t,e){return u.useMemo(()=>{const r=Ho[t]==null?0:Ho[t]+1;return Ho[t]=r,t+"-"+r},[t,e])}var Wr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Wr||(Wr={}));function v2(){}const Tm=Object.freeze({x:0,y:0});var lr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(lr||(lr={}));var b2;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(b2||(b2={}));var ct;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(ct||(ct={}));ct.Space,ct.Enter,ct.Esc,ct.Space,ct.Enter,ct.Tab;var m2;(function(t){t[t.RightClick=2]="RightClick"})(m2||(m2={}));var y2;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(y2||(y2={}));var C2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(C2||(C2={}));lr.Backward+"",lr.Forward+"",lr.Backward+"",lr.Forward+"";var _a;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(_a||(_a={}));var Pa;(function(t){t.Optimized="optimized"})(Pa||(Pa={}));function km(t){let{callback:e,disabled:r}=t;const n=gf(e),i=u.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(n)},[r]);return u.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}_a.WhileDragging,Pa.Optimized;const Im={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:v2,draggableNodes:new Map,over:null,measureDroppableContainers:v2},Om=u.createContext(Im);({...Tm});var E2;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(E2||(E2={}));const Mm="Droppable",Nm={timeout:25};function Rm(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:i}=t;const o=Am(Mm),{active:a,dispatch:l,over:s,measureDroppableContainers:c}=u.useContext(Om),d=u.useRef({disabled:r}),f=u.useRef(!1),p=u.useRef(null),g=u.useRef(null),{disabled:y,updateMeasurementsFor:h,timeout:v}={...Nm,...i},m=g2(h??n),C=u.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(m.current)?m.current:[m.current]),g.current=null},v)},[v]),E=km({callback:C,disabled:y||!a}),F=u.useCallback((O,K)=>{E&&(K&&(E.unobserve(K),f.current=!1),O&&E.observe(O))},[E]),[D,w]=Pm(F),S=g2(e);return u.useEffect(()=>{!E||!D.current||(E.disconnect(),f.current=!1,E.observe(D.current))},[D,E]),u.useEffect(()=>(l({type:Wr.RegisterDroppable,element:{id:n,key:o,disabled:r,node:D,rect:p,data:S}}),()=>l({type:Wr.UnregisterDroppable,key:o,id:n})),[n]),u.useEffect(()=>{r!==d.current.disabled&&(l({type:Wr.SetDroppableDisabled,id:n,key:o,disabled:r}),d.current.disabled=r)},[n,o,r,l]),{active:a,rect:p,isOver:(s==null?void 0:s.id)===n,node:D,over:s,setNodeRef:w}}const Bm=t=>{const{isOver:e,setNodeRef:r}=Rm({id:t.id,data:t.data});return u.useEffect(()=>{var n;(n=t.onOver)==null||n.call(t,e,t.data)},[e,t.data,t.onOver]),b.jsx("div",{className:"c__dnd--droppable",ref:r,children:t.children})},Lm=({children:t,itemProps:e,testId:r,onClick:n,onKeyDown:i,node:o,dragHandle:a,style:l,forceLoading:s})=>{var O,K;const{t:c}=X.useCunningham(),d=Pl(),f=u.useRef(null),[p,g]=u.useState(!1),[y,h]=u.useState(!1),[v,m]=u.useState(!1),C=s??p,E=o.willReceiveDrop||v,F=o.data.value.childrenCount!==void 0&&o.data.value.childrenCount>0||(((O=o.data.children)==null?void 0:O.length)??0)>0,D=((K=o.children)==null?void 0:K.length)??!1,w=o.isLeaf||!F,S=u.useCallback(V=>{V.stopPropagation(),o.data.value.nodeType===se.VIEW_MORE&&(h(!0),d==null||d.treeData.handleLoadChildren(o.data.parentKey).then(()=>h(!1)).catch(()=>h(!1)))},[o.data.value.nodeType,o.data.parentKey,d==null?void 0:d.treeData]);return u.useEffect(()=>{w||D||o.data.value.hasLoadedChildren||o.isOpen&&(g(!0),d==null||d.treeData.handleLoadChildren(o.data.value.id).then(()=>g(!1)))},[o.isOpen,w,D,o.data.value.hasLoadedChildren,o.data.value.id,d==null?void 0:d.treeData]),u.useEffect(()=>(E&&!o.isOpen&&!o.isDragging&&(f.current=setTimeout(()=>{o.open()},500)),()=>{f.current&&clearTimeout(f.current)}),[E,o.isOpen,o.isDragging,o]),o.data.value.nodeType===se.SEPARATOR?b.jsx("div",{className:"c__tree-view--node__separator","data-testid":r}):o.data.value.nodeType===se.TITLE?b.jsx("div",{className:"c__tree-view--node__title","data-testid":r,children:o.data.value.headerTitle}):o.data.value.nodeType===se.VIEW_MORE?b.jsx("div",{className:"c__tree-view--row-content","data-testid":r,children:b.jsx("div",{className:"c__tree-view--node",style:l,children:b.jsxs("div",{role:"button",className:"c__tree-view--node__view-more-button",style:{paddingLeft:0,marginLeft:20},onClick:S,children:[y?b.jsx("div",{className:"c__tree-view--node__loading",children:b.jsx(li,{})}):b.jsx("span",{className:"material-icons c__tree-view--node__view-more-button__icon",children:"arrow_downward"}),b.jsxs("span",{className:"c__tree-view--node__view-more-text",children:[o.data.value.nodeType===se.VIEW_MORE,c("components.treeView.viewMore")]})]})})}):b.jsx(Bm,{id:o.id,data:{data:o.data,nodeApi:o},onOver:m,children:b.jsxs("div",{onClick:V=>{if(!V.target.closest(".c__tree-view--node")){V.stopPropagation();return}n==null||n()},onKeyDown:V=>{i==null||i(V),V.target.closest(".c__tree-view--node")||V.stopPropagation()},ref:a,style:l,className:ve("c__tree-view--node",{...o.state,simpleNode:o.data.value.nodeType===se.SIMPLE_NODE,canDrop:o.data.value.canDrop??!0,externalDrop:v}),"data-testid":r,...e,children:[w&&b.jsx("div",{className:"c__tree-view--node__leaf"}),!w&&b.jsxs(b.Fragment,{children:[C&&b.jsx("div",{className:"c__tree-view--node__loading",children:b.jsx(li,{})}),!C&&b.jsx("span",{onClick:V=>{V.stopPropagation(),o.toggle()},className:"c__tree-view--node__arrow material-icons",children:o.isOpen?"keyboard_arrow_down":"keyboard_arrow_right"})]}),t]})})},jm=({children:t,uppercased:e=!1,type:r="accent",className:n,...i})=>b.jsx("div",{className:ve(n,"c__badge",{"c__badge--uppercased":e,[`c__badge--${r}`]:r}),...i,children:t});function Km(t){u.useEffect(()=>{if(!t)return;let e=!1;const r=()=>Array.from(t.querySelectorAll("button")).filter(a=>!a.disabled&&a.getAttribute("aria-disabled")!=="true"),n=a=>{const l=a.key==="ArrowLeft"||a.key==="ArrowRight",s=a.key===" ";if(!(a.target instanceof HTMLElement))return;if(s){const h=a.target.closest("button");h instanceof HTMLButtonElement&&t.contains(h)&&h.click();return}if(!l)return;const d=a.target.closest("button");if(!(d instanceof HTMLButtonElement&&t.contains(d)))return;const p=r(),g=p.indexOf(d);if(g<0)return;a.preventDefault(),a.stopPropagation();const y=a.key==="ArrowRight"?(g+1)%p.length:(g-1+p.length)%p.length;p[y].focus(),e=!0},i=a=>{e&&((a.key===" "||a.key==="Enter")&&(a.preventDefault(),a.stopPropagation()),e=!1)},o={capture:!0};return t.addEventListener("keydown",n,o),t.addEventListener("keyup",i,o),()=>{t.removeEventListener("keydown",n,o),t.removeEventListener("keyup",i,o)}},[t])}const Zi=({roles:t,onSelect:e,canUpdate:r=!0,selectedRole:n,isOpen:i,onOpenChange:o,roleTopMessage:a,onDelete:l})=>{const{t:s}=X.useCunningham(),c=t.find(f=>f.value===n),d=u.useMemo(()=>l?[...t,{type:"separator"},{label:s("components.share.access.delete"),callback:l}]:t,[t,l,s]);return r?b.jsx(Yr,{isOpen:i,shouldCloseOnInteractOutside:f=>!f.closest(".c__access-role-dropdown"),onOpenChange:o,options:d,selectedValues:[n],onSelectValue:e,topMessage:a,children:b.jsxs("div",{role:"button",className:"c__access-role-dropdown","data-testid":"access-role-dropdown-button",onClick:()=>{o==null||o(!i)},children:[b.jsx("span",{className:"c__access-role-dropdown__role-label",children:c==null?void 0:c.label}),b.jsx("span",{className:"material-icons c__access-role-dropdown__icon",children:i?"arrow_drop_up":"arrow_drop_down"})]})}):b.jsx("span",{className:"c__access-role-dropdown__role-label-can-not-update",children:c==null?void 0:c.label})},vf=({users:t,onRemoveUser:e,rightActions:r,onShare:n,shareButtonLabel:i,roles:o,selectedRole:a,onSelectRole:l})=>{const{t:s}=X.useCunningham(),[c,d]=u.useState(!1);return b.jsxs("div",{className:"c__add-share-user-list","data-testid":"selected-users-list",children:[b.jsx("div",{className:"c__add-share-user-list__items",children:t.map(f=>b.jsx(bf,{user:f,onRemoveUser:e},f.id))}),b.jsxs("div",{className:"c__add-share-user-list__right-actions",children:[r,b.jsx(Zi,{roles:o,selectedRole:a,onSelect:l,isOpen:c,onOpenChange:d}),b.jsx(X.Button,{onClick:n,children:i??s("components.share.shareButton")})]})]})},bf=({user:t,onRemoveUser:e})=>b.jsxs("div",{className:"c__add-share-user-item","data-testid":"selected-user-item",children:[b.jsx("span",{children:t.full_name||t.email}),b.jsx(X.Button,{variant:"tertiary",color:"neutral",size:"nano",onClick:()=>e==null?void 0:e(t),icon:b.jsx("span",{className:"material-icons",children:"close"})})]}),Aa=["gray","brand","red","orange","brown","green","blue-1","blue-2","pink","yellow","purple"],mf=t=>t.split(/[\s-_]+/).slice(0,2).map(e=>e[0]).join("").toUpperCase(),Al=t=>{let e=0;for(let r=0;r<t.length;r++)e+=t.charCodeAt(r);return Aa[e%Aa.length]},Gi=({fullName:t,size:e="medium",forceColor:r,backgroundColor:n})=>{const i=mf(t),o=n||Al(t);return b.jsx("div",{style:{backgroundColor:r||void 0},className:ve(`c__avatar ${e}`,{[o]:!r&&o}),children:b.jsx("div",{className:"c__avatar__initials",children:i})})},qi=({fullName:t,email:e,showEmail:r=!0})=>{const n=t&&t!==""?t:e??"";return b.jsxs("div",{className:"c__user-row",children:[b.jsx(Gi,{fullName:n,size:"small"}),b.jsxs("div",{className:"c__user-row__info",children:[b.jsx("span",{className:"c__user-row__name",children:t}),r&&e&&b.jsx("span",{className:ve("c__user-row__email",{"has-only-email":e&&(t===""||!t)}),children:e})]})]})},Ta=({user:t})=>{const{t:e}=X.useCunningham();return b.jsx(Ki,{testId:"search-user-item",left:b.jsx(qi,{fullName:t.full_name,email:t.email}),alwaysShowRight:!1,right:b.jsxs("div",{className:"c__search-user-item-right",children:[b.jsx("span",{children:e("components.share.item.add")}),b.jsx("span",{className:"material-icons",children:"add"})]})})},yf=({accessData:t,accessRoleKey:e="role",roles:r,updateRole:n,deleteAccess:i,canUpdate:o=!0,roleTopMessage:a})=>{const l=mr();return b.jsx("div",{className:"c__share-member-item",children:b.jsx(Ki,{testId:"share-member-item",left:b.jsx(qi,{fullName:t.user.full_name,email:t.user.email,showEmail:!0}),alwaysShowRight:!0,right:b.jsx("div",{className:"c__share-member-item__right",children:b.jsx(Zi,{roles:r,selectedRole:t[e],onSelect:s=>n==null?void 0:n(t,s),isOpen:l.isOpen,onOpenChange:l.setIsOpen,canUpdate:o,roleTopMessage:a,onDelete:t.is_explicit!==!1&&t.can_delete!==!1&&i?()=>i(t):void 0})})})})},Cf=({invitation:t,roles:e,updateRole:r,deleteInvitation:n,canUpdate:i=!0,roleTopMessage:o})=>{const a=mr();return b.jsx("div",{className:"c__share-member-item",children:b.jsx(Ki,{testId:"share-invitation-item",left:b.jsx(qi,{fullName:"",email:t.email,showEmail:!0}),alwaysShowRight:!0,right:b.jsx("div",{className:"c__share-member-item__right",children:b.jsx(Zi,{roles:e,selectedRole:t.role,onSelect:l=>r==null?void 0:r(t,l),isOpen:a.isOpen,canUpdate:i,onOpenChange:a.setIsOpen,roleTopMessage:o,onDelete:n?()=>n(t):void 0})})})})},Vm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6167%2022%209.31667%2021.7375%208.1%2021.2125C6.88333%2020.6875%205.825%2019.975%204.925%2019.075C4.025%2018.175%203.3125%2017.1167%202.7875%2015.9C2.2625%2014.6833%202%2013.3833%202%2012C2%2010.6167%202.2625%209.31667%202.7875%208.1C3.3125%206.88333%204.025%205.825%204.925%204.925C5.825%204.025%206.88333%203.3125%208.1%202.7875C9.31667%202.2625%2010.6167%202%2012%202C13.3833%202%2014.6833%202.2625%2015.9%202.7875C17.1167%203.3125%2018.175%204.025%2019.075%204.925C19.975%205.825%2020.6875%206.88333%2021.2125%208.1C21.7375%209.31667%2022%2010.6167%2022%2012C22%2013.3833%2021.7375%2014.6833%2021.2125%2015.9C20.6875%2017.1167%2019.975%2018.175%2019.075%2019.075C18.175%2019.975%2017.1167%2020.6875%2015.9%2021.2125C14.6833%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0167%204.6625%2015.7833%205.9875%2017.3C7.3125%2018.8167%208.98333%2019.7%2011%2019.95ZM17.9%2017.4C18.2333%2017.0333%2018.5333%2016.6375%2018.8%2016.2125C19.0667%2015.7875%2019.2875%2015.3458%2019.4625%2014.8875C19.6375%2014.4292%2019.7708%2013.9583%2019.8625%2013.475C19.9542%2012.9917%2020%2012.5%2020%2012C20%2010.3667%2019.5458%208.875%2018.6375%207.525C17.7292%206.175%2016.5167%205.2%2015%204.6V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.4333%2016%2016.825%2016.1292%2017.175%2016.3875C17.525%2016.6458%2017.7667%2016.9833%2017.9%2017.4Z'%20fill='%23222631'/%3e%3c/svg%3e",Hm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18%2018C18.4167%2018%2018.7708%2017.8542%2019.0625%2017.5625C19.3542%2017.2708%2019.5%2016.9167%2019.5%2016.5C19.5%2016.0833%2019.3542%2015.7292%2019.0625%2015.4375C18.7708%2015.1458%2018.4167%2015%2018%2015C17.5833%2015%2017.2292%2015.1458%2016.9375%2015.4375C16.6458%2015.7292%2016.5%2016.0833%2016.5%2016.5C16.5%2016.9167%2016.6458%2017.2708%2016.9375%2017.5625C17.2292%2017.8542%2017.5833%2018%2018%2018ZM18%2021C18.5%2021%2018.9667%2020.8833%2019.4%2020.65C19.8333%2020.4167%2020.1917%2020.0917%2020.475%2019.675C20.0917%2019.4417%2019.6917%2019.2708%2019.275%2019.1625C18.8583%2019.0542%2018.4333%2019%2018%2019C17.5667%2019%2017.1417%2019.0542%2016.725%2019.1625C16.3083%2019.2708%2015.9083%2019.4417%2015.525%2019.675C15.8083%2020.0917%2016.1667%2020.4167%2016.6%2020.65C17.0333%2020.8833%2017.5%2021%2018%2021ZM9%208H15V6C15%205.16667%2014.7083%204.45833%2014.125%203.875C13.5417%203.29167%2012.8333%203%2012%203C11.1667%203%2010.4583%203.29167%209.875%203.875C9.29167%204.45833%209%205.16667%209%206V8ZM12.25%2022H6C5.45%2022%204.97917%2021.8042%204.5875%2021.4125C4.19583%2021.0208%204%2020.55%204%2020V10C4%209.45%204.19583%208.97917%204.5875%208.5875C4.97917%208.19583%205.45%208%206%208H7V6C7%204.61667%207.4875%203.4375%208.4625%202.4625C9.4375%201.4875%2010.6167%201%2012%201C13.3833%201%2014.5625%201.4875%2015.5375%202.4625C16.5125%203.4375%2017%204.61667%2017%206V8H18C18.55%208%2019.0208%208.19583%2019.4125%208.5875C19.8042%208.97917%2020%209.45%2020%2010V11.3C19.7%2011.2%2019.3875%2011.125%2019.0625%2011.075C18.7375%2011.025%2018.3833%2011%2018%2011V10H6V20H11.3C11.4333%2020.4%2011.5667%2020.7458%2011.7%2021.0375C11.8333%2021.3292%2012.0167%2021.65%2012.25%2022ZM18%2023C16.6167%2023%2015.4375%2022.5125%2014.4625%2021.5375C13.4875%2020.5625%2013%2019.3833%2013%2018C13%2016.6167%2013.4875%2015.4375%2014.4625%2014.4625C15.4375%2013.4875%2016.6167%2013%2018%2013C19.3833%2013%2020.5625%2013.4875%2021.5375%2014.4625C22.5125%2015.4375%2023%2016.6167%2023%2018C23%2019.3833%2022.5125%2020.5625%2021.5375%2021.5375C20.5625%2022.5125%2019.3833%2023%2018%2023Z'%20fill='%23222631'/%3e%3c/svg%3e",zm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6333%2022%209.34167%2021.7375%208.125%2021.2125C6.90833%2020.6875%205.84583%2019.9708%204.9375%2019.0625C4.02917%2018.1542%203.3125%2017.0917%202.7875%2015.875C2.2625%2014.6583%202%2013.3667%202%2012C2%2010.6167%202.2625%209.32083%202.7875%208.1125C3.3125%206.90417%204.02917%205.84583%204.9375%204.9375C5.84583%204.02917%206.90833%203.3125%208.125%202.7875C9.34167%202.2625%2010.6333%202%2012%202C12.5333%202%2013.0458%202.0375%2013.5375%202.1125C14.0292%202.1875%2014.5167%202.3%2015%202.45V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.45%2016%2016.8458%2016.1333%2017.1875%2016.4C17.5292%2016.6667%2017.7667%2017%2017.9%2017.4C18.55%2016.6667%2019.0625%2015.8458%2019.4375%2014.9375C19.8125%2014.0292%2020%2013.05%2020%2012C20%2011.8167%2019.9917%2011.65%2019.975%2011.5C19.9583%2011.35%2019.9333%2011.1833%2019.9%2011H21.95C21.9833%2011.1833%2022%2011.35%2022%2011.5V12C22%2013.3667%2021.7375%2014.6583%2021.2125%2015.875C20.6875%2017.0917%2019.9708%2018.1542%2019.0625%2019.0625C18.1542%2019.9708%2017.0958%2020.6875%2015.8875%2021.2125C14.6792%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0667%204.67083%2015.8458%206.0125%2017.3375C7.35417%2018.8292%209.01667%2019.7%2011%2019.95ZM18%209C17.7167%209%2017.4792%208.90417%2017.2875%208.7125C17.0958%208.52083%2017%208.28333%2017%208V5C17%204.71667%2017.0958%204.47917%2017.2875%204.2875C17.4792%204.09583%2017.7167%204%2018%204V3C18%202.45%2018.1958%201.97917%2018.5875%201.5875C18.9792%201.19583%2019.45%201%2020%201C20.55%201%2021.0208%201.19583%2021.4125%201.5875C21.8042%201.97917%2022%202.45%2022%203V4C22.2833%204%2022.5208%204.09583%2022.7125%204.2875C22.9042%204.47917%2023%204.71667%2023%205V8C23%208.28333%2022.9042%208.52083%2022.7125%208.7125C22.5208%208.90417%2022.2833%209%2022%209H18ZM19%204H21V3C21%202.71667%2020.9042%202.47917%2020.7125%202.2875C20.5208%202.09583%2020.2833%202%2020%202C19.7167%202%2019.4792%202.09583%2019.2875%202.2875C19.0958%202.47917%2019%202.71667%2019%203V4Z'%20fill='%23222631'/%3e%3c/svg%3e",Um="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6167%2022%209.31667%2021.7375%208.1%2021.2125C6.88333%2020.6875%205.825%2019.975%204.925%2019.075C4.025%2018.175%203.3125%2017.1167%202.7875%2015.9C2.2625%2014.6833%202%2013.3833%202%2012C2%2010.6167%202.2625%209.31667%202.7875%208.1C3.3125%206.88333%204.025%205.825%204.925%204.925C5.825%204.025%206.88333%203.3125%208.1%202.7875C9.31667%202.2625%2010.6167%202%2012%202C13.3833%202%2014.6833%202.2625%2015.9%202.7875C17.1167%203.3125%2018.175%204.025%2019.075%204.925C19.975%205.825%2020.6875%206.88333%2021.2125%208.1C21.7375%209.31667%2022%2010.6167%2022%2012C22%2013.3833%2021.7375%2014.6833%2021.2125%2015.9C20.6875%2017.1167%2019.975%2018.175%2019.075%2019.075C18.175%2019.975%2017.1167%2020.6875%2015.9%2021.2125C14.6833%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0167%204.6625%2015.7833%205.9875%2017.3C7.3125%2018.8167%208.98333%2019.7%2011%2019.95ZM17.9%2017.4C18.2333%2017.0333%2018.5333%2016.6375%2018.8%2016.2125C19.0667%2015.7875%2019.2875%2015.3458%2019.4625%2014.8875C19.6375%2014.4292%2019.7708%2013.9583%2019.8625%2013.475C19.9542%2012.9917%2020%2012.5%2020%2012C20%2010.3667%2019.5458%208.875%2018.6375%207.525C17.7292%206.175%2016.5167%205.2%2015%204.6V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.4333%2016%2016.825%2016.1292%2017.175%2016.3875C17.525%2016.6458%2017.7667%2016.9833%2017.9%2017.4Z'%20fill='%233E5DE7'/%3e%3c/svg%3e",Wm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18%2018C18.4167%2018%2018.7708%2017.8542%2019.0625%2017.5625C19.3542%2017.2708%2019.5%2016.9167%2019.5%2016.5C19.5%2016.0833%2019.3542%2015.7292%2019.0625%2015.4375C18.7708%2015.1458%2018.4167%2015%2018%2015C17.5833%2015%2017.2292%2015.1458%2016.9375%2015.4375C16.6458%2015.7292%2016.5%2016.0833%2016.5%2016.5C16.5%2016.9167%2016.6458%2017.2708%2016.9375%2017.5625C17.2292%2017.8542%2017.5833%2018%2018%2018ZM18%2021C18.5%2021%2018.9667%2020.8833%2019.4%2020.65C19.8333%2020.4167%2020.1917%2020.0917%2020.475%2019.675C20.0917%2019.4417%2019.6917%2019.2708%2019.275%2019.1625C18.8583%2019.0542%2018.4333%2019%2018%2019C17.5667%2019%2017.1417%2019.0542%2016.725%2019.1625C16.3083%2019.2708%2015.9083%2019.4417%2015.525%2019.675C15.8083%2020.0917%2016.1667%2020.4167%2016.6%2020.65C17.0333%2020.8833%2017.5%2021%2018%2021ZM9%208H15V6C15%205.16667%2014.7083%204.45833%2014.125%203.875C13.5417%203.29167%2012.8333%203%2012%203C11.1667%203%2010.4583%203.29167%209.875%203.875C9.29167%204.45833%209%205.16667%209%206V8ZM12.25%2022H6C5.45%2022%204.97917%2021.8042%204.5875%2021.4125C4.19583%2021.0208%204%2020.55%204%2020V10C4%209.45%204.19583%208.97917%204.5875%208.5875C4.97917%208.19583%205.45%208%206%208H7V6C7%204.61667%207.4875%203.4375%208.4625%202.4625C9.4375%201.4875%2010.6167%201%2012%201C13.3833%201%2014.5625%201.4875%2015.5375%202.4625C16.5125%203.4375%2017%204.61667%2017%206V8H18C18.55%208%2019.0208%208.19583%2019.4125%208.5875C19.8042%208.97917%2020%209.45%2020%2010V11.3C19.7%2011.2%2019.3875%2011.125%2019.0625%2011.075C18.7375%2011.025%2018.3833%2011%2018%2011V10H6V20H11.3C11.4333%2020.4%2011.5667%2020.7458%2011.7%2021.0375C11.8333%2021.3292%2012.0167%2021.65%2012.25%2022ZM18%2023C16.6167%2023%2015.4375%2022.5125%2014.4625%2021.5375C13.4875%2020.5625%2013%2019.3833%2013%2018C13%2016.6167%2013.4875%2015.4375%2014.4625%2014.4625C15.4375%2013.4875%2016.6167%2013%2018%2013C19.3833%2013%2020.5625%2013.4875%2021.5375%2014.4625C22.5125%2015.4375%2023%2016.6167%2023%2018C23%2019.3833%2022.5125%2020.5625%2021.5375%2021.5375C20.5625%2022.5125%2019.3833%2023%2018%2023Z'%20fill='%23304DDF'/%3e%3c/svg%3e",Zm="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%2022C10.6333%2022%209.34167%2021.7375%208.125%2021.2125C6.90833%2020.6875%205.84583%2019.9708%204.9375%2019.0625C4.02917%2018.1542%203.3125%2017.0917%202.7875%2015.875C2.2625%2014.6583%202%2013.3667%202%2012C2%2010.6167%202.2625%209.32083%202.7875%208.1125C3.3125%206.90417%204.02917%205.84583%204.9375%204.9375C5.84583%204.02917%206.90833%203.3125%208.125%202.7875C9.34167%202.2625%2010.6333%202%2012%202C12.5333%202%2013.0458%202.0375%2013.5375%202.1125C14.0292%202.1875%2014.5167%202.3%2015%202.45V5C15%205.55%2014.8042%206.02083%2014.4125%206.4125C14.0208%206.80417%2013.55%207%2013%207H11V9C11%209.28333%2010.9042%209.52083%2010.7125%209.7125C10.5208%209.90417%2010.2833%2010%2010%2010H8V12H14C14.2833%2012%2014.5208%2012.0958%2014.7125%2012.2875C14.9042%2012.4792%2015%2012.7167%2015%2013V16H16C16.45%2016%2016.8458%2016.1333%2017.1875%2016.4C17.5292%2016.6667%2017.7667%2017%2017.9%2017.4C18.55%2016.6667%2019.0625%2015.8458%2019.4375%2014.9375C19.8125%2014.0292%2020%2013.05%2020%2012C20%2011.8167%2019.9917%2011.65%2019.975%2011.5C19.9583%2011.35%2019.9333%2011.1833%2019.9%2011H21.95C21.9833%2011.1833%2022%2011.35%2022%2011.5V12C22%2013.3667%2021.7375%2014.6583%2021.2125%2015.875C20.6875%2017.0917%2019.9708%2018.1542%2019.0625%2019.0625C18.1542%2019.9708%2017.0958%2020.6875%2015.8875%2021.2125C14.6792%2021.7375%2013.3833%2022%2012%2022ZM11%2019.95V18C10.45%2018%209.97917%2017.8042%209.5875%2017.4125C9.19583%2017.0208%209%2016.55%209%2016V15L4.2%2010.2C4.15%2010.5%204.10417%2010.8%204.0625%2011.1C4.02083%2011.4%204%2011.7%204%2012C4%2014.0667%204.67083%2015.8458%206.0125%2017.3375C7.35417%2018.8292%209.01667%2019.7%2011%2019.95ZM18%209C17.7167%209%2017.4792%208.90417%2017.2875%208.7125C17.0958%208.52083%2017%208.28333%2017%208V5C17%204.71667%2017.0958%204.47917%2017.2875%204.2875C17.4792%204.09583%2017.7167%204%2018%204V3C18%202.45%2018.1958%201.97917%2018.5875%201.5875C18.9792%201.19583%2019.45%201%2020%201C20.55%201%2021.0208%201.19583%2021.4125%201.5875C21.8042%201.97917%2022%202.45%2022%203V4C22.2833%204%2022.5208%204.09583%2022.7125%204.2875C22.9042%204.47917%2023%204.71667%2023%205V8C23%208.28333%2022.9042%208.52083%2022.7125%208.7125C22.5208%208.90417%2022.2833%209%2022%209H18ZM19%204H21V3C21%202.71667%2020.9042%202.47917%2020.7125%202.2875C20.5208%202.09583%2020.2833%202%2020%202C19.7167%202%2019.4792%202.09583%2019.2875%202.2875C19.0958%202.47917%2019%202.71667%2019%203V4Z'%20fill='%233E5DE7'/%3e%3c/svg%3e",Ef=t=>{const{t:e}=X.useCunningham();return{t:r=>(t==null?void 0:t[r])??e(r)}},In=(t,e=!1)=>{switch(t){case"public":return b.jsx("img",{src:e?Um:Vm,alt:""});case"restricted":return b.jsx("img",{src:e?Wm:Hm,alt:""});case"authenticated":return b.jsx("img",{src:e?Zm:zm,alt:""});default:return null}},Gm=({linkReachChoices:t=[],canUpdate:e,linkReach:r="public",onUpdateLinkReach:n,showLinkRole:i=!1,linkRoleChoices:o=[],linkRole:a="reader",onUpdateLinkRole:l,customTranslations:s,topLinkReachMessage:c,topLinkRoleMessage:d})=>{const f=mr(),p=mr(),[g,y]=u.useState([r]),h=g[0],[v,m]=u.useState([a]),C=v[0],{t:E}=Ef(s),F=u.useMemo(()=>t.map(x=>({icon:x.icon??In(x.value),value:x.value,label:E("components.share.linkSettings.reach.choices."+x.value+".title"),...x})),[t]),D=u.useMemo(()=>F.find(x=>x.value===h),[F,h]),w=u.useMemo(()=>o.map(x=>({value:x.value,label:E("components.share.linkSettings.role.choices."+x.value+".title"),...x})),[o]),S=u.useMemo(()=>w.find(x=>x.value===C),[w,C]),O=i&&o.length>0,K=()=>b.jsx("div",{className:"c__share-modal__link-settings__content__select",children:e?b.jsx(Yr,{onSelectValue:x=>{y([x]),n==null||n(x)},options:F,isOpen:f.isOpen,topMessage:c,onOpenChange:f.setIsOpen,selectedValues:g,children:b.jsxs(X.Button,{variant:"tertiary",icon:In(h,!0),iconPosition:"left","data-testid":"share-link-reach-dropdown-button",onClick:()=>{e&&f.setIsOpen(!f.isOpen)},children:[D==null?void 0:D.label,b.jsx("span",{className:"material-icons",children:f.isOpen?"arrow_drop_up":"arrow_drop_down"})]})}):b.jsxs("span",{className:"c__share-modal__link-settings__content__select__value",children:[In(h),D==null?void 0:D.label]})}),V=()=>O?b.jsx("div",{className:"c__share-modal__link-settings__content__select-role",children:e?b.jsx(Yr,{onSelectValue:x=>{m([x]),l==null||l(x)},options:w,isOpen:p.isOpen,onOpenChange:p.setIsOpen,selectedValues:v,topMessage:d,children:b.jsx(X.Button,{variant:"tertiary","data-testid":"share-link-role-dropdown-button",icon:b.jsx("span",{className:"material-icons",children:p.isOpen?"arrow_drop_up":"arrow_drop_down"}),iconPosition:"right",onClick:()=>{e&&p.setIsOpen(!p.isOpen)},size:"small",children:S==null?void 0:S.label})}):b.jsxs("span",{className:"c__share-modal__link-settings__content__select-role__value",children:[In(C,!0),S==null?void 0:S.label]})}):null;return b.jsxs("div",{className:"c__share-modal__link-settings","data-testid":"share-link-settings",children:[b.jsx("span",{className:"c__share-modal__link-settings__title",children:E("components.share.linkSettings.title")}),b.jsxs("div",{className:"c__share-modal__link-settings__content",children:[K(),b.jsx("div",{className:"c__share-modal__link-settings__content__description desktop",children:E(`components.share.linkSettings.reach.choices.${h}.description`)}),V()]}),b.jsx("div",{className:"c__share-modal__link-settings__content__description mobile",children:E(`components.share.linkSettings.reach.choices.${h}.description`)})]})},qm=({searchUsersResult:t,children:e,outsideSearchContent:r,accesses:n=[],invitations:i=[],hasNextMembers:o=!1,canUpdate:a=!0,canView:l=!0,hasNextInvitations:s=!1,hideInvitations:c=!1,hideMembers:d=!1,cannotViewChildren:f,customTranslations:p,...g})=>{var T,M;if(!(c&&d)){if(!g.invitationRoles)throw new Error("invitationRoles is required");if(!g.onSearchUsers)throw new Error("onSearchUsers is required")}if(!c&&!g.onInviteUser)throw new Error("onInviteUser is required");if(a&&!l)throw new Error("canView cannot be false if canUpdate is true");const{t:y}=X.useCunningham(),{isMobile:h}=ot(),v=u.useRef(null),[m,C]=u.useState("400px"),E=u.useRef(null),[F,D]=u.useState(""),[w,S]=u.useState(""),[O,K]=u.useState([]),[V,x]=u.useState(((M=(T=g.invitationRoles)==null?void 0:T[0])==null?void 0:M.value)??""),B=h?"calc(100dvh - 32px)":"min(690px, calc(100dvh - 2em - 12px - 32px))",U=j=>{if(v.current&&clearTimeout(v.current),j===""){S(""),g.onSearchUsers("");return}v.current=setTimeout(()=>{g.onSearchUsers(j),S(j)},300)},k=j=>{D(j),U(j)},W=w!==""||O.length>0,_=u.useCallback(j=>{K(H=>[...H,j]),D(""),S(""),g.onSearchUsers("")},[g]),I=j=>{K(H=>H.filter(Z=>Z.id!==j.id))},z=u.useMemo(()=>{const j=t==null?void 0:t.filter(G=>!O.includes(G));let H=y(w!==""?"components.share.user.no_result":"components.share.user.placeholder");const q=(G=>!!G.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z\-0-9]{2,}))$/))(w??"")&&!(j!=null&&j.some(G=>G.email===w)),Y={id:w,full_name:"",email:w};return q&&(H=void 0),{groupName:y("components.share.search.group_name"),elements:j??[],showWhenEmpty:!0,emptyString:H,endActions:q?[{content:b.jsx(Ta,{user:Y}),onSelect:()=>void _(Y)}]:void 0}},[t,w,y,O,_]),L=j=>{var le;const Z=(j==null?void 0:j.clientHeight)??0,q=((le=E.current)==null?void 0:le.clientHeight)??0,Y=`calc(${B} - ${Z}px - ${q}px - 70px - 10px)`;C(Y)},N=!c&&!W&&!g.loading&&i.length>0,R=!d&&!W&&!g.loading&&n.length>0,P=l?c&&d?"empty":"search":"cannot_view";return b.jsx(X.Modal,{title:g.modalTitle??y("components.share.modalTitle"),isOpen:g.isOpen,onClose:g.onClose,"aria-label":y("components.share.modalAriaLabel"),closeOnClickOutside:!0,size:h?X.ModalSize.FULL:X.ModalSize.LARGE,children:b.jsxs("div",{className:"c__share-modal no-padding",children:[a&&O.length>0&&b.jsx("div",{className:"c__share-modal__selected-users",ref:E,children:b.jsx(vf,{users:O,onRemoveUser:I,roles:g.invitationRoles,selectedRole:V,onSelectRole:x,onShare:()=>{g.onInviteUser(O,V),K([])}})}),P==="cannot_view"&&b.jsxs("div",{className:"c__share-modal__cannot-view",style:{height:m},children:[b.jsx("div",{className:"c__share-modal__cannot-view__content",children:b.jsx("p",{children:g.cannotViewMessage??y("components.share.cannot_view.message")})}),f]}),P==="search"&&b.jsx(b1,{onFilter:k,inputValue:F,showInput:a,loading:g.loading,placeholder:y("components.share.user.placeholder"),children:b.jsxs("div",{style:{height:m,overflowY:"auto"},children:[W&&b.jsx("div",{className:"c__share-modal__search-users","data-testid":"search-users-list",children:b.jsx(m1,{group:z,onSelect:j=>{_(j)},renderElement:j=>b.jsx(Ta,{user:j})})}),!W&&e,N&&b.jsxs("div",{className:"c__share-modal__invitations","data-testid":"invitations-list",children:[b.jsx("span",{className:"c__share-modal__invitations-title",children:y("components.share.invitations.title")}),i.map(j=>{var H;return b.jsx(Cf,{invitation:j,roles:g.invitationRoles,updateRole:g.onUpdateInvitation,deleteInvitation:g.onDeleteInvitation,canUpdate:a,roleTopMessage:(H=g.invitationRoleTopMessage)==null?void 0:H.call(g,j)},j.id)}),b.jsx(w2,{show:s,onShowMore:g.onLoadNextInvitations})]}),R&&b.jsxs("div",{className:"c__share-modal__members","data-testid":"members-list",children:[b.jsx("span",{className:"c__share-modal__members-title",children:y(n.length>1?"components.share.members.title_plural":"components.share.members.title_singular",{count:n.length})}),n.map(j=>{var H,Z;return b.jsx(yf,{accessData:j,accessRoleKey:g.accessRoleKey??"role",canUpdate:a,roleTopMessage:(H=g.accessRoleTopMessage)==null?void 0:H.call(g,j),roles:((Z=g.getAccessRoles)==null?void 0:Z.call(g,j))??g.invitationRoles,updateRole:g.onUpdateAccess,deleteAccess:g.onDeleteAccess},j.id)}),b.jsx(w2,{show:o,onShowMore:g.onLoadNextMembers})]})]})}),b.jsx("div",{ref:L,children:!W&&b.jsxs("div",{className:"c__share-modal__footer",children:[g.linkSettings&&b.jsx(Gm,{linkReachChoices:g.linkReachChoices,canUpdate:a,onUpdateLinkReach:g.onUpdateLinkReach,linkReach:g.linkReach,linkRoleChoices:g.linkRoleChoices,linkRole:g.linkRole,onUpdateLinkRole:g.onUpdateLinkRole,showLinkRole:g.showLinkRole,customTranslations:p,topLinkReachMessage:g.topLinkReachMessage,topLinkRoleMessage:g.topLinkRoleMessage}),r]})})]})})},w2=({show:t,onShowMore:e})=>{const{t:r}=X.useCunningham();return t?b.jsx("div",{className:"c__share-modal__show-more-button",children:b.jsx(X.Button,{variant:"tertiary",size:"small",icon:b.jsx("span",{className:"material-icons",children:"arrow_downward"}),onClick:e,children:r("components.share.members.load_more")})}):null},Ym=({onCopyLink:t,onOk:e})=>{const{t:r}=X.useCunningham();return b.jsxs("div",{className:"c__share-modal__copy-link-footer",children:[b.jsx(X.Button,{variant:"secondary",icon:b.jsx("span",{className:"material-icons",children:"link"}),onClick:t,children:r("components.share.copyLink")}),b.jsx(X.Button,{variant:"primary",onClick:e,children:r("components.share.ok")})]})},wf=({user:t,settingsItems:e,showSettings:r,actions:n,termOfServiceUrl:i})=>{const o=!!n||!!i,{t:a}=X.useCunningham(),l=t?t.full_name??t.email:void 0,s=l?Al(l):void 0;return t?b.jsx(b.Fragment,{children:b.jsxs("div",{className:"user-menu__content__body",children:[b.jsxs("div",{className:"user-menu__content__body__user-info",style:{"--gradient-color":`var(--c--contextuals--background--palette--${s}--primary)`},children:[b.jsx(Gi,{fullName:l}),b.jsx("div",{className:"user-menu__content__identity__name",children:t.full_name?b.jsxs(b.Fragment,{children:[b.jsx("p",{className:"user-menu__content__identity__name",children:b.jsx("strong",{children:t.full_name})}),b.jsx("p",{className:"user-menu__content__identity__email",children:t.email})]}):b.jsx("p",{className:"user-menu__content__identity__email",children:b.jsx("strong",{children:t.email})})})]}),r&&b.jsxs(b.Fragment,{children:[b.jsx(an,{withPadding:!1}),b.jsx("div",{className:"user-menu__content__body__settings",children:e.map(c=>b.jsx(xf,{label:c.label,icon:c.icon,onClick:c.onClick},c.label))})]}),o&&b.jsxs(b.Fragment,{children:[b.jsx(an,{withPadding:!1}),b.jsxs("div",{className:"user-menu__actions user-menu__actions--mobile",children:[n&&b.jsx("div",{className:"user-menu__actions__left",children:n}),i&&b.jsx("div",{className:"user-menu__actions__right",children:b.jsx(X.Button,{variant:"tertiary",target:"_blank",href:i,size:"small",color:"neutral",children:a("components.userMenu.term_of_service")})})]})]})]})}):null},Xm=({...t})=>{const{t:e}=X.useCunningham(),r=Sf();return b.jsxs(b.Fragment,{children:[b.jsx(Df,{user:t.user,...r}),b.jsx(X.Modal,{isOpen:r.openState,onClose:()=>r.setOpenState(!1),"aria-label":e("components.userMenu.dialogTitle"),size:X.ModalSize.FULL,children:b.jsxs("div",{className:"user-menu__popover user-menu__popover--mobile",children:[b.jsx(X.Button,{variant:"tertiary",className:"user-menu__close-button",onClick:r.toggleUserMenu,"aria-label":e("components.userMenu.close"),color:"neutral",icon:b.jsx(Jr,{name:"close"}),size:"small"}),b.jsx(wf,{...t}),b.jsx("div",{className:"user-menu__footer--mobile",children:b.jsx(X.Button,{variant:"primary",onClick:r.toggleUserMenu,children:e("components.share.ok")})})]})})]})},Jm=({user:t,settingsItems:e,showSettings:r,actions:n,termOfServiceUrl:i})=>{const{t:o}=X.useCunningham(),a=Sf();return b.jsxs(b.Fragment,{children:[b.jsx(Df,{user:t,...a}),b.jsx(Pi,{className:"c__dropdown-menu user-menu__popover",triggerRef:a.triggerRef,isOpen:a.openState,onOpenChange:a.setOpenState,children:b.jsx(Rh,{"aria-label":o("components.userMenu.dialogTitle"),children:b.jsx(wf,{user:t,settingsItems:e,showSettings:r,actions:n,termOfServiceUrl:i})})})]})},Qm=({user:t,settingsCTA:e,logout:r,termOfServiceUrl:n,actions:i})=>{const{t:o}=X.useCunningham(),{isTablet:a}=ot(),l=u.useMemo(()=>{const c=[];return e&&c.push({label:o("components.userMenu.manage_account"),icon:"settings",onClick:typeof e=="function"?e:typeof e=="string"?()=>window.open(e,"_blank","noopener,noreferrer"):void 0}),r&&c.push({label:o("components.userMenu.logout"),icon:"logout",onClick:r}),c},[e,r,o]),s=l.length>0;return t?b.jsx(b.Fragment,{children:a?b.jsx(Xm,{user:t,settingsItems:l,showSettings:s,actions:i,termOfServiceUrl:n}):b.jsx(Jm,{user:t,settingsItems:l,showSettings:s,actions:i,termOfServiceUrl:n})}):null},xf=({label:t,icon:e,onClick:r})=>b.jsxs("div",{className:"user-menu__item",onClick:r,children:[b.jsx(Jr,{name:e}),b.jsx("span",{className:"user-menu__item__label",children:t})]}),Df=({user:t,triggerRef:e,id:r,openState:n,toggleUserMenu:i})=>{const{t:o}=X.useCunningham();return t?b.jsx(X.Button,{variant:"tertiary",size:"small",ref:e,id:r,onClick:i,"aria-label":o(n?"components.userMenu.close":"components.userMenu.open"),title:o(n?"components.userMenu.close":"components.userMenu.open"),children:b.jsx(Gi,{fullName:t.full_name??t.email})}):null},Sf=()=>{const t=u.useId(),[e,r]=u.useState(!1),n=()=>{r(!e)},i=u.useRef(null);return{id:t,openState:e,setOpenState:r,toggleUserMenu:n,triggerRef:i}},Tl=(t,e)=>e&&t.activeIcon?t.activeIcon:t.icon,Ff=u.forwardRef(({step:t,isActive:e,onClick:r,index:n,ariaLabel:i},o)=>{const a=Tl(t,e);return b.jsxs("button",{ref:o,type:"button",className:ve("c__onboarding-modal__step",{"c__onboarding-modal__step--active":e}),onClick:r,"aria-current":e?"step":void 0,"aria-label":i,tabIndex:e?0:-1,"data-testid":`onboarding-step-${n}`,children:[b.jsx("div",{className:"c__onboarding-modal__step__icon","aria-hidden":"true",children:a}),b.jsxs("div",{className:"c__onboarding-modal__step__content",children:[b.jsx("span",{className:"c__onboarding-modal__step__title",children:t.title}),t.description&&b.jsx("div",{className:"c__onboarding-modal__step__description-wrapper",children:b.jsx("span",{className:"c__onboarding-modal__step__description",children:t.description})})]})]})});Ff.displayName="OnboardingStepItem";const ey=200,$f=({isOpen:t,size:e=X.ModalSize.LARGE,appName:r,mainTitle:n,steps:i,initialStep:o=0,footerLink:a,hideContent:l,onSkip:s,onComplete:c,onClose:d,labels:f})=>{const{t:p}=X.useCunningham(),{isMobile:g}=ot(),[y,h]=u.useState(o),[v,m]=u.useState(o),[C,E]=u.useState(!1),F=u.useRef([]),D=u.useRef(null),w=u.useRef(null),S=y===i.length-1,O=y===0,K=(f==null?void 0:f.skip)??p("components.onboarding.skip"),V=(f==null?void 0:f.next)??p("components.onboarding.next"),x=(f==null?void 0:f.previous)??p("components.onboarding.previous"),B=(f==null?void 0:f.complete)??p("components.onboarding.complete"),U=i[v],k=!l&&!!(U!=null&&U.content),W=u.useCallback((T,M)=>{const j=p("components.onboarding.stepLabel").replace("{current}",String(T+1)).replace("{total}",String(i.length)).replace("{title}",M);return T===y?j+p("components.onboarding.currentStepSuffix"):j},[p,i.length,y]),_=u.useCallback(()=>p("components.onboarding.contentRegionLabel").replace("{current}",String(v+1)).replace("{total}",String(i.length)),[p,v,i.length]);u.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]),u.useEffect(()=>{const T=F.current[y];T&&T.scrollIntoView({behavior:"smooth",block:"nearest"})},[y]),u.useEffect(()=>{if(t){w.current&&(clearTimeout(w.current),w.current=null),h(o),m(o),E(!1);const T=setTimeout(()=>{requestAnimationFrame(()=>{const M=F.current[o];M&&!g&&M.focus()})},150);return()=>clearTimeout(T)}},[t,o,g]);const I=u.useCallback(T=>{T!==y&&(w.current&&clearTimeout(w.current),E(!0),h(T),w.current=setTimeout(()=>{m(T),E(!1),w.current=null},ey))},[y]);u.useEffect(()=>{const T=D.current;if(!T)return;const M=j=>{if(j.key!=="ArrowUp"&&j.key!=="ArrowDown"||!j.target.closest(".c__onboarding-modal__step"))return;j.preventDefault();const Z=j.key==="ArrowDown"?(y+1)%i.length:(y-1+i.length)%i.length;I(Z),setTimeout(()=>{var q;(q=F.current[Z])==null||q.focus()},0)};return T.addEventListener("keydown",M),()=>T.removeEventListener("keydown",M)},[y,i.length,I]);const z=u.useCallback(()=>{S?c():I(y+1)},[S,c,I,y]),L=u.useCallback(()=>{O||I(y-1)},[O,I,y]),N=u.useCallback(()=>{s==null||s()},[s]);if(i.length===0)return null;const R=Math.max(0,Math.min(o,i.length-1));R!==o&&process.env.NODE_ENV==="development"&&console.warn(`OnboardingModal: initialStep (${o}) is out of bounds. Using ${R} instead.`);const $=a?b.jsxs("a",{className:"c__onboarding-modal__footer-link",target:"_blank",href:a.href,onClick:T=>{a.onClick&&(a.href||T.preventDefault(),a.onClick())},children:[b.jsx("span",{className:"material-icons","aria-hidden":"true",children:"info"}),b.jsx("span",{className:"c__onboarding-modal__footer-link__label",children:a.label})]}):void 0,P=b.jsxs(b.Fragment,{children:[g&&!O&&b.jsx(X.Button,{variant:"secondary",onClick:L,"data-testid":"onboarding-previous",children:x}),s&&b.jsx(X.Button,{variant:"tertiary",onClick:N,"data-testid":"onboarding-skip",children:K}),b.jsx(X.Button,{variant:"primary",onClick:z,"data-testid":"onboarding-next",children:S?B:V})]});return b.jsx(X.Modal,{isOpen:t,onClose:d,size:g?X.ModalSize.FULL:e,closeOnClickOutside:!0,title:"","aria-label":n,leftActions:$,rightActions:P,children:b.jsxs("div",{className:"c__onboarding-modal","data-testid":"onboarding-modal",children:[b.jsxs("div",{className:"c__onboarding-modal__header",children:[r&&b.jsx("div",{className:"c__onboarding-modal__app-name",children:r}),b.jsx("h2",{className:"c__onboarding-modal__main-title",children:n})]}),b.jsxs("div",{className:ve("c__onboarding-modal__body",{"c__onboarding-modal__body--text-only":!k}),children:[b.jsx("div",{ref:D,className:"c__onboarding-modal__steps",role:"tablist","aria-orientation":"vertical","aria-label":n,children:i.map((T,M)=>b.jsx(Ff,{ref:j=>{F.current[M]=j},step:T,index:M,totalSteps:i.length,isActive:M===y,ariaLabel:W(M,T.title),onClick:()=>I(M)},M))}),k&&b.jsx("div",{className:"c__onboarding-modal__content",role:"tabpanel","aria-live":"polite","aria-atomic":"true","aria-label":_(),children:b.jsx("div",{className:ve("c__onboarding-modal__content-inner",{"c__onboarding-modal__content-inner--fading":C}),children:U==null?void 0:U.content})}),(k||l)&&b.jsxs("div",{className:"c__onboarding-modal__mobile-step",children:[b.jsx("div",{className:"c__onboarding-modal__mobile-step__icon","aria-hidden":"true",children:U&&Tl(U,!0)}),b.jsxs("div",{className:"c__onboarding-modal__mobile-step__content",children:[b.jsx("span",{className:"c__onboarding-modal__mobile-step__title",children:U==null?void 0:U.title}),(U==null?void 0:U.description)&&b.jsx("span",{className:"c__onboarding-modal__mobile-step__description",children:U.description})]})]})]})]})})},ty=({steps:t,...e})=>b.jsx($f,{...e,steps:t,size:X.ModalSize.MEDIUM,hideContent:!0}),ry=(t,e={})=>Ti.getThemesFromGlobals(gr(Xr,t),{...e,overrides:gr(ki,e.overrides??{})});Object.defineProperty(exports,"ModalSize",{enumerable:!0,get:()=>X.ModalSize});exports.AVATAR_COLORS=Aa;exports.AccessRoleDropdown=Zi;exports.Badge=jm;exports.ContextMenu=qh;exports.ContextMenuProvider=Gh;exports.CunninghamProvider=Bf;exports.CustomTabs=vg;exports.DropdownMenu=Yr;exports.Filter=Jh;exports.Footer=Xh;exports.Header=cd;exports.Hero=e7;exports.HomeGutter=t7;exports.HorizontalSeparator=an;exports.Icon=Jr;exports.IconSize=De;exports.IconType=ii;exports.InvitationUserSelectorItem=bf;exports.InvitationUserSelectorList=vf;exports.LaGaufre=f7;exports.LaGaufreV2=od;exports.Label=Id;exports.LanguagePicker=sd;exports.LeftPanel=ud;exports.MainLayout=np;exports.OnboardingModal=$f;exports.ProConnectButton=S2;exports.QuickSearch=b1;exports.QuickSearchGroup=m1;exports.QuickSearchInput=v1;exports.QuickSearchItem=Bn;exports.QuickSearchItemTemplate=Ki;exports.ReleaseNoteModal=ty;exports.SearchUserItem=Ta;exports.ShareInvitationItem=Cf;exports.ShareMemberItem=yf;exports.ShareModal=qm;exports.ShareModalCopyLinkFooter=Ym;exports.Spinner=li;exports.TreeApi=pr;exports.TreeContext=_l;exports.TreeProvider=Sm;exports.TreeView=Fm;exports.TreeViewItem=Lm;exports.TreeViewMoveModeEnum=wt;exports.TreeViewNodeTypeEnum=se;exports.TreeViewSeparator=df;exports.UserAvatar=Gi;exports.UserMenu=Qm;exports.UserMenuItem=xf;exports.UserRow=qi;exports.VerticalSeparator=gg;exports.WithLabel=op;exports.anctGlobals=id;exports.containerSizeMap=ld;exports.cunninghamConfig=fa;exports.dsfrGlobals=nd;exports.getContainerSize=x7;exports.getIconSize=D7;exports.getStepIcon=Tl;exports.getUIKitThemesFromGlobals=ry;exports.getUserColor=Al;exports.getUserInitials=mf;exports.headerHeight=ip;exports.iconSizeMap=ad;exports.isNode=zr;exports.isSeparator=fi;exports.isTitle=hi;exports.isViewMore=ff;exports.locales=D2;exports.useArrowRoving=Km;exports.useContextMenuContext=Qu;exports.useCustomTranslations=Ef;exports.useDropdownMenu=mr;exports.useResponsive=ot;exports.useTree=hf;exports.useTreeContext=Pl;exports.whiteLabelGlobals=rd;
99
99
  //# sourceMappingURL=index.cjs.map