@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.
@@ -1,4 +1,4 @@
1
- (function(we,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react"),require("react-dom"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","react/jsx-runtime"],h):(we=typeof globalThis<"u"?globalThis:we||self,h(we.CollectionEditorReact={},we.React,we.ReactDOM,we.jsxRuntime))})(this,function(we,h,qe,l){"use strict";var Yh=we=>{throw TypeError(we)};var gl=(we,h,qe)=>h.has(we)||Yh("Cannot "+qe);var E=(we,h,qe)=>(gl(we,h,"read from private field"),qe?qe.call(we):h.get(we)),ne=(we,h,qe)=>h.has(we)?Yh("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(we):h.set(we,qe),Y=(we,h,qe,l)=>(gl(we,h,"write to private field"),l?l.call(we,qe):h.set(we,qe),qe),_e=(we,h,qe)=>(gl(we,h,"access private method"),qe);var ao=(we,h,qe,l)=>({set _(lo){Y(we,h,lo,qe)},get _(){return E(we,h,l)}});var Jr,Nr,Ln,Bh,sr,en,Uh,Fn,kr,$n,zh,tn,Vh,jn,rn,Bn,Vt,nn,it,Fs,sn,Lt,Rh,mr,qh,Tt,Ce,$s,St,on,Un,fr,xr,js,zn,Vn,an,ln,Ar,qn,Ne,Ws,yl,vl,ml,bl,_l,wl,Sl,Xh,Hh,Bs,ir,bt,cn,or,jr,Wh,hr,Xt,Us,Kh,ar,Qh,Ye,Pr,Mr,Hn,Wn,Lr,Kn,Qn,Gh;function lo(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 Te=lo(h);var Rn=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(){}},ep=(Bh=class extends Rn{constructor(){super();ne(this,Jr);ne(this,Nr);ne(this,Ln);Y(this,Ln,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Nr)||this.setEventListener(E(this,Ln))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Nr))==null||t.call(this),Y(this,Nr,void 0))}setEventListener(t){var r;Y(this,Ln,t),(r=E(this,Nr))==null||r.call(this),Y(this,Nr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Jr)!==t&&(Y(this,Jr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,Jr)=="boolean"?E(this,Jr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Jr=new WeakMap,Nr=new WeakMap,Ln=new WeakMap,Bh),co=new ep,tp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rp=(Uh=class{constructor(){ne(this,sr,tp);ne(this,en,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,en)&&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}),Y(this,sr,e),process.env.NODE_ENV!=="production"&&Y(this,en,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,en,!0),E(this,sr).setTimeout(e,t)}clearTimeout(e){E(this,sr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,en,!0),E(this,sr).setInterval(e,t)}clearInterval(e){E(this,sr).clearInterval(e)}},sr=new WeakMap,en=new WeakMap,Uh),Br=new rp;function np(e){setTimeout(e,0)}var sp=typeof window>"u"||"Deno"in globalThis;function Ot(){}function ip(e,t){return typeof e=="function"?e(t):e}function uo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Cl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function br(e,t){return typeof e=="function"?e(t):e}function xt(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!==fo(o,t.options))return!1}else if(!Zn(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 El(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Xn(t.options.mutationKey)!==Xn(i))return!1}else if(!Zn(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function fo(e,t){return((t==null?void 0:t.queryKeyHashFn)||Xn)(e)}function Xn(e){return JSON.stringify(e,(t,r)=>go(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Zn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Zn(e[r],t[r])):!1}var op=Object.prototype.hasOwnProperty;function ho(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Dl(e)&&Dl(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],y=t[f];if(g===y){c[f]=g,(n?u<i:op.call(e,f))&&d++;continue}if(g===null||y===null||typeof g!="object"||typeof y!="object"){c[f]=y;continue}const b=ho(g,y,r+1);c[f]=b,b===g&&d++}return i===a&&d===i?e:c}function po(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 Dl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function go(e){if(!Il(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Il(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Il(e){return Object.prototype.toString.call(e)==="[object Object]"}function ap(e){return new Promise(t=>{Br.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 ho(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 ho(e,t)}return t}function lp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function cp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ks=Symbol();function Tl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ks&&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===Ks?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Nl(e,t){return typeof e=="function"?e(...t):!!e}function up(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 Jn=(()=>{let e=()=>sp;return{isServer(){return e()},setIsServer(t){e=t}}})();function vo(){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 dp=np;function fp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=dp;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 at=fp(),hp=(zh=class extends Rn{constructor(){super();ne(this,Fn,!0);ne(this,kr);ne(this,$n);Y(this,$n,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,kr)||this.setEventListener(E(this,$n))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,kr))==null||t.call(this),Y(this,kr,void 0))}setEventListener(t){var r;Y(this,$n,t),(r=E(this,kr))==null||r.call(this),Y(this,kr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Fn)!==t&&(Y(this,Fn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Fn)}},Fn=new WeakMap,kr=new WeakMap,$n=new WeakMap,zh),Qs=new hp;function pp(e){return Math.min(1e3*2**e,3e4)}function kl(e){return(e??"online")==="online"?Qs.isOnline():!0}var mo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function xl(e){let t=!1,r=0,n;const s=vo(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new mo(p);g(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>co.isFocused()&&(e.networkMode==="always"||Qs.isOnline())&&e.canRun(),u=()=>kl(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},g=p=>{i()||(n==null||n(),s.reject(p))},y=()=>new Promise(p=>{var v;n=m=>{(i()||d())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),b=()=>{if(i())return;let p;const v=r===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(f).catch(m=>{var T;if(i())return;const _=e.retry??(Jn.isServer()?0:3),S=e.retryDelay??pp,w=typeof S=="function"?S(r,m):S,O=_===!0||typeof _=="number"&&r<_||typeof _=="function"&&_(r,m);if(t||!O){g(m);return}r++,(T=e.onFail)==null||T.call(e,r,m),ap(w).then(()=>d()?void 0:y()).then(()=>{t?g(m):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?b():y().then(b),s)}}var Al=(Vh=class{constructor(){ne(this,tn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),uo(this.gcTime)&&Y(this,tn,Br.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Jn.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,tn)!==void 0&&(Br.clearTimeout(E(this,tn)),Y(this,tn,void 0))}},tn=new WeakMap,Vh);function gp(e){return{onFetch:(t,r)=>{var u,f,g,y,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=((y=t.state.data)==null?void 0:y.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const v=S=>{up(S,()=>t.signal,()=>p=!0)},m=Tl(t.options,t.fetchOptions),_=async(S,w,O)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const x=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:w,direction:O?"backward":"forward",meta:t.options.meta};return v(M),M})(),P=await m(x),{maxPages:$}=t.options,k=O?cp:lp;return{pages:k(S.pages,P,$),pageParams:k(S.pageParams,w,$)}};if(s&&i.length){const S=s==="backward",w=S?yp:Pl,O={pages:i,pageParams:o},T=w(n,O);a=await _(O,T,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Pl(n,a);if(c>0&&w==null)break;a=await _(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var p,v;return(v=(p=t.options).persister)==null?void 0:v.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Pl(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 yp(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 vp=(qh=class extends Al{constructor(t){super();ne(this,Lt);ne(this,jn);ne(this,rn);ne(this,Bn);ne(this,Vt);ne(this,nn);ne(this,it);ne(this,Fs);ne(this,sn);Y(this,sn,!1),Y(this,Fs,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,nn,t.client),Y(this,Vt,E(this,nn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,rn,Fl(this.options)),this.state=t.state??E(this,rn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,jn)}get promise(){var t;return(t=E(this,it))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Fs),...t},t!=null&&t._type&&Y(this,jn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Fl(this.options);r.data!==void 0&&(this.setState(Ll(r.data,r.dataUpdatedAt)),Y(this,rn,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,Vt).remove(this)}setData(t,r){const n=yo(this.state.data,t,this.options);return _e(this,Lt,mr).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,Lt,mr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,it))==null?void 0:n.promise;return(s=E(this,it))==null||s.cancel(t),r?r.then(Ot).catch(Ot):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,rn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>xt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ks||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>br(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:!Cl(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,it))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,it))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,Vt).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,it)&&(E(this,sn)||_e(this,Lt,Rh).call(this)?E(this,it).cancel({revert:!0}):E(this,it).cancelRetry()),this.scheduleGc()),E(this,Vt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Lt,mr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,g,y,b,p,v,m,_,S;if(this.state.fetchStatus!=="idle"&&((d=E(this,it))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,it))return E(this,it).continueRetry(),E(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(O=>O.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:()=>(Y(this,sn,!0),n.signal)})},i=()=>{const w=Tl(this.options,r),T=(()=>{const x={client:E(this,nn),queryKey:this.queryKey,meta:this.meta};return s(x),x})();return Y(this,sn,!1),this.options.persister?this.options.persister(w,T,this):w(T)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,nn),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,jn)==="infinite"?gp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),Y(this,Bn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&_e(this,Lt,mr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,it,xl({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof mo&&w.revert&&this.setState({...E(this,Bn),fetchStatus:"idle"}),n.abort()},onFail:(w,O)=>{_e(this,Lt,mr).call(this,{type:"failed",failureCount:w,error:O})},onPause:()=>{_e(this,Lt,mr).call(this,{type:"pause"})},onContinue:()=>{_e(this,Lt,mr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,it).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),(y=(g=E(this,Vt).config).onSuccess)==null||y.call(g,w,this),(p=(b=E(this,Vt).config).onSettled)==null||p.call(b,w,this.state.error,this),w}catch(w){if(w instanceof mo){if(w.silent)return E(this,it).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw _e(this,Lt,mr).call(this,{type:"error",error:w}),(m=(v=E(this,Vt).config).onError)==null||m.call(v,w,this),(S=(_=E(this,Vt).config).onSettled)==null||S.call(_,this.state.data,w,this),w}finally{this.scheduleGc()}}},jn=new WeakMap,rn=new WeakMap,Bn=new WeakMap,Vt=new WeakMap,nn=new WeakMap,it=new WeakMap,Fs=new WeakMap,sn=new WeakMap,Lt=new WeakSet,Rh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},mr=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,...Ml(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Ll(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Bn,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),at.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,Vt).notify({query:this,type:"updated",action:t})})},qh);function Ml(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:kl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Ll(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Fl(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 mp=(Hh=class extends Rn{constructor(t,r){super();ne(this,Ne);ne(this,Tt);ne(this,Ce);ne(this,$s);ne(this,St);ne(this,on);ne(this,Un);ne(this,fr);ne(this,xr);ne(this,js);ne(this,zn);ne(this,Vn);ne(this,an);ne(this,ln);ne(this,Ar);ne(this,qn,new Set);this.options=r,Y(this,Tt,t),Y(this,xr,null),Y(this,fr,vo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,Ce).addObserver(this),$l(E(this,Ce),this.options)?_e(this,Ne,Ws).call(this):this.updateResult(),_e(this,Ne,bl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bo(E(this,Ce),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bo(E(this,Ce),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Ne,_l).call(this),_e(this,Ne,wl).call(this),E(this,Ce).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,Ce);if(this.options=E(this,Tt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xt(this.options.enabled,E(this,Ce))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Ne,Sl).call(this),E(this,Ce).setOptions(this.options),r._defaulted&&!po(this.options,r)&&E(this,Tt).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,Ce),observer:this});const s=this.hasListeners();s&&jl(E(this,Ce),n,this.options,r)&&_e(this,Ne,Ws).call(this),this.updateResult(),s&&(E(this,Ce)!==n||xt(this.options.enabled,E(this,Ce))!==xt(r.enabled,E(this,Ce))||br(this.options.staleTime,E(this,Ce))!==br(r.staleTime,E(this,Ce)))&&_e(this,Ne,yl).call(this);const i=_e(this,Ne,vl).call(this);s&&(E(this,Ce)!==n||xt(this.options.enabled,E(this,Ce))!==xt(r.enabled,E(this,Ce))||i!==E(this,Ar))&&_e(this,Ne,ml).call(this,i)}getOptimisticResult(t){const r=E(this,Tt).getQueryCache().build(E(this,Tt),t),n=this.createResult(r,t);return _p(this,n)&&(Y(this,St,n),Y(this,Un,this.options),Y(this,on,E(this,Ce).state)),n}getCurrentResult(){return E(this,St)}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,fr).status==="pending"&&E(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,qn).add(t)}getCurrentQuery(){return E(this,Ce)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,Tt).defaultQueryOptions(t),n=E(this,Tt).getQueryCache().build(E(this,Tt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return _e(this,Ne,Ws).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,St)))}createResult(t,r){var $;const n=E(this,Ce),s=this.options,i=E(this,St),o=E(this,on),a=E(this,Un),d=t!==n?t.state:E(this,$s),{state:u}=t;let f={...u},g=!1,y;if(r._optimisticResults){const k=this.hasListeners(),M=!k&&$l(t,r),B=k&&jl(t,n,r,s);(M||B)&&(f={...f,...Ml(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:p,status:v}=f;y=f.data;let m=!1;if(r.placeholderData!==void 0&&y===void 0&&v==="pending"){let k;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(k=i.data,m=!0):k=typeof r.placeholderData=="function"?r.placeholderData(($=E(this,Vn))==null?void 0:$.state.data,E(this,Vn)):r.placeholderData,k!==void 0&&(v="success",y=yo(i==null?void 0:i.data,k,r),g=!0)}if(r.select&&y!==void 0&&!m)if(i&&y===(o==null?void 0:o.data)&&r.select===E(this,js))y=E(this,zn);else try{Y(this,js,r.select),y=r.select(y),y=yo(i==null?void 0:i.data,y,r),Y(this,zn,y),Y(this,xr,null)}catch(k){Y(this,xr,k)}E(this,xr)&&(b=E(this,xr),y=E(this,zn),p=Date.now(),v="error");const _=f.fetchStatus==="fetching",S=v==="pending",w=v==="error",O=S&&_,T=y!==void 0,P={status:v,fetchStatus:f.fetchStatus,isPending:S,isSuccess:v==="success",isError:w,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:p,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&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&T,isStale:_o(t,r),refetch:this.refetch,promise:E(this,fr),isEnabled:xt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=P.data!==void 0,M=P.status==="error"&&!k,B=F=>{M?F.reject(P.error):k&&F.resolve(P.data)},A=()=>{const F=Y(this,fr,P.promise=vo());B(F)},j=E(this,fr);switch(j.status){case"pending":t.queryHash===n.queryHash&&B(j);break;case"fulfilled":(M||P.data!==j.value)&&A();break;case"rejected":(!M||P.error!==j.reason)&&A();break}}return P}updateResult(){const t=E(this,St),r=this.createResult(E(this,Ce),this.options);if(Y(this,on,E(this,Ce).state),Y(this,Un,this.options),E(this,on).data!==void 0&&Y(this,Vn,E(this,Ce)),po(r,t))return;Y(this,St,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,qn).size)return!0;const o=new Set(i??E(this,qn));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,St)).some(a=>{const c=a;return E(this,St)[c]!==t[c]&&o.has(c)})};_e(this,Ne,Xh).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Ne,bl).call(this)}},Tt=new WeakMap,Ce=new WeakMap,$s=new WeakMap,St=new WeakMap,on=new WeakMap,Un=new WeakMap,fr=new WeakMap,xr=new WeakMap,js=new WeakMap,zn=new WeakMap,Vn=new WeakMap,an=new WeakMap,ln=new WeakMap,Ar=new WeakMap,qn=new WeakMap,Ne=new WeakSet,Ws=function(t){_e(this,Ne,Sl).call(this);let r=E(this,Ce).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ot)),r},yl=function(){_e(this,Ne,_l).call(this);const t=br(this.options.staleTime,E(this,Ce));if(Jn.isServer()||E(this,St).isStale||!uo(t))return;const n=Cl(E(this,St).dataUpdatedAt,t)+1;Y(this,an,Br.setTimeout(()=>{E(this,St).isStale||this.updateResult()},n))},vl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,Ce)):this.options.refetchInterval)??!1},ml=function(t){_e(this,Ne,wl).call(this),Y(this,Ar,t),!(Jn.isServer()||xt(this.options.enabled,E(this,Ce))===!1||!uo(E(this,Ar))||E(this,Ar)===0)&&Y(this,ln,Br.setInterval(()=>{(this.options.refetchIntervalInBackground||co.isFocused())&&_e(this,Ne,Ws).call(this)},E(this,Ar)))},bl=function(){_e(this,Ne,yl).call(this),_e(this,Ne,ml).call(this,_e(this,Ne,vl).call(this))},_l=function(){E(this,an)!==void 0&&(Br.clearTimeout(E(this,an)),Y(this,an,void 0))},wl=function(){E(this,ln)!==void 0&&(Br.clearInterval(E(this,ln)),Y(this,ln,void 0))},Sl=function(){const t=E(this,Tt).getQueryCache().build(E(this,Tt),this.options);if(t===E(this,Ce))return;const r=E(this,Ce);Y(this,Ce,t),Y(this,$s,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Xh=function(t){at.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,St))}),E(this,Tt).getQueryCache().notify({query:E(this,Ce),type:"observerResultsUpdated"})})},Hh);function bp(e,t){return xt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&xt(t.retryOnMount,e)===!1)}function $l(e,t){return bp(e,t)||e.state.data!==void 0&&bo(e,t,t.refetchOnMount)}function bo(e,t,r){if(xt(t.enabled,e)!==!1&&br(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&_o(e,t)}return!1}function jl(e,t,r,n){return(e!==t||xt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&_o(e,r)}function _o(e,t){return xt(t.enabled,e)!==!1&&e.isStaleByTime(br(t.staleTime,e))}function _p(e,t){return!po(e.getCurrentResult(),t)}var wp=(Wh=class extends Al{constructor(t){super();ne(this,or);ne(this,Bs);ne(this,ir);ne(this,bt);ne(this,cn);Y(this,Bs,t.client),this.mutationId=t.mutationId,Y(this,bt,t.mutationCache),Y(this,ir,[]),this.state=t.state||Sp(),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,bt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,ir,E(this,ir).filter(r=>r!==t)),this.scheduleGc(),E(this,bt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,ir).length||(this.state.status==="pending"?this.scheduleGc():E(this,bt).remove(this))}continue(){var t;return((t=E(this,cn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,g,y,b,p,v,m,_,S,w,O,T,x;const r=()=>{_e(this,or,jr).call(this,{type:"continue"})},n={client:E(this,Bs),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,cn,xl({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(P,$)=>{_e(this,or,jr).call(this,{type:"failed",failureCount:P,error:$})},onPause:()=>{_e(this,or,jr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,bt).canRun(this)}));const s=this.state.status==="pending",i=!E(this,cn).canStart();try{if(s)r();else{_e(this,or,jr).call(this,{type:"pending",variables:t,isPaused:i}),E(this,bt).config.onMutate&&await E(this,bt).config.onMutate(t,this,n);const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));$!==this.state.context&&_e(this,or,jr).call(this,{type:"pending",context:$,variables:t,isPaused:i})}const P=await E(this,cn).start();return await((d=(c=E(this,bt).config).onSuccess)==null?void 0:d.call(c,P,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,P,t,this.state.context,n)),await((y=(g=E(this,bt).config).onSettled)==null?void 0:y.call(g,P,null,this.state.variables,this.state.context,this,n)),await((p=(b=this.options).onSettled)==null?void 0:p.call(b,P,null,t,this.state.context,n)),_e(this,or,jr).call(this,{type:"success",data:P}),P}catch(P){try{await((m=(v=E(this,bt).config).onError)==null?void 0:m.call(v,P,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((S=(_=this.options).onError)==null?void 0:S.call(_,P,t,this.state.context,n))}catch($){Promise.reject($)}try{await((O=(w=E(this,bt).config).onSettled)==null?void 0:O.call(w,void 0,P,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((x=(T=this.options).onSettled)==null?void 0:x.call(T,void 0,P,t,this.state.context,n))}catch($){Promise.reject($)}throw _e(this,or,jr).call(this,{type:"error",error:P}),P}finally{E(this,bt).runNext(this)}}},Bs=new WeakMap,ir=new WeakMap,bt=new WeakMap,cn=new WeakMap,or=new WeakSet,jr=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),at.batch(()=>{E(this,ir).forEach(n=>{n.onMutationUpdate(t)}),E(this,bt).notify({mutation:this,type:"updated",action:t})})},Wh);function Sp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Cp=(Kh=class extends Rn{constructor(t={}){super();ne(this,hr);ne(this,Xt);ne(this,Us);this.config=t,Y(this,hr,new Set),Y(this,Xt,new Map),Y(this,Us,0)}build(t,r,n){const s=new wp({client:t,mutationCache:this,mutationId:++ao(this,Us)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,hr).add(t);const r=Gs(t);if(typeof r=="string"){const n=E(this,Xt).get(r);n?n.push(t):E(this,Xt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,hr).delete(t)){const r=Gs(t);if(typeof r=="string"){const n=E(this,Xt).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,Xt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Gs(t);if(typeof r=="string"){const n=E(this,Xt).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,Xt).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(){at.batch(()=>{E(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,hr).clear(),E(this,Xt).clear()})}getAll(){return Array.from(E(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>El(r,n))}findAll(t={}){return this.getAll().filter(r=>El(t,r))}notify(t){at.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return at.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ot))))}},hr=new WeakMap,Xt=new WeakMap,Us=new WeakMap,Kh);function Gs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Op=(Qh=class extends Rn{constructor(t={}){super();ne(this,ar);this.config=t,Y(this,ar,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??fo(s,r);let o=this.get(i);return o||(o=new vp({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(){at.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){at.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){at.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){at.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ar=new WeakMap,Qh),Ep=(Gh=class{constructor(e={}){ne(this,Ye);ne(this,Pr);ne(this,Mr);ne(this,Hn);ne(this,Wn);ne(this,Lr);ne(this,Kn);ne(this,Qn);Y(this,Ye,e.queryCache||new Op),Y(this,Pr,e.mutationCache||new Cp),Y(this,Mr,e.defaultOptions||{}),Y(this,Hn,new Map),Y(this,Wn,new Map),Y(this,Lr,0)}mount(){ao(this,Lr)._++,E(this,Lr)===1&&(Y(this,Kn,co.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ye).onFocus())})),Y(this,Qn,Qs.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ye).onOnline())})))}unmount(){var e,t;ao(this,Lr)._--,E(this,Lr)===0&&((e=E(this,Kn))==null||e.call(this),Y(this,Kn,void 0),(t=E(this,Qn))==null||t.call(this),Y(this,Qn,void 0))}isFetching(e){return E(this,Ye).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Pr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,Ye).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,Ye).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(br(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,Ye).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,Ye).get(n.queryHash),i=s==null?void 0:s.state.data,o=ip(t,i);if(o!==void 0)return E(this,Ye).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return at.batch(()=>E(this,Ye).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,Ye).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,Ye);at.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,Ye);return at.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=at.batch(()=>E(this,Ye).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ot).catch(Ot)}invalidateQueries(e,t={}){return at.batch(()=>(E(this,Ye).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=at.batch(()=>E(this,Ye).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ot)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Ot)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,Ye).build(this,t);return r.isStaleByTime(br(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ot).catch(Ot)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ot).catch(Ot)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Qs.isOnline()?E(this,Pr).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Ye)}getMutationCache(){return E(this,Pr)}getDefaultOptions(){return E(this,Mr)}setDefaultOptions(e){Y(this,Mr,e)}setQueryDefaults(e,t){E(this,Hn).set(Xn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,Hn).values()],r={};return t.forEach(n=>{Zn(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,Wn).set(Xn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Wn).values()],r={};return t.forEach(n=>{Zn(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Mr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fo(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===Ks&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Mr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Ye).clear(),E(this,Pr).clear()}},Ye=new WeakMap,Pr=new WeakMap,Mr=new WeakMap,Hn=new WeakMap,Wn=new WeakMap,Lr=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Gh),Bl=Te.createContext(void 0),Dp=e=>{const t=Te.useContext(Bl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ip=({client:e,children:t})=>(Te.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Bl.Provider,{value:e,children:t})),Ul=Te.createContext(!1),Tp=()=>Te.useContext(Ul);Ul.Provider;function Np(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var kp=Te.createContext(Np()),xp=()=>Te.useContext(kp),Ap=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Nl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Pp=e=>{Te.useEffect(()=>{e.clearReset()},[e])},Mp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Nl(r,[e.error,n])),Lp=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))}},Fp=(e,t)=>e.isLoading&&e.isFetching&&!t,$p=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,zl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function jp(e,t,r){var y,b,p,v;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=Tp(),s=xp(),i=Dp(),o=i.defaultQueryOptions(e);(b=(y=i.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,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,Lp(o),Ap(o,s,a),Pp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Te.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Te.useSyncExternalStore(Te.useCallback(m=>{const _=g?u.subscribe(at.batchCalls(m)):Ot;return u.updateResult(),_},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Te.useEffect(()=>{u.setOptions(o)},[o,u]),$p(o,f))throw zl(o,u,s);if(Mp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((v=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||v.call(p,o,f),o.experimental_prefetchInRender&&!Jn.isServer()&&Fp(f,n)){const m=d?zl(o,u,s):a==null?void 0:a.promise;m==null||m.catch(Ot).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Ys(e,t){return jp(e,mp)}let Bp={data:""},Up=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||Bp},zp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Vp=/\/\*[^]*?\*\/| +/g,Vl=/\n+/g,_r=(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"?_r(o,i):i+"{"+_r(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=_r(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+=_r.p?_r.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},wr={},ql=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+ql(e[r]);return t}return e},qp=(e,t,r,n,s)=>{let i=ql(e),o=wr[i]||(wr[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!wr[o]){let c=i!==e?e:(d=>{let u,f,g=[{}];for(;u=zp.exec(d.replace(Vp,""));)u[4]?g.shift():u[3]?(f=u[3].replace(Vl," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Vl," ").trim();return g[0]})(e);wr[o]=_r(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&wr.g;return r&&(wr.g=wr[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)})(wr[o],t,n,a),o},Hp=(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?"":_r(a,""):a===!1?"":a}return n+s+(o??"")},"");function Rs(e){let t=this||{},r=e.call?e(t.p):e;return qp(r.unshift?r.raw?Hp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Up(t.target),t.g,t.o,t.k)}let Hl,wo,So;Rs.bind({g:1});let ur=Rs.bind({k:1});function Wp(e,t,r,n){_r.p=t,Hl=e,wo=r,So=n}function Sr(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:wo&&wo()},a),r.o=/go\d/.test(c),a.className=Rs.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),So&&d[0]&&So(a),Hl(d,a)}return s}}var Kp=e=>typeof e=="function",Xs=(e,t)=>Kp(e)?e(t):e,Qp=(()=>{let e=0;return()=>(++e).toString()})(),Wl=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Gp=20,Co="default",Kl=(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 Kl(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}))}}},Zs=[],Ql={toasts:[],pausedAt:void 0,settings:{toastLimit:Gp}},Jt={},Gl=(e,t=Co)=>{Jt[t]=Kl(Jt[t]||Ql,e),Zs.forEach(([r,n])=>{r===t&&n(Jt[t])})},Yl=e=>Object.keys(Jt).forEach(t=>Gl(e,t)),Yp=e=>Object.keys(Jt).find(t=>Jt[t].toasts.some(r=>r.id===e)),Js=(e=Co)=>t=>{Gl(t,e)},Rp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Xp=(e={},t=Co)=>{let[r,n]=h.useState(Jt[t]||Ql),s=h.useRef(Jt[t]);h.useEffect(()=>(s.current!==Jt[t]&&n(Jt[t]),Zs.push([t,n]),()=>{let o=Zs.findIndex(([a])=>a===t);o>-1&&Zs.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)||Rp[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},Zp=(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)||Qp()}),es=e=>(t,r)=>{let n=Zp(t,e,r);return Js(n.toasterId||Yp(n.id))({type:2,toast:n}),n.id},Je=(e,t)=>es("blank")(e,t);Je.error=es("error"),Je.success=es("success"),Je.loading=es("loading"),Je.custom=es("custom"),Je.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Js(t)(r):Yl(r)},Je.dismissAll=e=>Je.dismiss(void 0,e),Je.remove=(e,t)=>{let r={type:4,toastId:e};t?Js(t)(r):Yl(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?Xs(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?Xs(t.error,s):void 0;i?Je.error(i,{id:n,...r,...r==null?void 0:r.error}):Je.dismiss(n)}),e};var Jp=1e3,eg=(e,t="default")=>{let{toasts:r,pausedAt:n}=Xp(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,g=Jp)=>{if(s.has(f))return;let y=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},g);s.set(f,y)},[]);h.useEffect(()=>{if(n)return;let f=Date.now(),g=r.map(y=>{if(y.duration===1/0)return;let b=(y.duration||0)+y.pauseDuration-(f-y.createdAt);if(b<0){y.visible&&Je.dismiss(y.id);return}return setTimeout(()=>Je.dismiss(y.id,t),b)});return()=>{g.forEach(y=>y&&clearTimeout(y))}},[r,n,t]);let o=h.useCallback(Js(t),[t]),a=h.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=h.useCallback((f,g)=>{o({type:1,toast:{id:f,height:g}})},[o]),d=h.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=h.useCallback((f,g)=>{let{reverseOrder:y=!1,gutter:b=8,defaultPosition:p}=g||{},v=r.filter(S=>(S.position||p)===(f.position||p)&&S.height),m=v.findIndex(S=>S.id===f.id),_=v.filter((S,w)=>w<m&&S.visible).length;return v.filter(S=>S.visible).slice(...y?[_+1]:[0,_]).reduce((S,w)=>S+(w.height||0)+b,0)},[r]);return h.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}}},tg=ur`
1
+ (function(ye,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react"),require("react-dom"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","react/jsx-runtime"],h):(ye=typeof globalThis<"u"?globalThis:ye||self,h(ye.CollectionEditorReact={},ye.React,ye.ReactDOM,ye.jsxRuntime))})(this,function(ye,h,Pe,l){"use strict";var hD=Object.defineProperty;var ip=ye=>{throw TypeError(ye)};var pD=(ye,h,Pe)=>h in ye?hD(ye,h,{enumerable:!0,configurable:!0,writable:!0,value:Pe}):ye[h]=Pe;var Qs=(ye,h,Pe)=>pD(ye,typeof h!="symbol"?h+"":h,Pe),bl=(ye,h,Pe)=>h.has(ye)||ip("Cannot "+Pe);var O=(ye,h,Pe)=>(bl(ye,h,"read from private field"),Pe?Pe.call(ye):h.get(ye)),ne=(ye,h,Pe)=>h.has(ye)?ip("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(ye):h.set(ye,Pe),Y=(ye,h,Pe,l)=>(bl(ye,h,"write to private field"),l?l.call(ye,Pe):h.set(ye,Pe),Pe),we=(ye,h,Pe)=>(bl(ye,h,"access private method"),Pe);var fo=(ye,h,Pe,l)=>({set _(ho){Y(ye,h,ho,Pe)},get _(){return O(ye,h,l)}});var en,kr,Fn,Yh,ir,tn,Rh,$n,xr,jn,Xh,rn,Zh,Bn,nn,Un,qt,sn,it,js,on,Ft,op,br,Jh,Nt,Ce,Bs,Ct,an,zn,hr,Ar,Us,Vn,qn,ln,cn,Pr,Hn,Ne,Gs,_l,wl,Sl,Cl,El,Ol,Dl,ap,ep,zs,or,_t,un,ar,Br,tp,pr,Zt,Vs,rp,lr,np,Ye,Lr,Mr,Wn,Kn,Fr,Qn,Gn,sp;function ho(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 Te=ho(h);var Xn=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(){}},up=(Yh=class extends Xn{constructor(){super();ne(this,en);ne(this,kr);ne(this,Fn);Y(this,Fn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,kr)||this.setEventListener(O(this,Fn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,kr))==null||t.call(this),Y(this,kr,void 0))}setEventListener(t){var r;Y(this,Fn,t),(r=O(this,kr))==null||r.call(this),Y(this,kr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,en)!==t&&(Y(this,en,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,en)=="boolean"?O(this,en):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},en=new WeakMap,kr=new WeakMap,Fn=new WeakMap,Yh),po=new up,dp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},fp=(Rh=class{constructor(){ne(this,ir,dp);ne(this,tn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,tn)&&e!==O(this,ir)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,ir),provider:e}),Y(this,ir,e),process.env.NODE_ENV!=="production"&&Y(this,tn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,tn,!0),O(this,ir).setTimeout(e,t)}clearTimeout(e){O(this,ir).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,tn,!0),O(this,ir).setInterval(e,t)}clearInterval(e){O(this,ir).clearInterval(e)}},ir=new WeakMap,tn=new WeakMap,Rh),Ur=new fp;function hp(e){setTimeout(e,0)}var pp=typeof window>"u"||"Deno"in globalThis;function Ot(){}function gp(e,t){return typeof e=="function"?e(t):e}function go(e){return typeof e=="number"&&e>=0&&e!==1/0}function Il(e,t){return Math.max(e+(t||0)-Date.now(),0)}function _r(e,t){return typeof e=="function"?e(t):e}function At(e,t){return typeof e=="function"?e(t):e}function Tl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==yo(o,t.options))return!1}else if(!Jn(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 Nl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Zn(t.options.mutationKey)!==Zn(i))return!1}else if(!Jn(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function yo(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zn)(e)}function Zn(e){return JSON.stringify(e,(t,r)=>bo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Jn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Jn(e[r],t[r])):!1}var yp=Object.prototype.hasOwnProperty;function vo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=kl(e)&&kl(t);if(!n&&!(bo(e)&&bo(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],y=t[f];if(g===y){c[f]=g,(n?u<i:yp.call(e,f))&&d++;continue}if(g===null||y===null||typeof g!="object"||typeof y!="object"){c[f]=y;continue}const b=vo(g,y,r+1);c[f]=b,b===g&&d++}return i===a&&d===i?e:c}function mo(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 kl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bo(e){if(!xl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!xl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xl(e){return Object.prototype.toString.call(e)==="[object Object]"}function vp(e){return new Promise(t=>{Ur.setTimeout(t,e)})}function _o(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 mp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function bp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ys=Symbol();function Al(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ys&&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===Ys?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pl(e,t){return typeof e=="function"?e(...t):!!e}function _p(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 es=(()=>{let e=()=>pp;return{isServer(){return e()},setIsServer(t){e=t}}})();function wo(){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 wp=hp;function Sp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=wp;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=Sp(),Cp=(Xh=class extends Xn{constructor(){super();ne(this,$n,!0);ne(this,xr);ne(this,jn);Y(this,jn,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,xr)||this.setEventListener(O(this,jn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,xr))==null||t.call(this),Y(this,xr,void 0))}setEventListener(t){var r;Y(this,jn,t),(r=O(this,xr))==null||r.call(this),Y(this,xr,t(this.setOnline.bind(this)))}setOnline(t){O(this,$n)!==t&&(Y(this,$n,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,$n)}},$n=new WeakMap,xr=new WeakMap,jn=new WeakMap,Xh),Rs=new Cp;function Ep(e){return Math.min(1e3*2**e,3e4)}function Ll(e){return(e??"online")==="online"?Rs.isOnline():!0}var So=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ml(e){let t=!1,r=0,n;const s=wo(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new So(p);g(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>po.isFocused()&&(e.networkMode==="always"||Rs.isOnline())&&e.canRun(),u=()=>Ll(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},g=p=>{i()||(n==null||n(),s.reject(p))},y=()=>new Promise(p=>{var v;n=m=>{(i()||d())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),b=()=>{if(i())return;let p;const v=r===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(f).catch(m=>{var T;if(i())return;const _=e.retry??(es.isServer()?0:3),S=e.retryDelay??Ep,w=typeof S=="function"?S(r,m):S,E=_===!0||typeof _=="number"&&r<_||typeof _=="function"&&_(r,m);if(t||!E){g(m);return}r++,(T=e.onFail)==null||T.call(e,r,m),vp(w).then(()=>d()?void 0:y()).then(()=>{t?g(m):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?b():y().then(b),s)}}var Fl=(Zh=class{constructor(){ne(this,rn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),go(this.gcTime)&&Y(this,rn,Ur.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(es.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,rn)!==void 0&&(Ur.clearTimeout(O(this,rn)),Y(this,rn,void 0))}},rn=new WeakMap,Zh);function Op(e){return{onFetch:(t,r)=>{var u,f,g,y,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=((y=t.state.data)==null?void 0:y.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const v=S=>{_p(S,()=>t.signal,()=>p=!0)},m=Al(t.options,t.fetchOptions),_=async(S,w,E)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const x=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:w,direction:E?"backward":"forward",meta:t.options.meta};return v(L),L})(),P=await m(x),{maxPages:$}=t.options,k=E?bp:mp;return{pages:k(S.pages,P,$),pageParams:k(S.pageParams,w,$)}};if(s&&i.length){const S=s==="backward",w=S?Dp:$l,E={pages:i,pageParams:o},T=w(n,E);a=await _(E,T,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:$l(n,a);if(c>0&&w==null)break;a=await _(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var p,v;return(v=(p=t.options).persister)==null?void 0:v.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function $l(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 Ip=(Jh=class extends Fl{constructor(t){super();ne(this,Ft);ne(this,Bn);ne(this,nn);ne(this,Un);ne(this,qt);ne(this,sn);ne(this,it);ne(this,js);ne(this,on);Y(this,on,!1),Y(this,js,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,sn,t.client),Y(this,qt,O(this,sn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,nn,Ul(this.options)),this.state=t.state??O(this,nn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,Bn)}get promise(){var t;return(t=O(this,it))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,js),...t},t!=null&&t._type&&Y(this,Bn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Ul(this.options);r.data!==void 0&&(this.setState(Bl(r.data,r.dataUpdatedAt)),Y(this,nn,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,qt).remove(this)}setData(t,r){const n=_o(this.state.data,t,this.options);return we(this,Ft,br).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){we(this,Ft,br).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,it))==null?void 0:n.promise;return(s=O(this,it))==null||s.cancel(t),r?r.then(Ot).catch(Ot):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,nn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>At(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ys||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>_r(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:!Il(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,it))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,it))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,qt).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,it)&&(O(this,on)||we(this,Ft,op).call(this)?O(this,it).cancel({revert:!0}):O(this,it).cancelRetry()),this.scheduleGc()),O(this,qt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||we(this,Ft,br).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,g,y,b,p,v,m,_,S;if(this.state.fetchStatus!=="idle"&&((d=O(this,it))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,it))return O(this,it).continueRetry(),O(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(E=>E.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:()=>(Y(this,on,!0),n.signal)})},i=()=>{const w=Al(this.options,r),T=(()=>{const x={client:O(this,sn),queryKey:this.queryKey,meta:this.meta};return s(x),x})();return Y(this,on,!1),this.options.persister?this.options.persister(w,T,this):w(T)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,sn),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,Bn)==="infinite"?Op(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),Y(this,Un,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&we(this,Ft,br).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,it,Ml({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof So&&w.revert&&this.setState({...O(this,Un),fetchStatus:"idle"}),n.abort()},onFail:(w,E)=>{we(this,Ft,br).call(this,{type:"failed",failureCount:w,error:E})},onPause:()=>{we(this,Ft,br).call(this,{type:"pause"})},onContinue:()=>{we(this,Ft,br).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,it).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),(y=(g=O(this,qt).config).onSuccess)==null||y.call(g,w,this),(p=(b=O(this,qt).config).onSettled)==null||p.call(b,w,this.state.error,this),w}catch(w){if(w instanceof So){if(w.silent)return O(this,it).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw we(this,Ft,br).call(this,{type:"error",error:w}),(m=(v=O(this,qt).config).onError)==null||m.call(v,w,this),(S=(_=O(this,qt).config).onSettled)==null||S.call(_,this.state.data,w,this),w}finally{this.scheduleGc()}}},Bn=new WeakMap,nn=new WeakMap,Un=new WeakMap,qt=new WeakMap,sn=new WeakMap,it=new WeakMap,js=new WeakMap,on=new WeakMap,Ft=new WeakSet,op=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},br=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,...jl(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Bl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Un,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,qt).notify({query:this,type:"updated",action:t})})},Jh);function jl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ll(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Bl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ul(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 Tp=(ep=class extends Xn{constructor(t,r){super();ne(this,Ne);ne(this,Nt);ne(this,Ce);ne(this,Bs);ne(this,Ct);ne(this,an);ne(this,zn);ne(this,hr);ne(this,Ar);ne(this,Us);ne(this,Vn);ne(this,qn);ne(this,ln);ne(this,cn);ne(this,Pr);ne(this,Hn,new Set);this.options=r,Y(this,Nt,t),Y(this,Ar,null),Y(this,hr,wo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Ce).addObserver(this),zl(O(this,Ce),this.options)?we(this,Ne,Gs).call(this):this.updateResult(),we(this,Ne,Cl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Co(O(this,Ce),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Co(O(this,Ce),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,we(this,Ne,El).call(this),we(this,Ne,Ol).call(this),O(this,Ce).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,Ce);if(this.options=O(this,Nt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof At(this.options.enabled,O(this,Ce))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");we(this,Ne,Dl).call(this),O(this,Ce).setOptions(this.options),r._defaulted&&!mo(this.options,r)&&O(this,Nt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Ce),observer:this});const s=this.hasListeners();s&&Vl(O(this,Ce),n,this.options,r)&&we(this,Ne,Gs).call(this),this.updateResult(),s&&(O(this,Ce)!==n||At(this.options.enabled,O(this,Ce))!==At(r.enabled,O(this,Ce))||_r(this.options.staleTime,O(this,Ce))!==_r(r.staleTime,O(this,Ce)))&&we(this,Ne,_l).call(this);const i=we(this,Ne,wl).call(this);s&&(O(this,Ce)!==n||At(this.options.enabled,O(this,Ce))!==At(r.enabled,O(this,Ce))||i!==O(this,Pr))&&we(this,Ne,Sl).call(this,i)}getOptimisticResult(t){const r=O(this,Nt).getQueryCache().build(O(this,Nt),t),n=this.createResult(r,t);return kp(this,n)&&(Y(this,Ct,n),Y(this,zn,this.options),Y(this,an,O(this,Ce).state)),n}getCurrentResult(){return O(this,Ct)}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,hr).status==="pending"&&O(this,hr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){O(this,Hn).add(t)}getCurrentQuery(){return O(this,Ce)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,Nt).defaultQueryOptions(t),n=O(this,Nt).getQueryCache().build(O(this,Nt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return we(this,Ne,Gs).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,Ct)))}createResult(t,r){var $;const n=O(this,Ce),s=this.options,i=O(this,Ct),o=O(this,an),a=O(this,zn),d=t!==n?t.state:O(this,Bs),{state:u}=t;let f={...u},g=!1,y;if(r._optimisticResults){const k=this.hasListeners(),L=!k&&zl(t,r),B=k&&Vl(t,n,r,s);(L||B)&&(f={...f,...jl(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:p,status:v}=f;y=f.data;let m=!1;if(r.placeholderData!==void 0&&y===void 0&&v==="pending"){let k;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(k=i.data,m=!0):k=typeof r.placeholderData=="function"?r.placeholderData(($=O(this,qn))==null?void 0:$.state.data,O(this,qn)):r.placeholderData,k!==void 0&&(v="success",y=_o(i==null?void 0:i.data,k,r),g=!0)}if(r.select&&y!==void 0&&!m)if(i&&y===(o==null?void 0:o.data)&&r.select===O(this,Us))y=O(this,Vn);else try{Y(this,Us,r.select),y=r.select(y),y=_o(i==null?void 0:i.data,y,r),Y(this,Vn,y),Y(this,Ar,null)}catch(k){Y(this,Ar,k)}O(this,Ar)&&(b=O(this,Ar),y=O(this,Vn),p=Date.now(),v="error");const _=f.fetchStatus==="fetching",S=v==="pending",w=v==="error",E=S&&_,T=y!==void 0,P={status:v,fetchStatus:f.fetchStatus,isPending:S,isSuccess:v==="success",isError:w,isInitialLoading:E,isLoading:E,data:y,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:p,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&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&T,isStale:Eo(t,r),refetch:this.refetch,promise:O(this,hr),isEnabled:At(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=P.data!==void 0,L=P.status==="error"&&!k,B=F=>{L?F.reject(P.error):k&&F.resolve(P.data)},A=()=>{const F=Y(this,hr,P.promise=wo());B(F)},j=O(this,hr);switch(j.status){case"pending":t.queryHash===n.queryHash&&B(j);break;case"fulfilled":(L||P.data!==j.value)&&A();break;case"rejected":(!L||P.error!==j.reason)&&A();break}}return P}updateResult(){const t=O(this,Ct),r=this.createResult(O(this,Ce),this.options);if(Y(this,an,O(this,Ce).state),Y(this,zn,this.options),O(this,an).data!==void 0&&Y(this,qn,O(this,Ce)),mo(r,t))return;Y(this,Ct,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,Hn).size)return!0;const o=new Set(i??O(this,Hn));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,Ct)).some(a=>{const c=a;return O(this,Ct)[c]!==t[c]&&o.has(c)})};we(this,Ne,ap).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&we(this,Ne,Cl).call(this)}},Nt=new WeakMap,Ce=new WeakMap,Bs=new WeakMap,Ct=new WeakMap,an=new WeakMap,zn=new WeakMap,hr=new WeakMap,Ar=new WeakMap,Us=new WeakMap,Vn=new WeakMap,qn=new WeakMap,ln=new WeakMap,cn=new WeakMap,Pr=new WeakMap,Hn=new WeakMap,Ne=new WeakSet,Gs=function(t){we(this,Ne,Dl).call(this);let r=O(this,Ce).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ot)),r},_l=function(){we(this,Ne,El).call(this);const t=_r(this.options.staleTime,O(this,Ce));if(es.isServer()||O(this,Ct).isStale||!go(t))return;const n=Il(O(this,Ct).dataUpdatedAt,t)+1;Y(this,ln,Ur.setTimeout(()=>{O(this,Ct).isStale||this.updateResult()},n))},wl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Ce)):this.options.refetchInterval)??!1},Sl=function(t){we(this,Ne,Ol).call(this),Y(this,Pr,t),!(es.isServer()||At(this.options.enabled,O(this,Ce))===!1||!go(O(this,Pr))||O(this,Pr)===0)&&Y(this,cn,Ur.setInterval(()=>{(this.options.refetchIntervalInBackground||po.isFocused())&&we(this,Ne,Gs).call(this)},O(this,Pr)))},Cl=function(){we(this,Ne,_l).call(this),we(this,Ne,Sl).call(this,we(this,Ne,wl).call(this))},El=function(){O(this,ln)!==void 0&&(Ur.clearTimeout(O(this,ln)),Y(this,ln,void 0))},Ol=function(){O(this,cn)!==void 0&&(Ur.clearInterval(O(this,cn)),Y(this,cn,void 0))},Dl=function(){const t=O(this,Nt).getQueryCache().build(O(this,Nt),this.options);if(t===O(this,Ce))return;const r=O(this,Ce);Y(this,Ce,t),Y(this,Bs,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},ap=function(t){lt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,Ct))}),O(this,Nt).getQueryCache().notify({query:O(this,Ce),type:"observerResultsUpdated"})})},ep);function Np(e,t){return At(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&At(t.retryOnMount,e)===!1)}function zl(e,t){return Np(e,t)||e.state.data!==void 0&&Co(e,t,t.refetchOnMount)}function Co(e,t,r){if(At(t.enabled,e)!==!1&&_r(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Eo(e,t)}return!1}function Vl(e,t,r,n){return(e!==t||At(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Eo(e,r)}function Eo(e,t){return At(t.enabled,e)!==!1&&e.isStaleByTime(_r(t.staleTime,e))}function kp(e,t){return!mo(e.getCurrentResult(),t)}var xp=(tp=class extends Fl{constructor(t){super();ne(this,ar);ne(this,zs);ne(this,or);ne(this,_t);ne(this,un);Y(this,zs,t.client),this.mutationId=t.mutationId,Y(this,_t,t.mutationCache),Y(this,or,[]),this.state=t.state||Ap(),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,or).includes(t)||(O(this,or).push(t),this.clearGcTimeout(),O(this,_t).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,or,O(this,or).filter(r=>r!==t)),this.scheduleGc(),O(this,_t).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,or).length||(this.state.status==="pending"?this.scheduleGc():O(this,_t).remove(this))}continue(){var t;return((t=O(this,un))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,g,y,b,p,v,m,_,S,w,E,T,x;const r=()=>{we(this,ar,Br).call(this,{type:"continue"})},n={client:O(this,zs),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,un,Ml({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(P,$)=>{we(this,ar,Br).call(this,{type:"failed",failureCount:P,error:$})},onPause:()=>{we(this,ar,Br).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,_t).canRun(this)}));const s=this.state.status==="pending",i=!O(this,un).canStart();try{if(s)r();else{we(this,ar,Br).call(this,{type:"pending",variables:t,isPaused:i}),O(this,_t).config.onMutate&&await O(this,_t).config.onMutate(t,this,n);const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));$!==this.state.context&&we(this,ar,Br).call(this,{type:"pending",context:$,variables:t,isPaused:i})}const P=await O(this,un).start();return await((d=(c=O(this,_t).config).onSuccess)==null?void 0:d.call(c,P,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,P,t,this.state.context,n)),await((y=(g=O(this,_t).config).onSettled)==null?void 0:y.call(g,P,null,this.state.variables,this.state.context,this,n)),await((p=(b=this.options).onSettled)==null?void 0:p.call(b,P,null,t,this.state.context,n)),we(this,ar,Br).call(this,{type:"success",data:P}),P}catch(P){try{await((m=(v=O(this,_t).config).onError)==null?void 0:m.call(v,P,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((S=(_=this.options).onError)==null?void 0:S.call(_,P,t,this.state.context,n))}catch($){Promise.reject($)}try{await((E=(w=O(this,_t).config).onSettled)==null?void 0:E.call(w,void 0,P,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((x=(T=this.options).onSettled)==null?void 0:x.call(T,void 0,P,t,this.state.context,n))}catch($){Promise.reject($)}throw we(this,ar,Br).call(this,{type:"error",error:P}),P}finally{O(this,_t).runNext(this)}}},zs=new WeakMap,or=new WeakMap,_t=new WeakMap,un=new WeakMap,ar=new WeakSet,Br=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,or).forEach(n=>{n.onMutationUpdate(t)}),O(this,_t).notify({mutation:this,type:"updated",action:t})})},tp);function Ap(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Pp=(rp=class extends Xn{constructor(t={}){super();ne(this,pr);ne(this,Zt);ne(this,Vs);this.config=t,Y(this,pr,new Set),Y(this,Zt,new Map),Y(this,Vs,0)}build(t,r,n){const s=new xp({client:t,mutationCache:this,mutationId:++fo(this,Vs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,pr).add(t);const r=Xs(t);if(typeof r=="string"){const n=O(this,Zt).get(r);n?n.push(t):O(this,Zt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,pr).delete(t)){const r=Xs(t);if(typeof r=="string"){const n=O(this,Zt).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,Zt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Xs(t);if(typeof r=="string"){const n=O(this,Zt).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=Xs(t);if(typeof r=="string"){const s=(n=O(this,Zt).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,pr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,pr).clear(),O(this,Zt).clear()})}getAll(){return Array.from(O(this,pr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Nl(r,n))}findAll(t={}){return this.getAll().filter(r=>Nl(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(Ot))))}},pr=new WeakMap,Zt=new WeakMap,Vs=new WeakMap,rp);function Xs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Lp=(np=class extends Xn{constructor(t={}){super();ne(this,lr);this.config=t,Y(this,lr,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??yo(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){O(this,lr).has(t.queryHash)||(O(this,lr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,lr).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,lr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){lt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,lr).get(t)}getAll(){return[...O(this,lr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Tl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Tl(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()})})}},lr=new WeakMap,np),Mp=(sp=class{constructor(e={}){ne(this,Ye);ne(this,Lr);ne(this,Mr);ne(this,Wn);ne(this,Kn);ne(this,Fr);ne(this,Qn);ne(this,Gn);Y(this,Ye,e.queryCache||new Lp),Y(this,Lr,e.mutationCache||new Pp),Y(this,Mr,e.defaultOptions||{}),Y(this,Wn,new Map),Y(this,Kn,new Map),Y(this,Fr,0)}mount(){fo(this,Fr)._++,O(this,Fr)===1&&(Y(this,Qn,po.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ye).onFocus())})),Y(this,Gn,Rs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ye).onOnline())})))}unmount(){var e,t;fo(this,Fr)._--,O(this,Fr)===0&&((e=O(this,Qn))==null||e.call(this),Y(this,Qn,void 0),(t=O(this,Gn))==null||t.call(this),Y(this,Gn,void 0))}isFetching(e){return O(this,Ye).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Lr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ye).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Ye).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(_r(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,Ye).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,Ye).get(n.queryHash),i=s==null?void 0:s.state.data,o=gp(t,i);if(o!==void 0)return O(this,Ye).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return lt.batch(()=>O(this,Ye).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,Ye).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Ye);lt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Ye);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,Ye).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ot).catch(Ot)}invalidateQueries(e,t={}){return lt.batch(()=>(O(this,Ye).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,Ye).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ot)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Ot)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,Ye).build(this,t);return r.isStaleByTime(_r(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ot).catch(Ot)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ot).catch(Ot)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Rs.isOnline()?O(this,Lr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ye)}getMutationCache(){return O(this,Lr)}getDefaultOptions(){return O(this,Mr)}setDefaultOptions(e){Y(this,Mr,e)}setQueryDefaults(e,t){O(this,Wn).set(Zn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Wn).values()],r={};return t.forEach(n=>{Jn(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,Kn).set(Zn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Kn).values()],r={};return t.forEach(n=>{Jn(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Mr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=yo(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===Ys&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Mr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ye).clear(),O(this,Lr).clear()}},Ye=new WeakMap,Lr=new WeakMap,Mr=new WeakMap,Wn=new WeakMap,Kn=new WeakMap,Fr=new WeakMap,Qn=new WeakMap,Gn=new WeakMap,sp),ql=Te.createContext(void 0),Fp=e=>{const t=Te.useContext(ql);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},$p=({client:e,children:t})=>(Te.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(ql.Provider,{value:e,children:t})),Hl=Te.createContext(!1),jp=()=>Te.useContext(Hl);Hl.Provider;function Bp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Up=Te.createContext(Bp()),zp=()=>Te.useContext(Up),Vp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Pl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},qp=e=>{Te.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||Pl(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,Wl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Gp(e,t,r){var y,b,p,v;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=jp(),s=zp(),i=Fp(),o=i.defaultQueryOptions(e);(b=(y=i.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,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]=Te.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Te.useSyncExternalStore(Te.useCallback(m=>{const _=g?u.subscribe(lt.batchCalls(m)):Ot;return u.updateResult(),_},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Te.useEffect(()=>{u.setOptions(o)},[o,u]),Qp(o,f))throw Wl(o,u,s);if(Hp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((v=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||v.call(p,o,f),o.experimental_prefetchInRender&&!es.isServer()&&Kp(f,n)){const m=d?Wl(o,u,s):a==null?void 0:a.promise;m==null||m.catch(Ot).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function ts(e,t){return Gp(e,Tp)}let Yp={data:""},Rp=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},Xp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Zp=/\/\*[^]*?\*\/| +/g,Kl=/\n+/g,wr=(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"?wr(o,i):i+"{"+wr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=wr(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+=wr.p?wr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},Sr={},Ql=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+Ql(e[r]);return t}return e},Jp=(e,t,r,n,s)=>{let i=Ql(e),o=Sr[i]||(Sr[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!Sr[o]){let c=i!==e?e:(d=>{let u,f,g=[{}];for(;u=Xp.exec(d.replace(Zp,""));)u[4]?g.shift():u[3]?(f=u[3].replace(Kl," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Kl," ").trim();return g[0]})(e);Sr[o]=wr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&Sr.g;return r&&(Sr.g=Sr[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)})(Sr[o],t,n,a),o},eg=(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?"":wr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Zs(e){let t=this||{},r=e.call?e(t.p):e;return Jp(r.unshift?r.raw?eg(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Rp(t.target),t.g,t.o,t.k)}let Gl,Oo,Do;Zs.bind({g:1});let dr=Zs.bind({k:1});function tg(e,t,r,n){wr.p=t,Gl=e,Oo=r,Do=n}function Cr(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:Oo&&Oo()},a),r.o=/go\d/.test(c),a.className=Zs.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),Do&&d[0]&&Do(a),Gl(d,a)}return s}}var rg=e=>typeof e=="function",Js=(e,t)=>rg(e)?e(t):e,ng=(()=>{let e=0;return()=>(++e).toString()})(),Yl=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),sg=20,Io="default",Rl=(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 Rl(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}))}}},ei=[],Xl={toasts:[],pausedAt:void 0,settings:{toastLimit:sg}},er={},Zl=(e,t=Io)=>{er[t]=Rl(er[t]||Xl,e),ei.forEach(([r,n])=>{r===t&&n(er[t])})},Jl=e=>Object.keys(er).forEach(t=>Zl(e,t)),ig=e=>Object.keys(er).find(t=>er[t].toasts.some(r=>r.id===e)),ti=(e=Io)=>t=>{Zl(t,e)},og={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},ag=(e={},t=Io)=>{let[r,n]=h.useState(er[t]||Xl),s=h.useRef(er[t]);h.useEffect(()=>(s.current!==er[t]&&n(er[t]),ei.push([t,n]),()=>{let o=ei.findIndex(([a])=>a===t);o>-1&&ei.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)||og[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},lg=(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)||ng()}),rs=e=>(t,r)=>{let n=lg(t,e,r);return ti(n.toasterId||ig(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?ti(t)(r):Jl(r)},Je.dismissAll=e=>Je.dismiss(void 0,e),Je.remove=(e,t)=>{let r={type:4,toastId:e};t?ti(t)(r):Jl(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?Js(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?Js(t.error,s):void 0;i?Je.error(i,{id:n,...r,...r==null?void 0:r.error}):Je.dismiss(n)}),e};var cg=1e3,ug=(e,t="default")=>{let{toasts:r,pausedAt:n}=ag(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,g=cg)=>{if(s.has(f))return;let y=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},g);s.set(f,y)},[]);h.useEffect(()=>{if(n)return;let f=Date.now(),g=r.map(y=>{if(y.duration===1/0)return;let b=(y.duration||0)+y.pauseDuration-(f-y.createdAt);if(b<0){y.visible&&Je.dismiss(y.id);return}return setTimeout(()=>Je.dismiss(y.id,t),b)});return()=>{g.forEach(y=>y&&clearTimeout(y))}},[r,n,t]);let o=h.useCallback(ti(t),[t]),a=h.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=h.useCallback((f,g)=>{o({type:1,toast:{id:f,height:g}})},[o]),d=h.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=h.useCallback((f,g)=>{let{reverseOrder:y=!1,gutter:b=8,defaultPosition:p}=g||{},v=r.filter(S=>(S.position||p)===(f.position||p)&&S.height),m=v.findIndex(S=>S.id===f.id),_=v.filter((S,w)=>w<m&&S.visible).length;return v.filter(S=>S.visible).slice(...y?[_+1]:[0,_]).reduce((S,w)=>S+(w.height||0)+b,0)},[r]);return h.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}}},dg=dr`
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
- }`,rg=ur`
9
+ }`,fg=dr`
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
- }`,ng=ur`
17
+ }`,hg=dr`
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
- }`,sg=Sr("div")`
25
+ }`,pg=Cr("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: ${tg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
34
+ animation: ${dg} 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: ${rg} 0.15s ease-out forwards;
41
+ animation: ${fg} 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: ${ng} 0.15s ease-out forwards;
54
+ animation: ${hg} 0.15s ease-out forwards;
55
55
  animation-delay: 180ms;
56
56
  transform: rotate(90deg);
57
57
  }
58
- `,ig=ur`
58
+ `,gg=dr`
59
59
  from {
60
60
  transform: rotate(0deg);
61
61
  }
62
62
  to {
63
63
  transform: rotate(360deg);
64
64
  }
65
- `,og=Sr("div")`
65
+ `,yg=Cr("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: ${ig} 1s linear infinite;
74
- `,ag=ur`
73
+ animation: ${gg} 1s linear infinite;
74
+ `,vg=dr`
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
- }`,lg=ur`
82
+ }`,mg=dr`
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
- }`,cg=Sr("div")`
96
+ }`,bg=Cr("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: ${ag} 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: ${lg} 0.2s ease-out forwards;
111
+ animation: ${mg} 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
- `,ug=Sr("div")`
123
+ `,_g=Cr("div")`
124
124
  position: absolute;
125
- `,dg=Sr("div")`
125
+ `,wg=Cr("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
- `,fg=ur`
132
+ `,Sg=dr`
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
- }`,hg=Sr("div")`
140
+ }`,Cg=Cr("div")`
141
141
  position: relative;
142
142
  transform: scale(0.6);
143
143
  opacity: 0.4;
144
144
  min-width: 20px;
145
- animation: ${fg} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
145
+ animation: ${Sg} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
146
146
  forwards;
147
- `,pg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Te.createElement(hg,null,t):t:r==="blank"?null:Te.createElement(dg,null,Te.createElement(og,{...n}),r!=="loading"&&Te.createElement(ug,null,r==="error"?Te.createElement(sg,{...n}):Te.createElement(cg,{...n})))},gg=e=>`
147
+ `,Eg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Te.createElement(Cg,null,t):t:r==="blank"?null:Te.createElement(wg,null,Te.createElement(yg,{...n}),r!=="loading"&&Te.createElement(_g,null,r==="error"?Te.createElement(pg,{...n}):Te.createElement(bg,{...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
- `,yg=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
- `,vg="0%{opacity:0;} 100%{opacity:1;}",mg="0%{opacity:1;} 100%{opacity:0;}",bg=Sr("div")`
153
+ `,Ig="0%{opacity:0;} 100%{opacity:1;}",Tg="0%{opacity:1;} 100%{opacity:0;}",Ng=Cr("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
- `,_g=Sr("div")`
165
+ `,kg=Cr("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
- `,wg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Wl()?[vg,mg]:[gg(r),yg(r)];return{animation:t?`${ur(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ur(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Sg=Te.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?wg(e.position||t||"top-center",e.visible):{opacity:0},i=Te.createElement(pg,{toast:e}),o=Te.createElement(_g,{...e.ariaProps},Xs(e.message,e));return Te.createElement(bg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Te.createElement(Te.Fragment,null,i,o))});Wp(Te.createElement);var Cg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Te.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 Te.createElement("div",{ref:i,className:t,style:r},s)},Og=(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:Wl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Eg=Rs`
172
+ `,xg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Yl()?[Ig,Tg]:[Og(r),Dg(r)];return{animation:t?`${dr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${dr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Ag=Te.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?xg(e.position||t||"top-center",e.visible):{opacity:0},i=Te.createElement(Eg,{toast:e}),o=Te.createElement(kg,{...e.ariaProps},Js(e.message,e));return Te.createElement(Ng,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Te.createElement(Te.Fragment,null,i,o))});tg(Te.createElement);var Pg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Te.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 Te.createElement("div",{ref:i,className:t,style:r},s)},Lg=(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:Yl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Mg=Zs`
173
173
  z-index: 9999;
174
174
  > * {
175
175
  pointer-events: auto;
176
176
  }
177
- `,ei=16,Dg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=eg(r,i);return Te.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:ei,left:ei,right:ei,bottom:ei,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}),y=Og(f,g);return Te.createElement(Cg,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Eg:"",style:y},u.type==="custom"?Xs(u.message,u):s?s(u):Te.createElement(Sg,{toast:u,position:f}))}))},De=Je;function Ig(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const ti=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Oo(e){return"nodeType"in e}function wt(e){var t,r;return e?fn(e)?e:Oo(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Eo(e){const{Document:t}=wt(e);return e instanceof t}function ts(e){return fn(e)?!1:e instanceof wt(e).HTMLElement}function Rl(e){return e instanceof wt(e).SVGElement}function hn(e){return e?fn(e)?e.document:Oo(e)?Eo(e)?e:ts(e)||Rl(e)?e.ownerDocument:document:document:document}const Ht=ti?h.useLayoutEffect:h.useEffect;function ri(e){const t=h.useRef(e);return Ht(()=>{t.current=e}),h.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 Tg(){const e=h.useRef(null),t=h.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function rs(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return Ht(()=>{r.current!==e&&(r.current=e)},t),r}function ns(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function ni(e){const t=ri(e),r=h.useRef(null),n=h.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function si(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let Do={};function ss(e,t){return h.useMemo(()=>{if(t)return t;const r=Do[e]==null?0:Do[e]+1;return Do[e]=r,e+"-"+r},[e,t])}function Xl(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 pn=Xl(1),is=Xl(-1);function Ng(e){return"clientX"in e&&"clientY"in e}function ii(e){if(!e)return!1;const{KeyboardEvent:t}=wt(e.target);return t&&e instanceof t}function kg(e){if(!e)return!1;const{TouchEvent:t}=wt(e.target);return t&&e instanceof t}function oi(e){if(kg(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 Ng(e)?{x:e.clientX,y:e.clientY}:null}const Cr=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[Cr.Translate.toString(e),Cr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Zl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xg(e){return e.matches(Zl)?e:e.querySelector(Zl)}const Ag={display:"none"};function Pg(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:Ag},r)}function Mg(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 h.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Lg(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Jl=h.createContext(null);function Fg(e){const t=h.useContext(Jl);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function $g(){const[e]=h.useState(()=>new Set),t=h.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[h.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 jg={draggable:`
177
+ `,ri=16,Fg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=ug(r,i);return Te.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:ri,left:ri,right:ri,bottom:ri,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}),y=Lg(f,g);return Te.createElement(Pg,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Mg:"",style:y},u.type==="custom"?Js(u.message,u):s?s(u):Te.createElement(Ag,{toast:u,position:f}))}))},De=Je;function $g(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const ni=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function To(e){return"nodeType"in e}function St(e){var t,r;return e?hn(e)?e:To(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function No(e){const{Document:t}=St(e);return e instanceof t}function ns(e){return hn(e)?!1:e instanceof St(e).HTMLElement}function ec(e){return e instanceof St(e).SVGElement}function pn(e){return e?hn(e)?e.document:To(e)?No(e)?e:ns(e)||ec(e)?e.ownerDocument:document:document:document}const Wt=ni?h.useLayoutEffect:h.useEffect;function si(e){const t=h.useRef(e);return Wt(()=>{t.current=e}),h.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 jg(){const e=h.useRef(null),t=h.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function ss(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return Wt(()=>{r.current!==e&&(r.current=e)},t),r}function is(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function ii(e){const t=si(e),r=h.useRef(null),n=h.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function oi(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let ko={};function os(e,t){return h.useMemo(()=>{if(t)return t;const r=ko[e]==null?0:ko[e]+1;return ko[e]=r,e+"-"+r},[e,t])}function tc(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 gn=tc(1),as=tc(-1);function Bg(e){return"clientX"in e&&"clientY"in e}function ai(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 li(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 Er=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[Er.Translate.toString(e),Er.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),rc="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(rc)?e:e.querySelector(rc)}const Vg={display:"none"};function qg(e){let{id:t,value:r}=e;return h.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 h.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Wg(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const nc=h.createContext(null);function Kg(e){const t=h.useContext(nc);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Qg(){const[e]=h.useState(()=>new Set),t=h.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[h.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
- `},Bg={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 Ug(e){let{announcements:t=Bg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=jg}=e;const{announce:i,announcement:o}=Lg(),a=ss("DndLiveRegion"),[c,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),Fg(h.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:y}=f;t.onDragMove&&i(t.onDragMove({active:g,over:y}))},onDragOver(f){let{active:g,over:y}=f;i(t.onDragOver({active:g,over:y}))},onDragEnd(f){let{active:g,over:y}=f;i(t.onDragEnd({active:g,over:y}))},onDragCancel(f){let{active:g,over:y}=f;i(t.onDragCancel({active:g,over:y}))}}),[i,t])),!c)return null;const u=h.createElement(h.Fragment,null,h.createElement(Pg,{id:n,value:s.draggable}),h.createElement(Mg,{id:a,announcement:o}));return r?qe.createPortal(u,r):u}var et;(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"})(et||(et={}));function ai(){}function Io(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function ec(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Wt=Object.freeze({x:0,y:0});function tc(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=oi(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 rc(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Vg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function nc(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 sc(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function ic(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 qg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=ic(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=tc(ic(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(rc)},Hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=nc(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=nc(c),u=s.reduce((g,y,b)=>g+tc(d[b],y),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(rc)};function Wg(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 Kg=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=Wg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Vg)};function Qg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function oc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Wt}function Gg(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 Yg=Gg(1);function ac(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 Rg(e,t,r){const n=ac(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 Xg={ignoreTransform:!1};function gn(e,t){t===void 0&&(t=Xg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=wt(e).getComputedStyle(e);d&&(r=Rg(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 lc(e){return gn(e,{ignoreTransform:!0})}function Zg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Jg(e,t){return t===void 0&&(t=wt(e).getComputedStyle(e)),t.position==="fixed"}function ey(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 li(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Eo(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!ts(s)||Rl(s)||r.includes(s))return r;const i=wt(e).getComputedStyle(s);return s!==e&&ey(s,i)&&r.push(s),Jg(s,i)?r:n(s.parentNode)}return e?n(e):r}function cc(e){const[t]=li(e,1);return t??null}function To(e){return!ti||!e?null:fn(e)?e:Oo(e)?Eo(e)||e===hn(e).scrollingElement?window:ts(e)?e:null:null}function uc(e){return fn(e)?e.scrollX:e.scrollLeft}function dc(e){return fn(e)?e.scrollY:e.scrollTop}function No(e){return{x:uc(e),y:dc(e)}}var rt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(rt||(rt={}));function fc(e){return!ti||!e?!1:e===document.scrollingElement}function hc(e){const t={x:0,y:0},r=fc(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 ty={x:.2,y:.2};function ry(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=ty);const{isTop:d,isBottom:u,isLeft:f,isRight:g}=hc(e),y={x:0,y:0},b={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+p.height?(y.y=rt.Backward,b.y=n*Math.abs((t.top+p.height-i)/p.height)):!u&&c>=t.bottom-p.height&&(y.y=rt.Forward,b.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!g&&a>=t.right-p.width?(y.x=rt.Forward,b.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(y.x=rt.Backward,b.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:y,speed:b}}function ny(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 pc(e){return e.reduce((t,r)=>pn(t,No(r)),Wt)}function sy(e){return e.reduce((t,r)=>t+uc(r),0)}function iy(e){return e.reduce((t,r)=>t+dc(r),0)}function gc(e,t){if(t===void 0&&(t=gn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);cc(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const oy=[["x",["left","right"],sy],["y",["top","bottom"],iy]];class ko{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=li(r),s=pc(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of oy)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 os{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 ay(e){const{EventTarget:t}=wt(e);return e instanceof t?e:hn(e)}function xo(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 $t;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($t||($t={}));function yc(e){e.preventDefault()}function ly(e){e.stopPropagation()}var Se;(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"})(Se||(Se={}));const vc={start:[Se.Space,Se.Enter],cancel:[Se.Esc],end:[Se.Space,Se.Enter,Se.Tab]},cy=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Se.Right:return{...r,x:r.x+25};case Se.Left:return{...r,x:r.x-25};case Se.Down:return{...r,y:r.y+25};case Se.Up:return{...r,y:r.y-25}}};class Ao{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 os(hn(r)),this.windowListeners=new os(wt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($t.Resize,this.handleCancel),this.windowListeners.add($t.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($t.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&gc(n),r(Wt)}handleKeyDown(t){if(ii(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=vc,coordinateGetter:o=cy,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}:Wt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const g=is(f,u),y={x:0,y:0},{scrollableAncestors:b}=n.current;for(const p of b){const v=t.code,{isTop:m,isRight:_,isLeft:S,isBottom:w,maxScroll:O,minScroll:T}=hc(p),x=ny(p),P={x:Math.min(v===Se.Right?x.right-x.width/2:x.right,Math.max(v===Se.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(v===Se.Down?x.bottom-x.height/2:x.bottom,Math.max(v===Se.Down?x.top:x.top+x.height/2,f.y))},$=v===Se.Right&&!_||v===Se.Left&&!S,k=v===Se.Down&&!w||v===Se.Up&&!m;if($&&P.x!==f.x){const M=p.scrollLeft+g.x,B=v===Se.Right&&M<=O.x||v===Se.Left&&M>=T.x;if(B&&!g.y){p.scrollTo({left:M,behavior:a});return}B?y.x=p.scrollLeft-M:y.x=v===Se.Right?p.scrollLeft-O.x:p.scrollLeft-T.x,y.x&&p.scrollBy({left:-y.x,behavior:a});break}else if(k&&P.y!==f.y){const M=p.scrollTop+g.y,B=v===Se.Down&&M<=O.y||v===Se.Up&&M>=T.y;if(B&&!g.x){p.scrollTo({top:M,behavior:a});return}B?y.y=p.scrollTop-M:y.y=v===Se.Down?p.scrollTop-O.y:p.scrollTop-T.y,y.y&&p.scrollBy({top:-y.y,behavior:a});break}}this.handleMove(t,pn(is(f,this.referenceCoordinates),y))}}}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()}}Ao.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=vc,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 mc(e){return!!(e&&"distance"in e)}function bc(e){return!!(e&&"delay"in e)}class Po{constructor(t,r,n){var s;n===void 0&&(n=ay(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=hn(o),this.documentListeners=new os(this.document),this.listeners=new os(n),this.windowListeners=new os(wt(o)),this.initialCoordinates=(s=oi(i))!=null?s:Wt,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($t.Resize,this.handleCancel),this.windowListeners.add($t.DragStart,yc),this.windowListeners.add($t.VisibilityChange,this.handleCancel),this.windowListeners.add($t.ContextMenu,yc),this.documentListeners.add($t.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(bc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(mc(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($t.Click,ly,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($t.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=oi(t))!=null?r:Wt,d=is(s,c);if(!n&&a){if(mc(a)){if(a.tolerance!=null&&xo(d,a.tolerance))return this.handleCancel();if(xo(d,a.distance))return this.handleStart()}if(bc(a)&&xo(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===Se.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const uy={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ci extends Po{constructor(t){const{event:r}=t,n=hn(r.target);super(t,uy,n)}}ci.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 dy={move:{name:"mousemove"},end:{name:"mouseup"}};var Mo;(function(e){e[e.RightClick=2]="RightClick"})(Mo||(Mo={}));class fy extends Po{constructor(t){super(t,dy,hn(t.event.target))}}fy.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Mo.RightClick?!1:(n==null||n({event:r}),!0)}}];const Lo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hy extends Po{constructor(t){super(t,Lo)}static setup(){return window.addEventListener(Lo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lo.move.name,t)};function t(){}}}hy.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 as;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(as||(as={}));var ui;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ui||(ui={}));function py(e){let{acceleration:t,activator:r=as.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=ui.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:g}=e;const y=yy({delta:f,disabled:!i}),[b,p]=Tg(),v=h.useRef({x:0,y:0}),m=h.useRef({x:0,y:0}),_=h.useMemo(()=>{switch(r){case as.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case as.DraggableRect:return s}},[r,s,c]),S=h.useRef(null),w=h.useCallback(()=>{const T=S.current;if(!T)return;const x=v.current.x*m.current.x,P=v.current.y*m.current.y;T.scrollBy(x,P)},[]),O=h.useMemo(()=>a===ui.TreeOrder?[...d].reverse():d,[a,d]);h.useEffect(()=>{if(!i||!d.length||!_){p();return}for(const T of O){if((n==null?void 0:n(T))===!1)continue;const x=d.indexOf(T),P=u[x];if(!P)continue;const{direction:$,speed:k}=ry(T,P,_,t,g);for(const M of["x","y"])y[M][$[M]]||(k[M]=0,$[M]=0);if(k.x>0||k.y>0){p(),S.current=T,b(w,o),v.current=k,m.current=$;return}}v.current={x:0,y:0},m.current={x:0,y:0},p()},[t,w,n,p,i,o,JSON.stringify(_),JSON.stringify(y),b,d,O,u,JSON.stringify(g)])}const gy={x:{[rt.Backward]:!1,[rt.Forward]:!1},y:{[rt.Backward]:!1,[rt.Forward]:!1}};function yy(e){let{delta:t,disabled:r}=e;const n=si(t);return ns(s=>{if(r||!n||!s)return gy;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[rt.Backward]:s.x[rt.Backward]||i.x===-1,[rt.Forward]:s.x[rt.Forward]||i.x===1},y:{[rt.Backward]:s.y[rt.Backward]||i.y===-1,[rt.Forward]:s.y[rt.Forward]||i.y===1}}},[r,t,n])}function vy(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return ns(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function my(e,t){return h.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 ls;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ls||(ls={}));var Fo;(function(e){e.Optimized="optimized"})(Fo||(Fo={}));const _c=new Map;function by(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=h.useState(null),{frequency:a,measure:c,strategy:d}=s,u=h.useRef(e),f=v(),g=rs(f),y=h.useCallback(function(m){m===void 0&&(m=[]),!g.current&&o(_=>_===null?m:_.concat(m.filter(S=>!_.includes(S))))},[g]),b=h.useRef(null),p=ns(m=>{if(f&&!r)return _c;if(!m||m===_c||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,O=w?new ko(c(w),w):null;S.rect.current=O,O&&_.set(S.id,O)}return _}return m},[e,i,r,f,c]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{f||y()},[r,f]),h.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{y(),b.current=null},a))},[a,f,y,...n]),{droppableRects:p,measureDroppableContainers:y,measuringScheduled:i!=null};function v(){switch(d){case ls.Always:return!1;case ls.BeforeDragging:return r;default:return!r}}}function $o(e,t){return ns(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function _y(e,t){return $o(e,t)}function wy(e){let{callback:t,disabled:r}=e;const n=ri(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function di(e){let{callback:t,disabled:r}=e;const n=ri(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Sy(e){return new ko(gn(e),e)}function wc(e,t,r){t===void 0&&(t=Sy);const[n,s]=h.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=wy({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=di({callback:i});return Ht(()=>{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 Cy(e){const t=$o(e);return oc(e,t)}const Sc=[];function Oy(e){const t=h.useRef(e),r=ns(n=>e?n&&n!==Sc&&e&&t.current&&e.parentNode===t.current.parentNode?n:li(e):Sc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function Ey(e){const[t,r]=h.useState(null),n=h.useRef(e),s=h.useCallback(i=>{const o=To(i.target);o&&r(a=>a?(a.set(o,No(o)),new Map(a)):null)},[]);return h.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=To(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,No(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=To(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>pn(i,o),Wt):pc(e):Wt,[e,t])}function Cc(e,t){t===void 0&&(t=[]);const r=h.useRef(null);return h.useEffect(()=>{r.current=null},t),h.useEffect(()=>{const n=e!==Wt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?is(e,r.current):Wt}function Dy(e){h.useEffect(()=>{if(!ti)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 Iy(e,t){return h.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Oc(e){return h.useMemo(()=>e?Zg(e):null,[e])}const Ec=[];function Ty(e,t){t===void 0&&(t=gn);const[r]=e,n=Oc(r?wt(r):null),[s,i]=h.useState(Ec);function o(){i(()=>e.length?e.map(c=>fc(c)?n:new ko(t(c),c)):Ec)}const a=di({callback:o});return Ht(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Dc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ts(t)?t:e}function Ny(e){let{measure:t}=e;const[r,n]=h.useState(null),s=h.useCallback(d=>{for(const{target:u}of d)if(ts(u)){n(f=>{const g=t(u);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=di({callback:s}),o=h.useCallback(d=>{const u=Dc(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=ni(o);return h.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const ky=[{sensor:ci,options:{}},{sensor:Ao,options:{}}],xy={current:{}},fi={draggable:{measure:lc},droppable:{measure:lc,strategy:ls.WhileDragging,frequency:Fo.Optimized},dragOverlay:{measure:gn}};class cs 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 Ay={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new cs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ai},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fi,measureDroppableContainers:ai,windowRect:null,measuringScheduled:!1},Ic={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ai,draggableNodes:new Map,over:null,measureDroppableContainers:ai},us=h.createContext(Ic),Tc=h.createContext(Ay);function Py(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new cs}}}function My(e,t){switch(t.type){case et.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case et.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 et.DragEnd:case et.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case et.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new cs(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case et.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 cs(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case et.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new cs(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Ly(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=h.useContext(us),i=si(n),o=si(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!ii(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=xg(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Nc(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Fy(e){return h.useMemo(()=>({draggable:{...fi.draggable,...e==null?void 0:e.draggable},droppable:{...fi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...fi.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 $y(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=h.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Ht(()=>{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=oc(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=cc(d);g&&g.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const hi=h.createContext({...Wt,scaleX:1,scaleY:1});var Or;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Or||(Or={}));const kc=h.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=ky,collisionDetection:f=Kg,measuring:g,modifiers:y,...b}=t;const p=h.useReducer(My,void 0,Py),[v,m]=p,[_,S]=$g(),[w,O]=h.useState(Or.Uninitialized),T=w===Or.Initialized,{draggable:{active:x,nodes:P,translate:$},droppable:{containers:k}}=v,M=x!=null?P.get(x):null,B=h.useRef({initial:null,translated:null}),A=h.useMemo(()=>{var ot;return x!=null?{id:x,data:(ot=M==null?void 0:M.data)!=null?ot:xy,rect:B}:null},[x,M]),j=h.useRef(null),[F,Z]=h.useState(null),[ae,me]=h.useState(null),Oe=rs(b,Object.values(b)),pe=ss("DndDescribedBy",o),K=h.useMemo(()=>k.getEnabled(),[k]),J=Fy(g),{droppableRects:se,measureDroppableContainers:U,measuringScheduled:R}=by(K,{dragging:T,dependencies:[$.x,$.y],config:J.droppable}),Q=vy(P,x),ue=h.useMemo(()=>ae?oi(ae):null,[ae]),Ee=dn(),je=_y(Q,J.draggable.measure);$y({activeNode:x!=null?P.get(x):null,config:Ee.layoutShiftCompensation,initialRect:je,measure:J.draggable.measure});const ye=wc(Q,J.draggable.measure,je),ce=wc(Q?Q.parentElement:null),ge=h.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Le=k.getNodeFor((r=ge.current.over)==null?void 0:r.id),Ve=Ny({measure:J.dragOverlay.measure}),ke=(n=Ve.nodeRef.current)!=null?n:Q,ee=T?(s=Ve.rect)!=null?s:ye:null,Ke=!!(Ve.nodeRef.current&&Ve.rect),tt=Cy(Ke?null:ye),H=Oc(ke?wt(ke):null),re=Oy(T?Le??Q:null),ie=Ty(re),Re=Nc(y,{transform:{x:$.x-tt.x,y:$.y-tt.y,scaleX:1,scaleY:1},activatorEvent:ae,active:A,activeNodeRect:ye,containerNodeRect:ce,draggingNodeRect:ee,over:ge.current.over,overlayNodeRect:Ve.rect,scrollableAncestors:re,scrollableAncestorRects:ie,windowRect:H}),pr=ue?pn(ue,$):null,gr=Ey(re),un=Cc(gr),Gn=Cc(gr,[ye]),C=pn(Re,un),I=ee?Yg(ee,Re):null,N=A&&I?f({active:A,collisionRect:I,droppableRects:se,droppableContainers:K,pointerCoordinates:pr}):null,z=sc(N,"id"),[V,G]=h.useState(null),q=Ke?Re:pn(Re,Gn),te=Qg(q,(i=V==null?void 0:V.rect)!=null?i:null,ye),ve=h.useRef(null),Qe=h.useCallback((ot,_t)=>{let{sensor:Ct,options:Zt}=_t;if(j.current==null)return;const qt=P.get(j.current);if(!qt)return;const Ft=ot.nativeEvent,lr=new Ct({active:j.current,activeNode:qt,event:Ft,options:Zt,context:ge,onAbort(dt){if(!P.get(dt))return;const{onDragAbort:cr}=Oe.current,vr={id:dt};cr==null||cr(vr),_({type:"onDragAbort",event:vr})},onPending(dt,Fr,cr,vr){if(!P.get(dt))return;const{onDragPending:qs}=Oe.current,$r={id:dt,constraint:Fr,initialCoordinates:cr,offset:vr};qs==null||qs($r),_({type:"onDragPending",event:$r})},onStart(dt){const Fr=j.current;if(Fr==null)return;const cr=P.get(Fr);if(!cr)return;const{onDragStart:vr}=Oe.current,Vs={activatorEvent:Ft,active:{id:Fr,data:cr.data,rect:B}};qe.unstable_batchedUpdates(()=>{vr==null||vr(Vs),O(Or.Initializing),m({type:et.DragStart,initialCoordinates:dt,active:Fr}),_({type:"onDragStart",event:Vs}),Z(ve.current),me(Ft)})},onMove(dt){m({type:et.DragMove,coordinates:dt})},onEnd:Yn(et.DragEnd),onCancel:Yn(et.DragCancel)});ve.current=lr;function Yn(dt){return async function(){const{active:cr,collisions:vr,over:Vs,scrollAdjustedTranslate:qs}=ge.current;let $r=null;if(cr&&qs){const{cancelDrop:Hs}=Oe.current;$r={activatorEvent:Ft,active:cr,collisions:vr,delta:qs,over:Vs},dt===et.DragEnd&&typeof Hs=="function"&&await Promise.resolve(Hs($r))&&(dt=et.DragCancel)}j.current=null,qe.unstable_batchedUpdates(()=>{m({type:dt}),O(Or.Uninitialized),G(null),Z(null),me(null),ve.current=null;const Hs=dt===et.DragEnd?"onDragEnd":"onDragCancel";if($r){const pl=Oe.current[Hs];pl==null||pl($r),_({type:Hs,event:$r})}})}}},[P]),Nt=h.useCallback((ot,_t)=>(Ct,Zt)=>{const qt=Ct.nativeEvent,Ft=P.get(Zt);if(j.current!==null||!Ft||qt.dndKit||qt.defaultPrevented)return;const lr={active:Ft};ot(Ct,_t.options,lr)===!0&&(qt.dndKit={capturedBy:_t.sensor},j.current=Zt,Qe(Ct,_t))},[P,Qe]),kt=my(u,Nt);Dy(u),Ht(()=>{ye&&w===Or.Initializing&&O(Or.Initialized)},[ye,w]),h.useEffect(()=>{const{onDragMove:ot}=Oe.current,{active:_t,activatorEvent:Ct,collisions:Zt,over:qt}=ge.current;if(!_t||!Ct)return;const Ft={active:_t,activatorEvent:Ct,collisions:Zt,delta:{x:C.x,y:C.y},over:qt};qe.unstable_batchedUpdates(()=>{ot==null||ot(Ft),_({type:"onDragMove",event:Ft})})},[C.x,C.y]),h.useEffect(()=>{const{active:ot,activatorEvent:_t,collisions:Ct,droppableContainers:Zt,scrollAdjustedTranslate:qt}=ge.current;if(!ot||j.current==null||!_t||!qt)return;const{onDragOver:Ft}=Oe.current,lr=Zt.get(z),Yn=lr&&lr.rect.current?{id:lr.id,rect:lr.rect.current,data:lr.data,disabled:lr.disabled}:null,dt={active:ot,activatorEvent:_t,collisions:Ct,delta:{x:qt.x,y:qt.y},over:Yn};qe.unstable_batchedUpdates(()=>{G(Yn),Ft==null||Ft(dt),_({type:"onDragOver",event:dt})})},[z]),Ht(()=>{ge.current={activatorEvent:ae,active:A,activeNode:Q,collisionRect:I,collisions:N,droppableRects:se,draggableNodes:P,draggingNode:ke,draggingNodeRect:ee,droppableContainers:k,over:V,scrollableAncestors:re,scrollAdjustedTranslate:C},B.current={initial:ee,translated:I}},[A,Q,N,I,P,ke,ee,se,k,V,re,C]),py({...Ee,delta:$,draggingRect:I,pointerCoordinates:pr,scrollableAncestors:re,scrollableAncestorRects:ie});const yr=h.useMemo(()=>({active:A,activeNode:Q,activeNodeRect:ye,activatorEvent:ae,collisions:N,containerNodeRect:ce,dragOverlay:Ve,draggableNodes:P,droppableContainers:k,droppableRects:se,over:V,measureDroppableContainers:U,scrollableAncestors:re,scrollableAncestorRects:ie,measuringConfiguration:J,measuringScheduled:R,windowRect:H}),[A,Q,ye,ae,N,ce,Ve,P,k,se,V,U,re,ie,J,R,H]),zs=h.useMemo(()=>({activatorEvent:ae,activators:kt,active:A,activeNodeRect:ye,ariaDescribedById:{draggable:pe},dispatch:m,draggableNodes:P,over:V,measureDroppableContainers:U}),[ae,kt,A,ye,m,pe,P,V,U]);return h.createElement(Jl.Provider,{value:S},h.createElement(us.Provider,{value:zs},h.createElement(Tc.Provider,{value:yr},h.createElement(hi.Provider,{value:te},d)),h.createElement(Ly,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(Ug,{...a,hiddenTextDescribedById:pe}));function dn(){const ot=(F==null?void 0:F.autoScrollEnabled)===!1,_t=typeof c=="object"?c.enabled===!1:c===!1,Ct=T&&!ot&&!_t;return typeof c=="object"?{...c,enabled:Ct}:{enabled:Ct}}}),jy=h.createContext(null),xc="button",By="Draggable";function Ac(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=ss(By),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:g}=h.useContext(us),{role:y=xc,roleDescription:b="draggable",tabIndex:p=0}=s??{},v=(c==null?void 0:c.id)===t,m=h.useContext(v?hi:jy),[_,S]=ni(),[w,O]=ni(),T=Iy(o,t),x=rs(r);Ht(()=>(f.set(t,{id:t,key:i,node:_,activatorNode:w,data:x}),()=>{const $=f.get(t);$&&$.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:y,tabIndex:p,"aria-disabled":n,"aria-pressed":v&&y===xc?!0:void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[n,y,p,v,b,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:P,isDragging:v,listeners:n?void 0:T,node:_,over:g,setNodeRef:S,setActivatorNodeRef:O,transform:m}}function Pc(){return h.useContext(Tc)}const Uy="Droppable",zy={timeout:25};function Vy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=ss(Uy),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=h.useContext(us),u=h.useRef({disabled:r}),f=h.useRef(!1),g=h.useRef(null),y=h.useRef(null),{disabled:b,updateMeasurementsFor:p,timeout:v}={...zy,...s},m=rs(p??n),_=h.useCallback(()=>{if(!f.current){f.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),y.current=null},v)},[v]),S=di({callback:_,disabled:b||!o}),w=h.useCallback((P,$)=>{S&&($&&(S.unobserve($),f.current=!1),P&&S.observe(P))},[S]),[O,T]=ni(w),x=rs(t);return h.useEffect(()=>{!S||!O.current||(S.disconnect(),f.current=!1,S.observe(O.current))},[O,S]),h.useEffect(()=>(a({type:et.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:g,data:x}}),()=>a({type:et.UnregisterDroppable,key:i,id:n})),[n]),h.useEffect(()=>{r!==u.current.disabled&&(a({type:et.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:O,over:c,setNodeRef:T}}function qy(e){let{animation:t,children:r}=e;const[n,s]=h.useState(null),[i,o]=h.useState(null),a=si(r);return!r&&!n&&a&&s(a),Ht(()=>{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]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:o}):null)}const Hy={x:0,y:0,scaleX:1,scaleY:1};function Wy(e){let{children:t}=e;return h.createElement(us.Provider,{value:Ic},h.createElement(hi.Provider,{value:Hy},t))}const Ky={position:"fixed",touchAction:"none"},Qy=e=>ii(e)?"transform 250ms ease":void 0,Gy=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=Qy}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...Ky,width:a.width,height:a.height,top:a.top,left:a.left,transform:Cr.Transform.toString(f),transformOrigin:s&&n?zg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return h.createElement(r,{className:o,style:g,ref:t},i)}),Yy={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Cr.Transform.toString(t)},{transform:Cr.Transform.toString(r)}]},sideEffects:(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)}})({styles:{active:{opacity:"0"}}})};function Ry(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return ri((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=Dc(o);if(!d)return;const{transform:u}=wt(o).getComputedStyle(o),f=ac(u);if(!f)return;const g=typeof t=="function"?t:Xy(t);return gc(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 Xy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Yy,...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},y=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:g}}),[b]=y,p=y[y.length-1];if(JSON.stringify(b)===JSON.stringify(p))return;const v=n==null?void 0:n({active:o,dragOverlay:a,...d}),m=a.node.animate(y,{duration:t,easing:r,fill:"forwards"});return new Promise(_=>{m.onfinish=()=>{v==null||v(),_()}})}}let Mc=0;function Zy(e){return h.useMemo(()=>{if(e!=null)return Mc++,Mc},[e])}const Jy=h.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:y,draggableNodes:b,droppableContainers:p,dragOverlay:v,over:m,measuringConfiguration:_,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:O}=Pc(),T=h.useContext(hi),x=Zy(f==null?void 0:f.id),P=Nc(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:T,windowRect:O}),$=$o(g),k=Ry({config:n,draggableNodes:b,droppableContainers:p,measuringConfiguration:_}),M=$?v.setRef:void 0;return h.createElement(Wy,null,h.createElement(qy,{animation:k},f&&x?h.createElement(Gy,{key:x,id:f.id,ref:M,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:d,...s},transform:P},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 Rg(e){let{announcements:t=Yg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Gg}=e;const{announce:i,announcement:o}=Wg(),a=os("DndLiveRegion"),[c,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),Kg(h.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:y}=f;t.onDragMove&&i(t.onDragMove({active:g,over:y}))},onDragOver(f){let{active:g,over:y}=f;i(t.onDragOver({active:g,over:y}))},onDragEnd(f){let{active:g,over:y}=f;i(t.onDragEnd({active:g,over:y}))},onDragCancel(f){let{active:g,over:y}=f;i(t.onDragCancel({active:g,over:y}))}}),[i,t])),!c)return null;const u=h.createElement(h.Fragment,null,h.createElement(qg,{id:n,value:s.draggable}),h.createElement(Hg,{id:a,announcement:o}));return r?Pe.createPortal(u,r):u}var et;(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"})(et||(et={}));function ci(){}function xo(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function sc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return h.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Kt=Object.freeze({x:0,y:0});function ic(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xg(e,t){const r=li(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 oc(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Zg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function ac(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 lc(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function cc(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 Jg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=cc(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=ic(cc(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(oc)},ey=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=ac(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=ac(c),u=s.reduce((g,y,b)=>g+ic(d[b],y),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(oc)};function ty(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 ry=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=ty(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Zg)};function ny(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function uc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Kt}function sy(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 iy=sy(1);function dc(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 oy(e,t,r){const n=dc(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 ay={ignoreTransform:!1};function yn(e,t){t===void 0&&(t=ay);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=St(e).getComputedStyle(e);d&&(r=oy(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 fc(e){return yn(e,{ignoreTransform:!0})}function ly(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function cy(e,t){return t===void 0&&(t=St(e).getComputedStyle(e)),t.position==="fixed"}function uy(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 ui(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(No(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!ns(s)||ec(s)||r.includes(s))return r;const i=St(e).getComputedStyle(s);return s!==e&&uy(s,i)&&r.push(s),cy(s,i)?r:n(s.parentNode)}return e?n(e):r}function hc(e){const[t]=ui(e,1);return t??null}function Ao(e){return!ni||!e?null:hn(e)?e:To(e)?No(e)||e===pn(e).scrollingElement?window:ns(e)?e:null:null}function pc(e){return hn(e)?e.scrollX:e.scrollLeft}function gc(e){return hn(e)?e.scrollY:e.scrollTop}function Po(e){return{x:pc(e),y:gc(e)}}var rt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(rt||(rt={}));function yc(e){return!ni||!e?!1:e===document.scrollingElement}function vc(e){const t={x:0,y:0},r=yc(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 dy={x:.2,y:.2};function fy(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=dy);const{isTop:d,isBottom:u,isLeft:f,isRight:g}=vc(e),y={x:0,y:0},b={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+p.height?(y.y=rt.Backward,b.y=n*Math.abs((t.top+p.height-i)/p.height)):!u&&c>=t.bottom-p.height&&(y.y=rt.Forward,b.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!g&&a>=t.right-p.width?(y.x=rt.Forward,b.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(y.x=rt.Backward,b.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:y,speed:b}}function hy(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 mc(e){return e.reduce((t,r)=>gn(t,Po(r)),Kt)}function py(e){return e.reduce((t,r)=>t+pc(r),0)}function gy(e){return e.reduce((t,r)=>t+gc(r),0)}function bc(e,t){if(t===void 0&&(t=yn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);hc(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const yy=[["x",["left","right"],py],["y",["top","bottom"],gy]];class Lo{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=ui(r),s=mc(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of yy)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 ls{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 vy(e){const{EventTarget:t}=St(e);return e instanceof t?e:pn(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 jt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(jt||(jt={}));function _c(e){e.preventDefault()}function my(e){e.stopPropagation()}var Se;(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"})(Se||(Se={}));const wc={start:[Se.Space,Se.Enter],cancel:[Se.Esc],end:[Se.Space,Se.Enter,Se.Tab]},by=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Se.Right:return{...r,x:r.x+25};case Se.Left:return{...r,x:r.x-25};case Se.Down:return{...r,y:r.y+25};case Se.Up:return{...r,y:r.y-25}}};class Fo{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 ls(pn(r)),this.windowListeners=new ls(St(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(jt.Resize,this.handleCancel),this.windowListeners.add(jt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(jt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&bc(n),r(Kt)}handleKeyDown(t){if(ai(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=wc,coordinateGetter:o=by,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}:Kt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const g=as(f,u),y={x:0,y:0},{scrollableAncestors:b}=n.current;for(const p of b){const v=t.code,{isTop:m,isRight:_,isLeft:S,isBottom:w,maxScroll:E,minScroll:T}=vc(p),x=hy(p),P={x:Math.min(v===Se.Right?x.right-x.width/2:x.right,Math.max(v===Se.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(v===Se.Down?x.bottom-x.height/2:x.bottom,Math.max(v===Se.Down?x.top:x.top+x.height/2,f.y))},$=v===Se.Right&&!_||v===Se.Left&&!S,k=v===Se.Down&&!w||v===Se.Up&&!m;if($&&P.x!==f.x){const L=p.scrollLeft+g.x,B=v===Se.Right&&L<=E.x||v===Se.Left&&L>=T.x;if(B&&!g.y){p.scrollTo({left:L,behavior:a});return}B?y.x=p.scrollLeft-L:y.x=v===Se.Right?p.scrollLeft-E.x:p.scrollLeft-T.x,y.x&&p.scrollBy({left:-y.x,behavior:a});break}else if(k&&P.y!==f.y){const L=p.scrollTop+g.y,B=v===Se.Down&&L<=E.y||v===Se.Up&&L>=T.y;if(B&&!g.x){p.scrollTo({top:L,behavior:a});return}B?y.y=p.scrollTop-L:y.y=v===Se.Down?p.scrollTop-E.y:p.scrollTop-T.y,y.y&&p.scrollBy({top:-y.y,behavior:a});break}}this.handleMove(t,gn(as(f,this.referenceCoordinates),y))}}}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()}}Fo.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=wc,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 Sc(e){return!!(e&&"distance"in e)}function Cc(e){return!!(e&&"delay"in e)}class $o{constructor(t,r,n){var s;n===void 0&&(n=vy(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=pn(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(St(o)),this.initialCoordinates=(s=li(i))!=null?s:Kt,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(jt.Resize,this.handleCancel),this.windowListeners.add(jt.DragStart,_c),this.windowListeners.add(jt.VisibilityChange,this.handleCancel),this.windowListeners.add(jt.ContextMenu,_c),this.documentListeners.add(jt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Sc(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(jt.Click,my,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(jt.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=li(t))!=null?r:Kt,d=as(s,c);if(!n&&a){if(Sc(a)){if(a.tolerance!=null&&Mo(d,a.tolerance))return this.handleCancel();if(Mo(d,a.distance))return this.handleStart()}if(Cc(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===Se.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const _y={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class di extends $o{constructor(t){const{event:r}=t,n=pn(r.target);super(t,_y,n)}}di.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 wy={move:{name:"mousemove"},end:{name:"mouseup"}};var jo;(function(e){e[e.RightClick=2]="RightClick"})(jo||(jo={}));class Sy extends $o{constructor(t){super(t,wy,pn(t.event.target))}}Sy.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===jo.RightClick?!1:(n==null||n({event:r}),!0)}}];const Bo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Cy extends $o{constructor(t){super(t,Bo)}static setup(){return window.addEventListener(Bo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Bo.move.name,t)};function t(){}}}Cy.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 cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var fi;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(fi||(fi={}));function Ey(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=fi.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:g}=e;const y=Dy({delta:f,disabled:!i}),[b,p]=jg(),v=h.useRef({x:0,y:0}),m=h.useRef({x:0,y:0}),_=h.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),S=h.useRef(null),w=h.useCallback(()=>{const T=S.current;if(!T)return;const x=v.current.x*m.current.x,P=v.current.y*m.current.y;T.scrollBy(x,P)},[]),E=h.useMemo(()=>a===fi.TreeOrder?[...d].reverse():d,[a,d]);h.useEffect(()=>{if(!i||!d.length||!_){p();return}for(const T of E){if((n==null?void 0:n(T))===!1)continue;const x=d.indexOf(T),P=u[x];if(!P)continue;const{direction:$,speed:k}=fy(T,P,_,t,g);for(const L of["x","y"])y[L][$[L]]||(k[L]=0,$[L]=0);if(k.x>0||k.y>0){p(),S.current=T,b(w,o),v.current=k,m.current=$;return}}v.current={x:0,y:0},m.current={x:0,y:0},p()},[t,w,n,p,i,o,JSON.stringify(_),JSON.stringify(y),b,d,E,u,JSON.stringify(g)])}const Oy={x:{[rt.Backward]:!1,[rt.Forward]:!1},y:{[rt.Backward]:!1,[rt.Forward]:!1}};function Dy(e){let{delta:t,disabled:r}=e;const n=oi(t);return is(s=>{if(r||!n||!s)return Oy;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[rt.Backward]:s.x[rt.Backward]||i.x===-1,[rt.Forward]:s.x[rt.Forward]||i.x===1},y:{[rt.Backward]:s.y[rt.Backward]||i.y===-1,[rt.Forward]:s.y[rt.Forward]||i.y===1}}},[r,t,n])}function Iy(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return is(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function Ty(e,t){return h.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 us;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(us||(us={}));var Uo;(function(e){e.Optimized="optimized"})(Uo||(Uo={}));const Ec=new Map;function Ny(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=h.useState(null),{frequency:a,measure:c,strategy:d}=s,u=h.useRef(e),f=v(),g=ss(f),y=h.useCallback(function(m){m===void 0&&(m=[]),!g.current&&o(_=>_===null?m:_.concat(m.filter(S=>!_.includes(S))))},[g]),b=h.useRef(null),p=is(m=>{if(f&&!r)return Ec;if(!m||m===Ec||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,E=w?new Lo(c(w),w):null;S.rect.current=E,E&&_.set(S.id,E)}return _}return m},[e,i,r,f,c]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{f||y()},[r,f]),h.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{y(),b.current=null},a))},[a,f,y,...n]),{droppableRects:p,measureDroppableContainers:y,measuringScheduled:i!=null};function v(){switch(d){case us.Always:return!1;case us.BeforeDragging:return r;default:return!r}}}function zo(e,t){return is(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ky(e,t){return zo(e,t)}function xy(e){let{callback:t,disabled:r}=e;const n=si(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function hi(e){let{callback:t,disabled:r}=e;const n=si(t),s=h.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return h.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Ay(e){return new Lo(yn(e),e)}function Oc(e,t,r){t===void 0&&(t=Ay);const[n,s]=h.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=xy({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=hi({callback:i});return Wt(()=>{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 Py(e){const t=zo(e);return uc(e,t)}const Dc=[];function Ly(e){const t=h.useRef(e),r=is(n=>e?n&&n!==Dc&&e&&t.current&&e.parentNode===t.current.parentNode?n:ui(e):Dc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function My(e){const[t,r]=h.useState(null),n=h.useRef(e),s=h.useCallback(i=>{const o=Ao(i.target);o&&r(a=>a?(a.set(o,Po(o)),new Map(a)):null)},[]);return h.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=Ao(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,Po(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=Ao(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>gn(i,o),Kt):mc(e):Kt,[e,t])}function Ic(e,t){t===void 0&&(t=[]);const r=h.useRef(null);return h.useEffect(()=>{r.current=null},t),h.useEffect(()=>{const n=e!==Kt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?as(e,r.current):Kt}function Fy(e){h.useEffect(()=>{if(!ni)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 $y(e,t){return h.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Tc(e){return h.useMemo(()=>e?ly(e):null,[e])}const Nc=[];function jy(e,t){t===void 0&&(t=yn);const[r]=e,n=Tc(r?St(r):null),[s,i]=h.useState(Nc);function o(){i(()=>e.length?e.map(c=>yc(c)?n:new Lo(t(c),c)):Nc)}const a=hi({callback:o});return Wt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function kc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ns(t)?t:e}function By(e){let{measure:t}=e;const[r,n]=h.useState(null),s=h.useCallback(d=>{for(const{target:u}of d)if(ns(u)){n(f=>{const g=t(u);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=hi({callback:s}),o=h.useCallback(d=>{const u=kc(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=ii(o);return h.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Uy=[{sensor:di,options:{}},{sensor:Fo,options:{}}],zy={current:{}},pi={draggable:{measure:fc},droppable:{measure:fc,strategy:us.WhileDragging,frequency:Uo.Optimized},dragOverlay:{measure:yn}};class ds 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 Vy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ds,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ci},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pi,measureDroppableContainers:ci,windowRect:null,measuringScheduled:!1},xc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ci,draggableNodes:new Map,over:null,measureDroppableContainers:ci},fs=h.createContext(xc),Ac=h.createContext(Vy);function qy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ds}}}function Hy(e,t){switch(t.type){case et.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case et.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 et.DragEnd:case et.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case et.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new ds(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case et.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 ds(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case et.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new ds(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Wy(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=h.useContext(fs),i=oi(n),o=oi(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!ai(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 Pc(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Ky(e){return h.useMemo(()=>({draggable:{...pi.draggable,...e==null?void 0:e.draggable},droppable:{...pi.droppable,...e==null?void 0:e.droppable},dragOverlay:{...pi.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 Qy(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=h.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Wt(()=>{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=uc(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=hc(d);g&&g.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const gi=h.createContext({...Kt,scaleX:1,scaleY:1});var Or;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Or||(Or={}));const Lc=h.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Uy,collisionDetection:f=ry,measuring:g,modifiers:y,...b}=t;const p=h.useReducer(Hy,void 0,qy),[v,m]=p,[_,S]=Qg(),[w,E]=h.useState(Or.Uninitialized),T=w===Or.Initialized,{draggable:{active:x,nodes:P,translate:$},droppable:{containers:k}}=v,L=x!=null?P.get(x):null,B=h.useRef({initial:null,translated:null}),A=h.useMemo(()=>{var at;return x!=null?{id:x,data:(at=L==null?void 0:L.data)!=null?at:zy,rect:B}:null},[x,L]),j=h.useRef(null),[F,Z]=h.useState(null),[ae,be]=h.useState(null),Ee=ss(b,Object.values(b)),pe=os("DndDescribedBy",o),K=h.useMemo(()=>k.getEnabled(),[k]),J=Ky(g),{droppableRects:se,measureDroppableContainers:U,measuringScheduled:R}=Ny(K,{dragging:T,dependencies:[$.x,$.y],config:J.droppable}),Q=Iy(P,x),ue=h.useMemo(()=>ae?li(ae):null,[ae]),Oe=fn(),Be=ky(Q,J.draggable.measure);Qy({activeNode:x!=null?P.get(x):null,config:Oe.layoutShiftCompensation,initialRect:Be,measure:J.draggable.measure});const ve=Oc(Q,J.draggable.measure,Be),ce=Oc(Q?Q.parentElement:null),ge=h.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),$e=k.getNodeFor((r=ge.current.over)==null?void 0:r.id),qe=By({measure:J.dragOverlay.measure}),ke=(n=qe.nodeRef.current)!=null?n:Q,ee=T?(s=qe.rect)!=null?s:ve:null,Ke=!!(qe.nodeRef.current&&qe.rect),tt=Py(Ke?null:ve),H=Tc(ke?St(ke):null),re=Ly(T?$e??Q:null),ie=jy(re),Re=Pc(y,{transform:{x:$.x-tt.x,y:$.y-tt.y,scaleX:1,scaleY:1},activatorEvent:ae,active:A,activeNodeRect:ve,containerNodeRect:ce,draggingNodeRect:ee,over:ge.current.over,overlayNodeRect:qe.rect,scrollableAncestors:re,scrollableAncestorRects:ie,windowRect:H}),gr=ue?gn(ue,$):null,yr=My(re),dn=Ic(yr),Yn=Ic(yr,[ve]),C=gn(Re,dn),I=ee?iy(ee,Re):null,N=A&&I?f({active:A,collisionRect:I,droppableRects:se,droppableContainers:K,pointerCoordinates:gr}):null,z=lc(N,"id"),[V,G]=h.useState(null),q=Ke?Re:gn(Re,Yn),te=ny(q,(i=V==null?void 0:V.rect)!=null?i:null,ve),me=h.useRef(null),Qe=h.useCallback((at,wt)=>{let{sensor:Et,options:Jt}=wt;if(j.current==null)return;const Ht=P.get(j.current);if(!Ht)return;const $t=at.nativeEvent,cr=new Et({active:j.current,activeNode:Ht,event:$t,options:Jt,context:ge,onAbort(ft){if(!P.get(ft))return;const{onDragAbort:ur}=Ee.current,mr={id:ft};ur==null||ur(mr),_({type:"onDragAbort",event:mr})},onPending(ft,$r,ur,mr){if(!P.get(ft))return;const{onDragPending:Ws}=Ee.current,jr={id:ft,constraint:$r,initialCoordinates:ur,offset:mr};Ws==null||Ws(jr),_({type:"onDragPending",event:jr})},onStart(ft){const $r=j.current;if($r==null)return;const ur=P.get($r);if(!ur)return;const{onDragStart:mr}=Ee.current,Hs={activatorEvent:$t,active:{id:$r,data:ur.data,rect:B}};Pe.unstable_batchedUpdates(()=>{mr==null||mr(Hs),E(Or.Initializing),m({type:et.DragStart,initialCoordinates:ft,active:$r}),_({type:"onDragStart",event:Hs}),Z(me.current),be($t)})},onMove(ft){m({type:et.DragMove,coordinates:ft})},onEnd:Rn(et.DragEnd),onCancel:Rn(et.DragCancel)});me.current=cr;function Rn(ft){return async function(){const{active:ur,collisions:mr,over:Hs,scrollAdjustedTranslate:Ws}=ge.current;let jr=null;if(ur&&Ws){const{cancelDrop:Ks}=Ee.current;jr={activatorEvent:$t,active:ur,collisions:mr,delta:Ws,over:Hs},ft===et.DragEnd&&typeof Ks=="function"&&await Promise.resolve(Ks(jr))&&(ft=et.DragCancel)}j.current=null,Pe.unstable_batchedUpdates(()=>{m({type:ft}),E(Or.Uninitialized),G(null),Z(null),be(null),me.current=null;const Ks=ft===et.DragEnd?"onDragEnd":"onDragCancel";if(jr){const ml=Ee.current[Ks];ml==null||ml(jr),_({type:Ks,event:jr})}})}}},[P]),kt=h.useCallback((at,wt)=>(Et,Jt)=>{const Ht=Et.nativeEvent,$t=P.get(Jt);if(j.current!==null||!$t||Ht.dndKit||Ht.defaultPrevented)return;const cr={active:$t};at(Et,wt.options,cr)===!0&&(Ht.dndKit={capturedBy:wt.sensor},j.current=Jt,Qe(Et,wt))},[P,Qe]),xt=Ty(u,kt);Fy(u),Wt(()=>{ve&&w===Or.Initializing&&E(Or.Initialized)},[ve,w]),h.useEffect(()=>{const{onDragMove:at}=Ee.current,{active:wt,activatorEvent:Et,collisions:Jt,over:Ht}=ge.current;if(!wt||!Et)return;const $t={active:wt,activatorEvent:Et,collisions:Jt,delta:{x:C.x,y:C.y},over:Ht};Pe.unstable_batchedUpdates(()=>{at==null||at($t),_({type:"onDragMove",event:$t})})},[C.x,C.y]),h.useEffect(()=>{const{active:at,activatorEvent:wt,collisions:Et,droppableContainers:Jt,scrollAdjustedTranslate:Ht}=ge.current;if(!at||j.current==null||!wt||!Ht)return;const{onDragOver:$t}=Ee.current,cr=Jt.get(z),Rn=cr&&cr.rect.current?{id:cr.id,rect:cr.rect.current,data:cr.data,disabled:cr.disabled}:null,ft={active:at,activatorEvent:wt,collisions:Et,delta:{x:Ht.x,y:Ht.y},over:Rn};Pe.unstable_batchedUpdates(()=>{G(Rn),$t==null||$t(ft),_({type:"onDragOver",event:ft})})},[z]),Wt(()=>{ge.current={activatorEvent:ae,active:A,activeNode:Q,collisionRect:I,collisions:N,droppableRects:se,draggableNodes:P,draggingNode:ke,draggingNodeRect:ee,droppableContainers:k,over:V,scrollableAncestors:re,scrollAdjustedTranslate:C},B.current={initial:ee,translated:I}},[A,Q,N,I,P,ke,ee,se,k,V,re,C]),Ey({...Oe,delta:$,draggingRect:I,pointerCoordinates:gr,scrollableAncestors:re,scrollableAncestorRects:ie});const vr=h.useMemo(()=>({active:A,activeNode:Q,activeNodeRect:ve,activatorEvent:ae,collisions:N,containerNodeRect:ce,dragOverlay:qe,draggableNodes:P,droppableContainers:k,droppableRects:se,over:V,measureDroppableContainers:U,scrollableAncestors:re,scrollableAncestorRects:ie,measuringConfiguration:J,measuringScheduled:R,windowRect:H}),[A,Q,ve,ae,N,ce,qe,P,k,se,V,U,re,ie,J,R,H]),qs=h.useMemo(()=>({activatorEvent:ae,activators:xt,active:A,activeNodeRect:ve,ariaDescribedById:{draggable:pe},dispatch:m,draggableNodes:P,over:V,measureDroppableContainers:U}),[ae,xt,A,ve,m,pe,P,V,U]);return h.createElement(nc.Provider,{value:S},h.createElement(fs.Provider,{value:qs},h.createElement(Ac.Provider,{value:vr},h.createElement(gi.Provider,{value:te},d)),h.createElement(Wy,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(Rg,{...a,hiddenTextDescribedById:pe}));function fn(){const at=(F==null?void 0:F.autoScrollEnabled)===!1,wt=typeof c=="object"?c.enabled===!1:c===!1,Et=T&&!at&&!wt;return typeof c=="object"?{...c,enabled:Et}:{enabled:Et}}}),Gy=h.createContext(null),Mc="button",Yy="Draggable";function Fc(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=os(Yy),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:g}=h.useContext(fs),{role:y=Mc,roleDescription:b="draggable",tabIndex:p=0}=s??{},v=(c==null?void 0:c.id)===t,m=h.useContext(v?gi:Gy),[_,S]=ii(),[w,E]=ii(),T=$y(o,t),x=ss(r);Wt(()=>(f.set(t,{id:t,key:i,node:_,activatorNode:w,data:x}),()=>{const $=f.get(t);$&&$.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:y,tabIndex:p,"aria-disabled":n,"aria-pressed":v&&y===Mc?!0:void 0,"aria-roledescription":b,"aria-describedby":u.draggable}),[n,y,p,v,b,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:P,isDragging:v,listeners:n?void 0:T,node:_,over:g,setNodeRef:S,setActivatorNodeRef:E,transform:m}}function $c(){return h.useContext(Ac)}const Ry="Droppable",Xy={timeout:25};function Zy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=os(Ry),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=h.useContext(fs),u=h.useRef({disabled:r}),f=h.useRef(!1),g=h.useRef(null),y=h.useRef(null),{disabled:b,updateMeasurementsFor:p,timeout:v}={...Xy,...s},m=ss(p??n),_=h.useCallback(()=>{if(!f.current){f.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),y.current=null},v)},[v]),S=hi({callback:_,disabled:b||!o}),w=h.useCallback((P,$)=>{S&&($&&(S.unobserve($),f.current=!1),P&&S.observe(P))},[S]),[E,T]=ii(w),x=ss(t);return h.useEffect(()=>{!S||!E.current||(S.disconnect(),f.current=!1,S.observe(E.current))},[E,S]),h.useEffect(()=>(a({type:et.RegisterDroppable,element:{id:n,key:i,disabled:r,node:E,rect:g,data:x}}),()=>a({type:et.UnregisterDroppable,key:i,id:n})),[n]),h.useEffect(()=>{r!==u.current.disabled&&(a({type:et.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:E,over:c,setNodeRef:T}}function Jy(e){let{animation:t,children:r}=e;const[n,s]=h.useState(null),[i,o]=h.useState(null),a=oi(r);return!r&&!n&&a&&s(a),Wt(()=>{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]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:o}):null)}const ev={x:0,y:0,scaleX:1,scaleY:1};function tv(e){let{children:t}=e;return h.createElement(fs.Provider,{value:xc},h.createElement(gi.Provider,{value:ev},t))}const rv={position:"fixed",touchAction:"none"},nv=e=>ai(e)?"transform 250ms ease":void 0,sv=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=nv}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...rv,width:a.width,height:a.height,top:a.top,left:a.left,transform:Er.Transform.toString(f),transformOrigin:s&&n?Xg(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return h.createElement(r,{className:o,style:g,ref:t},i)}),iv={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Er.Transform.toString(t)},{transform:Er.Transform.toString(r)}]},sideEffects:(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)}})({styles:{active:{opacity:"0"}}})};function ov(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return si((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=kc(o);if(!d)return;const{transform:u}=St(o).getComputedStyle(o),f=dc(u);if(!f)return;const g=typeof t=="function"?t:av(t);return bc(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 av(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...iv,...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},y=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:g}}),[b]=y,p=y[y.length-1];if(JSON.stringify(b)===JSON.stringify(p))return;const v=n==null?void 0:n({active:o,dragOverlay:a,...d}),m=a.node.animate(y,{duration:t,easing:r,fill:"forwards"});return new Promise(_=>{m.onfinish=()=>{v==null||v(),_()}})}}let jc=0;function lv(e){return h.useMemo(()=>{if(e!=null)return jc++,jc},[e])}const cv=h.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:y,draggableNodes:b,droppableContainers:p,dragOverlay:v,over:m,measuringConfiguration:_,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:E}=$c(),T=h.useContext(gi),x=lv(f==null?void 0:f.id),P=Pc(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:T,windowRect:E}),$=zo(g),k=ov({config:n,draggableNodes:b,droppableContainers:p,measuringConfiguration:_}),L=$?v.setRef:void 0;return h.createElement(tv,null,h.createElement(Jy,{animation:k},f&&x?h.createElement(sv,{key:x,id:f.id,ref:L,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:d,...s},transform:P},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 ev=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Lc=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
186
+ */const uv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Bc=(...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 tv={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 dv={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 rv=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>h.createElement("svg",{ref:c,...tv,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Lc("lucide",s),...a},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
196
+ */const fv=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>h.createElement("svg",{ref:c,...dv,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Bc("lucide",s),...a},[...o.map(([d,u])=>h.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 de=(e,t)=>{const r=h.forwardRef(({className:n,...s},i)=>h.createElement(rv,{ref:i,iconNode:t,className:Lc(`lucide-${ev(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
201
+ */const de=(e,t)=>{const r=h.forwardRef(({className:n,...s},i)=>h.createElement(fv,{ref:i,iconNode:t,className:Bc(`lucide-${uv(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 nv=de("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
206
+ */const hv=de("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 sv=de("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 pv=de("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 iv=de("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 gv=de("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 yn=de("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
221
+ */const vn=de("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 ds=de("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
226
+ */const hs=de("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 Fc=de("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
231
+ */const Uc=de("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 ov=de("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
236
+ */const yv=de("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 $c=de("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 zc=de("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 jo=de("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 Vo=de("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 Bo=de("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 qo=de("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 av=de("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
256
+ */const vv=de("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 lv=de("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 mv=de("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 jc=de("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 Vc=de("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 Uo=de("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 Ho=de("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 vn=de("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 mn=de("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 cv=de("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 bv=de("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 Bc=de("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 qc=de("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 uv=de("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 _v=de("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 Uc=de("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 Hc=de("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 dv=de("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 wv=de("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 zc=de("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 Wc=de("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 zo=de("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 Wo=de("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 fv=de("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 Sv=de("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 pi=de("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 yi=de("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 Vo=de("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 Ko=de("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 qo=de("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 Qo=de("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 hv=de("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 Cv=de("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 pv=de("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 Ev=de("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 gv=de("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 Ov=de("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 yv=de("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 Dv=de("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=de("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
356
+ */const ps=de("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 Vc=de("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 Kc=de("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 vv=de("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 Iv=de("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 mv=de("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 Tv=de("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 Ho=de("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
376
+ */const Go=de("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 bv=de("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
381
+ */const Nv=de("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 _v=de("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 kv=de("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 wv=de("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 xv=de("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 Wo=de("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 Yo=de("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 qc=de("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 Qc=de("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 Sv=de("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 Av=de("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 Ko=de("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 Ro=de("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 Ur=de("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Cv={},Hc=e=>{let t;const r=new Set,n=(u,f)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const y=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(b=>b(t,y))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(Cv?"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},Ov=e=>e?Hc(e):Hc;function Wc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qo={exports:{}},Go={},gi={exports:{}},Yo={};/**
416
+ */const zr=de("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Pv={},Gc=e=>{let t;const r=new Set,n=(u,f)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const y=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(b=>b(t,y))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(Pv?"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},Lv=e=>e?Gc(e):Gc;function Yc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xo={exports:{}},Zo={},vi={exports:{}},Jo={};/**
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 Kc;function Ev(){if(Kc)return Yo;Kc=1;var e=h;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 y=g(),b=n({inst:{value:y,getSnapshot:g}}),p=b[0].inst,v=b[1];return i(function(){p.value=y,p.getSnapshot=g,c(p)&&v({inst:p})},[f,y,g]),s(function(){return c(p)&&v({inst:p}),f(function(){c(p)&&v({inst:p})})},[f]),o(y),y}function c(f){var g=f.getSnapshot;f=f.value;try{var y=g();return!r(f,y)}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 Yo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Yo}var Ro={};/**
424
+ */var Rc;function Mv(){if(Rc)return Jo;Rc=1;var e=h;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 y=g(),b=n({inst:{value:y,getSnapshot:g}}),p=b[0].inst,v=b[1];return i(function(){p.value=y,p.getSnapshot=g,c(p)&&v({inst:p})},[f,y,g]),s(function(){return c(p)&&v({inst:p}),f(function(){c(p)&&v({inst:p})})},[f]),o(y),y}function c(f){var g=f.getSnapshot;f=f.value;try{var y=g();return!r(f,y)}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 Jo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Jo}var ea={};/**
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 Qc;function Dv(){return Qc||(Qc=1,process.env.NODE_ENV!=="production"&&function(){function e(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}function t(y,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 p=b();if(!f){var v=b();i(p,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}v=o({inst:{value:p,getSnapshot:b}});var m=v[0].inst,_=v[1];return c(function(){m.value=p,m.getSnapshot=b,r(m)&&_({inst:m})},[y,p,b]),a(function(){return r(m)&&_({inst:m}),y(function(){r(m)&&_({inst:m})})},[y]),d(p),p}function r(y){var b=y.getSnapshot;y=y.value;try{var p=b();return!i(y,p)}catch{return!0}}function n(y,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=h,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;Ro.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())}()),Ro}var Gc;function Xo(){return Gc||(Gc=1,process.env.NODE_ENV==="production"?gi.exports=Ev():gi.exports=Dv()),gi.exports}/**
432
+ */var Xc;function Fv(){return Xc||(Xc=1,process.env.NODE_ENV!=="production"&&function(){function e(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}function t(y,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 p=b();if(!f){var v=b();i(p,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}v=o({inst:{value:p,getSnapshot:b}});var m=v[0].inst,_=v[1];return c(function(){m.value=p,m.getSnapshot=b,r(m)&&_({inst:m})},[y,p,b]),a(function(){return r(m)&&_({inst:m}),y(function(){r(m)&&_({inst:m})})},[y]),d(p),p}function r(y){var b=y.getSnapshot;y=y.value;try{var p=b();return!i(y,p)}catch{return!0}}function n(y,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=h,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;ea.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())}()),ea}var Zc;function ta(){return Zc||(Zc=1,process.env.NODE_ENV==="production"?vi.exports=Mv():vi.exports=Fv()),vi.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 Yc;function Iv(){if(Yc)return Go;Yc=1;var e=h,t=Xo();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 Go.useSyncExternalStoreWithSelector=function(d,u,f,g,y){var b=i(null);if(b.current===null){var p={hasValue:!1,value:null};b.current=p}else p=b.current;b=a(function(){function m(T){if(!_){if(_=!0,S=T,T=g(T),y!==void 0&&p.hasValue){var x=p.value;if(y(x,T))return w=x}return w=T}if(x=w,n(S,T))return x;var P=g(T);return y!==void 0&&y(x,P)?(S=T,x):(S=T,w=P)}var _=!1,S,w,O=f===void 0?null:f;return[function(){return m(u())},O===null?void 0:function(){return m(O())}]},[u,f,g,y]);var v=s(d,b[0],b[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},Go}var Zo={};/**
440
+ */var Jc;function $v(){if(Jc)return Zo;Jc=1;var e=h,t=ta();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 Zo.useSyncExternalStoreWithSelector=function(d,u,f,g,y){var b=i(null);if(b.current===null){var p={hasValue:!1,value:null};b.current=p}else p=b.current;b=a(function(){function m(T){if(!_){if(_=!0,S=T,T=g(T),y!==void 0&&p.hasValue){var x=p.value;if(y(x,T))return w=x}return w=T}if(x=w,n(S,T))return x;var P=g(T);return y!==void 0&&y(x,P)?(S=T,x):(S=T,w=P)}var _=!1,S,w,E=f===void 0?null:f;return[function(){return m(u())},E===null?void 0:function(){return m(E())}]},[u,f,g,y]);var v=s(d,b[0],b[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},Zo}var ra={};/**
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 Rc;function Tv(){return Rc||(Rc=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=h,r=Xo(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Zo.useSyncExternalStoreWithSelector=function(d,u,f,g,y){var b=i(null);if(b.current===null){var p={hasValue:!1,value:null};b.current=p}else p=b.current;b=a(function(){function m(T){if(!_){if(_=!0,S=T,T=g(T),y!==void 0&&p.hasValue){var x=p.value;if(y(x,T))return w=x}return w=T}if(x=w,n(S,T))return x;var P=g(T);return y!==void 0&&y(x,P)?(S=T,x):(S=T,w=P)}var _=!1,S,w,O=f===void 0?null:f;return[function(){return m(u())},O===null?void 0:function(){return m(O())}]},[u,f,g,y]);var v=s(d,b[0],b[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Zo}process.env.NODE_ENV==="production"?Qo.exports=Iv():Qo.exports=Tv();var Nv=Qo.exports;const kv=Wc(Nv),Xc={},{useDebugValue:xv}=h,{useSyncExternalStoreWithSelector:Av}=kv;let Zc=!1;const Pv=e=>e;function Mv(e,t=Pv,r){(Xc?"production":void 0)!=="production"&&r&&!Zc&&(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"),Zc=!0);const n=Av(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return xv(n),n}const Jc=e=>{(Xc?"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"?Ov(e):e,r=(n,s)=>Mv(t,n,s);return Object.assign(r,t),r},yi=e=>e?Jc(e):Jc,oe=yi(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}})})),Lv=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:oe},Symbol.toStringTag,{value:"Module"}));function zr(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 eu(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=eu(s.children,t,r+1);if(i>=0)return i}}return-1}const Fv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function tu(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Fv)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:tu(n.children,t,r)}:n})}function vi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:vi(n.children,t,r)}:n)}function Jo(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?Jo(r.children,t):[]}))}function ru(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:ru(s.children,t,r,n)}:s})}function nu(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?nu(r.children,t):[]}})}function $v(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 jv(e,t){const r=zr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?zr(e,s.parent):void 0;return n}const Ae=yi((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=zr(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:tu(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=eu(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:vi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:Jo(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:ru(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=zr(i.treeData,r);if(!o)return i;let a=Jo(i.treeData,r);return a=vi(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||zr(t().treeData,r.identifier))return!1;const a=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if($v(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(y=>({treeData:vi(y.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{oe.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=nu(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=>zr(t().treeData,r),getChildrenOf:r=>{const n=zr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>jv(t().treeData,r)})),Bv=yi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Uv={spin:"_spin_1ah4d_9"},zv=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Uv.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"})}),Pe=({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(zv,{size:14}):null,i]}),Me={overlay:"_overlay_w9xez_1",modal:"_modal_w9xez_11",modalHeader:"_modalHeader_w9xez_23",modalHeaderClose:"_modalHeaderClose_w9xez_33",modalBody:"_modalBody_w9xez_51",modalFooter:"_modalFooter_w9xez_58",checkRow:"_checkRow_w9xez_65",formGroup:"_formGroup_w9xez_108",textarea:"_textarea_w9xez_119",sliderGroup:"_sliderGroup_w9xez_140",sliderValue:"_sliderValue_w9xez_152",sliderLabels:"_sliderLabels_w9xez_160",sectionTitle:"_sectionTitle_w9xez_168"},Vv=({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]=h.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Me.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Me.modal,children:[l.jsxs("div",{className:Me.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Me.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Me.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:Me.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:Me.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:Me.modalFooter,children:[l.jsx(Pe,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Pe,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},qv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=h.useState(""),[o,a]=h.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:Me.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Me.modal,children:[l.jsxs("div",{className:Me.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Me.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Me.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Me.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Me.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:Me.sliderValue,children:o})]}),l.jsxs("div",{className:Me.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Me.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:Me.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:Me.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:Me.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:Me.modalFooter,children:[l.jsx(Pe,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Pe,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function su(e,t){return function(){return e.apply(t,arguments)}}const{toString:Hv}=Object.prototype,{getPrototypeOf:mn}=Object,{iterator:hs,toStringTag:iu}=Symbol,mi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ps=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),mi(r,t))return!0;r=mn(r)}return!1},Wv=(e,t)=>e!=null&&ps(e,t)?e[t]:void 0,ea=(e=>t=>{const r=Hv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Kt=e=>(e=e.toLowerCase(),t=>ea(t)===e),bi=e=>t=>typeof t===e,{isArray:Vr}=Array,bn=bi("undefined");function _n(e){return e!==null&&!bn(e)&&e.constructor!==null&&!bn(e.constructor)&&Et(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ou=Kt("ArrayBuffer");function Kv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ou(e.buffer),t}const Qv=bi("string"),Et=bi("function"),au=bi("number"),wn=e=>e!==null&&typeof e=="object",Gv=e=>e===!0||e===!1,_i=e=>{if(!wn(e))return!1;const t=mn(e);return(t===null||t===Object.prototype||mn(t)===null)&&!ps(e,iu)&&!ps(e,hs)},Yv=e=>{if(!wn(e)||_n(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Rv=Kt("Date"),Xv=Kt("File"),Zv=e=>!!(e&&typeof e.uri<"u"),Jv=e=>e&&typeof e.getParts<"u",em=Kt("Blob"),tm=Kt("FileList"),rm=e=>wn(e)&&Et(e.pipe);function nm(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const lu=nm(),cu=typeof lu.FormData<"u"?lu.FormData:void 0,sm=e=>{if(!e)return!1;if(cu&&e instanceof cu)return!0;const t=mn(e);if(!t||t===Object.prototype||!Et(e.append))return!1;const r=ea(e);return r==="formdata"||r==="object"&&Et(e.toString)&&e.toString()==="[object FormData]"},im=Kt("URLSearchParams"),[om,am,lm,cm]=["ReadableStream","Request","Response","Headers"].map(Kt),um=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function gs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),Vr(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(_n(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 uu(e,t){if(_n(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 qr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,du=e=>!bn(e)&&e!==qr;function ta(...e){const{caseless:t,skipUndefined:r}=du(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&uu(n,o)||o,c=mi(n,a)?n[a]:void 0;_i(c)&&_i(i)?n[a]=ta(c,i):_i(i)?n[a]=ta({},i):Vr(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||_n(a)||(gs(a,s),typeof a!="object"||Vr(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];Sm.call(a,u)&&s(a[u],u)}}return n}const dm=(e,t,r,{allOwnKeys:n}={})=>(gs(t,(s,i)=>{r&&Et(s)?Object.defineProperty(e,i,{__proto__:null,value:su(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),fm=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),hm=(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)},pm=(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&&mn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},gm=(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},ym=e=>{if(!e)return null;if(Vr(e))return e;let t=e.length;if(!au(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},vm=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&mn(Uint8Array)),mm=(e,t)=>{const n=(e&&e[hs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},bm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},_m=Kt("HTMLFormElement"),wm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Sm}=Object.prototype,Cm=Kt("RegExp"),fu=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};gs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Om=e=>{fu(e,(t,r)=>{if(Et(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Et(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+"'")})}})},Em=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Vr(e)?n(e):n(String(e).split(t)),r},Dm=()=>{},Im=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Tm(e){return!!(e&&Et(e.append)&&e[iu]==="FormData"&&e[hs])}const Nm=e=>{const t=new WeakSet,r=n=>{if(wn(n)){if(t.has(n))return;if(_n(n))return n;if(!("toJSON"in n)){t.add(n);const s=Vr(n)?[]:{};return gs(n,(i,o)=>{const a=r(i);!bn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},km=Kt("AsyncFunction"),xm=e=>e&&(wn(e)||Et(e))&&Et(e.then)&&Et(e.catch),hu=((e,t)=>e?setImmediate:t?((r,n)=>(qr.addEventListener("message",({source:s,data:i})=>{s===qr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),qr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Et(qr.postMessage)),Am=typeof queueMicrotask<"u"?queueMicrotask.bind(qr):typeof process<"u"&&process.nextTick||hu,pu=e=>e!=null&&Et(e[hs]),D={isArray:Vr,isArrayBuffer:ou,isBuffer:_n,isFormData:sm,isArrayBufferView:Kv,isString:Qv,isNumber:au,isBoolean:Gv,isObject:wn,isPlainObject:_i,isEmptyObject:Yv,isReadableStream:om,isRequest:am,isResponse:lm,isHeaders:cm,isUndefined:bn,isDate:Rv,isFile:Xv,isReactNativeBlob:Zv,isReactNative:Jv,isBlob:em,isRegExp:Cm,isFunction:Et,isStream:rm,isURLSearchParams:im,isTypedArray:vm,isFileList:tm,forEach:gs,merge:ta,extend:dm,trim:um,stripBOM:fm,inherits:hm,toFlatObject:pm,kindOf:ea,kindOfTest:Kt,endsWith:gm,toArray:ym,forEachEntry:mm,matchAll:bm,isHTMLForm:_m,hasOwnProperty:mi,hasOwnProp:mi,hasOwnInPrototypeChain:ps,getSafeProp:Wv,reduceDescriptors:fu,freezeMethods:Om,toObjectSet:Em,toCamelCase:wm,noop:Dm,toFiniteNumber:Im,findKey:uu,global:qr,isContextDefined:du,isSpecCompliantForm:Tm,toJSONObject:Nm,isAsyncFn:km,isThenable:xm,setImmediate:hu,asap:Am,isIterable:pu,isSafeIterable:e=>e!=null&&ps(e,hs)&&pu(e)},Pm=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"]),Mm=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]&&Pm[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Lm(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 Fm=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),$m=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ra(e,t){return D.isArray(e)?e.map(r=>ra(r,t)):Lm(String(e).replace(t,""))}const jm=e=>ra(e,Fm),Bm=e=>ra(e,$m);function gu(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=Bm(r)}),t}const yu=Symbol("internals");function ys(e){return e&&String(e).trim().toLowerCase()}function wi(e){return e===!1||e==null?e:D.isArray(e)?e.map(wi):jm(String(e))}function Um(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 zm=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function na(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 Vm(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function qm(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 ft=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=ys(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]=wi(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())&&!zm(t))o(Mm(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=ys(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Um(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=ys(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||na(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=ys(o),o){const a=D.findKey(n,o);a&&(!r||na(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||na(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]=wi(s),delete r[i];return}const a=t?Vm(i):String(i).trim();a!==i&&delete r[i],r[a]=wi(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[yu]=this[yu]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ys(o);n[a]||(qm(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};ft.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(ft.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),D.freezeMethods(ft);const Hm="[REDACTED ****]";function Wm(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 Km(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 ft&&(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)&&Wm(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?Hm:s(c);D.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let X=class Zh extends Error{static from(t,r,n,s,i,o){const a=new Zh(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?Km(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 Qm=null,vu=100;function sa(e){return D.isPlainObject(e)||D.isArray(e)}function mu(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function ia(e,t,r){return e?e.concat(t).map(function(s,i){return s=mu(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Gm(e){return D.isArray(e)&&!e.some(sa)}const Ym=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function Si(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?vu:r.maxDepth,d=a&&D.isSpecCompliantForm(t),u=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(m){if(m===null)return"";if(D.isDate(m))return m.toISOString();if(D.isBoolean(m))return m.toString();if(!d&&D.isBlob(m))throw new X("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(m)||D.isTypedArray(m)?d&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function g(m){if(m>c)throw new X("Object is too deeply nested ("+m+" levels). Max depth: "+c,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function y(m,_){if(c===1/0)return JSON.stringify(m);const S=[];return JSON.stringify(m,function(O,T){if(!D.isObject(T))return T;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(T),g(_+S.length-1),T})}function b(m,_,S){let w=m;if(D.isReactNative(t)&&D.isReactNativeBlob(m))return t.append(ia(S,_,i),f(m)),!1;if(m&&!S&&typeof m=="object"){if(D.endsWith(_,"{}"))_=n?_:_.slice(0,-2),m=y(m,1);else if(D.isArray(m)&&Gm(m)||(D.isFileList(m)||D.endsWith(_,"[]"))&&(w=D.toArray(m)))return _=mu(_),w.forEach(function(T,x){!(D.isUndefined(T)||T===null)&&t.append(o===!0?ia([_],x,i):o===null?_:_+"[]",f(T))}),!1}return sa(m)?!0:(t.append(ia(S,_,i),f(m)),!1)}const p=Object.assign(Ym,{defaultVisitor:b,convertValue:f,isVisitable:sa});function v(m,_,S=0){if(!D.isUndefined(m)){if(g(S),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+_.join("."));u.push(m),D.forEach(m,function(O,T){(!(D.isUndefined(O)||O===null)&&s.call(t,O,D.isString(T)?T.trim():T,_,p))===!0&&v(O,_?_.concat(T):[T],S+1)}),u.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return v(e),t}function bu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function oa(e,t){this._pairs=[],e&&Si(e,this,t)}const _u=oa.prototype;_u.append=function(t,r){this._pairs.push([t,r])},_u.toString=function(t){const r=t?function(n){return t.call(this,n,bu)}:bu;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Rm(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function wu(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||Rm,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new oa(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Su{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 aa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Xm={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:oa,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},la=typeof window<"u"&&typeof document<"u",ca=typeof navigator=="object"&&navigator||void 0,Zm=la&&(!ca||["ReactNative","NativeScript","NS"].indexOf(ca.product)<0),Jm=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",eb=la&&window.location.href||"http://localhost",lt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:la,hasStandardBrowserEnv:Zm,hasStandardBrowserWebWorkerEnv:Jm,navigator:ca,origin:eb},Symbol.toStringTag,{value:"Module"})),...Xm};function tb(e,t){return Si(e,new lt.classes.URLSearchParams,{visitor:function(r,n,s,i){return lt.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Cu=vu;function Ou(e){if(e>Cu)throw new X("FormData field is too deeply nested ("+e+" levels). Max depth: "+Cu,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function rb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Ou(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function nb(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 Eu(e){function t(r,n,s,i){Ou(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]=nb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(rb(n),s,r,0)}),r}return null}const Sn=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function sb(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 vs={transitional:aa,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(Eu(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=Sn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return tb(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=Sn(this,"env"),u=d&&d.FormData;return Si(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),sb(t)):t}],transformResponse:[function(t){const r=Sn(this,"transitional")||vs.transitional,n=r&&r.forcedJSONParsing,s=Sn(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,Sn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?X.from(c,X.ERR_BAD_RESPONSE,this,null,Sn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:lt.classes.FormData,Blob:lt.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=>{vs.headers[e]={}});function ua(e,t){const r=this||vs,n=t||r,s=ft.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 Du(e){return!!(e&&e.__CANCEL__)}let ms=class extends X{constructor(t,r,n){super(t??"canceled",X.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Iu(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 ib(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function ob(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 y=u&&d-u;return y?Math.round(g*1e3/y):void 0}}function ab(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 Ci=(e,t,r=3)=>{let n=0;const s=ob(50,250);return ab(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)},Tu=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Nu=e=>(...t)=>D.asap(()=>e(...t)),lb=lt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,lt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(lt.origin),lt.navigator&&/(msie|trident)/i.test(lt.navigator.userAgent)):()=>!0,cb=lt.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 ub(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function db(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const fb=/^https?:(?!\/\/)/i,hb=/[\t\n\r]/g;function pb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function gb(e){return pb(e).replace(hb,"")}function ku(e,t){if(typeof e=="string"&&fb.test(gb(e)))throw new X('Invalid URL: missing "//" after protocol',X.ERR_INVALID_URL,t)}function xu(e,t,r,n){ku(t,n);let s=!ub(t);return e&&(s||r===!1)?(ku(e,n),db(e,t)):t}const Au=e=>e instanceof ft?{...e}:e;function Hr(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,y){return D.isPlainObject(u)&&D.isPlainObject(f)?D.merge.call({caseless:y},u,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(u,f,g,y){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u,g,y)}else return n(u,f,g,y)}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(Au(u),Au(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,y=D.hasOwnProp(e,f)?e[f]:void 0,b=D.hasOwnProp(t,f)?t[f]:void 0,p=g(y,b,f);D.isUndefined(p)&&g!==c||(r[f]=p)}),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 yb=["content-type","content-length"];function vb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{yb.includes(n.toLowerCase())&&e.set(n,s)})}const mb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Pu(e){const t=Hr({},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=ft.from(a),t.url=wu(xu(d,f,u,t),r("params"),r("paramsSerializer")),c){const g=D.getSafeProp(c,"username")||"",y=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(y?mb(y):"")))}if(D.isFormData(n)&&(lt.hasStandardBrowserEnv||lt.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&vb(a,n.getHeaders(),r("formDataHeaderPolicy"))),lt.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&lb(t.url))){const y=i&&o&&cb.read(o);y&&a.set(i,y)}return t}const bb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=Pu(e);let i=s.data;const o=ft.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,g,y,b;function p(){y&&y(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function m(){if(!v)return;const S=ft.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),O={data:!a||a==="text"||a==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:S,config:e,request:v};Iu(function(x){r(x),p()},function(x){n(x),p()},O),v=null}"onloadend"in v?v.onloadend=m:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(m)},v.onabort=function(){v&&(n(new X("Request aborted",X.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const O=w&&w.message?w.message:"Network Error",T=new X(O,X.ERR_NETWORK,e,v);T.event=w||null,n(T),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||aa;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new X(w,O.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&D.forEach(gu(o),function(w,O){v.setRequestHeader(O,w)}),D.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),a&&a!=="json"&&(v.responseType=s.responseType),d&&([g,b]=Ci(d,!0),v.addEventListener("progress",g)),c&&v.upload&&([f,y]=Ci(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",y)),(s.cancelToken||s.signal)&&(u=S=>{v&&(n(!S||S.type?new ms(null,e,v):S),v.abort(),p(),v=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const _=ib(s.url);if(_&&!lt.protocols.includes(_)){n(new X("Unsupported protocol "+_+":",X.ERR_BAD_REQUEST,e));return}v.send(i||null)})},_b=(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 ms(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},wb=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},Sb=async function*(e,t){for await(const r of Cb(e))yield*wb(r,t)},Cb=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()}},Mu=(e,t,r,n)=>{const s=Sb(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})},Oi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Ob=(e,t,r)=>t+2<r&&Oi(e.charCodeAt(t+1))&&Oi(e.charCodeAt(t+2));function Eb(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 y=0;y<a;y++)if(n.charCodeAt(y)===37&&y+2<a){const b=n.charCodeAt(y+1),p=n.charCodeAt(y+2);Oi(b)&&Oi(p)&&(o-=2,y+=2)}let c=0,d=a-1;const u=y=>y>=2&&n.charCodeAt(y-2)===37&&n.charCodeAt(y-1)===51&&(n.charCodeAt(y)===68||n.charCodeAt(y)===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&&Ob(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 da="1.18.0",Lu=64*1024,{isFunction:Ei}=D,Db=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Fu=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},$u=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ib=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Tb=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?Ei(s):typeof fetch=="function",c=Ei(i),d=Ei(o);if(!a)return!1;const u=a&&Ei(r),f=a&&(typeof n=="function"?(m=>_=>m.encode(_))(new n):async m=>new Uint8Array(await new i(m).arrayBuffer())),g=c&&u&&$u(()=>{let m=!1;const _=new i(lt.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),S=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),m&&!S}),y=d&&u&&$u(()=>D.isReadableStream(new o("").body)),b={stream:y&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!b[m]&&(b[m]=(_,S)=>{let w=_&&_[m];if(w)return w.call(_);throw new X(`Response type '${m}' is not supported`,X.ERR_NOT_SUPPORT,S)})});const p=async m=>{if(m==null)return 0;if(D.isBlob(m))return m.size;if(D.isSpecCompliantForm(m))return(await new i(lt.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(D.isArrayBufferView(m)||D.isArrayBuffer(m))return m.byteLength;if(D.isURLSearchParams(m)&&(m=m+""),D.isString(m))return(await f(m)).byteLength},v=async(m,_)=>{const S=D.toFiniteNumber(m.getContentLength());return S??p(_)};return async m=>{let{url:_,method:S,data:w,signal:O,cancelToken:T,timeout:x,onDownloadProgress:P,onUploadProgress:$,responseType:k,headers:M,withCredentials:B="same-origin",fetchOptions:A,maxContentLength:j,maxBodyLength:F}=Pu(m);const Z=D.isNumber(j)&&j>-1,ae=D.isNumber(F)&&F>-1,me=Q=>D.hasOwnProp(m,Q)?m[Q]:void 0;let Oe=s||fetch;k=k?(k+"").toLowerCase():"text";let pe=_b([O,T&&T.toAbortSignal()],x),K=null;const J=pe&&pe.unsubscribe&&(()=>{pe.unsubscribe()});let se,U=null;const R=()=>new X("Request body larger than maxBodyLength limit",X.ERR_BAD_REQUEST,m,K);try{let Q;const ue=me("auth");if(ue){const ee=D.getSafeProp(ue,"username")||"",Ke=D.getSafeProp(ue,"password")||"";Q={username:ee,password:Ke}}if(Ib(_)){const ee=new URL(_,lt.origin);if(!Q&&(ee.username||ee.password)){const Ke=Fu(ee.username),tt=Fu(ee.password);Q={username:Ke,password:tt}}(ee.username||ee.password)&&(ee.username="",ee.password="",_=ee.href)}if(Q&&(M.delete("authorization"),M.set("Authorization","Basic "+btoa(Db((Q.username||"")+":"+(Q.password||""))))),Z&&typeof _=="string"&&_.startsWith("data:")&&Eb(_)>j)throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K);if(ae&&S!=="get"&&S!=="head"){const ee=await p(w);if(typeof ee=="number"&&isFinite(ee)&&(se=ee,ee>F))throw R()}const Ee=ae&&(D.isReadableStream(w)||D.isStream(w)),je=(ee,Ke,tt)=>Mu(ee,Lu,H=>{if(ae&&H>F)throw U=R();Ke&&Ke(H)},tt);if(g&&S!=="get"&&S!=="head"&&($||Ee)){if(se=se??await v(M,w),se!==0||Ee){let ee=new i(_,{method:"POST",body:w,duplex:"half"}),Ke;if(D.isFormData(w)&&(Ke=ee.headers.get("content-type"))&&M.setContentType(Ke),ee.body){const[tt,H]=$&&Tu(se,Ci(Nu($)))||[];w=je(ee.body,tt,H)}}}else if(Ee&&!c&&u&&S!=="get"&&S!=="head")w=je(w);else if(Ee&&c&&!g&&S!=="get"&&S!=="head")throw new X("Stream request bodies are not supported by the current fetch implementation",X.ERR_NOT_SUPPORT,m,K);D.isString(B)||(B=B?"include":"omit");const ye=c&&"credentials"in i.prototype;if(D.isFormData(w)){const ee=M.getContentType();ee&&/^multipart\/form-data/i.test(ee)&&!/boundary=/i.test(ee)&&M.delete("content-type")}M.set("User-Agent","axios/"+da,!1);const ce={...A,signal:pe,method:S.toUpperCase(),headers:gu(M.normalize()),body:w,duplex:"half",credentials:ye?B:void 0};K=c&&new i(_,ce);let ge=await(c?Oe(K,A):Oe(_,ce));const Le=ft.from(ge.headers);if(Z){const ee=D.toFiniteNumber(Le.getContentLength());if(ee!=null&&ee>j)throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K)}const Ve=y&&(k==="stream"||k==="response");if(y&&ge.body&&(P||Z||Ve&&J)){const ee={};["status","statusText","headers"].forEach(Re=>{ee[Re]=ge[Re]});const Ke=D.toFiniteNumber(Le.getContentLength()),[tt,H]=P&&Tu(Ke,Ci(Nu(P),!0))||[];let re=0;const ie=Re=>{if(Z&&(re=Re,re>j))throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K);tt&&tt(Re)};ge=new o(Mu(ge.body,Lu,ie,()=>{H&&H(),J&&J()}),ee)}k=k||"text";let ke=await b[D.findKey(b,k)||"text"](ge,m);if(Z&&!y&&!Ve){let ee;if(ke!=null&&(typeof ke.byteLength=="number"?ee=ke.byteLength:typeof ke.size=="number"?ee=ke.size:typeof ke=="string"&&(ee=typeof n=="function"?new n().encode(ke).byteLength:ke.length)),typeof ee=="number"&&ee>j)throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K)}return!Ve&&J&&J(),await new Promise((ee,Ke)=>{Iu(ee,Ke,{data:ke,headers:ft.from(ge.headers),status:ge.status,statusText:ge.statusText,config:m,request:K})})}catch(Q){if(J&&J(),pe&&pe.aborted&&pe.reason instanceof X){const ue=pe.reason;throw ue.config=m,K&&(ue.request=K),Q!==ue&&(ue.cause=Q),ue}throw U?(K&&!U.request&&(U.request=K),U):Q instanceof X?(K&&!Q.request&&(Q.request=K),Q):Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new X("Network Error",X.ERR_NETWORK,m,K,Q&&Q.response),{cause:Q.cause||Q}):X.from(Q,Q&&Q.code,m,K,Q&&Q.response)}}},Nb=new Map,ju=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=Nb;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Tb(t)),u=d;return d};ju();const fa={http:Qm,xhr:bb,fetch:{get:ju}};D.forEach(fa,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Bu=e=>`- ${e}`,kb=e=>D.isFunction(e)||e===null||e===!1;function xb(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,!kb(n)&&(s=fa[(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(Bu).join(`
452
- `):" "+Bu(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 Uu={getAdapter:xb,adapters:fa};function ha(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ms(null,e)}function zu(e){return ha(e),e.headers=ft.from(e.headers),e.data=ua.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Uu.getAdapter(e.adapter||vs.adapter,e)(e).then(function(n){ha(e),e.response=n;try{n.data=ua.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=ft.from(n.headers),n},function(n){if(!Du(n)&&(ha(e),n&&n.response)){e.response=n.response;try{n.response.data=ua.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=ft.from(n.response.headers)}return Promise.reject(n)})}const Di={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Di[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Vu={};Di.transitional=function(t,r,n){function s(i,o){return"[Axios v"+da+"] 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&&!Vu[o]&&(Vu[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}},Di.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Ab(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 Ii={assertOptions:Ab,validators:Di},ht=Ii.validators;let Wr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Su,response:new Su}}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 eu;function jv(){return eu||(eu=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=h,r=ta(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;ra.useSyncExternalStoreWithSelector=function(d,u,f,g,y){var b=i(null);if(b.current===null){var p={hasValue:!1,value:null};b.current=p}else p=b.current;b=a(function(){function m(T){if(!_){if(_=!0,S=T,T=g(T),y!==void 0&&p.hasValue){var x=p.value;if(y(x,T))return w=x}return w=T}if(x=w,n(S,T))return x;var P=g(T);return y!==void 0&&y(x,P)?(S=T,x):(S=T,w=P)}var _=!1,S,w,E=f===void 0?null:f;return[function(){return m(u())},E===null?void 0:function(){return m(E())}]},[u,f,g,y]);var v=s(d,b[0],b[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ra}process.env.NODE_ENV==="production"?Xo.exports=$v():Xo.exports=jv();var Bv=Xo.exports;const Uv=Yc(Bv),tu={},{useDebugValue:zv}=h,{useSyncExternalStoreWithSelector:Vv}=Uv;let ru=!1;const qv=e=>e;function Hv(e,t=qv,r){(tu?"production":void 0)!=="production"&&r&&!ru&&(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"),ru=!0);const n=Vv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return zv(n),n}const nu=e=>{(tu?"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"?Lv(e):e,r=(n,s)=>Hv(t,n,s);return Object.assign(r,t),r},mi=e=>e?nu(e):nu,oe=mi(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}})})),Wv=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 su(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=su(s.children,t,r+1);if(i>=0)return i}}return-1}const Kv=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function iu(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Kv)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:iu(n.children,t,r)}:n})}function bi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:bi(n.children,t,r)}:n)}function na(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?na(r.children,t):[]}))}function ou(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:ou(s.children,t,r,n)}:s})}function au(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?au(r.children,t):[]}})}function Qv(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 Gv(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 Le=mi((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:iu(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=su(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:bi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:na(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:ou(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Vr(i.treeData,r);if(!o)return i;let a=na(i.treeData,r);return a=bi(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(Qv(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(y=>({treeData:bi(y.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{oe.getState().setIsDirty(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=au(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=>Gv(t().treeData,r)})),Yv=mi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Rv={spin:"_spin_1ah4d_9"},Xv=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Rv.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"})}),Me=({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(Xv,{size:14}):null,i]}),Fe={overlay:"_overlay_w9xez_1",modal:"_modal_w9xez_11",modalHeader:"_modalHeader_w9xez_23",modalHeaderClose:"_modalHeaderClose_w9xez_33",modalBody:"_modalBody_w9xez_51",modalFooter:"_modalFooter_w9xez_58",checkRow:"_checkRow_w9xez_65",formGroup:"_formGroup_w9xez_108",textarea:"_textarea_w9xez_119",sliderGroup:"_sliderGroup_w9xez_140",sliderValue:"_sliderValue_w9xez_152",sliderLabels:"_sliderLabels_w9xez_160",sectionTitle:"_sectionTitle_w9xez_168"},Zv=({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]=h.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Fe.modal,children:[l.jsxs("div",{className:Fe.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Fe.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Fe.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:Fe.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:Fe.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:Fe.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Me,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},Jv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=h.useState(""),[o,a]=h.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:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Fe.modal,children:[l.jsxs("div",{className:Fe.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Fe.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Fe.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Fe.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Fe.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:Fe.sliderValue,children:o})]}),l.jsxs("div",{className:Fe.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Fe.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:Fe.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:Fe.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:Fe.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:Fe.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Me,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function lu(e,t){return function(){return e.apply(t,arguments)}}const{toString:em}=Object.prototype,{getPrototypeOf:bn}=Object,{iterator:gs,toStringTag:cu}=Symbol,_i=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ys=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),_i(r,t))return!0;r=bn(r)}return!1},tm=(e,t)=>e!=null&&ys(e,t)?e[t]:void 0,sa=(e=>t=>{const r=em.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Qt=e=>(e=e.toLowerCase(),t=>sa(t)===e),wi=e=>t=>typeof t===e,{isArray:qr}=Array,_n=wi("undefined");function wn(e){return e!==null&&!_n(e)&&e.constructor!==null&&!_n(e.constructor)&&Dt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const uu=Qt("ArrayBuffer");function rm(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&uu(e.buffer),t}const nm=wi("string"),Dt=wi("function"),du=wi("number"),Sn=e=>e!==null&&typeof e=="object",sm=e=>e===!0||e===!1,Si=e=>{if(!Sn(e))return!1;const t=bn(e);return(t===null||t===Object.prototype||bn(t)===null)&&!ys(e,cu)&&!ys(e,gs)},im=e=>{if(!Sn(e)||wn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},om=Qt("Date"),am=Qt("File"),lm=e=>!!(e&&typeof e.uri<"u"),cm=e=>e&&typeof e.getParts<"u",um=Qt("Blob"),dm=Qt("FileList"),fm=e=>Sn(e)&&Dt(e.pipe);function hm(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const fu=hm(),hu=typeof fu.FormData<"u"?fu.FormData:void 0,pm=e=>{if(!e)return!1;if(hu&&e instanceof hu)return!0;const t=bn(e);if(!t||t===Object.prototype||!Dt(e.append))return!1;const r=sa(e);return r==="formdata"||r==="object"&&Dt(e.toString)&&e.toString()==="[object FormData]"},gm=Qt("URLSearchParams"),[ym,vm,mm,bm]=["ReadableStream","Request","Response","Headers"].map(Qt),_m=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]),qr(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(wn(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 pu(e,t){if(wn(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,gu=e=>!_n(e)&&e!==Hr;function ia(...e){const{caseless:t,skipUndefined:r}=gu(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&pu(n,o)||o,c=_i(n,a)?n[a]:void 0;Si(c)&&Si(i)?n[a]=ia(c,i):Si(i)?n[a]=ia({},i):qr(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||wn(a)||(vs(a,s),typeof a!="object"||qr(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];Am.call(a,u)&&s(a[u],u)}}return n}const wm=(e,t,r,{allOwnKeys:n}={})=>(vs(t,(s,i)=>{r&&Dt(s)?Object.defineProperty(e,i,{__proto__:null,value:lu(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),Sm=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Cm=(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)},Em=(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&&bn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Om=(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},Dm=e=>{if(!e)return null;if(qr(e))return e;let t=e.length;if(!du(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Im=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&bn(Uint8Array)),Tm=(e,t)=>{const n=(e&&e[gs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Nm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},km=Qt("HTMLFormElement"),xm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Am}=Object.prototype,Pm=Qt("RegExp"),yu=(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)},Lm=e=>{yu(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+"'")})}})},Mm=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return qr(e)?n(e):n(String(e).split(t)),r},Fm=()=>{},$m=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function jm(e){return!!(e&&Dt(e.append)&&e[cu]==="FormData"&&e[gs])}const Bm=e=>{const t=new WeakSet,r=n=>{if(Sn(n)){if(t.has(n))return;if(wn(n))return n;if(!("toJSON"in n)){t.add(n);const s=qr(n)?[]:{};return vs(n,(i,o)=>{const a=r(i);!_n(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Um=Qt("AsyncFunction"),zm=e=>e&&(Sn(e)||Dt(e))&&Dt(e.then)&&Dt(e.catch),vu=((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)),Vm=typeof queueMicrotask<"u"?queueMicrotask.bind(Hr):typeof process<"u"&&process.nextTick||vu,mu=e=>e!=null&&Dt(e[gs]),D={isArray:qr,isArrayBuffer:uu,isBuffer:wn,isFormData:pm,isArrayBufferView:rm,isString:nm,isNumber:du,isBoolean:sm,isObject:Sn,isPlainObject:Si,isEmptyObject:im,isReadableStream:ym,isRequest:vm,isResponse:mm,isHeaders:bm,isUndefined:_n,isDate:om,isFile:am,isReactNativeBlob:lm,isReactNative:cm,isBlob:um,isRegExp:Pm,isFunction:Dt,isStream:fm,isURLSearchParams:gm,isTypedArray:Im,isFileList:dm,forEach:vs,merge:ia,extend:wm,trim:_m,stripBOM:Sm,inherits:Cm,toFlatObject:Em,kindOf:sa,kindOfTest:Qt,endsWith:Om,toArray:Dm,forEachEntry:Tm,matchAll:Nm,isHTMLForm:km,hasOwnProperty:_i,hasOwnProp:_i,hasOwnInPrototypeChain:ys,getSafeProp:tm,reduceDescriptors:yu,freezeMethods:Lm,toObjectSet:Mm,toCamelCase:xm,noop:Fm,toFiniteNumber:$m,findKey:pu,global:Hr,isContextDefined:gu,isSpecCompliantForm:jm,toJSONObject:Bm,isAsyncFn:Um,isThenable:zm,setImmediate:vu,asap:Vm,isIterable:mu,isSafeIterable:e=>e!=null&&ys(e,gs)&&mu(e)},qm=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"]),Hm=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]&&qm[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Wm(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 Km=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Qm=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function oa(e,t){return D.isArray(e)?e.map(r=>oa(r,t)):Wm(String(e).replace(t,""))}const Gm=e=>oa(e,Km),Ym=e=>oa(e,Qm);function bu(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=Ym(r)}),t}const _u=Symbol("internals");function ms(e){return e&&String(e).trim().toLowerCase()}function Ci(e){return e===!1||e==null?e:D.isArray(e)?e.map(Ci):Gm(String(e))}function Rm(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 Xm=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function aa(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 Zm(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Jm(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 ht=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=ms(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]=Ci(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())&&!Xm(t))o(Hm(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=ms(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Rm(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=ms(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||aa(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=ms(o),o){const a=D.findKey(n,o);a&&(!r||aa(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||aa(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]=Ci(s),delete r[i];return}const a=t?Zm(i):String(i).trim();a!==i&&delete r[i],r[a]=Ci(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[_u]=this[_u]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ms(o);n[a]||(Jm(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};ht.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(ht.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),D.freezeMethods(ht);const eb="[REDACTED ****]";function tb(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 rb(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 ht&&(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)&&tb(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?eb:s(c);D.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let X=class lp extends Error{static from(t,r,n,s,i,o){const a=new lp(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?rb(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 nb=null,wu=100;function la(e){return D.isPlainObject(e)||D.isArray(e)}function Su(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function ca(e,t,r){return e?e.concat(t).map(function(s,i){return s=Su(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function sb(e){return D.isArray(e)&&!e.some(la)}const ib=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function Ei(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?wu:r.maxDepth,d=a&&D.isSpecCompliantForm(t),u=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(m){if(m===null)return"";if(D.isDate(m))return m.toISOString();if(D.isBoolean(m))return m.toString();if(!d&&D.isBlob(m))throw new X("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(m)||D.isTypedArray(m)?d&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function g(m){if(m>c)throw new X("Object is too deeply nested ("+m+" levels). Max depth: "+c,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function y(m,_){if(c===1/0)return JSON.stringify(m);const S=[];return JSON.stringify(m,function(E,T){if(!D.isObject(T))return T;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(T),g(_+S.length-1),T})}function b(m,_,S){let w=m;if(D.isReactNative(t)&&D.isReactNativeBlob(m))return t.append(ca(S,_,i),f(m)),!1;if(m&&!S&&typeof m=="object"){if(D.endsWith(_,"{}"))_=n?_:_.slice(0,-2),m=y(m,1);else if(D.isArray(m)&&sb(m)||(D.isFileList(m)||D.endsWith(_,"[]"))&&(w=D.toArray(m)))return _=Su(_),w.forEach(function(T,x){!(D.isUndefined(T)||T===null)&&t.append(o===!0?ca([_],x,i):o===null?_:_+"[]",f(T))}),!1}return la(m)?!0:(t.append(ca(S,_,i),f(m)),!1)}const p=Object.assign(ib,{defaultVisitor:b,convertValue:f,isVisitable:la});function v(m,_,S=0){if(!D.isUndefined(m)){if(g(S),u.indexOf(m)!==-1)throw new Error("Circular reference detected in "+_.join("."));u.push(m),D.forEach(m,function(E,T){(!(D.isUndefined(E)||E===null)&&s.call(t,E,D.isString(T)?T.trim():T,_,p))===!0&&v(E,_?_.concat(T):[T],S+1)}),u.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return v(e),t}function Cu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function ua(e,t){this._pairs=[],e&&Ei(e,this,t)}const Eu=ua.prototype;Eu.append=function(t,r){this._pairs.push([t,r])},Eu.toString=function(t){const r=t?function(n){return t.call(this,n,Cu)}:Cu;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function ob(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ou(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||ob,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new ua(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Du{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 da={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},ab={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ua,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},fa=typeof window<"u"&&typeof document<"u",ha=typeof navigator=="object"&&navigator||void 0,lb=fa&&(!ha||["ReactNative","NativeScript","NS"].indexOf(ha.product)<0),cb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ub=fa&&window.location.href||"http://localhost",ct={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fa,hasStandardBrowserEnv:lb,hasStandardBrowserWebWorkerEnv:cb,navigator:ha,origin:ub},Symbol.toStringTag,{value:"Module"})),...ab};function db(e,t){return Ei(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 Iu=wu;function Tu(e){if(e>Iu)throw new X("FormData field is too deeply nested ("+e+" levels). Max depth: "+Iu,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function fb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Tu(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function hb(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 Nu(e){function t(r,n,s,i){Tu(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]=hb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(fb(n),s,r,0)}),r}return null}const Cn=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function pb(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 bs={transitional:da,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(Nu(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=Cn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return db(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=Cn(this,"env"),u=d&&d.FormData;return Ei(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),pb(t)):t}],transformResponse:[function(t){const r=Cn(this,"transitional")||bs.transitional,n=r&&r.forcedJSONParsing,s=Cn(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,Cn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?X.from(c,X.ERR_BAD_RESPONSE,this,null,Cn(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=>{bs.headers[e]={}});function pa(e,t){const r=this||bs,n=t||r,s=ht.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 ku(e){return!!(e&&e.__CANCEL__)}let _s=class extends X{constructor(t,r,n){super(t??"canceled",X.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function xu(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 gb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function yb(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 y=u&&d-u;return y?Math.round(g*1e3/y):void 0}}function vb(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 Oi=(e,t,r=3)=>{let n=0;const s=yb(50,250);return vb(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)},Au=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Pu=e=>(...t)=>D.asap(()=>e(...t)),mb=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,bb=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 _b(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function wb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Sb=/^https?:(?!\/\/)/i,Cb=/[\t\n\r]/g;function Eb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Ob(e){return Eb(e).replace(Cb,"")}function Lu(e,t){if(typeof e=="string"&&Sb.test(Ob(e)))throw new X('Invalid URL: missing "//" after protocol',X.ERR_INVALID_URL,t)}function Mu(e,t,r,n){Lu(t,n);let s=!_b(t);return e&&(s||r===!1)?(Lu(e,n),wb(e,t)):t}const Fu=e=>e instanceof ht?{...e}:e;function Wr(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,y){return D.isPlainObject(u)&&D.isPlainObject(f)?D.merge.call({caseless:y},u,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(u,f,g,y){if(D.isUndefined(f)){if(!D.isUndefined(u))return n(void 0,u,g,y)}else return n(u,f,g,y)}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(Fu(u),Fu(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,y=D.hasOwnProp(e,f)?e[f]:void 0,b=D.hasOwnProp(t,f)?t[f]:void 0,p=g(y,b,f);D.isUndefined(p)&&g!==c||(r[f]=p)}),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 Db=["content-type","content-length"];function Ib(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Db.includes(n.toLowerCase())&&e.set(n,s)})}const Tb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function $u(e){const t=Wr({},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=ht.from(a),t.url=Ou(Mu(d,f,u,t),r("params"),r("paramsSerializer")),c){const g=D.getSafeProp(c,"username")||"",y=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(y?Tb(y):"")))}if(D.isFormData(n)&&(ct.hasStandardBrowserEnv||ct.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&Ib(a,n.getHeaders(),r("formDataHeaderPolicy"))),ct.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&mb(t.url))){const y=i&&o&&bb.read(o);y&&a.set(i,y)}return t}const Nb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=$u(e);let i=s.data;const o=ht.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,g,y,b;function p(){y&&y(),b&&b(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function m(){if(!v)return;const S=ht.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),E={data:!a||a==="text"||a==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:S,config:e,request:v};xu(function(x){r(x),p()},function(x){n(x),p()},E),v=null}"onloadend"in v?v.onloadend=m:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(m)},v.onabort=function(){v&&(n(new X("Request aborted",X.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const E=w&&w.message?w.message:"Network Error",T=new X(E,X.ERR_NETWORK,e,v);T.event=w||null,n(T),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const E=s.transitional||da;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new X(w,E.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&D.forEach(bu(o),function(w,E){v.setRequestHeader(E,w)}),D.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),a&&a!=="json"&&(v.responseType=s.responseType),d&&([g,b]=Oi(d,!0),v.addEventListener("progress",g)),c&&v.upload&&([f,y]=Oi(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",y)),(s.cancelToken||s.signal)&&(u=S=>{v&&(n(!S||S.type?new _s(null,e,v):S),v.abort(),p(),v=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const _=gb(s.url);if(_&&!ct.protocols.includes(_)){n(new X("Unsupported protocol "+_+":",X.ERR_BAD_REQUEST,e));return}v.send(i||null)})},kb=(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 _s(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},xb=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},Ab=async function*(e,t){for await(const r of Pb(e))yield*xb(r,t)},Pb=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()}},ju=(e,t,r,n)=>{const s=Ab(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})},Di=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Lb=(e,t,r)=>t+2<r&&Di(e.charCodeAt(t+1))&&Di(e.charCodeAt(t+2));function Mb(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 y=0;y<a;y++)if(n.charCodeAt(y)===37&&y+2<a){const b=n.charCodeAt(y+1),p=n.charCodeAt(y+2);Di(b)&&Di(p)&&(o-=2,y+=2)}let c=0,d=a-1;const u=y=>y>=2&&n.charCodeAt(y-2)===37&&n.charCodeAt(y-1)===51&&(n.charCodeAt(y)===68||n.charCodeAt(y)===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&&Lb(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 ga="1.18.0",Bu=64*1024,{isFunction:Ii}=D,Fb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),Uu=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},zu=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$b=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},jb=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?Ii(s):typeof fetch=="function",c=Ii(i),d=Ii(o);if(!a)return!1;const u=a&&Ii(r),f=a&&(typeof n=="function"?(m=>_=>m.encode(_))(new n):async m=>new Uint8Array(await new i(m).arrayBuffer())),g=c&&u&&zu(()=>{let m=!1;const _=new i(ct.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),S=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),m&&!S}),y=d&&u&&zu(()=>D.isReadableStream(new o("").body)),b={stream:y&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!b[m]&&(b[m]=(_,S)=>{let w=_&&_[m];if(w)return w.call(_);throw new X(`Response type '${m}' is not supported`,X.ERR_NOT_SUPPORT,S)})});const p=async m=>{if(m==null)return 0;if(D.isBlob(m))return m.size;if(D.isSpecCompliantForm(m))return(await new i(ct.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(D.isArrayBufferView(m)||D.isArrayBuffer(m))return m.byteLength;if(D.isURLSearchParams(m)&&(m=m+""),D.isString(m))return(await f(m)).byteLength},v=async(m,_)=>{const S=D.toFiniteNumber(m.getContentLength());return S??p(_)};return async m=>{let{url:_,method:S,data:w,signal:E,cancelToken:T,timeout:x,onDownloadProgress:P,onUploadProgress:$,responseType:k,headers:L,withCredentials:B="same-origin",fetchOptions:A,maxContentLength:j,maxBodyLength:F}=$u(m);const Z=D.isNumber(j)&&j>-1,ae=D.isNumber(F)&&F>-1,be=Q=>D.hasOwnProp(m,Q)?m[Q]:void 0;let Ee=s||fetch;k=k?(k+"").toLowerCase():"text";let pe=kb([E,T&&T.toAbortSignal()],x),K=null;const J=pe&&pe.unsubscribe&&(()=>{pe.unsubscribe()});let se,U=null;const R=()=>new X("Request body larger than maxBodyLength limit",X.ERR_BAD_REQUEST,m,K);try{let Q;const ue=be("auth");if(ue){const ee=D.getSafeProp(ue,"username")||"",Ke=D.getSafeProp(ue,"password")||"";Q={username:ee,password:Ke}}if($b(_)){const ee=new URL(_,ct.origin);if(!Q&&(ee.username||ee.password)){const Ke=Uu(ee.username),tt=Uu(ee.password);Q={username:Ke,password:tt}}(ee.username||ee.password)&&(ee.username="",ee.password="",_=ee.href)}if(Q&&(L.delete("authorization"),L.set("Authorization","Basic "+btoa(Fb((Q.username||"")+":"+(Q.password||""))))),Z&&typeof _=="string"&&_.startsWith("data:")&&Mb(_)>j)throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K);if(ae&&S!=="get"&&S!=="head"){const ee=await p(w);if(typeof ee=="number"&&isFinite(ee)&&(se=ee,ee>F))throw R()}const Oe=ae&&(D.isReadableStream(w)||D.isStream(w)),Be=(ee,Ke,tt)=>ju(ee,Bu,H=>{if(ae&&H>F)throw U=R();Ke&&Ke(H)},tt);if(g&&S!=="get"&&S!=="head"&&($||Oe)){if(se=se??await v(L,w),se!==0||Oe){let ee=new i(_,{method:"POST",body:w,duplex:"half"}),Ke;if(D.isFormData(w)&&(Ke=ee.headers.get("content-type"))&&L.setContentType(Ke),ee.body){const[tt,H]=$&&Au(se,Oi(Pu($)))||[];w=Be(ee.body,tt,H)}}}else if(Oe&&!c&&u&&S!=="get"&&S!=="head")w=Be(w);else if(Oe&&c&&!g&&S!=="get"&&S!=="head")throw new X("Stream request bodies are not supported by the current fetch implementation",X.ERR_NOT_SUPPORT,m,K);D.isString(B)||(B=B?"include":"omit");const ve=c&&"credentials"in i.prototype;if(D.isFormData(w)){const ee=L.getContentType();ee&&/^multipart\/form-data/i.test(ee)&&!/boundary=/i.test(ee)&&L.delete("content-type")}L.set("User-Agent","axios/"+ga,!1);const ce={...A,signal:pe,method:S.toUpperCase(),headers:bu(L.normalize()),body:w,duplex:"half",credentials:ve?B:void 0};K=c&&new i(_,ce);let ge=await(c?Ee(K,A):Ee(_,ce));const $e=ht.from(ge.headers);if(Z){const ee=D.toFiniteNumber($e.getContentLength());if(ee!=null&&ee>j)throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K)}const qe=y&&(k==="stream"||k==="response");if(y&&ge.body&&(P||Z||qe&&J)){const ee={};["status","statusText","headers"].forEach(Re=>{ee[Re]=ge[Re]});const Ke=D.toFiniteNumber($e.getContentLength()),[tt,H]=P&&Au(Ke,Oi(Pu(P),!0))||[];let re=0;const ie=Re=>{if(Z&&(re=Re,re>j))throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K);tt&&tt(Re)};ge=new o(ju(ge.body,Bu,ie,()=>{H&&H(),J&&J()}),ee)}k=k||"text";let ke=await b[D.findKey(b,k)||"text"](ge,m);if(Z&&!y&&!qe){let ee;if(ke!=null&&(typeof ke.byteLength=="number"?ee=ke.byteLength:typeof ke.size=="number"?ee=ke.size:typeof ke=="string"&&(ee=typeof n=="function"?new n().encode(ke).byteLength:ke.length)),typeof ee=="number"&&ee>j)throw new X("maxContentLength size of "+j+" exceeded",X.ERR_BAD_RESPONSE,m,K)}return!qe&&J&&J(),await new Promise((ee,Ke)=>{xu(ee,Ke,{data:ke,headers:ht.from(ge.headers),status:ge.status,statusText:ge.statusText,config:m,request:K})})}catch(Q){if(J&&J(),pe&&pe.aborted&&pe.reason instanceof X){const ue=pe.reason;throw ue.config=m,K&&(ue.request=K),Q!==ue&&(ue.cause=Q),ue}throw U?(K&&!U.request&&(U.request=K),U):Q instanceof X?(K&&!Q.request&&(Q.request=K),Q):Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new X("Network Error",X.ERR_NETWORK,m,K,Q&&Q.response),{cause:Q.cause||Q}):X.from(Q,Q&&Q.code,m,K,Q&&Q.response)}}},Bb=new Map,Vu=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=Bb;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:jb(t)),u=d;return d};Vu();const ya={http:nb,xhr:Nb,fetch:{get:Vu}};D.forEach(ya,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const qu=e=>`- ${e}`,Ub=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,!Ub(n)&&(s=ya[(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(qu).join(`
452
+ `):" "+qu(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 Hu={getAdapter:zb,adapters:ya};function va(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _s(null,e)}function Wu(e){return va(e),e.headers=ht.from(e.headers),e.data=pa.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Hu.getAdapter(e.adapter||bs.adapter,e)(e).then(function(n){va(e),e.response=n;try{n.data=pa.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=ht.from(n.headers),n},function(n){if(!ku(n)&&(va(e),n&&n.response)){e.response=n.response;try{n.response.data=pa.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=ht.from(n.response.headers)}return Promise.reject(n)})}const Ti={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ti[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Ku={};Ti.transitional=function(t,r,n){function s(i,o){return"[Axios v"+ga+"] 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&&!Ku[o]&&(Ku[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}},Ti.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Vb(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 Ni={assertOptions:Vb,validators:Ti},pt=Ni.validators;let Kr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Du,response:new Du}}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=Hr(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Ii.assertOptions(n,{silentJSONParsing:ht.transitional(ht.boolean),forcedJSONParsing:ht.transitional(ht.boolean),clarifyTimeoutError:ht.transitional(ht.boolean),legacyInterceptorReqResOrdering:ht.transitional(ht.boolean),advertiseZstdAcceptEncoding:ht.transitional(ht.boolean),validateStatusUndefinedResolves:ht.transitional(ht.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:Ii.assertOptions(s,{encode:ht.function,serialize:ht.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ii.assertOptions(r,{baseUrl:ht.spelling("baseURL"),withXsrfToken:ht.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=ft.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(r)===!1)return;c=c&&p.synchronous;const v=r.transitional||aa;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,f=0,g;if(!c){const b=[zu.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 y=r;for(;f<g;){const b=a[f++],p=a[f++];try{y=b(y)}catch(v){p.call(this,v);break}}try{u=zu.call(this,y)}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=Hr(this.defaults,t);const r=xu(t.baseURL,t.url,t.allowAbsoluteUrls,t);return wu(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){Wr.prototype[t]=function(r,n){return this.request(Hr(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(Hr(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Wr.prototype[t]=r(),t!=="query"&&(Wr.prototype[t+"Form"]=r(!0))});let Pb=class Jh{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 ms(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 Jh(function(s){t=s}),cancel:t}}};function Mb(e){return function(r){return e.apply(null,r)}}function Lb(e){return D.isObject(e)&&e.isAxiosError===!0}const pa={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(pa).forEach(([e,t])=>{pa[t]=e});function qu(e){const t=new Wr(e),r=su(Wr.prototype.request,t);return D.extend(r,Wr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return qu(Hr(e,s))},r}const Xe=qu(vs);Xe.Axios=Wr,Xe.CanceledError=ms,Xe.CancelToken=Pb,Xe.isCancel=Du,Xe.VERSION=da,Xe.toFormData=Si,Xe.AxiosError=X,Xe.Cancel=Xe.CanceledError,Xe.all=function(t){return Promise.all(t)},Xe.spread=Mb,Xe.isAxiosError=Lb,Xe.mergeConfig=Hr,Xe.AxiosHeaders=ft,Xe.formToJSON=e=>Eu(D.isHTMLForm(e)?new FormData(e):e),Xe.getAdapter=Uu.getAdapter,Xe.HttpStatusCode=pa,Xe.default=Xe;const{Axios:SD,AxiosError:CD,CanceledError:OD,isCancel:ED,CancelToken:DD,VERSION:ID,all:TD,Cancel:ND,isAxiosError:kD,spread:xD,toFormData:AD,AxiosHeaders:PD,HttpStatusCode:MD,formToJSON:LD,getAdapter:FD,mergeConfig:$D,create:jD}=Xe;let ga="";function Hu(e){ga=e}const Fe=Xe.create({timeout:3e4});Fe.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Lv),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),ga&&(e.baseURL=ga),e});const Wu=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Fb(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:Wu,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Fe.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 $b(e){var r,n,s;return e.length?((s=(n=(r=(await Fe.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Wu,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 Ku(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=>Ku(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 Qu(e){var s,i,o,a,c,d,u;const t=await Fe.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=Ku(r);return{content:r,rootNode:n}}async function jb(e,t,r,n){var i;return((i=(await Fe.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function Bb(e,t=""){await Fe.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function Ub(e){var r,n;return(n=(r=(await Fe.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function zb(e){await Fe.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function Vb(e,t){await Fe.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function qb(e,t){await Fe.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Ie={container:"_container_r27rp_1",header:"_header_r27rp_13",title:"_title_r27rp_22",closeBtn:"_closeBtn_r27rp_29",body:"_body_r27rp_45",label:"_label_r27rp_54",searchSection:"_searchSection_r27rp_62",searchRow:"_searchRow_r27rp_68",searchInput:"_searchInput_r27rp_74",searchSpinner:"_searchSpinner_r27rp_89",resultsList:"_resultsList_r27rp_105",resultItem:"_resultItem_r27rp_118",userInfo:"_userInfo_r27rp_133",userName:"_userName_r27rp_141",userEmail:"_userEmail_r27rp_150",userOrg:"_userOrg_r27rp_158",noResults:"_noResults_r27rp_167",collabSection:"_collabSection_r27rp_174",sectionTitle:"_sectionTitle_r27rp_179",badge:"_badge_r27rp_189",emptyCollab:"_emptyCollab_r27rp_203",collabList:"_collabList_r27rp_214",collabItem:"_collabItem_r27rp_223",userAvatar:"_userAvatar_r27rp_237",error:"_error_r27rp_251",success:"_success_r27rp_257",footer:"_footer_r27rp_263"},Hb=({contentId:e,onClose:t})=>{var P,$;const r=oe(k=>k.editorConfig),n=(P=r==null?void 0:r.context)==null?void 0:P.channel,s=($=r==null?void 0:r.config)==null?void 0:$.objectType,[i,o]=h.useState(""),[a,c]=h.useState([]),[d,u]=h.useState(!1),[f,g]=h.useState([]),[y,b]=h.useState(!1),[p,v]=h.useState(""),[m,_]=h.useState(!1),S=h.useRef(null);h.useEffect(()=>{let k=!1;return(async()=>{try{const M=await Ub(e),B=(M==null?void 0:M.collaborators)??[];if(!B.length)return;const A=await $b(B);if(k)return;const j=B.map(F=>A.find(Z=>Z.identifier===F)??{identifier:F,firstName:F});g(j)}catch{}})(),()=>{k=!0}},[e]),h.useEffect(()=>{S.current&&clearTimeout(S.current);const k=i.trim();if(k.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const M=await Fb(k,{rootOrgId:n,objectType:s}),B=new Set(f.map(A=>A.identifier));c(M.filter(A=>!B.has(A.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(k=>{g(M=>M.find(B=>B.identifier===k.identifier)?M:[...M,k]),c(M=>M.filter(B=>B.identifier!==k.identifier)),_(!1)},[]),O=h.useCallback(k=>{g(M=>M.filter(B=>B.identifier!==k)),_(!1)},[]),T=h.useCallback(async()=>{b(!0),v(""),_(!1);try{await qb(e,f.map(k=>k.identifier)),_(!0)}catch{v("Failed to save collaborators. Please try again.")}finally{b(!1)}},[e,f]),x=k=>`${k.firstName}${k.lastName?` ${k.lastName}`:""}`;return l.jsxs("div",{className:Ie.container,children:[l.jsxs("div",{className:Ie.header,children:[l.jsx("h2",{className:Ie.title,children:"Manage Collaborators"}),l.jsx("button",{className:Ie.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ie.body,children:[l.jsxs("div",{className:Ie.searchSection,children:[l.jsx("label",{className:Ie.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Ie.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Ie.searchInput,placeholder:"Search by name or email...",value:i,onChange:k=>o(k.target.value)}),d&&l.jsx("span",{className:Ie.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Ie.resultsList,role:"listbox","aria-label":"Search results",children:a.map(k=>{var M,B,A,j;return l.jsxs("li",{className:Ie.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Ie.userInfo,children:[l.jsx("span",{className:Ie.userName,children:x(k)}),k.email&&l.jsx("span",{className:Ie.userEmail,children:k.email}),(((B=(M=k.organisations)==null?void 0:M[0])==null?void 0:B.orgName)??k.rootOrgName)&&l.jsx("span",{className:Ie.userOrg,children:((j=(A=k.organisations)==null?void 0:A[0])==null?void 0:j.orgName)??k.rootOrgName})]}),l.jsx(Pe,{variant:"primary",size:"sm",onClick:()=>w(k),children:"Add"})]},k.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Ie.noResults,children:"No users found."})]}),l.jsxs("div",{className:Ie.collabSection,children:[l.jsxs("h3",{className:Ie.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Ie.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Ie.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Ie.collabList,children:f.map(k=>{var M,B,A,j;return l.jsxs("li",{className:Ie.collabItem,children:[l.jsx("div",{className:Ie.userAvatar,"aria-hidden":"true",children:x(k).charAt(0).toUpperCase()}),l.jsxs("div",{className:Ie.userInfo,children:[l.jsx("span",{className:Ie.userName,children:x(k)}),k.email&&l.jsx("span",{className:Ie.userEmail,children:k.email}),(((B=(M=k.organisations)==null?void 0:M[0])==null?void 0:B.orgName)??k.rootOrgName)&&l.jsx("span",{className:Ie.userOrg,children:((j=(A=k.organisations)==null?void 0:A[0])==null?void 0:j.orgName)??k.rootOrgName})]}),l.jsx(Pe,{variant:"danger",size:"sm",onClick:()=>O(k.identifier),children:"Remove"})]},k.identifier)})})]}),p&&l.jsx("p",{className:Ie.error,role:"alert",children:p}),m&&l.jsx("p",{className:Ie.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Ie.footer,children:[l.jsx(Pe,{variant:"ghost",onClick:t,disabled:y,children:"Cancel"}),l.jsx(Pe,{variant:"primary",isLoading:y,onClick:T,children:"Save"})]})]})};async function Wb(e){return(await Fe.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function Kb(e,t){var s;const n=((s=(await Fe.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 Qb(e){var n;const r=((n=(await Fe.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 le={topbar:"_topbar_zj8wk_1",left:"_left_zj8wk_15",right:"_right_zj8wk_23",backBtn:"_backBtn_zj8wk_30",title:"_title_zj8wk_49",statusChip:"_statusChip_zj8wk_61",savedIndicator:"_savedIndicator_zj8wk_73",unsaved:"_unsaved_zj8wk_83",iconBtn:"_iconBtn_zj8wk_88",iconBtnLabel:"_iconBtnLabel_zj8wk_115",qrDropdown:"_qrDropdown_zj8wk_119",qrMenu:"_qrMenu_zj8wk_123",reviewBtns:"_reviewBtns_zj8wk_158",sourcingBtns:"_sourcingBtns_zj8wk_167",modalOverlay:"_modalOverlay_zj8wk_176",sbOverlay:"_sbOverlay_zj8wk_186",sbModal:"_sbModal_zj8wk_196",sbModalHeader:"_sbModalHeader_zj8wk_207",sbModalTitle:"_sbModalTitle_zj8wk_215",sbModalClose:"_sbModalClose_zj8wk_222",sbModalBody:"_sbModalBody_zj8wk_235",sbLabel:"_sbLabel_zj8wk_242",sbTextarea:"_sbTextarea_zj8wk_249",sbError:"_sbError_zj8wk_266",sbModalFooter:"_sbModalFooter_zj8wk_273"};function Gb(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Yb(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const Gu=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=h.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:le.sbModalTitle,children:e}),l.jsx("button",{className:le.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:le.sbModalBody,children:[l.jsxs("label",{className:le.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:le.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:le.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:le.sbModalFooter,children:[l.jsx(Pe,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Pe,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Rb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:le.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:le.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:le.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:le.sbModalFooter,children:[l.jsx(Pe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Pe,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Xb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:le.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:le.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:le.sbModalBody,children:[l.jsxs("label",{className:le.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:le.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:le.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:le.sbModalFooter,children:[l.jsx(Pe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Pe,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Zb=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var je,ye;const a=Ae(ce=>ce.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=Yb(((je=a==null?void 0:a.metadata)==null?void 0:je.status)??(a==null?void 0:a.status)),u=oe(ce=>{var ge,Le,Ve,ke;return((Le=(ge=ce.editorConfig)==null?void 0:ge.context)==null?void 0:Le.contentId)??((ke=(Ve=ce.editorConfig)==null?void 0:Ve.context)==null?void 0:ke.identifier)??""}),{activeModal:f,modalData:g,closeModal:y,openModal:b}=Bv(),p=oe(ce=>ce.buttonLoaders),v=oe(ce=>ce.categoryMeta),m=!v||v.schemaDefaults.generateDIALCodes!=="No",[_,S]=h.useState(!1),[w,O]=h.useState(!1),[T,x]=h.useState(!1),[P,$]=h.useState(!1),k=h.useRef(null),[M,B]=h.useState(!1);h.useEffect(()=>{if(!P)return;const ce=ge=>{var Le;(Le=k.current)!=null&&Le.contains(ge.target)||$(!1)};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[P]);const[A,j]=h.useState(!1),[F,Z]=h.useState(!1),{updateNode:ae}=Ae(),me=(ye=a==null?void 0:a.metadata)==null?void 0:ye.qrCodeProcessId,Oe=h.useCallback(async ce=>{if(u){B(!1),j(!0);try{const{processId:ge,reservedDialcodes:Le}=await Kb(u,ce);ge&&a&&ae(a.id,{qrCodeProcessId:ge,reservedDialcodes:Le}),De.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{De.error("Failed to generate QR Codes. Please try again.")}finally{j(!1)}}},[u,a,ae]),pe=h.useCallback(async()=>{if(!me){De.error("No QR codes generated yet. Generate QR Codes first.");return}Z(!0);try{const ce=await Qb(me);if(ce.status==="in-process"){De("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const ge=ce.url;if(!ge){De.error("QR Codes not ready yet. Please wait and try again.");return}const Le=await fetch(ge).then(ie=>ie.blob()),Ve=await new Promise(ie=>{const Re=new FileReader;Re.onloadend=()=>ie(Re.result),Re.readAsDataURL(Le)}),ke=(a==null?void 0:a.metadata)??{},ee=ie=>Array.isArray(ie)?ie.join("_"):typeof ie=="string"?ie:"",Ke=[u,ee(ke.medium),ee(ke.gradeLevel),ee(ke.subject)].filter(Boolean),tt=new Date().toISOString().replace(/[:.]/g,"-"),H=`${Ke.join("_")}_${tt}.zip`,re=document.createElement("a");re.href=Ve,re.download=H,re.style.display="none",document.body.appendChild(re),re.click(),document.body.removeChild(re),De.success("QR codes downloaded.")}catch{De.error("Failed to download QR Codes.")}finally{Z(!1)}},[me,a,u]),K=e==="edit",J=e==="review",se=e==="sourcingreview",U=e==="read",R=h.useCallback((ce,ge)=>{i({action:ce,data:ge})},[i]),Q=h.useCallback(()=>{y(),R("publish")},[y,R]),ue=h.useCallback((ce,ge)=>{const Le=g==null?void 0:g.action;y(),Le==="approve"?R("sourcingApprove",{comment:ce,score:ge}):R("reject",{comment:ce})},[y,R,g]),Ee=h.useCallback(ce=>{S(!1),R("sendBackForCorrections",{comment:ce})},[R]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:le.topbar,role:"banner",children:[l.jsxs("div",{className:le.left,children:[l.jsx("button",{className:le.backBtn,onClick:()=>R("back"),"aria-label":"Go back",type:"button",children:l.jsx(nv,{size:18})}),l.jsx("h1",{className:le.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${le.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:le.right,children:[t?l.jsx("span",{className:le.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${le.savedIndicator} ${le.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:le.savedIndicator,"aria-live":"polite",children:[l.jsx(yn,{size:14,"aria-hidden":"true"}),"Saved ",Gb(n)]}):null,!U&&!J&&!se&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Pe,{variant:"ghost",size:"sm",onClick:()=>R("saveCollection"),disabled:!s,children:"Save as Draft"})}),K&&l.jsxs(l.Fragment,{children:[l.jsxs(Pe,{variant:"primary",size:"sm",onClick:()=>x(!0),disabled:p.saveCollection,isLoading:p.saveCollection,children:[l.jsx(bv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:le.iconBtn,onClick:()=>b("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(Sv,{size:16,"aria-hidden":"true"})}),m&&l.jsxs("div",{className:le.qrDropdown,ref:k,children:[l.jsxs("button",{className:le.iconBtn,onClick:()=>$(ce=>!ce),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":P,children:[l.jsx(Vc,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:le.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),P&&l.jsxs("div",{className:le.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),B(!0)},disabled:A,children:[l.jsx(Vc,{size:14}),A?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),pe()},disabled:F||!me,children:[l.jsx(lv,{size:14}),F?"Downloading…":"Download QR Codes"]})]})]})]}),J&&l.jsxs("div",{className:le.reviewBtns,children:[l.jsxs(Pe,{variant:"primary",size:"sm",onClick:()=>b("publishChecklist"),disabled:p.publishCollection,isLoading:p.publishCollection,children:[l.jsx($c,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Pe,{variant:"danger",size:"sm",onClick:()=>O(!0),disabled:p.rejectCollection,isLoading:p.rejectCollection,children:[l.jsx(Bo,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Pe,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[l.jsx(vv,{size:14,"aria-hidden":"true"})," Send Back"]})]}),se&&l.jsxs("div",{className:le.sourcingBtns,children:[l.jsxs(Pe,{variant:"primary",size:"sm",onClick:()=>b("qualityParams",{action:"approve"}),children:[l.jsx(_v,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Pe,{variant:"danger",size:"sm",onClick:()=>b("qualityParams",{action:"reject"}),children:[l.jsx(Bo,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(Vv,{contentId:u,onConfirm:Q,onCancel:y}),f==="qualityParams"&&l.jsx(qv,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:ue,onCancel:y}),f==="manageCollaborators"&&l.jsx("div",{className:le.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(Hb,{contentId:u,onClose:y})}),T&&l.jsx(Rb,{onConfirm:()=>{x(!1),R("sendForReview")},onCancel:()=>x(!1)}),w&&l.jsx(Gu,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:ce=>{O(!1),R("reject",{comment:ce})},onCancel:()=>O(!1)}),_&&l.jsx(Gu,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:Ee,onCancel:()=>S(!1)}),M&&l.jsx(Xb,{onConfirm:Oe,onCancel:()=>B(!1)})]})},Jb=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>qe.createPortal(l.jsx("div",{className:Me.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Me.modal,children:[l.jsxs("div",{className:Me.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Me.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Me.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:Me.modalFooter,children:[l.jsx(Pe,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Pe,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Pe,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var e_=Xo();const Yu=h.createContext(null);function Dt(){const e=h.useContext(Yu);if(e===null)throw new Error("No Tree Api Provided");return e}const Ru=h.createContext(null);function t_(){const e=h.useContext(Ru);if(e===null)throw new Error("Provide a NodesContext");return e}const Xu=h.createContext(null);function r_(){const e=h.useContext(Xu);if(e===null)throw new Error("Provide a DnDContext");return e}const Zu=h.createContext(0);function Ju(){h.useContext(Zu)}function Ti(e,t,r){return Math.max(Math.min(e,r),t)}function ed(e){return e&&e.isLeaf}function td(e){return e&&e.isInternal&&!e.isOpen}function rd(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const nd=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},sd=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function ya(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=ya(r,t);if(n)return n}return null}function Ni(e,t){if(t(e),e.children)for(let r of e.children)Ni(r,t)}function id(e){const t=ad(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=n_(t,n);break}r==null||r.focus()}function od(e){const t=ad(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=s_(t,n);break}r==null||r.focus()}function n_(e,t){return t+1<e.length?e[t+1]:e[0]}function s_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function ad(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 bs(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function Cn(e){return typeof e=="string"?e:e.id}function i_(e,...t){if(e)return e(...t)}function ld(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function cd(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 ud(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const o_=Object.freeze(Object.defineProperty({__proto__:null,access:bs,bound:Ti,dfs:ya,focusNextElement:id,focusPrevElement:od,getInsertIndex:cd,getInsertParentId:ud,identify:Cn,indexOf:sd,isClosed:td,isDescendant:nd,isItem:ed,isOpenWithEmptyChildren:rd,safeRun:i_,waitFor:ld,walk:Ni},Symbol.toStringTag,{value:"Module"})),a_={display:"flex",alignItems:"center",zIndex:1},l_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},c_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},u_=h.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({},a_),s),children:[l.jsx("div",{style:Object.assign({},c_)}),l.jsx("div",{style:Object.assign({},l_)})]})});function d_({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 f_(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(p_,Object.assign({},e)):l.jsx(h_,Object.assign({},e))]})}function h_(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function p_({node:e}){const t=h.useRef();return h.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 _s="__REACT_ARBORIST_INTERNAL_ROOT__";function dd(e){var t;function r(i,o,a){const c=e.accessId(i),d=new ws({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 ws({tree:e,id:_s,data:{id:_s},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 ws{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===_s}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 ws(Object.assign({},this))}edit(){return this.tree.edit(this)}}function va(e){return{type:"EDIT",id:e}}function g_(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function On(e){return{type:"FOCUS",id:e}}function y_(){return{type:"TREE_BLUR"}}function v_(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 ma={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 fd(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 m_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:fd(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:fd(e.unfiltered,t)}):e}const En=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}}},Er={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:Cn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(Cn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(Cn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:Cn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:Cn(e)})};function b_(e=En().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 Dn={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 __(e=En().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 En().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const w_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},S_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},C_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function hd({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(O_,{isDragging:s,children:[l.jsx(E_,{offset:e,children:l.jsx(I_,{id:r,dragIds:n})}),l.jsx(D_,{mouse:t,count:n.length})]})}const O_=h.memo(function(t){return t.isDragging?l.jsx("div",{style:w_,children:t.children}):null});function E_(e){return l.jsx("div",{className:"row preview",style:S_(e.offset),children:e.children})}function D_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:C_(r),children:t}):null}const I_=h.memo(function(t){const r=Dt(),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 pd(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 T_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_a(e,t)}var gd=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function N_(e,t){return!!(e===t||gd(e)&&gd(t))}function k_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!N_(e[r],t[r]))return!1;return!0}function wa(e,t){t===void 0&&(t=k_);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 x_=typeof performance=="object"&&typeof performance.now=="function",yd=x_?function(){return performance.now()}:function(){return Date.now()};function vd(e){cancelAnimationFrame(e.id)}function A_(e,t){var r=yd();function n(){yd()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Sa=-1;function md(e){if(e===void 0&&(e=!1),Sa===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Sa=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Sa}var In=null;function bd(e){if(e===void 0&&(e=!1),In===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?In="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?In="negative":In="positive-ascending"),document.body.removeChild(t),In}return In}process.env.NODE_ENV;var P_=150,M_=function(t,r){return t},ki=null,xi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ki=new WeakSet,xi=new WeakSet);function _d(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){T_(g,f);function g(b){var p;return p=f.call(this,b)||this,p._instanceProps=c(p.props,pd(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:pd(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=wa(function(v,m,_,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:_,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=wa(function(v,m,_){return p.props.onScroll({scrollDirection:v,scrollOffset:m,scrollUpdateWasRequested:_})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var m=p.props,_=m.direction,S=m.itemSize,w=m.layout,O=p._getItemStyleCache(d&&S,d&&w,d&&_),T;if(O.hasOwnProperty(v))T=O[v];else{var x=r(p.props,v,p._instanceProps),P=s(p.props,v,p._instanceProps),$=_==="horizontal"||w==="horizontal",k=_==="rtl",M=$?x:0;O[v]=T={position:"absolute",left:k?void 0:M,right:k?M:void 0,top:$?0:x,height:$?"100%":P,width:$?P:"100%"}}return T},p._getItemStyleCache=void 0,p._getItemStyleCache=wa(function(v,m,_){return{}}),p._onScrollHorizontal=function(v){var m=v.currentTarget,_=m.clientWidth,S=m.scrollLeft,w=m.scrollWidth;p.setState(function(O){if(O.scrollOffset===S)return null;var T=p.props.direction,x=S;if(T==="rtl")switch(bd()){case"negative":x=-S;break;case"positive-descending":x=w-_-S;break}return x=Math.max(0,Math.min(x,w-_)),{isScrolling:!0,scrollDirection:O.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var m=v.currentTarget,_=m.clientHeight,S=m.scrollHeight,w=m.scrollTop;p.setState(function(O){if(O.scrollOffset===w)return null;var T=Math.max(0,Math.min(w,S-_));return{isScrolling:!0,scrollDirection:O.scrollOffset<T?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var m=p.props.outerRef;p._outerRef=v,typeof m=="function"?m(v):m!=null&&typeof m=="object"&&m.hasOwnProperty("current")&&(m.current=v)},p._resetIsScrollingDebounced=function(){p._resetIsScrollingTimeoutId!==null&&vd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=A_(p._resetIsScrolling,P_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}g.getDerivedStateFromProps=function(p,v){return L_(p,v),u(p),null};var y=g.prototype;return y.scrollTo=function(p){p=Math.max(0,p),this.setState(function(v){return v.scrollOffset===p?null:{scrollDirection:v.scrollOffset<p?"forward":"backward",scrollOffset:p,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(p,v){v===void 0&&(v="auto");var m=this.props,_=m.itemCount,S=m.layout,w=this.state.scrollOffset;p=Math.max(0,Math.min(p,_-1));var O=0;if(this._outerRef){var T=this._outerRef;S==="vertical"?O=T.scrollWidth>T.clientWidth?md():0:O=T.scrollHeight>T.clientHeight?md():0}this.scrollTo(i(this.props,p,v,w,this._instanceProps,O))},y.componentDidMount=function(){var p=this.props,v=p.direction,m=p.initialScrollOffset,_=p.layout;if(typeof m=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||_==="horizontal"?S.scrollLeft=m:S.scrollTop=m}this._callPropsCallbacks()},y.componentDidUpdate=function(){var p=this.props,v=p.direction,m=p.layout,_=this.state,S=_.scrollOffset,w=_.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var O=this._outerRef;if(v==="horizontal"||m==="horizontal")if(v==="rtl")switch(bd()){case"negative":O.scrollLeft=-S;break;case"positive-ascending":O.scrollLeft=S;break;default:var T=O.clientWidth,x=O.scrollWidth;O.scrollLeft=x-T-S;break}else O.scrollLeft=S;else O.scrollTop=S}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&vd(this._resetIsScrollingTimeoutId)},y.render=function(){var p=this.props,v=p.children,m=p.className,_=p.direction,S=p.height,w=p.innerRef,O=p.innerElementType,T=p.innerTagName,x=p.itemCount,P=p.itemData,$=p.itemKey,k=$===void 0?M_:$,M=p.layout,B=p.outerElementType,A=p.outerTagName,j=p.style,F=p.useIsScrolling,Z=p.width,ae=this.state.isScrolling,me=_==="horizontal"||M==="horizontal",Oe=me?this._onScrollHorizontal:this._onScrollVertical,pe=this._getRangeToRender(),K=pe[0],J=pe[1],se=[];if(x>0)for(var U=K;U<=J;U++)se.push(h.createElement(v,{data:P,key:k(U,P),index:U,isScrolling:F?ae:void 0,style:this._getItemStyle(U)}));var R=n(this.props,this._instanceProps);return h.createElement(B||A||"div",{className:m,onScroll:Oe,ref:this._outerRefSetter,style:ba({position:"relative",height:S,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:_},j)},h.createElement(O||T||"div",{children:se,ref:w,style:{height:me?"100%":R,pointerEvents:ae?"none":void 0,width:me?R:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],_=v[1],S=v[2],w=v[3];this._callOnItemsRendered(m,_,S,w)}}if(typeof this.props.onScroll=="function"){var O=this.state,T=O.scrollDirection,x=O.scrollOffset,P=O.scrollUpdateWasRequested;this._callOnScroll(T,x,P)}},y._getRangeToRender=function(){var p=this.props,v=p.itemCount,m=p.overscanCount,_=this.state,S=_.isScrolling,w=_.scrollDirection,O=_.scrollOffset;if(v===0)return[0,0,0,0];var T=o(this.props,O,this._instanceProps),x=a(this.props,T,O,this._instanceProps),P=!S||w==="backward"?Math.max(1,m):1,$=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,T-P),Math.max(0,Math.min(v-1,x+$)),T,x]},g}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var L_=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)&&xi&&!xi.has(u)&&(xi.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":ki&&!ki.has(u)&&(ki.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.'))}},F_=50,Tn=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]},$_=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?wd(t,r,i,0,n):j_(t,r,Math.max(0,i),n)},wd=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Tn(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},j_=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Tn(t,n,r).offset<s;)n+=o,o*=2;return wd(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Sd=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},B_=_d({getItemOffset:function(t,r,n){return Tn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Sd,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,y=Tn(t,r,i),b=Sd(t,i),p=Math.max(0,Math.min(b-g,y.offset)),v=Math.max(0,y.offset-g+y.size+o);switch(n==="smart"&&(s>=v-g&&s<=p+g?n="auto":n="center"),n){case"start":return p;case"end":return v;case"center":return Math.round(v+(p-v)/2);case"auto":default:return s>=v&&s<=p?s:s<v?v:p}},getStartIndexForOffset:function(t,r,n){return $_(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=Tn(t,r,s),y=n+f,b=g.offset+g.size,p=r;p<a-1&&b<y;)p++,b+=Tn(t,p,s).size;return p},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||F_,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.'))}}),U_=_d({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,y=a==="horizontal"||f==="horizontal",b=y?g:c,p=Math.max(0,d*u-b),v=Math.min(p,r*u),m=Math.max(0,r*u-b+u+o);switch(n==="smart"&&(s>=m-b&&s<=v+b?n="auto":n="center"),n){case"start":return v;case"end":return m;case"center":{var _=Math.round(m+(v-m)/2);return _<Math.ceil(b/2)?0:_>p+Math.floor(b/2)?p:_}case"auto":default:return s>=m&&s<=v?s:s<m?m:v}},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,y=Math.ceil((g+n-f)/a);return Math.max(0,Math.min(o-1,r+y-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 z_(){var e,t;const r=Dt(),s=r_().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 V_=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 q_=h.forwardRef(function(t,r){const{children:n}=t,s=V_(t,["children"]),i=Dt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(H_,{}),n]}))}),H_=()=>{const e=Dt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(z_,{})})};var W_=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 K_=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=W_(t,["style"]);const d=Dt(),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 Cd=h.createContext({dragDropManager:void 0}),jt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(jt||(jt={}));function fe(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 Ca="dnd-core/INIT_COORDS",Ai="dnd-core/BEGIN_DRAG",Oa="dnd-core/PUBLISH_DRAG_SOURCE",Pi="dnd-core/HOVER",Mi="dnd-core/DROP",Li="dnd-core/END_DRAG";function Od(e,t){return{type:Ca,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function Fi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fi=function(r){return typeof r}:Fi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Fi(e)}function Q_(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function G_(e,t){return e.filter(function(r){return r!==t})}function Ed(e){return Fi(e)==="object"}function Y_(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 R_(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var X_={type:Ca,payload:{clientOffset:null,sourceClientOffset:null}};function Z_(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(Od(o)),J_(r,c,d);var u=rw(r,c);if(u===null){e.dispatch(X_);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");ew(a),f=a(u)}e.dispatch(Od(o,f));var g=d.getSource(u),y=g.beginDrag(c,u);if(y!=null){tw(y),d.pinSource(u);var b=d.getSourceType(u);return{type:Ai,payload:{itemType:b,item:y,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function J_(e,t,r){fe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){fe(r.getSource(n),"Expected sourceIds to be registered.")})}function ew(e){fe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function tw(e){fe(Ed(e),"Item must be an object.")}function rw(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 nw(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Oa}}}function Ea(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function sw(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;iw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();ow(i,o,a);var c=o.getItemType();return aw(i,a,c),lw(i,o,a),{type:Pi,payload:{targetIds:i,clientOffset:s||null}}}}function iw(e){fe(Array.isArray(e),"Expected targetIds to be an array.")}function ow(e,t,r){fe(t.isDragging(),"Cannot call hover while not dragging."),fe(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];fe(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);fe(i,"Expected targetIds to be registered.")}}function aw(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 lw(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Dd(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 Id(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dd(Object(r),!0).forEach(function(n){cw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uw(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();dw(n);var i=pw(n);i.forEach(function(o,a){var c=fw(o,a,s,n),d={type:Mi,payload:{dropResult:Id(Id({},r),c)}};e.dispatch(d)})}}function dw(e){fe(e.isDragging(),"Cannot call drop while not dragging."),fe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function fw(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return hw(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function hw(e){fe(typeof e>"u"||Ed(e),"Drop result must either be an object or undefined.")}function pw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function gw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();yw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Li}}}function yw(e){fe(e.isDragging(),"Cannot call endDrag while not dragging.")}function vw(e){return{beginDrag:Z_(e),publishDragSource:nw(e),hover:sw(e),drop:uw(e),endDrag:gw(e)}}function mw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bw(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 _w(e,t,r){return t&&bw(e.prototype,t),e}function Ss(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ww=function(){function e(t,r){var n=this;mw(this,e),Ss(this,"store",void 0),Ss(this,"monitor",void 0),Ss(this,"backend",void 0),Ss(this,"isSetUp",!1),Ss(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 _w(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=vw(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 Bt(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 Td=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Nd=function(){return Math.random().toString(36).substring(7).split("").join(".")},kd={INIT:"@@redux/INIT"+Nd(),REPLACE:"@@redux/REPLACE"+Nd()};function Sw(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 Cw(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(Dw(e))return"date";if(Ew(e))return"error";var r=Ow(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 Ow(e){return typeof e.constructor=="function"?e.constructor.name:null}function Ew(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Dw(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Nn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Cw(e)),t}function xd(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"?Bt(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"?Bt(1):"Expected the enhancer to be a function. Instead, received: '"+Nn(r)+"'");return r(xd)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(2):"Expected the root reducer to be a function. Instead, received: '"+Nn(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"?Bt(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(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(4):"Expected the listener to be a function. Instead, received: '"+Nn(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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 v=!0;return d(),a.push(p),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Bt(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();var _=a.indexOf(p);a.splice(_,1),o=null}}}function g(p){if(!Sw(p))throw new Error(process.env.NODE_ENV==="production"?Bt(7):"Actions must be plain objects. Instead, the actual type was: '"+Nn(p)+"'. 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 p.type>"u")throw new Error(process.env.NODE_ENV==="production"?Bt(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"?Bt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,p)}finally{c=!1}for(var v=o=a,m=0;m<v.length;m++){var _=v[m];_()}return p}function y(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Bt(10):"Expected the nextReducer to be a function. Instead, received: '"+Nn(p));s=p,g({type:kd.REPLACE})}function b(){var p,v=f;return p={subscribe:function(_){if(typeof _!="object"||_===null)throw new Error(process.env.NODE_ENV==="production"?Bt(11):"Expected the observer to be an object. Instead, received: '"+Nn(_)+"'");function S(){_.next&&_.next(u())}S();var w=v(S);return{unsubscribe:w}}},p[Td]=function(){return this},p}return g({type:kd.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:y},n[Td]=b,n}var Iw=function(t,r){return t===r};function Tw(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Nw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Iw;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 Ad(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 Pd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ad(Object(r),!0).forEach(function(n){kw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ad(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Md={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function xw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Md,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ca:case Ai:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Pi:return Tw(e.clientOffset,r.clientOffset)?e:Pd(Pd({},e),{},{clientOffset:r.clientOffset});case Li:case Mi:return Md;default:return e}}var Da="dnd-core/ADD_SOURCE",Ia="dnd-core/ADD_TARGET",Ta="dnd-core/REMOVE_SOURCE",$i="dnd-core/REMOVE_TARGET";function Aw(e){return{type:Da,payload:{sourceId:e}}}function Pw(e){return{type:Ia,payload:{targetId:e}}}function Mw(e){return{type:Ta,payload:{sourceId:e}}}function Lw(e){return{type:$i,payload:{targetId:e}}}function Ld(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 Ut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ld(Object(r),!0).forEach(function(n){Fw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ld(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $w={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function jw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$w,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ai:return Ut(Ut({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Oa:return Ut(Ut({},e),{},{isSourcePublic:!0});case Pi:return Ut(Ut({},e),{},{targetIds:r.targetIds});case $i:return e.targetIds.indexOf(r.targetId)===-1?e:Ut(Ut({},e),{},{targetIds:G_(e.targetIds,r.targetId)});case Mi:return Ut(Ut({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Li:return Ut(Ut({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Bw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Da:case Ia:return e+1;case Ta:case $i:return e-1;default:return e}}var ji=[],Na=[];ji.__IS_NONE__=!0,Na.__IS_ALL__=!0;function Uw(e,t){if(e===ji)return!1;if(e===Na||typeof t>"u")return!0;var r=R_(t,e);return r.length>0}function zw(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Pi:break;case Da:case Ia:case $i:case Ta:return ji;case Ai:case Oa:case Li:case Mi:default:return Na}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=Y_(n,i),a=o.length>0||!Nw(n,i);if(!a)return ji;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function Vw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Fd(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 $d(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fd(Object(r),!0).forEach(function(n){qw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:zw(e.dirtyHandlerIds,{type:t.type,payload:$d($d({},t.payload),{},{prevTargetIds:Q_(e,"dragOperation.targetIds",[])})}),dragOffset:xw(e.dragOffset,t),refCount:Bw(e.refCount,t),dragOperation:jw(e.dragOperation,t),stateId:Vw(e.stateId)}}function Ww(e,t){return{x:e.x+t.x,y:e.y+t.y}}function jd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Kw(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:jd(Ww(t,n),r)}function Qw(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:jd(t,r)}function Gw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yw(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 Rw(e,t,r){return t&&Yw(e.prototype,t),e}function Bd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Xw=function(){function e(t,r){Gw(this,e),Bd(this,"store",void 0),Bd(this,"registry",void 0),this.store=t,this.registry=r}return Rw(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;fe(typeof r=="function","listener must be a function."),fe(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&&!Uw(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;fe(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 fe(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(fe(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(fe(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 Kw(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return Qw(this.store.getState().dragOffset)}}]),e}(),Zw=0;function Jw(){return Zw++}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 eS(e){fe(typeof e.canDrag=="function","Expected canDrag to be a function."),fe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),fe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function tS(e){fe(typeof e.canDrop=="function","Expected canDrop to be a function."),fe(typeof e.hover=="function","Expected hover to be a function."),fe(typeof e.drop=="function","Expected beginDrag to be a function.")}function ka(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return ka(r,!1)});return}fe(typeof e=="string"||Bi(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 Ud=typeof global<"u"?global:self,zd=Ud.MutationObserver||Ud.WebKitMutationObserver;function Vd(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function rS(e){let t=1;const r=new zd(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const nS=typeof zd=="function"?rS:Vd;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=nS(this.flush),this.requestErrorThrow=Vd(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class iS{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 iS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const qd=new sS,aS=new oS(qd.registerPendingError);function lS(e){qd.enqueueTask(aS.create(e))}function cS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uS(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 dS(e,t,r){return t&&uS(e.prototype,t),e}function kn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fS(e,t){return yS(e)||gS(e,t)||pS(e,t)||hS()}function hS(){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 pS(e,t){if(e){if(typeof e=="string")return Hd(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 Hd(e,t)}}function Hd(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 gS(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 yS(e){if(Array.isArray(e))return e}function vS(e){var t=Jw().toString();switch(e){case jt.SOURCE:return"S".concat(t);case jt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Wd(e){switch(e[0]){case"S":return jt.SOURCE;case"T":return jt.TARGET;default:fe(!1,"Cannot parse handler ID: ".concat(e))}}function Kd(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=fS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var mS=function(){function e(t){cS(this,e),kn(this,"types",new Map),kn(this,"dragSources",new Map),kn(this,"dropTargets",new Map),kn(this,"pinnedSourceId",null),kn(this,"pinnedSource",null),kn(this,"store",void 0),this.store=t}return dS(e,[{key:"addSource",value:function(r,n){ka(r),eS(n);var s=this.addHandler(jt.SOURCE,r,n);return this.store.dispatch(Aw(s)),s}},{key:"addTarget",value:function(r,n){ka(r,!0),tS(n);var s=this.addHandler(jt.TARGET,r,n);return this.store.dispatch(Pw(s)),s}},{key:"containsHandler",value:function(r){return Kd(this.dragSources,r)||Kd(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;fe(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 fe(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return fe(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return fe(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Wd(r);return n===jt.SOURCE}},{key:"isTargetId",value:function(r){var n=Wd(r);return n===jt.TARGET}},{key:"removeSource",value:function(r){var n=this;fe(this.getSource(r),"Expected an existing source."),this.store.dispatch(Mw(r)),lS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){fe(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Lw(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);fe(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){fe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=vS(r);return this.types.set(i,n),r===jt.SOURCE?this.dragSources.set(i,s):r===jt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function bS(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 Xw(s,new mS(s)),o=new ww(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 xd(Hw,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var wS=["children"];function SS(e,t){return DS(e)||ES(e,t)||OS(e,t)||CS()}function CS(){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 OS(e,t){if(e){if(typeof e=="string")return Qd(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 Qd(e,t)}}function Qd(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 ES(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 DS(e){if(Array.isArray(e))return e}function IS(e,t){if(e==null)return{};var r=TS(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 TS(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 Gd=0,Ui=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),NS=h.memo(function(t){var r=t.children,n=IS(t,wS),s=kS(n),i=SS(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=Yd();return++Gd,function(){--Gd===0&&(c[Ui]=null)}}},[]),l.jsx(Cd.Provider,Object.assign({value:o},{children:r}),void 0)});function kS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=xS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function xS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Yd(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[Ui]||(s[Ui]={dragDropManager:bS(e,t,r,n)}),s[Ui]}function Yd(){return typeof global<"u"?global:window}function AS(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 MS(e,t,r){return t&&PS(e.prototype,t),e}function Rd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xa=!1,Aa=!1,LS=function(){function e(t){AS(this,e),Rd(this,"internalMonitor",void 0),Rd(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return MS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){fe(!xa,"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 xa=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{xa=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;fe(!Aa,"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 Aa=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Aa=!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 FS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $S(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&&$S(e.prototype,t),e}function Xd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Pa=!1,BS=function(){function e(t){FS(this,e),Xd(this,"internalMonitor",void 0),Xd(this,"targetId",null),this.internalMonitor=t.getMonitor()}return jS(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;fe(!Pa,"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 Pa=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Pa=!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 US(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 zS(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(!h.isValidElement(t)){var n=t;return e(n,r),n}var s=t;US(s);var i=r?function(o){return e(o,r)}:e;return VS(s,i)}}function Zd(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=zS(n);t[r]=function(){return s}}}),t}function Jd(e,t){typeof e=="function"?e(t):e.current=t}function VS(e,t){var r=e.ref;return fe(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?h.cloneElement(e,{ref:function(s){Jd(r,s),Jd(t,s)}}):h.cloneElement(e,{ref:t})}function zi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?zi=function(r){return typeof r}:zi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},zi(e)}function Ma(e){return e!==null&&zi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function La(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 qS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HS(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 WS(e,t,r){return t&&HS(e.prototype,t),e}function pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var KS=function(){function e(t){var r=this;qS(this,e),pt(this,"hooks",Zd({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Ma(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Ma(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),pt(this,"handlerId",null),pt(this,"dragSourceRef",null),pt(this,"dragSourceNode",void 0),pt(this,"dragSourceOptionsInternal",null),pt(this,"dragSourceUnsubscribe",void 0),pt(this,"dragPreviewRef",null),pt(this,"dragPreviewNode",void 0),pt(this,"dragPreviewOptionsInternal",null),pt(this,"dragPreviewUnsubscribe",void 0),pt(this,"lastConnectedHandlerId",null),pt(this,"lastConnectedDragSource",null),pt(this,"lastConnectedDragSourceOptions",null),pt(this,"lastConnectedDragPreview",null),pt(this,"lastConnectedDragPreviewOptions",null),pt(this,"backend",void 0),this.backend=t}return WS(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!La(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!La(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 QS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GS(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 YS(e,t,r){return t&&GS(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 RS=function(){function e(t){var r=this;QS(this,e),er(this,"hooks",Zd({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Ma(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 YS(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!La(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 XS(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function ZS(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var Kr=typeof window<"u"?h.useLayoutEffect:h.useEffect;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 JS(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 tC(e,t,r){return t&&eC(e.prototype,t),e}function Fa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rC=function(){function e(t,r,n){JS(this,e),Fa(this,"spec",void 0),Fa(this,"monitor",void 0),Fa(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return tC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return Vi(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 nC(e,t,r){var n=h.useMemo(function(){return new rC(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Qr(){var e=h.useContext(Cd),t=e.dragDropManager;return fe(t!=null,"Expected drag drop context"),t}function sC(e){return h.useMemo(function(){var t=e.type;return fe(t!=null,"spec.type must be defined"),t},[e])}function iC(e,t){return cC(e)||lC(e,t)||aC(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 aC(e,t){if(e){if(typeof e=="string")return ef(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 ef(e,t)}}function ef(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 lC(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 cC(e){if(Array.isArray(e))return e}function uC(e,t,r){var n=Qr(),s=nC(e,t,r),i=sC(e);Kr(function(){if(i!=null){var a=ZS(i,s,n),c=iC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function dC(e){return gC(e)||pC(e)||hC(e)||fC()}function fC(){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 hC(e,t){if(e){if(typeof e=="string")return $a(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 $a(e,t)}}function pC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function gC(e){if(Array.isArray(e))return $a(e)}function $a(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 tf(e,t){var r=dC(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function yC(){var e=Qr();return h.useMemo(function(){return new LS(e)},[e])}function vC(e,t){var r=Qr(),n=h.useMemo(function(){return new KS(r.getBackend())},[r]);return Kr(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),Kr(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var mC=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 bC=Wc(mC);function _C(e,t){return OC(e)||CC(e,t)||SC(e,t)||wC()}function wC(){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 SC(e,t){if(e){if(typeof e=="string")return rf(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 rf(e,t)}}function rf(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 CC(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 OC(e){if(Array.isArray(e))return e}function nf(e,t,r){var n=h.useState(function(){return t(e)}),s=_C(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);bC(i,c)||(o(c),r&&r())},[i,e,r]);return Kr(a),[i,a]}function EC(e,t){return NC(e)||TC(e,t)||IC(e,t)||DC()}function DC(){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 IC(e,t){if(e){if(typeof e=="string")return sf(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 sf(e,t)}}function sf(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 TC(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 kC(e,t,r){var n=nf(e,t,r),s=EC(n,2),i=s[0],o=s[1];return Kr(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function of(e,t,r){return kC(t,e||function(){return{}},function(){return r.reconnect()})}function xC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function AC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function PC(e,t){var r=tf(e,t);fe(!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=yC(),s=vC(r.options,r.previewOptions);return uC(r,n,s),[of(r.collect,n,s),xC(s),AC(s)]}function MC(e){var t=e.accept;return h.useMemo(function(){return fe(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function LC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FC(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&&FC(e.prototype,t),e}function af(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jC=function(){function e(t,r){LC(this,e),af(this,"spec",void 0),af(this,"monitor",void 0),this.spec=t,this.monitor=r}return $C(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 BC(e,t){var r=h.useMemo(function(){return new jC(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function UC(e,t){return HC(e)||qC(e,t)||VC(e,t)||zC()}function zC(){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 VC(e,t){if(e){if(typeof e=="string")return lf(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 lf(e,t)}}function lf(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 qC(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 HC(e){if(Array.isArray(e))return e}function WC(e,t,r){var n=Qr(),s=BC(e,t),i=MC(e);Kr(function(){var a=XS(i,s,n),c=UC(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 KC(){var e=Qr();return h.useMemo(function(){return new BS(e)},[e])}function QC(e){var t=Qr(),r=h.useMemo(function(){return new RS(t.getBackend())},[t]);return Kr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function GC(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function cf(e,t){var r=tf(e,t),n=KC(),s=QC(r.options);return WC(r,n,s),[of(r.collect,n,s),GC(s)]}function YC(e,t){return JC(e)||ZC(e,t)||XC(e,t)||RC()}function RC(){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 XC(e,t){if(e){if(typeof e=="string")return uf(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 uf(e,t)}}function uf(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 JC(e){if(Array.isArray(e))return e}function e0(e){var t=Qr(),r=t.getMonitor(),n=nf(r,e),s=YC(n,2),i=s[0],o=s[1];return h.useEffect(function(){return r.subscribeToOffsetChange(o)}),h.useEffect(function(){return r.subscribeToStateChange(o)}),i}function df(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function t0(e,t){return e.filter(function(r){return r!==t})}function r0(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 n0(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 i0(e,t,r){return t&&s0(e.prototype,t),e}function ff(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){n0(this,e),ff(this,"entered",[]),ff(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return i0(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=r0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=t0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),a0=df(function(){return/firefox/i.test(navigator.userAgent)}),hf=df(function(){return!!window.safari});function l0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c0(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&&c0(e.prototype,t),e}function Cs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pf=function(){function e(t,r){l0(this,e),Cs(this,"xs",void 0),Cs(this,"ys",void 0),Cs(this,"c1s",void 0),Cs(this,"c2s",void 0),Cs(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(P,$){return t[P]<t[$]?-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 y=a[g],b=a[g+1];if(y*b<=0)f.push(0);else{c=o[g];var p=o[g+1],v=c+p;f.push(3*v/((v+p)/y+(v+c)/b))}}f.push(a[a.length-1]);for(var m=[],_=[],S,w=0;w<f.length-1;w++){S=a[w];var O=f[w],T=1/o[w],x=O+f[w+1]-S-S;m.push((S-O-x)*T),_.push(x*T*T)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=m,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 y=r-n[c],b=y*y;return s[c]+i[c]*y+o[c]*b+a[c]*y*b}}]),e}(),d0=1;function gf(e){var t=e.nodeType===d0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function qi(e){return{x:e.clientX,y:e.clientY}}function f0(e){var t;return e.nodeName==="IMG"&&(a0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function h0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return hf()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function p0(e,t,r,n,s){var i=f0(t),o=i?e:t,a=gf(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,g=n.anchorY,y=h0(i,t,d,u),b=y.dragPreviewWidth,p=y.dragPreviewHeight,v=function(){var x=new pf([0,.5,1],[c.y,c.y/u*p,c.y+p-u]),P=x.interpolate(g);return hf()&&i&&(P+=(window.devicePixelRatio-1)*p),P},m=function(){var x=new pf([0,.5,1],[c.x,c.x/d*b,c.x+b-d]);return x.interpolate(f)},_=s.offsetX,S=s.offsetY,w=_===0||_,O=S===0||S;return{x:w?_:m(),y:O?S:v()}}var yf="__NATIVE_FILE__",vf="__NATIVE_URL__",mf="__NATIVE_TEXT__",bf="__NATIVE_HTML__";const _f=Object.freeze(Object.defineProperty({__proto__:null,FILE:yf,HTML:bf,TEXT:mf,URL:vf},Symbol.toStringTag,{value:"Module"}));function ja(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var xn;function Hi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ba=(xn={},Hi(xn,yf,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Hi(xn,bf,{exposeProperties:{html:function(t,r){return ja(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Hi(xn,vf,{exposeProperties:{urls:function(t,r){return ja(t,r,"").split(`
465
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Hi(xn,mf,{exposeProperties:{text:function(t,r){return ja(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),xn);function g0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y0(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 v0(e,t,r){return t&&y0(e.prototype,t),e}function wf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var m0=function(){function e(t){g0(this,e),wf(this,"item",void 0),wf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return v0(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 b0(e,t){var r=new m0(Ba[e]);return r.loadDataTransfer(t),r}function Ua(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ba).filter(function(r){var n=Ba[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 w0(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 S0(e,t,r){return t&&w0(e.prototype,t),e}function za(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var C0=function(){function e(t,r){_0(this,e),za(this,"ownerDocument",null),za(this,"globalContext",void 0),za(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return S0(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 Sf(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 Cf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sf(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function O0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E0(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 D0(e,t,r){return t&&E0(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 I0=function(){function e(t,r,n){var s=this;O0(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&&gf(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=qi(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Ua(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 y=s.getCurrentSourcePreviewNodeOptions(),b=y.anchorX,p=y.anchorY,v=y.offsetX,m=y.offsetY,_={anchorX:b,anchorY:p},S={offsetX:v,offsetY:m},w=p0(f,g,a,_,S);c.setDragImage(g,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var O=s.getCurrentSourcePreviewNodeOptions(),T=O.captureDraggingState;T?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=Ua(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:qi(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=qi(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 Ua(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:qi(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 C0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new o0(this.isNodeInDocument)}return D0(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 Cf({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 Cf({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(_f).some(function(n){return _f[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=b0(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}(),Wi;function T0(){return Wi||(Wi=new Image,Wi.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Wi}var N0=function(t,r,n){return new I0(t,r,n)};function k0(e,t){return typeof e=="function"?e(t):e??"NODE"}function x0(e){return e.isDraggable&&!e.isEditing}function A0(e){const t=Dt(),r=t.selectedIds,[n,s,i]=PC(()=>({canDrag:()=>x0(e),type:k0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Dn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Dn.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{i(T0())},[i]),s}function P0(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 M0(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 Ki(e,t){return{parentId:e||null,index:t}}function An(e,t){return{type:"line",index:e,level:t}}function L0(e){return{type:"highlight",id:e}}function Va(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=sd(n)+1;return{parentId:s,index:i}}function Of(e){var t;const r=P0(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]=M0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Ki(i.id,null),cursor:L0(i.id)};if(!c)return{drop:Ki((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:An(0,0)};if(ed(c)){const u=Ti(s,(d==null?void 0:d.level)||0,c.level);return{drop:Va(c,u),cursor:An(c.rowIndex+1,u)}}if(td(c)){const u=Ti(s,(d==null?void 0:d.level)||0,c.level);return{drop:Va(c,u),cursor:An(c.rowIndex+1,u)}}if(rd(c)){const u=Ti(s,0,c.level+1);return u>c.level?{drop:Ki(c.id,0),cursor:An(c.rowIndex+1,u)}:{drop:Va(c,u),cursor:An(c.rowIndex+1,u)}}return{drop:Ki(c==null?void 0:c.id,0),cursor:An(c.rowIndex+1,c.level+1)}}function F0(e,t){const r=Dt(),[n,s]=cf(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=Of({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(Dn.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 $0(e){const t=Dt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return h.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const Ef=h.memo(function({index:t,style:r}){Ju(),t_();const n=Dt(),s=$0(t),i=h.useRef(null),o=A0(s),a=F0(i,s),c=h.useCallback(p=>{i.current=p,a(p)},[a]),d=n.indent*s.level,u=h.useMemo(()=>({paddingLeft:d}),[d]),f=h.useMemo(()=>{var p,v;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((v=(p=n.props.padding)!==null&&p!==void 0?p:n.props.paddingTop)!==null&&v!==void 0?v: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};h.useEffect(()=>{var p;!s.isEditing&&s.isFocused&&((p=i.current)===null||p===void 0||p.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const y=n.renderNode,b=n.renderRow;return l.jsx(b,{node:s,innerRef:c,attrs:g,children:l.jsx(y,{node:s,tree:n,style:u,dragHandle:o})})});let qa="",Df=null;function If(){Ju();const e=Dt();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(),id(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),od(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(Df),qa+=t.key,Df=setTimeout(()=>{qa=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(qa):!1});n&&e.focus(n.id)},children:l.jsx(j0,{})})}function j0(){var e,t;const r=Dt(),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:q_,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:K_,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(B_,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:Ef})):l.jsx(U_,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:Ef}))}function Tf(e){return e.isFiltered?U0(e.root,e.isMatch.bind(e)):B0(e.root)}function B0(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(Nf),t}function U0(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(Nf),n}function Nf(e,t){e.rowIndex=t}const kf=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ha=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:gt}=o_;class Os{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=dd(this),this.visibleNodes=Tf(this),this.idToIndex=kf(this.visibleNodes)}update(t){this.props=t,this.root=dd(this),this.visibleNodes=Tf(this),this.idToIndex=kf(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=bs(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=bs(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 ws)return t.id;const r=this.props.idAccessor||"id";return bs(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 Ha(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?ud(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:cd(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield gt(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 Ha(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 gt(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(va(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=>{Os.editPromise=i})}submit(t,r){return Ha(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield gt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(va(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(va(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&gt(this.props.onActivate,r)}resolveEdit(t){const r=Os.editPromise;r&&r(t),Os.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(On(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&gt(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(On(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&&gt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Er.remove(r)),gt(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(On(n.id)),n.isSelectable&&(this.dispatch(Er.add(n.id)),this.dispatch(Er.anchor(n.id)),this.dispatch(Er.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&gt(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(On(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(Er.remove(this.nodesBetween(s,i))),this.dispatch(Er.add(o)),this.dispatch(Er.mostRecent(n))}this.scrollTo(n),this.focusedNode&&gt(this.props.onFocus,this.focusedNode),gt(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(On((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&gt(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(Er.set({ids:n,anchor:s,mostRecent:i})),gt(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&&nd(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;gt(this.props.onMove,{dragIds:n,parentId:t===_s?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Dn.cursor({type:"none"}))}showCursor(t){this.dispatch(Dn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(ma.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),gt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(ma.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),gt(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=ya(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(){Ni(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ni(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),ld(()=>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===_s)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!bs(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(On(t.id))}onBlur(){this.dispatch(y_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||If}get renderRow(){return this.props.renderRow||d_}get renderNode(){return this.props.children||f_}get renderDragPreview(){return this.props.renderDragPreview||hd}get renderCursor(){return this.props.renderCursor||u_}}function yt(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 z0=typeof Symbol=="function"&&Symbol.observable||"@@observable",xf=z0,Wa=()=>Math.random().toString(36).substring(7).split("").join("."),V0={INIT:`@@redux/INIT${Wa()}`,REPLACE:`@@redux/REPLACE${Wa()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Wa()}`},Gr=V0;function Af(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 q0(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(K0(e))return"date";if(W0(e))return"error";const r=H0(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 H0(e){return typeof e.constructor=="function"?e.constructor.name:null}function W0(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function K0(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Dr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=q0(e)),t}function Pf(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?yt(2):`Expected the root reducer to be a function. Instead, received: '${Dr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?yt(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"?yt(1):`Expected the enhancer to be a function. Instead, received: '${Dr(r)}'`);return r(Pf)(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((v,m)=>{o.set(m,v)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?yt(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(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?yt(4):`Expected the listener to be a function. Instead, received: '${Dr(v)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?yt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let m=!0;d();const _=a++;return o.set(_,v),function(){if(m){if(c)throw new Error(process.env.NODE_ENV==="production"?yt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");m=!1,d(),o.delete(_),i=null}}}function g(v){if(!Af(v))throw new Error(process.env.NODE_ENV==="production"?yt(7):`Actions must be plain objects. Instead, the actual type was: '${Dr(v)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof v.type>"u")throw new Error(process.env.NODE_ENV==="production"?yt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof v.type!="string")throw new Error(process.env.NODE_ENV==="production"?yt(17):`Action "type" property must be a string. Instead, the actual type was: '${Dr(v.type)}'. Value was: '${v.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?yt(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,v)}finally{c=!1}return(i=o).forEach(_=>{_()}),v}function y(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?yt(10):`Expected the nextReducer to be a function. Instead, received: '${Dr(v)}`);n=v,g({type:Gr.REPLACE})}function b(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?yt(11):`Expected the observer to be an object. Instead, received: '${Dr(m)}'`);function _(){const w=m;w.next&&w.next(u())}return _(),{unsubscribe:v(_)}},[xf](){return this}}}return g({type:Gr.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:y,[xf]:b}}function Mf(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Q0(e,t,r,n){const s=Object.keys(t),i=r&&r.type===Gr.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(!Af(e))return`The ${i} has unexpected type of "${Dr(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===Gr.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 G0(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Gr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?yt(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:Gr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?yt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Gr.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 Lf(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"&&Mf(`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{G0(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=Q0(a,r,c,s);f&&Mf(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const g=n[f],y=r[g],b=a[g],p=y(b,c);if(typeof p>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?yt(14):`When called with an action of type ${v?`"${String(v)}"`:"(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]=p,d=d||p!==b}return d=d||n.length!==Object.keys(a).length,d?u:a}}function Y0(e=En().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 R0=Lf({nodes:Lf({focus:v_,edit:g_,open:m_,selection:b_,drag:Y0}),dnd:__}),X0=En();function Z0({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(Pf(R0,En(e))),o=e_.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>X0),a=h.useMemo(()=>new Os(i.current,e,n,s),[]),c=h.useRef(0);return h.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),h.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),h.useImperativeHandle(t,()=>a),h.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),h.useEffect(()=>{a.props.searchTerm||i.current.dispatch(ma.clear(!0))},[a.props.searchTerm]),l.jsx(Yu.Provider,{value:a,children:l.jsx(Zu.Provider,{value:c.current,children:l.jsx(Ru.Provider,{value:o.nodes,children:l.jsx(Xu.Provider,{value:o.dnd,children:l.jsx(NS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||N0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function J0(){const e=Dt(),[,t]=cf(()=>({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}=Of({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Dn.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 e1(e){return J0(),e.children}function t1(){const t=Dt().props.renderContainer||If;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function r1(){const e=Dt(),{offset:t,mouse:r,item:n,isDragging:s}=e0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||hd;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 n1(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=n1(r),this.root=i1(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 i1(e,t){const r=new Ff({},null,t,"ROOT");return r.children=e.map(n=>Ka(n,r,t)),r}function Ka(e,t,r){const n=new Ff(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>Ka(i,n,r))),n}class Ff{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=Ka(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 a1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new s1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=b=>{for(const p of b.dragIds)o.move({id:p,parentId:b.parentId,index:b.index});n(o.data)},c=({name:b,id:p})=>{o.update({id:p,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:p,type:v})=>{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(v==="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 m={[d]:`simple-tree-id-${o1++}`,name:""};return v==="internal"&&(m[u]=[]),o.create({parentId:b,index:p,data:m}),n(o.data),m},onDelete:b=>{b.ids.forEach(p=>o.drop({id:p})),n(o.data)}}]}function l1(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]=a1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function c1(e,t){const r=l1(e);return l.jsxs(Z0,{treeProps:r,imperativeHandle:t,children:[l.jsx(e1,{children:l.jsx(t1,{})}),l.jsx(r1,{})]})}const u1=h.forwardRef(c1);function Qa(){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 d1(){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 $f={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},jf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Bf=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],f1=[{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 h1(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 Qi(e){const t=h1(e);return{key:t,color:$f[t]??$f.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:jf[t]??jf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const It={row:"_row_i3qt2_1",grip:"_grip_i3qt2_16",menuBtn:"_menuBtn_i3qt2_19",selected:"_selected_i3qt2_23",title:"_title_i3qt2_28",dropTarget:"_dropTarget_i3qt2_33",toggle:"_toggle_i3qt2_50",ctIcon:"_ctIcon_i3qt2_65",folderIcon:"_folderIcon_i3qt2_77",renameInput:"_renameInput_i3qt2_92",dropHere:"_dropHere_i3qt2_101",menuWrap:"_menuWrap_i3qt2_111",menu:"_menu_i3qt2_19",dangerItem:"_dangerItem_i3qt2_163"},p1={video:Ko,pdf:Uo,h5p:zo,scorm:qo,audio:Vo,quiz:jo,default:vn},g1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,d]=h.useState(e.data.name),u=h.useRef(null),f=n==="edit",g=Qa(),y=Qi(e.data),b=p1[y.key]??vn,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),_=v?iv:m?uv:b;h.useEffect(()=>{if(!s)return;const O=T=>{var x;(x=u.current)!=null&&x.contains(T.target)||i(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[s]);const S=h.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=h.useCallback(O=>{O.key==="Enter"&&S(),O.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[It.row,p?It.selected:"",e.state.isOver&&m?It.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":m?"true":void 0,role:"treeitem","aria-selected":p,"aria-expanded":m?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:It.grip,"aria-hidden":"true",children:l.jsx(Uc,{size:14})}),l.jsx("button",{className:It.toggle,onClick:O=>{O.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(Fc,{size:14}):l.jsx(ds,{size:14})}),l.jsx("span",{className:`${It.ctIcon} ${v||m?It.folderIcon:y.bgClass}`,"aria-hidden":"true",children:l.jsx(_,{size:12})}),o?l.jsx("input",{className:It.renameInput,value:c,autoFocus:!0,onChange:O=>d(O.target.value),onBlur:S,onKeyDown:w,onClick:O=>O.stopPropagation()}):l.jsx("span",{className:It.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&&m&&l.jsx("span",{className:It.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:It.menuWrap,ref:u,children:[l.jsx("button",{className:It.menuBtn,onClick:O=>{O.stopPropagation(),i(T=>!T)},"aria-label":"Node options",children:l.jsx(jc,{size:14})}),s&&l.jsxs("div",{className:It.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(yv,{size:13})," Rename"]}),m&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Bc,{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:It.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Wo,{size:13})," Delete"]})]})]})]})};async function y1(e,t){var i,o;const n=((i=(await Fe.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 v1(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 m1(e,t){var a;const r=await y1(e,t.name),n=await v1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Fe.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function b1(e){var r;return((r=(await Fe.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Uf(e){var n,s,i;const r=(i=(s=(n=(await Fe.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 _1(e){return Uf(e)}const xe={container:"_container_jr3ij_1",header:"_header_jr3ij_13",title:"_title_jr3ij_22",closeBtn:"_closeBtn_jr3ij_29",body:"_body_jr3ij_45",dropZone:"_dropZone_jr3ij_54",dragOver:"_dragOver_jr3ij_67",hasFile:"_hasFile_jr3ij_72",hiddenInput:"_hiddenInput_jr3ij_78",fileInfo:"_fileInfo_jr3ij_82",fileIcon:"_fileIcon_jr3ij_89",fileName:"_fileName_jr3ij_93",fileSize:"_fileSize_jr3ij_100",dropHint:"_dropHint_jr3ij_105",dropIcon:"_dropIcon_jr3ij_112",dropText:"_dropText_jr3ij_117",dropSubtext:"_dropSubtext_jr3ij_124",sampleLink:"_sampleLink_jr3ij_130",statusBar:"_statusBar_jr3ij_145",status_uploading:"_status_uploading_jr3ij_154",status_processing:"_status_processing_jr3ij_154",status_done:"_status_done_jr3ij_159",status_error:"_status_error_jr3ij_164",successDetail:"_successDetail_jr3ij_170",spinner:"_spinner_jr3ij_175",spin:"_spin_jr3ij_175",errorMsg:"_errorMsg_jr3ij_191",failedSection:"_failedSection_jr3ij_197",failedTitle:"_failedTitle_jr3ij_203",tableWrap:"_tableWrap_jr3ij_213",failedTable:"_failedTable_jr3ij_219",reasonCell:"_reasonCell_jr3ij_244",footer:"_footer_jr3ij_248"},w1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState("idle"),[u,f]=h.useState(""),[g,y]=h.useState([]),[b,p]=h.useState(null),v=h.useRef(null),m=h.useRef(null),_=h.useCallback(()=>{m.current!==null&&(clearInterval(m.current),m.current=null)},[]);h.useEffect(()=>()=>_(),[_]);const S=k=>k.name.toLowerCase().endsWith(".csv")?k.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=h.useCallback(k=>{f(""),y([]),p(null),d("idle"),S(k)&&i(k)},[]),O=h.useCallback(k=>{k.preventDefault(),a(!1);const M=k.dataTransfer.files[0];M&&w(M)},[w]),T=h.useCallback(k=>{var B;const M=(B=k.target.files)==null?void 0:B[0];M&&w(M),k.target.value=""},[w]),x=h.useCallback(async()=>{try{const k=await _1(e),M=document.createElement("a");M.href=k,M.download="sample_hierarchy.csv",M.target="_blank",M.click()}catch{f("Failed to download sample CSV.")}},[e]),P=h.useCallback(async()=>{if(s){d("uploading"),f(""),y([]);try{const{processId:k}=await m1(e,s);if(!k){d("done"),p(null),setTimeout(t,1500);return}d("processing"),m.current=setInterval(async()=>{try{const M=await b1(k);M.status==="COMPLETED"?(_(),d("done"),p(M.successCount??null),M.failedRecords&&M.failedRecords.length>0?y(M.failedRecords):setTimeout(t,1500)):M.status==="FAILED"&&(_(),d("error"),f("Upload processing failed. Please check the error rows below."),M.failedRecords&&y(M.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,_]),$={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:xe.container,children:[l.jsxs("div",{className:xe.header,children:[l.jsx("h2",{className:xe.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:xe.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:xe.body,children:[l.jsxs("div",{className:`${xe.dropZone} ${o?xe.dragOver:""} ${s?xe.hasFile:""}`,onDragEnter:k=>{k.preventDefault(),a(!0)},onDragOver:k=>{k.preventDefault(),a(!0)},onDragLeave:k=>{k.preventDefault(),a(!1)},onDrop:O,onClick:()=>{var k;return(k=v.current)==null?void 0:k.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:k=>{var M;return k.key==="Enter"&&((M=v.current)==null?void 0:M.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:xe.hiddenInput,onChange:T,"aria-hidden":"true"}),s?l.jsxs("div",{className:xe.fileInfo,children:[l.jsx("span",{className:xe.fileIcon,children:"📄"}),l.jsx("span",{className:xe.fileName,children:s.name}),l.jsxs("span",{className:xe.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:xe.dropHint,children:[l.jsx("span",{className:xe.dropIcon,children:"⬆️"}),l.jsx("p",{className:xe.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:xe.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:xe.sampleLink,onClick:x,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${xe.statusBar} ${xe[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:xe.spinner,"aria-hidden":"true"}),$[c],c==="done"&&b!==null&&l.jsxs("span",{className:xe.successDetail,children:[" — ",b," item(s) imported"]})]}),u&&l.jsx("p",{className:xe.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:xe.failedSection,children:[l.jsxs("h4",{className:xe.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:xe.tableWrap,children:l.jsxs("table",{className:xe.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((k,M)=>l.jsxs("tr",{children:[l.jsx("td",{children:k.rowNumber??M+1}),l.jsx("td",{children:k.name??"—"}),l.jsx("td",{className:xe.reasonCell,children:k.reason??"Unknown error"})]},M))})]})})]})]}),l.jsxs("div",{className:xe.footer,children:[l.jsx(Pe,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Pe,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:P,children:c==="done"?"Uploaded":"Upload"})]})]})},tr={container:"_container_1y30m_1",header:"_header_1y30m_8",headerActions:"_headerActions_1y30m_19",iconBtn:"_iconBtn_1y30m_25",menuWrap:"_menuWrap_1y30m_43",dropdownMenu:"_dropdownMenu_1y30m_47",treeWrapper:"_treeWrapper_1y30m_79",csvModal:"_csvModal_1y30m_95",footer:"_footer_1y30m_105"},S1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var pe;const n=h.useRef(null),s=h.useRef(null),i=h.useRef(null),[o,a]=h.useState(400),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[g,y]=h.useState("create"),{treeData:b,selectedNodeId:p,selectNode:v,addNode:m,deleteNode:_,reorderChildren:S,moveNode:w,setTreeData:O}=Ae(),T=e==="edit",x=Qa(),P=T&&x,$=(((pe=b[0])==null?void 0:pe.children)??[]).some(K=>K.isFolder),k=oe(K=>{var J,se,U,R;return((se=(J=K.editorConfig)==null?void 0:J.context)==null?void 0:se.contentId)??((R=(U=K.editorConfig)==null?void 0:U.context)==null?void 0:R.identifier)??""}),M=oe(K=>{var se,U;const J=(U=(se=K.categoryMeta)==null?void 0:se.sourcingSettings)==null?void 0:U.collection;return(J==null?void 0:J.enableBulkUpload)!==!1});h.useEffect(()=>{const K=s.current;if(!K)return;const J=new ResizeObserver(()=>{a(K.clientHeight||400)});return J.observe(K),a(K.clientHeight||400),()=>J.disconnect()},[]),h.useEffect(()=>{if(!c)return;const K=J=>{var se;(se=i.current)!=null&&se.contains(J.target)||d(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[c]);const B=h.useCallback(K=>{K.length>0&&v(K[0].data.id)},[v]),A=h.useCallback(({parentId:K,index:J,dragIds:se})=>{if(!K)return;const U=se[0],R=Ga(b,U);if(!R)return;const Q=R.parent;if(Q===K){const ue=Ga(b,K);if(!(ue!=null&&ue.children))return;const Ee=ue.children.findIndex(je=>je.id===U);if(Ee<0)return;S(K,Ee,J>Ee?J-1:J)}else w(U,Q??"",K)},[b,S,w]),j=h.useCallback(({ids:K})=>{K.forEach(J=>_(J))},[_]),F=h.useCallback(({parentId:K})=>{var U;const J=K??((U=b[0])==null?void 0:U.id)??"";if(!J)return{id:crypto.randomUUID()};const se=m(J,"unit");return se?{id:se}:(De.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,b]),Z=h.useCallback(()=>{var J;const K=(J=b[0])==null?void 0:J.id;K&&(m(K,"unit")||De.error("Maximum depth reached"))},[b,m]),ae=h.useCallback(()=>{p&&(m(p,"subunit")||De.error("Maximum depth reached"))},[p,m]),me=h.useCallback(async()=>{if(d(!1),!!k)try{const K=await Uf(k),J=await fetch(K).then(R=>R.blob()),se=URL.createObjectURL(J),U=document.createElement("a");U.href=se,U.download=`${k}-folders.csv`,U.style.display="none",document.body.appendChild(U),U.click(),document.body.removeChild(U),URL.revokeObjectURL(se)}catch{De.error("Failed to download CSV")}},[k]),Oe=h.useCallback(async()=>{if(f(!1),!!k)try{const{rootNode:K}=await Qu(k);O([K]),De.success("Course outline refreshed.")}catch{De.error("Outline could not be refreshed automatically. Please reload the page.")}},[k,O]);return l.jsxs("div",{className:tr.container,children:[l.jsx("div",{className:tr.header,children:l.jsxs("div",{className:tr.headerActions,children:[T&&l.jsxs("div",{className:tr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:tr.iconBtn,onClick:()=>d(K=>!K),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(jc,{size:15})}),c&&l.jsx("div",{className:tr.dropdownMenu,role:"menu",children:M&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:$,title:$?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),y("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:me,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),y("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(pv,{size:15}):l.jsx(hv,{size:15})})]})}),l.jsx("div",{className:tr.treeWrapper,ref:s,children:l.jsx(u1,{ref:n,data:b,idAccessor:"id",childrenAccessor:"children",onSelect:B,onMove:T?A:void 0,onDelete:T?j:void 0,onCreate:T?F:void 0,disableEdit:!T,disableDrop:!T,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:K=>l.jsx(g1,{...K,editorMode:e})})}),T&&l.jsxs("div",{className:tr.footer,children:[l.jsxs(Pe,{variant:"ghost",size:"sm",onClick:Z,disabled:!P,children:[l.jsx(fs,{size:14})," Add Unit"]}),l.jsxs(Pe,{variant:"ghost",size:"sm",onClick:ae,disabled:!P||!p,children:[l.jsx(Bc,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:tr.csvModal,children:l.jsx(w1,{contentId:k,mode:g,onComplete:Oe,onClose:()=>f(!1)})})]})};function Ga(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Ga(r.children,t);if(n)return n}}}const Es={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},C1=({crumbs:e})=>{const t=Ae(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Es.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Es.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(dv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(Fc,{size:13,className:Es.sep}),n<e.length-1?l.jsx("button",{className:Es.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Es.current,children:r.name})]},r.id))]}):null},Ds={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},zf=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],O1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?zf.filter(i=>n.includes(i.id)):zf;return l.jsx("div",{className:Ds.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:[Ds.tab,e===i.id?Ds.active:"",r.includes(i.id)?Ds.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Ds.errorDot,"aria-label":"Has errors"})]},i.id))})};var Is=e=>e.type==="checkbox",Yr=e=>e instanceof Date,ct=e=>e==null;const Vf=e=>typeof e=="object";var He=e=>!ct(e)&&!Array.isArray(e)&&Vf(e)&&!Yr(e),Ya=e=>He(e)&&e.target?Is(e.target)?e.target.checked:e.target.value:e,qf=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Hf=e=>{const t=e.constructor&&e.constructor.prototype;return He(t)&&t.hasOwnProperty("isPrototypeOf")},Gi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ge(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Gi&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(He(e)&&Hf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ge(e[s]));return n}const Ir={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Qt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Gt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ra="form",Wf="root",Kf=["__proto__","constructor","prototype"];var Ts=e=>/^\w*$/.test(e),Be=e=>e===void 0,Yi=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!He(e))return r;const n=Ts(t)?[t]:Yi(t);if(n.some(i=>Kf.includes(i)))return r;const s=n.reduce((i,o)=>ct(i)?void 0:i[o],e);return Be(s)||s===e?Be(e[t])?r:e[t]:s},At=e=>typeof e=="boolean",vt=e=>typeof e=="function",$e=(e,t,r)=>{let n=-1;const s=Ts(t)?[t]:Yi(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(Kf.includes(a))return;e[a]=c,e=e[a]}};const Xa=h.createContext(null);Xa.displayName="HookFormControlContext";const Za=()=>h.useContext(Xa);var Qf=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Qt.all&&(t._proxyFormState[o]=!n||Qt.all),r&&(r[o]=!0),e[o]}});return s};const Ja=Gi?h.useLayoutEffect:h.useEffect;function E1(e){const t=Za(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=h.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ja(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),h.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),h.useMemo(()=>Qf(o,r,c.current,!1),[o,r])}var mt=e=>typeof e=="string",el=(e,t,r,n,s)=>mt(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),W(r,i))):(n&&(t.watchAll=!0),r),tl=e=>ct(e)||!Vf(e);const Gf=(e,t)=>t.length===0&&!Array.isArray(e)&&!Hf(e);function Pt(e,t,r=new WeakMap){if(e===t)return!0;if(tl(e)||tl(t))return Object.is(e,t);if(Yr(e)&&Yr(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(Gf(e,n)||Gf(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(Yr(a)&&Yr(c)||(He(a)||Array.isArray(a))&&(He(c)||Array.isArray(c))?!Pt(a,c,r):!Object.is(a,c))return!1}}return!0}function D1(e){const t=Za(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=h.useRef(s),d=h.useRef(a),u=h.useRef(void 0),f=h.useRef(r),g=h.useRef(n);d.current=a;const[y,b]=h.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),p=h.useCallback(w=>{const O=el(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(O):O},[r._formValues,r._names,n]),v=h.useCallback(w=>{if(!i){const O=el(n,r._names,w||r._formValues,!1,c.current);if(d.current){const T=d.current(O);Pt(T,u.current)||(b(T),u.current=T)}else b(O)}},[r._formValues,r._names,i,n]);Ja(()=>((f.current!==r||!Pt(g.current,n))&&(f.current=r,g.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{v(w.values)}})),[r,o,n,v]),h.useEffect(()=>r._removeUnmounted());const m=f.current!==r,_=g.current,S=h.useMemo(()=>{if(i)return null;const w=!m&&!Pt(_,n);return m||w?p():null},[i,m,n,_,p]);return S!==null?S:y}function Ri(e){const t=Za(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=qf(s._names.array,r),d=h.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,o)),[s,r,o]),u=D1({control:s,name:r,defaultValue:d,exact:a}),f=E1({control:s,name:r,exact:a}),g=h.useRef(e),y=h.useRef(null),b=h.useRef(s.register(r,{...e.rules,value:u,...At(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const p=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!W(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!W(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!W(f.validatingFields,r)},error:{enumerable:!0,get:()=>W(f.errors,r)}}),[f,r]),v=h.useCallback(w=>{const O=Ya(w);return W(s._fields,r)||(b.current=s.register(r,{...g.current.rules,value:O})),b.current.onChange({target:{value:Ya(w),name:r},type:Ir.CHANGE})},[r,s]),m=h.useCallback(()=>b.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Ir.BLUR}),[r,s._formValues]),_=h.useCallback(w=>{w&&(y.current={focus:()=>vt(w.focus)&&w.focus(),select:()=>vt(w.select)&&w.select(),setCustomValidity:T=>vt(w.setCustomValidity)&&w.setCustomValidity(T),reportValidity:()=>vt(w.reportValidity)&&w.reportValidity()});const O=W(s._fields,r);O&&O._f&&w&&(O._f.ref=y.current)},[s._fields,r]),S=h.useMemo(()=>({name:r,value:u,...At(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:m,ref:_}),[r,n,f.disabled,v,m,_,u]);return h.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...At(g.current.disabled)?{disabled:g.current.disabled}:{}});const O=(T,x)=>{const P=W(s._fields,T);P&&P._f&&(P._f.mount=x)};if(O(r,!0),w){const T=Ge(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,g.current.defaultValue)));$e(s._defaultValues,r,T),Be(W(s._formValues,r))&&$e(s._formValues,r,T)}if(!c&&s.register(r),y.current){const T=W(s._fields,r);T&&T._f&&(T._f.ref=y.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):O(r,!1)}},[r,s,c,i]),h.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),h.useMemo(()=>({field:S,formState:f,fieldState:p}),[S,f,p])}const rl=h.createContext(null);rl.displayName="HookFormContext";const Yt=()=>h.useContext(rl),I1=({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:y,control:b,register:p,setFocus:v,subscribe:m})=>{const _=h.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:y,control:b,register:p,setFocus:v,subscribe:m}),[i,b,d,n,r,g,p,f,u,s,v,o,a,m,c,y,t]);return h.createElement(rl.Provider,{value:_},h.createElement(Xa.Provider,{value:_.control},e))};var T1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Yf=e=>Array.isArray(e)?e.filter(Boolean):[],Xi=e=>Array.isArray(e)?e:[e],Rf=()=>{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 Xf(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=Xf(s,i);He(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var nt=e=>He(e)&&!Object.keys(e).length,nl=e=>e.type==="file",Zi=e=>{if(!Gi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Zf=e=>e.type==="select-multiple",sl=e=>e.type==="radio",N1=e=>sl(e)||Is(e),il=e=>Zi(e)&&e.isConnected;function k1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ct(e)){e=void 0;break}e=e[t[n]],n++}return e}function x1(e){for(const t in e)if(e.hasOwnProperty(t)&&!Be(e[t]))return!1;return!0}function Ze(e,t){if(mt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Ts(t)?[t]:Yi(t),n=r.length===1?e:k1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(He(n)&&nt(n)||Array.isArray(n)&&x1(n))&&Ze(e,r.slice(0,-1)),e}var A1=e=>{for(const t in e)if(vt(e[t]))return!0;return!1};function Jf(e){return Array.isArray(e)||He(e)&&!A1(e)}function ol(e,t={}){for(const r in e){const n=e[r];Jf(n)?(t[r]=Array.isArray(n)?[]:{},ol(n,t[r])):Be(n)||(t[r]=!0)}return t}function al(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>al(r));return t.some(r=>r!==void 0)?t:void 0}if(He(e)){const t={};for(const r in e){const n=al(e[r]);Be(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Rr(e,t,r){r||(r=ol(t));for(const n in e){const s=e[n];if(Jf(s))Be(t)||tl(r[n])?r[n]=ol(s,Array.isArray(s)?[]:{}):Rr(s,ct(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Pt(s,i)}}return al(r)||{}}const eh={value:!1,isValid:!1},th={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&&!Be(e[0].attributes.value)?Be(e[0].value)||e[0].value===""?th:{value:e[0].value,isValid:!0}:th:eh}return eh},nh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Be(e)?e:t?e===""?NaN:e&&+e:r&&mt(e)?new Date(e):n?n(e):e;const sh={isValid:!1,value:null};var ih=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,sh):sh;function oh(e){const t=e.ref;return nl(t)?t.files:sl(t)?ih(e.refs).value:Zf(t)?[...t.selectedOptions].map(({value:r})=>r):Is(t)?rh(e.refs).value:nh(Be(t.value)?e.ref.value:t.value,e)}var P1=(e,t,r,n)=>{const s={};for(const i of e){const o=W(t,i);o&&$e(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ji=e=>e instanceof RegExp,Ns=e=>Be(e)?e:Ji(e)?e.source:He(e)?Ji(e.value)?e.value.source:e.value:e,ah=e=>({isOnSubmit:!e||e===Qt.onSubmit,isOnBlur:e===Qt.onBlur,isOnChange:e===Qt.onChange,isOnAll:e===Qt.all,isOnTouch:e===Qt.onTouched});const lh="AsyncFunction";var M1=e=>!!e&&!!e.validate&&!!(vt(e.validate)&&e.validate.constructor.name===lh||He(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===lh)),L1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ll=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const ks=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=W(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(ks(a,t))break}else if(He(a)&&ks(a,t))break}}};function ch(e,t,r){const n=W(e,r);if(n||Ts(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=W(t,i),a=W(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 F1=(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||Qt.all))},$1=(e,t,r)=>!e||!t||e===t||Xi(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),j1=(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,B1=(e,t)=>!Yf(W(e,t)).length&&Ze(e,t),uh=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return $e(s,Wf,t[r]),$e(e,r,s),e};function dh(e,t,r="validate"){if(mt(e)||Array.isArray(e)&&e.every(mt)||At(e)&&!e)return{type:r,message:mt(e)?e:"",ref:t}}var Pn=e=>He(e)&&!Ji(e)?e:{value:e,message:""},fh=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:g,pattern:y,validate:b,name:p,valueAsNumber:v,mount:m}=e._f,_=W(r,p);if(!m||t.has(p))return{};const S=a?a[0]:o,w=B=>{if(s&&S.reportValidity){const A=At(B)?"":B||"";a?a.forEach(j=>j.setCustomValidity(A)):S.setCustomValidity(A),S.reportValidity()}},O={},T=sl(o),x=Is(o),P=T||x,$=(v||nl(o))&&Be(o.value)&&Be(_)||Zi(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,k=T1.bind(null,p,n,O),M=(B,A,j,F=Gt.maxLength,Z=Gt.minLength)=>{const ae=B?A:j;O[p]={type:B?F:Z,message:ae,ref:o,...k(B?F:Z,ae)}};if(i?!Array.isArray(_)||!_.length:c&&(!P&&($||ct(_))||At(_)&&!_||x&&!rh(a).isValid||T&&!ih(a).isValid)){const{value:B,message:A}=mt(c)?{value:!!c,message:c}:Pn(c);if(B&&(O[p]={type:Gt.required,message:A,ref:S,...k(Gt.required,A)},!n))return w(A),O}if(!$&&(!ct(f)||!ct(g))){let B,A;const j=Pn(g),F=Pn(f);if(!ct(_)&&!isNaN(_)){const Z=o.valueAsNumber||_&&+_;ct(j.value)||(B=Z>j.value),ct(F.value)||(A=Z<F.value)}else{const Z=o.valueAsDate||new Date(_),ae=pe=>new Date(new Date().toDateString()+" "+pe),me=o.type=="time",Oe=o.type=="week";mt(j.value)&&_&&(B=me?ae(_)>ae(j.value):Oe?_>j.value:Z>new Date(j.value)),mt(F.value)&&_&&(A=me?ae(_)<ae(F.value):Oe?_<F.value:Z<new Date(F.value))}if((B||A)&&(M(!!B,j.message,F.message,Gt.max,Gt.min),!n))return w(O[p].message),O}if((d||u)&&!$&&(mt(_)||i&&Array.isArray(_))){const B=Pn(d),A=Pn(u),j=!ct(B.value)&&_.length>+B.value,F=!ct(A.value)&&_.length<+A.value;if((j||F)&&(M(j,B.message,A.message),!n))return w(O[p].message),O}if(y&&!$&&mt(_)){const{value:B,message:A}=Pn(y);if(Ji(B)&&!_.match(B)&&(O[p]={type:Gt.pattern,message:A,ref:o,...k(Gt.pattern,A)},!n))return w(A),O}if(b){if(vt(b)){const B=await b(_,r),A=dh(B,S);if(A&&(O[p]={...A,...k(Gt.validate,A.message)},!n))return w(A.message),O}else if(He(b)){let B={};for(const A in b){if(!nt(B)&&!n)break;const j=dh(await b[A](_,r),S,A);j&&(B={...j,...k(A,j.message)},w(j.message),n&&(O[p]=B))}if(!nt(B)&&(O[p]={ref:S,...B},!n))return O}}return w(!0),O};const U1={mode:Qt.onSubmit,reValidateMode:Qt.onChange,shouldFocusError:!0},hh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function z1(e={}){let t={...U1,...e},r={...Ge(hh),isLoading:vt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=He(t.defaultValues)||He(t.values)?Ge(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ge(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 y={array:Rf(),state:Rf()},b=t.criteriaMode===Qt.all,p=C=>I=>{clearTimeout(d),d=setTimeout(C,I)},v=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||C)){let I;t.resolver?(I=nt((await k()).errors),m()):I=await A({fields:n,onlyCheckValid:!0,eventType:Ir.VALID}),I!==r.isValid&&y.state.next({isValid:I})}},m=(C,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((C||Array.from(a.mount)).forEach(N=>{N&&(I?$e(r.validatingFields,N,I):Ze(r.validatingFields,N))}),y.state.next({validatingFields:r.validatingFields,isValidating:!nt(r.validatingFields)}))},_=()=>{r.dirtyFields=Rr(s,i)},S=(C,I=[],N,z,V=!0,G=!0)=>{if(z&&N&&!t.disabled){if(o.action=!0,G&&Array.isArray(W(n,C))){const q=N(W(n,C),z.argA,z.argB);V&&$e(n,C,q)}if(G&&Array.isArray(W(r.errors,C))){const q=N(W(r.errors,C),z.argA,z.argB);V&&$e(r.errors,C,q),B1(r.errors,C)}if((f.touchedFields||g.touchedFields)&&G&&Array.isArray(W(r.touchedFields,C))){const q=N(W(r.touchedFields,C),z.argA,z.argB);V&&$e(r.touchedFields,C,q)}(f.dirtyFields||g.dirtyFields)&&_(),y.state.next({name:C,isDirty:F(C,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else $e(i,C,I)},w=(C,I)=>{$e(r.errors,C,I),r.errors={...r.errors},y.state.next({errors:r.errors})},O=C=>{r.errors=C,y.state.next({errors:r.errors,isValid:!1})},T=C=>{const I=Ts(C)?[C]:Yi(C);let N=i,z=s;for(let V=0;V<I.length-1;V++){const G=I[V];if(N=ct(N)?N:N[G],z=ct(z)?z:z[G],N===null&&z!==null)return!0}return!1},x=(C,I,N,z)=>{const V=W(n,C);if(V){if(T(C))return;const G=Be(W(i,C)),q=W(i,C,Be(N)?W(s,C):N);Be(q)||z&&z.defaultChecked||I?$e(i,C,I?q:oh(V._f)):me(C,q),o.mount&&!o.action&&(v(),G&&r.isDirty&&(f.isDirty||g.isDirty)&&(F()||(r.isDirty=!1,y.state.next({...r}))),e.shouldUnregister&&G&&!Be(W(i,C))&&ll(C,a)&&(o.watch=!0))}},P=(C,I,N,z,V)=>{let G=!1,q=!1;const te={name:C};if(!t.disabled){if(!N||z){(f.isDirty||g.isDirty)&&(q=r.isDirty,r.isDirty=te.isDirty=F(),G=q!==te.isDirty);const ve=Pt(W(s,C),I);q=!!W(r.dirtyFields,C),ve!==r.isDirty?r.dirtyFields=Rr(s,i):ve?Ze(r.dirtyFields,C):$e(r.dirtyFields,C,!0),te.dirtyFields=r.dirtyFields,G=G||(f.dirtyFields||g.dirtyFields)&&q!==!ve}if(N){const ve=W(r.touchedFields,C);ve||($e(r.touchedFields,C,N),te.touchedFields=r.touchedFields,G=G||(f.touchedFields||g.touchedFields)&&ve!==N)}G&&V&&y.state.next(te)}return G?te:{}},$=(C,I,N,z)=>{const V=W(r.errors,C),G=(f.isValid||g.isValid)&&At(I)&&r.isValid!==I;if(t.delayError&&N?(c=p(()=>w(C,N)),c(t.delayError)):(clearTimeout(d),c=null,N?$e(r.errors,C,N):Ze(r.errors,C),r.errors={...r.errors}),(N?!Pt(V,N):V)||!nt(z)||G){const q={...z,...G&&At(I)?{isValid:I}:{},errors:r.errors,name:C};r={...r,...q},y.state.next(q)}},k=async C=>(m(C,!0),await t.resolver(i,t.context,P1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),M=async C=>{const{errors:I}=await k(C);if(m(C),C){for(const N of C){const z=W(I,N);z?a.array.has(N)&&He(z)&&!Object.keys(z).some(V=>!Number.isNaN(Number(V)))?uh(r.errors,{[N]:z},N):$e(r.errors,N,z):Ze(r.errors,N)}r.errors={...r.errors}}else r.errors=I;return I},B=async({name:C,eventType:I})=>{if(e.validate){const N=await e.validate({formValues:i,formState:r,name:C,eventType:I});if(He(N))for(const z in N){const V=N[z];V&&je(`${Ra}.${z}`,{message:mt(V.message)?V.message:"",type:V.type||Gt.validate})}else mt(N)||!N?je(Ra,{message:N||"",type:Gt.validate}):Ee(Ra);return N}return!0},A=async({fields:C,onlyCheckValid:I,name:N,eventType:z,context:V={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(V.runRootValidation=!0,!await B({name:N,eventType:z})&&(V.valid=!1,I)))return V.valid;for(const G in C){const q=C[G];if(q){const{_f:te,...ve}=q;if(te){const Qe=a.array.has(te.name),Nt=q._f&&M1(q._f),kt=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;Nt&&kt&&m([te.name],!0);const yr=await fh(q,a.disabled,i,b,t.shouldUseNativeValidation&&!I,Qe);if(Nt&&kt&&m([te.name]),yr[te.name]&&(V.valid=!1,I)||(!I&&(W(yr,te.name)?Qe?uh(r.errors,yr,te.name):$e(r.errors,te.name,yr[te.name]):Ze(r.errors,te.name)),e.shouldUseNativeValidation&&yr[te.name]))break}!nt(ve)&&await A({context:V,onlyCheckValid:I,fields:ve,name:G,eventType:z})}}return V.valid},j=()=>{for(const C of a.unMount){const I=W(n,C);I&&(I._f.refs?I._f.refs.every(N=>!il(N)):!il(I._f.ref))&&Le(C)}a.unMount=new Set},F=(C,I)=>!t.disabled&&(C&&I&&$e(i,C,I),!Pt(Q(),s)),Z=(C,I,N)=>el(C,a,{...o.mount?i:Be(I)?s:mt(C)?{[C]:I}:I},N,I),ae=C=>Yf(W(o.mount?i:s,C,t.shouldUnregister?W(s,C,[]):[])),me=(C,I,N={},z=!1)=>{const V=W(n,C);let G=I;if(V){const q=V._f;q&&(!q.disabled&&$e(i,C,nh(I,q)),G=Zi(q.ref)&&ct(I)?"":I,Zf(q.ref)?[...q.ref.options].forEach(te=>te.selected=G.includes(te.value)):q.refs?Is(q.ref)?q.refs.forEach(te=>{(!te.defaultChecked||!te.disabled)&&(Array.isArray(G)?te.checked=!!G.find(ve=>ve===te.value):te.checked=G===te.value||!!G)}):q.refs.forEach(te=>te.checked=te.value===G):nl(q.ref)?q.ref.value="":(q.ref.value=G,q.ref.type||y.state.next({name:C,values:z?i:Ge(i)})))}(N.shouldDirty||N.shouldTouch)&&P(C,G,N.shouldTouch,N.shouldDirty,!0),N.shouldValidate&&R(C)},Oe=(C,I,N,z=!1)=>{for(const V in I){if(!I.hasOwnProperty(V))return;const G=I[V],q=C+"."+V,te=W(n,q);(a.array.has(C)||He(G)||te&&!te._f)&&!Yr(G)?Oe(q,G,N,z):me(q,G,N,z)}},pe=(C,I,N,z)=>{const V=W(n,C),G=a.array.has(C),q=z?I:Ge(I),te=W(i,C),ve=Pt(te,q);if(ve||$e(i,C,q),G)y.array.next({name:C,values:z?i:Ge(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&N.shouldDirty&&(_(),y.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:F(C,q)}));else{const Qe=Array.isArray(q)&&!q.length||nt(q);!V||V._f||ct(q)||Qe?me(C,q,N,z):Oe(C,q,N,z)}if(!ve){const Qe=ll(C,a),Nt=z?i:Ge(i);y.state.next({...Qe&&r,name:o.mount||Qe?C:void 0,values:Nt})}},K=(C,I,N={})=>pe(C,I,N,!1),J=(C,I={})=>{const N=vt(C)?C(i):C;if(!Pt(i,N)){i={...i,...N};for(const z of a.mount)pe(z,W(N,z),I,!0);y.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&v()}},se=async C=>{o.mount=!0;const I=C.target;let N=I.name,z=!0;const V=W(n,N),G=ve=>{z=Number.isNaN(ve)||Yr(ve)&&isNaN(ve.getTime())||Pt(ve,W(i,N,ve))},q=ah(t.mode),te=ah(t.reValidateMode);if(V){let ve,Qe;const Nt=I.type?oh(V._f):Ya(C),kt=C.type===Ir.BLUR||C.type===Ir.FOCUS_OUT,yr=!L1(V._f)&&!e.validate&&!t.resolver&&!W(r.errors,N)&&!V._f.deps||j1(kt,W(r.touchedFields,N),r.isSubmitted,te,q),zs=ll(N,a,kt);$e(i,N,Nt),kt?(!I||!I.readOnly)&&(V._f.onBlur&&V._f.onBlur(C),c&&c(0)):V._f.onChange&&V._f.onChange(C);const dn=P(N,Nt,kt),ot=!nt(dn)||zs;if(!kt&&y.state.next({name:N,type:C.type,values:Ge(i)}),yr)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?kt&&v():kt||v()),ot&&y.state.next({name:N,...zs?{}:dn});if(!t.resolver&&e.validate&&await B({name:N,eventType:C.type}),!kt&&zs&&y.state.next({...r}),t.resolver){const{errors:_t}=await k([N]);if(m([N]),G(Nt),!z){!nt(dn)&&y.state.next(dn);return}const Ct=ch(r.errors,n,N),Zt=ch(_t,n,Ct.name||N);ve=Zt.error,N=Zt.name,Qe=nt(_t)}else m([N],!0),ve=(await fh(V,a.disabled,i,b,t.shouldUseNativeValidation))[N],m([N]),G(Nt),z&&(ve?Qe=!1:(f.isValid||g.isValid)&&(Qe=await A({fields:n,onlyCheckValid:!0,name:N,eventType:C.type})));z&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&R(V._f.deps),$(N,Qe,ve,dn))}},U=(C,I)=>{if(W(r.errors,I)&&C.focus)return C.focus(),1},R=async(C,I={})=>{let N,z;const V=Xi(C);if(t.resolver){const G=await M(Be(C)?C:V);N=nt(G),z=C?!V.some(q=>W(G,q)):N}else C?(z=(await Promise.all(V.map(async G=>{const q=W(n,G);return await A({fields:q&&q._f?{[G]:q}:q,eventType:Ir.TRIGGER})}))).every(Boolean),!(!z&&!r.isValid)&&v()):z=N=await A({fields:n,name:C,eventType:Ir.TRIGGER});return y.state.next({...!mt(C)||(f.isValid||g.isValid)&&N!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:N}:{},errors:r.errors}),I.shouldFocus&&!z&&ks(n,U,C?V:a.mount),z},Q=(C,I)=>{let N={...o.mount?i:s};return I&&(N=Xf(I.dirtyFields?r.dirtyFields:r.touchedFields,N)),Be(C)?N:mt(C)?W(N,C):C.map(z=>W(N,z))},ue=(C,I)=>({invalid:!!W((I||r).errors,C),isDirty:!!W((I||r).dirtyFields,C),error:W((I||r).errors,C),isValidating:!!W(r.validatingFields,C),isTouched:!!W((I||r).touchedFields,C)}),Ee=C=>{const I=C?Xi(C):void 0;I==null||I.forEach(N=>Ze(r.errors,N)),I?I.forEach(N=>{y.state.next({name:N,errors:r.errors})}):y.state.next({errors:{}})},je=(C,I,N)=>{const z=(W(n,C,{_f:{}})._f||{}).ref,V=W(r.errors,C)||{},{ref:G,message:q,type:te,...ve}=V;$e(r.errors,C,{...ve,...I,ref:z}),y.state.next({name:C,errors:r.errors,isValid:!1}),N&&N.shouldFocus&&z&&z.focus&&z.focus()},ye=(C,I)=>vt(C)?y.state.subscribe({next:N=>"values"in N&&C(N.values||Z(void 0,I),N)}):Z(C,I,!0),ce=C=>y.state.subscribe({next:I=>{if($1(C.name,I.name,C.exact)&&F1(I,C.formState||f,pr,C.reRenderRoot)){const N={...i};C.callback({values:N,...r,...I,defaultValues:s})}}}).unsubscribe,ge=C=>(o.mount=!0,g={...g,...C.formState},ce({...C,formState:{...u,...C.formState}})),Le=(C,I={})=>{for(const N of C?Xi(C):a.mount)a.mount.delete(N),a.array.delete(N),I.keepValue||(Ze(n,N),Ze(i,N)),!I.keepError&&Ze(r.errors,N),!I.keepDirty&&Ze(r.dirtyFields,N),!I.keepTouched&&Ze(r.touchedFields,N),!I.keepIsValidating&&Ze(r.validatingFields,N),!t.shouldUnregister&&!I.keepDefaultValue&&Ze(s,N);y.state.next({values:Ge(i)}),y.state.next({...r,...I.keepDirty?{isDirty:F()}:{}}),!I.keepIsValid&&v()},Ve=({disabled:C,name:I})=>{if(At(C)&&o.mount||C||a.disabled.has(I)){const V=a.disabled.has(I)!==!!C;C?a.disabled.add(I):a.disabled.delete(I),V&&o.mount&&!o.action&&v()}},ke=(C,I={})=>{let N=W(n,C);const z=At(I.disabled)||At(t.disabled),V=!a.registerName.has(C)&&N&&N._f&&!N._f.mount;return $e(n,C,{...N||{},_f:{...N&&N._f?N._f:{ref:{name:C}},name:C,mount:!0,...I}}),a.mount.add(C),N&&!V?Ve({disabled:At(I.disabled)?I.disabled:t.disabled,name:C}):x(C,!0,I.value),{...z?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:Ns(I.min),max:Ns(I.max),minLength:Ns(I.minLength),maxLength:Ns(I.maxLength),pattern:Ns(I.pattern)}:{},name:C,onChange:se,onBlur:se,ref:G=>{if(G){a.registerName.add(C),ke(C,I),a.registerName.delete(C),N=W(n,C);const q=Be(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,te=N1(q),ve=N._f.refs||[];if(te?ve.find(Qe=>Qe===q):q===N._f.ref)return;$e(n,C,{_f:{...N._f,...te?{refs:[...ve.filter(il),q,...Array.isArray(W(s,C))?[{}]:[]],ref:{type:q.type,name:C}}:{ref:q}}}),x(C,!1,void 0,q)}else N=W(n,C,{}),N._f&&(N._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(qf(a.array,C)&&o.action)&&a.unMount.add(C)}}},ee=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&ks(n,U,a.mount),Ke=C=>{At(C)&&(y.state.next({disabled:C}),ks(n,(I,N)=>{const z=W(n,N);z&&(I.disabled=z._f.disabled||C,Array.isArray(z._f.refs)&&z._f.refs.forEach(V=>{V.disabled=z._f.disabled||C}))},0,!1))},tt=(C,I)=>async N=>{let z;N&&(N.preventDefault&&N.preventDefault(),N.persist&&N.persist());let V=Ge(i);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:G,values:q}=await k();m(),r.errors=G,V=Ge(q)}else await A({fields:n,eventType:Ir.SUBMIT});if(a.disabled.size)for(const G of a.disabled)Ze(V,G);if(Ze(r.errors,Wf),nt(r.errors)){y.state.next({errors:{}});try{await C(V,N)}catch(G){z=G}}else I&&await I({...r.errors},N),ee(),setTimeout(ee);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nt(r.errors)&&!z,submitCount:r.submitCount+1,errors:r.errors}),z)throw z},H=(C,I={})=>{W(n,C)&&(Be(I.defaultValue)?K(C,Ge(W(s,C))):(K(C,I.defaultValue),$e(s,C,Ge(I.defaultValue))),I.keepTouched||Ze(r.touchedFields,C),I.keepDirty||(Ze(r.dirtyFields,C),r.isDirty=I.defaultValue?F(C,Ge(W(s,C))):F()),I.keepError||(Ze(r.errors,C),f.isValid&&v()),y.state.next({...r}))},re=(C,I={})=>{const N=C?Ge(C):s,z=Ge(N),V=nt(C),G=z;if(I.keepDefaultValues||(s=N),!I.keepValues){if(I.keepDirtyValues){const q=new Set([...a.mount,...Object.keys(Rr(s,i))]);for(const te of Array.from(q)){const ve=W(r.dirtyFields,te),Qe=W(i,te),Nt=W(G,te);ve&&!Be(Qe)?$e(G,te,Qe):!ve&&!Be(Nt)&&K(te,Nt)}}else{if(Gi&&Be(C))for(const q of a.mount){const te=W(n,q);if(te&&te._f){const ve=Array.isArray(te._f.refs)?te._f.refs[0]:te._f.ref;if(Zi(ve)){const Qe=ve.closest("form");if(Qe){Qe.reset();break}}}}if(I.keepFieldsRef)for(const q of a.mount)K(q,W(G,q));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?Ge(s):{},I.keepFieldsRef)for(const q of a.mount)$e(i,q,W(G,q))}else i=Ge(G);y.array.next({values:{...G}}),y.state.next({values:{...G}})}a={mount:I.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||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!nt(G),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),y.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:V?!1:I.keepDirty?r.isDirty:I.keepValues?F():!!(I.keepDefaultValues&&!Pt(C,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:V?{}:I.keepDirtyValues?I.keepDefaultValues&&i?Rr(s,i):r.dirtyFields:I.keepDefaultValues&&C?Rr(s,C):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},ie=(C,I)=>re(vt(C)?C(i):C,{...t.resetOptions,...I}),Re=(C,I={})=>{const N=W(n,C),z=N&&N._f;if(z){const V=z.refs?z.refs[0]:z.ref;V.focus&&setTimeout(()=>{V.focus(),I.shouldSelect&&vt(V.select)&&V.select()})}},pr=C=>{r={...r,...C}},Gn={control:{register:ke,unregister:Le,getFieldState:ue,handleSubmit:tt,setError:je,_subscribe:ce,_runSchema:k,_updateIsValidating:m,_focusError:ee,_getWatch:Z,_getDirty:F,_setValid:v,_setFieldArray:S,_setDisabledField:Ve,_setErrors:O,_getFieldArray:ae,_reset:re,_resetDefaultValues:()=>vt(t.defaultValues)&&t.defaultValues().then(C=>{ie(C,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:j,_disableForm:Ke,_subjects:y,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return s},get _names(){return a},set _names(C){a=C},get _formState(){return r},get _options(){return t},set _options(C){t={...t,...C}}},subscribe:ge,trigger:R,register:ke,handleSubmit:tt,watch:ye,setValue:K,setValues:J,getValues:Q,reset:ie,resetField:H,resetDefaultValues:(C,I={})=>{if(s=Ge(C),!I.keepDirty){const N=Rr(s,i);r.dirtyFields=N,r.isDirty=!nt(N)}I.keepIsValid||v(),y.state.next({...r,defaultValues:s})},clearErrors:Ee,unregister:Le,setError:je,setFocus:Re,getFieldState:ue};return{...Gn,formControl:Gn}}function V1(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...Ge(hh),isLoading:vt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:vt(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&&!vt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=z1(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,Ja(()=>{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]),h.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),h.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),h.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),h.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),h.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]),h.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=h.useMemo(()=>Qf(s,o),[o,s]),t.current}async function ph(e){var r,n;return(n=(r=(await Fe.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function q1(e){var r,n;return((n=(r=(await Fe.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 gh(e,t){const r=Ys({queryKey:["framework",e],queryFn:()=>ph(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Ys({queryKey:["framework",n],queryFn:()=>ph(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function H1(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}=Ys({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>q1({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 W1(e){var r,n;return(n=(r=(await Fe.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function K1(e){var r,n,s,i,o,a;const t=Ys({queryKey:["channel",e],queryFn:()=>W1(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 Q1={"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."}},G1=new Set(["review","read","sourcingreview","orgreview"]),eo={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},Y1={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},R1={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"},yh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function X1(e,t,r,n,s={}){if(!(e!=null&&e.length))return dO(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=sO(a),u=iO(a,r,t,i,s),f=t[c],g=J1(c,vh(f,d),d,t,s),y={code:c,label:a.label??c,inputType:d,required:!!(a.required===!0||Array.isArray(a.validations)&&a.validations.some(b=>b.type==="required")),editable:Z1(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:rO(u,g,d,r),depends:a.depends,tab:nO(a),section:a.section,defaultValue:a.defaultValue??a.default,currentValue:g};if(c==="dialcodes"){const b=t.dialcodeRequired==="Yes";return{...y,required:b,visible:b}}return y})}function Z1(e,t,r){var i;const n=r.editorMode??"edit";if(!G1.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function J1(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!==""?eO(Number(a)):t}default:return t}}function eO(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 tO(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 rO(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=tO(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 nO(e){const t=e.section;if(t){if(eo[t])return eo[t];const n=Y1[t];if(n&&eo[n])return eo[n]}const r=e.code??"";return R1[r]??"details"}function vh(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 sO(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 iO(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?cO(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??cl[i];if(c)return mh(i,c,e,t,r,n)}function oO(e,t){return yh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function aO(e,t){return yh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function ul(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 lO(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 cO(e){return Array.from(new Set(e))}function uO(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function mh(e,t,r,n,s,i){const o=oO(e,r),a=aO(e,r),c=p=>({label:p.name,value:o?p.identifier:p.name}),d=r.depends;if(!(d!=null&&d.length))return ul(n,t,a).map(c);const u=d.flatMap(p=>uO(s[p])).map(String);if(!u.length)return[];const f=[];for(const p of d){const v=i.get(p),m=(v==null?void 0:v.sourceCategory)??cl[p]??p;f.push(...ul(n,m,a))}const y=f.filter(p=>u.includes(String(p.name))||u.includes(String(p.identifier))||u.includes(String(p.code))).flatMap(p=>p.associations??[]).filter(p=>String(p.category??"").toLowerCase()===t.toLowerCase()),b=lO(y);return b.length?b.map(c):ul(n,t,a).map(c)}function xs(e,t){const r=cl[e];if(r)return mh(e,r,{},t,{},new Map)}function ut(e,t,r){return vh(e[t],r)}function dO(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:ut(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:ut(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:ut(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:ut(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:ut(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:ut(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:xs("subjectIds",r),currentValue:ut(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:ut(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:xs("targetBoardIds",r),currentValue:ut(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:xs("targetMediumIds",r),currentValue:ut(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:xs("targetGradeLevelIds",r),currentValue:ut(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:xs("targetSubjectIds",r),currentValue:ut(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ut(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ut(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ut(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ut(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:ut(e,"license","select")})),n}const fO=["allowECM","levels","setPeriod","instances"];function bh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function hO(e,t={}){const r={...e};for(const i of fO)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 pO(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 gO(e,t){const{watch:r,setValue:n}=e,s=h.useRef(!1);h.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 Mn={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},yO=({title:e,description:t,children:r})=>l.jsxs("div",{className:Mn.section,children:[l.jsxs("div",{className:Mn.header,children:[l.jsx("h3",{className:Mn.title,children:e}),t&&l.jsx("p",{className:Mn.description,children:t})]}),l.jsx("hr",{className:Mn.divider}),l.jsx("div",{className:Mn.fields,children:r})]}),L={field:"_field_1s288_1",fullWidth:"_fullWidth_1s288_7",label:"_label_1s288_11",required:"_required_1s288_19",input:"_input_1s288_24",textarea:"_textarea_1s288_45",inputError:"_inputError_1s288_50",error:"_error_1s288_54",selectBtn:"_selectBtn_1s288_59",selectOpen:"_selectOpen_1s288_83",placeholder:"_placeholder_1s288_87",selectedVal:"_selectedVal_1s288_91",chevronUp:"_chevronUp_1s288_95",dropdown:"_dropdown_1s288_100",option:"_option_1s288_116",optionSelected:"_optionSelected_1s288_134",noOpts:"_noOpts_1s288_139",chipGroup:"_chipGroup_1s288_146",chipInput:"_chipInput_1s288_158",addChipBtn:"_addChipBtn_1s288_167",radioGroup:"_radioGroup_1s288_184",radioLabel:"_radioLabel_1s288_191",iconWrap:"_iconWrap_1s288_199",iconPreview:"_iconPreview_1s288_214",iconPlaceholder:"_iconPlaceholder_1s288_220",removeIconBtn:"_removeIconBtn_1s288_233",tagChip:"_tagChip_1s288_252",tagChipRemove:"_tagChipRemove_1s288_264",nestedSelectRow:"_nestedSelectRow_1s288_278",dialcodeRow:"_dialcodeRow_1s288_287",validateBtn:"_validateBtn_1s288_293",dialcodeValid:"_dialcodeValid_1s288_315",dialcodeSpinner:"_dialcodeSpinner_1s288_325"},_h=({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:[L.field,s?L.fullWidth:""].join(" "),children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[L.input,L.textarea,d?L.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[L.input,d?L.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:L.error,children:String(d.message)})]})},vO=({name:e,label:t,options:r,required:n,disabled:s})=>{var p;const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),g=d(e),y=((p=r.find(v=>v.value===g))==null?void 0:p.label)??"Select…",b=f[e];return h.useEffect(()=>{if(!i)return;const v=m=>{var _;(_=a.current)!=null&&_.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),l.jsxs("div",{className:L.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[L.selectBtn,b?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:g?L.selectedVal:L.placeholder,children:y}),l.jsx(ds,{size:14,className:i?L.chevronUp:""})]}),i&&l.jsxs("div",{className:L.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[L.option,g===v.value?L.optionSelected:""].join(" "),onClick:()=>{u(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:v.label}),g===v.value&&l.jsx(yn,{size:13})]},v.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),b&&l.jsx("span",{className:L.error,children:String(b.message)})]})},mO=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Yt(),g=d(e)??[],y=f[e],b=g.length?`${g.length} selected`:"Select…";h.useEffect(()=>{if(!i)return;const v=m=>{var _;(_=a.current)!=null&&_.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const p=v=>{const m=g.includes(v)?g.filter(_=>_!==v):[...g,v];u(e,m,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:L.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[L.selectBtn,y?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:g.length?L.selectedVal:L.placeholder,children:b}),l.jsx(ds,{size:14,className:i?L.chevronUp:""})]}),i&&l.jsxs("div",{className:L.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[L.option,g.includes(v.value)?L.optionSelected:""].join(" "),onClick:()=>p(v.value),children:[l.jsx(yn,{size:13,style:{opacity:g.includes(v.value)?1:0}}),l.jsx("span",{children:v.label})]},v.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),y&&l.jsx("span",{className:L.error,children:String(y.message)})]})},bO=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=h.useState(""),[a,c]=h.useState(!1),d=h.useRef(null),{watch:u,setValue:f,formState:{errors:g}}=Yt(),y=u(e)??[],b=g[e],p=()=>{const m=i.trim();m&&!y.includes(m)&&f(e,[...y,m],{shouldDirty:!0}),o(""),c(!1)},v=m=>f(e,y.filter(_=>_!==m),{shouldDirty:!0});return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:L.chipGroup,children:[y.map(m=>l.jsxs("span",{className:"sbx-chip filled",children:[m,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>v(m),"aria-label":`Remove ${m}`,children:"×"})]},m)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:L.chipInput,value:i,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),p()),m.key==="Escape"&&(o(""),c(!1))},onBlur:p,placeholder:s}):l.jsxs("button",{type:"button",className:L.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var m;return(m=d.current)==null?void 0:m.focus()},50)},children:[l.jsx(fs,{size:12})," Add"]}))]}),b&&l.jsx("span",{className:L.error,children:String(b.message)})]})},_O=({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:L.field,children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("div",{className:L.radioGroup,children:r.map(c=>l.jsxs("label",{className:L.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:L.error,children:String(a.message)})]})};async function wO(e,t,r,n){var o,a;const i=(a=(o=(await Fe.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 SO(e,t){var s,i;const n=(i=(s=(await Fe.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 CO(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 OO(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Fe.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 he={overlay:"_overlay_ga6eh_1",modal:"_modal_ga6eh_12",header:"_header_ga6eh_24",title:"_title_ga6eh_33",closeBtn:"_closeBtn_ga6eh_39",tabs:"_tabs_ga6eh_57",tab:"_tab_ga6eh_57",activeTab:"_activeTab_ga6eh_83",body:"_body_ga6eh_88",searchWrap:"_searchWrap_ga6eh_99",searchIcon:"_searchIcon_ga6eh_104",searchInput:"_searchInput_ga6eh_113",grid:"_grid_ga6eh_132",imgCell:"_imgCell_ga6eh_148",imgCellSelected:"_imgCellSelected_ga6eh_166",thumb:"_thumb_ga6eh_171",noThumb:"_noThumb_ga6eh_177",checkBadge:"_checkBadge_ga6eh_183",loadMoreBtn:"_loadMoreBtn_ga6eh_198",loadingRow:"_loadingRow_ga6eh_220",empty:"_empty_ga6eh_230",spinner:"_spinner_ga6eh_237",uploadArea:"_uploadArea_ga6eh_247",dropZone:"_dropZone_ga6eh_256",uploadIcon:"_uploadIcon_ga6eh_277",dropText:"_dropText_ga6eh_281",dropSubtext:"_dropSubtext_ga6eh_288",uploadPreview:"_uploadPreview_ga6eh_294",hiddenInput:"_hiddenInput_ga6eh_301",fileName:"_fileName_ga6eh_305",errorText:"_errorText_ga6eh_311",footer:"_footer_ga6eh_318",cancelBtn:"_cancelBtn_ga6eh_328",confirmBtn:"_confirmBtn_ga6eh_345"},wh=18,Sh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=h.useState("my"),[o,a]=h.useState(""),[c,d]=h.useState([]),[u,f]=h.useState(0),[g,y]=h.useState(!1),[b,p]=h.useState(null),[v,m]=h.useState(0),[_,S]=h.useState(null),[w,O]=h.useState(""),[T,x]=h.useState(!1),[P,$]=h.useState(""),k=h.useRef(null),M=oe(U=>{var R,Q;return((Q=(R=U.editorConfig)==null?void 0:R.context)==null?void 0:Q.channel)??""}),B=oe(U=>{var R,Q;return((Q=(R=U.editorConfig)==null?void 0:R.context)==null?void 0:Q.uid)??""}),A=oe(U=>{var R,Q,ue;return((ue=(Q=(R=U.editorConfig)==null?void 0:R.context)==null?void 0:Q.cloudStorage)==null?void 0:ue.presigned_headers)??{}}),j=oe(U=>{var R,Q,ue;return((ue=(Q=(R=U.editorConfig)==null?void 0:R.config)==null?void 0:Q.assetConfig)==null?void 0:ue.size)??1*1024*1024}),F=oe(U=>{var R,Q,ue;return((ue=(Q=(R=U.editorConfig)==null?void 0:R.config)==null?void 0:Q.assetConfig)==null?void 0:ue.accepted)??"image/png,image/jpeg"}),Z=h.useCallback(async(U,R,Q=!1)=>{var ue;y(!0);try{const Ee={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&B&&(Ee.createdBy=B),M&&(Ee.channel=M);const ye=((ue=(await Fe.post("/action/composite/v3/search",{request:{filters:Ee,query:U,limit:wh,offset:R,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ue.result)??{},ce=ye.content??[];f(ye.count??0),d(ge=>Q?[...ge,...ce]:ce)}catch{}finally{y(!1)}},[s,B,M]);h.useEffect(()=>{s!=="upload"&&(d([]),m(0),Z(o,0))},[s]);const ae=h.useRef(),me=U=>{a(U),clearTimeout(ae.current),ae.current=setTimeout(()=>{d([]),m(0),Z(U,0)},400)},Oe=()=>{const U=v+wh;m(U),Z(o,U,!0)},pe=()=>{const U=(b==null?void 0:b.artifactUrl)??(b==null?void 0:b.appIcon)??(b==null?void 0:b.downloadUrl)??"";U&&r(U)};h.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const K=U=>{var ue;const R=(ue=U.target.files)==null?void 0:ue[0];if(U.target.value="",!R)return;const Q=F.split(",").map(Ee=>Ee.trim());if(!Q.includes(R.type)){const Ee=Q.map(je=>je.replace("image/","").toUpperCase()).join(", ");$(`Only ${Ee} files are accepted.`);return}if(R.size>j){const Ee=(j/1048576).toFixed(0);$(`Image must be under ${Ee} MB.`);return}w&&URL.revokeObjectURL(w),S(R),O(URL.createObjectURL(R)),$("")},J=async()=>{if(_){x(!0),$("");try{const U=await wO(_.name.split(".").slice(0,-1).join(".")||_.name,_.type,B,M),R=await SO(U,_.name);await CO(R,_,A);const Q=R.split("?")[0],ue=await OO(U,Q,_.type);r(ue)}catch(U){$(U instanceof Error?U.message:"Upload failed.")}finally{x(!1)}}},se=c.length<u;return l.jsx("div",{className:he.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:he.modal,children:[l.jsxs("div",{className:he.header,children:[l.jsx("span",{className:he.title,children:"Select App Icon"}),l.jsx("button",{className:he.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(Ur,{size:18})})]}),l.jsxs("div",{className:he.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${he.tab} ${s==="my"?he.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${he.tab} ${s==="all"?he.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${he.tab} ${s==="upload"?he.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(qc,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:he.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:he.searchWrap,children:[l.jsx(Ho,{size:14,className:he.searchIcon}),l.jsx("input",{type:"search",className:he.searchInput,placeholder:"Search images…",value:o,onChange:U=>me(U.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:he.loadingRow,children:[l.jsx(pi,{size:20,className:he.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:he.empty,children:"No images found"}):l.jsx("div",{className:he.grid,children:c.map(U=>{const R=U.appIcon??U.artifactUrl??U.downloadUrl??"",Q=(b==null?void 0:b.identifier)===U.identifier;return l.jsxs("button",{type:"button",className:`${he.imgCell} ${Q?he.imgCellSelected:""}`,onClick:()=>p(U),title:U.name,children:[R?l.jsx("img",{src:R,alt:U.name,className:he.thumb}):l.jsx("div",{className:he.noThumb,children:"IMG"}),Q&&l.jsx("div",{className:he.checkBadge,children:l.jsx(yn,{size:12})})]},U.identifier)})}),se&&!g&&l.jsx("button",{className:he.loadMoreBtn,onClick:Oe,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:he.loadingRow,children:l.jsx(pi,{size:16,className:he.spinner})})]}):l.jsxs("div",{className:he.uploadArea,children:[l.jsx("div",{className:he.dropZone,onClick:()=>{var U;return(U=k.current)==null?void 0:U.click()},onDragOver:U=>U.preventDefault(),onDrop:U=>{U.preventDefault();const R=U.dataTransfer.files[0];R&&K({target:{files:[R],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:he.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(qc,{size:32,className:he.uploadIcon}),l.jsx("p",{className:he.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:he.dropSubtext,children:[F.split(",").map(U=>U.replace("image/","").toUpperCase()).join(", ")," · max ",(j/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:k,type:"file",accept:F,className:he.hiddenInput,onChange:K}),_&&l.jsx("p",{className:he.fileName,children:_.name}),P&&l.jsx("p",{className:he.errorText,children:P})]})}),l.jsxs("div",{className:he.footer,children:[l.jsx("button",{className:he.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:he.confirmBtn,disabled:!_||T,onClick:J,children:T?l.jsxs(l.Fragment,{children:[l.jsx(pi,{size:14,className:he.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:he.confirmBtn,disabled:!b,onClick:pe,children:"Use Selected"})]})]})})},EO=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Yt(),f=a(e),g=u[e],y=p=>{c(e,p,{shouldDirty:!0,shouldValidate:!0}),o(!1)},b=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:L.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:L.iconPreview}):l.jsxs("div",{className:L.iconPlaceholder,children:[l.jsx(zc,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:L.removeIconBtn,onClick:b,"aria-label":"Remove app icon",children:[l.jsx(Wo,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:L.error,children:String(g.message)}),i&&l.jsx(Sh,{nodeId:r,currentValue:f,onSelect:y,onClose:()=>o(!1)})]})},DO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Ri({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[L.input,o?L.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},IO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Ri({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=h.useState(""),d=h.useRef(null),u=i.value??[],f=p=>{const v=p.trim();!v||u.includes(v)||i.onChange([...u,v])},g=p=>{i.onChange(u.filter(v=>v!==p))},y=p=>{p.key==="Enter"||p.key===","?(p.preventDefault(),f(a),c("")):p.key==="Backspace"&&a===""&&u.length>0&&g(u[u.length-1])},b=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:[L.chipGroup,o?L.inputError:""].join(" "),onClick:()=>{var p;return!n&&((p=d.current)==null?void 0:p.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(p=>l.jsxs("span",{className:L.tagChip,children:[p,!n&&l.jsx("button",{type:"button",className:L.tagChipRemove,onClick:v=>{v.stopPropagation(),g(p)},"aria-label":`Remove ${p}`,children:l.jsx(Ur,{size:11})})]},p)),!n&&l.jsx("input",{ref:d,className:L.chipInput,value:a,onChange:p=>c(p.target.value),onKeyDown:y,onBlur:b,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},TO=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=Ri({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,g)=>{const y={};for(let b=0;b<f;b++)y[r[b].code]=c[r[b].code]??"";y[u]=g;for(let b=f+1;b<r.length;b++)y[r[b].code]="";o.onChange(y)};return l.jsxs("div",{className:[L.field,L.fullWidth].join(" "),children:[l.jsxs("label",{className:L.label,children:[t,n&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("div",{className:L.nestedSelectRow,children:r.map((u,f)=>{const g=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:L.field,style:{flex:1},children:[l.jsx("label",{className:L.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[L.input,a?L.inputError:""].join(" "),disabled:s||g,value:c[u.code]??"",onChange:y=>d(u.code,f,y.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(y=>l.jsx("option",{value:y.value,children:y.label},y.value))]})]},u.code)})}),a&&l.jsx("span",{className:L.error,children:String(a.message)})]})},Ch=[{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"}],NO=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=h.useState(!1),o=h.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Yt(),f=c(e),g=Ch.find(p=>p.value===f),y=(g==null?void 0:g.label)??"Select license…",b=u[e];return h.useEffect(()=>{if(!s)return;const p=v=>{var m;(m=o.current)!=null&&m.contains(v.target)||i(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),l.jsxs("div",{className:L.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:L.label,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[L.selectBtn,b?L.inputError:"",s?L.selectOpen:""].join(" "),onClick:()=>i(p=>!p),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?L.selectedVal:L.placeholder,children:y}),l.jsx(ds,{size:14,className:s?L.chevronUp:""})]}),s&&l.jsx("div",{className:L.dropdown,role:"listbox",children:Ch.map(p=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===p.value,className:[L.option,f===p.value?L.optionSelected:""].join(" "),onClick:()=>{d(e,p.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:p.label}),f===p.value&&l.jsx(yn,{size:13})]},p.value))}),b&&l.jsx("span",{className:L.error,children:String(b.message)})]})},kO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Ri({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=h.useState("idle"),[d,u]=h.useState(""),f=async()=>{const y=(i.value??"").trim();if(!y){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const b=await Wb(y),p=b==null?void 0:b.result,v=p==null?void 0:p.dialcodes;Array.isArray(v)&&v.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(pi,{size:16,className:L.dialcodeSpinner}):a==="valid"?l.jsx($c,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(Bo,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:L.field,children:[l.jsxs("label",{className:L.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:L.required,children:"*"})]}),l.jsxs("div",{className:L.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[L.input,o?L.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:y=>{i.onChange(y),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:L.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),g()]}),o&&l.jsx("span",{className:L.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?L.dialcodeValid:L.error,children:d})]})},dl={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},xO=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var ge,Le,Ve,ke,ee,Ke,tt;const a=oe(H=>H.editorConfig),c=oe(H=>H.rootFormConfig),d=oe(H=>H.unitFormConfig),u=oe(H=>H.categoryMeta),f=oe(H=>H.contentFramework),g=oe(H=>H.contentTargetFWIds),{organisationFramework:y,targetFrameworks:b,isLoading:p}=gh(f??((ge=a==null?void 0:a.context)==null?void 0:ge.framework),g??((Le=a==null?void 0:a.context)==null?void 0:Le.targetFWIds)),{frameworks:v,collectionAdditionalCategories:m,contentAdditionalCategories:_,defaultLicense:S,name:w}=K1((Ve=a==null?void 0:a.context)==null?void 0:Ve.channel),O=H1(v,(ke=u==null?void 0:u.frameworkMetadata)==null?void 0:ke.orgFWType,(ee=a==null?void 0:a.context)==null?void 0:ee.channel),T={organisationFramework:y,targetFrameworks:b,orgFrameworks:O,channelAdditionalCategories:m},x=Ae(H=>H.selectedNodeId),P=Ae(H=>H.treeData),$=Ae(H=>H.treeCache),k=x?$[x]??{}:{},M={...e,...k},B=h.useMemo(()=>{var re;if(!x)return 0;const H=[...P];for(;H.length;){const ie=H.shift();if(ie.id===x)return((re=ie.children)==null?void 0:re.length)??0;ie.children&&H.push(...ie.children)}return 0},[P,x]),A=(a==null?void 0:a.config)??{},j=(a==null?void 0:a.context)??{},F={editorMode:s,editableFields:A.editableFields,objectType:A.objectType,setDefaultCopyRight:A.setDefaultCopyRight===!0,defaultLicense:j.defaultLicense??S,contextAdditionalCategories:j.additionalCategories,userFullName:(Ke=j.user)==null?void 0:Ke.fullName,channelName:w,collectionAdditionalCategories:m,contentAdditionalCategories:_,childCount:B},Z=r?c:d,ae=Z||(((tt=a==null?void 0:a.config.hierarchy)==null?void 0:tt.formConfig)??[]),me=X1(ae,M,T,r,F),Oe=me.filter(H=>H.tab===t&&H.inputType!=="appIcon"&&H.visible!==!1),pe=V1({mode:"onChange",defaultValues:Object.fromEntries(me.map(H=>{const re=["multiselect","chips","keywords","tagsinput"],ie=["nestedselect"];return re.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??[]]:ie.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??{}]:[H.code,H.currentValue??H.defaultValue??""]}))});gO(pe,me);const{updateNode:K}=Ae(),J=h.useRef(me);J.current=me;const se=h.useRef(x);se.current=x;const U=h.useRef(i);U.current=i;const R=h.useRef(o);R.current=o;const Q=h.useRef(typeof M.shuffle=="boolean"?M.shuffle:void 0),ue=h.useRef(M.name??"");ue.current=M.name??"";const Ee=h.useRef(s);Ee.current=s;const je=["review","read","sourcingreview","orgreview"];h.useEffect(()=>{const H=se.current;if(H){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&&K(H,re)}pe.trigger().then(()=>{const re=pe.formState.errors,ie=J.current,Re=Array.from(new Set(Object.keys(re).map(pr=>{var gr;return(gr=ie.find(un=>un.code===pr))==null?void 0:gr.tab}).filter(Boolean)));R.current(Object.keys(re).length===0,Re)})},[]),h.useEffect(()=>{const H=pe.watch((re,{name:ie})=>{const Re=se.current;if(!Re)return;const pr=J.current,gr=new Set(pr.map(C=>C.code));if(ie&&gr.has(ie)){let C=pe.getValues(ie);ie==="dialcodes"&&(C=Array.isArray(C)?C:C?[C]:[]),ie==="shuffle"&&(C===!0&&Q.current===!1&&De("Shuffling is enabled for this question set.",{icon:"ℹ️"}),Q.current=C);const I=pO(ie,C);I&&(K(Re,I),U.current(I))}else if(!ie){const C=pe.getValues(),I=Object.fromEntries(Object.entries(C).filter(([z])=>gr.has(z))),N=hO(I,{isReview:je.includes(Ee.current),nodeTitle:ue.current});Object.keys(N).length>0&&(K(Re,N),U.current(N))}const un=pe.formState.errors,Gn=Array.from(new Set(Object.keys(un).map(C=>{var I;return(I=pr.find(N=>N.code===C))==null?void 0:I.tab}).filter(Boolean)));R.current(Object.keys(un).length===0,Gn)});return()=>H.unsubscribe()},[pe]);const ye=Oe.reduce((H,re)=>{const ie=H[H.length-1];return ie&&ie.section===re.section?ie.fields.push(re):H.push({section:re.section,fields:[re]}),H},[]),ce=H=>{const re={key:H.code,name:H.code,label:H.label,required:H.required,disabled:H.editable===!1};switch(H.inputType){case"textarea":return l.jsx(_h,{...re,multiline:!0,maxLength:H.maxLength});case"select":return l.jsx(vO,{...re,options:H.options??[]});case"multiselect":return l.jsx(mO,{...re,options:H.options??[]});case"chips":return l.jsx(bO,{...re});case"radio":return l.jsx(_O,{...re,options:H.options??[]});case"appIcon":return l.jsx(EO,{...re,nodeId:x??""});case"datepicker":case"datetime":return l.jsx(DO,{...re});case"keywords":case"tagsinput":return l.jsx(IO,{...re});case"nestedselect":return l.jsx(TO,{...re,levels:H.levels??[]});case"license":return l.jsx(NO,{...re});case"dialcode":return l.jsx(kO,{...re});default:return l.jsx(_h,{...re,maxLength:H.maxLength})}};return l.jsx(I1,{...pe,children:l.jsxs("div",{className:dl.form,children:[ye.map((H,re)=>{const ie=H.section?Q1[H.section]:void 0;return ie?l.jsx(yO,{title:ie.title,description:ie.description,children:H.fields.map(ce)},H.section??re):l.jsx("div",{className:dl.ungrouped,children:H.fields.map(ce)},re)}),Oe.length===0&&!p&&l.jsx("p",{className:dl.noFields,children:"No fields configured for this tab."})]})})};function Oh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function AO(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function to(e){return e!==null&&e>=0}function PO(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 MO(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Eh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Oh(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}},ro={scaleX:1,scaleY:1},LO=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,...ro}:null}const c=FO(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...ro}:s<r&&s>=o?{x:0,y:a.height+c,...ro}:{x:0,y:0,...ro}};function FO(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 Dh="Sortable",Ih=h.createContext({activeIndex:-1,containerId:Dh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Eh,disabled:{draggable:!1,droppable:!1}});function $O(e){let{children:t,id:r,items:n,strategy:s=Eh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=Pc(),f=ss(Dh,r),g=a.rect!==null,y=h.useMemo(()=>n.map(T=>typeof T=="object"&&"id"in T?T.id:T),[n]),b=o!=null,p=o?y.indexOf(o.id):-1,v=d?y.indexOf(d.id):-1,m=h.useRef(y),_=!PO(y,m.current),S=v!==-1&&p===-1||_,w=MO(i);Ht(()=>{_&&b&&u(y)},[_,y,b,u]),h.useEffect(()=>{m.current=y},[y]);const O=h.useMemo(()=>({activeIndex:p,containerId:f,disabled:w,disableTransforms:S,items:y,overIndex:v,useDragOverlay:g,sortedRects:AO(y,c),strategy:s}),[p,f,w.draggable,w.droppable,S,y,v,c,g,s]);return h.createElement(Ih.Provider,{value:O},t)}const jO=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Oh(r,n,s).indexOf(t)},BO=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},UO={duration:200,easing:"ease"},Th="transform",zO=Cr.Transition.toString({property:Th,duration:0,easing:"linear"}),VO={roleDescription:"sortable"};function qO(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=h.useState(null),a=h.useRef(r);return Ht(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=gn(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]),h.useEffect(()=>{i&&o(null)},[i]),i}function HO(e){let{animateLayoutChanges:t=BO,attributes:r,disabled:n,data:s,getNewIndex:i=jO,id:o,strategy:a,resizeObserverConfig:c,transition:d=UO}=e;const{items:u,containerId:f,activeIndex:g,disabled:y,disableTransforms:b,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:_}=h.useContext(Ih),S=WO(n,y),w=u.indexOf(o),O=h.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),T=h.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:x,node:P,isOver:$,setNodeRef:k}=Vy({id:o,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...c}}),{active:M,activatorEvent:B,activeNodeRect:A,attributes:j,setNodeRef:F,listeners:Z,isDragging:ae,over:me,setActivatorNodeRef:Oe,transform:pe}=Ac({id:o,data:O,attributes:{...VO,...r},disabled:S.draggable}),K=Ig(k,F),J=!!M,se=J&&!b&&to(g)&&to(v),U=!m&&ae,R=U&&se?pe:null,ue=se?R??(a??_)({rects:p,activeNodeRect:A,activeIndex:g,overIndex:v,index:w}):null,Ee=to(g)&&to(v)?i({id:o,items:u,activeIndex:g,overIndex:v}):w,je=M==null?void 0:M.id,ye=h.useRef({activeId:je,items:u,newIndex:Ee,containerId:f}),ce=u!==ye.current.items,ge=t({active:M,containerId:f,isDragging:ae,isSorting:J,id:o,index:w,items:u,newIndex:ye.current.newIndex,previousItems:ye.current.items,previousContainerId:ye.current.containerId,transition:d,wasDragging:ye.current.activeId!=null}),Le=qO({disabled:!ge,index:w,node:P,rect:x});return h.useEffect(()=>{J&&ye.current.newIndex!==Ee&&(ye.current.newIndex=Ee),f!==ye.current.containerId&&(ye.current.containerId=f),u!==ye.current.items&&(ye.current.items=u)},[J,Ee,f,u]),h.useEffect(()=>{if(je===ye.current.activeId)return;if(je&&!ye.current.activeId){ye.current.activeId=je;return}const ke=setTimeout(()=>{ye.current.activeId=je},50);return()=>clearTimeout(ke)},[je]),{active:M,activeIndex:g,attributes:j,data:O,rect:x,index:w,newIndex:Ee,items:u,isOver:$,isSorting:J,isDragging:ae,listeners:Z,node:P,overIndex:v,over:me,setNodeRef:K,setActivatorNodeRef:Oe,setDroppableNodeRef:k,setDraggableNodeRef:F,transform:Le??ue,transition:Ve()};function Ve(){if(Le||ce&&ye.current.newIndex===w)return zO;if(!(U&&!ii(B)||!d)&&(J||ge))return Cr.Transition.toString({...d,property:Th})}}function WO(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 no(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 KO=[Se.Down,Se.Right,Se.Up,Se.Left],QO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(KO.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 Se.Down:n.top<g.top&&c.push(f);break;case Se.Up:n.top>g.top&&c.push(f);break;case Se.Left:n.left>g.left&&c.push(f);break;case Se.Right:n.left<g.left&&c.push(f);break}});const d=Hg({collisionRect:n,droppableRects:s,droppableContainers:c});let u=sc(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),y=g?s.get(g.id):null,b=g==null?void 0:g.node.current;if(b&&y&&f&&g){const v=li(b).some((T,x)=>a[x]!==T),m=Nh(f,g),_=GO(f,g),S=v||!m?{x:0,y:0}:{x:_?n.width-y.width:0,y:_?n.height-y.height:0},w={x:y.left,y:y.top};return S.x&&S.y?w:is(w,S)}}}};function Nh(e,t){return!no(e)||!no(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function GO(e,t){return!no(e)||!no(t)||!Nh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Xr={row:"_row_11nth_1",removeBtn:"_removeBtn_11nth_14",grip:"_grip_11nth_17",ctIcon:"_ctIcon_11nth_34",info:"_info_11nth_38",name:"_name_11nth_46",meta:"_meta_11nth_55"},YO={video:Ko,pdf:Uo,h5p:zo,scorm:qo,audio:Vo,quiz:jo,default:vn},RO=({item:e,onRemove:t,isEditable:r})=>{const n=Qi(e),s=YO[n.key]??vn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=HO({id:e.id,disabled:!r}),f={transform:Cr.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Xr.row,role:"listitem",children:[r&&l.jsx("span",{className:Xr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Uc,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Xr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Xr.info,children:[l.jsx("span",{className:Xr.name,title:e.name,children:e.name}),l.jsx("span",{className:Xr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Xr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(Ur,{size:14})})]})},Zr={container:"_container_lzvke_1",header:"_header_lzvke_7",heading:"_heading_lzvke_13",count:"_count_lzvke_21",list:"_list_lzvke_30",emptyState:"_emptyState_lzvke_36",addRow:"_addRow_lzvke_52"},XO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Ae(),i=t?r(t):[],o=e==="edit",a=ec(Io(ci,{activationConstraint:{distance:5}}),Io(Ao,{coordinateGetter:QO})),c=h.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const y=Ae.getState().getChildrenOf(t),b=y.findIndex(v=>v.id===f.id),p=y.findIndex(v=>v.id===g.id);b<0||p<0||n(t,b,p)},[t,n]),d=h.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(kc,{sensors:a,collisionDetection:qg,onDragEnd:c,children:l.jsx($O,{items:i.map(u=>u.id),strategy:LO,children:l.jsx("div",{className:Zr.list,role:"list",children:i.map(u=>l.jsx(RO,{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(fs,{size:14})," Add content"]})]}):null},kh={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},ZO=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${kh.dropZone} ${e?kh.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 JO(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Fe.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 eE(e){var r,n;return(n=(r=(await Fe.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Ue={contentPlayerRoot:"_contentPlayerRoot_ryh6z_1",stage:"_stage_ryh6z_9",playerHeader:"_playerHeader_ryh6z_19",playerHeaderThumb:"_playerHeaderThumb_ryh6z_33",playerHeaderTitle:"_playerHeaderTitle_ryh6z_43",typeBadge:"_typeBadge_ryh6z_53",typeDot:"_typeDot_ryh6z_92",aspectRatio:"_aspectRatio_ryh6z_99",playerFrame:"_playerFrame_ryh6z_112",coverOverlay:"_coverOverlay_ryh6z_120",coverHidden:"_coverHidden_ryh6z_132",coverThumb:"_coverThumb_ryh6z_137",coverPlayRing:"_coverPlayRing_ryh6z_146",coverPlayIcon:"_coverPlayIcon_ryh6z_159",coverLabel:"_coverLabel_ryh6z_168",coverSkeleton:"_coverSkeleton_ryh6z_174",playerWrapper:"_playerWrapper_ryh6z_200",infoStrip:"_infoStrip_ryh6z_210",infoChip:"_infoChip_ryh6z_226",infoChipLabel:"_infoChipLabel_ryh6z_245",infoChipIcon:"_infoChipIcon_ryh6z_254",playerError:"_playerError_ryh6z_260",playerErrorIcon:"_playerErrorIcon_ryh6z_274",playerErrorMsg:"_playerErrorMsg_ryh6z_279",qumlRoot:"_qumlRoot_ryh6z_286"},tE=[{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 rE(e){return tE.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const nE={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},sE={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},iE={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},oE="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function fl(e){for(const[t,r]of Object.entries(nE))if(r.includes(e))return t;return"default-player"}function aE(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 lE(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 cE(e,t,r=100){await lE(sE[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 uE=[{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 dE({node:e}){const t=e.metadata??{},r=uE.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:Ue.infoStrip,children:r.map(n=>l.jsxs("div",{className:Ue.infoChip,children:[n.icon&&l.jsx("span",{className:Ue.infoChipIcon,children:n.icon}),l.jsx("span",{className:Ue.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function fE({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Ue.coverOverlay} ${t?Ue.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Ue.coverThumb}),l.jsx("div",{className:Ue.coverPlayRing,children:l.jsx("div",{className:Ue.coverPlayIcon})}),l.jsx("span",{className:Ue.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Ue.coverSkeleton})})}function hE({message:e}){return l.jsxs("div",{className:Ue.playerError,children:[l.jsx("span",{className:Ue.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Ue.playerErrorMsg,children:e})]})}function pE({mimeType:e}){const t=rE(e);return l.jsxs("span",{className:Ue.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Ue.typeDot}),t.label]})}const hl=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(yE,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:Ue.contentPlayerRoot,children:[l.jsxs("div",{className:Ue.stage,children:[l.jsxs("div",{className:Ue.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:Ue.playerHeaderThumb}),l.jsx("span",{className:Ue.playerHeaderTitle,children:e.name}),l.jsx(pE,{mimeType:e.mimeType??""})]}),l.jsx(gE,{node:e})]}),l.jsx(dE,{node:e})]})};function gE({node:e}){var v;const t=oe(m=>m.editorConfig),[r,n]=h.useState(()=>fl(e.mimeType??"")),[s,i]=h.useState(!1),[o,a]=h.useState(null),[c,d]=h.useState(e.metadata??{}),[u,f]=h.useState(!1),g=h.useRef(null),y=h.useRef(null),b=((v=t==null?void 0:t.config)==null?void 0:v.previewCdnUrl)??oE;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(fl(e.mimeType??"")),eE(e.identifier).then(_=>{if(m)return;const S={...e.metadata??{},..._};d(S);const w=_.mimeType??e.mimeType??"";n(fl(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=aE(e,c,t);return h.useEffect(()=>{if(!u||r!=="default-player")return;const m=g.current;if(!m)return;m.src=b;const _=()=>{try{const w=m.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(p),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 m.addEventListener("load",_),m.addEventListener("error",S),()=>{m.removeEventListener("load",_),m.removeEventListener("error",S),m.src=""}},[e.identifier,r,b,u]),h.useEffect(()=>{if(!u||r==="default-player")return;const m=y.current;if(!m)return;const _=iE[r];if(!_)return;const S=p;cE(_,r).then(()=>{if(!y.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",()=>{}),m.innerHTML="",m.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:Ue.aspectRatio,children:[o?l.jsx(hE,{message:o}):l.jsx(fE,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:Ue.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:y,className:Ue.playerFrame})]})}function yE({node:e,editorMode:t}){const r=oe(s=>s.editorConfig),n=h.useRef(null);return h.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:Ue.qumlRoot,children:l.jsx("div",{ref:n,className:Ue.playerWrapper})})}const zt={overlay:"_overlay_ifddx_1",modal:"_modal_ifddx_11",header:"_header_ifddx_21",body:"_body_ifddx_37",hint:"_hint_ifddx_43",list:"_list_ifddx_49",item:"_item_ifddx_55",selected:"_selected_ifddx_68",empty:"_empty_ifddx_73",footer:"_footer_ifddx_79",cancelBtn:"_cancelBtn_ifddx_87",moveBtn:"_moveBtn_ifddx_95"};function vE(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 mE=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Ae(),o=vE(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=h.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:zt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:zt.modal,children:[l.jsxs("div",{className:zt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(Ur,{size:16})})]}),l.jsxs("div",{className:zt.body,children:[l.jsx("p",{className:zt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:zt.list,children:[o.map(f=>l.jsxs("li",{className:`${zt.item} ${a===f.id?zt.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(cv,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:zt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:zt.footer,children:[l.jsx("button",{className:zt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:zt.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},rr={overlay:"_overlay_16at9_1",modal:"_modal_16at9_11",header:"_header_16at9_21",body:"_body_16at9_37",table:"_table_16at9_43",pageInput:"_pageInput_16at9_61",empty:"_empty_16at9_68",footer:"_footer_16at9_74",cancelBtn:"_cancelBtn_16at9_82",saveBtn:"_saveBtn_16at9_90"};function bE(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 _E=({onClose:e})=>{const{treeData:t,updateNode:r}=Ae(),n=bE(t),[s,i]=h.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=h.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(Ur,{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(mv,{size:14})," Save"]})]})]})})},We={container:"_container_1a7t2_1",panelHeader:"_panelHeader_1a7t2_10",panelHeaderLeft:"_panelHeaderLeft_1a7t2_19",panelCollapseBtn:"_panelCollapseBtn_1a7t2_27",titleRow:"_titleRow_1a7t2_46",field:"_field_1a7t2_47",moveBtn:"_moveBtn_1a7t2_64",icon:"_icon_1a7t2_84",nameInput:"_nameInput_1a7t2_93",fieldHeader:"_fieldHeader_1a7t2_118",label:"_label_1a7t2_124",fieldCount:"_fieldCount_1a7t2_133",chips:"_chips_1a7t2_170",chip:"_chip_1a7t2_170",chipRemove:"_chipRemove_1a7t2_188",keywordInput:"_keywordInput_1a7t2_202",input:"_input_1a7t2_207",addBtn:"_addBtn_1a7t2_220",radioGroup:"_radioGroup_1a7t2_234",radioLabel:"_radioLabel_1a7t2_239"},wE=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var M,B;const{updateNode:s,markDirty:i}=Ae(),o=t==="edit",a=Qi(e),c=oe(A=>A.relationalFormConfig),d=A=>c==null?void 0:c.find(j=>j.code===A),u=A=>!c||!!d(A),f=(A,j)=>{var F;return((F=d(A))==null?void 0:F.label)||j},[g,y]=h.useState(!0),b=((M=e.metadata)==null?void 0:M.relationalMetadata)??{},[p,v]=h.useState(b.name??e.name??""),[m,_]=h.useState(""),[S,w]=h.useState(Array.isArray(b.keywords)?b.keywords:Array.isArray((B=e.metadata)==null?void 0:B.keywords)?e.metadata.keywords:[]),[O,T]=h.useState(!!b.optional);h.useEffect(()=>{var j,F;const A=((j=e.metadata)==null?void 0:j.relationalMetadata)??{};v(A.name??e.name??""),w(Array.isArray(A.keywords)?A.keywords:Array.isArray((F=e.metadata)==null?void 0:F.keywords)?e.metadata.keywords:[]),T(!!A.optional)},[e.id]);const x=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},P=()=>{const A=m.trim();if(A&&!S.includes(A)){const j=[...S,A];w(j),s(e.id,{keywords:j}),i()}_("")},$=A=>{const j=S.filter(F=>F!==A);w(j),s(e.id,{keywords:j}),i()},k=A=>{T(A),s(e.id,{optional:A}),i()};return l.jsxs("div",{className:We.container,children:[l.jsxs("div",{className:We.panelHeader,children:[l.jsxs("div",{className:We.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:We.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:We.panelCollapseBtn,onClick:()=>y(A=>!A),"aria-expanded":g,"aria-label":g?"Collapse metadata panel":"Expand metadata panel",title:g?"Collapse":"Expand",children:g?l.jsx(ds,{size:15}):l.jsx(ov,{size:15})})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:We.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:We.icon}),l.jsx("input",{type:"text",className:We.nameInput,value:p,disabled:!o,onChange:A=>v(A.target.value),onBlur:x,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:We.field,children:[l.jsx("div",{className:We.fieldHeader,children:l.jsxs("label",{className:We.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:We.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:We.chips,children:S.map(A=>l.jsxs("span",{className:We.chip,children:[A,o&&l.jsx("button",{type:"button",className:We.chipRemove,onClick:()=>$(A),children:"×"})]},A))}),o&&l.jsxs("div",{className:We.keywordInput,children:[l.jsx("input",{type:"text",className:We.input,value:m,placeholder:"Add keyword and press Enter",onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),P())}}),l.jsx("button",{type:"button",className:We.addBtn,onClick:P,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:We.field,children:[l.jsx("label",{className:We.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:We.radioGroup,children:[l.jsxs("label",{className:We.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!0,onChange:()=>k(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:We.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!1,onChange:()=>k(!1),disabled:!o}),"No"]})]})]})]}),n]})},As={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},SE=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.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:[As.iconBtn,r?As.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:As.iconImg}):l.jsx("div",{className:As.placeholder,children:l.jsx(zc,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:As.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Wo,{size:11})})]}),n&&l.jsx(Sh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Rt={leafContentLayout:"_leafContentLayout_1osey_1",container:"_container_1osey_17",emptyState:"_emptyState_1osey_26",titleRow:"_titleRow_1osey_36",nodeTitle:"_nodeTitle_1osey_52",formArea:"_formArea_1osey_74",contentListArea:"_contentListArea_1osey_78",dropZone:"_dropZone_1osey_83",reviewComment:"_reviewComment_1osey_90",reviewCommentLabel:"_reviewCommentLabel_1osey_103",reviewCommentText:"_reviewCommentText_1osey_109"},CE=["application/vnd.sunbird.questionset"],OE=({editorMode:e,onToolbarEvent:t})=>{var M,B,A,j;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,d]=h.useState(!1),u=h.useRef(null),f=h.useRef(),{selectedNodeId:g,breadcrumb:y,activeNodeMeta:b,updateNode:p,treeData:v}=Ae(),m=oe(F=>{var Z,ae,me,Oe;return((ae=(Z=F.editorConfig)==null?void 0:Z.context)==null?void 0:ae.contentId)??((Oe=(me=F.editorConfig)==null?void 0:me.context)==null?void 0:Oe.identifier)??""}),_=g?xh(v,g):null,S=!!_&&!_.parent,w=!!(_!=null&&_.isFolder),O=_&&CE.includes(_.mimeType??""),T=_&&!_.isFolder&&!O&&!S,x=((M=_==null?void 0:_.metadata)==null?void 0:M.rejectComment)??(S?(A=(B=v[0])==null?void 0:B.metadata)==null?void 0:A.rejectComment:void 0),P=h.useCallback(()=>{const F=u.current;if(!F||!g)return;const Z=F.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(g,{name:Z})},600)},[g,p]),$=h.useCallback(F=>{t({action:"onFormValueChange",data:F})},[t]),k=h.useCallback((F,Z)=>{i(Z),t({action:"onFormStatusChange",data:{isValid:F,nodeId:g}})},[t,g]);return _?O?l.jsx(hl,{node:_,editorMode:e,type:"quml"}):T?l.jsxs("div",{className:Rt.leafContentLayout,children:[l.jsx(hl,{node:_,editorMode:e,type:"content"}),l.jsx(wE,{node:_,editorMode:e,onMoveClick:()=>a(_.identifier),reorderDialog:o?l.jsx(mE,{resourceId:o,resourceName:_.name,currentUnitId:_.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Rt.container,children:[l.jsx(C1,{crumbs:y}),x&&l.jsxs("div",{className:Rt.reviewComment,role:"alert",children:[l.jsx("span",{className:Rt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Rt.reviewCommentText,children:x})]}),l.jsxs("div",{className:Rt.titleRow,children:[S&&g&&l.jsx(SE,{nodeId:g,value:String(_.appIcon??((j=_.metadata)==null?void 0:j.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Rt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:P,onBlur:P,"data-placeholder":"Untitled","aria-label":"Node title",children:_.name})]}),l.jsx(O1,{activeTab:r,onChange:F=>n(F),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Rt.formArea,children:l.jsx(xO,{nodeMetadata:b,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:$,onFormStatusChange:k},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Rt.contentListArea,children:l.jsx(XO,{editorMode:e})}),l.jsx(ZO,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Rt.dropZone}),c&&l.jsx(_E,{contentId:m,onClose:()=>d(!1)})]}):l.jsx("div",{className:Rt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function xh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=xh(r.children,t);if(n)return n}}}const Ah=yi((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})}})),EE=20;function Ph(){var d;const e=oe(u=>u.editorConfig),t=Ae(u=>u.selectedNodeId),r=Ae(u=>u.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function u(f,g,y=0){var b;for(const p of f){if(p.id===g)return y;if((b=p.children)!=null&&b.length){const v=u(p.children,g,y+1);if(v>=0)return v}}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[...Bf];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:[...Bf]}function DE(){const e=Ah(),t=oe(f=>{var g,y;return((y=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:y.channel)??""}),r=Ph(),n=h.useRef(),s=h.useCallback(async(f="",g="all",y={},b=!0,p=!1)=>{var v,m,_,S,w;e.setLoading(!0);try{const O={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(v=y==null?void 0:y.board)!=null&&v.length&&(O.board=y.board),(m=y==null?void 0:y.medium)!=null&&m.length&&(O.medium=y.medium),(_=y==null?void 0:y.gradeLevel)!=null&&_.length&&(O.gradeLevel=y.gradeLevel),(S=y==null?void 0:y.subject)!=null&&S.length&&(O.subject=y.subject),(w=y==null?void 0:y.primaryCategory)!=null&&w.length&&(O.primaryCategory=y.primaryCategory);const T=b?0:e.offset,{content:x,count:P}=await JO({filters:O,query:f,limit:f?50:EE,offset:T,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});b?e.setContent(x,P):e.appendContent(x,P)}catch(O){console.error("[useLibrary] load error:",O)}finally{e.setLoading(!1)}},[r,t]);h.useEffect(()=>{s()},[t]);const i=h.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=h.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=h.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=h.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=h.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 nr={card:"_card_jzciw_1",addBtn:"_addBtn_jzciw_17",dragging:"_dragging_jzciw_24",ctIcon:"_ctIcon_jzciw_29",info:"_info_jzciw_33",name:"_name_jzciw_41",meta:"_meta_jzciw_50",addBtnMuted:"_addBtnMuted_jzciw_78",added:"_added_jzciw_87",addedBadge:"_addedBadge_jzciw_96"},IE={video:Ko,pdf:Uo,h5p:zo,scorm:qo,audio:Vo,quiz:jo,default:vn},TE=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=Qi(e),o=IE[i.key]??vn,a=Qa(),c=d1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:y}=Ac({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,y?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:[((p=e.organisation)==null?void 0:p[0])??e.channel??"",(v=e.organisation)!=null&&v[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(yn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[nr.addBtn,!d&&a?nr.addBtnMuted:""].join(" "),onClick:m=>{m.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})})]})},Mh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},NE=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Mh.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",Mh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),st={panel:"_panel_1cl11_1",header:"_header_1cl11_10",headerTitle:"_headerTitle_1cl11_19",closeBtn:"_closeBtn_1cl11_25",body:"_body_1cl11_43",section:"_section_1cl11_59",sectionLabel:"_sectionLabel_1cl11_65",chips:"_chips_1cl11_73",chip:"_chip_1cl11_73",active:"_active_1cl11_96",footer:"_footer_1cl11_102",resetBtn:"_resetBtn_1cl11_112",applyBtn:"_applyBtn_1cl11_129"},kE=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],xE=new Set(["board","medium","gradeLevel","subject","topic"]),AE=({local:e,toggle:t})=>{const r=Ph();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},PE=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var p,v;const s=oe(m=>m.editorConfig),i=oe(m=>m.searchFormConfig),o=oe(m=>m.contentFramework),a=oe(m=>m.contentTargetFWIds),{organisationFramework:c}=gh(o??((p=s==null?void 0:s.context)==null?void 0:p.framework),a??((v=s==null?void 0:s.context)==null?void 0:v.targetFWIds)),[d,u]=h.useState(t),f=i!=null&&i.length?i.filter(m=>xE.has(m.code)).map(m=>({key:m.code,label:m.label||m.code})):kE;h.useEffect(()=>{u(t)},[t]);const g=(m,_)=>{u(S=>{const w=S[m]??[],O=w.includes(_)?w.filter(T=>T!==_):[...w,_];return{...S,[m]:O}})},y=(c==null?void 0:c.categories)??[],b=m=>{var _;return((_=y.find(S=>S.code===m))==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(Ur,{size:16})})]}),l.jsxs("div",{className:st.body,children:[f.map(({key:m,label:_})=>{const S=b(m);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[m]??[]).includes(w.name)?st.active:""].join(" "),onClick:()=>g(m,w.name),children:w.name},w.identifier))})]},m):null}),l.jsx(AE,{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},dr={header:"_header_6qdpu_10",title:"_title_6qdpu_20",headerActions:"_headerActions_6qdpu_31",iconBtn:"_iconBtn_6qdpu_38",playerArea:"_playerArea_6qdpu_56",footer:"_footer_6qdpu_64",addBtn:"_addBtn_6qdpu_73",modalOverlay:"_modalOverlay_6qdpu_92",modalPanel:"_modalPanel_6qdpu_103"},ME=({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 qe.createPortal(l.jsx("div",{className:dr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:dr.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:dr.header,children:[l.jsx("span",{className:dr.title,title:e.name,children:e.name}),l.jsx("div",{className:dr.headerActions,children:l.jsx("button",{type:"button",className:dr.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(Ur,{size:16})})})]}),l.jsx("div",{className:dr.playerArea,children:l.jsx(hl,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:dr.footer,children:l.jsx("button",{type:"button",className:dr.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},ze={dock:"_dock_1lpg0_1",header:"_header_1lpg0_8",headerLeft:"_headerLeft_1lpg0_17",headerTitle:"_headerTitle_1lpg0_24",count:"_count_1lpg0_30",searchRow:"_searchRow_1lpg0_39",searchWrap:"_searchWrap_1lpg0_47",searchIcon:"_searchIcon_1lpg0_53",searchInput:"_searchInput_1lpg0_62",filterToggleBtn:"_filterToggleBtn_1lpg0_80",filterToggleBtnActive:"_filterToggleBtnActive_1lpg0_99",filterBadge:"_filterBadge_1lpg0_105",filters:"_filters_1lpg0_124",mainArea:"_mainArea_1lpg0_134",sidePanelOverlay:"_sidePanelOverlay_1lpg0_143",cardList:"_cardList_1lpg0_152",skeleton:"_skeleton_1lpg0_168",skeletonIcon:"_skeletonIcon_1lpg0_178",skeletonText:"_skeletonText_1lpg0_186",skeletonLine:"_skeletonLine_1lpg0_193",skeletonLineSm:"_skeletonLineSm_1lpg0_200",loadMoreBtn:"_loadMoreBtn_1lpg0_215",emptyState:"_emptyState_1lpg0_240",collapseBtn:"_collapseBtn_1lpg0_260"};function LE(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 FE=({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:y,loadMore:b}=DE(),{addResource:p,selectedNodeId:v,treeData:m}=Ae(),_=e==="edit",[S,w]=h.useState(!1),[O,T]=h.useState({}),[x,P]=h.useState(null),$=h.useMemo(()=>LE(m),[m]),k=h.useCallback(F=>{var me;if(!v){De.error("Select a unit first");return}const Z=(me=m[0])==null?void 0:me.id;if(v===Z){De("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(p(F,v)===!1){De.error(`"${F.name}" is already in this collection`);return}De.success(`Added "${F.name}"`)},[v,p,m]),M=h.useCallback(F=>{T(F),g(F)},[g]),B=h.useCallback(F=>{P(F)},[]),A=h.useCallback(F=>{k(F),P(null)},[k]),j=h.useMemo(()=>Object.values(O).reduce((F,Z)=>F+((Z==null?void 0:Z.length)??0),0),[O]);return l.jsxs("div",{className:ze.dock,children:[l.jsx("div",{className:ze.header,children:l.jsxs("div",{className:ze.headerLeft,children:[l.jsx("button",{type:"button",className:ze.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(gv,{size:15})}),l.jsx(fv,{size:16}),l.jsx("span",{className:ze.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:ze.count,children:i})]})}),l.jsxs("div",{className:ze.searchRow,children:[l.jsxs("div",{className:ze.searchWrap,children:[l.jsx(Ho,{size:14,className:ze.searchIcon}),l.jsx("input",{type:"search",className:ze.searchInput,placeholder:"Search content…",value:a,onChange:F=>u(F.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[ze.filterToggleBtn,c?ze.filterToggleBtnActive:""].join(" "),onClick:y,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(sv,{size:15}):l.jsx(av,{size:15})}),l.jsxs("button",{type:"button",className:[ze.filterToggleBtn,S?ze.filterToggleBtnActive:""].join(" "),onClick:()=>w(F=>!F),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(wv,{size:15}),j>0&&l.jsx("span",{className:ze.filterBadge,children:j})]})]}),l.jsx("div",{className:ze.filters,children:l.jsx(NE,{filters:f1,active:o,onChange:f})}),l.jsxs("div",{className:ze.mainArea,children:[l.jsx("div",{className:ze.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((F,Z)=>l.jsxs("div",{className:ze.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:ze.skeletonIcon}),l.jsxs("div",{className:ze.skeletonText,children:[l.jsx("div",{className:ze.skeletonLine}),l.jsx("div",{className:ze.skeletonLineSm})]})]},Z)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(F=>l.jsx(TE,{item:F,onAdd:k,onPreview:B,isDraggable:_,isAdded:$.has(F.identifier)},F.identifier)),d&&l.jsx("button",{type:"button",className:ze.loadMoreBtn,onClick:b,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:ze.emptyState,children:[l.jsx(Ho,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:ze.sidePanelOverlay,children:l.jsx(PE,{isOpen:S,filters:O,onApply:M,onClose:()=>w(!1)})}),x&&l.jsx(ME,{content:x,onAdd:A,onClose:()=>P(null)})]})]})};function $E(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,y=!1){const b={};for(const[p,v]of Object.entries(g))if(!i.has(p)&&!(y&&o.has(p)))if(a.has(p))Array.isArray(v)?b[p]=v:v!=null&&v!==""?b[p]=[v]:b[p]=[];else if(c.has(p)){const m=Number(v);isNaN(m)||(b[p]=m)}else b[p]=v;return b}function u(g){var b;const y={};for(const p of g.children??[]){if(p.isFolder)continue;const v=t[p.identifier];if(!v)continue;const{isNew:m,..._}=v;if(Object.keys(_).length===0)continue;const S=((b=p.metadata)==null?void 0:b.relationalMetadata)??{};y[p.identifier]={name:p.name,...S,..._}}return y}function f(g,y){var S,w;const b=g.identifier,p=t[b],v=b.startsWith("temp-")||!!(p!=null&&p.isNew),m=!g.isFolder&&!y;if(y||v||p&&!m){let O;if(v)O={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(y){const{isNew:T,...x}=p??{};O={...d(g.metadata??{},!0),...d(x,!1),name:g.name}}else{const{isNew:T,...x}=p??{};O={name:g.name,visibility:"Parent",...d(x,!0)}}n[b]={metadata:O,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:y,isNew:v}}const _=g.isFolder?u(g):{};s[b]={name:g.name,children:(g.children??[]).map(O=>O.identifier),...Object.keys(_).length>0?{relationalMetadata:_}:{},root:y},(g.children??[]).forEach(O=>f(O,!1))}return e.forEach((g,y)=>f(g,y===0)),{nodesModified:n,hierarchy:s}}function jE(){const[e,t]=h.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:h.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:y,hierarchy:b}=$E(n,r,f),{identifiers:p}=await jb(u,y,b,g);p&&Object.keys(p).length>0&&Ae.getState().replaceNodeIds(p);const v=new Date().toISOString();a(v),o(!1)}catch(y){console.error("[useSaveHierarchy] save failed:",y),De.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function BE(e){const t=oe(o=>o.editorConfig),r=oe(o=>o.setButtonLoader),n=oe(o=>o.validateAllForms),s=Ae(o=>o.treeData);return{runAction:h.useCallback(async(o,a)=>{var u,f,g,y;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 De.error("No content identifier found."),!1;const d=((g=t==null?void 0:t.context)==null?void 0:g.userId)??((y=t==null?void 0:t.context)==null?void 0:y.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await zb(c),De.success("Content sent for review"),!0):(De.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 Vb(c,b),De.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await Bb(c,d),De.success("Content published successfully"),!0):(De.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 p=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return De.error(`Failed to ${p}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const Mt={shell:"_shell_90fon_1",workspace:"_workspace_90fon_8",sidebarCollapsed:"_sidebarCollapsed_90fon_16",dockCollapsed:"_dockCollapsed_90fon_19",dock:"_dock_90fon_19",outline:"_outline_90fon_40",reopenTab:"_reopenTab_90fon_45",outlineHidden:"_outlineHidden_90fon_79",editor:"_editor_90fon_86",dockHidden:"_dockHidden_90fon_101",dockReopenTab:"_dockReopenTab_90fon_108",dragChip:"_dragChip_90fon_133",dragChipLabel:"_dragChipLabel_90fon_148"},UE=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState(!1),[u,f]=h.useState(!1),{addResource:g,treeData:y}=Ae(),b=oe(A=>A.setFormStatus),[p,v]=h.useState(!0),m=Ae(A=>A.selectedNodeId),{save:_,isSaving:S,isDirty:w,lastSaved:O}=jE(),{runAction:T}=BE(_);h.useEffect(()=>{if(!w)return;const A=j=>{j.preventDefault(),j.returnValue=""};return window.addEventListener("beforeunload",A),()=>window.removeEventListener("beforeunload",A)},[w]);const x=ec(Io(ci,{activationConstraint:{distance:8}})),P=h.useCallback(A=>{var F;const j=(F=A.active.data.current)==null?void 0:F.item;j&&i(j)},[]),$=h.useCallback(A=>{var Oe,pe;i(null);const j=(Oe=A.active.data.current)==null?void 0:Oe.item;if(!j)return;const F=A.over,Z=(F==null?void 0:F.id)??m??void 0;if(!Z){De.error("Drop onto a unit to add content");return}const ae=(pe=y[0])==null?void 0:pe.id;if(Z===ae){De.error("Drop content onto a unit, not directly on the course.");return}if(!g(j,Z)){De.error(`"${j.name}" is already in this collection`);return}r==null||r(j,Z),De.success(`Added "${j.name}" to unit`)},[m,g,r]),k=h.useCallback(async A=>{if(A.action==="onFormStatusChange"){const{isValid:j,nodeId:F}=A.data??{},Z=j!==!1;v(Z),F&&b(F,Z);return}if(A.action==="back"&&w){f(!0);return}if(A.action==="saveCollection"){if(!p){De.error("Please fill the required metadata");return}await _(),n==null||n(y),t==null||t(A);return}if(A.action==="sendForReview"||A.action==="reject"||A.action==="publish"){await T(A.action,A.data)&&(t==null||t(A));return}t==null||t(A)},[_,T,t,n,y,w,p]),M=h.useCallback(async()=>{await _(),f(!1),n==null||n(y),t==null||t({action:"back"})},[_,n,t,y]),B=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(kc,{sensors:x,onDragStart:P,onDragEnd:$,children:[l.jsxs("div",{className:Mt.shell,children:[l.jsx(Zb,{editorMode:e,isSaving:S,isDirty:w,lastSaved:O,isFormValid:p,onToolbarEvent:k}),l.jsxs("div",{className:[Mt.workspace,o?Mt.sidebarCollapsed:"",c?Mt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Mt.outline,o?Mt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(S1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(A=>!A)})}),o&&l.jsx("button",{className:Mt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Mt.editor,role:"main","aria-label":"Content editor",children:l.jsx(OE,{editorMode:e,onToolbarEvent:k})}),l.jsx("aside",{className:[Mt.dock,c?Mt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(FE,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(A=>!A)})}),c&&l.jsx("button",{className:Mt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Jy,{dropAnimation:null,children:s?l.jsx("div",{className:Mt.dragChip,children:l.jsx("span",{className:Mt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(Jb,{onSave:M,onDiscard:B,onCancel:()=>f(!1),isSaving:S})]})},zE="v1";function VE(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 Lh(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:VE(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 Tr(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(Lh(o,s))}else n.code&&r.push(Lh(n));return r}function qE(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 HE(e,t,r="Collection",n=zE){var d,u;const i=(u=(d=(await Fe.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:Tr(o.create),unitForm:Tr(o.unitMetadata),childForm:Tr(o.childMetadata),searchForm:Tr(o.search??o.searchConfig),relationalForm:Tr(o.relationalMetadata),publishChecklist:Tr(o.publishchecklist),reviewChecklist:Tr(o.review),rfcChecklist:Tr(o.requestforchangeschecklist),schemaDefaults:qE(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function WE({config:e,onError:t}){const[r,n]=h.useState(!0),[s,i]=h.useState(null),[o,a]=h.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u,setContentFramework:f}=oe(),{setTreeData:g,selectNode:y}=Ae();return h.useEffect(()=>{let b=!1;async function p(){var v,m;try{n(!0),i(null),e.apiBaseUrl&&Hu(e.apiBaseUrl),c(e),d(e.config.mode);const _=e.context.contentId??e.context.identifier??"";if(_){const{rootNode:S}=await Qu(_);if(!b&&(g(S?[S]:[]),S)){y(S.id);const P=S.metadata??{},$=P.framework??e.context.framework??null,k=P.targetFWIds??e.context.targetFWIds??null;f($,k)}const w=e.config.primaryCategory??"Course",O=e.context.channel??"",T=e.config.categoryDefinitionApiVersion??"v1";try{const x=await HE(w,O,e.config.objectType??"Collection",T);if(!b){u(x);const P=((v=x.sourcingSettings)==null?void 0:v.collection)??{},$={};P.maxDepth&&!e.config.maxDepth&&($.maxDepth=P.maxDepth),P.children&&!e.config.children&&($.children=P.children),P.hierarchy&&!((m=e.config.hierarchy)!=null&&m.level1)&&($.hierarchy={...e.config.hierarchy??{},...P.hierarchy}),Object.keys($).length>0&&c({...e,config:{...e.config,...$}})}}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 p(),()=>{b=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Ps={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},KE=new Ep({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class QE extends h.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:Ps.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 GE(e){const{isLoading:t,error:r}=WE({config:e,onError:e.onError}),n=oe(s=>s.editorMode);return t?l.jsxs("div",{className:Ps.loadingState,children:[l.jsx("div",{className:Ps.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:Ps.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${Ps.root}`,children:l.jsx(UE,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Fh=e=>l.jsx(QE,{onError:e.onError,children:l.jsxs(Ip,{client:KE,children:[l.jsx(GE,{...e}),l.jsx(Dg,{position:"top-right",toastOptions:{duration:3e3}})]})}),so=Symbol.for("r2wc.reactRender"),$h=Symbol.for("r2wc.shouldRender"),io=Symbol.for("r2wc.root");function YE(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function RE(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var jh={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[so]()}}),e[so]()}};function XE(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&&jh.expando(g,u,f),Reflect.set(d,u,f,g)):(jh.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[$h]=!0,this[so]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[io].unmount():r.unmountComponentAtNode(this)},a[so]=function(){if(this[$h]===!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[io]||(this[io]=r.createRoot(u)),this[io].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return YE(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?RE(d):d;this[g]=f}),o}var Ms={},Ls=qe;if(process.env.NODE_ENV==="production")Ms.createRoot=Ls.createRoot,Ms.hydrateRoot=Ls.hydrateRoot;else{var oo=Ls.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Ms.createRoot=function(e,t){oo.usingClientEntryPoint=!0;try{return Ls.createRoot(e,t)}finally{oo.usingClientEntryPoint=!1}},Ms.hydrateRoot=function(e,t,r){oo.usingClientEntryPoint=!0;try{return Ls.hydrateRoot(e,t,r)}finally{oo.usingClientEntryPoint=!1}}}function ZE(){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 JE(e="sb-collection-editor"){if(ZE(),typeof customElements>"u"||customElements.get(e))return;const t=XE(Fh,h,Ms,{});customElements.define(e,t)}we.CollectionEditor=Fh,we.registerCollectionEditor=JE,we.setApiBaseUrl=Hu,we.useEditorStore=oe,we.useLibraryStore=Ah,we.useTreeStore=Ae,Object.defineProperty(we,Symbol.toStringTag,{value:"Module"})});
456
+ `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Wr(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Ni.assertOptions(n,{silentJSONParsing:pt.transitional(pt.boolean),forcedJSONParsing:pt.transitional(pt.boolean),clarifyTimeoutError:pt.transitional(pt.boolean),legacyInterceptorReqResOrdering:pt.transitional(pt.boolean),advertiseZstdAcceptEncoding:pt.transitional(pt.boolean),validateStatusUndefinedResolves:pt.transitional(pt.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:Ni.assertOptions(s,{encode:pt.function,serialize:pt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ni.assertOptions(r,{baseUrl:pt.spelling("baseURL"),withXsrfToken:pt.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=ht.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(r)===!1)return;c=c&&p.synchronous;const v=r.transitional||da;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,f=0,g;if(!c){const b=[Wu.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 y=r;for(;f<g;){const b=a[f++],p=a[f++];try{y=b(y)}catch(v){p.call(this,v);break}}try{u=Wu.call(this,y)}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=Wr(this.defaults,t);const r=Mu(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Ou(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){Kr.prototype[t]=function(r,n){return this.request(Wr(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(Wr(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Kr.prototype[t]=r(),t!=="query"&&(Kr.prototype[t+"Form"]=r(!0))});let qb=class cp{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 _s(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 cp(function(s){t=s}),cancel:t}}};function Hb(e){return function(r){return e.apply(null,r)}}function Wb(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 Qu(e){const t=new Kr(e),r=lu(Kr.prototype.request,t);return D.extend(r,Kr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Qu(Wr(e,s))},r}const Xe=Qu(bs);Xe.Axios=Kr,Xe.CanceledError=_s,Xe.CancelToken=qb,Xe.isCancel=ku,Xe.VERSION=ga,Xe.toFormData=Ei,Xe.AxiosError=X,Xe.Cancel=Xe.CanceledError,Xe.all=function(t){return Promise.all(t)},Xe.spread=Hb,Xe.isAxiosError=Wb,Xe.mergeConfig=Wr,Xe.AxiosHeaders=ht,Xe.formToJSON=e=>Nu(D.isHTMLForm(e)?new FormData(e):e),Xe.getAdapter=Hu.getAdapter,Xe.HttpStatusCode=ma,Xe.default=Xe;const{Axios:$D,AxiosError:jD,CanceledError:BD,isCancel:UD,CancelToken:zD,VERSION:VD,all:qD,Cancel:HD,isAxiosError:WD,spread:KD,toFormData:QD,AxiosHeaders:GD,HttpStatusCode:YD,formToJSON:RD,getAdapter:XD,mergeConfig:ZD,create:JD}=Xe;let ba="";function Gu(e){ba=e}const xe=Xe.create({timeout:3e4});xe.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Wv),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),ba&&(e.baseURL=ba),e});const Yu=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Kb(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:Yu,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await xe.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 Qb(e){var r,n,s;return e.length?((s=(n=(r=(await xe.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Yu,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 Ru(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=>Ru(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 Xu(e){var s,i,o,a,c,d,u;const t=await xe.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=Ru(r);return{content:r,rootNode:n}}async function Gb(e,t,r,n){var i;return((i=(await xe.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function Yb(e,t=""){await xe.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function Rb(e){var r,n;return(n=(r=(await xe.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function Xb(e){await xe.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function Zb(e,t){await xe.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function Jb(e,t){await xe.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Ie={container:"_container_r27rp_1",header:"_header_r27rp_13",title:"_title_r27rp_22",closeBtn:"_closeBtn_r27rp_29",body:"_body_r27rp_45",label:"_label_r27rp_54",searchSection:"_searchSection_r27rp_62",searchRow:"_searchRow_r27rp_68",searchInput:"_searchInput_r27rp_74",searchSpinner:"_searchSpinner_r27rp_89",resultsList:"_resultsList_r27rp_105",resultItem:"_resultItem_r27rp_118",userInfo:"_userInfo_r27rp_133",userName:"_userName_r27rp_141",userEmail:"_userEmail_r27rp_150",userOrg:"_userOrg_r27rp_158",noResults:"_noResults_r27rp_167",collabSection:"_collabSection_r27rp_174",sectionTitle:"_sectionTitle_r27rp_179",badge:"_badge_r27rp_189",emptyCollab:"_emptyCollab_r27rp_203",collabList:"_collabList_r27rp_214",collabItem:"_collabItem_r27rp_223",userAvatar:"_userAvatar_r27rp_237",error:"_error_r27rp_251",success:"_success_r27rp_257",footer:"_footer_r27rp_263"},e_=({contentId:e,onClose:t})=>{var P,$;const r=oe(k=>k.editorConfig),n=(P=r==null?void 0:r.context)==null?void 0:P.channel,s=($=r==null?void 0:r.config)==null?void 0:$.objectType,[i,o]=h.useState(""),[a,c]=h.useState([]),[d,u]=h.useState(!1),[f,g]=h.useState([]),[y,b]=h.useState(!1),[p,v]=h.useState(""),[m,_]=h.useState(!1),S=h.useRef(null);h.useEffect(()=>{let k=!1;return(async()=>{try{const L=await Rb(e),B=(L==null?void 0:L.collaborators)??[];if(!B.length)return;const A=await Qb(B);if(k)return;const j=B.map(F=>A.find(Z=>Z.identifier===F)??{identifier:F,firstName:F});g(j)}catch{}})(),()=>{k=!0}},[e]),h.useEffect(()=>{S.current&&clearTimeout(S.current);const k=i.trim();if(k.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const L=await Kb(k,{rootOrgId:n,objectType:s}),B=new Set(f.map(A=>A.identifier));c(L.filter(A=>!B.has(A.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(k=>{g(L=>L.find(B=>B.identifier===k.identifier)?L:[...L,k]),c(L=>L.filter(B=>B.identifier!==k.identifier)),_(!1)},[]),E=h.useCallback(k=>{g(L=>L.filter(B=>B.identifier!==k)),_(!1)},[]),T=h.useCallback(async()=>{b(!0),v(""),_(!1);try{await Jb(e,f.map(k=>k.identifier)),_(!0)}catch{v("Failed to save collaborators. Please try again.")}finally{b(!1)}},[e,f]),x=k=>`${k.firstName}${k.lastName?` ${k.lastName}`:""}`;return l.jsxs("div",{className:Ie.container,children:[l.jsxs("div",{className:Ie.header,children:[l.jsx("h2",{className:Ie.title,children:"Manage Collaborators"}),l.jsx("button",{className:Ie.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ie.body,children:[l.jsxs("div",{className:Ie.searchSection,children:[l.jsx("label",{className:Ie.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Ie.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Ie.searchInput,placeholder:"Search by name or email...",value:i,onChange:k=>o(k.target.value)}),d&&l.jsx("span",{className:Ie.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Ie.resultsList,role:"listbox","aria-label":"Search results",children:a.map(k=>{var L,B,A,j;return l.jsxs("li",{className:Ie.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Ie.userInfo,children:[l.jsx("span",{className:Ie.userName,children:x(k)}),k.email&&l.jsx("span",{className:Ie.userEmail,children:k.email}),(((B=(L=k.organisations)==null?void 0:L[0])==null?void 0:B.orgName)??k.rootOrgName)&&l.jsx("span",{className:Ie.userOrg,children:((j=(A=k.organisations)==null?void 0:A[0])==null?void 0:j.orgName)??k.rootOrgName})]}),l.jsx(Me,{variant:"primary",size:"sm",onClick:()=>w(k),children:"Add"})]},k.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Ie.noResults,children:"No users found."})]}),l.jsxs("div",{className:Ie.collabSection,children:[l.jsxs("h3",{className:Ie.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Ie.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Ie.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Ie.collabList,children:f.map(k=>{var L,B,A,j;return l.jsxs("li",{className:Ie.collabItem,children:[l.jsx("div",{className:Ie.userAvatar,"aria-hidden":"true",children:x(k).charAt(0).toUpperCase()}),l.jsxs("div",{className:Ie.userInfo,children:[l.jsx("span",{className:Ie.userName,children:x(k)}),k.email&&l.jsx("span",{className:Ie.userEmail,children:k.email}),(((B=(L=k.organisations)==null?void 0:L[0])==null?void 0:B.orgName)??k.rootOrgName)&&l.jsx("span",{className:Ie.userOrg,children:((j=(A=k.organisations)==null?void 0:A[0])==null?void 0:j.orgName)??k.rootOrgName})]}),l.jsx(Me,{variant:"danger",size:"sm",onClick:()=>E(k.identifier),children:"Remove"})]},k.identifier)})})]}),p&&l.jsx("p",{className:Ie.error,role:"alert",children:p}),m&&l.jsx("p",{className:Ie.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Ie.footer,children:[l.jsx(Me,{variant:"ghost",onClick:t,disabled:y,children:"Cancel"}),l.jsx(Me,{variant:"primary",isLoading:y,onClick:T,children:"Save"})]})]})};async function t_(e){return(await xe.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function r_(e,t){var s;const n=((s=(await xe.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 n_(e){var n;const r=((n=(await xe.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 le={topbar:"_topbar_zj8wk_1",left:"_left_zj8wk_15",right:"_right_zj8wk_23",backBtn:"_backBtn_zj8wk_30",title:"_title_zj8wk_49",statusChip:"_statusChip_zj8wk_61",savedIndicator:"_savedIndicator_zj8wk_73",unsaved:"_unsaved_zj8wk_83",iconBtn:"_iconBtn_zj8wk_88",iconBtnLabel:"_iconBtnLabel_zj8wk_115",qrDropdown:"_qrDropdown_zj8wk_119",qrMenu:"_qrMenu_zj8wk_123",reviewBtns:"_reviewBtns_zj8wk_158",sourcingBtns:"_sourcingBtns_zj8wk_167",modalOverlay:"_modalOverlay_zj8wk_176",sbOverlay:"_sbOverlay_zj8wk_186",sbModal:"_sbModal_zj8wk_196",sbModalHeader:"_sbModalHeader_zj8wk_207",sbModalTitle:"_sbModalTitle_zj8wk_215",sbModalClose:"_sbModalClose_zj8wk_222",sbModalBody:"_sbModalBody_zj8wk_235",sbLabel:"_sbLabel_zj8wk_242",sbTextarea:"_sbTextarea_zj8wk_249",sbError:"_sbError_zj8wk_266",sbModalFooter:"_sbModalFooter_zj8wk_273"};function s_(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function i_(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const Zu=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=h.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:le.sbModalTitle,children:e}),l.jsx("button",{className:le.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:le.sbModalBody,children:[l.jsxs("label",{className:le.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:le.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:le.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:le.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Me,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},o_=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:le.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:le.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:le.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:le.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Me,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},a_=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:le.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:le.sbModal,children:[l.jsxs("div",{className:le.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:le.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:le.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:le.sbModalBody,children:[l.jsxs("label",{className:le.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:le.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:le.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:le.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Me,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},l_=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var Be,ve;const a=Le(ce=>ce.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=i_(((Be=a==null?void 0:a.metadata)==null?void 0:Be.status)??(a==null?void 0:a.status)),u=oe(ce=>{var ge,$e,qe,ke;return(($e=(ge=ce.editorConfig)==null?void 0:ge.context)==null?void 0:$e.contentId)??((ke=(qe=ce.editorConfig)==null?void 0:qe.context)==null?void 0:ke.identifier)??""}),{activeModal:f,modalData:g,closeModal:y,openModal:b}=Yv(),p=oe(ce=>ce.buttonLoaders),v=oe(ce=>ce.categoryMeta),m=!v||v.schemaDefaults.generateDIALCodes!=="No",[_,S]=h.useState(!1),[w,E]=h.useState(!1),[T,x]=h.useState(!1),[P,$]=h.useState(!1),k=h.useRef(null),[L,B]=h.useState(!1);h.useEffect(()=>{if(!P)return;const ce=ge=>{var $e;($e=k.current)!=null&&$e.contains(ge.target)||$(!1)};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[P]);const[A,j]=h.useState(!1),[F,Z]=h.useState(!1),{updateNode:ae}=Le(),be=(ve=a==null?void 0:a.metadata)==null?void 0:ve.qrCodeProcessId,Ee=h.useCallback(async ce=>{if(u){B(!1),j(!0);try{const{processId:ge,reservedDialcodes:$e}=await r_(u,ce);ge&&a&&ae(a.id,{qrCodeProcessId:ge,reservedDialcodes:$e}),De.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{De.error("Failed to generate QR Codes. Please try again.")}finally{j(!1)}}},[u,a,ae]),pe=h.useCallback(async()=>{if(!be){De.error("No QR codes generated yet. Generate QR Codes first.");return}Z(!0);try{const ce=await n_(be);if(ce.status==="in-process"){De("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const ge=ce.url;if(!ge){De.error("QR Codes not ready yet. Please wait and try again.");return}const $e=await fetch(ge).then(ie=>ie.blob()),qe=await new Promise(ie=>{const Re=new FileReader;Re.onloadend=()=>ie(Re.result),Re.readAsDataURL($e)}),ke=(a==null?void 0:a.metadata)??{},ee=ie=>Array.isArray(ie)?ie.join("_"):typeof ie=="string"?ie:"",Ke=[u,ee(ke.medium),ee(ke.gradeLevel),ee(ke.subject)].filter(Boolean),tt=new Date().toISOString().replace(/[:.]/g,"-"),H=`${Ke.join("_")}_${tt}.zip`,re=document.createElement("a");re.href=qe,re.download=H,re.style.display="none",document.body.appendChild(re),re.click(),document.body.removeChild(re),De.success("QR codes downloaded.")}catch{De.error("Failed to download QR Codes.")}finally{Z(!1)}},[be,a,u]),K=e==="edit",J=e==="review",se=e==="sourcingreview",U=e==="read",R=h.useCallback((ce,ge)=>{i({action:ce,data:ge})},[i]),Q=h.useCallback(()=>{y(),R("publish")},[y,R]),ue=h.useCallback((ce,ge)=>{const $e=g==null?void 0:g.action;y(),$e==="approve"?R("sourcingApprove",{comment:ce,score:ge}):R("reject",{comment:ce})},[y,R,g]),Oe=h.useCallback(ce=>{S(!1),R("sendBackForCorrections",{comment:ce})},[R]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:le.topbar,role:"banner",children:[l.jsxs("div",{className:le.left,children:[l.jsx("button",{className:le.backBtn,onClick:()=>R("back"),"aria-label":"Go back",type:"button",children:l.jsx(hv,{size:18})}),l.jsx("h1",{className:le.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${le.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:le.right,children:[t?l.jsx("span",{className:le.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${le.savedIndicator} ${le.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:le.savedIndicator,"aria-live":"polite",children:[l.jsx(vn,{size:14,"aria-hidden":"true"}),"Saved ",s_(n)]}):null,!U&&!J&&!se&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>R("saveCollection"),disabled:!s,children:"Save as Draft"})}),K&&l.jsxs(l.Fragment,{children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>x(!0),disabled:p.saveCollection,isLoading:p.saveCollection,children:[l.jsx(Nv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:le.iconBtn,onClick:()=>b("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(Av,{size:16,"aria-hidden":"true"})}),m&&l.jsxs("div",{className:le.qrDropdown,ref:k,children:[l.jsxs("button",{className:le.iconBtn,onClick:()=>$(ce=>!ce),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":P,children:[l.jsx(Kc,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:le.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),P&&l.jsxs("div",{className:le.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),B(!0)},disabled:A,children:[l.jsx(Kc,{size:14}),A?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{$(!1),pe()},disabled:F||!be,children:[l.jsx(mv,{size:14}),F?"Downloading…":"Download QR Codes"]})]})]})]}),J&&l.jsxs("div",{className:le.reviewBtns,children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>b("publishChecklist"),disabled:p.publishCollection,isLoading:p.publishCollection,children:[l.jsx(zc,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Me,{variant:"danger",size:"sm",onClick:()=>E(!0),disabled:p.rejectCollection,isLoading:p.rejectCollection,children:[l.jsx(qo,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Me,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[l.jsx(Iv,{size:14,"aria-hidden":"true"})," Send Back"]})]}),se&&l.jsxs("div",{className:le.sourcingBtns,children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>b("qualityParams",{action:"approve"}),children:[l.jsx(kv,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Me,{variant:"danger",size:"sm",onClick:()=>b("qualityParams",{action:"reject"}),children:[l.jsx(qo,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),f==="publishChecklist"&&l.jsx(Zv,{contentId:u,onConfirm:Q,onCancel:y}),f==="qualityParams"&&l.jsx(Jv,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:ue,onCancel:y}),f==="manageCollaborators"&&l.jsx("div",{className:le.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(e_,{contentId:u,onClose:y})}),T&&l.jsx(o_,{onConfirm:()=>{x(!1),R("sendForReview")},onCancel:()=>x(!1)}),w&&l.jsx(Zu,{titleText:"Reject Content",labelText:"Reason for rejection",placeholderText:"Explain why this content is being rejected",submitLabel:"Reject",submitVariant:"danger",onConfirm:ce=>{E(!1),R("reject",{comment:ce})},onCancel:()=>E(!1)}),_&&l.jsx(Zu,{titleText:"Send Back for Corrections",labelText:"Corrections needed",placeholderText:"Describe the corrections the author needs to make",submitLabel:"Send Back",submitVariant:"primary",onConfirm:Oe,onCancel:()=>S(!1)}),L&&l.jsx(a_,{onConfirm:Ee,onCancel:()=>B(!1)})]})},c_=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Pe.createPortal(l.jsx("div",{className:Fe.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Fe.modal,children:[l.jsxs("div",{className:Fe.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Fe.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Fe.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:Fe.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Me,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Me,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var u_=ta();const Ju=h.createContext(null);function It(){const e=h.useContext(Ju);if(e===null)throw new Error("No Tree Api Provided");return e}const ed=h.createContext(null);function d_(){const e=h.useContext(ed);if(e===null)throw new Error("Provide a NodesContext");return e}const td=h.createContext(null);function f_(){const e=h.useContext(td);if(e===null)throw new Error("Provide a DnDContext");return e}const rd=h.createContext(0);function nd(){h.useContext(rd)}function ki(e,t,r){return Math.max(Math.min(e,r),t)}function sd(e){return e&&e.isLeaf}function id(e){return e&&e.isInternal&&!e.isOpen}function od(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const ad=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},ld=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function _a(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=_a(r,t);if(n)return n}return null}function xi(e,t){if(t(e),e.children)for(let r of e.children)xi(r,t)}function cd(e){const t=dd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=h_(t,n);break}r==null||r.focus()}function ud(e){const t=dd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=p_(t,n);break}r==null||r.focus()}function h_(e,t){return t+1<e.length?e[t+1]:e[0]}function p_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function dd(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 ws(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function En(e){return typeof e=="string"?e:e.id}function g_(e,...t){if(e)return e(...t)}function fd(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function hd(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 pd(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const y_=Object.freeze(Object.defineProperty({__proto__:null,access:ws,bound:ki,dfs:_a,focusNextElement:cd,focusPrevElement:ud,getInsertIndex:hd,getInsertParentId:pd,identify:En,indexOf:ld,isClosed:id,isDescendant:ad,isItem:sd,isOpenWithEmptyChildren:od,safeRun:g_,waitFor:fd,walk:xi},Symbol.toStringTag,{value:"Module"})),v_={display:"flex",alignItems:"center",zIndex:1},m_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},b_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},__=h.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({},v_),s),children:[l.jsx("div",{style:Object.assign({},b_)}),l.jsx("div",{style:Object.assign({},m_)})]})});function w_({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 S_(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(E_,Object.assign({},e)):l.jsx(C_,Object.assign({},e))]})}function C_(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function E_({node:e}){const t=h.useRef();return h.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 Ss="__REACT_ARBORIST_INTERNAL_ROOT__";function gd(e){var t;function r(i,o,a){const c=e.accessId(i),d=new Cs({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 Cs({tree:e,id:Ss,data:{id:Ss},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 Cs{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===Ss}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 Cs(Object.assign({},this))}edit(){return this.tree.edit(this)}}function wa(e){return{type:"EDIT",id:e}}function O_(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function On(e){return{type:"FOCUS",id:e}}function D_(){return{type:"TREE_BLUR"}}function I_(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 yd(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 T_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:yd(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:yd(e.unfiltered,t)}):e}const Dn=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}}},Dr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:En(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(En)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(En)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:En(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:En(e)})};function N_(e=Dn().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 In={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 k_(e=Dn().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 Dn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const x_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},A_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},P_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function vd({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(L_,{isDragging:s,children:[l.jsx(M_,{offset:e,children:l.jsx($_,{id:r,dragIds:n})}),l.jsx(F_,{mouse:t,count:n.length})]})}const L_=h.memo(function(t){return t.isDragging?l.jsx("div",{style:x_,children:t.children}):null});function M_(e){return l.jsx("div",{className:"row preview",style:A_(e.offset),children:e.children})}function F_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:P_(r),children:t}):null}const $_=h.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 Ca(){return Ca=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},Ca.apply(null,arguments)}function md(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ea(e,t){return Ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ea(e,t)}function j_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ea(e,t)}var bd=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function B_(e,t){return!!(e===t||bd(e)&&bd(t))}function U_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!B_(e[r],t[r]))return!1;return!0}function Oa(e,t){t===void 0&&(t=U_);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 z_=typeof performance=="object"&&typeof performance.now=="function",_d=z_?function(){return performance.now()}:function(){return Date.now()};function wd(e){cancelAnimationFrame(e.id)}function V_(e,t){var r=_d();function n(){_d()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Da=-1;function Sd(e){if(e===void 0&&(e=!1),Da===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Da=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Da}var Tn=null;function Cd(e){if(e===void 0&&(e=!1),Tn===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?Tn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Tn="negative":Tn="positive-ascending"),document.body.removeChild(t),Tn}return Tn}process.env.NODE_ENV;var q_=150,H_=function(t,r){return t},Ai=null,Pi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Ai=new WeakSet,Pi=new WeakSet);function Ed(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){j_(g,f);function g(b){var p;return p=f.call(this,b)||this,p._instanceProps=c(p.props,md(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:md(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=Oa(function(v,m,_,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:_,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=Oa(function(v,m,_){return p.props.onScroll({scrollDirection:v,scrollOffset:m,scrollUpdateWasRequested:_})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var m=p.props,_=m.direction,S=m.itemSize,w=m.layout,E=p._getItemStyleCache(d&&S,d&&w,d&&_),T;if(E.hasOwnProperty(v))T=E[v];else{var x=r(p.props,v,p._instanceProps),P=s(p.props,v,p._instanceProps),$=_==="horizontal"||w==="horizontal",k=_==="rtl",L=$?x:0;E[v]=T={position:"absolute",left:k?void 0:L,right:k?L:void 0,top:$?0:x,height:$?"100%":P,width:$?P:"100%"}}return T},p._getItemStyleCache=void 0,p._getItemStyleCache=Oa(function(v,m,_){return{}}),p._onScrollHorizontal=function(v){var m=v.currentTarget,_=m.clientWidth,S=m.scrollLeft,w=m.scrollWidth;p.setState(function(E){if(E.scrollOffset===S)return null;var T=p.props.direction,x=S;if(T==="rtl")switch(Cd()){case"negative":x=-S;break;case"positive-descending":x=w-_-S;break}return x=Math.max(0,Math.min(x,w-_)),{isScrolling:!0,scrollDirection:E.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var m=v.currentTarget,_=m.clientHeight,S=m.scrollHeight,w=m.scrollTop;p.setState(function(E){if(E.scrollOffset===w)return null;var T=Math.max(0,Math.min(w,S-_));return{isScrolling:!0,scrollDirection:E.scrollOffset<T?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._outerRefSetter=function(v){var m=p.props.outerRef;p._outerRef=v,typeof m=="function"?m(v):m!=null&&typeof m=="object"&&m.hasOwnProperty("current")&&(m.current=v)},p._resetIsScrollingDebounced=function(){p._resetIsScrollingTimeoutId!==null&&wd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=V_(p._resetIsScrolling,q_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}g.getDerivedStateFromProps=function(p,v){return W_(p,v),u(p),null};var y=g.prototype;return y.scrollTo=function(p){p=Math.max(0,p),this.setState(function(v){return v.scrollOffset===p?null:{scrollDirection:v.scrollOffset<p?"forward":"backward",scrollOffset:p,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(p,v){v===void 0&&(v="auto");var m=this.props,_=m.itemCount,S=m.layout,w=this.state.scrollOffset;p=Math.max(0,Math.min(p,_-1));var E=0;if(this._outerRef){var T=this._outerRef;S==="vertical"?E=T.scrollWidth>T.clientWidth?Sd():0:E=T.scrollHeight>T.clientHeight?Sd():0}this.scrollTo(i(this.props,p,v,w,this._instanceProps,E))},y.componentDidMount=function(){var p=this.props,v=p.direction,m=p.initialScrollOffset,_=p.layout;if(typeof m=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||_==="horizontal"?S.scrollLeft=m:S.scrollTop=m}this._callPropsCallbacks()},y.componentDidUpdate=function(){var p=this.props,v=p.direction,m=p.layout,_=this.state,S=_.scrollOffset,w=_.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var E=this._outerRef;if(v==="horizontal"||m==="horizontal")if(v==="rtl")switch(Cd()){case"negative":E.scrollLeft=-S;break;case"positive-ascending":E.scrollLeft=S;break;default:var T=E.clientWidth,x=E.scrollWidth;E.scrollLeft=x-T-S;break}else E.scrollLeft=S;else E.scrollTop=S}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&wd(this._resetIsScrollingTimeoutId)},y.render=function(){var p=this.props,v=p.children,m=p.className,_=p.direction,S=p.height,w=p.innerRef,E=p.innerElementType,T=p.innerTagName,x=p.itemCount,P=p.itemData,$=p.itemKey,k=$===void 0?H_:$,L=p.layout,B=p.outerElementType,A=p.outerTagName,j=p.style,F=p.useIsScrolling,Z=p.width,ae=this.state.isScrolling,be=_==="horizontal"||L==="horizontal",Ee=be?this._onScrollHorizontal:this._onScrollVertical,pe=this._getRangeToRender(),K=pe[0],J=pe[1],se=[];if(x>0)for(var U=K;U<=J;U++)se.push(h.createElement(v,{data:P,key:k(U,P),index:U,isScrolling:F?ae:void 0,style:this._getItemStyle(U)}));var R=n(this.props,this._instanceProps);return h.createElement(B||A||"div",{className:m,onScroll:Ee,ref:this._outerRefSetter,style:Ca({position:"relative",height:S,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:_},j)},h.createElement(E||T||"div",{children:se,ref:w,style:{height:be?"100%":R,pointerEvents:ae?"none":void 0,width:be?R:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],_=v[1],S=v[2],w=v[3];this._callOnItemsRendered(m,_,S,w)}}if(typeof this.props.onScroll=="function"){var E=this.state,T=E.scrollDirection,x=E.scrollOffset,P=E.scrollUpdateWasRequested;this._callOnScroll(T,x,P)}},y._getRangeToRender=function(){var p=this.props,v=p.itemCount,m=p.overscanCount,_=this.state,S=_.isScrolling,w=_.scrollDirection,E=_.scrollOffset;if(v===0)return[0,0,0,0];var T=o(this.props,E,this._instanceProps),x=a(this.props,T,E,this._instanceProps),P=!S||w==="backward"?Math.max(1,m):1,$=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,T-P),Math.max(0,Math.min(v-1,x+$)),T,x]},g}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var W_=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":Ai&&!Ai.has(u)&&(Ai.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.'))}},K_=50,Nn=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]},Q_=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Od(t,r,i,0,n):G_(t,r,Math.max(0,i),n)},Od=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Nn(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},G_=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Nn(t,n,r).offset<s;)n+=o,o*=2;return Od(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Dd=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},Y_=Ed({getItemOffset:function(t,r,n){return Nn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Dd,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,y=Nn(t,r,i),b=Dd(t,i),p=Math.max(0,Math.min(b-g,y.offset)),v=Math.max(0,y.offset-g+y.size+o);switch(n==="smart"&&(s>=v-g&&s<=p+g?n="auto":n="center"),n){case"start":return p;case"end":return v;case"center":return Math.round(v+(p-v)/2);case"auto":default:return s>=v&&s<=p?s:s<v?v:p}},getStartIndexForOffset:function(t,r,n){return Q_(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=Nn(t,r,s),y=n+f,b=g.offset+g.size,p=r;p<a-1&&b<y;)p++,b+=Nn(t,p,s).size;return p},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||K_,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.'))}}),R_=Ed({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,y=a==="horizontal"||f==="horizontal",b=y?g:c,p=Math.max(0,d*u-b),v=Math.min(p,r*u),m=Math.max(0,r*u-b+u+o);switch(n==="smart"&&(s>=m-b&&s<=v+b?n="auto":n="center"),n){case"start":return v;case"end":return m;case"center":{var _=Math.round(m+(v-m)/2);return _<Math.ceil(b/2)?0:_>p+Math.floor(b/2)?p:_}case"auto":default:return s>=m&&s<=v?s:s<m?m:v}},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,y=Math.ceil((g+n-f)/a);return Math.max(0,Math.min(o-1,r+y-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 X_(){var e,t;const r=It(),s=f_().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 Z_=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 J_=h.forwardRef(function(t,r){const{children:n}=t,s=Z_(t,["children"]),i=It();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(ew,{}),n]}))}),ew=()=>{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(X_,{})})};var tw=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 rw=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=tw(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 Id=h.createContext({dragDropManager:void 0}),Bt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Bt||(Bt={}));function fe(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 Ia="dnd-core/INIT_COORDS",Li="dnd-core/BEGIN_DRAG",Ta="dnd-core/PUBLISH_DRAG_SOURCE",Mi="dnd-core/HOVER",Fi="dnd-core/DROP",$i="dnd-core/END_DRAG";function Td(e,t){return{type:Ia,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function ji(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ji=function(r){return typeof r}:ji=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ji(e)}function nw(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function sw(e,t){return e.filter(function(r){return r!==t})}function Nd(e){return ji(e)==="object"}function iw(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 ow(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var aw={type:Ia,payload:{clientOffset:null,sourceClientOffset:null}};function lw(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(Td(o)),cw(r,c,d);var u=fw(r,c);if(u===null){e.dispatch(aw);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");uw(a),f=a(u)}e.dispatch(Td(o,f));var g=d.getSource(u),y=g.beginDrag(c,u);if(y!=null){dw(y),d.pinSource(u);var b=d.getSourceType(u);return{type:Li,payload:{itemType:b,item:y,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function cw(e,t,r){fe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){fe(r.getSource(n),"Expected sourceIds to be registered.")})}function uw(e){fe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function dw(e){fe(Nd(e),"Item must be an object.")}function fw(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 hw(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:Ta}}}function Na(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function pw(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;gw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();yw(i,o,a);var c=o.getItemType();return vw(i,a,c),mw(i,o,a),{type:Mi,payload:{targetIds:i,clientOffset:s||null}}}}function gw(e){fe(Array.isArray(e),"Expected targetIds to be an array.")}function yw(e,t,r){fe(t.isDragging(),"Cannot call hover while not dragging."),fe(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];fe(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);fe(i,"Expected targetIds to be registered.")}}function vw(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Na(i,r)||e.splice(n,1)}}function mw(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function kd(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 xd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kd(Object(r),!0).forEach(function(n){bw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _w(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();ww(n);var i=Ew(n);i.forEach(function(o,a){var c=Sw(o,a,s,n),d={type:Fi,payload:{dropResult:xd(xd({},r),c)}};e.dispatch(d)})}}function ww(e){fe(e.isDragging(),"Cannot call drop while not dragging."),fe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Sw(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Cw(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Cw(e){fe(typeof e>"u"||Nd(e),"Drop result must either be an object or undefined.")}function Ew(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Ow(e){return function(){var r=e.getMonitor(),n=e.getRegistry();Dw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:$i}}}function Dw(e){fe(e.isDragging(),"Cannot call endDrag while not dragging.")}function Iw(e){return{beginDrag:lw(e),publishDragSource:hw(e),hover:pw(e),drop:_w(e),endDrag:Ow(e)}}function Tw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nw(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 kw(e,t,r){return t&&Nw(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 xw=function(){function e(t,r){var n=this;Tw(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 kw(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=Iw(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 Ut(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 Ad=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Pd=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ld={INIT:"@@redux/INIT"+Pd(),REPLACE:"@@redux/REPLACE"+Pd()};function Aw(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 Pw(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(Fw(e))return"date";if(Mw(e))return"error";var r=Lw(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 Lw(e){return typeof e.constructor=="function"?e.constructor.name:null}function Mw(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Fw(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function kn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Pw(e)),t}function Md(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"?Ut(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"?Ut(1):"Expected the enhancer to be a function. Instead, received: '"+kn(r)+"'");return r(Md)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(2):"Expected the root reducer to be a function. Instead, received: '"+kn(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"?Ut(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(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(4):"Expected the listener to be a function. Instead, received: '"+kn(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Ut(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 v=!0;return d(),a.push(p),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?Ut(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();var _=a.indexOf(p);a.splice(_,1),o=null}}}function g(p){if(!Aw(p))throw new Error(process.env.NODE_ENV==="production"?Ut(7):"Actions must be plain objects. Instead, the actual type was: '"+kn(p)+"'. 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 p.type>"u")throw new Error(process.env.NODE_ENV==="production"?Ut(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"?Ut(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,p)}finally{c=!1}for(var v=o=a,m=0;m<v.length;m++){var _=v[m];_()}return p}function y(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?Ut(10):"Expected the nextReducer to be a function. Instead, received: '"+kn(p));s=p,g({type:Ld.REPLACE})}function b(){var p,v=f;return p={subscribe:function(_){if(typeof _!="object"||_===null)throw new Error(process.env.NODE_ENV==="production"?Ut(11):"Expected the observer to be an object. Instead, received: '"+kn(_)+"'");function S(){_.next&&_.next(u())}S();var w=v(S);return{unsubscribe:w}}},p[Ad]=function(){return this},p}return g({type:Ld.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:y},n[Ad]=b,n}var $w=function(t,r){return t===r};function jw(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Bw(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$w;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 Fd(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 $d(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fd(Object(r),!0).forEach(function(n){Uw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Uw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jd={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function zw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jd,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ia:case Li:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Mi:return jw(e.clientOffset,r.clientOffset)?e:$d($d({},e),{},{clientOffset:r.clientOffset});case $i:case Fi:return jd;default:return e}}var ka="dnd-core/ADD_SOURCE",xa="dnd-core/ADD_TARGET",Aa="dnd-core/REMOVE_SOURCE",Bi="dnd-core/REMOVE_TARGET";function Vw(e){return{type:ka,payload:{sourceId:e}}}function qw(e){return{type:xa,payload:{targetId:e}}}function Hw(e){return{type:Aa,payload:{sourceId:e}}}function Ww(e){return{type:Bi,payload:{targetId:e}}}function Bd(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 zt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bd(Object(r),!0).forEach(function(n){Kw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Qw={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Gw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qw,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Li:return zt(zt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Ta:return zt(zt({},e),{},{isSourcePublic:!0});case Mi:return zt(zt({},e),{},{targetIds:r.targetIds});case Bi:return e.targetIds.indexOf(r.targetId)===-1?e:zt(zt({},e),{},{targetIds:sw(e.targetIds,r.targetId)});case Fi:return zt(zt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case $i:return zt(zt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Yw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ka:case xa:return e+1;case Aa:case Bi:return e-1;default:return e}}var Ui=[],Pa=[];Ui.__IS_NONE__=!0,Pa.__IS_ALL__=!0;function Rw(e,t){if(e===Ui)return!1;if(e===Pa||typeof t>"u")return!0;var r=ow(t,e);return r.length>0}function Xw(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Mi:break;case ka:case xa:case Bi:case Aa:return Ui;case Li:case Ta:case $i:case Fi:default:return Pa}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=iw(n,i),a=o.length>0||!Bw(n,i);if(!a)return Ui;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function Zw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Ud(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 zd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ud(Object(r),!0).forEach(function(n){Jw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ud(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Jw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Xw(e.dirtyHandlerIds,{type:t.type,payload:zd(zd({},t.payload),{},{prevTargetIds:nw(e,"dragOperation.targetIds",[])})}),dragOffset:zw(e.dragOffset,t),refCount:Yw(e.refCount,t),dragOperation:Gw(e.dragOperation,t),stateId:Zw(e.stateId)}}function tS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Vd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function rS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Vd(tS(t,n),r)}function nS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Vd(t,r)}function sS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iS(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 oS(e,t,r){return t&&iS(e.prototype,t),e}function qd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var aS=function(){function e(t,r){sS(this,e),qd(this,"store",void 0),qd(this,"registry",void 0),this.store=t,this.registry=r}return oS(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;fe(typeof r=="function","listener must be a function."),fe(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&&!Rw(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;fe(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 fe(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(fe(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 Na(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(fe(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&&!Na(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 rS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return nS(this.store.getState().dragOffset)}}]),e}(),lS=0;function cS(){return lS++}function zi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?zi=function(r){return typeof r}:zi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},zi(e)}function uS(e){fe(typeof e.canDrag=="function","Expected canDrag to be a function."),fe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),fe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function dS(e){fe(typeof e.canDrop=="function","Expected canDrop to be a function."),fe(typeof e.hover=="function","Expected hover to be a function."),fe(typeof e.drop=="function","Expected beginDrag to be a function.")}function La(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return La(r,!1)});return}fe(typeof e=="string"||zi(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 Hd=typeof global<"u"?global:self,Wd=Hd.MutationObserver||Hd.WebKitMutationObserver;function Kd(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function fS(e){let t=1;const r=new Wd(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const hS=typeof Wd=="function"?fS:Kd;class pS{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=hS(this.flush),this.requestErrorThrow=Kd(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class gS{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 yS{create(t){const r=this.freeTasks,n=r.length?r.pop():new gS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Qd=new pS,vS=new yS(Qd.registerPendingError);function mS(e){Qd.enqueueTask(vS.create(e))}function bS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _S(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 wS(e,t,r){return t&&_S(e.prototype,t),e}function xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SS(e,t){return DS(e)||OS(e,t)||ES(e,t)||CS()}function CS(){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 ES(e,t){if(e){if(typeof e=="string")return Gd(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 Gd(e,t)}}function Gd(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 OS(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 DS(e){if(Array.isArray(e))return e}function IS(e){var t=cS().toString();switch(e){case Bt.SOURCE:return"S".concat(t);case Bt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Yd(e){switch(e[0]){case"S":return Bt.SOURCE;case"T":return Bt.TARGET;default:fe(!1,"Cannot parse handler ID: ".concat(e))}}function Rd(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=SS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var TS=function(){function e(t){bS(this,e),xn(this,"types",new Map),xn(this,"dragSources",new Map),xn(this,"dropTargets",new Map),xn(this,"pinnedSourceId",null),xn(this,"pinnedSource",null),xn(this,"store",void 0),this.store=t}return wS(e,[{key:"addSource",value:function(r,n){La(r),uS(n);var s=this.addHandler(Bt.SOURCE,r,n);return this.store.dispatch(Vw(s)),s}},{key:"addTarget",value:function(r,n){La(r,!0),dS(n);var s=this.addHandler(Bt.TARGET,r,n);return this.store.dispatch(qw(s)),s}},{key:"containsHandler",value:function(r){return Rd(this.dragSources,r)||Rd(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;fe(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 fe(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return fe(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return fe(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Yd(r);return n===Bt.SOURCE}},{key:"isTargetId",value:function(r){var n=Yd(r);return n===Bt.TARGET}},{key:"removeSource",value:function(r){var n=this;fe(this.getSource(r),"Expected an existing source."),this.store.dispatch(Hw(r)),mS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){fe(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Ww(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);fe(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){fe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=IS(r);return this.types.set(i,n),r===Bt.SOURCE?this.dragSources.set(i,s):r===Bt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function NS(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=kS(n),i=new aS(s,new TS(s)),o=new xw(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function kS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Md(eS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var xS=["children"];function AS(e,t){return FS(e)||MS(e,t)||LS(e,t)||PS()}function PS(){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 LS(e,t){if(e){if(typeof e=="string")return Xd(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 Xd(e,t)}}function Xd(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 MS(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 FS(e){if(Array.isArray(e))return e}function $S(e,t){if(e==null)return{};var r=jS(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 jS(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 Zd=0,Vi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),BS=h.memo(function(t){var r=t.children,n=$S(t,xS),s=US(n),i=AS(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=Jd();return++Zd,function(){--Zd===0&&(c[Vi]=null)}}},[]),l.jsx(Id.Provider,Object.assign({value:o},{children:r}),void 0)});function US(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=zS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function zS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jd(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[Vi]||(s[Vi]={dragDropManager:NS(e,t,r,n)}),s[Vi]}function Jd(){return typeof global<"u"?global:window}function VS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qS(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 HS(e,t,r){return t&&qS(e.prototype,t),e}function ef(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ma=!1,Fa=!1,WS=function(){function e(t){VS(this,e),ef(this,"internalMonitor",void 0),ef(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return HS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){fe(!Ma,"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 Ma=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ma=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;fe(!Fa,"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 Fa=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Fa=!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 KS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QS(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&&QS(e.prototype,t),e}function tf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $a=!1,YS=function(){function e(t){KS(this,e),tf(this,"internalMonitor",void 0),tf(this,"targetId",null),this.internalMonitor=t.getMonitor()}return GS(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;fe(!$a,"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 $a=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{$a=!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 RS(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 XS(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(!h.isValidElement(t)){var n=t;return e(n,r),n}var s=t;RS(s);var i=r?function(o){return e(o,r)}:e;return ZS(s,i)}}function rf(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=XS(n);t[r]=function(){return s}}}),t}function nf(e,t){typeof e=="function"?e(t):e.current=t}function ZS(e,t){var r=e.ref;return fe(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?h.cloneElement(e,{ref:function(s){nf(r,s),nf(t,s)}}):h.cloneElement(e,{ref:t})}function qi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qi=function(r){return typeof r}:qi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qi(e)}function ja(e){return e!==null&&qi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ba(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 JS(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 tC(e,t,r){return t&&eC(e.prototype,t),e}function gt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rC=function(){function e(t){var r=this;JS(this,e),gt(this,"hooks",rf({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ja(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ja(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),gt(this,"handlerId",null),gt(this,"dragSourceRef",null),gt(this,"dragSourceNode",void 0),gt(this,"dragSourceOptionsInternal",null),gt(this,"dragSourceUnsubscribe",void 0),gt(this,"dragPreviewRef",null),gt(this,"dragPreviewNode",void 0),gt(this,"dragPreviewOptionsInternal",null),gt(this,"dragPreviewUnsubscribe",void 0),gt(this,"lastConnectedHandlerId",null),gt(this,"lastConnectedDragSource",null),gt(this,"lastConnectedDragSourceOptions",null),gt(this,"lastConnectedDragPreview",null),gt(this,"lastConnectedDragPreviewOptions",null),gt(this,"backend",void 0),this.backend=t}return tC(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!Ba(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Ba(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 nC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sC(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 iC(e,t,r){return t&&sC(e.prototype,t),e}function tr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var oC=function(){function e(t){var r=this;nC(this,e),tr(this,"hooks",rf({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ja(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),tr(this,"handlerId",null),tr(this,"dropTargetRef",null),tr(this,"dropTargetNode",void 0),tr(this,"dropTargetOptionsInternal",null),tr(this,"unsubscribeDropTarget",void 0),tr(this,"lastConnectedHandlerId",null),tr(this,"lastConnectedDropTarget",null),tr(this,"lastConnectedDropTargetOptions",null),tr(this,"backend",void 0),this.backend=t}return iC(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!Ba(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 aC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function lC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var Qr=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Hi=function(r){return typeof r}:Hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Hi(e)}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 Ua(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=function(){function e(t,r,n){cC(this,e),Ua(this,"spec",void 0),Ua(this,"monitor",void 0),Ua(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return dC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return Hi(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 hC(e,t,r){var n=h.useMemo(function(){return new fC(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Gr(){var e=h.useContext(Id),t=e.dragDropManager;return fe(t!=null,"Expected drag drop context"),t}function pC(e){return h.useMemo(function(){var t=e.type;return fe(t!=null,"spec.type must be defined"),t},[e])}function gC(e,t){return bC(e)||mC(e,t)||vC(e,t)||yC()}function yC(){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 vC(e,t){if(e){if(typeof e=="string")return sf(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 sf(e,t)}}function sf(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 mC(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 _C(e,t,r){var n=Gr(),s=hC(e,t,r),i=pC(e);Qr(function(){if(i!=null){var a=lC(i,s,n),c=gC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function wC(e){return OC(e)||EC(e)||CC(e)||SC()}function SC(){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 CC(e,t){if(e){if(typeof e=="string")return za(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 za(e,t)}}function EC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function OC(e){if(Array.isArray(e))return za(e)}function za(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 of(e,t){var r=wC(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function DC(){var e=Gr();return h.useMemo(function(){return new WS(e)},[e])}function IC(e,t){var r=Gr(),n=h.useMemo(function(){return new rC(r.getBackend())},[r]);return Qr(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),Qr(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var TC=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 NC=Yc(TC);function kC(e,t){return LC(e)||PC(e,t)||AC(e,t)||xC()}function xC(){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 AC(e,t){if(e){if(typeof e=="string")return af(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 af(e,t)}}function af(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 PC(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 LC(e){if(Array.isArray(e))return e}function lf(e,t,r){var n=h.useState(function(){return t(e)}),s=kC(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);NC(i,c)||(o(c),r&&r())},[i,e,r]);return Qr(a),[i,a]}function MC(e,t){return BC(e)||jC(e,t)||$C(e,t)||FC()}function FC(){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 $C(e,t){if(e){if(typeof e=="string")return cf(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 cf(e,t)}}function cf(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 jC(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=lf(e,t,r),s=MC(n,2),i=s[0],o=s[1];return Qr(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function uf(e,t,r){return UC(t,e||function(){return{}},function(){return r.reconnect()})}function zC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function VC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function qC(e,t){var r=of(e,t);fe(!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=DC(),s=IC(r.options,r.previewOptions);return _C(r,n,s),[uf(r.collect,n,s),zC(s),VC(s)]}function HC(e){var t=e.accept;return h.useMemo(function(){return fe(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function WC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KC(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 QC(e,t,r){return t&&KC(e.prototype,t),e}function df(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,r){WC(this,e),df(this,"spec",void 0),df(this,"monitor",void 0),this.spec=t,this.monitor=r}return QC(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 YC(e,t){var r=h.useMemo(function(){return new GC(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function RC(e,t){return e0(e)||JC(e,t)||ZC(e,t)||XC()}function XC(){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 ZC(e,t){if(e){if(typeof e=="string")return ff(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 ff(e,t)}}function ff(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 JC(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 e0(e){if(Array.isArray(e))return e}function t0(e,t,r){var n=Gr(),s=YC(e,t),i=HC(e);Qr(function(){var a=aC(i,s,n),c=RC(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 r0(){var e=Gr();return h.useMemo(function(){return new YS(e)},[e])}function n0(e){var t=Gr(),r=h.useMemo(function(){return new oC(t.getBackend())},[t]);return Qr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function s0(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function hf(e,t){var r=of(e,t),n=r0(),s=n0(r.options);return t0(r,n,s),[uf(r.collect,n,s),s0(s)]}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.
464
+ 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 pf(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 pf(e,t)}}function pf(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){var t=Gr(),r=t.getMonitor(),n=lf(r,e),s=i0(n,2),i=s[0],o=s[1];return h.useEffect(function(){return r.subscribeToOffsetChange(o)}),h.useEffect(function(){return r.subscribeToStateChange(o)}),i}function gf(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function d0(e,t){return e.filter(function(r){return r!==t})}function f0(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 h0(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 g0(e,t,r){return t&&p0(e.prototype,t),e}function yf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var y0=function(){function e(t){h0(this,e),yf(this,"entered",[]),yf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return g0(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=f0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=d0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),v0=gf(function(){return/firefox/i.test(navigator.userAgent)}),vf=gf(function(){return!!window.safari});function m0(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 _0(e,t,r){return t&&b0(e.prototype,t),e}function Os(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var mf=function(){function e(t,r){m0(this,e),Os(this,"xs",void 0),Os(this,"ys",void 0),Os(this,"c1s",void 0),Os(this,"c2s",void 0),Os(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(P,$){return t[P]<t[$]?-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 y=a[g],b=a[g+1];if(y*b<=0)f.push(0);else{c=o[g];var p=o[g+1],v=c+p;f.push(3*v/((v+p)/y+(v+c)/b))}}f.push(a[a.length-1]);for(var m=[],_=[],S,w=0;w<f.length-1;w++){S=a[w];var E=f[w],T=1/o[w],x=E+f[w+1]-S-S;m.push((S-E-x)*T),_.push(x*T*T)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=m,this.c3s=_}return _0(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 y=r-n[c],b=y*y;return s[c]+i[c]*y+o[c]*b+a[c]*y*b}}]),e}(),w0=1;function bf(e){var t=e.nodeType===w0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Wi(e){return{x:e.clientX,y:e.clientY}}function S0(e){var t;return e.nodeName==="IMG"&&(v0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function C0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return vf()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function E0(e,t,r,n,s){var i=S0(t),o=i?e:t,a=bf(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,g=n.anchorY,y=C0(i,t,d,u),b=y.dragPreviewWidth,p=y.dragPreviewHeight,v=function(){var x=new mf([0,.5,1],[c.y,c.y/u*p,c.y+p-u]),P=x.interpolate(g);return vf()&&i&&(P+=(window.devicePixelRatio-1)*p),P},m=function(){var x=new mf([0,.5,1],[c.x,c.x/d*b,c.x+b-d]);return x.interpolate(f)},_=s.offsetX,S=s.offsetY,w=_===0||_,E=S===0||S;return{x:w?_:m(),y:E?S:v()}}var _f="__NATIVE_FILE__",wf="__NATIVE_URL__",Sf="__NATIVE_TEXT__",Cf="__NATIVE_HTML__";const Ef=Object.freeze(Object.defineProperty({__proto__:null,FILE:_f,HTML:Cf,TEXT:Sf,URL:wf},Symbol.toStringTag,{value:"Module"}));function Va(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var An;function Ki(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var qa=(An={},Ki(An,_f,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Ki(An,Cf,{exposeProperties:{html:function(t,r){return Va(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Ki(An,wf,{exposeProperties:{urls:function(t,r){return Va(t,r,"").split(`
465
+ `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Ki(An,Sf,{exposeProperties:{text:function(t,r){return Va(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),An);function O0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D0(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 I0(e,t,r){return t&&D0(e.prototype,t),e}function Of(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T0=function(){function e(t){O0(this,e),Of(this,"item",void 0),Of(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return I0(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 N0(e,t){var r=new T0(qa[e]);return r.loadDataTransfer(t),r}function Ha(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(qa).filter(function(r){var n=qa[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function k0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x0(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 A0(e,t,r){return t&&x0(e.prototype,t),e}function Wa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var P0=function(){function e(t,r){k0(this,e),Wa(this,"ownerDocument",null),Wa(this,"globalContext",void 0),Wa(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return A0(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 Df(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 If(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Df(Object(r),!0).forEach(function(n){_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Df(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function L0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M0(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 F0(e,t,r){return t&&M0(e.prototype,t),e}function _e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $0=function(){function e(t,r,n){var s=this;L0(this,e),_e(this,"options",void 0),_e(this,"actions",void 0),_e(this,"monitor",void 0),_e(this,"registry",void 0),_e(this,"enterLeaveCounter",void 0),_e(this,"sourcePreviewNodes",new Map),_e(this,"sourcePreviewNodeOptions",new Map),_e(this,"sourceNodes",new Map),_e(this,"sourceNodeOptions",new Map),_e(this,"dragStartSourceIds",null),_e(this,"dropTargetIds",[]),_e(this,"dragEnterTargetIds",[]),_e(this,"currentNativeSource",null),_e(this,"currentNativeHandle",null),_e(this,"currentDragSourceNode",null),_e(this,"altKeyPressed",!1),_e(this,"mouseMoveTimeoutTimer",null),_e(this,"asyncEndDragFrameId",null),_e(this,"dragOverTargetIds",null),_e(this,"lastClientOffset",null),_e(this,"hoverRafId",null),_e(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&bf(o)||null}),_e(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),_e(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),_e(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),_e(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),_e(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Wi(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Ha(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 y=s.getCurrentSourcePreviewNodeOptions(),b=y.anchorX,p=y.anchorY,v=y.offsetX,m=y.offsetY,_={anchorX:b,anchorY:p},S={offsetX:v,offsetY:m},w=E0(f,g,a,_,S);c.setDragImage(g,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var E=s.getCurrentSourcePreviewNodeOptions(),T=E.captureDraggingState;T?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()}}}),_e(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),_e(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Ha(a);c&&s.beginDragNativeItem(c,a)}}),_e(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:Wi(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),_e(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),_e(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=Wi(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"))}),_e(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),_e(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 Ha(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),_e(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Wi(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),_e(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 P0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new y0(this.isNodeInDocument)}return F0(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 If({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 If({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(Ef).some(function(n){return Ef[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=N0(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}(),Qi;function j0(){return Qi||(Qi=new Image,Qi.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Qi}var B0=function(t,r,n){return new $0(t,r,n)};function U0(e,t){return typeof e=="function"?e(t):e??"NODE"}function z0(e){return e.isDraggable&&!e.isEditing}function V0(e){const t=It(),r=t.selectedIds,[n,s,i]=qC(()=>({canDrag:()=>z0(e),type:U0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(In.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(In.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{i(j0())},[i]),s}function q0(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 H0(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 Gi(e,t){return{parentId:e||null,index:t}}function Pn(e,t){return{type:"line",index:e,level:t}}function W0(e){return{type:"highlight",id:e}}function Ka(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=ld(n)+1;return{parentId:s,index:i}}function Tf(e){var t;const r=q0(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]=H0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Gi(i.id,null),cursor:W0(i.id)};if(!c)return{drop:Gi((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:Pn(0,0)};if(sd(c)){const u=ki(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ka(c,u),cursor:Pn(c.rowIndex+1,u)}}if(id(c)){const u=ki(s,(d==null?void 0:d.level)||0,c.level);return{drop:Ka(c,u),cursor:Pn(c.rowIndex+1,u)}}if(od(c)){const u=ki(s,0,c.level+1);return u>c.level?{drop:Gi(c.id,0),cursor:Pn(c.rowIndex+1,u)}:{drop:Ka(c,u),cursor:Pn(c.rowIndex+1,u)}}return{drop:Gi(c==null?void 0:c.id,0),cursor:Pn(c.rowIndex+1,c.level+1)}}function K0(e,t){const r=It(),[n,s]=hf(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=Tf({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(In.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 Q0(e){const t=It(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return h.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const Nf=h.memo(function({index:t,style:r}){nd(),d_();const n=It(),s=Q0(t),i=h.useRef(null),o=V0(s),a=K0(i,s),c=h.useCallback(p=>{i.current=p,a(p)},[a]),d=n.indent*s.level,u=h.useMemo(()=>({paddingLeft:d}),[d]),f=h.useMemo(()=>{var p,v;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((v=(p=n.props.padding)!==null&&p!==void 0?p:n.props.paddingTop)!==null&&v!==void 0?v: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};h.useEffect(()=>{var p;!s.isEditing&&s.isFocused&&((p=i.current)===null||p===void 0||p.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const y=n.renderNode,b=n.renderRow;return l.jsx(b,{node:s,innerRef:c,attrs:g,children:l.jsx(y,{node:s,tree:n,style:u,dragHandle:o})})});let Qa="",kf=null;function xf(){nd();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(),cd(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),ud(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(kf),Qa+=t.key,kf=setTimeout(()=>{Qa=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Qa):!1});n&&e.focus(n.id)},children:l.jsx(G0,{})})}function G0(){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:J_,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:rw,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(Y_,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:Nf})):l.jsx(R_,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:Nf}))}function Af(e){return e.isFiltered?R0(e.root,e.isMatch.bind(e)):Y0(e.root)}function Y0(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(Pf),t}function R0(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(Pf),n}function Pf(e,t){e.rowIndex=t}const Lf=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Ga=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:yt}=y_;class Ds{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=gd(this),this.visibleNodes=Af(this),this.idToIndex=Lf(this.visibleNodes)}update(t){this.props=t,this.root=gd(this),this.visibleNodes=Af(this),this.idToIndex=Lf(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=ws(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ws(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 Cs)return t.id;const r=this.props.idAccessor||"id";return ws(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 Ga(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?pd(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:hd(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield yt(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 Ga(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 yt(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(wa(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=>{Ds.editPromise=i})}submit(t,r){return Ga(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield yt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(wa(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(wa(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&yt(this.props.onActivate,r)}resolveEdit(t){const r=Ds.editPromise;r&&r(t),Ds.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(On(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&yt(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(On(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&&yt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Dr.remove(r)),yt(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(On(n.id)),n.isSelectable&&(this.dispatch(Dr.add(n.id)),this.dispatch(Dr.anchor(n.id)),this.dispatch(Dr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&yt(this.props.onFocus,this.focusedNode),yt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(On(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(Dr.remove(this.nodesBetween(s,i))),this.dispatch(Dr.add(o)),this.dispatch(Dr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&yt(this.props.onFocus,this.focusedNode),yt(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(On((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&yt(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(Dr.set({ids:n,anchor:s,mostRecent:i})),yt(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&&ad(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;yt(this.props.onMove,{dragIds:n,parentId:t===Ss?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(In.cursor({type:"none"}))}showCursor(t){this.dispatch(In.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),yt(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),yt(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=_a(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(){xi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){xi(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),fd(()=>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===Ss)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!ws(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(On(t.id))}onBlur(){this.dispatch(D_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||xf}get renderRow(){return this.props.renderRow||w_}get renderNode(){return this.props.children||S_}get renderDragPreview(){return this.props.renderDragPreview||vd}get renderCursor(){return this.props.renderCursor||__}}function vt(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 X0=typeof Symbol=="function"&&Symbol.observable||"@@observable",Mf=X0,Ya=()=>Math.random().toString(36).substring(7).split("").join("."),Z0={INIT:`@@redux/INIT${Ya()}`,REPLACE:`@@redux/REPLACE${Ya()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ya()}`},Yr=Z0;function Ff(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 J0(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(r1(e))return"date";if(t1(e))return"error";const r=e1(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 e1(e){return typeof e.constructor=="function"?e.constructor.name:null}function t1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function r1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Ir(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=J0(e)),t}function $f(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?vt(2):`Expected the root reducer to be a function. Instead, received: '${Ir(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?vt(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"?vt(1):`Expected the enhancer to be a function. Instead, received: '${Ir(r)}'`);return r($f)(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((v,m)=>{o.set(m,v)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?vt(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(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?vt(4):`Expected the listener to be a function. Instead, received: '${Ir(v)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?vt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let m=!0;d();const _=a++;return o.set(_,v),function(){if(m){if(c)throw new Error(process.env.NODE_ENV==="production"?vt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");m=!1,d(),o.delete(_),i=null}}}function g(v){if(!Ff(v))throw new Error(process.env.NODE_ENV==="production"?vt(7):`Actions must be plain objects. Instead, the actual type was: '${Ir(v)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof v.type>"u")throw new Error(process.env.NODE_ENV==="production"?vt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof v.type!="string")throw new Error(process.env.NODE_ENV==="production"?vt(17):`Action "type" property must be a string. Instead, the actual type was: '${Ir(v.type)}'. Value was: '${v.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?vt(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,v)}finally{c=!1}return(i=o).forEach(_=>{_()}),v}function y(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?vt(10):`Expected the nextReducer to be a function. Instead, received: '${Ir(v)}`);n=v,g({type:Yr.REPLACE})}function b(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?vt(11):`Expected the observer to be an object. Instead, received: '${Ir(m)}'`);function _(){const w=m;w.next&&w.next(u())}return _(),{unsubscribe:v(_)}},[Mf](){return this}}}return g({type:Yr.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:y,[Mf]:b}}function jf(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function n1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===Yr.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(!Ff(e))return`The ${i} has unexpected type of "${Ir(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===Yr.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 s1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Yr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?vt(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:Yr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?vt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Yr.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 Bf(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"&&jf(`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{s1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=n1(a,r,c,s);f&&jf(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const g=n[f],y=r[g],b=a[g],p=y(b,c);if(typeof p>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?vt(14):`When called with an action of type ${v?`"${String(v)}"`:"(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]=p,d=d||p!==b}return d=d||n.length!==Object.keys(a).length,d?u:a}}function i1(e=Dn().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 o1=Bf({nodes:Bf({focus:I_,edit:O_,open:T_,selection:N_,drag:i1}),dnd:k_}),a1=Dn();function l1({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef($f(o1,Dn(e))),o=u_.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>a1),a=h.useMemo(()=>new Ds(i.current,e,n,s),[]),c=h.useRef(0);return h.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),h.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),h.useImperativeHandle(t,()=>a),h.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),h.useEffect(()=>{a.props.searchTerm||i.current.dispatch(Sa.clear(!0))},[a.props.searchTerm]),l.jsx(Ju.Provider,{value:a,children:l.jsx(rd.Provider,{value:c.current,children:l.jsx(ed.Provider,{value:o.nodes,children:l.jsx(td.Provider,{value:o.dnd,children:l.jsx(BS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||B0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function c1(){const e=It(),[,t]=hf(()=>({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}=Tf({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(In.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 u1(e){return c1(),e.children}function d1(){const t=It().props.renderContainer||xf;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function f1(){const e=It(),{offset:t,mouse:r,item:n,isDragging:s}=u0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||vd;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 h1(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=h1(r),this.root=g1(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 g1(e,t){const r=new Uf({},null,t,"ROOT");return r.children=e.map(n=>Ra(n,r,t)),r}function Ra(e,t,r){const n=new Uf(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>Ra(i,n,r))),n}class Uf{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=Ra(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 y1=0;function v1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new p1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=b=>{for(const p of b.dragIds)o.move({id:p,parentId:b.parentId,index:b.index});n(o.data)},c=({name:b,id:p})=>{o.update({id:p,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:p,type:v})=>{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(v==="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 m={[d]:`simple-tree-id-${y1++}`,name:""};return v==="internal"&&(m[u]=[]),o.create({parentId:b,index:p,data:m}),n(o.data),m},onDelete:b=>{b.ids.forEach(p=>o.drop({id:p})),n(o.data)}}]}function m1(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]=v1(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=m1(e);return l.jsxs(l1,{treeProps:r,imperativeHandle:t,children:[l.jsx(u1,{children:l.jsx(d1,{})}),l.jsx(f1,{})]})}const _1=h.forwardRef(b1);function Xa(){return Le(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 w1(){return Le(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 zf={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Vf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},qf=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],S1=[{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 C1(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 Yi(e){const t=C1(e);return{key:t,color:zf[t]??zf.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Vf[t]??Vf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const Tt={row:"_row_i3qt2_1",grip:"_grip_i3qt2_16",menuBtn:"_menuBtn_i3qt2_19",selected:"_selected_i3qt2_23",title:"_title_i3qt2_28",dropTarget:"_dropTarget_i3qt2_33",toggle:"_toggle_i3qt2_50",ctIcon:"_ctIcon_i3qt2_65",folderIcon:"_folderIcon_i3qt2_77",renameInput:"_renameInput_i3qt2_92",dropHere:"_dropHere_i3qt2_101",menuWrap:"_menuWrap_i3qt2_111",menu:"_menu_i3qt2_19",dangerItem:"_dangerItem_i3qt2_163"},E1={video:Ro,pdf:Ho,h5p:Wo,scorm:Qo,audio:Ko,quiz:Vo,default:mn},O1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,d]=h.useState(e.data.name),u=h.useRef(null),f=n==="edit",g=Xa(),y=Yi(e.data),b=E1[y.key]??mn,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),_=v?gv:m?_v:b;h.useEffect(()=>{if(!s)return;const E=T=>{var x;(x=u.current)!=null&&x.contains(T.target)||i(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[s]);const S=h.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=h.useCallback(E=>{E.key==="Enter"&&S(),E.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[Tt.row,p?Tt.selected:"",e.state.isOver&&m?Tt.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":m?"true":void 0,role:"treeitem","aria-selected":p,"aria-expanded":m?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:Tt.grip,"aria-hidden":"true",children:l.jsx(Hc,{size:14})}),l.jsx("button",{className:Tt.toggle,onClick:E=>{E.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(Uc,{size:14}):l.jsx(hs,{size:14})}),l.jsx("span",{className:`${Tt.ctIcon} ${v||m?Tt.folderIcon:y.bgClass}`,"aria-hidden":"true",children:l.jsx(_,{size:12})}),o?l.jsx("input",{className:Tt.renameInput,value:c,autoFocus:!0,onChange:E=>d(E.target.value),onBlur:S,onKeyDown:w,onClick:E=>E.stopPropagation()}):l.jsx("span",{className:Tt.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&&m&&l.jsx("span",{className:Tt.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Tt.menuWrap,ref:u,children:[l.jsx("button",{className:Tt.menuBtn,onClick:E=>{E.stopPropagation(),i(T=>!T)},"aria-label":"Node options",children:l.jsx(Vc,{size:14})}),s&&l.jsxs("div",{className:Tt.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(Dv,{size:13})," Rename"]}),m&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(qc,{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(ps,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Tt.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Yo,{size:13})," Delete"]})]})]})]})};async function D1(e,t){var i,o;const n=((i=(await xe.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 I1(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 T1(e,t){var a;const r=await D1(e,t.name),n=await I1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await xe.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function N1(e){var r;return((r=(await xe.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Hf(e){var n,s,i;const r=(i=(s=(n=(await xe.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 k1(e){return Hf(e)}const Ae={container:"_container_jr3ij_1",header:"_header_jr3ij_13",title:"_title_jr3ij_22",closeBtn:"_closeBtn_jr3ij_29",body:"_body_jr3ij_45",dropZone:"_dropZone_jr3ij_54",dragOver:"_dragOver_jr3ij_67",hasFile:"_hasFile_jr3ij_72",hiddenInput:"_hiddenInput_jr3ij_78",fileInfo:"_fileInfo_jr3ij_82",fileIcon:"_fileIcon_jr3ij_89",fileName:"_fileName_jr3ij_93",fileSize:"_fileSize_jr3ij_100",dropHint:"_dropHint_jr3ij_105",dropIcon:"_dropIcon_jr3ij_112",dropText:"_dropText_jr3ij_117",dropSubtext:"_dropSubtext_jr3ij_124",sampleLink:"_sampleLink_jr3ij_130",statusBar:"_statusBar_jr3ij_145",status_uploading:"_status_uploading_jr3ij_154",status_processing:"_status_processing_jr3ij_154",status_done:"_status_done_jr3ij_159",status_error:"_status_error_jr3ij_164",successDetail:"_successDetail_jr3ij_170",spinner:"_spinner_jr3ij_175",spin:"_spin_jr3ij_175",errorMsg:"_errorMsg_jr3ij_191",failedSection:"_failedSection_jr3ij_197",failedTitle:"_failedTitle_jr3ij_203",tableWrap:"_tableWrap_jr3ij_213",failedTable:"_failedTable_jr3ij_219",reasonCell:"_reasonCell_jr3ij_244",footer:"_footer_jr3ij_248"},x1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState("idle"),[u,f]=h.useState(""),[g,y]=h.useState([]),[b,p]=h.useState(null),v=h.useRef(null),m=h.useRef(null),_=h.useCallback(()=>{m.current!==null&&(clearInterval(m.current),m.current=null)},[]);h.useEffect(()=>()=>_(),[_]);const S=k=>k.name.toLowerCase().endsWith(".csv")?k.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=h.useCallback(k=>{f(""),y([]),p(null),d("idle"),S(k)&&i(k)},[]),E=h.useCallback(k=>{k.preventDefault(),a(!1);const L=k.dataTransfer.files[0];L&&w(L)},[w]),T=h.useCallback(k=>{var B;const L=(B=k.target.files)==null?void 0:B[0];L&&w(L),k.target.value=""},[w]),x=h.useCallback(async()=>{try{const k=await k1(e),L=document.createElement("a");L.href=k,L.download="sample_hierarchy.csv",L.target="_blank",L.click()}catch{f("Failed to download sample CSV.")}},[e]),P=h.useCallback(async()=>{if(s){d("uploading"),f(""),y([]);try{const{processId:k}=await T1(e,s);if(!k){d("done"),p(null),setTimeout(t,1500);return}d("processing"),m.current=setInterval(async()=>{try{const L=await N1(k);L.status==="COMPLETED"?(_(),d("done"),p(L.successCount??null),L.failedRecords&&L.failedRecords.length>0?y(L.failedRecords):setTimeout(t,1500)):L.status==="FAILED"&&(_(),d("error"),f("Upload processing failed. Please check the error rows below."),L.failedRecords&&y(L.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,_]),$={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ae.container,children:[l.jsxs("div",{className:Ae.header,children:[l.jsx("h2",{className:Ae.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ae.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ae.body,children:[l.jsxs("div",{className:`${Ae.dropZone} ${o?Ae.dragOver:""} ${s?Ae.hasFile:""}`,onDragEnter:k=>{k.preventDefault(),a(!0)},onDragOver:k=>{k.preventDefault(),a(!0)},onDragLeave:k=>{k.preventDefault(),a(!1)},onDrop:E,onClick:()=>{var k;return(k=v.current)==null?void 0:k.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:k=>{var L;return k.key==="Enter"&&((L=v.current)==null?void 0:L.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:Ae.hiddenInput,onChange:T,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ae.fileInfo,children:[l.jsx("span",{className:Ae.fileIcon,children:"📄"}),l.jsx("span",{className:Ae.fileName,children:s.name}),l.jsxs("span",{className:Ae.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ae.dropHint,children:[l.jsx("span",{className:Ae.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ae.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ae.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ae.sampleLink,onClick:x,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ae.statusBar} ${Ae[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ae.spinner,"aria-hidden":"true"}),$[c],c==="done"&&b!==null&&l.jsxs("span",{className:Ae.successDetail,children:[" — ",b," item(s) imported"]})]}),u&&l.jsx("p",{className:Ae.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:Ae.failedSection,children:[l.jsxs("h4",{className:Ae.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:Ae.tableWrap,children:l.jsxs("table",{className:Ae.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((k,L)=>l.jsxs("tr",{children:[l.jsx("td",{children:k.rowNumber??L+1}),l.jsx("td",{children:k.name??"—"}),l.jsx("td",{className:Ae.reasonCell,children:k.reason??"Unknown error"})]},L))})]})})]})]}),l.jsxs("div",{className:Ae.footer,children:[l.jsx(Me,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Me,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:P,children:c==="done"?"Uploaded":"Upload"})]})]})},rr={container:"_container_1y30m_1",header:"_header_1y30m_8",headerActions:"_headerActions_1y30m_19",iconBtn:"_iconBtn_1y30m_25",menuWrap:"_menuWrap_1y30m_43",dropdownMenu:"_dropdownMenu_1y30m_47",treeWrapper:"_treeWrapper_1y30m_79",csvModal:"_csvModal_1y30m_95",footer:"_footer_1y30m_105"},A1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var pe;const n=h.useRef(null),s=h.useRef(null),i=h.useRef(null),[o,a]=h.useState(400),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[g,y]=h.useState("create"),{treeData:b,selectedNodeId:p,selectNode:v,addNode:m,deleteNode:_,reorderChildren:S,moveNode:w,setTreeData:E}=Le(),T=e==="edit",x=Xa(),P=T&&x,$=(((pe=b[0])==null?void 0:pe.children)??[]).some(K=>K.isFolder),k=oe(K=>{var J,se,U,R;return((se=(J=K.editorConfig)==null?void 0:J.context)==null?void 0:se.contentId)??((R=(U=K.editorConfig)==null?void 0:U.context)==null?void 0:R.identifier)??""}),L=oe(K=>{var se,U;const J=(U=(se=K.categoryMeta)==null?void 0:se.sourcingSettings)==null?void 0:U.collection;return(J==null?void 0:J.enableBulkUpload)!==!1});h.useEffect(()=>{const K=s.current;if(!K)return;const J=new ResizeObserver(()=>{a(K.clientHeight||400)});return J.observe(K),a(K.clientHeight||400),()=>J.disconnect()},[]),h.useEffect(()=>{if(!c)return;const K=J=>{var se;(se=i.current)!=null&&se.contains(J.target)||d(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[c]);const B=h.useCallback(K=>{K.length>0&&v(K[0].data.id)},[v]),A=h.useCallback(({parentId:K,index:J,dragIds:se})=>{if(!K)return;const U=se[0],R=Za(b,U);if(!R)return;const Q=R.parent;if(Q===K){const ue=Za(b,K);if(!(ue!=null&&ue.children))return;const Oe=ue.children.findIndex(Be=>Be.id===U);if(Oe<0)return;S(K,Oe,J>Oe?J-1:J)}else w(U,Q??"",K)},[b,S,w]),j=h.useCallback(({ids:K})=>{K.forEach(J=>_(J))},[_]),F=h.useCallback(({parentId:K})=>{var U;const J=K??((U=b[0])==null?void 0:U.id)??"";if(!J)return{id:crypto.randomUUID()};const se=m(J,"unit");return se?{id:se}:(De.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,b]),Z=h.useCallback(()=>{var J;const K=(J=b[0])==null?void 0:J.id;K&&(m(K,"unit")||De.error("Maximum depth reached"))},[b,m]),ae=h.useCallback(()=>{p&&(m(p,"subunit")||De.error("Maximum depth reached"))},[p,m]),be=h.useCallback(async()=>{if(d(!1),!!k)try{const K=await Hf(k),J=await fetch(K).then(R=>R.blob()),se=URL.createObjectURL(J),U=document.createElement("a");U.href=se,U.download=`${k}-folders.csv`,U.style.display="none",document.body.appendChild(U),U.click(),document.body.removeChild(U),URL.revokeObjectURL(se)}catch{De.error("Failed to download CSV")}},[k]),Ee=h.useCallback(async()=>{if(f(!1),!!k)try{const{rootNode:K}=await Xu(k);E([K]),De.success("Course outline refreshed.")}catch{De.error("Outline could not be refreshed automatically. Please reload the page.")}},[k,E]);return l.jsxs("div",{className:rr.container,children:[l.jsx("div",{className:rr.header,children:l.jsxs("div",{className:rr.headerActions,children:[T&&l.jsxs("div",{className:rr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:rr.iconBtn,onClick:()=>d(K=>!K),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Vc,{size:15})}),c&&l.jsx("div",{className:rr.dropdownMenu,role:"menu",children:L&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:$,title:$?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),y("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:be,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!$,title:$?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),y("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:rr.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(Ev,{size:15}):l.jsx(Cv,{size:15})})]})}),l.jsx("div",{className:rr.treeWrapper,ref:s,children:l.jsx(_1,{ref:n,data:b,idAccessor:"id",childrenAccessor:"children",onSelect:B,onMove:T?A:void 0,onDelete:T?j:void 0,onCreate:T?F:void 0,disableEdit:!T,disableDrop:!T,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:K=>l.jsx(O1,{...K,editorMode:e})})}),T&&l.jsxs("div",{className:rr.footer,children:[l.jsxs(Me,{variant:"ghost",size:"sm",onClick:Z,disabled:!P,children:[l.jsx(ps,{size:14})," Add Unit"]}),l.jsxs(Me,{variant:"ghost",size:"sm",onClick:ae,disabled:!P||!p,children:[l.jsx(qc,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:rr.csvModal,children:l.jsx(x1,{contentId:k,mode:g,onComplete:Ee,onClose:()=>f(!1)})})]})};function Za(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Za(r.children,t);if(n)return n}}}const Is={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},P1=({crumbs:e})=>{const t=Le(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Is.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Is.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(wv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(Uc,{size:13,className:Is.sep}),n<e.length-1?l.jsx("button",{className:Is.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Is.current,children:r.name})]},r.id))]}):null},Ts={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},Wf=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],L1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?Wf.filter(i=>n.includes(i.id)):Wf;return l.jsx("div",{className:Ts.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:[Ts.tab,e===i.id?Ts.active:"",r.includes(i.id)?Ts.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Ts.errorDot,"aria-label":"Has errors"})]},i.id))})};var Ns=e=>e.type==="checkbox",Rr=e=>e instanceof Date,ut=e=>e==null;const Kf=e=>typeof e=="object";var He=e=>!ut(e)&&!Array.isArray(e)&&Kf(e)&&!Rr(e),Ja=e=>He(e)&&e.target?Ns(e.target)?e.target.checked:e.target.value:e,Qf=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Gf=e=>{const t=e.constructor&&e.constructor.prototype;return He(t)&&t.hasOwnProperty("isPrototypeOf")},Ri=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ge(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Ri&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(He(e)&&Gf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ge(e[s]));return n}const Tr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Gt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Yt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},el="form",Yf="root",Rf=["__proto__","constructor","prototype"];var ks=e=>/^\w*$/.test(e),Ue=e=>e===void 0,Xi=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!He(e))return r;const n=ks(t)?[t]:Xi(t);if(n.some(i=>Rf.includes(i)))return r;const s=n.reduce((i,o)=>ut(i)?void 0:i[o],e);return Ue(s)||s===e?Ue(e[t])?r:e[t]:s},Pt=e=>typeof e=="boolean",mt=e=>typeof e=="function",je=(e,t,r)=>{let n=-1;const s=ks(t)?[t]:Xi(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(Rf.includes(a))return;e[a]=c,e=e[a]}};const tl=h.createContext(null);tl.displayName="HookFormControlContext";const rl=()=>h.useContext(tl);var Xf=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Gt.all&&(t._proxyFormState[o]=!n||Gt.all),r&&(r[o]=!0),e[o]}});return s};const nl=Ri?h.useLayoutEffect:h.useEffect;function M1(e){const t=rl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=h.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return nl(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),h.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),h.useMemo(()=>Xf(o,r,c.current,!1),[o,r])}var bt=e=>typeof e=="string",sl=(e,t,r,n,s)=>bt(e)?(n&&t.watch.add(e),W(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),W(r,i))):(n&&(t.watchAll=!0),r),il=e=>ut(e)||!Kf(e);const Zf=(e,t)=>t.length===0&&!Array.isArray(e)&&!Gf(e);function Lt(e,t,r=new WeakMap){if(e===t)return!0;if(il(e)||il(t))return Object.is(e,t);if(Rr(e)&&Rr(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(Zf(e,n)||Zf(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(Rr(a)&&Rr(c)||(He(a)||Array.isArray(a))&&(He(c)||Array.isArray(c))?!Lt(a,c,r):!Object.is(a,c))return!1}}return!0}function F1(e){const t=rl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=h.useRef(s),d=h.useRef(a),u=h.useRef(void 0),f=h.useRef(r),g=h.useRef(n);d.current=a;const[y,b]=h.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),p=h.useCallback(w=>{const E=sl(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(E):E},[r._formValues,r._names,n]),v=h.useCallback(w=>{if(!i){const E=sl(n,r._names,w||r._formValues,!1,c.current);if(d.current){const T=d.current(E);Lt(T,u.current)||(b(T),u.current=T)}else b(E)}},[r._formValues,r._names,i,n]);nl(()=>((f.current!==r||!Lt(g.current,n))&&(f.current=r,g.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{v(w.values)}})),[r,o,n,v]),h.useEffect(()=>r._removeUnmounted());const m=f.current!==r,_=g.current,S=h.useMemo(()=>{if(i)return null;const w=!m&&!Lt(_,n);return m||w?p():null},[i,m,n,_,p]);return S!==null?S:y}function Zi(e){const t=rl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Qf(s._names.array,r),d=h.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,o)),[s,r,o]),u=F1({control:s,name:r,defaultValue:d,exact:a}),f=M1({control:s,name:r,exact:a}),g=h.useRef(e),y=h.useRef(null),b=h.useRef(s.register(r,{...e.rules,value:u,...Pt(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const p=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!W(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!W(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!W(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!W(f.validatingFields,r)},error:{enumerable:!0,get:()=>W(f.errors,r)}}),[f,r]),v=h.useCallback(w=>{const E=Ja(w);return W(s._fields,r)||(b.current=s.register(r,{...g.current.rules,value:E})),b.current.onChange({target:{value:Ja(w),name:r},type:Tr.CHANGE})},[r,s]),m=h.useCallback(()=>b.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Tr.BLUR}),[r,s._formValues]),_=h.useCallback(w=>{w&&(y.current={focus:()=>mt(w.focus)&&w.focus(),select:()=>mt(w.select)&&w.select(),setCustomValidity:T=>mt(w.setCustomValidity)&&w.setCustomValidity(T),reportValidity:()=>mt(w.reportValidity)&&w.reportValidity()});const E=W(s._fields,r);E&&E._f&&w&&(E._f.ref=y.current)},[s._fields,r]),S=h.useMemo(()=>({name:r,value:u,...Pt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:m,ref:_}),[r,n,f.disabled,v,m,_,u]);return h.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...Pt(g.current.disabled)?{disabled:g.current.disabled}:{}});const E=(T,x)=>{const P=W(s._fields,T);P&&P._f&&(P._f.mount=x)};if(E(r,!0),w){const T=Ge(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,g.current.defaultValue)));je(s._defaultValues,r,T),Ue(W(s._formValues,r))&&je(s._formValues,r,T)}if(!c&&s.register(r),y.current){const T=W(s._fields,r);T&&T._f&&(T._f.ref=y.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):E(r,!1)}},[r,s,c,i]),h.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),h.useMemo(()=>({field:S,formState:f,fieldState:p}),[S,f,p])}const ol=h.createContext(null);ol.displayName="HookFormContext";const Rt=()=>h.useContext(ol),$1=({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:y,control:b,register:p,setFocus:v,subscribe:m})=>{const _=h.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:y,control:b,register:p,setFocus:v,subscribe:m}),[i,b,d,n,r,g,p,f,u,s,v,o,a,m,c,y,t]);return h.createElement(ol.Provider,{value:_},h.createElement(tl.Provider,{value:_.control},e))};var j1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Jf=e=>Array.isArray(e)?e.filter(Boolean):[],Ji=e=>Array.isArray(e)?e:[e],eh=()=>{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 nt=e=>He(e)&&!Object.keys(e).length,al=e=>e.type==="file",eo=e=>{if(!Ri)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},rh=e=>e.type==="select-multiple",ll=e=>e.type==="radio",B1=e=>ll(e)||Ns(e),cl=e=>eo(e)&&e.isConnected;function U1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ut(e)){e=void 0;break}e=e[t[n]],n++}return e}function z1(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ue(e[t]))return!1;return!0}function Ze(e,t){if(bt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:ks(t)?[t]:Xi(t),n=r.length===1?e:U1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(He(n)&&nt(n)||Array.isArray(n)&&z1(n))&&Ze(e,r.slice(0,-1)),e}var V1=e=>{for(const t in e)if(mt(e[t]))return!0;return!1};function nh(e){return Array.isArray(e)||He(e)&&!V1(e)}function ul(e,t={}){for(const r in e){const n=e[r];nh(n)?(t[r]=Array.isArray(n)?[]:{},ul(n,t[r])):Ue(n)||(t[r]=!0)}return t}function dl(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>dl(r));return t.some(r=>r!==void 0)?t:void 0}if(He(e)){const t={};for(const r in e){const n=dl(e[r]);Ue(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Xr(e,t,r){r||(r=ul(t));for(const n in e){const s=e[n];if(nh(s))Ue(t)||il(r[n])?r[n]=ul(s,Array.isArray(s)?[]:{}):Xr(s,ut(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Lt(s,i)}}return dl(r)||{}}const sh={value:!1,isValid:!1},ih={value:!0,isValid:!0};var oh=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&&!Ue(e[0].attributes.value)?Ue(e[0].value)||e[0].value===""?ih:{value:e[0].value,isValid:!0}:ih:sh}return sh},ah=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ue(e)?e:t?e===""?NaN:e&&+e:r&&bt(e)?new Date(e):n?n(e):e;const lh={isValid:!1,value:null};var ch=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,lh):lh;function uh(e){const t=e.ref;return al(t)?t.files:ll(t)?ch(e.refs).value:rh(t)?[...t.selectedOptions].map(({value:r})=>r):Ns(t)?oh(e.refs).value:ah(Ue(t.value)?e.ref.value:t.value,e)}var q1=(e,t,r,n)=>{const s={};for(const i of e){const o=W(t,i);o&&je(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},to=e=>e instanceof RegExp,xs=e=>Ue(e)?e:to(e)?e.source:He(e)?to(e.value)?e.value.source:e.value:e,dh=e=>({isOnSubmit:!e||e===Gt.onSubmit,isOnBlur:e===Gt.onBlur,isOnChange:e===Gt.onChange,isOnAll:e===Gt.all,isOnTouch:e===Gt.onTouched});const fh="AsyncFunction";var H1=e=>!!e&&!!e.validate&&!!(mt(e.validate)&&e.validate.constructor.name===fh||He(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===fh)),W1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),fl=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const As=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=W(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(As(a,t))break}else if(He(a)&&As(a,t))break}}};function hh(e,t,r){const n=W(e,r);if(n||ks(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=W(t,i),a=W(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 K1=(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||Gt.all))},Q1=(e,t,r)=>!e||!t||e===t||Ji(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),G1=(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,Y1=(e,t)=>!Jf(W(e,t)).length&&Ze(e,t),ph=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return je(s,Yf,t[r]),je(e,r,s),e};function gh(e,t,r="validate"){if(bt(e)||Array.isArray(e)&&e.every(bt)||Pt(e)&&!e)return{type:r,message:bt(e)?e:"",ref:t}}var Ln=e=>He(e)&&!to(e)?e:{value:e,message:""},yh=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:g,pattern:y,validate:b,name:p,valueAsNumber:v,mount:m}=e._f,_=W(r,p);if(!m||t.has(p))return{};const S=a?a[0]:o,w=B=>{if(s&&S.reportValidity){const A=Pt(B)?"":B||"";a?a.forEach(j=>j.setCustomValidity(A)):S.setCustomValidity(A),S.reportValidity()}},E={},T=ll(o),x=Ns(o),P=T||x,$=(v||al(o))&&Ue(o.value)&&Ue(_)||eo(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,k=j1.bind(null,p,n,E),L=(B,A,j,F=Yt.maxLength,Z=Yt.minLength)=>{const ae=B?A:j;E[p]={type:B?F:Z,message:ae,ref:o,...k(B?F:Z,ae)}};if(i?!Array.isArray(_)||!_.length:c&&(!P&&($||ut(_))||Pt(_)&&!_||x&&!oh(a).isValid||T&&!ch(a).isValid)){const{value:B,message:A}=bt(c)?{value:!!c,message:c}:Ln(c);if(B&&(E[p]={type:Yt.required,message:A,ref:S,...k(Yt.required,A)},!n))return w(A),E}if(!$&&(!ut(f)||!ut(g))){let B,A;const j=Ln(g),F=Ln(f);if(!ut(_)&&!isNaN(_)){const Z=o.valueAsNumber||_&&+_;ut(j.value)||(B=Z>j.value),ut(F.value)||(A=Z<F.value)}else{const Z=o.valueAsDate||new Date(_),ae=pe=>new Date(new Date().toDateString()+" "+pe),be=o.type=="time",Ee=o.type=="week";bt(j.value)&&_&&(B=be?ae(_)>ae(j.value):Ee?_>j.value:Z>new Date(j.value)),bt(F.value)&&_&&(A=be?ae(_)<ae(F.value):Ee?_<F.value:Z<new Date(F.value))}if((B||A)&&(L(!!B,j.message,F.message,Yt.max,Yt.min),!n))return w(E[p].message),E}if((d||u)&&!$&&(bt(_)||i&&Array.isArray(_))){const B=Ln(d),A=Ln(u),j=!ut(B.value)&&_.length>+B.value,F=!ut(A.value)&&_.length<+A.value;if((j||F)&&(L(j,B.message,A.message),!n))return w(E[p].message),E}if(y&&!$&&bt(_)){const{value:B,message:A}=Ln(y);if(to(B)&&!_.match(B)&&(E[p]={type:Yt.pattern,message:A,ref:o,...k(Yt.pattern,A)},!n))return w(A),E}if(b){if(mt(b)){const B=await b(_,r),A=gh(B,S);if(A&&(E[p]={...A,...k(Yt.validate,A.message)},!n))return w(A.message),E}else if(He(b)){let B={};for(const A in b){if(!nt(B)&&!n)break;const j=gh(await b[A](_,r),S,A);j&&(B={...j,...k(A,j.message)},w(j.message),n&&(E[p]=B))}if(!nt(B)&&(E[p]={ref:S,...B},!n))return E}}return w(!0),E};const R1={mode:Gt.onSubmit,reValidateMode:Gt.onChange,shouldFocusError:!0},vh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function X1(e={}){let t={...R1,...e},r={...Ge(vh),isLoading:mt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=He(t.defaultValues)||He(t.values)?Ge(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ge(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 y={array:eh(),state:eh()},b=t.criteriaMode===Gt.all,p=C=>I=>{clearTimeout(d),d=setTimeout(C,I)},v=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||C)){let I;t.resolver?(I=nt((await k()).errors),m()):I=await A({fields:n,onlyCheckValid:!0,eventType:Tr.VALID}),I!==r.isValid&&y.state.next({isValid:I})}},m=(C,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((C||Array.from(a.mount)).forEach(N=>{N&&(I?je(r.validatingFields,N,I):Ze(r.validatingFields,N))}),y.state.next({validatingFields:r.validatingFields,isValidating:!nt(r.validatingFields)}))},_=()=>{r.dirtyFields=Xr(s,i)},S=(C,I=[],N,z,V=!0,G=!0)=>{if(z&&N&&!t.disabled){if(o.action=!0,G&&Array.isArray(W(n,C))){const q=N(W(n,C),z.argA,z.argB);V&&je(n,C,q)}if(G&&Array.isArray(W(r.errors,C))){const q=N(W(r.errors,C),z.argA,z.argB);V&&je(r.errors,C,q),Y1(r.errors,C)}if((f.touchedFields||g.touchedFields)&&G&&Array.isArray(W(r.touchedFields,C))){const q=N(W(r.touchedFields,C),z.argA,z.argB);V&&je(r.touchedFields,C,q)}(f.dirtyFields||g.dirtyFields)&&_(),y.state.next({name:C,isDirty:F(C,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else je(i,C,I)},w=(C,I)=>{je(r.errors,C,I),r.errors={...r.errors},y.state.next({errors:r.errors})},E=C=>{r.errors=C,y.state.next({errors:r.errors,isValid:!1})},T=C=>{const I=ks(C)?[C]:Xi(C);let N=i,z=s;for(let V=0;V<I.length-1;V++){const G=I[V];if(N=ut(N)?N:N[G],z=ut(z)?z:z[G],N===null&&z!==null)return!0}return!1},x=(C,I,N,z)=>{const V=W(n,C);if(V){if(T(C))return;const G=Ue(W(i,C)),q=W(i,C,Ue(N)?W(s,C):N);Ue(q)||z&&z.defaultChecked||I?je(i,C,I?q:uh(V._f)):be(C,q),o.mount&&!o.action&&(v(),G&&r.isDirty&&(f.isDirty||g.isDirty)&&(F()||(r.isDirty=!1,y.state.next({...r}))),e.shouldUnregister&&G&&!Ue(W(i,C))&&fl(C,a)&&(o.watch=!0))}},P=(C,I,N,z,V)=>{let G=!1,q=!1;const te={name:C};if(!t.disabled){if(!N||z){(f.isDirty||g.isDirty)&&(q=r.isDirty,r.isDirty=te.isDirty=F(),G=q!==te.isDirty);const me=Lt(W(s,C),I);q=!!W(r.dirtyFields,C),me!==r.isDirty?r.dirtyFields=Xr(s,i):me?Ze(r.dirtyFields,C):je(r.dirtyFields,C,!0),te.dirtyFields=r.dirtyFields,G=G||(f.dirtyFields||g.dirtyFields)&&q!==!me}if(N){const me=W(r.touchedFields,C);me||(je(r.touchedFields,C,N),te.touchedFields=r.touchedFields,G=G||(f.touchedFields||g.touchedFields)&&me!==N)}G&&V&&y.state.next(te)}return G?te:{}},$=(C,I,N,z)=>{const V=W(r.errors,C),G=(f.isValid||g.isValid)&&Pt(I)&&r.isValid!==I;if(t.delayError&&N?(c=p(()=>w(C,N)),c(t.delayError)):(clearTimeout(d),c=null,N?je(r.errors,C,N):Ze(r.errors,C),r.errors={...r.errors}),(N?!Lt(V,N):V)||!nt(z)||G){const q={...z,...G&&Pt(I)?{isValid:I}:{},errors:r.errors,name:C};r={...r,...q},y.state.next(q)}},k=async C=>(m(C,!0),await t.resolver(i,t.context,q1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),L=async C=>{const{errors:I}=await k(C);if(m(C),C){for(const N of C){const z=W(I,N);z?a.array.has(N)&&He(z)&&!Object.keys(z).some(V=>!Number.isNaN(Number(V)))?ph(r.errors,{[N]:z},N):je(r.errors,N,z):Ze(r.errors,N)}r.errors={...r.errors}}else r.errors=I;return I},B=async({name:C,eventType:I})=>{if(e.validate){const N=await e.validate({formValues:i,formState:r,name:C,eventType:I});if(He(N))for(const z in N){const V=N[z];V&&Be(`${el}.${z}`,{message:bt(V.message)?V.message:"",type:V.type||Yt.validate})}else bt(N)||!N?Be(el,{message:N||"",type:Yt.validate}):Oe(el);return N}return!0},A=async({fields:C,onlyCheckValid:I,name:N,eventType:z,context:V={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(V.runRootValidation=!0,!await B({name:N,eventType:z})&&(V.valid=!1,I)))return V.valid;for(const G in C){const q=C[G];if(q){const{_f:te,...me}=q;if(te){const Qe=a.array.has(te.name),kt=q._f&&H1(q._f),xt=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;kt&&xt&&m([te.name],!0);const vr=await yh(q,a.disabled,i,b,t.shouldUseNativeValidation&&!I,Qe);if(kt&&xt&&m([te.name]),vr[te.name]&&(V.valid=!1,I)||(!I&&(W(vr,te.name)?Qe?ph(r.errors,vr,te.name):je(r.errors,te.name,vr[te.name]):Ze(r.errors,te.name)),e.shouldUseNativeValidation&&vr[te.name]))break}!nt(me)&&await A({context:V,onlyCheckValid:I,fields:me,name:G,eventType:z})}}return V.valid},j=()=>{for(const C of a.unMount){const I=W(n,C);I&&(I._f.refs?I._f.refs.every(N=>!cl(N)):!cl(I._f.ref))&&$e(C)}a.unMount=new Set},F=(C,I)=>!t.disabled&&(C&&I&&je(i,C,I),!Lt(Q(),s)),Z=(C,I,N)=>sl(C,a,{...o.mount?i:Ue(I)?s:bt(C)?{[C]:I}:I},N,I),ae=C=>Jf(W(o.mount?i:s,C,t.shouldUnregister?W(s,C,[]):[])),be=(C,I,N={},z=!1)=>{const V=W(n,C);let G=I;if(V){const q=V._f;q&&(!q.disabled&&je(i,C,ah(I,q)),G=eo(q.ref)&&ut(I)?"":I,rh(q.ref)?[...q.ref.options].forEach(te=>te.selected=G.includes(te.value)):q.refs?Ns(q.ref)?q.refs.forEach(te=>{(!te.defaultChecked||!te.disabled)&&(Array.isArray(G)?te.checked=!!G.find(me=>me===te.value):te.checked=G===te.value||!!G)}):q.refs.forEach(te=>te.checked=te.value===G):al(q.ref)?q.ref.value="":(q.ref.value=G,q.ref.type||y.state.next({name:C,values:z?i:Ge(i)})))}(N.shouldDirty||N.shouldTouch)&&P(C,G,N.shouldTouch,N.shouldDirty,!0),N.shouldValidate&&R(C)},Ee=(C,I,N,z=!1)=>{for(const V in I){if(!I.hasOwnProperty(V))return;const G=I[V],q=C+"."+V,te=W(n,q);(a.array.has(C)||He(G)||te&&!te._f)&&!Rr(G)?Ee(q,G,N,z):be(q,G,N,z)}},pe=(C,I,N,z)=>{const V=W(n,C),G=a.array.has(C),q=z?I:Ge(I),te=W(i,C),me=Lt(te,q);if(me||je(i,C,q),G)y.array.next({name:C,values:z?i:Ge(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&N.shouldDirty&&(_(),y.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:F(C,q)}));else{const Qe=Array.isArray(q)&&!q.length||nt(q);!V||V._f||ut(q)||Qe?be(C,q,N,z):Ee(C,q,N,z)}if(!me){const Qe=fl(C,a),kt=z?i:Ge(i);y.state.next({...Qe&&r,name:o.mount||Qe?C:void 0,values:kt})}},K=(C,I,N={})=>pe(C,I,N,!1),J=(C,I={})=>{const N=mt(C)?C(i):C;if(!Lt(i,N)){i={...i,...N};for(const z of a.mount)pe(z,W(N,z),I,!0);y.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&v()}},se=async C=>{o.mount=!0;const I=C.target;let N=I.name,z=!0;const V=W(n,N),G=me=>{z=Number.isNaN(me)||Rr(me)&&isNaN(me.getTime())||Lt(me,W(i,N,me))},q=dh(t.mode),te=dh(t.reValidateMode);if(V){let me,Qe;const kt=I.type?uh(V._f):Ja(C),xt=C.type===Tr.BLUR||C.type===Tr.FOCUS_OUT,vr=!W1(V._f)&&!e.validate&&!t.resolver&&!W(r.errors,N)&&!V._f.deps||G1(xt,W(r.touchedFields,N),r.isSubmitted,te,q),qs=fl(N,a,xt);je(i,N,kt),xt?(!I||!I.readOnly)&&(V._f.onBlur&&V._f.onBlur(C),c&&c(0)):V._f.onChange&&V._f.onChange(C);const fn=P(N,kt,xt),at=!nt(fn)||qs;if(!xt&&y.state.next({name:N,type:C.type,values:Ge(i)}),vr)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?xt&&v():xt||v()),at&&y.state.next({name:N,...qs?{}:fn});if(!t.resolver&&e.validate&&await B({name:N,eventType:C.type}),!xt&&qs&&y.state.next({...r}),t.resolver){const{errors:wt}=await k([N]);if(m([N]),G(kt),!z){!nt(fn)&&y.state.next(fn);return}const Et=hh(r.errors,n,N),Jt=hh(wt,n,Et.name||N);me=Jt.error,N=Jt.name,Qe=nt(wt)}else m([N],!0),me=(await yh(V,a.disabled,i,b,t.shouldUseNativeValidation))[N],m([N]),G(kt),z&&(me?Qe=!1:(f.isValid||g.isValid)&&(Qe=await A({fields:n,onlyCheckValid:!0,name:N,eventType:C.type})));z&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&R(V._f.deps),$(N,Qe,me,fn))}},U=(C,I)=>{if(W(r.errors,I)&&C.focus)return C.focus(),1},R=async(C,I={})=>{let N,z;const V=Ji(C);if(t.resolver){const G=await L(Ue(C)?C:V);N=nt(G),z=C?!V.some(q=>W(G,q)):N}else C?(z=(await Promise.all(V.map(async G=>{const q=W(n,G);return await A({fields:q&&q._f?{[G]:q}:q,eventType:Tr.TRIGGER})}))).every(Boolean),!(!z&&!r.isValid)&&v()):z=N=await A({fields:n,name:C,eventType:Tr.TRIGGER});return y.state.next({...!bt(C)||(f.isValid||g.isValid)&&N!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:N}:{},errors:r.errors}),I.shouldFocus&&!z&&As(n,U,C?V:a.mount),z},Q=(C,I)=>{let N={...o.mount?i:s};return I&&(N=th(I.dirtyFields?r.dirtyFields:r.touchedFields,N)),Ue(C)?N:bt(C)?W(N,C):C.map(z=>W(N,z))},ue=(C,I)=>({invalid:!!W((I||r).errors,C),isDirty:!!W((I||r).dirtyFields,C),error:W((I||r).errors,C),isValidating:!!W(r.validatingFields,C),isTouched:!!W((I||r).touchedFields,C)}),Oe=C=>{const I=C?Ji(C):void 0;I==null||I.forEach(N=>Ze(r.errors,N)),I?I.forEach(N=>{y.state.next({name:N,errors:r.errors})}):y.state.next({errors:{}})},Be=(C,I,N)=>{const z=(W(n,C,{_f:{}})._f||{}).ref,V=W(r.errors,C)||{},{ref:G,message:q,type:te,...me}=V;je(r.errors,C,{...me,...I,ref:z}),y.state.next({name:C,errors:r.errors,isValid:!1}),N&&N.shouldFocus&&z&&z.focus&&z.focus()},ve=(C,I)=>mt(C)?y.state.subscribe({next:N=>"values"in N&&C(N.values||Z(void 0,I),N)}):Z(C,I,!0),ce=C=>y.state.subscribe({next:I=>{if(Q1(C.name,I.name,C.exact)&&K1(I,C.formState||f,gr,C.reRenderRoot)){const N={...i};C.callback({values:N,...r,...I,defaultValues:s})}}}).unsubscribe,ge=C=>(o.mount=!0,g={...g,...C.formState},ce({...C,formState:{...u,...C.formState}})),$e=(C,I={})=>{for(const N of C?Ji(C):a.mount)a.mount.delete(N),a.array.delete(N),I.keepValue||(Ze(n,N),Ze(i,N)),!I.keepError&&Ze(r.errors,N),!I.keepDirty&&Ze(r.dirtyFields,N),!I.keepTouched&&Ze(r.touchedFields,N),!I.keepIsValidating&&Ze(r.validatingFields,N),!t.shouldUnregister&&!I.keepDefaultValue&&Ze(s,N);y.state.next({values:Ge(i)}),y.state.next({...r,...I.keepDirty?{isDirty:F()}:{}}),!I.keepIsValid&&v()},qe=({disabled:C,name:I})=>{if(Pt(C)&&o.mount||C||a.disabled.has(I)){const V=a.disabled.has(I)!==!!C;C?a.disabled.add(I):a.disabled.delete(I),V&&o.mount&&!o.action&&v()}},ke=(C,I={})=>{let N=W(n,C);const z=Pt(I.disabled)||Pt(t.disabled),V=!a.registerName.has(C)&&N&&N._f&&!N._f.mount;return je(n,C,{...N||{},_f:{...N&&N._f?N._f:{ref:{name:C}},name:C,mount:!0,...I}}),a.mount.add(C),N&&!V?qe({disabled:Pt(I.disabled)?I.disabled:t.disabled,name:C}):x(C,!0,I.value),{...z?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:xs(I.min),max:xs(I.max),minLength:xs(I.minLength),maxLength:xs(I.maxLength),pattern:xs(I.pattern)}:{},name:C,onChange:se,onBlur:se,ref:G=>{if(G){a.registerName.add(C),ke(C,I),a.registerName.delete(C),N=W(n,C);const q=Ue(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,te=B1(q),me=N._f.refs||[];if(te?me.find(Qe=>Qe===q):q===N._f.ref)return;je(n,C,{_f:{...N._f,...te?{refs:[...me.filter(cl),q,...Array.isArray(W(s,C))?[{}]:[]],ref:{type:q.type,name:C}}:{ref:q}}}),x(C,!1,void 0,q)}else N=W(n,C,{}),N._f&&(N._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(Qf(a.array,C)&&o.action)&&a.unMount.add(C)}}},ee=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&As(n,U,a.mount),Ke=C=>{Pt(C)&&(y.state.next({disabled:C}),As(n,(I,N)=>{const z=W(n,N);z&&(I.disabled=z._f.disabled||C,Array.isArray(z._f.refs)&&z._f.refs.forEach(V=>{V.disabled=z._f.disabled||C}))},0,!1))},tt=(C,I)=>async N=>{let z;N&&(N.preventDefault&&N.preventDefault(),N.persist&&N.persist());let V=Ge(i);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:G,values:q}=await k();m(),r.errors=G,V=Ge(q)}else await A({fields:n,eventType:Tr.SUBMIT});if(a.disabled.size)for(const G of a.disabled)Ze(V,G);if(Ze(r.errors,Yf),nt(r.errors)){y.state.next({errors:{}});try{await C(V,N)}catch(G){z=G}}else I&&await I({...r.errors},N),ee(),setTimeout(ee);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nt(r.errors)&&!z,submitCount:r.submitCount+1,errors:r.errors}),z)throw z},H=(C,I={})=>{W(n,C)&&(Ue(I.defaultValue)?K(C,Ge(W(s,C))):(K(C,I.defaultValue),je(s,C,Ge(I.defaultValue))),I.keepTouched||Ze(r.touchedFields,C),I.keepDirty||(Ze(r.dirtyFields,C),r.isDirty=I.defaultValue?F(C,Ge(W(s,C))):F()),I.keepError||(Ze(r.errors,C),f.isValid&&v()),y.state.next({...r}))},re=(C,I={})=>{const N=C?Ge(C):s,z=Ge(N),V=nt(C),G=z;if(I.keepDefaultValues||(s=N),!I.keepValues){if(I.keepDirtyValues){const q=new Set([...a.mount,...Object.keys(Xr(s,i))]);for(const te of Array.from(q)){const me=W(r.dirtyFields,te),Qe=W(i,te),kt=W(G,te);me&&!Ue(Qe)?je(G,te,Qe):!me&&!Ue(kt)&&K(te,kt)}}else{if(Ri&&Ue(C))for(const q of a.mount){const te=W(n,q);if(te&&te._f){const me=Array.isArray(te._f.refs)?te._f.refs[0]:te._f.ref;if(eo(me)){const Qe=me.closest("form");if(Qe){Qe.reset();break}}}}if(I.keepFieldsRef)for(const q of a.mount)K(q,W(G,q));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?Ge(s):{},I.keepFieldsRef)for(const q of a.mount)je(i,q,W(G,q))}else i=Ge(G);y.array.next({values:{...G}}),y.state.next({values:{...G}})}a={mount:I.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||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!nt(G),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),y.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:V?!1:I.keepDirty?r.isDirty:I.keepValues?F():!!(I.keepDefaultValues&&!Lt(C,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:V?{}:I.keepDirtyValues?I.keepDefaultValues&&i?Xr(s,i):r.dirtyFields:I.keepDefaultValues&&C?Xr(s,C):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},ie=(C,I)=>re(mt(C)?C(i):C,{...t.resetOptions,...I}),Re=(C,I={})=>{const N=W(n,C),z=N&&N._f;if(z){const V=z.refs?z.refs[0]:z.ref;V.focus&&setTimeout(()=>{V.focus(),I.shouldSelect&&mt(V.select)&&V.select()})}},gr=C=>{r={...r,...C}},Yn={control:{register:ke,unregister:$e,getFieldState:ue,handleSubmit:tt,setError:Be,_subscribe:ce,_runSchema:k,_updateIsValidating:m,_focusError:ee,_getWatch:Z,_getDirty:F,_setValid:v,_setFieldArray:S,_setDisabledField:qe,_setErrors:E,_getFieldArray:ae,_reset:re,_resetDefaultValues:()=>mt(t.defaultValues)&&t.defaultValues().then(C=>{ie(C,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:j,_disableForm:Ke,_subjects:y,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return s},get _names(){return a},set _names(C){a=C},get _formState(){return r},get _options(){return t},set _options(C){t={...t,...C}}},subscribe:ge,trigger:R,register:ke,handleSubmit:tt,watch:ve,setValue:K,setValues:J,getValues:Q,reset:ie,resetField:H,resetDefaultValues:(C,I={})=>{if(s=Ge(C),!I.keepDirty){const N=Xr(s,i);r.dirtyFields=N,r.isDirty=!nt(N)}I.keepIsValid||v(),y.state.next({...r,defaultValues:s})},clearErrors:Oe,unregister:$e,setError:Be,setFocus:Re,getFieldState:ue};return{...Yn,formControl:Yn}}function Z1(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...Ge(vh),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}=X1(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,nl(()=>{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]),h.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),h.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),h.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),h.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),h.useEffect(()=>{var a;e.values&&!Lt(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]),h.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=h.useMemo(()=>Xf(s,o),[o,s]),t.current}async function mh(e){var r,n;return(n=(r=(await xe.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function J1(e){var r,n;return((n=(r=(await xe.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 bh(e,t){const r=ts({queryKey:["framework",e],queryFn:()=>mh(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=ts({queryKey:["framework",n],queryFn:()=>mh(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function eE(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}=ts({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>J1({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 tE(e){var r,n;return(n=(r=(await xe.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function rE(e){var r,n,s,i,o,a;const t=ts({queryKey:["channel",e],queryFn:()=>tE(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 nE={"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."}},sE=new Set(["review","read","sourcingreview","orgreview"]),ro={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},iE={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},oE={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"},hl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},_h=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function aE(e,t,r,n,s={}){if(!(e!=null&&e.length))return wE(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=pE(a),u=gE(a,r,t,i,s),f=t[c],g=cE(c,wh(f,d),d,t,s),y={code:c,label:a.label??c,inputType:d,required:!!(a.required===!0||Array.isArray(a.validations)&&a.validations.some(b=>b.type==="required")),editable:lE(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:fE(u,g,d,r),depends:a.depends,tab:hE(a),section:a.section,defaultValue:a.defaultValue??a.default,currentValue:g};if(c==="dialcodes"){const b=t.dialcodeRequired==="Yes";return{...y,required:b,visible:b}}return y})}function lE(e,t,r){var i;const n=r.editorMode??"edit";if(!sE.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function cE(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!==""?uE(Number(a)):t}default:return t}}function uE(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 dE(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 fE(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=dE(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 hE(e){const t=e.section;if(t){if(ro[t])return ro[t];const n=iE[t];if(n&&ro[n])return ro[n]}const r=e.code??"";return oE[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 pE(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 gE(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?bE(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??hl[i];if(c)return Sh(i,c,e,t,r,n)}function yE(e,t){return _h.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function vE(e,t){return _h.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function pl(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 mE(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 bE(e){return Array.from(new Set(e))}function _E(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function Sh(e,t,r,n,s,i){const o=yE(e,r),a=vE(e,r),c=p=>({label:p.name,value:o?p.identifier:p.name}),d=r.depends;if(!(d!=null&&d.length))return pl(n,t,a).map(c);const u=d.flatMap(p=>_E(s[p])).map(String);if(!u.length)return[];const f=[];for(const p of d){const v=i.get(p),m=(v==null?void 0:v.sourceCategory)??hl[p]??p;f.push(...pl(n,m,a))}const y=f.filter(p=>u.includes(String(p.name))||u.includes(String(p.identifier))||u.includes(String(p.code))).flatMap(p=>p.associations??[]).filter(p=>String(p.category??"").toLowerCase()===t.toLowerCase()),b=mE(y);return b.length?b.map(c):pl(n,t,a).map(c)}function Ps(e,t){const r=hl[e];if(r)return Sh(e,r,{},t,{},new Map)}function dt(e,t,r){return wh(e[t],r)}function wE(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:dt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:dt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:dt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:dt(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:dt(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:dt(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:Ps("subjectIds",r),currentValue:dt(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:dt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:Ps("targetBoardIds",r),currentValue:dt(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:Ps("targetMediumIds",r),currentValue:dt(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:Ps("targetGradeLevelIds",r),currentValue:dt(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:Ps("targetSubjectIds",r),currentValue:dt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:dt(e,"license","select")})),n}const SE=["allowECM","levels","setPeriod","instances"];function Ch(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function CE(e,t={}){const r={...e};for(const i of SE)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Ch(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 EE(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Ch(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function OE(e,t){const{watch:r,setValue:n}=e,s=h.useRef(!1);h.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 Mn={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},DE=({title:e,description:t,children:r})=>l.jsxs("div",{className:Mn.section,children:[l.jsxs("div",{className:Mn.header,children:[l.jsx("h3",{className:Mn.title,children:e}),t&&l.jsx("p",{className:Mn.description,children:t})]}),l.jsx("hr",{className:Mn.divider}),l.jsx("div",{className:Mn.fields,children:r})]}),M={field:"_field_1s288_1",fullWidth:"_fullWidth_1s288_7",label:"_label_1s288_11",required:"_required_1s288_19",input:"_input_1s288_24",textarea:"_textarea_1s288_45",inputError:"_inputError_1s288_50",error:"_error_1s288_54",selectBtn:"_selectBtn_1s288_59",selectOpen:"_selectOpen_1s288_83",placeholder:"_placeholder_1s288_87",selectedVal:"_selectedVal_1s288_91",chevronUp:"_chevronUp_1s288_95",dropdown:"_dropdown_1s288_100",option:"_option_1s288_116",optionSelected:"_optionSelected_1s288_134",noOpts:"_noOpts_1s288_139",chipGroup:"_chipGroup_1s288_146",chipInput:"_chipInput_1s288_158",addChipBtn:"_addChipBtn_1s288_167",radioGroup:"_radioGroup_1s288_184",radioLabel:"_radioLabel_1s288_191",iconWrap:"_iconWrap_1s288_199",iconPreview:"_iconPreview_1s288_214",iconPlaceholder:"_iconPlaceholder_1s288_220",removeIconBtn:"_removeIconBtn_1s288_233",tagChip:"_tagChip_1s288_252",tagChipRemove:"_tagChipRemove_1s288_264",nestedSelectRow:"_nestedSelectRow_1s288_278",dialcodeRow:"_dialcodeRow_1s288_287",validateBtn:"_validateBtn_1s288_293",dialcodeValid:"_dialcodeValid_1s288_315",dialcodeSpinner:"_dialcodeSpinner_1s288_325"},Eh=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Rt(),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:[M.field,s?M.fullWidth:""].join(" "),children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[M.input,M.textarea,d?M.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[M.input,d?M.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:M.error,children:String(d.message)})]})},IE=({name:e,label:t,options:r,required:n,disabled:s})=>{var p;const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Rt(),g=d(e),y=((p=r.find(v=>v.value===g))==null?void 0:p.label)??"Select…",b=f[e];return h.useEffect(()=>{if(!i)return;const v=m=>{var _;(_=a.current)!=null&&_.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),l.jsxs("div",{className:M.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[M.selectBtn,b?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:g?M.selectedVal:M.placeholder,children:y}),l.jsx(hs,{size:14,className:i?M.chevronUp:""})]}),i&&l.jsxs("div",{className:M.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[M.option,g===v.value?M.optionSelected:""].join(" "),onClick:()=>{u(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:v.label}),g===v.value&&l.jsx(vn,{size:13})]},v.value)),!r.length&&l.jsx("span",{className:M.noOpts,children:"No options"})]}),b&&l.jsx("span",{className:M.error,children:String(b.message)})]})},TE=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Rt(),g=d(e)??[],y=f[e],b=g.length?`${g.length} selected`:"Select…";h.useEffect(()=>{if(!i)return;const v=m=>{var _;(_=a.current)!=null&&_.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const p=v=>{const m=g.includes(v)?g.filter(_=>_!==v):[...g,v];u(e,m,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:M.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[M.selectBtn,y?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:g.length?M.selectedVal:M.placeholder,children:b}),l.jsx(hs,{size:14,className:i?M.chevronUp:""})]}),i&&l.jsxs("div",{className:M.dropdown,children:[r.map(v=>l.jsxs("button",{type:"button",className:[M.option,g.includes(v.value)?M.optionSelected:""].join(" "),onClick:()=>p(v.value),children:[l.jsx(vn,{size:13,style:{opacity:g.includes(v.value)?1:0}}),l.jsx("span",{children:v.label})]},v.value)),!r.length&&l.jsx("span",{className:M.noOpts,children:"No options"})]}),y&&l.jsx("span",{className:M.error,children:String(y.message)})]})},NE=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=h.useState(""),[a,c]=h.useState(!1),d=h.useRef(null),{watch:u,setValue:f,formState:{errors:g}}=Rt(),y=u(e)??[],b=g[e],p=()=>{const m=i.trim();m&&!y.includes(m)&&f(e,[...y,m],{shouldDirty:!0}),o(""),c(!1)},v=m=>f(e,y.filter(_=>_!==m),{shouldDirty:!0});return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:M.chipGroup,children:[y.map(m=>l.jsxs("span",{className:"sbx-chip filled",children:[m,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>v(m),"aria-label":`Remove ${m}`,children:"×"})]},m)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:M.chipInput,value:i,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),p()),m.key==="Escape"&&(o(""),c(!1))},onBlur:p,placeholder:s}):l.jsxs("button",{type:"button",className:M.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var m;return(m=d.current)==null?void 0:m.focus()},50)},children:[l.jsx(ps,{size:12})," Add"]}))]}),b&&l.jsx("span",{className:M.error,children:String(b.message)})]})},kE=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Rt(),a=o[e];return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("div",{className:M.radioGroup,children:r.map(c=>l.jsxs("label",{className:M.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:M.error,children:String(a.message)})]})};async function xE(e,t,r,n){var o,a;const i=(a=(o=(await xe.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 AE(e,t){var s,i;const n=(i=(s=(await xe.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 PE(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 LE(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await xe.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 he={overlay:"_overlay_ga6eh_1",modal:"_modal_ga6eh_12",header:"_header_ga6eh_24",title:"_title_ga6eh_33",closeBtn:"_closeBtn_ga6eh_39",tabs:"_tabs_ga6eh_57",tab:"_tab_ga6eh_57",activeTab:"_activeTab_ga6eh_83",body:"_body_ga6eh_88",searchWrap:"_searchWrap_ga6eh_99",searchIcon:"_searchIcon_ga6eh_104",searchInput:"_searchInput_ga6eh_113",grid:"_grid_ga6eh_132",imgCell:"_imgCell_ga6eh_148",imgCellSelected:"_imgCellSelected_ga6eh_166",thumb:"_thumb_ga6eh_171",noThumb:"_noThumb_ga6eh_177",checkBadge:"_checkBadge_ga6eh_183",loadMoreBtn:"_loadMoreBtn_ga6eh_198",loadingRow:"_loadingRow_ga6eh_220",empty:"_empty_ga6eh_230",spinner:"_spinner_ga6eh_237",uploadArea:"_uploadArea_ga6eh_247",dropZone:"_dropZone_ga6eh_256",uploadIcon:"_uploadIcon_ga6eh_277",dropText:"_dropText_ga6eh_281",dropSubtext:"_dropSubtext_ga6eh_288",uploadPreview:"_uploadPreview_ga6eh_294",hiddenInput:"_hiddenInput_ga6eh_301",fileName:"_fileName_ga6eh_305",errorText:"_errorText_ga6eh_311",footer:"_footer_ga6eh_318",cancelBtn:"_cancelBtn_ga6eh_328",confirmBtn:"_confirmBtn_ga6eh_345"},Oh=18,Dh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=h.useState("my"),[o,a]=h.useState(""),[c,d]=h.useState([]),[u,f]=h.useState(0),[g,y]=h.useState(!1),[b,p]=h.useState(null),[v,m]=h.useState(0),[_,S]=h.useState(null),[w,E]=h.useState(""),[T,x]=h.useState(!1),[P,$]=h.useState(""),k=h.useRef(null),L=oe(U=>{var R,Q;return((Q=(R=U.editorConfig)==null?void 0:R.context)==null?void 0:Q.channel)??""}),B=oe(U=>{var R,Q;return((Q=(R=U.editorConfig)==null?void 0:R.context)==null?void 0:Q.uid)??""}),A=oe(U=>{var R,Q,ue;return((ue=(Q=(R=U.editorConfig)==null?void 0:R.context)==null?void 0:Q.cloudStorage)==null?void 0:ue.presigned_headers)??{}}),j=oe(U=>{var R,Q,ue;return((ue=(Q=(R=U.editorConfig)==null?void 0:R.config)==null?void 0:Q.assetConfig)==null?void 0:ue.size)??1*1024*1024}),F=oe(U=>{var R,Q,ue;return((ue=(Q=(R=U.editorConfig)==null?void 0:R.config)==null?void 0:Q.assetConfig)==null?void 0:ue.accepted)??"image/png,image/jpeg"}),Z=h.useCallback(async(U,R,Q=!1)=>{var ue;y(!0);try{const Oe={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&B&&(Oe.createdBy=B),L&&(Oe.channel=L);const ve=((ue=(await xe.post("/action/composite/v3/search",{request:{filters:Oe,query:U,limit:Oh,offset:R,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ue.result)??{},ce=ve.content??[];f(ve.count??0),d(ge=>Q?[...ge,...ce]:ce)}catch{}finally{y(!1)}},[s,B,L]);h.useEffect(()=>{s!=="upload"&&(d([]),m(0),Z(o,0))},[s]);const ae=h.useRef(),be=U=>{a(U),clearTimeout(ae.current),ae.current=setTimeout(()=>{d([]),m(0),Z(U,0)},400)},Ee=()=>{const U=v+Oh;m(U),Z(o,U,!0)},pe=()=>{const U=(b==null?void 0:b.artifactUrl)??(b==null?void 0:b.appIcon)??(b==null?void 0:b.downloadUrl)??"";U&&r(U)};h.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const K=U=>{var ue;const R=(ue=U.target.files)==null?void 0:ue[0];if(U.target.value="",!R)return;const Q=F.split(",").map(Oe=>Oe.trim());if(!Q.includes(R.type)){const Oe=Q.map(Be=>Be.replace("image/","").toUpperCase()).join(", ");$(`Only ${Oe} files are accepted.`);return}if(R.size>j){const Oe=(j/1048576).toFixed(0);$(`Image must be under ${Oe} MB.`);return}w&&URL.revokeObjectURL(w),S(R),E(URL.createObjectURL(R)),$("")},J=async()=>{if(_){x(!0),$("");try{const U=await xE(_.name.split(".").slice(0,-1).join(".")||_.name,_.type,B,L),R=await AE(U,_.name);await PE(R,_,A);const Q=R.split("?")[0],ue=await LE(U,Q,_.type);r(ue)}catch(U){$(U instanceof Error?U.message:"Upload failed.")}finally{x(!1)}}},se=c.length<u;return l.jsx("div",{className:he.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:he.modal,children:[l.jsxs("div",{className:he.header,children:[l.jsx("span",{className:he.title,children:"Select App Icon"}),l.jsx("button",{className:he.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(zr,{size:18})})]}),l.jsxs("div",{className:he.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${he.tab} ${s==="my"?he.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${he.tab} ${s==="all"?he.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${he.tab} ${s==="upload"?he.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Qc,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:he.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:he.searchWrap,children:[l.jsx(Go,{size:14,className:he.searchIcon}),l.jsx("input",{type:"search",className:he.searchInput,placeholder:"Search images…",value:o,onChange:U=>be(U.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:he.loadingRow,children:[l.jsx(yi,{size:20,className:he.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:he.empty,children:"No images found"}):l.jsx("div",{className:he.grid,children:c.map(U=>{const R=U.appIcon??U.artifactUrl??U.downloadUrl??"",Q=(b==null?void 0:b.identifier)===U.identifier;return l.jsxs("button",{type:"button",className:`${he.imgCell} ${Q?he.imgCellSelected:""}`,onClick:()=>p(U),title:U.name,children:[R?l.jsx("img",{src:R,alt:U.name,className:he.thumb}):l.jsx("div",{className:he.noThumb,children:"IMG"}),Q&&l.jsx("div",{className:he.checkBadge,children:l.jsx(vn,{size:12})})]},U.identifier)})}),se&&!g&&l.jsx("button",{className:he.loadMoreBtn,onClick:Ee,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:he.loadingRow,children:l.jsx(yi,{size:16,className:he.spinner})})]}):l.jsxs("div",{className:he.uploadArea,children:[l.jsx("div",{className:he.dropZone,onClick:()=>{var U;return(U=k.current)==null?void 0:U.click()},onDragOver:U=>U.preventDefault(),onDrop:U=>{U.preventDefault();const R=U.dataTransfer.files[0];R&&K({target:{files:[R],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:he.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Qc,{size:32,className:he.uploadIcon}),l.jsx("p",{className:he.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:he.dropSubtext,children:[F.split(",").map(U=>U.replace("image/","").toUpperCase()).join(", ")," · max ",(j/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:k,type:"file",accept:F,className:he.hiddenInput,onChange:K}),_&&l.jsx("p",{className:he.fileName,children:_.name}),P&&l.jsx("p",{className:he.errorText,children:P})]})}),l.jsxs("div",{className:he.footer,children:[l.jsx("button",{className:he.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:he.confirmBtn,disabled:!_||T,onClick:J,children:T?l.jsxs(l.Fragment,{children:[l.jsx(yi,{size:14,className:he.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:he.confirmBtn,disabled:!b,onClick:pe,children:"Use Selected"})]})]})})},ME=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Rt(),f=a(e),g=u[e],y=p=>{c(e,p,{shouldDirty:!0,shouldValidate:!0}),o(!1)},b=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:M.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:M.iconPreview}):l.jsxs("div",{className:M.iconPlaceholder,children:[l.jsx(Wc,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:M.removeIconBtn,onClick:b,"aria-label":"Remove app icon",children:[l.jsx(Yo,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:M.error,children:String(g.message)}),i&&l.jsx(Dh,{nodeId:r,currentValue:f,onSelect:y,onClose:()=>o(!1)})]})},FE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Rt(),{field:i,fieldState:{error:o}}=Zi({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[M.input,o?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:M.error,children:String(o.message)})]})},$E=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Rt(),{field:i,fieldState:{error:o}}=Zi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=h.useState(""),d=h.useRef(null),u=i.value??[],f=p=>{const v=p.trim();!v||u.includes(v)||i.onChange([...u,v])},g=p=>{i.onChange(u.filter(v=>v!==p))},y=p=>{p.key==="Enter"||p.key===","?(p.preventDefault(),f(a),c("")):p.key==="Backspace"&&a===""&&u.length>0&&g(u[u.length-1])},b=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:[M.chipGroup,o?M.inputError:""].join(" "),onClick:()=>{var p;return!n&&((p=d.current)==null?void 0:p.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(p=>l.jsxs("span",{className:M.tagChip,children:[p,!n&&l.jsx("button",{type:"button",className:M.tagChipRemove,onClick:v=>{v.stopPropagation(),g(p)},"aria-label":`Remove ${p}`,children:l.jsx(zr,{size:11})})]},p)),!n&&l.jsx("input",{ref:d,className:M.chipInput,value:a,onChange:p=>c(p.target.value),onKeyDown:y,onBlur:b,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:M.error,children:String(o.message)})]})},jE=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Rt(),{field:o,fieldState:{error:a}}=Zi({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,g)=>{const y={};for(let b=0;b<f;b++)y[r[b].code]=c[r[b].code]??"";y[u]=g;for(let b=f+1;b<r.length;b++)y[r[b].code]="";o.onChange(y)};return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("div",{className:M.nestedSelectRow,children:r.map((u,f)=>{const g=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:M.field,style:{flex:1},children:[l.jsx("label",{className:M.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[M.input,a?M.inputError:""].join(" "),disabled:s||g,value:c[u.code]??"",onChange:y=>d(u.code,f,y.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(y=>l.jsx("option",{value:y.value,children:y.label},y.value))]})]},u.code)})}),a&&l.jsx("span",{className:M.error,children:String(a.message)})]})},Ih=[{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"}],BE=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=h.useState(!1),o=h.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Rt(),f=c(e),g=Ih.find(p=>p.value===f),y=(g==null?void 0:g.label)??"Select license…",b=u[e];return h.useEffect(()=>{if(!s)return;const p=v=>{var m;(m=o.current)!=null&&m.contains(v.target)||i(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),l.jsxs("div",{className:M.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[M.selectBtn,b?M.inputError:"",s?M.selectOpen:""].join(" "),onClick:()=>i(p=>!p),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?M.selectedVal:M.placeholder,children:y}),l.jsx(hs,{size:14,className:s?M.chevronUp:""})]}),s&&l.jsx("div",{className:M.dropdown,role:"listbox",children:Ih.map(p=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===p.value,className:[M.option,f===p.value?M.optionSelected:""].join(" "),onClick:()=>{d(e,p.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:p.label}),f===p.value&&l.jsx(vn,{size:13})]},p.value))}),b&&l.jsx("span",{className:M.error,children:String(b.message)})]})},UE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Rt(),{field:i,fieldState:{error:o}}=Zi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=h.useState("idle"),[d,u]=h.useState(""),f=async()=>{const y=(i.value??"").trim();if(!y){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const b=await t_(y),p=b==null?void 0:b.result,v=p==null?void 0:p.dialcodes;Array.isArray(v)&&v.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(yi,{size:16,className:M.dialcodeSpinner}):a==="valid"?l.jsx(zc,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(qo,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:M.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[M.input,o?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:y=>{i.onChange(y),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:M.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),g()]}),o&&l.jsx("span",{className:M.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?M.dialcodeValid:M.error,children:d})]})},gl={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},zE=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var ge,$e,qe,ke,ee,Ke,tt;const a=oe(H=>H.editorConfig),c=oe(H=>H.rootFormConfig),d=oe(H=>H.unitFormConfig),u=oe(H=>H.categoryMeta),f=oe(H=>H.contentFramework),g=oe(H=>H.contentTargetFWIds),{organisationFramework:y,targetFrameworks:b,isLoading:p}=bh(f??((ge=a==null?void 0:a.context)==null?void 0:ge.framework),g??(($e=a==null?void 0:a.context)==null?void 0:$e.targetFWIds)),{frameworks:v,collectionAdditionalCategories:m,contentAdditionalCategories:_,defaultLicense:S,name:w}=rE((qe=a==null?void 0:a.context)==null?void 0:qe.channel),E=eE(v,(ke=u==null?void 0:u.frameworkMetadata)==null?void 0:ke.orgFWType,(ee=a==null?void 0:a.context)==null?void 0:ee.channel),T={organisationFramework:y,targetFrameworks:b,orgFrameworks:E,channelAdditionalCategories:m},x=Le(H=>H.selectedNodeId),P=Le(H=>H.treeData),$=Le(H=>H.treeCache),k=x?$[x]??{}:{},L={...e,...k},B=h.useMemo(()=>{var re;if(!x)return 0;const H=[...P];for(;H.length;){const ie=H.shift();if(ie.id===x)return((re=ie.children)==null?void 0:re.length)??0;ie.children&&H.push(...ie.children)}return 0},[P,x]),A=(a==null?void 0:a.config)??{},j=(a==null?void 0:a.context)??{},F={editorMode:s,editableFields:A.editableFields,objectType:A.objectType,setDefaultCopyRight:A.setDefaultCopyRight===!0,defaultLicense:j.defaultLicense??S,contextAdditionalCategories:j.additionalCategories,userFullName:(Ke=j.user)==null?void 0:Ke.fullName,channelName:w,collectionAdditionalCategories:m,contentAdditionalCategories:_,childCount:B},Z=r?c:d,ae=Z||(((tt=a==null?void 0:a.config.hierarchy)==null?void 0:tt.formConfig)??[]),be=aE(ae,L,T,r,F),Ee=be.filter(H=>H.tab===t&&H.inputType!=="appIcon"&&H.visible!==!1),pe=Z1({mode:"onChange",defaultValues:Object.fromEntries(be.map(H=>{const re=["multiselect","chips","keywords","tagsinput"],ie=["nestedselect"];return re.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??[]]:ie.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??{}]:[H.code,H.currentValue??H.defaultValue??""]}))});OE(pe,be);const{updateNode:K}=Le(),J=h.useRef(be);J.current=be;const se=h.useRef(x);se.current=x;const U=h.useRef(i);U.current=i;const R=h.useRef(o);R.current=o;const Q=h.useRef(typeof L.shuffle=="boolean"?L.shuffle:void 0),ue=h.useRef(L.name??"");ue.current=L.name??"";const Oe=h.useRef(s);Oe.current=s;const Be=["review","read","sourcingreview","orgreview"];h.useEffect(()=>{const H=se.current;if(H){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&&K(H,re)}pe.trigger().then(()=>{const re=pe.formState.errors,ie=J.current,Re=Array.from(new Set(Object.keys(re).map(gr=>{var yr;return(yr=ie.find(dn=>dn.code===gr))==null?void 0:yr.tab}).filter(Boolean)));R.current(Object.keys(re).length===0,Re)})},[]),h.useEffect(()=>{const H=pe.watch((re,{name:ie})=>{const Re=se.current;if(!Re)return;const gr=J.current,yr=new Set(gr.map(C=>C.code));if(ie&&yr.has(ie)){let C=pe.getValues(ie);ie==="dialcodes"&&(C=Array.isArray(C)?C:C?[C]:[]),ie==="shuffle"&&(C===!0&&Q.current===!1&&De("Shuffling is enabled for this question set.",{icon:"ℹ️"}),Q.current=C);const I=EE(ie,C);I&&(K(Re,I),U.current(I))}else if(!ie){const C=pe.getValues(),I=Object.fromEntries(Object.entries(C).filter(([z])=>yr.has(z))),N=CE(I,{isReview:Be.includes(Oe.current),nodeTitle:ue.current});Object.keys(N).length>0&&(K(Re,N),U.current(N))}const dn=pe.formState.errors,Yn=Array.from(new Set(Object.keys(dn).map(C=>{var I;return(I=gr.find(N=>N.code===C))==null?void 0:I.tab}).filter(Boolean)));R.current(Object.keys(dn).length===0,Yn)});return()=>H.unsubscribe()},[pe]);const ve=Ee.reduce((H,re)=>{const ie=H[H.length-1];return ie&&ie.section===re.section?ie.fields.push(re):H.push({section:re.section,fields:[re]}),H},[]),ce=H=>{const re={key:H.code,name:H.code,label:H.label,required:H.required,disabled:H.editable===!1};switch(H.inputType){case"textarea":return l.jsx(Eh,{...re,multiline:!0,maxLength:H.maxLength});case"select":return l.jsx(IE,{...re,options:H.options??[]});case"multiselect":return l.jsx(TE,{...re,options:H.options??[]});case"chips":return l.jsx(NE,{...re});case"radio":return l.jsx(kE,{...re,options:H.options??[]});case"appIcon":return l.jsx(ME,{...re,nodeId:x??""});case"datepicker":case"datetime":return l.jsx(FE,{...re});case"keywords":case"tagsinput":return l.jsx($E,{...re});case"nestedselect":return l.jsx(jE,{...re,levels:H.levels??[]});case"license":return l.jsx(BE,{...re});case"dialcode":return l.jsx(UE,{...re});default:return l.jsx(Eh,{...re,maxLength:H.maxLength})}};return l.jsx($1,{...pe,children:l.jsxs("div",{className:gl.form,children:[ve.map((H,re)=>{const ie=H.section?nE[H.section]:void 0;return ie?l.jsx(DE,{title:ie.title,description:ie.description,children:H.fields.map(ce)},H.section??re):l.jsx("div",{className:gl.ungrouped,children:H.fields.map(ce)},re)}),Ee.length===0&&!p&&l.jsx("p",{className:gl.noFields,children:"No fields configured for this tab."})]})})};function Th(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function VE(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function no(e){return e!==null&&e>=0}function qE(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 HE(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Nh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Th(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}},so={scaleX:1,scaleY:1},WE=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,...so}:null}const c=KE(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...so}:s<r&&s>=o?{x:0,y:a.height+c,...so}:{x:0,y:0,...so}};function KE(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 kh="Sortable",xh=h.createContext({activeIndex:-1,containerId:kh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Nh,disabled:{draggable:!1,droppable:!1}});function QE(e){let{children:t,id:r,items:n,strategy:s=Nh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=$c(),f=os(kh,r),g=a.rect!==null,y=h.useMemo(()=>n.map(T=>typeof T=="object"&&"id"in T?T.id:T),[n]),b=o!=null,p=o?y.indexOf(o.id):-1,v=d?y.indexOf(d.id):-1,m=h.useRef(y),_=!qE(y,m.current),S=v!==-1&&p===-1||_,w=HE(i);Wt(()=>{_&&b&&u(y)},[_,y,b,u]),h.useEffect(()=>{m.current=y},[y]);const E=h.useMemo(()=>({activeIndex:p,containerId:f,disabled:w,disableTransforms:S,items:y,overIndex:v,useDragOverlay:g,sortedRects:VE(y,c),strategy:s}),[p,f,w.draggable,w.droppable,S,y,v,c,g,s]);return h.createElement(xh.Provider,{value:E},t)}const GE=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Th(r,n,s).indexOf(t)},YE=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},RE={duration:200,easing:"ease"},Ah="transform",XE=Er.Transition.toString({property:Ah,duration:0,easing:"linear"}),ZE={roleDescription:"sortable"};function JE(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=h.useState(null),a=h.useRef(r);return Wt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=yn(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]),h.useEffect(()=>{i&&o(null)},[i]),i}function eO(e){let{animateLayoutChanges:t=YE,attributes:r,disabled:n,data:s,getNewIndex:i=GE,id:o,strategy:a,resizeObserverConfig:c,transition:d=RE}=e;const{items:u,containerId:f,activeIndex:g,disabled:y,disableTransforms:b,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:_}=h.useContext(xh),S=tO(n,y),w=u.indexOf(o),E=h.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),T=h.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:x,node:P,isOver:$,setNodeRef:k}=Zy({id:o,data:E,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...c}}),{active:L,activatorEvent:B,activeNodeRect:A,attributes:j,setNodeRef:F,listeners:Z,isDragging:ae,over:be,setActivatorNodeRef:Ee,transform:pe}=Fc({id:o,data:E,attributes:{...ZE,...r},disabled:S.draggable}),K=$g(k,F),J=!!L,se=J&&!b&&no(g)&&no(v),U=!m&&ae,R=U&&se?pe:null,ue=se?R??(a??_)({rects:p,activeNodeRect:A,activeIndex:g,overIndex:v,index:w}):null,Oe=no(g)&&no(v)?i({id:o,items:u,activeIndex:g,overIndex:v}):w,Be=L==null?void 0:L.id,ve=h.useRef({activeId:Be,items:u,newIndex:Oe,containerId:f}),ce=u!==ve.current.items,ge=t({active:L,containerId:f,isDragging:ae,isSorting:J,id:o,index:w,items:u,newIndex:ve.current.newIndex,previousItems:ve.current.items,previousContainerId:ve.current.containerId,transition:d,wasDragging:ve.current.activeId!=null}),$e=JE({disabled:!ge,index:w,node:P,rect:x});return h.useEffect(()=>{J&&ve.current.newIndex!==Oe&&(ve.current.newIndex=Oe),f!==ve.current.containerId&&(ve.current.containerId=f),u!==ve.current.items&&(ve.current.items=u)},[J,Oe,f,u]),h.useEffect(()=>{if(Be===ve.current.activeId)return;if(Be&&!ve.current.activeId){ve.current.activeId=Be;return}const ke=setTimeout(()=>{ve.current.activeId=Be},50);return()=>clearTimeout(ke)},[Be]),{active:L,activeIndex:g,attributes:j,data:E,rect:x,index:w,newIndex:Oe,items:u,isOver:$,isSorting:J,isDragging:ae,listeners:Z,node:P,overIndex:v,over:be,setNodeRef:K,setActivatorNodeRef:Ee,setDroppableNodeRef:k,setDraggableNodeRef:F,transform:$e??ue,transition:qe()};function qe(){if($e||ce&&ve.current.newIndex===w)return XE;if(!(U&&!ai(B)||!d)&&(J||ge))return Er.Transition.toString({...d,property:Ah})}}function tO(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 io(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 rO=[Se.Down,Se.Right,Se.Up,Se.Left],nO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(rO.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 Se.Down:n.top<g.top&&c.push(f);break;case Se.Up:n.top>g.top&&c.push(f);break;case Se.Left:n.left>g.left&&c.push(f);break;case Se.Right:n.left<g.left&&c.push(f);break}});const d=ey({collisionRect:n,droppableRects:s,droppableContainers:c});let u=lc(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),y=g?s.get(g.id):null,b=g==null?void 0:g.node.current;if(b&&y&&f&&g){const v=ui(b).some((T,x)=>a[x]!==T),m=Ph(f,g),_=sO(f,g),S=v||!m?{x:0,y:0}:{x:_?n.width-y.width:0,y:_?n.height-y.height:0},w={x:y.left,y:y.top};return S.x&&S.y?w:as(w,S)}}}};function Ph(e,t){return!io(e)||!io(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function sO(e,t){return!io(e)||!io(t)||!Ph(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Zr={row:"_row_11nth_1",removeBtn:"_removeBtn_11nth_14",grip:"_grip_11nth_17",ctIcon:"_ctIcon_11nth_34",info:"_info_11nth_38",name:"_name_11nth_46",meta:"_meta_11nth_55"},iO={video:Ro,pdf:Ho,h5p:Wo,scorm:Qo,audio:Ko,quiz:Vo,default:mn},oO=({item:e,onRemove:t,isEditable:r})=>{const n=Yi(e),s=iO[n.key]??mn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=eO({id:e.id,disabled:!r}),f={transform:Er.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Zr.row,role:"listitem",children:[r&&l.jsx("span",{className:Zr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Hc,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Zr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Zr.info,children:[l.jsx("span",{className:Zr.name,title:e.name,children:e.name}),l.jsx("span",{className:Zr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Zr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(zr,{size:14})})]})},Jr={container:"_container_lzvke_1",header:"_header_lzvke_7",heading:"_heading_lzvke_13",count:"_count_lzvke_21",list:"_list_lzvke_30",emptyState:"_emptyState_lzvke_36",addRow:"_addRow_lzvke_52"},aO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Le(),i=t?r(t):[],o=e==="edit",a=sc(xo(di,{activationConstraint:{distance:5}}),xo(Fo,{coordinateGetter:nO})),c=h.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const y=Le.getState().getChildrenOf(t),b=y.findIndex(v=>v.id===f.id),p=y.findIndex(v=>v.id===g.id);b<0||p<0||n(t,b,p)},[t,n]),d=h.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:Jr.container,children:[l.jsxs("div",{className:Jr.header,children:[l.jsx("span",{className:Jr.heading,children:"Content in this unit"}),l.jsx("span",{className:Jr.count,children:i.length})]}),i.length>0?l.jsx(Lc,{sensors:a,collisionDetection:Jg,onDragEnd:c,children:l.jsx(QE,{items:i.map(u=>u.id),strategy:WE,children:l.jsx("div",{className:Jr.list,role:"list",children:i.map(u=>l.jsx(oO,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:Jr.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:Jr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(ps,{size:14})," Add content"]})]}):null},Lh={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},lO=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Lh.dropZone} ${e?Lh.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 cO(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await xe.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 uO(e){var r,n;return(n=(r=(await xe.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function dO(e){var n,s,i,o,a,c,d;const t=await xe.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 fO(e){var r,n;return e.length?((n=(r=(await xe.post("/action/question/v2/list",{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}const Mh="application/vnd.sunbird.question";function Fh(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function hO(e,t){return ts({queryKey:["quml","questionset",e],enabled:!!e,queryFn:async()=>{const n=await dO(e),s=u=>{if(!u)return[];const f=u.mimeType===Mh&&u.identifier?[u.identifier]:[],g=(u.children??[]).flatMap(s);return[...f,...g]},i=s(n),o=new Map;i.length&&(await fO(i)).forEach(f=>{const g=f.identifier;g&&o.set(g,f)});const a=u=>{if(!u)return u;if(u.mimeType===Mh&&u.identifier){const f=o.get(u.identifier)??u,g=f.outcomeDeclaration;return g!=null&&g.maxScore||(f.outcomeDeclaration={...g??{},maxScore:Fh(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:Fh(c)}),c}})}const $h="/assets/quml-player/sunbird-quml-player.js",pO="/assets/quml-player/styles.css",gO="/action/question/v2/list",jh="sunbird-quml-player",ot=class ot{constructor(){Qs(this,"eventHandlers",new WeakMap)}loadScript(){return ot.scriptLoaded||customElements.get(jh)?(ot.scriptLoaded=!0,Promise.resolve()):(ot.scriptLoading||(ot.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=$h,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{ot.scriptLoaded=!0,ot.scriptLoading=void 0,t()},n.onerror=()=>{ot.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${$h}`))},document.body.appendChild(n)})),ot.scriptLoading)}loadStyles(){if(window.questionListUrl=gO,ot.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){ot.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=pO,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),ot.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),ot.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(jh);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))}};Qs(ot,"scriptLoaded",!1),Qs(ot,"scriptLoading"),Qs(ot,"stylesLoaded",!1);let oo=ot;const ao=new oo,ze={contentPlayerRoot:"_contentPlayerRoot_ryh6z_1",stage:"_stage_ryh6z_9",playerHeader:"_playerHeader_ryh6z_19",playerHeaderThumb:"_playerHeaderThumb_ryh6z_33",playerHeaderTitle:"_playerHeaderTitle_ryh6z_43",typeBadge:"_typeBadge_ryh6z_53",typeDot:"_typeDot_ryh6z_92",aspectRatio:"_aspectRatio_ryh6z_99",playerFrame:"_playerFrame_ryh6z_112",coverOverlay:"_coverOverlay_ryh6z_120",coverHidden:"_coverHidden_ryh6z_132",coverThumb:"_coverThumb_ryh6z_137",coverPlayRing:"_coverPlayRing_ryh6z_146",coverPlayIcon:"_coverPlayIcon_ryh6z_159",coverLabel:"_coverLabel_ryh6z_168",coverSkeleton:"_coverSkeleton_ryh6z_174",playerWrapper:"_playerWrapper_ryh6z_200",infoStrip:"_infoStrip_ryh6z_210",infoChip:"_infoChip_ryh6z_226",infoChipLabel:"_infoChipLabel_ryh6z_245",infoChipIcon:"_infoChipIcon_ryh6z_254",playerError:"_playerError_ryh6z_260",playerErrorIcon:"_playerErrorIcon_ryh6z_274",playerErrorMsg:"_playerErrorMsg_ryh6z_279",qumlRoot:"_qumlRoot_ryh6z_286"},yO=[{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 vO(e){return yO.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const mO={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},bO={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},_O={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},wO="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function yl(e){for(const[t,r]of Object.entries(mO))if(r.includes(e))return t;return"default-player"}function SO(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 CO(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 EO(e,t,r=100){await CO(bO[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 OO=[{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 DO({node:e}){const t=e.metadata??{},r=OO.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:ze.infoStrip,children:r.map(n=>l.jsxs("div",{className:ze.infoChip,children:[n.icon&&l.jsx("span",{className:ze.infoChipIcon,children:n.icon}),l.jsx("span",{className:ze.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function Bh({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${ze.coverOverlay} ${t?ze.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:ze.coverThumb}),l.jsx("div",{className:ze.coverPlayRing,children:l.jsx("div",{className:ze.coverPlayIcon})}),l.jsx("span",{className:ze.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:ze.coverSkeleton})})}function Uh({message:e}){return l.jsxs("div",{className:ze.playerError,children:[l.jsx("span",{className:ze.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:ze.playerErrorMsg,children:e})]})}function IO({mimeType:e}){const t=vO(e);return l.jsxs("span",{className:ze.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:ze.typeDot}),t.label]})}const vl=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(NO,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:ze.contentPlayerRoot,children:[l.jsxs("div",{className:ze.stage,children:[l.jsxs("div",{className:ze.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:ze.playerHeaderThumb}),l.jsx("span",{className:ze.playerHeaderTitle,children:e.name}),l.jsx(IO,{mimeType:e.mimeType??""})]}),l.jsx(TO,{node:e})]}),l.jsx(DO,{node:e})]})};function TO({node:e}){var v;const t=oe(m=>m.editorConfig),[r,n]=h.useState(()=>yl(e.mimeType??"")),[s,i]=h.useState(!1),[o,a]=h.useState(null),[c,d]=h.useState(e.metadata??{}),[u,f]=h.useState(!1),g=h.useRef(null),y=h.useRef(null),b=((v=t==null?void 0:t.config)==null?void 0:v.previewCdnUrl)??wO;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(yl(e.mimeType??"")),uO(e.identifier).then(_=>{if(m)return;const S={...e.metadata??{},..._};d(S);const w=_.mimeType??e.mimeType??"";n(yl(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=SO(e,c,t);return h.useEffect(()=>{if(!u||r!=="default-player")return;const m=g.current;if(!m)return;m.src=b;const _=()=>{try{const w=m.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(p),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 m.addEventListener("load",_),m.addEventListener("error",S),()=>{m.removeEventListener("load",_),m.removeEventListener("error",S),m.src=""}},[e.identifier,r,b,u]),h.useEffect(()=>{if(!u||r==="default-player")return;const m=y.current;if(!m)return;const _=_O[r];if(!_)return;const S=p;EO(_,r).then(()=>{if(!y.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",()=>{}),m.innerHTML="",m.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:ze.aspectRatio,children:[o?l.jsx(Uh,{message:o}):l.jsx(Bh,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:ze.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:y,className:ze.playerFrame})]})}function NO({node:e,editorMode:t}){const r=oe(a=>a.editorConfig),n=h.useRef(null),{data:s,isLoading:i,error:o}=hO(e.identifier);return h.useEffect(()=>{const a=n.current;if(!a||!s)return;let c=null,d=!1;return(async()=>{try{const u=await ao.createConfig(s,r==null?void 0:r.context,{mode:t==="edit"?"edit":"play"});if(d||!n.current)return;const f=ao.createElement(u);c=f,ao.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&&(ao.removeEventListeners(c),c.remove()),oo.unloadStyles()}},[s,r,t]),l.jsxs("div",{className:ze.qumlRoot,children:[o?l.jsx(Uh,{message:`Unable to load questionset: ${o.message}`}):i||!s?l.jsx(Bh,{node:e,hidden:!1}):null,l.jsx("div",{ref:n,className:ze.playerWrapper})]})}const Vt={overlay:"_overlay_ifddx_1",modal:"_modal_ifddx_11",header:"_header_ifddx_21",body:"_body_ifddx_37",hint:"_hint_ifddx_43",list:"_list_ifddx_49",item:"_item_ifddx_55",selected:"_selected_ifddx_68",empty:"_empty_ifddx_73",footer:"_footer_ifddx_79",cancelBtn:"_cancelBtn_ifddx_87",moveBtn:"_moveBtn_ifddx_95"};function kO(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 xO=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Le(),o=kO(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=h.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Vt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Vt.modal,children:[l.jsxs("div",{className:Vt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(zr,{size:16})})]}),l.jsxs("div",{className:Vt.body,children:[l.jsx("p",{className:Vt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Vt.list,children:[o.map(f=>l.jsxs("li",{className:`${Vt.item} ${a===f.id?Vt.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(bv,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Vt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Vt.footer,children:[l.jsx("button",{className:Vt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Vt.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},nr={overlay:"_overlay_16at9_1",modal:"_modal_16at9_11",header:"_header_16at9_21",body:"_body_16at9_37",table:"_table_16at9_43",pageInput:"_pageInput_16at9_61",empty:"_empty_16at9_68",footer:"_footer_16at9_74",cancelBtn:"_cancelBtn_16at9_82",saveBtn:"_saveBtn_16at9_90"};function AO(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 PO=({onClose:e})=>{const{treeData:t,updateNode:r}=Le(),n=AO(t),[s,i]=h.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=h.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:nr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:nr.modal,children:[l.jsxs("div",{className:nr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(zr,{size:16})})]}),l.jsx("div",{className:nr.body,children:n.length===0?l.jsx("p",{className:nr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:nr.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:nr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:nr.footer,children:[l.jsx("button",{className:nr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:nr.saveBtn,onClick:o,children:[l.jsx(Tv,{size:14})," Save"]})]})]})})},We={container:"_container_1a7t2_1",panelHeader:"_panelHeader_1a7t2_10",panelHeaderLeft:"_panelHeaderLeft_1a7t2_19",panelCollapseBtn:"_panelCollapseBtn_1a7t2_27",titleRow:"_titleRow_1a7t2_46",field:"_field_1a7t2_47",moveBtn:"_moveBtn_1a7t2_64",icon:"_icon_1a7t2_84",nameInput:"_nameInput_1a7t2_93",fieldHeader:"_fieldHeader_1a7t2_118",label:"_label_1a7t2_124",fieldCount:"_fieldCount_1a7t2_133",chips:"_chips_1a7t2_170",chip:"_chip_1a7t2_170",chipRemove:"_chipRemove_1a7t2_188",keywordInput:"_keywordInput_1a7t2_202",input:"_input_1a7t2_207",addBtn:"_addBtn_1a7t2_220",radioGroup:"_radioGroup_1a7t2_234",radioLabel:"_radioLabel_1a7t2_239"},LO=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var L,B;const{updateNode:s,markDirty:i}=Le(),o=t==="edit",a=Yi(e),c=oe(A=>A.relationalFormConfig),d=A=>c==null?void 0:c.find(j=>j.code===A),u=A=>!c||!!d(A),f=(A,j)=>{var F;return((F=d(A))==null?void 0:F.label)||j},[g,y]=h.useState(!0),b=((L=e.metadata)==null?void 0:L.relationalMetadata)??{},[p,v]=h.useState(b.name??e.name??""),[m,_]=h.useState(""),[S,w]=h.useState(Array.isArray(b.keywords)?b.keywords:Array.isArray((B=e.metadata)==null?void 0:B.keywords)?e.metadata.keywords:[]),[E,T]=h.useState(!!b.optional);h.useEffect(()=>{var j,F;const A=((j=e.metadata)==null?void 0:j.relationalMetadata)??{};v(A.name??e.name??""),w(Array.isArray(A.keywords)?A.keywords:Array.isArray((F=e.metadata)==null?void 0:F.keywords)?e.metadata.keywords:[]),T(!!A.optional)},[e.id]);const x=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},P=()=>{const A=m.trim();if(A&&!S.includes(A)){const j=[...S,A];w(j),s(e.id,{keywords:j}),i()}_("")},$=A=>{const j=S.filter(F=>F!==A);w(j),s(e.id,{keywords:j}),i()},k=A=>{T(A),s(e.id,{optional:A}),i()};return l.jsxs("div",{className:We.container,children:[l.jsxs("div",{className:We.panelHeader,children:[l.jsxs("div",{className:We.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:We.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:We.panelCollapseBtn,onClick:()=>y(A=>!A),"aria-expanded":g,"aria-label":g?"Collapse metadata panel":"Expand metadata panel",title:g?"Collapse":"Expand",children:g?l.jsx(hs,{size:15}):l.jsx(yv,{size:15})})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:We.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:We.icon}),l.jsx("input",{type:"text",className:We.nameInput,value:p,disabled:!o,onChange:A=>v(A.target.value),onBlur:x,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:We.field,children:[l.jsx("div",{className:We.fieldHeader,children:l.jsxs("label",{className:We.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:We.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:We.chips,children:S.map(A=>l.jsxs("span",{className:We.chip,children:[A,o&&l.jsx("button",{type:"button",className:We.chipRemove,onClick:()=>$(A),children:"×"})]},A))}),o&&l.jsxs("div",{className:We.keywordInput,children:[l.jsx("input",{type:"text",className:We.input,value:m,placeholder:"Add keyword and press Enter",onChange:A=>_(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),P())}}),l.jsx("button",{type:"button",className:We.addBtn,onClick:P,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:We.field,children:[l.jsx("label",{className:We.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:We.radioGroup,children:[l.jsxs("label",{className:We.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!0,onChange:()=>k(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:We.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:E===!1,onChange:()=>k(!1),disabled:!o}),"No"]})]})]})]}),n]})},Ls={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},MO=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=Le(),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(Wc,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:Ls.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Yo,{size:11})})]}),n&&l.jsx(Dh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Xt={leafContentLayout:"_leafContentLayout_1osey_1",container:"_container_1osey_17",emptyState:"_emptyState_1osey_26",titleRow:"_titleRow_1osey_36",nodeTitle:"_nodeTitle_1osey_52",formArea:"_formArea_1osey_74",contentListArea:"_contentListArea_1osey_78",dropZone:"_dropZone_1osey_83",reviewComment:"_reviewComment_1osey_90",reviewCommentLabel:"_reviewCommentLabel_1osey_103",reviewCommentText:"_reviewCommentText_1osey_109"},FO=["application/vnd.sunbird.questionset"],$O=({editorMode:e,onToolbarEvent:t})=>{var L,B,A,j;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,d]=h.useState(!1),u=h.useRef(null),f=h.useRef(),{selectedNodeId:g,breadcrumb:y,activeNodeMeta:b,updateNode:p,treeData:v}=Le(),m=oe(F=>{var Z,ae,be,Ee;return((ae=(Z=F.editorConfig)==null?void 0:Z.context)==null?void 0:ae.contentId)??((Ee=(be=F.editorConfig)==null?void 0:be.context)==null?void 0:Ee.identifier)??""}),_=g?zh(v,g):null,S=!!_&&!_.parent,w=!!(_!=null&&_.isFolder),E=_&&FO.includes(_.mimeType??""),T=_&&!_.isFolder&&!E&&!S,x=((L=_==null?void 0:_.metadata)==null?void 0:L.rejectComment)??(S?(A=(B=v[0])==null?void 0:B.metadata)==null?void 0:A.rejectComment:void 0),P=h.useCallback(()=>{const F=u.current;if(!F||!g)return;const Z=F.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(g,{name:Z})},600)},[g,p]),$=h.useCallback(F=>{t({action:"onFormValueChange",data:F})},[t]),k=h.useCallback((F,Z)=>{i(Z),t({action:"onFormStatusChange",data:{isValid:F,nodeId:g}})},[t,g]);return _?E?l.jsx(vl,{node:_,editorMode:e,type:"quml"}):T?l.jsxs("div",{className:Xt.leafContentLayout,children:[l.jsx(vl,{node:_,editorMode:e,type:"content"}),l.jsx(LO,{node:_,editorMode:e,onMoveClick:()=>a(_.identifier),reorderDialog:o?l.jsx(xO,{resourceId:o,resourceName:_.name,currentUnitId:_.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Xt.container,children:[l.jsx(P1,{crumbs:y}),x&&l.jsxs("div",{className:Xt.reviewComment,role:"alert",children:[l.jsx("span",{className:Xt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Xt.reviewCommentText,children:x})]}),l.jsxs("div",{className:Xt.titleRow,children:[S&&g&&l.jsx(MO,{nodeId:g,value:String(_.appIcon??((j=_.metadata)==null?void 0:j.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Xt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:P,onBlur:P,"data-placeholder":"Untitled","aria-label":"Node title",children:_.name})]}),l.jsx(L1,{activeTab:r,onChange:F=>n(F),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Xt.formArea,children:l.jsx(zE,{nodeMetadata:b,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:$,onFormStatusChange:k},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Xt.contentListArea,children:l.jsx(aO,{editorMode:e})}),l.jsx(lO,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Xt.dropZone}),c&&l.jsx(PO,{contentId:m,onClose:()=>d(!1)})]}):l.jsx("div",{className:Xt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function zh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=zh(r.children,t);if(n)return n}}}const Vh=mi((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})}})),jO=20;function qh(){var d;const e=oe(u=>u.editorConfig),t=Le(u=>u.selectedNodeId),r=Le(u=>u.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function u(f,g,y=0){var b;for(const p of f){if(p.id===g)return y;if((b=p.children)!=null&&b.length){const v=u(p.children,g,y+1);if(v>=0)return v}}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[...qf];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:[...qf]}function BO(){const e=Vh(),t=oe(f=>{var g,y;return((y=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:y.channel)??""}),r=qh(),n=h.useRef(),s=h.useCallback(async(f="",g="all",y={},b=!0,p=!1)=>{var v,m,_,S,w;e.setLoading(!0);try{const E={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(v=y==null?void 0:y.board)!=null&&v.length&&(E.board=y.board),(m=y==null?void 0:y.medium)!=null&&m.length&&(E.medium=y.medium),(_=y==null?void 0:y.gradeLevel)!=null&&_.length&&(E.gradeLevel=y.gradeLevel),(S=y==null?void 0:y.subject)!=null&&S.length&&(E.subject=y.subject),(w=y==null?void 0:y.primaryCategory)!=null&&w.length&&(E.primaryCategory=y.primaryCategory);const T=b?0:e.offset,{content:x,count:P}=await cO({filters:E,query:f,limit:f?50:jO,offset:T,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});b?e.setContent(x,P):e.appendContent(x,P)}catch(E){console.error("[useLibrary] load error:",E)}finally{e.setLoading(!1)}},[r,t]);h.useEffect(()=>{s()},[t]);const i=h.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=h.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=h.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=h.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=h.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 sr={card:"_card_jzciw_1",addBtn:"_addBtn_jzciw_17",dragging:"_dragging_jzciw_24",ctIcon:"_ctIcon_jzciw_29",info:"_info_jzciw_33",name:"_name_jzciw_41",meta:"_meta_jzciw_50",addBtnMuted:"_addBtnMuted_jzciw_78",added:"_added_jzciw_87",addedBadge:"_addedBadge_jzciw_96"},UO={video:Ro,pdf:Ho,h5p:Wo,scorm:Qo,audio:Ko,quiz:Vo,default:mn},zO=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=Yi(e),o=UO[i.key]??mn,a=Xa(),c=w1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:y}=Fc({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),b=()=>{r&&r(e)};return l.jsxs("div",{ref:g,className:[sr.card,y?sr.dragging:"",s?sr.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:b,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,sr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:sr.info,children:[l.jsx("span",{className:sr.name,title:e.name,children:e.name}),l.jsxs("span",{className:sr.meta,children:[((p=e.organisation)==null?void 0:p[0])??e.channel??"",(v=e.organisation)!=null&&v[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:sr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(vn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[sr.addBtn,!d&&a?sr.addBtnMuted:""].join(" "),onClick:m=>{m.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(ps,{size:14})})]})},Hh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},VO=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Hh.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",Hh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),st={panel:"_panel_1cl11_1",header:"_header_1cl11_10",headerTitle:"_headerTitle_1cl11_19",closeBtn:"_closeBtn_1cl11_25",body:"_body_1cl11_43",section:"_section_1cl11_59",sectionLabel:"_sectionLabel_1cl11_65",chips:"_chips_1cl11_73",chip:"_chip_1cl11_73",active:"_active_1cl11_96",footer:"_footer_1cl11_102",resetBtn:"_resetBtn_1cl11_112",applyBtn:"_applyBtn_1cl11_129"},qO=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],HO=new Set(["board","medium","gradeLevel","subject","topic"]),WO=({local:e,toggle:t})=>{const r=qh();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},KO=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var p,v;const s=oe(m=>m.editorConfig),i=oe(m=>m.searchFormConfig),o=oe(m=>m.contentFramework),a=oe(m=>m.contentTargetFWIds),{organisationFramework:c}=bh(o??((p=s==null?void 0:s.context)==null?void 0:p.framework),a??((v=s==null?void 0:s.context)==null?void 0:v.targetFWIds)),[d,u]=h.useState(t),f=i!=null&&i.length?i.filter(m=>HO.has(m.code)).map(m=>({key:m.code,label:m.label||m.code})):qO;h.useEffect(()=>{u(t)},[t]);const g=(m,_)=>{u(S=>{const w=S[m]??[],E=w.includes(_)?w.filter(T=>T!==_):[...w,_];return{...S,[m]:E}})},y=(c==null?void 0:c.categories)??[],b=m=>{var _;return((_=y.find(S=>S.code===m))==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(zr,{size:16})})]}),l.jsxs("div",{className:st.body,children:[f.map(({key:m,label:_})=>{const S=b(m);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[m]??[]).includes(w.name)?st.active:""].join(" "),onClick:()=>g(m,w.name),children:w.name},w.identifier))})]},m):null}),l.jsx(WO,{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},fr={header:"_header_6qdpu_10",title:"_title_6qdpu_20",headerActions:"_headerActions_6qdpu_31",iconBtn:"_iconBtn_6qdpu_38",playerArea:"_playerArea_6qdpu_56",footer:"_footer_6qdpu_64",addBtn:"_addBtn_6qdpu_73",modalOverlay:"_modalOverlay_6qdpu_92",modalPanel:"_modalPanel_6qdpu_103"},QO=({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 Pe.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(zr,{size:16})})})]}),l.jsx("div",{className:fr.playerArea,children:l.jsx(vl,{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)},Ve={dock:"_dock_1lpg0_1",header:"_header_1lpg0_8",headerLeft:"_headerLeft_1lpg0_17",headerTitle:"_headerTitle_1lpg0_24",count:"_count_1lpg0_30",searchRow:"_searchRow_1lpg0_39",searchWrap:"_searchWrap_1lpg0_47",searchIcon:"_searchIcon_1lpg0_53",searchInput:"_searchInput_1lpg0_62",filterToggleBtn:"_filterToggleBtn_1lpg0_80",filterToggleBtnActive:"_filterToggleBtnActive_1lpg0_99",filterBadge:"_filterBadge_1lpg0_105",filters:"_filters_1lpg0_124",mainArea:"_mainArea_1lpg0_134",sidePanelOverlay:"_sidePanelOverlay_1lpg0_143",cardList:"_cardList_1lpg0_152",skeleton:"_skeleton_1lpg0_168",skeletonIcon:"_skeletonIcon_1lpg0_178",skeletonText:"_skeletonText_1lpg0_186",skeletonLine:"_skeletonLine_1lpg0_193",skeletonLineSm:"_skeletonLineSm_1lpg0_200",loadMoreBtn:"_loadMoreBtn_1lpg0_215",emptyState:"_emptyState_1lpg0_240",collapseBtn:"_collapseBtn_1lpg0_260"};function GO(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 YO=({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:y,loadMore:b}=BO(),{addResource:p,selectedNodeId:v,treeData:m}=Le(),_=e==="edit",[S,w]=h.useState(!1),[E,T]=h.useState({}),[x,P]=h.useState(null),$=h.useMemo(()=>GO(m),[m]),k=h.useCallback(F=>{var be;if(!v){De.error("Select a unit first");return}const Z=(be=m[0])==null?void 0:be.id;if(v===Z){De("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(p(F,v)===!1){De.error(`"${F.name}" is already in this collection`);return}De.success(`Added "${F.name}"`)},[v,p,m]),L=h.useCallback(F=>{T(F),g(F)},[g]),B=h.useCallback(F=>{P(F)},[]),A=h.useCallback(F=>{k(F),P(null)},[k]),j=h.useMemo(()=>Object.values(E).reduce((F,Z)=>F+((Z==null?void 0:Z.length)??0),0),[E]);return l.jsxs("div",{className:Ve.dock,children:[l.jsx("div",{className:Ve.header,children:l.jsxs("div",{className:Ve.headerLeft,children:[l.jsx("button",{type:"button",className:Ve.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(Ov,{size:15})}),l.jsx(Sv,{size:16}),l.jsx("span",{className:Ve.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ve.count,children:i})]})}),l.jsxs("div",{className:Ve.searchRow,children:[l.jsxs("div",{className:Ve.searchWrap,children:[l.jsx(Go,{size:14,className:Ve.searchIcon}),l.jsx("input",{type:"search",className:Ve.searchInput,placeholder:"Search content…",value:a,onChange:F=>u(F.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ve.filterToggleBtn,c?Ve.filterToggleBtnActive:""].join(" "),onClick:y,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(pv,{size:15}):l.jsx(vv,{size:15})}),l.jsxs("button",{type:"button",className:[Ve.filterToggleBtn,S?Ve.filterToggleBtnActive:""].join(" "),onClick:()=>w(F=>!F),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(xv,{size:15}),j>0&&l.jsx("span",{className:Ve.filterBadge,children:j})]})]}),l.jsx("div",{className:Ve.filters,children:l.jsx(VO,{filters:S1,active:o,onChange:f})}),l.jsxs("div",{className:Ve.mainArea,children:[l.jsx("div",{className:Ve.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((F,Z)=>l.jsxs("div",{className:Ve.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ve.skeletonIcon}),l.jsxs("div",{className:Ve.skeletonText,children:[l.jsx("div",{className:Ve.skeletonLine}),l.jsx("div",{className:Ve.skeletonLineSm})]})]},Z)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(F=>l.jsx(zO,{item:F,onAdd:k,onPreview:B,isDraggable:_,isAdded:$.has(F.identifier)},F.identifier)),d&&l.jsx("button",{type:"button",className:Ve.loadMoreBtn,onClick:b,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ve.emptyState,children:[l.jsx(Go,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:Ve.sidePanelOverlay,children:l.jsx(KO,{isOpen:S,filters:E,onApply:L,onClose:()=>w(!1)})}),x&&l.jsx(QO,{content:x,onAdd:A,onClose:()=>P(null)})]})]})};function RO(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,y=!1){const b={};for(const[p,v]of Object.entries(g))if(!i.has(p)&&!(y&&o.has(p)))if(a.has(p))Array.isArray(v)?b[p]=v:v!=null&&v!==""?b[p]=[v]:b[p]=[];else if(c.has(p)){const m=Number(v);isNaN(m)||(b[p]=m)}else b[p]=v;return b}function u(g){var b;const y={};for(const p of g.children??[]){if(p.isFolder)continue;const v=t[p.identifier];if(!v)continue;const{isNew:m,..._}=v;if(Object.keys(_).length===0)continue;const S=((b=p.metadata)==null?void 0:b.relationalMetadata)??{};y[p.identifier]={name:p.name,...S,..._}}return y}function f(g,y){var S,w;const b=g.identifier,p=t[b],v=b.startsWith("temp-")||!!(p!=null&&p.isNew),m=!g.isFolder&&!y;if(y||v||p&&!m){let E;if(v)E={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(y){const{isNew:T,...x}=p??{};E={...d(g.metadata??{},!0),...d(x,!1),name:g.name}}else{const{isNew:T,...x}=p??{};E={name:g.name,visibility:"Parent",...d(x,!0)}}n[b]={metadata:E,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:y,isNew:v}}const _=g.isFolder?u(g):{};s[b]={name:g.name,children:(g.children??[]).map(E=>E.identifier),...Object.keys(_).length>0?{relationalMetadata:_}:{},root:y},(g.children??[]).forEach(E=>f(E,!1))}return e.forEach((g,y)=>f(g,y===0)),{nodesModified:n,hierarchy:s}}function XO(){const[e,t]=h.useState(!1),r=Le(u=>u.treeCache),n=Le(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:h.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:y,hierarchy:b}=RO(n,r,f),{identifiers:p}=await Gb(u,y,b,g);p&&Object.keys(p).length>0&&Le.getState().replaceNodeIds(p);const v=new Date().toISOString();a(v),o(!1)}catch(y){console.error("[useSaveHierarchy] save failed:",y),De.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}function ZO(e){const t=oe(o=>o.editorConfig),r=oe(o=>o.setButtonLoader),n=oe(o=>o.validateAllForms),s=Le(o=>o.treeData);return{runAction:h.useCallback(async(o,a)=>{var u,f,g,y;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 De.error("No content identifier found."),!1;const d=((g=t==null?void 0:t.context)==null?void 0:g.userId)??((y=t==null?void 0:t.context)==null?void 0:y.uid)??"";try{switch(o){case"sendForReview":return n(s)?(r("saveCollection",!0),await e(),await Xb(c),De.success("Content sent for review"),!0):(De.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 Zb(c,b),De.success("Content rejected and sent back to the author"),!0}case"publish":return n(s)?(r("publishCollection",!0),await e(),await Yb(c,d),De.success("Content published successfully"),!0):(De.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 p=o==="sendForReview"?"send for review":o==="reject"?"reject":"publish";return De.error(`Failed to ${p}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const Mt={shell:"_shell_90fon_1",workspace:"_workspace_90fon_8",sidebarCollapsed:"_sidebarCollapsed_90fon_16",dockCollapsed:"_dockCollapsed_90fon_19",dock:"_dock_90fon_19",outline:"_outline_90fon_40",reopenTab:"_reopenTab_90fon_45",outlineHidden:"_outlineHidden_90fon_79",editor:"_editor_90fon_86",dockHidden:"_dockHidden_90fon_101",dockReopenTab:"_dockReopenTab_90fon_108",dragChip:"_dragChip_90fon_133",dragChipLabel:"_dragChipLabel_90fon_148"},JO=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,d]=h.useState(!1),[u,f]=h.useState(!1),{addResource:g,treeData:y}=Le(),b=oe(A=>A.setFormStatus),[p,v]=h.useState(!0),m=Le(A=>A.selectedNodeId),{save:_,isSaving:S,isDirty:w,lastSaved:E}=XO(),{runAction:T}=ZO(_);h.useEffect(()=>{if(!w)return;const A=j=>{j.preventDefault(),j.returnValue=""};return window.addEventListener("beforeunload",A),()=>window.removeEventListener("beforeunload",A)},[w]);const x=sc(xo(di,{activationConstraint:{distance:8}})),P=h.useCallback(A=>{var F;const j=(F=A.active.data.current)==null?void 0:F.item;j&&i(j)},[]),$=h.useCallback(A=>{var Ee,pe;i(null);const j=(Ee=A.active.data.current)==null?void 0:Ee.item;if(!j)return;const F=A.over,Z=(F==null?void 0:F.id)??m??void 0;if(!Z){De.error("Drop onto a unit to add content");return}const ae=(pe=y[0])==null?void 0:pe.id;if(Z===ae){De.error("Drop content onto a unit, not directly on the course.");return}if(!g(j,Z)){De.error(`"${j.name}" is already in this collection`);return}r==null||r(j,Z),De.success(`Added "${j.name}" to unit`)},[m,g,r]),k=h.useCallback(async A=>{if(A.action==="onFormStatusChange"){const{isValid:j,nodeId:F}=A.data??{},Z=j!==!1;v(Z),F&&b(F,Z);return}if(A.action==="back"&&w){f(!0);return}if(A.action==="saveCollection"){if(!p){De.error("Please fill the required metadata");return}await _(),n==null||n(y),t==null||t(A);return}if(A.action==="sendForReview"||A.action==="reject"||A.action==="publish"){await T(A.action,A.data)&&(t==null||t(A));return}t==null||t(A)},[_,T,t,n,y,w,p]),L=h.useCallback(async()=>{await _(),f(!1),n==null||n(y),t==null||t({action:"back"})},[_,n,t,y]),B=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Lc,{sensors:x,onDragStart:P,onDragEnd:$,children:[l.jsxs("div",{className:Mt.shell,children:[l.jsx(l_,{editorMode:e,isSaving:S,isDirty:w,lastSaved:E,isFormValid:p,onToolbarEvent:k}),l.jsxs("div",{className:[Mt.workspace,o?Mt.sidebarCollapsed:"",c?Mt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Mt.outline,o?Mt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(A1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(A=>!A)})}),o&&l.jsx("button",{className:Mt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Mt.editor,role:"main","aria-label":"Content editor",children:l.jsx($O,{editorMode:e,onToolbarEvent:k})}),l.jsx("aside",{className:[Mt.dock,c?Mt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(YO,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(A=>!A)})}),c&&l.jsx("button",{className:Mt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(cv,{dropAnimation:null,children:s?l.jsx("div",{className:Mt.dragChip,children:l.jsx("span",{className:Mt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(c_,{onSave:L,onDiscard:B,onCancel:()=>f(!1),isSaving:S})]})},eD="v1";function tD(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 Wh(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:tD(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 Nr(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(Wh(o,s))}else n.code&&r.push(Wh(n));return r}function rD(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 nD(e,t,r="Collection",n=eD){var d,u;const i=(u=(d=(await xe.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:Nr(o.create),unitForm:Nr(o.unitMetadata),childForm:Nr(o.childMetadata),searchForm:Nr(o.search??o.searchConfig),relationalForm:Nr(o.relationalMetadata),publishChecklist:Nr(o.publishchecklist),reviewChecklist:Nr(o.review),rfcChecklist:Nr(o.requestforchangeschecklist),schemaDefaults:rD(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function sD({config:e,onError:t}){const[r,n]=h.useState(!0),[s,i]=h.useState(null),[o,a]=h.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u,setContentFramework:f}=oe(),{setTreeData:g,selectNode:y}=Le();return h.useEffect(()=>{let b=!1;async function p(){var v,m;try{n(!0),i(null),e.apiBaseUrl&&Gu(e.apiBaseUrl),c(e),d(e.config.mode);const _=e.context.contentId??e.context.identifier??"";if(_){const{rootNode:S}=await Xu(_);if(!b&&(g(S?[S]:[]),S)){y(S.id);const P=S.metadata??{},$=P.framework??e.context.framework??null,k=P.targetFWIds??e.context.targetFWIds??null;f($,k)}const w=e.config.primaryCategory??"Course",E=e.context.channel??"",T=e.config.categoryDefinitionApiVersion??"v1";try{const x=await nD(w,E,e.config.objectType??"Collection",T);if(!b){u(x);const P=((v=x.sourcingSettings)==null?void 0:v.collection)??{},$={};P.maxDepth&&!e.config.maxDepth&&($.maxDepth=P.maxDepth),P.children&&!e.config.children&&($.children=P.children),P.hierarchy&&!((m=e.config.hierarchy)!=null&&m.level1)&&($.hierarchy={...e.config.hierarchy??{},...P.hierarchy}),Object.keys($).length>0&&c({...e,config:{...e.config,...$}})}}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 p(),()=>{b=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Ms={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},iD=new Mp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class oD extends h.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:Ms.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 aD(e){const{isLoading:t,error:r}=sD({config:e,onError:e.onError}),n=oe(s=>s.editorMode);return t?l.jsxs("div",{className:Ms.loadingState,children:[l.jsx("div",{className:Ms.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:Ms.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${Ms.root}`,children:l.jsx(JO,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Kh=e=>l.jsx(oD,{onError:e.onError,children:l.jsxs($p,{client:iD,children:[l.jsx(aD,{...e}),l.jsx(Fg,{position:"top-right",toastOptions:{duration:3e3}})]})}),lo=Symbol.for("r2wc.reactRender"),Qh=Symbol.for("r2wc.shouldRender"),co=Symbol.for("r2wc.root");function lD(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function cD(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Gh={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[lo]()}}),e[lo]()}};function uD(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&&Gh.expando(g,u,f),Reflect.set(d,u,f,g)):(Gh.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[Qh]=!0,this[lo]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[co].unmount():r.unmountComponentAtNode(this)},a[lo]=function(){if(this[Qh]===!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[co]||(this[co]=r.createRoot(u)),this[co].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return lD(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?cD(d):d;this[g]=f}),o}var Fs={},$s=Pe;if(process.env.NODE_ENV==="production")Fs.createRoot=$s.createRoot,Fs.hydrateRoot=$s.hydrateRoot;else{var uo=$s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Fs.createRoot=function(e,t){uo.usingClientEntryPoint=!0;try{return $s.createRoot(e,t)}finally{uo.usingClientEntryPoint=!1}},Fs.hydrateRoot=function(e,t,r){uo.usingClientEntryPoint=!0;try{return $s.hydrateRoot(e,t,r)}finally{uo.usingClientEntryPoint=!1}}}function dD(){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 fD(e="sb-collection-editor"){if(dD(),typeof customElements>"u"||customElements.get(e))return;const t=uD(Kh,h,Fs,{});customElements.define(e,t)}ye.CollectionEditor=Kh,ye.registerCollectionEditor=fD,ye.setApiBaseUrl=Gu,ye.useEditorStore=oe,ye.useLibraryStore=Vh,ye.useTreeStore=Le,Object.defineProperty(ye,Symbol.toStringTag,{value:"Module"})});