@gouvfr-lasuite/ui-kit 0.1.8 → 0.1.9

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
@@ -98,5 +98,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
98
98
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LE(t,e){if(t){if(typeof t=="string")return ql(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ql(t,e)}}function ql(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function FE(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,s;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw s}}return r}}function jE(t){if(Array.isArray(t))return t}function zE(t,e,n){var r=Ht(),i=ME(t,e),o=IE(t);Ft(function(){var s=V0(o,i,r),l=AE(s,2),u=l[0],c=l[1];return e.receiveHandlerId(u),n.receiveHandlerId(u),c},[r,e,i,n,o.map(function(a){return a.toString()}).join("|")])}function HE(){var t=Ht();return d.useMemo(function(){return new N0(t)},[t])}function BE(t){var e=Ht(),n=d.useMemo(function(){return new U0(e.getBackend())},[e]);return Ft(function(){return n.dropTargetOptions=t||null,n.reconnect(),function(){return n.disconnectDropTarget()}},[t]),n}function WE(t){return d.useMemo(function(){return t.hooks.dropTarget()},[t])}function zf(t,e){var n=Lf(t,e),r=HE(),i=BE(n.options);return zE(n,r,i),[jf(n.collect,r,i),WE(i)]}function UE(t,e){return YE(t)||qE(t,e)||GE(t,e)||VE()}function VE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
99
99
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GE(t,e){if(t){if(typeof t=="string")return Yl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yl(t,e)}}function Yl(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function qE(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,s;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw s}}return r}}function YE(t){if(Array.isArray(t))return t}function XE(t){var e=Ht(),n=e.getMonitor(),r=Ff(n,t),i=UE(r,2),o=i[0],a=i[1];return d.useEffect(function(){return n.subscribeToOffsetChange(a)}),d.useEffect(function(){return n.subscribeToStateChange(a)}),o}function Hf(t){var e=null,n=function(){return e==null&&(e=t()),e};return n}function JE(t,e){return t.filter(function(n){return n!==e})}function QE(t,e){var n=new Set,r=function(a){return n.add(a)};t.forEach(r),e.forEach(r);var i=[];return n.forEach(function(o){return i.push(o)}),i}function ZE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e$(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function t$(t,e,n){return e$(t.prototype,e),t}function Xl(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var n$=function(){function t(e){ZE(this,t),Xl(this,"entered",[]),Xl(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return t$(t,[{key:"enter",value:function(n){var r=this,i=this.entered.length,o=function(s){return r.isNodeInDocument(s)&&(!s.contains||s.contains(n))};return this.entered=QE(this.entered.filter(o),[n]),i===0&&this.entered.length>0}},{key:"leave",value:function(n){var r=this.entered.length;return this.entered=JE(this.entered.filter(this.isNodeInDocument),n),r>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),t}(),r$=Hf(function(){return/firefox/i.test(navigator.userAgent)}),Bf=Hf(function(){return!!window.safari});function i$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o$(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a$(t,e,n){return o$(t.prototype,e),t}function An(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Jl=function(){function t(e,n){i$(this,t),An(this,"xs",void 0),An(this,"ys",void 0),An(this,"c1s",void 0),An(this,"c2s",void 0),An(this,"c3s",void 0);for(var r=e.length,i=[],o=0;o<r;o++)i.push(o);i.sort(function(b,R){return e[b]<e[R]?-1:1});for(var a=[],s=[],l,u,c=0;c<r-1;c++)l=e[c+1]-e[c],u=n[c+1]-n[c],a.push(l),s.push(u/l);for(var h=[s[0]],p=0;p<a.length-1;p++){var g=s[p],m=s[p+1];if(g*m<=0)h.push(0);else{l=a[p];var f=a[p+1],v=l+f;h.push(3*v/((v+f)/g+(v+l)/m))}}h.push(s[s.length-1]);for(var y=[],S=[],w,T=0;T<h.length-1;T++){w=s[T];var x=h[T],I=1/a[T],P=x+h[T+1]-w-w;y.push((w-x-P)*I),S.push(P*I*I)}this.xs=e,this.ys=n,this.c1s=h,this.c2s=y,this.c3s=S}return a$(t,[{key:"interpolate",value:function(n){var r=this.xs,i=this.ys,o=this.c1s,a=this.c2s,s=this.c3s,l=r.length-1;if(n===r[l])return i[l];for(var u=0,c=s.length-1,h;u<=c;){h=Math.floor(.5*(u+c));var p=r[h];if(p<n)u=h+1;else if(p>n)c=h-1;else return i[h]}l=Math.max(0,c);var g=n-r[l],m=g*g;return i[l]+o[l]*g+a[l]*m+s[l]*g*m}}]),t}(),s$=1;function Wf(t){var e=t.nodeType===s$?t:t.parentElement;if(!e)return null;var n=e.getBoundingClientRect(),r=n.top,i=n.left;return{x:i,y:r}}function Pr(t){return{x:t.clientX,y:t.clientY}}function l$(t){var e;return t.nodeName==="IMG"&&(r$()||!((e=document.documentElement)!==null&&e!==void 0&&e.contains(t)))}function u$(t,e,n,r){var i=t?e.width:n,o=t?e.height:r;return Bf()&&t&&(o/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:o}}function c$(t,e,n,r,i){var o=l$(e),a=o?t:e,s=Wf(a),l={x:n.x-s.x,y:n.y-s.y},u=t.offsetWidth,c=t.offsetHeight,h=r.anchorX,p=r.anchorY,g=u$(o,e,u,c),m=g.dragPreviewWidth,f=g.dragPreviewHeight,v=function(){var P=new Jl([0,.5,1],[l.y,l.y/c*f,l.y+f-c]),b=P.interpolate(p);return Bf()&&o&&(b+=(window.devicePixelRatio-1)*f),b},y=function(){var P=new Jl([0,.5,1],[l.x,l.x/u*m,l.x+m-u]);return P.interpolate(h)},S=i.offsetX,w=i.offsetY,T=S===0||S,x=w===0||w;return{x:T?S:y(),y:x?w:v()}}var Uf="__NATIVE_FILE__",Vf="__NATIVE_URL__",Gf="__NATIVE_TEXT__",qf="__NATIVE_HTML__";const Ql=Object.freeze(Object.defineProperty({__proto__:null,FILE:Uf,HTML:qf,TEXT:Gf,URL:Vf},Symbol.toStringTag,{value:"Module"}));function po(t,e,n){var r=e.reduce(function(i,o){return i||t.getData(o)},"");return r??n}var en;function Or(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ra=(en={},Or(en,Uf,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),Or(en,qf,{exposeProperties:{html:function(e,n){return po(e,n,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),Or(en,Vf,{exposeProperties:{urls:function(e,n){return po(e,n,"").split(`
100
100
  `)},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),Or(en,Gf,{exposeProperties:{text:function(e,n){return po(e,n,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),en);function d$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f$(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h$(t,e,n){return f$(t.prototype,e),t}function Zl(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var p$=function(){function t(e){d$(this,t),Zl(this,"item",void 0),Zl(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return h$(t,[{key:"initializeExposedProperties",value:function(){var n=this;Object.keys(this.config.exposeProperties).forEach(function(r){Object.defineProperty(n.item,r,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(r,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(n){var r=this;if(n){var i={};Object.keys(this.config.exposeProperties).forEach(function(o){i[o]={value:r.config.exposeProperties[o](n,r.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(n,r){return r===n.getSourceId()}},{key:"endDrag",value:function(){}}]),t}();function g$(t,e){var n=new p$(ra[t]);return n.loadDataTransfer(e),n}function go(t){if(!t)return null;var e=Array.prototype.slice.call(t.types||[]);return Object.keys(ra).filter(function(n){var r=ra[n].matchesTypes;return r.some(function(i){return e.indexOf(i)>-1})})[0]||null}function v$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m$(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function y$(t,e,n){return m$(t.prototype,e),t}function vo(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var b$=function(){function t(e,n){v$(this,t),vo(this,"ownerDocument",null),vo(this,"globalContext",void 0),vo(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=n}return y$(t,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var n;return(n=this.globalContext)!==null&&n!==void 0&&n.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var n;return((n=this.optionsArgs)===null||n===void 0?void 0:n.rootElement)||this.window}}]),t}();function eu(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function tu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eu(Object(n),!0).forEach(function(r){te(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eu(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function S$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w$(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function E$(t,e,n){return w$(t.prototype,e),t}function te(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var $$=function(){function t(e,n,r){var i=this;S$(this,t),te(this,"options",void 0),te(this,"actions",void 0),te(this,"monitor",void 0),te(this,"registry",void 0),te(this,"enterLeaveCounter",void 0),te(this,"sourcePreviewNodes",new Map),te(this,"sourcePreviewNodeOptions",new Map),te(this,"sourceNodes",new Map),te(this,"sourceNodeOptions",new Map),te(this,"dragStartSourceIds",null),te(this,"dropTargetIds",[]),te(this,"dragEnterTargetIds",[]),te(this,"currentNativeSource",null),te(this,"currentNativeHandle",null),te(this,"currentDragSourceNode",null),te(this,"altKeyPressed",!1),te(this,"mouseMoveTimeoutTimer",null),te(this,"asyncEndDragFrameId",null),te(this,"dragOverTargetIds",null),te(this,"lastClientOffset",null),te(this,"hoverRafId",null),te(this,"getSourceClientOffset",function(o){var a=i.sourceNodes.get(o);return a&&Wf(a)||null}),te(this,"endDragNativeItem",function(){i.isDraggingNativeItem()&&(i.actions.endDrag(),i.currentNativeHandle&&i.registry.removeSource(i.currentNativeHandle),i.currentNativeHandle=null,i.currentNativeSource=null)}),te(this,"isNodeInDocument",function(o){return!!(o&&i.document&&i.document.body&&i.document.body.contains(o))}),te(this,"endDragIfSourceWasRemovedFromDOM",function(){var o=i.currentDragSourceNode;o==null||i.isNodeInDocument(o)||i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),te(this,"handleTopDragStartCapture",function(){i.clearCurrentDragSourceNode(),i.dragStartSourceIds=[]}),te(this,"handleTopDragStart",function(o){if(!o.defaultPrevented){var a=i.dragStartSourceIds;i.dragStartSourceIds=null;var s=Pr(o);i.monitor.isDragging()&&i.actions.endDrag(),i.actions.beginDrag(a||[],{publishSource:!1,getSourceClientOffset:i.getSourceClientOffset,clientOffset:s});var l=o.dataTransfer,u=go(l);if(i.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){var c=i.monitor.getSourceId(),h=i.sourceNodes.get(c),p=i.sourcePreviewNodes.get(c)||h;if(p){var g=i.getCurrentSourcePreviewNodeOptions(),m=g.anchorX,f=g.anchorY,v=g.offsetX,y=g.offsetY,S={anchorX:m,anchorY:f},w={offsetX:v,offsetY:y},T=c$(h,p,s,S,w);l.setDragImage(p,T.x,T.y)}}try{l==null||l.setData("application/json",{})}catch{}i.setCurrentDragSourceNode(o.target);var x=i.getCurrentSourcePreviewNodeOptions(),I=x.captureDraggingState;I?i.actions.publishDragSource():setTimeout(function(){return i.actions.publishDragSource()},0)}else if(u)i.beginDragNativeItem(u);else{if(l&&!l.types&&(o.target&&!o.target.hasAttribute||!o.target.hasAttribute("draggable")))return;o.preventDefault()}}}),te(this,"handleTopDragEndCapture",function(){i.clearCurrentDragSourceNode()&&i.monitor.isDragging()&&i.actions.endDrag()}),te(this,"handleTopDragEnterCapture",function(o){i.dragEnterTargetIds=[];var a=i.enterLeaveCounter.enter(o.target);if(!(!a||i.monitor.isDragging())){var s=o.dataTransfer,l=go(s);l&&i.beginDragNativeItem(l,s)}}),te(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:Pr(o)});var s=a.some(function(l){return i.monitor.canDropOnTarget(l)});s&&(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect()))}}),te(this,"handleTopDragOverCapture",function(){i.dragOverTargetIds=[]}),te(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=Pr(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 s=(a||[]).some(function(l){return i.monitor.canDropOnTarget(l)});s?(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect=i.getCurrentDropEffect())):i.isDraggingNativeItem()?o.preventDefault():(o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="none"))}),te(this,"handleTopDragLeaveCapture",function(o){i.isDraggingNativeItem()&&o.preventDefault();var a=i.enterLeaveCounter.leave(o.target);a&&i.isDraggingNativeItem()&&setTimeout(function(){return i.endDragNativeItem()},0)}),te(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 go(o.dataTransfer)&&o.preventDefault();i.enterLeaveCounter.reset()}),te(this,"handleTopDrop",function(o){var a=i.dropTargetIds;i.dropTargetIds=[],i.actions.hover(a,{clientOffset:Pr(o)}),i.actions.drop({dropEffect:i.getCurrentDropEffect()}),i.isDraggingNativeItem()?i.endDragNativeItem():i.monitor.isDragging()&&i.actions.endDrag()}),te(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 b$(n,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new n$(this.isNodeInDocument)}return E$(t,[{key:"profile",value:function(){var n,r;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((n=this.dragStartSourceIds)===null||n===void 0?void 0:n.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((r=this.dragOverTargetIds)===null||r===void 0?void 0:r.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 n=this.rootElement;if(n!==void 0){if(n.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");n.__isReactDndBackendSetUp=!0,this.addEventListeners(n)}}},{key:"teardown",value:function(){var n=this.rootElement;if(n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var r;(r=this.window)===null||r===void 0||r.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(n,r,i){var o=this;return this.sourcePreviewNodeOptions.set(n,i),this.sourcePreviewNodes.set(n,r),function(){o.sourcePreviewNodes.delete(n),o.sourcePreviewNodeOptions.delete(n)}}},{key:"connectDragSource",value:function(n,r,i){var o=this;this.sourceNodes.set(n,r),this.sourceNodeOptions.set(n,i);var a=function(u){return o.handleDragStart(u,n)},s=function(u){return o.handleSelectStart(u)};return r.setAttribute("draggable","true"),r.addEventListener("dragstart",a),r.addEventListener("selectstart",s),function(){o.sourceNodes.delete(n),o.sourceNodeOptions.delete(n),r.removeEventListener("dragstart",a),r.removeEventListener("selectstart",s),r.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(n,r){var i=this,o=function(u){return i.handleDragEnter(u,n)},a=function(u){return i.handleDragOver(u,n)},s=function(u){return i.handleDrop(u,n)};return r.addEventListener("dragenter",o),r.addEventListener("dragover",a),r.addEventListener("drop",s),function(){r.removeEventListener("dragenter",o),r.removeEventListener("dragover",a),r.removeEventListener("drop",s)}}},{key:"addEventListeners",value:function(n){n.addEventListener&&(n.addEventListener("dragstart",this.handleTopDragStart),n.addEventListener("dragstart",this.handleTopDragStartCapture,!0),n.addEventListener("dragend",this.handleTopDragEndCapture,!0),n.addEventListener("dragenter",this.handleTopDragEnter),n.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.addEventListener("dragover",this.handleTopDragOver),n.addEventListener("dragover",this.handleTopDragOverCapture,!0),n.addEventListener("drop",this.handleTopDrop),n.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(n){n.removeEventListener&&(n.removeEventListener("dragstart",this.handleTopDragStart),n.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),n.removeEventListener("dragend",this.handleTopDragEndCapture,!0),n.removeEventListener("dragenter",this.handleTopDragEnter),n.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.removeEventListener("dragover",this.handleTopDragOver),n.removeEventListener("dragover",this.handleTopDragOverCapture,!0),n.removeEventListener("drop",this.handleTopDrop),n.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var n=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(n);return tu({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var n=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(n);return tu({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}},{key:"isDraggingNativeItem",value:function(){var n=this.monitor.getItemType();return Object.keys(Ql).some(function(r){return Ql[r]===n})}},{key:"beginDragNativeItem",value:function(n,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=g$(n,r),this.currentNativeHandle=this.registry.addSource(n,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(n){var r=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=n;var i=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var o;return(o=r.rootElement)===null||o===void 0?void 0:o.addEventListener("mousemove",r.endDragIfSourceWasRemovedFromDOM,!0)},i)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var n;(n=this.window)===null||n===void 0||n.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(n,r){n.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}},{key:"handleDragEnter",value:function(n,r){this.dragEnterTargetIds.unshift(r)}},{key:"handleDragOver",value:function(n,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}},{key:"handleDrop",value:function(n,r){this.dropTargetIds.unshift(r)}}]),t}(),Ir;function x$(){return Ir||(Ir=new Image,Ir.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ir}var C$=function(e,n,r){return new $$(e,n,r)};function T$(t){const e=Oe(),n=e.selectedIds,[r,i,o]=OE(()=>({canDrag:()=>t.isDraggable,type:"NODE",item:()=>{const a=e.isSelected(t.id)?Array.from(n):[t.id];return e.dispatch(En.dragStart(t.id,a)),{id:t.id,dragIds:a}},end:()=>{e.hideCursor(),e.dispatch(En.dragEnd())}}),[n,t]);return d.useEffect(()=>{o(x$())},[o]),i}function D$(t,e){const n=t.getBoundingClientRect(),r=e.x-Math.round(n.x),i=e.y-Math.round(n.y),o=n.height,a=i<o/2,s=!a,l=o/4,u=i>l&&i<o-l;return{x:r,inTopHalf:a,inBottomHalf:s,inMiddle:u,atTop:!u&&a,atBottom:!u&&s}}function P$(t,e,n,r){return t?t.isInternal?r.atTop?[e,t]:r.inMiddle?[t,t]:[t,n]:r.inTopHalf?[e,t]:[t,n]:[e,null]}function _r(t,e){return{parentId:t||null,index:e}}function tn(t,e){return{type:"line",index:t,level:e}}function O$(t){return{type:"highlight",id:t}}function mo(t,e){var n;let r=t;for(;r.parent&&r.level>e;)r=r.parent;const i=((n=r.parent)===null||n===void 0?void 0:n.id)||null,o=bf(r)+1;return{parentId:i,index:o}}function Yf(t){var e;const n=D$(t.element,t.offset),r=t.indent,i=Math.round(Math.max(0,n.x-r)/r),{node:o,nextNode:a,prevNode:s}=t,[l,u]=P$(o,s,a,n);if(o&&o.isInternal&&n.inMiddle)return{drop:_r(o.id,null),cursor:O$(o.id)};if(!l)return{drop:_r((e=u==null?void 0:u.parent)===null||e===void 0?void 0:e.id,0),cursor:tn(0,0)};if(gf(l)){const c=Ar(i,(u==null?void 0:u.level)||0,l.level);return{drop:mo(l,c),cursor:tn(l.rowIndex+1,c)}}if(vf(l)){const c=Ar(i,(u==null?void 0:u.level)||0,l.level);return{drop:mo(l,c),cursor:tn(l.rowIndex+1,c)}}if(mf(l)){const c=Ar(i,0,l.level+1);return c>l.level?{drop:_r(l.id,0),cursor:tn(l.rowIndex+1,c)}:{drop:mo(l,c),cursor:tn(l.rowIndex+1,c)}}return{drop:_r(l==null?void 0:l.id,0),cursor:tn(l.rowIndex+1,l.level+1)}}function I$(t,e){const n=Oe(),[r,i]=zf(()=>({accept:"NODE",canDrop:()=>n.canDrop(),hover:(o,a)=>{const s=a.getClientOffset();if(!t.current||!s)return;const{cursor:l,drop:u}=Yf({element:t.current,offset:s,indent:n.indent,node:e,prevNode:e.prev,nextNode:e.next});u&&n.dispatch(En.hovering(u.parentId,u.index)),a.canDrop()?l&&n.showCursor(l):n.hideCursor()},drop:(o,a)=>{if(!a.canDrop())return null;let{parentId:s,index:l,dragIds:u}=n.state.dnd;xf(n.props.onMove,{dragIds:u,parentId:s===er?null:s,index:l===null?0:l,dragNodes:n.dragNodes,parentNode:n.get(s)}),n.open(s)}}),[e,t.current,n.props]);return i}function _$(t){const e=Oe(),n=e.at(t);if(!n)throw new Error(`Could not find node for index: ${t}`);return d.useMemo(()=>{const r=n.clone();return e.visibleNodes[t]=r,r},[...Object.values(n.state),n])}const k$=d.memo(function({index:e,style:n}){pf(),Qb();const r=Oe(),i=_$(e),o=d.useRef(null),a=T$(i),s=I$(o,i),l=d.useCallback(f=>{o.current=f,s(f)},[s]),u=r.indent*i.level,c=d.useMemo(()=>({paddingLeft:u}),[u]),h=d.useMemo(()=>{var f,v;return Object.assign(Object.assign({},n),{top:parseFloat(n.top)+((v=(f=r.props.padding)!==null&&f!==void 0?f:r.props.paddingTop)!==null&&v!==void 0?v:0)})},[n,r.props.padding,r.props.paddingTop]),p={role:"treeitem","aria-level":i.level+1,"aria-selected":i.isSelected,"aria-expanded":i.isOpen,style:h,tabIndex:-1,className:r.props.rowClassName};d.useEffect(()=>{var f;!i.isEditing&&i.isFocused&&((f=o.current)===null||f===void 0||f.focus({preventScroll:!0}))},[i.isEditing,i.isFocused,o.current]);const g=r.renderNode,m=r.renderRow;return D.jsx(m,{node:i,innerRef:l,attrs:p,children:D.jsx(g,{node:i,tree:r,style:c,dragHandle:a})})});let yo="",nu=null;function Xf(){pf();const t=Oe();return D.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 n;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,s=o.parent;t.focus(a||s,{scroll:!1}),t.delete(o)}}return}if(e.key==="Tab"&&!e.shiftKey){e.preventDefault(),Sf(e.currentTarget);return}if(e.key==="Tab"&&e.shiftKey){e.preventDefault(),wf(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):!((n=i.parent)===null||n===void 0)&&n.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(nu),yo+=e.key,nu=setTimeout(()=>{yo=""},600);const r=t.visibleNodes.find(i=>{const o=i.data.name;return typeof o=="string"?o.toLowerCase().startsWith(yo):!1});r&&t.focus(r.id)},children:D.jsx(MS,{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 n;return((n=t.visibleNodes[e])===null||n===void 0?void 0:n.id)||e},outerElementType:LS,innerElementType:zS,onScroll:t.props.onScroll,onItemsRendered:t.onItemsRendered.bind(t),ref:t.list,children:k$})})}function ru(t){return t.isFiltered?N$(t.root,t.isMatch.bind(t)):R$(t.root)}function R$(t){const e=[];function n(r){var i;r.level>=0&&e.push(r),r.isOpen&&((i=r.children)===null||i===void 0||i.forEach(n))}return n(t),e.forEach(Jf),e}function N$(t,e){const n={},r=[];function i(a){if(!a.isRoot&&e(a)){n[a.id]=!0;let l=a.parent;for(;l;)n[l.id]=!0,l=l.parent}if(a.children)for(let l of a.children)i(l)}function o(a){var s;a.level>=0&&n[a.id]&&r.push(a),a.isOpen&&((s=a.children)===null||s===void 0||s.forEach(o))}return i(t),o(t),r.forEach(Jf),r}function Jf(t,e){t.rowIndex=e}const iu=t=>t.reduce((e,n,r)=>(e[n.id]=r,e),{});var bo=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(h){a(h)}}function l(c){try{u(r.throw(c))}catch(h){a(h)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(t,e||[])).next())})};const{safeRun:he,identify:et,identifyNull:je}=iS;class vn{constructor(e,n,r,i){this.store=e,this.props=n,this.list=r,this.listEl=i,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=pl(this),this.visibleNodes=ru(this),this.idToIndex=iu(this.visibleNodes)}update(e){this.props=e,this.root=pl(this),this.visibleNodes=ru(this),this.idToIndex=iu(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 n=(e=this.props.searchMatch)!==null&&e!==void 0?e:(r,i)=>JSON.stringify(Object.values(r.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return r=>n(r,this.searchTerm)}accessChildren(e){var n;const r=this.props.childrenAccessor||"children";return(n=zn(e,r))!==null&&n!==void 0?n:null}accessId(e){const n=this.props.idAccessor||"id",r=zn(e,n);if(!r)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return r}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,n){var r;if(e===null||n===null)return[];const i=(r=this.indexOf(e))!==null&&r!==void 0?r:0,o=this.indexOf(n);if(o===null)return[];const a=Math.min(i,o),s=Math.max(i,o);return this.visibleNodes.slice(a,s+1)}indexOf(e){const n=$f(e);return n?this.idToIndex[n]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return bo(this,arguments,void 0,function*(e={}){var n,r;const i=e.parentId===void 0?Df(this):e.parentId,o=(n=e.index)!==null&&n!==void 0?n:Tf(this),a=(r=e.type)!==null&&r!==void 0?r:"leaf",s=yield he(this.props.onCreate,{type:a,parentId:i,index:o,parentNode:this.get(i)});s&&(this.focus(s),setTimeout(()=>{this.edit(s).then(()=>{this.select(s),this.activate(s)})}))})}delete(e){return bo(this,void 0,void 0,function*(){if(!e)return;const r=(Array.isArray(e)?e:[e]).map(et),i=r.map(o=>this.get(o)).filter(o=>!!o);yield he(this.props.onDelete,{nodes:i,ids:r})})}edit(e){const n=et(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(n),this.dispatch(io(n)),new Promise(r=>{vn.editPromise=r})}submit(e,n){return bo(this,void 0,void 0,function*(){if(!e)return;const r=et(e);yield he(this.props.onRename,{id:r,name:n,node:this.get(r)}),this.dispatch(io(null)),this.resolveEdit({cancelled:!1,value:n}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(io(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){const n=this.get(je(e));n&&he(this.props.onActivate,n)}resolveEdit(e){const n=vn.editPromise;n&&n(e),vn.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let n of Array.from(this.selectedIds)){const r=this.get(n);r&&e.push(r)}return e}focus(e,n={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(Xt(et(e))),n.scroll!==!1&&this.scrollTo(e),this.focusedNode&&he(this.props.onFocus,this.focusedNode)))}pageUp(){var e,n;const r=this.visibleStartIndex,o=this.visibleStopIndex-r;let a=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;a>r?a=r:a=Math.max(r-o,0),this.focus(this.at(a))}pageDown(){var e,n;const r=this.visibleStartIndex,i=this.visibleStopIndex,o=i-r;let a=(n=(e=this.focusedNode)===null||e===void 0?void 0:e.rowIndex)!==null&&n!==void 0?n:0;a<i?a=i:a=Math.min(a+o,this.visibleNodes.length-1),this.focus(this.at(a))}select(e,n={}){if(!e)return;const r=n.focus!==!1,i=et(e);r&&this.dispatch(Xt(i)),this.dispatch(Fe.only(i)),this.dispatch(Fe.anchor(i)),this.dispatch(Fe.mostRecent(i)),this.scrollTo(i,n.align),this.focusedNode&&r&&he(this.props.onFocus,this.focusedNode),he(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;const n=et(e);this.dispatch(Fe.remove(n)),he(this.props.onSelect,this.selectedNodes)}selectMulti(e){const n=this.get(je(e));n&&(this.dispatch(Xt(n.id)),this.dispatch(Fe.add(n.id)),this.dispatch(Fe.anchor(n.id)),this.dispatch(Fe.mostRecent(n.id)),this.scrollTo(n),this.focusedNode&&he(this.props.onFocus,this.focusedNode),he(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;const n=et(e),{anchor:r,mostRecent:i}=this.state.nodes.selection;this.dispatch(Xt(n)),this.dispatch(Fe.remove(this.nodesBetween(r,i))),this.dispatch(Fe.add(this.nodesBetween(r,je(n)))),this.dispatch(Fe.mostRecent(n)),this.scrollTo(n),this.focusedNode&&he(this.props.onFocus,this.focusedNode),he(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),he(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(Xt((e=this.lastNode)===null||e===void 0?void 0:e.id)),this.focusedNode&&he(this.props.onFocus,this.focusedNode),he(this.props.onSelect,this.selectedNodes)}setSelection(e){var n;const r=new Set((n=e.ids)===null||n===void 0?void 0:n.map(et)),i=je(e.anchor),o=je(e.mostRecent);this.dispatch(Fe.set({ids:r,anchor:i,mostRecent:o})),he(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 n=(e=this.get(this.state.dnd.parentId))!==null&&e!==void 0?e:this.root,r=this.dragNodes,i=this.props.disableDrop;for(const o of r)if(!o||!n||o.isInternal&&yf(n,o))return!1;return typeof i=="function"?!i({parentNode:n,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof i=="string"?!n.data[i]:typeof i=="boolean"?!i:!0}hideCursor(){this.dispatch(En.cursor({type:"none"}))}showCursor(e){this.dispatch(En.cursor(e))}open(e){const n=je(e);n&&(this.isOpen(n)||(this.dispatch(Yo.open(n,this.isFiltered)),he(this.props.onToggle,n)))}close(e){const n=je(e);n&&this.isOpen(n)&&(this.dispatch(Yo.close(n,this.isFiltered)),he(this.props.onToggle,n))}toggle(e){const n=je(e);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(e){const n=je(e);if(!n)return;const r=Ma(this.root,n);let i=r==null?void 0:r.parent;for(;i;)this.open(i.id),i=i.parent}openSiblings(e){const n=e.parent;if(!n)this.toggle(e.id);else if(n.children){const r=e.isOpen;for(let i of n.children)i.isInternal&&(r?this.close(i.id):this.open(i.id));this.scrollTo(this.focusedNode)}}openAll(){oi(this.root,e=>{e.isInternal&&e.open()})}closeAll(){oi(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,n="smart"){if(!e)return;const r=et(e);return this.openParents(r),Cf(()=>r in this.idToIndex).then(()=>{var i;const o=this.idToIndex[r];o!==void 0&&((i=this.list.current)===null||i===void 0||i.scrollToItem(o,n))}).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 n,r,i;if(!e)return!1;if(e===er)return!0;const o=(n=this.props.openByDefault)!==null&&n!==void 0?n:!0;return this.isFiltered?(r=this.state.nodes.open.filtered[e])!==null&&r!==void 0?r:!0:(i=this.state.nodes.open.unfiltered[e])!==null&&i!==void 0?i:o}isEditable(e){const n=this.props.disableEdit||(()=>!1);return!zn(e,n)}isDraggable(e){const n=this.props.disableDrag||(()=>!1);return!zn(e,n)}isDragging(e){const n=je(e);return n?this.state.nodes.drag.id===n:!1}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){const n=je(e);if(!n)return!1;const{destinationParentId:r,destinationIndex:i}=this.state.nodes.drag;return n===r&&i===null}onFocus(){const e=this.focusedNode||this.firstNode;e&&this.dispatch(Xt(e.id))}onBlur(){this.dispatch(pS())}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Xf}get renderRow(){return this.props.renderRow||uS}get renderNode(){return this.props.children||cS}get renderDragPreview(){return this.props.renderDragPreview||Pf}get renderCursor(){return this.props.renderCursor||lS}}function Ee(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 M$=typeof Symbol=="function"&&Symbol.observable||"@@observable",ou=M$,So=()=>Math.random().toString(36).substring(7).split("").join("."),A$={INIT:`@@redux/INIT${So()}`,REPLACE:`@@redux/REPLACE${So()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${So()}`},Ot=A$;function Qf(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 K$(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(j$(t))return"date";if(F$(t))return"error";const n=L$(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return Object.prototype.toString.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"")}function L$(t){return typeof t.constructor=="function"?t.constructor.name:null}function F$(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function j$(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function dt(t){let e=typeof t;return process.env.NODE_ENV!=="production"&&(e=K$(t)),e}function Zf(t,e,n){if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?Ee(2):`Expected the root reducer to be a function. Instead, received: '${dt(t)}'`);if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Ee(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 n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(process.env.NODE_ENV==="production"?Ee(1):`Expected the enhancer to be a function. Instead, received: '${dt(n)}'`);return n(Zf)(t,e)}let r=t,i=e,o=new Map,a=o,s=0,l=!1;function u(){a===o&&(a=new Map,o.forEach((v,y)=>{a.set(y,v)}))}function c(){if(l)throw new Error(process.env.NODE_ENV==="production"?Ee(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 h(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?Ee(4):`Expected the listener to be a function. Instead, received: '${dt(v)}'`);if(l)throw new Error(process.env.NODE_ENV==="production"?Ee(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 y=!0;u();const S=s++;return a.set(S,v),function(){if(y){if(l)throw new Error(process.env.NODE_ENV==="production"?Ee(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.");y=!1,u(),a.delete(S),o=null}}}function p(v){if(!Qf(v))throw new Error(process.env.NODE_ENV==="production"?Ee(7):`Actions must be plain objects. Instead, the actual type was: '${dt(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"?Ee(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"?Ee(17):`Action "type" property must be a string. Instead, the actual type was: '${dt(v.type)}'. Value was: '${v.type}' (stringified)`);if(l)throw new Error(process.env.NODE_ENV==="production"?Ee(9):"Reducers may not dispatch actions.");try{l=!0,i=r(i,v)}finally{l=!1}return(o=a).forEach(S=>{S()}),v}function g(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?Ee(10):`Expected the nextReducer to be a function. Instead, received: '${dt(v)}`);r=v,p({type:Ot.REPLACE})}function m(){const v=h;return{subscribe(y){if(typeof y!="object"||y===null)throw new Error(process.env.NODE_ENV==="production"?Ee(11):`Expected the observer to be an object. Instead, received: '${dt(y)}'`);function S(){const T=y;T.next&&T.next(c())}return S(),{unsubscribe:v(S)}},[ou](){return this}}}return p({type:Ot.INIT}),{dispatch:p,subscribe:h,getState:c,replaceReducer:g,[ou]:m}}function au(t){typeof console<"u"&&typeof console.error=="function"&&console.error(t);try{throw new Error(t)}catch{}}function z$(t,e,n,r){const i=Object.keys(e),o=n&&n.type===Ot.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(!Qf(t))return`The ${o} has unexpected type of "${dt(t)}". Expected argument to be an object with the following keys: "${i.join('", "')}"`;const a=Object.keys(t).filter(s=>!e.hasOwnProperty(s)&&!r[s]);if(a.forEach(s=>{r[s]=!0}),!(n&&n.type===Ot.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 H$(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:Ot.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?Ee(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 n(void 0,{type:Ot.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?Ee(13):`The slice reducer for key "${e}" returned undefined when probed with a random type. Don't try to handle '${Ot.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 su(t){const e=Object.keys(t),n={};for(let a=0;a<e.length;a++){const s=e[a];process.env.NODE_ENV!=="production"&&typeof t[s]>"u"&&au(`No reducer provided for key "${s}"`),typeof t[s]=="function"&&(n[s]=t[s])}const r=Object.keys(n);let i;process.env.NODE_ENV!=="production"&&(i={});let o;try{H$(n)}catch(a){o=a}return function(s={},l){if(o)throw o;if(process.env.NODE_ENV!=="production"){const h=z$(s,n,l,i);h&&au(h)}let u=!1;const c={};for(let h=0;h<r.length;h++){const p=r[h],g=n[p],m=s[p],f=g(m,l);if(typeof f>"u"){const v=l&&l.type;throw new Error(process.env.NODE_ENV==="production"?Ee(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.`)}c[p]=f,u=u||f!==m}return u=u||r.length!==Object.keys(s).length,u?c:s}}function B$(t=wn().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 W$=su({nodes:su({focus:gS,edit:hS,open:vS,selection:mS,drag:B$}),dnd:yS}),U$=wn();function V$({treeProps:t,imperativeHandle:e,children:n}){const r=d.useRef(null),i=d.useRef(null),o=d.useRef(Zf(W$,wn(t))),a=da.useSyncExternalStore(o.current.subscribe,o.current.getState,()=>U$),s=d.useMemo(()=>new vn(o.current,t,r,i),[]),l=d.useRef(0);return d.useMemo(()=>{l.current+=1,s.update(t)},[...Object.values(t),a.nodes.open]),d.useImperativeHandle(e,()=>s),d.useEffect(()=>{s.props.selection?s.select(s.props.selection,{focus:!1}):s.deselectAll()},[s.props.selection]),d.useEffect(()=>{s.props.searchTerm||o.current.dispatch(Yo.clear(!0))},[s.props.searchTerm]),D.jsx(cf.Provider,{value:s,children:D.jsx(hf.Provider,{value:l.current,children:D.jsx(df.Provider,{value:a.nodes,children:D.jsx(ff.Provider,{value:a.dnd,children:D.jsx(x0,Object.assign({backend:C$,options:{rootElement:s.props.dndRootElement||void 0}},t.dndManager&&{manager:t.dndManager},{children:n}))})})})})}function G$(){const t=Oe(),[,e]=zf(()=>({accept:"NODE",canDrop:(n,r)=>r.isOver({shallow:!0})?t.canDrop():!1,hover:(n,r)=>{if(!r.isOver({shallow:!0}))return;const i=r.getClientOffset();if(!t.listEl.current||!i)return;const{cursor:o,drop:a}=Yf({element:t.listEl.current,offset:i,indent:t.indent,node:null,prevNode:t.visibleNodes[t.visibleNodes.length-1],nextNode:null});a&&t.dispatch(En.hovering(a.parentId,a.index)),r.canDrop()?o&&t.showCursor(o):t.hideCursor()}}),[t]);e(t.listEl)}function q$(t){return G$(),t.children}function Y$(){const e=Oe().props.renderContainer||Xf;return D.jsx(D.Fragment,{children:D.jsx(e,{})})}function X$(){const t=Oe(),{offset:e,mouse:n,item:r,isDragging:i}=XE(a=>({offset:a.getSourceClientOffset(),mouse:a.getClientOffset(),item:a.getItem(),isDragging:a.isDragging()})),o=t.props.renderDragPreview||Pf;return D.jsx(o,{offset:e,mouse:n,id:(r==null?void 0:r.id)||null,dragIds:(r==null?void 0:r.dragIds)||[],isDragging:i})}class J${constructor(e){this.root=Q$(e)}get data(){var e,n;return(n=(e=this.root.children)===null||e===void 0?void 0:e.map(r=>r.data))!==null&&n!==void 0?n:[]}create(e){const n=e.parentId?this.find(e.parentId):this.root;if(!n)return null;n.addChild(e.data,e.index)}move(e){const n=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;!n||!r||(r.addChild(n.data,e.index),n.drop())}update(e){const n=this.find(e.id);n&&n.update(e.changes)}drop(e){const n=this.find(e.id);n&&n.drop()}find(e,n=this.root){if(!n)return null;if(n.id===e)return n;if(n.children){for(let r of n.children){const i=this.find(e,r);if(i)return i}return null}return null}}function Q$(t){const e=new eh({id:"ROOT"},null);return e.children=t.map(n=>Ha(n,e)),e}function Ha(t,e){const n=new eh(t,e);return t.children&&(n.children=t.children.map(r=>Ha(r,n))),n}class eh{constructor(e,n){this.data=e,this.parent=n,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,n){var r,i;const o=Ha(e,this);this.children=(r=this.children)!==null&&r!==void 0?r:[],this.children.splice(n,0,o),this.data.children=(i=this.data.children)!==null&&i!==void 0?i:[],this.data.children.splice(n,0,e)}removeChild(e){var n,r;(n=this.children)===null||n===void 0||n.splice(e,1),(r=this.data.children)===null||r===void 0||r.splice(e,1)}update(e){if(this.hasParent()){const n=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),n),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let Z$=0;function ex(t){const[e,n]=d.useState(t),r=d.useMemo(()=>new J$(e),[e]);return[e,{onMove:u=>{for(const c of u.dragIds)r.move({id:c,parentId:u.parentId,index:u.index});n(r.data)},onRename:({name:u,id:c})=>{r.update({id:c,changes:{name:u}}),n(r.data)},onCreate:({parentId:u,index:c,type:h})=>{const p={id:`simple-tree-id-${Z$++}`,name:""};return h==="internal"&&(p.children=[]),r.create({parentId:u,index:c,data:p}),n(r.data),p},onDelete:u=>{u.ids.forEach(c=>r.drop({id:c})),n(r.data)}}]}function tx(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.
101
- Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,n]=ex(t.initialData);return Object.assign(Object.assign(Object.assign({},t),n),{data:e})}else return t}function nx(t,e){const n=tx(t);return D.jsxs(V$,{treeProps:n,imperativeHandle:e,children:[D.jsx(q$,{children:D.jsx(Y$,{})}),D.jsx(X$,{})]})}const rx=d.forwardRef(nx),th=({top:t,left:e})=>D.jsx("div",{className:"c__tree-view__cursor",style:{top:t-2,left:e+10,width:`calc(100% - ${24+e}px)`}});function ix(t,e){var n=d.useRef(null),r=d.useRef(null);r.current=e;var i=d.useRef(null);d.useEffect(function(){o()});var o=d.useCallback(function(){var a=i.current,s=r.current,l=a||(s?s instanceof Element?s:s.current:null);n.current&&n.current.element===l&&n.current.subscriber===t||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:l,subscriber:t,cleanup:l?t(l):void 0})},[t]);return d.useEffect(function(){return function(){n.current&&n.current.cleanup&&(n.current.cleanup(),n.current=null)}},[]),d.useCallback(function(a){i.current=a,o()},[o])}function lu(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function ox(t){t===void 0&&(t={});var e=t.onResize,n=d.useRef(void 0);n.current=e;var r=t.round||Math.round,i=d.useRef(),o=d.useState({width:void 0,height:void 0}),a=o[0],s=o[1],l=d.useRef(!1);d.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var u=d.useRef({width:void 0,height:void 0}),c=ix(d.useCallback(function(h){return(!i.current||i.current.box!==t.box||i.current.round!==r)&&(i.current={box:t.box,round:r,instance:new ResizeObserver(function(p){var g=p[0],m=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",f=lu(g,m,"inlineSize"),v=lu(g,m,"blockSize"),y=f?r(f):void 0,S=v?r(v):void 0;if(u.current.width!==y||u.current.height!==S){var w={width:y,height:S};u.current.width=y,u.current.height=S,n.current?n.current(w):l.current||s(w)}})}),i.current.instance.observe(h,{box:t.box}),function(){i.current&&i.current.instance.unobserve(h)}},[t.box,r]),t.ref);return d.useMemo(function(){return{ref:c,width:a.width,height:a.height}},[c,a.width,a.height])}var Ke=(t=>(t.NODE="node",t.SEPARATOR="separator",t.TITLE="title",t))(Ke||{}),$t=(t=>(t.FIRST_CHILD="first-child",t.LAST_CHILD="last-child",t.LEFT="left",t.RIGHT="right",t))($t||{});const li=t=>t?t.nodeType===Ke.SEPARATOR:!1,ui=t=>t?t.nodeType===Ke.TITLE:!1,Hn=t=>!li(t)&&!ui(t),nh=(t,e,n)=>{const{remove:r,update:i,insert:o,insertBefore:a,insertAfter:s,append:l,prepend:u,getItem:c,move:h,items:p}=Pv({initialItems:JSON.parse(JSON.stringify(t)),getKey:j=>j.id,getChildren:j=>j.children||[]}),[g,m]=d.useState(),f=(j=[])=>{const O=p.map(N=>N.key);r(...O);const k=JSON.parse(JSON.stringify(j));k.length>0&&o(null,0,...k),m(void 0)},v=(j,O,k)=>{const N=c(j);if(!N)return;const F=[...N.value.children??[]];k?F.splice(k,0,O):F.push(O),N.value.children=F,N.value.childrenCount=F.length},y=j=>{const O=c(j);O&&m(O.value)},S=(j,O,k)=>{var N;if(j){const A=c(j);A&&(o(j,k??((N=A.children)==null?void 0:N.length)??0,O),v(j,O,k))}else o(null,k??p.length,O)},w=j=>{var O;return(O=c(j))==null?void 0:O.value},T=(j,O)=>{const k=c(j);if(!k){console.error("No item found");return}let N=k.value.children??null;const A=O.childrenCount??k.value.childrenCount??0;(N==null?void 0:N.length)===0&&A>0&&(N=null),O.children&&(N=[...N??[],...O.children]);const F={...k.value,...O,children:N,childrenCount:(N==null?void 0:N.length)??A};i(j,F),k.parentKey&&I(k.parentKey,j,O)},x=j=>{const O=c(j),k=O==null?void 0:O.parentKey;k&&O&&Y(k,O.value.id),r(j)},I=(j,O,k)=>{const N=c(j);if(!N)return;const A=N.value.children??[],F=A.findIndex(L=>L.id===O);if(F===-1)return;const B={...A[F],...k};A[F]=B},P=async j=>{if(!e){console.error("No refresh callback provided");return}try{const O=await e(j);T(j,O)}catch(O){console.error("error while refreshing node:",O)}},b=(j,O)=>{o(null,O??p.length,j)},R=(j,O)=>{const k=c(j);if(!k){console.error("No item found");return}const N={...k.value,children:O,childrenCount:O.length,hasLoadedChildren:O.length>0};i(j,N),k.parentKey&&I(k.parentKey,j,N)},W=j=>{const O=[],k=c(j);if(!k)return[];O.push(k.value);const N=A=>{const F=M(A);if(!F)return;const B=c(F);B&&(O.push(B.value),N(F))};return N(j),O.reverse()},M=j=>{var O;return((O=c(j))==null?void 0:O.parentKey)??null},H=j=>{const O=M(j);if(!O)return null;const k=c(O);return k?k.value:null},E=(j,O)=>{a(j,O)},_=(j,O)=>{s(j,O)},z=(j,O)=>{l(j,O)},U=(j,O)=>{u(j,O)},Y=(j,O)=>{const k=c(j);if(!k)return;const A=(k.value.children??[]).filter(F=>F.id!==O);k.value.children=A,k.value.childrenCount=A.length},K=(j,O,k,N)=>{var F;const A=(F=c(j))==null?void 0:F.value;h(j,O,k),O&&A&&v(O,A),N&&Y(N,j)};return{nodes:p,addChild:S,updateNode:T,deleteNode:x,addRootNode:b,selectedNode:g,setSelectedNode:m,refreshNode:P,setChildren:R,insertBeforeNode:E,insertAfterNode:_,handleMove:j=>{K(j.sourceId,j.newParentId,j.index,j.oldParentId)},prependToNode:U,moveNode:K,appendToNode:z,move:h,resetTree:f,handleLoadChildren:async j=>{if(!n)return[];const O=await n(j);return T(j,{children:O,hasLoadedChildren:!0,childrenCount:O.length}),O},selectNodeById:y,getParent:H,getNode:w,getParentId:M,getAncestors:W}},Ba=d.createContext(null),ax=({children:t,onRefresh:e,initialNodeId:n,onLoadChildren:r,initialTreeData:i})=>{const o=d.useRef(null),[a,s]=d.useState(null),[l,u]=d.useState(n??null),c=nh(i??[],e,r);return D.jsx(Ba.Provider,{value:{treeApiRef:o,treeData:c,root:a,initialTargetId:l,setInitialTargetId:u,setRoot:s},children:t})},Wa=()=>{const t=d.useContext(Ba);if(!t)throw new Error("TreeContext not found");return t},sx=({initialOpenState:t,selectedNodeId:e,rootNodeId:n,renderNode:r,canDrop:i,canDrag:o,afterMove:a})=>{const{ref:s,width:l,height:u}=ox(),c=Wa(),h=(c==null?void 0:c.treeData.nodes)??[],p=m=>{var z,U,Y,K;const f=JSON.parse(JSON.stringify(h)),v=m.dragNodes[0],y=m.parentId?((z=m.parentNode)==null?void 0:z.data.children)??[]:f,S=m.dragNodes[0].data.value.id,w=m.dragNodes[0].data,T=(U=m.parentNode)==null?void 0:U.data;if((T==null?void 0:T.value.nodeType)===Ke.TITLE||(T==null?void 0:T.value.nodeType)===Ke.SEPARATOR)return null;const x=w.parentKey??n,I=m.parentId??n;let P=m.index+0,b=null,R=I;const W=((K=(Y=v.parent)==null?void 0:Y.children)==null?void 0:K.findIndex(q=>q.data.value.id===S))??0;if(x===I){if(W===P)return null;P=P<W?P:P-1}const M=m.index-1,H=y[M],E=m.index,_=y[E];return m.index===0?(R=m.parentId??n,b=$t.FIRST_CHILD):!T&&m.index===1&&!Hn(H.value)?(R=n,P=1,b=$t.FIRST_CHILD):m.index===y.length?(R=R??n,b=$t.LAST_CHILD):H&&Hn(H.value)?(R=H.value.id,b=$t.RIGHT):_&&Hn(_.value)&&(b=$t.LEFT,R=_.value.id),b&&R?{targetModeId:R,mode:b,oldParentId:x,index:P,newParentId:m.parentId,sourceId:S}:null},g=m=>{const f=p(m);f&&(c==null||c.treeData.handleMove(f),a==null||a(f))};if(c)return D.jsx("div",{ref:s,className:"c__tree-view--container",children:D.jsx(rx,{data:h,ref:c.treeApiRef,openByDefault:!1,disableEdit:!0,className:"c__tree-view",idAccessor:"key",onMove:g,rowHeight:35,disableDrag:m=>o?!o(m):!1,disableDrop:({parentNode:m,dragNodes:f,index:v})=>{var x,I;if(i&&!i({parentNode:m,dragNodes:f,index:v}))return m.id!=="__REACT_ARBORIST_INTERNAL_ROOT__"&&(m.data.value.canDrop=!1),!0;const y=f[0];if(y&&y.isDragging&&y.willReceiveDrop||((x=m.data.value)==null?void 0:x.nodeType)===Ke.TITLE||((I=m.data.value)==null?void 0:I.nodeType)===Ke.SEPARATOR)return!0;if(m.id==="__REACT_ARBORIST_INTERNAL_ROOT__"){const P=h[v-1],b=h[v],R=h[v+1],W=li(P==null?void 0:P.value),M=li(b==null?void 0:b.value),H=ui(P==null?void 0:P.value),E=ui(b==null?void 0:b.value),_=Hn(R==null?void 0:R.value);return!!(v===0&&(M||E)||W&&E&&_||H&&M&&_)}const S=m==null?void 0:m.isOpen,w=(m==null?void 0:m.data.value.childrenCount)&&m.data.value.childrenCount>0||(m==null?void 0:m.data.children)&&m.data.children.length>0;if(!w)return m.data.value.canDrop=!0,!1;let T=m.data.value.childrenCount&&m.data.value.childrenCount>0&&(m==null?void 0:m.data.children)&&m.data.children.length>0;return T=T??!0,!S&&!T&&w?(m.data.value.canDrop=!0,!0):(m.data.value.canDrop=!0,!1)},paddingBottom:30,paddingTop:2,width:l,initialOpenState:t,height:u,overscanCount:20,selection:e,renderCursor:th,renderRow:lx,rowClassName:"c__tree-view--row",children:r})})},lx=({children:t,...e})=>{const n=e.node.data.value.nodeType===Ke.TITLE,r=e.node.data.value.nodeType===Ke.SEPARATOR,{style:i}=e.attrs,o={...i};return n||r?d.createElement("div",{...e.attrs,key:e.node.id,style:o,ref:e.innerRef,onFocus:a=>a.stopPropagation(),onClick:e.node.handleClick},t):d.createElement("div",{...e.attrs,style:o,key:e.node.id,ref:e.innerRef,onFocus:a=>a.stopPropagation(),onClick:e.node.handleClick},D.jsx("div",{style:{padding:"0 12px"},children:t}))},ux=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cx(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function dx(t){return"nodeType"in t}function fx(t){var e,n;return t?cx(t)?t:dx(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}const rh=ux?d.useLayoutEffect:d.useEffect;function ih(t){const e=d.useRef(t);return rh(()=>{e.current=t}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function uu(t,e){e===void 0&&(e=[t]);const n=d.useRef(t);return rh(()=>{n.current!==t&&(n.current=t)},e),n}function hx(t){const e=ih(t),n=d.useRef(null),r=d.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}let wo={};function px(t,e){return d.useMemo(()=>{const n=wo[t]==null?0:wo[t]+1;return wo[t]=n,t+"-"+n},[t,e])}var Un;(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"})(Un||(Un={}));function cu(){}const gx=Object.freeze({x:0,y:0});function vx(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function mx(t,e,n){const r=vx(e);if(!r)return t;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=t.left-a-(1-i)*parseFloat(n),u=t.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?t.width/i:t.width,h=o?t.height/o:t.height;return{width:c,height:h,top:u,right:l+c,bottom:u+h,left:l}}const yx={ignoreTransform:!1};function oh(t,e){e===void 0&&(e=yx);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:u,transformOrigin:c}=fx(t).getComputedStyle(t);u&&(n=mx(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function du(t){return oh(t,{ignoreTransform:!0})}var dn;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(dn||(dn={}));var fu;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(fu||(fu={}));var ht;(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"})(ht||(ht={}));ht.Space,ht.Enter,ht.Esc,ht.Space,ht.Enter,ht.Tab;var hu;(function(t){t[t.RightClick=2]="RightClick"})(hu||(hu={}));var pu;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(pu||(pu={}));var gu;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(gu||(gu={}));dn.Backward+"",dn.Forward+"",dn.Backward+"",dn.Forward+"";var ia;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ia||(ia={}));var oa;(function(t){t.Optimized="optimized"})(oa||(oa={}));function bx(t){let{callback:e,disabled:n}=t;const r=ih(e),i=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return d.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}ia.WhileDragging,oa.Optimized;const Sx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cu,draggableNodes:new Map,over:null,measureDroppableContainers:cu},wx=d.createContext(Sx);({...gx});var vu;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(vu||(vu={}));const Ex="Droppable",$x={timeout:25};function xx(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const o=px(Ex),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=d.useContext(wx),c=d.useRef({disabled:n}),h=d.useRef(!1),p=d.useRef(null),g=d.useRef(null),{disabled:m,updateMeasurementsFor:f,timeout:v}={...$x,...i},y=uu(f??r),S=d.useCallback(()=>{if(!h.current){h.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),g.current=null},v)},[v]),w=bx({callback:S,disabled:m||!a}),T=d.useCallback((b,R)=>{w&&(R&&(w.unobserve(R),h.current=!1),b&&w.observe(b))},[w]),[x,I]=hx(T),P=uu(e);return d.useEffect(()=>{!w||!x.current||(w.disconnect(),h.current=!1,w.observe(x.current))},[x,w]),d.useEffect(()=>(s({type:Un.RegisterDroppable,element:{id:r,key:o,disabled:n,node:x,rect:p,data:P}}),()=>s({type:Un.UnregisterDroppable,key:o,id:r})),[r]),d.useEffect(()=>{n!==c.current.disabled&&(s({type:Un.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:p,isOver:(l==null?void 0:l.id)===r,node:x,over:l,setNodeRef:I}}const Cx=t=>{const{isOver:e,setNodeRef:n}=xx({id:t.id,data:t.data});return d.useEffect(()=>{var r;(r=t.onOver)==null||r.call(t,e,t.data)},[e,t.data,t.onOver]),D.jsx("div",{className:"c__dnd--droppable",ref:n,children:t.children})},Tx=({children:t,onClick:e,node:n,dragHandle:r,style:i,forceLoading:o})=>{var w,T;const a=Wa(),s=d.useRef(null),[l,u]=d.useState(!1),[c,h]=d.useState(!1),p=o??l,g=n.willReceiveDrop||c,m=n.data.value.childrenCount!==void 0&&n.data.value.childrenCount>0||(((w=n.data.children)==null?void 0:w.length)??0)>0,f=((T=n.children)==null?void 0:T.length)??!1,v=n.isLeaf||!m,y=d.useCallback(async()=>{if(!v){if(f||n.data.value.hasLoadedChildren){n.toggle();return}u(!0),await(a==null?void 0:a.treeData.handleLoadChildren(n.data.value.id)),u(!1),n.open()}},[v,f,n,a==null?void 0:a.treeData]),S=d.useCallback(x=>{x&&!n.isOpen&&!n.isDragging&&(s.current=setTimeout(()=>{y()},500)),s.current&&!x&&clearTimeout(s.current)},[y,n.isOpen,n.isDragging]);return d.useEffect(()=>{S(g)},[g,S]),n.data.value.nodeType===Ke.SEPARATOR?D.jsx("div",{className:"c__tree-view--node__separator"}):n.data.value.nodeType===Ke.TITLE?D.jsx("div",{className:"c__tree-view--node__title",children:n.data.value.headerTitle}):D.jsx(Cx,{id:n.id,data:{data:n.data,nodeApi:n},onOver:h,children:D.jsxs("div",{onClick:e,ref:r,style:i,className:ot("c__tree-view--node",{...n.state,canDrop:n.data.value.canDrop??!0,externalDrop:c}),children:[v&&D.jsx("div",{className:"c__tree-view--node__leaf"}),!v&&D.jsxs(D.Fragment,{children:[p&&D.jsx("div",{className:"c__tree-view--node__loading",children:D.jsx(Da,{})}),!p&&D.jsx("span",{onClick:x=>{x.stopPropagation(),y()},className:"c__tree-view--node__arrow material-icons",children:n.isOpen?"keyboard_arrow_down":"keyboard_arrow_right"})]}),t]})})};exports.CunninghamProvider=mh;exports.CustomTabs=Jb;exports.DropdownMenu=ed;exports.Header=rd;exports.HorizontalSeparator=qo;exports.Label=Dd;exports.LanguagePicker=nd;exports.LeftPanel=id;exports.MainLayout=jm;exports.ProConnectButton=yh;exports.QuickSearch=qb;exports.QuickSearchGroup=Yb;exports.QuickSearchInput=uf;exports.QuickSearchItem=Mr;exports.QuickSearchItemTemplate=Xb;exports.Spinner=Da;exports.TreeApi=vn;exports.TreeContext=Ba;exports.TreeProvider=ax;exports.TreeView=sx;exports.TreeViewItem=Tx;exports.TreeViewMoveModeEnum=$t;exports.TreeViewNodeTypeEnum=Ke;exports.TreeViewSeparator=th;exports.WithLabel=Hm;exports.cunninghamConfig=jo;exports.getLocales=yu;exports.headerHeight=zm;exports.isNode=Hn;exports.isSeparator=li;exports.isTitle=ui;exports.useDropdownMenu=td;exports.useResponsive=ar;exports.useTree=nh;exports.useTreeContext=Wa;
101
+ Use the data prop if you want to provide your own handlers.`);if(t.initialData){const[e,n]=ex(t.initialData);return Object.assign(Object.assign(Object.assign({},t),n),{data:e})}else return t}function nx(t,e){const n=tx(t);return D.jsxs(V$,{treeProps:n,imperativeHandle:e,children:[D.jsx(q$,{children:D.jsx(Y$,{})}),D.jsx(X$,{})]})}const rx=d.forwardRef(nx),th=({top:t,left:e})=>D.jsx("div",{className:"c__tree-view__cursor",style:{top:t-2,left:e+10,width:`calc(100% - ${24+e}px)`}});function ix(t,e){var n=d.useRef(null),r=d.useRef(null);r.current=e;var i=d.useRef(null);d.useEffect(function(){o()});var o=d.useCallback(function(){var a=i.current,s=r.current,l=a||(s?s instanceof Element?s:s.current:null);n.current&&n.current.element===l&&n.current.subscriber===t||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:l,subscriber:t,cleanup:l?t(l):void 0})},[t]);return d.useEffect(function(){return function(){n.current&&n.current.cleanup&&(n.current.cleanup(),n.current=null)}},[]),d.useCallback(function(a){i.current=a,o()},[o])}function lu(t,e,n){return t[e]?t[e][0]?t[e][0][n]:t[e][n]:e==="contentBoxSize"?t.contentRect[n==="inlineSize"?"width":"height"]:void 0}function ox(t){t===void 0&&(t={});var e=t.onResize,n=d.useRef(void 0);n.current=e;var r=t.round||Math.round,i=d.useRef(),o=d.useState({width:void 0,height:void 0}),a=o[0],s=o[1],l=d.useRef(!1);d.useEffect(function(){return l.current=!1,function(){l.current=!0}},[]);var u=d.useRef({width:void 0,height:void 0}),c=ix(d.useCallback(function(h){return(!i.current||i.current.box!==t.box||i.current.round!==r)&&(i.current={box:t.box,round:r,instance:new ResizeObserver(function(p){var g=p[0],m=t.box==="border-box"?"borderBoxSize":t.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",f=lu(g,m,"inlineSize"),v=lu(g,m,"blockSize"),y=f?r(f):void 0,S=v?r(v):void 0;if(u.current.width!==y||u.current.height!==S){var w={width:y,height:S};u.current.width=y,u.current.height=S,n.current?n.current(w):l.current||s(w)}})}),i.current.instance.observe(h,{box:t.box}),function(){i.current&&i.current.instance.unobserve(h)}},[t.box,r]),t.ref);return d.useMemo(function(){return{ref:c,width:a.width,height:a.height}},[c,a.width,a.height])}var Ke=(t=>(t.NODE="node",t.SEPARATOR="separator",t.TITLE="title",t))(Ke||{}),$t=(t=>(t.FIRST_CHILD="first-child",t.LAST_CHILD="last-child",t.LEFT="left",t.RIGHT="right",t))($t||{});const li=t=>t?t.nodeType===Ke.SEPARATOR:!1,ui=t=>t?t.nodeType===Ke.TITLE:!1,Hn=t=>!li(t)&&!ui(t),nh=(t,e,n)=>{const{remove:r,update:i,insert:o,insertBefore:a,insertAfter:s,append:l,prepend:u,getItem:c,move:h,items:p}=Pv({initialItems:JSON.parse(JSON.stringify(t)),getKey:j=>j.id,getChildren:j=>j.children||[]}),[g,m]=d.useState(),f=(j=[])=>{const O=p.map(N=>N.key);r(...O);const k=JSON.parse(JSON.stringify(j));k.length>0&&o(null,0,...k),m(void 0)},v=(j,O,k)=>{const N=c(j);if(!N)return;const F=[...N.value.children??[]];k?F.splice(k,0,O):F.push(O),N.value.children=F,N.value.childrenCount=F.length},y=j=>{const O=c(j);O&&m(O.value)},S=(j,O,k)=>{var N;if(j){const A=c(j);A&&(o(j,k??((N=A.children)==null?void 0:N.length)??0,O),v(j,O,k))}else o(null,k??p.length,O)},w=j=>{var O;return(O=c(j))==null?void 0:O.value},T=(j,O)=>{const k=c(j);if(!k){console.error("No item found");return}let N=k.value.children??null;const A=O.childrenCount??k.value.childrenCount??0;(N==null?void 0:N.length)===0&&A>0&&(N=null),O.children&&(N=[...N??[],...O.children]);const F={...k.value,...O,children:N,childrenCount:(N==null?void 0:N.length)??A};i(j,F),k.parentKey&&I(k.parentKey,j,O)},x=j=>{const O=c(j),k=O==null?void 0:O.parentKey;k&&O&&Y(k,O.value.id),r(j)},I=(j,O,k)=>{const N=c(j);if(!N)return;const A=N.value.children??[],F=A.findIndex(L=>L.id===O);if(F===-1)return;const B={...A[F],...k};A[F]=B},P=async j=>{if(!e){console.error("No refresh callback provided");return}try{const O=await e(j);T(j,O)}catch(O){console.error("error while refreshing node:",O)}},b=(j,O)=>{o(null,O??p.length,j)},R=(j,O)=>{const k=c(j);if(!k){console.error("No item found");return}const N={...k.value,children:O,childrenCount:O.length,hasLoadedChildren:O.length>0};i(j,N),k.parentKey&&I(k.parentKey,j,N)},W=j=>{const O=[],k=c(j);if(!k)return[];O.push(k.value);const N=A=>{const F=M(A);if(!F)return;const B=c(F);B&&(O.push(B.value),N(F))};return N(j),O.reverse()},M=j=>{var O;return((O=c(j))==null?void 0:O.parentKey)??null},H=j=>{const O=M(j);if(!O)return null;const k=c(O);return k?k.value:null},E=(j,O)=>{a(j,O)},_=(j,O)=>{s(j,O)},z=(j,O)=>{l(j,O)},U=(j,O)=>{u(j,O)},Y=(j,O)=>{const k=c(j);if(!k)return;const A=(k.value.children??[]).filter(F=>F.id!==O);k.value.children=A,k.value.childrenCount=A.length},K=(j,O,k,N)=>{var F;const A=(F=c(j))==null?void 0:F.value;h(j,O,k),O&&A&&v(O,A),N&&Y(N,j)};return{nodes:p,addChild:S,updateNode:T,deleteNode:x,addRootNode:b,selectedNode:g,setSelectedNode:m,refreshNode:P,setChildren:R,insertBeforeNode:E,insertAfterNode:_,handleMove:j=>{K(j.sourceId,j.newParentId,j.index,j.oldParentId)},prependToNode:U,moveNode:K,appendToNode:z,move:h,resetTree:f,handleLoadChildren:async j=>{if(!n)return[];const O=await n(j);return T(j,{children:O,hasLoadedChildren:!0,childrenCount:O.length}),O},selectNodeById:y,getParent:H,getNode:w,getParentId:M,getAncestors:W}},Ba=d.createContext(null),ax=({children:t,onRefresh:e,initialNodeId:n,onLoadChildren:r,initialTreeData:i})=>{const o=d.useRef(null),[a,s]=d.useState(null),[l,u]=d.useState(n??null),c=nh(i??[],e,r);return D.jsx(Ba.Provider,{value:{treeApiRef:o,treeData:c,root:a,initialTargetId:l,setInitialTargetId:u,setRoot:s},children:t})},Wa=()=>{const t=d.useContext(Ba);if(!t)throw new Error("TreeContext not found");return t},sx=({initialOpenState:t,selectedNodeId:e,rootNodeId:n,renderNode:r,canDrop:i,canDrag:o,afterMove:a})=>{const{ref:s,width:l,height:u}=ox(),c=Wa(),h=(c==null?void 0:c.treeData.nodes)??[],p=m=>{var z,U,Y,K;const f=JSON.parse(JSON.stringify(h)),v=m.dragNodes[0],y=m.parentId?((z=m.parentNode)==null?void 0:z.data.children)??[]:f,S=m.dragNodes[0].data.value.id,w=m.dragNodes[0].data,T=(U=m.parentNode)==null?void 0:U.data;if((T==null?void 0:T.value.nodeType)===Ke.TITLE||(T==null?void 0:T.value.nodeType)===Ke.SEPARATOR)return null;const x=w.parentKey??n,I=m.parentId??n;let P=m.index+0,b=null,R=I;const W=((K=(Y=v.parent)==null?void 0:Y.children)==null?void 0:K.findIndex(q=>q.data.value.id===S))??0;if(x===I){if(W===P)return null;P=P<W?P:P-1}const M=m.index-1,H=y[M],E=m.index,_=y[E];return m.index===0?(R=m.parentId??n,b=$t.FIRST_CHILD):!T&&m.index===1&&!Hn(H.value)?(R=n,P=1,b=$t.FIRST_CHILD):m.index===y.length?(R=R??n,b=$t.LAST_CHILD):H&&Hn(H.value)?(R=H.value.id,b=$t.RIGHT):_&&Hn(_.value)&&(b=$t.LEFT,R=_.value.id),b&&R?{targetModeId:R,mode:b,oldParentId:x,index:P,newParentId:m.parentId,sourceId:S}:null},g=m=>{const f=p(m);f&&(c==null||c.treeData.handleMove(f),a==null||a(f))};if(c)return D.jsx("div",{ref:s,className:"c__tree-view--container",children:D.jsx(rx,{data:h,ref:c.treeApiRef,openByDefault:!1,selectionFollowsFocus:!1,disableMultiSelection:!0,disableEdit:!0,className:"c__tree-view",idAccessor:"key",onMove:g,rowHeight:35,disableDrag:m=>o?!o(m):!1,disableDrop:({parentNode:m,dragNodes:f,index:v})=>{var x,I;if(i&&!i({parentNode:m,dragNodes:f,index:v}))return m.id!=="__REACT_ARBORIST_INTERNAL_ROOT__"&&(m.data.value.canDrop=!1),!0;const y=f[0];if(y&&y.isDragging&&y.willReceiveDrop||((x=m.data.value)==null?void 0:x.nodeType)===Ke.TITLE||((I=m.data.value)==null?void 0:I.nodeType)===Ke.SEPARATOR)return!0;if(m.id==="__REACT_ARBORIST_INTERNAL_ROOT__"){const P=h[v-1],b=h[v],R=h[v+1],W=li(P==null?void 0:P.value),M=li(b==null?void 0:b.value),H=ui(P==null?void 0:P.value),E=ui(b==null?void 0:b.value),_=Hn(R==null?void 0:R.value);return!!(v===0&&(M||E)||W&&E&&_||H&&M&&_)}const S=m==null?void 0:m.isOpen,w=(m==null?void 0:m.data.value.childrenCount)&&m.data.value.childrenCount>0||(m==null?void 0:m.data.children)&&m.data.children.length>0;if(!w)return m.data.value.canDrop=!0,!1;let T=m.data.value.childrenCount&&m.data.value.childrenCount>0&&(m==null?void 0:m.data.children)&&m.data.children.length>0;return T=T??!0,!S&&!T&&w?(m.data.value.canDrop=!0,!0):(m.data.value.canDrop=!0,!1)},paddingBottom:30,paddingTop:2,width:l,initialOpenState:t,height:u,overscanCount:20,selection:e,renderCursor:th,renderRow:lx,rowClassName:"c__tree-view--row",children:r})})},lx=({children:t,...e})=>{const n=e.node.data.value.nodeType===Ke.TITLE,r=e.node.data.value.nodeType===Ke.SEPARATOR,{style:i}=e.attrs,o={...i};return n||r?d.createElement("div",{...e.attrs,key:e.node.id,style:o,ref:e.innerRef,onFocus:a=>a.stopPropagation(),onClick:e.node.handleClick},t):d.createElement("div",{...e.attrs,style:o,key:e.node.id,ref:e.innerRef,onFocus:a=>a.stopPropagation(),onClick:e.node.handleClick},D.jsx("div",{style:{padding:"0 12px"},children:t}))},ux=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function cx(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function dx(t){return"nodeType"in t}function fx(t){var e,n;return t?cx(t)?t:dx(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}const rh=ux?d.useLayoutEffect:d.useEffect;function ih(t){const e=d.useRef(t);return rh(()=>{e.current=t}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function uu(t,e){e===void 0&&(e=[t]);const n=d.useRef(t);return rh(()=>{n.current!==t&&(n.current=t)},e),n}function hx(t){const e=ih(t),n=d.useRef(null),r=d.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}let wo={};function px(t,e){return d.useMemo(()=>{const n=wo[t]==null?0:wo[t]+1;return wo[t]=n,t+"-"+n},[t,e])}var Un;(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"})(Un||(Un={}));function cu(){}const gx=Object.freeze({x:0,y:0});function vx(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function mx(t,e,n){const r=vx(e);if(!r)return t;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=t.left-a-(1-i)*parseFloat(n),u=t.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?t.width/i:t.width,h=o?t.height/o:t.height;return{width:c,height:h,top:u,right:l+c,bottom:u+h,left:l}}const yx={ignoreTransform:!1};function oh(t,e){e===void 0&&(e=yx);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:u,transformOrigin:c}=fx(t).getComputedStyle(t);u&&(n=mx(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function du(t){return oh(t,{ignoreTransform:!0})}var dn;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(dn||(dn={}));var fu;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(fu||(fu={}));var ht;(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"})(ht||(ht={}));ht.Space,ht.Enter,ht.Esc,ht.Space,ht.Enter,ht.Tab;var hu;(function(t){t[t.RightClick=2]="RightClick"})(hu||(hu={}));var pu;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(pu||(pu={}));var gu;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(gu||(gu={}));dn.Backward+"",dn.Forward+"",dn.Backward+"",dn.Forward+"";var ia;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ia||(ia={}));var oa;(function(t){t.Optimized="optimized"})(oa||(oa={}));function bx(t){let{callback:e,disabled:n}=t;const r=ih(e),i=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return d.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}ia.WhileDragging,oa.Optimized;const Sx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cu,draggableNodes:new Map,over:null,measureDroppableContainers:cu},wx=d.createContext(Sx);({...gx});var vu;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(vu||(vu={}));const Ex="Droppable",$x={timeout:25};function xx(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const o=px(Ex),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=d.useContext(wx),c=d.useRef({disabled:n}),h=d.useRef(!1),p=d.useRef(null),g=d.useRef(null),{disabled:m,updateMeasurementsFor:f,timeout:v}={...$x,...i},y=uu(f??r),S=d.useCallback(()=>{if(!h.current){h.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),g.current=null},v)},[v]),w=bx({callback:S,disabled:m||!a}),T=d.useCallback((b,R)=>{w&&(R&&(w.unobserve(R),h.current=!1),b&&w.observe(b))},[w]),[x,I]=hx(T),P=uu(e);return d.useEffect(()=>{!w||!x.current||(w.disconnect(),h.current=!1,w.observe(x.current))},[x,w]),d.useEffect(()=>(s({type:Un.RegisterDroppable,element:{id:r,key:o,disabled:n,node:x,rect:p,data:P}}),()=>s({type:Un.UnregisterDroppable,key:o,id:r})),[r]),d.useEffect(()=>{n!==c.current.disabled&&(s({type:Un.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:p,isOver:(l==null?void 0:l.id)===r,node:x,over:l,setNodeRef:I}}const Cx=t=>{const{isOver:e,setNodeRef:n}=xx({id:t.id,data:t.data});return d.useEffect(()=>{var r;(r=t.onOver)==null||r.call(t,e,t.data)},[e,t.data,t.onOver]),D.jsx("div",{className:"c__dnd--droppable",ref:n,children:t.children})},Tx=({children:t,onClick:e,node:n,dragHandle:r,style:i,forceLoading:o})=>{var w,T;const a=Wa(),s=d.useRef(null),[l,u]=d.useState(!1),[c,h]=d.useState(!1),p=o??l,g=n.willReceiveDrop||c,m=n.data.value.childrenCount!==void 0&&n.data.value.childrenCount>0||(((w=n.data.children)==null?void 0:w.length)??0)>0,f=((T=n.children)==null?void 0:T.length)??!1,v=n.isLeaf||!m,y=d.useCallback(async()=>{if(!v){if(f||n.data.value.hasLoadedChildren){n.toggle();return}u(!0),await(a==null?void 0:a.treeData.handleLoadChildren(n.data.value.id)),u(!1),n.open()}},[v,f,n,a==null?void 0:a.treeData]),S=d.useCallback(x=>{x&&!n.isOpen&&!n.isDragging&&(s.current=setTimeout(()=>{y()},500)),s.current&&!x&&clearTimeout(s.current)},[y,n.isOpen,n.isDragging]);return d.useEffect(()=>{S(g)},[g,S]),n.data.value.nodeType===Ke.SEPARATOR?D.jsx("div",{className:"c__tree-view--node__separator"}):n.data.value.nodeType===Ke.TITLE?D.jsx("div",{className:"c__tree-view--node__title",children:n.data.value.headerTitle}):D.jsx(Cx,{id:n.id,data:{data:n.data,nodeApi:n},onOver:h,children:D.jsxs("div",{onClick:x=>{x.target.closest(".c__tree-view--node")||x.stopPropagation(),e==null||e()},onKeyDown:x=>{x.stopPropagation()},ref:r,style:i,className:ot("c__tree-view--node",{...n.state,canDrop:n.data.value.canDrop??!0,externalDrop:c}),children:[v&&D.jsx("div",{className:"c__tree-view--node__leaf"}),!v&&D.jsxs(D.Fragment,{children:[p&&D.jsx("div",{className:"c__tree-view--node__loading",children:D.jsx(Da,{})}),!p&&D.jsx("span",{onClick:x=>{x.stopPropagation(),y()},className:"c__tree-view--node__arrow material-icons",children:n.isOpen?"keyboard_arrow_down":"keyboard_arrow_right"})]}),t]})})};exports.CunninghamProvider=mh;exports.CustomTabs=Jb;exports.DropdownMenu=ed;exports.Header=rd;exports.HorizontalSeparator=qo;exports.Label=Dd;exports.LanguagePicker=nd;exports.LeftPanel=id;exports.MainLayout=jm;exports.ProConnectButton=yh;exports.QuickSearch=qb;exports.QuickSearchGroup=Yb;exports.QuickSearchInput=uf;exports.QuickSearchItem=Mr;exports.QuickSearchItemTemplate=Xb;exports.Spinner=Da;exports.TreeApi=vn;exports.TreeContext=Ba;exports.TreeProvider=ax;exports.TreeView=sx;exports.TreeViewItem=Tx;exports.TreeViewMoveModeEnum=$t;exports.TreeViewNodeTypeEnum=Ke;exports.TreeViewSeparator=th;exports.WithLabel=Hm;exports.cunninghamConfig=jo;exports.getLocales=yu;exports.headerHeight=zm;exports.isNode=Hn;exports.isSeparator=li;exports.isTitle=ui;exports.useDropdownMenu=td;exports.useResponsive=ar;exports.useTree=nh;exports.useTreeContext=Wa;
102
102
  //# sourceMappingURL=index.cjs.map