@project-sunbird/collection-editor-react 0.1.18 → 0.1.19

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
@@ -1,4 +1,4 @@
1
- "use strict";var wl=e=>{throw TypeError(e)};var lo=(e,t,r)=>t.has(e)||wl("Cannot "+r);var O=(e,t,r)=>(lo(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?wl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),G=(e,t,r,n)=>(lo(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),_e=(e,t,r)=>(lo(e,t,"access private method"),r);var Hs=(e,t,r,n)=>({set _(s){G(e,t,s,r)},get _(){return O(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Ar=require("react-dom"),l=require("react/jsx-runtime");function Zh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ie=Zh(p);var js=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Kr,Dr,On,zu,Jh=(zu=class extends js{constructor(){super();ne(this,Kr);ne(this,Dr);ne(this,On);G(this,On,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Dr)||this.setEventListener(O(this,On))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Dr))==null||t.call(this),G(this,Dr,void 0))}setEventListener(t){var r;G(this,On,t),(r=O(this,Dr))==null||r.call(this),G(this,Dr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,Kr)!==t&&(G(this,Kr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,Kr)=="boolean"?O(this,Kr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Kr=new WeakMap,Dr=new WeakMap,On=new WeakMap,zu),Aa=new Jh,ep={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},nr,Qr,Vu,tp=(Vu=class{constructor(){ne(this,nr,ep);ne(this,Qr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,Qr)&&e!==O(this,nr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,nr),provider:e}),G(this,nr,e),process.env.NODE_ENV!=="production"&&G(this,Qr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,Qr,!0),O(this,nr).setTimeout(e,t)}clearTimeout(e){O(this,nr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,Qr,!0),O(this,nr).setInterval(e,t)}clearInterval(e){O(this,nr).clearInterval(e)}},nr=new WeakMap,Qr=new WeakMap,Vu),qr=new tp;function rp(e){setTimeout(e,0)}var np=typeof window>"u"||"Deno"in globalThis;function Et(){}function sp(e,t){return typeof e=="function"?e(t):e}function zo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Zu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Pr(e,t){return typeof e=="function"?e(t):e}function Rt(e,t){return typeof e=="function"?e(t):e}function xl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Pa(o,t.options))return!1}else if(!vs(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Sl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(ys(t.options.mutationKey)!==ys(i))return!1}else if(!vs(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Pa(e,t){return((t==null?void 0:t.queryKeyHashFn)||ys)(e)}function ys(e){return JSON.stringify(e,(t,r)=>Ho(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function vs(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>vs(e[r],t[r])):!1}var ip=Object.prototype.hasOwnProperty;function Vo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Cl(e)&&Cl(t);if(!n&&!(Ho(e)&&Ho(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],g=e[f],m=t[f];if(g===m){c[f]=g,(n?u<i:ip.call(e,f))&&d++;continue}if(g===null||m===null||typeof g!="object"||typeof m!="object"){c[f]=m;continue}const b=Vo(g,m,r+1);c[f]=b,b===g&&d++}return i===a&&d===i?e:c}function qo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Cl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ho(e){if(!Ol(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Ol(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ol(e){return Object.prototype.toString.call(e)==="[object Object]"}function op(e){return new Promise(t=>{qr.setTimeout(t,e)})}function Wo(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Vo(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Vo(e,t)}return t}function ap(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function lp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var wi=Symbol();function Ju(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===wi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===wi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ed(e,t){return typeof e=="function"?e(...t):!!e}function cp(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var bs=(()=>{let e=()=>np;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ko(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var up=rp;function dp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=up;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var lt=dp(),En,Ir,Dn,qu,fp=(qu=class extends js{constructor(){super();ne(this,En,!0);ne(this,Ir);ne(this,Dn);G(this,Dn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){O(this,Ir)||this.setEventListener(O(this,Dn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Ir))==null||t.call(this),G(this,Ir,void 0))}setEventListener(t){var r;G(this,Dn,t),(r=O(this,Ir))==null||r.call(this),G(this,Ir,t(this.setOnline.bind(this)))}setOnline(t){O(this,En)!==t&&(G(this,En,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,En)}},En=new WeakMap,Ir=new WeakMap,Dn=new WeakMap,qu),xi=new fp;function hp(e){return Math.min(1e3*2**e,3e4)}function td(e){return(e??"online")==="online"?xi.isOnline():!0}var Qo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function rd(e){let t=!1,r=0,n;const s=Ko(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new Qo(h);g(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>Aa.isFocused()&&(e.networkMode==="always"||xi.isOnline())&&e.canRun(),u=()=>td(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},g=h=>{i()||(n==null||n(),s.reject(h))},m=()=>new Promise(h=>{var y;n=v=>{(i()||d())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),b=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(f).catch(v=>{var I;if(i())return;const _=e.retry??(bs.isServer()?0:3),x=e.retryDelay??hp,w=typeof x=="function"?x(r,v):x,C=_===!0||typeof _=="number"&&r<_||typeof _=="function"&&_(r,v);if(t||!C){g(v);return}r++,(I=e.onFail)==null||I.call(e,r,v),op(w).then(()=>d()?void 0:m()).then(()=>{t?g(v):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?b():m().then(b),s)}}var Gr,Hu,nd=(Hu=class{constructor(){ne(this,Gr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zo(this.gcTime)&&G(this,Gr,qr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bs.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,Gr)!==void 0&&(qr.clearTimeout(O(this,Gr)),G(this,Gr,void 0))}},Gr=new WeakMap,Hu);function pp(e){return{onFetch:(t,r)=>{var u,f,g,m,b;const n=t.options,s=(g=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const y=x=>{cp(x,()=>t.signal,()=>h=!0)},v=Ju(t.options,t.fetchOptions),_=async(x,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const j=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return y(A),A})(),k=await v(j),{maxPages:L}=t.options,N=C?lp:ap;return{pages:N(x.pages,k,L),pageParams:N(x.pageParams,w,L)}};if(s&&i.length){const x=s==="backward",w=x?gp:El,C={pages:i,pageParams:o},I=w(n,C);a=await _(C,I,x)}else{const x=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:El(n,a);if(c>0&&w==null)break;a=await _(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function El(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function gp(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var In,Yr,Tn,$t,Xr,tt,Es,Zr,jt,sd,hr,Wu,mp=(Wu=class extends nd{constructor(t){super();ne(this,jt);ne(this,In);ne(this,Yr);ne(this,Tn);ne(this,$t);ne(this,Xr);ne(this,tt);ne(this,Es);ne(this,Zr);G(this,Zr,!1),G(this,Es,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,Xr,t.client),G(this,$t,O(this,Xr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Yr,Il(this.options)),this.state=t.state??O(this,Yr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,In)}get promise(){var t;return(t=O(this,tt))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,Es),...t},t!=null&&t._type&&G(this,In,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Il(this.options);r.data!==void 0&&(this.setState(Dl(r.data,r.dataUpdatedAt)),G(this,Yr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,$t).remove(this)}setData(t,r){const n=Wo(this.state.data,t,this.options);return _e(this,jt,hr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){_e(this,jt,hr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,tt))==null?void 0:n.promise;return(s=O(this,tt))==null||s.cancel(t),r?r.then(Et).catch(Et):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,Yr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Rt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Pr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Zu(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,tt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,tt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,$t).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(O(this,tt)&&(O(this,Zr)||_e(this,jt,sd).call(this)?O(this,tt).cancel({revert:!0}):O(this,tt).cancelRetry()),this.scheduleGc()),O(this,$t).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,jt,hr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,g,m,b,h,y,v,_,x;if(this.state.fetchStatus!=="idle"&&((d=O(this,tt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,tt))return O(this,tt).continueRetry(),O(this,tt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(G(this,Zr,!0),n.signal)})},i=()=>{const w=Ju(this.options,r),I=(()=>{const j={client:O(this,Xr),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return G(this,Zr,!1),this.options.persister?this.options.persister(w,I,this):w(I)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,Xr),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,In)==="infinite"?pp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),G(this,Tn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&_e(this,jt,hr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),G(this,tt,rd({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof Qo&&w.revert&&this.setState({...O(this,Tn),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{_e(this,jt,hr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{_e(this,jt,hr).call(this,{type:"pause"})},onContinue:()=>{_e(this,jt,hr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,tt).start();if(w===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(w),(m=(g=O(this,$t).config).onSuccess)==null||m.call(g,w,this),(h=(b=O(this,$t).config).onSettled)==null||h.call(b,w,this.state.error,this),w}catch(w){if(w instanceof Qo){if(w.silent)return O(this,tt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw _e(this,jt,hr).call(this,{type:"error",error:w}),(v=(y=O(this,$t).config).onError)==null||v.call(y,w,this),(x=(_=O(this,$t).config).onSettled)==null||x.call(_,this.state.data,w,this),w}finally{this.scheduleGc()}}},In=new WeakMap,Yr=new WeakMap,Tn=new WeakMap,$t=new WeakMap,Xr=new WeakMap,tt=new WeakMap,Es=new WeakMap,Zr=new WeakMap,jt=new WeakSet,sd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},hr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...id(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Dl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,Tn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),lt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,$t).notify({query:this,type:"updated",action:t})})},Wu);function id(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:td(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Dl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Il(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Ot,Se,Ds,_t,Jr,Nn,pr,Tr,Is,jn,Rn,en,tn,Nr,kn,Te,ls,Go,Yo,Xo,Zo,Jo,ea,ta,od,Ku,yp=(Ku=class extends js{constructor(t,r){super();ne(this,Te);ne(this,Ot);ne(this,Se);ne(this,Ds);ne(this,_t);ne(this,Jr);ne(this,Nn);ne(this,pr);ne(this,Tr);ne(this,Is);ne(this,jn);ne(this,Rn);ne(this,en);ne(this,tn);ne(this,Nr);ne(this,kn,new Set);this.options=r,G(this,Ot,t),G(this,Tr,null),G(this,pr,Ko()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Se).addObserver(this),Tl(O(this,Se),this.options)?_e(this,Te,ls).call(this):this.updateResult(),_e(this,Te,Zo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ra(O(this,Se),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ra(O(this,Se),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Te,Jo).call(this),_e(this,Te,ea).call(this),O(this,Se).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,Se);if(this.options=O(this,Ot).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Rt(this.options.enabled,O(this,Se))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Te,ta).call(this),O(this,Se).setOptions(this.options),r._defaulted&&!qo(this.options,r)&&O(this,Ot).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Se),observer:this});const s=this.hasListeners();s&&Nl(O(this,Se),n,this.options,r)&&_e(this,Te,ls).call(this),this.updateResult(),s&&(O(this,Se)!==n||Rt(this.options.enabled,O(this,Se))!==Rt(r.enabled,O(this,Se))||Pr(this.options.staleTime,O(this,Se))!==Pr(r.staleTime,O(this,Se)))&&_e(this,Te,Go).call(this);const i=_e(this,Te,Yo).call(this);s&&(O(this,Se)!==n||Rt(this.options.enabled,O(this,Se))!==Rt(r.enabled,O(this,Se))||i!==O(this,Nr))&&_e(this,Te,Xo).call(this,i)}getOptimisticResult(t){const r=O(this,Ot).getQueryCache().build(O(this,Ot),t),n=this.createResult(r,t);return bp(this,n)&&(G(this,_t,n),G(this,Nn,this.options),G(this,Jr,O(this,Se).state)),n}getCurrentResult(){return O(this,_t)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&O(this,pr).status==="pending"&&O(this,pr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){O(this,kn).add(t)}getCurrentQuery(){return O(this,Se)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,Ot).defaultQueryOptions(t),n=O(this,Ot).getQueryCache().build(O(this,Ot),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return _e(this,Te,ls).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,_t)))}createResult(t,r){var L;const n=O(this,Se),s=this.options,i=O(this,_t),o=O(this,Jr),a=O(this,Nn),d=t!==n?t.state:O(this,Ds),{state:u}=t;let f={...u},g=!1,m;if(r._optimisticResults){const N=this.hasListeners(),A=!N&&Tl(t,r),$=N&&Nl(t,n,r,s);(A||$)&&(f={...f,...id(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:h,status:y}=f;m=f.data;let v=!1;if(r.placeholderData!==void 0&&m===void 0&&y==="pending"){let N;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(N=i.data,v=!0):N=typeof r.placeholderData=="function"?r.placeholderData((L=O(this,Rn))==null?void 0:L.state.data,O(this,Rn)):r.placeholderData,N!==void 0&&(y="success",m=Wo(i==null?void 0:i.data,N,r),g=!0)}if(r.select&&m!==void 0&&!v)if(i&&m===(o==null?void 0:o.data)&&r.select===O(this,Is))m=O(this,jn);else try{G(this,Is,r.select),m=r.select(m),m=Wo(i==null?void 0:i.data,m,r),G(this,jn,m),G(this,Tr,null)}catch(N){G(this,Tr,N)}O(this,Tr)&&(b=O(this,Tr),m=O(this,jn),h=Date.now(),y="error");const _=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",C=x&&_,I=m!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:_,isRefetching:_&&!x,isLoadingError:w&&!I,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&I,isStale:Ma(t,r),refetch:this.refetch,promise:O(this,pr),isEnabled:Rt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=k.data!==void 0,A=k.status==="error"&&!N,$=M=>{A?M.reject(k.error):N&&M.resolve(k.data)},R=()=>{const M=G(this,pr,k.promise=Ko());$(M)},F=O(this,pr);switch(F.status){case"pending":t.queryHash===n.queryHash&&$(F);break;case"fulfilled":(A||k.data!==F.value)&&R();break;case"rejected":(!A||k.error!==F.reason)&&R();break}}return k}updateResult(){const t=O(this,_t),r=this.createResult(O(this,Se),this.options);if(G(this,Jr,O(this,Se).state),G(this,Nn,this.options),O(this,Jr).data!==void 0&&G(this,Rn,O(this,Se)),qo(r,t))return;G(this,_t,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,kn).size)return!0;const o=new Set(i??O(this,kn));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,_t)).some(a=>{const c=a;return O(this,_t)[c]!==t[c]&&o.has(c)})};_e(this,Te,od).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Te,Zo).call(this)}},Ot=new WeakMap,Se=new WeakMap,Ds=new WeakMap,_t=new WeakMap,Jr=new WeakMap,Nn=new WeakMap,pr=new WeakMap,Tr=new WeakMap,Is=new WeakMap,jn=new WeakMap,Rn=new WeakMap,en=new WeakMap,tn=new WeakMap,Nr=new WeakMap,kn=new WeakMap,Te=new WeakSet,ls=function(t){_e(this,Te,ta).call(this);let r=O(this,Se).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Et)),r},Go=function(){_e(this,Te,Jo).call(this);const t=Pr(this.options.staleTime,O(this,Se));if(bs.isServer()||O(this,_t).isStale||!zo(t))return;const n=Zu(O(this,_t).dataUpdatedAt,t)+1;G(this,en,qr.setTimeout(()=>{O(this,_t).isStale||this.updateResult()},n))},Yo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Se)):this.options.refetchInterval)??!1},Xo=function(t){_e(this,Te,ea).call(this),G(this,Nr,t),!(bs.isServer()||Rt(this.options.enabled,O(this,Se))===!1||!zo(O(this,Nr))||O(this,Nr)===0)&&G(this,tn,qr.setInterval(()=>{(this.options.refetchIntervalInBackground||Aa.isFocused())&&_e(this,Te,ls).call(this)},O(this,Nr)))},Zo=function(){_e(this,Te,Go).call(this),_e(this,Te,Xo).call(this,_e(this,Te,Yo).call(this))},Jo=function(){O(this,en)!==void 0&&(qr.clearTimeout(O(this,en)),G(this,en,void 0))},ea=function(){O(this,tn)!==void 0&&(qr.clearInterval(O(this,tn)),G(this,tn,void 0))},ta=function(){const t=O(this,Ot).getQueryCache().build(O(this,Ot),this.options);if(t===O(this,Se))return;const r=O(this,Se);G(this,Se,t),G(this,Ds,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},od=function(t){lt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,_t))}),O(this,Ot).getQueryCache().notify({query:O(this,Se),type:"observerResultsUpdated"})})},Ku);function vp(e,t){return Rt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Rt(t.retryOnMount,e)===!1)}function Tl(e,t){return vp(e,t)||e.state.data!==void 0&&ra(e,t,t.refetchOnMount)}function ra(e,t,r){if(Rt(t.enabled,e)!==!1&&Pr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ma(e,t)}return!1}function Nl(e,t,r,n){return(e!==t||Rt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ma(e,r)}function Ma(e,t){return Rt(t.enabled,e)!==!1&&e.isStaleByTime(Pr(t.staleTime,e))}function bp(e,t){return!qo(e.getCurrentResult(),t)}var Ts,sr,gt,rn,ir,xr,Qu,_p=(Qu=class extends nd{constructor(t){super();ne(this,ir);ne(this,Ts);ne(this,sr);ne(this,gt);ne(this,rn);G(this,Ts,t.client),this.mutationId=t.mutationId,G(this,gt,t.mutationCache),G(this,sr,[]),this.state=t.state||wp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,sr).includes(t)||(O(this,sr).push(t),this.clearGcTimeout(),O(this,gt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,sr,O(this,sr).filter(r=>r!==t)),this.scheduleGc(),O(this,gt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,sr).length||(this.state.status==="pending"?this.scheduleGc():O(this,gt).remove(this))}continue(){var t;return((t=O(this,rn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,g,m,b,h,y,v,_,x,w,C,I,j;const r=()=>{_e(this,ir,xr).call(this,{type:"continue"})},n={client:O(this,Ts),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,rn,rd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(k,L)=>{_e(this,ir,xr).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{_e(this,ir,xr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,gt).canRun(this)}));const s=this.state.status==="pending",i=!O(this,rn).canStart();try{if(s)r();else{_e(this,ir,xr).call(this,{type:"pending",variables:t,isPaused:i}),O(this,gt).config.onMutate&&await O(this,gt).config.onMutate(t,this,n);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));L!==this.state.context&&_e(this,ir,xr).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const k=await O(this,rn).start();return await((d=(c=O(this,gt).config).onSuccess)==null?void 0:d.call(c,k,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,n)),await((m=(g=O(this,gt).config).onSettled)==null?void 0:m.call(g,k,null,this.state.variables,this.state.context,this,n)),await((h=(b=this.options).onSettled)==null?void 0:h.call(b,k,null,t,this.state.context,n)),_e(this,ir,xr).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(y=O(this,gt).config).onError)==null?void 0:v.call(y,k,t,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((x=(_=this.options).onError)==null?void 0:x.call(_,k,t,this.state.context,n))}catch(L){Promise.reject(L)}try{await((C=(w=O(this,gt).config).onSettled)==null?void 0:C.call(w,void 0,k,this.state.variables,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((j=(I=this.options).onSettled)==null?void 0:j.call(I,void 0,k,t,this.state.context,n))}catch(L){Promise.reject(L)}throw _e(this,ir,xr).call(this,{type:"error",error:k}),k}finally{O(this,gt).runNext(this)}}},Ts=new WeakMap,sr=new WeakMap,gt=new WeakMap,rn=new WeakMap,ir=new WeakSet,xr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),lt.batch(()=>{O(this,sr).forEach(n=>{n.onMutationUpdate(t)}),O(this,gt).notify({mutation:this,type:"updated",action:t})})},Qu);function wp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var gr,Ht,Ns,Gu,xp=(Gu=class extends js{constructor(t={}){super();ne(this,gr);ne(this,Ht);ne(this,Ns);this.config=t,G(this,gr,new Set),G(this,Ht,new Map),G(this,Ns,0)}build(t,r,n){const s=new _p({client:t,mutationCache:this,mutationId:++Hs(this,Ns)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,gr).add(t);const r=Ws(t);if(typeof r=="string"){const n=O(this,Ht).get(r);n?n.push(t):O(this,Ht).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,gr).delete(t)){const r=Ws(t);if(typeof r=="string"){const n=O(this,Ht).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&O(this,Ht).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Ws(t);if(typeof r=="string"){const n=O(this,Ht).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Ws(t);if(typeof r=="string"){const s=(n=O(this,Ht).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){lt.batch(()=>{O(this,gr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,gr).clear(),O(this,Ht).clear()})}getAll(){return Array.from(O(this,gr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Sl(r,n))}findAll(t={}){return this.getAll().filter(r=>Sl(t,r))}notify(t){lt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return lt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Et))))}},gr=new WeakMap,Ht=new WeakMap,Ns=new WeakMap,Gu);function Ws(e){var t;return(t=e.options.scope)==null?void 0:t.id}var or,Yu,Sp=(Yu=class extends js{constructor(t={}){super();ne(this,or);this.config=t,G(this,or,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Pa(s,r);let o=this.get(i);return o||(o=new mp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){O(this,or).has(t.queryHash)||(O(this,or).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,or).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,or).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){lt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,or).get(t)}getAll(){return[...O(this,or).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>xl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>xl(t,n)):r}notify(t){lt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){lt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){lt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},or=new WeakMap,Yu),Qe,jr,Rr,An,Pn,kr,Mn,Ln,Xu,Cp=(Xu=class{constructor(e={}){ne(this,Qe);ne(this,jr);ne(this,Rr);ne(this,An);ne(this,Pn);ne(this,kr);ne(this,Mn);ne(this,Ln);G(this,Qe,e.queryCache||new Sp),G(this,jr,e.mutationCache||new xp),G(this,Rr,e.defaultOptions||{}),G(this,An,new Map),G(this,Pn,new Map),G(this,kr,0)}mount(){Hs(this,kr)._++,O(this,kr)===1&&(G(this,Mn,Aa.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Qe).onFocus())})),G(this,Ln,xi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Qe).onOnline())})))}unmount(){var e,t;Hs(this,kr)._--,O(this,kr)===0&&((e=O(this,Mn))==null||e.call(this),G(this,Mn,void 0),(t=O(this,Ln))==null||t.call(this),G(this,Ln,void 0))}isFetching(e){return O(this,Qe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,jr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Qe).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Qe).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Pr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,Qe).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=O(this,Qe).get(n.queryHash),i=s==null?void 0:s.state.data,o=sp(t,i);if(o!==void 0)return O(this,Qe).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return lt.batch(()=>O(this,Qe).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Qe).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Qe);lt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Qe);return lt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=lt.batch(()=>O(this,Qe).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Et).catch(Et)}invalidateQueries(e,t={}){return lt.batch(()=>(O(this,Qe).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=lt.batch(()=>O(this,Qe).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Et)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Et)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,Qe).build(this,t);return r.isStaleByTime(Pr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Et).catch(Et)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Et).catch(Et)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return xi.isOnline()?O(this,jr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Qe)}getMutationCache(){return O(this,jr)}getDefaultOptions(){return O(this,Rr)}setDefaultOptions(e){G(this,Rr,e)}setQueryDefaults(e,t){O(this,An).set(ys(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,An).values()],r={};return t.forEach(n=>{vs(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,Pn).set(ys(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Pn).values()],r={};return t.forEach(n=>{vs(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Rr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Pa(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===wi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Rr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Qe).clear(),O(this,jr).clear()}},Qe=new WeakMap,jr=new WeakMap,Rr=new WeakMap,An=new WeakMap,Pn=new WeakMap,kr=new WeakMap,Mn=new WeakMap,Ln=new WeakMap,Xu),ad=Ie.createContext(void 0),Op=e=>{const t=Ie.useContext(ad);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ep=({client:e,children:t})=>(Ie.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(ad.Provider,{value:e,children:t})),ld=Ie.createContext(!1),Dp=()=>Ie.useContext(ld);ld.Provider;function Ip(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Tp=Ie.createContext(Ip()),Np=()=>Ie.useContext(Tp),jp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?ed(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Rp=e=>{Ie.useEffect(()=>{e.clearReset()},[e])},kp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||ed(r,[e.error,n])),Ap=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Pp=(e,t)=>e.isLoading&&e.isFetching&&!t,Mp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,jl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Lp(e,t,r){var m,b,h,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Dp(),s=Np(),i=Op(),o=i.defaultQueryOptions(e);(b=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||b.call(m,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Ap(o),jp(o,s,a),Rp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ie.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Ie.useSyncExternalStore(Ie.useCallback(v=>{const _=g?u.subscribe(lt.batchCalls(v)):Et;return u.updateResult(),_},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ie.useEffect(()=>{u.setOptions(o)},[o,u]),Mp(o,f))throw jl(o,u,s);if(kp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!bs.isServer()&&Pp(f,n)){const v=d?jl(o,u,s):a==null?void 0:a.promise;v==null||v.catch(Et).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Si(e,t){return Lp(e,yp)}let Fp={data:""},$p=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||Fp},Bp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Up=/\/\*[^]*?\*\/| +/g,Rl=/\n+/g,Er=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?Er(o,i):i+"{"+Er(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Er(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,a):a?a+" "+c:c)):i):o!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Er.p?Er.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},br={},cd=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+cd(e[r]);return t}return e},zp=(e,t,r,n,s)=>{let i=cd(e),o=br[i]||(br[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!br[o]){let c=i!==e?e:(d=>{let u,f,g=[{}];for(;u=Bp.exec(d.replace(Up,""));)u[4]?g.shift():u[3]?(f=u[3].replace(Rl," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Rl," ").trim();return g[0]})(e);br[o]=Er(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&br.g;return r&&(br.g=br[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(br[o],t,n,a),o},Vp=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":Er(a,""):a===!1?"":a}return n+s+(o??"")},"");function $i(e){let t=this||{},r=e.call?e(t.p):e;return zp(r.unshift?r.raw?Vp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,$p(t.target),t.g,t.o,t.k)}let ud,na,sa;$i.bind({g:1});let mr=$i.bind({k:1});function qp(e,t,r,n){Er.p=t,ud=e,na=r,sa=n}function Lr(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:na&&na()},a),r.o=/go\d/.test(c),a.className=$i.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),sa&&d[0]&&sa(a),ud(d,a)}return s}}var Hp=e=>typeof e=="function",Ci=(e,t)=>Hp(e)?e(t):e,Wp=(()=>{let e=0;return()=>(++e).toString()})(),dd=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Kp=20,La="default",fd=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return fd(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ii=[],hd={toasts:[],pausedAt:void 0,settings:{toastLimit:Kp}},ar={},pd=(e,t=La)=>{ar[t]=fd(ar[t]||hd,e),ii.forEach(([r,n])=>{r===t&&n(ar[t])})},gd=e=>Object.keys(ar).forEach(t=>pd(e,t)),Qp=e=>Object.keys(ar).find(t=>ar[t].toasts.some(r=>r.id===e)),Bi=(e=La)=>t=>{pd(t,e)},Gp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Yp=(e={},t=La)=>{let[r,n]=p.useState(ar[t]||hd),s=p.useRef(ar[t]);p.useEffect(()=>(s.current!==ar[t]&&n(ar[t]),ii.push([t,n]),()=>{let o=ii.findIndex(([a])=>a===t);o>-1&&ii.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||Gp[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},Xp=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||Wp()}),Rs=e=>(t,r)=>{let n=Xp(t,e,r);return Bi(n.toasterId||Qp(n.id))({type:2,toast:n}),n.id},Je=(e,t)=>Rs("blank")(e,t);Je.error=Rs("error");Je.success=Rs("success");Je.loading=Rs("loading");Je.custom=Rs("custom");Je.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Bi(t)(r):gd(r)};Je.dismissAll=e=>Je.dismiss(void 0,e);Je.remove=(e,t)=>{let r={type:4,toastId:e};t?Bi(t)(r):gd(r)};Je.removeAll=e=>Je.remove(void 0,e);Je.promise=(e,t,r)=>{let n=Je.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ci(t.success,s):void 0;return i?Je.success(i,{id:n,...r,...r==null?void 0:r.success}):Je.dismiss(n),s}).catch(s=>{let i=t.error?Ci(t.error,s):void 0;i?Je.error(i,{id:n,...r,...r==null?void 0:r.error}):Je.dismiss(n)}),e};var Zp=1e3,Jp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Yp(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,g=Zp)=>{if(s.has(f))return;let m=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},g);s.set(f,m)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),g=r.map(m=>{if(m.duration===1/0)return;let b=(m.duration||0)+m.pauseDuration-(f-m.createdAt);if(b<0){m.visible&&Je.dismiss(m.id);return}return setTimeout(()=>Je.dismiss(m.id,t),b)});return()=>{g.forEach(m=>m&&clearTimeout(m))}},[r,n,t]);let o=p.useCallback(Bi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,g)=>{o({type:1,toast:{id:f,height:g}})},[o]),d=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=p.useCallback((f,g)=>{let{reverseOrder:m=!1,gutter:b=8,defaultPosition:h}=g||{},y=r.filter(x=>(x.position||h)===(f.position||h)&&x.height),v=y.findIndex(x=>x.id===f.id),_=y.filter((x,w)=>w<v&&x.visible).length;return y.filter(x=>x.visible).slice(...m?[_+1]:[0,_]).reduce((x,w)=>x+(w.height||0)+b,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let g=s.get(f.id);g&&(clearTimeout(g),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},eg=mr`
1
+ "use strict";var lp=Object.defineProperty;var El=e=>{throw TypeError(e)};var cp=(e,t,r)=>t in e?lp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var es=(e,t,r)=>cp(e,typeof t!="symbol"?t+"":t,r),ho=(e,t,r)=>t.has(e)||El("Cannot "+r);var E=(e,t,r)=>(ho(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?El("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),G=(e,t,r,n)=>(ho(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),_e=(e,t,r)=>(ho(e,t,"access private method"),r);var Qs=(e,t,r,n)=>({set _(s){G(e,t,s,r)},get _(){return E(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Pr=require("react-dom"),l=require("react/jsx-runtime");function up(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ie=up(p);var As=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qr,Ir,On,Yu,dp=(Yu=class extends As{constructor(){super();ne(this,Qr);ne(this,Ir);ne(this,On);G(this,On,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Ir)||this.setEventListener(E(this,On))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Ir))==null||t.call(this),G(this,Ir,void 0))}setEventListener(t){var r;G(this,On,t),(r=E(this,Ir))==null||r.call(this),G(this,Ir,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Qr)!==t&&(G(this,Qr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,Qr)=="boolean"?E(this,Qr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Qr=new WeakMap,Ir=new WeakMap,On=new WeakMap,Yu),Fa=new dp,fp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},sr,Gr,Xu,hp=(Xu=class{constructor(){ne(this,sr,fp);ne(this,Gr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,Gr)&&e!==E(this,sr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,sr),provider:e}),G(this,sr,e),process.env.NODE_ENV!=="production"&&G(this,Gr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,Gr,!0),E(this,sr).setTimeout(e,t)}clearTimeout(e){E(this,sr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,Gr,!0),E(this,sr).setInterval(e,t)}clearInterval(e){E(this,sr).clearInterval(e)}},sr=new WeakMap,Gr=new WeakMap,Xu),Hr=new hp;function pp(e){setTimeout(e,0)}var gp=typeof window>"u"||"Deno"in globalThis;function Dt(){}function mp(e,t){return typeof e=="function"?e(t):e}function Wo(e){return typeof e=="number"&&e>=0&&e!==1/0}function od(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Mr(e,t){return typeof e=="function"?e(t):e}function kt(e,t){return typeof e=="function"?e(t):e}function Ol(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==$a(o,t.options))return!1}else if(!_s(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Dl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(bs(t.options.mutationKey)!==bs(i))return!1}else if(!_s(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function $a(e,t){return((t==null?void 0:t.queryKeyHashFn)||bs)(e)}function bs(e){return JSON.stringify(e,(t,r)=>Go(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function _s(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>_s(e[r],t[r])):!1}var yp=Object.prototype.hasOwnProperty;function Ko(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Il(e)&&Il(t);if(!n&&!(Go(e)&&Go(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],g=e[f],m=t[f];if(g===m){c[f]=g,(n?u<i:yp.call(e,f))&&d++;continue}if(g===null||m===null||typeof g!="object"||typeof m!="object"){c[f]=m;continue}const b=Ko(g,m,r+1);c[f]=b,b===g&&d++}return i===a&&d===i?e:c}function Qo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Il(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Go(e){if(!Tl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Tl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Tl(e){return Object.prototype.toString.call(e)==="[object Object]"}function vp(e){return new Promise(t=>{Hr.setTimeout(t,e)})}function Yo(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Ko(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Ko(e,t)}return t}function bp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function _p(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ei=Symbol();function ad(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ei&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ei?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ld(e,t){return typeof e=="function"?e(...t):!!e}function wp(e,t,r){let n=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),n||(n=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var ws=(()=>{let e=()=>gp;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xo(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var Sp=pp;function xp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=Sp;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var ct=xp(),Dn,Tr,In,Zu,Cp=(Zu=class extends As{constructor(){super();ne(this,Dn,!0);ne(this,Tr);ne(this,In);G(this,In,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,Tr)||this.setEventListener(E(this,In))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Tr))==null||t.call(this),G(this,Tr,void 0))}setEventListener(t){var r;G(this,In,t),(r=E(this,Tr))==null||r.call(this),G(this,Tr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Dn)!==t&&(G(this,Dn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Dn)}},Dn=new WeakMap,Tr=new WeakMap,In=new WeakMap,Zu),Oi=new Cp;function Ep(e){return Math.min(1e3*2**e,3e4)}function cd(e){return(e??"online")==="online"?Oi.isOnline():!0}var Zo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ud(e){let t=!1,r=0,n;const s=Xo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new Zo(h);g(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>Fa.isFocused()&&(e.networkMode==="always"||Oi.isOnline())&&e.canRun(),u=()=>cd(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},g=h=>{i()||(n==null||n(),s.reject(h))},m=()=>new Promise(h=>{var y;n=v=>{(i()||d())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),b=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(f).catch(v=>{var I;if(i())return;const _=e.retry??(ws.isServer()?0:3),S=e.retryDelay??Ep,w=typeof S=="function"?S(r,v):S,C=_===!0||typeof _=="number"&&r<_||typeof _=="function"&&_(r,v);if(t||!C){g(v);return}r++,(I=e.onFail)==null||I.call(e,r,v),vp(w).then(()=>d()?void 0:m()).then(()=>{t?g(v):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?b():m().then(b),s)}}var Yr,Ju,dd=(Ju=class{constructor(){ne(this,Yr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wo(this.gcTime)&&G(this,Yr,Hr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ws.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Yr)!==void 0&&(Hr.clearTimeout(E(this,Yr)),G(this,Yr,void 0))}},Yr=new WeakMap,Ju);function Op(e){return{onFetch:(t,r)=>{var u,f,g,m,b;const n=t.options,s=(g=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const y=S=>{wp(S,()=>t.signal,()=>h=!0)},v=ad(t.options,t.fetchOptions),_=async(S,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const j=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return y(A),A})(),k=await v(j),{maxPages:L}=t.options,N=C?_p:bp;return{pages:N(S.pages,k,L),pageParams:N(S.pageParams,w,L)}};if(s&&i.length){const S=s==="backward",w=S?Dp:Nl,C={pages:i,pageParams:o},I=w(n,C);a=await _(C,I,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Nl(n,a);if(c>0&&w==null)break;a=await _(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Nl(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Dp(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Tn,Xr,Nn,Bt,Zr,rt,Ts,Jr,Rt,fd,pr,ed,Ip=(ed=class extends dd{constructor(t){super();ne(this,Rt);ne(this,Tn);ne(this,Xr);ne(this,Nn);ne(this,Bt);ne(this,Zr);ne(this,rt);ne(this,Ts);ne(this,Jr);G(this,Jr,!1),G(this,Ts,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,Zr,t.client),G(this,Bt,E(this,Zr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Xr,Rl(this.options)),this.state=t.state??E(this,Xr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Tn)}get promise(){var t;return(t=E(this,rt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Ts),...t},t!=null&&t._type&&G(this,Tn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Rl(this.options);r.data!==void 0&&(this.setState(jl(r.data,r.dataUpdatedAt)),G(this,Xr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,Bt).remove(this)}setData(t,r){const n=Yo(this.state.data,t,this.options);return _e(this,Rt,pr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){_e(this,Rt,pr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,rt))==null?void 0:n.promise;return(s=E(this,rt))==null||s.cancel(t),r?r.then(Dt).catch(Dt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Xr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ei||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Mr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!od(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,rt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,rt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,Bt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(E(this,rt)&&(E(this,Jr)||_e(this,Rt,fd).call(this)?E(this,rt).cancel({revert:!0}):E(this,rt).cancelRetry()),this.scheduleGc()),E(this,Bt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Rt,pr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,g,m,b,h,y,v,_,S;if(this.state.fetchStatus!=="idle"&&((d=E(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,rt))return E(this,rt).continueRetry(),E(this,rt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(G(this,Jr,!0),n.signal)})},i=()=>{const w=ad(this.options,r),I=(()=>{const j={client:E(this,Zr),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return G(this,Jr,!1),this.options.persister?this.options.persister(w,I,this):w(I)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,Zr),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,Tn)==="infinite"?Op(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),G(this,Nn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&_e(this,Rt,pr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),G(this,rt,ud({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof Zo&&w.revert&&this.setState({...E(this,Nn),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{_e(this,Rt,pr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{_e(this,Rt,pr).call(this,{type:"pause"})},onContinue:()=>{_e(this,Rt,pr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,rt).start();if(w===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(w),(m=(g=E(this,Bt).config).onSuccess)==null||m.call(g,w,this),(h=(b=E(this,Bt).config).onSettled)==null||h.call(b,w,this.state.error,this),w}catch(w){if(w instanceof Zo){if(w.silent)return E(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw _e(this,Rt,pr).call(this,{type:"error",error:w}),(v=(y=E(this,Bt).config).onError)==null||v.call(y,w,this),(S=(_=E(this,Bt).config).onSettled)==null||S.call(_,this.state.data,w,this),w}finally{this.scheduleGc()}}},Tn=new WeakMap,Xr=new WeakMap,Nn=new WeakMap,Bt=new WeakMap,Zr=new WeakMap,rt=new WeakMap,Ts=new WeakMap,Jr=new WeakMap,Rt=new WeakSet,fd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},pr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...hd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...jl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,Nn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),ct.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,Bt).notify({query:this,type:"updated",action:t})})},ed);function hd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function jl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Rl(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Ot,xe,Ns,wt,en,jn,gr,Nr,js,Rn,kn,tn,rn,jr,An,Te,us,Jo,ea,ta,ra,na,sa,ia,pd,td,Tp=(td=class extends As{constructor(t,r){super();ne(this,Te);ne(this,Ot);ne(this,xe);ne(this,Ns);ne(this,wt);ne(this,en);ne(this,jn);ne(this,gr);ne(this,Nr);ne(this,js);ne(this,Rn);ne(this,kn);ne(this,tn);ne(this,rn);ne(this,jr);ne(this,An,new Set);this.options=r,G(this,Ot,t),G(this,Nr,null),G(this,gr,Xo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,xe).addObserver(this),kl(E(this,xe),this.options)?_e(this,Te,us).call(this):this.updateResult(),_e(this,Te,ra).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return oa(E(this,xe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return oa(E(this,xe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Te,na).call(this),_e(this,Te,sa).call(this),E(this,xe).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,xe);if(this.options=E(this,Ot).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof kt(this.options.enabled,E(this,xe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Te,ia).call(this),E(this,xe).setOptions(this.options),r._defaulted&&!Qo(this.options,r)&&E(this,Ot).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,xe),observer:this});const s=this.hasListeners();s&&Al(E(this,xe),n,this.options,r)&&_e(this,Te,us).call(this),this.updateResult(),s&&(E(this,xe)!==n||kt(this.options.enabled,E(this,xe))!==kt(r.enabled,E(this,xe))||Mr(this.options.staleTime,E(this,xe))!==Mr(r.staleTime,E(this,xe)))&&_e(this,Te,Jo).call(this);const i=_e(this,Te,ea).call(this);s&&(E(this,xe)!==n||kt(this.options.enabled,E(this,xe))!==kt(r.enabled,E(this,xe))||i!==E(this,jr))&&_e(this,Te,ta).call(this,i)}getOptimisticResult(t){const r=E(this,Ot).getQueryCache().build(E(this,Ot),t),n=this.createResult(r,t);return jp(this,n)&&(G(this,wt,n),G(this,jn,this.options),G(this,en,E(this,xe).state)),n}getCurrentResult(){return E(this,wt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,gr).status==="pending"&&E(this,gr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,An).add(t)}getCurrentQuery(){return E(this,xe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,Ot).defaultQueryOptions(t),n=E(this,Ot).getQueryCache().build(E(this,Ot),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return _e(this,Te,us).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,wt)))}createResult(t,r){var L;const n=E(this,xe),s=this.options,i=E(this,wt),o=E(this,en),a=E(this,jn),d=t!==n?t.state:E(this,Ns),{state:u}=t;let f={...u},g=!1,m;if(r._optimisticResults){const N=this.hasListeners(),A=!N&&kl(t,r),$=N&&Al(t,n,r,s);(A||$)&&(f={...f,...hd(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:h,status:y}=f;m=f.data;let v=!1;if(r.placeholderData!==void 0&&m===void 0&&y==="pending"){let N;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(N=i.data,v=!0):N=typeof r.placeholderData=="function"?r.placeholderData((L=E(this,kn))==null?void 0:L.state.data,E(this,kn)):r.placeholderData,N!==void 0&&(y="success",m=Yo(i==null?void 0:i.data,N,r),g=!0)}if(r.select&&m!==void 0&&!v)if(i&&m===(o==null?void 0:o.data)&&r.select===E(this,js))m=E(this,Rn);else try{G(this,js,r.select),m=r.select(m),m=Yo(i==null?void 0:i.data,m,r),G(this,Rn,m),G(this,Nr,null)}catch(N){G(this,Nr,N)}E(this,Nr)&&(b=E(this,Nr),m=E(this,Rn),h=Date.now(),y="error");const _=f.fetchStatus==="fetching",S=y==="pending",w=y==="error",C=S&&_,I=m!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:S,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:_,isRefetching:_&&!S,isLoadingError:w&&!I,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&I,isStale:Ba(t,r),refetch:this.refetch,promise:E(this,gr),isEnabled:kt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=k.data!==void 0,A=k.status==="error"&&!N,$=M=>{A?M.reject(k.error):N&&M.resolve(k.data)},R=()=>{const M=G(this,gr,k.promise=Xo());$(M)},F=E(this,gr);switch(F.status){case"pending":t.queryHash===n.queryHash&&$(F);break;case"fulfilled":(A||k.data!==F.value)&&R();break;case"rejected":(!A||k.error!==F.reason)&&R();break}}return k}updateResult(){const t=E(this,wt),r=this.createResult(E(this,xe),this.options);if(G(this,en,E(this,xe).state),G(this,jn,this.options),E(this,en).data!==void 0&&G(this,kn,E(this,xe)),Qo(r,t))return;G(this,wt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,An).size)return!0;const o=new Set(i??E(this,An));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,wt)).some(a=>{const c=a;return E(this,wt)[c]!==t[c]&&o.has(c)})};_e(this,Te,pd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Te,ra).call(this)}},Ot=new WeakMap,xe=new WeakMap,Ns=new WeakMap,wt=new WeakMap,en=new WeakMap,jn=new WeakMap,gr=new WeakMap,Nr=new WeakMap,js=new WeakMap,Rn=new WeakMap,kn=new WeakMap,tn=new WeakMap,rn=new WeakMap,jr=new WeakMap,An=new WeakMap,Te=new WeakSet,us=function(t){_e(this,Te,ia).call(this);let r=E(this,xe).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Dt)),r},Jo=function(){_e(this,Te,na).call(this);const t=Mr(this.options.staleTime,E(this,xe));if(ws.isServer()||E(this,wt).isStale||!Wo(t))return;const n=od(E(this,wt).dataUpdatedAt,t)+1;G(this,tn,Hr.setTimeout(()=>{E(this,wt).isStale||this.updateResult()},n))},ea=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,xe)):this.options.refetchInterval)??!1},ta=function(t){_e(this,Te,sa).call(this),G(this,jr,t),!(ws.isServer()||kt(this.options.enabled,E(this,xe))===!1||!Wo(E(this,jr))||E(this,jr)===0)&&G(this,rn,Hr.setInterval(()=>{(this.options.refetchIntervalInBackground||Fa.isFocused())&&_e(this,Te,us).call(this)},E(this,jr)))},ra=function(){_e(this,Te,Jo).call(this),_e(this,Te,ta).call(this,_e(this,Te,ea).call(this))},na=function(){E(this,tn)!==void 0&&(Hr.clearTimeout(E(this,tn)),G(this,tn,void 0))},sa=function(){E(this,rn)!==void 0&&(Hr.clearInterval(E(this,rn)),G(this,rn,void 0))},ia=function(){const t=E(this,Ot).getQueryCache().build(E(this,Ot),this.options);if(t===E(this,xe))return;const r=E(this,xe);G(this,xe,t),G(this,Ns,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},pd=function(t){ct.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,wt))}),E(this,Ot).getQueryCache().notify({query:E(this,xe),type:"observerResultsUpdated"})})},td);function Np(e,t){return kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&kt(t.retryOnMount,e)===!1)}function kl(e,t){return Np(e,t)||e.state.data!==void 0&&oa(e,t,t.refetchOnMount)}function oa(e,t,r){if(kt(t.enabled,e)!==!1&&Mr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ba(e,t)}return!1}function Al(e,t,r,n){return(e!==t||kt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ba(e,r)}function Ba(e,t){return kt(t.enabled,e)!==!1&&e.isStaleByTime(Mr(t.staleTime,e))}function jp(e,t){return!Qo(e.getCurrentResult(),t)}var Rs,ir,mt,nn,or,xr,rd,Rp=(rd=class extends dd{constructor(t){super();ne(this,or);ne(this,Rs);ne(this,ir);ne(this,mt);ne(this,nn);G(this,Rs,t.client),this.mutationId=t.mutationId,G(this,mt,t.mutationCache),G(this,ir,[]),this.state=t.state||kp(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,ir).includes(t)||(E(this,ir).push(t),this.clearGcTimeout(),E(this,mt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,ir,E(this,ir).filter(r=>r!==t)),this.scheduleGc(),E(this,mt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,ir).length||(this.state.status==="pending"?this.scheduleGc():E(this,mt).remove(this))}continue(){var t;return((t=E(this,nn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,g,m,b,h,y,v,_,S,w,C,I,j;const r=()=>{_e(this,or,xr).call(this,{type:"continue"})},n={client:E(this,Rs),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,nn,ud({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(k,L)=>{_e(this,or,xr).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{_e(this,or,xr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,mt).canRun(this)}));const s=this.state.status==="pending",i=!E(this,nn).canStart();try{if(s)r();else{_e(this,or,xr).call(this,{type:"pending",variables:t,isPaused:i}),E(this,mt).config.onMutate&&await E(this,mt).config.onMutate(t,this,n);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));L!==this.state.context&&_e(this,or,xr).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const k=await E(this,nn).start();return await((d=(c=E(this,mt).config).onSuccess)==null?void 0:d.call(c,k,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,n)),await((m=(g=E(this,mt).config).onSettled)==null?void 0:m.call(g,k,null,this.state.variables,this.state.context,this,n)),await((h=(b=this.options).onSettled)==null?void 0:h.call(b,k,null,t,this.state.context,n)),_e(this,or,xr).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(y=E(this,mt).config).onError)==null?void 0:v.call(y,k,t,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((S=(_=this.options).onError)==null?void 0:S.call(_,k,t,this.state.context,n))}catch(L){Promise.reject(L)}try{await((C=(w=E(this,mt).config).onSettled)==null?void 0:C.call(w,void 0,k,this.state.variables,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((j=(I=this.options).onSettled)==null?void 0:j.call(I,void 0,k,t,this.state.context,n))}catch(L){Promise.reject(L)}throw _e(this,or,xr).call(this,{type:"error",error:k}),k}finally{E(this,mt).runNext(this)}}},Rs=new WeakMap,ir=new WeakMap,mt=new WeakMap,nn=new WeakMap,or=new WeakSet,xr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),ct.batch(()=>{E(this,ir).forEach(n=>{n.onMutationUpdate(t)}),E(this,mt).notify({mutation:this,type:"updated",action:t})})},rd);function kp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var mr,Wt,ks,nd,Ap=(nd=class extends As{constructor(t={}){super();ne(this,mr);ne(this,Wt);ne(this,ks);this.config=t,G(this,mr,new Set),G(this,Wt,new Map),G(this,ks,0)}build(t,r,n){const s=new Rp({client:t,mutationCache:this,mutationId:++Qs(this,ks)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,mr).add(t);const r=Gs(t);if(typeof r=="string"){const n=E(this,Wt).get(r);n?n.push(t):E(this,Wt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,mr).delete(t)){const r=Gs(t);if(typeof r=="string"){const n=E(this,Wt).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&E(this,Wt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Gs(t);if(typeof r=="string"){const n=E(this,Wt).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Gs(t);if(typeof r=="string"){const s=(n=E(this,Wt).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ct.batch(()=>{E(this,mr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,mr).clear(),E(this,Wt).clear()})}getAll(){return Array.from(E(this,mr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Dl(r,n))}findAll(t={}){return this.getAll().filter(r=>Dl(t,r))}notify(t){ct.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return ct.batch(()=>Promise.all(t.map(r=>r.continue().catch(Dt))))}},mr=new WeakMap,Wt=new WeakMap,ks=new WeakMap,nd);function Gs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ar,sd,Pp=(sd=class extends As{constructor(t={}){super();ne(this,ar);this.config=t,G(this,ar,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??$a(s,r);let o=this.get(i);return o||(o=new Ip({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,ar).has(t.queryHash)||(E(this,ar).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,ar).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,ar).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,ar).get(t)}getAll(){return[...E(this,ar).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ol(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Ol(t,n)):r}notify(t){ct.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ar=new WeakMap,sd),Qe,Rr,kr,Pn,Mn,Ar,Ln,Fn,id,Mp=(id=class{constructor(e={}){ne(this,Qe);ne(this,Rr);ne(this,kr);ne(this,Pn);ne(this,Mn);ne(this,Ar);ne(this,Ln);ne(this,Fn);G(this,Qe,e.queryCache||new Pp),G(this,Rr,e.mutationCache||new Ap),G(this,kr,e.defaultOptions||{}),G(this,Pn,new Map),G(this,Mn,new Map),G(this,Ar,0)}mount(){Qs(this,Ar)._++,E(this,Ar)===1&&(G(this,Ln,Fa.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Qe).onFocus())})),G(this,Fn,Oi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Qe).onOnline())})))}unmount(){var e,t;Qs(this,Ar)._--,E(this,Ar)===0&&((e=E(this,Ln))==null||e.call(this),G(this,Ln,void 0),(t=E(this,Fn))==null||t.call(this),G(this,Fn,void 0))}isFetching(e){return E(this,Qe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Rr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,Qe).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,Qe).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Mr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,Qe).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=E(this,Qe).get(n.queryHash),i=s==null?void 0:s.state.data,o=mp(t,i);if(o!==void 0)return E(this,Qe).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return ct.batch(()=>E(this,Qe).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,Qe).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,Qe);ct.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,Qe);return ct.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=ct.batch(()=>E(this,Qe).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Dt).catch(Dt)}invalidateQueries(e,t={}){return ct.batch(()=>(E(this,Qe).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=ct.batch(()=>E(this,Qe).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Dt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Dt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,Qe).build(this,t);return r.isStaleByTime(Mr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dt).catch(Dt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Dt).catch(Dt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Oi.isOnline()?E(this,Rr).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Qe)}getMutationCache(){return E(this,Rr)}getDefaultOptions(){return E(this,kr)}setDefaultOptions(e){G(this,kr,e)}setQueryDefaults(e,t){E(this,Pn).set(bs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,Pn).values()],r={};return t.forEach(n=>{_s(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,Mn).set(bs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Mn).values()],r={};return t.forEach(n=>{_s(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,kr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=$a(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ei&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,kr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Qe).clear(),E(this,Rr).clear()}},Qe=new WeakMap,Rr=new WeakMap,kr=new WeakMap,Pn=new WeakMap,Mn=new WeakMap,Ar=new WeakMap,Ln=new WeakMap,Fn=new WeakMap,id),gd=Ie.createContext(void 0),Lp=e=>{const t=Ie.useContext(gd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Fp=({client:e,children:t})=>(Ie.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(gd.Provider,{value:e,children:t})),md=Ie.createContext(!1),$p=()=>Ie.useContext(md);md.Provider;function Bp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Up=Ie.createContext(Bp()),zp=()=>Ie.useContext(Up),Vp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?ld(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},qp=e=>{Ie.useEffect(()=>{e.clearReset()},[e])},Hp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||ld(r,[e.error,n])),Wp=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Kp=(e,t)=>e.isLoading&&e.isFetching&&!t,Qp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Pl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Gp(e,t,r){var m,b,h,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=$p(),s=zp(),i=Lp(),o=i.defaultQueryOptions(e);(b=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||b.call(m,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Wp(o),Vp(o,s,a),qp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ie.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Ie.useSyncExternalStore(Ie.useCallback(v=>{const _=g?u.subscribe(ct.batchCalls(v)):Dt;return u.updateResult(),_},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ie.useEffect(()=>{u.setOptions(o)},[o,u]),Qp(o,f))throw Pl(o,u,s);if(Hp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!ws.isServer()&&Kp(f,n)){const v=d?Pl(o,u,s):a==null?void 0:a.promise;v==null||v.catch(Dt).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Ss(e,t){return Gp(e,Tp)}let Yp={data:""},Xp=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||Yp},Zp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Jp=/\/\*[^]*?\*\/| +/g,Ml=/\n+/g,Dr=(e,t)=>{let r="",n="",s="";for(let i in e){let o=e[i];i[0]=="@"?i[1]=="i"?r=i+" "+o+";":n+=i[1]=="f"?Dr(o,i):i+"{"+Dr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Dr(o,t?t.replace(/([^,])+/g,a=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,a):a?a+" "+c:c)):i):o!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Dr.p?Dr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},_r={},yd=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+yd(e[r]);return t}return e},eg=(e,t,r,n,s)=>{let i=yd(e),o=_r[i]||(_r[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!_r[o]){let c=i!==e?e:(d=>{let u,f,g=[{}];for(;u=Zp.exec(d.replace(Jp,""));)u[4]?g.shift():u[3]?(f=u[3].replace(Ml," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Ml," ").trim();return g[0]})(e);_r[o]=Dr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&_r.g;return r&&(_r.g=_r[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(_r[o],t,n,a),o},tg=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":Dr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Vi(e){let t=this||{},r=e.call?e(t.p):e;return eg(r.unshift?r.raw?tg(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Xp(t.target),t.g,t.o,t.k)}let vd,aa,la;Vi.bind({g:1});let yr=Vi.bind({k:1});function rg(e,t,r,n){Dr.p=t,vd=e,aa=r,la=n}function Fr(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:aa&&aa()},a),r.o=/go\d/.test(c),a.className=Vi.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),la&&d[0]&&la(a),vd(d,a)}return s}}var ng=e=>typeof e=="function",Di=(e,t)=>ng(e)?e(t):e,sg=(()=>{let e=0;return()=>(++e).toString()})(),bd=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),ig=20,Ua="default",_d=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return _d(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ci=[],wd={toasts:[],pausedAt:void 0,settings:{toastLimit:ig}},lr={},Sd=(e,t=Ua)=>{lr[t]=_d(lr[t]||wd,e),ci.forEach(([r,n])=>{r===t&&n(lr[t])})},xd=e=>Object.keys(lr).forEach(t=>Sd(e,t)),og=e=>Object.keys(lr).find(t=>lr[t].toasts.some(r=>r.id===e)),qi=(e=Ua)=>t=>{Sd(t,e)},ag={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},lg=(e={},t=Ua)=>{let[r,n]=p.useState(lr[t]||wd),s=p.useRef(lr[t]);p.useEffect(()=>(s.current!==lr[t]&&n(lr[t]),ci.push([t,n]),()=>{let o=ci.findIndex(([a])=>a===t);o>-1&&ci.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||ag[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},cg=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||sg()}),Ps=e=>(t,r)=>{let n=cg(t,e,r);return qi(n.toasterId||og(n.id))({type:2,toast:n}),n.id},Je=(e,t)=>Ps("blank")(e,t);Je.error=Ps("error");Je.success=Ps("success");Je.loading=Ps("loading");Je.custom=Ps("custom");Je.dismiss=(e,t)=>{let r={type:3,toastId:e};t?qi(t)(r):xd(r)};Je.dismissAll=e=>Je.dismiss(void 0,e);Je.remove=(e,t)=>{let r={type:4,toastId:e};t?qi(t)(r):xd(r)};Je.removeAll=e=>Je.remove(void 0,e);Je.promise=(e,t,r)=>{let n=Je.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Di(t.success,s):void 0;return i?Je.success(i,{id:n,...r,...r==null?void 0:r.success}):Je.dismiss(n),s}).catch(s=>{let i=t.error?Di(t.error,s):void 0;i?Je.error(i,{id:n,...r,...r==null?void 0:r.error}):Je.dismiss(n)}),e};var ug=1e3,dg=(e,t="default")=>{let{toasts:r,pausedAt:n}=lg(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,g=ug)=>{if(s.has(f))return;let m=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},g);s.set(f,m)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),g=r.map(m=>{if(m.duration===1/0)return;let b=(m.duration||0)+m.pauseDuration-(f-m.createdAt);if(b<0){m.visible&&Je.dismiss(m.id);return}return setTimeout(()=>Je.dismiss(m.id,t),b)});return()=>{g.forEach(m=>m&&clearTimeout(m))}},[r,n,t]);let o=p.useCallback(qi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,g)=>{o({type:1,toast:{id:f,height:g}})},[o]),d=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=p.useCallback((f,g)=>{let{reverseOrder:m=!1,gutter:b=8,defaultPosition:h}=g||{},y=r.filter(S=>(S.position||h)===(f.position||h)&&S.height),v=y.findIndex(S=>S.id===f.id),_=y.filter((S,w)=>w<v&&S.visible).length;return y.filter(S=>S.visible).slice(...m?[_+1]:[0,_]).reduce((S,w)=>S+(w.height||0)+b,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let g=s.get(f.id);g&&(clearTimeout(g),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},fg=yr`
2
2
  from {
3
3
  transform: scale(0) rotate(45deg);
4
4
  opacity: 0;
@@ -6,7 +6,7 @@ from {
6
6
  to {
7
7
  transform: scale(1) rotate(45deg);
8
8
  opacity: 1;
9
- }`,tg=mr`
9
+ }`,hg=yr`
10
10
  from {
11
11
  transform: scale(0);
12
12
  opacity: 0;
@@ -14,7 +14,7 @@ from {
14
14
  to {
15
15
  transform: scale(1);
16
16
  opacity: 1;
17
- }`,rg=mr`
17
+ }`,pg=yr`
18
18
  from {
19
19
  transform: scale(0) rotate(90deg);
20
20
  opacity: 0;
@@ -22,7 +22,7 @@ from {
22
22
  to {
23
23
  transform: scale(1) rotate(90deg);
24
24
  opacity: 1;
25
- }`,ng=Lr("div")`
25
+ }`,gg=Fr("div")`
26
26
  width: 20px;
27
27
  opacity: 0;
28
28
  height: 20px;
@@ -31,14 +31,14 @@ to {
31
31
  position: relative;
32
32
  transform: rotate(45deg);
33
33
 
34
- animation: ${eg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
34
+ animation: ${fg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
35
35
  forwards;
36
36
  animation-delay: 100ms;
37
37
 
38
38
  &:after,
39
39
  &:before {
40
40
  content: '';
41
- animation: ${tg} 0.15s ease-out forwards;
41
+ animation: ${hg} 0.15s ease-out forwards;
42
42
  animation-delay: 150ms;
43
43
  position: absolute;
44
44
  border-radius: 3px;
@@ -51,18 +51,18 @@ to {
51
51
  }
52
52
 
53
53
  &:before {
54
- animation: ${rg} 0.15s ease-out forwards;
54
+ animation: ${pg} 0.15s ease-out forwards;
55
55
  animation-delay: 180ms;
56
56
  transform: rotate(90deg);
57
57
  }
58
- `,sg=mr`
58
+ `,mg=yr`
59
59
  from {
60
60
  transform: rotate(0deg);
61
61
  }
62
62
  to {
63
63
  transform: rotate(360deg);
64
64
  }
65
- `,ig=Lr("div")`
65
+ `,yg=Fr("div")`
66
66
  width: 12px;
67
67
  height: 12px;
68
68
  box-sizing: border-box;
@@ -70,8 +70,8 @@ to {
70
70
  border-radius: 100%;
71
71
  border-color: ${e=>e.secondary||"#e0e0e0"};
72
72
  border-right-color: ${e=>e.primary||"#616161"};
73
- animation: ${sg} 1s linear infinite;
74
- `,og=mr`
73
+ animation: ${mg} 1s linear infinite;
74
+ `,vg=yr`
75
75
  from {
76
76
  transform: scale(0) rotate(45deg);
77
77
  opacity: 0;
@@ -79,7 +79,7 @@ from {
79
79
  to {
80
80
  transform: scale(1) rotate(45deg);
81
81
  opacity: 1;
82
- }`,ag=mr`
82
+ }`,bg=yr`
83
83
  0% {
84
84
  height: 0;
85
85
  width: 0;
@@ -93,7 +93,7 @@ to {
93
93
  100% {
94
94
  opacity: 1;
95
95
  height: 10px;
96
- }`,lg=Lr("div")`
96
+ }`,_g=Fr("div")`
97
97
  width: 20px;
98
98
  opacity: 0;
99
99
  height: 20px;
@@ -102,13 +102,13 @@ to {
102
102
  position: relative;
103
103
  transform: rotate(45deg);
104
104
 
105
- animation: ${og} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
105
+ animation: ${vg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
106
106
  forwards;
107
107
  animation-delay: 100ms;
108
108
  &:after {
109
109
  content: '';
110
110
  box-sizing: border-box;
111
- animation: ${ag} 0.2s ease-out forwards;
111
+ animation: ${bg} 0.2s ease-out forwards;
112
112
  opacity: 0;
113
113
  animation-delay: 200ms;
114
114
  position: absolute;
@@ -120,16 +120,16 @@ to {
120
120
  height: 10px;
121
121
  width: 6px;
122
122
  }
123
- `,cg=Lr("div")`
123
+ `,wg=Fr("div")`
124
124
  position: absolute;
125
- `,ug=Lr("div")`
125
+ `,Sg=Fr("div")`
126
126
  position: relative;
127
127
  display: flex;
128
128
  justify-content: center;
129
129
  align-items: center;
130
130
  min-width: 20px;
131
131
  min-height: 20px;
132
- `,dg=mr`
132
+ `,xg=yr`
133
133
  from {
134
134
  transform: scale(0.6);
135
135
  opacity: 0.4;
@@ -137,20 +137,20 @@ from {
137
137
  to {
138
138
  transform: scale(1);
139
139
  opacity: 1;
140
- }`,fg=Lr("div")`
140
+ }`,Cg=Fr("div")`
141
141
  position: relative;
142
142
  transform: scale(0.6);
143
143
  opacity: 0.4;
144
144
  min-width: 20px;
145
- animation: ${dg} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
145
+ animation: ${xg} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
146
146
  forwards;
147
- `,hg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ie.createElement(fg,null,t):t:r==="blank"?null:Ie.createElement(ug,null,Ie.createElement(ig,{...n}),r!=="loading"&&Ie.createElement(cg,null,r==="error"?Ie.createElement(ng,{...n}):Ie.createElement(lg,{...n})))},pg=e=>`
147
+ `,Eg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ie.createElement(Cg,null,t):t:r==="blank"?null:Ie.createElement(Sg,null,Ie.createElement(yg,{...n}),r!=="loading"&&Ie.createElement(wg,null,r==="error"?Ie.createElement(gg,{...n}):Ie.createElement(_g,{...n})))},Og=e=>`
148
148
  0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
149
149
  100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
150
- `,gg=e=>`
150
+ `,Dg=e=>`
151
151
  0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
152
152
  100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
153
- `,mg="0%{opacity:0;} 100%{opacity:1;}",yg="0%{opacity:1;} 100%{opacity:0;}",vg=Lr("div")`
153
+ `,Ig="0%{opacity:0;} 100%{opacity:1;}",Tg="0%{opacity:1;} 100%{opacity:0;}",Ng=Fr("div")`
154
154
  display: flex;
155
155
  align-items: center;
156
156
  background: #fff;
@@ -162,258 +162,258 @@ to {
162
162
  pointer-events: auto;
163
163
  padding: 8px 10px;
164
164
  border-radius: 8px;
165
- `,bg=Lr("div")`
165
+ `,jg=Fr("div")`
166
166
  display: flex;
167
167
  justify-content: center;
168
168
  margin: 4px 10px;
169
169
  color: inherit;
170
170
  flex: 1 1 auto;
171
171
  white-space: pre-line;
172
- `,_g=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=dd()?[mg,yg]:[pg(r),gg(r)];return{animation:t?`${mr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${mr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},wg=Ie.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?_g(e.position||t||"top-center",e.visible):{opacity:0},i=Ie.createElement(hg,{toast:e}),o=Ie.createElement(bg,{...e.ariaProps},Ci(e.message,e));return Ie.createElement(vg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Ie.createElement(Ie.Fragment,null,i,o))});qp(Ie.createElement);var xg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Ie.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ie.createElement("div",{ref:i,className:t,style:r},s)},Sg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:dd()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Cg=$i`
172
+ `,Rg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=bd()?[Ig,Tg]:[Og(r),Dg(r)];return{animation:t?`${yr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${yr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},kg=Ie.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?Rg(e.position||t||"top-center",e.visible):{opacity:0},i=Ie.createElement(Eg,{toast:e}),o=Ie.createElement(jg,{...e.ariaProps},Di(e.message,e));return Ie.createElement(Ng,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Ie.createElement(Ie.Fragment,null,i,o))});rg(Ie.createElement);var Ag=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Ie.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ie.createElement("div",{ref:i,className:t,style:r},s)},Pg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:bd()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Mg=Vi`
173
173
  z-index: 9999;
174
174
  > * {
175
175
  pointer-events: auto;
176
176
  }
177
- `,Ks=16,Og=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=Jp(r,i);return Ie.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Ks,left:Ks,right:Ks,bottom:Ks,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,g=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),m=Sg(f,g);return Ie.createElement(xg,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Cg:"",style:m},u.type==="custom"?Ci(u.message,u):s?s(u):Ie.createElement(wg,{toast:u,position:f}))}))},Ee=Je;function Eg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Ui=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Fa(e){return"nodeType"in e}function wt(e){var t,r;return e?zn(e)?e:Fa(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function $a(e){const{Document:t}=wt(e);return e instanceof t}function ks(e){return zn(e)?!1:e instanceof wt(e).HTMLElement}function md(e){return e instanceof wt(e).SVGElement}function Vn(e){return e?zn(e)?e.document:Fa(e)?$a(e)?e:ks(e)||md(e)?e.ownerDocument:document:document:document}const Kt=Ui?p.useLayoutEffect:p.useEffect;function zi(e){const t=p.useRef(e);return Kt(()=>{t.current=e}),p.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Dg(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function _s(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Kt(()=>{r.current!==e&&(r.current=e)},t),r}function As(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Oi(e){const t=zi(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function Ei(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let co={};function Ps(e,t){return p.useMemo(()=>{if(t)return t;const r=co[e]==null?0:co[e]+1;return co[e]=r,e+"-"+r},[e,t])}function yd(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((i,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const Cn=yd(1),ws=yd(-1);function Ig(e){return"clientX"in e&&"clientY"in e}function Vi(e){if(!e)return!1;const{KeyboardEvent:t}=wt(e.target);return t&&e instanceof t}function Tg(e){if(!e)return!1;const{TouchEvent:t}=wt(e.target);return t&&e instanceof t}function Di(e){if(Tg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ig(e)?{x:e.clientX,y:e.clientY}:null}const Mr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Mr.Translate.toString(e),Mr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),kl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ng(e){return e.matches(kl)?e:e.querySelector(kl)}const jg={display:"none"};function Rg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:jg},r)}function kg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return p.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Ag(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const vd=p.createContext(null);function Pg(e){const t=p.useContext(vd);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Mg(){const[e]=p.useState(()=>new Set),t=p.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[p.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Lg={draggable:`
177
+ `,Ys=16,Lg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=dg(r,i);return Ie.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Ys,left:Ys,right:Ys,bottom:Ys,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,g=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),m=Pg(f,g);return Ie.createElement(Ag,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Mg:"",style:m},u.type==="custom"?Di(u.message,u):s?s(u):Ie.createElement(kg,{toast:u,position:f}))}))},Oe=Je;function Fg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Hi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function za(e){return"nodeType"in e}function St(e){var t,r;return e?Vn(e)?e:za(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Va(e){const{Document:t}=St(e);return e instanceof t}function Ms(e){return Vn(e)?!1:e instanceof St(e).HTMLElement}function Cd(e){return e instanceof St(e).SVGElement}function qn(e){return e?Vn(e)?e.document:za(e)?Va(e)?e:Ms(e)||Cd(e)?e.ownerDocument:document:document:document}const Qt=Hi?p.useLayoutEffect:p.useEffect;function Wi(e){const t=p.useRef(e);return Qt(()=>{t.current=e}),p.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function $g(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function xs(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Qt(()=>{r.current!==e&&(r.current=e)},t),r}function Ls(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Ii(e){const t=Wi(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function Ti(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let po={};function Fs(e,t){return p.useMemo(()=>{if(t)return t;const r=po[e]==null?0:po[e]+1;return po[e]=r,e+"-"+r},[e,t])}function Ed(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((i,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const En=Ed(1),Cs=Ed(-1);function Bg(e){return"clientX"in e&&"clientY"in e}function Ki(e){if(!e)return!1;const{KeyboardEvent:t}=St(e.target);return t&&e instanceof t}function Ug(e){if(!e)return!1;const{TouchEvent:t}=St(e.target);return t&&e instanceof t}function Ni(e){if(Ug(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Bg(e)?{x:e.clientX,y:e.clientY}:null}const Lr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Lr.Translate.toString(e),Lr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Ll="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function zg(e){return e.matches(Ll)?e:e.querySelector(Ll)}const Vg={display:"none"};function qg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:Vg},r)}function Hg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return p.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Wg(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Od=p.createContext(null);function Kg(e){const t=p.useContext(Od);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Qg(){const[e]=p.useState(()=>new Set),t=p.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[p.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Gg={draggable:`
178
178
  To pick up a draggable item, press the space bar.
179
179
  While dragging, use the arrow keys to move the item.
180
180
  Press space again to drop the item in its new position, or press escape to cancel.
181
- `},Fg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $g(e){let{announcements:t=Fg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Lg}=e;const{announce:i,announcement:o}=Ag(),a=Ps("DndLiveRegion"),[c,d]=p.useState(!1);if(p.useEffect(()=>{d(!0)},[]),Pg(p.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:m}=f;t.onDragMove&&i(t.onDragMove({active:g,over:m}))},onDragOver(f){let{active:g,over:m}=f;i(t.onDragOver({active:g,over:m}))},onDragEnd(f){let{active:g,over:m}=f;i(t.onDragEnd({active:g,over:m}))},onDragCancel(f){let{active:g,over:m}=f;i(t.onDragCancel({active:g,over:m}))}}),[i,t])),!c)return null;const u=p.createElement(p.Fragment,null,p.createElement(Rg,{id:n,value:s.draggable}),p.createElement(kg,{id:a,announcement:o}));return r?Ar.createPortal(u,r):u}var Ze;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ze||(Ze={}));function Ii(){}function ia(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function bd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Qt=Object.freeze({x:0,y:0});function _d(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bg(e,t){const r=Di(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function wd(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Ug(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Al(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function xd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Pl(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Pl(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=_d(Pl(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(wd)},Vg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Al(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Al(c),u=s.reduce((g,m,b)=>g+_d(d[b],m),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(wd)};function qg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const Hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=qg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Ug)};function Wg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Sd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Qt}function Kg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const Qg=Kg(1);function Cd(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Gg(e,t,r){const n=Cd(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Yg={ignoreTransform:!1};function qn(e,t){t===void 0&&(t=Yg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=wt(e).getComputedStyle(e);d&&(r=Gg(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function Ml(e){return qn(e,{ignoreTransform:!0})}function Xg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Zg(e,t){return t===void 0&&(t=wt(e).getComputedStyle(e)),t.position==="fixed"}function Jg(e,t){t===void 0&&(t=wt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?r.test(i):!1})}function qi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if($a(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!ks(s)||md(s)||r.includes(s))return r;const i=wt(e).getComputedStyle(s);return s!==e&&Jg(s,i)&&r.push(s),Zg(s,i)?r:n(s.parentNode)}return e?n(e):r}function Od(e){const[t]=qi(e,1);return t??null}function uo(e){return!Ui||!e?null:zn(e)?e:Fa(e)?$a(e)||e===Vn(e).scrollingElement?window:ks(e)?e:null:null}function Ed(e){return zn(e)?e.scrollX:e.scrollLeft}function Dd(e){return zn(e)?e.scrollY:e.scrollTop}function oa(e){return{x:Ed(e),y:Dd(e)}}var st;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(st||(st={}));function Id(e){return!Ui||!e?!1:e===document.scrollingElement}function Td(e){const t={x:0,y:0},r=Id(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const em={x:.2,y:.2};function tm(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=em);const{isTop:d,isBottom:u,isLeft:f,isRight:g}=Td(e),m={x:0,y:0},b={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+h.height?(m.y=st.Backward,b.y=n*Math.abs((t.top+h.height-i)/h.height)):!u&&c>=t.bottom-h.height&&(m.y=st.Forward,b.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!g&&a>=t.right-h.width?(m.x=st.Forward,b.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(m.x=st.Backward,b.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:m,speed:b}}function rm(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Nd(e){return e.reduce((t,r)=>Cn(t,oa(r)),Qt)}function nm(e){return e.reduce((t,r)=>t+Ed(r),0)}function sm(e){return e.reduce((t,r)=>t+Dd(r),0)}function jd(e,t){if(t===void 0&&(t=qn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Od(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const im=[["x",["left","right"],nm],["y",["top","bottom"],sm]];class Ba{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=qi(r),s=Nd(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of im)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class fs{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function om(e){const{EventTarget:t}=wt(e);return e instanceof t?e:Vn(e)}function fo(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Bt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Bt||(Bt={}));function Ll(e){e.preventDefault()}function am(e){e.stopPropagation()}var Ce;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ce||(Ce={}));const Rd={start:[Ce.Space,Ce.Enter],cancel:[Ce.Esc],end:[Ce.Space,Ce.Enter,Ce.Tab]},lm=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ce.Right:return{...r,x:r.x+25};case Ce.Left:return{...r,x:r.x-25};case Ce.Down:return{...r,y:r.y+25};case Ce.Up:return{...r,y:r.y-25}}};class Ua{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new fs(Vn(r)),this.windowListeners=new fs(wt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&jd(n),r(Qt)}handleKeyDown(t){if(Vi(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Rd,coordinateGetter:o=lm,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Qt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const g=ws(f,u),m={x:0,y:0},{scrollableAncestors:b}=n.current;for(const h of b){const y=t.code,{isTop:v,isRight:_,isLeft:x,isBottom:w,maxScroll:C,minScroll:I}=Td(h),j=rm(h),k={x:Math.min(y===Ce.Right?j.right-j.width/2:j.right,Math.max(y===Ce.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===Ce.Down?j.bottom-j.height/2:j.bottom,Math.max(y===Ce.Down?j.top:j.top+j.height/2,f.y))},L=y===Ce.Right&&!_||y===Ce.Left&&!x,N=y===Ce.Down&&!w||y===Ce.Up&&!v;if(L&&k.x!==f.x){const A=h.scrollLeft+g.x,$=y===Ce.Right&&A<=C.x||y===Ce.Left&&A>=I.x;if($&&!g.y){h.scrollTo({left:A,behavior:a});return}$?m.x=h.scrollLeft-A:m.x=y===Ce.Right?h.scrollLeft-C.x:h.scrollLeft-I.x,m.x&&h.scrollBy({left:-m.x,behavior:a});break}else if(N&&k.y!==f.y){const A=h.scrollTop+g.y,$=y===Ce.Down&&A<=C.y||y===Ce.Up&&A>=I.y;if($&&!g.x){h.scrollTo({top:A,behavior:a});return}$?m.y=h.scrollTop-A:m.y=y===Ce.Down?h.scrollTop-C.y:h.scrollTop-I.y,m.y&&h.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,Cn(ws(f,this.referenceCoordinates),m))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ua.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Rd,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Fl(e){return!!(e&&"distance"in e)}function $l(e){return!!(e&&"delay"in e)}class za{constructor(t,r,n){var s;n===void 0&&(n=om(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:o}=i;this.props=t,this.events=r,this.document=Vn(o),this.documentListeners=new fs(this.document),this.listeners=new fs(n),this.windowListeners=new fs(wt(o)),this.initialCoordinates=(s=Di(i))!=null?s:Qt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.DragStart,Ll),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),this.windowListeners.add(Bt.ContextMenu,Ll),this.documentListeners.add(Bt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($l(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Fl(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Bt.Click,am,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Di(t))!=null?r:Qt,d=ws(s,c);if(!n&&a){if(Fl(a)){if(a.tolerance!=null&&fo(d,a.tolerance))return this.handleCancel();if(fo(d,a.distance))return this.handleStart()}if($l(a)&&fo(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Ce.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const cm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Hi extends za{constructor(t){const{event:r}=t,n=Vn(r.target);super(t,cm,n)}}Hi.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const um={move:{name:"mousemove"},end:{name:"mouseup"}};var aa;(function(e){e[e.RightClick=2]="RightClick"})(aa||(aa={}));class dm extends za{constructor(t){super(t,um,Vn(t.event.target))}}dm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===aa.RightClick?!1:(n==null||n({event:r}),!0)}}];const ho={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class fm extends za{constructor(t){super(t,ho)}static setup(){return window.addEventListener(ho.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ho.move.name,t)};function t(){}}}fm.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var hs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(hs||(hs={}));var Ti;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ti||(Ti={}));function hm(e){let{acceleration:t,activator:r=hs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Ti.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:g}=e;const m=gm({delta:f,disabled:!i}),[b,h]=Dg(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),_=p.useMemo(()=>{switch(r){case hs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case hs.DraggableRect:return s}},[r,s,c]),x=p.useRef(null),w=p.useCallback(()=>{const I=x.current;if(!I)return;const j=y.current.x*v.current.x,k=y.current.y*v.current.y;I.scrollBy(j,k)},[]),C=p.useMemo(()=>a===Ti.TreeOrder?[...d].reverse():d,[a,d]);p.useEffect(()=>{if(!i||!d.length||!_){h();return}for(const I of C){if((n==null?void 0:n(I))===!1)continue;const j=d.indexOf(I),k=u[j];if(!k)continue;const{direction:L,speed:N}=tm(I,k,_,t,g);for(const A of["x","y"])m[A][L[A]]||(N[A]=0,L[A]=0);if(N.x>0||N.y>0){h(),x.current=I,b(w,o),y.current=N,v.current=L;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(_),JSON.stringify(m),b,d,C,u,JSON.stringify(g)])}const pm={x:{[st.Backward]:!1,[st.Forward]:!1},y:{[st.Backward]:!1,[st.Forward]:!1}};function gm(e){let{delta:t,disabled:r}=e;const n=Ei(t);return As(s=>{if(r||!n||!s)return pm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[st.Backward]:s.x[st.Backward]||i.x===-1,[st.Forward]:s.x[st.Forward]||i.x===1},y:{[st.Backward]:s.y[st.Backward]||i.y===-1,[st.Forward]:s.y[st.Forward]||i.y===1}}},[r,t,n])}function mm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return As(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function ym(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var xs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xs||(xs={}));var la;(function(e){e.Optimized="optimized"})(la||(la={}));const Bl=new Map;function vm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:d}=s,u=p.useRef(e),f=y(),g=_s(f),m=p.useCallback(function(v){v===void 0&&(v=[]),!g.current&&o(_=>_===null?v:_.concat(v.filter(x=>!_.includes(x))))},[g]),b=p.useRef(null),h=As(v=>{if(f&&!r)return Bl;if(!v||v===Bl||u.current!==e||i!=null){const _=new Map;for(let x of e){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){_.set(x.id,x.rect.current);continue}const w=x.node.current,C=w?new Ba(c(w),w):null;x.rect.current=C,C&&_.set(x.id,C)}return _}return v},[e,i,r,f,c]);return p.useEffect(()=>{u.current=e},[e]),p.useEffect(()=>{f||m()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},a))},[a,f,m,...n]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:i!=null};function y(){switch(d){case xs.Always:return!1;case xs.BeforeDragging:return r;default:return!r}}}function Va(e,t){return As(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function bm(e,t){return Va(e,t)}function _m(e){let{callback:t,disabled:r}=e;const n=zi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Wi(e){let{callback:t,disabled:r}=e;const n=zi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function wm(e){return new Ba(qn(e),e)}function Ul(e,t,r){t===void 0&&(t=wm);const[n,s]=p.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=_m({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Wi({callback:i});return Kt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function xm(e){const t=Va(e);return Sd(e,t)}const zl=[];function Sm(e){const t=p.useRef(e),r=As(n=>e?n&&n!==zl&&e&&t.current&&e.parentNode===t.current.parentNode?n:qi(e):zl,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function Cm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=uo(i.target);o&&r(a=>a?(a.set(o,oa(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=uo(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,oa(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=uo(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Cn(i,o),Qt):Nd(e):Qt,[e,t])}function Vl(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ws(e,r.current):Qt}function Om(e){p.useEffect(()=>{if(!Ui)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Em(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function kd(e){return p.useMemo(()=>e?Xg(e):null,[e])}const ql=[];function Dm(e,t){t===void 0&&(t=qn);const[r]=e,n=kd(r?wt(r):null),[s,i]=p.useState(ql);function o(){i(()=>e.length?e.map(c=>Id(c)?n:new Ba(t(c),c)):ql)}const a=Wi({callback:o});return Kt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Ad(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ks(t)?t:e}function Im(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(d=>{for(const{target:u}of d)if(ks(u)){n(f=>{const g=t(u);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=Wi({callback:s}),o=p.useCallback(d=>{const u=Ad(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=Oi(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Tm=[{sensor:Hi,options:{}},{sensor:Ua,options:{}}],Nm={current:{}},oi={draggable:{measure:Ml},droppable:{measure:Ml,strategy:xs.WhileDragging,frequency:la.Optimized},dragOverlay:{measure:qn}};class ps extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const jm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ps,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ii},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:oi,measureDroppableContainers:Ii,windowRect:null,measuringScheduled:!1},Pd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ii,draggableNodes:new Map,over:null,measureDroppableContainers:Ii},Ms=p.createContext(Pd),Md=p.createContext(jm);function Rm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ps}}}function km(e,t){switch(t.type){case Ze.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ze.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ze.DragEnd:case Ze.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ze.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new ps(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Ze.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new ps(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Ze.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new ps(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Am(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext(Ms),i=Ei(n),o=Ei(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!Vi(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Ng(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Ld(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Pm(e){return p.useMemo(()=>({draggable:{...oi.draggable,...e==null?void 0:e.draggable},droppable:{...oi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...oi.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Mm(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=p.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Kt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=Sd(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=Od(d);g&&g.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const Ki=p.createContext({...Qt,scaleX:1,scaleY:1});var Cr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Cr||(Cr={}));const Fd=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Tm,collisionDetection:f=Hg,measuring:g,modifiers:m,...b}=t;const h=p.useReducer(km,void 0,Rm),[y,v]=h,[_,x]=Mg(),[w,C]=p.useState(Cr.Uninitialized),I=w===Cr.Initialized,{draggable:{active:j,nodes:k,translate:L},droppable:{containers:N}}=y,A=j!=null?k.get(j):null,$=p.useRef({initial:null,translated:null}),R=p.useMemo(()=>{var et;return j!=null?{id:j,data:(et=A==null?void 0:A.data)!=null?et:Nm,rect:$}:null},[j,A]),F=p.useRef(null),[M,Z]=p.useState(null),[ae,ve]=p.useState(null),we=_s(b,Object.values(b)),he=Ps("DndDescribedBy",o),W=p.useMemo(()=>N.getEnabled(),[N]),J=Pm(g),{droppableRects:se,measureDroppableContainers:B,measuringScheduled:Y}=vm(W,{dragging:I,dependencies:[L.x,L.y],config:J.droppable}),K=mm(k,j),ue=p.useMemo(()=>ae?Di(ae):null,[ae]),xe=$r(),Pe=bm(K,J.draggable.measure);Mm({activeNode:j!=null?k.get(j):null,config:xe.layoutShiftCompensation,initialRect:Pe,measure:J.draggable.measure});const me=Ul(K,J.draggable.measure,Pe),le=Ul(K?K.parentElement:null),pe=p.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),je=N.getNodeFor((r=pe.current.over)==null?void 0:r.id),Ue=Im({measure:J.dragOverlay.measure}),De=(n=Ue.nodeRef.current)!=null?n:K,ee=I?(s=Ue.rect)!=null?s:me:null,ze=!!(Ue.nodeRef.current&&Ue.rect),Xe=xm(ze?null:me),q=kd(De?wt(De):null),re=Sm(I?je??K:null),ie=Dm(re),We=Ld(m,{transform:{x:L.x-Xe.x,y:L.y-Xe.y,scaleX:1,scaleY:1},activatorEvent:ae,active:R,activeNodeRect:me,containerNodeRect:le,draggingNodeRect:ee,over:pe.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:re,scrollableAncestorRects:ie,windowRect:q}),lr=ue?Cn(ue,L):null,cr=Cm(re),Fr=Vl(cr),dn=Vl(cr,[me]),S=Cn(We,Fr),E=ee?Qg(ee,We):null,T=R&&E?f({active:R,collisionRect:E,droppableRects:se,droppableContainers:W,pointerCoordinates:lr}):null,U=xd(T,"id"),[z,Q]=p.useState(null),V=ze?We:Cn(We,dn),te=Wg(V,(i=z==null?void 0:z.rect)!=null?i:null,me),ye=p.useRef(null),Ve=p.useCallback((et,ut)=>{let{sensor:bt,options:zt}=ut;if(F.current==null)return;const Pt=k.get(F.current);if(!Pt)return;const Tt=et.nativeEvent,Xt=new bt({active:F.current,activeNode:Pt,event:Tt,options:zt,context:pe,onAbort(it){if(!k.get(it))return;const{onDragAbort:Zt}=we.current,dr={id:it};Zt==null||Zt(dr),_({type:"onDragAbort",event:dr})},onPending(it,yr,Zt,dr){if(!k.get(it))return;const{onDragPending:Xn}=we.current,vr={id:it,constraint:yr,initialCoordinates:Zt,offset:dr};Xn==null||Xn(vr),_({type:"onDragPending",event:vr})},onStart(it){const yr=F.current;if(yr==null)return;const Zt=k.get(yr);if(!Zt)return;const{onDragStart:dr}=we.current,Yn={activatorEvent:Tt,active:{id:yr,data:Zt.data,rect:$}};Ar.unstable_batchedUpdates(()=>{dr==null||dr(Yn),C(Cr.Initializing),v({type:Ze.DragStart,initialCoordinates:it,active:yr}),_({type:"onDragStart",event:Yn}),Z(ye.current),ve(Tt)})},onMove(it){v({type:Ze.DragMove,coordinates:it})},onEnd:fn(Ze.DragEnd),onCancel:fn(Ze.DragCancel)});ye.current=Xt;function fn(it){return async function(){const{active:Zt,collisions:dr,over:Yn,scrollAdjustedTranslate:Xn}=pe.current;let vr=null;if(Zt&&Xn){const{cancelDrop:Zn}=we.current;vr={activatorEvent:Tt,active:Zt,collisions:dr,delta:Xn,over:Yn},it===Ze.DragEnd&&typeof Zn=="function"&&await Promise.resolve(Zn(vr))&&(it=Ze.DragCancel)}F.current=null,Ar.unstable_batchedUpdates(()=>{v({type:it}),C(Cr.Uninitialized),Q(null),Z(null),ve(null),ye.current=null;const Zn=it===Ze.DragEnd?"onDragEnd":"onDragCancel";if(vr){const ao=we.current[Zn];ao==null||ao(vr),_({type:Zn,event:vr})}})}}},[k]),xt=p.useCallback((et,ut)=>(bt,zt)=>{const Pt=bt.nativeEvent,Tt=k.get(zt);if(F.current!==null||!Tt||Pt.dndKit||Pt.defaultPrevented)return;const Xt={active:Tt};et(bt,ut.options,Xt)===!0&&(Pt.dndKit={capturedBy:ut.sensor},F.current=zt,Ve(bt,ut))},[k,Ve]),St=ym(u,xt);Om(u),Kt(()=>{me&&w===Cr.Initializing&&C(Cr.Initialized)},[me,w]),p.useEffect(()=>{const{onDragMove:et}=we.current,{active:ut,activatorEvent:bt,collisions:zt,over:Pt}=pe.current;if(!ut||!bt)return;const Tt={active:ut,activatorEvent:bt,collisions:zt,delta:{x:S.x,y:S.y},over:Pt};Ar.unstable_batchedUpdates(()=>{et==null||et(Tt),_({type:"onDragMove",event:Tt})})},[S.x,S.y]),p.useEffect(()=>{const{active:et,activatorEvent:ut,collisions:bt,droppableContainers:zt,scrollAdjustedTranslate:Pt}=pe.current;if(!et||F.current==null||!ut||!Pt)return;const{onDragOver:Tt}=we.current,Xt=zt.get(U),fn=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,it={active:et,activatorEvent:ut,collisions:bt,delta:{x:Pt.x,y:Pt.y},over:fn};Ar.unstable_batchedUpdates(()=>{Q(fn),Tt==null||Tt(it),_({type:"onDragOver",event:it})})},[U]),Kt(()=>{pe.current={activatorEvent:ae,active:R,activeNode:K,collisionRect:E,collisions:T,droppableRects:se,draggableNodes:k,draggingNode:De,draggingNodeRect:ee,droppableContainers:N,over:z,scrollableAncestors:re,scrollAdjustedTranslate:S},$.current={initial:ee,translated:E}},[R,K,T,E,k,De,ee,se,N,z,re,S]),hm({...xe,delta:L,draggingRect:E,pointerCoordinates:lr,scrollableAncestors:re,scrollableAncestorRects:ie});const ur=p.useMemo(()=>({active:R,activeNode:K,activeNodeRect:me,activatorEvent:ae,collisions:T,containerNodeRect:le,dragOverlay:Ue,draggableNodes:k,droppableContainers:N,droppableRects:se,over:z,measureDroppableContainers:B,scrollableAncestors:re,scrollableAncestorRects:ie,measuringConfiguration:J,measuringScheduled:Y,windowRect:q}),[R,K,me,ae,T,le,Ue,k,N,se,z,B,re,ie,J,Y,q]),Gn=p.useMemo(()=>({activatorEvent:ae,activators:St,active:R,activeNodeRect:me,ariaDescribedById:{draggable:he},dispatch:v,draggableNodes:k,over:z,measureDroppableContainers:B}),[ae,St,R,me,v,he,k,z,B]);return p.createElement(vd.Provider,{value:x},p.createElement(Ms.Provider,{value:Gn},p.createElement(Md.Provider,{value:ur},p.createElement(Ki.Provider,{value:te},d)),p.createElement(Am,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement($g,{...a,hiddenTextDescribedById:he}));function $r(){const et=(M==null?void 0:M.autoScrollEnabled)===!1,ut=typeof c=="object"?c.enabled===!1:c===!1,bt=I&&!et&&!ut;return typeof c=="object"?{...c,enabled:bt}:{enabled:bt}}}),Lm=p.createContext(null),Hl="button",Fm="Draggable";function $d(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=Ps(Fm),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:g}=p.useContext(Ms),{role:m=Hl,roleDescription:b="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?Ki:Lm),[_,x]=Oi(),[w,C]=Oi(),I=Em(o,t),j=_s(r);Kt(()=>(f.set(t,{id:t,key:i,node:_,activatorNode:w,data:j}),()=>{const L=f.get(t);L&&L.key===i&&f.delete(t)}),[f,t]);const k=p.useMemo(()=>({role:m,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&m===Hl?!0:void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[n,m,h,y,b,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:y,listeners:n?void 0:I,node:_,over:g,setNodeRef:x,setActivatorNodeRef:C,transform:v}}function Bd(){return p.useContext(Md)}const $m="Droppable",Bm={timeout:25};function Um(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=Ps($m),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=p.useContext(Ms),u=p.useRef({disabled:r}),f=p.useRef(!1),g=p.useRef(null),m=p.useRef(null),{disabled:b,updateMeasurementsFor:h,timeout:y}={...Bm,...s},v=_s(h??n),_=p.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),m.current=null},y)},[y]),x=Wi({callback:_,disabled:b||!o}),w=p.useCallback((k,L)=>{x&&(L&&(x.unobserve(L),f.current=!1),k&&x.observe(k))},[x]),[C,I]=Oi(w),j=_s(t);return p.useEffect(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),p.useEffect(()=>(a({type:Ze.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:g,data:j}}),()=>a({type:Ze.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==u.current.disabled&&(a({type:Ze.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:g,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:I}}function zm(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=Ei(r);return!r&&!n&&a&&s(a),Kt(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const Vm={x:0,y:0,scaleX:1,scaleY:1};function qm(e){let{children:t}=e;return p.createElement(Ms.Provider,{value:Pd},p.createElement(Ki.Provider,{value:Vm},t))}const Hm={position:"fixed",touchAction:"none"},Wm=e=>Vi(e)?"transform 250ms ease":void 0,Km=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=Wm}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...Hm,width:a.width,height:a.height,top:a.top,left:a.left,transform:Mr.Transform.toString(f),transformOrigin:s&&n?Bg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return p.createElement(r,{className:o,style:g,ref:t},i)}),Qm=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}},Gm=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Mr.Transform.toString(t)},{transform:Mr.Transform.toString(r)}]},Ym={duration:250,easing:"ease",keyframes:Gm,sideEffects:Qm({styles:{active:{opacity:"0"}}})};function Xm(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return zi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=Ad(o);if(!d)return;const{transform:u}=wt(o).getComputedStyle(o),f=Cd(u);if(!f)return;const g=typeof t=="function"?t:Zm(t);return jd(c,s.draggable.measure),g({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Zm(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Ym,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},g={x:c.x-u.x,y:c.y-u.y,...f},m=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:g}}),[b]=m,h=m[m.length-1];if(JSON.stringify(b)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...d}),v=a.node.animate(m,{duration:t,easing:r,fill:"forwards"});return new Promise(_=>{v.onfinish=()=>{y==null||y(),_()}})}}let Wl=0;function Jm(e){return p.useMemo(()=>{if(e!=null)return Wl++,Wl},[e])}const ey=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggableNodes:b,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:_,scrollableAncestors:x,scrollableAncestorRects:w,windowRect:C}=Bd(),I=p.useContext(Ki),j=Jm(f==null?void 0:f.id),k=Ld(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:w,transform:I,windowRect:C}),L=Va(g),N=Xm({config:n,draggableNodes:b,droppableContainers:h,measuringConfiguration:_}),A=L?y.setRef:void 0;return p.createElement(qm,null,p.createElement(zm,{animation:N},f&&j?p.createElement(Km,{key:j,id:f.id,ref:A,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:L,style:{zIndex:d,...s},transform:k},r):null))});/**
181
+ `},Yg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Xg(e){let{announcements:t=Yg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Gg}=e;const{announce:i,announcement:o}=Wg(),a=Fs("DndLiveRegion"),[c,d]=p.useState(!1);if(p.useEffect(()=>{d(!0)},[]),Kg(p.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:m}=f;t.onDragMove&&i(t.onDragMove({active:g,over:m}))},onDragOver(f){let{active:g,over:m}=f;i(t.onDragOver({active:g,over:m}))},onDragEnd(f){let{active:g,over:m}=f;i(t.onDragEnd({active:g,over:m}))},onDragCancel(f){let{active:g,over:m}=f;i(t.onDragCancel({active:g,over:m}))}}),[i,t])),!c)return null;const u=p.createElement(p.Fragment,null,p.createElement(qg,{id:n,value:s.draggable}),p.createElement(Hg,{id:a,announcement:o}));return r?Pr.createPortal(u,r):u}var Ze;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ze||(Ze={}));function ji(){}function ca(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Dd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Gt=Object.freeze({x:0,y:0});function Id(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zg(e,t){const r=Ni(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Td(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Jg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Fl(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function Nd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function $l(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const em=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=$l(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Id($l(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(Td)},tm=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Fl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Fl(c),u=s.reduce((g,m,b)=>g+Id(d[b],m),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(Td)};function rm(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const nm=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=rm(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Jg)};function sm(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function jd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Gt}function im(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const om=im(1);function Rd(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function am(e,t,r){const n=Rd(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const lm={ignoreTransform:!1};function Hn(e,t){t===void 0&&(t=lm);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=St(e).getComputedStyle(e);d&&(r=am(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function Bl(e){return Hn(e,{ignoreTransform:!0})}function cm(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function um(e,t){return t===void 0&&(t=St(e).getComputedStyle(e)),t.position==="fixed"}function dm(e,t){t===void 0&&(t=St(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?r.test(i):!1})}function Qi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Va(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ms(s)||Cd(s)||r.includes(s))return r;const i=St(e).getComputedStyle(s);return s!==e&&dm(s,i)&&r.push(s),um(s,i)?r:n(s.parentNode)}return e?n(e):r}function kd(e){const[t]=Qi(e,1);return t??null}function go(e){return!Hi||!e?null:Vn(e)?e:za(e)?Va(e)||e===qn(e).scrollingElement?window:Ms(e)?e:null:null}function Ad(e){return Vn(e)?e.scrollX:e.scrollLeft}function Pd(e){return Vn(e)?e.scrollY:e.scrollTop}function ua(e){return{x:Ad(e),y:Pd(e)}}var it;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(it||(it={}));function Md(e){return!Hi||!e?!1:e===document.scrollingElement}function Ld(e){const t={x:0,y:0},r=Md(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const fm={x:.2,y:.2};function hm(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=fm);const{isTop:d,isBottom:u,isLeft:f,isRight:g}=Ld(e),m={x:0,y:0},b={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+h.height?(m.y=it.Backward,b.y=n*Math.abs((t.top+h.height-i)/h.height)):!u&&c>=t.bottom-h.height&&(m.y=it.Forward,b.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!g&&a>=t.right-h.width?(m.x=it.Forward,b.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(m.x=it.Backward,b.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:m,speed:b}}function pm(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Fd(e){return e.reduce((t,r)=>En(t,ua(r)),Gt)}function gm(e){return e.reduce((t,r)=>t+Ad(r),0)}function mm(e){return e.reduce((t,r)=>t+Pd(r),0)}function $d(e,t){if(t===void 0&&(t=Hn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);kd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ym=[["x",["left","right"],gm],["y",["top","bottom"],mm]];class qa{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Qi(r),s=Fd(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of ym)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ps{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function vm(e){const{EventTarget:t}=St(e);return e instanceof t?e:qn(e)}function mo(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ut||(Ut={}));function Ul(e){e.preventDefault()}function bm(e){e.stopPropagation()}var Ce;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ce||(Ce={}));const Bd={start:[Ce.Space,Ce.Enter],cancel:[Ce.Esc],end:[Ce.Space,Ce.Enter,Ce.Tab]},_m=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ce.Right:return{...r,x:r.x+25};case Ce.Left:return{...r,x:r.x-25};case Ce.Down:return{...r,y:r.y+25};case Ce.Up:return{...r,y:r.y-25}}};class Ha{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ps(qn(r)),this.windowListeners=new ps(St(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&$d(n),r(Gt)}handleKeyDown(t){if(Ki(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Bd,coordinateGetter:o=_m,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Gt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const g=Cs(f,u),m={x:0,y:0},{scrollableAncestors:b}=n.current;for(const h of b){const y=t.code,{isTop:v,isRight:_,isLeft:S,isBottom:w,maxScroll:C,minScroll:I}=Ld(h),j=pm(h),k={x:Math.min(y===Ce.Right?j.right-j.width/2:j.right,Math.max(y===Ce.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===Ce.Down?j.bottom-j.height/2:j.bottom,Math.max(y===Ce.Down?j.top:j.top+j.height/2,f.y))},L=y===Ce.Right&&!_||y===Ce.Left&&!S,N=y===Ce.Down&&!w||y===Ce.Up&&!v;if(L&&k.x!==f.x){const A=h.scrollLeft+g.x,$=y===Ce.Right&&A<=C.x||y===Ce.Left&&A>=I.x;if($&&!g.y){h.scrollTo({left:A,behavior:a});return}$?m.x=h.scrollLeft-A:m.x=y===Ce.Right?h.scrollLeft-C.x:h.scrollLeft-I.x,m.x&&h.scrollBy({left:-m.x,behavior:a});break}else if(N&&k.y!==f.y){const A=h.scrollTop+g.y,$=y===Ce.Down&&A<=C.y||y===Ce.Up&&A>=I.y;if($&&!g.x){h.scrollTo({top:A,behavior:a});return}$?m.y=h.scrollTop-A:m.y=y===Ce.Down?h.scrollTop-C.y:h.scrollTop-I.y,m.y&&h.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,En(Cs(f,this.referenceCoordinates),m))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Ha.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Bd,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function zl(e){return!!(e&&"distance"in e)}function Vl(e){return!!(e&&"delay"in e)}class Wa{constructor(t,r,n){var s;n===void 0&&(n=vm(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:o}=i;this.props=t,this.events=r,this.document=qn(o),this.documentListeners=new ps(this.document),this.listeners=new ps(n),this.windowListeners=new ps(St(o)),this.initialCoordinates=(s=Ni(i))!=null?s:Gt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ut.Resize,this.handleCancel),this.windowListeners.add(Ut.DragStart,Ul),this.windowListeners.add(Ut.VisibilityChange,this.handleCancel),this.windowListeners.add(Ut.ContextMenu,Ul),this.documentListeners.add(Ut.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vl(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(zl(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ut.Click,bm,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ut.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Ni(t))!=null?r:Gt,d=Cs(s,c);if(!n&&a){if(zl(a)){if(a.tolerance!=null&&mo(d,a.tolerance))return this.handleCancel();if(mo(d,a.distance))return this.handleStart()}if(Vl(a)&&mo(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Ce.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const wm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Gi extends Wa{constructor(t){const{event:r}=t,n=qn(r.target);super(t,wm,n)}}Gi.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const Sm={move:{name:"mousemove"},end:{name:"mouseup"}};var da;(function(e){e[e.RightClick=2]="RightClick"})(da||(da={}));class xm extends Wa{constructor(t){super(t,Sm,qn(t.event.target))}}xm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===da.RightClick?!1:(n==null||n({event:r}),!0)}}];const yo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Cm extends Wa{constructor(t){super(t,yo)}static setup(){return window.addEventListener(yo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(yo.move.name,t)};function t(){}}}Cm.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var gs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(gs||(gs={}));var Ri;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ri||(Ri={}));function Em(e){let{acceleration:t,activator:r=gs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Ri.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:g}=e;const m=Dm({delta:f,disabled:!i}),[b,h]=$g(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),_=p.useMemo(()=>{switch(r){case gs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case gs.DraggableRect:return s}},[r,s,c]),S=p.useRef(null),w=p.useCallback(()=>{const I=S.current;if(!I)return;const j=y.current.x*v.current.x,k=y.current.y*v.current.y;I.scrollBy(j,k)},[]),C=p.useMemo(()=>a===Ri.TreeOrder?[...d].reverse():d,[a,d]);p.useEffect(()=>{if(!i||!d.length||!_){h();return}for(const I of C){if((n==null?void 0:n(I))===!1)continue;const j=d.indexOf(I),k=u[j];if(!k)continue;const{direction:L,speed:N}=hm(I,k,_,t,g);for(const A of["x","y"])m[A][L[A]]||(N[A]=0,L[A]=0);if(N.x>0||N.y>0){h(),S.current=I,b(w,o),y.current=N,v.current=L;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(_),JSON.stringify(m),b,d,C,u,JSON.stringify(g)])}const Om={x:{[it.Backward]:!1,[it.Forward]:!1},y:{[it.Backward]:!1,[it.Forward]:!1}};function Dm(e){let{delta:t,disabled:r}=e;const n=Ti(t);return Ls(s=>{if(r||!n||!s)return Om;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[it.Backward]:s.x[it.Backward]||i.x===-1,[it.Forward]:s.x[it.Forward]||i.x===1},y:{[it.Backward]:s.y[it.Backward]||i.y===-1,[it.Forward]:s.y[it.Forward]||i.y===1}}},[r,t,n])}function Im(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ls(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function Tm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var Es;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Es||(Es={}));var fa;(function(e){e.Optimized="optimized"})(fa||(fa={}));const ql=new Map;function Nm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:d}=s,u=p.useRef(e),f=y(),g=xs(f),m=p.useCallback(function(v){v===void 0&&(v=[]),!g.current&&o(_=>_===null?v:_.concat(v.filter(S=>!_.includes(S))))},[g]),b=p.useRef(null),h=Ls(v=>{if(f&&!r)return ql;if(!v||v===ql||u.current!==e||i!=null){const _=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){_.set(S.id,S.rect.current);continue}const w=S.node.current,C=w?new qa(c(w),w):null;S.rect.current=C,C&&_.set(S.id,C)}return _}return v},[e,i,r,f,c]);return p.useEffect(()=>{u.current=e},[e]),p.useEffect(()=>{f||m()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},a))},[a,f,m,...n]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:i!=null};function y(){switch(d){case Es.Always:return!1;case Es.BeforeDragging:return r;default:return!r}}}function Ka(e,t){return Ls(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function jm(e,t){return Ka(e,t)}function Rm(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Yi(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function km(e){return new qa(Hn(e),e)}function Hl(e,t,r){t===void 0&&(t=km);const[n,s]=p.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=Rm({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Yi({callback:i});return Qt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function Am(e){const t=Ka(e);return jd(e,t)}const Wl=[];function Pm(e){const t=p.useRef(e),r=Ls(n=>e?n&&n!==Wl&&e&&t.current&&e.parentNode===t.current.parentNode?n:Qi(e):Wl,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function Mm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=go(i.target);o&&r(a=>a?(a.set(o,ua(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=go(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,ua(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=go(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>En(i,o),Gt):Fd(e):Gt,[e,t])}function Kl(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Gt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Cs(e,r.current):Gt}function Lm(e){p.useEffect(()=>{if(!Hi)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Fm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Ud(e){return p.useMemo(()=>e?cm(e):null,[e])}const Ql=[];function $m(e,t){t===void 0&&(t=Hn);const[r]=e,n=Ud(r?St(r):null),[s,i]=p.useState(Ql);function o(){i(()=>e.length?e.map(c=>Md(c)?n:new qa(t(c),c)):Ql)}const a=Yi({callback:o});return Qt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function zd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ms(t)?t:e}function Bm(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(d=>{for(const{target:u}of d)if(Ms(u)){n(f=>{const g=t(u);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=Yi({callback:s}),o=p.useCallback(d=>{const u=zd(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=Ii(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Um=[{sensor:Gi,options:{}},{sensor:Ha,options:{}}],zm={current:{}},ui={draggable:{measure:Bl},droppable:{measure:Bl,strategy:Es.WhileDragging,frequency:fa.Optimized},dragOverlay:{measure:Hn}};class ms extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const Vm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ms,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ji},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ui,measureDroppableContainers:ji,windowRect:null,measuringScheduled:!1},Vd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ji,draggableNodes:new Map,over:null,measureDroppableContainers:ji},$s=p.createContext(Vd),qd=p.createContext(Vm);function qm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ms}}}function Hm(e,t){switch(t.type){case Ze.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ze.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ze.DragEnd:case Ze.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ze.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new ms(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Ze.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new ms(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Ze.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new ms(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Wm(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext($s),i=Ti(n),o=Ti(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!Ki(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=zg(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Hd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Km(e){return p.useMemo(()=>({draggable:{...ui.draggable,...e==null?void 0:e.draggable},droppable:{...ui.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ui.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Qm(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=p.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Qt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=jd(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=kd(d);g&&g.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const Xi=p.createContext({...Gt,scaleX:1,scaleY:1});var Er;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Er||(Er={}));const Wd=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Um,collisionDetection:f=nm,measuring:g,modifiers:m,...b}=t;const h=p.useReducer(Hm,void 0,qm),[y,v]=h,[_,S]=Qg(),[w,C]=p.useState(Er.Uninitialized),I=w===Er.Initialized,{draggable:{active:j,nodes:k,translate:L},droppable:{containers:N}}=y,A=j!=null?k.get(j):null,$=p.useRef({initial:null,translated:null}),R=p.useMemo(()=>{var et;return j!=null?{id:j,data:(et=A==null?void 0:A.data)!=null?et:zm,rect:$}:null},[j,A]),F=p.useRef(null),[M,Z]=p.useState(null),[ae,ve]=p.useState(null),we=xs(b,Object.values(b)),he=Fs("DndDescribedBy",o),W=p.useMemo(()=>N.getEnabled(),[N]),J=Km(g),{droppableRects:se,measureDroppableContainers:B,measuringScheduled:Y}=Nm(W,{dragging:I,dependencies:[L.x,L.y],config:J.droppable}),K=Im(k,j),ue=p.useMemo(()=>ae?Ni(ae):null,[ae]),Se=Br(),Me=jm(K,J.draggable.measure);Qm({activeNode:j!=null?k.get(j):null,config:Se.layoutShiftCompensation,initialRect:Me,measure:J.draggable.measure});const me=Hl(K,J.draggable.measure,Me),le=Hl(K?K.parentElement:null),pe=p.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Re=N.getNodeFor((r=pe.current.over)==null?void 0:r.id),Ue=Bm({measure:J.dragOverlay.measure}),De=(n=Ue.nodeRef.current)!=null?n:K,ee=I?(s=Ue.rect)!=null?s:me:null,ze=!!(Ue.nodeRef.current&&Ue.rect),Xe=Am(ze?null:me),q=Ud(De?St(De):null),re=Pm(I?Re??K:null),ie=$m(re),We=Hd(m,{transform:{x:L.x-Xe.x,y:L.y-Xe.y,scaleX:1,scaleY:1},activatorEvent:ae,active:R,activeNodeRect:me,containerNodeRect:le,draggingNodeRect:ee,over:pe.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:re,scrollableAncestorRects:ie,windowRect:q}),cr=ue?En(ue,L):null,ur=Mm(re),$r=Kl(ur),fn=Kl(ur,[me]),x=En(We,$r),O=ee?om(ee,We):null,T=R&&O?f({active:R,collisionRect:O,droppableRects:se,droppableContainers:W,pointerCoordinates:cr}):null,U=Nd(T,"id"),[z,Q]=p.useState(null),V=ze?We:En(We,fn),te=sm(V,(i=z==null?void 0:z.rect)!=null?i:null,me),ye=p.useRef(null),Ve=p.useCallback((et,dt)=>{let{sensor:_t,options:Vt}=dt;if(F.current==null)return;const Mt=k.get(F.current);if(!Mt)return;const Nt=et.nativeEvent,Zt=new _t({active:F.current,activeNode:Mt,event:Nt,options:Vt,context:pe,onAbort(ot){if(!k.get(ot))return;const{onDragAbort:Jt}=we.current,fr={id:ot};Jt==null||Jt(fr),_({type:"onDragAbort",event:fr})},onPending(ot,vr,Jt,fr){if(!k.get(ot))return;const{onDragPending:Zn}=we.current,br={id:ot,constraint:vr,initialCoordinates:Jt,offset:fr};Zn==null||Zn(br),_({type:"onDragPending",event:br})},onStart(ot){const vr=F.current;if(vr==null)return;const Jt=k.get(vr);if(!Jt)return;const{onDragStart:fr}=we.current,Xn={activatorEvent:Nt,active:{id:vr,data:Jt.data,rect:$}};Pr.unstable_batchedUpdates(()=>{fr==null||fr(Xn),C(Er.Initializing),v({type:Ze.DragStart,initialCoordinates:ot,active:vr}),_({type:"onDragStart",event:Xn}),Z(ye.current),ve(Nt)})},onMove(ot){v({type:Ze.DragMove,coordinates:ot})},onEnd:hn(Ze.DragEnd),onCancel:hn(Ze.DragCancel)});ye.current=Zt;function hn(ot){return async function(){const{active:Jt,collisions:fr,over:Xn,scrollAdjustedTranslate:Zn}=pe.current;let br=null;if(Jt&&Zn){const{cancelDrop:Jn}=we.current;br={activatorEvent:Nt,active:Jt,collisions:fr,delta:Zn,over:Xn},ot===Ze.DragEnd&&typeof Jn=="function"&&await Promise.resolve(Jn(br))&&(ot=Ze.DragCancel)}F.current=null,Pr.unstable_batchedUpdates(()=>{v({type:ot}),C(Er.Uninitialized),Q(null),Z(null),ve(null),ye.current=null;const Jn=ot===Ze.DragEnd?"onDragEnd":"onDragCancel";if(br){const fo=we.current[Jn];fo==null||fo(br),_({type:Jn,event:br})}})}}},[k]),xt=p.useCallback((et,dt)=>(_t,Vt)=>{const Mt=_t.nativeEvent,Nt=k.get(Vt);if(F.current!==null||!Nt||Mt.dndKit||Mt.defaultPrevented)return;const Zt={active:Nt};et(_t,dt.options,Zt)===!0&&(Mt.dndKit={capturedBy:dt.sensor},F.current=Vt,Ve(_t,dt))},[k,Ve]),Ct=Tm(u,xt);Lm(u),Qt(()=>{me&&w===Er.Initializing&&C(Er.Initialized)},[me,w]),p.useEffect(()=>{const{onDragMove:et}=we.current,{active:dt,activatorEvent:_t,collisions:Vt,over:Mt}=pe.current;if(!dt||!_t)return;const Nt={active:dt,activatorEvent:_t,collisions:Vt,delta:{x:x.x,y:x.y},over:Mt};Pr.unstable_batchedUpdates(()=>{et==null||et(Nt),_({type:"onDragMove",event:Nt})})},[x.x,x.y]),p.useEffect(()=>{const{active:et,activatorEvent:dt,collisions:_t,droppableContainers:Vt,scrollAdjustedTranslate:Mt}=pe.current;if(!et||F.current==null||!dt||!Mt)return;const{onDragOver:Nt}=we.current,Zt=Vt.get(U),hn=Zt&&Zt.rect.current?{id:Zt.id,rect:Zt.rect.current,data:Zt.data,disabled:Zt.disabled}:null,ot={active:et,activatorEvent:dt,collisions:_t,delta:{x:Mt.x,y:Mt.y},over:hn};Pr.unstable_batchedUpdates(()=>{Q(hn),Nt==null||Nt(ot),_({type:"onDragOver",event:ot})})},[U]),Qt(()=>{pe.current={activatorEvent:ae,active:R,activeNode:K,collisionRect:O,collisions:T,droppableRects:se,draggableNodes:k,draggingNode:De,draggingNodeRect:ee,droppableContainers:N,over:z,scrollableAncestors:re,scrollAdjustedTranslate:x},$.current={initial:ee,translated:O}},[R,K,T,O,k,De,ee,se,N,z,re,x]),Em({...Se,delta:L,draggingRect:O,pointerCoordinates:cr,scrollableAncestors:re,scrollableAncestorRects:ie});const dr=p.useMemo(()=>({active:R,activeNode:K,activeNodeRect:me,activatorEvent:ae,collisions:T,containerNodeRect:le,dragOverlay:Ue,draggableNodes:k,droppableContainers:N,droppableRects:se,over:z,measureDroppableContainers:B,scrollableAncestors:re,scrollableAncestorRects:ie,measuringConfiguration:J,measuringScheduled:Y,windowRect:q}),[R,K,me,ae,T,le,Ue,k,N,se,z,B,re,ie,J,Y,q]),Yn=p.useMemo(()=>({activatorEvent:ae,activators:Ct,active:R,activeNodeRect:me,ariaDescribedById:{draggable:he},dispatch:v,draggableNodes:k,over:z,measureDroppableContainers:B}),[ae,Ct,R,me,v,he,k,z,B]);return p.createElement(Od.Provider,{value:S},p.createElement($s.Provider,{value:Yn},p.createElement(qd.Provider,{value:dr},p.createElement(Xi.Provider,{value:te},d)),p.createElement(Wm,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(Xg,{...a,hiddenTextDescribedById:he}));function Br(){const et=(M==null?void 0:M.autoScrollEnabled)===!1,dt=typeof c=="object"?c.enabled===!1:c===!1,_t=I&&!et&&!dt;return typeof c=="object"?{...c,enabled:_t}:{enabled:_t}}}),Gm=p.createContext(null),Gl="button",Ym="Draggable";function Kd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=Fs(Ym),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:g}=p.useContext($s),{role:m=Gl,roleDescription:b="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?Xi:Gm),[_,S]=Ii(),[w,C]=Ii(),I=Fm(o,t),j=xs(r);Qt(()=>(f.set(t,{id:t,key:i,node:_,activatorNode:w,data:j}),()=>{const L=f.get(t);L&&L.key===i&&f.delete(t)}),[f,t]);const k=p.useMemo(()=>({role:m,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&m===Gl?!0:void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[n,m,h,y,b,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:y,listeners:n?void 0:I,node:_,over:g,setNodeRef:S,setActivatorNodeRef:C,transform:v}}function Qd(){return p.useContext(qd)}const Xm="Droppable",Zm={timeout:25};function Jm(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=Fs(Xm),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=p.useContext($s),u=p.useRef({disabled:r}),f=p.useRef(!1),g=p.useRef(null),m=p.useRef(null),{disabled:b,updateMeasurementsFor:h,timeout:y}={...Zm,...s},v=xs(h??n),_=p.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),m.current=null},y)},[y]),S=Yi({callback:_,disabled:b||!o}),w=p.useCallback((k,L)=>{S&&(L&&(S.unobserve(L),f.current=!1),k&&S.observe(k))},[S]),[C,I]=Ii(w),j=xs(t);return p.useEffect(()=>{!S||!C.current||(S.disconnect(),f.current=!1,S.observe(C.current))},[C,S]),p.useEffect(()=>(a({type:Ze.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:g,data:j}}),()=>a({type:Ze.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==u.current.disabled&&(a({type:Ze.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:g,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:I}}function ey(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=Ti(r);return!r&&!n&&a&&s(a),Qt(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const ty={x:0,y:0,scaleX:1,scaleY:1};function ry(e){let{children:t}=e;return p.createElement($s.Provider,{value:Vd},p.createElement(Xi.Provider,{value:ty},t))}const ny={position:"fixed",touchAction:"none"},sy=e=>Ki(e)?"transform 250ms ease":void 0,iy=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=sy}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...ny,width:a.width,height:a.height,top:a.top,left:a.left,transform:Lr.Transform.toString(f),transformOrigin:s&&n?Zg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return p.createElement(r,{className:o,style:g,ref:t},i)}),oy=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}},ay=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Lr.Transform.toString(t)},{transform:Lr.Transform.toString(r)}]},ly={duration:250,easing:"ease",keyframes:ay,sideEffects:oy({styles:{active:{opacity:"0"}}})};function cy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Wi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=zd(o);if(!d)return;const{transform:u}=St(o).getComputedStyle(o),f=Rd(u);if(!f)return;const g=typeof t=="function"?t:uy(t);return $d(c,s.draggable.measure),g({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function uy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...ly,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},g={x:c.x-u.x,y:c.y-u.y,...f},m=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:g}}),[b]=m,h=m[m.length-1];if(JSON.stringify(b)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...d}),v=a.node.animate(m,{duration:t,easing:r,fill:"forwards"});return new Promise(_=>{v.onfinish=()=>{y==null||y(),_()}})}}let Yl=0;function dy(e){return p.useMemo(()=>{if(e!=null)return Yl++,Yl},[e])}const fy=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggableNodes:b,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:_,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:C}=Qd(),I=p.useContext(Xi),j=dy(f==null?void 0:f.id),k=Hd(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:I,windowRect:C}),L=Ka(g),N=cy({config:n,draggableNodes:b,droppableContainers:h,measuringConfiguration:_}),A=L?y.setRef:void 0;return p.createElement(ry,null,p.createElement(ey,{animation:N},f&&j?p.createElement(iy,{key:j,id:f.id,ref:A,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:L,style:{zIndex:d,...s},transform:k},r):null))});/**
182
182
  * @license lucide-react v0.400.0 - ISC
183
183
  *
184
184
  * This source code is licensed under the ISC license.
185
185
  * See the LICENSE file in the root directory of this source tree.
186
- */const ty=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ud=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
186
+ */const hy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Gd=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
187
187
  * @license lucide-react v0.400.0 - ISC
188
188
  *
189
189
  * This source code is licensed under the ISC license.
190
190
  * See the LICENSE file in the root directory of this source tree.
191
- */var ry={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
191
+ */var py={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
192
192
  * @license lucide-react v0.400.0 - ISC
193
193
  *
194
194
  * This source code is licensed under the ISC license.
195
195
  * See the LICENSE file in the root directory of this source tree.
196
- */const ny=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>p.createElement("svg",{ref:c,...ry,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ud("lucide",s),...a},[...o.map(([d,u])=>p.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
196
+ */const gy=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>p.createElement("svg",{ref:c,...py,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Gd("lucide",s),...a},[...o.map(([d,u])=>p.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
197
197
  * @license lucide-react v0.400.0 - ISC
198
198
  *
199
199
  * This source code is licensed under the ISC license.
200
200
  * See the LICENSE file in the root directory of this source tree.
201
- */const fe=(e,t)=>{const r=p.forwardRef(({className:n,...s},i)=>p.createElement(ny,{ref:i,iconNode:t,className:Ud(`lucide-${ty(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
201
+ */const fe=(e,t)=>{const r=p.forwardRef(({className:n,...s},i)=>p.createElement(gy,{ref:i,iconNode:t,className:Gd(`lucide-${hy(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
202
202
  * @license lucide-react v0.400.0 - ISC
203
203
  *
204
204
  * This source code is licensed under the ISC license.
205
205
  * See the LICENSE file in the root directory of this source tree.
206
- */const sy=fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
206
+ */const my=fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
207
207
  * @license lucide-react v0.400.0 - ISC
208
208
  *
209
209
  * This source code is licensed under the ISC license.
210
210
  * See the LICENSE file in the root directory of this source tree.
211
- */const iy=fe("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/**
211
+ */const yy=fe("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/**
212
212
  * @license lucide-react v0.400.0 - ISC
213
213
  *
214
214
  * This source code is licensed under the ISC license.
215
215
  * See the LICENSE file in the root directory of this source tree.
216
- */const oy=fe("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/**
216
+ */const vy=fe("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/**
217
217
  * @license lucide-react v0.400.0 - ISC
218
218
  *
219
219
  * This source code is licensed under the ISC license.
220
220
  * See the LICENSE file in the root directory of this source tree.
221
- */const Hn=fe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
221
+ */const Wn=fe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
222
222
  * @license lucide-react v0.400.0 - ISC
223
223
  *
224
224
  * This source code is licensed under the ISC license.
225
225
  * See the LICENSE file in the root directory of this source tree.
226
- */const Ls=fe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
226
+ */const Bs=fe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
227
227
  * @license lucide-react v0.400.0 - ISC
228
228
  *
229
229
  * This source code is licensed under the ISC license.
230
230
  * See the LICENSE file in the root directory of this source tree.
231
- */const zd=fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
231
+ */const Yd=fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
232
232
  * @license lucide-react v0.400.0 - ISC
233
233
  *
234
234
  * This source code is licensed under the ISC license.
235
235
  * See the LICENSE file in the root directory of this source tree.
236
- */const ay=fe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
236
+ */const by=fe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
237
237
  * @license lucide-react v0.400.0 - ISC
238
238
  *
239
239
  * This source code is licensed under the ISC license.
240
240
  * See the LICENSE file in the root directory of this source tree.
241
- */const Vd=fe("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
241
+ */const Xd=fe("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
242
242
  * @license lucide-react v0.400.0 - ISC
243
243
  *
244
244
  * This source code is licensed under the ISC license.
245
245
  * See the LICENSE file in the root directory of this source tree.
246
- */const qa=fe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
246
+ */const Qa=fe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
247
247
  * @license lucide-react v0.400.0 - ISC
248
248
  *
249
249
  * This source code is licensed under the ISC license.
250
250
  * See the LICENSE file in the root directory of this source tree.
251
- */const ca=fe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
251
+ */const ha=fe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
252
252
  * @license lucide-react v0.400.0 - ISC
253
253
  *
254
254
  * This source code is licensed under the ISC license.
255
255
  * See the LICENSE file in the root directory of this source tree.
256
- */const ly=fe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
256
+ */const _y=fe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
257
257
  * @license lucide-react v0.400.0 - ISC
258
258
  *
259
259
  * This source code is licensed under the ISC license.
260
260
  * See the LICENSE file in the root directory of this source tree.
261
- */const cy=fe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
261
+ */const wy=fe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
262
262
  * @license lucide-react v0.400.0 - ISC
263
263
  *
264
264
  * This source code is licensed under the ISC license.
265
265
  * See the LICENSE file in the root directory of this source tree.
266
- */const qd=fe("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
266
+ */const Zd=fe("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
267
267
  * @license lucide-react v0.400.0 - ISC
268
268
  *
269
269
  * This source code is licensed under the ISC license.
270
270
  * See the LICENSE file in the root directory of this source tree.
271
- */const Ha=fe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
271
+ */const Ga=fe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
272
272
  * @license lucide-react v0.400.0 - ISC
273
273
  *
274
274
  * This source code is licensed under the ISC license.
275
275
  * See the LICENSE file in the root directory of this source tree.
276
- */const Wn=fe("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
276
+ */const Kn=fe("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
277
277
  * @license lucide-react v0.400.0 - ISC
278
278
  *
279
279
  * This source code is licensed under the ISC license.
280
280
  * See the LICENSE file in the root directory of this source tree.
281
- */const uy=fe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
281
+ */const Sy=fe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
282
282
  * @license lucide-react v0.400.0 - ISC
283
283
  *
284
284
  * This source code is licensed under the ISC license.
285
285
  * See the LICENSE file in the root directory of this source tree.
286
- */const Hd=fe("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
286
+ */const Jd=fe("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
287
287
  * @license lucide-react v0.400.0 - ISC
288
288
  *
289
289
  * This source code is licensed under the ISC license.
290
290
  * See the LICENSE file in the root directory of this source tree.
291
- */const dy=fe("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
291
+ */const xy=fe("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
292
292
  * @license lucide-react v0.400.0 - ISC
293
293
  *
294
294
  * This source code is licensed under the ISC license.
295
295
  * See the LICENSE file in the root directory of this source tree.
296
- */const Wd=fe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
296
+ */const ef=fe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
297
297
  * @license lucide-react v0.400.0 - ISC
298
298
  *
299
299
  * This source code is licensed under the ISC license.
300
300
  * See the LICENSE file in the root directory of this source tree.
301
- */const fy=fe("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
301
+ */const Cy=fe("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
302
302
  * @license lucide-react v0.400.0 - ISC
303
303
  *
304
304
  * This source code is licensed under the ISC license.
305
305
  * See the LICENSE file in the root directory of this source tree.
306
- */const Kd=fe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
306
+ */const tf=fe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
307
307
  * @license lucide-react v0.400.0 - ISC
308
308
  *
309
309
  * This source code is licensed under the ISC license.
310
310
  * See the LICENSE file in the root directory of this source tree.
311
- */const Wa=fe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
311
+ */const Ya=fe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
312
312
  * @license lucide-react v0.400.0 - ISC
313
313
  *
314
314
  * This source code is licensed under the ISC license.
315
315
  * See the LICENSE file in the root directory of this source tree.
316
- */const hy=fe("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
316
+ */const Ey=fe("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
317
317
  * @license lucide-react v0.400.0 - ISC
318
318
  *
319
319
  * This source code is licensed under the ISC license.
320
320
  * See the LICENSE file in the root directory of this source tree.
321
- */const ai=fe("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
321
+ */const di=fe("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
322
322
  * @license lucide-react v0.400.0 - ISC
323
323
  *
324
324
  * This source code is licensed under the ISC license.
325
325
  * See the LICENSE file in the root directory of this source tree.
326
- */const Ka=fe("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
326
+ */const Xa=fe("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
327
327
  * @license lucide-react v0.400.0 - ISC
328
328
  *
329
329
  * This source code is licensed under the ISC license.
330
330
  * See the LICENSE file in the root directory of this source tree.
331
- */const Qa=fe("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
331
+ */const Za=fe("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
332
332
  * @license lucide-react v0.400.0 - ISC
333
333
  *
334
334
  * This source code is licensed under the ISC license.
335
335
  * See the LICENSE file in the root directory of this source tree.
336
- */const py=fe("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
336
+ */const Oy=fe("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
337
337
  * @license lucide-react v0.400.0 - ISC
338
338
  *
339
339
  * This source code is licensed under the ISC license.
340
340
  * See the LICENSE file in the root directory of this source tree.
341
- */const gy=fe("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
341
+ */const Dy=fe("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
342
342
  * @license lucide-react v0.400.0 - ISC
343
343
  *
344
344
  * This source code is licensed under the ISC license.
345
345
  * See the LICENSE file in the root directory of this source tree.
346
- */const my=fe("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
346
+ */const Iy=fe("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
347
347
  * @license lucide-react v0.400.0 - ISC
348
348
  *
349
349
  * This source code is licensed under the ISC license.
350
350
  * See the LICENSE file in the root directory of this source tree.
351
- */const yy=fe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
351
+ */const Ty=fe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
352
352
  * @license lucide-react v0.400.0 - ISC
353
353
  *
354
354
  * This source code is licensed under the ISC license.
355
355
  * See the LICENSE file in the root directory of this source tree.
356
- */const Fs=fe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
356
+ */const Us=fe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
357
357
  * @license lucide-react v0.400.0 - ISC
358
358
  *
359
359
  * This source code is licensed under the ISC license.
360
360
  * See the LICENSE file in the root directory of this source tree.
361
- */const Kl=fe("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
361
+ */const Xl=fe("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
362
362
  * @license lucide-react v0.400.0 - ISC
363
363
  *
364
364
  * This source code is licensed under the ISC license.
365
365
  * See the LICENSE file in the root directory of this source tree.
366
- */const vy=fe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
366
+ */const Ny=fe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
367
367
  * @license lucide-react v0.400.0 - ISC
368
368
  *
369
369
  * This source code is licensed under the ISC license.
370
370
  * See the LICENSE file in the root directory of this source tree.
371
- */const by=fe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
371
+ */const jy=fe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
372
372
  * @license lucide-react v0.400.0 - ISC
373
373
  *
374
374
  * This source code is licensed under the ISC license.
375
375
  * See the LICENSE file in the root directory of this source tree.
376
- */const ua=fe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
376
+ */const pa=fe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
377
377
  * @license lucide-react v0.400.0 - ISC
378
378
  *
379
379
  * This source code is licensed under the ISC license.
380
380
  * See the LICENSE file in the root directory of this source tree.
381
- */const _y=fe("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
381
+ */const Ry=fe("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
382
382
  * @license lucide-react v0.400.0 - ISC
383
383
  *
384
384
  * This source code is licensed under the ISC license.
385
385
  * See the LICENSE file in the root directory of this source tree.
386
- */const wy=fe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
386
+ */const ky=fe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
387
387
  * @license lucide-react v0.400.0 - ISC
388
388
  *
389
389
  * This source code is licensed under the ISC license.
390
390
  * See the LICENSE file in the root directory of this source tree.
391
- */const xy=fe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
391
+ */const Ay=fe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
392
392
  * @license lucide-react v0.400.0 - ISC
393
393
  *
394
394
  * This source code is licensed under the ISC license.
395
395
  * See the LICENSE file in the root directory of this source tree.
396
- */const Ga=fe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
396
+ */const Ja=fe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
397
397
  * @license lucide-react v0.400.0 - ISC
398
398
  *
399
399
  * This source code is licensed under the ISC license.
400
400
  * See the LICENSE file in the root directory of this source tree.
401
- */const Ql=fe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
401
+ */const Zl=fe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
402
402
  * @license lucide-react v0.400.0 - ISC
403
403
  *
404
404
  * This source code is licensed under the ISC license.
405
405
  * See the LICENSE file in the root directory of this source tree.
406
- */const Sy=fe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
406
+ */const Py=fe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
407
407
  * @license lucide-react v0.400.0 - ISC
408
408
  *
409
409
  * This source code is licensed under the ISC license.
410
410
  * See the LICENSE file in the root directory of this source tree.
411
- */const Ya=fe("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
411
+ */const el=fe("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
412
412
  * @license lucide-react v0.400.0 - ISC
413
413
  *
414
414
  * This source code is licensed under the ISC license.
415
415
  * See the LICENSE file in the root directory of this source tree.
416
- */const cn=fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Cy={},Gl=e=>{let t;const r=new Set,n=(u,f)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const m=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(b=>b(t,m))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(Cy?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},d=t=e(n,s,c);return c},Oy=e=>e?Gl(e):Gl;function Qd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var da={exports:{}},po={},Qs={exports:{}},go={};/**
416
+ */const un=fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),My={},Jl=e=>{let t;const r=new Set,n=(u,f)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const m=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(b=>b(t,m))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(My?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},d=t=e(n,s,c);return c},Ly=e=>e?Jl(e):Jl;function rf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ga={exports:{}},vo={},Xs={exports:{}},bo={};/**
417
417
  * @license React
418
418
  * use-sync-external-store-shim.production.js
419
419
  *
@@ -421,7 +421,7 @@ to {
421
421
  *
422
422
  * This source code is licensed under the MIT license found in the
423
423
  * LICENSE file in the root directory of this source tree.
424
- */var Yl;function Ey(){if(Yl)return go;Yl=1;var e=p;function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,g){var m=g(),b=n({inst:{value:m,getSnapshot:g}}),h=b[0].inst,y=b[1];return i(function(){h.value=m,h.getSnapshot=g,c(h)&&y({inst:h})},[f,m,g]),s(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),o(m),m}function c(f){var g=f.getSnapshot;f=f.value;try{var m=g();return!r(f,m)}catch{return!0}}function d(f,g){return g()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return go.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,go}var mo={};/**
424
+ */var ec;function Fy(){if(ec)return bo;ec=1;var e=p;function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,g){var m=g(),b=n({inst:{value:m,getSnapshot:g}}),h=b[0].inst,y=b[1];return i(function(){h.value=m,h.getSnapshot=g,c(h)&&y({inst:h})},[f,m,g]),s(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),o(m),m}function c(f){var g=f.getSnapshot;f=f.value;try{var m=g();return!r(f,m)}catch{return!0}}function d(f,g){return g()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return bo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,bo}var _o={};/**
425
425
  * @license React
426
426
  * use-sync-external-store-shim.development.js
427
427
  *
@@ -429,7 +429,7 @@ to {
429
429
  *
430
430
  * This source code is licensed under the MIT license found in the
431
431
  * LICENSE file in the root directory of this source tree.
432
- */var Xl;function Dy(){return Xl||(Xl=1,process.env.NODE_ENV!=="production"&&function(){function e(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}function t(m,b){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=b();if(!f){var y=b();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:b}});var v=y[0].inst,_=y[1];return c(function(){v.value=h,v.getSnapshot=b,r(v)&&_({inst:v})},[m,h,b]),a(function(){return r(v)&&_({inst:v}),m(function(){r(v)&&_({inst:v})})},[m]),d(h),h}function r(m){var b=m.getSnapshot;m=m.value;try{var h=b();return!i(m,h)}catch{return!0}}function n(m,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=p,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;mo.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),mo}var Zl;function Xa(){return Zl||(Zl=1,process.env.NODE_ENV==="production"?Qs.exports=Ey():Qs.exports=Dy()),Qs.exports}/**
432
+ */var tc;function $y(){return tc||(tc=1,process.env.NODE_ENV!=="production"&&function(){function e(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}function t(m,b){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=b();if(!f){var y=b();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:b}});var v=y[0].inst,_=y[1];return c(function(){v.value=h,v.getSnapshot=b,r(v)&&_({inst:v})},[m,h,b]),a(function(){return r(v)&&_({inst:v}),m(function(){r(v)&&_({inst:v})})},[m]),d(h),h}function r(m){var b=m.getSnapshot;m=m.value;try{var h=b();return!i(m,h)}catch{return!0}}function n(m,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=p,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;_o.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),_o}var rc;function tl(){return rc||(rc=1,process.env.NODE_ENV==="production"?Xs.exports=Fy():Xs.exports=$y()),Xs.exports}/**
433
433
  * @license React
434
434
  * use-sync-external-store-shim/with-selector.production.js
435
435
  *
@@ -437,7 +437,7 @@ to {
437
437
  *
438
438
  * This source code is licensed under the MIT license found in the
439
439
  * LICENSE file in the root directory of this source tree.
440
- */var Jl;function Iy(){if(Jl)return po;Jl=1;var e=p,t=Xa();function r(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return po.useSyncExternalStoreWithSelector=function(d,u,f,g,m){var b=i(null);if(b.current===null){var h={hasValue:!1,value:null};b.current=h}else h=b.current;b=a(function(){function v(I){if(!_){if(_=!0,x=I,I=g(I),m!==void 0&&h.hasValue){var j=h.value;if(m(j,I))return w=j}return w=I}if(j=w,n(x,I))return j;var k=g(I);return m!==void 0&&m(j,k)?(x=I,j):(x=I,w=k)}var _=!1,x,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,g,m]);var y=s(d,b[0],b[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},po}var yo={};/**
440
+ */var nc;function By(){if(nc)return vo;nc=1;var e=p,t=tl();function r(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return vo.useSyncExternalStoreWithSelector=function(d,u,f,g,m){var b=i(null);if(b.current===null){var h={hasValue:!1,value:null};b.current=h}else h=b.current;b=a(function(){function v(I){if(!_){if(_=!0,S=I,I=g(I),m!==void 0&&h.hasValue){var j=h.value;if(m(j,I))return w=j}return w=I}if(j=w,n(S,I))return j;var k=g(I);return m!==void 0&&m(j,k)?(S=I,j):(S=I,w=k)}var _=!1,S,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,g,m]);var y=s(d,b[0],b[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},vo}var wo={};/**
441
441
  * @license React
442
442
  * use-sync-external-store-shim/with-selector.development.js
443
443
  *
@@ -445,22 +445,22 @@ to {
445
445
  *
446
446
  * This source code is licensed under the MIT license found in the
447
447
  * LICENSE file in the root directory of this source tree.
448
- */var ec;function Ty(){return ec||(ec=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,r=Xa(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;yo.useSyncExternalStoreWithSelector=function(d,u,f,g,m){var b=i(null);if(b.current===null){var h={hasValue:!1,value:null};b.current=h}else h=b.current;b=a(function(){function v(I){if(!_){if(_=!0,x=I,I=g(I),m!==void 0&&h.hasValue){var j=h.value;if(m(j,I))return w=j}return w=I}if(j=w,n(x,I))return j;var k=g(I);return m!==void 0&&m(j,k)?(x=I,j):(x=I,w=k)}var _=!1,x,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,g,m]);var y=s(d,b[0],b[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),yo}process.env.NODE_ENV==="production"?da.exports=Iy():da.exports=Ty();var Ny=da.exports;const jy=Qd(Ny),Gd={},{useDebugValue:Ry}=p,{useSyncExternalStoreWithSelector:ky}=jy;let tc=!1;const Ay=e=>e;function Py(e,t=Ay,r){(Gd?"production":void 0)!=="production"&&r&&!tc&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),tc=!0);const n=ky(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Ry(n),n}const rc=e=>{(Gd?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Oy(e):e,r=(n,s)=>Py(t,n,s);return Object.assign(r,t),r},Qi=e=>e?rc(e):rc,oe=Qi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},contentFramework:null,contentTargetFWIds:null,rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setContentFramework:(t,r)=>e({contentFramework:t,contentTargetFWIds:r}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=oe.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),My=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:oe},Symbol.toStringTag,{value:"Module"}));function Vr(e,t){const r=[...e];for(;r.length>0;){const n=r.shift();if(n.id===t)return n;n.children&&r.push(...n.children)}}function Yd(e,t,r=0){var n;for(const s of e){if(s.id===t)return r;if((n=s.children)!=null&&n.length){const i=Yd(s.children,t,r+1);if(i>=0)return i}}return-1}const Ly=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function Xd(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Ly)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Xd(n.children,t,r)}:n})}function li(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:li(n.children,t,r)}:n)}function fa(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?fa(r.children,t):[]}))}function Zd(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[o]=i.splice(r,1);return i.splice(n,0,o),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:Zd(s.children,t,r,n)}:s})}function Jd(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?Jd(r.children,t):[]}})}function Fy(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function $y(e,t){const r=Vr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Vr(e,s.parent):void 0;return n}const Ae=Qi((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=Vr(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};oe.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:Xd(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),oe.getState().setIsDirty(!0)},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=oe.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=Yd(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:li(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:fa(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Zd(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Vr(i.treeData,r);if(!o)return i;let a=fa(i.treeData,r);return a=li(a,s,{...o,parent:s}),{treeData:a}}),oe.getState().setIsDirty(!0)},addResource:(r,n)=>{var u,f,g;const s=oe.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Vr(t().treeData,r.identifier))return!1;const a=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if(Fy(t().treeData)>=a)return!1;const d={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:r};return e(m=>({treeData:li(m.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{oe.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=Jd(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Vr(t().treeData,r),getChildrenOf:r=>{const n=Vr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>$y(t().treeData,r)})),By=Qi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Uy="_spin_1ah4d_9",zy={spin:Uy},Vy=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:zy.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),ke=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(Vy,{size:14}):null,i]}),qy="_overlay_w9xez_1",Hy="_modal_w9xez_11",Wy="_modalHeader_w9xez_23",Ky="_modalHeaderClose_w9xez_33",Qy="_modalBody_w9xez_51",Gy="_modalFooter_w9xez_58",Yy="_checkRow_w9xez_65",Xy="_formGroup_w9xez_108",Zy="_textarea_w9xez_119",Jy="_sliderGroup_w9xez_140",ev="_sliderValue_w9xez_152",tv="_sliderLabels_w9xez_160",rv="_sectionTitle_w9xez_168",Re={overlay:qy,modal:Hy,modalHeader:Wy,modalHeaderClose:Ky,modalBody:Qy,modalFooter:Gy,checkRow:Yy,formGroup:Xy,textarea:Zy,sliderGroup:Jy,sliderValue:ev,sliderLabels:tv,sectionTitle:rv},nv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=oe(u=>{var f,g;return(g=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:g.objectType})||"Content",s=oe(u=>u.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Re.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Re.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:Re.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(g=>({...g,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(ke,{variant:"ghost",onClick:r,children:"No"}),l.jsx(ke,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},sv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Re.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Re.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Re.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:g=>a(Number(g.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Re.sliderValue,children:o})]}),l.jsxs("div",{className:Re.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Re.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:Re.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:Re.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Re.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:g=>i(g.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(ke,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(ke,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function ef(e,t){return function(){return e.apply(t,arguments)}}const{toString:iv}=Object.prototype,{getPrototypeOf:Fn}=Object,{iterator:$s,toStringTag:tf}=Symbol,Ni=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ss=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Ni(r,t))return!0;r=Fn(r)}return!1},ov=(e,t)=>e!=null&&Ss(e,t)?e[t]:void 0,Za=(e=>t=>{const r=iv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Gt=e=>(e=e.toLowerCase(),t=>Za(t)===e),Gi=e=>t=>typeof t===e,{isArray:on}=Array,$n=Gi("undefined");function Kn(e){return e!==null&&!$n(e)&&e.constructor!==null&&!$n(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const rf=Gt("ArrayBuffer");function av(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&rf(e.buffer),t}const lv=Gi("string"),Dt=Gi("function"),nf=Gi("number"),Qn=e=>e!==null&&typeof e=="object",cv=e=>e===!0||e===!1,ci=e=>{if(!Qn(e))return!1;const t=Fn(e);return(t===null||t===Object.prototype||Fn(t)===null)&&!Ss(e,tf)&&!Ss(e,$s)},uv=e=>{if(!Qn(e)||Kn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},dv=Gt("Date"),fv=Gt("File"),hv=e=>!!(e&&typeof e.uri<"u"),pv=e=>e&&typeof e.getParts<"u",gv=Gt("Blob"),mv=Gt("FileList"),yv=e=>Qn(e)&&Dt(e.pipe);function vv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const nc=vv(),sc=typeof nc.FormData<"u"?nc.FormData:void 0,bv=e=>{if(!e)return!1;if(sc&&e instanceof sc)return!0;const t=Fn(e);if(!t||t===Object.prototype||!Dt(e.append))return!1;const r=Za(e);return r==="formdata"||r==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"},_v=Gt("URLSearchParams"),[wv,xv,Sv,Cv]=["ReadableStream","Request","Response","Headers"].map(Gt),Ov=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Bs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),on(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Kn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function sf(e,t){if(Kn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Hr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,of=e=>!$n(e)&&e!==Hr;function ha(...e){const{caseless:t,skipUndefined:r}=of(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&sf(n,o)||o,c=Ni(n,a)?n[a]:void 0;ci(c)&&ci(i)?n[a]=ha(c,i):ci(i)?n[a]=ha({},i):on(i)?n[a]=i.slice():(!r||!$n(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Kn(a)||(Bs(a,s),typeof a!="object"||on(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];Lv.call(a,u)&&s(a[u],u)}}return n}const Ev=(e,t,r,{allOwnKeys:n}={})=>(Bs(t,(s,i)=>{r&&Dt(s)?Object.defineProperty(e,i,{__proto__:null,value:ef(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),Dv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Iv=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},Tv=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&Fn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Nv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},jv=e=>{if(!e)return null;if(on(e))return e;let t=e.length;if(!nf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Rv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Fn(Uint8Array)),kv=(e,t)=>{const n=(e&&e[$s]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Av=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Pv=Gt("HTMLFormElement"),Mv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Lv}=Object.prototype,Fv=Gt("RegExp"),af=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Bs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},$v=e=>{af(e,(t,r)=>{if(Dt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Dt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Bv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return on(e)?n(e):n(String(e).split(t)),r},Uv=()=>{},zv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Vv(e){return!!(e&&Dt(e.append)&&e[tf]==="FormData"&&e[$s])}const qv=e=>{const t=new WeakSet,r=n=>{if(Qn(n)){if(t.has(n))return;if(Kn(n))return n;if(!("toJSON"in n)){t.add(n);const s=on(n)?[]:{};return Bs(n,(i,o)=>{const a=r(i);!$n(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Hv=Gt("AsyncFunction"),Wv=e=>e&&(Qn(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),lf=((e,t)=>e?setImmediate:t?((r,n)=>(Hr.addEventListener("message",({source:s,data:i})=>{s===Hr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Hr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Dt(Hr.postMessage)),Kv=typeof queueMicrotask<"u"?queueMicrotask.bind(Hr):typeof process<"u"&&process.nextTick||lf,cf=e=>e!=null&&Dt(e[$s]),Qv=e=>e!=null&&Ss(e,$s)&&cf(e),D={isArray:on,isArrayBuffer:rf,isBuffer:Kn,isFormData:bv,isArrayBufferView:av,isString:lv,isNumber:nf,isBoolean:cv,isObject:Qn,isPlainObject:ci,isEmptyObject:uv,isReadableStream:wv,isRequest:xv,isResponse:Sv,isHeaders:Cv,isUndefined:$n,isDate:dv,isFile:fv,isReactNativeBlob:hv,isReactNative:pv,isBlob:gv,isRegExp:Fv,isFunction:Dt,isStream:yv,isURLSearchParams:_v,isTypedArray:Rv,isFileList:mv,forEach:Bs,merge:ha,extend:Ev,trim:Ov,stripBOM:Dv,inherits:Iv,toFlatObject:Tv,kindOf:Za,kindOfTest:Gt,endsWith:Nv,toArray:jv,forEachEntry:kv,matchAll:Av,isHTMLForm:Pv,hasOwnProperty:Ni,hasOwnProp:Ni,hasOwnInPrototypeChain:Ss,getSafeProp:ov,reduceDescriptors:af,freezeMethods:$v,toObjectSet:Bv,toCamelCase:Mv,noop:Uv,toFiniteNumber:zv,findKey:sf,global:Hr,isContextDefined:of,isSpecCompliantForm:Vv,toJSONObject:qv,isAsyncFn:Hv,isThenable:Wv,setImmediate:lf,asap:Kv,isIterable:cf,isSafeIterable:Qv},Gv=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Yv=e=>{const t={};let r,n,s;return e&&e.split(`
449
- `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&Gv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Xv(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}const Zv=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Jv=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Ja(e,t){return D.isArray(e)?e.map(r=>Ja(r,t)):Xv(String(e).replace(t,""))}const eb=e=>Ja(e,Zv),tb=e=>Ja(e,Jv);function uf(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=tb(r)}),t}const ic=Symbol("internals");function Jn(e){return e&&String(e).trim().toLowerCase()}function ui(e){return e===!1||e==null?e:D.isArray(e)?e.map(ui):eb(String(e))}function rb(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const nb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function vo(e,t,r,n,s){if(D.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!D.isString(t)){if(D.isString(n))return t.indexOf(n)!==-1;if(D.isRegExp(n))return n.test(t)}}function sb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function ib(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let vt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=Jn(c);if(!u)return;const f=D.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=ui(a))}const o=(a,c)=>D.forEach(a,(d,u)=>i(d,u,c));if(D.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(D.isString(t)&&(t=t.trim())&&!nb(t))o(Yv(t),r);else if(D.isObject(t)&&D.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!D.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],D.hasOwnProp(a,d)?(c=a[d],a[d]=D.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=Jn(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return rb(s);if(D.isFunction(r))return r.call(this,s,n);if(D.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Jn(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||vo(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=Jn(o),o){const a=D.findKey(n,o);a&&(!r||vo(n,n[a],a,r))&&(delete n[a],s=!0)}}return D.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||vo(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return D.forEach(this,(s,i)=>{const o=D.findKey(n,i);if(o){r[o]=ui(s),delete r[i];return}const a=t?sb(i):String(i).trim();a!==i&&delete r[i],r[a]=ui(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return D.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&D.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
450
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[ic]=this[ic]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Jn(o);n[a]||(ib(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};vt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);D.reduceDescriptors(vt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});D.freezeMethods(vt);const ob="[REDACTED ****]";function ab(e){if(D.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(D.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function lb(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||D.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof vt&&(i=i.toJSON()),n.push(i);let o;if(D.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);D.isUndefined(d)||(o[c]=d)});else{if(!D.isPlainObject(i)&&ab(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?ob:s(c);D.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let X=class df extends Error{static from(t,r,n,s,i,o){const a=new df(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&D.hasOwnProp(t,"redact")?t.redact:void 0,n=D.isArray(r)&&r.length>0?lb(t,r):D.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};X.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";X.ERR_BAD_OPTION="ERR_BAD_OPTION";X.ECONNABORTED="ECONNABORTED";X.ETIMEDOUT="ETIMEDOUT";X.ECONNREFUSED="ECONNREFUSED";X.ERR_NETWORK="ERR_NETWORK";X.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";X.ERR_DEPRECATED="ERR_DEPRECATED";X.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";X.ERR_BAD_REQUEST="ERR_BAD_REQUEST";X.ERR_CANCELED="ERR_CANCELED";X.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";X.ERR_INVALID_URL="ERR_INVALID_URL";X.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const cb=null,ff=100;function pa(e){return D.isPlainObject(e)||D.isArray(e)}function hf(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function bo(e,t,r){return e?e.concat(t).map(function(s,i){return s=hf(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function ub(e){return D.isArray(e)&&!e.some(pa)}const db=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function Yi(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,x){return!D.isUndefined(x[_])});const n=r.metaTokens,s=r.visitor||b,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?ff:r.maxDepth,d=a&&D.isSpecCompliantForm(t),u=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(D.isDate(v))return v.toISOString();if(D.isBoolean(v))return v.toString();if(!d&&D.isBlob(v))throw new X("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(v)||D.isTypedArray(v)?d&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function g(v){if(v>c)throw new X("Object is too deeply nested ("+v+" levels). Max depth: "+c,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(v,_){if(c===1/0)return JSON.stringify(v);const x=[];return JSON.stringify(v,function(C,I){if(!D.isObject(I))return I;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(I),g(_+x.length-1),I})}function b(v,_,x){let w=v;if(D.isReactNative(t)&&D.isReactNativeBlob(v))return t.append(bo(x,_,i),f(v)),!1;if(v&&!x&&typeof v=="object"){if(D.endsWith(_,"{}"))_=n?_:_.slice(0,-2),v=m(v,1);else if(D.isArray(v)&&ub(v)||(D.isFileList(v)||D.endsWith(_,"[]"))&&(w=D.toArray(v)))return _=hf(_),w.forEach(function(I,j){!(D.isUndefined(I)||I===null)&&t.append(o===!0?bo([_],j,i):o===null?_:_+"[]",f(I))}),!1}return pa(v)?!0:(t.append(bo(x,_,i),f(v)),!1)}const h=Object.assign(db,{defaultVisitor:b,convertValue:f,isVisitable:pa});function y(v,_,x=0){if(!D.isUndefined(v)){if(g(x),u.indexOf(v)!==-1)throw new Error("Circular reference detected in "+_.join("."));u.push(v),D.forEach(v,function(C,I){(!(D.isUndefined(C)||C===null)&&s.call(t,C,D.isString(I)?I.trim():I,_,h))===!0&&y(C,_?_.concat(I):[I],x+1)}),u.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return y(e),t}function oc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function el(e,t){this._pairs=[],e&&Yi(e,this,t)}const pf=el.prototype;pf.append=function(t,r){this._pairs.push([t,r])};pf.toString=function(t){const r=t?function(n){return t.call(this,n,oc)}:oc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function fb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function gf(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||fb,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new el(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ac{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){D.forEach(this.handlers,function(n){n!==null&&t(n)})}}const tl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},hb=typeof URLSearchParams<"u"?URLSearchParams:el,pb=typeof FormData<"u"?FormData:null,gb=typeof Blob<"u"?Blob:null,mb={isBrowser:!0,classes:{URLSearchParams:hb,FormData:pb,Blob:gb},protocols:["http","https","file","blob","url","data"]},rl=typeof window<"u"&&typeof document<"u",ga=typeof navigator=="object"&&navigator||void 0,yb=rl&&(!ga||["ReactNative","NativeScript","NS"].indexOf(ga.product)<0),vb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bb=rl&&window.location.href||"http://localhost",_b=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:rl,hasStandardBrowserEnv:yb,hasStandardBrowserWebWorkerEnv:vb,navigator:ga,origin:bb},Symbol.toStringTag,{value:"Module"})),ct={..._b,...mb};function wb(e,t){return Yi(e,new ct.classes.URLSearchParams,{visitor:function(r,n,s,i){return ct.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const lc=ff;function mf(e){if(e>lc)throw new X("FormData field is too deeply nested ("+e+" levels). Max depth: "+lc,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function xb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)mf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function Sb(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function yf(e){function t(r,n,s,i){mf(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&D.isArray(s)?s.length:o,c?(D.hasOwnProp(s,o)?s[o]=D.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!D.hasOwnProp(s,o)||!D.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&D.isArray(s[o])&&(s[o]=Sb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(xb(n),s,r,0)}),r}return null}const hn=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function Cb(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Us={transitional:tl,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=D.isObject(t);if(i&&D.isHTMLForm(t)&&(t=new FormData(t)),D.isFormData(t))return s?JSON.stringify(yf(t)):t;if(D.isArrayBuffer(t)||D.isBuffer(t)||D.isStream(t)||D.isFile(t)||D.isBlob(t)||D.isReadableStream(t))return t;if(D.isArrayBufferView(t))return t.buffer;if(D.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=hn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return wb(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=hn(this,"env"),u=d&&d.FormData;return Yi(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),Cb(t)):t}],transformResponse:[function(t){const r=hn(this,"transitional")||Us.transitional,n=r&&r.forcedJSONParsing,s=hn(this,"responseType"),i=s==="json";if(D.isResponse(t)||D.isReadableStream(t))return t;if(t&&D.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,hn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?X.from(c,X.ERR_BAD_RESPONSE,this,null,hn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ct.classes.FormData,Blob:ct.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch","query"],e=>{Us.headers[e]={}});function _o(e,t){const r=this||Us,n=t||r,s=vt.from(n.headers);let i=n.data;return D.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function vf(e){return!!(e&&e.__CANCEL__)}let zs=class extends X{constructor(t,r,n){super(t??"canceled",X.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function bf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new X("Request failed with status code "+r.status,r.status>=400&&r.status<500?X.ERR_BAD_REQUEST:X.ERR_BAD_RESPONSE,r.config,r.request,r))}function Ob(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Eb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,g=0;for(;f!==s;)g+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const m=u&&d-u;return m?Math.round(g*1e3/m):void 0}}function Db(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const ji=(e,t,r=3)=>{let n=0;const s=Eb(50,250);return Db(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},cc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},uc=e=>(...t)=>D.asap(()=>e(...t)),Ib=ct.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ct.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ct.origin),ct.navigator&&/(msie|trident)/i.test(ct.navigator.userAgent)):()=>!0,Tb=ct.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];D.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),D.isString(n)&&a.push(`path=${n}`),D.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),D.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===e)return decodeURIComponent(n.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Nb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function jb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Rb=/^https?:(?!\/\/)/i,kb=/[\t\n\r]/g;function Ab(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Pb(e){return Ab(e).replace(kb,"")}function dc(e,t){if(typeof e=="string"&&Rb.test(Pb(e)))throw new X('Invalid URL: missing "//" after protocol',X.ERR_INVALID_URL,t)}function _f(e,t,r,n){dc(t,n);let s=!Nb(t);return e&&(s||r===!1)?(dc(e,n),jb(e,t)):t}const fc=e=>e instanceof vt?{...e}:e;function an(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,g,m){return D.isPlainObject(u)&&D.isPlainObject(f)?D.merge.call({caseless:m},u,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(u,f,g,m){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u,g,m)}else return n(u,f,g,m)}function i(u,f){if(!D.isUndefined(f))return n(void 0,f)}function o(u,f){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=D.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!D.isUndefined(f))if(D.isPlainObject(f)){if(D.hasOwnProp(f,u))return f[u]}else return;const g=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(g)&&D.hasOwnProp(g,u))return g[u]}function c(u,f,g){if(D.hasOwnProp(t,g))return n(u,f);if(D.hasOwnProp(e,g))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,g)=>s(fc(u),fc(f),g,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const g=D.hasOwnProp(d,f)?d[f]:s,m=D.hasOwnProp(e,f)?e[f]:void 0,b=D.hasOwnProp(t,f)?t[f]:void 0,h=g(m,b,f);D.isUndefined(h)&&g!==c||(r[f]=h)}),D.hasOwnProp(t,"validateStatus")&&D.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(D.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Mb=["content-type","content-length"];function Lb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Mb.includes(n.toLowerCase())&&e.set(n,s)})}const Fb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function wf(e){const t=an({},e),r=g=>D.hasOwnProp(t,g)?t[g]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=vt.from(a),t.url=gf(_f(d,f,u,t),r("params"),r("paramsSerializer")),c){const g=D.getSafeProp(c,"username")||"",m=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(m?Fb(m):"")))}if(D.isFormData(n)&&(ct.hasStandardBrowserEnv||ct.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&Lb(a,n.getHeaders(),r("formDataHeaderPolicy"))),ct.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&Ib(t.url))){const m=i&&o&&Tb.read(o);m&&a.set(i,m)}return t}const $b=typeof XMLHttpRequest<"u",Bb=$b&&function(e){return new Promise(function(r,n){const s=wf(e);let i=s.data;const o=vt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,g,m,b;function h(){m&&m(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const x=vt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};bf(function(j){r(j),h()},function(j){n(j),h()},C),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new X("Request aborted",X.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(w){const C=w&&w.message?w.message:"Network Error",I=new X(C,X.ERR_NETWORK,e,y);I.event=w||null,n(I),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||tl;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new X(w,C.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&D.forEach(uf(o),function(w,C){y.setRequestHeader(C,w)}),D.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([g,b]=ji(d,!0),y.addEventListener("progress",g)),c&&y.upload&&([f,m]=ji(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(u=x=>{y&&(n(!x||x.type?new zs(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const _=Ob(s.url);if(_&&!ct.protocols.includes(_)){n(new X("Unsupported protocol "+_+":",X.ERR_BAD_REQUEST,e));return}y.send(i||null)})},Ub=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof X?d:new zs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new X(`timeout of ${t}ms exceeded`,X.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>D.asap(o),a},zb=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},Vb=async function*(e,t){for await(const r of qb(e))yield*zb(r,t)},qb=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},hc=(e,t,r,n)=>{const s=Vb(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let g=i+=f;r(g)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ri=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Hb=(e,t,r)=>t+2<r&&Ri(e.charCodeAt(t+1))&&Ri(e.charCodeAt(t+2));function Wb(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let m=0;m<a;m++)if(n.charCodeAt(m)===37&&m+2<a){const b=n.charCodeAt(m+1),h=n.charCodeAt(m+2);Ri(b)&&Ri(h)&&(o-=2,m+=2)}let c=0,d=a-1;const u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const g=Math.floor(o/4)*3-(c||0);return g>0?g:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&Hb(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const nl="1.18.0",pc=64*1024,{isFunction:Gs}=D,Kb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),gc=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},mc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Qb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Gb=e=>{const t=D.global!==void 0&&D.global!==null?D.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=D.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Gs(s):typeof fetch=="function",c=Gs(i),d=Gs(o);if(!a)return!1;const u=a&&Gs(r),f=a&&(typeof n=="function"?(v=>_=>v.encode(_))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),g=c&&u&&mc(()=>{let v=!1;const _=new i(ct.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),x=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),v&&!x}),m=d&&u&&mc(()=>D.isReadableStream(new o("").body)),b={stream:m&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!b[v]&&(b[v]=(_,x)=>{let w=_&&_[v];if(w)return w.call(_);throw new X(`Response type '${v}' is not supported`,X.ERR_NOT_SUPPORT,x)})});const h=async v=>{if(v==null)return 0;if(D.isBlob(v))return v.size;if(D.isSpecCompliantForm(v))return(await new i(ct.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(D.isArrayBufferView(v)||D.isArrayBuffer(v))return v.byteLength;if(D.isURLSearchParams(v)&&(v=v+""),D.isString(v))return(await f(v)).byteLength},y=async(v,_)=>{const x=D.toFiniteNumber(v.getContentLength());return x??h(_)};return async v=>{let{url:_,method:x,data:w,signal:C,cancelToken:I,timeout:j,onDownloadProgress:k,onUploadProgress:L,responseType:N,headers:A,withCredentials:$="same-origin",fetchOptions:R,maxContentLength:F,maxBodyLength:M}=wf(v);const Z=D.isNumber(F)&&F>-1,ae=D.isNumber(M)&&M>-1,ve=K=>D.hasOwnProp(v,K)?v[K]:void 0;let we=s||fetch;N=N?(N+"").toLowerCase():"text";let he=Ub([C,I&&I.toAbortSignal()],j),W=null;const J=he&&he.unsubscribe&&(()=>{he.unsubscribe()});let se,B=null;const Y=()=>new X("Request body larger than maxBodyLength limit",X.ERR_BAD_REQUEST,v,W);try{let K;const ue=ve("auth");if(ue){const ee=D.getSafeProp(ue,"username")||"",ze=D.getSafeProp(ue,"password")||"";K={username:ee,password:ze}}if(Qb(_)){const ee=new URL(_,ct.origin);if(!K&&(ee.username||ee.password)){const ze=gc(ee.username),Xe=gc(ee.password);K={username:ze,password:Xe}}(ee.username||ee.password)&&(ee.username="",ee.password="",_=ee.href)}if(K&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(Kb((K.username||"")+":"+(K.password||""))))),Z&&typeof _=="string"&&_.startsWith("data:")&&Wb(_)>F)throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W);if(ae&&x!=="get"&&x!=="head"){const ee=await h(w);if(typeof ee=="number"&&isFinite(ee)&&(se=ee,ee>M))throw Y()}const xe=ae&&(D.isReadableStream(w)||D.isStream(w)),Pe=(ee,ze,Xe)=>hc(ee,pc,q=>{if(ae&&q>M)throw B=Y();ze&&ze(q)},Xe);if(g&&x!=="get"&&x!=="head"&&(L||xe)){if(se=se??await y(A,w),se!==0||xe){let ee=new i(_,{method:"POST",body:w,duplex:"half"}),ze;if(D.isFormData(w)&&(ze=ee.headers.get("content-type"))&&A.setContentType(ze),ee.body){const[Xe,q]=L&&cc(se,ji(uc(L)))||[];w=Pe(ee.body,Xe,q)}}}else if(xe&&!c&&u&&x!=="get"&&x!=="head")w=Pe(w);else if(xe&&c&&!g&&x!=="get"&&x!=="head")throw new X("Stream request bodies are not supported by the current fetch implementation",X.ERR_NOT_SUPPORT,v,W);D.isString($)||($=$?"include":"omit");const me=c&&"credentials"in i.prototype;if(D.isFormData(w)){const ee=A.getContentType();ee&&/^multipart\/form-data/i.test(ee)&&!/boundary=/i.test(ee)&&A.delete("content-type")}A.set("User-Agent","axios/"+nl,!1);const le={...R,signal:he,method:x.toUpperCase(),headers:uf(A.normalize()),body:w,duplex:"half",credentials:me?$:void 0};W=c&&new i(_,le);let pe=await(c?we(W,R):we(_,le));const je=vt.from(pe.headers);if(Z){const ee=D.toFiniteNumber(je.getContentLength());if(ee!=null&&ee>F)throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W)}const Ue=m&&(N==="stream"||N==="response");if(m&&pe.body&&(k||Z||Ue&&J)){const ee={};["status","statusText","headers"].forEach(We=>{ee[We]=pe[We]});const ze=D.toFiniteNumber(je.getContentLength()),[Xe,q]=k&&cc(ze,ji(uc(k),!0))||[];let re=0;const ie=We=>{if(Z&&(re=We,re>F))throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W);Xe&&Xe(We)};pe=new o(hc(pe.body,pc,ie,()=>{q&&q(),J&&J()}),ee)}N=N||"text";let De=await b[D.findKey(b,N)||"text"](pe,v);if(Z&&!m&&!Ue){let ee;if(De!=null&&(typeof De.byteLength=="number"?ee=De.byteLength:typeof De.size=="number"?ee=De.size:typeof De=="string"&&(ee=typeof n=="function"?new n().encode(De).byteLength:De.length)),typeof ee=="number"&&ee>F)throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W)}return!Ue&&J&&J(),await new Promise((ee,ze)=>{bf(ee,ze,{data:De,headers:vt.from(pe.headers),status:pe.status,statusText:pe.statusText,config:v,request:W})})}catch(K){if(J&&J(),he&&he.aborted&&he.reason instanceof X){const ue=he.reason;throw ue.config=v,W&&(ue.request=W),K!==ue&&(ue.cause=K),ue}throw B?(W&&!B.request&&(B.request=W),B):K instanceof X?(W&&!K.request&&(K.request=W),K):K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new X("Network Error",X.ERR_NETWORK,v,W,K&&K.response),{cause:K.cause||K}):X.from(K,K&&K.code,v,W,K&&K.response)}}},Yb=new Map,xf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=Yb;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Gb(t)),u=d;return d};xf();const sl={http:cb,xhr:Bb,fetch:{get:xf}};D.forEach(sl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const yc=e=>`- ${e}`,Xb=e=>D.isFunction(e)||e===null||e===!1;function Zb(e,t){e=D.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Xb(n)&&(s=sl[(a=String(n)).toLowerCase()],s===void 0))throw new X(`Unknown adapter '${a}'`);if(s&&(D.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
- `+o.map(yc).join(`
452
- `):" "+yc(o[0]):"as no adapter specified";throw new X("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Sf={getAdapter:Zb,adapters:sl};function wo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new zs(null,e)}function vc(e){return wo(e),e.headers=vt.from(e.headers),e.data=_o.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Sf.getAdapter(e.adapter||Us.adapter,e)(e).then(function(n){wo(e),e.response=n;try{n.data=_o.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=vt.from(n.headers),n},function(n){if(!vf(n)&&(wo(e),n&&n.response)){e.response=n.response;try{n.response.data=_o.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=vt.from(n.response.headers)}return Promise.reject(n)})}const Xi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Xi[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const bc={};Xi.transitional=function(t,r,n){function s(i,o){return"[Axios v"+nl+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new X(s(o," has been removed"+(r?" in "+r:"")),X.ERR_DEPRECATED);return r&&!bc[o]&&(bc[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}};Xi.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Jb(e,t,r){if(typeof e!="object")throw new X("options must be an object",X.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],c=a===void 0||o(a,i,e);if(c!==!0)throw new X("option "+i+" must be "+c,X.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new X("Unknown option "+i,X.ERR_BAD_OPTION)}}const di={assertOptions:Jb,validators:Xi},dt=di.validators;let nn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ac,response:new ac}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
448
+ */var sc;function Uy(){return sc||(sc=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,r=tl(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;wo.useSyncExternalStoreWithSelector=function(d,u,f,g,m){var b=i(null);if(b.current===null){var h={hasValue:!1,value:null};b.current=h}else h=b.current;b=a(function(){function v(I){if(!_){if(_=!0,S=I,I=g(I),m!==void 0&&h.hasValue){var j=h.value;if(m(j,I))return w=j}return w=I}if(j=w,n(S,I))return j;var k=g(I);return m!==void 0&&m(j,k)?(S=I,j):(S=I,w=k)}var _=!1,S,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,g,m]);var y=s(d,b[0],b[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),wo}process.env.NODE_ENV==="production"?ga.exports=By():ga.exports=Uy();var zy=ga.exports;const Vy=rf(zy),nf={},{useDebugValue:qy}=p,{useSyncExternalStoreWithSelector:Hy}=Vy;let ic=!1;const Wy=e=>e;function Ky(e,t=Wy,r){(nf?"production":void 0)!=="production"&&r&&!ic&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),ic=!0);const n=Hy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return qy(n),n}const oc=e=>{(nf?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Ly(e):e,r=(n,s)=>Ky(t,n,s);return Object.assign(r,t),r},Zi=e=>e?oc(e):oc,oe=Zi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},contentFramework:null,contentTargetFWIds:null,rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setContentFramework:(t,r)=>e({contentFramework:t,contentTargetFWIds:r}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=oe.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),Qy=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:oe},Symbol.toStringTag,{value:"Module"}));function qr(e,t){const r=[...e];for(;r.length>0;){const n=r.shift();if(n.id===t)return n;n.children&&r.push(...n.children)}}function sf(e,t,r=0){var n;for(const s of e){if(s.id===t)return r;if((n=s.children)!=null&&n.length){const i=sf(s.children,t,r+1);if(i>=0)return i}}return-1}const Gy=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function of(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Gy)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:of(n.children,t,r)}:n})}function fi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:fi(n.children,t,r)}:n)}function ma(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?ma(r.children,t):[]}))}function af(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[o]=i.splice(r,1);return i.splice(n,0,o),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:af(s.children,t,r,n)}:s})}function lf(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?lf(r.children,t):[]}})}function Yy(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function Xy(e,t){const r=qr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?qr(e,s.parent):void 0;return n}const Pe=Zi((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=qr(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};oe.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:of(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),oe.getState().setIsDirty(!0)},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=oe.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=sf(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:fi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:ma(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:af(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=qr(i.treeData,r);if(!o)return i;let a=ma(i.treeData,r);return a=fi(a,s,{...o,parent:s}),{treeData:a}}),oe.getState().setIsDirty(!0)},addResource:(r,n)=>{var u,f,g;const s=oe.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||qr(t().treeData,r.identifier))return!1;const a=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if(Yy(t().treeData)>=a)return!1;const d={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:r};return e(m=>({treeData:fi(m.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{oe.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=lf(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>qr(t().treeData,r),getChildrenOf:r=>{const n=qr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Xy(t().treeData,r)})),Zy=Zi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Jy="_spin_1ah4d_9",ev={spin:Jy},tv=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:ev.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),Ae=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(tv,{size:14}):null,i]}),rv="_overlay_w9xez_1",nv="_modal_w9xez_11",sv="_modalHeader_w9xez_23",iv="_modalHeaderClose_w9xez_33",ov="_modalBody_w9xez_51",av="_modalFooter_w9xez_58",lv="_checkRow_w9xez_65",cv="_formGroup_w9xez_108",uv="_textarea_w9xez_119",dv="_sliderGroup_w9xez_140",fv="_sliderValue_w9xez_152",hv="_sliderLabels_w9xez_160",pv="_sectionTitle_w9xez_168",ke={overlay:rv,modal:nv,modalHeader:sv,modalHeaderClose:iv,modalBody:ov,modalFooter:av,checkRow:lv,formGroup:cv,textarea:uv,sliderGroup:dv,sliderValue:fv,sliderLabels:hv,sectionTitle:pv},gv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=oe(u=>{var f,g;return(g=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:g.objectType})||"Content",s=oe(u=>u.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:ke.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:ke.modal,children:[l.jsxs("div",{className:ke.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:ke.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:ke.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:ke.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:ke.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(g=>({...g,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:ke.modalFooter,children:[l.jsx(Ae,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Ae,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},mv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:ke.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:ke.modal,children:[l.jsxs("div",{className:ke.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:ke.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:ke.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ke.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:ke.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:g=>a(Number(g.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:ke.sliderValue,children:o})]}),l.jsxs("div",{className:ke.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:ke.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:ke.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:ke.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:ke.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:g=>i(g.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:ke.modalFooter,children:[l.jsx(Ae,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Ae,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function cf(e,t){return function(){return e.apply(t,arguments)}}const{toString:yv}=Object.prototype,{getPrototypeOf:$n}=Object,{iterator:zs,toStringTag:uf}=Symbol,ki=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Os=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),ki(r,t))return!0;r=$n(r)}return!1},vv=(e,t)=>e!=null&&Os(e,t)?e[t]:void 0,rl=(e=>t=>{const r=yv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Yt=e=>(e=e.toLowerCase(),t=>rl(t)===e),Ji=e=>t=>typeof t===e,{isArray:an}=Array,Bn=Ji("undefined");function Qn(e){return e!==null&&!Bn(e)&&e.constructor!==null&&!Bn(e.constructor)&&It(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const df=Yt("ArrayBuffer");function bv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&df(e.buffer),t}const _v=Ji("string"),It=Ji("function"),ff=Ji("number"),Gn=e=>e!==null&&typeof e=="object",wv=e=>e===!0||e===!1,hi=e=>{if(!Gn(e))return!1;const t=$n(e);return(t===null||t===Object.prototype||$n(t)===null)&&!Os(e,uf)&&!Os(e,zs)},Sv=e=>{if(!Gn(e)||Qn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},xv=Yt("Date"),Cv=Yt("File"),Ev=e=>!!(e&&typeof e.uri<"u"),Ov=e=>e&&typeof e.getParts<"u",Dv=Yt("Blob"),Iv=Yt("FileList"),Tv=e=>Gn(e)&&It(e.pipe);function Nv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const ac=Nv(),lc=typeof ac.FormData<"u"?ac.FormData:void 0,jv=e=>{if(!e)return!1;if(lc&&e instanceof lc)return!0;const t=$n(e);if(!t||t===Object.prototype||!It(e.append))return!1;const r=rl(e);return r==="formdata"||r==="object"&&It(e.toString)&&e.toString()==="[object FormData]"},Rv=Yt("URLSearchParams"),[kv,Av,Pv,Mv]=["ReadableStream","Request","Response","Headers"].map(Yt),Lv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Vs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),an(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Qn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function hf(e,t){if(Qn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Wr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,pf=e=>!Bn(e)&&e!==Wr;function ya(...e){const{caseless:t,skipUndefined:r}=pf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&hf(n,o)||o,c=ki(n,a)?n[a]:void 0;hi(c)&&hi(i)?n[a]=ya(c,i):hi(i)?n[a]=ya({},i):an(i)?n[a]=i.slice():(!r||!Bn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Qn(a)||(Vs(a,s),typeof a!="object"||an(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];Gv.call(a,u)&&s(a[u],u)}}return n}const Fv=(e,t,r,{allOwnKeys:n}={})=>(Vs(t,(s,i)=>{r&&It(s)?Object.defineProperty(e,i,{__proto__:null,value:cf(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),$v=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Bv=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},Uv=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&$n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},zv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},Vv=e=>{if(!e)return null;if(an(e))return e;let t=e.length;if(!ff(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},qv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&$n(Uint8Array)),Hv=(e,t)=>{const n=(e&&e[zs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Wv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Kv=Yt("HTMLFormElement"),Qv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Gv}=Object.prototype,Yv=Yt("RegExp"),gf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Vs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Xv=e=>{gf(e,(t,r)=>{if(It(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(It(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Zv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return an(e)?n(e):n(String(e).split(t)),r},Jv=()=>{},eb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function tb(e){return!!(e&&It(e.append)&&e[uf]==="FormData"&&e[zs])}const rb=e=>{const t=new WeakSet,r=n=>{if(Gn(n)){if(t.has(n))return;if(Qn(n))return n;if(!("toJSON"in n)){t.add(n);const s=an(n)?[]:{};return Vs(n,(i,o)=>{const a=r(i);!Bn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},nb=Yt("AsyncFunction"),sb=e=>e&&(Gn(e)||It(e))&&It(e.then)&&It(e.catch),mf=((e,t)=>e?setImmediate:t?((r,n)=>(Wr.addEventListener("message",({source:s,data:i})=>{s===Wr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Wr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",It(Wr.postMessage)),ib=typeof queueMicrotask<"u"?queueMicrotask.bind(Wr):typeof process<"u"&&process.nextTick||mf,yf=e=>e!=null&&It(e[zs]),ob=e=>e!=null&&Os(e,zs)&&yf(e),D={isArray:an,isArrayBuffer:df,isBuffer:Qn,isFormData:jv,isArrayBufferView:bv,isString:_v,isNumber:ff,isBoolean:wv,isObject:Gn,isPlainObject:hi,isEmptyObject:Sv,isReadableStream:kv,isRequest:Av,isResponse:Pv,isHeaders:Mv,isUndefined:Bn,isDate:xv,isFile:Cv,isReactNativeBlob:Ev,isReactNative:Ov,isBlob:Dv,isRegExp:Yv,isFunction:It,isStream:Tv,isURLSearchParams:Rv,isTypedArray:qv,isFileList:Iv,forEach:Vs,merge:ya,extend:Fv,trim:Lv,stripBOM:$v,inherits:Bv,toFlatObject:Uv,kindOf:rl,kindOfTest:Yt,endsWith:zv,toArray:Vv,forEachEntry:Hv,matchAll:Wv,isHTMLForm:Kv,hasOwnProperty:ki,hasOwnProp:ki,hasOwnInPrototypeChain:Os,getSafeProp:vv,reduceDescriptors:gf,freezeMethods:Xv,toObjectSet:Zv,toCamelCase:Qv,noop:Jv,toFiniteNumber:eb,findKey:hf,global:Wr,isContextDefined:pf,isSpecCompliantForm:tb,toJSONObject:rb,isAsyncFn:nb,isThenable:sb,setImmediate:mf,asap:ib,isIterable:yf,isSafeIterable:ob},ab=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),lb=e=>{const t={};let r,n,s;return e&&e.split(`
449
+ `).forEach(function(o){s=o.indexOf(":"),r=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!r||t[r]&&ab[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function cb(e){let t=0,r=e.length;for(;t<r;){const n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;r>t;){const n=e.charCodeAt(r-1);if(n!==9&&n!==32)break;r-=1}return t===0&&r===e.length?e:e.slice(t,r)}const ub=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),db=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function nl(e,t){return D.isArray(e)?e.map(r=>nl(r,t)):cb(String(e).replace(t,""))}const fb=e=>nl(e,ub),hb=e=>nl(e,db);function vf(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=hb(r)}),t}const cc=Symbol("internals");function ts(e){return e&&String(e).trim().toLowerCase()}function pi(e){return e===!1||e==null?e:D.isArray(e)?e.map(pi):fb(String(e))}function pb(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const gb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function So(e,t,r,n,s){if(D.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!D.isString(t)){if(D.isString(n))return t.indexOf(n)!==-1;if(D.isRegExp(n))return n.test(t)}}function mb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function yb(e,t){const r=D.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(s,i,o){return this[n].call(this,t,s,i,o)},configurable:!0})})}let bt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=ts(c);if(!u)return;const f=D.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=pi(a))}const o=(a,c)=>D.forEach(a,(d,u)=>i(d,u,c));if(D.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(D.isString(t)&&(t=t.trim())&&!gb(t))o(lb(t),r);else if(D.isObject(t)&&D.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!D.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],D.hasOwnProp(a,d)?(c=a[d],a[d]=D.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=ts(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return pb(s);if(D.isFunction(r))return r.call(this,s,n);if(D.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ts(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||So(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=ts(o),o){const a=D.findKey(n,o);a&&(!r||So(n,n[a],a,r))&&(delete n[a],s=!0)}}return D.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||So(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return D.forEach(this,(s,i)=>{const o=D.findKey(n,i);if(o){r[o]=pi(s),delete r[i];return}const a=t?mb(i):String(i).trim();a!==i&&delete r[i],r[a]=pi(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return D.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&D.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
450
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[cc]=this[cc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ts(o);n[a]||(yb(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};bt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);D.reduceDescriptors(bt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});D.freezeMethods(bt);const vb="[REDACTED ****]";function bb(e){if(D.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(D.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function _b(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||D.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof bt&&(i=i.toJSON()),n.push(i);let o;if(D.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);D.isUndefined(d)||(o[c]=d)});else{if(!D.isPlainObject(i)&&bb(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?vb:s(c);D.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let X=class bf extends Error{static from(t,r,n,s,i,o){const a=new bf(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&D.hasOwnProp(t,"redact")?t.redact:void 0,n=D.isArray(r)&&r.length>0?_b(t,r):D.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};X.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";X.ERR_BAD_OPTION="ERR_BAD_OPTION";X.ECONNABORTED="ECONNABORTED";X.ETIMEDOUT="ETIMEDOUT";X.ECONNREFUSED="ECONNREFUSED";X.ERR_NETWORK="ERR_NETWORK";X.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";X.ERR_DEPRECATED="ERR_DEPRECATED";X.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";X.ERR_BAD_REQUEST="ERR_BAD_REQUEST";X.ERR_CANCELED="ERR_CANCELED";X.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";X.ERR_INVALID_URL="ERR_INVALID_URL";X.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const wb=null,_f=100;function va(e){return D.isPlainObject(e)||D.isArray(e)}function wf(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function xo(e,t,r){return e?e.concat(t).map(function(s,i){return s=wf(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Sb(e){return D.isArray(e)&&!e.some(va)}const xb=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function eo(e,t,r){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,S){return!D.isUndefined(S[_])});const n=r.metaTokens,s=r.visitor||b,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?_f:r.maxDepth,d=a&&D.isSpecCompliantForm(t),u=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(D.isDate(v))return v.toISOString();if(D.isBoolean(v))return v.toString();if(!d&&D.isBlob(v))throw new X("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(v)||D.isTypedArray(v)?d&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function g(v){if(v>c)throw new X("Object is too deeply nested ("+v+" levels). Max depth: "+c,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(v,_){if(c===1/0)return JSON.stringify(v);const S=[];return JSON.stringify(v,function(C,I){if(!D.isObject(I))return I;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(I),g(_+S.length-1),I})}function b(v,_,S){let w=v;if(D.isReactNative(t)&&D.isReactNativeBlob(v))return t.append(xo(S,_,i),f(v)),!1;if(v&&!S&&typeof v=="object"){if(D.endsWith(_,"{}"))_=n?_:_.slice(0,-2),v=m(v,1);else if(D.isArray(v)&&Sb(v)||(D.isFileList(v)||D.endsWith(_,"[]"))&&(w=D.toArray(v)))return _=wf(_),w.forEach(function(I,j){!(D.isUndefined(I)||I===null)&&t.append(o===!0?xo([_],j,i):o===null?_:_+"[]",f(I))}),!1}return va(v)?!0:(t.append(xo(S,_,i),f(v)),!1)}const h=Object.assign(xb,{defaultVisitor:b,convertValue:f,isVisitable:va});function y(v,_,S=0){if(!D.isUndefined(v)){if(g(S),u.indexOf(v)!==-1)throw new Error("Circular reference detected in "+_.join("."));u.push(v),D.forEach(v,function(C,I){(!(D.isUndefined(C)||C===null)&&s.call(t,C,D.isString(I)?I.trim():I,_,h))===!0&&y(C,_?_.concat(I):[I],S+1)}),u.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return y(e),t}function uc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function sl(e,t){this._pairs=[],e&&eo(e,this,t)}const Sf=sl.prototype;Sf.append=function(t,r){this._pairs.push([t,r])};Sf.toString=function(t){const r=t?function(n){return t.call(this,n,uc)}:uc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Cb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xf(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||Cb,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new sl(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class dc{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){D.forEach(this.handlers,function(n){n!==null&&t(n)})}}const il={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Eb=typeof URLSearchParams<"u"?URLSearchParams:sl,Ob=typeof FormData<"u"?FormData:null,Db=typeof Blob<"u"?Blob:null,Ib={isBrowser:!0,classes:{URLSearchParams:Eb,FormData:Ob,Blob:Db},protocols:["http","https","file","blob","url","data"]},ol=typeof window<"u"&&typeof document<"u",ba=typeof navigator=="object"&&navigator||void 0,Tb=ol&&(!ba||["ReactNative","NativeScript","NS"].indexOf(ba.product)<0),Nb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jb=ol&&window.location.href||"http://localhost",Rb=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ol,hasStandardBrowserEnv:Tb,hasStandardBrowserWebWorkerEnv:Nb,navigator:ba,origin:jb},Symbol.toStringTag,{value:"Module"})),ut={...Rb,...Ib};function kb(e,t){return eo(e,new ut.classes.URLSearchParams,{visitor:function(r,n,s,i){return ut.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const fc=_f;function Cf(e){if(e>fc)throw new X("FormData field is too deeply nested ("+e+" levels). Max depth: "+fc,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Ab(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Cf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function Pb(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function Ef(e){function t(r,n,s,i){Cf(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&D.isArray(s)?s.length:o,c?(D.hasOwnProp(s,o)?s[o]=D.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!D.hasOwnProp(s,o)||!D.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&D.isArray(s[o])&&(s[o]=Pb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(Ab(n),s,r,0)}),r}return null}const pn=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function Mb(e,t,r){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const qs={transitional:il,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=D.isObject(t);if(i&&D.isHTMLForm(t)&&(t=new FormData(t)),D.isFormData(t))return s?JSON.stringify(Ef(t)):t;if(D.isArrayBuffer(t)||D.isBuffer(t)||D.isStream(t)||D.isFile(t)||D.isBlob(t)||D.isReadableStream(t))return t;if(D.isArrayBufferView(t))return t.buffer;if(D.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=pn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return kb(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=pn(this,"env"),u=d&&d.FormData;return eo(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),Mb(t)):t}],transformResponse:[function(t){const r=pn(this,"transitional")||qs.transitional,n=r&&r.forcedJSONParsing,s=pn(this,"responseType"),i=s==="json";if(D.isResponse(t)||D.isReadableStream(t))return t;if(t&&D.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,pn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?X.from(c,X.ERR_BAD_RESPONSE,this,null,pn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ut.classes.FormData,Blob:ut.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch","query"],e=>{qs.headers[e]={}});function Co(e,t){const r=this||qs,n=t||r,s=bt.from(n.headers);let i=n.data;return D.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Of(e){return!!(e&&e.__CANCEL__)}let Hs=class extends X{constructor(t,r,n){super(t??"canceled",X.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Df(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new X("Request failed with status code "+r.status,r.status>=400&&r.status<500?X.ERR_BAD_REQUEST:X.ERR_BAD_RESPONSE,r.config,r.request,r))}function Lb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Fb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,g=0;for(;f!==s;)g+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const m=u&&d-u;return m?Math.round(g*1e3/m):void 0}}function $b(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Ai=(e,t,r=3)=>{let n=0;const s=Fb(50,250);return $b(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},hc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},pc=e=>(...t)=>D.asap(()=>e(...t)),Bb=ut.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,ut.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(ut.origin),ut.navigator&&/(msie|trident)/i.test(ut.navigator.userAgent)):()=>!0,Ub=ut.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];D.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),D.isString(n)&&a.push(`path=${n}`),D.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),D.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),s=n.indexOf("=");if(s!==-1&&n.slice(0,s)===e)return decodeURIComponent(n.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function zb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Vb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const qb=/^https?:(?!\/\/)/i,Hb=/[\t\n\r]/g;function Wb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Kb(e){return Wb(e).replace(Hb,"")}function gc(e,t){if(typeof e=="string"&&qb.test(Kb(e)))throw new X('Invalid URL: missing "//" after protocol',X.ERR_INVALID_URL,t)}function If(e,t,r,n){gc(t,n);let s=!zb(t);return e&&(s||r===!1)?(gc(e,n),Vb(e,t)):t}const mc=e=>e instanceof bt?{...e}:e;function ln(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,g,m){return D.isPlainObject(u)&&D.isPlainObject(f)?D.merge.call({caseless:m},u,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(u,f,g,m){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u,g,m)}else return n(u,f,g,m)}function i(u,f){if(!D.isUndefined(f))return n(void 0,f)}function o(u,f){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=D.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!D.isUndefined(f))if(D.isPlainObject(f)){if(D.hasOwnProp(f,u))return f[u]}else return;const g=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(g)&&D.hasOwnProp(g,u))return g[u]}function c(u,f,g){if(D.hasOwnProp(t,g))return n(u,f);if(D.hasOwnProp(e,g))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,g)=>s(mc(u),mc(f),g,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const g=D.hasOwnProp(d,f)?d[f]:s,m=D.hasOwnProp(e,f)?e[f]:void 0,b=D.hasOwnProp(t,f)?t[f]:void 0,h=g(m,b,f);D.isUndefined(h)&&g!==c||(r[f]=h)}),D.hasOwnProp(t,"validateStatus")&&D.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(D.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Qb=["content-type","content-length"];function Gb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Qb.includes(n.toLowerCase())&&e.set(n,s)})}const Yb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Tf(e){const t=ln({},e),r=g=>D.hasOwnProp(t,g)?t[g]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=bt.from(a),t.url=xf(If(d,f,u,t),r("params"),r("paramsSerializer")),c){const g=D.getSafeProp(c,"username")||"",m=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(m?Yb(m):"")))}if(D.isFormData(n)&&(ut.hasStandardBrowserEnv||ut.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&Gb(a,n.getHeaders(),r("formDataHeaderPolicy"))),ut.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&Bb(t.url))){const m=i&&o&&Ub.read(o);m&&a.set(i,m)}return t}const Xb=typeof XMLHttpRequest<"u",Zb=Xb&&function(e){return new Promise(function(r,n){const s=Tf(e);let i=s.data;const o=bt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,g,m,b;function h(){m&&m(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const S=bt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:S,config:e,request:y};Df(function(j){r(j),h()},function(j){n(j),h()},C),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new X("Request aborted",X.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(w){const C=w&&w.message?w.message:"Network Error",I=new X(C,X.ERR_NETWORK,e,y);I.event=w||null,n(I),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||il;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new X(w,C.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&D.forEach(vf(o),function(w,C){y.setRequestHeader(C,w)}),D.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([g,b]=Ai(d,!0),y.addEventListener("progress",g)),c&&y.upload&&([f,m]=Ai(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(u=S=>{y&&(n(!S||S.type?new Hs(null,e,y):S),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const _=Lb(s.url);if(_&&!ut.protocols.includes(_)){n(new X("Unsupported protocol "+_+":",X.ERR_BAD_REQUEST,e));return}y.send(i||null)})},Jb=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof X?d:new Hs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new X(`timeout of ${t}ms exceeded`,X.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>D.asap(o),a},e_=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,s;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},t_=async function*(e,t){for await(const r of r_(e))yield*e_(r,t)},r_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},yc=(e,t,r,n)=>{const s=t_(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let g=i+=f;r(g)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Pi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,n_=(e,t,r)=>t+2<r&&Pi(e.charCodeAt(t+1))&&Pi(e.charCodeAt(t+2));function s_(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let m=0;m<a;m++)if(n.charCodeAt(m)===37&&m+2<a){const b=n.charCodeAt(m+1),h=n.charCodeAt(m+2);Pi(b)&&Pi(h)&&(o-=2,m+=2)}let c=0,d=a-1;const u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const g=Math.floor(o/4)*3-(c||0);return g>0?g:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&n_(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const al="1.18.0",vc=64*1024,{isFunction:Zs}=D,i_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),bc=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},_c=(e,...t)=>{try{return!!e(...t)}catch{return!1}},o_=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},a_=e=>{const t=D.global!==void 0&&D.global!==null?D.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=D.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Zs(s):typeof fetch=="function",c=Zs(i),d=Zs(o);if(!a)return!1;const u=a&&Zs(r),f=a&&(typeof n=="function"?(v=>_=>v.encode(_))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),g=c&&u&&_c(()=>{let v=!1;const _=new i(ut.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),S=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),v&&!S}),m=d&&u&&_c(()=>D.isReadableStream(new o("").body)),b={stream:m&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!b[v]&&(b[v]=(_,S)=>{let w=_&&_[v];if(w)return w.call(_);throw new X(`Response type '${v}' is not supported`,X.ERR_NOT_SUPPORT,S)})});const h=async v=>{if(v==null)return 0;if(D.isBlob(v))return v.size;if(D.isSpecCompliantForm(v))return(await new i(ut.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(D.isArrayBufferView(v)||D.isArrayBuffer(v))return v.byteLength;if(D.isURLSearchParams(v)&&(v=v+""),D.isString(v))return(await f(v)).byteLength},y=async(v,_)=>{const S=D.toFiniteNumber(v.getContentLength());return S??h(_)};return async v=>{let{url:_,method:S,data:w,signal:C,cancelToken:I,timeout:j,onDownloadProgress:k,onUploadProgress:L,responseType:N,headers:A,withCredentials:$="same-origin",fetchOptions:R,maxContentLength:F,maxBodyLength:M}=Tf(v);const Z=D.isNumber(F)&&F>-1,ae=D.isNumber(M)&&M>-1,ve=K=>D.hasOwnProp(v,K)?v[K]:void 0;let we=s||fetch;N=N?(N+"").toLowerCase():"text";let he=Jb([C,I&&I.toAbortSignal()],j),W=null;const J=he&&he.unsubscribe&&(()=>{he.unsubscribe()});let se,B=null;const Y=()=>new X("Request body larger than maxBodyLength limit",X.ERR_BAD_REQUEST,v,W);try{let K;const ue=ve("auth");if(ue){const ee=D.getSafeProp(ue,"username")||"",ze=D.getSafeProp(ue,"password")||"";K={username:ee,password:ze}}if(o_(_)){const ee=new URL(_,ut.origin);if(!K&&(ee.username||ee.password)){const ze=bc(ee.username),Xe=bc(ee.password);K={username:ze,password:Xe}}(ee.username||ee.password)&&(ee.username="",ee.password="",_=ee.href)}if(K&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(i_((K.username||"")+":"+(K.password||""))))),Z&&typeof _=="string"&&_.startsWith("data:")&&s_(_)>F)throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W);if(ae&&S!=="get"&&S!=="head"){const ee=await h(w);if(typeof ee=="number"&&isFinite(ee)&&(se=ee,ee>M))throw Y()}const Se=ae&&(D.isReadableStream(w)||D.isStream(w)),Me=(ee,ze,Xe)=>yc(ee,vc,q=>{if(ae&&q>M)throw B=Y();ze&&ze(q)},Xe);if(g&&S!=="get"&&S!=="head"&&(L||Se)){if(se=se??await y(A,w),se!==0||Se){let ee=new i(_,{method:"POST",body:w,duplex:"half"}),ze;if(D.isFormData(w)&&(ze=ee.headers.get("content-type"))&&A.setContentType(ze),ee.body){const[Xe,q]=L&&hc(se,Ai(pc(L)))||[];w=Me(ee.body,Xe,q)}}}else if(Se&&!c&&u&&S!=="get"&&S!=="head")w=Me(w);else if(Se&&c&&!g&&S!=="get"&&S!=="head")throw new X("Stream request bodies are not supported by the current fetch implementation",X.ERR_NOT_SUPPORT,v,W);D.isString($)||($=$?"include":"omit");const me=c&&"credentials"in i.prototype;if(D.isFormData(w)){const ee=A.getContentType();ee&&/^multipart\/form-data/i.test(ee)&&!/boundary=/i.test(ee)&&A.delete("content-type")}A.set("User-Agent","axios/"+al,!1);const le={...R,signal:he,method:S.toUpperCase(),headers:vf(A.normalize()),body:w,duplex:"half",credentials:me?$:void 0};W=c&&new i(_,le);let pe=await(c?we(W,R):we(_,le));const Re=bt.from(pe.headers);if(Z){const ee=D.toFiniteNumber(Re.getContentLength());if(ee!=null&&ee>F)throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W)}const Ue=m&&(N==="stream"||N==="response");if(m&&pe.body&&(k||Z||Ue&&J)){const ee={};["status","statusText","headers"].forEach(We=>{ee[We]=pe[We]});const ze=D.toFiniteNumber(Re.getContentLength()),[Xe,q]=k&&hc(ze,Ai(pc(k),!0))||[];let re=0;const ie=We=>{if(Z&&(re=We,re>F))throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W);Xe&&Xe(We)};pe=new o(yc(pe.body,vc,ie,()=>{q&&q(),J&&J()}),ee)}N=N||"text";let De=await b[D.findKey(b,N)||"text"](pe,v);if(Z&&!m&&!Ue){let ee;if(De!=null&&(typeof De.byteLength=="number"?ee=De.byteLength:typeof De.size=="number"?ee=De.size:typeof De=="string"&&(ee=typeof n=="function"?new n().encode(De).byteLength:De.length)),typeof ee=="number"&&ee>F)throw new X("maxContentLength size of "+F+" exceeded",X.ERR_BAD_RESPONSE,v,W)}return!Ue&&J&&J(),await new Promise((ee,ze)=>{Df(ee,ze,{data:De,headers:bt.from(pe.headers),status:pe.status,statusText:pe.statusText,config:v,request:W})})}catch(K){if(J&&J(),he&&he.aborted&&he.reason instanceof X){const ue=he.reason;throw ue.config=v,W&&(ue.request=W),K!==ue&&(ue.cause=K),ue}throw B?(W&&!B.request&&(B.request=W),B):K instanceof X?(W&&!K.request&&(K.request=W),K):K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new X("Network Error",X.ERR_NETWORK,v,W,K&&K.response),{cause:K.cause||K}):X.from(K,K&&K.code,v,W,K&&K.response)}}},l_=new Map,Nf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=l_;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:a_(t)),u=d;return d};Nf();const ll={http:wb,xhr:Zb,fetch:{get:Nf}};D.forEach(ll,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const wc=e=>`- ${e}`,c_=e=>D.isFunction(e)||e===null||e===!1;function u_(e,t){e=D.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!c_(n)&&(s=ll[(a=String(n)).toLowerCase()],s===void 0))throw new X(`Unknown adapter '${a}'`);if(s&&(D.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
+ `+o.map(wc).join(`
452
+ `):" "+wc(o[0]):"as no adapter specified";throw new X("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const jf={getAdapter:u_,adapters:ll};function Eo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Hs(null,e)}function Sc(e){return Eo(e),e.headers=bt.from(e.headers),e.data=Co.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),jf.getAdapter(e.adapter||qs.adapter,e)(e).then(function(n){Eo(e),e.response=n;try{n.data=Co.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=bt.from(n.headers),n},function(n){if(!Of(n)&&(Eo(e),n&&n.response)){e.response=n.response;try{n.response.data=Co.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=bt.from(n.response.headers)}return Promise.reject(n)})}const to={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{to[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const xc={};to.transitional=function(t,r,n){function s(i,o){return"[Axios v"+al+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new X(s(o," has been removed"+(r?" in "+r:"")),X.ERR_DEPRECATED);return r&&!xc[o]&&(xc[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}};to.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function d_(e,t,r){if(typeof e!="object")throw new X("options must be an object",X.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],c=a===void 0||o(a,i,e);if(c!==!0)throw new X("option "+i+" must be "+c,X.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new X("Unknown option "+i,X.ERR_BAD_OPTION)}}const gi={assertOptions:d_,validators:to},ft=gi.validators;let sn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new dc,response:new dc}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
453
453
  `);return o===-1?"":s.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
454
454
  `),a=o===-1?-1:i.indexOf(`
455
455
  `,o+1),c=a===-1?"":i.slice(a+1);String(n.stack).endsWith(c)||(n.stack+=`
456
- `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=an(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&di.assertOptions(n,{silentJSONParsing:dt.transitional(dt.boolean),forcedJSONParsing:dt.transitional(dt.boolean),clarifyTimeoutError:dt.transitional(dt.boolean),legacyInterceptorReqResOrdering:dt.transitional(dt.boolean),advertiseZstdAcceptEncoding:dt.transitional(dt.boolean),validateStatusUndefinedResolves:dt.transitional(dt.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:di.assertOptions(s,{encode:dt.function,serialize:dt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),di.assertOptions(r,{baseUrl:dt.spelling("baseURL"),withXsrfToken:dt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&D.merge(i.common,i[r.method]);i&&D.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete i[b]}),r.headers=vt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||tl;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,g;if(!c){const b=[vc.bind(this),void 0];for(b.unshift(...a),b.push(...d),g=b.length,u=Promise.resolve(r);f<g;)u=u.then(b[f++],b[f++]);return u}g=a.length;let m=r;for(;f<g;){const b=a[f++],h=a[f++];try{m=b(m)}catch(y){h.call(this,y);break}}try{u=vc.call(this,m)}catch(b){return Promise.reject(b)}for(f=0,g=d.length;f<g;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=an(this.defaults,t);const r=_f(t.baseURL,t.url,t.allowAbsoluteUrls,t);return gf(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){nn.prototype[t]=function(r,n){return this.request(an(n||{},{method:t,url:r,data:n&&D.hasOwnProp(n,"data")?n.data:void 0}))}});D.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(an(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}nn.prototype[t]=r(),t!=="query"&&(nn.prototype[t+"Form"]=r(!0))});let e_=class Cf{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new zs(i,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Cf(function(s){t=s}),cancel:t}}};function t_(e){return function(r){return e.apply(null,r)}}function r_(e){return D.isObject(e)&&e.isAxiosError===!0}const ma={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ma).forEach(([e,t])=>{ma[t]=e});function Of(e){const t=new nn(e),r=ef(nn.prototype.request,t);return D.extend(r,nn.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Of(an(e,s))},r}const Ge=Of(Us);Ge.Axios=nn;Ge.CanceledError=zs;Ge.CancelToken=e_;Ge.isCancel=vf;Ge.VERSION=nl;Ge.toFormData=Yi;Ge.AxiosError=X;Ge.Cancel=Ge.CanceledError;Ge.all=function(t){return Promise.all(t)};Ge.spread=t_;Ge.isAxiosError=r_;Ge.mergeConfig=an;Ge.AxiosHeaders=vt;Ge.formToJSON=e=>yf(D.isHTMLForm(e)?new FormData(e):e);Ge.getAdapter=Sf.getAdapter;Ge.HttpStatusCode=ma;Ge.default=Ge;const{Axios:pk,AxiosError:gk,CanceledError:mk,isCancel:yk,CancelToken:vk,VERSION:bk,all:_k,Cancel:wk,isAxiosError:xk,spread:Sk,toFormData:Ck,AxiosHeaders:Ok,HttpStatusCode:Ek,formToJSON:Dk,getAdapter:Ik,mergeConfig:Tk,create:Nk}=Ge;let ya="";function Ef(e){ya=e}const Le=Ge.create({timeout:3e4});Le.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>My),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),ya&&(e.baseURL=ya),e});const Df=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function n_(e,t={}){var c,d,u,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:Df,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Le.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function s_(e){var r,n,s;return e.length?((s=(n=(r=(await Le.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Df,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}function If(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",o=(r.mimeType??"")==="application/vnd.ekstep.content-collection"||s.toLowerCase().includes("unit")||s.toLowerCase().includes("textbook")||s.toLowerCase().includes("collection")||s.toLowerCase().includes("course")||s.toLowerCase().includes("lesson")||r.visibility==="Parent",a=r.children,c=Array.isArray(a)?a.map(d=>If(d,n)):[];return{id:n,identifier:n,name:r.name??"Untitled",title:r.name??"Untitled",description:r.description,primaryCategory:r.primaryCategory,mimeType:r.mimeType,objectType:s,contentType:r.contentType,visibility:r.visibility,status:r.status,appIcon:r.appIcon,isFolder:o,children:c,metadata:r,parent:t}}async function Tf(e){var s,i,o,a,c,d,u;const t=await Le.get(`/action/content/v3/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=If(r);return{content:r,rootNode:n}}async function i_(e,t,r,n){var i;return((i=(await Le.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function o_(e,t=""){await Le.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function a_(e){var r,n;return(n=(r=(await Le.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function l_(e){await Le.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function c_(e,t){await Le.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function u_(e,t){await Le.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const d_="_container_r27rp_1",f_="_header_r27rp_13",h_="_title_r27rp_22",p_="_closeBtn_r27rp_29",g_="_body_r27rp_45",m_="_label_r27rp_54",y_="_searchSection_r27rp_62",v_="_searchRow_r27rp_68",b_="_searchInput_r27rp_74",__="_searchSpinner_r27rp_89",w_="_resultsList_r27rp_105",x_="_resultItem_r27rp_118",S_="_userInfo_r27rp_133",C_="_userName_r27rp_141",O_="_userEmail_r27rp_150",E_="_userOrg_r27rp_158",D_="_noResults_r27rp_167",I_="_collabSection_r27rp_174",T_="_sectionTitle_r27rp_179",N_="_badge_r27rp_189",j_="_emptyCollab_r27rp_203",R_="_collabList_r27rp_214",k_="_collabItem_r27rp_223",A_="_userAvatar_r27rp_237",P_="_error_r27rp_251",M_="_success_r27rp_257",L_="_footer_r27rp_263",Oe={container:d_,header:f_,title:h_,closeBtn:p_,body:g_,label:m_,searchSection:y_,searchRow:v_,searchInput:b_,searchSpinner:__,resultsList:w_,resultItem:x_,userInfo:S_,userName:C_,userEmail:O_,userOrg:E_,noResults:D_,collabSection:I_,sectionTitle:T_,badge:N_,emptyCollab:j_,collabList:R_,collabItem:k_,userAvatar:A_,error:P_,success:M_,footer:L_},F_=({contentId:e,onClose:t})=>{var k,L;const r=oe(N=>N.editorConfig),n=(k=r==null?void 0:r.context)==null?void 0:k.channel,s=(L=r==null?void 0:r.config)==null?void 0:L.objectType,[i,o]=p.useState(""),[a,c]=p.useState([]),[d,u]=p.useState(!1),[f,g]=p.useState([]),[m,b]=p.useState(!1),[h,y]=p.useState(""),[v,_]=p.useState(!1),x=p.useRef(null);p.useEffect(()=>{let N=!1;return(async()=>{try{const A=await a_(e),$=(A==null?void 0:A.collaborators)??[];if(!$.length)return;const R=await s_($);if(N)return;const F=$.map(M=>R.find(Z=>Z.identifier===M)??{identifier:M,firstName:M});g(F)}catch{}})(),()=>{N=!0}},[e]),p.useEffect(()=>{x.current&&clearTimeout(x.current);const N=i.trim();if(N.length<2){c([]);return}return x.current=setTimeout(async()=>{u(!0);try{const A=await n_(N,{rootOrgId:n,objectType:s}),$=new Set(f.map(R=>R.identifier));c(A.filter(R=>!$.has(R.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{x.current&&clearTimeout(x.current)}},[i,f,n,s]);const w=p.useCallback(N=>{g(A=>A.find($=>$.identifier===N.identifier)?A:[...A,N]),c(A=>A.filter($=>$.identifier!==N.identifier)),_(!1)},[]),C=p.useCallback(N=>{g(A=>A.filter($=>$.identifier!==N)),_(!1)},[]),I=p.useCallback(async()=>{b(!0),y(""),_(!1);try{await u_(e,f.map(N=>N.identifier)),_(!0)}catch{y("Failed to save collaborators. Please try again.")}finally{b(!1)}},[e,f]),j=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return l.jsxs("div",{className:Oe.container,children:[l.jsxs("div",{className:Oe.header,children:[l.jsx("h2",{className:Oe.title,children:"Manage Collaborators"}),l.jsx("button",{className:Oe.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Oe.body,children:[l.jsxs("div",{className:Oe.searchSection,children:[l.jsx("label",{className:Oe.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Oe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Oe.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:Oe.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Oe.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var A,$,R,F;return l.jsxs("li",{className:Oe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Oe.userInfo,children:[l.jsx("span",{className:Oe.userName,children:j(N)}),N.email&&l.jsx("span",{className:Oe.userEmail,children:N.email}),((($=(A=N.organisations)==null?void 0:A[0])==null?void 0:$.orgName)??N.rootOrgName)&&l.jsx("span",{className:Oe.userOrg,children:((F=(R=N.organisations)==null?void 0:R[0])==null?void 0:F.orgName)??N.rootOrgName})]}),l.jsx(ke,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Oe.noResults,children:"No users found."})]}),l.jsxs("div",{className:Oe.collabSection,children:[l.jsxs("h3",{className:Oe.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Oe.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Oe.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Oe.collabList,children:f.map(N=>{var A,$,R,F;return l.jsxs("li",{className:Oe.collabItem,children:[l.jsx("div",{className:Oe.userAvatar,"aria-hidden":"true",children:j(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:Oe.userInfo,children:[l.jsx("span",{className:Oe.userName,children:j(N)}),N.email&&l.jsx("span",{className:Oe.userEmail,children:N.email}),((($=(A=N.organisations)==null?void 0:A[0])==null?void 0:$.orgName)??N.rootOrgName)&&l.jsx("span",{className:Oe.userOrg,children:((F=(R=N.organisations)==null?void 0:R[0])==null?void 0:F.orgName)??N.rootOrgName})]}),l.jsx(ke,{variant:"danger",size:"sm",onClick:()=>C(N.identifier),children:"Remove"})]},N.identifier)})})]}),h&&l.jsx("p",{className:Oe.error,role:"alert",children:h}),v&&l.jsx("p",{className:Oe.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Oe.footer,children:[l.jsx(ke,{variant:"ghost",onClick:t,disabled:m,children:"Cancel"}),l.jsx(ke,{variant:"primary",isLoading:m,onClick:I,children:"Save"})]})]})};async function $_(e){return(await Le.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function B_(e,t){var s;const n=((s=(await Le.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:s.result)??{};return{processId:n.processId??"",reservedDialcodes:n.reservedDialcodes??{}}}async function U_(e){var n;const r=((n=(await Le.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const z_="_topbar_zj8wk_1",V_="_left_zj8wk_15",q_="_right_zj8wk_23",H_="_backBtn_zj8wk_30",W_="_title_zj8wk_49",K_="_statusChip_zj8wk_61",Q_="_savedIndicator_zj8wk_73",G_="_unsaved_zj8wk_83",Y_="_iconBtn_zj8wk_88",X_="_iconBtnLabel_zj8wk_115",Z_="_qrDropdown_zj8wk_119",J_="_qrMenu_zj8wk_123",ew="_reviewBtns_zj8wk_158",tw="_sourcingBtns_zj8wk_167",rw="_modalOverlay_zj8wk_176",nw="_sbOverlay_zj8wk_186",sw="_sbModal_zj8wk_196",iw="_sbModalHeader_zj8wk_207",ow="_sbModalTitle_zj8wk_215",aw="_sbModalClose_zj8wk_222",lw="_sbModalBody_zj8wk_235",cw="_sbLabel_zj8wk_242",uw="_sbTextarea_zj8wk_249",dw="_sbError_zj8wk_266",fw="_sbModalFooter_zj8wk_273",ce={topbar:z_,left:V_,right:q_,backBtn:H_,title:W_,statusChip:K_,savedIndicator:Q_,unsaved:G_,iconBtn:Y_,iconBtnLabel:X_,qrDropdown:Z_,qrMenu:J_,reviewBtns:ew,sourcingBtns:tw,modalOverlay:rw,sbOverlay:nw,sbModal:sw,sbModalHeader:iw,sbModalTitle:ow,sbModalClose:aw,sbModalBody:lw,sbLabel:cw,sbTextarea:uw,sbError:dw,sbModalFooter:fw};function hw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function pw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const _c=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ce.sbModalTitle,children:e}),l.jsx("button",{className:ce.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:ce.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ce.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(ke,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(ke,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},gw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(!1);return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ce.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ce.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(ke,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(ke,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},mw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ce.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ce.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ce.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(ke,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(ke,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},yw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var Pe,me;const a=Ae(le=>le.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=pw(((Pe=a==null?void 0:a.metadata)==null?void 0:Pe.status)??(a==null?void 0:a.status)),u=oe(le=>{var pe,je,Ue,De;return((je=(pe=le.editorConfig)==null?void 0:pe.context)==null?void 0:je.contentId)??((De=(Ue=le.editorConfig)==null?void 0:Ue.context)==null?void 0:De.identifier)??""}),{activeModal:f,modalData:g,closeModal:m,openModal:b}=By(),h=oe(le=>le.buttonLoaders),y=oe(le=>le.categoryMeta),v=!y||y.schemaDefaults.generateDIALCodes!=="No",[_,x]=p.useState(!1),[w,C]=p.useState(!1),[I,j]=p.useState(!1),[k,L]=p.useState(!1),N=p.useRef(null),[A,$]=p.useState(!1);p.useEffect(()=>{if(!k)return;const le=pe=>{var je;(je=N.current)!=null&&je.contains(pe.target)||L(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[k]);const[R,F]=p.useState(!1),[M,Z]=p.useState(!1),{updateNode:ae}=Ae(),ve=(me=a==null?void 0:a.metadata)==null?void 0:me.qrCodeProcessId,we=p.useCallback(async le=>{if(u){$(!1),F(!0);try{const{processId:pe,reservedDialcodes:je}=await B_(u,le);pe&&a&&ae(a.id,{qrCodeProcessId:pe,reservedDialcodes:je}),Ee.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ee.error("Failed to generate QR Codes. Please try again.")}finally{F(!1)}}},[u,a,ae]),he=p.useCallback(async()=>{if(!ve){Ee.error("No QR codes generated yet. Generate QR Codes first.");return}Z(!0);try{const le=await U_(ve);if(le.status==="in-process"){Ee("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const pe=le.url;if(!pe){Ee.error("QR Codes not ready yet. Please wait and try again.");return}const je=await fetch(pe).then(ie=>ie.blob()),Ue=await new Promise(ie=>{const We=new FileReader;We.onloadend=()=>ie(We.result),We.readAsDataURL(je)}),De=(a==null?void 0:a.metadata)??{},ee=ie=>Array.isArray(ie)?ie.join("_"):typeof ie=="string"?ie:"",ze=[u,ee(De.medium),ee(De.gradeLevel),ee(De.subject)].filter(Boolean),Xe=new Date().toISOString().replace(/[:.]/g,"-"),q=`${ze.join("_")}_${Xe}.zip`,re=document.createElement("a");re.href=Ue,re.download=q,re.style.display="none",document.body.appendChild(re),re.click(),document.body.removeChild(re),Ee.success("QR codes downloaded.")}catch{Ee.error("Failed to download QR Codes.")}finally{Z(!1)}},[ve,a,u]),W=e==="edit",J=e==="review",se=e==="sourcingreview",B=e==="read",Y=p.useCallback((le,pe)=>{i({action:le,data:pe})},[i]),K=p.useCallback(()=>{m(),Y("publish")},[m,Y]),ue=p.useCallback((le,pe)=>{const je=g==null?void 0:g.action;m(),je==="approve"?Y("sourcingApprove",{comment:le,score:pe}):Y("reject",{comment:le})},[m,Y,g]),xe=p.useCallback(le=>{x(!1),Y("sendBackForCorrections",{comment:le})},[Y]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ce.topbar,role:"banner",children:[l.jsxs("div",{className:ce.left,children:[l.jsx("button",{className:ce.backBtn,onClick:()=>Y("back"),"aria-label":"Go back",type:"button",children:l.jsx(sy,{size:18})}),l.jsx("h1",{className:ce.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ce.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ce.right,children:[t?l.jsx("span",{className:ce.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ce.savedIndicator} ${ce.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ce.savedIndicator,"aria-live":"polite",children:[l.jsx(Hn,{size:14,"aria-hidden":"true"}),"Saved ",hw(n)]}):null,!B&&!J&&!se&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(ke,{variant:"ghost",size:"sm",onClick:()=>Y("saveCollection"),disabled:!s,children:"Save as Draft"})}),W&&l.jsxs(l.Fragment,{children:[l.jsxs(ke,{variant:"primary",size:"sm",onClick:()=>j(!0),disabled:h.saveCollection,isLoading:h.saveCollection,children:[l.jsx(_y,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ce.iconBtn,onClick:()=>b("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(Sy,{size:16,"aria-hidden":"true"})}),v&&l.jsxs("div",{className:ce.qrDropdown,ref:N,children:[l.jsxs("button",{className:ce.iconBtn,onClick:()=>L(le=>!le),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":k,children:[l.jsx(Kl,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ce.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),k&&l.jsxs("div",{className:ce.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{L(!1),$(!0)},disabled:R,children:[l.jsx(Kl,{size:14}),R?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{L(!1),he()},disabled:M||!ve,children:[l.jsx(cy,{size:14}),M?"Downloading…":"Download QR Codes"]})]})]})]}),J&&l.jsxs("div",{className:ce.reviewBtns,children:[l.jsxs(ke,{variant:"primary",size:"sm",onClick:()=>b("publishChecklist"),disabled:h.publishCollection,isLoading:h.publishCollection,children:[l.jsx(Vd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(ke,{variant:"danger",size:"sm",onClick:()=>C(!0),disabled:h.rejectCollection,isLoading:h.rejectCollection,children:[l.jsx(ca,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(ke,{variant:"ghost",size:"sm",onClick:()=>x(!0),children:[l.jsx(vy,{size:14,"aria-hidden":"true"})," Send Back"]})]}),se&&l.jsxs("div",{className:ce.sourcingBtns,children:[l.jsxs(ke,{variant:"primary",size:"sm",onClick:()=>b("qualityParams",{action:"approve"}),children:[l.jsx(wy,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(ke,{variant:"danger",size:"sm",onClick:()=>b("qualityParams",{action:"reject"}),children:[l.jsx(ca,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(nv,{contentId:u,onConfirm:K,onCancel:m}),f==="qualityParams"&&l.jsx(sv,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:ue,onCancel:m}),f==="manageCollaborators"&&l.jsx("div",{className:ce.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(F_,{contentId:u,onClose:m})}),I&&l.jsx(gw,{onConfirm:()=>{j(!1),Y("sendForReview")},onCancel:()=>j(!1)}),w&&l.jsx(_c,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:le=>{C(!1),Y("reject",{comment:le})},onCancel:()=>C(!1)}),_&&l.jsx(_c,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:xe,onCancel:()=>x(!1)}),A&&l.jsx(mw,{onConfirm:we,onCancel:()=>$(!1)})]})},vw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Ar.createPortal(l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Re.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(ke,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(ke,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(ke,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var bw=Xa();const Nf=p.createContext(null);function It(){const e=p.useContext(Nf);if(e===null)throw new Error("No Tree Api Provided");return e}const jf=p.createContext(null);function _w(){const e=p.useContext(jf);if(e===null)throw new Error("Provide a NodesContext");return e}const Rf=p.createContext(null);function ww(){const e=p.useContext(Rf);if(e===null)throw new Error("Provide a DnDContext");return e}const kf=p.createContext(0);function Af(){p.useContext(kf)}function fi(e,t,r){return Math.max(Math.min(e,r),t)}function Pf(e){return e&&e.isLeaf}function Mf(e){return e&&e.isInternal&&!e.isOpen}function Lf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Ff=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},$f=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function il(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=il(r,t);if(n)return n}return null}function ki(e,t){if(t(e),e.children)for(let r of e.children)ki(r,t)}function Bf(e){const t=zf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=xw(t,n);break}r==null||r.focus()}function Uf(e){const t=zf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Sw(t,n);break}r==null||r.focus()}function xw(e,t){return t+1<e.length?e[t+1]:e[0]}function Sw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function zf(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function cs(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function xn(e){return typeof e=="string"?e:e.id}function Cw(e,...t){if(e)return e(...t)}function Vf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function qf(e){var t,r;const n=e.focusedNode;return n?n.isOpen?0:n.parent?n.childIndex+1:0:(r=(t=e.root.children)===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0}function Hf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const Ow=Object.freeze(Object.defineProperty({__proto__:null,access:cs,bound:fi,dfs:il,focusNextElement:Bf,focusPrevElement:Uf,getInsertIndex:qf,getInsertParentId:Hf,identify:xn,indexOf:$f,isClosed:Mf,isDescendant:Ff,isItem:Pf,isOpenWithEmptyChildren:Lf,safeRun:Cw,waitFor:Vf,walk:ki},Symbol.toStringTag,{value:"Module"})),Ew={display:"flex",alignItems:"center",zIndex:1},Dw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Iw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Tw=p.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},Ew),s),children:[l.jsx("div",{style:Object.assign({},Iw)}),l.jsx("div",{style:Object.assign({},Dw)})]})});function Nw({node:e,attrs:t,innerRef:r,children:n}){return l.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function jw(e){return l.jsxs("div",{ref:e.dragHandle,style:e.style,children:[l.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?l.jsx(kw,Object.assign({},e)):l.jsx(Rw,Object.assign({},e))]})}function Rw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function kw({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const Cs="__REACT_ARBORIST_INTERNAL_ROOT__";function wc(e){var t;function r(i,o,a){const c=e.accessId(i),d=new Os({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new Os({tree:e,id:Cs,data:{id:Cs},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class Os{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===Cs}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Os(Object.assign({},this))}edit(){return this.tree.edit(this)}}function xo(e){return{type:"EDIT",id:e}}function Aw(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function pn(e){return{type:"FOCUS",id:e}}function Pw(){return{type:"TREE_BLUR"}}function Mw(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}const va={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function xc(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function Lw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:xc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:xc(e.unfiltered,t)}):e}const Bn=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:(t=e==null?void 0:e.initialOpenState)!==null&&t!==void 0?t:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},_r={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:xn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(xn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(xn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:xn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:xn(e)})};function Fw(e=Bn().nodes.selection,t){const r=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return t.ids.length===0?e:(t.ids.forEach(n=>r.add(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_REMOVE":return t.ids.length===0?e:(t.ids.forEach(n=>r.delete(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}const Un={cursor(e){return{type:"DND_CURSOR",cursor:e}},dragStart(e,t){return{type:"DND_DRAG_START",id:e,dragIds:t}},dragEnd(){return{type:"DND_DRAG_END"}},hovering(e,t){return{type:"DND_HOVERING",parentId:e,index:t}}};function $w(e=Bn().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return Bn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Bw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Uw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},zw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function Wf({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(Vw,{isDragging:s,children:[l.jsx(qw,{offset:e,children:l.jsx(Ww,{id:r,dragIds:n})}),l.jsx(Hw,{mouse:t,count:n.length})]})}const Vw=p.memo(function(t){return t.isDragging?l.jsx("div",{style:Bw,children:t.children}):null});function qw(e){return l.jsx("div",{className:"row preview",style:Uw(e.offset),children:e.children})}function Hw(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:zw(r),children:t}):null}const Ww=p.memo(function(t){const r=It(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function ba(){return ba=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ba.apply(null,arguments)}function Sc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _a(e,t){return _a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},_a(e,t)}function Kw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_a(e,t)}var Cc=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Qw(e,t){return!!(e===t||Cc(e)&&Cc(t))}function Gw(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Qw(e[r],t[r]))return!1;return!0}function So(e,t){t===void 0&&(t=Gw);var r,n=[],s,i=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return i&&r===this&&t(a,n)||(s=e.apply(this,a),i=!0,r=this,n=a),s}return o}var Yw=typeof performance=="object"&&typeof performance.now=="function",Oc=Yw?function(){return performance.now()}:function(){return Date.now()};function Ec(e){cancelAnimationFrame(e.id)}function Xw(e,t){var r=Oc();function n(){Oc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Co=-1;function Dc(e){if(e===void 0&&(e=!1),Co===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Co=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Co}var gn=null;function Ic(e){if(e===void 0&&(e=!1),gn===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?gn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?gn="negative":gn="positive-ascending"),document.body.removeChild(t),gn}return gn}process.env.NODE_ENV;var Zw=150,Jw=function(t,r){return t},hi=null,pi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(hi=new WeakSet,pi=new WeakSet);function Kf(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){Kw(g,f);function g(b){var h;return h=f.call(this,b)||this,h._instanceProps=c(h.props,Sc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:Sc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=So(function(y,v,_,x){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:_,visibleStopIndex:x})}),h._callOnScroll=void 0,h._callOnScroll=So(function(y,v,_){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:_})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,_=v.direction,x=v.itemSize,w=v.layout,C=h._getItemStyleCache(d&&x,d&&w,d&&_),I;if(C.hasOwnProperty(y))I=C[y];else{var j=r(h.props,y,h._instanceProps),k=s(h.props,y,h._instanceProps),L=_==="horizontal"||w==="horizontal",N=_==="rtl",A=L?j:0;C[y]=I={position:"absolute",left:N?void 0:A,right:N?A:void 0,top:L?0:j,height:L?"100%":k,width:L?k:"100%"}}return I},h._getItemStyleCache=void 0,h._getItemStyleCache=So(function(y,v,_){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,_=v.clientWidth,x=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===x)return null;var I=h.props.direction,j=x;if(I==="rtl")switch(Ic()){case"negative":j=-x;break;case"positive-descending":j=w-_-x;break}return j=Math.max(0,Math.min(j,w-_)),{isScrolling:!0,scrollDirection:C.scrollOffset<j?"forward":"backward",scrollOffset:j,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,_=v.clientHeight,x=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var I=Math.max(0,Math.min(w,x-_));return{isScrolling:!0,scrollDirection:C.scrollOffset<I?"forward":"backward",scrollOffset:I,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&Ec(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=Xw(h._resetIsScrolling,Zw)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}g.getDerivedStateFromProps=function(h,y){return ex(h,y),u(h),null};var m=g.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,_=v.itemCount,x=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,_-1));var C=0;if(this._outerRef){var I=this._outerRef;x==="vertical"?C=I.scrollWidth>I.clientWidth?Dc():0:C=I.scrollHeight>I.clientHeight?Dc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},m.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,_=h.layout;if(typeof v=="number"&&this._outerRef!=null){var x=this._outerRef;y==="horizontal"||_==="horizontal"?x.scrollLeft=v:x.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,_=this.state,x=_.scrollOffset,w=_.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Ic()){case"negative":C.scrollLeft=-x;break;case"positive-ascending":C.scrollLeft=x;break;default:var I=C.clientWidth,j=C.scrollWidth;C.scrollLeft=j-I-x;break}else C.scrollLeft=x;else C.scrollTop=x}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Ec(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,y=h.children,v=h.className,_=h.direction,x=h.height,w=h.innerRef,C=h.innerElementType,I=h.innerTagName,j=h.itemCount,k=h.itemData,L=h.itemKey,N=L===void 0?Jw:L,A=h.layout,$=h.outerElementType,R=h.outerTagName,F=h.style,M=h.useIsScrolling,Z=h.width,ae=this.state.isScrolling,ve=_==="horizontal"||A==="horizontal",we=ve?this._onScrollHorizontal:this._onScrollVertical,he=this._getRangeToRender(),W=he[0],J=he[1],se=[];if(j>0)for(var B=W;B<=J;B++)se.push(p.createElement(y,{data:k,key:N(B,k),index:B,isScrolling:M?ae:void 0,style:this._getItemStyle(B)}));var Y=n(this.props,this._instanceProps);return p.createElement($||R||"div",{className:v,onScroll:we,ref:this._outerRefSetter,style:ba({position:"relative",height:x,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:_},F)},p.createElement(C||I||"div",{children:se,ref:w,style:{height:ve?"100%":Y,pointerEvents:ae?"none":void 0,width:ve?Y:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],_=y[1],x=y[2],w=y[3];this._callOnItemsRendered(v,_,x,w)}}if(typeof this.props.onScroll=="function"){var C=this.state,I=C.scrollDirection,j=C.scrollOffset,k=C.scrollUpdateWasRequested;this._callOnScroll(I,j,k)}},m._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,_=this.state,x=_.isScrolling,w=_.scrollDirection,C=_.scrollOffset;if(y===0)return[0,0,0,0];var I=o(this.props,C,this._instanceProps),j=a(this.props,I,C,this._instanceProps),k=!x||w==="backward"?Math.max(1,v):1,L=!x||w==="forward"?Math.max(1,v):1;return[Math.max(0,I-k),Math.max(0,Math.min(y-1,j+L)),I,j]},g}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var ex=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&pi&&!pi.has(u)&&(pi.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":hi&&!hi.has(u)&&(hi.add(u),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},tx=50,Sn=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},rx=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Qf(t,r,i,0,n):nx(t,r,Math.max(0,i),n)},Qf=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Sn(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},nx=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Sn(t,n,r).offset<s;)n+=o,o*=2;return Qf(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Tc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var d=n-o-1,u=d*i;return a+u},sx=Kf({getItemOffset:function(t,r,n){return Sn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Tc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",g=f?u:c,m=Sn(t,r,i),b=Tc(t,i),h=Math.max(0,Math.min(b-g,m.offset)),y=Math.max(0,m.offset-g+m.size+o);switch(n==="smart"&&(s>=y-g&&s<=h+g?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return rx(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,g=Sn(t,r,s),m=n+f,b=g.offset+g.size,h=r;h<a-1&&b<m;)h++,b+=Sn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||tx,lastMeasuredIndex:-1};return r.resetAfterIndex=function(o,a){a===void 0&&(a=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,o-1),r._getItemStyleCache(-1),a&&r.forceUpdate()},i},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}}),ix=Kf({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.itemCount,u=t.itemSize,f=t.layout,g=t.width,m=a==="horizontal"||f==="horizontal",b=m?g:c,h=Math.max(0,d*u-b),y=Math.min(h,r*u),v=Math.max(0,r*u-b+u+o);switch(n==="smart"&&(s>=v-b&&s<=y+b?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var _=Math.round(v+(y-v)/2);return _<Math.ceil(b/2)?0:_>h+Math.floor(b/2)?h:_}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,g=u?d:i,m=Math.ceil((g+n-f)/a);return Math.max(0,Math.min(o-1,r+m-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function ox(){var e,t;const r=It(),s=ww().cursor;if(!s||s.type!=="line")return null;const i=r.indent,o=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),a=i*s.level,c=r.renderCursor;return l.jsx(c,{top:o,left:a,indent:i})}var ax=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const lx=p.forwardRef(function(t,r){const{children:n}=t,s=ax(t,["children"]),i=It();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(cx,{}),n]}))}),cx=()=>{const e=It();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(ox,{})})};var ux=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const dx=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=ux(t,["style"]);const d=It(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var Gf=p.createContext({dragDropManager:void 0}),Ut;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ut||(Ut={}));function de(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var ol="dnd-core/INIT_COORDS",Zi="dnd-core/BEGIN_DRAG",al="dnd-core/PUBLISH_DRAG_SOURCE",Ji="dnd-core/HOVER",eo="dnd-core/DROP",to="dnd-core/END_DRAG";function Nc(e,t){return{type:ol,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function gi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gi=function(r){return typeof r}:gi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gi(e)}function fx(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function hx(e,t){return e.filter(function(r){return r!==t})}function Yf(e){return gi(e)==="object"}function px(e,t){var r=new Map,n=function(o){r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,o){i===1&&s.push(o)}),s}function gx(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var mx={type:ol,payload:{clientOffset:null,sourceClientOffset:null}};function yx(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(Nc(o)),vx(r,c,d);var u=wx(r,c);if(u===null){e.dispatch(mx);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");bx(a),f=a(u)}e.dispatch(Nc(o,f));var g=d.getSource(u),m=g.beginDrag(c,u);if(m!=null){_x(m),d.pinSource(u);var b=d.getSourceType(u);return{type:Zi,payload:{itemType:b,item:m,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function vx(e,t,r){de(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){de(r.getSource(n),"Expected sourceIds to be registered.")})}function bx(e){de(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function _x(e){de(Yf(e),"Item must be an object.")}function wx(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function xx(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:al}}}function wa(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function Sx(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;Cx(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();Ox(i,o,a);var c=o.getItemType();return Ex(i,a,c),Dx(i,o,a),{type:Ji,payload:{targetIds:i,clientOffset:s||null}}}}function Cx(e){de(Array.isArray(e),"Expected targetIds to be an array.")}function Ox(e,t,r){de(t.isDragging(),"Cannot call hover while not dragging."),de(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];de(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);de(i,"Expected targetIds to be registered.")}}function Ex(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);wa(i,r)||e.splice(n,1)}}function Dx(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function jc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Rc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jc(Object(r),!0).forEach(function(n){Ix(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ix(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tx(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Nx(n);var i=kx(n);i.forEach(function(o,a){var c=jx(o,a,s,n),d={type:eo,payload:{dropResult:Rc(Rc({},r),c)}};e.dispatch(d)})}}function Nx(e){de(e.isDragging(),"Cannot call drop while not dragging."),de(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function jx(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Rx(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Rx(e){de(typeof e>"u"||Yf(e),"Drop result must either be an object or undefined.")}function kx(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ax(e){return function(){var r=e.getMonitor(),n=e.getRegistry();Px(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:to}}}function Px(e){de(e.isDragging(),"Cannot call endDrag while not dragging.")}function Mx(e){return{beginDrag:yx(e),publishDragSource:xx(e),hover:Sx(e),drop:Tx(e),endDrag:Ax(e)}}function Lx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fx(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function $x(e,t,r){return t&&Fx(e.prototype,t),e}function es(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bx=function(){function e(t,r){var n=this;Lx(this,e),es(this,"store",void 0),es(this,"monitor",void 0),es(this,"backend",void 0),es(this,"isSetUp",!1),es(this,"handleRefCountChange",function(){var s=n.store.getState().refCount>0;n.backend&&(s&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!s&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return $x(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=Mx(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Mt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var kc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ac=function(){return Math.random().toString(36).substring(7).split("").join(".")},Pc={INIT:"@@redux/INIT"+Ac(),REPLACE:"@@redux/REPLACE"+Ac()};function Ux(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function zx(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(Hx(e))return"date";if(qx(e))return"error";var r=Vx(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function Vx(e){return typeof e.constructor=="function"?e.constructor.name:null}function qx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Hx(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function mn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=zx(e)),t}function Xf(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Mt(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 t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(1):"Expected the enhancer to be a function. Instead, received: '"+mn(r)+"'");return r(Xf)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(2):"Expected the root reducer to be a function. Instead, received: '"+mn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(4):"Expected the listener to be a function. Instead, received: '"+mn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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.");var y=!0;return d(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(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,d();var _=a.indexOf(h);a.splice(_,1),o=null}}}function g(h){if(!Ux(h))throw new Error(process.env.NODE_ENV==="production"?Mt(7):"Actions must be plain objects. Instead, the actual type was: '"+mn(h)+"'. 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 h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Mt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var _=y[v];_()}return h}function m(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(10):"Expected the nextReducer to be a function. Instead, received: '"+mn(h));s=h,g({type:Pc.REPLACE})}function b(){var h,y=f;return h={subscribe:function(_){if(typeof _!="object"||_===null)throw new Error(process.env.NODE_ENV==="production"?Mt(11):"Expected the observer to be an object. Instead, received: '"+mn(_)+"'");function x(){_.next&&_.next(u())}x();var w=y(x);return{unsubscribe:w}}},h[kc]=function(){return this},h}return g({type:Pc.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:m},n[kc]=b,n}var Wx=function(t,r){return t===r};function Kx(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Qx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wx;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Mc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Lc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mc(Object(r),!0).forEach(function(n){Gx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Gx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Yx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ol:case Zi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Ji:return Kx(e.clientOffset,r.clientOffset)?e:Lc(Lc({},e),{},{clientOffset:r.clientOffset});case to:case eo:return Fc;default:return e}}var ll="dnd-core/ADD_SOURCE",cl="dnd-core/ADD_TARGET",ul="dnd-core/REMOVE_SOURCE",ro="dnd-core/REMOVE_TARGET";function Xx(e){return{type:ll,payload:{sourceId:e}}}function Zx(e){return{type:cl,payload:{targetId:e}}}function Jx(e){return{type:ul,payload:{sourceId:e}}}function eS(e){return{type:ro,payload:{targetId:e}}}function $c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Lt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$c(Object(r),!0).forEach(function(n){tS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$c(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function nS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rS,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Zi:return Lt(Lt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case al:return Lt(Lt({},e),{},{isSourcePublic:!0});case Ji:return Lt(Lt({},e),{},{targetIds:r.targetIds});case ro:return e.targetIds.indexOf(r.targetId)===-1?e:Lt(Lt({},e),{},{targetIds:hx(e.targetIds,r.targetId)});case eo:return Lt(Lt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case to:return Lt(Lt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function sS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ll:case cl:return e+1;case ul:case ro:return e-1;default:return e}}var Ai=[],dl=[];Ai.__IS_NONE__=!0;dl.__IS_ALL__=!0;function iS(e,t){if(e===Ai)return!1;if(e===dl||typeof t>"u")return!0;var r=gx(t,e);return r.length>0}function oS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Ji:break;case ll:case cl:case ro:case ul:return Ai;case Zi:case al:case to:case eo:default:return dl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=px(n,i),a=o.length>0||!Qx(n,i);if(!a)return Ai;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function aS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Bc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Uc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bc(Object(r),!0).forEach(function(n){lS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:oS(e.dirtyHandlerIds,{type:t.type,payload:Uc(Uc({},t.payload),{},{prevTargetIds:fx(e,"dragOperation.targetIds",[])})}),dragOffset:Yx(e.dragOffset,t),refCount:sS(e.refCount,t),dragOperation:nS(e.dragOperation,t),stateId:aS(e.stateId)}}function uS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Zf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function dS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Zf(uS(t,n),r)}function fS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Zf(t,r)}function hS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function gS(e,t,r){return t&&pS(e.prototype,t),e}function zc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var mS=function(){function e(t,r){hS(this,e),zc(this,"store",void 0),zc(this,"registry",void 0),this.store=t,this.registry=r}return gS(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;de(typeof r=="function","listener must be a function."),de(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!iS(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;de(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return de(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(de(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return wa(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(de(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!wa(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return dS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return fS(this.store.getState().dragOffset)}}]),e}(),yS=0;function vS(){return yS++}function mi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mi=function(r){return typeof r}:mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mi(e)}function bS(e){de(typeof e.canDrag=="function","Expected canDrag to be a function."),de(typeof e.beginDrag=="function","Expected beginDrag to be a function."),de(typeof e.endDrag=="function","Expected endDrag to be a function.")}function _S(e){de(typeof e.canDrop=="function","Expected canDrop to be a function."),de(typeof e.hover=="function","Expected hover to be a function."),de(typeof e.drop=="function","Expected beginDrag to be a function.")}function xa(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return xa(r,!1)});return}de(typeof e=="string"||mi(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Vc=typeof global<"u"?global:self,Jf=Vc.MutationObserver||Vc.WebKitMutationObserver;function eh(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function wS(e){let t=1;const r=new Jf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const xS=typeof Jf=="function"?wS:eh;class SS{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=xS(this.flush),this.requestErrorThrow=eh(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class CS{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class OS{create(t){const r=this.freeTasks,n=r.length?r.pop():new CS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const th=new SS,ES=new OS(th.registerPendingError);function DS(e){th.enqueueTask(ES.create(e))}function IS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function NS(e,t,r){return t&&TS(e.prototype,t),e}function yn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jS(e,t){return PS(e)||AS(e,t)||kS(e,t)||RS()}function RS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
457
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kS(e,t){if(e){if(typeof e=="string")return qc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qc(e,t)}}function qc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function AS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function PS(e){if(Array.isArray(e))return e}function MS(e){var t=vS().toString();switch(e){case Ut.SOURCE:return"S".concat(t);case Ut.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Hc(e){switch(e[0]){case"S":return Ut.SOURCE;case"T":return Ut.TARGET;default:de(!1,"Cannot parse handler ID: ".concat(e))}}function Wc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=jS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var LS=function(){function e(t){IS(this,e),yn(this,"types",new Map),yn(this,"dragSources",new Map),yn(this,"dropTargets",new Map),yn(this,"pinnedSourceId",null),yn(this,"pinnedSource",null),yn(this,"store",void 0),this.store=t}return NS(e,[{key:"addSource",value:function(r,n){xa(r),bS(n);var s=this.addHandler(Ut.SOURCE,r,n);return this.store.dispatch(Xx(s)),s}},{key:"addTarget",value:function(r,n){xa(r,!0),_S(n);var s=this.addHandler(Ut.TARGET,r,n);return this.store.dispatch(Zx(s)),s}},{key:"containsHandler",value:function(r){return Wc(this.dragSources,r)||Wc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;de(this.isSourceId(r),"Expected a valid source ID.");var s=n&&r===this.pinnedSourceId,i=s?this.pinnedSource:this.dragSources.get(r);return i}},{key:"getTarget",value:function(r){return de(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return de(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return de(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Hc(r);return n===Ut.SOURCE}},{key:"isTargetId",value:function(r){var n=Hc(r);return n===Ut.TARGET}},{key:"removeSource",value:function(r){var n=this;de(this.getSource(r),"Expected an existing source."),this.store.dispatch(Jx(r)),DS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){de(this.getTarget(r),"Expected an existing target."),this.store.dispatch(eS(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);de(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){de(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=MS(r);return this.types.set(i,n),r===Ut.SOURCE?this.dragSources.set(i,s):r===Ut.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function FS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=$S(n),i=new mS(s,new LS(s)),o=new Bx(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function $S(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Xf(cS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var BS=["children"];function US(e,t){return HS(e)||qS(e,t)||VS(e,t)||zS()}function zS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
458
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VS(e,t){if(e){if(typeof e=="string")return Kc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kc(e,t)}}function Kc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function qS(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function HS(e){if(Array.isArray(e))return e}function WS(e,t){if(e==null)return{};var r=KS(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function KS(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Qc=0,yi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),QS=p.memo(function(t){var r=t.children,n=WS(t,BS),s=GS(n),i=US(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=rh();return++Qc,function(){--Qc===0&&(c[yi]=null)}}},[]),l.jsx(Gf.Provider,Object.assign({value:o},{children:r}),void 0)});function GS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=YS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function YS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:rh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[yi]||(s[yi]={dragDropManager:FS(e,t,r,n)}),s[yi]}function rh(){return typeof global<"u"?global:window}function XS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function JS(e,t,r){return t&&ZS(e.prototype,t),e}function Gc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Oo=!1,Eo=!1,eC=function(){function e(t){XS(this,e),Gc(this,"internalMonitor",void 0),Gc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return JS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){de(!Oo,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Oo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Oo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;de(!Eo,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Eo=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Eo=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function tC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function nC(e,t,r){return t&&rC(e.prototype,t),e}function Yc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Do=!1,sC=function(){function e(t){tC(this,e),Yc(this,"internalMonitor",void 0),Yc(this,"targetId",null),this.internalMonitor=t.getMonitor()}return nC(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;de(!Do,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Do=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Do=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function iC(e){if(typeof e.type!="string"){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function oC(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;iC(s);var i=r?function(o){return e(o,r)}:e;return aC(s,i)}}function nh(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var s=oC(n);t[r]=function(){return s}}}),t}function Xc(e,t){typeof e=="function"?e(t):e.current=t}function aC(e,t){var r=e.ref;return de(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?p.cloneElement(e,{ref:function(s){Xc(r,s),Xc(t,s)}}):p.cloneElement(e,{ref:t})}function vi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?vi=function(r){return typeof r}:vi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},vi(e)}function Sa(e){return e!==null&&vi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ca(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function lC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function uC(e,t,r){return t&&cC(e.prototype,t),e}function ft(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var dC=function(){function e(t){var r=this;lC(this,e),ft(this,"hooks",nh({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Sa(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Sa(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),ft(this,"handlerId",null),ft(this,"dragSourceRef",null),ft(this,"dragSourceNode",void 0),ft(this,"dragSourceOptionsInternal",null),ft(this,"dragSourceUnsubscribe",void 0),ft(this,"dragPreviewRef",null),ft(this,"dragPreviewNode",void 0),ft(this,"dragPreviewOptionsInternal",null),ft(this,"dragPreviewUnsubscribe",void 0),ft(this,"lastConnectedHandlerId",null),ft(this,"lastConnectedDragSource",null),ft(this,"lastConnectedDragSourceOptions",null),ft(this,"lastConnectedDragPreview",null),ft(this,"lastConnectedDragPreviewOptions",null),ft(this,"backend",void 0),this.backend=t}return uC(e,[{key:"receiveHandlerId",value:function(r){this.handlerId!==r&&(this.handlerId=r,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(r){this.dragSourceOptionsInternal=r}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(r){this.dragPreviewOptionsInternal=r}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var r=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(n&&this.disconnectDragSource(),!!this.handlerId){if(!r){this.lastConnectedDragSource=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=r,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,r,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var r=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!Ca(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Ca(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function fC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pC(e,t,r){return t&&hC(e.prototype,t),e}function Jt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gC=function(){function e(t){var r=this;fC(this,e),Jt(this,"hooks",nh({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Sa(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),Jt(this,"handlerId",null),Jt(this,"dropTargetRef",null),Jt(this,"dropTargetNode",void 0),Jt(this,"dropTargetOptionsInternal",null),Jt(this,"unsubscribeDropTarget",void 0),Jt(this,"lastConnectedHandlerId",null),Jt(this,"lastConnectedDropTarget",null),Jt(this,"lastConnectedDropTargetOptions",null),Jt(this,"backend",void 0),this.backend=t}return pC(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var r=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();r&&this.disconnectDropTarget();var n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(r){r!==this.handlerId&&(this.handlerId=r,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(r){this.dropTargetOptionsInternal=r}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!Ca(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function mC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function yC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var ln=typeof window<"u"?p.useLayoutEffect:p.useEffect;function bi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bi=function(r){return typeof r}:bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bi(e)}function vC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _C(e,t,r){return t&&bC(e.prototype,t),e}function Io(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wC=function(){function e(t,r,n){vC(this,e),Io(this,"spec",void 0),Io(this,"monitor",void 0),Io(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return _C(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return bi(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,o=s.isDragging;return o?o(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e}();function xC(e,t,r){var n=p.useMemo(function(){return new wC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function un(){var e=p.useContext(Gf),t=e.dragDropManager;return de(t!=null,"Expected drag drop context"),t}function SC(e){return p.useMemo(function(){var t=e.type;return de(t!=null,"spec.type must be defined"),t},[e])}function CC(e,t){return IC(e)||DC(e,t)||EC(e,t)||OC()}function OC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EC(e,t){if(e){if(typeof e=="string")return Zc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zc(e,t)}}function Zc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function DC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function IC(e){if(Array.isArray(e))return e}function TC(e,t,r){var n=un(),s=xC(e,t,r),i=SC(e);ln(function(){if(i!=null){var a=yC(i,s,n),c=CC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function NC(e){return AC(e)||kC(e)||RC(e)||jC()}function jC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RC(e,t){if(e){if(typeof e=="string")return Oa(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Oa(e,t)}}function kC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function AC(e){if(Array.isArray(e))return Oa(e)}function Oa(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sh(e,t){var r=NC(t||[]);return t==null&&typeof e!="function"&&r.push(e),p.useMemo(function(){return typeof e=="function"?e():e},r)}function PC(){var e=un();return p.useMemo(function(){return new eC(e)},[e])}function MC(e,t){var r=un(),n=p.useMemo(function(){return new dC(r.getBackend())},[r]);return ln(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),ln(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var LC=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r};const FC=Qd(LC);function $C(e,t){return VC(e)||zC(e,t)||UC(e,t)||BC()}function BC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
461
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UC(e,t){if(e){if(typeof e=="string")return Jc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jc(e,t)}}function Jc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function VC(e){if(Array.isArray(e))return e}function ih(e,t,r){var n=p.useState(function(){return t(e)}),s=$C(n,2),i=s[0],o=s[1],a=p.useCallback(function(){var c=t(e);FC(i,c)||(o(c),r&&r())},[i,e,r]);return ln(a),[i,a]}function qC(e,t){return QC(e)||KC(e,t)||WC(e,t)||HC()}function HC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
462
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WC(e,t){if(e){if(typeof e=="string")return eu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eu(e,t)}}function eu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function KC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function QC(e){if(Array.isArray(e))return e}function GC(e,t,r){var n=ih(e,t,r),s=qC(n,2),i=s[0],o=s[1];return ln(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function oh(e,t,r){return GC(t,e||function(){return{}},function(){return r.reconnect()})}function YC(e){return p.useMemo(function(){return e.hooks.dragSource()},[e])}function XC(e){return p.useMemo(function(){return e.hooks.dragPreview()},[e])}function ZC(e,t){var r=sh(e,t);de(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var n=PC(),s=MC(r.options,r.previewOptions);return TC(r,n,s),[oh(r.collect,n,s),YC(s),XC(s)]}function JC(e){var t=e.accept;return p.useMemo(function(){return de(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function e0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r0(e,t,r){return t&&t0(e.prototype,t),e}function tu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n0=function(){function e(t,r){e0(this,e),tu(this,"spec",void 0),tu(this,"monitor",void 0),this.spec=t,this.monitor=r}return r0(e,[{key:"canDrop",value:function(){var r=this.spec,n=this.monitor;return r.canDrop?r.canDrop(n.getItem(),n):!0}},{key:"hover",value:function(){var r=this.spec,n=this.monitor;r.hover&&r.hover(n.getItem(),n)}},{key:"drop",value:function(){var r=this.spec,n=this.monitor;if(r.drop)return r.drop(n.getItem(),n)}}]),e}();function s0(e,t){var r=p.useMemo(function(){return new n0(e,t)},[t]);return p.useEffect(function(){r.spec=e},[e]),r}function i0(e,t){return c0(e)||l0(e,t)||a0(e,t)||o0()}function o0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a0(e,t){if(e){if(typeof e=="string")return ru(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ru(e,t)}}function ru(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function c0(e){if(Array.isArray(e))return e}function u0(e,t,r){var n=un(),s=s0(e,t),i=JC(e);ln(function(){var a=mC(i,s,n),c=i0(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function d0(){var e=un();return p.useMemo(function(){return new sC(e)},[e])}function f0(e){var t=un(),r=p.useMemo(function(){return new gC(t.getBackend())},[t]);return ln(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function h0(e){return p.useMemo(function(){return e.hooks.dropTarget()},[e])}function ah(e,t){var r=sh(e,t),n=d0(),s=f0(r.options);return u0(r,n,s),[oh(r.collect,n,s),h0(s)]}function p0(e,t){return v0(e)||y0(e,t)||m0(e,t)||g0()}function g0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m0(e,t){if(e){if(typeof e=="string")return nu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nu(e,t)}}function nu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function v0(e){if(Array.isArray(e))return e}function b0(e){var t=un(),r=t.getMonitor(),n=ih(r,e),s=p0(n,2),i=s[0],o=s[1];return p.useEffect(function(){return r.subscribeToOffsetChange(o)}),p.useEffect(function(){return r.subscribeToStateChange(o)}),i}function lh(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function _0(e,t){return e.filter(function(r){return r!==t})}function w0(e,t){var r=new Set,n=function(o){return r.add(o)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function x0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C0(e,t,r){return t&&S0(e.prototype,t),e}function su(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O0=function(){function e(t){x0(this,e),su(this,"entered",[]),su(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return C0(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(a){return n.isNodeInDocument(a)&&(!a.contains||a.contains(r))};return this.entered=w0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=_0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),E0=lh(function(){return/firefox/i.test(navigator.userAgent)}),ch=lh(function(){return!!window.safari});function D0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function T0(e,t,r){return t&&I0(e.prototype,t),e}function ts(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var iu=function(){function e(t,r){D0(this,e),ts(this,"xs",void 0),ts(this,"ys",void 0),ts(this,"c1s",void 0),ts(this,"c2s",void 0),ts(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(k,L){return t[k]<t[L]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],g=0;g<o.length-1;g++){var m=a[g],b=a[g+1];if(m*b<=0)f.push(0);else{c=o[g];var h=o[g+1],y=c+h;f.push(3*y/((y+h)/m+(y+c)/b))}}f.push(a[a.length-1]);for(var v=[],_=[],x,w=0;w<f.length-1;w++){x=a[w];var C=f[w],I=1/o[w],j=C+f[w+1]-x-x;v.push((x-C-j)*I),_.push(j*I*I)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,this.c3s=_}return T0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var g=n[f];if(g<r)d=f+1;else if(g>r)u=f-1;else return s[f]}c=Math.max(0,u);var m=r-n[c],b=m*m;return s[c]+i[c]*m+o[c]*b+a[c]*m*b}}]),e}(),N0=1;function uh(e){var t=e.nodeType===N0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Ys(e){return{x:e.clientX,y:e.clientY}}function j0(e){var t;return e.nodeName==="IMG"&&(E0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function R0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return ch()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function k0(e,t,r,n,s){var i=j0(t),o=i?e:t,a=uh(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,g=n.anchorY,m=R0(i,t,d,u),b=m.dragPreviewWidth,h=m.dragPreviewHeight,y=function(){var j=new iu([0,.5,1],[c.y,c.y/u*h,c.y+h-u]),k=j.interpolate(g);return ch()&&i&&(k+=(window.devicePixelRatio-1)*h),k},v=function(){var j=new iu([0,.5,1],[c.x,c.x/d*b,c.x+b-d]);return j.interpolate(f)},_=s.offsetX,x=s.offsetY,w=_===0||_,C=x===0||x;return{x:w?_:v(),y:C?x:y()}}var dh="__NATIVE_FILE__",fh="__NATIVE_URL__",hh="__NATIVE_TEXT__",ph="__NATIVE_HTML__";const ou=Object.freeze(Object.defineProperty({__proto__:null,FILE:dh,HTML:ph,TEXT:hh,URL:fh},Symbol.toStringTag,{value:"Module"}));function To(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var vn;function Xs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ea=(vn={},Xs(vn,dh,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Xs(vn,ph,{exposeProperties:{html:function(t,r){return To(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Xs(vn,fh,{exposeProperties:{urls:function(t,r){return To(t,r,"").split(`
465
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Xs(vn,hh,{exposeProperties:{text:function(t,r){return To(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),vn);function A0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M0(e,t,r){return t&&P0(e.prototype,t),e}function au(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L0=function(){function e(t){A0(this,e),au(this,"item",void 0),au(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return M0(e,[{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 s={};Object.keys(this.config.exposeProperties).forEach(function(i){s[i]={value:n.config.exposeProperties[i](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,s)}}},{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(){}}]),e}();function F0(e,t){var r=new L0(Ea[e]);return r.loadDataTransfer(t),r}function No(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ea).filter(function(r){var n=Ea[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function $0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U0(e,t,r){return t&&B0(e.prototype,t),e}function jo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var z0=function(){function e(t,r){$0(this,e),jo(this,"ownerDocument",null),jo(this,"globalContext",void 0),jo(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return U0(e,[{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}}]),e}();function lu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function cu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function V0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function H0(e,t,r){return t&&q0(e.prototype,t),e}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var W0=function(){function e(t,r,n){var s=this;V0(this,e),be(this,"options",void 0),be(this,"actions",void 0),be(this,"monitor",void 0),be(this,"registry",void 0),be(this,"enterLeaveCounter",void 0),be(this,"sourcePreviewNodes",new Map),be(this,"sourcePreviewNodeOptions",new Map),be(this,"sourceNodes",new Map),be(this,"sourceNodeOptions",new Map),be(this,"dragStartSourceIds",null),be(this,"dropTargetIds",[]),be(this,"dragEnterTargetIds",[]),be(this,"currentNativeSource",null),be(this,"currentNativeHandle",null),be(this,"currentDragSourceNode",null),be(this,"altKeyPressed",!1),be(this,"mouseMoveTimeoutTimer",null),be(this,"asyncEndDragFrameId",null),be(this,"dragOverTargetIds",null),be(this,"lastClientOffset",null),be(this,"hoverRafId",null),be(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&uh(o)||null}),be(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),be(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Ys(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=No(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),g=s.sourcePreviewNodes.get(u)||f;if(g){var m=s.getCurrentSourcePreviewNodeOptions(),b=m.anchorX,h=m.anchorY,y=m.offsetX,v=m.offsetY,_={anchorX:b,anchorY:h},x={offsetX:y,offsetY:v},w=k0(f,g,a,_,x);c.setDragImage(g,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var C=s.getCurrentSourcePreviewNodeOptions(),I=C.captureDraggingState;I?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),be(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=No(a);c&&s.beginDragNativeItem(c,a)}}),be(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Ys(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=Ys(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),be(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else No(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Ys(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new z0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new O0(this.isNodeInDocument)}return H0(e,[{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,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{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 cu({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 cu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(ou).some(function(n){return ou[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=F0(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 s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{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)}}]),e}(),Zs;function K0(){return Zs||(Zs=new Image,Zs.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Zs}var Q0=function(t,r,n){return new W0(t,r,n)};function G0(e,t){return typeof e=="function"?e(t):e??"NODE"}function Y0(e){return e.isDraggable&&!e.isEditing}function X0(e){const t=It(),r=t.selectedIds,[n,s,i]=ZC(()=>({canDrag:()=>Y0(e),type:G0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Un.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Un.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(K0())},[i]),s}function Z0(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function J0(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function Js(e,t){return{parentId:e||null,index:t}}function bn(e,t){return{type:"line",index:e,level:t}}function e1(e){return{type:"highlight",id:e}}function Ro(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=$f(n)+1;return{parentId:s,index:i}}function gh(e){var t;const r=Z0(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=J0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Js(i.id,null),cursor:e1(i.id)};if(!c)return{drop:Js((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:bn(0,0)};if(Pf(c)){const u=fi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ro(c,u),cursor:bn(c.rowIndex+1,u)}}if(Mf(c)){const u=fi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ro(c,u),cursor:bn(c.rowIndex+1,u)}}if(Lf(c)){const u=fi(s,0,c.level+1);return u>c.level?{drop:Js(c.id,0),cursor:bn(c.rowIndex+1,u)}:{drop:Ro(c,u),cursor:bn(c.rowIndex+1,u)}}return{drop:Js(c==null?void 0:c.id,0),cursor:bn(c.rowIndex+1,c.level+1)}}function t1(e,t){const r=It(),[n,s]=ah(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=gh({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(Un.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function r1(e){const t=It(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const uu=p.memo(function({index:t,style:r}){Af(),_w();const n=It(),s=r1(t),i=p.useRef(null),o=X0(s),a=t1(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),d=n.indent*s.level,u=p.useMemo(()=>({paddingLeft:d}),[d]),f=p.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const m=n.renderNode,b=n.renderRow;return l.jsx(b,{node:s,innerRef:c,attrs:g,children:l.jsx(m,{node:s,tree:n,style:u,dragHandle:o})})});let ko="",du=null;function mh(){Af();const e=It();return l.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),Bf(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Uf(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(du),ko+=t.key,du=setTimeout(()=>{ko=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(ko):!1});n&&e.focus(n.id)},children:l.jsx(n1,{})})}function n1(){var e,t;const r=It(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:lx,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:dx,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(sx,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:uu})):l.jsx(ix,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:uu}))}function fu(e){return e.isFiltered?i1(e.root,e.isMatch.bind(e)):s1(e.root)}function s1(e){const t=[];function r(n){var s;n.level>=0&&t.push(n),n.isOpen&&((s=n.children)===null||s===void 0||s.forEach(r))}return r(e),t.forEach(yh),t}function i1(e,t){const r={},n=[];function s(o){if(!o.isRoot&&t(o)){r[o.id]=!0;let c=o.parent;for(;c;)r[c.id]=!0,c=c.parent}if(o.children)for(let c of o.children)s(c)}function i(o){var a;o.level>=0&&r[o.id]&&n.push(o),o.isOpen&&((a=o.children)===null||a===void 0||a.forEach(i))}return s(e),i(e),n.forEach(yh),n}function yh(e,t){e.rowIndex=t}const hu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ao=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:ht}=Ow;class gs{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=wc(this),this.visibleNodes=fu(this),this.idToIndex=hu(this.visibleNodes)}update(t){this.props=t,this.root=wc(this),this.visibleNodes=fu(this),this.idToIndex=hu(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=cs(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=cs(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof Os)return t.id;const r=this.props.idAccessor||"id";return cs(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+1)}indexOf(t){const r=this.identifyNull(t);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 Ao(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?Hf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:qf(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield ht(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return Ao(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield ht(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(xo(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{gs.editPromise=i})}submit(t,r){return Ao(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield ht(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(xo(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(xo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&ht(this.props.onActivate,r)}resolveEdit(t){const r=gs.editPromise;r&&r(t),gs.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(pn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&ht(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(pn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&&ht(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(_r.remove(r)),ht(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(pn(n.id)),n.isSelectable&&(this.dispatch(_r.add(n.id)),this.dispatch(_r.anchor(n.id)),this.dispatch(_r.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&ht(this.props.onFocus,this.focusedNode),ht(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(pn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(_r.remove(this.nodesBetween(s,i))),this.dispatch(_r.add(o)),this.dispatch(_r.mostRecent(n))}this.scrollTo(n),this.focusedNode&&ht(this.props.onFocus,this.focusedNode),ht(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(pn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&ht(this.props.onFocus,this.focusedNode)}filterSelectableNodes(t){return t.map(r=>this.get(this.identify(r))).filter(r=>!!r&&r.isSelectable)}setSelection(t){var r;const n=new Set((r=t.ids)===null||r===void 0?void 0:r.map(o=>this.identify(o))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(_r.set({ids:n,anchor:s,mostRecent:i})),ht(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}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 t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&Ff(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;ht(this.props.onMove,{dragIds:n,parentId:t===Cs?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Un.cursor({type:"none"}))}showCursor(t){this.dispatch(Un.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(va.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),ht(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(va.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),ht(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=il(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){ki(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){ki(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),Vf(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.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(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===Cs)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!cs(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(pn(t.id))}onBlur(){this.dispatch(Pw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||mh}get renderRow(){return this.props.renderRow||Nw}get renderNode(){return this.props.children||jw}get renderDragPreview(){return this.props.renderDragPreview||Wf}get renderCursor(){return this.props.renderCursor||Tw}}function pt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var o1=typeof Symbol=="function"&&Symbol.observable||"@@observable",pu=o1,Po=()=>Math.random().toString(36).substring(7).split("").join("."),a1={INIT:`@@redux/INIT${Po()}`,REPLACE:`@@redux/REPLACE${Po()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Po()}`},sn=a1;function vh(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function l1(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(d1(e))return"date";if(u1(e))return"error";const r=c1(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function c1(e){return typeof e.constructor=="function"?e.constructor.name:null}function u1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function d1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Sr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=l1(e)),t}function bh(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?pt(2):`Expected the root reducer to be a function. Instead, received: '${Sr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?pt(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 t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?pt(1):`Expected the enhancer to be a function. Instead, received: '${Sr(r)}'`);return r(bh)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?pt(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 s}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?pt(4):`Expected the listener to be a function. Instead, received: '${Sr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?pt(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 v=!0;d();const _=a++;return o.set(_,y),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?pt(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.");v=!1,d(),o.delete(_),i=null}}}function g(y){if(!vh(y))throw new Error(process.env.NODE_ENV==="production"?pt(7):`Actions must be plain objects. Instead, the actual type was: '${Sr(y)}'. 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 y.type>"u")throw new Error(process.env.NODE_ENV==="production"?pt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?pt(17):`Action "type" property must be a string. Instead, the actual type was: '${Sr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?pt(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(_=>{_()}),y}function m(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?pt(10):`Expected the nextReducer to be a function. Instead, received: '${Sr(y)}`);n=y,g({type:sn.REPLACE})}function b(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?pt(11):`Expected the observer to be an object. Instead, received: '${Sr(v)}'`);function _(){const w=v;w.next&&w.next(u())}return _(),{unsubscribe:y(_)}},[pu](){return this}}}return g({type:sn.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:m,[pu]:b}}function gu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function f1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===sn.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(s.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(!vh(e))return`The ${i} has unexpected type of "${Sr(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===sn.REPLACE)&&o.length>0)return`Unexpected ${o.length>1?"keys":"key"} "${o.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function h1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:sn.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?pt(12):`The slice reducer for key "${t}" 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:sn.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?pt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${sn.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 mu(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&gu(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{h1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=f1(a,r,c,s);f&&gu(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const g=n[f],m=r[g],b=a[g],h=m(b,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?pt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${g}" 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.`)}u[g]=h,d=d||h!==b}return d=d||n.length!==Object.keys(a).length,d?u:a}}function p1(e=Bn().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const g1=mu({nodes:mu({focus:Mw,edit:Aw,open:Lw,selection:Fw,drag:p1}),dnd:$w}),m1=Bn();function y1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(bh(g1,Bn(e))),o=bw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>m1),a=p.useMemo(()=>new gs(i.current,e,n,s),[]),c=p.useRef(0);return p.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),p.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),p.useImperativeHandle(t,()=>a),p.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),p.useEffect(()=>{a.props.searchTerm||i.current.dispatch(va.clear(!0))},[a.props.searchTerm]),l.jsx(Nf.Provider,{value:a,children:l.jsx(kf.Provider,{value:c.current,children:l.jsx(jf.Provider,{value:o.nodes,children:l.jsx(Rf.Provider,{value:o.dnd,children:l.jsx(QS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||Q0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function v1(){const e=It(),[,t]=ah(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const s=n.getClientOffset();if(!e.listEl.current||!s)return;const{cursor:i,drop:o}=gh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Un.hovering(o.parentId,o.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function b1(e){return v1(),e.children}function _1(){const t=It().props.renderContainer||mh;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function w1(){const e=It(),{offset:t,mouse:r,item:n,isDragging:s}=b0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||Wf;return l.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function x1(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class S1{constructor(t,r={}){this.accessors=x1(r),this.root=C1(t,this.accessors)}get data(){var t,r;return(r=(t=this.root.children)===null||t===void 0?void 0:t.map(n=>n.data))!==null&&r!==void 0?r:[]}create(t){const r=t.parentId?this.find(t.parentId):this.root;if(!r)return null;r.addChild(t.data,t.index)}move(t){const r=this.find(t.id),n=t.parentId?this.find(t.parentId):this.root;!r||!n||(n.addChild(r.data,t.index),r.drop())}update(t){const r=this.find(t.id);r&&r.update(t.changes)}drop(t){const r=this.find(t.id);r&&r.drop()}find(t,r=this.root){if(!r)return null;if(r.id===t)return r;if(r.children){for(let n of r.children){const s=this.find(t,n);if(s)return s}return null}return null}}function C1(e,t){const r=new _h({},null,t,"ROOT");return r.children=e.map(n=>fl(n,r,t)),r}function fl(e,t,r){const n=new _h(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>fl(i,n,r))),n}class _h{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=fl(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let O1=0;function E1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new S1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=b=>{for(const h of b.dragIds)o.move({id:h,parentId:b.parentId,index:b.index});n(o.data)},c=({name:b,id:h})=>{o.update({id:h,changes:{name:b}}),n(o.data)},d=typeof s=="string"?s:"id",u=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:b,index:h,type:y})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(y==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const v={[d]:`simple-tree-id-${O1++}`,name:""};return y==="internal"&&(v[u]=[]),o.create({parentId:b,index:h,data:v}),n(o.data),v},onDelete:b=>{b.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function D1(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
466
- Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=E1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function I1(e,t){const r=D1(e);return l.jsxs(y1,{treeProps:r,imperativeHandle:t,children:[l.jsx(b1,{children:l.jsx(_1,{})}),l.jsx(w1,{})]})}const T1=p.forwardRef(I1);function hl(){return Ae(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function N1(){return Ae(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const yu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},vu={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},bu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],j1=[{label:"All",value:"all"},{label:"Course Assessment",value:"Course Assessment"},{label:"eTextbook",value:"eTextbook"},{label:"Exam Question",value:"Exam Question"},{label:"Explanation Content",value:"Explanation Content"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"},{label:"SCORM Content",value:"SCORM Content"},{label:"Teacher Resource",value:"Teacher Resource"}];function R1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function no(e){const t=R1(e);return{key:t,color:yu[t]??yu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:vu[t]??vu.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const k1="_row_i3qt2_1",A1="_grip_i3qt2_16",P1="_menuBtn_i3qt2_19",M1="_selected_i3qt2_23",L1="_title_i3qt2_28",F1="_dropTarget_i3qt2_33",$1="_toggle_i3qt2_50",B1="_ctIcon_i3qt2_65",U1="_folderIcon_i3qt2_77",z1="_renameInput_i3qt2_92",V1="_dropHere_i3qt2_101",q1="_menuWrap_i3qt2_111",H1="_menu_i3qt2_19",W1="_dangerItem_i3qt2_163",Ct={row:k1,grip:A1,menuBtn:P1,selected:M1,title:L1,dropTarget:F1,toggle:$1,ctIcon:B1,folderIcon:U1,renameInput:z1,dropHere:V1,menuWrap:q1,menu:H1,dangerItem:W1},K1={video:Ya,pdf:Ha,h5p:Wa,scorm:Qa,audio:Ka,quiz:qa,default:Wn},Q1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,d]=p.useState(e.data.name),u=p.useRef(null),f=n==="edit",g=hl(),m=no(e.data),b=K1[m.key]??Wn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),_=y?oy:v?dy:b;p.useEffect(()=>{if(!s)return;const C=I=>{var j;(j=u.current)!=null&&j.contains(I.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const x=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(C=>{C.key==="Enter"&&x(),C.key==="Escape"&&(d(e.data.name),a(!1))},[x,e.data.name]);return l.jsxs("div",{className:[Ct.row,h?Ct.selected:"",e.state.isOver&&v?Ct.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":v?"true":void 0,role:"treeitem","aria-selected":h,"aria-expanded":v?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Ct.grip,"aria-hidden":"true",children:l.jsx(Wd,{size:14})}),l.jsx("button",{className:Ct.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(zd,{size:14}):l.jsx(Ls,{size:14})}),l.jsx("span",{className:`${Ct.ctIcon} ${y||v?Ct.folderIcon:m.bgClass}`,"aria-hidden":"true",children:l.jsx(_,{size:12})}),o?l.jsx("input",{className:Ct.renameInput,value:c,autoFocus:!0,onChange:C=>d(C.target.value),onBlur:x,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:Ct.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:Ct.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ct.menuWrap,ref:u,children:[l.jsx("button",{className:Ct.menuBtn,onClick:C=>{C.stopPropagation(),i(I=>!I)},"aria-label":"Node options",children:l.jsx(qd,{size:14})}),s&&l.jsxs("div",{className:Ct.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(yy,{size:13})," Rename"]}),v&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Hd,{size:13})," Add sub-unit"]}),e.data.parent&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(Fs,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ct.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Ga,{size:13})," Delete"]})]})]})]})};async function G1(e,t){var i,o;const n=((i=(await Le.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((o=n.content)==null?void 0:o.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function Y1(e,t){const r=await fetch(e,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:t});if(!r.ok)throw new Error(`Blob upload failed (${r.status})`);return e.split("?")[0]}async function X1(e,t){var a;const r=await G1(e,t.name),n=await Y1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Le.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function Z1(e){var r;return((r=(await Le.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function wh(e){var n,s,i;const r=(i=(s=(n=(await Le.get(`/action/collection/v1/export/${e}`)).data)==null?void 0:n.result)==null?void 0:s.collection)==null?void 0:i.tocUrl;if(!r)throw new Error("No export URL returned");return r}async function J1(e){return wh(e)}const eO="_container_jr3ij_1",tO="_header_jr3ij_13",rO="_title_jr3ij_22",nO="_closeBtn_jr3ij_29",sO="_body_jr3ij_45",iO="_dropZone_jr3ij_54",oO="_dragOver_jr3ij_67",aO="_hasFile_jr3ij_72",lO="_hiddenInput_jr3ij_78",cO="_fileInfo_jr3ij_82",uO="_fileIcon_jr3ij_89",dO="_fileName_jr3ij_93",fO="_fileSize_jr3ij_100",hO="_dropHint_jr3ij_105",pO="_dropIcon_jr3ij_112",gO="_dropText_jr3ij_117",mO="_dropSubtext_jr3ij_124",yO="_sampleLink_jr3ij_130",vO="_statusBar_jr3ij_145",bO="_status_uploading_jr3ij_154",_O="_status_processing_jr3ij_154",wO="_status_done_jr3ij_159",xO="_status_error_jr3ij_164",SO="_successDetail_jr3ij_170",CO="_spinner_jr3ij_175",OO="_spin_jr3ij_175",EO="_errorMsg_jr3ij_191",DO="_failedSection_jr3ij_197",IO="_failedTitle_jr3ij_203",TO="_tableWrap_jr3ij_213",NO="_failedTable_jr3ij_219",jO="_reasonCell_jr3ij_244",RO="_footer_jr3ij_248",Ne={container:eO,header:tO,title:rO,closeBtn:nO,body:sO,dropZone:iO,dragOver:oO,hasFile:aO,hiddenInput:lO,fileInfo:cO,fileIcon:uO,fileName:dO,fileSize:fO,dropHint:hO,dropIcon:pO,dropText:gO,dropSubtext:mO,sampleLink:yO,statusBar:vO,status_uploading:bO,status_processing:_O,status_done:wO,status_error:xO,successDetail:SO,spinner:CO,spin:OO,errorMsg:EO,failedSection:DO,failedTitle:IO,tableWrap:TO,failedTable:NO,reasonCell:jO,footer:RO},kO=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState("idle"),[u,f]=p.useState(""),[g,m]=p.useState([]),[b,h]=p.useState(null),y=p.useRef(null),v=p.useRef(null),_=p.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);p.useEffect(()=>()=>_(),[_]);const x=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(N=>{f(""),m([]),h(null),d("idle"),x(N)&&i(N)},[]),C=p.useCallback(N=>{N.preventDefault(),a(!1);const A=N.dataTransfer.files[0];A&&w(A)},[w]),I=p.useCallback(N=>{var $;const A=($=N.target.files)==null?void 0:$[0];A&&w(A),N.target.value=""},[w]),j=p.useCallback(async()=>{try{const N=await J1(e),A=document.createElement("a");A.href=N,A.download="sample_hierarchy.csv",A.target="_blank",A.click()}catch{f("Failed to download sample CSV.")}},[e]),k=p.useCallback(async()=>{if(s){d("uploading"),f(""),m([]);try{const{processId:N}=await X1(e,s);if(!N){d("done"),h(null),setTimeout(t,1500);return}d("processing"),v.current=setInterval(async()=>{try{const A=await Z1(N);A.status==="COMPLETED"?(_(),d("done"),h(A.successCount??null),A.failedRecords&&A.failedRecords.length>0?m(A.failedRecords):setTimeout(t,1500)):A.status==="FAILED"&&(_(),d("error"),f("Upload processing failed. Please check the error rows below."),A.failedRecords&&m(A.failedRecords))}catch{_(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,_]),L={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ne.container,children:[l.jsxs("div",{className:Ne.header,children:[l.jsx("h2",{className:Ne.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ne.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ne.body,children:[l.jsxs("div",{className:`${Ne.dropZone} ${o?Ne.dragOver:""} ${s?Ne.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),a(!0)},onDragOver:N=>{N.preventDefault(),a(!0)},onDragLeave:N=>{N.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var N;return(N=y.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:N=>{var A;return N.key==="Enter"&&((A=y.current)==null?void 0:A.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:Ne.hiddenInput,onChange:I,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ne.fileInfo,children:[l.jsx("span",{className:Ne.fileIcon,children:"📄"}),l.jsx("span",{className:Ne.fileName,children:s.name}),l.jsxs("span",{className:Ne.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ne.dropHint,children:[l.jsx("span",{className:Ne.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ne.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ne.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ne.sampleLink,onClick:j,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ne.statusBar} ${Ne[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ne.spinner,"aria-hidden":"true"}),L[c],c==="done"&&b!==null&&l.jsxs("span",{className:Ne.successDetail,children:[" — ",b," item(s) imported"]})]}),u&&l.jsx("p",{className:Ne.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:Ne.failedSection,children:[l.jsxs("h4",{className:Ne.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:Ne.tableWrap,children:l.jsxs("table",{className:Ne.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:g.map((N,A)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??A+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ne.reasonCell,children:N.reason??"Unknown error"})]},A))})]})})]})]}),l.jsxs("div",{className:Ne.footer,children:[l.jsx(ke,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(ke,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:k,children:c==="done"?"Uploaded":"Upload"})]})]})},AO="_container_1y30m_1",PO="_header_1y30m_8",MO="_headerActions_1y30m_19",LO="_iconBtn_1y30m_25",FO="_menuWrap_1y30m_43",$O="_dropdownMenu_1y30m_47",BO="_treeWrapper_1y30m_79",UO="_csvModal_1y30m_95",zO="_footer_1y30m_105",er={container:AO,header:PO,headerActions:MO,iconBtn:LO,menuWrap:FO,dropdownMenu:$O,treeWrapper:BO,csvModal:UO,footer:zO},VO=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var he;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[g,m]=p.useState("create"),{treeData:b,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:_,reorderChildren:x,moveNode:w,setTreeData:C}=Ae(),I=e==="edit",j=hl(),k=I&&j,L=(((he=b[0])==null?void 0:he.children)??[]).some(W=>W.isFolder),N=oe(W=>{var J,se,B,Y;return((se=(J=W.editorConfig)==null?void 0:J.context)==null?void 0:se.contentId)??((Y=(B=W.editorConfig)==null?void 0:B.context)==null?void 0:Y.identifier)??""}),A=oe(W=>{var se,B;const J=(B=(se=W.categoryMeta)==null?void 0:se.sourcingSettings)==null?void 0:B.collection;return(J==null?void 0:J.enableBulkUpload)!==!1});p.useEffect(()=>{const W=s.current;if(!W)return;const J=new ResizeObserver(()=>{a(W.clientHeight||400)});return J.observe(W),a(W.clientHeight||400),()=>J.disconnect()},[]),p.useEffect(()=>{if(!c)return;const W=J=>{var se;(se=i.current)!=null&&se.contains(J.target)||d(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[c]);const $=p.useCallback(W=>{W.length>0&&y(W[0].data.id)},[y]),R=p.useCallback(({parentId:W,index:J,dragIds:se})=>{if(!W)return;const B=se[0],Y=Da(b,B);if(!Y)return;const K=Y.parent;if(K===W){const ue=Da(b,W);if(!(ue!=null&&ue.children))return;const xe=ue.children.findIndex(Pe=>Pe.id===B);if(xe<0)return;x(W,xe,J>xe?J-1:J)}else w(B,K??"",W)},[b,x,w]),F=p.useCallback(({ids:W})=>{W.forEach(J=>_(J))},[_]),M=p.useCallback(({parentId:W})=>{var B;const J=W??((B=b[0])==null?void 0:B.id)??"";if(!J)return{id:crypto.randomUUID()};const se=v(J,"unit");return se?{id:se}:(Ee.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,b]),Z=p.useCallback(()=>{var J;const W=(J=b[0])==null?void 0:J.id;W&&(v(W,"unit")||Ee.error("Maximum depth reached"))},[b,v]),ae=p.useCallback(()=>{h&&(v(h,"subunit")||Ee.error("Maximum depth reached"))},[h,v]),ve=p.useCallback(async()=>{if(d(!1),!!N)try{const W=await wh(N),J=await fetch(W).then(Y=>Y.blob()),se=URL.createObjectURL(J),B=document.createElement("a");B.href=se,B.download=`${N}-folders.csv`,B.style.display="none",document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(se)}catch{Ee.error("Failed to download CSV")}},[N]),we=p.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:W}=await Tf(N);C([W]),Ee.success("Course outline refreshed.")}catch{Ee.error("Outline could not be refreshed automatically. Please reload the page.")}},[N,C]);return l.jsxs("div",{className:er.container,children:[l.jsx("div",{className:er.header,children:l.jsxs("div",{className:er.headerActions,children:[I&&l.jsxs("div",{className:er.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:er.iconBtn,onClick:()=>d(W=>!W),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(qd,{size:15})}),c&&l.jsx("div",{className:er.dropdownMenu,role:"menu",children:A&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:L,title:L?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),m("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:ve,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),m("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:er.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(gy,{size:15}):l.jsx(py,{size:15})})]})}),l.jsx("div",{className:er.treeWrapper,ref:s,children:l.jsx(T1,{ref:n,data:b,idAccessor:"id",childrenAccessor:"children",onSelect:$,onMove:I?R:void 0,onDelete:I?F:void 0,onCreate:I?M:void 0,disableEdit:!I,disableDrop:!I,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:W=>l.jsx(Q1,{...W,editorMode:e})})}),I&&l.jsxs("div",{className:er.footer,children:[l.jsxs(ke,{variant:"ghost",size:"sm",onClick:Z,disabled:!k,children:[l.jsx(Fs,{size:14})," Add Unit"]}),l.jsxs(ke,{variant:"ghost",size:"sm",onClick:ae,disabled:!k||!h,children:[l.jsx(Hd,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:er.csvModal,children:l.jsx(kO,{contentId:N,mode:g,onComplete:we,onClose:()=>f(!1)})})]})};function Da(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Da(r.children,t);if(n)return n}}}const qO="_breadcrumb_zd1aj_1",HO="_crumb_zd1aj_10",WO="_sep_zd1aj_26",KO="_current_zd1aj_31",rs={breadcrumb:qO,crumb:HO,sep:WO,current:KO},QO=({crumbs:e})=>{const t=Ae(r=>r.selectNode);return e.length?l.jsxs("nav",{className:rs.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:rs.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(fy,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(zd,{size:13,className:rs.sep}),n<e.length-1?l.jsx("button",{className:rs.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:rs.current,children:r.name})]},r.id))]}):null},GO="_tabBar_qhks1_1",YO="_tab_qhks1_1",XO="_active_qhks1_29",ZO="_error_qhks1_35",JO="_errorDot_qhks1_39",ns={tabBar:GO,tab:YO,active:XO,error:ZO,errorDot:JO},_u=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],eE=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?_u.filter(i=>n.includes(i.id)):_u;return l.jsx("div",{className:ns.tabBar,role:"tablist","aria-label":"Metadata sections",children:s.map(i=>l.jsxs("button",{role:"tab","aria-selected":e===i.id,"aria-controls":`panel-${i.id}`,className:[ns.tab,e===i.id?ns.active:"",r.includes(i.id)?ns.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:ns.errorDot,"aria-label":"Has errors"})]},i.id))})};var Vs=e=>e.type==="checkbox",Wr=e=>e instanceof Date,at=e=>e==null;const xh=e=>typeof e=="object";var He=e=>!at(e)&&!Array.isArray(e)&&xh(e)&&!Wr(e),Ia=e=>He(e)&&e.target?Vs(e.target)?e.target.checked:e.target.value:e,Sh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Ch=e=>{const t=e.constructor&&e.constructor.prototype;return He(t)&&t.hasOwnProperty("isPrototypeOf")},so=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ke(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(so&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(He(e)&&Ch(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ke(e[s]));return n}const Or={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Wt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Mo="form",Oh="root",Eh=["__proto__","constructor","prototype"];var qs=e=>/^\w*$/.test(e),$e=e=>e===void 0,io=e=>e.split(/[.[\]'"]/g).filter(Boolean),H=(e,t,r)=>{if(!t||!He(e))return r;const n=qs(t)?[t]:io(t);if(n.some(i=>Eh.includes(i)))return r;const s=n.reduce((i,o)=>at(i)?void 0:i[o],e);return $e(s)||s===e?$e(e[t])?r:e[t]:s},kt=e=>typeof e=="boolean",mt=e=>typeof e=="function",Me=(e,t,r)=>{let n=-1;const s=qs(t)?[t]:io(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=He(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Eh.includes(a))return;e[a]=c,e=e[a]}};const pl=p.createContext(null);pl.displayName="HookFormControlContext";const gl=()=>p.useContext(pl);var Dh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Wt.all&&(t._proxyFormState[o]=!n||Wt.all),r&&(r[o]=!0),e[o]}});return s};const ml=so?p.useLayoutEffect:p.useEffect;function tE(e){const t=gl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ml(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Dh(o,r,c.current,!1),[o,r])}var yt=e=>typeof e=="string",Ta=(e,t,r,n,s)=>yt(e)?(n&&t.watch.add(e),H(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),H(r,i))):(n&&(t.watchAll=!0),r),Na=e=>at(e)||!xh(e);const wu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Ch(e);function At(e,t,r=new WeakMap){if(e===t)return!0;if(Na(e)||Na(t))return Object.is(e,t);if(Wr(e)&&Wr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(wu(e,n)||wu(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Wr(a)&&Wr(c)||(He(a)||Array.isArray(a))&&(He(c)||Array.isArray(c))?!At(a,c,r):!Object.is(a,c))return!1}}return!0}function rE(e){const t=gl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),d=p.useRef(a),u=p.useRef(void 0),f=p.useRef(r),g=p.useRef(n);d.current=a;const[m,b]=p.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=p.useCallback(w=>{const C=Ta(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const C=Ta(n,r._names,w||r._formValues,!1,c.current);if(d.current){const I=d.current(C);At(I,u.current)||(b(I),u.current=I)}else b(C)}},[r._formValues,r._names,i,n]);ml(()=>((f.current!==r||!At(g.current,n))&&(f.current=r,g.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,_=g.current,x=p.useMemo(()=>{if(i)return null;const w=!v&&!At(_,n);return v||w?h():null},[i,v,n,_,h]);return x!==null?x:m}function oo(e){const t=gl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Sh(s._names.array,r),d=p.useMemo(()=>H(s._formValues,r,H(s._defaultValues,r,o)),[s,r,o]),u=rE({control:s,name:r,defaultValue:d,exact:a}),f=tE({control:s,name:r,exact:a}),g=p.useRef(e),m=p.useRef(null),b=p.useRef(s.register(r,{...e.rules,value:u,...kt(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!H(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!H(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!H(f.validatingFields,r)},error:{enumerable:!0,get:()=>H(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const C=Ia(w);return H(s._fields,r)||(b.current=s.register(r,{...g.current.rules,value:C})),b.current.onChange({target:{value:Ia(w),name:r},type:Or.CHANGE})},[r,s]),v=p.useCallback(()=>b.current.onBlur({target:{value:H(s._formValues,r),name:r},type:Or.BLUR}),[r,s._formValues]),_=p.useCallback(w=>{w&&(m.current={focus:()=>mt(w.focus)&&w.focus(),select:()=>mt(w.select)&&w.select(),setCustomValidity:I=>mt(w.setCustomValidity)&&w.setCustomValidity(I),reportValidity:()=>mt(w.reportValidity)&&w.reportValidity()});const C=H(s._fields,r);C&&C._f&&w&&(C._f.ref=m.current)},[s._fields,r]),x=p.useMemo(()=>({name:r,value:u,...kt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:_}),[r,n,f.disabled,y,v,_,u]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...kt(g.current.disabled)?{disabled:g.current.disabled}:{}});const C=(I,j)=>{const k=H(s._fields,I);k&&k._f&&(k._f.mount=j)};if(C(r,!0),w){const I=Ke(H(i?s._defaultValues:s._options.values||s._defaultValues,r,H(s._options.defaultValues,r,g.current.defaultValue)));Me(s._defaultValues,r,I),$e(H(s._formValues,r))&&Me(s._formValues,r,I)}if(!c&&s.register(r),m.current){const I=H(s._fields,r);I&&I._f&&(I._f.ref=m.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:x,formState:f,fieldState:h}),[x,f,h])}const yl=p.createContext(null);yl.displayName="HookFormContext";const Yt=()=>p.useContext(yl),nE=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:b,register:h,setFocus:y,subscribe:v})=>{const _=p.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:b,register:h,setFocus:y,subscribe:v}),[i,b,d,n,r,g,h,f,u,s,y,o,a,v,c,m,t]);return p.createElement(yl.Provider,{value:_},p.createElement(pl.Provider,{value:_.control},e))};var sE=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Ih=e=>Array.isArray(e)?e.filter(Boolean):[],_i=e=>Array.isArray(e)?e:[e],xu=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function Th(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&He(s)&&i){const o=Th(s,i);He(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var rt=e=>He(e)&&!Object.keys(e).length,vl=e=>e.type==="file",Pi=e=>{if(!so)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Nh=e=>e.type==="select-multiple",bl=e=>e.type==="radio",iE=e=>bl(e)||Vs(e),Lo=e=>Pi(e)&&e.isConnected;function oE(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(at(e)){e=void 0;break}e=e[t[n]],n++}return e}function aE(e){for(const t in e)if(e.hasOwnProperty(t)&&!$e(e[t]))return!1;return!0}function Ye(e,t){if(yt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:qs(t)?[t]:io(t),n=r.length===1?e:oE(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(He(n)&&rt(n)||Array.isArray(n)&&aE(n))&&Ye(e,r.slice(0,-1)),e}var lE=e=>{for(const t in e)if(mt(e[t]))return!0;return!1};function jh(e){return Array.isArray(e)||He(e)&&!lE(e)}function ja(e,t={}){for(const r in e){const n=e[r];jh(n)?(t[r]=Array.isArray(n)?[]:{},ja(n,t[r])):$e(n)||(t[r]=!0)}return t}function Ra(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Ra(r));return t.some(r=>r!==void 0)?t:void 0}if(He(e)){const t={};for(const r in e){const n=Ra(e[r]);$e(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function zr(e,t,r){r||(r=ja(t));for(const n in e){const s=e[n];if(jh(s))$e(t)||Na(r[n])?r[n]=ja(s,Array.isArray(s)?[]:{}):zr(s,at(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!At(s,i)}}return Ra(r)||{}}const Su={value:!1,isValid:!1},Cu={value:!0,isValid:!0};var Rh=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$e(e[0].attributes.value)?$e(e[0].value)||e[0].value===""?Cu:{value:e[0].value,isValid:!0}:Cu:Su}return Su},kh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$e(e)?e:t?e===""?NaN:e&&+e:r&&yt(e)?new Date(e):n?n(e):e;const Ou={isValid:!1,value:null};var Ah=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Ou):Ou;function Eu(e){const t=e.ref;return vl(t)?t.files:bl(t)?Ah(e.refs).value:Nh(t)?[...t.selectedOptions].map(({value:r})=>r):Vs(t)?Rh(e.refs).value:kh($e(t.value)?e.ref.value:t.value,e)}var cE=(e,t,r,n)=>{const s={};for(const i of e){const o=H(t,i);o&&Me(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Mi=e=>e instanceof RegExp,ss=e=>$e(e)?e:Mi(e)?e.source:He(e)?Mi(e.value)?e.value.source:e.value:e,Du=e=>({isOnSubmit:!e||e===Wt.onSubmit,isOnBlur:e===Wt.onBlur,isOnChange:e===Wt.onChange,isOnAll:e===Wt.all,isOnTouch:e===Wt.onTouched});const Iu="AsyncFunction";var uE=e=>!!e&&!!e.validate&&!!(mt(e.validate)&&e.validate.constructor.name===Iu||He(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Iu)),dE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Fo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const ms=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=H(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(ms(a,t))break}else if(He(a)&&ms(a,t))break}}};function Tu(e,t,r){const n=H(e,r);if(n||qs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=H(t,i),a=H(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var fE=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return rt(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Wt.all))},hE=(e,t,r)=>!e||!t||e===t||_i(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),pE=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,gE=(e,t)=>!Ih(H(e,t)).length&&Ye(e,t),Nu=(e,t,r)=>{const n=H(e,r),s=Array.isArray(n)?n:[];return Me(s,Oh,t[r]),Me(e,r,s),e};function ju(e,t,r="validate"){if(yt(e)||Array.isArray(e)&&e.every(yt)||kt(e)&&!e)return{type:r,message:yt(e)?e:"",ref:t}}var _n=e=>He(e)&&!Mi(e)?e:{value:e,message:""},Ru=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:g,pattern:m,validate:b,name:h,valueAsNumber:y,mount:v}=e._f,_=H(r,h);if(!v||t.has(h))return{};const x=a?a[0]:o,w=$=>{if(s&&x.reportValidity){const R=kt($)?"":$||"";a?a.forEach(F=>F.setCustomValidity(R)):x.setCustomValidity(R),x.reportValidity()}},C={},I=bl(o),j=Vs(o),k=I||j,L=(y||vl(o))&&$e(o.value)&&$e(_)||Pi(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,N=sE.bind(null,h,n,C),A=($,R,F,M=qt.maxLength,Z=qt.minLength)=>{const ae=$?R:F;C[h]={type:$?M:Z,message:ae,ref:o,...N($?M:Z,ae)}};if(i?!Array.isArray(_)||!_.length:c&&(!k&&(L||at(_))||kt(_)&&!_||j&&!Rh(a).isValid||I&&!Ah(a).isValid)){const{value:$,message:R}=yt(c)?{value:!!c,message:c}:_n(c);if($&&(C[h]={type:qt.required,message:R,ref:x,...N(qt.required,R)},!n))return w(R),C}if(!L&&(!at(f)||!at(g))){let $,R;const F=_n(g),M=_n(f);if(!at(_)&&!isNaN(_)){const Z=o.valueAsNumber||_&&+_;at(F.value)||($=Z>F.value),at(M.value)||(R=Z<M.value)}else{const Z=o.valueAsDate||new Date(_),ae=he=>new Date(new Date().toDateString()+" "+he),ve=o.type=="time",we=o.type=="week";yt(F.value)&&_&&($=ve?ae(_)>ae(F.value):we?_>F.value:Z>new Date(F.value)),yt(M.value)&&_&&(R=ve?ae(_)<ae(M.value):we?_<M.value:Z<new Date(M.value))}if(($||R)&&(A(!!$,F.message,M.message,qt.max,qt.min),!n))return w(C[h].message),C}if((d||u)&&!L&&(yt(_)||i&&Array.isArray(_))){const $=_n(d),R=_n(u),F=!at($.value)&&_.length>+$.value,M=!at(R.value)&&_.length<+R.value;if((F||M)&&(A(F,$.message,R.message),!n))return w(C[h].message),C}if(m&&!L&&yt(_)){const{value:$,message:R}=_n(m);if(Mi($)&&!_.match($)&&(C[h]={type:qt.pattern,message:R,ref:o,...N(qt.pattern,R)},!n))return w(R),C}if(b){if(mt(b)){const $=await b(_,r),R=ju($,x);if(R&&(C[h]={...R,...N(qt.validate,R.message)},!n))return w(R.message),C}else if(He(b)){let $={};for(const R in b){if(!rt($)&&!n)break;const F=ju(await b[R](_,r),x,R);F&&($={...F,...N(R,F.message)},w(F.message),n&&(C[h]=$))}if(!rt($)&&(C[h]={ref:x,...$},!n))return C}}return w(!0),C};const mE={mode:Wt.onSubmit,reValidateMode:Wt.onChange,shouldFocusError:!0},Ph={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function yE(e={}){let t={...mE,...e},r={...Ke(Ph),isLoading:mt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=He(t.defaultValues)||He(t.values)?Ke(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ke(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let g={...f};const m={array:xu(),state:xu()},b=t.criteriaMode===Wt.all,h=S=>E=>{clearTimeout(d),d=setTimeout(S,E)},y=async S=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||S)){let E;t.resolver?(E=rt((await N()).errors),v()):E=await R({fields:n,onlyCheckValid:!0,eventType:Or.VALID}),E!==r.isValid&&m.state.next({isValid:E})}},v=(S,E)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((S||Array.from(a.mount)).forEach(T=>{T&&(E?Me(r.validatingFields,T,E):Ye(r.validatingFields,T))}),m.state.next({validatingFields:r.validatingFields,isValidating:!rt(r.validatingFields)}))},_=()=>{r.dirtyFields=zr(s,i)},x=(S,E=[],T,U,z=!0,Q=!0)=>{if(U&&T&&!t.disabled){if(o.action=!0,Q&&Array.isArray(H(n,S))){const V=T(H(n,S),U.argA,U.argB);z&&Me(n,S,V)}if(Q&&Array.isArray(H(r.errors,S))){const V=T(H(r.errors,S),U.argA,U.argB);z&&Me(r.errors,S,V),gE(r.errors,S)}if((f.touchedFields||g.touchedFields)&&Q&&Array.isArray(H(r.touchedFields,S))){const V=T(H(r.touchedFields,S),U.argA,U.argB);z&&Me(r.touchedFields,S,V)}(f.dirtyFields||g.dirtyFields)&&_(),m.state.next({name:S,isDirty:M(S,E),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Me(i,S,E)},w=(S,E)=>{Me(r.errors,S,E),r.errors={...r.errors},m.state.next({errors:r.errors})},C=S=>{r.errors=S,m.state.next({errors:r.errors,isValid:!1})},I=S=>{const E=qs(S)?[S]:io(S);let T=i,U=s;for(let z=0;z<E.length-1;z++){const Q=E[z];if(T=at(T)?T:T[Q],U=at(U)?U:U[Q],T===null&&U!==null)return!0}return!1},j=(S,E,T,U)=>{const z=H(n,S);if(z){if(I(S))return;const Q=$e(H(i,S)),V=H(i,S,$e(T)?H(s,S):T);$e(V)||U&&U.defaultChecked||E?Me(i,S,E?V:Eu(z._f)):ve(S,V),o.mount&&!o.action&&(y(),Q&&r.isDirty&&(f.isDirty||g.isDirty)&&(M()||(r.isDirty=!1,m.state.next({...r}))),e.shouldUnregister&&Q&&!$e(H(i,S))&&Fo(S,a)&&(o.watch=!0))}},k=(S,E,T,U,z)=>{let Q=!1,V=!1;const te={name:S};if(!t.disabled){if(!T||U){(f.isDirty||g.isDirty)&&(V=r.isDirty,r.isDirty=te.isDirty=M(),Q=V!==te.isDirty);const ye=At(H(s,S),E);V=!!H(r.dirtyFields,S),ye!==r.isDirty?r.dirtyFields=zr(s,i):ye?Ye(r.dirtyFields,S):Me(r.dirtyFields,S,!0),te.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||g.dirtyFields)&&V!==!ye}if(T){const ye=H(r.touchedFields,S);ye||(Me(r.touchedFields,S,T),te.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||g.touchedFields)&&ye!==T)}Q&&z&&m.state.next(te)}return Q?te:{}},L=(S,E,T,U)=>{const z=H(r.errors,S),Q=(f.isValid||g.isValid)&&kt(E)&&r.isValid!==E;if(t.delayError&&T?(c=h(()=>w(S,T)),c(t.delayError)):(clearTimeout(d),c=null,T?Me(r.errors,S,T):Ye(r.errors,S),r.errors={...r.errors}),(T?!At(z,T):z)||!rt(U)||Q){const V={...U,...Q&&kt(E)?{isValid:E}:{},errors:r.errors,name:S};r={...r,...V},m.state.next(V)}},N=async S=>(v(S,!0),await t.resolver(i,t.context,cE(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),A=async S=>{const{errors:E}=await N(S);if(v(S),S){for(const T of S){const U=H(E,T);U?a.array.has(T)&&He(U)&&!Object.keys(U).some(z=>!Number.isNaN(Number(z)))?Nu(r.errors,{[T]:U},T):Me(r.errors,T,U):Ye(r.errors,T)}r.errors={...r.errors}}else r.errors=E;return E},$=async({name:S,eventType:E})=>{if(e.validate){const T=await e.validate({formValues:i,formState:r,name:S,eventType:E});if(He(T))for(const U in T){const z=T[U];z&&Pe(`${Mo}.${U}`,{message:yt(z.message)?z.message:"",type:z.type||qt.validate})}else yt(T)||!T?Pe(Mo,{message:T||"",type:qt.validate}):xe(Mo);return T}return!0},R=async({fields:S,onlyCheckValid:E,name:T,eventType:U,context:z={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(z.runRootValidation=!0,!await $({name:T,eventType:U})&&(z.valid=!1,E)))return z.valid;for(const Q in S){const V=S[Q];if(V){const{_f:te,...ye}=V;if(te){const Ve=a.array.has(te.name),xt=V._f&&uE(V._f),St=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;xt&&St&&v([te.name],!0);const ur=await Ru(V,a.disabled,i,b,t.shouldUseNativeValidation&&!E,Ve);if(xt&&St&&v([te.name]),ur[te.name]&&(z.valid=!1,E)||(!E&&(H(ur,te.name)?Ve?Nu(r.errors,ur,te.name):Me(r.errors,te.name,ur[te.name]):Ye(r.errors,te.name)),e.shouldUseNativeValidation&&ur[te.name]))break}!rt(ye)&&await R({context:z,onlyCheckValid:E,fields:ye,name:Q,eventType:U})}}return z.valid},F=()=>{for(const S of a.unMount){const E=H(n,S);E&&(E._f.refs?E._f.refs.every(T=>!Lo(T)):!Lo(E._f.ref))&&je(S)}a.unMount=new Set},M=(S,E)=>!t.disabled&&(S&&E&&Me(i,S,E),!At(K(),s)),Z=(S,E,T)=>Ta(S,a,{...o.mount?i:$e(E)?s:yt(S)?{[S]:E}:E},T,E),ae=S=>Ih(H(o.mount?i:s,S,t.shouldUnregister?H(s,S,[]):[])),ve=(S,E,T={},U=!1)=>{const z=H(n,S);let Q=E;if(z){const V=z._f;V&&(!V.disabled&&Me(i,S,kh(E,V)),Q=Pi(V.ref)&&at(E)?"":E,Nh(V.ref)?[...V.ref.options].forEach(te=>te.selected=Q.includes(te.value)):V.refs?Vs(V.ref)?V.refs.forEach(te=>{(!te.defaultChecked||!te.disabled)&&(Array.isArray(Q)?te.checked=!!Q.find(ye=>ye===te.value):te.checked=Q===te.value||!!Q)}):V.refs.forEach(te=>te.checked=te.value===Q):vl(V.ref)?V.ref.value="":(V.ref.value=Q,V.ref.type||m.state.next({name:S,values:U?i:Ke(i)})))}(T.shouldDirty||T.shouldTouch)&&k(S,Q,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&Y(S)},we=(S,E,T,U=!1)=>{for(const z in E){if(!E.hasOwnProperty(z))return;const Q=E[z],V=S+"."+z,te=H(n,V);(a.array.has(S)||He(Q)||te&&!te._f)&&!Wr(Q)?we(V,Q,T,U):ve(V,Q,T,U)}},he=(S,E,T,U)=>{const z=H(n,S),Q=a.array.has(S),V=U?E:Ke(E),te=H(i,S),ye=At(te,V);if(ye||Me(i,S,V),Q)m.array.next({name:S,values:U?i:Ke(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&T.shouldDirty&&(_(),m.state.next({name:S,dirtyFields:r.dirtyFields,isDirty:M(S,V)}));else{const Ve=Array.isArray(V)&&!V.length||rt(V);!z||z._f||at(V)||Ve?ve(S,V,T,U):we(S,V,T,U)}if(!ye){const Ve=Fo(S,a),xt=U?i:Ke(i);m.state.next({...Ve&&r,name:o.mount||Ve?S:void 0,values:xt})}},W=(S,E,T={})=>he(S,E,T,!1),J=(S,E={})=>{const T=mt(S)?S(i):S;if(!At(i,T)){i={...i,...T};for(const U of a.mount)he(U,H(T,U),E,!0);m.state.next({...r,name:void 0,type:void 0,values:i}),E.shouldValidate&&y()}},se=async S=>{o.mount=!0;const E=S.target;let T=E.name,U=!0;const z=H(n,T),Q=ye=>{U=Number.isNaN(ye)||Wr(ye)&&isNaN(ye.getTime())||At(ye,H(i,T,ye))},V=Du(t.mode),te=Du(t.reValidateMode);if(z){let ye,Ve;const xt=E.type?Eu(z._f):Ia(S),St=S.type===Or.BLUR||S.type===Or.FOCUS_OUT,ur=!dE(z._f)&&!e.validate&&!t.resolver&&!H(r.errors,T)&&!z._f.deps||pE(St,H(r.touchedFields,T),r.isSubmitted,te,V),Gn=Fo(T,a,St);Me(i,T,xt),St?(!E||!E.readOnly)&&(z._f.onBlur&&z._f.onBlur(S),c&&c(0)):z._f.onChange&&z._f.onChange(S);const $r=k(T,xt,St),et=!rt($r)||Gn;if(!St&&m.state.next({name:T,type:S.type,values:Ke(i)}),ur)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?St&&y():St||y()),et&&m.state.next({name:T,...Gn?{}:$r});if(!t.resolver&&e.validate&&await $({name:T,eventType:S.type}),!St&&Gn&&m.state.next({...r}),t.resolver){const{errors:ut}=await N([T]);if(v([T]),Q(xt),!U){!rt($r)&&m.state.next($r);return}const bt=Tu(r.errors,n,T),zt=Tu(ut,n,bt.name||T);ye=zt.error,T=zt.name,Ve=rt(ut)}else v([T],!0),ye=(await Ru(z,a.disabled,i,b,t.shouldUseNativeValidation))[T],v([T]),Q(xt),U&&(ye?Ve=!1:(f.isValid||g.isValid)&&(Ve=await R({fields:n,onlyCheckValid:!0,name:T,eventType:S.type})));U&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&Y(z._f.deps),L(T,Ve,ye,$r))}},B=(S,E)=>{if(H(r.errors,E)&&S.focus)return S.focus(),1},Y=async(S,E={})=>{let T,U;const z=_i(S);if(t.resolver){const Q=await A($e(S)?S:z);T=rt(Q),U=S?!z.some(V=>H(Q,V)):T}else S?(U=(await Promise.all(z.map(async Q=>{const V=H(n,Q);return await R({fields:V&&V._f?{[Q]:V}:V,eventType:Or.TRIGGER})}))).every(Boolean),!(!U&&!r.isValid)&&y()):U=T=await R({fields:n,name:S,eventType:Or.TRIGGER});return m.state.next({...!yt(S)||(f.isValid||g.isValid)&&T!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:T}:{},errors:r.errors}),E.shouldFocus&&!U&&ms(n,B,S?z:a.mount),U},K=(S,E)=>{let T={...o.mount?i:s};return E&&(T=Th(E.dirtyFields?r.dirtyFields:r.touchedFields,T)),$e(S)?T:yt(S)?H(T,S):S.map(U=>H(T,U))},ue=(S,E)=>({invalid:!!H((E||r).errors,S),isDirty:!!H((E||r).dirtyFields,S),error:H((E||r).errors,S),isValidating:!!H(r.validatingFields,S),isTouched:!!H((E||r).touchedFields,S)}),xe=S=>{const E=S?_i(S):void 0;E==null||E.forEach(T=>Ye(r.errors,T)),E?E.forEach(T=>{m.state.next({name:T,errors:r.errors})}):m.state.next({errors:{}})},Pe=(S,E,T)=>{const U=(H(n,S,{_f:{}})._f||{}).ref,z=H(r.errors,S)||{},{ref:Q,message:V,type:te,...ye}=z;Me(r.errors,S,{...ye,...E,ref:U}),m.state.next({name:S,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&U&&U.focus&&U.focus()},me=(S,E)=>mt(S)?m.state.subscribe({next:T=>"values"in T&&S(T.values||Z(void 0,E),T)}):Z(S,E,!0),le=S=>m.state.subscribe({next:E=>{if(hE(S.name,E.name,S.exact)&&fE(E,S.formState||f,lr,S.reRenderRoot)){const T={...i};S.callback({values:T,...r,...E,defaultValues:s})}}}).unsubscribe,pe=S=>(o.mount=!0,g={...g,...S.formState},le({...S,formState:{...u,...S.formState}})),je=(S,E={})=>{for(const T of S?_i(S):a.mount)a.mount.delete(T),a.array.delete(T),E.keepValue||(Ye(n,T),Ye(i,T)),!E.keepError&&Ye(r.errors,T),!E.keepDirty&&Ye(r.dirtyFields,T),!E.keepTouched&&Ye(r.touchedFields,T),!E.keepIsValidating&&Ye(r.validatingFields,T),!t.shouldUnregister&&!E.keepDefaultValue&&Ye(s,T);m.state.next({values:Ke(i)}),m.state.next({...r,...E.keepDirty?{isDirty:M()}:{}}),!E.keepIsValid&&y()},Ue=({disabled:S,name:E})=>{if(kt(S)&&o.mount||S||a.disabled.has(E)){const z=a.disabled.has(E)!==!!S;S?a.disabled.add(E):a.disabled.delete(E),z&&o.mount&&!o.action&&y()}},De=(S,E={})=>{let T=H(n,S);const U=kt(E.disabled)||kt(t.disabled),z=!a.registerName.has(S)&&T&&T._f&&!T._f.mount;return Me(n,S,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:S}},name:S,mount:!0,...E}}),a.mount.add(S),T&&!z?Ue({disabled:kt(E.disabled)?E.disabled:t.disabled,name:S}):j(S,!0,E.value),{...U?{disabled:E.disabled||t.disabled}:{},...t.progressive?{required:!!E.required,min:ss(E.min),max:ss(E.max),minLength:ss(E.minLength),maxLength:ss(E.maxLength),pattern:ss(E.pattern)}:{},name:S,onChange:se,onBlur:se,ref:Q=>{if(Q){a.registerName.add(S),De(S,E),a.registerName.delete(S),T=H(n,S);const V=$e(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,te=iE(V),ye=T._f.refs||[];if(te?ye.find(Ve=>Ve===V):V===T._f.ref)return;Me(n,S,{_f:{...T._f,...te?{refs:[...ye.filter(Lo),V,...Array.isArray(H(s,S))?[{}]:[]],ref:{type:V.type,name:S}}:{ref:V}}}),j(S,!1,void 0,V)}else T=H(n,S,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||E.shouldUnregister)&&!(Sh(a.array,S)&&o.action)&&a.unMount.add(S)}}},ee=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&ms(n,B,a.mount),ze=S=>{kt(S)&&(m.state.next({disabled:S}),ms(n,(E,T)=>{const U=H(n,T);U&&(E.disabled=U._f.disabled||S,Array.isArray(U._f.refs)&&U._f.refs.forEach(z=>{z.disabled=U._f.disabled||S}))},0,!1))},Xe=(S,E)=>async T=>{let U;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let z=Ke(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:V}=await N();v(),r.errors=Q,z=Ke(V)}else await R({fields:n,eventType:Or.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Ye(z,Q);if(Ye(r.errors,Oh),rt(r.errors)){m.state.next({errors:{}});try{await S(z,T)}catch(Q){U=Q}}else E&&await E({...r.errors},T),ee(),setTimeout(ee);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:rt(r.errors)&&!U,submitCount:r.submitCount+1,errors:r.errors}),U)throw U},q=(S,E={})=>{H(n,S)&&($e(E.defaultValue)?W(S,Ke(H(s,S))):(W(S,E.defaultValue),Me(s,S,Ke(E.defaultValue))),E.keepTouched||Ye(r.touchedFields,S),E.keepDirty||(Ye(r.dirtyFields,S),r.isDirty=E.defaultValue?M(S,Ke(H(s,S))):M()),E.keepError||(Ye(r.errors,S),f.isValid&&y()),m.state.next({...r}))},re=(S,E={})=>{const T=S?Ke(S):s,U=Ke(T),z=rt(S),Q=U;if(E.keepDefaultValues||(s=T),!E.keepValues){if(E.keepDirtyValues){const V=new Set([...a.mount,...Object.keys(zr(s,i))]);for(const te of Array.from(V)){const ye=H(r.dirtyFields,te),Ve=H(i,te),xt=H(Q,te);ye&&!$e(Ve)?Me(Q,te,Ve):!ye&&!$e(xt)&&W(te,xt)}}else{if(so&&$e(S))for(const V of a.mount){const te=H(n,V);if(te&&te._f){const ye=Array.isArray(te._f.refs)?te._f.refs[0]:te._f.ref;if(Pi(ye)){const Ve=ye.closest("form");if(Ve){Ve.reset();break}}}}if(E.keepFieldsRef)for(const V of a.mount)W(V,H(Q,V));else n={}}if(t.shouldUnregister){if(i=E.keepDefaultValues?Ke(s):{},E.keepFieldsRef)for(const V of a.mount)Me(i,V,H(Q,V))}else i=Ke(Q);m.array.next({values:{...Q}}),m.state.next({values:{...Q}})}a={mount:E.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!E.keepIsValid||!!E.keepDirtyValues||!t.shouldUnregister&&!rt(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!E.keepIsValid,o.action=!1,E.keepErrors||(r.errors={}),m.state.next({submitCount:E.keepSubmitCount?r.submitCount:0,isDirty:z?!1:E.keepDirty?r.isDirty:E.keepValues?M():!!(E.keepDefaultValues&&!At(S,s)),isSubmitted:E.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:z?{}:E.keepDirtyValues?E.keepDefaultValues&&i?zr(s,i):r.dirtyFields:E.keepDefaultValues&&S?zr(s,S):E.keepDirty?r.dirtyFields:{},touchedFields:E.keepTouched?r.touchedFields:{},errors:E.keepErrors?r.errors:{},isSubmitSuccessful:E.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},ie=(S,E)=>re(mt(S)?S(i):S,{...t.resetOptions,...E}),We=(S,E={})=>{const T=H(n,S),U=T&&T._f;if(U){const z=U.refs?U.refs[0]:U.ref;z.focus&&setTimeout(()=>{z.focus(),E.shouldSelect&&mt(z.select)&&z.select()})}},lr=S=>{r={...r,...S}},dn={control:{register:De,unregister:je,getFieldState:ue,handleSubmit:Xe,setError:Pe,_subscribe:le,_runSchema:N,_updateIsValidating:v,_focusError:ee,_getWatch:Z,_getDirty:M,_setValid:y,_setFieldArray:x,_setDisabledField:Ue,_setErrors:C,_getFieldArray:ae,_reset:re,_resetDefaultValues:()=>mt(t.defaultValues)&&t.defaultValues().then(S=>{ie(S,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:ze,_subjects:m,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(S){o=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},get _options(){return t},set _options(S){t={...t,...S}}},subscribe:pe,trigger:Y,register:De,handleSubmit:Xe,watch:me,setValue:W,setValues:J,getValues:K,reset:ie,resetField:q,resetDefaultValues:(S,E={})=>{if(s=Ke(S),!E.keepDirty){const T=zr(s,i);r.dirtyFields=T,r.isDirty=!rt(T)}E.keepIsValid||y(),m.state.next({...r,defaultValues:s})},clearErrors:xe,unregister:je,setError:Pe,setFocus:We,getFieldState:ue};return{...dn,formControl:dn}}function vE(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...Ke(Ph),isLoading:mt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:mt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!mt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=yE(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,ml(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!At(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),p.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=p.useMemo(()=>Dh(s,o),[o,s]),t.current}async function ku(e){var r,n;return(n=(r=(await Le.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function bE(e){var r,n;return((n=(r=(await Le.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function Mh(e,t){const r=Si({queryKey:["framework",e],queryFn:()=>ku(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Si({queryKey:["framework",n],queryFn:()=>ku(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function _E(e,t,r){const n=e??[],s=new Set(n.map(u=>u.type).filter(Boolean)),i=(t??[]).filter(u=>!s.has(u)),{data:o}=Si({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>bE({type:i,systemDefault:"Yes"}),enabled:i.length>0,staleTime:10*60*1e3}),a=t&&t.length?n.filter(u=>u.type&&t.includes(u.type)):n,c=[...(o??[]).map(u=>({label:u.name,value:u.identifier})),...a.map(u=>({label:u.name,value:u.identifier}))],d=new Set;return c.filter(u=>d.has(u.value)?!1:(d.add(u.value),!0))}async function wE(e){var r,n;return(n=(r=(await Le.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function xE(e){var r,n,s,i,o,a;const t=Si({queryKey:["channel",e],queryFn:()=>wE(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}const SE={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Third Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."},"Sixth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},CE=new Set(["review","read","sourcingreview","orgreview"]),ei={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},OE={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},EE={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},_l={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Lh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function DE(e,t,r,n,s={}){if(!(e!=null&&e.length))return UE(t,n,r);const i=new Map;for(const a of e){const c=a.code;c&&!i.has(c)&&i.set(c,a)}const o=new Set;return e.filter(a=>{if(n&&(a.code==="dialCode"||a.code==="dialcode")||a.visible===!1)return!1;const c=a.code;return o.has(c)?!1:(o.add(c),!0)}).map(a=>{const c=a.code??"",d=AE(a),u=PE(a,r,t,i,s),f=t[c],g=TE(c,Fh(f,d),d,t,s),m={code:c,label:a.label??c,inputType:d,required:!!(a.required===!0||Array.isArray(a.validations)&&a.validations.some(b=>b.type==="required")),editable:IE(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:RE(u,g,d,r),depends:a.depends,tab:kE(a),section:a.section,defaultValue:a.defaultValue??a.default,currentValue:g};if(c==="dialcodes"){const b=t.dialcodeRequired==="Yes";return{...m,required:b,visible:b}}return m})}function IE(e,t,r){var i;const n=r.editorMode??"edit";if(!CE.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function TE(e,t,r,n,s){const i=t==null||t===""||Array.isArray(t)&&t.length===0;switch(e){case"license":return i?s.defaultLicense??"":t;case"copyright":return i&&s.setDefaultCopyRight&&s.channelName?s.channelName:t;case"author":case"creator":return i&&s.userFullName?s.userFullName:t;case"instructions":{const o=n.instructions;return o&&typeof o=="object"&&!Array.isArray(o)?o.default??"":typeof t=="object"&&t!==null?"":t}case"maxTime":case"warningTime":{if(!i)return t;const o=n.timeLimits,a=o==null?void 0:o[e];return a!=null&&a!==""?NE(Number(a)):t}default:return t}}function NE(e){if(!Number.isFinite(e)||e<0)return"";const t=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),s=i=>String(i).padStart(2,"0");return n>0?`${s(n)}:${s(r)}:${s(t)}`:`${s(r)}:${s(t)}`}function jE(e){var n,s,i;const t=new Map,r=o=>o==null?void 0:o.forEach(a=>{a.identifier&&t.set(a.identifier,a.name),a.name&&t.set(a.name,a.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(o=>r(o.terms)),(i=e.targetFrameworks)==null||i.forEach(o=>{var a;return(a=o.categories)==null?void 0:a.forEach(c=>r(c.terms))}),t}function RE(e,t,r,n){if(r!=="select"&&r!=="multiselect"&&r!=="radio")return e;const s=Array.isArray(t)?t:t!=null&&t!==""?[t]:[];if(!s.length)return e;const i=e?[...e]:[],o=new Set(i.map(c=>c.value)),a=jE(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function kE(e){const t=e.section;if(t){if(ei[t])return ei[t];const n=OE[t];if(n&&ei[n])return ei[n]}const r=e.code??"";return EE[r]??"details"}function Fh(e,t){const r=new Set(["multiselect","chips","keywords","tagsinput"]),n=new Set(["select","text","textarea","radio","datepicker","datetime","license"]);return r.has(t)?Array.isArray(e)?e:e!=null&&e!==""?[e]:[]:n.has(t)?Array.isArray(e)?e[0]??"":e??"":e}function AE(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"?"select":t==="framework"||t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function PE(e,t,r,n,s){const i=e.code??"";if(i==="maxQuestions"){const d=s.childCount??0;if(d>0)return Array.from({length:d},(u,f)=>({label:String(f+1),value:String(f+1)}))}const o=e.range;if(Array.isArray(o)&&o.length)return typeof o[0]=="string"?o.map(d=>({label:d,value:d})):o.map(d=>({label:d.name,value:d.identifier}));const a=e.enum;if(a!=null&&a.length)return a.map(d=>({label:d,value:d}));if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories"){const u=(s.objectType??"")==="QuestionSet"?s.contentAdditionalCategories??s.collectionAdditionalCategories:s.collectionAdditionalCategories??s.contentAdditionalCategories,f=(u&&u.length?u:s.contextAdditionalCategories)??t.channelAdditionalCategories;return f!=null&&f.length?$E(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??_l[i];if(c)return $h(i,c,e,t,r,n)}function ME(e,t){return Lh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function LE(e,t){return Lh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function $o(e,t,r){var i,o,a,c,d;const n=(o=(i=e.organisationFramework)==null?void 0:i.categories)==null?void 0:o.find(u=>u.code===t),s=(d=(c=(a=e.targetFrameworks)==null?void 0:a[0])==null?void 0:c.categories)==null?void 0:d.find(u=>u.code===t);return r?(s==null?void 0:s.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(s==null?void 0:s.terms)??[]}function FE(e){const t=new Set,r=[];for(const n of e){const s=n.identifier??n.name;s&&!t.has(s)&&(t.add(s),r.push(n))}return r}function $E(e){return Array.from(new Set(e))}function BE(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function $h(e,t,r,n,s,i){const o=ME(e,r),a=LE(e,r),c=h=>({label:h.name,value:o?h.identifier:h.name}),d=r.depends;if(!(d!=null&&d.length))return $o(n,t,a).map(c);const u=d.flatMap(h=>BE(s[h])).map(String);if(!u.length)return[];const f=[];for(const h of d){const y=i.get(h),v=(y==null?void 0:y.sourceCategory)??_l[h]??h;f.push(...$o(n,v,a))}const m=f.filter(h=>u.includes(String(h.name))||u.includes(String(h.identifier))||u.includes(String(h.code))).flatMap(h=>h.associations??[]).filter(h=>String(h.category??"").toLowerCase()===t.toLowerCase()),b=FE(m);return b.length?b.map(c):$o(n,t,a).map(c)}function is(e,t){const r=_l[e];if(r)return $h(e,r,{},t,{},new Map)}function ot(e,t,r){return Fh(e[t],r)}function UE(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:ot(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:ot(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:ot(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:ot(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:ot(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:ot(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:is("subjectIds",r),currentValue:ot(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:ot(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:is("targetBoardIds",r),currentValue:ot(e,"targetBoardIds","select")},{code:"targetMediumIds",label:"Medium(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetBoardIds"],options:is("targetMediumIds",r),currentValue:ot(e,"targetMediumIds","multiselect")},{code:"targetGradeLevelIds",label:"Class(es) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetMediumIds"],options:is("targetGradeLevelIds",r),currentValue:ot(e,"targetGradeLevelIds","multiselect")},{code:"targetSubjectIds",label:"Subject(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetGradeLevelIds"],options:is("targetSubjectIds",r),currentValue:ot(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ot(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ot(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ot(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ot(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ot(e,"license","select")})),n}const zE=["allowECM","levels","setPeriod","instances"];function Bh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function VE(e,t={}){const r={...e};for(const i of zE)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Bh(n)});const s=e.instances;return s!=null&&s!==""&&(r.instances={label:s}),t.isReview&&(r.name===void 0||r.name===null||r.name==="")&&t.nodeTitle&&(r.name=t.nodeTitle),r}function qE(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Bh(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function HE(e,t){const{watch:r,setValue:n}=e,s=p.useRef(!1);p.useEffect(()=>{const i=r((o,{name:a})=>{var c;if(!(!a||s.current)){s.current=!0;try{const d=new Set([a]);let u=!0;for(;u;){u=!1;for(const f of t)d.has(f.code)||(c=f.depends)!=null&&c.some(g=>d.has(g))&&(n(f.code,f.inputType==="multiselect"||f.inputType==="chips"?[]:"",{shouldDirty:!0}),d.add(f.code),u=!0)}}finally{s.current=!1}}});return()=>i.unsubscribe()},[r,n,t])}const WE="_section_ylgu8_1",KE="_header_ylgu8_11",QE="_title_ylgu8_17",GE="_description_ylgu8_24",YE="_divider_ylgu8_30",XE="_fields_ylgu8_36",wn={section:WE,header:KE,title:QE,description:GE,divider:YE,fields:XE},ZE=({title:e,description:t,children:r})=>l.jsxs("div",{className:wn.section,children:[l.jsxs("div",{className:wn.header,children:[l.jsx("h3",{className:wn.title,children:e}),t&&l.jsx("p",{className:wn.description,children:t})]}),l.jsx("hr",{className:wn.divider}),l.jsx("div",{className:wn.fields,children:r})]}),JE="_field_1s288_1",eD="_fullWidth_1s288_7",tD="_label_1s288_11",rD="_required_1s288_19",nD="_input_1s288_24",sD="_textarea_1s288_45",iD="_inputError_1s288_50",oD="_error_1s288_54",aD="_selectBtn_1s288_59",lD="_selectOpen_1s288_83",cD="_placeholder_1s288_87",uD="_selectedVal_1s288_91",dD="_chevronUp_1s288_95",fD="_dropdown_1s288_100",hD="_option_1s288_116",pD="_optionSelected_1s288_134",gD="_noOpts_1s288_139",mD="_chipGroup_1s288_146",yD="_chipInput_1s288_158",vD="_addChipBtn_1s288_167",bD="_radioGroup_1s288_184",_D="_radioLabel_1s288_191",wD="_iconWrap_1s288_199",xD="_iconPreview_1s288_214",SD="_iconPlaceholder_1s288_220",CD="_removeIconBtn_1s288_233",OD="_tagChip_1s288_252",ED="_tagChipRemove_1s288_264",DD="_nestedSelectRow_1s288_278",ID="_dialcodeRow_1s288_287",TD="_validateBtn_1s288_293",ND="_dialcodeValid_1s288_315",jD="_dialcodeSpinner_1s288_325",P={field:JE,fullWidth:eD,label:tD,required:rD,input:nD,textarea:sD,inputError:iD,error:oD,selectBtn:aD,selectOpen:lD,placeholder:cD,selectedVal:uD,chevronUp:dD,dropdown:fD,option:hD,optionSelected:pD,noOpts:gD,chipGroup:mD,chipInput:yD,addChipBtn:vD,radioGroup:bD,radioLabel:_D,iconWrap:wD,iconPreview:xD,iconPlaceholder:SD,removeIconBtn:CD,tagChip:OD,tagChipRemove:ED,nestedSelectRow:DD,dialcodeRow:ID,validateBtn:TD,dialcodeValid:ND,dialcodeSpinner:jD},Au=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[P.field,s?P.fullWidth:""].join(" "),children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[P.input,P.textarea,d?P.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[P.input,d?P.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:P.error,children:String(d.message)})]})},RD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),g=d(e),m=((h=r.find(y=>y.value===g))==null?void 0:h.label)??"Select…",b=f[e];return p.useEffect(()=>{if(!i)return;const y=v=>{var _;(_=a.current)!=null&&_.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,b?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g?P.selectedVal:P.placeholder,children:m}),l.jsx(Ls,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,g===y.value?P.optionSelected:""].join(" "),onClick:()=>{u(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),g===y.value&&l.jsx(Hn,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),b&&l.jsx("span",{className:P.error,children:String(b.message)})]})},kD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),g=d(e)??[],m=f[e],b=g.length?`${g.length} selected`:"Select…";p.useEffect(()=>{if(!i)return;const y=v=>{var _;(_=a.current)!=null&&_.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=g.includes(y)?g.filter(_=>_!==y):[...g,y];u(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,m?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g.length?P.selectedVal:P.placeholder,children:b}),l.jsx(Ls,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,g.includes(y.value)?P.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Hn,{size:13,style:{opacity:g.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),m&&l.jsx("span",{className:P.error,children:String(m.message)})]})},AD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),d=p.useRef(null),{watch:u,setValue:f,formState:{errors:g}}=Yt(),m=u(e)??[],b=g[e],h=()=>{const v=i.trim();v&&!m.includes(v)&&f(e,[...m,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,m.filter(_=>_!==v),{shouldDirty:!0});return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.chipGroup,children:[m.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:P.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:P.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=d.current)==null?void 0:v.focus()},50)},children:[l.jsx(Fs,{size:12})," Add"]}))]}),b&&l.jsx("span",{className:P.error,children:String(b.message)})]})},PD=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Yt(),a=o[e];return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.radioGroup,children:r.map(c=>l.jsxs("label",{className:P.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:P.error,children:String(a.message)})]})};async function MD(e,t,r,n){var o,a;const i=(a=(o=(await Le.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function LD(e,t){var s,i;const n=(i=(s=(await Le.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function FD(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function $D(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Le.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const BD="_overlay_ga6eh_1",UD="_modal_ga6eh_12",zD="_header_ga6eh_24",VD="_title_ga6eh_33",qD="_closeBtn_ga6eh_39",HD="_tabs_ga6eh_57",WD="_tab_ga6eh_57",KD="_activeTab_ga6eh_83",QD="_body_ga6eh_88",GD="_searchWrap_ga6eh_99",YD="_searchIcon_ga6eh_104",XD="_searchInput_ga6eh_113",ZD="_grid_ga6eh_132",JD="_imgCell_ga6eh_148",eI="_imgCellSelected_ga6eh_166",tI="_thumb_ga6eh_171",rI="_noThumb_ga6eh_177",nI="_checkBadge_ga6eh_183",sI="_loadMoreBtn_ga6eh_198",iI="_loadingRow_ga6eh_220",oI="_empty_ga6eh_230",aI="_spinner_ga6eh_237",lI="_uploadArea_ga6eh_247",cI="_dropZone_ga6eh_256",uI="_uploadIcon_ga6eh_277",dI="_dropText_ga6eh_281",fI="_dropSubtext_ga6eh_288",hI="_uploadPreview_ga6eh_294",pI="_hiddenInput_ga6eh_301",gI="_fileName_ga6eh_305",mI="_errorText_ga6eh_311",yI="_footer_ga6eh_318",vI="_cancelBtn_ga6eh_328",bI="_confirmBtn_ga6eh_345",ge={overlay:BD,modal:UD,header:zD,title:VD,closeBtn:qD,tabs:HD,tab:WD,activeTab:KD,body:QD,searchWrap:GD,searchIcon:YD,searchInput:XD,grid:ZD,imgCell:JD,imgCellSelected:eI,thumb:tI,noThumb:rI,checkBadge:nI,loadMoreBtn:sI,loadingRow:iI,empty:oI,spinner:aI,uploadArea:lI,dropZone:cI,uploadIcon:uI,dropText:dI,dropSubtext:fI,uploadPreview:hI,hiddenInput:pI,fileName:gI,errorText:mI,footer:yI,cancelBtn:vI,confirmBtn:bI},Pu=18,Uh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,d]=p.useState([]),[u,f]=p.useState(0),[g,m]=p.useState(!1),[b,h]=p.useState(null),[y,v]=p.useState(0),[_,x]=p.useState(null),[w,C]=p.useState(""),[I,j]=p.useState(!1),[k,L]=p.useState(""),N=p.useRef(null),A=oe(B=>{var Y,K;return((K=(Y=B.editorConfig)==null?void 0:Y.context)==null?void 0:K.channel)??""}),$=oe(B=>{var Y,K;return((K=(Y=B.editorConfig)==null?void 0:Y.context)==null?void 0:K.uid)??""}),R=oe(B=>{var Y,K,ue;return((ue=(K=(Y=B.editorConfig)==null?void 0:Y.context)==null?void 0:K.cloudStorage)==null?void 0:ue.presigned_headers)??{}}),F=oe(B=>{var Y,K,ue;return((ue=(K=(Y=B.editorConfig)==null?void 0:Y.config)==null?void 0:K.assetConfig)==null?void 0:ue.size)??1*1024*1024}),M=oe(B=>{var Y,K,ue;return((ue=(K=(Y=B.editorConfig)==null?void 0:Y.config)==null?void 0:K.assetConfig)==null?void 0:ue.accepted)??"image/png,image/jpeg"}),Z=p.useCallback(async(B,Y,K=!1)=>{var ue;m(!0);try{const xe={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&$&&(xe.createdBy=$),A&&(xe.channel=A);const me=((ue=(await Le.post("/action/composite/v3/search",{request:{filters:xe,query:B,limit:Pu,offset:Y,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ue.result)??{},le=me.content??[];f(me.count??0),d(pe=>K?[...pe,...le]:le)}catch{}finally{m(!1)}},[s,$,A]);p.useEffect(()=>{s!=="upload"&&(d([]),v(0),Z(o,0))},[s]);const ae=p.useRef(),ve=B=>{a(B),clearTimeout(ae.current),ae.current=setTimeout(()=>{d([]),v(0),Z(B,0)},400)},we=()=>{const B=y+Pu;v(B),Z(o,B,!0)},he=()=>{const B=(b==null?void 0:b.artifactUrl)??(b==null?void 0:b.appIcon)??(b==null?void 0:b.downloadUrl)??"";B&&r(B)};p.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const W=B=>{var ue;const Y=(ue=B.target.files)==null?void 0:ue[0];if(B.target.value="",!Y)return;const K=M.split(",").map(xe=>xe.trim());if(!K.includes(Y.type)){const xe=K.map(Pe=>Pe.replace("image/","").toUpperCase()).join(", ");L(`Only ${xe} files are accepted.`);return}if(Y.size>F){const xe=(F/1048576).toFixed(0);L(`Image must be under ${xe} MB.`);return}w&&URL.revokeObjectURL(w),x(Y),C(URL.createObjectURL(Y)),L("")},J=async()=>{if(_){j(!0),L("");try{const B=await MD(_.name.split(".").slice(0,-1).join(".")||_.name,_.type,$,A),Y=await LD(B,_.name);await FD(Y,_,R);const K=Y.split("?")[0],ue=await $D(B,K,_.type);r(ue)}catch(B){L(B instanceof Error?B.message:"Upload failed.")}finally{j(!1)}}},se=c.length<u;return l.jsx("div",{className:ge.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:ge.modal,children:[l.jsxs("div",{className:ge.header,children:[l.jsx("span",{className:ge.title,children:"Select App Icon"}),l.jsx("button",{className:ge.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(cn,{size:18})})]}),l.jsxs("div",{className:ge.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${ge.tab} ${s==="my"?ge.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${ge.tab} ${s==="all"?ge.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${ge.tab} ${s==="upload"?ge.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Ql,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:ge.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ge.searchWrap,children:[l.jsx(ua,{size:14,className:ge.searchIcon}),l.jsx("input",{type:"search",className:ge.searchInput,placeholder:"Search images…",value:o,onChange:B=>ve(B.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:ge.loadingRow,children:[l.jsx(ai,{size:20,className:ge.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:ge.empty,children:"No images found"}):l.jsx("div",{className:ge.grid,children:c.map(B=>{const Y=B.appIcon??B.artifactUrl??B.downloadUrl??"",K=(b==null?void 0:b.identifier)===B.identifier;return l.jsxs("button",{type:"button",className:`${ge.imgCell} ${K?ge.imgCellSelected:""}`,onClick:()=>h(B),title:B.name,children:[Y?l.jsx("img",{src:Y,alt:B.name,className:ge.thumb}):l.jsx("div",{className:ge.noThumb,children:"IMG"}),K&&l.jsx("div",{className:ge.checkBadge,children:l.jsx(Hn,{size:12})})]},B.identifier)})}),se&&!g&&l.jsx("button",{className:ge.loadMoreBtn,onClick:we,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:ge.loadingRow,children:l.jsx(ai,{size:16,className:ge.spinner})})]}):l.jsxs("div",{className:ge.uploadArea,children:[l.jsx("div",{className:ge.dropZone,onClick:()=>{var B;return(B=N.current)==null?void 0:B.click()},onDragOver:B=>B.preventDefault(),onDrop:B=>{B.preventDefault();const Y=B.dataTransfer.files[0];Y&&W({target:{files:[Y],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:ge.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Ql,{size:32,className:ge.uploadIcon}),l.jsx("p",{className:ge.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:ge.dropSubtext,children:[M.split(",").map(B=>B.replace("image/","").toUpperCase()).join(", ")," · max ",(F/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:N,type:"file",accept:M,className:ge.hiddenInput,onChange:W}),_&&l.jsx("p",{className:ge.fileName,children:_.name}),k&&l.jsx("p",{className:ge.errorText,children:k})]})}),l.jsxs("div",{className:ge.footer,children:[l.jsx("button",{className:ge.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:ge.confirmBtn,disabled:!_||I,onClick:J,children:I?l.jsxs(l.Fragment,{children:[l.jsx(ai,{size:14,className:ge.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:ge.confirmBtn,disabled:!b,onClick:he,children:"Use Selected"})]})]})})},_I=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Yt(),f=a(e),g=u[e],m=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},b=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:P.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:P.iconPreview}):l.jsxs("div",{className:P.iconPlaceholder,children:[l.jsx(Kd,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:P.removeIconBtn,onClick:b,"aria-label":"Remove app icon",children:[l.jsx(Ga,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:P.error,children:String(g.message)}),i&&l.jsx(Uh,{nodeId:r,currentValue:f,onSelect:m,onClose:()=>o(!1)})]})},wI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=oo({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:P.error,children:String(o.message)})]})},xI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=oo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),d=p.useRef(null),u=i.value??[],f=h=>{const y=h.trim();!y||u.includes(y)||i.onChange([...u,y])},g=h=>{i.onChange(u.filter(y=>y!==h))},m=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&u.length>0&&g(u[u.length-1])},b=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:[P.chipGroup,o?P.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=d.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(h=>l.jsxs("span",{className:P.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:P.tagChipRemove,onClick:y=>{y.stopPropagation(),g(h)},"aria-label":`Remove ${h}`,children:l.jsx(cn,{size:11})})]},h)),!n&&l.jsx("input",{ref:d,className:P.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:m,onBlur:b,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:P.error,children:String(o.message)})]})},SI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=oo({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,g)=>{const m={};for(let b=0;b<f;b++)m[r[b].code]=c[r[b].code]??"";m[u]=g;for(let b=f+1;b<r.length;b++)m[r[b].code]="";o.onChange(m)};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.nestedSelectRow,children:r.map((u,f)=>{const g=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:P.field,style:{flex:1},children:[l.jsx("label",{className:P.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[P.input,a?P.inputError:""].join(" "),disabled:s||g,value:c[u.code]??"",onChange:m=>d(u.code,f,m.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(m=>l.jsx("option",{value:m.value,children:m.label},m.value))]})]},u.code)})}),a&&l.jsx("span",{className:P.error,children:String(a.message)})]})},Mu=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],CI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Yt(),f=c(e),g=Mu.find(h=>h.value===f),m=(g==null?void 0:g.label)??"Select license…",b=u[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:P.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[P.selectBtn,b?P.inputError:"",s?P.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?P.selectedVal:P.placeholder,children:m}),l.jsx(Ls,{size:14,className:s?P.chevronUp:""})]}),s&&l.jsx("div",{className:P.dropdown,role:"listbox",children:Mu.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[P.option,f===h.value?P.optionSelected:""].join(" "),onClick:()=>{d(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Hn,{size:13})]},h.value))}),b&&l.jsx("span",{className:P.error,children:String(b.message)})]})},OI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=oo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[d,u]=p.useState(""),f=async()=>{const m=(i.value??"").trim();if(!m){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const b=await $_(m),h=b==null?void 0:b.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},g=()=>a==="loading"?l.jsx(ai,{size:16,className:P.dialcodeSpinner}):a==="valid"?l.jsx(Vd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(ca,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:m=>{i.onChange(m),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:P.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),g()]}),o&&l.jsx("span",{className:P.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?P.dialcodeValid:P.error,children:d})]})},EI="_form_szqex_1",DI="_ungrouped_szqex_7",II="_noFields_szqex_18",Bo={form:EI,ungrouped:DI,noFields:II},TI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var pe,je,Ue,De,ee,ze,Xe;const a=oe(q=>q.editorConfig),c=oe(q=>q.rootFormConfig),d=oe(q=>q.unitFormConfig),u=oe(q=>q.categoryMeta),f=oe(q=>q.contentFramework),g=oe(q=>q.contentTargetFWIds),{organisationFramework:m,targetFrameworks:b,isLoading:h}=Mh(f??((pe=a==null?void 0:a.context)==null?void 0:pe.framework),g??((je=a==null?void 0:a.context)==null?void 0:je.targetFWIds)),{frameworks:y,collectionAdditionalCategories:v,contentAdditionalCategories:_,defaultLicense:x,name:w}=xE((Ue=a==null?void 0:a.context)==null?void 0:Ue.channel),C=_E(y,(De=u==null?void 0:u.frameworkMetadata)==null?void 0:De.orgFWType,(ee=a==null?void 0:a.context)==null?void 0:ee.channel),I={organisationFramework:m,targetFrameworks:b,orgFrameworks:C,channelAdditionalCategories:v},j=Ae(q=>q.selectedNodeId),k=Ae(q=>q.treeData),L=Ae(q=>q.treeCache),N=j?L[j]??{}:{},A={...e,...N},$=p.useMemo(()=>{var re;if(!j)return 0;const q=[...k];for(;q.length;){const ie=q.shift();if(ie.id===j)return((re=ie.children)==null?void 0:re.length)??0;ie.children&&q.push(...ie.children)}return 0},[k,j]),R=(a==null?void 0:a.config)??{},F=(a==null?void 0:a.context)??{},M={editorMode:s,editableFields:R.editableFields,objectType:R.objectType,setDefaultCopyRight:R.setDefaultCopyRight===!0,defaultLicense:F.defaultLicense??x,contextAdditionalCategories:F.additionalCategories,userFullName:(ze=F.user)==null?void 0:ze.fullName,channelName:w,collectionAdditionalCategories:v,contentAdditionalCategories:_,childCount:$},Z=r?c:d,ae=Z||(((Xe=a==null?void 0:a.config.hierarchy)==null?void 0:Xe.formConfig)??[]),ve=DE(ae,A,I,r,M),we=ve.filter(q=>q.tab===t&&q.inputType!=="appIcon"&&q.visible!==!1),he=vE({mode:"onChange",defaultValues:Object.fromEntries(ve.map(q=>{const re=["multiselect","chips","keywords","tagsinput"],ie=["nestedselect"];return re.includes(q.inputType)?[q.code,q.currentValue??q.defaultValue??[]]:ie.includes(q.inputType)?[q.code,q.currentValue??q.defaultValue??{}]:[q.code,q.currentValue??q.defaultValue??""]}))});HE(he,ve);const{updateNode:W}=Ae(),J=p.useRef(ve);J.current=ve;const se=p.useRef(j);se.current=j;const B=p.useRef(i);B.current=i;const Y=p.useRef(o);Y.current=o;const K=p.useRef(typeof A.shuffle=="boolean"?A.shuffle:void 0),ue=p.useRef(A.name??"");ue.current=A.name??"";const xe=p.useRef(s);xe.current=s;const Pe=["review","read","sourcingreview","orgreview"];p.useEffect(()=>{const q=se.current;if(q){const re=Object.fromEntries(J.current.filter(ie=>ie.currentValue!==void 0&&ie.currentValue!==null).map(ie=>[ie.code,ie.currentValue]));Object.keys(re).length>0&&W(q,re)}he.trigger().then(()=>{const re=he.formState.errors,ie=J.current,We=Array.from(new Set(Object.keys(re).map(lr=>{var cr;return(cr=ie.find(Fr=>Fr.code===lr))==null?void 0:cr.tab}).filter(Boolean)));Y.current(Object.keys(re).length===0,We)})},[]),p.useEffect(()=>{const q=he.watch((re,{name:ie})=>{const We=se.current;if(!We)return;const lr=J.current,cr=new Set(lr.map(S=>S.code));if(ie&&cr.has(ie)){let S=he.getValues(ie);ie==="dialcodes"&&(S=Array.isArray(S)?S:S?[S]:[]),ie==="shuffle"&&(S===!0&&K.current===!1&&Ee("Shuffling is enabled for this question set.",{icon:"ℹ️"}),K.current=S);const E=qE(ie,S);E&&(W(We,E),B.current(E))}else if(!ie){const S=he.getValues(),E=Object.fromEntries(Object.entries(S).filter(([U])=>cr.has(U))),T=VE(E,{isReview:Pe.includes(xe.current),nodeTitle:ue.current});Object.keys(T).length>0&&(W(We,T),B.current(T))}const Fr=he.formState.errors,dn=Array.from(new Set(Object.keys(Fr).map(S=>{var E;return(E=lr.find(T=>T.code===S))==null?void 0:E.tab}).filter(Boolean)));Y.current(Object.keys(Fr).length===0,dn)});return()=>q.unsubscribe()},[he]);const me=we.reduce((q,re)=>{const ie=q[q.length-1];return ie&&ie.section===re.section?ie.fields.push(re):q.push({section:re.section,fields:[re]}),q},[]),le=q=>{const re={key:q.code,name:q.code,label:q.label,required:q.required,disabled:q.editable===!1};switch(q.inputType){case"textarea":return l.jsx(Au,{...re,multiline:!0,maxLength:q.maxLength});case"select":return l.jsx(RD,{...re,options:q.options??[]});case"multiselect":return l.jsx(kD,{...re,options:q.options??[]});case"chips":return l.jsx(AD,{...re});case"radio":return l.jsx(PD,{...re,options:q.options??[]});case"appIcon":return l.jsx(_I,{...re,nodeId:j??""});case"datepicker":case"datetime":return l.jsx(wI,{...re});case"keywords":case"tagsinput":return l.jsx(xI,{...re});case"nestedselect":return l.jsx(SI,{...re,levels:q.levels??[]});case"license":return l.jsx(CI,{...re});case"dialcode":return l.jsx(OI,{...re});default:return l.jsx(Au,{...re,maxLength:q.maxLength})}};return l.jsx(nE,{...he,children:l.jsxs("div",{className:Bo.form,children:[me.map((q,re)=>{const ie=q.section?SE[q.section]:void 0;return ie?l.jsx(ZE,{title:ie.title,description:ie.description,children:q.fields.map(le)},q.section??re):l.jsx("div",{className:Bo.ungrouped,children:q.fields.map(le)},re)}),we.length===0&&!h&&l.jsx("p",{className:Bo.noFields,children:"No fields configured for this tab."})]})})};function zh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function NI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function ti(e){return e!==null&&e>=0}function jI(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function RI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Vh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=zh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},ri={scaleX:1,scaleY:1},kI=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...ri}:null}const c=AI(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...ri}:s<r&&s>=o?{x:0,y:a.height+c,...ri}:{x:0,y:0,...ri}};function AI(e,t,r){const n=e[t],s=e[t-1],i=e[t+1];return n?r<t?s?n.top-(s.top+s.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const qh="Sortable",Hh=p.createContext({activeIndex:-1,containerId:qh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vh,disabled:{draggable:!1,droppable:!1}});function PI(e){let{children:t,id:r,items:n,strategy:s=Vh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=Bd(),f=Ps(qh,r),g=a.rect!==null,m=p.useMemo(()=>n.map(I=>typeof I=="object"&&"id"in I?I.id:I),[n]),b=o!=null,h=o?m.indexOf(o.id):-1,y=d?m.indexOf(d.id):-1,v=p.useRef(m),_=!jI(m,v.current),x=y!==-1&&h===-1||_,w=RI(i);Kt(()=>{_&&b&&u(m)},[_,m,b,u]),p.useEffect(()=>{v.current=m},[m]);const C=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:x,items:m,overIndex:y,useDragOverlay:g,sortedRects:NI(m,c),strategy:s}),[h,f,w.draggable,w.droppable,x,m,y,c,g,s]);return p.createElement(Hh.Provider,{value:C},t)}const MI=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return zh(r,n,s).indexOf(t)},LI=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},FI={duration:200,easing:"ease"},Wh="transform",$I=Mr.Transition.toString({property:Wh,duration:0,easing:"linear"}),BI={roleDescription:"sortable"};function UI(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Kt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=qn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),p.useEffect(()=>{i&&o(null)},[i]),i}function zI(e){let{animateLayoutChanges:t=LI,attributes:r,disabled:n,data:s,getNewIndex:i=MI,id:o,strategy:a,resizeObserverConfig:c,transition:d=FI}=e;const{items:u,containerId:f,activeIndex:g,disabled:m,disableTransforms:b,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:_}=p.useContext(Hh),x=VI(n,m),w=u.indexOf(o),C=p.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),I=p.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:j,node:k,isOver:L,setNodeRef:N}=Um({id:o,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...c}}),{active:A,activatorEvent:$,activeNodeRect:R,attributes:F,setNodeRef:M,listeners:Z,isDragging:ae,over:ve,setActivatorNodeRef:we,transform:he}=$d({id:o,data:C,attributes:{...BI,...r},disabled:x.draggable}),W=Eg(N,M),J=!!A,se=J&&!b&&ti(g)&&ti(y),B=!v&&ae,Y=B&&se?he:null,ue=se?Y??(a??_)({rects:h,activeNodeRect:R,activeIndex:g,overIndex:y,index:w}):null,xe=ti(g)&&ti(y)?i({id:o,items:u,activeIndex:g,overIndex:y}):w,Pe=A==null?void 0:A.id,me=p.useRef({activeId:Pe,items:u,newIndex:xe,containerId:f}),le=u!==me.current.items,pe=t({active:A,containerId:f,isDragging:ae,isSorting:J,id:o,index:w,items:u,newIndex:me.current.newIndex,previousItems:me.current.items,previousContainerId:me.current.containerId,transition:d,wasDragging:me.current.activeId!=null}),je=UI({disabled:!pe,index:w,node:k,rect:j});return p.useEffect(()=>{J&&me.current.newIndex!==xe&&(me.current.newIndex=xe),f!==me.current.containerId&&(me.current.containerId=f),u!==me.current.items&&(me.current.items=u)},[J,xe,f,u]),p.useEffect(()=>{if(Pe===me.current.activeId)return;if(Pe&&!me.current.activeId){me.current.activeId=Pe;return}const De=setTimeout(()=>{me.current.activeId=Pe},50);return()=>clearTimeout(De)},[Pe]),{active:A,activeIndex:g,attributes:F,data:C,rect:j,index:w,newIndex:xe,items:u,isOver:L,isSorting:J,isDragging:ae,listeners:Z,node:k,overIndex:y,over:ve,setNodeRef:W,setActivatorNodeRef:we,setDroppableNodeRef:N,setDraggableNodeRef:M,transform:je??ue,transition:Ue()};function Ue(){if(je||le&&me.current.newIndex===w)return $I;if(!(B&&!Vi($)||!d)&&(J||pe))return Mr.Transition.toString({...d,property:Wh})}}function VI(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function Li(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const qI=[Ce.Down,Ce.Right,Ce.Up,Ce.Left],HI=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(qI.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const g=s.get(f.id);if(g)switch(e.code){case Ce.Down:n.top<g.top&&c.push(f);break;case Ce.Up:n.top>g.top&&c.push(f);break;case Ce.Left:n.left>g.left&&c.push(f);break;case Ce.Right:n.left<g.left&&c.push(f);break}});const d=Vg({collisionRect:n,droppableRects:s,droppableContainers:c});let u=xd(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),g=i.get(u),m=g?s.get(g.id):null,b=g==null?void 0:g.node.current;if(b&&m&&f&&g){const y=qi(b).some((I,j)=>a[j]!==I),v=Kh(f,g),_=WI(f,g),x=y||!v?{x:0,y:0}:{x:_?n.width-m.width:0,y:_?n.height-m.height:0},w={x:m.left,y:m.top};return x.x&&x.y?w:ws(w,x)}}}};function Kh(e,t){return!Li(e)||!Li(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function WI(e,t){return!Li(e)||!Li(t)||!Kh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const KI="_row_11nth_1",QI="_removeBtn_11nth_14",GI="_grip_11nth_17",YI="_ctIcon_11nth_34",XI="_info_11nth_38",ZI="_name_11nth_46",JI="_meta_11nth_55",Br={row:KI,removeBtn:QI,grip:GI,ctIcon:YI,info:XI,name:ZI,meta:JI},eT={video:Ya,pdf:Ha,h5p:Wa,scorm:Qa,audio:Ka,quiz:qa,default:Wn},tT=({item:e,onRemove:t,isEditable:r})=>{const n=no(e),s=eT[n.key]??Wn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=zI({id:e.id,disabled:!r}),f={transform:Mr.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Br.row,role:"listitem",children:[r&&l.jsx("span",{className:Br.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Wd,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Br.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Br.info,children:[l.jsx("span",{className:Br.name,title:e.name,children:e.name}),l.jsx("span",{className:Br.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Br.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(cn,{size:14})})]})},rT="_container_lzvke_1",nT="_header_lzvke_7",sT="_heading_lzvke_13",iT="_count_lzvke_21",oT="_list_lzvke_30",aT="_emptyState_lzvke_36",lT="_addRow_lzvke_52",Ur={container:rT,header:nT,heading:sT,count:iT,list:oT,emptyState:aT,addRow:lT},cT=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Ae(),i=t?r(t):[],o=e==="edit",a=bd(ia(Hi,{activationConstraint:{distance:5}}),ia(Ua,{coordinateGetter:HI})),c=p.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const m=Ae.getState().getChildrenOf(t),b=m.findIndex(y=>y.id===f.id),h=m.findIndex(y=>y.id===g.id);b<0||h<0||n(t,b,h)},[t,n]),d=p.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:Ur.container,children:[l.jsxs("div",{className:Ur.header,children:[l.jsx("span",{className:Ur.heading,children:"Content in this unit"}),l.jsx("span",{className:Ur.count,children:i.length})]}),i.length>0?l.jsx(Fd,{sensors:a,collisionDetection:zg,onDragEnd:c,children:l.jsx(PI,{items:i.map(u=>u.id),strategy:kI,children:l.jsx("div",{className:Ur.list,role:"list",children:i.map(u=>l.jsx(tT,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:Ur.emptyState,children:[l.jsx("p",{children:"No content yet"}),l.jsx("span",{children:"Drag from the library or click Add content"})]}),o&&l.jsxs("button",{className:Ur.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(Fs,{size:14})," Add content"]})]}):null},uT="_dropZone_ijo5w_1",dT="_active_ijo5w_14",Lu={dropZone:uT,active:dT},fT=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Lu.dropZone} ${e?Lu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function hT(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Le.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function pT(e){var r,n;return(n=(r=(await Le.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const gT="_contentPlayerRoot_ryh6z_1",mT="_stage_ryh6z_9",yT="_playerHeader_ryh6z_19",vT="_playerHeaderThumb_ryh6z_33",bT="_playerHeaderTitle_ryh6z_43",_T="_typeBadge_ryh6z_53",wT="_typeDot_ryh6z_92",xT="_aspectRatio_ryh6z_99",ST="_playerFrame_ryh6z_112",CT="_coverOverlay_ryh6z_120",OT="_coverHidden_ryh6z_132",ET="_coverThumb_ryh6z_137",DT="_coverPlayRing_ryh6z_146",IT="_coverPlayIcon_ryh6z_159",TT="_coverLabel_ryh6z_168",NT="_coverSkeleton_ryh6z_174",jT="_playerWrapper_ryh6z_200",RT="_infoStrip_ryh6z_210",kT="_infoChip_ryh6z_226",AT="_infoChipLabel_ryh6z_245",PT="_infoChipIcon_ryh6z_254",MT="_playerError_ryh6z_260",LT="_playerErrorIcon_ryh6z_274",FT="_playerErrorMsg_ryh6z_279",$T="_qumlRoot_ryh6z_286",Be={contentPlayerRoot:gT,stage:mT,playerHeader:yT,playerHeaderThumb:vT,playerHeaderTitle:bT,typeBadge:_T,typeDot:wT,aspectRatio:xT,playerFrame:ST,coverOverlay:CT,coverHidden:OT,coverThumb:ET,coverPlayRing:DT,coverPlayIcon:IT,coverLabel:TT,coverSkeleton:NT,playerWrapper:jT,infoStrip:RT,infoChip:kT,infoChipLabel:AT,infoChipIcon:PT,playerError:MT,playerErrorIcon:LT,playerErrorMsg:FT,qumlRoot:$T},BT=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"],label:"Video",icon:"🎬"},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"],label:"Audio",icon:"🎵"},{key:"pdf",mimes:["application/pdf"],label:"PDF",icon:"📄"},{key:"epub",mimes:["application/epub"],label:"ePub",icon:"📖"},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"],label:"ECML",icon:"✏️"},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"],label:"H5P",icon:"🎮"},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"],label:"SCORM",icon:"📦"}];function UT(e){return BT.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const zT={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},VT={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},qT={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},HT="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Uo(e){for(const[t,r]of Object.entries(zT))if(r.includes(e))return t;return"default-player"}function WT(e,t,r){var i;const n=r==null?void 0:r.context,s=t.mimeType??e.mimeType??"";return{context:{mode:"play",partner:[],pdata:{id:((i=n==null?void 0:n.pdata)==null?void 0:i.id)??"sunbird.portal",ver:1,pid:"sunbird-portal"},contentId:e.identifier,sid:(n==null?void 0:n.sid)??"",uid:(n==null?void 0:n.uid)??"",channel:(n==null?void 0:n.channel)??"",did:(n==null?void 0:n.did)??"",timeDiff:0,contextRollup:{},tags:[],app:[(n==null?void 0:n.channel)??""],dims:""},config:{showEndPage:!1,showStartPage:!0,host:"",overlay:{showUser:!1},splash:{text:"",icon:"",bgImage:"",webLink:""},sideMenu:{showDownload:!0,showExit:!1,showShare:!0},apislug:"/action",repos:["/sunbird-plugins/renderer"],plugins:[{id:"org.sunbird.iframeEvent",ver:1,type:"plugin"},{id:"org.sunbird.player.endpage",ver:1.1,type:"plugin"}],enableTelemetryValidation:!1},metadata:t,data:s==="application/vnd.ekstep.ecml-archive"?t.body??{}:{}}}function KT(e){return document.querySelector(`script[src="${e}"]`)?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${e}`)),document.head.appendChild(n)})}async function QT(e,t,r=100){await KT(VT[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const o=setInterval(()=>{i++,customElements.get(e)?(clearInterval(o),n()):i>=r&&(clearInterval(o),s(new Error(`Custom element <${e}> did not register`)))},100)})}const GT=[{key:"author",label:"Author",icon:"👤"},{key:"license",label:"License",icon:"⚖️"},{key:"language",label:"Language",icon:"🌐"},{key:"gradeLevel",label:"Class",icon:"🏫"},{key:"subject",label:"Subject",icon:"📚"},{key:"contentType",label:"Type",icon:"🏷️"}];function YT({node:e}){const t=e.metadata??{},r=GT.flatMap(n=>{const s=t[n.key];if(!s)return[];const i=Array.isArray(s)?s.join(", "):String(s);return i?[{...n,val:i}]:[]});return r.length?l.jsx("div",{className:Be.infoStrip,children:r.map(n=>l.jsxs("div",{className:Be.infoChip,children:[n.icon&&l.jsx("span",{className:Be.infoChipIcon,children:n.icon}),l.jsx("span",{className:Be.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function XT({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Be.coverOverlay} ${t?Be.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Be.coverThumb}),l.jsx("div",{className:Be.coverPlayRing,children:l.jsx("div",{className:Be.coverPlayIcon})}),l.jsx("span",{className:Be.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Be.coverSkeleton})})}function ZT({message:e}){return l.jsxs("div",{className:Be.playerError,children:[l.jsx("span",{className:Be.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Be.playerErrorMsg,children:e})]})}function JT({mimeType:e}){const t=UT(e);return l.jsxs("span",{className:Be.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Be.typeDot}),t.label]})}const ka=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(tN,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Be.contentPlayerRoot,children:[l.jsxs("div",{className:Be.stage,children:[l.jsxs("div",{className:Be.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Be.playerHeaderThumb}),l.jsx("span",{className:Be.playerHeaderTitle,children:e.name}),l.jsx(JT,{mimeType:e.mimeType??""})]}),l.jsx(eN,{node:e})]}),l.jsx(YT,{node:e})]})};function eN({node:e}){var y;const t=oe(v=>v.editorConfig),[r,n]=p.useState(()=>Uo(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,d]=p.useState(e.metadata??{}),[u,f]=p.useState(!1),g=p.useRef(null),m=p.useRef(null),b=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??HT;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(Uo(e.mimeType??"")),pT(e.identifier).then(_=>{if(v)return;const x={...e.metadata??{},..._};d(x);const w=_.mimeType??e.mimeType??"";n(Uo(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=WT(e,c,t);return p.useEffect(()=>{if(!u||r!=="default-player")return;const v=g.current;if(!v)return;v.src=b;const _=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},x=()=>a("Preview player could not be loaded.");return v.addEventListener("load",_),v.addEventListener("error",x),()=>{v.removeEventListener("load",_),v.removeEventListener("error",x),v.src=""}},[e.identifier,r,b,u]),p.useEffect(()=>{if(!u||r==="default-player")return;const v=m.current;if(!v)return;const _=qT[r];if(!_)return;const x=h;QT(_,r).then(()=>{if(!m.current)return;if(!customElements.get(_)){n("default-player");return}const w=document.createElement(_);w.setAttribute("player-config",JSON.stringify(x)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=x}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Be.aspectRatio,children:[o?l.jsx(ZT,{message:o}):l.jsx(XT,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:Be.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:m,className:Be.playerFrame})]})}function tN({node:e,editorMode:t}){const r=oe(s=>s.editorConfig),n=p.useRef(null);return p.useEffect(()=>{var a;if(!n.current)return;const s=r==null?void 0:r.context,i={context:{mode:t==="edit"?"edit":"play",pdata:{id:((a=s==null?void 0:s.pdata)==null?void 0:a.id)??"sunbird.portal",ver:"1.0",pid:"sunbird-portal"},contentId:e.identifier,sid:(s==null?void 0:s.sid)??"",uid:(s==null?void 0:s.uid)??"",channel:(s==null?void 0:s.channel)??"",did:(s==null?void 0:s.did)??""},config:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1},metadata:e.metadata??{},data:{}},o=document.createElement("sunbird-quml-player");o.setAttribute("player-config",JSON.stringify(i)),n.current.innerHTML="",n.current.appendChild(o)},[e.identifier,t]),l.jsx("div",{className:Be.qumlRoot,children:l.jsx("div",{ref:n,className:Be.playerWrapper})})}const rN="_overlay_ifddx_1",nN="_modal_ifddx_11",sN="_header_ifddx_21",iN="_body_ifddx_37",oN="_hint_ifddx_43",aN="_list_ifddx_49",lN="_item_ifddx_55",cN="_selected_ifddx_68",uN="_empty_ifddx_73",dN="_footer_ifddx_79",fN="_cancelBtn_ifddx_87",hN="_moveBtn_ifddx_95",Ft={overlay:rN,modal:nN,header:sN,body:iN,hint:oN,list:aN,item:lN,selected:cN,empty:uN,footer:dN,cancelBtn:fN,moveBtn:hN};function pN(e,t,r){const n=[],s=i=>{var o;for(const a of i)a.isFolder&&a.id!==r&&a.id!==t&&n.push(a),(o=a.children)!=null&&o.length&&s(a.children)};return s(e),n}const gN=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Ae(),o=pN(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=p.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Ft.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Ft.modal,children:[l.jsxs("div",{className:Ft.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(cn,{size:16})})]}),l.jsxs("div",{className:Ft.body,children:[l.jsx("p",{className:Ft.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Ft.list,children:[o.map(f=>l.jsxs("li",{className:`${Ft.item} ${a===f.id?Ft.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(uy,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Ft.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Ft.footer,children:[l.jsx("button",{className:Ft.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Ft.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},mN="_overlay_16at9_1",yN="_modal_16at9_11",vN="_header_16at9_21",bN="_body_16at9_37",_N="_table_16at9_43",wN="_pageInput_16at9_61",xN="_empty_16at9_68",SN="_footer_16at9_74",CN="_cancelBtn_16at9_82",ON="_saveBtn_16at9_90",tr={overlay:mN,modal:yN,header:vN,body:bN,table:_N,pageInput:wN,empty:xN,footer:SN,cancelBtn:CN,saveBtn:ON};function EN(e){const t=[],r=n=>{var s;for(const i of n)!i.isFolder&&(!i.children||i.children.length===0)?t.push(i):(s=i.children)!=null&&s.length&&r(i.children)};return r(e),t}const DN=({onClose:e})=>{const{treeData:t,updateNode:r}=Ae(),n=EN(t),[s,i]=p.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=p.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:tr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:tr.modal,children:[l.jsxs("div",{className:tr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(cn,{size:16})})]}),l.jsx("div",{className:tr.body,children:n.length===0?l.jsx("p",{className:tr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:tr.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:tr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:tr.footer,children:[l.jsx("button",{className:tr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:tr.saveBtn,onClick:o,children:[l.jsx(by,{size:14})," Save"]})]})]})})},IN="_container_1a7t2_1",TN="_panelHeader_1a7t2_10",NN="_panelHeaderLeft_1a7t2_19",jN="_panelCollapseBtn_1a7t2_27",RN="_titleRow_1a7t2_46",kN="_field_1a7t2_47",AN="_moveBtn_1a7t2_64",PN="_icon_1a7t2_84",MN="_nameInput_1a7t2_93",LN="_fieldHeader_1a7t2_118",FN="_label_1a7t2_124",$N="_fieldCount_1a7t2_133",BN="_chips_1a7t2_170",UN="_chip_1a7t2_170",zN="_chipRemove_1a7t2_188",VN="_keywordInput_1a7t2_202",qN="_input_1a7t2_207",HN="_addBtn_1a7t2_220",WN="_radioGroup_1a7t2_234",KN="_radioLabel_1a7t2_239",qe={container:IN,panelHeader:TN,panelHeaderLeft:NN,panelCollapseBtn:jN,titleRow:RN,field:kN,moveBtn:AN,icon:PN,nameInput:MN,fieldHeader:LN,label:FN,fieldCount:$N,chips:BN,chip:UN,chipRemove:zN,keywordInput:VN,input:qN,addBtn:HN,radioGroup:WN,radioLabel:KN},QN=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var A,$;const{updateNode:s,markDirty:i}=Ae(),o=t==="edit",a=no(e),c=oe(R=>R.relationalFormConfig),d=R=>c==null?void 0:c.find(F=>F.code===R),u=R=>!c||!!d(R),f=(R,F)=>{var M;return((M=d(R))==null?void 0:M.label)||F},[g,m]=p.useState(!0),b=((A=e.metadata)==null?void 0:A.relationalMetadata)??{},[h,y]=p.useState(b.name??e.name??""),[v,_]=p.useState(""),[x,w]=p.useState(Array.isArray(b.keywords)?b.keywords:Array.isArray(($=e.metadata)==null?void 0:$.keywords)?e.metadata.keywords:[]),[C,I]=p.useState(!!b.optional);p.useEffect(()=>{var F,M;const R=((F=e.metadata)==null?void 0:F.relationalMetadata)??{};y(R.name??e.name??""),w(Array.isArray(R.keywords)?R.keywords:Array.isArray((M=e.metadata)==null?void 0:M.keywords)?e.metadata.keywords:[]),I(!!R.optional)},[e.id]);const j=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},k=()=>{const R=v.trim();if(R&&!x.includes(R)){const F=[...x,R];w(F),s(e.id,{keywords:F}),i()}_("")},L=R=>{const F=x.filter(M=>M!==R);w(F),s(e.id,{keywords:F}),i()},N=R=>{I(R),s(e.id,{optional:R}),i()};return l.jsxs("div",{className:qe.container,children:[l.jsxs("div",{className:qe.panelHeader,children:[l.jsxs("div",{className:qe.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:qe.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:qe.panelCollapseBtn,onClick:()=>m(R=>!R),"aria-expanded":g,"aria-label":g?"Collapse metadata panel":"Expand metadata panel",title:g?"Collapse":"Expand",children:g?l.jsx(Ls,{size:15}):l.jsx(ay,{size:15})})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:qe.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:qe.icon}),l.jsx("input",{type:"text",className:qe.nameInput,value:h,disabled:!o,onChange:R=>y(R.target.value),onBlur:j,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:qe.field,children:[l.jsx("div",{className:qe.fieldHeader,children:l.jsxs("label",{className:qe.label,children:[f("keywords","Keywords"),x.length>0&&l.jsx("span",{className:qe.fieldCount,children:x.length})]})}),x.length>0&&l.jsx("div",{className:qe.chips,children:x.map(R=>l.jsxs("span",{className:qe.chip,children:[R,o&&l.jsx("button",{type:"button",className:qe.chipRemove,onClick:()=>L(R),children:"×"})]},R))}),o&&l.jsxs("div",{className:qe.keywordInput,children:[l.jsx("input",{type:"text",className:qe.input,value:v,placeholder:"Add keyword and press Enter",onChange:R=>_(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),k())}}),l.jsx("button",{type:"button",className:qe.addBtn,onClick:k,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:qe.field,children:[l.jsx("label",{className:qe.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:qe.radioGroup,children:[l.jsxs("label",{className:qe.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:qe.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>N(!1),disabled:!o}),"No"]})]})]})]}),n]})},GN="_iconBtn_vl14u_1",YN="_editable_vl14u_14",XN="_iconImg_vl14u_26",ZN="_placeholder_vl14u_34",JN="_removeBtn_vl14u_41",os={iconBtn:GN,editable:YN,iconImg:XN,placeholder:ZN,removeBtn:JN},ej=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=Ae(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[os.iconBtn,r?os.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:os.iconImg}):l.jsx("div",{className:os.placeholder,children:l.jsx(Kd,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:os.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Ga,{size:11})})]}),n&&l.jsx(Uh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},tj="_leafContentLayout_1osey_1",rj="_container_1osey_17",nj="_emptyState_1osey_26",sj="_titleRow_1osey_36",ij="_nodeTitle_1osey_52",oj="_formArea_1osey_74",aj="_contentListArea_1osey_78",lj="_dropZone_1osey_83",cj="_reviewComment_1osey_90",uj="_reviewCommentLabel_1osey_103",dj="_reviewCommentText_1osey_109",Vt={leafContentLayout:tj,container:rj,emptyState:nj,titleRow:sj,nodeTitle:ij,formArea:oj,contentListArea:aj,dropZone:lj,reviewComment:cj,reviewCommentLabel:uj,reviewCommentText:dj},fj=["application/vnd.sunbird.questionset"],hj=({editorMode:e,onToolbarEvent:t})=>{var A,$,R,F;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,d]=p.useState(!1),u=p.useRef(null),f=p.useRef(),{selectedNodeId:g,breadcrumb:m,activeNodeMeta:b,updateNode:h,treeData:y}=Ae(),v=oe(M=>{var Z,ae,ve,we;return((ae=(Z=M.editorConfig)==null?void 0:Z.context)==null?void 0:ae.contentId)??((we=(ve=M.editorConfig)==null?void 0:ve.context)==null?void 0:we.identifier)??""}),_=g?Qh(y,g):null,x=!!_&&!_.parent,w=!!(_!=null&&_.isFolder),C=_&&fj.includes(_.mimeType??""),I=_&&!_.isFolder&&!C&&!x,j=((A=_==null?void 0:_.metadata)==null?void 0:A.rejectComment)??(x?(R=($=y[0])==null?void 0:$.metadata)==null?void 0:R.rejectComment:void 0),k=p.useCallback(()=>{const M=u.current;if(!M||!g)return;const Z=M.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(g,{name:Z})},600)},[g,h]),L=p.useCallback(M=>{t({action:"onFormValueChange",data:M})},[t]),N=p.useCallback((M,Z)=>{i(Z),t({action:"onFormStatusChange",data:{isValid:M,nodeId:g}})},[t,g]);return _?C?l.jsx(ka,{node:_,editorMode:e,type:"quml"}):I?l.jsxs("div",{className:Vt.leafContentLayout,children:[l.jsx(ka,{node:_,editorMode:e,type:"content"}),l.jsx(QN,{node:_,editorMode:e,onMoveClick:()=>a(_.identifier),reorderDialog:o?l.jsx(gN,{resourceId:o,resourceName:_.name,currentUnitId:_.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Vt.container,children:[l.jsx(QO,{crumbs:m}),j&&l.jsxs("div",{className:Vt.reviewComment,role:"alert",children:[l.jsx("span",{className:Vt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Vt.reviewCommentText,children:j})]}),l.jsxs("div",{className:Vt.titleRow,children:[x&&g&&l.jsx(ej,{nodeId:g,value:String(_.appIcon??((F=_.metadata)==null?void 0:F.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Vt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:k,onBlur:k,"data-placeholder":"Untitled","aria-label":"Node title",children:_.name})]}),l.jsx(eE,{activeTab:r,onChange:M=>n(M),errorTabs:s,visibleTabs:x?void 0:["details"]}),l.jsx("div",{className:Vt.formArea,children:l.jsx(TI,{nodeMetadata:b,activeTab:r,isRoot:x,isFolder:w,editorMode:e,onFormValueChange:L,onFormStatusChange:N},`${g??"none"}:${x?"root":"node"}`)}),(w||x)&&r==="details"&&l.jsx("div",{className:Vt.contentListArea,children:l.jsx(cT,{editorMode:e})}),l.jsx(fT,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Vt.dropZone}),c&&l.jsx(DN,{contentId:v,onClose:()=>d(!1)})]}):l.jsx("div",{className:Vt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Qh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Qh(r.children,t);if(n)return n}}}const Gh=Qi((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),pj=20;function Yh(){var d;const e=oe(u=>u.editorConfig),t=Ae(u=>u.selectedNodeId),r=Ae(u=>u.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function u(f,g,m=0){var b;for(const h of f){if(h.id===g)return m;if((b=h.children)!=null&&b.length){const y=u(h.children,g,m+1);if(y>=0)return y}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...bu];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...bu]}function gj(){const e=Gh(),t=oe(f=>{var g,m;return((m=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:m.channel)??""}),r=Yh(),n=p.useRef(),s=p.useCallback(async(f="",g="all",m={},b=!0,h=!1)=>{var y,v,_,x,w;e.setLoading(!0);try{const C={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(y=m==null?void 0:m.board)!=null&&y.length&&(C.board=m.board),(v=m==null?void 0:m.medium)!=null&&v.length&&(C.medium=m.medium),(_=m==null?void 0:m.gradeLevel)!=null&&_.length&&(C.gradeLevel=m.gradeLevel),(x=m==null?void 0:m.subject)!=null&&x.length&&(C.subject=m.subject),(w=m==null?void 0:m.primaryCategory)!=null&&w.length&&(C.primaryCategory=m.primaryCategory);const I=b?0:e.offset,{content:j,count:k}=await hT({filters:C,query:f,limit:f?50:pj,offset:I,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});b?e.setContent(j,k):e.appendContent(j,k)}catch(C){console.error("[useLibrary] load error:",C)}finally{e.setLoading(!1)}},[r,t]);p.useEffect(()=>{s()},[t]);const i=p.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=p.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=p.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=p.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),d=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const mj="_card_jzciw_1",yj="_addBtn_jzciw_17",vj="_dragging_jzciw_24",bj="_ctIcon_jzciw_29",_j="_info_jzciw_33",wj="_name_jzciw_41",xj="_meta_jzciw_50",Sj="_addBtnMuted_jzciw_78",Cj="_added_jzciw_87",Oj="_addedBadge_jzciw_96",rr={card:mj,addBtn:yj,dragging:vj,ctIcon:bj,info:_j,name:wj,meta:xj,addBtnMuted:Sj,added:Cj,addedBadge:Oj},Ej={video:Ya,pdf:Ha,h5p:Wa,scorm:Qa,audio:Ka,quiz:qa,default:Wn},Dj=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=no(e),o=Ej[i.key]??Wn,a=hl(),c=N1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:m}=$d({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),b=()=>{r&&r(e)};return l.jsxs("div",{ref:g,className:[rr.card,m?rr.dragging:"",s?rr.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:b,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,rr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:rr.info,children:[l.jsx("span",{className:rr.name,title:e.name,children:e.name}),l.jsxs("span",{className:rr.meta,children:[((h=e.organisation)==null?void 0:h[0])??e.channel??"",(y=e.organisation)!=null&&y[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:rr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Hn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[rr.addBtn,!d&&a?rr.addBtnMuted:""].join(" "),onClick:v=>{v.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(Fs,{size:14})})]})},Ij="_chips_xhhaq_1",Tj="_chip_xhhaq_1",Fu={chips:Ij,chip:Tj},Nj=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Fu.chips,role:"group","aria-label":"Content type filters",children:e.map(n=>l.jsx("button",{type:"button",role:"radio","aria-checked":t===n.value,className:["sbx-chip",t===n.value?"filled":"outline",Fu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),jj="_panel_1cl11_1",Rj="_header_1cl11_10",kj="_headerTitle_1cl11_19",Aj="_closeBtn_1cl11_25",Pj="_body_1cl11_43",Mj="_section_1cl11_59",Lj="_sectionLabel_1cl11_65",Fj="_chips_1cl11_73",$j="_chip_1cl11_73",Bj="_active_1cl11_96",Uj="_footer_1cl11_102",zj="_resetBtn_1cl11_112",Vj="_applyBtn_1cl11_129",nt={panel:jj,header:Rj,headerTitle:kj,closeBtn:Aj,body:Pj,section:Mj,sectionLabel:Lj,chips:Fj,chip:$j,active:Bj,footer:Uj,resetBtn:zj,applyBtn:Vj},qj=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],Hj=new Set(["board","medium","gradeLevel","subject","topic"]),Wj=({local:e,toggle:t})=>{const r=Yh();return r.length?l.jsxs("div",{className:nt.section,children:[l.jsx("div",{className:nt.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:nt.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[nt.chip,(e.primaryCategory??[]).includes(n)?nt.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},Kj=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var h,y;const s=oe(v=>v.editorConfig),i=oe(v=>v.searchFormConfig),o=oe(v=>v.contentFramework),a=oe(v=>v.contentTargetFWIds),{organisationFramework:c}=Mh(o??((h=s==null?void 0:s.context)==null?void 0:h.framework),a??((y=s==null?void 0:s.context)==null?void 0:y.targetFWIds)),[d,u]=p.useState(t),f=i!=null&&i.length?i.filter(v=>Hj.has(v.code)).map(v=>({key:v.code,label:v.label||v.code})):qj;p.useEffect(()=>{u(t)},[t]);const g=(v,_)=>{u(x=>{const w=x[v]??[],C=w.includes(_)?w.filter(I=>I!==_):[...w,_];return{...x,[v]:C}})},m=(c==null?void 0:c.categories)??[],b=v=>{var _;return((_=m.find(x=>x.code===v))==null?void 0:_.terms)??[]};return e?l.jsxs("div",{className:nt.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:nt.header,children:[l.jsx("span",{className:nt.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:nt.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(cn,{size:16})})]}),l.jsxs("div",{className:nt.body,children:[f.map(({key:v,label:_})=>{const x=b(v);return x.length?l.jsxs("div",{className:nt.section,children:[l.jsx("div",{className:nt.sectionLabel,children:_}),l.jsx("div",{className:nt.chips,children:x.slice(0,20).map(w=>l.jsx("button",{type:"button",className:[nt.chip,(d[v]??[]).includes(w.name)?nt.active:""].join(" "),onClick:()=>g(v,w.name),children:w.name},w.identifier))})]},v):null}),l.jsx(Wj,{local:d,toggle:g})]}),l.jsxs("div",{className:nt.footer,children:[l.jsx("button",{type:"button",className:nt.resetBtn,onClick:()=>u({}),children:"Reset"}),l.jsx("button",{type:"button",className:nt.applyBtn,onClick:()=>{r(d),n()},children:"Apply"})]})]}):null},Qj="_header_6qdpu_10",Gj="_title_6qdpu_20",Yj="_headerActions_6qdpu_31",Xj="_iconBtn_6qdpu_38",Zj="_playerArea_6qdpu_56",Jj="_footer_6qdpu_64",eR="_addBtn_6qdpu_73",tR="_modalOverlay_6qdpu_92",rR="_modalPanel_6qdpu_103",fr={header:Qj,title:Gj,headerActions:Yj,iconBtn:Xj,playerArea:Zj,footer:Jj,addBtn:eR,modalOverlay:tR,modalPanel:rR},nR=({content:e,onAdd:t,onClose:r})=>{if(!e)return null;const n={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Ar.createPortal(l.jsx("div",{className:fr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:fr.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:fr.header,children:[l.jsx("span",{className:fr.title,title:e.name,children:e.name}),l.jsx("div",{className:fr.headerActions,children:l.jsx("button",{type:"button",className:fr.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(cn,{size:16})})})]}),l.jsx("div",{className:fr.playerArea,children:l.jsx(ka,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:fr.footer,children:l.jsx("button",{type:"button",className:fr.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},sR="_dock_1lpg0_1",iR="_header_1lpg0_8",oR="_headerLeft_1lpg0_17",aR="_headerTitle_1lpg0_24",lR="_count_1lpg0_30",cR="_searchRow_1lpg0_39",uR="_searchWrap_1lpg0_47",dR="_searchIcon_1lpg0_53",fR="_searchInput_1lpg0_62",hR="_filterToggleBtn_1lpg0_80",pR="_filterToggleBtnActive_1lpg0_99",gR="_filterBadge_1lpg0_105",mR="_filters_1lpg0_124",yR="_mainArea_1lpg0_134",vR="_sidePanelOverlay_1lpg0_143",bR="_cardList_1lpg0_152",_R="_skeleton_1lpg0_168",wR="_skeletonIcon_1lpg0_178",xR="_skeletonText_1lpg0_186",SR="_skeletonLine_1lpg0_193",CR="_skeletonLineSm_1lpg0_200",OR="_loadMoreBtn_1lpg0_215",ER="_emptyState_1lpg0_240",DR="_collapseBtn_1lpg0_260",Fe={dock:sR,header:iR,headerLeft:oR,headerTitle:aR,count:lR,searchRow:cR,searchWrap:uR,searchIcon:dR,searchInput:fR,filterToggleBtn:hR,filterToggleBtnActive:pR,filterBadge:gR,filters:mR,mainArea:yR,sidePanelOverlay:vR,cardList:bR,skeleton:_R,skeletonIcon:wR,skeletonText:xR,skeletonLine:SR,skeletonLineSm:CR,loadMoreBtn:OR,emptyState:ER,collapseBtn:DR};function IR(e){const t=new Set,r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t.add(n.identifier),n.children&&r.push(...n.children)}return t}const TR=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:g,toggleSort:m,loadMore:b}=gj(),{addResource:h,selectedNodeId:y,treeData:v}=Ae(),_=e==="edit",[x,w]=p.useState(!1),[C,I]=p.useState({}),[j,k]=p.useState(null),L=p.useMemo(()=>IR(v),[v]),N=p.useCallback(M=>{var ve;if(!y){Ee.error("Select a unit first");return}const Z=(ve=v[0])==null?void 0:ve.id;if(y===Z){Ee("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(h(M,y)===!1){Ee.error(`"${M.name}" is already in this collection`);return}Ee.success(`Added "${M.name}"`)},[y,h,v]),A=p.useCallback(M=>{I(M),g(M)},[g]),$=p.useCallback(M=>{k(M)},[]),R=p.useCallback(M=>{N(M),k(null)},[N]),F=p.useMemo(()=>Object.values(C).reduce((M,Z)=>M+((Z==null?void 0:Z.length)??0),0),[C]);return l.jsxs("div",{className:Fe.dock,children:[l.jsx("div",{className:Fe.header,children:l.jsxs("div",{className:Fe.headerLeft,children:[l.jsx("button",{type:"button",className:Fe.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(my,{size:15})}),l.jsx(hy,{size:16}),l.jsx("span",{className:Fe.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Fe.count,children:i})]})}),l.jsxs("div",{className:Fe.searchRow,children:[l.jsxs("div",{className:Fe.searchWrap,children:[l.jsx(ua,{size:14,className:Fe.searchIcon}),l.jsx("input",{type:"search",className:Fe.searchInput,placeholder:"Search content…",value:a,onChange:M=>u(M.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Fe.filterToggleBtn,c?Fe.filterToggleBtnActive:""].join(" "),onClick:m,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(iy,{size:15}):l.jsx(ly,{size:15})}),l.jsxs("button",{type:"button",className:[Fe.filterToggleBtn,x?Fe.filterToggleBtnActive:""].join(" "),onClick:()=>w(M=>!M),"aria-label":"Toggle advanced filters","aria-pressed":x,title:"Advanced filters",children:[l.jsx(xy,{size:15}),F>0&&l.jsx("span",{className:Fe.filterBadge,children:F})]})]}),l.jsx("div",{className:Fe.filters,children:l.jsx(Nj,{filters:j1,active:o,onChange:f})}),l.jsxs("div",{className:Fe.mainArea,children:[l.jsx("div",{className:Fe.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((M,Z)=>l.jsxs("div",{className:Fe.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Fe.skeletonIcon}),l.jsxs("div",{className:Fe.skeletonText,children:[l.jsx("div",{className:Fe.skeletonLine}),l.jsx("div",{className:Fe.skeletonLineSm})]})]},Z)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(M=>l.jsx(Dj,{item:M,onAdd:N,onPreview:$,isDraggable:_,isAdded:L.has(M.identifier)},M.identifier)),d&&l.jsx("button",{type:"button",className:Fe.loadMoreBtn,onClick:b,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Fe.emptyState,children:[l.jsx(ua,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),x&&l.jsx("div",{className:Fe.sidePanelOverlay,children:l.jsx(Kj,{isOpen:x,filters:C,onApply:A,onClose:()=>w(!1)})}),j&&l.jsx(nR,{content:j,onAdd:R,onClose:()=>k(null)})]})]})};function NR(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(g,m=!1){const b={};for(const[h,y]of Object.entries(g))if(!i.has(h)&&!(m&&o.has(h)))if(a.has(h))Array.isArray(y)?b[h]=y:y!=null&&y!==""?b[h]=[y]:b[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(b[h]=v)}else b[h]=y;return b}function u(g){var b;const m={};for(const h of g.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,..._}=y;if(Object.keys(_).length===0)continue;const x=((b=h.metadata)==null?void 0:b.relationalMetadata)??{};m[h.identifier]={name:h.name,...x,..._}}return m}function f(g,m){var x,w;const b=g.identifier,h=t[b],y=b.startsWith("temp-")||!!(h!=null&&h.isNew),v=!g.isFolder&&!m;if(m||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:b,contentType:((x=g.metadata)==null?void 0:x.contentType)??"CourseUnit",primaryCategory:((w=g.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:g.name,visibility:"Parent",channel:r,...d(g.metadata??{})};else if(m){const{isNew:I,...j}=h??{};C={...d(g.metadata??{},!0),...d(j,!1),name:g.name}}else{const{isNew:I,...j}=h??{};C={name:g.name,visibility:"Parent",...d(j,!0)}}n[b]={metadata:C,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:m,isNew:y}}const _=g.isFolder?u(g):{};s[b]={name:g.name,children:(g.children??[]).map(C=>C.identifier),...Object.keys(_).length>0?{relationalMetadata:_}:{},root:m},(g.children??[]).forEach(C=>f(C,!1))}return e.forEach((g,m)=>f(g,m===0)),{nodesModified:n,hierarchy:s}}function jR(){const[e,t]=p.useState(!1),r=Ae(u=>u.treeCache),n=Ae(u=>u.treeData),s=oe(u=>u.isDirty),i=oe(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=oe(),c=oe(u=>u.editorConfig);return{save:p.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",g=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:m,hierarchy:b}=NR(n,r,f),{identifiers:h}=await i_(u,m,b,g);h&&Object.keys(h).length>0&&Ae.getState().replaceNodeIds(h);const y=new Date().toISOString();a(y),o(!1)}catch(m){console.error("[useSaveHierarchy] save failed:",m),Ee.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function RR(e){const t=oe(o=>o.editorConfig),r=oe(o=>o.setButtonLoader),n=oe(o=>o.validateAllForms),s=Ae(o=>o.treeData);return{runAction:p.useCallback(async(o,a)=>{var u,f,g,m;const c=((u=t==null?void 0:t.context)==null?void 0:u.contentId)??((f=t==null?void 0:t.context)==null?void 0:f.identifier)??"";if(!c)return Ee.error("No content identifier found."),!1;const d=((g=t==null?void 0:t.context)==null?void 0:g.userId)??((m=t==null?void 0:t.context)==null?void 0:m.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await l_(c),Ee.success("Content sent for review"),!0):(Ee.error("Some units have missing required fields. Please fill them before sending for review."),!1);case"reject":{r("rejectCollection",!0);const b=(a==null?void 0:a.comment)??"";return await c_(c,b),Ee.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await o_(c,d),Ee.success("Content published successfully"),!0):(Ee.error("Some units have missing required fields. Please fill them before publishing."),!1);default:return!1}}catch(b){console.error(`[useToolbarActions] ${o} failed`,b);const h=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return Ee.error(`Failed to ${h}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const kR="_shell_90fon_1",AR="_workspace_90fon_8",PR="_sidebarCollapsed_90fon_16",MR="_dockCollapsed_90fon_19",LR="_dock_90fon_19",FR="_outline_90fon_40",$R="_reopenTab_90fon_45",BR="_outlineHidden_90fon_79",UR="_editor_90fon_86",zR="_dockHidden_90fon_101",VR="_dockReopenTab_90fon_108",qR="_dragChip_90fon_133",HR="_dragChipLabel_90fon_148",Nt={shell:kR,workspace:AR,sidebarCollapsed:PR,dockCollapsed:MR,dock:LR,outline:FR,reopenTab:$R,outlineHidden:BR,editor:UR,dockHidden:zR,dockReopenTab:VR,dragChip:qR,dragChipLabel:HR},WR=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState(!1),[u,f]=p.useState(!1),{addResource:g,treeData:m}=Ae(),b=oe(R=>R.setFormStatus),[h,y]=p.useState(!0),v=Ae(R=>R.selectedNodeId),{save:_,isSaving:x,isDirty:w,lastSaved:C}=jR(),{runAction:I}=RR(_);p.useEffect(()=>{if(!w)return;const R=F=>{F.preventDefault(),F.returnValue=""};return window.addEventListener("beforeunload",R),()=>window.removeEventListener("beforeunload",R)},[w]);const j=bd(ia(Hi,{activationConstraint:{distance:8}})),k=p.useCallback(R=>{var M;const F=(M=R.active.data.current)==null?void 0:M.item;F&&i(F)},[]),L=p.useCallback(R=>{var we,he;i(null);const F=(we=R.active.data.current)==null?void 0:we.item;if(!F)return;const M=R.over,Z=(M==null?void 0:M.id)??v??void 0;if(!Z){Ee.error("Drop onto a unit to add content");return}const ae=(he=m[0])==null?void 0:he.id;if(Z===ae){Ee.error("Drop content onto a unit, not directly on the course.");return}if(!g(F,Z)){Ee.error(`"${F.name}" is already in this collection`);return}r==null||r(F,Z),Ee.success(`Added "${F.name}" to unit`)},[v,g,r]),N=p.useCallback(async R=>{if(R.action==="onFormStatusChange"){const{isValid:F,nodeId:M}=R.data??{},Z=F!==!1;y(Z),M&&b(M,Z);return}if(R.action==="back"&&w){f(!0);return}if(R.action==="saveCollection"){if(!h){Ee.error("Please fill the required metadata");return}await _(),n==null||n(m),t==null||t(R);return}if(R.action==="sendForReview"||R.action==="reject"||R.action==="publish"){await I(R.action,R.data)&&(t==null||t(R));return}t==null||t(R)},[_,I,t,n,m,w,h]),A=p.useCallback(async()=>{await _(),f(!1),n==null||n(m),t==null||t({action:"back"})},[_,n,t,m]),$=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Fd,{sensors:j,onDragStart:k,onDragEnd:L,children:[l.jsxs("div",{className:Nt.shell,children:[l.jsx(yw,{editorMode:e,isSaving:x,isDirty:w,lastSaved:C,isFormValid:h,onToolbarEvent:N}),l.jsxs("div",{className:[Nt.workspace,o?Nt.sidebarCollapsed:"",c?Nt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Nt.outline,o?Nt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(VO,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(R=>!R)})}),o&&l.jsx("button",{className:Nt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Nt.editor,role:"main","aria-label":"Content editor",children:l.jsx(hj,{editorMode:e,onToolbarEvent:N})}),l.jsx("aside",{className:[Nt.dock,c?Nt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(TR,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(R=>!R)})}),c&&l.jsx("button",{className:Nt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(ey,{dropAnimation:null,children:s?l.jsx("div",{className:Nt.dragChip,children:l.jsx("span",{className:Nt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(vw,{onSave:A,onDiscard:$,onCancel:()=>f(!1),isSaving:x})]})},KR="v1";function QR(e){const t=e.validations,r=t==null?void 0:t.find(s=>s.type==="maxlength"||s.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function $u(e,t){var r;return{code:e.code??"",label:e.label??e.name??e.code??"",name:e.name,inputType:e.inputType,dataType:e.dataType,required:e.required===!0||Array.isArray(e.validations)&&e.validations.some(n=>n.type==="required")||String(((r=e.renderingHints)==null?void 0:r.class)??"").includes("required"),editable:e.editable!==!1,visible:e.visible!==!1,placeholder:e.placeholder,maxLength:QR(e),depends:e.depends,sourceCategory:e.sourceCategory,range:e.range,enum:e.enum,default:e.default,defaultValue:e.defaultValue,index:e.index,section:t,output:e.output}}function wr(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.name??void 0,i=n.fields.filter(o=>!!o.code).sort((o,a)=>(o.index??0)-(a.index??0));for(const o of i)r.push($u(o,s))}else n.code&&r.push($u(n));return r}function GR(e){const t=e==null?void 0:e.properties;if(!t)return{};const r={};for(const[n,s]of Object.entries(t))s&&"default"in s&&(r[n]=s.default);return r}async function YR(e,t,r="Collection",n=KR){var d,u;const i=(u=(d=(await Le.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:wr(o.create),unitForm:wr(o.unitMetadata),childForm:wr(o.childMetadata),searchForm:wr(o.search??o.searchConfig),relationalForm:wr(o.relationalMetadata),publishChecklist:wr(o.publishchecklist),reviewChecklist:wr(o.review),rfcChecklist:wr(o.requestforchangeschecklist),schemaDefaults:GR(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function XR({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u,setContentFramework:f}=oe(),{setTreeData:g,selectNode:m}=Ae();return p.useEffect(()=>{let b=!1;async function h(){var y,v;try{n(!0),i(null),e.apiBaseUrl&&Ef(e.apiBaseUrl),c(e),d(e.config.mode);const _=e.context.contentId??e.context.identifier??"";if(_){const{rootNode:x}=await Tf(_);if(!b&&(g(x?[x]:[]),x)){m(x.id);const k=x.metadata??{},L=k.framework??e.context.framework??null,N=k.targetFWIds??e.context.targetFWIds??null;f(L,N)}const w=e.config.primaryCategory??"Course",C=e.context.channel??"",I=e.config.categoryDefinitionApiVersion??"v1";try{const j=await YR(w,C,e.config.objectType??"Collection",I);if(!b){u(j);const k=((y=j.sourcingSettings)==null?void 0:y.collection)??{},L={};k.maxDepth&&!e.config.maxDepth&&(L.maxDepth=k.maxDepth),k.children&&!e.config.children&&(L.children=k.children),k.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(L.hierarchy={...e.config.hierarchy??{},...k.hierarchy}),Object.keys(L).length>0&&c({...e,config:{...e.config,...L}})}}catch{}}b||a(!0)}catch(_){if(!b){const x=_ instanceof Error?_:new Error(String(_));i(x),t==null||t(x)}}finally{b||n(!1)}}return h(),()=>{b=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const ZR="_root_qcpw6_1",JR="_loadingState_qcpw6_10",ek="_loadingSpinner_qcpw6_20",tk="_errorState_qcpw6_34",us={root:ZR,loadingState:JR,loadingSpinner:ek,errorState:tk},rk=new Cp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class nk extends p.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?l.jsxs("div",{className:us.errorState,children:[l.jsx("h3",{children:"Something went wrong"}),l.jsx("p",{children:this.state.error.message}),l.jsx("button",{onClick:()=>this.setState({error:null}),children:"Retry"})]}):this.props.children}}function sk(e){const{isLoading:t,error:r}=XR({config:e,onError:e.onError}),n=oe(s=>s.editorMode);return t?l.jsxs("div",{className:us.loadingState,children:[l.jsx("div",{className:us.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:us.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${us.root}`,children:l.jsx(WR,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Xh=e=>l.jsx(nk,{onError:e.onError,children:l.jsxs(Ep,{client:rk,children:[l.jsx(sk,{...e}),l.jsx(Og,{position:"top-right",toastOptions:{duration:3e3}})]})}),Fi=Symbol.for("r2wc.reactRender"),Bu=Symbol.for("r2wc.shouldRender"),ni=Symbol.for("r2wc.root");function ik(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ok(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Uu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Fi]()}}),e[Fi]()}};function ak(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,g){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Uu.expando(g,u,f),Reflect.set(d,u,f,g)):(Uu.expando(g,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Bu]=!0,this[Fi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ni].unmount():r.unmountComponentAtNode(this)},a[Fi]=function(){if(this[Bu]===!0){var d={};Object.keys(this).forEach(function(g){s[g]!==!1&&(d[g]=this[g])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[ni]||(this[ni]=r.createRoot(u)),this[ni].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return ik(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?ok(d):d;this[g]=f}),o}var ds={},as=Ar;if(process.env.NODE_ENV==="production")ds.createRoot=as.createRoot,ds.hydrateRoot=as.hydrateRoot;else{var si=as.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ds.createRoot=function(e,t){si.usingClientEntryPoint=!0;try{return as.createRoot(e,t)}finally{si.usingClientEntryPoint=!1}},ds.hydrateRoot=function(e,t,r){si.usingClientEntryPoint=!0;try{return as.hydrateRoot(e,t,r)}finally{si.usingClientEntryPoint=!1}}}function lk(){if(document.getElementById("sb-ce-react-styles"))return;const e=document.createElement("style");e.id="sb-ce-react-styles",e.textContent="@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');",document.head.insertBefore(e,document.head.firstChild)}function ck(e="sb-collection-editor"){if(lk(),typeof customElements>"u"||customElements.get(e))return;const t=ak(Xh,p,ds,{});customElements.define(e,t)}exports.CollectionEditor=Xh;exports.registerCollectionEditor=ck;exports.setApiBaseUrl=Ef;exports.useEditorStore=oe;exports.useLibraryStore=Gh;exports.useTreeStore=Ae;
456
+ `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=ln(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&gi.assertOptions(n,{silentJSONParsing:ft.transitional(ft.boolean),forcedJSONParsing:ft.transitional(ft.boolean),clarifyTimeoutError:ft.transitional(ft.boolean),legacyInterceptorReqResOrdering:ft.transitional(ft.boolean),advertiseZstdAcceptEncoding:ft.transitional(ft.boolean),validateStatusUndefinedResolves:ft.transitional(ft.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:gi.assertOptions(s,{encode:ft.function,serialize:ft.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),gi.assertOptions(r,{baseUrl:ft.spelling("baseURL"),withXsrfToken:ft.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&D.merge(i.common,i[r.method]);i&&D.forEach(["delete","get","head","post","put","patch","query","common"],b=>{delete i[b]}),r.headers=bt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||il;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,g;if(!c){const b=[Sc.bind(this),void 0];for(b.unshift(...a),b.push(...d),g=b.length,u=Promise.resolve(r);f<g;)u=u.then(b[f++],b[f++]);return u}g=a.length;let m=r;for(;f<g;){const b=a[f++],h=a[f++];try{m=b(m)}catch(y){h.call(this,y);break}}try{u=Sc.call(this,m)}catch(b){return Promise.reject(b)}for(f=0,g=d.length;f<g;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=ln(this.defaults,t);const r=If(t.baseURL,t.url,t.allowAbsoluteUrls,t);return xf(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){sn.prototype[t]=function(r,n){return this.request(ln(n||{},{method:t,url:r,data:n&&D.hasOwnProp(n,"data")?n.data:void 0}))}});D.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(ln(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}sn.prototype[t]=r(),t!=="query"&&(sn.prototype[t+"Form"]=r(!0))});let f_=class Rf{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new Hs(i,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Rf(function(s){t=s}),cancel:t}}};function h_(e){return function(r){return e.apply(null,r)}}function p_(e){return D.isObject(e)&&e.isAxiosError===!0}const _a={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(_a).forEach(([e,t])=>{_a[t]=e});function kf(e){const t=new sn(e),r=cf(sn.prototype.request,t);return D.extend(r,sn.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return kf(ln(e,s))},r}const Ge=kf(qs);Ge.Axios=sn;Ge.CanceledError=Hs;Ge.CancelToken=f_;Ge.isCancel=Of;Ge.VERSION=al;Ge.toFormData=eo;Ge.AxiosError=X;Ge.Cancel=Ge.CanceledError;Ge.all=function(t){return Promise.all(t)};Ge.spread=h_;Ge.isAxiosError=p_;Ge.mergeConfig=ln;Ge.AxiosHeaders=bt;Ge.formToJSON=e=>Ef(D.isHTMLForm(e)?new FormData(e):e);Ge.getAdapter=jf.getAdapter;Ge.HttpStatusCode=_a;Ge.default=Ge;const{Axios:Tk,AxiosError:Nk,CanceledError:jk,isCancel:Rk,CancelToken:kk,VERSION:Ak,all:Pk,Cancel:Mk,isAxiosError:Lk,spread:Fk,toFormData:$k,AxiosHeaders:Bk,HttpStatusCode:Uk,formToJSON:zk,getAdapter:Vk,mergeConfig:qk,create:Hk}=Ge;let wa="";function Af(e){wa=e}const je=Ge.create({timeout:3e4});je.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Qy),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),wa&&(e.baseURL=wa),e});const Pf=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function g_(e,t={}){var c,d,u,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:Pf,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await je.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function m_(e){var r,n,s;return e.length?((s=(n=(r=(await je.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Pf,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}function Mf(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",o=(r.mimeType??"")==="application/vnd.ekstep.content-collection"||s.toLowerCase().includes("unit")||s.toLowerCase().includes("textbook")||s.toLowerCase().includes("collection")||s.toLowerCase().includes("course")||s.toLowerCase().includes("lesson")||r.visibility==="Parent",a=r.children,c=Array.isArray(a)?a.map(d=>Mf(d,n)):[];return{id:n,identifier:n,name:r.name??"Untitled",title:r.name??"Untitled",description:r.description,primaryCategory:r.primaryCategory,mimeType:r.mimeType,objectType:s,contentType:r.contentType,visibility:r.visibility,status:r.status,appIcon:r.appIcon,isFolder:o,children:c,metadata:r,parent:t}}async function Lf(e){var s,i,o,a,c,d,u;const t=await je.get(`/action/content/v3/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Mf(r);return{content:r,rootNode:n}}async function y_(e,t,r,n){var i;return((i=(await je.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function v_(e,t=""){await je.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function b_(e){var r,n;return(n=(r=(await je.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function __(e){await je.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function w_(e,t){await je.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function S_(e,t){await je.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const x_="_container_r27rp_1",C_="_header_r27rp_13",E_="_title_r27rp_22",O_="_closeBtn_r27rp_29",D_="_body_r27rp_45",I_="_label_r27rp_54",T_="_searchSection_r27rp_62",N_="_searchRow_r27rp_68",j_="_searchInput_r27rp_74",R_="_searchSpinner_r27rp_89",k_="_resultsList_r27rp_105",A_="_resultItem_r27rp_118",P_="_userInfo_r27rp_133",M_="_userName_r27rp_141",L_="_userEmail_r27rp_150",F_="_userOrg_r27rp_158",$_="_noResults_r27rp_167",B_="_collabSection_r27rp_174",U_="_sectionTitle_r27rp_179",z_="_badge_r27rp_189",V_="_emptyCollab_r27rp_203",q_="_collabList_r27rp_214",H_="_collabItem_r27rp_223",W_="_userAvatar_r27rp_237",K_="_error_r27rp_251",Q_="_success_r27rp_257",G_="_footer_r27rp_263",Ee={container:x_,header:C_,title:E_,closeBtn:O_,body:D_,label:I_,searchSection:T_,searchRow:N_,searchInput:j_,searchSpinner:R_,resultsList:k_,resultItem:A_,userInfo:P_,userName:M_,userEmail:L_,userOrg:F_,noResults:$_,collabSection:B_,sectionTitle:U_,badge:z_,emptyCollab:V_,collabList:q_,collabItem:H_,userAvatar:W_,error:K_,success:Q_,footer:G_},Y_=({contentId:e,onClose:t})=>{var k,L;const r=oe(N=>N.editorConfig),n=(k=r==null?void 0:r.context)==null?void 0:k.channel,s=(L=r==null?void 0:r.config)==null?void 0:L.objectType,[i,o]=p.useState(""),[a,c]=p.useState([]),[d,u]=p.useState(!1),[f,g]=p.useState([]),[m,b]=p.useState(!1),[h,y]=p.useState(""),[v,_]=p.useState(!1),S=p.useRef(null);p.useEffect(()=>{let N=!1;return(async()=>{try{const A=await b_(e),$=(A==null?void 0:A.collaborators)??[];if(!$.length)return;const R=await m_($);if(N)return;const F=$.map(M=>R.find(Z=>Z.identifier===M)??{identifier:M,firstName:M});g(F)}catch{}})(),()=>{N=!0}},[e]),p.useEffect(()=>{S.current&&clearTimeout(S.current);const N=i.trim();if(N.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const A=await g_(N,{rootOrgId:n,objectType:s}),$=new Set(f.map(R=>R.identifier));c(A.filter(R=>!$.has(R.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=p.useCallback(N=>{g(A=>A.find($=>$.identifier===N.identifier)?A:[...A,N]),c(A=>A.filter($=>$.identifier!==N.identifier)),_(!1)},[]),C=p.useCallback(N=>{g(A=>A.filter($=>$.identifier!==N)),_(!1)},[]),I=p.useCallback(async()=>{b(!0),y(""),_(!1);try{await S_(e,f.map(N=>N.identifier)),_(!0)}catch{y("Failed to save collaborators. Please try again.")}finally{b(!1)}},[e,f]),j=N=>`${N.firstName}${N.lastName?` ${N.lastName}`:""}`;return l.jsxs("div",{className:Ee.container,children:[l.jsxs("div",{className:Ee.header,children:[l.jsx("h2",{className:Ee.title,children:"Manage Collaborators"}),l.jsx("button",{className:Ee.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ee.body,children:[l.jsxs("div",{className:Ee.searchSection,children:[l.jsx("label",{className:Ee.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Ee.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Ee.searchInput,placeholder:"Search by name or email...",value:i,onChange:N=>o(N.target.value)}),d&&l.jsx("span",{className:Ee.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Ee.resultsList,role:"listbox","aria-label":"Search results",children:a.map(N=>{var A,$,R,F;return l.jsxs("li",{className:Ee.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Ee.userInfo,children:[l.jsx("span",{className:Ee.userName,children:j(N)}),N.email&&l.jsx("span",{className:Ee.userEmail,children:N.email}),((($=(A=N.organisations)==null?void 0:A[0])==null?void 0:$.orgName)??N.rootOrgName)&&l.jsx("span",{className:Ee.userOrg,children:((F=(R=N.organisations)==null?void 0:R[0])==null?void 0:F.orgName)??N.rootOrgName})]}),l.jsx(Ae,{variant:"primary",size:"sm",onClick:()=>w(N),children:"Add"})]},N.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Ee.noResults,children:"No users found."})]}),l.jsxs("div",{className:Ee.collabSection,children:[l.jsxs("h3",{className:Ee.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Ee.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Ee.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Ee.collabList,children:f.map(N=>{var A,$,R,F;return l.jsxs("li",{className:Ee.collabItem,children:[l.jsx("div",{className:Ee.userAvatar,"aria-hidden":"true",children:j(N).charAt(0).toUpperCase()}),l.jsxs("div",{className:Ee.userInfo,children:[l.jsx("span",{className:Ee.userName,children:j(N)}),N.email&&l.jsx("span",{className:Ee.userEmail,children:N.email}),((($=(A=N.organisations)==null?void 0:A[0])==null?void 0:$.orgName)??N.rootOrgName)&&l.jsx("span",{className:Ee.userOrg,children:((F=(R=N.organisations)==null?void 0:R[0])==null?void 0:F.orgName)??N.rootOrgName})]}),l.jsx(Ae,{variant:"danger",size:"sm",onClick:()=>C(N.identifier),children:"Remove"})]},N.identifier)})})]}),h&&l.jsx("p",{className:Ee.error,role:"alert",children:h}),v&&l.jsx("p",{className:Ee.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Ee.footer,children:[l.jsx(Ae,{variant:"ghost",onClick:t,disabled:m,children:"Cancel"}),l.jsx(Ae,{variant:"primary",isLoading:m,onClick:I,children:"Save"})]})]})};async function X_(e){return(await je.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function Z_(e,t){var s;const n=((s=(await je.post(`/action/dialcode/v1/reserve/${e}`,{request:{dialcodes:{count:t,qrCodeSpec:{errorCorrectionLevel:"H"}}}})).data)==null?void 0:s.result)??{};return{processId:n.processId??"",reservedDialcodes:n.reservedDialcodes??{}}}async function J_(e){var n;const r=((n=(await je.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const ew="_topbar_zj8wk_1",tw="_left_zj8wk_15",rw="_right_zj8wk_23",nw="_backBtn_zj8wk_30",sw="_title_zj8wk_49",iw="_statusChip_zj8wk_61",ow="_savedIndicator_zj8wk_73",aw="_unsaved_zj8wk_83",lw="_iconBtn_zj8wk_88",cw="_iconBtnLabel_zj8wk_115",uw="_qrDropdown_zj8wk_119",dw="_qrMenu_zj8wk_123",fw="_reviewBtns_zj8wk_158",hw="_sourcingBtns_zj8wk_167",pw="_modalOverlay_zj8wk_176",gw="_sbOverlay_zj8wk_186",mw="_sbModal_zj8wk_196",yw="_sbModalHeader_zj8wk_207",vw="_sbModalTitle_zj8wk_215",bw="_sbModalClose_zj8wk_222",_w="_sbModalBody_zj8wk_235",ww="_sbLabel_zj8wk_242",Sw="_sbTextarea_zj8wk_249",xw="_sbError_zj8wk_266",Cw="_sbModalFooter_zj8wk_273",ce={topbar:ew,left:tw,right:rw,backBtn:nw,title:sw,statusChip:iw,savedIndicator:ow,unsaved:aw,iconBtn:lw,iconBtnLabel:cw,qrDropdown:uw,qrMenu:dw,reviewBtns:fw,sourcingBtns:hw,modalOverlay:pw,sbOverlay:gw,sbModal:mw,sbModalHeader:yw,sbModalTitle:vw,sbModalClose:bw,sbModalBody:_w,sbLabel:ww,sbTextarea:Sw,sbError:xw,sbModalFooter:Cw};function Ew(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Ow(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const Cc=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ce.sbModalTitle,children:e}),l.jsx("button",{className:ce.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:ce.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ce.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Ae,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Ae,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Dw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(!1);return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ce.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ce.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Ae,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Ae,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Iw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ce.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ce.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ce.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Ae,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Ae,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Tw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var Me,me;const a=Pe(le=>le.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=Ow(((Me=a==null?void 0:a.metadata)==null?void 0:Me.status)??(a==null?void 0:a.status)),u=oe(le=>{var pe,Re,Ue,De;return((Re=(pe=le.editorConfig)==null?void 0:pe.context)==null?void 0:Re.contentId)??((De=(Ue=le.editorConfig)==null?void 0:Ue.context)==null?void 0:De.identifier)??""}),{activeModal:f,modalData:g,closeModal:m,openModal:b}=Zy(),h=oe(le=>le.buttonLoaders),y=oe(le=>le.categoryMeta),v=!y||y.schemaDefaults.generateDIALCodes!=="No",[_,S]=p.useState(!1),[w,C]=p.useState(!1),[I,j]=p.useState(!1),[k,L]=p.useState(!1),N=p.useRef(null),[A,$]=p.useState(!1);p.useEffect(()=>{if(!k)return;const le=pe=>{var Re;(Re=N.current)!=null&&Re.contains(pe.target)||L(!1)};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[k]);const[R,F]=p.useState(!1),[M,Z]=p.useState(!1),{updateNode:ae}=Pe(),ve=(me=a==null?void 0:a.metadata)==null?void 0:me.qrCodeProcessId,we=p.useCallback(async le=>{if(u){$(!1),F(!0);try{const{processId:pe,reservedDialcodes:Re}=await Z_(u,le);pe&&a&&ae(a.id,{qrCodeProcessId:pe,reservedDialcodes:Re}),Oe.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Oe.error("Failed to generate QR Codes. Please try again.")}finally{F(!1)}}},[u,a,ae]),he=p.useCallback(async()=>{if(!ve){Oe.error("No QR codes generated yet. Generate QR Codes first.");return}Z(!0);try{const le=await J_(ve);if(le.status==="in-process"){Oe("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const pe=le.url;if(!pe){Oe.error("QR Codes not ready yet. Please wait and try again.");return}const Re=await fetch(pe).then(ie=>ie.blob()),Ue=await new Promise(ie=>{const We=new FileReader;We.onloadend=()=>ie(We.result),We.readAsDataURL(Re)}),De=(a==null?void 0:a.metadata)??{},ee=ie=>Array.isArray(ie)?ie.join("_"):typeof ie=="string"?ie:"",ze=[u,ee(De.medium),ee(De.gradeLevel),ee(De.subject)].filter(Boolean),Xe=new Date().toISOString().replace(/[:.]/g,"-"),q=`${ze.join("_")}_${Xe}.zip`,re=document.createElement("a");re.href=Ue,re.download=q,re.style.display="none",document.body.appendChild(re),re.click(),document.body.removeChild(re),Oe.success("QR codes downloaded.")}catch{Oe.error("Failed to download QR Codes.")}finally{Z(!1)}},[ve,a,u]),W=e==="edit",J=e==="review",se=e==="sourcingreview",B=e==="read",Y=p.useCallback((le,pe)=>{i({action:le,data:pe})},[i]),K=p.useCallback(()=>{m(),Y("publish")},[m,Y]),ue=p.useCallback((le,pe)=>{const Re=g==null?void 0:g.action;m(),Re==="approve"?Y("sourcingApprove",{comment:le,score:pe}):Y("reject",{comment:le})},[m,Y,g]),Se=p.useCallback(le=>{S(!1),Y("sendBackForCorrections",{comment:le})},[Y]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ce.topbar,role:"banner",children:[l.jsxs("div",{className:ce.left,children:[l.jsx("button",{className:ce.backBtn,onClick:()=>Y("back"),"aria-label":"Go back",type:"button",children:l.jsx(my,{size:18})}),l.jsx("h1",{className:ce.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ce.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ce.right,children:[t?l.jsx("span",{className:ce.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ce.savedIndicator} ${ce.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ce.savedIndicator,"aria-live":"polite",children:[l.jsx(Wn,{size:14,"aria-hidden":"true"}),"Saved ",Ew(n)]}):null,!B&&!J&&!se&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>Y("saveCollection"),disabled:!s,children:"Save as Draft"})}),W&&l.jsxs(l.Fragment,{children:[l.jsxs(Ae,{variant:"primary",size:"sm",onClick:()=>j(!0),disabled:h.saveCollection,isLoading:h.saveCollection,children:[l.jsx(Ry,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ce.iconBtn,onClick:()=>b("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(Py,{size:16,"aria-hidden":"true"})}),v&&l.jsxs("div",{className:ce.qrDropdown,ref:N,children:[l.jsxs("button",{className:ce.iconBtn,onClick:()=>L(le=>!le),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":k,children:[l.jsx(Xl,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ce.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),k&&l.jsxs("div",{className:ce.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{L(!1),$(!0)},disabled:R,children:[l.jsx(Xl,{size:14}),R?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{L(!1),he()},disabled:M||!ve,children:[l.jsx(wy,{size:14}),M?"Downloading…":"Download QR Codes"]})]})]})]}),J&&l.jsxs("div",{className:ce.reviewBtns,children:[l.jsxs(Ae,{variant:"primary",size:"sm",onClick:()=>b("publishChecklist"),disabled:h.publishCollection,isLoading:h.publishCollection,children:[l.jsx(Xd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Ae,{variant:"danger",size:"sm",onClick:()=>C(!0),disabled:h.rejectCollection,isLoading:h.rejectCollection,children:[l.jsx(ha,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[l.jsx(Ny,{size:14,"aria-hidden":"true"})," Send Back"]})]}),se&&l.jsxs("div",{className:ce.sourcingBtns,children:[l.jsxs(Ae,{variant:"primary",size:"sm",onClick:()=>b("qualityParams",{action:"approve"}),children:[l.jsx(ky,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Ae,{variant:"danger",size:"sm",onClick:()=>b("qualityParams",{action:"reject"}),children:[l.jsx(ha,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(gv,{contentId:u,onConfirm:K,onCancel:m}),f==="qualityParams"&&l.jsx(mv,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:ue,onCancel:m}),f==="manageCollaborators"&&l.jsx("div",{className:ce.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(Y_,{contentId:u,onClose:m})}),I&&l.jsx(Dw,{onConfirm:()=>{j(!1),Y("sendForReview")},onCancel:()=>j(!1)}),w&&l.jsx(Cc,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:le=>{C(!1),Y("reject",{comment:le})},onCancel:()=>C(!1)}),_&&l.jsx(Cc,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:Se,onCancel:()=>S(!1)}),A&&l.jsx(Iw,{onConfirm:we,onCancel:()=>$(!1)})]})},Nw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Pr.createPortal(l.jsx("div",{className:ke.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:ke.modal,children:[l.jsxs("div",{className:ke.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:ke.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:ke.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:ke.modalFooter,children:[l.jsx(Ae,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Ae,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Ae,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var jw=tl();const Ff=p.createContext(null);function Tt(){const e=p.useContext(Ff);if(e===null)throw new Error("No Tree Api Provided");return e}const $f=p.createContext(null);function Rw(){const e=p.useContext($f);if(e===null)throw new Error("Provide a NodesContext");return e}const Bf=p.createContext(null);function kw(){const e=p.useContext(Bf);if(e===null)throw new Error("Provide a DnDContext");return e}const Uf=p.createContext(0);function zf(){p.useContext(Uf)}function mi(e,t,r){return Math.max(Math.min(e,r),t)}function Vf(e){return e&&e.isLeaf}function qf(e){return e&&e.isInternal&&!e.isOpen}function Hf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Wf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Kf=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function cl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=cl(r,t);if(n)return n}return null}function Mi(e,t){if(t(e),e.children)for(let r of e.children)Mi(r,t)}function Qf(e){const t=Yf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Aw(t,n);break}r==null||r.focus()}function Gf(e){const t=Yf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Pw(t,n);break}r==null||r.focus()}function Aw(e,t){return t+1<e.length?e[t+1]:e[0]}function Pw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Yf(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function ds(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function xn(e){return typeof e=="string"?e:e.id}function Mw(e,...t){if(e)return e(...t)}function Xf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function Zf(e){var t,r;const n=e.focusedNode;return n?n.isOpen?0:n.parent?n.childIndex+1:0:(r=(t=e.root.children)===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0}function Jf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const Lw=Object.freeze(Object.defineProperty({__proto__:null,access:ds,bound:mi,dfs:cl,focusNextElement:Qf,focusPrevElement:Gf,getInsertIndex:Zf,getInsertParentId:Jf,identify:xn,indexOf:Kf,isClosed:qf,isDescendant:Wf,isItem:Vf,isOpenWithEmptyChildren:Hf,safeRun:Mw,waitFor:Xf,walk:Mi},Symbol.toStringTag,{value:"Module"})),Fw={display:"flex",alignItems:"center",zIndex:1},$w={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Bw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Uw=p.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},Fw),s),children:[l.jsx("div",{style:Object.assign({},Bw)}),l.jsx("div",{style:Object.assign({},$w)})]})});function zw({node:e,attrs:t,innerRef:r,children:n}){return l.jsx("div",Object.assign({},t,{ref:r,onFocus:s=>s.stopPropagation(),onClick:e.handleClick,children:n}))}function Vw(e){return l.jsxs("div",{ref:e.dragHandle,style:e.style,children:[l.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?l.jsx(Hw,Object.assign({},e)):l.jsx(qw,Object.assign({},e))]})}function qw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function Hw({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const Ds="__REACT_ARBORIST_INTERNAL_ROOT__";function Ec(e){var t;function r(i,o,a){const c=e.accessId(i),d=new Is({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new Is({tree:e,id:Ds,data:{id:Ds},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class Is{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===Ds}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Is(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Oo(e){return{type:"EDIT",id:e}}function Ww(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function gn(e){return{type:"FOCUS",id:e}}function Kw(){return{type:"TREE_BLUR"}}function Qw(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}const Sa={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function Oc(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function Gw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:Oc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:Oc(e.unfiltered,t)}):e}const Un=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:(t=e==null?void 0:e.initialOpenState)!==null&&t!==void 0?t:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},wr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:xn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(xn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(xn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:xn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:xn(e)})};function Yw(e=Un().nodes.selection,t){const r=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return t.ids.length===0?e:(t.ids.forEach(n=>r.add(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_REMOVE":return t.ids.length===0?e:(t.ids.forEach(n=>r.delete(n)),Object.assign(Object.assign({},e),{ids:new Set(r)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}const zn={cursor(e){return{type:"DND_CURSOR",cursor:e}},dragStart(e,t){return{type:"DND_DRAG_START",id:e,dragIds:t}},dragEnd(){return{type:"DND_DRAG_END"}},hovering(e,t){return{type:"DND_HOVERING",parentId:e,index:t}}};function Xw(e=Un().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return Un().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Zw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Jw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},eS=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function eh({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(tS,{isDragging:s,children:[l.jsx(rS,{offset:e,children:l.jsx(sS,{id:r,dragIds:n})}),l.jsx(nS,{mouse:t,count:n.length})]})}const tS=p.memo(function(t){return t.isDragging?l.jsx("div",{style:Zw,children:t.children}):null});function rS(e){return l.jsx("div",{className:"row preview",style:Jw(e.offset),children:e.children})}function nS(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:eS(r),children:t}):null}const sS=p.memo(function(t){const r=Tt(),n=r.get(t.id);return n?l.jsx(r.renderNode,{preview:!0,node:n,style:{paddingLeft:n.level*r.indent,opacity:.2,background:"transparent"},tree:r}):null});function xa(){return xa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xa.apply(null,arguments)}function Dc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ca(e,t){return Ca=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ca(e,t)}function iS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ca(e,t)}var Ic=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function oS(e,t){return!!(e===t||Ic(e)&&Ic(t))}function aS(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!oS(e[r],t[r]))return!1;return!0}function Do(e,t){t===void 0&&(t=aS);var r,n=[],s,i=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return i&&r===this&&t(a,n)||(s=e.apply(this,a),i=!0,r=this,n=a),s}return o}var lS=typeof performance=="object"&&typeof performance.now=="function",Tc=lS?function(){return performance.now()}:function(){return Date.now()};function Nc(e){cancelAnimationFrame(e.id)}function cS(e,t){var r=Tc();function n(){Tc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Io=-1;function jc(e){if(e===void 0&&(e=!1),Io===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Io=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Io}var mn=null;function Rc(e){if(e===void 0&&(e=!1),mn===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?mn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?mn="negative":mn="positive-ascending"),document.body.removeChild(t),mn}return mn}process.env.NODE_ENV;var uS=150,dS=function(t,r){return t},yi=null,vi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(yi=new WeakSet,vi=new WeakSet);function th(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){iS(g,f);function g(b){var h;return h=f.call(this,b)||this,h._instanceProps=c(h.props,Dc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:Dc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=Do(function(y,v,_,S){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:_,visibleStopIndex:S})}),h._callOnScroll=void 0,h._callOnScroll=Do(function(y,v,_){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:_})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,_=v.direction,S=v.itemSize,w=v.layout,C=h._getItemStyleCache(d&&S,d&&w,d&&_),I;if(C.hasOwnProperty(y))I=C[y];else{var j=r(h.props,y,h._instanceProps),k=s(h.props,y,h._instanceProps),L=_==="horizontal"||w==="horizontal",N=_==="rtl",A=L?j:0;C[y]=I={position:"absolute",left:N?void 0:A,right:N?A:void 0,top:L?0:j,height:L?"100%":k,width:L?k:"100%"}}return I},h._getItemStyleCache=void 0,h._getItemStyleCache=Do(function(y,v,_){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,_=v.clientWidth,S=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===S)return null;var I=h.props.direction,j=S;if(I==="rtl")switch(Rc()){case"negative":j=-S;break;case"positive-descending":j=w-_-S;break}return j=Math.max(0,Math.min(j,w-_)),{isScrolling:!0,scrollDirection:C.scrollOffset<j?"forward":"backward",scrollOffset:j,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,_=v.clientHeight,S=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var I=Math.max(0,Math.min(w,S-_));return{isScrolling:!0,scrollDirection:C.scrollOffset<I?"forward":"backward",scrollOffset:I,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&Nc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=cS(h._resetIsScrolling,uS)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}g.getDerivedStateFromProps=function(h,y){return fS(h,y),u(h),null};var m=g.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,_=v.itemCount,S=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,_-1));var C=0;if(this._outerRef){var I=this._outerRef;S==="vertical"?C=I.scrollWidth>I.clientWidth?jc():0:C=I.scrollHeight>I.clientHeight?jc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},m.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,_=h.layout;if(typeof v=="number"&&this._outerRef!=null){var S=this._outerRef;y==="horizontal"||_==="horizontal"?S.scrollLeft=v:S.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,_=this.state,S=_.scrollOffset,w=_.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Rc()){case"negative":C.scrollLeft=-S;break;case"positive-ascending":C.scrollLeft=S;break;default:var I=C.clientWidth,j=C.scrollWidth;C.scrollLeft=j-I-S;break}else C.scrollLeft=S;else C.scrollTop=S}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Nc(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,y=h.children,v=h.className,_=h.direction,S=h.height,w=h.innerRef,C=h.innerElementType,I=h.innerTagName,j=h.itemCount,k=h.itemData,L=h.itemKey,N=L===void 0?dS:L,A=h.layout,$=h.outerElementType,R=h.outerTagName,F=h.style,M=h.useIsScrolling,Z=h.width,ae=this.state.isScrolling,ve=_==="horizontal"||A==="horizontal",we=ve?this._onScrollHorizontal:this._onScrollVertical,he=this._getRangeToRender(),W=he[0],J=he[1],se=[];if(j>0)for(var B=W;B<=J;B++)se.push(p.createElement(y,{data:k,key:N(B,k),index:B,isScrolling:M?ae:void 0,style:this._getItemStyle(B)}));var Y=n(this.props,this._instanceProps);return p.createElement($||R||"div",{className:v,onScroll:we,ref:this._outerRefSetter,style:xa({position:"relative",height:S,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:_},F)},p.createElement(C||I||"div",{children:se,ref:w,style:{height:ve?"100%":Y,pointerEvents:ae?"none":void 0,width:ve?Y:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],_=y[1],S=y[2],w=y[3];this._callOnItemsRendered(v,_,S,w)}}if(typeof this.props.onScroll=="function"){var C=this.state,I=C.scrollDirection,j=C.scrollOffset,k=C.scrollUpdateWasRequested;this._callOnScroll(I,j,k)}},m._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,_=this.state,S=_.isScrolling,w=_.scrollDirection,C=_.scrollOffset;if(y===0)return[0,0,0,0];var I=o(this.props,C,this._instanceProps),j=a(this.props,I,C,this._instanceProps),k=!S||w==="backward"?Math.max(1,v):1,L=!S||w==="forward"?Math.max(1,v):1;return[Math.max(0,I-k),Math.max(0,Math.min(y-1,j+L)),I,j]},g}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var fS=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&vi&&!vi.has(u)&&(vi.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":yi&&!yi.has(u)&&(yi.add(u),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},hS=50,Cn=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},pS=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?rh(t,r,i,0,n):gS(t,r,Math.max(0,i),n)},rh=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Cn(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},gS=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Cn(t,n,r).offset<s;)n+=o,o*=2;return rh(t,r,Math.min(n,i-1),Math.floor(n/2),s)},kc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var d=n-o-1,u=d*i;return a+u},mS=th({getItemOffset:function(t,r,n){return Cn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:kc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",g=f?u:c,m=Cn(t,r,i),b=kc(t,i),h=Math.max(0,Math.min(b-g,m.offset)),y=Math.max(0,m.offset-g+m.size+o);switch(n==="smart"&&(s>=y-g&&s<=h+g?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return pS(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,g=Cn(t,r,s),m=n+f,b=g.offset+g.size,h=r;h<a-1&&b<m;)h++,b+=Cn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||hS,lastMeasuredIndex:-1};return r.resetAfterIndex=function(o,a){a===void 0&&(a=!0),i.lastMeasuredIndex=Math.min(i.lastMeasuredIndex,o-1),r._getItemStyleCache(-1),a&&r.forceUpdate()},i},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}}),yS=th({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.itemCount,u=t.itemSize,f=t.layout,g=t.width,m=a==="horizontal"||f==="horizontal",b=m?g:c,h=Math.max(0,d*u-b),y=Math.min(h,r*u),v=Math.max(0,r*u-b+u+o);switch(n==="smart"&&(s>=v-b&&s<=y+b?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var _=Math.round(v+(y-v)/2);return _<Math.ceil(b/2)?0:_>h+Math.floor(b/2)?h:_}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,g=u?d:i,m=Math.ceil((g+n-f)/a);return Math.max(0,Math.min(o-1,r+m-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function vS(){var e,t;const r=Tt(),s=kw().cursor;if(!s||s.type!=="line")return null;const i=r.indent,o=r.rowTopPosition(s.index)+((t=(e=r.props.padding)!==null&&e!==void 0?e:r.props.paddingTop)!==null&&t!==void 0?t:0),a=i*s.level,c=r.renderCursor;return l.jsx(c,{top:o,left:a,indent:i})}var bS=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const _S=p.forwardRef(function(t,r){const{children:n}=t,s=bS(t,["children"]),i=Tt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(wS,{}),n]}))}),wS=()=>{const e=Tt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(vS,{})})};var SS=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r};const xS=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=SS(t,["style"]);const d=Tt(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var nh=p.createContext({dragDropManager:void 0}),zt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(zt||(zt={}));function de(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var ul="dnd-core/INIT_COORDS",ro="dnd-core/BEGIN_DRAG",dl="dnd-core/PUBLISH_DRAG_SOURCE",no="dnd-core/HOVER",so="dnd-core/DROP",io="dnd-core/END_DRAG";function Ac(e,t){return{type:ul,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function bi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bi=function(r){return typeof r}:bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bi(e)}function CS(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function ES(e,t){return e.filter(function(r){return r!==t})}function sh(e){return bi(e)==="object"}function OS(e,t){var r=new Map,n=function(o){r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i,o){i===1&&s.push(o)}),s}function DS(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var IS={type:ul,payload:{clientOffset:null,sourceClientOffset:null}};function TS(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(Ac(o)),NS(r,c,d);var u=kS(r,c);if(u===null){e.dispatch(IS);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");jS(a),f=a(u)}e.dispatch(Ac(o,f));var g=d.getSource(u),m=g.beginDrag(c,u);if(m!=null){RS(m),d.pinSource(u);var b=d.getSourceType(u);return{type:ro,payload:{itemType:b,item:m,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function NS(e,t,r){de(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){de(r.getSource(n),"Expected sourceIds to be registered.")})}function jS(e){de(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function RS(e){de(sh(e),"Item must be an object.")}function kS(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function AS(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:dl}}}function Ea(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function PS(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;MS(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();LS(i,o,a);var c=o.getItemType();return FS(i,a,c),$S(i,o,a),{type:no,payload:{targetIds:i,clientOffset:s||null}}}}function MS(e){de(Array.isArray(e),"Expected targetIds to be an array.")}function LS(e,t,r){de(t.isDragging(),"Cannot call hover while not dragging."),de(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];de(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);de(i,"Expected targetIds to be registered.")}}function FS(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Ea(i,r)||e.splice(n,1)}}function $S(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Pc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Mc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pc(Object(r),!0).forEach(function(n){BS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function US(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();zS(n);var i=HS(n);i.forEach(function(o,a){var c=VS(o,a,s,n),d={type:so,payload:{dropResult:Mc(Mc({},r),c)}};e.dispatch(d)})}}function zS(e){de(e.isDragging(),"Cannot call drop while not dragging."),de(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function VS(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return qS(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function qS(e){de(typeof e>"u"||sh(e),"Drop result must either be an object or undefined.")}function HS(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function WS(e){return function(){var r=e.getMonitor(),n=e.getRegistry();KS(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:io}}}function KS(e){de(e.isDragging(),"Cannot call endDrag while not dragging.")}function QS(e){return{beginDrag:TS(e),publishDragSource:AS(e),hover:PS(e),drop:US(e),endDrag:WS(e)}}function GS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function XS(e,t,r){return t&&YS(e.prototype,t),e}function rs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ZS=function(){function e(t,r){var n=this;GS(this,e),rs(this,"store",void 0),rs(this,"monitor",void 0),rs(this,"backend",void 0),rs(this,"isSetUp",!1),rs(this,"handleRefCountChange",function(){var s=n.store.getState().refCount>0;n.backend&&(s&&!n.isSetUp?(n.backend.setup(),n.isSetUp=!0):!s&&n.isSetUp&&(n.backend.teardown(),n.isSetUp=!1))}),this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}return XS(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=QS(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Lt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Lc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Fc=function(){return Math.random().toString(36).substring(7).split("").join(".")},$c={INIT:"@@redux/INIT"+Fc(),REPLACE:"@@redux/REPLACE"+Fc()};function JS(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ex(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(nx(e))return"date";if(rx(e))return"error";var r=tx(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function tx(e){return typeof e.constructor=="function"?e.constructor.name:null}function rx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function nx(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function yn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=ex(e)),t}function ih(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Lt(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 t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(1):"Expected the enhancer to be a function. Instead, received: '"+yn(r)+"'");return r(ih)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(2):"Expected the root reducer to be a function. Instead, received: '"+yn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?Lt(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(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(4):"Expected the listener to be a function. Instead, received: '"+yn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Lt(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.");var y=!0;return d(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?Lt(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,d();var _=a.indexOf(h);a.splice(_,1),o=null}}}function g(h){if(!JS(h))throw new Error(process.env.NODE_ENV==="production"?Lt(7):"Actions must be plain objects. Instead, the actual type was: '"+yn(h)+"'. 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 h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Lt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Lt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var _=y[v];_()}return h}function m(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(10):"Expected the nextReducer to be a function. Instead, received: '"+yn(h));s=h,g({type:$c.REPLACE})}function b(){var h,y=f;return h={subscribe:function(_){if(typeof _!="object"||_===null)throw new Error(process.env.NODE_ENV==="production"?Lt(11):"Expected the observer to be an object. Instead, received: '"+yn(_)+"'");function S(){_.next&&_.next(u())}S();var w=y(S);return{unsubscribe:w}}},h[Lc]=function(){return this},h}return g({type:$c.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:m},n[Lc]=b,n}var sx=function(t,r){return t===r};function ix(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function ox(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sx;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Bc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Uc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bc(Object(r),!0).forEach(function(n){ax(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ax(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var zc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function lx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:zc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ul:case ro:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case no:return ix(e.clientOffset,r.clientOffset)?e:Uc(Uc({},e),{},{clientOffset:r.clientOffset});case io:case so:return zc;default:return e}}var fl="dnd-core/ADD_SOURCE",hl="dnd-core/ADD_TARGET",pl="dnd-core/REMOVE_SOURCE",oo="dnd-core/REMOVE_TARGET";function cx(e){return{type:fl,payload:{sourceId:e}}}function ux(e){return{type:hl,payload:{targetId:e}}}function dx(e){return{type:pl,payload:{sourceId:e}}}function fx(e){return{type:oo,payload:{targetId:e}}}function Vc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Ft(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vc(Object(r),!0).forEach(function(n){hx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var px={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function gx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:px,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ro:return Ft(Ft({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case dl:return Ft(Ft({},e),{},{isSourcePublic:!0});case no:return Ft(Ft({},e),{},{targetIds:r.targetIds});case oo:return e.targetIds.indexOf(r.targetId)===-1?e:Ft(Ft({},e),{},{targetIds:ES(e.targetIds,r.targetId)});case so:return Ft(Ft({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case io:return Ft(Ft({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function mx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case fl:case hl:return e+1;case pl:case oo:return e-1;default:return e}}var Li=[],gl=[];Li.__IS_NONE__=!0;gl.__IS_ALL__=!0;function yx(e,t){if(e===Li)return!1;if(e===gl||typeof t>"u")return!0;var r=DS(t,e);return r.length>0}function vx(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case no:break;case fl:case hl:case oo:case pl:return Li;case ro:case dl:case io:case so:default:return gl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=OS(n,i),a=o.length>0||!ox(n,i);if(!a)return Li;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function bx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function qc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Hc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qc(Object(r),!0).forEach(function(n){_x(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:vx(e.dirtyHandlerIds,{type:t.type,payload:Hc(Hc({},t.payload),{},{prevTargetIds:CS(e,"dragOperation.targetIds",[])})}),dragOffset:lx(e.dragOffset,t),refCount:mx(e.refCount,t),dragOperation:gx(e.dragOperation,t),stateId:bx(e.stateId)}}function Sx(e,t){return{x:e.x+t.x,y:e.y+t.y}}function oh(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xx(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:oh(Sx(t,n),r)}function Cx(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:oh(t,r)}function Ex(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ox(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Dx(e,t,r){return t&&Ox(e.prototype,t),e}function Wc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ix=function(){function e(t,r){Ex(this,e),Wc(this,"store",void 0),Wc(this,"registry",void 0),this.store=t,this.registry=r}return Dx(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;de(typeof r=="function","listener must be a function."),de(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!yx(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;de(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return de(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(de(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Ea(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(de(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!Ea(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return xx(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return Cx(this.store.getState().dragOffset)}}]),e}(),Tx=0;function Nx(){return Tx++}function _i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_i=function(r){return typeof r}:_i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_i(e)}function jx(e){de(typeof e.canDrag=="function","Expected canDrag to be a function."),de(typeof e.beginDrag=="function","Expected beginDrag to be a function."),de(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Rx(e){de(typeof e.canDrop=="function","Expected canDrop to be a function."),de(typeof e.hover=="function","Expected hover to be a function."),de(typeof e.drop=="function","Expected beginDrag to be a function.")}function Oa(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Oa(r,!1)});return}de(typeof e=="string"||_i(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Kc=typeof global<"u"?global:self,ah=Kc.MutationObserver||Kc.WebKitMutationObserver;function lh(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function kx(e){let t=1;const r=new ah(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const Ax=typeof ah=="function"?kx:lh;class Px{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const r=this.index;if(this.index++,t[r].call(),this.index>this.capacity){for(let n=0,s=t.length-this.index;n<s;n++)t[n]=t[n+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=Ax(this.flush),this.requestErrorThrow=lh(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class Mx{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class Lx{create(t){const r=this.freeTasks,n=r.length?r.pop():new Mx(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const ch=new Px,Fx=new Lx(ch.registerPendingError);function $x(e){ch.enqueueTask(Fx.create(e))}function Bx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ux(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function zx(e,t,r){return t&&Ux(e.prototype,t),e}function vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vx(e,t){return Kx(e)||Wx(e,t)||Hx(e,t)||qx()}function qx(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
457
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hx(e,t){if(e){if(typeof e=="string")return Qc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qc(e,t)}}function Qc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Wx(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function Kx(e){if(Array.isArray(e))return e}function Qx(e){var t=Nx().toString();switch(e){case zt.SOURCE:return"S".concat(t);case zt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Gc(e){switch(e[0]){case"S":return zt.SOURCE;case"T":return zt.TARGET;default:de(!1,"Cannot parse handler ID: ".concat(e))}}function Yc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=Vx(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var Gx=function(){function e(t){Bx(this,e),vn(this,"types",new Map),vn(this,"dragSources",new Map),vn(this,"dropTargets",new Map),vn(this,"pinnedSourceId",null),vn(this,"pinnedSource",null),vn(this,"store",void 0),this.store=t}return zx(e,[{key:"addSource",value:function(r,n){Oa(r),jx(n);var s=this.addHandler(zt.SOURCE,r,n);return this.store.dispatch(cx(s)),s}},{key:"addTarget",value:function(r,n){Oa(r,!0),Rx(n);var s=this.addHandler(zt.TARGET,r,n);return this.store.dispatch(ux(s)),s}},{key:"containsHandler",value:function(r){return Yc(this.dragSources,r)||Yc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;de(this.isSourceId(r),"Expected a valid source ID.");var s=n&&r===this.pinnedSourceId,i=s?this.pinnedSource:this.dragSources.get(r);return i}},{key:"getTarget",value:function(r){return de(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return de(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return de(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Gc(r);return n===zt.SOURCE}},{key:"isTargetId",value:function(r){var n=Gc(r);return n===zt.TARGET}},{key:"removeSource",value:function(r){var n=this;de(this.getSource(r),"Expected an existing source."),this.store.dispatch(dx(r)),$x(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){de(this.getTarget(r),"Expected an existing target."),this.store.dispatch(fx(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);de(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){de(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=Qx(r);return this.types.set(i,n),r===zt.SOURCE?this.dragSources.set(i,s):r===zt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function Yx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=Xx(n),i=new Ix(s,new Gx(s)),o=new ZS(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function Xx(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return ih(wx,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var Zx=["children"];function Jx(e,t){return nC(e)||rC(e,t)||tC(e,t)||eC()}function eC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
458
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tC(e,t){if(e){if(typeof e=="string")return Xc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xc(e,t)}}function Xc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function rC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function nC(e){if(Array.isArray(e))return e}function sC(e,t){if(e==null)return{};var r=iC(e,t),n,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function iC(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Zc=0,wi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),oC=p.memo(function(t){var r=t.children,n=sC(t,Zx),s=aC(n),i=Jx(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=uh();return++Zc,function(){--Zc===0&&(c[wi]=null)}}},[]),l.jsx(nh.Provider,Object.assign({value:o},{children:r}),void 0)});function aC(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=lC(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function lC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:uh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[wi]||(s[wi]={dragDropManager:Yx(e,t,r,n)}),s[wi]}function uh(){return typeof global<"u"?global:window}function cC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function dC(e,t,r){return t&&uC(e.prototype,t),e}function Jc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var To=!1,No=!1,fC=function(){function e(t){cC(this,e),Jc(this,"internalMonitor",void 0),Jc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return dC(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){de(!To,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return To=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{To=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;de(!No,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return No=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{No=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function hC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function gC(e,t,r){return t&&pC(e.prototype,t),e}function eu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jo=!1,mC=function(){function e(t){hC(this,e),eu(this,"internalMonitor",void 0),eu(this,"targetId",null),this.internalMonitor=t.getMonitor()}return gC(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;de(!jo,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return jo=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{jo=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function yC(e){if(typeof e.type!="string"){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function vC(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;yC(s);var i=r?function(o){return e(o,r)}:e;return bC(s,i)}}function dh(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var s=vC(n);t[r]=function(){return s}}}),t}function tu(e,t){typeof e=="function"?e(t):e.current=t}function bC(e,t){var r=e.ref;return de(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?p.cloneElement(e,{ref:function(s){tu(r,s),tu(t,s)}}):p.cloneElement(e,{ref:t})}function Si(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Si=function(r){return typeof r}:Si=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Si(e)}function Da(e){return e!==null&&Si(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ia(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function _C(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function SC(e,t,r){return t&&wC(e.prototype,t),e}function ht(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xC=function(){function e(t){var r=this;_C(this,e),ht(this,"hooks",dh({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Da(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Da(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),ht(this,"handlerId",null),ht(this,"dragSourceRef",null),ht(this,"dragSourceNode",void 0),ht(this,"dragSourceOptionsInternal",null),ht(this,"dragSourceUnsubscribe",void 0),ht(this,"dragPreviewRef",null),ht(this,"dragPreviewNode",void 0),ht(this,"dragPreviewOptionsInternal",null),ht(this,"dragPreviewUnsubscribe",void 0),ht(this,"lastConnectedHandlerId",null),ht(this,"lastConnectedDragSource",null),ht(this,"lastConnectedDragSourceOptions",null),ht(this,"lastConnectedDragPreview",null),ht(this,"lastConnectedDragPreviewOptions",null),ht(this,"backend",void 0),this.backend=t}return SC(e,[{key:"receiveHandlerId",value:function(r){this.handlerId!==r&&(this.handlerId=r,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(r){this.dragSourceOptionsInternal=r}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(r){this.dragPreviewOptionsInternal=r}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var r=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(n&&this.disconnectDragSource(),!!this.handlerId){if(!r){this.lastConnectedDragSource=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=r,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,r,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var r=this.dragPreview,n=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!Ia(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Ia(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function CC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function EC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function OC(e,t,r){return t&&EC(e.prototype,t),e}function er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var DC=function(){function e(t){var r=this;CC(this,e),er(this,"hooks",dh({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Da(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),er(this,"handlerId",null),er(this,"dropTargetRef",null),er(this,"dropTargetNode",void 0),er(this,"dropTargetOptionsInternal",null),er(this,"unsubscribeDropTarget",void 0),er(this,"lastConnectedHandlerId",null),er(this,"lastConnectedDropTarget",null),er(this,"lastConnectedDropTargetOptions",null),er(this,"backend",void 0),this.backend=t}return OC(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var r=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();r&&this.disconnectDropTarget();var n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(r){r!==this.handlerId&&(this.handlerId=r,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(r){this.dropTargetOptionsInternal=r}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!Ia(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function IC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function TC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var cn=typeof window<"u"?p.useLayoutEffect:p.useEffect;function xi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?xi=function(r){return typeof r}:xi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},xi(e)}function NC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function RC(e,t,r){return t&&jC(e.prototype,t),e}function Ro(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var kC=function(){function e(t,r,n){NC(this,e),Ro(this,"spec",void 0),Ro(this,"monitor",void 0),Ro(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return RC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return xi(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,o=s.isDragging;return o?o(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e}();function AC(e,t,r){var n=p.useMemo(function(){return new kC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function dn(){var e=p.useContext(nh),t=e.dragDropManager;return de(t!=null,"Expected drag drop context"),t}function PC(e){return p.useMemo(function(){var t=e.type;return de(t!=null,"spec.type must be defined"),t},[e])}function MC(e,t){return BC(e)||$C(e,t)||FC(e,t)||LC()}function LC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FC(e,t){if(e){if(typeof e=="string")return ru(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ru(e,t)}}function ru(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $C(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function BC(e){if(Array.isArray(e))return e}function UC(e,t,r){var n=dn(),s=AC(e,t,r),i=PC(e);cn(function(){if(i!=null){var a=TC(i,s,n),c=MC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function zC(e){return WC(e)||HC(e)||qC(e)||VC()}function VC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qC(e,t){if(e){if(typeof e=="string")return Ta(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ta(e,t)}}function HC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function WC(e){if(Array.isArray(e))return Ta(e)}function Ta(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function fh(e,t){var r=zC(t||[]);return t==null&&typeof e!="function"&&r.push(e),p.useMemo(function(){return typeof e=="function"?e():e},r)}function KC(){var e=dn();return p.useMemo(function(){return new fC(e)},[e])}function QC(e,t){var r=dn(),n=p.useMemo(function(){return new xC(r.getBackend())},[r]);return cn(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),cn(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var GC=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r};const YC=rf(GC);function XC(e,t){return t0(e)||e0(e,t)||JC(e,t)||ZC()}function ZC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
461
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JC(e,t){if(e){if(typeof e=="string")return nu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nu(e,t)}}function nu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function e0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function t0(e){if(Array.isArray(e))return e}function hh(e,t,r){var n=p.useState(function(){return t(e)}),s=XC(n,2),i=s[0],o=s[1],a=p.useCallback(function(){var c=t(e);YC(i,c)||(o(c),r&&r())},[i,e,r]);return cn(a),[i,a]}function r0(e,t){return o0(e)||i0(e,t)||s0(e,t)||n0()}function n0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
462
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s0(e,t){if(e){if(typeof e=="string")return su(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return su(e,t)}}function su(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function o0(e){if(Array.isArray(e))return e}function a0(e,t,r){var n=hh(e,t,r),s=r0(n,2),i=s[0],o=s[1];return cn(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function ph(e,t,r){return a0(t,e||function(){return{}},function(){return r.reconnect()})}function l0(e){return p.useMemo(function(){return e.hooks.dragSource()},[e])}function c0(e){return p.useMemo(function(){return e.hooks.dragPreview()},[e])}function u0(e,t){var r=fh(e,t);de(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var n=KC(),s=QC(r.options,r.previewOptions);return UC(r,n,s),[ph(r.collect,n,s),l0(s),c0(s)]}function d0(e){var t=e.accept;return p.useMemo(function(){return de(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function f0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p0(e,t,r){return t&&h0(e.prototype,t),e}function iu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var g0=function(){function e(t,r){f0(this,e),iu(this,"spec",void 0),iu(this,"monitor",void 0),this.spec=t,this.monitor=r}return p0(e,[{key:"canDrop",value:function(){var r=this.spec,n=this.monitor;return r.canDrop?r.canDrop(n.getItem(),n):!0}},{key:"hover",value:function(){var r=this.spec,n=this.monitor;r.hover&&r.hover(n.getItem(),n)}},{key:"drop",value:function(){var r=this.spec,n=this.monitor;if(r.drop)return r.drop(n.getItem(),n)}}]),e}();function m0(e,t){var r=p.useMemo(function(){return new g0(e,t)},[t]);return p.useEffect(function(){r.spec=e},[e]),r}function y0(e,t){return w0(e)||_0(e,t)||b0(e,t)||v0()}function v0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b0(e,t){if(e){if(typeof e=="string")return ou(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ou(e,t)}}function ou(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function w0(e){if(Array.isArray(e))return e}function S0(e,t,r){var n=dn(),s=m0(e,t),i=d0(e);cn(function(){var a=IC(i,s,n),c=y0(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function x0(){var e=dn();return p.useMemo(function(){return new mC(e)},[e])}function C0(e){var t=dn(),r=p.useMemo(function(){return new DC(t.getBackend())},[t]);return cn(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function E0(e){return p.useMemo(function(){return e.hooks.dropTarget()},[e])}function gh(e,t){var r=fh(e,t),n=x0(),s=C0(r.options);return S0(r,n,s),[ph(r.collect,n,s),E0(s)]}function O0(e,t){return N0(e)||T0(e,t)||I0(e,t)||D0()}function D0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I0(e,t){if(e){if(typeof e=="string")return au(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return au(e,t)}}function au(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function N0(e){if(Array.isArray(e))return e}function j0(e){var t=dn(),r=t.getMonitor(),n=hh(r,e),s=O0(n,2),i=s[0],o=s[1];return p.useEffect(function(){return r.subscribeToOffsetChange(o)}),p.useEffect(function(){return r.subscribeToStateChange(o)}),i}function mh(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function R0(e,t){return e.filter(function(r){return r!==t})}function k0(e,t){var r=new Set,n=function(o){return r.add(o)};e.forEach(n),t.forEach(n);var s=[];return r.forEach(function(i){return s.push(i)}),s}function A0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M0(e,t,r){return t&&P0(e.prototype,t),e}function lu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L0=function(){function e(t){A0(this,e),lu(this,"entered",[]),lu(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return M0(e,[{key:"enter",value:function(r){var n=this,s=this.entered.length,i=function(a){return n.isNodeInDocument(a)&&(!a.contains||a.contains(r))};return this.entered=k0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=R0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),F0=mh(function(){return/firefox/i.test(navigator.userAgent)}),yh=mh(function(){return!!window.safari});function $0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function U0(e,t,r){return t&&B0(e.prototype,t),e}function ns(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cu=function(){function e(t,r){$0(this,e),ns(this,"xs",void 0),ns(this,"ys",void 0),ns(this,"c1s",void 0),ns(this,"c2s",void 0),ns(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(k,L){return t[k]<t[L]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],g=0;g<o.length-1;g++){var m=a[g],b=a[g+1];if(m*b<=0)f.push(0);else{c=o[g];var h=o[g+1],y=c+h;f.push(3*y/((y+h)/m+(y+c)/b))}}f.push(a[a.length-1]);for(var v=[],_=[],S,w=0;w<f.length-1;w++){S=a[w];var C=f[w],I=1/o[w],j=C+f[w+1]-S-S;v.push((S-C-j)*I),_.push(j*I*I)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,this.c3s=_}return U0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var g=n[f];if(g<r)d=f+1;else if(g>r)u=f-1;else return s[f]}c=Math.max(0,u);var m=r-n[c],b=m*m;return s[c]+i[c]*m+o[c]*b+a[c]*m*b}}]),e}(),z0=1;function vh(e){var t=e.nodeType===z0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Js(e){return{x:e.clientX,y:e.clientY}}function V0(e){var t;return e.nodeName==="IMG"&&(F0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function q0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return yh()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function H0(e,t,r,n,s){var i=V0(t),o=i?e:t,a=vh(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,g=n.anchorY,m=q0(i,t,d,u),b=m.dragPreviewWidth,h=m.dragPreviewHeight,y=function(){var j=new cu([0,.5,1],[c.y,c.y/u*h,c.y+h-u]),k=j.interpolate(g);return yh()&&i&&(k+=(window.devicePixelRatio-1)*h),k},v=function(){var j=new cu([0,.5,1],[c.x,c.x/d*b,c.x+b-d]);return j.interpolate(f)},_=s.offsetX,S=s.offsetY,w=_===0||_,C=S===0||S;return{x:w?_:v(),y:C?S:y()}}var bh="__NATIVE_FILE__",_h="__NATIVE_URL__",wh="__NATIVE_TEXT__",Sh="__NATIVE_HTML__";const uu=Object.freeze(Object.defineProperty({__proto__:null,FILE:bh,HTML:Sh,TEXT:wh,URL:_h},Symbol.toStringTag,{value:"Module"}));function ko(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var bn;function ei(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Na=(bn={},ei(bn,bh,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),ei(bn,Sh,{exposeProperties:{html:function(t,r){return ko(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),ei(bn,_h,{exposeProperties:{urls:function(t,r){return ko(t,r,"").split(`
465
+ `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),ei(bn,wh,{exposeProperties:{text:function(t,r){return ko(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),bn);function W0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Q0(e,t,r){return t&&K0(e.prototype,t),e}function du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var G0=function(){function e(t){W0(this,e),du(this,"item",void 0),du(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return Q0(e,[{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 s={};Object.keys(this.config.exposeProperties).forEach(function(i){s[i]={value:n.config.exposeProperties[i](r,n.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,s)}}},{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(){}}]),e}();function Y0(e,t){var r=new G0(Na[e]);return r.loadDataTransfer(t),r}function Ao(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Na).filter(function(r){var n=Na[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function X0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function J0(e,t,r){return t&&Z0(e.prototype,t),e}function Po(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var e1=function(){function e(t,r){X0(this,e),Po(this,"ownerDocument",null),Po(this,"globalContext",void 0),Po(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return J0(e,[{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}}]),e}();function fu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function hu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function t1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n1(e,t,r){return t&&r1(e.prototype,t),e}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s1=function(){function e(t,r,n){var s=this;t1(this,e),be(this,"options",void 0),be(this,"actions",void 0),be(this,"monitor",void 0),be(this,"registry",void 0),be(this,"enterLeaveCounter",void 0),be(this,"sourcePreviewNodes",new Map),be(this,"sourcePreviewNodeOptions",new Map),be(this,"sourceNodes",new Map),be(this,"sourceNodeOptions",new Map),be(this,"dragStartSourceIds",null),be(this,"dropTargetIds",[]),be(this,"dragEnterTargetIds",[]),be(this,"currentNativeSource",null),be(this,"currentNativeHandle",null),be(this,"currentDragSourceNode",null),be(this,"altKeyPressed",!1),be(this,"mouseMoveTimeoutTimer",null),be(this,"asyncEndDragFrameId",null),be(this,"dragOverTargetIds",null),be(this,"lastClientOffset",null),be(this,"hoverRafId",null),be(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&vh(o)||null}),be(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),be(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Js(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Ao(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),g=s.sourcePreviewNodes.get(u)||f;if(g){var m=s.getCurrentSourcePreviewNodeOptions(),b=m.anchorX,h=m.anchorY,y=m.offsetX,v=m.offsetY,_={anchorX:b,anchorY:h},S={offsetX:y,offsetY:v},w=H0(f,g,a,_,S);c.setDragImage(g,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var C=s.getCurrentSourcePreviewNodeOptions(),I=C.captureDraggingState;I?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),be(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Ao(a);c&&s.beginDragNativeItem(c,a)}}),be(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Js(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=Js(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),be(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Ao(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Js(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new e1(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new L0(this.isNodeInDocument)}return n1(e,[{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,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{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 hu({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 hu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(uu).some(function(n){return uu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=Y0(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 s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{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)}}]),e}(),ti;function i1(){return ti||(ti=new Image,ti.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),ti}var o1=function(t,r,n){return new s1(t,r,n)};function a1(e,t){return typeof e=="function"?e(t):e??"NODE"}function l1(e){return e.isDraggable&&!e.isEditing}function c1(e){const t=Tt(),r=t.selectedIds,[n,s,i]=u0(()=>({canDrag:()=>l1(e),type:a1(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(zn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(zn.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(i1())},[i]),s}function u1(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function d1(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function ri(e,t){return{parentId:e||null,index:t}}function _n(e,t){return{type:"line",index:e,level:t}}function f1(e){return{type:"highlight",id:e}}function Mo(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=Kf(n)+1;return{parentId:s,index:i}}function xh(e){var t;const r=u1(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=d1(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:ri(i.id,null),cursor:f1(i.id)};if(!c)return{drop:ri((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:_n(0,0)};if(Vf(c)){const u=mi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}if(qf(c)){const u=mi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}if(Hf(c)){const u=mi(s,0,c.level+1);return u>c.level?{drop:ri(c.id,0),cursor:_n(c.rowIndex+1,u)}:{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}return{drop:ri(c==null?void 0:c.id,0),cursor:_n(c.rowIndex+1,c.level+1)}}function h1(e,t){const r=Tt(),[n,s]=gh(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=xh({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(zn.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function p1(e){const t=Tt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const pu=p.memo(function({index:t,style:r}){zf(),Rw();const n=Tt(),s=p1(t),i=p.useRef(null),o=c1(s),a=h1(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),d=n.indent*s.level,u=p.useMemo(()=>({paddingLeft:d}),[d]),f=p.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const m=n.renderNode,b=n.renderRow;return l.jsx(b,{node:s,innerRef:c,attrs:g,children:l.jsx(m,{node:s,tree:n,style:u,dragHandle:o})})});let Lo="",gu=null;function Ch(){zf();const e=Tt();return l.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var r;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const s=Array.from(e.selectedIds);if(s.length>1){let i=e.mostRecentNode;for(;i&&i.isSelected;)i=i.nextSibling;i||(i=e.lastNode),e.focus(i,{scroll:!1}),e.delete(Array.from(s))}else{const i=e.focusedNode;if(i){const o=i.nextSibling,a=i.parent;e.focus(o||a,{scroll:!1}),e.delete(i)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),Qf(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Gf(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(gu),Lo+=t.key,gu=setTimeout(()=>{Lo=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Lo):!1});n&&e.focus(n.id)},children:l.jsx(g1,{})})}function g1(){var e,t;const r=Tt(),n={className:r.props.className,outerRef:r.listEl,itemCount:r.visibleNodes.length,height:r.height,width:r.width,overscanCount:r.overscanCount,itemKey:s=>{var i;return((i=r.visibleNodes[s])===null||i===void 0?void 0:i.id)||s},outerElementType:(e=r.props.outerElementType)!==null&&e!==void 0?e:_S,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:xS,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(mS,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:pu})):l.jsx(yS,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:pu}))}function mu(e){return e.isFiltered?y1(e.root,e.isMatch.bind(e)):m1(e.root)}function m1(e){const t=[];function r(n){var s;n.level>=0&&t.push(n),n.isOpen&&((s=n.children)===null||s===void 0||s.forEach(r))}return r(e),t.forEach(Eh),t}function y1(e,t){const r={},n=[];function s(o){if(!o.isRoot&&t(o)){r[o.id]=!0;let c=o.parent;for(;c;)r[c.id]=!0,c=c.parent}if(o.children)for(let c of o.children)s(c)}function i(o){var a;o.level>=0&&r[o.id]&&n.push(o),o.isOpen&&((a=o.children)===null||a===void 0||a.forEach(i))}return s(e),i(e),n.forEach(Eh),n}function Eh(e,t){e.rowIndex=t}const yu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Fo=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:pt}=Lw;class ys{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=Ec(this),this.visibleNodes=mu(this),this.idToIndex=yu(this.visibleNodes)}update(t){this.props=t,this.root=Ec(this),this.visibleNodes=mu(this),this.idToIndex=yu(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=ds(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ds(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof Is)return t.id;const r=this.props.idAccessor||"id";return ds(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+1)}indexOf(t){const r=this.identifyNull(t);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 Fo(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?Jf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:Zf(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield pt(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return Fo(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield pt(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(Oo(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{ys.editPromise=i})}submit(t,r){return Fo(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield pt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(Oo(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Oo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&pt(this.props.onActivate,r)}resolveEdit(t){const r=ys.editPromise;r&&r(t),ys.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(gn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&pt(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(gn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&&pt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(wr.remove(r)),pt(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(gn(n.id)),n.isSelectable&&(this.dispatch(wr.add(n.id)),this.dispatch(wr.anchor(n.id)),this.dispatch(wr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&pt(this.props.onFocus,this.focusedNode),pt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(gn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(wr.remove(this.nodesBetween(s,i))),this.dispatch(wr.add(o)),this.dispatch(wr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&pt(this.props.onFocus,this.focusedNode),pt(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(gn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&pt(this.props.onFocus,this.focusedNode)}filterSelectableNodes(t){return t.map(r=>this.get(this.identify(r))).filter(r=>!!r&&r.isSelectable)}setSelection(t){var r;const n=new Set((r=t.ids)===null||r===void 0?void 0:r.map(o=>this.identify(o))),s=this.identifyNull(t.anchor),i=this.identifyNull(t.mostRecent);this.dispatch(wr.set({ids:n,anchor:s,mostRecent:i})),pt(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}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 t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&Wf(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;pt(this.props.onMove,{dragIds:n,parentId:t===Ds?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(zn.cursor({type:"none"}))}showCursor(t){this.dispatch(zn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(Sa.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),pt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(Sa.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),pt(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=cl(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Mi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Mi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),Xf(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.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(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===Ds)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!ds(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(gn(t.id))}onBlur(){this.dispatch(Kw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Ch}get renderRow(){return this.props.renderRow||zw}get renderNode(){return this.props.children||Vw}get renderDragPreview(){return this.props.renderDragPreview||eh}get renderCursor(){return this.props.renderCursor||Uw}}function gt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var v1=typeof Symbol=="function"&&Symbol.observable||"@@observable",vu=v1,$o=()=>Math.random().toString(36).substring(7).split("").join("."),b1={INIT:`@@redux/INIT${$o()}`,REPLACE:`@@redux/REPLACE${$o()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$o()}`},on=b1;function Oh(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function _1(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(x1(e))return"date";if(S1(e))return"error";const r=w1(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function w1(e){return typeof e.constructor=="function"?e.constructor.name:null}function S1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function x1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Cr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=_1(e)),t}function Dh(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?gt(2):`Expected the root reducer to be a function. Instead, received: '${Cr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?gt(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 t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?gt(1):`Expected the enhancer to be a function. Instead, received: '${Cr(r)}'`);return r(Dh)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?gt(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 s}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?gt(4):`Expected the listener to be a function. Instead, received: '${Cr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?gt(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 v=!0;d();const _=a++;return o.set(_,y),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?gt(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.");v=!1,d(),o.delete(_),i=null}}}function g(y){if(!Oh(y))throw new Error(process.env.NODE_ENV==="production"?gt(7):`Actions must be plain objects. Instead, the actual type was: '${Cr(y)}'. 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 y.type>"u")throw new Error(process.env.NODE_ENV==="production"?gt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?gt(17):`Action "type" property must be a string. Instead, the actual type was: '${Cr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?gt(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(_=>{_()}),y}function m(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?gt(10):`Expected the nextReducer to be a function. Instead, received: '${Cr(y)}`);n=y,g({type:on.REPLACE})}function b(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?gt(11):`Expected the observer to be an object. Instead, received: '${Cr(v)}'`);function _(){const w=v;w.next&&w.next(u())}return _(),{unsubscribe:y(_)}},[vu](){return this}}}return g({type:on.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:m,[vu]:b}}function bu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function C1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===on.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(s.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(!Oh(e))return`The ${i} has unexpected type of "${Cr(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===on.REPLACE)&&o.length>0)return`Unexpected ${o.length>1?"keys":"key"} "${o.join('", "')}" found in ${i}. Expected to find one of the known reducer keys instead: "${s.join('", "')}". Unexpected keys will be ignored.`}function E1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:on.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?gt(12):`The slice reducer for key "${t}" 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:on.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?gt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${on.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 _u(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&bu(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{E1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=C1(a,r,c,s);f&&bu(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const g=n[f],m=r[g],b=a[g],h=m(b,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?gt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${g}" 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.`)}u[g]=h,d=d||h!==b}return d=d||n.length!==Object.keys(a).length,d?u:a}}function O1(e=Un().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const D1=_u({nodes:_u({focus:Qw,edit:Ww,open:Gw,selection:Yw,drag:O1}),dnd:Xw}),I1=Un();function T1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(Dh(D1,Un(e))),o=jw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>I1),a=p.useMemo(()=>new ys(i.current,e,n,s),[]),c=p.useRef(0);return p.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),p.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),p.useImperativeHandle(t,()=>a),p.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),p.useEffect(()=>{a.props.searchTerm||i.current.dispatch(Sa.clear(!0))},[a.props.searchTerm]),l.jsx(Ff.Provider,{value:a,children:l.jsx(Uf.Provider,{value:c.current,children:l.jsx($f.Provider,{value:o.nodes,children:l.jsx(Bf.Provider,{value:o.dnd,children:l.jsx(oC,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||o1,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function N1(){const e=Tt(),[,t]=gh(()=>({accept:"NODE",canDrop:(r,n)=>n.isOver({shallow:!0})?e.canDrop():!1,hover:(r,n)=>{if(!n.isOver({shallow:!0}))return;const s=n.getClientOffset();if(!e.listEl.current||!s)return;const{cursor:i,drop:o}=xh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(zn.hovering(o.parentId,o.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function j1(e){return N1(),e.children}function R1(){const t=Tt().props.renderContainer||Ch;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function k1(){const e=Tt(),{offset:t,mouse:r,item:n,isDragging:s}=j0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||eh;return l.jsx(i,{offset:t,mouse:r,id:(n==null?void 0:n.id)||null,dragIds:(n==null?void 0:n.dragIds)||[],isDragging:s})}function A1(e={}){var t,r;const n=(t=e.idAccessor)!==null&&t!==void 0?t:"id",s=(r=e.childrenAccessor)!==null&&r!==void 0?r:"children";return{getId:typeof n=="function"?n:i=>i[n],getChildren:typeof s=="function"?s:i=>i[s],childrenKey:typeof s=="string"?s:"children"}}class P1{constructor(t,r={}){this.accessors=A1(r),this.root=M1(t,this.accessors)}get data(){var t,r;return(r=(t=this.root.children)===null||t===void 0?void 0:t.map(n=>n.data))!==null&&r!==void 0?r:[]}create(t){const r=t.parentId?this.find(t.parentId):this.root;if(!r)return null;r.addChild(t.data,t.index)}move(t){const r=this.find(t.id),n=t.parentId?this.find(t.parentId):this.root;!r||!n||(n.addChild(r.data,t.index),r.drop())}update(t){const r=this.find(t.id);r&&r.update(t.changes)}drop(t){const r=this.find(t.id);r&&r.drop()}find(t,r=this.root){if(!r)return null;if(r.id===t)return r;if(r.children){for(let n of r.children){const s=this.find(t,n);if(s)return s}return null}return null}}function M1(e,t){const r=new Ih({},null,t,"ROOT");return r.children=e.map(n=>ml(n,r,t)),r}function ml(e,t,r){const n=new Ih(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>ml(i,n,r))),n}class Ih{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=ml(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let L1=0;function F1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new P1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=b=>{for(const h of b.dragIds)o.move({id:h,parentId:b.parentId,index:b.index});n(o.data)},c=({name:b,id:h})=>{o.update({id:h,changes:{name:b}}),n(o.data)},d=typeof s=="string"?s:"id",u=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:b,index:h,type:y})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(y==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const v={[d]:`simple-tree-id-${L1++}`,name:""};return y==="internal"&&(v[u]=[]),o.create({parentId:b,index:h,data:v}),n(o.data),v},onDelete:b=>{b.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function $1(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
466
+ Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,r]=F1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function B1(e,t){const r=$1(e);return l.jsxs(T1,{treeProps:r,imperativeHandle:t,children:[l.jsx(j1,{children:l.jsx(R1,{})}),l.jsx(k1,{})]})}const U1=p.forwardRef(B1);function yl(){return Pe(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function z1(){return Pe(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const wu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Su={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},xu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],V1=[{label:"All",value:"all"},{label:"Course Assessment",value:"Course Assessment"},{label:"eTextbook",value:"eTextbook"},{label:"Exam Question",value:"Exam Question"},{label:"Explanation Content",value:"Explanation Content"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"},{label:"SCORM Content",value:"SCORM Content"},{label:"Teacher Resource",value:"Teacher Resource"}];function q1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function ao(e){const t=q1(e);return{key:t,color:wu[t]??wu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Su[t]??Su.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const H1="_row_i3qt2_1",W1="_grip_i3qt2_16",K1="_menuBtn_i3qt2_19",Q1="_selected_i3qt2_23",G1="_title_i3qt2_28",Y1="_dropTarget_i3qt2_33",X1="_toggle_i3qt2_50",Z1="_ctIcon_i3qt2_65",J1="_folderIcon_i3qt2_77",eE="_renameInput_i3qt2_92",tE="_dropHere_i3qt2_101",rE="_menuWrap_i3qt2_111",nE="_menu_i3qt2_19",sE="_dangerItem_i3qt2_163",Et={row:H1,grip:W1,menuBtn:K1,selected:Q1,title:G1,dropTarget:Y1,toggle:X1,ctIcon:Z1,folderIcon:J1,renameInput:eE,dropHere:tE,menuWrap:rE,menu:nE,dangerItem:sE},iE={video:el,pdf:Ga,h5p:Ya,scorm:Za,audio:Xa,quiz:Qa,default:Kn},oE=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,d]=p.useState(e.data.name),u=p.useRef(null),f=n==="edit",g=yl(),m=ao(e.data),b=iE[m.key]??Kn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),_=y?vy:v?xy:b;p.useEffect(()=>{if(!s)return;const C=I=>{var j;(j=u.current)!=null&&j.contains(I.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const S=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(C=>{C.key==="Enter"&&S(),C.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[Et.row,h?Et.selected:"",e.state.isOver&&v?Et.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":v?"true":void 0,role:"treeitem","aria-selected":h,"aria-expanded":v?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Et.grip,"aria-hidden":"true",children:l.jsx(ef,{size:14})}),l.jsx("button",{className:Et.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(Yd,{size:14}):l.jsx(Bs,{size:14})}),l.jsx("span",{className:`${Et.ctIcon} ${y||v?Et.folderIcon:m.bgClass}`,"aria-hidden":"true",children:l.jsx(_,{size:12})}),o?l.jsx("input",{className:Et.renameInput,value:c,autoFocus:!0,onChange:C=>d(C.target.value),onBlur:S,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:Et.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:Et.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Et.menuWrap,ref:u,children:[l.jsx("button",{className:Et.menuBtn,onClick:C=>{C.stopPropagation(),i(I=>!I)},"aria-label":"Node options",children:l.jsx(Zd,{size:14})}),s&&l.jsxs("div",{className:Et.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(Ty,{size:13})," Rename"]}),v&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Jd,{size:13})," Add sub-unit"]}),e.data.parent&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(Us,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Et.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Ja,{size:13})," Delete"]})]})]})]})};async function aE(e,t){var i,o;const n=((i=(await je.post(`/action/content/v3/upload/url/${e}?type=hierarchy`,{request:{content:{fileName:t}}})).data)==null?void 0:i.result)??{},s=((o=n.content)==null?void 0:o.preSignedURL)??n.pre_signed_url??n.preSignedUrl;if(!s)throw new Error("Could not obtain an upload URL");return s}async function lE(e,t){const r=await fetch(e,{method:"PUT",headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"text/csv"},body:t});if(!r.ok)throw new Error(`Blob upload failed (${r.status})`);return e.split("?")[0]}async function cE(e,t){var a;const r=await aE(e,t.name),n=await lE(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await je.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function uE(e){var r;return((r=(await je.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Th(e){var n,s,i;const r=(i=(s=(n=(await je.get(`/action/collection/v1/export/${e}`)).data)==null?void 0:n.result)==null?void 0:s.collection)==null?void 0:i.tocUrl;if(!r)throw new Error("No export URL returned");return r}async function dE(e){return Th(e)}const fE="_container_jr3ij_1",hE="_header_jr3ij_13",pE="_title_jr3ij_22",gE="_closeBtn_jr3ij_29",mE="_body_jr3ij_45",yE="_dropZone_jr3ij_54",vE="_dragOver_jr3ij_67",bE="_hasFile_jr3ij_72",_E="_hiddenInput_jr3ij_78",wE="_fileInfo_jr3ij_82",SE="_fileIcon_jr3ij_89",xE="_fileName_jr3ij_93",CE="_fileSize_jr3ij_100",EE="_dropHint_jr3ij_105",OE="_dropIcon_jr3ij_112",DE="_dropText_jr3ij_117",IE="_dropSubtext_jr3ij_124",TE="_sampleLink_jr3ij_130",NE="_statusBar_jr3ij_145",jE="_status_uploading_jr3ij_154",RE="_status_processing_jr3ij_154",kE="_status_done_jr3ij_159",AE="_status_error_jr3ij_164",PE="_successDetail_jr3ij_170",ME="_spinner_jr3ij_175",LE="_spin_jr3ij_175",FE="_errorMsg_jr3ij_191",$E="_failedSection_jr3ij_197",BE="_failedTitle_jr3ij_203",UE="_tableWrap_jr3ij_213",zE="_failedTable_jr3ij_219",VE="_reasonCell_jr3ij_244",qE="_footer_jr3ij_248",Ne={container:fE,header:hE,title:pE,closeBtn:gE,body:mE,dropZone:yE,dragOver:vE,hasFile:bE,hiddenInput:_E,fileInfo:wE,fileIcon:SE,fileName:xE,fileSize:CE,dropHint:EE,dropIcon:OE,dropText:DE,dropSubtext:IE,sampleLink:TE,statusBar:NE,status_uploading:jE,status_processing:RE,status_done:kE,status_error:AE,successDetail:PE,spinner:ME,spin:LE,errorMsg:FE,failedSection:$E,failedTitle:BE,tableWrap:UE,failedTable:zE,reasonCell:VE,footer:qE},HE=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState("idle"),[u,f]=p.useState(""),[g,m]=p.useState([]),[b,h]=p.useState(null),y=p.useRef(null),v=p.useRef(null),_=p.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);p.useEffect(()=>()=>_(),[_]);const S=N=>N.name.toLowerCase().endsWith(".csv")?N.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(N=>{f(""),m([]),h(null),d("idle"),S(N)&&i(N)},[]),C=p.useCallback(N=>{N.preventDefault(),a(!1);const A=N.dataTransfer.files[0];A&&w(A)},[w]),I=p.useCallback(N=>{var $;const A=($=N.target.files)==null?void 0:$[0];A&&w(A),N.target.value=""},[w]),j=p.useCallback(async()=>{try{const N=await dE(e),A=document.createElement("a");A.href=N,A.download="sample_hierarchy.csv",A.target="_blank",A.click()}catch{f("Failed to download sample CSV.")}},[e]),k=p.useCallback(async()=>{if(s){d("uploading"),f(""),m([]);try{const{processId:N}=await cE(e,s);if(!N){d("done"),h(null),setTimeout(t,1500);return}d("processing"),v.current=setInterval(async()=>{try{const A=await uE(N);A.status==="COMPLETED"?(_(),d("done"),h(A.successCount??null),A.failedRecords&&A.failedRecords.length>0?m(A.failedRecords):setTimeout(t,1500)):A.status==="FAILED"&&(_(),d("error"),f("Upload processing failed. Please check the error rows below."),A.failedRecords&&m(A.failedRecords))}catch{_(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,_]),L={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ne.container,children:[l.jsxs("div",{className:Ne.header,children:[l.jsx("h2",{className:Ne.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ne.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ne.body,children:[l.jsxs("div",{className:`${Ne.dropZone} ${o?Ne.dragOver:""} ${s?Ne.hasFile:""}`,onDragEnter:N=>{N.preventDefault(),a(!0)},onDragOver:N=>{N.preventDefault(),a(!0)},onDragLeave:N=>{N.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var N;return(N=y.current)==null?void 0:N.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:N=>{var A;return N.key==="Enter"&&((A=y.current)==null?void 0:A.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:Ne.hiddenInput,onChange:I,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ne.fileInfo,children:[l.jsx("span",{className:Ne.fileIcon,children:"📄"}),l.jsx("span",{className:Ne.fileName,children:s.name}),l.jsxs("span",{className:Ne.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ne.dropHint,children:[l.jsx("span",{className:Ne.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ne.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ne.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ne.sampleLink,onClick:j,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ne.statusBar} ${Ne[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ne.spinner,"aria-hidden":"true"}),L[c],c==="done"&&b!==null&&l.jsxs("span",{className:Ne.successDetail,children:[" — ",b," item(s) imported"]})]}),u&&l.jsx("p",{className:Ne.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:Ne.failedSection,children:[l.jsxs("h4",{className:Ne.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:Ne.tableWrap,children:l.jsxs("table",{className:Ne.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:g.map((N,A)=>l.jsxs("tr",{children:[l.jsx("td",{children:N.rowNumber??A+1}),l.jsx("td",{children:N.name??"—"}),l.jsx("td",{className:Ne.reasonCell,children:N.reason??"Unknown error"})]},A))})]})})]})]}),l.jsxs("div",{className:Ne.footer,children:[l.jsx(Ae,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Ae,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:k,children:c==="done"?"Uploaded":"Upload"})]})]})},WE="_container_1y30m_1",KE="_header_1y30m_8",QE="_headerActions_1y30m_19",GE="_iconBtn_1y30m_25",YE="_menuWrap_1y30m_43",XE="_dropdownMenu_1y30m_47",ZE="_treeWrapper_1y30m_79",JE="_csvModal_1y30m_95",eO="_footer_1y30m_105",tr={container:WE,header:KE,headerActions:QE,iconBtn:GE,menuWrap:YE,dropdownMenu:XE,treeWrapper:ZE,csvModal:JE,footer:eO},tO=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var he;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[g,m]=p.useState("create"),{treeData:b,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:_,reorderChildren:S,moveNode:w,setTreeData:C}=Pe(),I=e==="edit",j=yl(),k=I&&j,L=(((he=b[0])==null?void 0:he.children)??[]).some(W=>W.isFolder),N=oe(W=>{var J,se,B,Y;return((se=(J=W.editorConfig)==null?void 0:J.context)==null?void 0:se.contentId)??((Y=(B=W.editorConfig)==null?void 0:B.context)==null?void 0:Y.identifier)??""}),A=oe(W=>{var se,B;const J=(B=(se=W.categoryMeta)==null?void 0:se.sourcingSettings)==null?void 0:B.collection;return(J==null?void 0:J.enableBulkUpload)!==!1});p.useEffect(()=>{const W=s.current;if(!W)return;const J=new ResizeObserver(()=>{a(W.clientHeight||400)});return J.observe(W),a(W.clientHeight||400),()=>J.disconnect()},[]),p.useEffect(()=>{if(!c)return;const W=J=>{var se;(se=i.current)!=null&&se.contains(J.target)||d(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[c]);const $=p.useCallback(W=>{W.length>0&&y(W[0].data.id)},[y]),R=p.useCallback(({parentId:W,index:J,dragIds:se})=>{if(!W)return;const B=se[0],Y=ja(b,B);if(!Y)return;const K=Y.parent;if(K===W){const ue=ja(b,W);if(!(ue!=null&&ue.children))return;const Se=ue.children.findIndex(Me=>Me.id===B);if(Se<0)return;S(W,Se,J>Se?J-1:J)}else w(B,K??"",W)},[b,S,w]),F=p.useCallback(({ids:W})=>{W.forEach(J=>_(J))},[_]),M=p.useCallback(({parentId:W})=>{var B;const J=W??((B=b[0])==null?void 0:B.id)??"";if(!J)return{id:crypto.randomUUID()};const se=v(J,"unit");return se?{id:se}:(Oe.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,b]),Z=p.useCallback(()=>{var J;const W=(J=b[0])==null?void 0:J.id;W&&(v(W,"unit")||Oe.error("Maximum depth reached"))},[b,v]),ae=p.useCallback(()=>{h&&(v(h,"subunit")||Oe.error("Maximum depth reached"))},[h,v]),ve=p.useCallback(async()=>{if(d(!1),!!N)try{const W=await Th(N),J=await fetch(W).then(Y=>Y.blob()),se=URL.createObjectURL(J),B=document.createElement("a");B.href=se,B.download=`${N}-folders.csv`,B.style.display="none",document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(se)}catch{Oe.error("Failed to download CSV")}},[N]),we=p.useCallback(async()=>{if(f(!1),!!N)try{const{rootNode:W}=await Lf(N);C([W]),Oe.success("Course outline refreshed.")}catch{Oe.error("Outline could not be refreshed automatically. Please reload the page.")}},[N,C]);return l.jsxs("div",{className:tr.container,children:[l.jsx("div",{className:tr.header,children:l.jsxs("div",{className:tr.headerActions,children:[I&&l.jsxs("div",{className:tr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:tr.iconBtn,onClick:()=>d(W=>!W),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Zd,{size:15})}),c&&l.jsx("div",{className:tr.dropdownMenu,role:"menu",children:A&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:L,title:L?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),m("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:ve,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),m("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:tr.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(Dy,{size:15}):l.jsx(Oy,{size:15})})]})}),l.jsx("div",{className:tr.treeWrapper,ref:s,children:l.jsx(U1,{ref:n,data:b,idAccessor:"id",childrenAccessor:"children",onSelect:$,onMove:I?R:void 0,onDelete:I?F:void 0,onCreate:I?M:void 0,disableEdit:!I,disableDrop:!I,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:W=>l.jsx(oE,{...W,editorMode:e})})}),I&&l.jsxs("div",{className:tr.footer,children:[l.jsxs(Ae,{variant:"ghost",size:"sm",onClick:Z,disabled:!k,children:[l.jsx(Us,{size:14})," Add Unit"]}),l.jsxs(Ae,{variant:"ghost",size:"sm",onClick:ae,disabled:!k||!h,children:[l.jsx(Jd,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:tr.csvModal,children:l.jsx(HE,{contentId:N,mode:g,onComplete:we,onClose:()=>f(!1)})})]})};function ja(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=ja(r.children,t);if(n)return n}}}const rO="_breadcrumb_zd1aj_1",nO="_crumb_zd1aj_10",sO="_sep_zd1aj_26",iO="_current_zd1aj_31",ss={breadcrumb:rO,crumb:nO,sep:sO,current:iO},oO=({crumbs:e})=>{const t=Pe(r=>r.selectNode);return e.length?l.jsxs("nav",{className:ss.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:ss.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(Cy,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Yd,{size:13,className:ss.sep}),n<e.length-1?l.jsx("button",{className:ss.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:ss.current,children:r.name})]},r.id))]}):null},aO="_tabBar_qhks1_1",lO="_tab_qhks1_1",cO="_active_qhks1_29",uO="_error_qhks1_35",dO="_errorDot_qhks1_39",is={tabBar:aO,tab:lO,active:cO,error:uO,errorDot:dO},Cu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],fO=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?Cu.filter(i=>n.includes(i.id)):Cu;return l.jsx("div",{className:is.tabBar,role:"tablist","aria-label":"Metadata sections",children:s.map(i=>l.jsxs("button",{role:"tab","aria-selected":e===i.id,"aria-controls":`panel-${i.id}`,className:[is.tab,e===i.id?is.active:"",r.includes(i.id)?is.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:is.errorDot,"aria-label":"Has errors"})]},i.id))})};var Ws=e=>e.type==="checkbox",Kr=e=>e instanceof Date,lt=e=>e==null;const Nh=e=>typeof e=="object";var He=e=>!lt(e)&&!Array.isArray(e)&&Nh(e)&&!Kr(e),Ra=e=>He(e)&&e.target?Ws(e.target)?e.target.checked:e.target.value:e,jh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Rh=e=>{const t=e.constructor&&e.constructor.prototype;return He(t)&&t.hasOwnProperty("isPrototypeOf")},lo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ke(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(lo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(He(e)&&Rh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ke(e[s]));return n}const Or={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Kt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ht={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Bo="form",kh="root",Ah=["__proto__","constructor","prototype"];var Ks=e=>/^\w*$/.test(e),$e=e=>e===void 0,co=e=>e.split(/[.[\]'"]/g).filter(Boolean),H=(e,t,r)=>{if(!t||!He(e))return r;const n=Ks(t)?[t]:co(t);if(n.some(i=>Ah.includes(i)))return r;const s=n.reduce((i,o)=>lt(i)?void 0:i[o],e);return $e(s)||s===e?$e(e[t])?r:e[t]:s},At=e=>typeof e=="boolean",yt=e=>typeof e=="function",Le=(e,t,r)=>{let n=-1;const s=Ks(t)?[t]:co(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=He(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Ah.includes(a))return;e[a]=c,e=e[a]}};const vl=p.createContext(null);vl.displayName="HookFormControlContext";const bl=()=>p.useContext(vl);var Ph=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Kt.all&&(t._proxyFormState[o]=!n||Kt.all),r&&(r[o]=!0),e[o]}});return s};const _l=lo?p.useLayoutEffect:p.useEffect;function hO(e){const t=bl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return _l(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Ph(o,r,c.current,!1),[o,r])}var vt=e=>typeof e=="string",ka=(e,t,r,n,s)=>vt(e)?(n&&t.watch.add(e),H(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),H(r,i))):(n&&(t.watchAll=!0),r),Aa=e=>lt(e)||!Nh(e);const Eu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Rh(e);function Pt(e,t,r=new WeakMap){if(e===t)return!0;if(Aa(e)||Aa(t))return Object.is(e,t);if(Kr(e)&&Kr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Eu(e,n)||Eu(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Kr(a)&&Kr(c)||(He(a)||Array.isArray(a))&&(He(c)||Array.isArray(c))?!Pt(a,c,r):!Object.is(a,c))return!1}}return!0}function pO(e){const t=bl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),d=p.useRef(a),u=p.useRef(void 0),f=p.useRef(r),g=p.useRef(n);d.current=a;const[m,b]=p.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=p.useCallback(w=>{const C=ka(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const C=ka(n,r._names,w||r._formValues,!1,c.current);if(d.current){const I=d.current(C);Pt(I,u.current)||(b(I),u.current=I)}else b(C)}},[r._formValues,r._names,i,n]);_l(()=>((f.current!==r||!Pt(g.current,n))&&(f.current=r,g.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,_=g.current,S=p.useMemo(()=>{if(i)return null;const w=!v&&!Pt(_,n);return v||w?h():null},[i,v,n,_,h]);return S!==null?S:m}function uo(e){const t=bl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=jh(s._names.array,r),d=p.useMemo(()=>H(s._formValues,r,H(s._defaultValues,r,o)),[s,r,o]),u=pO({control:s,name:r,defaultValue:d,exact:a}),f=hO({control:s,name:r,exact:a}),g=p.useRef(e),m=p.useRef(null),b=p.useRef(s.register(r,{...e.rules,value:u,...At(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!H(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!H(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!H(f.validatingFields,r)},error:{enumerable:!0,get:()=>H(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const C=Ra(w);return H(s._fields,r)||(b.current=s.register(r,{...g.current.rules,value:C})),b.current.onChange({target:{value:Ra(w),name:r},type:Or.CHANGE})},[r,s]),v=p.useCallback(()=>b.current.onBlur({target:{value:H(s._formValues,r),name:r},type:Or.BLUR}),[r,s._formValues]),_=p.useCallback(w=>{w&&(m.current={focus:()=>yt(w.focus)&&w.focus(),select:()=>yt(w.select)&&w.select(),setCustomValidity:I=>yt(w.setCustomValidity)&&w.setCustomValidity(I),reportValidity:()=>yt(w.reportValidity)&&w.reportValidity()});const C=H(s._fields,r);C&&C._f&&w&&(C._f.ref=m.current)},[s._fields,r]),S=p.useMemo(()=>({name:r,value:u,...At(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:_}),[r,n,f.disabled,y,v,_,u]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...At(g.current.disabled)?{disabled:g.current.disabled}:{}});const C=(I,j)=>{const k=H(s._fields,I);k&&k._f&&(k._f.mount=j)};if(C(r,!0),w){const I=Ke(H(i?s._defaultValues:s._options.values||s._defaultValues,r,H(s._options.defaultValues,r,g.current.defaultValue)));Le(s._defaultValues,r,I),$e(H(s._formValues,r))&&Le(s._formValues,r,I)}if(!c&&s.register(r),m.current){const I=H(s._fields,r);I&&I._f&&(I._f.ref=m.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:S,formState:f,fieldState:h}),[S,f,h])}const wl=p.createContext(null);wl.displayName="HookFormContext";const Xt=()=>p.useContext(wl),gO=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:b,register:h,setFocus:y,subscribe:v})=>{const _=p.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:b,register:h,setFocus:y,subscribe:v}),[i,b,d,n,r,g,h,f,u,s,y,o,a,v,c,m,t]);return p.createElement(wl.Provider,{value:_},p.createElement(vl.Provider,{value:_.control},e))};var mO=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Mh=e=>Array.isArray(e)?e.filter(Boolean):[],Ci=e=>Array.isArray(e)?e:[e],Ou=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function Lh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&He(s)&&i){const o=Lh(s,i);He(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var nt=e=>He(e)&&!Object.keys(e).length,Sl=e=>e.type==="file",Fi=e=>{if(!lo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Fh=e=>e.type==="select-multiple",xl=e=>e.type==="radio",yO=e=>xl(e)||Ws(e),Uo=e=>Fi(e)&&e.isConnected;function vO(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(lt(e)){e=void 0;break}e=e[t[n]],n++}return e}function bO(e){for(const t in e)if(e.hasOwnProperty(t)&&!$e(e[t]))return!1;return!0}function Ye(e,t){if(vt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Ks(t)?[t]:co(t),n=r.length===1?e:vO(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(He(n)&&nt(n)||Array.isArray(n)&&bO(n))&&Ye(e,r.slice(0,-1)),e}var _O=e=>{for(const t in e)if(yt(e[t]))return!0;return!1};function $h(e){return Array.isArray(e)||He(e)&&!_O(e)}function Pa(e,t={}){for(const r in e){const n=e[r];$h(n)?(t[r]=Array.isArray(n)?[]:{},Pa(n,t[r])):$e(n)||(t[r]=!0)}return t}function Ma(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Ma(r));return t.some(r=>r!==void 0)?t:void 0}if(He(e)){const t={};for(const r in e){const n=Ma(e[r]);$e(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Vr(e,t,r){r||(r=Pa(t));for(const n in e){const s=e[n];if($h(s))$e(t)||Aa(r[n])?r[n]=Pa(s,Array.isArray(s)?[]:{}):Vr(s,lt(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Pt(s,i)}}return Ma(r)||{}}const Du={value:!1,isValid:!1},Iu={value:!0,isValid:!0};var Bh=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$e(e[0].attributes.value)?$e(e[0].value)||e[0].value===""?Iu:{value:e[0].value,isValid:!0}:Iu:Du}return Du},Uh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$e(e)?e:t?e===""?NaN:e&&+e:r&&vt(e)?new Date(e):n?n(e):e;const Tu={isValid:!1,value:null};var zh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Tu):Tu;function Nu(e){const t=e.ref;return Sl(t)?t.files:xl(t)?zh(e.refs).value:Fh(t)?[...t.selectedOptions].map(({value:r})=>r):Ws(t)?Bh(e.refs).value:Uh($e(t.value)?e.ref.value:t.value,e)}var wO=(e,t,r,n)=>{const s={};for(const i of e){const o=H(t,i);o&&Le(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},$i=e=>e instanceof RegExp,os=e=>$e(e)?e:$i(e)?e.source:He(e)?$i(e.value)?e.value.source:e.value:e,ju=e=>({isOnSubmit:!e||e===Kt.onSubmit,isOnBlur:e===Kt.onBlur,isOnChange:e===Kt.onChange,isOnAll:e===Kt.all,isOnTouch:e===Kt.onTouched});const Ru="AsyncFunction";var SO=e=>!!e&&!!e.validate&&!!(yt(e.validate)&&e.validate.constructor.name===Ru||He(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ru)),xO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),zo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const vs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=H(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(vs(a,t))break}else if(He(a)&&vs(a,t))break}}};function ku(e,t,r){const n=H(e,r);if(n||Ks(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=H(t,i),a=H(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var CO=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return nt(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Kt.all))},EO=(e,t,r)=>!e||!t||e===t||Ci(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),OO=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,DO=(e,t)=>!Mh(H(e,t)).length&&Ye(e,t),Au=(e,t,r)=>{const n=H(e,r),s=Array.isArray(n)?n:[];return Le(s,kh,t[r]),Le(e,r,s),e};function Pu(e,t,r="validate"){if(vt(e)||Array.isArray(e)&&e.every(vt)||At(e)&&!e)return{type:r,message:vt(e)?e:"",ref:t}}var wn=e=>He(e)&&!$i(e)?e:{value:e,message:""},Mu=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:g,pattern:m,validate:b,name:h,valueAsNumber:y,mount:v}=e._f,_=H(r,h);if(!v||t.has(h))return{};const S=a?a[0]:o,w=$=>{if(s&&S.reportValidity){const R=At($)?"":$||"";a?a.forEach(F=>F.setCustomValidity(R)):S.setCustomValidity(R),S.reportValidity()}},C={},I=xl(o),j=Ws(o),k=I||j,L=(y||Sl(o))&&$e(o.value)&&$e(_)||Fi(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,N=mO.bind(null,h,n,C),A=($,R,F,M=Ht.maxLength,Z=Ht.minLength)=>{const ae=$?R:F;C[h]={type:$?M:Z,message:ae,ref:o,...N($?M:Z,ae)}};if(i?!Array.isArray(_)||!_.length:c&&(!k&&(L||lt(_))||At(_)&&!_||j&&!Bh(a).isValid||I&&!zh(a).isValid)){const{value:$,message:R}=vt(c)?{value:!!c,message:c}:wn(c);if($&&(C[h]={type:Ht.required,message:R,ref:S,...N(Ht.required,R)},!n))return w(R),C}if(!L&&(!lt(f)||!lt(g))){let $,R;const F=wn(g),M=wn(f);if(!lt(_)&&!isNaN(_)){const Z=o.valueAsNumber||_&&+_;lt(F.value)||($=Z>F.value),lt(M.value)||(R=Z<M.value)}else{const Z=o.valueAsDate||new Date(_),ae=he=>new Date(new Date().toDateString()+" "+he),ve=o.type=="time",we=o.type=="week";vt(F.value)&&_&&($=ve?ae(_)>ae(F.value):we?_>F.value:Z>new Date(F.value)),vt(M.value)&&_&&(R=ve?ae(_)<ae(M.value):we?_<M.value:Z<new Date(M.value))}if(($||R)&&(A(!!$,F.message,M.message,Ht.max,Ht.min),!n))return w(C[h].message),C}if((d||u)&&!L&&(vt(_)||i&&Array.isArray(_))){const $=wn(d),R=wn(u),F=!lt($.value)&&_.length>+$.value,M=!lt(R.value)&&_.length<+R.value;if((F||M)&&(A(F,$.message,R.message),!n))return w(C[h].message),C}if(m&&!L&&vt(_)){const{value:$,message:R}=wn(m);if($i($)&&!_.match($)&&(C[h]={type:Ht.pattern,message:R,ref:o,...N(Ht.pattern,R)},!n))return w(R),C}if(b){if(yt(b)){const $=await b(_,r),R=Pu($,S);if(R&&(C[h]={...R,...N(Ht.validate,R.message)},!n))return w(R.message),C}else if(He(b)){let $={};for(const R in b){if(!nt($)&&!n)break;const F=Pu(await b[R](_,r),S,R);F&&($={...F,...N(R,F.message)},w(F.message),n&&(C[h]=$))}if(!nt($)&&(C[h]={ref:S,...$},!n))return C}}return w(!0),C};const IO={mode:Kt.onSubmit,reValidateMode:Kt.onChange,shouldFocusError:!0},Vh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function TO(e={}){let t={...IO,...e},r={...Ke(Vh),isLoading:yt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=He(t.defaultValues)||He(t.values)?Ke(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ke(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let g={...f};const m={array:Ou(),state:Ou()},b=t.criteriaMode===Kt.all,h=x=>O=>{clearTimeout(d),d=setTimeout(x,O)},y=async x=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||x)){let O;t.resolver?(O=nt((await N()).errors),v()):O=await R({fields:n,onlyCheckValid:!0,eventType:Or.VALID}),O!==r.isValid&&m.state.next({isValid:O})}},v=(x,O)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((x||Array.from(a.mount)).forEach(T=>{T&&(O?Le(r.validatingFields,T,O):Ye(r.validatingFields,T))}),m.state.next({validatingFields:r.validatingFields,isValidating:!nt(r.validatingFields)}))},_=()=>{r.dirtyFields=Vr(s,i)},S=(x,O=[],T,U,z=!0,Q=!0)=>{if(U&&T&&!t.disabled){if(o.action=!0,Q&&Array.isArray(H(n,x))){const V=T(H(n,x),U.argA,U.argB);z&&Le(n,x,V)}if(Q&&Array.isArray(H(r.errors,x))){const V=T(H(r.errors,x),U.argA,U.argB);z&&Le(r.errors,x,V),DO(r.errors,x)}if((f.touchedFields||g.touchedFields)&&Q&&Array.isArray(H(r.touchedFields,x))){const V=T(H(r.touchedFields,x),U.argA,U.argB);z&&Le(r.touchedFields,x,V)}(f.dirtyFields||g.dirtyFields)&&_(),m.state.next({name:x,isDirty:M(x,O),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Le(i,x,O)},w=(x,O)=>{Le(r.errors,x,O),r.errors={...r.errors},m.state.next({errors:r.errors})},C=x=>{r.errors=x,m.state.next({errors:r.errors,isValid:!1})},I=x=>{const O=Ks(x)?[x]:co(x);let T=i,U=s;for(let z=0;z<O.length-1;z++){const Q=O[z];if(T=lt(T)?T:T[Q],U=lt(U)?U:U[Q],T===null&&U!==null)return!0}return!1},j=(x,O,T,U)=>{const z=H(n,x);if(z){if(I(x))return;const Q=$e(H(i,x)),V=H(i,x,$e(T)?H(s,x):T);$e(V)||U&&U.defaultChecked||O?Le(i,x,O?V:Nu(z._f)):ve(x,V),o.mount&&!o.action&&(y(),Q&&r.isDirty&&(f.isDirty||g.isDirty)&&(M()||(r.isDirty=!1,m.state.next({...r}))),e.shouldUnregister&&Q&&!$e(H(i,x))&&zo(x,a)&&(o.watch=!0))}},k=(x,O,T,U,z)=>{let Q=!1,V=!1;const te={name:x};if(!t.disabled){if(!T||U){(f.isDirty||g.isDirty)&&(V=r.isDirty,r.isDirty=te.isDirty=M(),Q=V!==te.isDirty);const ye=Pt(H(s,x),O);V=!!H(r.dirtyFields,x),ye!==r.isDirty?r.dirtyFields=Vr(s,i):ye?Ye(r.dirtyFields,x):Le(r.dirtyFields,x,!0),te.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||g.dirtyFields)&&V!==!ye}if(T){const ye=H(r.touchedFields,x);ye||(Le(r.touchedFields,x,T),te.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||g.touchedFields)&&ye!==T)}Q&&z&&m.state.next(te)}return Q?te:{}},L=(x,O,T,U)=>{const z=H(r.errors,x),Q=(f.isValid||g.isValid)&&At(O)&&r.isValid!==O;if(t.delayError&&T?(c=h(()=>w(x,T)),c(t.delayError)):(clearTimeout(d),c=null,T?Le(r.errors,x,T):Ye(r.errors,x),r.errors={...r.errors}),(T?!Pt(z,T):z)||!nt(U)||Q){const V={...U,...Q&&At(O)?{isValid:O}:{},errors:r.errors,name:x};r={...r,...V},m.state.next(V)}},N=async x=>(v(x,!0),await t.resolver(i,t.context,wO(x||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),A=async x=>{const{errors:O}=await N(x);if(v(x),x){for(const T of x){const U=H(O,T);U?a.array.has(T)&&He(U)&&!Object.keys(U).some(z=>!Number.isNaN(Number(z)))?Au(r.errors,{[T]:U},T):Le(r.errors,T,U):Ye(r.errors,T)}r.errors={...r.errors}}else r.errors=O;return O},$=async({name:x,eventType:O})=>{if(e.validate){const T=await e.validate({formValues:i,formState:r,name:x,eventType:O});if(He(T))for(const U in T){const z=T[U];z&&Me(`${Bo}.${U}`,{message:vt(z.message)?z.message:"",type:z.type||Ht.validate})}else vt(T)||!T?Me(Bo,{message:T||"",type:Ht.validate}):Se(Bo);return T}return!0},R=async({fields:x,onlyCheckValid:O,name:T,eventType:U,context:z={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(z.runRootValidation=!0,!await $({name:T,eventType:U})&&(z.valid=!1,O)))return z.valid;for(const Q in x){const V=x[Q];if(V){const{_f:te,...ye}=V;if(te){const Ve=a.array.has(te.name),xt=V._f&&SO(V._f),Ct=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;xt&&Ct&&v([te.name],!0);const dr=await Mu(V,a.disabled,i,b,t.shouldUseNativeValidation&&!O,Ve);if(xt&&Ct&&v([te.name]),dr[te.name]&&(z.valid=!1,O)||(!O&&(H(dr,te.name)?Ve?Au(r.errors,dr,te.name):Le(r.errors,te.name,dr[te.name]):Ye(r.errors,te.name)),e.shouldUseNativeValidation&&dr[te.name]))break}!nt(ye)&&await R({context:z,onlyCheckValid:O,fields:ye,name:Q,eventType:U})}}return z.valid},F=()=>{for(const x of a.unMount){const O=H(n,x);O&&(O._f.refs?O._f.refs.every(T=>!Uo(T)):!Uo(O._f.ref))&&Re(x)}a.unMount=new Set},M=(x,O)=>!t.disabled&&(x&&O&&Le(i,x,O),!Pt(K(),s)),Z=(x,O,T)=>ka(x,a,{...o.mount?i:$e(O)?s:vt(x)?{[x]:O}:O},T,O),ae=x=>Mh(H(o.mount?i:s,x,t.shouldUnregister?H(s,x,[]):[])),ve=(x,O,T={},U=!1)=>{const z=H(n,x);let Q=O;if(z){const V=z._f;V&&(!V.disabled&&Le(i,x,Uh(O,V)),Q=Fi(V.ref)&&lt(O)?"":O,Fh(V.ref)?[...V.ref.options].forEach(te=>te.selected=Q.includes(te.value)):V.refs?Ws(V.ref)?V.refs.forEach(te=>{(!te.defaultChecked||!te.disabled)&&(Array.isArray(Q)?te.checked=!!Q.find(ye=>ye===te.value):te.checked=Q===te.value||!!Q)}):V.refs.forEach(te=>te.checked=te.value===Q):Sl(V.ref)?V.ref.value="":(V.ref.value=Q,V.ref.type||m.state.next({name:x,values:U?i:Ke(i)})))}(T.shouldDirty||T.shouldTouch)&&k(x,Q,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&Y(x)},we=(x,O,T,U=!1)=>{for(const z in O){if(!O.hasOwnProperty(z))return;const Q=O[z],V=x+"."+z,te=H(n,V);(a.array.has(x)||He(Q)||te&&!te._f)&&!Kr(Q)?we(V,Q,T,U):ve(V,Q,T,U)}},he=(x,O,T,U)=>{const z=H(n,x),Q=a.array.has(x),V=U?O:Ke(O),te=H(i,x),ye=Pt(te,V);if(ye||Le(i,x,V),Q)m.array.next({name:x,values:U?i:Ke(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&T.shouldDirty&&(_(),m.state.next({name:x,dirtyFields:r.dirtyFields,isDirty:M(x,V)}));else{const Ve=Array.isArray(V)&&!V.length||nt(V);!z||z._f||lt(V)||Ve?ve(x,V,T,U):we(x,V,T,U)}if(!ye){const Ve=zo(x,a),xt=U?i:Ke(i);m.state.next({...Ve&&r,name:o.mount||Ve?x:void 0,values:xt})}},W=(x,O,T={})=>he(x,O,T,!1),J=(x,O={})=>{const T=yt(x)?x(i):x;if(!Pt(i,T)){i={...i,...T};for(const U of a.mount)he(U,H(T,U),O,!0);m.state.next({...r,name:void 0,type:void 0,values:i}),O.shouldValidate&&y()}},se=async x=>{o.mount=!0;const O=x.target;let T=O.name,U=!0;const z=H(n,T),Q=ye=>{U=Number.isNaN(ye)||Kr(ye)&&isNaN(ye.getTime())||Pt(ye,H(i,T,ye))},V=ju(t.mode),te=ju(t.reValidateMode);if(z){let ye,Ve;const xt=O.type?Nu(z._f):Ra(x),Ct=x.type===Or.BLUR||x.type===Or.FOCUS_OUT,dr=!xO(z._f)&&!e.validate&&!t.resolver&&!H(r.errors,T)&&!z._f.deps||OO(Ct,H(r.touchedFields,T),r.isSubmitted,te,V),Yn=zo(T,a,Ct);Le(i,T,xt),Ct?(!O||!O.readOnly)&&(z._f.onBlur&&z._f.onBlur(x),c&&c(0)):z._f.onChange&&z._f.onChange(x);const Br=k(T,xt,Ct),et=!nt(Br)||Yn;if(!Ct&&m.state.next({name:T,type:x.type,values:Ke(i)}),dr)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?Ct&&y():Ct||y()),et&&m.state.next({name:T,...Yn?{}:Br});if(!t.resolver&&e.validate&&await $({name:T,eventType:x.type}),!Ct&&Yn&&m.state.next({...r}),t.resolver){const{errors:dt}=await N([T]);if(v([T]),Q(xt),!U){!nt(Br)&&m.state.next(Br);return}const _t=ku(r.errors,n,T),Vt=ku(dt,n,_t.name||T);ye=Vt.error,T=Vt.name,Ve=nt(dt)}else v([T],!0),ye=(await Mu(z,a.disabled,i,b,t.shouldUseNativeValidation))[T],v([T]),Q(xt),U&&(ye?Ve=!1:(f.isValid||g.isValid)&&(Ve=await R({fields:n,onlyCheckValid:!0,name:T,eventType:x.type})));U&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&Y(z._f.deps),L(T,Ve,ye,Br))}},B=(x,O)=>{if(H(r.errors,O)&&x.focus)return x.focus(),1},Y=async(x,O={})=>{let T,U;const z=Ci(x);if(t.resolver){const Q=await A($e(x)?x:z);T=nt(Q),U=x?!z.some(V=>H(Q,V)):T}else x?(U=(await Promise.all(z.map(async Q=>{const V=H(n,Q);return await R({fields:V&&V._f?{[Q]:V}:V,eventType:Or.TRIGGER})}))).every(Boolean),!(!U&&!r.isValid)&&y()):U=T=await R({fields:n,name:x,eventType:Or.TRIGGER});return m.state.next({...!vt(x)||(f.isValid||g.isValid)&&T!==r.isValid?{}:{name:x},...t.resolver||!x?{isValid:T}:{},errors:r.errors}),O.shouldFocus&&!U&&vs(n,B,x?z:a.mount),U},K=(x,O)=>{let T={...o.mount?i:s};return O&&(T=Lh(O.dirtyFields?r.dirtyFields:r.touchedFields,T)),$e(x)?T:vt(x)?H(T,x):x.map(U=>H(T,U))},ue=(x,O)=>({invalid:!!H((O||r).errors,x),isDirty:!!H((O||r).dirtyFields,x),error:H((O||r).errors,x),isValidating:!!H(r.validatingFields,x),isTouched:!!H((O||r).touchedFields,x)}),Se=x=>{const O=x?Ci(x):void 0;O==null||O.forEach(T=>Ye(r.errors,T)),O?O.forEach(T=>{m.state.next({name:T,errors:r.errors})}):m.state.next({errors:{}})},Me=(x,O,T)=>{const U=(H(n,x,{_f:{}})._f||{}).ref,z=H(r.errors,x)||{},{ref:Q,message:V,type:te,...ye}=z;Le(r.errors,x,{...ye,...O,ref:U}),m.state.next({name:x,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&U&&U.focus&&U.focus()},me=(x,O)=>yt(x)?m.state.subscribe({next:T=>"values"in T&&x(T.values||Z(void 0,O),T)}):Z(x,O,!0),le=x=>m.state.subscribe({next:O=>{if(EO(x.name,O.name,x.exact)&&CO(O,x.formState||f,cr,x.reRenderRoot)){const T={...i};x.callback({values:T,...r,...O,defaultValues:s})}}}).unsubscribe,pe=x=>(o.mount=!0,g={...g,...x.formState},le({...x,formState:{...u,...x.formState}})),Re=(x,O={})=>{for(const T of x?Ci(x):a.mount)a.mount.delete(T),a.array.delete(T),O.keepValue||(Ye(n,T),Ye(i,T)),!O.keepError&&Ye(r.errors,T),!O.keepDirty&&Ye(r.dirtyFields,T),!O.keepTouched&&Ye(r.touchedFields,T),!O.keepIsValidating&&Ye(r.validatingFields,T),!t.shouldUnregister&&!O.keepDefaultValue&&Ye(s,T);m.state.next({values:Ke(i)}),m.state.next({...r,...O.keepDirty?{isDirty:M()}:{}}),!O.keepIsValid&&y()},Ue=({disabled:x,name:O})=>{if(At(x)&&o.mount||x||a.disabled.has(O)){const z=a.disabled.has(O)!==!!x;x?a.disabled.add(O):a.disabled.delete(O),z&&o.mount&&!o.action&&y()}},De=(x,O={})=>{let T=H(n,x);const U=At(O.disabled)||At(t.disabled),z=!a.registerName.has(x)&&T&&T._f&&!T._f.mount;return Le(n,x,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:x}},name:x,mount:!0,...O}}),a.mount.add(x),T&&!z?Ue({disabled:At(O.disabled)?O.disabled:t.disabled,name:x}):j(x,!0,O.value),{...U?{disabled:O.disabled||t.disabled}:{},...t.progressive?{required:!!O.required,min:os(O.min),max:os(O.max),minLength:os(O.minLength),maxLength:os(O.maxLength),pattern:os(O.pattern)}:{},name:x,onChange:se,onBlur:se,ref:Q=>{if(Q){a.registerName.add(x),De(x,O),a.registerName.delete(x),T=H(n,x);const V=$e(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,te=yO(V),ye=T._f.refs||[];if(te?ye.find(Ve=>Ve===V):V===T._f.ref)return;Le(n,x,{_f:{...T._f,...te?{refs:[...ye.filter(Uo),V,...Array.isArray(H(s,x))?[{}]:[]],ref:{type:V.type,name:x}}:{ref:V}}}),j(x,!1,void 0,V)}else T=H(n,x,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||O.shouldUnregister)&&!(jh(a.array,x)&&o.action)&&a.unMount.add(x)}}},ee=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&vs(n,B,a.mount),ze=x=>{At(x)&&(m.state.next({disabled:x}),vs(n,(O,T)=>{const U=H(n,T);U&&(O.disabled=U._f.disabled||x,Array.isArray(U._f.refs)&&U._f.refs.forEach(z=>{z.disabled=U._f.disabled||x}))},0,!1))},Xe=(x,O)=>async T=>{let U;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let z=Ke(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:V}=await N();v(),r.errors=Q,z=Ke(V)}else await R({fields:n,eventType:Or.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Ye(z,Q);if(Ye(r.errors,kh),nt(r.errors)){m.state.next({errors:{}});try{await x(z,T)}catch(Q){U=Q}}else O&&await O({...r.errors},T),ee(),setTimeout(ee);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nt(r.errors)&&!U,submitCount:r.submitCount+1,errors:r.errors}),U)throw U},q=(x,O={})=>{H(n,x)&&($e(O.defaultValue)?W(x,Ke(H(s,x))):(W(x,O.defaultValue),Le(s,x,Ke(O.defaultValue))),O.keepTouched||Ye(r.touchedFields,x),O.keepDirty||(Ye(r.dirtyFields,x),r.isDirty=O.defaultValue?M(x,Ke(H(s,x))):M()),O.keepError||(Ye(r.errors,x),f.isValid&&y()),m.state.next({...r}))},re=(x,O={})=>{const T=x?Ke(x):s,U=Ke(T),z=nt(x),Q=U;if(O.keepDefaultValues||(s=T),!O.keepValues){if(O.keepDirtyValues){const V=new Set([...a.mount,...Object.keys(Vr(s,i))]);for(const te of Array.from(V)){const ye=H(r.dirtyFields,te),Ve=H(i,te),xt=H(Q,te);ye&&!$e(Ve)?Le(Q,te,Ve):!ye&&!$e(xt)&&W(te,xt)}}else{if(lo&&$e(x))for(const V of a.mount){const te=H(n,V);if(te&&te._f){const ye=Array.isArray(te._f.refs)?te._f.refs[0]:te._f.ref;if(Fi(ye)){const Ve=ye.closest("form");if(Ve){Ve.reset();break}}}}if(O.keepFieldsRef)for(const V of a.mount)W(V,H(Q,V));else n={}}if(t.shouldUnregister){if(i=O.keepDefaultValues?Ke(s):{},O.keepFieldsRef)for(const V of a.mount)Le(i,V,H(Q,V))}else i=Ke(Q);m.array.next({values:{...Q}}),m.state.next({values:{...Q}})}a={mount:O.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!O.keepIsValid||!!O.keepDirtyValues||!t.shouldUnregister&&!nt(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!O.keepIsValid,o.action=!1,O.keepErrors||(r.errors={}),m.state.next({submitCount:O.keepSubmitCount?r.submitCount:0,isDirty:z?!1:O.keepDirty?r.isDirty:O.keepValues?M():!!(O.keepDefaultValues&&!Pt(x,s)),isSubmitted:O.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:z?{}:O.keepDirtyValues?O.keepDefaultValues&&i?Vr(s,i):r.dirtyFields:O.keepDefaultValues&&x?Vr(s,x):O.keepDirty?r.dirtyFields:{},touchedFields:O.keepTouched?r.touchedFields:{},errors:O.keepErrors?r.errors:{},isSubmitSuccessful:O.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},ie=(x,O)=>re(yt(x)?x(i):x,{...t.resetOptions,...O}),We=(x,O={})=>{const T=H(n,x),U=T&&T._f;if(U){const z=U.refs?U.refs[0]:U.ref;z.focus&&setTimeout(()=>{z.focus(),O.shouldSelect&&yt(z.select)&&z.select()})}},cr=x=>{r={...r,...x}},fn={control:{register:De,unregister:Re,getFieldState:ue,handleSubmit:Xe,setError:Me,_subscribe:le,_runSchema:N,_updateIsValidating:v,_focusError:ee,_getWatch:Z,_getDirty:M,_setValid:y,_setFieldArray:S,_setDisabledField:Ue,_setErrors:C,_getFieldArray:ae,_reset:re,_resetDefaultValues:()=>yt(t.defaultValues)&&t.defaultValues().then(x=>{ie(x,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:ze,_subjects:m,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(x){o=x},get _defaultValues(){return s},get _names(){return a},set _names(x){a=x},get _formState(){return r},get _options(){return t},set _options(x){t={...t,...x}}},subscribe:pe,trigger:Y,register:De,handleSubmit:Xe,watch:me,setValue:W,setValues:J,getValues:K,reset:ie,resetField:q,resetDefaultValues:(x,O={})=>{if(s=Ke(x),!O.keepDirty){const T=Vr(s,i);r.dirtyFields=T,r.isDirty=!nt(T)}O.keepIsValid||y(),m.state.next({...r,defaultValues:s})},clearErrors:Se,unregister:Re,setError:Me,setFocus:We,getFieldState:ue};return{...fn,formControl:fn}}function NO(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...Ke(Vh),isLoading:yt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:yt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!yt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=TO(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,_l(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!Pt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),p.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=p.useMemo(()=>Ph(s,o),[o,s]),t.current}async function Lu(e){var r,n;return(n=(r=(await je.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function jO(e){var r,n;return((n=(r=(await je.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function qh(e,t){const r=Ss({queryKey:["framework",e],queryFn:()=>Lu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Ss({queryKey:["framework",n],queryFn:()=>Lu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function RO(e,t,r){const n=e??[],s=new Set(n.map(u=>u.type).filter(Boolean)),i=(t??[]).filter(u=>!s.has(u)),{data:o}=Ss({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>jO({type:i,systemDefault:"Yes"}),enabled:i.length>0,staleTime:10*60*1e3}),a=t&&t.length?n.filter(u=>u.type&&t.includes(u.type)):n,c=[...(o??[]).map(u=>({label:u.name,value:u.identifier})),...a.map(u=>({label:u.name,value:u.identifier}))],d=new Set;return c.filter(u=>d.has(u.value)?!1:(d.add(u.value),!0))}async function kO(e){var r,n;return(n=(r=(await je.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function AO(e){var r,n,s,i,o,a;const t=Ss({queryKey:["channel",e],queryFn:()=>kO(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}const PO={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Third Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."},"Sixth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},MO=new Set(["review","read","sourcingreview","orgreview"]),ni={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},LO={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},FO={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},Cl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Hh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function $O(e,t,r,n,s={}){if(!(e!=null&&e.length))return JO(t,n,r);const i=new Map;for(const a of e){const c=a.code;c&&!i.has(c)&&i.set(c,a)}const o=new Set;return e.filter(a=>{if(n&&(a.code==="dialCode"||a.code==="dialcode")||a.visible===!1)return!1;const c=a.code;return o.has(c)?!1:(o.add(c),!0)}).map(a=>{const c=a.code??"",d=WO(a),u=KO(a,r,t,i,s),f=t[c],g=UO(c,Wh(f,d),d,t,s),m={code:c,label:a.label??c,inputType:d,required:!!(a.required===!0||Array.isArray(a.validations)&&a.validations.some(b=>b.type==="required")),editable:BO(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:qO(u,g,d,r),depends:a.depends,tab:HO(a),section:a.section,defaultValue:a.defaultValue??a.default,currentValue:g};if(c==="dialcodes"){const b=t.dialcodeRequired==="Yes";return{...m,required:b,visible:b}}return m})}function BO(e,t,r){var i;const n=r.editorMode??"edit";if(!MO.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function UO(e,t,r,n,s){const i=t==null||t===""||Array.isArray(t)&&t.length===0;switch(e){case"license":return i?s.defaultLicense??"":t;case"copyright":return i&&s.setDefaultCopyRight&&s.channelName?s.channelName:t;case"author":case"creator":return i&&s.userFullName?s.userFullName:t;case"instructions":{const o=n.instructions;return o&&typeof o=="object"&&!Array.isArray(o)?o.default??"":typeof t=="object"&&t!==null?"":t}case"maxTime":case"warningTime":{if(!i)return t;const o=n.timeLimits,a=o==null?void 0:o[e];return a!=null&&a!==""?zO(Number(a)):t}default:return t}}function zO(e){if(!Number.isFinite(e)||e<0)return"";const t=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),s=i=>String(i).padStart(2,"0");return n>0?`${s(n)}:${s(r)}:${s(t)}`:`${s(r)}:${s(t)}`}function VO(e){var n,s,i;const t=new Map,r=o=>o==null?void 0:o.forEach(a=>{a.identifier&&t.set(a.identifier,a.name),a.name&&t.set(a.name,a.name)});return(s=(n=e.organisationFramework)==null?void 0:n.categories)==null||s.forEach(o=>r(o.terms)),(i=e.targetFrameworks)==null||i.forEach(o=>{var a;return(a=o.categories)==null?void 0:a.forEach(c=>r(c.terms))}),t}function qO(e,t,r,n){if(r!=="select"&&r!=="multiselect"&&r!=="radio")return e;const s=Array.isArray(t)?t:t!=null&&t!==""?[t]:[];if(!s.length)return e;const i=e?[...e]:[],o=new Set(i.map(c=>c.value)),a=VO(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function HO(e){const t=e.section;if(t){if(ni[t])return ni[t];const n=LO[t];if(n&&ni[n])return ni[n]}const r=e.code??"";return FO[r]??"details"}function Wh(e,t){const r=new Set(["multiselect","chips","keywords","tagsinput"]),n=new Set(["select","text","textarea","radio","datepicker","datetime","license"]);return r.has(t)?Array.isArray(e)?e:e!=null&&e!==""?[e]:[]:n.has(t)?Array.isArray(e)?e[0]??"":e??"":e}function WO(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"?"select":t==="framework"||t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function KO(e,t,r,n,s){const i=e.code??"";if(i==="maxQuestions"){const d=s.childCount??0;if(d>0)return Array.from({length:d},(u,f)=>({label:String(f+1),value:String(f+1)}))}const o=e.range;if(Array.isArray(o)&&o.length)return typeof o[0]=="string"?o.map(d=>({label:d,value:d})):o.map(d=>({label:d.name,value:d.identifier}));const a=e.enum;if(a!=null&&a.length)return a.map(d=>({label:d,value:d}));if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories"){const u=(s.objectType??"")==="QuestionSet"?s.contentAdditionalCategories??s.collectionAdditionalCategories:s.collectionAdditionalCategories??s.contentAdditionalCategories,f=(u&&u.length?u:s.contextAdditionalCategories)??t.channelAdditionalCategories;return f!=null&&f.length?XO(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??Cl[i];if(c)return Kh(i,c,e,t,r,n)}function QO(e,t){return Hh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function GO(e,t){return Hh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function Vo(e,t,r){var i,o,a,c,d;const n=(o=(i=e.organisationFramework)==null?void 0:i.categories)==null?void 0:o.find(u=>u.code===t),s=(d=(c=(a=e.targetFrameworks)==null?void 0:a[0])==null?void 0:c.categories)==null?void 0:d.find(u=>u.code===t);return r?(s==null?void 0:s.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(s==null?void 0:s.terms)??[]}function YO(e){const t=new Set,r=[];for(const n of e){const s=n.identifier??n.name;s&&!t.has(s)&&(t.add(s),r.push(n))}return r}function XO(e){return Array.from(new Set(e))}function ZO(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function Kh(e,t,r,n,s,i){const o=QO(e,r),a=GO(e,r),c=h=>({label:h.name,value:o?h.identifier:h.name}),d=r.depends;if(!(d!=null&&d.length))return Vo(n,t,a).map(c);const u=d.flatMap(h=>ZO(s[h])).map(String);if(!u.length)return[];const f=[];for(const h of d){const y=i.get(h),v=(y==null?void 0:y.sourceCategory)??Cl[h]??h;f.push(...Vo(n,v,a))}const m=f.filter(h=>u.includes(String(h.name))||u.includes(String(h.identifier))||u.includes(String(h.code))).flatMap(h=>h.associations??[]).filter(h=>String(h.category??"").toLowerCase()===t.toLowerCase()),b=YO(m);return b.length?b.map(c):Vo(n,t,a).map(c)}function as(e,t){const r=Cl[e];if(r)return Kh(e,r,{},t,{},new Map)}function at(e,t,r){return Wh(e[t],r)}function JO(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:at(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:at(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:at(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:at(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:at(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:at(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:as("subjectIds",r),currentValue:at(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:at(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:as("targetBoardIds",r),currentValue:at(e,"targetBoardIds","select")},{code:"targetMediumIds",label:"Medium(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetBoardIds"],options:as("targetMediumIds",r),currentValue:at(e,"targetMediumIds","multiselect")},{code:"targetGradeLevelIds",label:"Class(es) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetMediumIds"],options:as("targetGradeLevelIds",r),currentValue:at(e,"targetGradeLevelIds","multiselect")},{code:"targetSubjectIds",label:"Subject(s) of the audience",inputType:"multiselect",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",depends:["targetGradeLevelIds"],options:as("targetSubjectIds",r),currentValue:at(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:at(e,"license","select")})),n}const eD=["allowECM","levels","setPeriod","instances"];function Qh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function tD(e,t={}){const r={...e};for(const i of eD)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Qh(n)});const s=e.instances;return s!=null&&s!==""&&(r.instances={label:s}),t.isReview&&(r.name===void 0||r.name===null||r.name==="")&&t.nodeTitle&&(r.name=t.nodeTitle),r}function rD(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Qh(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function nD(e,t){const{watch:r,setValue:n}=e,s=p.useRef(!1);p.useEffect(()=>{const i=r((o,{name:a})=>{var c;if(!(!a||s.current)){s.current=!0;try{const d=new Set([a]);let u=!0;for(;u;){u=!1;for(const f of t)d.has(f.code)||(c=f.depends)!=null&&c.some(g=>d.has(g))&&(n(f.code,f.inputType==="multiselect"||f.inputType==="chips"?[]:"",{shouldDirty:!0}),d.add(f.code),u=!0)}}finally{s.current=!1}}});return()=>i.unsubscribe()},[r,n,t])}const sD="_section_ylgu8_1",iD="_header_ylgu8_11",oD="_title_ylgu8_17",aD="_description_ylgu8_24",lD="_divider_ylgu8_30",cD="_fields_ylgu8_36",Sn={section:sD,header:iD,title:oD,description:aD,divider:lD,fields:cD},uD=({title:e,description:t,children:r})=>l.jsxs("div",{className:Sn.section,children:[l.jsxs("div",{className:Sn.header,children:[l.jsx("h3",{className:Sn.title,children:e}),t&&l.jsx("p",{className:Sn.description,children:t})]}),l.jsx("hr",{className:Sn.divider}),l.jsx("div",{className:Sn.fields,children:r})]}),dD="_field_1s288_1",fD="_fullWidth_1s288_7",hD="_label_1s288_11",pD="_required_1s288_19",gD="_input_1s288_24",mD="_textarea_1s288_45",yD="_inputError_1s288_50",vD="_error_1s288_54",bD="_selectBtn_1s288_59",_D="_selectOpen_1s288_83",wD="_placeholder_1s288_87",SD="_selectedVal_1s288_91",xD="_chevronUp_1s288_95",CD="_dropdown_1s288_100",ED="_option_1s288_116",OD="_optionSelected_1s288_134",DD="_noOpts_1s288_139",ID="_chipGroup_1s288_146",TD="_chipInput_1s288_158",ND="_addChipBtn_1s288_167",jD="_radioGroup_1s288_184",RD="_radioLabel_1s288_191",kD="_iconWrap_1s288_199",AD="_iconPreview_1s288_214",PD="_iconPlaceholder_1s288_220",MD="_removeIconBtn_1s288_233",LD="_tagChip_1s288_252",FD="_tagChipRemove_1s288_264",$D="_nestedSelectRow_1s288_278",BD="_dialcodeRow_1s288_287",UD="_validateBtn_1s288_293",zD="_dialcodeValid_1s288_315",VD="_dialcodeSpinner_1s288_325",P={field:dD,fullWidth:fD,label:hD,required:pD,input:gD,textarea:mD,inputError:yD,error:vD,selectBtn:bD,selectOpen:_D,placeholder:wD,selectedVal:SD,chevronUp:xD,dropdown:CD,option:ED,optionSelected:OD,noOpts:DD,chipGroup:ID,chipInput:TD,addChipBtn:ND,radioGroup:jD,radioLabel:RD,iconWrap:kD,iconPreview:AD,iconPlaceholder:PD,removeIconBtn:MD,tagChip:LD,tagChipRemove:FD,nestedSelectRow:$D,dialcodeRow:BD,validateBtn:UD,dialcodeValid:zD,dialcodeSpinner:VD},Fu=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Xt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[P.field,s?P.fullWidth:""].join(" "),children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[P.input,P.textarea,d?P.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[P.input,d?P.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:P.error,children:String(d.message)})]})},qD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Xt(),g=d(e),m=((h=r.find(y=>y.value===g))==null?void 0:h.label)??"Select…",b=f[e];return p.useEffect(()=>{if(!i)return;const y=v=>{var _;(_=a.current)!=null&&_.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,b?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g?P.selectedVal:P.placeholder,children:m}),l.jsx(Bs,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,g===y.value?P.optionSelected:""].join(" "),onClick:()=>{u(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),g===y.value&&l.jsx(Wn,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),b&&l.jsx("span",{className:P.error,children:String(b.message)})]})},HD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Xt(),g=d(e)??[],m=f[e],b=g.length?`${g.length} selected`:"Select…";p.useEffect(()=>{if(!i)return;const y=v=>{var _;(_=a.current)!=null&&_.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=g.includes(y)?g.filter(_=>_!==y):[...g,y];u(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,m?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g.length?P.selectedVal:P.placeholder,children:b}),l.jsx(Bs,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,g.includes(y.value)?P.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Wn,{size:13,style:{opacity:g.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),m&&l.jsx("span",{className:P.error,children:String(m.message)})]})},WD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),d=p.useRef(null),{watch:u,setValue:f,formState:{errors:g}}=Xt(),m=u(e)??[],b=g[e],h=()=>{const v=i.trim();v&&!m.includes(v)&&f(e,[...m,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,m.filter(_=>_!==v),{shouldDirty:!0});return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.chipGroup,children:[m.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:P.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:P.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=d.current)==null?void 0:v.focus()},50)},children:[l.jsx(Us,{size:12})," Add"]}))]}),b&&l.jsx("span",{className:P.error,children:String(b.message)})]})},KD=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Xt(),a=o[e];return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.radioGroup,children:r.map(c=>l.jsxs("label",{className:P.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:P.error,children:String(a.message)})]})};async function QD(e,t,r,n){var o,a;const i=(a=(o=(await je.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function GD(e,t){var s,i;const n=(i=(s=(await je.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function YD(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function XD(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await je.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const ZD="_overlay_ga6eh_1",JD="_modal_ga6eh_12",eI="_header_ga6eh_24",tI="_title_ga6eh_33",rI="_closeBtn_ga6eh_39",nI="_tabs_ga6eh_57",sI="_tab_ga6eh_57",iI="_activeTab_ga6eh_83",oI="_body_ga6eh_88",aI="_searchWrap_ga6eh_99",lI="_searchIcon_ga6eh_104",cI="_searchInput_ga6eh_113",uI="_grid_ga6eh_132",dI="_imgCell_ga6eh_148",fI="_imgCellSelected_ga6eh_166",hI="_thumb_ga6eh_171",pI="_noThumb_ga6eh_177",gI="_checkBadge_ga6eh_183",mI="_loadMoreBtn_ga6eh_198",yI="_loadingRow_ga6eh_220",vI="_empty_ga6eh_230",bI="_spinner_ga6eh_237",_I="_uploadArea_ga6eh_247",wI="_dropZone_ga6eh_256",SI="_uploadIcon_ga6eh_277",xI="_dropText_ga6eh_281",CI="_dropSubtext_ga6eh_288",EI="_uploadPreview_ga6eh_294",OI="_hiddenInput_ga6eh_301",DI="_fileName_ga6eh_305",II="_errorText_ga6eh_311",TI="_footer_ga6eh_318",NI="_cancelBtn_ga6eh_328",jI="_confirmBtn_ga6eh_345",ge={overlay:ZD,modal:JD,header:eI,title:tI,closeBtn:rI,tabs:nI,tab:sI,activeTab:iI,body:oI,searchWrap:aI,searchIcon:lI,searchInput:cI,grid:uI,imgCell:dI,imgCellSelected:fI,thumb:hI,noThumb:pI,checkBadge:gI,loadMoreBtn:mI,loadingRow:yI,empty:vI,spinner:bI,uploadArea:_I,dropZone:wI,uploadIcon:SI,dropText:xI,dropSubtext:CI,uploadPreview:EI,hiddenInput:OI,fileName:DI,errorText:II,footer:TI,cancelBtn:NI,confirmBtn:jI},$u=18,Gh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,d]=p.useState([]),[u,f]=p.useState(0),[g,m]=p.useState(!1),[b,h]=p.useState(null),[y,v]=p.useState(0),[_,S]=p.useState(null),[w,C]=p.useState(""),[I,j]=p.useState(!1),[k,L]=p.useState(""),N=p.useRef(null),A=oe(B=>{var Y,K;return((K=(Y=B.editorConfig)==null?void 0:Y.context)==null?void 0:K.channel)??""}),$=oe(B=>{var Y,K;return((K=(Y=B.editorConfig)==null?void 0:Y.context)==null?void 0:K.uid)??""}),R=oe(B=>{var Y,K,ue;return((ue=(K=(Y=B.editorConfig)==null?void 0:Y.context)==null?void 0:K.cloudStorage)==null?void 0:ue.presigned_headers)??{}}),F=oe(B=>{var Y,K,ue;return((ue=(K=(Y=B.editorConfig)==null?void 0:Y.config)==null?void 0:K.assetConfig)==null?void 0:ue.size)??1*1024*1024}),M=oe(B=>{var Y,K,ue;return((ue=(K=(Y=B.editorConfig)==null?void 0:Y.config)==null?void 0:K.assetConfig)==null?void 0:ue.accepted)??"image/png,image/jpeg"}),Z=p.useCallback(async(B,Y,K=!1)=>{var ue;m(!0);try{const Se={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&$&&(Se.createdBy=$),A&&(Se.channel=A);const me=((ue=(await je.post("/action/composite/v3/search",{request:{filters:Se,query:B,limit:$u,offset:Y,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ue.result)??{},le=me.content??[];f(me.count??0),d(pe=>K?[...pe,...le]:le)}catch{}finally{m(!1)}},[s,$,A]);p.useEffect(()=>{s!=="upload"&&(d([]),v(0),Z(o,0))},[s]);const ae=p.useRef(),ve=B=>{a(B),clearTimeout(ae.current),ae.current=setTimeout(()=>{d([]),v(0),Z(B,0)},400)},we=()=>{const B=y+$u;v(B),Z(o,B,!0)},he=()=>{const B=(b==null?void 0:b.artifactUrl)??(b==null?void 0:b.appIcon)??(b==null?void 0:b.downloadUrl)??"";B&&r(B)};p.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const W=B=>{var ue;const Y=(ue=B.target.files)==null?void 0:ue[0];if(B.target.value="",!Y)return;const K=M.split(",").map(Se=>Se.trim());if(!K.includes(Y.type)){const Se=K.map(Me=>Me.replace("image/","").toUpperCase()).join(", ");L(`Only ${Se} files are accepted.`);return}if(Y.size>F){const Se=(F/1048576).toFixed(0);L(`Image must be under ${Se} MB.`);return}w&&URL.revokeObjectURL(w),S(Y),C(URL.createObjectURL(Y)),L("")},J=async()=>{if(_){j(!0),L("");try{const B=await QD(_.name.split(".").slice(0,-1).join(".")||_.name,_.type,$,A),Y=await GD(B,_.name);await YD(Y,_,R);const K=Y.split("?")[0],ue=await XD(B,K,_.type);r(ue)}catch(B){L(B instanceof Error?B.message:"Upload failed.")}finally{j(!1)}}},se=c.length<u;return l.jsx("div",{className:ge.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:ge.modal,children:[l.jsxs("div",{className:ge.header,children:[l.jsx("span",{className:ge.title,children:"Select App Icon"}),l.jsx("button",{className:ge.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(un,{size:18})})]}),l.jsxs("div",{className:ge.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${ge.tab} ${s==="my"?ge.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${ge.tab} ${s==="all"?ge.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${ge.tab} ${s==="upload"?ge.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Zl,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:ge.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ge.searchWrap,children:[l.jsx(pa,{size:14,className:ge.searchIcon}),l.jsx("input",{type:"search",className:ge.searchInput,placeholder:"Search images…",value:o,onChange:B=>ve(B.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:ge.loadingRow,children:[l.jsx(di,{size:20,className:ge.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:ge.empty,children:"No images found"}):l.jsx("div",{className:ge.grid,children:c.map(B=>{const Y=B.appIcon??B.artifactUrl??B.downloadUrl??"",K=(b==null?void 0:b.identifier)===B.identifier;return l.jsxs("button",{type:"button",className:`${ge.imgCell} ${K?ge.imgCellSelected:""}`,onClick:()=>h(B),title:B.name,children:[Y?l.jsx("img",{src:Y,alt:B.name,className:ge.thumb}):l.jsx("div",{className:ge.noThumb,children:"IMG"}),K&&l.jsx("div",{className:ge.checkBadge,children:l.jsx(Wn,{size:12})})]},B.identifier)})}),se&&!g&&l.jsx("button",{className:ge.loadMoreBtn,onClick:we,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:ge.loadingRow,children:l.jsx(di,{size:16,className:ge.spinner})})]}):l.jsxs("div",{className:ge.uploadArea,children:[l.jsx("div",{className:ge.dropZone,onClick:()=>{var B;return(B=N.current)==null?void 0:B.click()},onDragOver:B=>B.preventDefault(),onDrop:B=>{B.preventDefault();const Y=B.dataTransfer.files[0];Y&&W({target:{files:[Y],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:ge.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Zl,{size:32,className:ge.uploadIcon}),l.jsx("p",{className:ge.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:ge.dropSubtext,children:[M.split(",").map(B=>B.replace("image/","").toUpperCase()).join(", ")," · max ",(F/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:N,type:"file",accept:M,className:ge.hiddenInput,onChange:W}),_&&l.jsx("p",{className:ge.fileName,children:_.name}),k&&l.jsx("p",{className:ge.errorText,children:k})]})}),l.jsxs("div",{className:ge.footer,children:[l.jsx("button",{className:ge.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:ge.confirmBtn,disabled:!_||I,onClick:J,children:I?l.jsxs(l.Fragment,{children:[l.jsx(di,{size:14,className:ge.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:ge.confirmBtn,disabled:!b,onClick:he,children:"Use Selected"})]})]})})},RI=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Xt(),f=a(e),g=u[e],m=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},b=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:P.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:P.iconPreview}):l.jsxs("div",{className:P.iconPlaceholder,children:[l.jsx(tf,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:P.removeIconBtn,onClick:b,"aria-label":"Remove app icon",children:[l.jsx(Ja,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:P.error,children:String(g.message)}),i&&l.jsx(Gh,{nodeId:r,currentValue:f,onSelect:m,onClose:()=>o(!1)})]})},kI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Xt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:P.error,children:String(o.message)})]})},AI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Xt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),d=p.useRef(null),u=i.value??[],f=h=>{const y=h.trim();!y||u.includes(y)||i.onChange([...u,y])},g=h=>{i.onChange(u.filter(y=>y!==h))},m=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&u.length>0&&g(u[u.length-1])},b=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:[P.chipGroup,o?P.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=d.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(h=>l.jsxs("span",{className:P.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:P.tagChipRemove,onClick:y=>{y.stopPropagation(),g(h)},"aria-label":`Remove ${h}`,children:l.jsx(un,{size:11})})]},h)),!n&&l.jsx("input",{ref:d,className:P.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:m,onBlur:b,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:P.error,children:String(o.message)})]})},PI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Xt(),{field:o,fieldState:{error:a}}=uo({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,g)=>{const m={};for(let b=0;b<f;b++)m[r[b].code]=c[r[b].code]??"";m[u]=g;for(let b=f+1;b<r.length;b++)m[r[b].code]="";o.onChange(m)};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.nestedSelectRow,children:r.map((u,f)=>{const g=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:P.field,style:{flex:1},children:[l.jsx("label",{className:P.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[P.input,a?P.inputError:""].join(" "),disabled:s||g,value:c[u.code]??"",onChange:m=>d(u.code,f,m.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(m=>l.jsx("option",{value:m.value,children:m.label},m.value))]})]},u.code)})}),a&&l.jsx("span",{className:P.error,children:String(a.message)})]})},Bu=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],MI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Xt(),f=c(e),g=Bu.find(h=>h.value===f),m=(g==null?void 0:g.label)??"Select license…",b=u[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:P.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[P.selectBtn,b?P.inputError:"",s?P.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?P.selectedVal:P.placeholder,children:m}),l.jsx(Bs,{size:14,className:s?P.chevronUp:""})]}),s&&l.jsx("div",{className:P.dropdown,role:"listbox",children:Bu.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[P.option,f===h.value?P.optionSelected:""].join(" "),onClick:()=>{d(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Wn,{size:13})]},h.value))}),b&&l.jsx("span",{className:P.error,children:String(b.message)})]})},LI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Xt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[d,u]=p.useState(""),f=async()=>{const m=(i.value??"").trim();if(!m){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const b=await X_(m),h=b==null?void 0:b.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},g=()=>a==="loading"?l.jsx(di,{size:16,className:P.dialcodeSpinner}):a==="valid"?l.jsx(Xd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(ha,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:m=>{i.onChange(m),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:P.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),g()]}),o&&l.jsx("span",{className:P.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?P.dialcodeValid:P.error,children:d})]})},FI="_form_szqex_1",$I="_ungrouped_szqex_7",BI="_noFields_szqex_18",qo={form:FI,ungrouped:$I,noFields:BI},UI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var pe,Re,Ue,De,ee,ze,Xe;const a=oe(q=>q.editorConfig),c=oe(q=>q.rootFormConfig),d=oe(q=>q.unitFormConfig),u=oe(q=>q.categoryMeta),f=oe(q=>q.contentFramework),g=oe(q=>q.contentTargetFWIds),{organisationFramework:m,targetFrameworks:b,isLoading:h}=qh(f??((pe=a==null?void 0:a.context)==null?void 0:pe.framework),g??((Re=a==null?void 0:a.context)==null?void 0:Re.targetFWIds)),{frameworks:y,collectionAdditionalCategories:v,contentAdditionalCategories:_,defaultLicense:S,name:w}=AO((Ue=a==null?void 0:a.context)==null?void 0:Ue.channel),C=RO(y,(De=u==null?void 0:u.frameworkMetadata)==null?void 0:De.orgFWType,(ee=a==null?void 0:a.context)==null?void 0:ee.channel),I={organisationFramework:m,targetFrameworks:b,orgFrameworks:C,channelAdditionalCategories:v},j=Pe(q=>q.selectedNodeId),k=Pe(q=>q.treeData),L=Pe(q=>q.treeCache),N=j?L[j]??{}:{},A={...e,...N},$=p.useMemo(()=>{var re;if(!j)return 0;const q=[...k];for(;q.length;){const ie=q.shift();if(ie.id===j)return((re=ie.children)==null?void 0:re.length)??0;ie.children&&q.push(...ie.children)}return 0},[k,j]),R=(a==null?void 0:a.config)??{},F=(a==null?void 0:a.context)??{},M={editorMode:s,editableFields:R.editableFields,objectType:R.objectType,setDefaultCopyRight:R.setDefaultCopyRight===!0,defaultLicense:F.defaultLicense??S,contextAdditionalCategories:F.additionalCategories,userFullName:(ze=F.user)==null?void 0:ze.fullName,channelName:w,collectionAdditionalCategories:v,contentAdditionalCategories:_,childCount:$},Z=r?c:d,ae=Z||(((Xe=a==null?void 0:a.config.hierarchy)==null?void 0:Xe.formConfig)??[]),ve=$O(ae,A,I,r,M),we=ve.filter(q=>q.tab===t&&q.inputType!=="appIcon"&&q.visible!==!1),he=NO({mode:"onChange",defaultValues:Object.fromEntries(ve.map(q=>{const re=["multiselect","chips","keywords","tagsinput"],ie=["nestedselect"];return re.includes(q.inputType)?[q.code,q.currentValue??q.defaultValue??[]]:ie.includes(q.inputType)?[q.code,q.currentValue??q.defaultValue??{}]:[q.code,q.currentValue??q.defaultValue??""]}))});nD(he,ve);const{updateNode:W}=Pe(),J=p.useRef(ve);J.current=ve;const se=p.useRef(j);se.current=j;const B=p.useRef(i);B.current=i;const Y=p.useRef(o);Y.current=o;const K=p.useRef(typeof A.shuffle=="boolean"?A.shuffle:void 0),ue=p.useRef(A.name??"");ue.current=A.name??"";const Se=p.useRef(s);Se.current=s;const Me=["review","read","sourcingreview","orgreview"];p.useEffect(()=>{const q=se.current;if(q){const re=Object.fromEntries(J.current.filter(ie=>ie.currentValue!==void 0&&ie.currentValue!==null).map(ie=>[ie.code,ie.currentValue]));Object.keys(re).length>0&&W(q,re)}he.trigger().then(()=>{const re=he.formState.errors,ie=J.current,We=Array.from(new Set(Object.keys(re).map(cr=>{var ur;return(ur=ie.find($r=>$r.code===cr))==null?void 0:ur.tab}).filter(Boolean)));Y.current(Object.keys(re).length===0,We)})},[]),p.useEffect(()=>{const q=he.watch((re,{name:ie})=>{const We=se.current;if(!We)return;const cr=J.current,ur=new Set(cr.map(x=>x.code));if(ie&&ur.has(ie)){let x=he.getValues(ie);ie==="dialcodes"&&(x=Array.isArray(x)?x:x?[x]:[]),ie==="shuffle"&&(x===!0&&K.current===!1&&Oe("Shuffling is enabled for this question set.",{icon:"ℹ️"}),K.current=x);const O=rD(ie,x);O&&(W(We,O),B.current(O))}else if(!ie){const x=he.getValues(),O=Object.fromEntries(Object.entries(x).filter(([U])=>ur.has(U))),T=tD(O,{isReview:Me.includes(Se.current),nodeTitle:ue.current});Object.keys(T).length>0&&(W(We,T),B.current(T))}const $r=he.formState.errors,fn=Array.from(new Set(Object.keys($r).map(x=>{var O;return(O=cr.find(T=>T.code===x))==null?void 0:O.tab}).filter(Boolean)));Y.current(Object.keys($r).length===0,fn)});return()=>q.unsubscribe()},[he]);const me=we.reduce((q,re)=>{const ie=q[q.length-1];return ie&&ie.section===re.section?ie.fields.push(re):q.push({section:re.section,fields:[re]}),q},[]),le=q=>{const re={key:q.code,name:q.code,label:q.label,required:q.required,disabled:q.editable===!1};switch(q.inputType){case"textarea":return l.jsx(Fu,{...re,multiline:!0,maxLength:q.maxLength});case"select":return l.jsx(qD,{...re,options:q.options??[]});case"multiselect":return l.jsx(HD,{...re,options:q.options??[]});case"chips":return l.jsx(WD,{...re});case"radio":return l.jsx(KD,{...re,options:q.options??[]});case"appIcon":return l.jsx(RI,{...re,nodeId:j??""});case"datepicker":case"datetime":return l.jsx(kI,{...re});case"keywords":case"tagsinput":return l.jsx(AI,{...re});case"nestedselect":return l.jsx(PI,{...re,levels:q.levels??[]});case"license":return l.jsx(MI,{...re});case"dialcode":return l.jsx(LI,{...re});default:return l.jsx(Fu,{...re,maxLength:q.maxLength})}};return l.jsx(gO,{...he,children:l.jsxs("div",{className:qo.form,children:[me.map((q,re)=>{const ie=q.section?PO[q.section]:void 0;return ie?l.jsx(uD,{title:ie.title,description:ie.description,children:q.fields.map(le)},q.section??re):l.jsx("div",{className:qo.ungrouped,children:q.fields.map(le)},re)}),we.length===0&&!h&&l.jsx("p",{className:qo.noFields,children:"No fields configured for this tab."})]})})};function Yh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function zI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function si(e){return e!==null&&e>=0}function VI(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function qI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Xh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Yh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},ii={scaleX:1,scaleY:1},HI=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...ii}:null}const c=WI(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...ii}:s<r&&s>=o?{x:0,y:a.height+c,...ii}:{x:0,y:0,...ii}};function WI(e,t,r){const n=e[t],s=e[t-1],i=e[t+1];return n?r<t?s?n.top-(s.top+s.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):s?n.top-(s.top+s.height):0:0}const Zh="Sortable",Jh=p.createContext({activeIndex:-1,containerId:Zh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Xh,disabled:{draggable:!1,droppable:!1}});function KI(e){let{children:t,id:r,items:n,strategy:s=Xh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=Qd(),f=Fs(Zh,r),g=a.rect!==null,m=p.useMemo(()=>n.map(I=>typeof I=="object"&&"id"in I?I.id:I),[n]),b=o!=null,h=o?m.indexOf(o.id):-1,y=d?m.indexOf(d.id):-1,v=p.useRef(m),_=!VI(m,v.current),S=y!==-1&&h===-1||_,w=qI(i);Qt(()=>{_&&b&&u(m)},[_,m,b,u]),p.useEffect(()=>{v.current=m},[m]);const C=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:S,items:m,overIndex:y,useDragOverlay:g,sortedRects:zI(m,c),strategy:s}),[h,f,w.draggable,w.droppable,S,m,y,c,g,s]);return p.createElement(Jh.Provider,{value:C},t)}const QI=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Yh(r,n,s).indexOf(t)},GI=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},YI={duration:200,easing:"ease"},ep="transform",XI=Lr.Transition.toString({property:ep,duration:0,easing:"linear"}),ZI={roleDescription:"sortable"};function JI(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Qt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=Hn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),p.useEffect(()=>{i&&o(null)},[i]),i}function eT(e){let{animateLayoutChanges:t=GI,attributes:r,disabled:n,data:s,getNewIndex:i=QI,id:o,strategy:a,resizeObserverConfig:c,transition:d=YI}=e;const{items:u,containerId:f,activeIndex:g,disabled:m,disableTransforms:b,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:_}=p.useContext(Jh),S=tT(n,m),w=u.indexOf(o),C=p.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),I=p.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:j,node:k,isOver:L,setNodeRef:N}=Jm({id:o,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...c}}),{active:A,activatorEvent:$,activeNodeRect:R,attributes:F,setNodeRef:M,listeners:Z,isDragging:ae,over:ve,setActivatorNodeRef:we,transform:he}=Kd({id:o,data:C,attributes:{...ZI,...r},disabled:S.draggable}),W=Fg(N,M),J=!!A,se=J&&!b&&si(g)&&si(y),B=!v&&ae,Y=B&&se?he:null,ue=se?Y??(a??_)({rects:h,activeNodeRect:R,activeIndex:g,overIndex:y,index:w}):null,Se=si(g)&&si(y)?i({id:o,items:u,activeIndex:g,overIndex:y}):w,Me=A==null?void 0:A.id,me=p.useRef({activeId:Me,items:u,newIndex:Se,containerId:f}),le=u!==me.current.items,pe=t({active:A,containerId:f,isDragging:ae,isSorting:J,id:o,index:w,items:u,newIndex:me.current.newIndex,previousItems:me.current.items,previousContainerId:me.current.containerId,transition:d,wasDragging:me.current.activeId!=null}),Re=JI({disabled:!pe,index:w,node:k,rect:j});return p.useEffect(()=>{J&&me.current.newIndex!==Se&&(me.current.newIndex=Se),f!==me.current.containerId&&(me.current.containerId=f),u!==me.current.items&&(me.current.items=u)},[J,Se,f,u]),p.useEffect(()=>{if(Me===me.current.activeId)return;if(Me&&!me.current.activeId){me.current.activeId=Me;return}const De=setTimeout(()=>{me.current.activeId=Me},50);return()=>clearTimeout(De)},[Me]),{active:A,activeIndex:g,attributes:F,data:C,rect:j,index:w,newIndex:Se,items:u,isOver:L,isSorting:J,isDragging:ae,listeners:Z,node:k,overIndex:y,over:ve,setNodeRef:W,setActivatorNodeRef:we,setDroppableNodeRef:N,setDraggableNodeRef:M,transform:Re??ue,transition:Ue()};function Ue(){if(Re||le&&me.current.newIndex===w)return XI;if(!(B&&!Ki($)||!d)&&(J||pe))return Lr.Transition.toString({...d,property:ep})}}function tT(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function Bi(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const rT=[Ce.Down,Ce.Right,Ce.Up,Ce.Left],nT=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(rT.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const g=s.get(f.id);if(g)switch(e.code){case Ce.Down:n.top<g.top&&c.push(f);break;case Ce.Up:n.top>g.top&&c.push(f);break;case Ce.Left:n.left>g.left&&c.push(f);break;case Ce.Right:n.left<g.left&&c.push(f);break}});const d=tm({collisionRect:n,droppableRects:s,droppableContainers:c});let u=Nd(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),g=i.get(u),m=g?s.get(g.id):null,b=g==null?void 0:g.node.current;if(b&&m&&f&&g){const y=Qi(b).some((I,j)=>a[j]!==I),v=tp(f,g),_=sT(f,g),S=y||!v?{x:0,y:0}:{x:_?n.width-m.width:0,y:_?n.height-m.height:0},w={x:m.left,y:m.top};return S.x&&S.y?w:Cs(w,S)}}}};function tp(e,t){return!Bi(e)||!Bi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function sT(e,t){return!Bi(e)||!Bi(t)||!tp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const iT="_row_11nth_1",oT="_removeBtn_11nth_14",aT="_grip_11nth_17",lT="_ctIcon_11nth_34",cT="_info_11nth_38",uT="_name_11nth_46",dT="_meta_11nth_55",Ur={row:iT,removeBtn:oT,grip:aT,ctIcon:lT,info:cT,name:uT,meta:dT},fT={video:el,pdf:Ga,h5p:Ya,scorm:Za,audio:Xa,quiz:Qa,default:Kn},hT=({item:e,onRemove:t,isEditable:r})=>{const n=ao(e),s=fT[n.key]??Kn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=eT({id:e.id,disabled:!r}),f={transform:Lr.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Ur.row,role:"listitem",children:[r&&l.jsx("span",{className:Ur.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(ef,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Ur.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Ur.info,children:[l.jsx("span",{className:Ur.name,title:e.name,children:e.name}),l.jsx("span",{className:Ur.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Ur.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(un,{size:14})})]})},pT="_container_lzvke_1",gT="_header_lzvke_7",mT="_heading_lzvke_13",yT="_count_lzvke_21",vT="_list_lzvke_30",bT="_emptyState_lzvke_36",_T="_addRow_lzvke_52",zr={container:pT,header:gT,heading:mT,count:yT,list:vT,emptyState:bT,addRow:_T},wT=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Pe(),i=t?r(t):[],o=e==="edit",a=Dd(ca(Gi,{activationConstraint:{distance:5}}),ca(Ha,{coordinateGetter:nT})),c=p.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const m=Pe.getState().getChildrenOf(t),b=m.findIndex(y=>y.id===f.id),h=m.findIndex(y=>y.id===g.id);b<0||h<0||n(t,b,h)},[t,n]),d=p.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:zr.container,children:[l.jsxs("div",{className:zr.header,children:[l.jsx("span",{className:zr.heading,children:"Content in this unit"}),l.jsx("span",{className:zr.count,children:i.length})]}),i.length>0?l.jsx(Wd,{sensors:a,collisionDetection:em,onDragEnd:c,children:l.jsx(KI,{items:i.map(u=>u.id),strategy:HI,children:l.jsx("div",{className:zr.list,role:"list",children:i.map(u=>l.jsx(hT,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:zr.emptyState,children:[l.jsx("p",{children:"No content yet"}),l.jsx("span",{children:"Drag from the library or click Add content"})]}),o&&l.jsxs("button",{className:zr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(Us,{size:14})," Add content"]})]}):null},ST="_dropZone_ijo5w_1",xT="_active_ijo5w_14",Uu={dropZone:ST,active:xT},CT=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Uu.dropZone} ${e?Uu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function ET(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await je.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function OT(e){var r,n;return(n=(r=(await je.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function DT(e){var n,s,i,o,a,c,d;const t=await je.get(`/action/questionset/v2/hierarchy/${e}`),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.questionset;if(!r||!r.identifier){const u=((o=(i=t.data)==null?void 0:i.params)==null?void 0:o.errmsg)||((c=(a=t.data)==null?void 0:a.params)==null?void 0:c.err)||((d=t.data)==null?void 0:d.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${u}`)}return r}async function IT(e){var r,n;return e.length?((n=(r=(await je.post("/action/question/v2/list",{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}const zu="application/vnd.sunbird.question";function Vu(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function TT(e,t){return Ss({queryKey:["quml","questionset",e],enabled:!!e,queryFn:async()=>{const n=await DT(e),s=u=>{if(!u)return[];const f=u.mimeType===zu&&u.identifier?[u.identifier]:[],g=(u.children??[]).flatMap(s);return[...f,...g]},i=s(n),o=new Map;i.length&&(await IT(i)).forEach(f=>{const g=f.identifier;g&&o.set(g,f)});const a=u=>{if(!u)return u;if(u.mimeType===zu&&u.identifier){const f=o.get(u.identifier)??u,g=f.outcomeDeclaration;return g!=null&&g.maxScore||(f.outcomeDeclaration={...g??{},maxScore:Vu(f)}),f}return Array.isArray(u.children)&&(u.children=u.children.map(f=>a(f))),u},c=a(n),d=c.outcomeDeclaration;return d!=null&&d.maxScore||(c.outcomeDeclaration={...d??{},maxScore:Vu(c)}),c}})}const qu="/assets/quml-player/sunbird-quml-player.js",NT="/assets/quml-player/styles.css",jT="/action/question/v2/list",Hu="sunbird-quml-player",tt=class tt{constructor(){es(this,"eventHandlers",new WeakMap)}loadScript(){return tt.scriptLoaded||customElements.get(Hu)?(tt.scriptLoaded=!0,Promise.resolve()):(tt.scriptLoading||(tt.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=qu,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{tt.scriptLoaded=!0,tt.scriptLoading=void 0,t()},n.onerror=()=>{tt.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${qu}`))},document.body.appendChild(n)})),tt.scriptLoading)}loadStyles(){if(window.questionListUrl=jT,tt.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){tt.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=NT,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),tt.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),tt.stylesLoaded=!1}async createConfig(t,r,n){var i,o,a;return await this.loadScript(),{context:{mode:(n==null?void 0:n.mode)??"play",pdata:{id:((i=r==null?void 0:r.pdata)==null?void 0:i.id)??"sunbird.portal",ver:((o=r==null?void 0:r.pdata)==null?void 0:o.ver)??"1.0",pid:((a=r==null?void 0:r.pdata)==null?void 0:a.pid)??"sunbird-portal"},contentId:t.identifier??"",sid:(r==null?void 0:r.sid)??"",uid:(r==null?void 0:r.uid)??(r==null?void 0:r.userId)??"",channel:(r==null?void 0:r.channel)??"",did:(r==null?void 0:r.did)??"",tags:(r==null?void 0:r.tags)??[],contextRollup:(n==null?void 0:n.contextRollup)??(r==null?void 0:r.rollup)??{},objectRollup:(n==null?void 0:n.objectRollup)??{},...n!=null&&n.cdata?{cdata:n.cdata}:{}},config:{sideMenu:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1}},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(Hu);return r.setAttribute("player-config",JSON.stringify(t)),r.setAttribute("data-player-id",t.metadata.identifier??"quml"),r}attachEventListeners(t,r,n){this.removeEventListeners(t);const s=o=>r==null?void 0:r(o),i=o=>n==null?void 0:n(o.detail);t.addEventListener("playerEvent",s),t.addEventListener("telemetryEvent",i),this.eventHandlers.set(t,{player:s,telemetry:i})}removeEventListeners(t){const r=this.eventHandlers.get(t);r&&(t.removeEventListener("playerEvent",r.player),t.removeEventListener("telemetryEvent",r.telemetry),this.eventHandlers.delete(t))}};es(tt,"scriptLoaded",!1),es(tt,"scriptLoading"),es(tt,"stylesLoaded",!1);let Ui=tt;const oi=new Ui,RT="_contentPlayerRoot_ryh6z_1",kT="_stage_ryh6z_9",AT="_playerHeader_ryh6z_19",PT="_playerHeaderThumb_ryh6z_33",MT="_playerHeaderTitle_ryh6z_43",LT="_typeBadge_ryh6z_53",FT="_typeDot_ryh6z_92",$T="_aspectRatio_ryh6z_99",BT="_playerFrame_ryh6z_112",UT="_coverOverlay_ryh6z_120",zT="_coverHidden_ryh6z_132",VT="_coverThumb_ryh6z_137",qT="_coverPlayRing_ryh6z_146",HT="_coverPlayIcon_ryh6z_159",WT="_coverLabel_ryh6z_168",KT="_coverSkeleton_ryh6z_174",QT="_playerWrapper_ryh6z_200",GT="_infoStrip_ryh6z_210",YT="_infoChip_ryh6z_226",XT="_infoChipLabel_ryh6z_245",ZT="_infoChipIcon_ryh6z_254",JT="_playerError_ryh6z_260",eN="_playerErrorIcon_ryh6z_274",tN="_playerErrorMsg_ryh6z_279",rN="_qumlRoot_ryh6z_286",Be={contentPlayerRoot:RT,stage:kT,playerHeader:AT,playerHeaderThumb:PT,playerHeaderTitle:MT,typeBadge:LT,typeDot:FT,aspectRatio:$T,playerFrame:BT,coverOverlay:UT,coverHidden:zT,coverThumb:VT,coverPlayRing:qT,coverPlayIcon:HT,coverLabel:WT,coverSkeleton:KT,playerWrapper:QT,infoStrip:GT,infoChip:YT,infoChipLabel:XT,infoChipIcon:ZT,playerError:JT,playerErrorIcon:eN,playerErrorMsg:tN,qumlRoot:rN},nN=[{key:"video",mimes:["video/mp4","video/webm","video/ogg"],label:"Video",icon:"🎬"},{key:"audio",mimes:["audio/mp3","audio/mpeg","audio/ogg","audio/wav"],label:"Audio",icon:"🎵"},{key:"pdf",mimes:["application/pdf"],label:"PDF",icon:"📄"},{key:"epub",mimes:["application/epub"],label:"ePub",icon:"📖"},{key:"ecml",mimes:["application/vnd.ekstep.ecml-archive"],label:"ECML",icon:"✏️"},{key:"h5p",mimes:["application/vnd.ekstep.h5p-archive"],label:"H5P",icon:"🎮"},{key:"scorm",mimes:["application/vnd.ekstep.content-collection"],label:"SCORM",icon:"📦"}];function sN(e){return nN.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const iN={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},oN={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},aN={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},lN="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Ho(e){for(const[t,r]of Object.entries(iN))if(r.includes(e))return t;return"default-player"}function cN(e,t,r){var i;const n=r==null?void 0:r.context,s=t.mimeType??e.mimeType??"";return{context:{mode:"play",partner:[],pdata:{id:((i=n==null?void 0:n.pdata)==null?void 0:i.id)??"sunbird.portal",ver:1,pid:"sunbird-portal"},contentId:e.identifier,sid:(n==null?void 0:n.sid)??"",uid:(n==null?void 0:n.uid)??"",channel:(n==null?void 0:n.channel)??"",did:(n==null?void 0:n.did)??"",timeDiff:0,contextRollup:{},tags:[],app:[(n==null?void 0:n.channel)??""],dims:""},config:{showEndPage:!1,showStartPage:!0,host:"",overlay:{showUser:!1},splash:{text:"",icon:"",bgImage:"",webLink:""},sideMenu:{showDownload:!0,showExit:!1,showShare:!0},apislug:"/action",repos:["/sunbird-plugins/renderer"],plugins:[{id:"org.sunbird.iframeEvent",ver:1,type:"plugin"},{id:"org.sunbird.player.endpage",ver:1.1,type:"plugin"}],enableTelemetryValidation:!1},metadata:t,data:s==="application/vnd.ekstep.ecml-archive"?t.body??{}:{}}}function uN(e){return document.querySelector(`script[src="${e}"]`)?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${e}`)),document.head.appendChild(n)})}async function dN(e,t,r=100){await uN(oN[t]??""),!customElements.get(e)&&await new Promise((n,s)=>{let i=0;const o=setInterval(()=>{i++,customElements.get(e)?(clearInterval(o),n()):i>=r&&(clearInterval(o),s(new Error(`Custom element <${e}> did not register`)))},100)})}const fN=[{key:"author",label:"Author",icon:"👤"},{key:"license",label:"License",icon:"⚖️"},{key:"language",label:"Language",icon:"🌐"},{key:"gradeLevel",label:"Class",icon:"🏫"},{key:"subject",label:"Subject",icon:"📚"},{key:"contentType",label:"Type",icon:"🏷️"}];function hN({node:e}){const t=e.metadata??{},r=fN.flatMap(n=>{const s=t[n.key];if(!s)return[];const i=Array.isArray(s)?s.join(", "):String(s);return i?[{...n,val:i}]:[]});return r.length?l.jsx("div",{className:Be.infoStrip,children:r.map(n=>l.jsxs("div",{className:Be.infoChip,children:[n.icon&&l.jsx("span",{className:Be.infoChipIcon,children:n.icon}),l.jsx("span",{className:Be.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function rp({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Be.coverOverlay} ${t?Be.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Be.coverThumb}),l.jsx("div",{className:Be.coverPlayRing,children:l.jsx("div",{className:Be.coverPlayIcon})}),l.jsx("span",{className:Be.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Be.coverSkeleton})})}function np({message:e}){return l.jsxs("div",{className:Be.playerError,children:[l.jsx("span",{className:Be.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Be.playerErrorMsg,children:e})]})}function pN({mimeType:e}){const t=sN(e);return l.jsxs("span",{className:Be.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Be.typeDot}),t.label]})}const La=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(mN,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Be.contentPlayerRoot,children:[l.jsxs("div",{className:Be.stage,children:[l.jsxs("div",{className:Be.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Be.playerHeaderThumb}),l.jsx("span",{className:Be.playerHeaderTitle,children:e.name}),l.jsx(pN,{mimeType:e.mimeType??""})]}),l.jsx(gN,{node:e})]}),l.jsx(hN,{node:e})]})};function gN({node:e}){var y;const t=oe(v=>v.editorConfig),[r,n]=p.useState(()=>Ho(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,d]=p.useState(e.metadata??{}),[u,f]=p.useState(!1),g=p.useRef(null),m=p.useRef(null),b=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??lN;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(Ho(e.mimeType??"")),OT(e.identifier).then(_=>{if(v)return;const S={...e.metadata??{},..._};d(S);const w=_.mimeType??e.mimeType??"";n(Ho(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=cN(e,c,t);return p.useEffect(()=>{if(!u||r!=="default-player")return;const v=g.current;if(!v)return;v.src=b;const _=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},S=()=>a("Preview player could not be loaded.");return v.addEventListener("load",_),v.addEventListener("error",S),()=>{v.removeEventListener("load",_),v.removeEventListener("error",S),v.src=""}},[e.identifier,r,b,u]),p.useEffect(()=>{if(!u||r==="default-player")return;const v=m.current;if(!v)return;const _=aN[r];if(!_)return;const S=h;dN(_,r).then(()=>{if(!m.current)return;if(!customElements.get(_)){n("default-player");return}const w=document.createElement(_);w.setAttribute("player-config",JSON.stringify(S)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=S}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Be.aspectRatio,children:[o?l.jsx(np,{message:o}):l.jsx(rp,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:Be.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:m,className:Be.playerFrame})]})}function mN({node:e,editorMode:t}){const r=oe(a=>a.editorConfig),n=p.useRef(null),{data:s,isLoading:i,error:o}=TT(e.identifier);return p.useEffect(()=>{const a=n.current;if(!a||!s)return;let c=null,d=!1;return(async()=>{try{const u=await oi.createConfig(s,r==null?void 0:r.context,{mode:t==="edit"?"edit":"play"});if(d||!n.current)return;const f=oi.createElement(u);c=f,oi.attachEventListeners(f,g=>console.debug("[QumlPlayer] playerEvent",g.detail),g=>console.debug("[QumlPlayer] telemetryEvent",g)),a.innerHTML="",a.appendChild(f)}catch(u){console.error("[QumlPlayer] failed to initialize",u)}})(),()=>{d=!0,c&&(oi.removeEventListeners(c),c.remove()),Ui.unloadStyles()}},[s,r,t]),l.jsxs("div",{className:Be.qumlRoot,children:[o?l.jsx(np,{message:`Unable to load questionset: ${o.message}`}):i||!s?l.jsx(rp,{node:e,hidden:!1}):null,l.jsx("div",{ref:n,className:Be.playerWrapper})]})}const yN="_overlay_ifddx_1",vN="_modal_ifddx_11",bN="_header_ifddx_21",_N="_body_ifddx_37",wN="_hint_ifddx_43",SN="_list_ifddx_49",xN="_item_ifddx_55",CN="_selected_ifddx_68",EN="_empty_ifddx_73",ON="_footer_ifddx_79",DN="_cancelBtn_ifddx_87",IN="_moveBtn_ifddx_95",$t={overlay:yN,modal:vN,header:bN,body:_N,hint:wN,list:SN,item:xN,selected:CN,empty:EN,footer:ON,cancelBtn:DN,moveBtn:IN};function TN(e,t,r){const n=[],s=i=>{var o;for(const a of i)a.isFolder&&a.id!==r&&a.id!==t&&n.push(a),(o=a.children)!=null&&o.length&&s(a.children)};return s(e),n}const NN=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Pe(),o=TN(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=p.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:$t.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:$t.modal,children:[l.jsxs("div",{className:$t.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(un,{size:16})})]}),l.jsxs("div",{className:$t.body,children:[l.jsx("p",{className:$t.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:$t.list,children:[o.map(f=>l.jsxs("li",{className:`${$t.item} ${a===f.id?$t.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(Sy,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:$t.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:$t.footer,children:[l.jsx("button",{className:$t.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:$t.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},jN="_overlay_16at9_1",RN="_modal_16at9_11",kN="_header_16at9_21",AN="_body_16at9_37",PN="_table_16at9_43",MN="_pageInput_16at9_61",LN="_empty_16at9_68",FN="_footer_16at9_74",$N="_cancelBtn_16at9_82",BN="_saveBtn_16at9_90",rr={overlay:jN,modal:RN,header:kN,body:AN,table:PN,pageInput:MN,empty:LN,footer:FN,cancelBtn:$N,saveBtn:BN};function UN(e){const t=[],r=n=>{var s;for(const i of n)!i.isFolder&&(!i.children||i.children.length===0)?t.push(i):(s=i.children)!=null&&s.length&&r(i.children)};return r(e),t}const zN=({onClose:e})=>{const{treeData:t,updateNode:r}=Pe(),n=UN(t),[s,i]=p.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=p.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:rr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:rr.modal,children:[l.jsxs("div",{className:rr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(un,{size:16})})]}),l.jsx("div",{className:rr.body,children:n.length===0?l.jsx("p",{className:rr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:rr.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:rr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:rr.footer,children:[l.jsx("button",{className:rr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:rr.saveBtn,onClick:o,children:[l.jsx(jy,{size:14})," Save"]})]})]})})},VN="_container_1a7t2_1",qN="_panelHeader_1a7t2_10",HN="_panelHeaderLeft_1a7t2_19",WN="_panelCollapseBtn_1a7t2_27",KN="_titleRow_1a7t2_46",QN="_field_1a7t2_47",GN="_moveBtn_1a7t2_64",YN="_icon_1a7t2_84",XN="_nameInput_1a7t2_93",ZN="_fieldHeader_1a7t2_118",JN="_label_1a7t2_124",ej="_fieldCount_1a7t2_133",tj="_chips_1a7t2_170",rj="_chip_1a7t2_170",nj="_chipRemove_1a7t2_188",sj="_keywordInput_1a7t2_202",ij="_input_1a7t2_207",oj="_addBtn_1a7t2_220",aj="_radioGroup_1a7t2_234",lj="_radioLabel_1a7t2_239",qe={container:VN,panelHeader:qN,panelHeaderLeft:HN,panelCollapseBtn:WN,titleRow:KN,field:QN,moveBtn:GN,icon:YN,nameInput:XN,fieldHeader:ZN,label:JN,fieldCount:ej,chips:tj,chip:rj,chipRemove:nj,keywordInput:sj,input:ij,addBtn:oj,radioGroup:aj,radioLabel:lj},cj=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var A,$;const{updateNode:s,markDirty:i}=Pe(),o=t==="edit",a=ao(e),c=oe(R=>R.relationalFormConfig),d=R=>c==null?void 0:c.find(F=>F.code===R),u=R=>!c||!!d(R),f=(R,F)=>{var M;return((M=d(R))==null?void 0:M.label)||F},[g,m]=p.useState(!0),b=((A=e.metadata)==null?void 0:A.relationalMetadata)??{},[h,y]=p.useState(b.name??e.name??""),[v,_]=p.useState(""),[S,w]=p.useState(Array.isArray(b.keywords)?b.keywords:Array.isArray(($=e.metadata)==null?void 0:$.keywords)?e.metadata.keywords:[]),[C,I]=p.useState(!!b.optional);p.useEffect(()=>{var F,M;const R=((F=e.metadata)==null?void 0:F.relationalMetadata)??{};y(R.name??e.name??""),w(Array.isArray(R.keywords)?R.keywords:Array.isArray((M=e.metadata)==null?void 0:M.keywords)?e.metadata.keywords:[]),I(!!R.optional)},[e.id]);const j=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},k=()=>{const R=v.trim();if(R&&!S.includes(R)){const F=[...S,R];w(F),s(e.id,{keywords:F}),i()}_("")},L=R=>{const F=S.filter(M=>M!==R);w(F),s(e.id,{keywords:F}),i()},N=R=>{I(R),s(e.id,{optional:R}),i()};return l.jsxs("div",{className:qe.container,children:[l.jsxs("div",{className:qe.panelHeader,children:[l.jsxs("div",{className:qe.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:qe.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:qe.panelCollapseBtn,onClick:()=>m(R=>!R),"aria-expanded":g,"aria-label":g?"Collapse metadata panel":"Expand metadata panel",title:g?"Collapse":"Expand",children:g?l.jsx(Bs,{size:15}):l.jsx(by,{size:15})})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:qe.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:qe.icon}),l.jsx("input",{type:"text",className:qe.nameInput,value:h,disabled:!o,onChange:R=>y(R.target.value),onBlur:j,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:qe.field,children:[l.jsx("div",{className:qe.fieldHeader,children:l.jsxs("label",{className:qe.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:qe.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:qe.chips,children:S.map(R=>l.jsxs("span",{className:qe.chip,children:[R,o&&l.jsx("button",{type:"button",className:qe.chipRemove,onClick:()=>L(R),children:"×"})]},R))}),o&&l.jsxs("div",{className:qe.keywordInput,children:[l.jsx("input",{type:"text",className:qe.input,value:v,placeholder:"Add keyword and press Enter",onChange:R=>_(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),k())}}),l.jsx("button",{type:"button",className:qe.addBtn,onClick:k,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:qe.field,children:[l.jsx("label",{className:qe.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:qe.radioGroup,children:[l.jsxs("label",{className:qe.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>N(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:qe.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>N(!1),disabled:!o}),"No"]})]})]})]}),n]})},uj="_iconBtn_vl14u_1",dj="_editable_vl14u_14",fj="_iconImg_vl14u_26",hj="_placeholder_vl14u_34",pj="_removeBtn_vl14u_41",ls={iconBtn:uj,editable:dj,iconImg:fj,placeholder:hj,removeBtn:pj},gj=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=Pe(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[ls.iconBtn,r?ls.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:ls.iconImg}):l.jsx("div",{className:ls.placeholder,children:l.jsx(tf,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:ls.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Ja,{size:11})})]}),n&&l.jsx(Gh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},mj="_leafContentLayout_1osey_1",yj="_container_1osey_17",vj="_emptyState_1osey_26",bj="_titleRow_1osey_36",_j="_nodeTitle_1osey_52",wj="_formArea_1osey_74",Sj="_contentListArea_1osey_78",xj="_dropZone_1osey_83",Cj="_reviewComment_1osey_90",Ej="_reviewCommentLabel_1osey_103",Oj="_reviewCommentText_1osey_109",qt={leafContentLayout:mj,container:yj,emptyState:vj,titleRow:bj,nodeTitle:_j,formArea:wj,contentListArea:Sj,dropZone:xj,reviewComment:Cj,reviewCommentLabel:Ej,reviewCommentText:Oj},Dj=["application/vnd.sunbird.questionset"],Ij=({editorMode:e,onToolbarEvent:t})=>{var A,$,R,F;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,d]=p.useState(!1),u=p.useRef(null),f=p.useRef(),{selectedNodeId:g,breadcrumb:m,activeNodeMeta:b,updateNode:h,treeData:y}=Pe(),v=oe(M=>{var Z,ae,ve,we;return((ae=(Z=M.editorConfig)==null?void 0:Z.context)==null?void 0:ae.contentId)??((we=(ve=M.editorConfig)==null?void 0:ve.context)==null?void 0:we.identifier)??""}),_=g?sp(y,g):null,S=!!_&&!_.parent,w=!!(_!=null&&_.isFolder),C=_&&Dj.includes(_.mimeType??""),I=_&&!_.isFolder&&!C&&!S,j=((A=_==null?void 0:_.metadata)==null?void 0:A.rejectComment)??(S?(R=($=y[0])==null?void 0:$.metadata)==null?void 0:R.rejectComment:void 0),k=p.useCallback(()=>{const M=u.current;if(!M||!g)return;const Z=M.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(g,{name:Z})},600)},[g,h]),L=p.useCallback(M=>{t({action:"onFormValueChange",data:M})},[t]),N=p.useCallback((M,Z)=>{i(Z),t({action:"onFormStatusChange",data:{isValid:M,nodeId:g}})},[t,g]);return _?C?l.jsx(La,{node:_,editorMode:e,type:"quml"}):I?l.jsxs("div",{className:qt.leafContentLayout,children:[l.jsx(La,{node:_,editorMode:e,type:"content"}),l.jsx(cj,{node:_,editorMode:e,onMoveClick:()=>a(_.identifier),reorderDialog:o?l.jsx(NN,{resourceId:o,resourceName:_.name,currentUnitId:_.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:qt.container,children:[l.jsx(oO,{crumbs:m}),j&&l.jsxs("div",{className:qt.reviewComment,role:"alert",children:[l.jsx("span",{className:qt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:qt.reviewCommentText,children:j})]}),l.jsxs("div",{className:qt.titleRow,children:[S&&g&&l.jsx(gj,{nodeId:g,value:String(_.appIcon??((F=_.metadata)==null?void 0:F.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:qt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:k,onBlur:k,"data-placeholder":"Untitled","aria-label":"Node title",children:_.name})]}),l.jsx(fO,{activeTab:r,onChange:M=>n(M),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:qt.formArea,children:l.jsx(UI,{nodeMetadata:b,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:L,onFormStatusChange:N},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:qt.contentListArea,children:l.jsx(wT,{editorMode:e})}),l.jsx(CT,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:qt.dropZone}),c&&l.jsx(zN,{contentId:v,onClose:()=>d(!1)})]}):l.jsx("div",{className:qt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function sp(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=sp(r.children,t);if(n)return n}}}const ip=Zi((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),Tj=20;function op(){var d;const e=oe(u=>u.editorConfig),t=Pe(u=>u.selectedNodeId),r=Pe(u=>u.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function u(f,g,m=0){var b;for(const h of f){if(h.id===g)return m;if((b=h.children)!=null&&b.length){const y=u(h.children,g,m+1);if(y>=0)return y}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...xu];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...xu]}function Nj(){const e=ip(),t=oe(f=>{var g,m;return((m=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:m.channel)??""}),r=op(),n=p.useRef(),s=p.useCallback(async(f="",g="all",m={},b=!0,h=!1)=>{var y,v,_,S,w;e.setLoading(!0);try{const C={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(y=m==null?void 0:m.board)!=null&&y.length&&(C.board=m.board),(v=m==null?void 0:m.medium)!=null&&v.length&&(C.medium=m.medium),(_=m==null?void 0:m.gradeLevel)!=null&&_.length&&(C.gradeLevel=m.gradeLevel),(S=m==null?void 0:m.subject)!=null&&S.length&&(C.subject=m.subject),(w=m==null?void 0:m.primaryCategory)!=null&&w.length&&(C.primaryCategory=m.primaryCategory);const I=b?0:e.offset,{content:j,count:k}=await ET({filters:C,query:f,limit:f?50:Tj,offset:I,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});b?e.setContent(j,k):e.appendContent(j,k)}catch(C){console.error("[useLibrary] load error:",C)}finally{e.setLoading(!1)}},[r,t]);p.useEffect(()=>{s()},[t]);const i=p.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=p.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=p.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=p.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),d=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const jj="_card_jzciw_1",Rj="_addBtn_jzciw_17",kj="_dragging_jzciw_24",Aj="_ctIcon_jzciw_29",Pj="_info_jzciw_33",Mj="_name_jzciw_41",Lj="_meta_jzciw_50",Fj="_addBtnMuted_jzciw_78",$j="_added_jzciw_87",Bj="_addedBadge_jzciw_96",nr={card:jj,addBtn:Rj,dragging:kj,ctIcon:Aj,info:Pj,name:Mj,meta:Lj,addBtnMuted:Fj,added:$j,addedBadge:Bj},Uj={video:el,pdf:Ga,h5p:Ya,scorm:Za,audio:Xa,quiz:Qa,default:Kn},zj=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=ao(e),o=Uj[i.key]??Kn,a=yl(),c=z1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:m}=Kd({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),b=()=>{r&&r(e)};return l.jsxs("div",{ref:g,className:[nr.card,m?nr.dragging:"",s?nr.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:b,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,nr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:nr.info,children:[l.jsx("span",{className:nr.name,title:e.name,children:e.name}),l.jsxs("span",{className:nr.meta,children:[((h=e.organisation)==null?void 0:h[0])??e.channel??"",(y=e.organisation)!=null&&y[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:nr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Wn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[nr.addBtn,!d&&a?nr.addBtnMuted:""].join(" "),onClick:v=>{v.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(Us,{size:14})})]})},Vj="_chips_xhhaq_1",qj="_chip_xhhaq_1",Wu={chips:Vj,chip:qj},Hj=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Wu.chips,role:"group","aria-label":"Content type filters",children:e.map(n=>l.jsx("button",{type:"button",role:"radio","aria-checked":t===n.value,className:["sbx-chip",t===n.value?"filled":"outline",Wu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),Wj="_panel_1cl11_1",Kj="_header_1cl11_10",Qj="_headerTitle_1cl11_19",Gj="_closeBtn_1cl11_25",Yj="_body_1cl11_43",Xj="_section_1cl11_59",Zj="_sectionLabel_1cl11_65",Jj="_chips_1cl11_73",eR="_chip_1cl11_73",tR="_active_1cl11_96",rR="_footer_1cl11_102",nR="_resetBtn_1cl11_112",sR="_applyBtn_1cl11_129",st={panel:Wj,header:Kj,headerTitle:Qj,closeBtn:Gj,body:Yj,section:Xj,sectionLabel:Zj,chips:Jj,chip:eR,active:tR,footer:rR,resetBtn:nR,applyBtn:sR},iR=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],oR=new Set(["board","medium","gradeLevel","subject","topic"]),aR=({local:e,toggle:t})=>{const r=op();return r.length?l.jsxs("div",{className:st.section,children:[l.jsx("div",{className:st.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:st.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[st.chip,(e.primaryCategory??[]).includes(n)?st.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},lR=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var h,y;const s=oe(v=>v.editorConfig),i=oe(v=>v.searchFormConfig),o=oe(v=>v.contentFramework),a=oe(v=>v.contentTargetFWIds),{organisationFramework:c}=qh(o??((h=s==null?void 0:s.context)==null?void 0:h.framework),a??((y=s==null?void 0:s.context)==null?void 0:y.targetFWIds)),[d,u]=p.useState(t),f=i!=null&&i.length?i.filter(v=>oR.has(v.code)).map(v=>({key:v.code,label:v.label||v.code})):iR;p.useEffect(()=>{u(t)},[t]);const g=(v,_)=>{u(S=>{const w=S[v]??[],C=w.includes(_)?w.filter(I=>I!==_):[...w,_];return{...S,[v]:C}})},m=(c==null?void 0:c.categories)??[],b=v=>{var _;return((_=m.find(S=>S.code===v))==null?void 0:_.terms)??[]};return e?l.jsxs("div",{className:st.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:st.header,children:[l.jsx("span",{className:st.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:st.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(un,{size:16})})]}),l.jsxs("div",{className:st.body,children:[f.map(({key:v,label:_})=>{const S=b(v);return S.length?l.jsxs("div",{className:st.section,children:[l.jsx("div",{className:st.sectionLabel,children:_}),l.jsx("div",{className:st.chips,children:S.slice(0,20).map(w=>l.jsx("button",{type:"button",className:[st.chip,(d[v]??[]).includes(w.name)?st.active:""].join(" "),onClick:()=>g(v,w.name),children:w.name},w.identifier))})]},v):null}),l.jsx(aR,{local:d,toggle:g})]}),l.jsxs("div",{className:st.footer,children:[l.jsx("button",{type:"button",className:st.resetBtn,onClick:()=>u({}),children:"Reset"}),l.jsx("button",{type:"button",className:st.applyBtn,onClick:()=>{r(d),n()},children:"Apply"})]})]}):null},cR="_header_6qdpu_10",uR="_title_6qdpu_20",dR="_headerActions_6qdpu_31",fR="_iconBtn_6qdpu_38",hR="_playerArea_6qdpu_56",pR="_footer_6qdpu_64",gR="_addBtn_6qdpu_73",mR="_modalOverlay_6qdpu_92",yR="_modalPanel_6qdpu_103",hr={header:cR,title:uR,headerActions:dR,iconBtn:fR,playerArea:hR,footer:pR,addBtn:gR,modalOverlay:mR,modalPanel:yR},vR=({content:e,onAdd:t,onClose:r})=>{if(!e)return null;const n={id:e.identifier,identifier:e.identifier,name:e.name??"",mimeType:e.mimeType,primaryCategory:e.primaryCategory,contentType:e.contentType,appIcon:e.appIcon,status:e.status,isFolder:!1,children:[],metadata:e};return Pr.createPortal(l.jsx("div",{className:hr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:hr.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:hr.header,children:[l.jsx("span",{className:hr.title,title:e.name,children:e.name}),l.jsx("div",{className:hr.headerActions,children:l.jsx("button",{type:"button",className:hr.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(un,{size:16})})})]}),l.jsx("div",{className:hr.playerArea,children:l.jsx(La,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:hr.footer,children:l.jsx("button",{type:"button",className:hr.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},bR="_dock_1lpg0_1",_R="_header_1lpg0_8",wR="_headerLeft_1lpg0_17",SR="_headerTitle_1lpg0_24",xR="_count_1lpg0_30",CR="_searchRow_1lpg0_39",ER="_searchWrap_1lpg0_47",OR="_searchIcon_1lpg0_53",DR="_searchInput_1lpg0_62",IR="_filterToggleBtn_1lpg0_80",TR="_filterToggleBtnActive_1lpg0_99",NR="_filterBadge_1lpg0_105",jR="_filters_1lpg0_124",RR="_mainArea_1lpg0_134",kR="_sidePanelOverlay_1lpg0_143",AR="_cardList_1lpg0_152",PR="_skeleton_1lpg0_168",MR="_skeletonIcon_1lpg0_178",LR="_skeletonText_1lpg0_186",FR="_skeletonLine_1lpg0_193",$R="_skeletonLineSm_1lpg0_200",BR="_loadMoreBtn_1lpg0_215",UR="_emptyState_1lpg0_240",zR="_collapseBtn_1lpg0_260",Fe={dock:bR,header:_R,headerLeft:wR,headerTitle:SR,count:xR,searchRow:CR,searchWrap:ER,searchIcon:OR,searchInput:DR,filterToggleBtn:IR,filterToggleBtnActive:TR,filterBadge:NR,filters:jR,mainArea:RR,sidePanelOverlay:kR,cardList:AR,skeleton:PR,skeletonIcon:MR,skeletonText:LR,skeletonLine:FR,skeletonLineSm:$R,loadMoreBtn:BR,emptyState:UR,collapseBtn:zR};function VR(e){const t=new Set,r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t.add(n.identifier),n.children&&r.push(...n.children)}return t}const qR=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:g,toggleSort:m,loadMore:b}=Nj(),{addResource:h,selectedNodeId:y,treeData:v}=Pe(),_=e==="edit",[S,w]=p.useState(!1),[C,I]=p.useState({}),[j,k]=p.useState(null),L=p.useMemo(()=>VR(v),[v]),N=p.useCallback(M=>{var ve;if(!y){Oe.error("Select a unit first");return}const Z=(ve=v[0])==null?void 0:ve.id;if(y===Z){Oe("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(h(M,y)===!1){Oe.error(`"${M.name}" is already in this collection`);return}Oe.success(`Added "${M.name}"`)},[y,h,v]),A=p.useCallback(M=>{I(M),g(M)},[g]),$=p.useCallback(M=>{k(M)},[]),R=p.useCallback(M=>{N(M),k(null)},[N]),F=p.useMemo(()=>Object.values(C).reduce((M,Z)=>M+((Z==null?void 0:Z.length)??0),0),[C]);return l.jsxs("div",{className:Fe.dock,children:[l.jsx("div",{className:Fe.header,children:l.jsxs("div",{className:Fe.headerLeft,children:[l.jsx("button",{type:"button",className:Fe.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(Iy,{size:15})}),l.jsx(Ey,{size:16}),l.jsx("span",{className:Fe.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Fe.count,children:i})]})}),l.jsxs("div",{className:Fe.searchRow,children:[l.jsxs("div",{className:Fe.searchWrap,children:[l.jsx(pa,{size:14,className:Fe.searchIcon}),l.jsx("input",{type:"search",className:Fe.searchInput,placeholder:"Search content…",value:a,onChange:M=>u(M.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Fe.filterToggleBtn,c?Fe.filterToggleBtnActive:""].join(" "),onClick:m,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(yy,{size:15}):l.jsx(_y,{size:15})}),l.jsxs("button",{type:"button",className:[Fe.filterToggleBtn,S?Fe.filterToggleBtnActive:""].join(" "),onClick:()=>w(M=>!M),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(Ay,{size:15}),F>0&&l.jsx("span",{className:Fe.filterBadge,children:F})]})]}),l.jsx("div",{className:Fe.filters,children:l.jsx(Hj,{filters:V1,active:o,onChange:f})}),l.jsxs("div",{className:Fe.mainArea,children:[l.jsx("div",{className:Fe.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((M,Z)=>l.jsxs("div",{className:Fe.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Fe.skeletonIcon}),l.jsxs("div",{className:Fe.skeletonText,children:[l.jsx("div",{className:Fe.skeletonLine}),l.jsx("div",{className:Fe.skeletonLineSm})]})]},Z)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(M=>l.jsx(zj,{item:M,onAdd:N,onPreview:$,isDraggable:_,isAdded:L.has(M.identifier)},M.identifier)),d&&l.jsx("button",{type:"button",className:Fe.loadMoreBtn,onClick:b,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Fe.emptyState,children:[l.jsx(pa,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:Fe.sidePanelOverlay,children:l.jsx(lR,{isOpen:S,filters:C,onApply:A,onClose:()=>w(!1)})}),j&&l.jsx(vR,{content:j,onAdd:R,onClose:()=>k(null)})]})]})};function HR(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(g,m=!1){const b={};for(const[h,y]of Object.entries(g))if(!i.has(h)&&!(m&&o.has(h)))if(a.has(h))Array.isArray(y)?b[h]=y:y!=null&&y!==""?b[h]=[y]:b[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(b[h]=v)}else b[h]=y;return b}function u(g){var b;const m={};for(const h of g.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,..._}=y;if(Object.keys(_).length===0)continue;const S=((b=h.metadata)==null?void 0:b.relationalMetadata)??{};m[h.identifier]={name:h.name,...S,..._}}return m}function f(g,m){var S,w;const b=g.identifier,h=t[b],y=b.startsWith("temp-")||!!(h!=null&&h.isNew),v=!g.isFolder&&!m;if(m||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:b,contentType:((S=g.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=g.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:g.name,visibility:"Parent",channel:r,...d(g.metadata??{})};else if(m){const{isNew:I,...j}=h??{};C={...d(g.metadata??{},!0),...d(j,!1),name:g.name}}else{const{isNew:I,...j}=h??{};C={name:g.name,visibility:"Parent",...d(j,!0)}}n[b]={metadata:C,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:m,isNew:y}}const _=g.isFolder?u(g):{};s[b]={name:g.name,children:(g.children??[]).map(C=>C.identifier),...Object.keys(_).length>0?{relationalMetadata:_}:{},root:m},(g.children??[]).forEach(C=>f(C,!1))}return e.forEach((g,m)=>f(g,m===0)),{nodesModified:n,hierarchy:s}}function WR(){const[e,t]=p.useState(!1),r=Pe(u=>u.treeCache),n=Pe(u=>u.treeData),s=oe(u=>u.isDirty),i=oe(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=oe(),c=oe(u=>u.editorConfig);return{save:p.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",g=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:m,hierarchy:b}=HR(n,r,f),{identifiers:h}=await y_(u,m,b,g);h&&Object.keys(h).length>0&&Pe.getState().replaceNodeIds(h);const y=new Date().toISOString();a(y),o(!1)}catch(m){console.error("[useSaveHierarchy] save failed:",m),Oe.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function KR(e){const t=oe(o=>o.editorConfig),r=oe(o=>o.setButtonLoader),n=oe(o=>o.validateAllForms),s=Pe(o=>o.treeData);return{runAction:p.useCallback(async(o,a)=>{var u,f,g,m;const c=((u=t==null?void 0:t.context)==null?void 0:u.contentId)??((f=t==null?void 0:t.context)==null?void 0:f.identifier)??"";if(!c)return Oe.error("No content identifier found."),!1;const d=((g=t==null?void 0:t.context)==null?void 0:g.userId)??((m=t==null?void 0:t.context)==null?void 0:m.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await __(c),Oe.success("Content sent for review"),!0):(Oe.error("Some units have missing required fields. Please fill them before sending for review."),!1);case"reject":{r("rejectCollection",!0);const b=(a==null?void 0:a.comment)??"";return await w_(c,b),Oe.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await v_(c,d),Oe.success("Content published successfully"),!0):(Oe.error("Some units have missing required fields. Please fill them before publishing."),!1);default:return!1}}catch(b){console.error(`[useToolbarActions] ${o} failed`,b);const h=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return Oe.error(`Failed to ${h}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const QR="_shell_90fon_1",GR="_workspace_90fon_8",YR="_sidebarCollapsed_90fon_16",XR="_dockCollapsed_90fon_19",ZR="_dock_90fon_19",JR="_outline_90fon_40",ek="_reopenTab_90fon_45",tk="_outlineHidden_90fon_79",rk="_editor_90fon_86",nk="_dockHidden_90fon_101",sk="_dockReopenTab_90fon_108",ik="_dragChip_90fon_133",ok="_dragChipLabel_90fon_148",jt={shell:QR,workspace:GR,sidebarCollapsed:YR,dockCollapsed:XR,dock:ZR,outline:JR,reopenTab:ek,outlineHidden:tk,editor:rk,dockHidden:nk,dockReopenTab:sk,dragChip:ik,dragChipLabel:ok},ak=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState(!1),[u,f]=p.useState(!1),{addResource:g,treeData:m}=Pe(),b=oe(R=>R.setFormStatus),[h,y]=p.useState(!0),v=Pe(R=>R.selectedNodeId),{save:_,isSaving:S,isDirty:w,lastSaved:C}=WR(),{runAction:I}=KR(_);p.useEffect(()=>{if(!w)return;const R=F=>{F.preventDefault(),F.returnValue=""};return window.addEventListener("beforeunload",R),()=>window.removeEventListener("beforeunload",R)},[w]);const j=Dd(ca(Gi,{activationConstraint:{distance:8}})),k=p.useCallback(R=>{var M;const F=(M=R.active.data.current)==null?void 0:M.item;F&&i(F)},[]),L=p.useCallback(R=>{var we,he;i(null);const F=(we=R.active.data.current)==null?void 0:we.item;if(!F)return;const M=R.over,Z=(M==null?void 0:M.id)??v??void 0;if(!Z){Oe.error("Drop onto a unit to add content");return}const ae=(he=m[0])==null?void 0:he.id;if(Z===ae){Oe.error("Drop content onto a unit, not directly on the course.");return}if(!g(F,Z)){Oe.error(`"${F.name}" is already in this collection`);return}r==null||r(F,Z),Oe.success(`Added "${F.name}" to unit`)},[v,g,r]),N=p.useCallback(async R=>{if(R.action==="onFormStatusChange"){const{isValid:F,nodeId:M}=R.data??{},Z=F!==!1;y(Z),M&&b(M,Z);return}if(R.action==="back"&&w){f(!0);return}if(R.action==="saveCollection"){if(!h){Oe.error("Please fill the required metadata");return}await _(),n==null||n(m),t==null||t(R);return}if(R.action==="sendForReview"||R.action==="reject"||R.action==="publish"){await I(R.action,R.data)&&(t==null||t(R));return}t==null||t(R)},[_,I,t,n,m,w,h]),A=p.useCallback(async()=>{await _(),f(!1),n==null||n(m),t==null||t({action:"back"})},[_,n,t,m]),$=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Wd,{sensors:j,onDragStart:k,onDragEnd:L,children:[l.jsxs("div",{className:jt.shell,children:[l.jsx(Tw,{editorMode:e,isSaving:S,isDirty:w,lastSaved:C,isFormValid:h,onToolbarEvent:N}),l.jsxs("div",{className:[jt.workspace,o?jt.sidebarCollapsed:"",c?jt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[jt.outline,o?jt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(tO,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(R=>!R)})}),o&&l.jsx("button",{className:jt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:jt.editor,role:"main","aria-label":"Content editor",children:l.jsx(Ij,{editorMode:e,onToolbarEvent:N})}),l.jsx("aside",{className:[jt.dock,c?jt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(qR,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(R=>!R)})}),c&&l.jsx("button",{className:jt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(fy,{dropAnimation:null,children:s?l.jsx("div",{className:jt.dragChip,children:l.jsx("span",{className:jt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(Nw,{onSave:A,onDiscard:$,onCancel:()=>f(!1),isSaving:S})]})},lk="v1";function ck(e){const t=e.validations,r=t==null?void 0:t.find(s=>s.type==="maxlength"||s.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function Ku(e,t){var r;return{code:e.code??"",label:e.label??e.name??e.code??"",name:e.name,inputType:e.inputType,dataType:e.dataType,required:e.required===!0||Array.isArray(e.validations)&&e.validations.some(n=>n.type==="required")||String(((r=e.renderingHints)==null?void 0:r.class)??"").includes("required"),editable:e.editable!==!1,visible:e.visible!==!1,placeholder:e.placeholder,maxLength:ck(e),depends:e.depends,sourceCategory:e.sourceCategory,range:e.range,enum:e.enum,default:e.default,defaultValue:e.defaultValue,index:e.index,section:t,output:e.output}}function Sr(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.name??void 0,i=n.fields.filter(o=>!!o.code).sort((o,a)=>(o.index??0)-(a.index??0));for(const o of i)r.push(Ku(o,s))}else n.code&&r.push(Ku(n));return r}function uk(e){const t=e==null?void 0:e.properties;if(!t)return{};const r={};for(const[n,s]of Object.entries(t))s&&"default"in s&&(r[n]=s.default);return r}async function dk(e,t,r="Collection",n=lk){var d,u;const i=(u=(d=(await je.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:Sr(o.create),unitForm:Sr(o.unitMetadata),childForm:Sr(o.childMetadata),searchForm:Sr(o.search??o.searchConfig),relationalForm:Sr(o.relationalMetadata),publishChecklist:Sr(o.publishchecklist),reviewChecklist:Sr(o.review),rfcChecklist:Sr(o.requestforchangeschecklist),schemaDefaults:uk(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function fk({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u,setContentFramework:f}=oe(),{setTreeData:g,selectNode:m}=Pe();return p.useEffect(()=>{let b=!1;async function h(){var y,v;try{n(!0),i(null),e.apiBaseUrl&&Af(e.apiBaseUrl),c(e),d(e.config.mode);const _=e.context.contentId??e.context.identifier??"";if(_){const{rootNode:S}=await Lf(_);if(!b&&(g(S?[S]:[]),S)){m(S.id);const k=S.metadata??{},L=k.framework??e.context.framework??null,N=k.targetFWIds??e.context.targetFWIds??null;f(L,N)}const w=e.config.primaryCategory??"Course",C=e.context.channel??"",I=e.config.categoryDefinitionApiVersion??"v1";try{const j=await dk(w,C,e.config.objectType??"Collection",I);if(!b){u(j);const k=((y=j.sourcingSettings)==null?void 0:y.collection)??{},L={};k.maxDepth&&!e.config.maxDepth&&(L.maxDepth=k.maxDepth),k.children&&!e.config.children&&(L.children=k.children),k.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(L.hierarchy={...e.config.hierarchy??{},...k.hierarchy}),Object.keys(L).length>0&&c({...e,config:{...e.config,...L}})}}catch{}}b||a(!0)}catch(_){if(!b){const S=_ instanceof Error?_:new Error(String(_));i(S),t==null||t(S)}}finally{b||n(!1)}}return h(),()=>{b=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const hk="_root_qcpw6_1",pk="_loadingState_qcpw6_10",gk="_loadingSpinner_qcpw6_20",mk="_errorState_qcpw6_34",fs={root:hk,loadingState:pk,loadingSpinner:gk,errorState:mk},yk=new Mp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class vk extends p.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?l.jsxs("div",{className:fs.errorState,children:[l.jsx("h3",{children:"Something went wrong"}),l.jsx("p",{children:this.state.error.message}),l.jsx("button",{onClick:()=>this.setState({error:null}),children:"Retry"})]}):this.props.children}}function bk(e){const{isLoading:t,error:r}=fk({config:e,onError:e.onError}),n=oe(s=>s.editorMode);return t?l.jsxs("div",{className:fs.loadingState,children:[l.jsx("div",{className:fs.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:fs.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${fs.root}`,children:l.jsx(ak,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const ap=e=>l.jsx(vk,{onError:e.onError,children:l.jsxs(Fp,{client:yk,children:[l.jsx(bk,{...e}),l.jsx(Lg,{position:"top-right",toastOptions:{duration:3e3}})]})}),zi=Symbol.for("r2wc.reactRender"),Qu=Symbol.for("r2wc.shouldRender"),ai=Symbol.for("r2wc.root");function _k(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function wk(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Gu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[zi]()}}),e[zi]()}};function Sk(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,g){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Gu.expando(g,u,f),Reflect.set(d,u,f,g)):(Gu.expando(g,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Qu]=!0,this[zi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ai].unmount():r.unmountComponentAtNode(this)},a[zi]=function(){if(this[Qu]===!0){var d={};Object.keys(this).forEach(function(g){s[g]!==!1&&(d[g]=this[g])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[ai]||(this[ai]=r.createRoot(u)),this[ai].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return _k(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?wk(d):d;this[g]=f}),o}var hs={},cs=Pr;if(process.env.NODE_ENV==="production")hs.createRoot=cs.createRoot,hs.hydrateRoot=cs.hydrateRoot;else{var li=cs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;hs.createRoot=function(e,t){li.usingClientEntryPoint=!0;try{return cs.createRoot(e,t)}finally{li.usingClientEntryPoint=!1}},hs.hydrateRoot=function(e,t,r){li.usingClientEntryPoint=!0;try{return cs.hydrateRoot(e,t,r)}finally{li.usingClientEntryPoint=!1}}}function xk(){if(document.getElementById("sb-ce-react-styles"))return;const e=document.createElement("style");e.id="sb-ce-react-styles",e.textContent="@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');",document.head.insertBefore(e,document.head.firstChild)}function Ck(e="sb-collection-editor"){if(xk(),typeof customElements>"u"||customElements.get(e))return;const t=Sk(ap,p,hs,{});customElements.define(e,t)}exports.CollectionEditor=ap;exports.registerCollectionEditor=Ck;exports.setApiBaseUrl=Af;exports.useEditorStore=oe;exports.useLibraryStore=ip;exports.useTreeStore=Pe;