@project-sunbird/collection-editor-react 0.1.6 → 0.1.7

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(pe,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):(pe=typeof globalThis<"u"?globalThis:pe||self,h(pe.CollectionEditorReact={},pe.React,pe.ReactDOM,pe.jsxRuntime))})(this,function(pe,h,Le,l){"use strict";var Gh=pe=>{throw TypeError(pe)};var cl=(pe,h,Le)=>h.has(pe)||Gh("Cannot "+Le);var O=(pe,h,Le)=>(cl(pe,h,"read from private field"),Le?Le.call(pe):h.get(pe)),ne=(pe,h,Le)=>h.has(pe)?Gh("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(pe):h.set(pe,Le),Y=(pe,h,Le,l)=>(cl(pe,h,"write to private field"),l?l.call(pe,Le):h.set(pe,Le),Le),he=(pe,h,Le)=>(cl(pe,h,"access private method"),Le);var no=(pe,h,Le,l)=>({set _(so){Y(pe,h,so,Le)},get _(){return O(pe,h,l)}});var Rr,Ir,Pn,Fh,nr,Xr,$h,Mn,Tr,Ln,jh,Zr,Bh,Fn,Jr,$n,Ut,en,Je,As,tn,Pt,Qh,yr,Vh,Dt,ye,Ps,_t,rn,jn,fr,Nr,Ms,Bn,Vn,nn,sn,xr,Un,we,Us,ul,dl,fl,hl,pl,gl,yl,Yh,Uh,Ls,sr,gt,on,ir,Fr,zh,hr,Xt,Fs,qh,or,Hh,ze,kr,Ar,zn,qn,Pr,Hn,Wn,Wh;function so(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 _e=so(h);var Gn=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(){}},Zh=(Fh=class extends Gn{constructor(){super();ne(this,Rr);ne(this,Ir);ne(this,Pn);Y(this,Pn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Ir)||this.setEventListener(O(this,Pn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Ir))==null||t.call(this),Y(this,Ir,void 0))}setEventListener(t){var r;Y(this,Pn,t),(r=O(this,Ir))==null||r.call(this),Y(this,Ir,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,Rr)!==t&&(Y(this,Rr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,Rr)=="boolean"?O(this,Rr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Rr=new WeakMap,Ir=new WeakMap,Pn=new WeakMap,Fh),io=new Zh,Jh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ep=($h=class{constructor(){ne(this,nr,Jh);ne(this,Xr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,Xr)&&e!==O(this,nr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,nr),provider:e}),Y(this,nr,e),process.env.NODE_ENV!=="production"&&Y(this,Xr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),O(this,nr).setTimeout(e,t)}clearTimeout(e){O(this,nr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),O(this,nr).setInterval(e,t)}clearInterval(e){O(this,nr).clearInterval(e)}},nr=new WeakMap,Xr=new WeakMap,$h),$r=new ep;function tp(e){setTimeout(e,0)}var rp=typeof window>"u"||"Deno"in globalThis;function St(){}function np(e,t){return typeof e=="function"?e(t):e}function oo(e){return typeof e=="number"&&e>=0&&e!==1/0}function vl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function vr(e,t){return typeof e=="function"?e(t):e}function Nt(e,t){return typeof e=="function"?e(t):e}function ml(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==ao(o,t.options))return!1}else if(!Yn(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 bl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Qn(t.options.mutationKey)!==Qn(i))return!1}else if(!Yn(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function ao(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qn)(e)}function Qn(e){return JSON.stringify(e,(t,r)=>uo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Yn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Yn(e[r],t[r])):!1}var sp=Object.prototype.hasOwnProperty;function lo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=_l(e)&&_l(t);if(!n&&!(uo(e)&&uo(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 u=0;for(let d=0;d<a;d++){const f=n?d:o[d],y=e[f],g=t[f];if(y===g){c[f]=y,(n?d<i:sp.call(e,f))&&u++;continue}if(y===null||g===null||typeof y!="object"||typeof g!="object"){c[f]=g;continue}const _=lo(y,g,r+1);c[f]=_,_===y&&u++}return i===a&&u===i?e:c}function co(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 _l(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function uo(e){if(!wl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!wl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wl(e){return Object.prototype.toString.call(e)==="[object Object]"}function ip(e){return new Promise(t=>{$r.setTimeout(t,e)})}function fo(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 lo(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 lo(e,t)}return t}function op(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function ap(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var zs=Symbol();function Sl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===zs&&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===zs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Cl(e,t){return typeof e=="function"?e(...t):!!e}function lp(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 Rn=(()=>{let e=()=>rp;return{isServer(){return e()},setIsServer(t){e=t}}})();function ho(){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 cp=tp;function up(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=cp;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 rt=up(),dp=(jh=class extends Gn{constructor(){super();ne(this,Mn,!0);ne(this,Tr);ne(this,Ln);Y(this,Ln,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,Tr)||this.setEventListener(O(this,Ln))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Tr))==null||t.call(this),Y(this,Tr,void 0))}setEventListener(t){var r;Y(this,Ln,t),(r=O(this,Tr))==null||r.call(this),Y(this,Tr,t(this.setOnline.bind(this)))}setOnline(t){O(this,Mn)!==t&&(Y(this,Mn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,Mn)}},Mn=new WeakMap,Tr=new WeakMap,Ln=new WeakMap,jh),qs=new dp;function fp(e){return Math.min(1e3*2**e,3e4)}function El(e){return(e??"online")==="online"?qs.isOnline():!0}var po=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ol(e){let t=!1,r=0,n;const s=ho(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new po(p);y(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>io.isFocused()&&(e.networkMode==="always"||qs.isOnline())&&e.canRun(),d=()=>El(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},y=p=>{i()||(n==null||n(),s.reject(p))},g=()=>new Promise(p=>{var v;n=m=>{(i()||u())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),_=()=>{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 D;if(i())return;const b=e.retry??(Rn.isServer()?0:3),S=e.retryDelay??fp,w=typeof S=="function"?S(r,m):S,C=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,m);if(t||!C){y(m);return}r++,(D=e.onFail)==null||D.call(e,r,m),ip(w).then(()=>u()?void 0:g()).then(()=>{t?y(m):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?_():g().then(_),s)}}var Dl=(Bh=class{constructor(){ne(this,Zr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),oo(this.gcTime)&&Y(this,Zr,$r.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Rn.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,Zr)!==void 0&&($r.clearTimeout(O(this,Zr)),Y(this,Zr,void 0))}},Zr=new WeakMap,Bh);function hp(e){return{onFetch:(t,r)=>{var d,f,y,g,_;const n=t.options,s=(y=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:y.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const v=S=>{lp(S,()=>t.signal,()=>p=!0)},m=Sl(t.options,t.fetchOptions),b=async(S,w,C)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const x=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return v(P),P})(),A=await m(x),{maxPages:F}=t.options,k=C?ap:op;return{pages:k(S.pages,A,F),pageParams:k(S.pageParams,w,F)}};if(s&&i.length){const S=s==="backward",w=S?pp:Il,C={pages:i,pageParams:o},D=w(n,C);a=await b(C,D,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Il(n,a);if(c>0&&w==null)break;a=await b(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,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function Il(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 pp(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 gp=(Vh=class extends Dl{constructor(t){super();ne(this,Pt);ne(this,Fn);ne(this,Jr);ne(this,$n);ne(this,Ut);ne(this,en);ne(this,Je);ne(this,As);ne(this,tn);Y(this,tn,!1),Y(this,As,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,en,t.client),Y(this,Ut,O(this,en).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,Jr,xl(this.options)),this.state=t.state??O(this,Jr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,Fn)}get promise(){var t;return(t=O(this,Je))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,As),...t},t!=null&&t._type&&Y(this,Fn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=xl(this.options);r.data!==void 0&&(this.setState(Nl(r.data,r.dataUpdatedAt)),Y(this,Jr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Ut).remove(this)}setData(t,r){const n=fo(this.state.data,t,this.options);return he(this,Pt,yr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){he(this,Pt,yr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,Je))==null?void 0:n.promise;return(s=O(this,Je))==null||s.cancel(t),r?r.then(St).catch(St):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,Jr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Nt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>vr(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:!vl(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Je))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Je))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Ut).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,Je)&&(O(this,tn)||he(this,Pt,Qh).call(this)?O(this,Je).cancel({revert:!0}):O(this,Je).cancelRetry()),this.scheduleGc()),O(this,Ut).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Pt,yr).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,y,g,_,p,v,m,b,S;if(this.state.fetchStatus!=="idle"&&((u=O(this,Je))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,Je))return O(this,Je).continueRetry(),O(this,Je).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(Y(this,tn,!0),n.signal)})},i=()=>{const w=Sl(this.options,r),D=(()=>{const x={client:O(this,en),queryKey:this.queryKey,meta:this.meta};return s(x),x})();return Y(this,tn,!1),this.options.persister?this.options.persister(w,D,this):w(D)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:O(this,en),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,Fn)==="infinite"?hp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),Y(this,$n,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&he(this,Pt,yr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,Je,Ol({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof po&&w.revert&&this.setState({...O(this,$n),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{he(this,Pt,yr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{he(this,Pt,yr).call(this,{type:"pause"})},onContinue:()=>{he(this,Pt,yr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,Je).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),(g=(y=O(this,Ut).config).onSuccess)==null||g.call(y,w,this),(p=(_=O(this,Ut).config).onSettled)==null||p.call(_,w,this.state.error,this),w}catch(w){if(w instanceof po){if(w.silent)return O(this,Je).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,Pt,yr).call(this,{type:"error",error:w}),(m=(v=O(this,Ut).config).onError)==null||m.call(v,w,this),(S=(b=O(this,Ut).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Fn=new WeakMap,Jr=new WeakMap,$n=new WeakMap,Ut=new WeakMap,en=new WeakMap,Je=new WeakMap,As=new WeakMap,tn=new WeakMap,Pt=new WeakSet,Qh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},yr=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,...Tl(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Nl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,$n,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),rt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,Ut).notify({query:this,type:"updated",action:t})})},Vh);function Tl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:El(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Nl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function xl(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 yp=(Uh=class extends Gn{constructor(t,r){super();ne(this,we);ne(this,Dt);ne(this,ye);ne(this,Ps);ne(this,_t);ne(this,rn);ne(this,jn);ne(this,fr);ne(this,Nr);ne(this,Ms);ne(this,Bn);ne(this,Vn);ne(this,nn);ne(this,sn);ne(this,xr);ne(this,Un,new Set);this.options=r,Y(this,Dt,t),Y(this,Nr,null),Y(this,fr,ho()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ye).addObserver(this),kl(O(this,ye),this.options)?he(this,we,Us).call(this):this.updateResult(),he(this,we,hl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return go(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return go(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,we,pl).call(this),he(this,we,gl).call(this),O(this,ye).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,ye);if(this.options=O(this,Dt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Nt(this.options.enabled,O(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,we,yl).call(this),O(this,ye).setOptions(this.options),r._defaulted&&!co(this.options,r)&&O(this,Dt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const s=this.hasListeners();s&&Al(O(this,ye),n,this.options,r)&&he(this,we,Us).call(this),this.updateResult(),s&&(O(this,ye)!==n||Nt(this.options.enabled,O(this,ye))!==Nt(r.enabled,O(this,ye))||vr(this.options.staleTime,O(this,ye))!==vr(r.staleTime,O(this,ye)))&&he(this,we,ul).call(this);const i=he(this,we,dl).call(this);s&&(O(this,ye)!==n||Nt(this.options.enabled,O(this,ye))!==Nt(r.enabled,O(this,ye))||i!==O(this,xr))&&he(this,we,fl).call(this,i)}getOptimisticResult(t){const r=O(this,Dt).getQueryCache().build(O(this,Dt),t),n=this.createResult(r,t);return mp(this,n)&&(Y(this,_t,n),Y(this,jn,this.options),Y(this,rn,O(this,ye).state)),n}getCurrentResult(){return O(this,_t)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&O(this,fr).status==="pending"&&O(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){O(this,Un).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,Dt).defaultQueryOptions(t),n=O(this,Dt).getQueryCache().build(O(this,Dt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return he(this,we,Us).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,_t)))}createResult(t,r){var F;const n=O(this,ye),s=this.options,i=O(this,_t),o=O(this,rn),a=O(this,jn),u=t!==n?t.state:O(this,Ps),{state:d}=t;let f={...d},y=!1,g;if(r._optimisticResults){const k=this.hasListeners(),P=!k&&kl(t,r),z=k&&Al(t,n,r,s);(P||z)&&(f={...f,...Tl(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:p,status:v}=f;g=f.data;let m=!1;if(r.placeholderData!==void 0&&g===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((F=O(this,Vn))==null?void 0:F.state.data,O(this,Vn)):r.placeholderData,k!==void 0&&(v="success",g=fo(i==null?void 0:i.data,k,r),y=!0)}if(r.select&&g!==void 0&&!m)if(i&&g===(o==null?void 0:o.data)&&r.select===O(this,Ms))g=O(this,Bn);else try{Y(this,Ms,r.select),g=r.select(g),g=fo(i==null?void 0:i.data,g,r),Y(this,Bn,g),Y(this,Nr,null)}catch(k){Y(this,Nr,k)}O(this,Nr)&&(_=O(this,Nr),g=O(this,Bn),p=Date.now(),v="error");const b=f.fetchStatus==="fetching",S=v==="pending",w=v==="error",C=S&&b,D=g!==void 0,A={status:v,fetchStatus:f.fetchStatus,isPending:S,isSuccess:v==="success",isError:w,isInitialLoading:C,isLoading:C,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:w&&!D,isPaused:f.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:w&&D,isStale:yo(t,r),refetch:this.refetch,promise:O(this,fr),isEnabled:Nt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=A.data!==void 0,P=A.status==="error"&&!k,z=$=>{P?$.reject(A.error):k&&$.resolve(A.data)},M=()=>{const $=Y(this,fr,A.promise=ho());z($)},H=O(this,fr);switch(H.status){case"pending":t.queryHash===n.queryHash&&z(H);break;case"fulfilled":(P||A.data!==H.value)&&M();break;case"rejected":(!P||A.error!==H.reason)&&M();break}}return A}updateResult(){const t=O(this,_t),r=this.createResult(O(this,ye),this.options);if(Y(this,rn,O(this,ye).state),Y(this,jn,this.options),O(this,rn).data!==void 0&&Y(this,Vn,O(this,ye)),co(r,t))return;Y(this,_t,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,Un).size)return!0;const o=new Set(i??O(this,Un));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,_t)).some(a=>{const c=a;return O(this,_t)[c]!==t[c]&&o.has(c)})};he(this,we,Yh).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,we,hl).call(this)}},Dt=new WeakMap,ye=new WeakMap,Ps=new WeakMap,_t=new WeakMap,rn=new WeakMap,jn=new WeakMap,fr=new WeakMap,Nr=new WeakMap,Ms=new WeakMap,Bn=new WeakMap,Vn=new WeakMap,nn=new WeakMap,sn=new WeakMap,xr=new WeakMap,Un=new WeakMap,we=new WeakSet,Us=function(t){he(this,we,yl).call(this);let r=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(St)),r},ul=function(){he(this,we,pl).call(this);const t=vr(this.options.staleTime,O(this,ye));if(Rn.isServer()||O(this,_t).isStale||!oo(t))return;const n=vl(O(this,_t).dataUpdatedAt,t)+1;Y(this,nn,$r.setTimeout(()=>{O(this,_t).isStale||this.updateResult()},n))},dl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},fl=function(t){he(this,we,gl).call(this),Y(this,xr,t),!(Rn.isServer()||Nt(this.options.enabled,O(this,ye))===!1||!oo(O(this,xr))||O(this,xr)===0)&&Y(this,sn,$r.setInterval(()=>{(this.options.refetchIntervalInBackground||io.isFocused())&&he(this,we,Us).call(this)},O(this,xr)))},hl=function(){he(this,we,ul).call(this),he(this,we,fl).call(this,he(this,we,dl).call(this))},pl=function(){O(this,nn)!==void 0&&($r.clearTimeout(O(this,nn)),Y(this,nn,void 0))},gl=function(){O(this,sn)!==void 0&&($r.clearInterval(O(this,sn)),Y(this,sn,void 0))},yl=function(){const t=O(this,Dt).getQueryCache().build(O(this,Dt),this.options);if(t===O(this,ye))return;const r=O(this,ye);Y(this,ye,t),Y(this,Ps,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Yh=function(t){rt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,_t))}),O(this,Dt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},Uh);function vp(e,t){return Nt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Nt(t.retryOnMount,e)===!1)}function kl(e,t){return vp(e,t)||e.state.data!==void 0&&go(e,t,t.refetchOnMount)}function go(e,t,r){if(Nt(t.enabled,e)!==!1&&vr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&yo(e,t)}return!1}function Al(e,t,r,n){return(e!==t||Nt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&yo(e,r)}function yo(e,t){return Nt(t.enabled,e)!==!1&&e.isStaleByTime(vr(t.staleTime,e))}function mp(e,t){return!co(e.getCurrentResult(),t)}var bp=(zh=class extends Dl{constructor(t){super();ne(this,ir);ne(this,Ls);ne(this,sr);ne(this,gt);ne(this,on);Y(this,Ls,t.client),this.mutationId=t.mutationId,Y(this,gt,t.mutationCache),Y(this,sr,[]),this.state=t.state||_p(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,sr).includes(t)||(O(this,sr).push(t),this.clearGcTimeout(),O(this,gt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,sr,O(this,sr).filter(r=>r!==t)),this.scheduleGc(),O(this,gt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,sr).length||(this.state.status==="pending"?this.scheduleGc():O(this,gt).remove(this))}continue(){var t;return((t=O(this,on))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,f,y,g,_,p,v,m,b,S,w,C,D,x;const r=()=>{he(this,ir,Fr).call(this,{type:"continue"})},n={client:O(this,Ls),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,on,Ol({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(A,F)=>{he(this,ir,Fr).call(this,{type:"failed",failureCount:A,error:F})},onPause:()=>{he(this,ir,Fr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,gt).canRun(this)}));const s=this.state.status==="pending",i=!O(this,on).canStart();try{if(s)r();else{he(this,ir,Fr).call(this,{type:"pending",variables:t,isPaused:i}),O(this,gt).config.onMutate&&await O(this,gt).config.onMutate(t,this,n);const F=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));F!==this.state.context&&he(this,ir,Fr).call(this,{type:"pending",context:F,variables:t,isPaused:i})}const A=await O(this,on).start();return await((u=(c=O(this,gt).config).onSuccess)==null?void 0:u.call(c,A,t,this.state.context,this,n)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,A,t,this.state.context,n)),await((g=(y=O(this,gt).config).onSettled)==null?void 0:g.call(y,A,null,this.state.variables,this.state.context,this,n)),await((p=(_=this.options).onSettled)==null?void 0:p.call(_,A,null,t,this.state.context,n)),he(this,ir,Fr).call(this,{type:"success",data:A}),A}catch(A){try{await((m=(v=O(this,gt).config).onError)==null?void 0:m.call(v,A,t,this.state.context,this,n))}catch(F){Promise.reject(F)}try{await((S=(b=this.options).onError)==null?void 0:S.call(b,A,t,this.state.context,n))}catch(F){Promise.reject(F)}try{await((C=(w=O(this,gt).config).onSettled)==null?void 0:C.call(w,void 0,A,this.state.variables,this.state.context,this,n))}catch(F){Promise.reject(F)}try{await((x=(D=this.options).onSettled)==null?void 0:x.call(D,void 0,A,t,this.state.context,n))}catch(F){Promise.reject(F)}throw he(this,ir,Fr).call(this,{type:"error",error:A}),A}finally{O(this,gt).runNext(this)}}},Ls=new WeakMap,sr=new WeakMap,gt=new WeakMap,on=new WeakMap,ir=new WeakSet,Fr=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),rt.batch(()=>{O(this,sr).forEach(n=>{n.onMutationUpdate(t)}),O(this,gt).notify({mutation:this,type:"updated",action:t})})},zh);function _p(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wp=(qh=class extends Gn{constructor(t={}){super();ne(this,hr);ne(this,Xt);ne(this,Fs);this.config=t,Y(this,hr,new Set),Y(this,Xt,new Map),Y(this,Fs,0)}build(t,r,n){const s=new bp({client:t,mutationCache:this,mutationId:++no(this,Fs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,hr).add(t);const r=Hs(t);if(typeof r=="string"){const n=O(this,Xt).get(r);n?n.push(t):O(this,Xt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,hr).delete(t)){const r=Hs(t);if(typeof r=="string"){const n=O(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&&O(this,Xt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Hs(t);if(typeof r=="string"){const n=O(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=Hs(t);if(typeof r=="string"){const s=(n=O(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(){rt.batch(()=>{O(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,hr).clear(),O(this,Xt).clear()})}getAll(){return Array.from(O(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>bl(r,n))}findAll(t={}){return this.getAll().filter(r=>bl(t,r))}notify(t){rt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return rt.batch(()=>Promise.all(t.map(r=>r.continue().catch(St))))}},hr=new WeakMap,Xt=new WeakMap,Fs=new WeakMap,qh);function Hs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Sp=(Hh=class extends Gn{constructor(t={}){super();ne(this,or);this.config=t,Y(this,or,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??ao(s,r);let o=this.get(i);return o||(o=new gp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){O(this,or).has(t.queryHash)||(O(this,or).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,or).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,or).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){rt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,or).get(t)}getAll(){return[...O(this,or).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>ml(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>ml(t,n)):r}notify(t){rt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){rt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){rt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},or=new WeakMap,Hh),Cp=(Wh=class{constructor(e={}){ne(this,ze);ne(this,kr);ne(this,Ar);ne(this,zn);ne(this,qn);ne(this,Pr);ne(this,Hn);ne(this,Wn);Y(this,ze,e.queryCache||new Sp),Y(this,kr,e.mutationCache||new wp),Y(this,Ar,e.defaultOptions||{}),Y(this,zn,new Map),Y(this,qn,new Map),Y(this,Pr,0)}mount(){no(this,Pr)._++,O(this,Pr)===1&&(Y(this,Hn,io.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ze).onFocus())})),Y(this,Wn,qs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ze).onOnline())})))}unmount(){var e,t;no(this,Pr)._--,O(this,Pr)===0&&((e=O(this,Hn))==null||e.call(this),Y(this,Hn,void 0),(t=O(this,Wn))==null||t.call(this),Y(this,Wn,void 0))}isFetching(e){return O(this,ze).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,kr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,ze).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,ze).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(vr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,ze).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,ze).get(n.queryHash),i=s==null?void 0:s.state.data,o=np(t,i);if(o!==void 0)return O(this,ze).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return rt.batch(()=>O(this,ze).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,ze).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,ze);rt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,ze);return rt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=rt.batch(()=>O(this,ze).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(St).catch(St)}invalidateQueries(e,t={}){return rt.batch(()=>(O(this,ze).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=rt.batch(()=>O(this,ze).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(St)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(St)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,ze).build(this,t);return r.isStaleByTime(vr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(St).catch(St)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(St).catch(St)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return qs.isOnline()?O(this,kr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,ze)}getMutationCache(){return O(this,kr)}getDefaultOptions(){return O(this,Ar)}setDefaultOptions(e){Y(this,Ar,e)}setQueryDefaults(e,t){O(this,zn).set(Qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,zn).values()],r={};return t.forEach(n=>{Yn(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,qn).set(Qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,qn).values()],r={};return t.forEach(n=>{Yn(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Ar).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ao(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===zs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Ar).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,ze).clear(),O(this,kr).clear()}},ze=new WeakMap,kr=new WeakMap,Ar=new WeakMap,zn=new WeakMap,qn=new WeakMap,Pr=new WeakMap,Hn=new WeakMap,Wn=new WeakMap,Wh),Pl=_e.createContext(void 0),Ep=e=>{const t=_e.useContext(Pl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Op=({client:e,children:t})=>(_e.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Pl.Provider,{value:e,children:t})),Ml=_e.createContext(!1),Dp=()=>_e.useContext(Ml);Ml.Provider;function Ip(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Tp=_e.createContext(Ip()),Np=()=>_e.useContext(Tp),xp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Cl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},kp=e=>{_e.useEffect(()=>{e.clearReset()},[e])},Ap=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Cl(r,[e.error,n])),Pp=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))}},Mp=(e,t)=>e.isLoading&&e.isFetching&&!t,Lp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ll=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Fp(e,t,r){var g,_,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=Dp(),s=Np(),i=Ep(),o=i.defaultQueryOptions(e);(_=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||_.call(g,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,Pp(o),xp(o,s,a),kp(s);const u=!i.getQueryCache().get(o.queryHash),[d]=_e.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),y=!n&&c;if(_e.useSyncExternalStore(_e.useCallback(m=>{const b=y?d.subscribe(rt.batchCalls(m)):St;return d.updateResult(),b},[d,y]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),_e.useEffect(()=>{d.setOptions(o)},[o,d]),Lp(o,f))throw Ll(o,d,s);if(Ap({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&&!Rn.isServer()&&Mp(f,n)){const m=u?Ll(o,d,s):a==null?void 0:a.promise;m==null||m.catch(St).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Fl(e,t){return Fp(e,yp)}let $p={data:""},jp=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||$p},Bp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Vp=/\/\*[^]*?\*\/| +/g,$l=/\n+/g,mr=(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"?mr(o,i):i+"{"+mr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=mr(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+=mr.p?mr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},br={},jl=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+jl(e[r]);return t}return e},Up=(e,t,r,n,s)=>{let i=jl(e),o=br[i]||(br[i]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(i));if(!br[o]){let c=i!==e?e:(u=>{let d,f,y=[{}];for(;d=Bp.exec(u.replace(Vp,""));)d[4]?y.shift():d[3]?(f=d[3].replace($l," ").trim(),y.unshift(y[0][f]=y[0][f]||{})):y[0][d[1]]=d[2].replace($l," ").trim();return y[0]})(e);br[o]=mr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&br.g;return r&&(br.g=br[o]),((c,u,d,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=d?c+u.data:u.data+c)})(br[o],t,n,a),o},zp=(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?"":mr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Ws(e){let t=this||{},r=e.call?e(t.p):e;return Up(r.unshift?r.raw?zp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,jp(t.target),t.g,t.o,t.k)}let Bl,vo,mo;Ws.bind({g:1});let cr=Ws.bind({k:1});function qp(e,t,r,n){mr.p=t,Bl=e,vo=r,mo=n}function _r(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:vo&&vo()},a),r.o=/go\d/.test(c),a.className=Ws.apply(r,n)+(c?" "+c:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),mo&&u[0]&&mo(a),Bl(u,a)}return s}}var Hp=e=>typeof e=="function",Ks=(e,t)=>Hp(e)?e(t):e,Wp=(()=>{let e=0;return()=>(++e).toString()})(),Vl=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Kp=20,bo="default",Ul=(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 Ul(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}))}}},Gs=[],zl={toasts:[],pausedAt:void 0,settings:{toastLimit:Kp}},Jt={},ql=(e,t=bo)=>{Jt[t]=Ul(Jt[t]||zl,e),Gs.forEach(([r,n])=>{r===t&&n(Jt[t])})},Hl=e=>Object.keys(Jt).forEach(t=>ql(e,t)),Gp=e=>Object.keys(Jt).find(t=>Jt[t].toasts.some(r=>r.id===e)),Qs=(e=bo)=>t=>{ql(t,e)},Qp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Yp=(e={},t=bo)=>{let[r,n]=h.useState(Jt[t]||zl),s=h.useRef(Jt[t]);h.useEffect(()=>(s.current!==Jt[t]&&n(Jt[t]),Gs.push([t,n]),()=>{let o=Gs.findIndex(([a])=>a===t);o>-1&&Gs.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,u;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)||Qp[o.type],style:{...e.style,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...r,toasts:i}},Rp=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||Wp()}),Xn=e=>(t,r)=>{let n=Rp(t,e,r);return Qs(n.toasterId||Gp(n.id))({type:2,toast:n}),n.id},Qe=(e,t)=>Xn("blank")(e,t);Qe.error=Xn("error"),Qe.success=Xn("success"),Qe.loading=Xn("loading"),Qe.custom=Xn("custom"),Qe.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Qs(t)(r):Hl(r)},Qe.dismissAll=e=>Qe.dismiss(void 0,e),Qe.remove=(e,t)=>{let r={type:4,toastId:e};t?Qs(t)(r):Hl(r)},Qe.removeAll=e=>Qe.remove(void 0,e),Qe.promise=(e,t,r)=>{let n=Qe.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ks(t.success,s):void 0;return i?Qe.success(i,{id:n,...r,...r==null?void 0:r.success}):Qe.dismiss(n),s}).catch(s=>{let i=t.error?Ks(t.error,s):void 0;i?Qe.error(i,{id:n,...r,...r==null?void 0:r.error}):Qe.dismiss(n)}),e};var Xp=1e3,Zp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Yp(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,y=Xp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},y);s.set(f,g)},[]);h.useEffect(()=>{if(n)return;let f=Date.now(),y=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&Qe.dismiss(g.id);return}return setTimeout(()=>Qe.dismiss(g.id,t),_)});return()=>{y.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=h.useCallback(Qs(t),[t]),a=h.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=h.useCallback((f,y)=>{o({type:1,toast:{id:f,height:y}})},[o]),u=h.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),d=h.useCallback((f,y)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:p}=y||{},v=r.filter(S=>(S.position||p)===(f.position||p)&&S.height),m=v.findIndex(S=>S.id===f.id),b=v.filter((S,w)=>w<m&&S.visible).length;return v.filter(S=>S.visible).slice(...g?[b+1]:[0,b]).reduce((S,w)=>S+(w.height||0)+_,0)},[r]);return h.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let y=s.get(f.id);y&&(clearTimeout(y),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:u,calculateOffset:d}}},Jp=cr`
1
+ (function(pe,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):(pe=typeof globalThis<"u"?globalThis:pe||self,h(pe.CollectionEditorReact={},pe.React,pe.ReactDOM,pe.jsxRuntime))})(this,function(pe,h,Fe,l){"use strict";var Gh=pe=>{throw TypeError(pe)};var cl=(pe,h,Fe)=>h.has(pe)||Gh("Cannot "+Fe);var E=(pe,h,Fe)=>(cl(pe,h,"read from private field"),Fe?Fe.call(pe):h.get(pe)),ne=(pe,h,Fe)=>h.has(pe)?Gh("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(pe):h.set(pe,Fe),Y=(pe,h,Fe,l)=>(cl(pe,h,"write to private field"),l?l.call(pe,Fe):h.set(pe,Fe),Fe),he=(pe,h,Fe)=>(cl(pe,h,"access private method"),Fe);var no=(pe,h,Fe,l)=>({set _(so){Y(pe,h,so,Fe)},get _(){return E(pe,h,l)}});var Rr,Ir,Pn,Fh,rr,Xr,$h,Mn,Tr,Ln,jh,Zr,Bh,Fn,Jr,$n,Vt,en,Ze,As,tn,Pt,Qh,yr,Vh,Et,ye,Ps,bt,rn,jn,dr,Nr,Ms,Bn,Vn,nn,sn,xr,Un,Se,Us,ul,dl,fl,hl,pl,gl,yl,Yh,Uh,Ls,nr,gt,on,sr,Fr,zh,fr,Rt,Fs,qh,ir,Hh,qe,kr,Ar,zn,qn,Pr,Hn,Wn,Wh;function so(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 we=so(h);var Gn=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(){}},Zh=(Fh=class extends Gn{constructor(){super();ne(this,Rr);ne(this,Ir);ne(this,Pn);Y(this,Pn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Ir)||this.setEventListener(E(this,Pn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Ir))==null||t.call(this),Y(this,Ir,void 0))}setEventListener(t){var r;Y(this,Pn,t),(r=E(this,Ir))==null||r.call(this),Y(this,Ir,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Rr)!==t&&(Y(this,Rr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,Rr)=="boolean"?E(this,Rr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Rr=new WeakMap,Ir=new WeakMap,Pn=new WeakMap,Fh),io=new Zh,Jh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ep=($h=class{constructor(){ne(this,rr,Jh);ne(this,Xr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,Xr)&&e!==E(this,rr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,rr),provider:e}),Y(this,rr,e),process.env.NODE_ENV!=="production"&&Y(this,Xr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),E(this,rr).setTimeout(e,t)}clearTimeout(e){E(this,rr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Xr,!0),E(this,rr).setInterval(e,t)}clearInterval(e){E(this,rr).clearInterval(e)}},rr=new WeakMap,Xr=new WeakMap,$h),$r=new ep;function tp(e){setTimeout(e,0)}var rp=typeof window>"u"||"Deno"in globalThis;function wt(){}function np(e,t){return typeof e=="function"?e(t):e}function oo(e){return typeof e=="number"&&e>=0&&e!==1/0}function vl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function vr(e,t){return typeof e=="function"?e(t):e}function Nt(e,t){return typeof e=="function"?e(t):e}function ml(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==ao(o,t.options))return!1}else if(!Yn(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 bl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Qn(t.options.mutationKey)!==Qn(i))return!1}else if(!Yn(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function ao(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qn)(e)}function Qn(e){return JSON.stringify(e,(t,r)=>uo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Yn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Yn(e[r],t[r])):!1}var sp=Object.prototype.hasOwnProperty;function lo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=_l(e)&&_l(t);if(!n&&!(uo(e)&&uo(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 u=0;for(let d=0;d<a;d++){const f=n?d:o[d],y=e[f],g=t[f];if(y===g){c[f]=y,(n?d<i:sp.call(e,f))&&u++;continue}if(y===null||g===null||typeof y!="object"||typeof g!="object"){c[f]=g;continue}const _=lo(y,g,r+1);c[f]=_,_===y&&u++}return i===a&&u===i?e:c}function co(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 _l(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function uo(e){if(!wl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!wl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wl(e){return Object.prototype.toString.call(e)==="[object Object]"}function ip(e){return new Promise(t=>{$r.setTimeout(t,e)})}function fo(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 lo(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 lo(e,t)}return t}function op(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function ap(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var zs=Symbol();function Sl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===zs&&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===zs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Cl(e,t){return typeof e=="function"?e(...t):!!e}function lp(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 Rn=(()=>{let e=()=>rp;return{isServer(){return e()},setIsServer(t){e=t}}})();function ho(){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 cp=tp;function up(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=cp;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 tt=up(),dp=(jh=class extends Gn{constructor(){super();ne(this,Mn,!0);ne(this,Tr);ne(this,Ln);Y(this,Ln,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,Tr)||this.setEventListener(E(this,Ln))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Tr))==null||t.call(this),Y(this,Tr,void 0))}setEventListener(t){var r;Y(this,Ln,t),(r=E(this,Tr))==null||r.call(this),Y(this,Tr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Mn)!==t&&(Y(this,Mn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Mn)}},Mn=new WeakMap,Tr=new WeakMap,Ln=new WeakMap,jh),qs=new dp;function fp(e){return Math.min(1e3*2**e,3e4)}function Ol(e){return(e??"online")==="online"?qs.isOnline():!0}var po=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function El(e){let t=!1,r=0,n;const s=ho(),i=()=>s.status!=="pending",o=p=>{var v;if(!i()){const m=new po(p);y(m),(v=e.onCancel)==null||v.call(e,m)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>io.isFocused()&&(e.networkMode==="always"||qs.isOnline())&&e.canRun(),d=()=>Ol(e.networkMode)&&e.canRun(),f=p=>{i()||(n==null||n(),s.resolve(p))},y=p=>{i()||(n==null||n(),s.reject(p))},g=()=>new Promise(p=>{var v;n=m=>{(i()||u())&&p(m)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;n=void 0,i()||(p=e.onContinue)==null||p.call(e)}),_=()=>{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 I;if(i())return;const b=e.retry??(Rn.isServer()?0:3),S=e.retryDelay??fp,w=typeof S=="function"?S(r,m):S,O=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,m);if(t||!O){y(m);return}r++,(I=e.onFail)==null||I.call(e,r,m),ip(w).then(()=>u()?void 0:g()).then(()=>{t?y(m):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?_():g().then(_),s)}}var Dl=(Bh=class{constructor(){ne(this,Zr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),oo(this.gcTime)&&Y(this,Zr,$r.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Rn.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Zr)!==void 0&&($r.clearTimeout(E(this,Zr)),Y(this,Zr,void 0))}},Zr=new WeakMap,Bh);function hp(e){return{onFetch:(t,r)=>{var d,f,y,g,_;const n=t.options,s=(y=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:y.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const v=S=>{lp(S,()=>t.signal,()=>p=!0)},m=Sl(t.options,t.fetchOptions),b=async(S,w,O)=>{if(p)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const k=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:w,direction:O?"backward":"forward",meta:t.options.meta};return v(A),A})(),P=await m(k),{maxPages:$}=t.options,T=O?ap:op;return{pages:T(S.pages,P,$),pageParams:T(S.pageParams,w,$)}};if(s&&i.length){const S=s==="backward",w=S?pp:Il,O={pages:i,pageParams:o},I=w(n,O);a=await b(O,I,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Il(n,a);if(c>0&&w==null)break;a=await b(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,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function Il(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 pp(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 gp=(Vh=class extends Dl{constructor(t){super();ne(this,Pt);ne(this,Fn);ne(this,Jr);ne(this,$n);ne(this,Vt);ne(this,en);ne(this,Ze);ne(this,As);ne(this,tn);Y(this,tn,!1),Y(this,As,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,en,t.client),Y(this,Vt,E(this,en).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,Jr,xl(this.options)),this.state=t.state??E(this,Jr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Fn)}get promise(){var t;return(t=E(this,Ze))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,As),...t},t!=null&&t._type&&Y(this,Fn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=xl(this.options);r.data!==void 0&&(this.setState(Nl(r.data,r.dataUpdatedAt)),Y(this,Jr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,Vt).remove(this)}setData(t,r){const n=fo(this.state.data,t,this.options);return he(this,Pt,yr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){he(this,Pt,yr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,Ze))==null?void 0:n.promise;return(s=E(this,Ze))==null||s.cancel(t),r?r.then(wt).catch(wt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Jr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Nt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zs||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>vr(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:!vl(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,Ze))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,Ze))==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,Ze)&&(E(this,tn)||he(this,Pt,Qh).call(this)?E(this,Ze).cancel({revert:!0}):E(this,Ze).cancelRetry()),this.scheduleGc()),E(this,Vt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Pt,yr).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,y,g,_,p,v,m,b,S;if(this.state.fetchStatus!=="idle"&&((u=E(this,Ze))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,Ze))return E(this,Ze).continueRetry(),E(this,Ze).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,tn,!0),n.signal)})},i=()=>{const w=Sl(this.options,r),I=(()=>{const k={client:E(this,en),queryKey:this.queryKey,meta:this.meta};return s(k),k})();return Y(this,tn,!1),this.options.persister?this.options.persister(w,I,this):w(I)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,en),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,Fn)==="infinite"?hp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),Y(this,$n,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&he(this,Pt,yr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Y(this,Ze,El({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof po&&w.revert&&this.setState({...E(this,$n),fetchStatus:"idle"}),n.abort()},onFail:(w,O)=>{he(this,Pt,yr).call(this,{type:"failed",failureCount:w,error:O})},onPause:()=>{he(this,Pt,yr).call(this,{type:"pause"})},onContinue:()=>{he(this,Pt,yr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,Ze).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),(g=(y=E(this,Vt).config).onSuccess)==null||g.call(y,w,this),(p=(_=E(this,Vt).config).onSettled)==null||p.call(_,w,this.state.error,this),w}catch(w){if(w instanceof po){if(w.silent)return E(this,Ze).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,Pt,yr).call(this,{type:"error",error:w}),(m=(v=E(this,Vt).config).onError)==null||m.call(v,w,this),(S=(b=E(this,Vt).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Fn=new WeakMap,Jr=new WeakMap,$n=new WeakMap,Vt=new WeakMap,en=new WeakMap,Ze=new WeakMap,As=new WeakMap,tn=new WeakMap,Pt=new WeakSet,Qh=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},yr=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,...Tl(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Nl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,$n,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),tt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,Vt).notify({query:this,type:"updated",action:t})})},Vh);function Tl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ol(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Nl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function xl(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 yp=(Uh=class extends Gn{constructor(t,r){super();ne(this,Se);ne(this,Et);ne(this,ye);ne(this,Ps);ne(this,bt);ne(this,rn);ne(this,jn);ne(this,dr);ne(this,Nr);ne(this,Ms);ne(this,Bn);ne(this,Vn);ne(this,nn);ne(this,sn);ne(this,xr);ne(this,Un,new Set);this.options=r,Y(this,Et,t),Y(this,Nr,null),Y(this,dr,ho()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,ye).addObserver(this),kl(E(this,ye),this.options)?he(this,Se,Us).call(this):this.updateResult(),he(this,Se,hl).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return go(E(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return go(E(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,Se,pl).call(this),he(this,Se,gl).call(this),E(this,ye).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,ye);if(this.options=E(this,Et).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Nt(this.options.enabled,E(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,Se,yl).call(this),E(this,ye).setOptions(this.options),r._defaulted&&!co(this.options,r)&&E(this,Et).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,ye),observer:this});const s=this.hasListeners();s&&Al(E(this,ye),n,this.options,r)&&he(this,Se,Us).call(this),this.updateResult(),s&&(E(this,ye)!==n||Nt(this.options.enabled,E(this,ye))!==Nt(r.enabled,E(this,ye))||vr(this.options.staleTime,E(this,ye))!==vr(r.staleTime,E(this,ye)))&&he(this,Se,ul).call(this);const i=he(this,Se,dl).call(this);s&&(E(this,ye)!==n||Nt(this.options.enabled,E(this,ye))!==Nt(r.enabled,E(this,ye))||i!==E(this,xr))&&he(this,Se,fl).call(this,i)}getOptimisticResult(t){const r=E(this,Et).getQueryCache().build(E(this,Et),t),n=this.createResult(r,t);return mp(this,n)&&(Y(this,bt,n),Y(this,jn,this.options),Y(this,rn,E(this,ye).state)),n}getCurrentResult(){return E(this,bt)}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,dr).status==="pending"&&E(this,dr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,Un).add(t)}getCurrentQuery(){return E(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,Et).defaultQueryOptions(t),n=E(this,Et).getQueryCache().build(E(this,Et),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return he(this,Se,Us).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,bt)))}createResult(t,r){var $;const n=E(this,ye),s=this.options,i=E(this,bt),o=E(this,rn),a=E(this,jn),u=t!==n?t.state:E(this,Ps),{state:d}=t;let f={...d},y=!1,g;if(r._optimisticResults){const T=this.hasListeners(),A=!T&&kl(t,r),F=T&&Al(t,n,r,s);(A||F)&&(f={...f,...Tl(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:p,status:v}=f;g=f.data;let m=!1;if(r.placeholderData!==void 0&&g===void 0&&v==="pending"){let T;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(T=i.data,m=!0):T=typeof r.placeholderData=="function"?r.placeholderData(($=E(this,Vn))==null?void 0:$.state.data,E(this,Vn)):r.placeholderData,T!==void 0&&(v="success",g=fo(i==null?void 0:i.data,T,r),y=!0)}if(r.select&&g!==void 0&&!m)if(i&&g===(o==null?void 0:o.data)&&r.select===E(this,Ms))g=E(this,Bn);else try{Y(this,Ms,r.select),g=r.select(g),g=fo(i==null?void 0:i.data,g,r),Y(this,Bn,g),Y(this,Nr,null)}catch(T){Y(this,Nr,T)}E(this,Nr)&&(_=E(this,Nr),g=E(this,Bn),p=Date.now(),v="error");const b=f.fetchStatus==="fetching",S=v==="pending",w=v==="error",O=S&&b,I=g!==void 0,P={status:v,fetchStatus:f.fetchStatus,isPending:S,isSuccess:v==="success",isError:w,isInitialLoading:O,isLoading:O,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:w&&!I,isPaused:f.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:w&&I,isStale:yo(t,r),refetch:this.refetch,promise:E(this,dr),isEnabled:Nt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const T=P.data!==void 0,A=P.status==="error"&&!T,F=j=>{A?j.reject(P.error):T&&j.resolve(P.data)},M=()=>{const j=Y(this,dr,P.promise=ho());F(j)},V=E(this,dr);switch(V.status){case"pending":t.queryHash===n.queryHash&&F(V);break;case"fulfilled":(A||P.data!==V.value)&&M();break;case"rejected":(!A||P.error!==V.reason)&&M();break}}return P}updateResult(){const t=E(this,bt),r=this.createResult(E(this,ye),this.options);if(Y(this,rn,E(this,ye).state),Y(this,jn,this.options),E(this,rn).data!==void 0&&Y(this,Vn,E(this,ye)),co(r,t))return;Y(this,bt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,Un).size)return!0;const o=new Set(i??E(this,Un));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,bt)).some(a=>{const c=a;return E(this,bt)[c]!==t[c]&&o.has(c)})};he(this,Se,Yh).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,Se,hl).call(this)}},Et=new WeakMap,ye=new WeakMap,Ps=new WeakMap,bt=new WeakMap,rn=new WeakMap,jn=new WeakMap,dr=new WeakMap,Nr=new WeakMap,Ms=new WeakMap,Bn=new WeakMap,Vn=new WeakMap,nn=new WeakMap,sn=new WeakMap,xr=new WeakMap,Un=new WeakMap,Se=new WeakSet,Us=function(t){he(this,Se,yl).call(this);let r=E(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(wt)),r},ul=function(){he(this,Se,pl).call(this);const t=vr(this.options.staleTime,E(this,ye));if(Rn.isServer()||E(this,bt).isStale||!oo(t))return;const n=vl(E(this,bt).dataUpdatedAt,t)+1;Y(this,nn,$r.setTimeout(()=>{E(this,bt).isStale||this.updateResult()},n))},dl=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,ye)):this.options.refetchInterval)??!1},fl=function(t){he(this,Se,gl).call(this),Y(this,xr,t),!(Rn.isServer()||Nt(this.options.enabled,E(this,ye))===!1||!oo(E(this,xr))||E(this,xr)===0)&&Y(this,sn,$r.setInterval(()=>{(this.options.refetchIntervalInBackground||io.isFocused())&&he(this,Se,Us).call(this)},E(this,xr)))},hl=function(){he(this,Se,ul).call(this),he(this,Se,fl).call(this,he(this,Se,dl).call(this))},pl=function(){E(this,nn)!==void 0&&($r.clearTimeout(E(this,nn)),Y(this,nn,void 0))},gl=function(){E(this,sn)!==void 0&&($r.clearInterval(E(this,sn)),Y(this,sn,void 0))},yl=function(){const t=E(this,Et).getQueryCache().build(E(this,Et),this.options);if(t===E(this,ye))return;const r=E(this,ye);Y(this,ye,t),Y(this,Ps,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},Yh=function(t){tt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,bt))}),E(this,Et).getQueryCache().notify({query:E(this,ye),type:"observerResultsUpdated"})})},Uh);function vp(e,t){return Nt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Nt(t.retryOnMount,e)===!1)}function kl(e,t){return vp(e,t)||e.state.data!==void 0&&go(e,t,t.refetchOnMount)}function go(e,t,r){if(Nt(t.enabled,e)!==!1&&vr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&yo(e,t)}return!1}function Al(e,t,r,n){return(e!==t||Nt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&yo(e,r)}function yo(e,t){return Nt(t.enabled,e)!==!1&&e.isStaleByTime(vr(t.staleTime,e))}function mp(e,t){return!co(e.getCurrentResult(),t)}var bp=(zh=class extends Dl{constructor(t){super();ne(this,sr);ne(this,Ls);ne(this,nr);ne(this,gt);ne(this,on);Y(this,Ls,t.client),this.mutationId=t.mutationId,Y(this,gt,t.mutationCache),Y(this,nr,[]),this.state=t.state||_p(),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,nr).includes(t)||(E(this,nr).push(t),this.clearGcTimeout(),E(this,gt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,nr,E(this,nr).filter(r=>r!==t)),this.scheduleGc(),E(this,gt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,nr).length||(this.state.status==="pending"?this.scheduleGc():E(this,gt).remove(this))}continue(){var t;return((t=E(this,on))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,f,y,g,_,p,v,m,b,S,w,O,I,k;const r=()=>{he(this,sr,Fr).call(this,{type:"continue"})},n={client:E(this,Ls),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,on,El({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(P,$)=>{he(this,sr,Fr).call(this,{type:"failed",failureCount:P,error:$})},onPause:()=>{he(this,sr,Fr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,gt).canRun(this)}));const s=this.state.status==="pending",i=!E(this,on).canStart();try{if(s)r();else{he(this,sr,Fr).call(this,{type:"pending",variables:t,isPaused:i}),E(this,gt).config.onMutate&&await E(this,gt).config.onMutate(t,this,n);const $=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));$!==this.state.context&&he(this,sr,Fr).call(this,{type:"pending",context:$,variables:t,isPaused:i})}const P=await E(this,on).start();return await((u=(c=E(this,gt).config).onSuccess)==null?void 0:u.call(c,P,t,this.state.context,this,n)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,P,t,this.state.context,n)),await((g=(y=E(this,gt).config).onSettled)==null?void 0:g.call(y,P,null,this.state.variables,this.state.context,this,n)),await((p=(_=this.options).onSettled)==null?void 0:p.call(_,P,null,t,this.state.context,n)),he(this,sr,Fr).call(this,{type:"success",data:P}),P}catch(P){try{await((m=(v=E(this,gt).config).onError)==null?void 0:m.call(v,P,t,this.state.context,this,n))}catch($){Promise.reject($)}try{await((S=(b=this.options).onError)==null?void 0:S.call(b,P,t,this.state.context,n))}catch($){Promise.reject($)}try{await((O=(w=E(this,gt).config).onSettled)==null?void 0:O.call(w,void 0,P,this.state.variables,this.state.context,this,n))}catch($){Promise.reject($)}try{await((k=(I=this.options).onSettled)==null?void 0:k.call(I,void 0,P,t,this.state.context,n))}catch($){Promise.reject($)}throw he(this,sr,Fr).call(this,{type:"error",error:P}),P}finally{E(this,gt).runNext(this)}}},Ls=new WeakMap,nr=new WeakMap,gt=new WeakMap,on=new WeakMap,sr=new WeakSet,Fr=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),tt.batch(()=>{E(this,nr).forEach(n=>{n.onMutationUpdate(t)}),E(this,gt).notify({mutation:this,type:"updated",action:t})})},zh);function _p(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wp=(qh=class extends Gn{constructor(t={}){super();ne(this,fr);ne(this,Rt);ne(this,Fs);this.config=t,Y(this,fr,new Set),Y(this,Rt,new Map),Y(this,Fs,0)}build(t,r,n){const s=new bp({client:t,mutationCache:this,mutationId:++no(this,Fs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,fr).add(t);const r=Hs(t);if(typeof r=="string"){const n=E(this,Rt).get(r);n?n.push(t):E(this,Rt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,fr).delete(t)){const r=Hs(t);if(typeof r=="string"){const n=E(this,Rt).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,Rt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Hs(t);if(typeof r=="string"){const n=E(this,Rt).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=Hs(t);if(typeof r=="string"){const s=(n=E(this,Rt).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(){tt.batch(()=>{E(this,fr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,fr).clear(),E(this,Rt).clear()})}getAll(){return Array.from(E(this,fr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>bl(r,n))}findAll(t={}){return this.getAll().filter(r=>bl(t,r))}notify(t){tt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return tt.batch(()=>Promise.all(t.map(r=>r.continue().catch(wt))))}},fr=new WeakMap,Rt=new WeakMap,Fs=new WeakMap,qh);function Hs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Sp=(Hh=class extends Gn{constructor(t={}){super();ne(this,ir);this.config=t,Y(this,ir,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??ao(s,r);let o=this.get(i);return o||(o=new gp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,ir).has(t.queryHash)||(E(this,ir).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,ir).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,ir).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){tt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,ir).get(t)}getAll(){return[...E(this,ir).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>ml(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>ml(t,n)):r}notify(t){tt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){tt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){tt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ir=new WeakMap,Hh),Cp=(Wh=class{constructor(e={}){ne(this,qe);ne(this,kr);ne(this,Ar);ne(this,zn);ne(this,qn);ne(this,Pr);ne(this,Hn);ne(this,Wn);Y(this,qe,e.queryCache||new Sp),Y(this,kr,e.mutationCache||new wp),Y(this,Ar,e.defaultOptions||{}),Y(this,zn,new Map),Y(this,qn,new Map),Y(this,Pr,0)}mount(){no(this,Pr)._++,E(this,Pr)===1&&(Y(this,Hn,io.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,qe).onFocus())})),Y(this,Wn,qs.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,qe).onOnline())})))}unmount(){var e,t;no(this,Pr)._--,E(this,Pr)===0&&((e=E(this,Hn))==null||e.call(this),Y(this,Hn,void 0),(t=E(this,Wn))==null||t.call(this),Y(this,Wn,void 0))}isFetching(e){return E(this,qe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,kr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,qe).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,qe).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(vr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,qe).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=E(this,qe).get(n.queryHash),i=s==null?void 0:s.state.data,o=np(t,i);if(o!==void 0)return E(this,qe).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return tt.batch(()=>E(this,qe).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,qe).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,qe);tt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,qe);return tt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=tt.batch(()=>E(this,qe).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(wt).catch(wt)}invalidateQueries(e,t={}){return tt.batch(()=>(E(this,qe).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=tt.batch(()=>E(this,qe).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(wt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(wt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,qe).build(this,t);return r.isStaleByTime(vr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(wt).catch(wt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(wt).catch(wt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return qs.isOnline()?E(this,kr).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,qe)}getMutationCache(){return E(this,kr)}getDefaultOptions(){return E(this,Ar)}setDefaultOptions(e){Y(this,Ar,e)}setQueryDefaults(e,t){E(this,zn).set(Qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,zn).values()],r={};return t.forEach(n=>{Yn(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,qn).set(Qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,qn).values()],r={};return t.forEach(n=>{Yn(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Ar).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ao(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===zs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Ar).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,qe).clear(),E(this,kr).clear()}},qe=new WeakMap,kr=new WeakMap,Ar=new WeakMap,zn=new WeakMap,qn=new WeakMap,Pr=new WeakMap,Hn=new WeakMap,Wn=new WeakMap,Wh),Pl=we.createContext(void 0),Op=e=>{const t=we.useContext(Pl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ep=({client:e,children:t})=>(we.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Pl.Provider,{value:e,children:t})),Ml=we.createContext(!1),Dp=()=>we.useContext(Ml);Ml.Provider;function Ip(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Tp=we.createContext(Ip()),Np=()=>we.useContext(Tp),xp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Cl(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},kp=e=>{we.useEffect(()=>{e.clearReset()},[e])},Ap=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Cl(r,[e.error,n])),Pp=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))}},Mp=(e,t)=>e.isLoading&&e.isFetching&&!t,Lp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ll=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Fp(e,t,r){var g,_,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=Dp(),s=Np(),i=Op(),o=i.defaultQueryOptions(e);(_=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||_.call(g,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,Pp(o),xp(o,s,a),kp(s);const u=!i.getQueryCache().get(o.queryHash),[d]=we.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),y=!n&&c;if(we.useSyncExternalStore(we.useCallback(m=>{const b=y?d.subscribe(tt.batchCalls(m)):wt;return d.updateResult(),b},[d,y]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),we.useEffect(()=>{d.setOptions(o)},[o,d]),Lp(o,f))throw Ll(o,d,s);if(Ap({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&&!Rn.isServer()&&Mp(f,n)){const m=u?Ll(o,d,s):a==null?void 0:a.promise;m==null||m.catch(wt).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Fl(e,t){return Fp(e,yp)}let $p={data:""},jp=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||$p},Bp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Vp=/\/\*[^]*?\*\/| +/g,$l=/\n+/g,mr=(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"?mr(o,i):i+"{"+mr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=mr(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+=mr.p?mr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},br={},jl=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+jl(e[r]);return t}return e},Up=(e,t,r,n,s)=>{let i=jl(e),o=br[i]||(br[i]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(i));if(!br[o]){let c=i!==e?e:(u=>{let d,f,y=[{}];for(;d=Bp.exec(u.replace(Vp,""));)d[4]?y.shift():d[3]?(f=d[3].replace($l," ").trim(),y.unshift(y[0][f]=y[0][f]||{})):y[0][d[1]]=d[2].replace($l," ").trim();return y[0]})(e);br[o]=mr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&br.g;return r&&(br.g=br[o]),((c,u,d,f)=>{f?u.data=u.data.replace(f,c):u.data.indexOf(c)===-1&&(u.data=d?c+u.data:u.data+c)})(br[o],t,n,a),o},zp=(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?"":mr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Ws(e){let t=this||{},r=e.call?e(t.p):e;return Up(r.unshift?r.raw?zp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,jp(t.target),t.g,t.o,t.k)}let Bl,vo,mo;Ws.bind({g:1});let lr=Ws.bind({k:1});function qp(e,t,r,n){mr.p=t,Bl=e,vo=r,mo=n}function _r(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:vo&&vo()},a),r.o=/go\d/.test(c),a.className=Ws.apply(r,n)+(c?" "+c:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),mo&&u[0]&&mo(a),Bl(u,a)}return s}}var Hp=e=>typeof e=="function",Ks=(e,t)=>Hp(e)?e(t):e,Wp=(()=>{let e=0;return()=>(++e).toString()})(),Vl=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Kp=20,bo="default",Ul=(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 Ul(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}))}}},Gs=[],zl={toasts:[],pausedAt:void 0,settings:{toastLimit:Kp}},Zt={},ql=(e,t=bo)=>{Zt[t]=Ul(Zt[t]||zl,e),Gs.forEach(([r,n])=>{r===t&&n(Zt[t])})},Hl=e=>Object.keys(Zt).forEach(t=>ql(e,t)),Gp=e=>Object.keys(Zt).find(t=>Zt[t].toasts.some(r=>r.id===e)),Qs=(e=bo)=>t=>{ql(t,e)},Qp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Yp=(e={},t=bo)=>{let[r,n]=h.useState(Zt[t]||zl),s=h.useRef(Zt[t]);h.useEffect(()=>(s.current!==Zt[t]&&n(Zt[t]),Gs.push([t,n]),()=>{let o=Gs.findIndex(([a])=>a===t);o>-1&&Gs.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,u;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)||Qp[o.type],style:{...e.style,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...r,toasts:i}},Rp=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||Wp()}),Xn=e=>(t,r)=>{let n=Rp(t,e,r);return Qs(n.toasterId||Gp(n.id))({type:2,toast:n}),n.id},Ge=(e,t)=>Xn("blank")(e,t);Ge.error=Xn("error"),Ge.success=Xn("success"),Ge.loading=Xn("loading"),Ge.custom=Xn("custom"),Ge.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Qs(t)(r):Hl(r)},Ge.dismissAll=e=>Ge.dismiss(void 0,e),Ge.remove=(e,t)=>{let r={type:4,toastId:e};t?Qs(t)(r):Hl(r)},Ge.removeAll=e=>Ge.remove(void 0,e),Ge.promise=(e,t,r)=>{let n=Ge.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ks(t.success,s):void 0;return i?Ge.success(i,{id:n,...r,...r==null?void 0:r.success}):Ge.dismiss(n),s}).catch(s=>{let i=t.error?Ks(t.error,s):void 0;i?Ge.error(i,{id:n,...r,...r==null?void 0:r.error}):Ge.dismiss(n)}),e};var Xp=1e3,Zp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Yp(e,t),s=h.useRef(new Map).current,i=h.useCallback((f,y=Xp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},y);s.set(f,g)},[]);h.useEffect(()=>{if(n)return;let f=Date.now(),y=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&Ge.dismiss(g.id);return}return setTimeout(()=>Ge.dismiss(g.id,t),_)});return()=>{y.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=h.useCallback(Qs(t),[t]),a=h.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=h.useCallback((f,y)=>{o({type:1,toast:{id:f,height:y}})},[o]),u=h.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),d=h.useCallback((f,y)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:p}=y||{},v=r.filter(S=>(S.position||p)===(f.position||p)&&S.height),m=v.findIndex(S=>S.id===f.id),b=v.filter((S,w)=>w<m&&S.visible).length;return v.filter(S=>S.visible).slice(...g?[b+1]:[0,b]).reduce((S,w)=>S+(w.height||0)+_,0)},[r]);return h.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let y=s.get(f.id);y&&(clearTimeout(y),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:u,calculateOffset:d}}},Jp=lr`
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
- }`,eg=cr`
9
+ }`,eg=lr`
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
- }`,tg=cr`
17
+ }`,tg=lr`
18
18
  from {
19
19
  transform: scale(0) rotate(90deg);
20
20
  opacity: 0;
@@ -55,7 +55,7 @@ to {
55
55
  animation-delay: 180ms;
56
56
  transform: rotate(90deg);
57
57
  }
58
- `,ng=cr`
58
+ `,ng=lr`
59
59
  from {
60
60
  transform: rotate(0deg);
61
61
  }
@@ -71,7 +71,7 @@ to {
71
71
  border-color: ${e=>e.secondary||"#e0e0e0"};
72
72
  border-right-color: ${e=>e.primary||"#616161"};
73
73
  animation: ${ng} 1s linear infinite;
74
- `,ig=cr`
74
+ `,ig=lr`
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
- }`,og=cr`
82
+ }`,og=lr`
83
83
  0% {
84
84
  height: 0;
85
85
  width: 0;
@@ -129,7 +129,7 @@ to {
129
129
  align-items: center;
130
130
  min-width: 20px;
131
131
  min-height: 20px;
132
- `,ug=cr`
132
+ `,ug=lr`
133
133
  from {
134
134
  transform: scale(0.6);
135
135
  opacity: 0.4;
@@ -144,7 +144,7 @@ to {
144
144
  min-width: 20px;
145
145
  animation: ${ug} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
146
146
  forwards;
147
- `,fg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?_e.createElement(dg,null,t):t:r==="blank"?null:_e.createElement(cg,null,_e.createElement(sg,{...n}),r!=="loading"&&_e.createElement(lg,null,r==="error"?_e.createElement(rg,{...n}):_e.createElement(ag,{...n})))},hg=e=>`
147
+ `,fg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?we.createElement(dg,null,t):t:r==="blank"?null:we.createElement(cg,null,we.createElement(sg,{...n}),r!=="loading"&&we.createElement(lg,null,r==="error"?we.createElement(rg,{...n}):we.createElement(ag,{...n})))},hg=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
150
  `,pg=e=>`
@@ -169,16 +169,16 @@ to {
169
169
  color: inherit;
170
170
  flex: 1 1 auto;
171
171
  white-space: pre-line;
172
- `,bg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Vl()?[gg,yg]:[hg(r),pg(r)];return{animation:t?`${cr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${cr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},_g=_e.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?bg(e.position||t||"top-center",e.visible):{opacity:0},i=_e.createElement(fg,{toast:e}),o=_e.createElement(mg,{...e.ariaProps},Ks(e.message,e));return _e.createElement(vg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):_e.createElement(_e.Fragment,null,i,o))});qp(_e.createElement);var wg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=_e.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 _e.createElement("div",{ref:i,className:t,style:r},s)},Sg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Vl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Cg=Ws`
172
+ `,bg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=Vl()?[gg,yg]:[hg(r),pg(r)];return{animation:t?`${lr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${lr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},_g=we.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?bg(e.position||t||"top-center",e.visible):{opacity:0},i=we.createElement(fg,{toast:e}),o=we.createElement(mg,{...e.ariaProps},Ks(e.message,e));return we.createElement(vg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):we.createElement(we.Fragment,null,i,o))});qp(we.createElement);var wg=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=we.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 we.createElement("div",{ref:i,className:t,style:r},s)},Sg=(e,t)=>{let r=e.includes("top"),n=r?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Vl()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Cg=Ws`
173
173
  z-index: 9999;
174
174
  > * {
175
175
  pointer-events: auto;
176
176
  }
177
- `,Ys=16,Eg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:u}=Zp(r,i);return _e.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Ys,left:Ys,right:Ys,bottom:Ys,pointerEvents:"none",...o},className:a,onMouseEnter:u.startPause,onMouseLeave:u.endPause},c.map(d=>{let f=d.position||t,y=u.calculateOffset(d,{reverseOrder:e,gutter:n,defaultPosition:t}),g=Sg(f,y);return _e.createElement(wg,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?Cg:"",style:g},d.type==="custom"?Ks(d.message,d):s?s(d):_e.createElement(_g,{toast:d,position:f}))}))},Pe=Qe;function Og(){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 Rs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ln(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _o(e){return"nodeType"in e}function bt(e){var t,r;return e?ln(e)?e:_o(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function wo(e){const{Document:t}=bt(e);return e instanceof t}function Zn(e){return ln(e)?!1:e instanceof bt(e).HTMLElement}function Wl(e){return e instanceof bt(e).SVGElement}function cn(e){return e?ln(e)?e.document:_o(e)?wo(e)?e:Zn(e)||Wl(e)?e.ownerDocument:document:document:document}const Ht=Rs?h.useLayoutEffect:h.useEffect;function Xs(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 Dg(){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 Jn(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return Ht(()=>{r.current!==e&&(r.current=e)},t),r}function es(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Zs(e){const t=Xs(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 Js(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let So={};function ts(e,t){return h.useMemo(()=>{if(t)return t;const r=So[e]==null?0:So[e]+1;return So[e]=r,e+"-"+r},[e,t])}function Kl(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,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const un=Kl(1),rs=Kl(-1);function Ig(e){return"clientX"in e&&"clientY"in e}function ei(e){if(!e)return!1;const{KeyboardEvent:t}=bt(e.target);return t&&e instanceof t}function Tg(e){if(!e)return!1;const{TouchEvent:t}=bt(e.target);return t&&e instanceof t}function ti(e){if(Tg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ig(e)?{x:e.clientX,y:e.clientY}:null}const wr=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[wr.Translate.toString(e),wr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Gl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ng(e){return e.matches(Gl)?e:e.querySelector(Gl)}const xg={display:"none"};function kg(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:xg},r)}function Ag(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 Pg(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Ql=h.createContext(null);function Mg(e){const t=h.useContext(Ql);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lg(){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 Fg={draggable:`
177
+ `,Ys=16,Og=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:u}=Zp(r,i);return we.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Ys,left:Ys,right:Ys,bottom:Ys,pointerEvents:"none",...o},className:a,onMouseEnter:u.startPause,onMouseLeave:u.endPause},c.map(d=>{let f=d.position||t,y=u.calculateOffset(d,{reverseOrder:e,gutter:n,defaultPosition:t}),g=Sg(f,y);return we.createElement(wg,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?Cg:"",style:g},d.type==="custom"?Ks(d.message,d):s?s(d):we.createElement(_g,{toast:d,position:f}))}))},Le=Ge;function Eg(){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 Rs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ln(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _o(e){return"nodeType"in e}function mt(e){var t,r;return e?ln(e)?e:_o(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function wo(e){const{Document:t}=mt(e);return e instanceof t}function Zn(e){return ln(e)?!1:e instanceof mt(e).HTMLElement}function Wl(e){return e instanceof mt(e).SVGElement}function cn(e){return e?ln(e)?e.document:_o(e)?wo(e)?e:Zn(e)||Wl(e)?e.ownerDocument:document:document:document}const qt=Rs?h.useLayoutEffect:h.useEffect;function Xs(e){const t=h.useRef(e);return qt(()=>{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 Dg(){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 Jn(e,t){t===void 0&&(t=[e]);const r=h.useRef(e);return qt(()=>{r.current!==e&&(r.current=e)},t),r}function es(e,t){const r=h.useRef();return h.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Zs(e){const t=Xs(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 Js(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let So={};function ts(e,t){return h.useMemo(()=>{if(t)return t;const r=So[e]==null?0:So[e]+1;return So[e]=r,e+"-"+r},[e,t])}function Kl(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,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const un=Kl(1),rs=Kl(-1);function Ig(e){return"clientX"in e&&"clientY"in e}function ei(e){if(!e)return!1;const{KeyboardEvent:t}=mt(e.target);return t&&e instanceof t}function Tg(e){if(!e)return!1;const{TouchEvent:t}=mt(e.target);return t&&e instanceof t}function ti(e){if(Tg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Ig(e)?{x:e.clientX,y:e.clientY}:null}const wr=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[wr.Translate.toString(e),wr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Gl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ng(e){return e.matches(Gl)?e:e.querySelector(Gl)}const xg={display:"none"};function kg(e){let{id:t,value:r}=e;return h.createElement("div",{id:t,style:xg},r)}function Ag(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 Pg(){const[e,t]=h.useState("");return{announce:h.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Ql=h.createContext(null);function Mg(e){const t=h.useContext(Ql);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lg(){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 Fg={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
- `},$g={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 jg(e){let{announcements:t=$g,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Fg}=e;const{announce:i,announcement:o}=Pg(),a=ts("DndLiveRegion"),[c,u]=h.useState(!1);if(h.useEffect(()=>{u(!0)},[]),Mg(h.useMemo(()=>({onDragStart(f){let{active:y}=f;i(t.onDragStart({active:y}))},onDragMove(f){let{active:y,over:g}=f;t.onDragMove&&i(t.onDragMove({active:y,over:g}))},onDragOver(f){let{active:y,over:g}=f;i(t.onDragOver({active:y,over:g}))},onDragEnd(f){let{active:y,over:g}=f;i(t.onDragEnd({active:y,over:g}))},onDragCancel(f){let{active:y,over:g}=f;i(t.onDragCancel({active:y,over:g}))}}),[i,t])),!c)return null;const d=h.createElement(h.Fragment,null,h.createElement(kg,{id:n,value:s.draggable}),h.createElement(Ag,{id:a,announcement:o}));return r?Le.createPortal(d,r):d}var Ye;(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"})(Ye||(Ye={}));function ri(){}function Co(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Yl(){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 Rl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bg(e,t){const r=ti(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 Xl(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 Zl(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 Jl(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function ec(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 Ug=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=ec(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Rl(ec(c),s);i.push({id:a,data:{droppableContainer:o,value:u}})}}return i.sort(Xl)},zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Zl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Zl(c),d=s.reduce((y,g,_)=>y+Rl(u[_],g),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(Xl)};function qg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,u=e.width*e.height,d=o*a,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const Hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=qg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Vg)};function Wg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function tc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Wt}function Kg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const Gg=Kg(1);function rc(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 Qg(e,t,r){const n=rc(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),u=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Yg={ignoreTransform:!1};function dn(e,t){t===void 0&&(t=Yg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=bt(e).getComputedStyle(e);u&&(r=Qg(r,u,d))}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 nc(e){return dn(e,{ignoreTransform:!0})}function Rg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Xg(e,t){return t===void 0&&(t=bt(e).getComputedStyle(e)),t.position==="fixed"}function Zg(e,t){t===void 0&&(t=bt(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 ni(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(wo(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Zn(s)||Wl(s)||r.includes(s))return r;const i=bt(e).getComputedStyle(s);return s!==e&&Zg(s,i)&&r.push(s),Xg(s,i)?r:n(s.parentNode)}return e?n(e):r}function sc(e){const[t]=ni(e,1);return t??null}function Eo(e){return!Rs||!e?null:ln(e)?e:_o(e)?wo(e)||e===cn(e).scrollingElement?window:Zn(e)?e:null:null}function ic(e){return ln(e)?e.scrollX:e.scrollLeft}function oc(e){return ln(e)?e.scrollY:e.scrollTop}function Oo(e){return{x:ic(e),y:oc(e)}}var Re;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Re||(Re={}));function ac(e){return!Rs||!e?!1:e===document.scrollingElement}function lc(e){const t={x:0,y:0},r=ac(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 Jg={x:.2,y:.2};function ey(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Jg);const{isTop:u,isBottom:d,isLeft:f,isRight:y}=lc(e),g={x:0,y:0},_={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+p.height?(g.y=Re.Backward,_.y=n*Math.abs((t.top+p.height-i)/p.height)):!d&&c>=t.bottom-p.height&&(g.y=Re.Forward,_.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!y&&a>=t.right-p.width?(g.x=Re.Forward,_.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(g.x=Re.Backward,_.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:g,speed:_}}function ty(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 cc(e){return e.reduce((t,r)=>un(t,Oo(r)),Wt)}function ry(e){return e.reduce((t,r)=>t+ic(r),0)}function ny(e){return e.reduce((t,r)=>t+oc(r),0)}function uc(e,t){if(t===void 0&&(t=dn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);sc(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sy=[["x",["left","right"],ry],["y",["top","bottom"],ny]];class Do{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=ni(r),s=cc(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of sy)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=a(n),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ns{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 iy(e){const{EventTarget:t}=bt(e);return e instanceof t?e:cn(e)}function Io(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 Ft;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ft||(Ft={}));function dc(e){e.preventDefault()}function oy(e){e.stopPropagation()}var ge;(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"})(ge||(ge={}));const fc={start:[ge.Space,ge.Enter],cancel:[ge.Esc],end:[ge.Space,ge.Enter,ge.Tab]},ay=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ge.Right:return{...r,x:r.x+25};case ge.Left:return{...r,x:r.x-25};case ge.Down:return{...r,y:r.y+25};case ge.Up:return{...r,y:r.y-25}}};class To{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 ns(cn(r)),this.windowListeners=new ns(bt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ft.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&uc(n),r(Wt)}handleKeyDown(t){if(ei(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=fc,coordinateGetter:o=ay,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:u}=n.current,d=u?{x:u.left,y:u.top}:Wt;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const y=rs(f,d),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const p of _){const v=t.code,{isTop:m,isRight:b,isLeft:S,isBottom:w,maxScroll:C,minScroll:D}=lc(p),x=ty(p),A={x:Math.min(v===ge.Right?x.right-x.width/2:x.right,Math.max(v===ge.Right?x.left:x.left+x.width/2,f.x)),y:Math.min(v===ge.Down?x.bottom-x.height/2:x.bottom,Math.max(v===ge.Down?x.top:x.top+x.height/2,f.y))},F=v===ge.Right&&!b||v===ge.Left&&!S,k=v===ge.Down&&!w||v===ge.Up&&!m;if(F&&A.x!==f.x){const P=p.scrollLeft+y.x,z=v===ge.Right&&P<=C.x||v===ge.Left&&P>=D.x;if(z&&!y.y){p.scrollTo({left:P,behavior:a});return}z?g.x=p.scrollLeft-P:g.x=v===ge.Right?p.scrollLeft-C.x:p.scrollLeft-D.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(k&&A.y!==f.y){const P=p.scrollTop+y.y,z=v===ge.Down&&P<=C.y||v===ge.Up&&P>=D.y;if(z&&!y.x){p.scrollTo({top:P,behavior:a});return}z?g.y=p.scrollTop-P:g.y=v===ge.Down?p.scrollTop-C.y:p.scrollTop-D.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,un(rs(f,this.referenceCoordinates),g))}}}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()}}To.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=fc,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 hc(e){return!!(e&&"distance"in e)}function pc(e){return!!(e&&"delay"in e)}class No{constructor(t,r,n){var s;n===void 0&&(n=iy(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=cn(o),this.documentListeners=new ns(this.document),this.listeners=new ns(n),this.windowListeners=new ns(bt(o)),this.initialCoordinates=(s=ti(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(Ft.Resize,this.handleCancel),this.windowListeners.add(Ft.DragStart,dc),this.windowListeners.add(Ft.VisibilityChange,this.handleCancel),this.windowListeners.add(Ft.ContextMenu,dc),this.documentListeners.add(Ft.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(hc(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(Ft.Click,oy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ft.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=ti(t))!=null?r:Wt,u=rs(s,c);if(!n&&a){if(hc(a)){if(a.tolerance!=null&&Io(u,a.tolerance))return this.handleCancel();if(Io(u,a.distance))return this.handleStart()}if(pc(a)&&Io(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);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===ge.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ly={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class si extends No{constructor(t){const{event:r}=t,n=cn(r.target);super(t,ly,n)}}si.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 cy={move:{name:"mousemove"},end:{name:"mouseup"}};var xo;(function(e){e[e.RightClick=2]="RightClick"})(xo||(xo={}));class uy extends No{constructor(t){super(t,cy,cn(t.event.target))}}uy.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===xo.RightClick?!1:(n==null||n({event:r}),!0)}}];const ko={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dy extends No{constructor(t){super(t,ko)}static setup(){return window.addEventListener(ko.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ko.move.name,t)};function t(){}}}dy.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 ss;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ss||(ss={}));var ii;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ii||(ii={}));function fy(e){let{acceleration:t,activator:r=ss.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=ii.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:y}=e;const g=py({delta:f,disabled:!i}),[_,p]=Dg(),v=h.useRef({x:0,y:0}),m=h.useRef({x:0,y:0}),b=h.useMemo(()=>{switch(r){case ss.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ss.DraggableRect:return s}},[r,s,c]),S=h.useRef(null),w=h.useCallback(()=>{const D=S.current;if(!D)return;const x=v.current.x*m.current.x,A=v.current.y*m.current.y;D.scrollBy(x,A)},[]),C=h.useMemo(()=>a===ii.TreeOrder?[...u].reverse():u,[a,u]);h.useEffect(()=>{if(!i||!u.length||!b){p();return}for(const D of C){if((n==null?void 0:n(D))===!1)continue;const x=u.indexOf(D),A=d[x];if(!A)continue;const{direction:F,speed:k}=ey(D,A,b,t,y);for(const P of["x","y"])g[P][F[P]]||(k[P]=0,F[P]=0);if(k.x>0||k.y>0){p(),S.current=D,_(w,o),v.current=k,m.current=F;return}}v.current={x:0,y:0},m.current={x:0,y:0},p()},[t,w,n,p,i,o,JSON.stringify(b),JSON.stringify(g),_,u,C,d,JSON.stringify(y)])}const hy={x:{[Re.Backward]:!1,[Re.Forward]:!1},y:{[Re.Backward]:!1,[Re.Forward]:!1}};function py(e){let{delta:t,disabled:r}=e;const n=Js(t);return es(s=>{if(r||!n||!s)return hy;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Re.Backward]:s.x[Re.Backward]||i.x===-1,[Re.Forward]:s.x[Re.Forward]||i.x===1},y:{[Re.Backward]:s.y[Re.Backward]||i.y===-1,[Re.Forward]:s.y[Re.Forward]||i.y===1}}},[r,t,n])}function gy(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return es(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function yy(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 is;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(is||(is={}));var Ao;(function(e){e.Optimized="optimized"})(Ao||(Ao={}));const gc=new Map;function vy(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=h.useState(null),{frequency:a,measure:c,strategy:u}=s,d=h.useRef(e),f=v(),y=Jn(f),g=h.useCallback(function(m){m===void 0&&(m=[]),!y.current&&o(b=>b===null?m:b.concat(m.filter(S=>!b.includes(S))))},[y]),_=h.useRef(null),p=es(m=>{if(f&&!r)return gc;if(!m||m===gc||d.current!==e||i!=null){const b=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){b.set(S.id,S.rect.current);continue}const w=S.node.current,C=w?new Do(c(w),w):null;S.rect.current=C,C&&b.set(S.id,C)}return b}return m},[e,i,r,f,c]);return h.useEffect(()=>{d.current=e},[e]),h.useEffect(()=>{f||g()},[r,f]),h.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:i!=null};function v(){switch(u){case is.Always:return!1;case is.BeforeDragging:return r;default:return!r}}}function Po(e,t){return es(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function my(e,t){return Po(e,t)}function by(e){let{callback:t,disabled:r}=e;const n=Xs(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 oi(e){let{callback:t,disabled:r}=e;const n=Xs(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 _y(e){return new Do(dn(e),e)}function yc(e,t,r){t===void 0&&(t=_y);const[n,s]=h.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??r)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=by({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=oi({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 wy(e){const t=Po(e);return tc(e,t)}const vc=[];function Sy(e){const t=h.useRef(e),r=es(n=>e?n&&n!==vc&&e&&t.current&&e.parentNode===t.current.parentNode?n:ni(e):vc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function Cy(e){const[t,r]=h.useState(null),n=h.useRef(e),s=h.useCallback(i=>{const o=Eo(i.target);o&&r(a=>a?(a.set(o,Oo(o)),new Map(a)):null)},[]);return h.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const u=Eo(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Oo(u)]):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 u=Eo(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>un(i,o),Wt):cc(e):Wt,[e,t])}function mc(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?rs(e,r.current):Wt}function Ey(e){h.useEffect(()=>{if(!Rs)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 Oy(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 bc(e){return h.useMemo(()=>e?Rg(e):null,[e])}const _c=[];function Dy(e,t){t===void 0&&(t=dn);const[r]=e,n=bc(r?bt(r):null),[s,i]=h.useState(_c);function o(){i(()=>e.length?e.map(c=>ac(c)?n:new Do(t(c),c)):_c)}const a=oi({callback:o});return Ht(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function wc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zn(t)?t:e}function Iy(e){let{measure:t}=e;const[r,n]=h.useState(null),s=h.useCallback(u=>{for(const{target:d}of u)if(Zn(d)){n(f=>{const y=t(d);return f?{...f,width:y.width,height:y.height}:y});break}},[t]),i=oi({callback:s}),o=h.useCallback(u=>{const d=wc(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[a,c]=Zs(o);return h.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Ty=[{sensor:si,options:{}},{sensor:To,options:{}}],Ny={current:{}},ai={draggable:{measure:nc},droppable:{measure:nc,strategy:is.WhileDragging,frequency:Ao.Optimized},dragOverlay:{measure:dn}};class os 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 xy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new os,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ri},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ai,measureDroppableContainers:ri,windowRect:null,measuringScheduled:!1},Sc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ri,draggableNodes:new Map,over:null,measureDroppableContainers:ri},as=h.createContext(Sc),Cc=h.createContext(xy);function ky(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new os}}}function Ay(e,t){switch(t.type){case Ye.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ye.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 Ye.DragEnd:case Ye.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ye.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new os(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Ye.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 os(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Ye.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new os(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Py(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=h.useContext(as),i=Js(n),o=Js(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!ei(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Ng(d);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Ec(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function My(e){return h.useMemo(()=>({draggable:{...ai.draggable,...e==null?void 0:e.draggable},droppable:{...ai.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ai.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 Ly(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 u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=r(u),f=tc(d,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const y=sc(u);y&&y.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const li=h.createContext({...Wt,scaleX:1,scaleY:1});var Sr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Sr||(Sr={}));const Oc=h.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=Ty,collisionDetection:f=Hg,measuring:y,modifiers:g,..._}=t;const p=h.useReducer(Ay,void 0,ky),[v,m]=p,[b,S]=Lg(),[w,C]=h.useState(Sr.Uninitialized),D=w===Sr.Initialized,{draggable:{active:x,nodes:A,translate:F},droppable:{containers:k}}=v,P=x!=null?A.get(x):null,z=h.useRef({initial:null,translated:null}),M=h.useMemo(()=>{var tt;return x!=null?{id:x,data:(tt=P==null?void 0:P.data)!=null?tt:Ny,rect:z}:null},[x,P]),H=h.useRef(null),[$,se]=h.useState(null),[ue,K]=h.useState(null),V=Jn(_,Object.values(_)),X=ts("DndDescribedBy",o),j=h.useMemo(()=>k.getEnabled(),[k]),G=My(y),{droppableRects:Z,measureDroppableContainers:ve,measuringScheduled:Ie}=vy(j,{dragging:D,dependencies:[F.x,F.y],config:G.droppable}),J=gy(A,x),Se=h.useMemo(()=>ue?ti(ue):null,[ue]),re=an(),me=my(J,G.draggable.measure);Ly({activeNode:x!=null?A.get(x):null,config:re.layoutShiftCompensation,initialRect:me,measure:G.draggable.measure});const oe=yc(J,G.draggable.measure,me),yt=yc(J?J.parentElement:null),Ne=h.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ot=k.getNodeFor((r=Ne.current.over)==null?void 0:r.id),et=Iy({measure:G.dragOverlay.measure}),qe=(n=et.nodeRef.current)!=null?n:J,te=D?(s=et.rect)!=null?s:oe:null,Ke=!!(et.nodeRef.current&&et.rect),vt=wy(Ke?null:oe),Ge=bc(qe?bt(qe):null),Be=Sy(D?ot??J:null),Mt=Dy(Be),zt=Ec(g,{transform:{x:F.x-vt.x,y:F.y-vt.y,scaleX:1,scaleY:1},activatorEvent:ue,active:M,activeNodeRect:oe,containerNodeRect:yt,draggingNodeRect:te,over:Ne.current.over,overlayNodeRect:et.rect,scrollableAncestors:Be,scrollableAncestorRects:Mt,windowRect:Ge}),to=Se?un(Se,F):null,al=Cy(Be),Kh=mc(al),ro=mc(al,[oe]),E=un(zt,Kh),T=te?Gg(te,zt):null,N=M&&T?f({active:M,collisionRect:T,droppableRects:Z,droppableContainers:j,pointerCoordinates:to}):null,B=Jl(N,"id"),[U,Q]=h.useState(null),q=Ke?zt:un(zt,ro),ee=Wg(q,(i=U==null?void 0:U.rect)!=null?i:null,oe),de=h.useRef(null),Ve=h.useCallback((tt,mt)=>{let{sensor:wt,options:Zt}=mt;if(H.current==null)return;const qt=A.get(H.current);if(!qt)return;const Lt=tt.nativeEvent,ar=new wt({active:H.current,activeNode:qt,event:Lt,options:Zt,context:Ne,onAbort(at){if(!A.get(at))return;const{onDragAbort:lr}=V.current,gr={id:at};lr==null||lr(gr),b({type:"onDragAbort",event:gr})},onPending(at,Mr,lr,gr){if(!A.get(at))return;const{onDragPending:Bs}=V.current,Lr={id:at,constraint:Mr,initialCoordinates:lr,offset:gr};Bs==null||Bs(Lr),b({type:"onDragPending",event:Lr})},onStart(at){const Mr=H.current;if(Mr==null)return;const lr=A.get(Mr);if(!lr)return;const{onDragStart:gr}=V.current,js={activatorEvent:Lt,active:{id:Mr,data:lr.data,rect:z}};Le.unstable_batchedUpdates(()=>{gr==null||gr(js),C(Sr.Initializing),m({type:Ye.DragStart,initialCoordinates:at,active:Mr}),b({type:"onDragStart",event:js}),se(de.current),K(Lt)})},onMove(at){m({type:Ye.DragMove,coordinates:at})},onEnd:Kn(Ye.DragEnd),onCancel:Kn(Ye.DragCancel)});de.current=ar;function Kn(at){return async function(){const{active:lr,collisions:gr,over:js,scrollAdjustedTranslate:Bs}=Ne.current;let Lr=null;if(lr&&Bs){const{cancelDrop:Vs}=V.current;Lr={activatorEvent:Lt,active:lr,collisions:gr,delta:Bs,over:js},at===Ye.DragEnd&&typeof Vs=="function"&&await Promise.resolve(Vs(Lr))&&(at=Ye.DragCancel)}H.current=null,Le.unstable_batchedUpdates(()=>{m({type:at}),C(Sr.Uninitialized),Q(null),se(null),K(null),de.current=null;const Vs=at===Ye.DragEnd?"onDragEnd":"onDragCancel";if(Lr){const ll=V.current[Vs];ll==null||ll(Lr),b({type:Vs,event:Lr})}})}}},[A]),It=h.useCallback((tt,mt)=>(wt,Zt)=>{const qt=wt.nativeEvent,Lt=A.get(Zt);if(H.current!==null||!Lt||qt.dndKit||qt.defaultPrevented)return;const ar={active:Lt};tt(wt,mt.options,ar)===!0&&(qt.dndKit={capturedBy:mt.sensor},H.current=Zt,Ve(wt,mt))},[A,Ve]),Tt=yy(d,It);Ey(d),Ht(()=>{oe&&w===Sr.Initializing&&C(Sr.Initialized)},[oe,w]),h.useEffect(()=>{const{onDragMove:tt}=V.current,{active:mt,activatorEvent:wt,collisions:Zt,over:qt}=Ne.current;if(!mt||!wt)return;const Lt={active:mt,activatorEvent:wt,collisions:Zt,delta:{x:E.x,y:E.y},over:qt};Le.unstable_batchedUpdates(()=>{tt==null||tt(Lt),b({type:"onDragMove",event:Lt})})},[E.x,E.y]),h.useEffect(()=>{const{active:tt,activatorEvent:mt,collisions:wt,droppableContainers:Zt,scrollAdjustedTranslate:qt}=Ne.current;if(!tt||H.current==null||!mt||!qt)return;const{onDragOver:Lt}=V.current,ar=Zt.get(B),Kn=ar&&ar.rect.current?{id:ar.id,rect:ar.rect.current,data:ar.data,disabled:ar.disabled}:null,at={active:tt,activatorEvent:mt,collisions:wt,delta:{x:qt.x,y:qt.y},over:Kn};Le.unstable_batchedUpdates(()=>{Q(Kn),Lt==null||Lt(at),b({type:"onDragOver",event:at})})},[B]),Ht(()=>{Ne.current={activatorEvent:ue,active:M,activeNode:J,collisionRect:T,collisions:N,droppableRects:Z,draggableNodes:A,draggingNode:qe,draggingNodeRect:te,droppableContainers:k,over:U,scrollableAncestors:Be,scrollAdjustedTranslate:E},z.current={initial:te,translated:T}},[M,J,N,T,A,qe,te,Z,k,U,Be,E]),fy({...re,delta:F,draggingRect:T,pointerCoordinates:to,scrollableAncestors:Be,scrollableAncestorRects:Mt});const pr=h.useMemo(()=>({active:M,activeNode:J,activeNodeRect:oe,activatorEvent:ue,collisions:N,containerNodeRect:yt,dragOverlay:et,draggableNodes:A,droppableContainers:k,droppableRects:Z,over:U,measureDroppableContainers:ve,scrollableAncestors:Be,scrollableAncestorRects:Mt,measuringConfiguration:G,measuringScheduled:Ie,windowRect:Ge}),[M,J,oe,ue,N,yt,et,A,k,Z,U,ve,Be,Mt,G,Ie,Ge]),$s=h.useMemo(()=>({activatorEvent:ue,activators:Tt,active:M,activeNodeRect:oe,ariaDescribedById:{draggable:X},dispatch:m,draggableNodes:A,over:U,measureDroppableContainers:ve}),[ue,Tt,M,oe,m,X,A,U,ve]);return h.createElement(Ql.Provider,{value:S},h.createElement(as.Provider,{value:$s},h.createElement(Cc.Provider,{value:pr},h.createElement(li.Provider,{value:ee},u)),h.createElement(Py,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(jg,{...a,hiddenTextDescribedById:X}));function an(){const tt=($==null?void 0:$.autoScrollEnabled)===!1,mt=typeof c=="object"?c.enabled===!1:c===!1,wt=D&&!tt&&!mt;return typeof c=="object"?{...c,enabled:wt}:{enabled:wt}}}),Fy=h.createContext(null),Dc="button",$y="Draggable";function Ic(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=ts($y),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:y}=h.useContext(as),{role:g=Dc,roleDescription:_="draggable",tabIndex:p=0}=s??{},v=(c==null?void 0:c.id)===t,m=h.useContext(v?li:Fy),[b,S]=Zs(),[w,C]=Zs(),D=Oy(o,t),x=Jn(r);Ht(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:x}),()=>{const F=f.get(t);F&&F.key===i&&f.delete(t)}),[f,t]);const A=h.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":n,"aria-pressed":v&&g===Dc?!0:void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[n,g,p,v,_,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:A,isDragging:v,listeners:n?void 0:D,node:b,over:y,setNodeRef:S,setActivatorNodeRef:C,transform:m}}function Tc(){return h.useContext(Cc)}const jy="Droppable",By={timeout:25};function Vy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=ts(jy),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=h.useContext(as),d=h.useRef({disabled:r}),f=h.useRef(!1),y=h.useRef(null),g=h.useRef(null),{disabled:_,updateMeasurementsFor:p,timeout:v}={...By,...s},m=Jn(p??n),b=h.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),g.current=null},v)},[v]),S=oi({callback:b,disabled:_||!o}),w=h.useCallback((A,F)=>{S&&(F&&(S.unobserve(F),f.current=!1),A&&S.observe(A))},[S]),[C,D]=Zs(w),x=Jn(t);return h.useEffect(()=>{!S||!C.current||(S.disconnect(),f.current=!1,S.observe(C.current))},[C,S]),h.useEffect(()=>(a({type:Ye.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:y,data:x}}),()=>a({type:Ye.UnregisterDroppable,key:i,id:n})),[n]),h.useEffect(()=>{r!==d.current.disabled&&(a({type:Ye.SetDroppableDisabled,id:n,key:i,disabled:r}),d.current.disabled=r)},[n,i,r,a]),{active:o,rect:y,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:D}}function Uy(e){let{animation:t,children:r}=e;const[n,s]=h.useState(null),[i,o]=h.useState(null),a=Js(r);return!r&&!n&&a&&s(a),Ht(()=>{if(!i)return;const c=n==null?void 0:n.key,u=n==null?void 0:n.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,n,i]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:o}):null)}const zy={x:0,y:0,scaleX:1,scaleY:1};function qy(e){let{children:t}=e;return h.createElement(as.Provider,{value:Sc},h.createElement(li.Provider,{value:zy},t))}const Hy={position:"fixed",touchAction:"none"},Wy=e=>ei(e)?"transform 250ms ease":void 0,Ky=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:u,transition:d=Wy}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},y={...Hy,width:a.width,height:a.height,top:a.top,left:a.left,transform:wr.Transform.toString(f),transformOrigin:s&&n?Bg(n,a):void 0,transition:typeof d=="function"?d(n):d,...c};return h.createElement(r,{className:o,style:y,ref:t},i)}),Gy={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:wr.Transform.toString(t)},{transform:wr.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,u]of Object.entries(s))r.node.style.setProperty(c,u);o!=null&&o.active&&r.node.classList.remove(o.active)}})({styles:{active:{opacity:"0"}}})};function Qy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Xs((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=wc(o);if(!u)return;const{transform:d}=bt(o).getComputedStyle(o),f=rc(d);if(!f)return;const y=typeof t=="function"?t:Yy(t);return uc(c,s.draggable.measure),y({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Yy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Gy,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={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},y={x:c.x-d.x,y:c.y-d.y,...f},g=s({...u,active:o,dragOverlay:a,transform:{initial:c,final:y}}),[_]=g,p=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(p))return;const v=n==null?void 0:n({active:o,dragOverlay:a,...u}),m=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{m.onfinish=()=>{v==null||v(),b()}})}}let Nc=0;function Ry(e){return h.useMemo(()=>{if(e!=null)return Nc++,Nc},[e])}const Xy=h.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:y,containerNodeRect:g,draggableNodes:_,droppableContainers:p,dragOverlay:v,over:m,measuringConfiguration:b,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:C}=Tc(),D=h.useContext(li),x=Ry(f==null?void 0:f.id),A=Ec(o,{activatorEvent:d,active:f,activeNodeRect:y,containerNodeRect:g,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:D,windowRect:C}),F=Po(y),k=Qy({config:n,draggableNodes:_,droppableContainers:p,measuringConfiguration:b}),P=F?v.setRef:void 0;return h.createElement(qy,null,h.createElement(Uy,{animation:k},f&&x?h.createElement(Ky,{key:x,id:f.id,ref:P,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:F,style:{zIndex:u,...s},transform:A},r):null))});/**
181
+ `},$g={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 jg(e){let{announcements:t=$g,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Fg}=e;const{announce:i,announcement:o}=Pg(),a=ts("DndLiveRegion"),[c,u]=h.useState(!1);if(h.useEffect(()=>{u(!0)},[]),Mg(h.useMemo(()=>({onDragStart(f){let{active:y}=f;i(t.onDragStart({active:y}))},onDragMove(f){let{active:y,over:g}=f;t.onDragMove&&i(t.onDragMove({active:y,over:g}))},onDragOver(f){let{active:y,over:g}=f;i(t.onDragOver({active:y,over:g}))},onDragEnd(f){let{active:y,over:g}=f;i(t.onDragEnd({active:y,over:g}))},onDragCancel(f){let{active:y,over:g}=f;i(t.onDragCancel({active:y,over:g}))}}),[i,t])),!c)return null;const d=h.createElement(h.Fragment,null,h.createElement(kg,{id:n,value:s.draggable}),h.createElement(Ag,{id:a,announcement:o}));return r?Fe.createPortal(d,r):d}var Qe;(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"})(Qe||(Qe={}));function ri(){}function Co(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Yl(){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 Ht=Object.freeze({x:0,y:0});function Rl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bg(e,t){const r=ti(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 Xl(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 Zl(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 Jl(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function ec(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 Ug=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=ec(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Rl(ec(c),s);i.push({id:a,data:{droppableContainer:o,value:u}})}}return i.sort(Xl)},zg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Zl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Zl(c),d=s.reduce((y,g,_)=>y+Rl(u[_],g),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(Xl)};function qg(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,u=e.width*e.height,d=o*a,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const Hg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=[];for(const i of n){const{id:o}=i,a=r.get(o);if(a){const c=qg(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Vg)};function Wg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function tc(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ht}function Kg(e){return function(r){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...r})}}const Gg=Kg(1);function rc(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 Qg(e,t,r){const n=rc(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),u=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Yg={ignoreTransform:!1};function dn(e,t){t===void 0&&(t=Yg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=mt(e).getComputedStyle(e);u&&(r=Qg(r,u,d))}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 nc(e){return dn(e,{ignoreTransform:!0})}function Rg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Xg(e,t){return t===void 0&&(t=mt(e).getComputedStyle(e)),t.position==="fixed"}function Zg(e,t){t===void 0&&(t=mt(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 ni(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(wo(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Zn(s)||Wl(s)||r.includes(s))return r;const i=mt(e).getComputedStyle(s);return s!==e&&Zg(s,i)&&r.push(s),Xg(s,i)?r:n(s.parentNode)}return e?n(e):r}function sc(e){const[t]=ni(e,1);return t??null}function Oo(e){return!Rs||!e?null:ln(e)?e:_o(e)?wo(e)||e===cn(e).scrollingElement?window:Zn(e)?e:null:null}function ic(e){return ln(e)?e.scrollX:e.scrollLeft}function oc(e){return ln(e)?e.scrollY:e.scrollTop}function Eo(e){return{x:ic(e),y:oc(e)}}var Ye;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ye||(Ye={}));function ac(e){return!Rs||!e?!1:e===document.scrollingElement}function lc(e){const t={x:0,y:0},r=ac(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 Jg={x:.2,y:.2};function ey(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Jg);const{isTop:u,isBottom:d,isLeft:f,isRight:y}=lc(e),g={x:0,y:0},_={x:0,y:0},p={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+p.height?(g.y=Ye.Backward,_.y=n*Math.abs((t.top+p.height-i)/p.height)):!d&&c>=t.bottom-p.height&&(g.y=Ye.Forward,_.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!y&&a>=t.right-p.width?(g.x=Ye.Forward,_.x=n*Math.abs((t.right-p.width-a)/p.width)):!f&&o<=t.left+p.width&&(g.x=Ye.Backward,_.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:g,speed:_}}function ty(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 cc(e){return e.reduce((t,r)=>un(t,Eo(r)),Ht)}function ry(e){return e.reduce((t,r)=>t+ic(r),0)}function ny(e){return e.reduce((t,r)=>t+oc(r),0)}function uc(e,t){if(t===void 0&&(t=dn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);sc(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sy=[["x",["left","right"],ry],["y",["top","bottom"],ny]];class Do{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=ni(r),s=cc(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of sy)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=a(n),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ns{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 iy(e){const{EventTarget:t}=mt(e);return e instanceof t?e:cn(e)}function Io(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 Lt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Lt||(Lt={}));function dc(e){e.preventDefault()}function oy(e){e.stopPropagation()}var ge;(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"})(ge||(ge={}));const fc={start:[ge.Space,ge.Enter],cancel:[ge.Esc],end:[ge.Space,ge.Enter,ge.Tab]},ay=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ge.Right:return{...r,x:r.x+25};case ge.Left:return{...r,x:r.x-25};case ge.Down:return{...r,y:r.y+25};case ge.Up:return{...r,y:r.y-25}}};class To{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 ns(cn(r)),this.windowListeners=new ns(mt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Lt.Resize,this.handleCancel),this.windowListeners.add(Lt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Lt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&uc(n),r(Ht)}handleKeyDown(t){if(ei(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=fc,coordinateGetter:o=ay,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:u}=n.current,d=u?{x:u.left,y:u.top}:Ht;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const y=rs(f,d),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const p of _){const v=t.code,{isTop:m,isRight:b,isLeft:S,isBottom:w,maxScroll:O,minScroll:I}=lc(p),k=ty(p),P={x:Math.min(v===ge.Right?k.right-k.width/2:k.right,Math.max(v===ge.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===ge.Down?k.bottom-k.height/2:k.bottom,Math.max(v===ge.Down?k.top:k.top+k.height/2,f.y))},$=v===ge.Right&&!b||v===ge.Left&&!S,T=v===ge.Down&&!w||v===ge.Up&&!m;if($&&P.x!==f.x){const A=p.scrollLeft+y.x,F=v===ge.Right&&A<=O.x||v===ge.Left&&A>=I.x;if(F&&!y.y){p.scrollTo({left:A,behavior:a});return}F?g.x=p.scrollLeft-A:g.x=v===ge.Right?p.scrollLeft-O.x:p.scrollLeft-I.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(T&&P.y!==f.y){const A=p.scrollTop+y.y,F=v===ge.Down&&A<=O.y||v===ge.Up&&A>=I.y;if(F&&!y.x){p.scrollTo({top:A,behavior:a});return}F?g.y=p.scrollTop-A:g.y=v===ge.Down?p.scrollTop-O.y:p.scrollTop-I.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,un(rs(f,this.referenceCoordinates),g))}}}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()}}To.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=fc,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 hc(e){return!!(e&&"distance"in e)}function pc(e){return!!(e&&"delay"in e)}class No{constructor(t,r,n){var s;n===void 0&&(n=iy(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=cn(o),this.documentListeners=new ns(this.document),this.listeners=new ns(n),this.windowListeners=new ns(mt(o)),this.initialCoordinates=(s=ti(i))!=null?s:Ht,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(Lt.Resize,this.handleCancel),this.windowListeners.add(Lt.DragStart,dc),this.windowListeners.add(Lt.VisibilityChange,this.handleCancel),this.windowListeners.add(Lt.ContextMenu,dc),this.documentListeners.add(Lt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pc(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(hc(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(Lt.Click,oy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Lt.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=ti(t))!=null?r:Ht,u=rs(s,c);if(!n&&a){if(hc(a)){if(a.tolerance!=null&&Io(u,a.tolerance))return this.handleCancel();if(Io(u,a.distance))return this.handleStart()}if(pc(a)&&Io(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);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===ge.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ly={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class si extends No{constructor(t){const{event:r}=t,n=cn(r.target);super(t,ly,n)}}si.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 cy={move:{name:"mousemove"},end:{name:"mouseup"}};var xo;(function(e){e[e.RightClick=2]="RightClick"})(xo||(xo={}));class uy extends No{constructor(t){super(t,cy,cn(t.event.target))}}uy.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===xo.RightClick?!1:(n==null||n({event:r}),!0)}}];const ko={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dy extends No{constructor(t){super(t,ko)}static setup(){return window.addEventListener(ko.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ko.move.name,t)};function t(){}}}dy.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 ss;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ss||(ss={}));var ii;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ii||(ii={}));function fy(e){let{acceleration:t,activator:r=ss.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=ii.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:y}=e;const g=py({delta:f,disabled:!i}),[_,p]=Dg(),v=h.useRef({x:0,y:0}),m=h.useRef({x:0,y:0}),b=h.useMemo(()=>{switch(r){case ss.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ss.DraggableRect:return s}},[r,s,c]),S=h.useRef(null),w=h.useCallback(()=>{const I=S.current;if(!I)return;const k=v.current.x*m.current.x,P=v.current.y*m.current.y;I.scrollBy(k,P)},[]),O=h.useMemo(()=>a===ii.TreeOrder?[...u].reverse():u,[a,u]);h.useEffect(()=>{if(!i||!u.length||!b){p();return}for(const I of O){if((n==null?void 0:n(I))===!1)continue;const k=u.indexOf(I),P=d[k];if(!P)continue;const{direction:$,speed:T}=ey(I,P,b,t,y);for(const A of["x","y"])g[A][$[A]]||(T[A]=0,$[A]=0);if(T.x>0||T.y>0){p(),S.current=I,_(w,o),v.current=T,m.current=$;return}}v.current={x:0,y:0},m.current={x:0,y:0},p()},[t,w,n,p,i,o,JSON.stringify(b),JSON.stringify(g),_,u,O,d,JSON.stringify(y)])}const hy={x:{[Ye.Backward]:!1,[Ye.Forward]:!1},y:{[Ye.Backward]:!1,[Ye.Forward]:!1}};function py(e){let{delta:t,disabled:r}=e;const n=Js(t);return es(s=>{if(r||!n||!s)return hy;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Ye.Backward]:s.x[Ye.Backward]||i.x===-1,[Ye.Forward]:s.x[Ye.Forward]||i.x===1},y:{[Ye.Backward]:s.y[Ye.Backward]||i.y===-1,[Ye.Forward]:s.y[Ye.Forward]||i.y===1}}},[r,t,n])}function gy(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return es(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function yy(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 is;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(is||(is={}));var Ao;(function(e){e.Optimized="optimized"})(Ao||(Ao={}));const gc=new Map;function vy(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=h.useState(null),{frequency:a,measure:c,strategy:u}=s,d=h.useRef(e),f=v(),y=Jn(f),g=h.useCallback(function(m){m===void 0&&(m=[]),!y.current&&o(b=>b===null?m:b.concat(m.filter(S=>!b.includes(S))))},[y]),_=h.useRef(null),p=es(m=>{if(f&&!r)return gc;if(!m||m===gc||d.current!==e||i!=null){const b=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){b.set(S.id,S.rect.current);continue}const w=S.node.current,O=w?new Do(c(w),w):null;S.rect.current=O,O&&b.set(S.id,O)}return b}return m},[e,i,r,f,c]);return h.useEffect(()=>{d.current=e},[e]),h.useEffect(()=>{f||g()},[r,f]),h.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:i!=null};function v(){switch(u){case is.Always:return!1;case is.BeforeDragging:return r;default:return!r}}}function Po(e,t){return es(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function my(e,t){return Po(e,t)}function by(e){let{callback:t,disabled:r}=e;const n=Xs(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 oi(e){let{callback:t,disabled:r}=e;const n=Xs(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 _y(e){return new Do(dn(e),e)}function yc(e,t,r){t===void 0&&(t=_y);const[n,s]=h.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??r)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=by({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=oi({callback:i});return qt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function wy(e){const t=Po(e);return tc(e,t)}const vc=[];function Sy(e){const t=h.useRef(e),r=es(n=>e?n&&n!==vc&&e&&t.current&&e.parentNode===t.current.parentNode?n:ni(e):vc,[e]);return h.useEffect(()=>{t.current=e},[e]),r}function Cy(e){const[t,r]=h.useState(null),n=h.useRef(e),s=h.useCallback(i=>{const o=Oo(i.target);o&&r(a=>a?(a.set(o,Eo(o)),new Map(a)):null)},[]);return h.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const u=Oo(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,Eo(u)]):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 u=Oo(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>un(i,o),Ht):cc(e):Ht,[e,t])}function mc(e,t){t===void 0&&(t=[]);const r=h.useRef(null);return h.useEffect(()=>{r.current=null},t),h.useEffect(()=>{const n=e!==Ht;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?rs(e,r.current):Ht}function Oy(e){h.useEffect(()=>{if(!Rs)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 Ey(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 bc(e){return h.useMemo(()=>e?Rg(e):null,[e])}const _c=[];function Dy(e,t){t===void 0&&(t=dn);const[r]=e,n=bc(r?mt(r):null),[s,i]=h.useState(_c);function o(){i(()=>e.length?e.map(c=>ac(c)?n:new Do(t(c),c)):_c)}const a=oi({callback:o});return qt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function wc(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zn(t)?t:e}function Iy(e){let{measure:t}=e;const[r,n]=h.useState(null),s=h.useCallback(u=>{for(const{target:d}of u)if(Zn(d)){n(f=>{const y=t(d);return f?{...f,width:y.width,height:y.height}:y});break}},[t]),i=oi({callback:s}),o=h.useCallback(u=>{const d=wc(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[a,c]=Zs(o);return h.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Ty=[{sensor:si,options:{}},{sensor:To,options:{}}],Ny={current:{}},ai={draggable:{measure:nc},droppable:{measure:nc,strategy:is.WhileDragging,frequency:Ao.Optimized},dragOverlay:{measure:dn}};class os 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 xy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new os,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ri},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ai,measureDroppableContainers:ri,windowRect:null,measuringScheduled:!1},Sc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ri,draggableNodes:new Map,over:null,measureDroppableContainers:ri},as=h.createContext(Sc),Cc=h.createContext(xy);function ky(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new os}}}function Ay(e,t){switch(t.type){case Qe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Qe.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 Qe.DragEnd:case Qe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qe.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new os(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Qe.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 os(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Qe.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new os(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Py(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=h.useContext(as),i=Js(n),o=Js(r==null?void 0:r.id);return h.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!ei(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:u}=a;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Ng(d);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Oc(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function My(e){return h.useMemo(()=>({draggable:{...ai.draggable,...e==null?void 0:e.draggable},droppable:{...ai.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ai.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 Ly(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;qt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=r(u),f=tc(d,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const y=sc(u);y&&y.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const li=h.createContext({...Ht,scaleX:1,scaleY:1});var Sr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Sr||(Sr={}));const Ec=h.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=Ty,collisionDetection:f=Hg,measuring:y,modifiers:g,..._}=t;const p=h.useReducer(Ay,void 0,ky),[v,m]=p,[b,S]=Lg(),[w,O]=h.useState(Sr.Uninitialized),I=w===Sr.Initialized,{draggable:{active:k,nodes:P,translate:$},droppable:{containers:T}}=v,A=k!=null?P.get(k):null,F=h.useRef({initial:null,translated:null}),M=h.useMemo(()=>{var et;return k!=null?{id:k,data:(et=A==null?void 0:A.data)!=null?et:Ny,rect:F}:null},[k,A]),V=h.useRef(null),[j,re]=h.useState(null),[ue,K]=h.useState(null),z=Jn(_,Object.values(_)),X=ts("DndDescribedBy",o),B=h.useMemo(()=>T.getEnabled(),[T]),G=My(y),{droppableRects:Z,measureDroppableContainers:ve,measuringScheduled:Te}=vy(B,{dragging:I,dependencies:[$.x,$.y],config:G.droppable}),J=gy(P,k),Ce=h.useMemo(()=>ue?ti(ue):null,[ue]),se=an(),me=my(J,G.draggable.measure);Ly({activeNode:k!=null?P.get(k):null,config:se.layoutShiftCompensation,initialRect:me,measure:G.draggable.measure});const oe=yc(J,G.draggable.measure,me),yt=yc(J?J.parentElement:null),Ee=h.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),it=T.getNodeFor((r=Ee.current.over)==null?void 0:r.id),Je=Iy({measure:G.dragOverlay.measure}),He=(n=Je.nodeRef.current)!=null?n:J,te=I?(s=Je.rect)!=null?s:oe:null,Me=!!(Je.nodeRef.current&&Je.rect),Ve=wy(Me?null:oe),ot=bc(He?mt(He):null),Dt=Sy(I?it??J:null),hr=Dy(Dt),Ut=Oc(g,{transform:{x:$.x-Ve.x,y:$.y-Ve.y,scaleX:1,scaleY:1},activatorEvent:ue,active:M,activeNodeRect:oe,containerNodeRect:yt,draggingNodeRect:te,over:Ee.current.over,overlayNodeRect:Je.rect,scrollableAncestors:Dt,scrollableAncestorRects:hr,windowRect:ot}),to=Ce?un(Ce,$):null,al=Cy(Dt),Kh=mc(al),ro=mc(al,[oe]),C=un(Ut,Kh),N=te?Gg(te,Ut):null,x=M&&N?f({active:M,collisionRect:N,droppableRects:Z,droppableContainers:B,pointerCoordinates:to}):null,U=Jl(x,"id"),[q,Q]=h.useState(null),H=Me?Ut:un(Ut,ro),ee=Wg(H,(i=q==null?void 0:q.rect)!=null?i:null,oe),de=h.useRef(null),Ue=h.useCallback((et,vt)=>{let{sensor:_t,options:Xt}=vt;if(V.current==null)return;const zt=P.get(V.current);if(!zt)return;const Mt=et.nativeEvent,or=new _t({active:V.current,activeNode:zt,event:Mt,options:Xt,context:Ee,onAbort(at){if(!P.get(at))return;const{onDragAbort:ar}=z.current,gr={id:at};ar==null||ar(gr),b({type:"onDragAbort",event:gr})},onPending(at,Mr,ar,gr){if(!P.get(at))return;const{onDragPending:Bs}=z.current,Lr={id:at,constraint:Mr,initialCoordinates:ar,offset:gr};Bs==null||Bs(Lr),b({type:"onDragPending",event:Lr})},onStart(at){const Mr=V.current;if(Mr==null)return;const ar=P.get(Mr);if(!ar)return;const{onDragStart:gr}=z.current,js={activatorEvent:Mt,active:{id:Mr,data:ar.data,rect:F}};Fe.unstable_batchedUpdates(()=>{gr==null||gr(js),O(Sr.Initializing),m({type:Qe.DragStart,initialCoordinates:at,active:Mr}),b({type:"onDragStart",event:js}),re(de.current),K(Mt)})},onMove(at){m({type:Qe.DragMove,coordinates:at})},onEnd:Kn(Qe.DragEnd),onCancel:Kn(Qe.DragCancel)});de.current=or;function Kn(at){return async function(){const{active:ar,collisions:gr,over:js,scrollAdjustedTranslate:Bs}=Ee.current;let Lr=null;if(ar&&Bs){const{cancelDrop:Vs}=z.current;Lr={activatorEvent:Mt,active:ar,collisions:gr,delta:Bs,over:js},at===Qe.DragEnd&&typeof Vs=="function"&&await Promise.resolve(Vs(Lr))&&(at=Qe.DragCancel)}V.current=null,Fe.unstable_batchedUpdates(()=>{m({type:at}),O(Sr.Uninitialized),Q(null),re(null),K(null),de.current=null;const Vs=at===Qe.DragEnd?"onDragEnd":"onDragCancel";if(Lr){const ll=z.current[Vs];ll==null||ll(Lr),b({type:Vs,event:Lr})}})}}},[P]),It=h.useCallback((et,vt)=>(_t,Xt)=>{const zt=_t.nativeEvent,Mt=P.get(Xt);if(V.current!==null||!Mt||zt.dndKit||zt.defaultPrevented)return;const or={active:Mt};et(_t,vt.options,or)===!0&&(zt.dndKit={capturedBy:vt.sensor},V.current=Xt,Ue(_t,vt))},[P,Ue]),Tt=yy(d,It);Oy(d),qt(()=>{oe&&w===Sr.Initializing&&O(Sr.Initialized)},[oe,w]),h.useEffect(()=>{const{onDragMove:et}=z.current,{active:vt,activatorEvent:_t,collisions:Xt,over:zt}=Ee.current;if(!vt||!_t)return;const Mt={active:vt,activatorEvent:_t,collisions:Xt,delta:{x:C.x,y:C.y},over:zt};Fe.unstable_batchedUpdates(()=>{et==null||et(Mt),b({type:"onDragMove",event:Mt})})},[C.x,C.y]),h.useEffect(()=>{const{active:et,activatorEvent:vt,collisions:_t,droppableContainers:Xt,scrollAdjustedTranslate:zt}=Ee.current;if(!et||V.current==null||!vt||!zt)return;const{onDragOver:Mt}=z.current,or=Xt.get(U),Kn=or&&or.rect.current?{id:or.id,rect:or.rect.current,data:or.data,disabled:or.disabled}:null,at={active:et,activatorEvent:vt,collisions:_t,delta:{x:zt.x,y:zt.y},over:Kn};Fe.unstable_batchedUpdates(()=>{Q(Kn),Mt==null||Mt(at),b({type:"onDragOver",event:at})})},[U]),qt(()=>{Ee.current={activatorEvent:ue,active:M,activeNode:J,collisionRect:N,collisions:x,droppableRects:Z,draggableNodes:P,draggingNode:He,draggingNodeRect:te,droppableContainers:T,over:q,scrollableAncestors:Dt,scrollAdjustedTranslate:C},F.current={initial:te,translated:N}},[M,J,x,N,P,He,te,Z,T,q,Dt,C]),fy({...se,delta:$,draggingRect:N,pointerCoordinates:to,scrollableAncestors:Dt,scrollableAncestorRects:hr});const pr=h.useMemo(()=>({active:M,activeNode:J,activeNodeRect:oe,activatorEvent:ue,collisions:x,containerNodeRect:yt,dragOverlay:Je,draggableNodes:P,droppableContainers:T,droppableRects:Z,over:q,measureDroppableContainers:ve,scrollableAncestors:Dt,scrollableAncestorRects:hr,measuringConfiguration:G,measuringScheduled:Te,windowRect:ot}),[M,J,oe,ue,x,yt,Je,P,T,Z,q,ve,Dt,hr,G,Te,ot]),$s=h.useMemo(()=>({activatorEvent:ue,activators:Tt,active:M,activeNodeRect:oe,ariaDescribedById:{draggable:X},dispatch:m,draggableNodes:P,over:q,measureDroppableContainers:ve}),[ue,Tt,M,oe,m,X,P,q,ve]);return h.createElement(Ql.Provider,{value:S},h.createElement(as.Provider,{value:$s},h.createElement(Cc.Provider,{value:pr},h.createElement(li.Provider,{value:ee},u)),h.createElement(Py,{disabled:(a==null?void 0:a.restoreFocus)===!1})),h.createElement(jg,{...a,hiddenTextDescribedById:X}));function an(){const et=(j==null?void 0:j.autoScrollEnabled)===!1,vt=typeof c=="object"?c.enabled===!1:c===!1,_t=I&&!et&&!vt;return typeof c=="object"?{...c,enabled:_t}:{enabled:_t}}}),Fy=h.createContext(null),Dc="button",$y="Draggable";function Ic(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=ts($y),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:y}=h.useContext(as),{role:g=Dc,roleDescription:_="draggable",tabIndex:p=0}=s??{},v=(c==null?void 0:c.id)===t,m=h.useContext(v?li:Fy),[b,S]=Zs(),[w,O]=Zs(),I=Ey(o,t),k=Jn(r);qt(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:k}),()=>{const $=f.get(t);$&&$.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":n,"aria-pressed":v&&g===Dc?!0:void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[n,g,p,v,_,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:P,isDragging:v,listeners:n?void 0:I,node:b,over:y,setNodeRef:S,setActivatorNodeRef:O,transform:m}}function Tc(){return h.useContext(Cc)}const jy="Droppable",By={timeout:25};function Vy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=ts(jy),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=h.useContext(as),d=h.useRef({disabled:r}),f=h.useRef(!1),y=h.useRef(null),g=h.useRef(null),{disabled:_,updateMeasurementsFor:p,timeout:v}={...By,...s},m=Jn(p??n),b=h.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),g.current=null},v)},[v]),S=oi({callback:b,disabled:_||!o}),w=h.useCallback((P,$)=>{S&&($&&(S.unobserve($),f.current=!1),P&&S.observe(P))},[S]),[O,I]=Zs(w),k=Jn(t);return h.useEffect(()=>{!S||!O.current||(S.disconnect(),f.current=!1,S.observe(O.current))},[O,S]),h.useEffect(()=>(a({type:Qe.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:y,data:k}}),()=>a({type:Qe.UnregisterDroppable,key:i,id:n})),[n]),h.useEffect(()=>{r!==d.current.disabled&&(a({type:Qe.SetDroppableDisabled,id:n,key:i,disabled:r}),d.current.disabled=r)},[n,i,r,a]),{active:o,rect:y,isOver:(c==null?void 0:c.id)===n,node:O,over:c,setNodeRef:I}}function Uy(e){let{animation:t,children:r}=e;const[n,s]=h.useState(null),[i,o]=h.useState(null),a=Js(r);return!r&&!n&&a&&s(a),qt(()=>{if(!i)return;const c=n==null?void 0:n.key,u=n==null?void 0:n.props.id;if(c==null||u==null){s(null);return}Promise.resolve(t(u,i)).then(()=>{s(null)})},[t,n,i]),h.createElement(h.Fragment,null,r,n?h.cloneElement(n,{ref:o}):null)}const zy={x:0,y:0,scaleX:1,scaleY:1};function qy(e){let{children:t}=e;return h.createElement(as.Provider,{value:Sc},h.createElement(li.Provider,{value:zy},t))}const Hy={position:"fixed",touchAction:"none"},Wy=e=>ei(e)?"transform 250ms ease":void 0,Ky=h.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:u,transition:d=Wy}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},y={...Hy,width:a.width,height:a.height,top:a.top,left:a.left,transform:wr.Transform.toString(f),transformOrigin:s&&n?Bg(n,a):void 0,transition:typeof d=="function"?d(n):d,...c};return h.createElement(r,{className:o,style:y,ref:t},i)}),Gy={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:wr.Transform.toString(t)},{transform:wr.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,u]of Object.entries(s))r.node.style.setProperty(c,u);o!=null&&o.active&&r.node.classList.remove(o.active)}})({styles:{active:{opacity:"0"}}})};function Qy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Xs((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=wc(o);if(!u)return;const{transform:d}=mt(o).getComputedStyle(o),f=rc(d);if(!f)return;const y=typeof t=="function"?t:Yy(t);return uc(c,s.draggable.measure),y({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function Yy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Gy,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...u}=i;if(!t)return;const d={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},y={x:c.x-d.x,y:c.y-d.y,...f},g=s({...u,active:o,dragOverlay:a,transform:{initial:c,final:y}}),[_]=g,p=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(p))return;const v=n==null?void 0:n({active:o,dragOverlay:a,...u}),m=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{m.onfinish=()=>{v==null||v(),b()}})}}let Nc=0;function Ry(e){return h.useMemo(()=>{if(e!=null)return Nc++,Nc},[e])}const Xy=h.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:y,containerNodeRect:g,draggableNodes:_,droppableContainers:p,dragOverlay:v,over:m,measuringConfiguration:b,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:O}=Tc(),I=h.useContext(li),k=Ry(f==null?void 0:f.id),P=Oc(o,{activatorEvent:d,active:f,activeNodeRect:y,containerNodeRect:g,draggingNodeRect:v.rect,over:m,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:I,windowRect:O}),$=Po(y),T=Qy({config:n,draggableNodes:_,droppableContainers:p,measuringConfiguration:b}),A=$?v.setRef:void 0;return h.createElement(qy,null,h.createElement(Uy,{animation:T},f&&k?h.createElement(Ky,{key:k,id:f.id,ref:A,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:$,style:{zIndex:u,...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.
@@ -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 zc;function Ev(){return zc||(zc=1,process.env.NODE_ENV!=="production"&&function(){function e(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}function t(g,_){d||s.startTransition===void 0||(d=!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=_();if(!f){var v=_();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:_}});var m=v[0].inst,b=v[1];return c(function(){m.value=p,m.getSnapshot=_,r(m)&&b({inst:m})},[g,p,_]),a(function(){return r(m)&&b({inst:m}),g(function(){r(m)&&b({inst:m})})},[g]),u(p),p}function r(g){var _=g.getSnapshot;g=g.value;try{var p=_();return!i(g,p)}catch{return!0}}function n(g,_){return _()}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,u=s.useDebugValue,d=!1,f=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Ko.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ko}var qc;function Go(){return qc||(qc=1,process.env.NODE_ENV==="production"?ui.exports=Cv():ui.exports=Ev()),ui.exports}/**
432
+ */var zc;function Ov(){return zc||(zc=1,process.env.NODE_ENV!=="production"&&function(){function e(g,_){return g===_&&(g!==0||1/g===1/_)||g!==g&&_!==_}function t(g,_){d||s.startTransition===void 0||(d=!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=_();if(!f){var v=_();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:_}});var m=v[0].inst,b=v[1];return c(function(){m.value=p,m.getSnapshot=_,r(m)&&b({inst:m})},[g,p,_]),a(function(){return r(m)&&b({inst:m}),g(function(){r(m)&&b({inst:m})})},[g]),u(p),p}function r(g){var _=g.getSnapshot;g=g.value;try{var p=_();return!i(g,p)}catch{return!0}}function n(g,_){return _()}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,u=s.useDebugValue,d=!1,f=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;Ko.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ko}var qc;function Go(){return qc||(qc=1,process.env.NODE_ENV==="production"?ui.exports=Cv():ui.exports=Ov()),ui.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 Hc;function Ov(){if(Hc)return Ho;Hc=1;var e=h,t=Go();function r(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}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 Ho.useSyncExternalStoreWithSelector=function(u,d,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(D){if(!b){if(b=!0,S=D,D=y(D),g!==void 0&&p.hasValue){var x=p.value;if(g(x,D))return w=x}return w=D}if(x=w,n(S,D))return x;var A=y(D);return g!==void 0&&g(x,A)?(S=D,x):(S=D,w=A)}var b=!1,S,w,C=f===void 0?null:f;return[function(){return m(d())},C===null?void 0:function(){return m(C())}]},[d,f,y,g]);var v=s(u,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},Ho}var Qo={};/**
440
+ */var Hc;function Ev(){if(Hc)return Ho;Hc=1;var e=h,t=Go();function r(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}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 Ho.useSyncExternalStoreWithSelector=function(u,d,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(I){if(!b){if(b=!0,S=I,I=y(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return w=k}return w=I}if(k=w,n(S,I))return k;var P=y(I);return g!==void 0&&g(k,P)?(S=I,k):(S=I,w=P)}var b=!1,S,w,O=f===void 0?null:f;return[function(){return m(d())},O===null?void 0:function(){return m(O())}]},[d,f,y,g]);var v=s(u,_[0],_[1]);return o(function(){p.hasValue=!0,p.value=v},[v]),c(v),v},Ho}var Qo={};/**
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 Wc;function Dv(){return Wc||(Wc=1,process.env.NODE_ENV!=="production"&&function(){function e(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,r=Go(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Qo.useSyncExternalStoreWithSelector=function(u,d,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(D){if(!b){if(b=!0,S=D,D=y(D),g!==void 0&&p.hasValue){var x=p.value;if(g(x,D))return w=x}return w=D}if(x=w,n(S,D))return x;var A=y(D);return g!==void 0&&g(x,A)?(S=D,x):(S=D,w=A)}var b=!1,S,w,C=f===void 0?null:f;return[function(){return m(d())},C===null?void 0:function(){return m(C())}]},[d,f,y,g]);var v=s(u,_[0],_[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())}()),Qo}process.env.NODE_ENV==="production"?qo.exports=Ov():qo.exports=Dv();var Iv=qo.exports;const Tv=Vc(Iv),Kc={},{useDebugValue:Nv}=h,{useSyncExternalStoreWithSelector:xv}=Tv;let Gc=!1;const kv=e=>e;function Av(e,t=kv,r){(Kc?"production":void 0)!=="production"&&r&&!Gc&&(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"),Gc=!0);const n=xv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Nv(n),n}const Qc=e=>{(Kc?"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"?Sv(e):e,r=(n,s)=>Av(t,n,s);return Object.assign(r,t),r},di=e=>e?Qc(e):Qc,be=di(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,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}),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}})})),Yc=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:be},Symbol.toStringTag,{value:"Module"}));function pn(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 Rc(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=Rc(s.children,t,r+1);if(i>=0)return i}}return-1}const Pv=new Set(["name","appIcon","description","keywords","trackable"]);function Xc(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Pv)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Xc(n.children,t,r)}:n})}function fi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:fi(n.children,t,r)}:n)}function Yo(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?Yo(r.children,t):[]}))}function Zc(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:Zc(s.children,t,r,n)}:s})}function Mv(e,t){const r=pn(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?pn(e,s.parent):void 0;return n}const Me=di((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=pn(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};be.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:Xc(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),be.getState().setIsDirty(!0)},addNode:(r,n)=>{var u,d;const s=t(),i=((d=(u=be.getState().editorConfig)==null?void 0:u.config)==null?void 0:d.maxDepth)??4,o=Rc(s.treeData,r);if(o>=i-1)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:fi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),t().selectNode(a),a},deleteNode:r=>{e(n=>({treeData:Yo(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Zc(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=pn(i.treeData,r);if(!o)return i;let a=Yo(i.treeData,r);return a=fi(a,s,{...o,parent:s}),{treeData:a,isDirty:!0}})},addResource:(r,n)=>{var c,u;const s=be.getState().editorConfig,i=((c=s==null?void 0:s.config)==null?void 0:c.allowContentUnderRoot)??!1,o=(u=t().treeData[0])==null?void 0:u.id;if(!i&&n===o)return;const a={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};e(d=>({treeData:fi(d.treeData,n,a)})),t().markDirty()},markDirty:()=>{Promise.resolve().then(()=>Yc).then(({useEditorStore:r})=>{r.getState().setIsDirty(!0)})},getNodeById:r=>pn(t().treeData,r),getChildrenOf:r=>{const n=pn(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Mv(t().treeData,r)})),Lv=di(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Fv={spin:"_spin_1ah4d_9"},$v=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Fv.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"})}),Oe=({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($v,{size:14}):null,i]}),De={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"},jv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=be(d=>{var f,y;return(y=(f=d.editorConfig)==null?void 0:f.config)==null?void 0:y.objectType})||"Content",s=be(d=>d.publishChecklist)??[],[i,o]=h.useState({}),a=s.every(d=>i[d.code]),c=s.length===0||a,u=()=>{t()};return l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:De.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:De.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:De.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(d=>l.jsxs("label",{className:De.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[d.code],onChange:f=>o(y=>({...y,[d.code]:f.target.checked}))}),l.jsx("span",{children:d.label})]},d.code))]})}),l.jsxs("div",{className:De.modalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Oe,{variant:"primary",onClick:u,disabled:!c,children:"Yes"})]})]})})},Bv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=h.useState(""),[o,a]=h.useState(7),c=t==="approve",u=c?"Review Quality":"Reject Content",d=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:u}),l.jsx("button",{className:De.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:De.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:De.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:De.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:y=>a(Number(y.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:De.sliderValue,children:o})]}),l.jsxs("div",{className:De.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:De.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:De.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:y=>i(y.target.value),rows:4})]})]}):l.jsxs("div",{className:De.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:De.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:y=>i(y.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:De.modalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Oe,{variant:c?"primary":"danger",onClick:f,disabled:d,children:c?"Approve":"Reject"})]})]})})};function Jc(e,t){return function(){return e.apply(t,arguments)}}const{toString:Vv}=Object.prototype,{getPrototypeOf:gn}=Object,{iterator:us,toStringTag:eu}=Symbol,hi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ds=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),hi(r,t))return!0;r=gn(r)}return!1},Uv=(e,t)=>e!=null&&ds(e,t)?e[t]:void 0,Ro=(e=>t=>{const r=Vv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Kt=e=>(e=e.toLowerCase(),t=>Ro(t)===e),pi=e=>t=>typeof t===e,{isArray:Br}=Array,yn=pi("undefined");function vn(e){return e!==null&&!yn(e)&&e.constructor!==null&&!yn(e.constructor)&&Ct(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const tu=Kt("ArrayBuffer");function zv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&tu(e.buffer),t}const qv=pi("string"),Ct=pi("function"),ru=pi("number"),mn=e=>e!==null&&typeof e=="object",Hv=e=>e===!0||e===!1,gi=e=>{if(!mn(e))return!1;const t=gn(e);return(t===null||t===Object.prototype||gn(t)===null)&&!ds(e,eu)&&!ds(e,us)},Wv=e=>{if(!mn(e)||vn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Kv=Kt("Date"),Gv=Kt("File"),Qv=e=>!!(e&&typeof e.uri<"u"),Yv=e=>e&&typeof e.getParts<"u",Rv=Kt("Blob"),Xv=Kt("FileList"),Zv=e=>mn(e)&&Ct(e.pipe);function Jv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const nu=Jv(),su=typeof nu.FormData<"u"?nu.FormData:void 0,em=e=>{if(!e)return!1;if(su&&e instanceof su)return!0;const t=gn(e);if(!t||t===Object.prototype||!Ct(e.append))return!1;const r=Ro(e);return r==="formdata"||r==="object"&&Ct(e.toString)&&e.toString()==="[object FormData]"},tm=Kt("URLSearchParams"),[rm,nm,sm,im]=["ReadableStream","Request","Response","Headers"].map(Kt),om=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),Br(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(vn(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 iu(e,t){if(vn(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 Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ou=e=>!yn(e)&&e!==Vr;function Xo(...e){const{caseless:t,skipUndefined:r}=ou(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&iu(n,o)||o,c=hi(n,a)?n[a]:void 0;gi(c)&&gi(i)?n[a]=Xo(c,i):gi(i)?n[a]=Xo({},i):Br(i)?n[a]=i.slice():(!r||!yn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||vn(a)||(fs(a,s),typeof a!="object"||Br(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let u=0;u<c.length;u++){const d=c[u];mm.call(a,d)&&s(a[d],d)}}return n}const am=(e,t,r,{allOwnKeys:n}={})=>(fs(t,(s,i)=>{r&&Ct(s)?Object.defineProperty(e,i,{__proto__:null,value:Jc(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),lm=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)},um=(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&&gn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},dm=(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},fm=e=>{if(!e)return null;if(Br(e))return e;let t=e.length;if(!ru(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},hm=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gn(Uint8Array)),pm=(e,t)=>{const n=(e&&e[us]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},gm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},ym=Kt("HTMLFormElement"),vm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:mm}=Object.prototype,bm=Kt("RegExp"),au=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};fs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},_m=e=>{au(e,(t,r)=>{if(Ct(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Ct(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+"'")})}})},wm=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Br(e)?n(e):n(String(e).split(t)),r},Sm=()=>{},Cm=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Em(e){return!!(e&&Ct(e.append)&&e[eu]==="FormData"&&e[us])}const Om=e=>{const t=new WeakSet,r=n=>{if(mn(n)){if(t.has(n))return;if(vn(n))return n;if(!("toJSON"in n)){t.add(n);const s=Br(n)?[]:{};return fs(n,(i,o)=>{const a=r(i);!yn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Dm=Kt("AsyncFunction"),Im=e=>e&&(mn(e)||Ct(e))&&Ct(e.then)&&Ct(e.catch),lu=((e,t)=>e?setImmediate:t?((r,n)=>(Vr.addEventListener("message",({source:s,data:i})=>{s===Vr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Vr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ct(Vr.postMessage)),Tm=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||lu,cu=e=>e!=null&&Ct(e[us]),I={isArray:Br,isArrayBuffer:tu,isBuffer:vn,isFormData:em,isArrayBufferView:zv,isString:qv,isNumber:ru,isBoolean:Hv,isObject:mn,isPlainObject:gi,isEmptyObject:Wv,isReadableStream:rm,isRequest:nm,isResponse:sm,isHeaders:im,isUndefined:yn,isDate:Kv,isFile:Gv,isReactNativeBlob:Qv,isReactNative:Yv,isBlob:Rv,isRegExp:bm,isFunction:Ct,isStream:Zv,isURLSearchParams:tm,isTypedArray:hm,isFileList:Xv,forEach:fs,merge:Xo,extend:am,trim:om,stripBOM:lm,inherits:cm,toFlatObject:um,kindOf:Ro,kindOfTest:Kt,endsWith:dm,toArray:fm,forEachEntry:pm,matchAll:gm,isHTMLForm:ym,hasOwnProperty:hi,hasOwnProp:hi,hasOwnInPrototypeChain:ds,getSafeProp:Uv,reduceDescriptors:au,freezeMethods:_m,toObjectSet:wm,toCamelCase:vm,noop:Sm,toFiniteNumber:Cm,findKey:iu,global:Vr,isContextDefined:ou,isSpecCompliantForm:Em,toJSONObject:Om,isAsyncFn:Dm,isThenable:Im,setImmediate:lu,asap:Tm,isIterable:cu,isSafeIterable:e=>e!=null&&ds(e,us)&&cu(e)},Nm=I.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"]),xm=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]&&Nm[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function km(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 Am=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Pm=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Zo(e,t){return I.isArray(e)?e.map(r=>Zo(r,t)):km(String(e).replace(t,""))}const Mm=e=>Zo(e,Am),Lm=e=>Zo(e,Pm);function uu(e){const t=Object.create(null);return I.forEach(e.toJSON(),(r,n)=>{t[n]=Lm(r)}),t}const du=Symbol("internals");function hs(e){return e&&String(e).trim().toLowerCase()}function yi(e){return e===!1||e==null?e:I.isArray(e)?e.map(yi):Mm(String(e))}function Fm(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 $m=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Jo(e,t,r,n,s){if(I.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!I.isString(t)){if(I.isString(n))return t.indexOf(n)!==-1;if(I.isRegExp(n))return n.test(t)}}function jm(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Bm(e,t){const r=I.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 lt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,u){const d=hs(c);if(!d)return;const f=I.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=yi(a))}const o=(a,c)=>I.forEach(a,(u,d)=>i(u,d,c));if(I.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(I.isString(t)&&(t=t.trim())&&!$m(t))o(xm(t),r);else if(I.isObject(t)&&I.isSafeIterable(t)){let a=Object.create(null),c,u;for(const d of t){if(!I.isArray(d))throw new TypeError("Object iterator must return a key-value pair");u=d[0],I.hasOwnProp(a,u)?(c=a[u],a[u]=I.isArray(c)?[...c,d[1]]:[c,d[1]]):a[u]=d[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=hs(t),t){const n=I.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Fm(s);if(I.isFunction(r))return r.call(this,s,n);if(I.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=hs(t),t){const n=I.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Jo(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=hs(o),o){const a=I.findKey(n,o);a&&(!r||Jo(n,n[a],a,r))&&(delete n[a],s=!0)}}return I.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||Jo(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return I.forEach(this,(s,i)=>{const o=I.findKey(n,i);if(o){r[o]=yi(s),delete r[i];return}const a=t?jm(i):String(i).trim();a!==i&&delete r[i],r[a]=yi(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return I.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&I.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[du]=this[du]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=hs(o);n[a]||(Bm(s,o),n[a]=!0)}return I.isArray(t)?t.forEach(i):i(t),this}};lt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),I.reduceDescriptors(lt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),I.freezeMethods(lt);const Vm="[REDACTED ****]";function Um(e){if(I.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(I.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function zm(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||I.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof lt&&(i=i.toJSON()),n.push(i);let o;if(I.isArray(i))o=[],i.forEach((a,c)=>{const u=s(a);I.isUndefined(u)||(o[c]=u)});else{if(!I.isPlainObject(i)&&Um(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const u=r.has(a.toLowerCase())?Vm:s(c);I.isUndefined(u)||(o[a]=u)}}return n.pop(),o};return s(e)}let R=class Rh extends Error{static from(t,r,n,s,i,o){const a=new Rh(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&&I.hasOwnProp(t,"redact")?t.redact:void 0,n=I.isArray(r)&&r.length>0?zm(t,r):I.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}}};R.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",R.ERR_BAD_OPTION="ERR_BAD_OPTION",R.ECONNABORTED="ECONNABORTED",R.ETIMEDOUT="ETIMEDOUT",R.ECONNREFUSED="ECONNREFUSED",R.ERR_NETWORK="ERR_NETWORK",R.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",R.ERR_DEPRECATED="ERR_DEPRECATED",R.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",R.ERR_BAD_REQUEST="ERR_BAD_REQUEST",R.ERR_CANCELED="ERR_CANCELED",R.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",R.ERR_INVALID_URL="ERR_INVALID_URL",R.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const qm=null,fu=100;function ea(e){return I.isPlainObject(e)||I.isArray(e)}function hu(e){return I.endsWith(e,"[]")?e.slice(0,-2):e}function ta(e,t,r){return e?e.concat(t).map(function(s,i){return s=hu(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Hm(e){return I.isArray(e)&&!e.some(ea)}const Wm=I.toFlatObject(I,{},null,function(t){return/^is[A-Z]/.test(t)});function vi(e,t,r){if(!I.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=I.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!I.isUndefined(S[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?fu:r.maxDepth,u=a&&I.isSpecCompliantForm(t),d=[];if(!I.isFunction(s))throw new TypeError("visitor must be a function");function f(m){if(m===null)return"";if(I.isDate(m))return m.toISOString();if(I.isBoolean(m))return m.toString();if(!u&&I.isBlob(m))throw new R("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(m)||I.isTypedArray(m)?u&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function y(m){if(m>c)throw new R("Object is too deeply nested ("+m+" levels). Max depth: "+c,R.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(m,b){if(c===1/0)return JSON.stringify(m);const S=[];return JSON.stringify(m,function(C,D){if(!I.isObject(D))return D;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(D),y(b+S.length-1),D})}function _(m,b,S){let w=m;if(I.isReactNative(t)&&I.isReactNativeBlob(m))return t.append(ta(S,b,i),f(m)),!1;if(m&&!S&&typeof m=="object"){if(I.endsWith(b,"{}"))b=n?b:b.slice(0,-2),m=g(m,1);else if(I.isArray(m)&&Hm(m)||(I.isFileList(m)||I.endsWith(b,"[]"))&&(w=I.toArray(m)))return b=hu(b),w.forEach(function(D,x){!(I.isUndefined(D)||D===null)&&t.append(o===!0?ta([b],x,i):o===null?b:b+"[]",f(D))}),!1}return ea(m)?!0:(t.append(ta(S,b,i),f(m)),!1)}const p=Object.assign(Wm,{defaultVisitor:_,convertValue:f,isVisitable:ea});function v(m,b,S=0){if(!I.isUndefined(m)){if(y(S),d.indexOf(m)!==-1)throw new Error("Circular reference detected in "+b.join("."));d.push(m),I.forEach(m,function(C,D){(!(I.isUndefined(C)||C===null)&&s.call(t,C,I.isString(D)?D.trim():D,b,p))===!0&&v(C,b?b.concat(D):[D],S+1)}),d.pop()}}if(!I.isObject(e))throw new TypeError("data must be an object");return v(e),t}function pu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function ra(e,t){this._pairs=[],e&&vi(e,this,t)}const gu=ra.prototype;gu.append=function(t,r){this._pairs.push([t,r])},gu.toString=function(t){const r=t?function(n){return t.call(this,n,pu)}:pu;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Km(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yu(e,t,r){if(!t)return e;const n=I.isFunction(r)?{serialize:r}:r,s=I.getSafeProp(n,"encode")||Km,i=I.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=I.isURLSearchParams(t)?t.toString():new ra(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class vu{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){I.forEach(this.handlers,function(n){n!==null&&t(n)})}}const na={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Gm={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ra,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},sa=typeof window<"u"&&typeof document<"u",ia=typeof navigator=="object"&&navigator||void 0,Qm=sa&&(!ia||["ReactNative","NativeScript","NS"].indexOf(ia.product)<0),Ym=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Rm=sa&&window.location.href||"http://localhost",nt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:sa,hasStandardBrowserEnv:Qm,hasStandardBrowserWebWorkerEnv:Ym,navigator:ia,origin:Rm},Symbol.toStringTag,{value:"Module"})),...Gm};function Xm(e,t){return vi(e,new nt.classes.URLSearchParams,{visitor:function(r,n,s,i){return nt.isNode&&I.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const mu=fu;function bu(e){if(e>mu)throw new R("FormData field is too deeply nested ("+e+" levels). Max depth: "+mu,R.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Zm(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)bu(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function Jm(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 _u(e){function t(r,n,s,i){bu(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&I.isArray(s)?s.length:o,c?(I.hasOwnProp(s,o)?s[o]=I.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!I.hasOwnProp(s,o)||!I.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&I.isArray(s[o])&&(s[o]=Jm(s[o])),!a)}if(I.isFormData(e)&&I.isFunction(e.entries)){const r={};return I.forEachEntry(e,(n,s)=>{t(Zm(n),s,r,0)}),r}return null}const bn=(e,t)=>e!=null&&I.hasOwnProp(e,t)?e[t]:void 0;function eb(e,t,r){if(I.isString(e))try{return(t||JSON.parse)(e),I.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const ps={transitional:na,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=I.isObject(t);if(i&&I.isHTMLForm(t)&&(t=new FormData(t)),I.isFormData(t))return s?JSON.stringify(_u(t)):t;if(I.isArrayBuffer(t)||I.isBuffer(t)||I.isStream(t)||I.isFile(t)||I.isBlob(t)||I.isReadableStream(t))return t;if(I.isArrayBufferView(t))return t.buffer;if(I.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=bn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Xm(t,c).toString();if((a=I.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=bn(this,"env"),d=u&&u.FormData;return vi(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(r.setContentType("application/json",!1),eb(t)):t}],transformResponse:[function(t){const r=bn(this,"transitional")||ps.transitional,n=r&&r.forcedJSONParsing,s=bn(this,"responseType"),i=s==="json";if(I.isResponse(t)||I.isReadableStream(t))return t;if(t&&I.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,bn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?R.from(c,R.ERR_BAD_RESPONSE,this,null,bn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:nt.classes.FormData,Blob:nt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch","query"],e=>{ps.headers[e]={}});function oa(e,t){const r=this||ps,n=t||r,s=lt.from(n.headers);let i=n.data;return I.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function wu(e){return!!(e&&e.__CANCEL__)}let gs=class extends R{constructor(t,r,n){super(t??"canceled",R.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Su(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new R("Request failed with status code "+r.status,r.status>=400&&r.status<500?R.ERR_BAD_REQUEST:R.ERR_BAD_RESPONSE,r.config,r.request,r))}function tb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function rb(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 u=Date.now(),d=n[i];o||(o=u),r[s]=c,n[s]=u;let f=i,y=0;for(;f!==s;)y+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const g=d&&u-d;return g?Math.round(y*1e3/g):void 0}}function nb(e,t){let r=0,n=1e3/t,s,i;const o=(u,d=Date.now())=>{r=d,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-r;f>=n?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const mi=(e,t,r=3)=>{let n=0;const s=rb(50,250);return nb(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,u=Math.max(0,c-n),d=s(u);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:u,rate:d||void 0,estimated:d&&a?(a-c)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},Cu=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Eu=e=>(...t)=>I.asap(()=>e(...t)),sb=nt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,nt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(nt.origin),nt.navigator&&/(msie|trident)/i.test(nt.navigator.userAgent)):()=>!0,ib=nt.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];I.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),I.isString(n)&&a.push(`path=${n}`),I.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),I.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 ob(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ab(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const lb=/^https?:(?!\/\/)/i,cb=/[\t\n\r]/g;function ub(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function db(e){return ub(e).replace(cb,"")}function Ou(e,t){if(typeof e=="string"&&lb.test(db(e)))throw new R('Invalid URL: missing "//" after protocol',R.ERR_INVALID_URL,t)}function Du(e,t,r,n){Ou(t,n);let s=!ob(t);return e&&(s||r===!1)?(Ou(e,n),ab(e,t)):t}const Iu=e=>e instanceof lt?{...e}:e;function Ur(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(d,f,y,g){return I.isPlainObject(d)&&I.isPlainObject(f)?I.merge.call({caseless:g},d,f):I.isPlainObject(f)?I.merge({},f):I.isArray(f)?f.slice():f}function s(d,f,y,g){if(I.isUndefined(f)){if(!I.isUndefined(d))return n(void 0,d,y,g)}else return n(d,f,y,g)}function i(d,f){if(!I.isUndefined(f))return n(void 0,f)}function o(d,f){if(I.isUndefined(f)){if(!I.isUndefined(d))return n(void 0,d)}else return n(void 0,f)}function a(d){const f=I.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!I.isUndefined(f))if(I.isPlainObject(f)){if(I.hasOwnProp(f,d))return f[d]}else return;const y=I.hasOwnProp(e,"transitional")?e.transitional:void 0;if(I.isPlainObject(y)&&I.hasOwnProp(y,d))return y[d]}function c(d,f,y){if(I.hasOwnProp(t,y))return n(d,f);if(I.hasOwnProp(e,y))return n(void 0,d)}const u={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:(d,f,y)=>s(Iu(d),Iu(f),y,!0)};return I.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const y=I.hasOwnProp(u,f)?u[f]:s,g=I.hasOwnProp(e,f)?e[f]:void 0,_=I.hasOwnProp(t,f)?t[f]:void 0,p=y(g,_,f);I.isUndefined(p)&&y!==c||(r[f]=p)}),I.hasOwnProp(t,"validateStatus")&&I.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(I.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const fb=["content-type","content-length"];function hb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{fb.includes(n.toLowerCase())&&e.set(n,s)})}const pb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Tu(e){const t=Ur({},e),r=y=>I.hasOwnProp(t,y)?t[y]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=lt.from(a),t.url=yu(Du(u,f,d,t),r("params"),r("paramsSerializer")),c){const y=I.getSafeProp(c,"username")||"",g=I.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(y+":"+(g?pb(g):"")))}if(I.isFormData(n)&&(nt.hasStandardBrowserEnv||nt.hasStandardBrowserWebWorkerEnv||I.isReactNative(n)?a.setContentType(void 0):I.isFunction(n.getHeaders)&&hb(a,n.getHeaders(),r("formDataHeaderPolicy"))),nt.hasStandardBrowserEnv&&(I.isFunction(s)&&(s=s(t)),s===!0||s==null&&sb(t.url))){const g=i&&o&&ib.read(o);g&&a.set(i,g)}return t}const gb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=Tu(e);let i=s.data;const o=lt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=s,d,f,y,g,_;function p(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function m(){if(!v)return;const S=lt.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:S,config:e,request:v};Su(function(x){r(x),p()},function(x){n(x),p()},C),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 R("Request aborted",R.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const C=w&&w.message?w.message:"Network Error",D=new R(C,R.ERR_NETWORK,e,v);D.event=w||null,n(D),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||na;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new R(w,C.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&I.forEach(uu(o),function(w,C){v.setRequestHeader(C,w)}),I.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),a&&a!=="json"&&(v.responseType=s.responseType),u&&([y,_]=mi(u,!0),v.addEventListener("progress",y)),c&&v.upload&&([f,g]=mi(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=S=>{v&&(n(!S||S.type?new gs(null,e,v):S),v.abort(),p(),v=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const b=tb(s.url);if(b&&!nt.protocols.includes(b)){n(new R("Unsupported protocol "+b+":",R.ERR_BAD_REQUEST,e));return}v.send(i||null)})},yb=(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 u=c instanceof Error?c:this.reason;r.abort(u instanceof R?u:new gs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new R(`timeout of ${t}ms exceeded`,R.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=()=>I.asap(o),a},vb=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},mb=async function*(e,t){for await(const r of bb(e))yield*vb(r,t)},bb=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()}},Nu=(e,t,r,n)=>{const s=mb(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){a(),c.close();return}let f=d.byteLength;if(r){let y=i+=f;r(y)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},bi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,_b=(e,t,r)=>t+2<r&&bi(e.charCodeAt(t+1))&&bi(e.charCodeAt(t+2));function wb(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let g=0;g<a;g++)if(n.charCodeAt(g)===37&&g+2<a){const _=n.charCodeAt(g+1),p=n.charCodeAt(g+2);bi(_)&&bi(p)&&(o-=2,g+=2)}let c=0,u=a-1;const d=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);u>=0&&(n.charCodeAt(u)===61?(c++,u--):d(u)&&(c++,u-=3)),c===1&&u>=0&&(n.charCodeAt(u)===61||d(u))&&c++;const y=Math.floor(o/4)*3-(c||0);return y>0?y:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&_b(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 u=n.charCodeAt(o+1);u>=56320&&u<=57343?(i+=4,o++):i+=3}else i+=3}return i}const aa="1.18.0",xu=64*1024,{isFunction:_i}=I,Sb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),ku=e=>{if(!I.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Au=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Cb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Eb=e=>{const t=I.global!==void 0&&I.global!==null?I.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=I.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?_i(s):typeof fetch=="function",c=_i(i),u=_i(o);if(!a)return!1;const d=a&&_i(r),f=a&&(typeof n=="function"?(m=>b=>m.encode(b))(new n):async m=>new Uint8Array(await new i(m).arrayBuffer())),y=c&&d&&Au(()=>{let m=!1;const b=new i(nt.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),S=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),m&&!S}),g=u&&d&&Au(()=>I.isReadableStream(new o("").body)),_={stream:g&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!_[m]&&(_[m]=(b,S)=>{let w=b&&b[m];if(w)return w.call(b);throw new R(`Response type '${m}' is not supported`,R.ERR_NOT_SUPPORT,S)})});const p=async m=>{if(m==null)return 0;if(I.isBlob(m))return m.size;if(I.isSpecCompliantForm(m))return(await new i(nt.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(I.isArrayBufferView(m)||I.isArrayBuffer(m))return m.byteLength;if(I.isURLSearchParams(m)&&(m=m+""),I.isString(m))return(await f(m)).byteLength},v=async(m,b)=>{const S=I.toFiniteNumber(m.getContentLength());return S??p(b)};return async m=>{let{url:b,method:S,data:w,signal:C,cancelToken:D,timeout:x,onDownloadProgress:A,onUploadProgress:F,responseType:k,headers:P,withCredentials:z="same-origin",fetchOptions:M,maxContentLength:H,maxBodyLength:$}=Tu(m);const se=I.isNumber(H)&&H>-1,ue=I.isNumber($)&&$>-1,K=J=>I.hasOwnProp(m,J)?m[J]:void 0;let V=s||fetch;k=k?(k+"").toLowerCase():"text";let X=yb([C,D&&D.toAbortSignal()],x),j=null;const G=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let Z,ve=null;const Ie=()=>new R("Request body larger than maxBodyLength limit",R.ERR_BAD_REQUEST,m,j);try{let J;const Se=K("auth");if(Se){const te=I.getSafeProp(Se,"username")||"",Ke=I.getSafeProp(Se,"password")||"";J={username:te,password:Ke}}if(Cb(b)){const te=new URL(b,nt.origin);if(!J&&(te.username||te.password)){const Ke=ku(te.username),vt=ku(te.password);J={username:Ke,password:vt}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(J&&(P.delete("authorization"),P.set("Authorization","Basic "+btoa(Sb((J.username||"")+":"+(J.password||""))))),se&&typeof b=="string"&&b.startsWith("data:")&&wb(b)>H)throw new R("maxContentLength size of "+H+" exceeded",R.ERR_BAD_RESPONSE,m,j);if(ue&&S!=="get"&&S!=="head"){const te=await p(w);if(typeof te=="number"&&isFinite(te)&&(Z=te,te>$))throw Ie()}const re=ue&&(I.isReadableStream(w)||I.isStream(w)),me=(te,Ke,vt)=>Nu(te,xu,Ge=>{if(ue&&Ge>$)throw ve=Ie();Ke&&Ke(Ge)},vt);if(y&&S!=="get"&&S!=="head"&&(F||re)){if(Z=Z??await v(P,w),Z!==0||re){let te=new i(b,{method:"POST",body:w,duplex:"half"}),Ke;if(I.isFormData(w)&&(Ke=te.headers.get("content-type"))&&P.setContentType(Ke),te.body){const[vt,Ge]=F&&Cu(Z,mi(Eu(F)))||[];w=me(te.body,vt,Ge)}}}else if(re&&!c&&d&&S!=="get"&&S!=="head")w=me(w);else if(re&&c&&!y&&S!=="get"&&S!=="head")throw new R("Stream request bodies are not supported by the current fetch implementation",R.ERR_NOT_SUPPORT,m,j);I.isString(z)||(z=z?"include":"omit");const oe=c&&"credentials"in i.prototype;if(I.isFormData(w)){const te=P.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&P.delete("content-type")}P.set("User-Agent","axios/"+aa,!1);const yt={...M,signal:X,method:S.toUpperCase(),headers:uu(P.normalize()),body:w,duplex:"half",credentials:oe?z:void 0};j=c&&new i(b,yt);let Ne=await(c?V(j,M):V(b,yt));const ot=lt.from(Ne.headers);if(se){const te=I.toFiniteNumber(ot.getContentLength());if(te!=null&&te>H)throw new R("maxContentLength size of "+H+" exceeded",R.ERR_BAD_RESPONSE,m,j)}const et=g&&(k==="stream"||k==="response");if(g&&Ne.body&&(A||se||et&&G)){const te={};["status","statusText","headers"].forEach(zt=>{te[zt]=Ne[zt]});const Ke=I.toFiniteNumber(ot.getContentLength()),[vt,Ge]=A&&Cu(Ke,mi(Eu(A),!0))||[];let Be=0;const Mt=zt=>{if(se&&(Be=zt,Be>H))throw new R("maxContentLength size of "+H+" exceeded",R.ERR_BAD_RESPONSE,m,j);vt&&vt(zt)};Ne=new o(Nu(Ne.body,xu,Mt,()=>{Ge&&Ge(),G&&G()}),te)}k=k||"text";let qe=await _[I.findKey(_,k)||"text"](Ne,m);if(se&&!g&&!et){let te;if(qe!=null&&(typeof qe.byteLength=="number"?te=qe.byteLength:typeof qe.size=="number"?te=qe.size:typeof qe=="string"&&(te=typeof n=="function"?new n().encode(qe).byteLength:qe.length)),typeof te=="number"&&te>H)throw new R("maxContentLength size of "+H+" exceeded",R.ERR_BAD_RESPONSE,m,j)}return!et&&G&&G(),await new Promise((te,Ke)=>{Su(te,Ke,{data:qe,headers:lt.from(Ne.headers),status:Ne.status,statusText:Ne.statusText,config:m,request:j})})}catch(J){if(G&&G(),X&&X.aborted&&X.reason instanceof R){const Se=X.reason;throw Se.config=m,j&&(Se.request=j),J!==Se&&(Se.cause=J),Se}throw ve?(j&&!ve.request&&(ve.request=j),ve):J instanceof R?(j&&!J.request&&(J.request=j),J):J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new R("Network Error",R.ERR_NETWORK,m,j,J&&J.response),{cause:J.cause||J}):R.from(J,J&&J.code,m,j,J&&J.response)}}},Ob=new Map,Pu=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,u,d=Ob;for(;a--;)c=i[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:Eb(t)),d=u;return u};Pu();const la={http:qm,xhr:gb,fetch:{get:Pu}};I.forEach(la,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Mu=e=>`- ${e}`,Db=e=>I.isFunction(e)||e===null||e===!1;function Ib(e,t){e=I.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,!Db(n)&&(s=la[(a=String(n)).toLowerCase()],s===void 0))throw new R(`Unknown adapter '${a}'`);if(s&&(I.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
448
+ */var Wc;function Dv(){return Wc||(Wc=1,process.env.NODE_ENV!=="production"&&function(){function e(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,r=Go(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Qo.useSyncExternalStoreWithSelector=function(u,d,f,y,g){var _=i(null);if(_.current===null){var p={hasValue:!1,value:null};_.current=p}else p=_.current;_=a(function(){function m(I){if(!b){if(b=!0,S=I,I=y(I),g!==void 0&&p.hasValue){var k=p.value;if(g(k,I))return w=k}return w=I}if(k=w,n(S,I))return k;var P=y(I);return g!==void 0&&g(k,P)?(S=I,k):(S=I,w=P)}var b=!1,S,w,O=f===void 0?null:f;return[function(){return m(d())},O===null?void 0:function(){return m(O())}]},[d,f,y,g]);var v=s(u,_[0],_[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())}()),Qo}process.env.NODE_ENV==="production"?qo.exports=Ev():qo.exports=Dv();var Iv=qo.exports;const Tv=Vc(Iv),Kc={},{useDebugValue:Nv}=h,{useSyncExternalStoreWithSelector:xv}=Tv;let Gc=!1;const kv=e=>e;function Av(e,t=kv,r){(Kc?"production":void 0)!=="production"&&r&&!Gc&&(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"),Gc=!0);const n=xv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Nv(n),n}const Qc=e=>{(Kc?"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"?Sv(e):e,r=(n,s)=>Av(t,n,s);return Object.assign(r,t),r},di=e=>e?Qc(e):Qc,be=di(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,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}),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}})})),Yc=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:be},Symbol.toStringTag,{value:"Module"}));function pn(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 Rc(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=Rc(s.children,t,r+1);if(i>=0)return i}}return-1}const Pv=new Set(["name","appIcon","description","keywords","trackable"]);function Xc(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Pv)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Xc(n.children,t,r)}:n})}function fi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:fi(n.children,t,r)}:n)}function Yo(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?Yo(r.children,t):[]}))}function Zc(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:Zc(s.children,t,r,n)}:s})}function Mv(e,t){const r=pn(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?pn(e,s.parent):void 0;return n}const Pe=di((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=pn(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};be.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:Xc(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),be.getState().setIsDirty(!0)},addNode:(r,n)=>{var u,d;const s=t(),i=((d=(u=be.getState().editorConfig)==null?void 0:u.config)==null?void 0:d.maxDepth)??4,o=Rc(s.treeData,r);if(o>=i-1)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:fi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),t().selectNode(a),a},deleteNode:r=>{e(n=>({treeData:Yo(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Zc(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=pn(i.treeData,r);if(!o)return i;let a=Yo(i.treeData,r);return a=fi(a,s,{...o,parent:s}),{treeData:a,isDirty:!0}})},addResource:(r,n)=>{var c,u;const s=be.getState().editorConfig,i=((c=s==null?void 0:s.config)==null?void 0:c.allowContentUnderRoot)??!1,o=(u=t().treeData[0])==null?void 0:u.id;if(!i&&n===o)return;const a={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};e(d=>({treeData:fi(d.treeData,n,a)})),t().markDirty()},markDirty:()=>{Promise.resolve().then(()=>Yc).then(({useEditorStore:r})=>{r.getState().setIsDirty(!0)})},getNodeById:r=>pn(t().treeData,r),getChildrenOf:r=>{const n=pn(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Mv(t().treeData,r)})),Lv=di(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Fv={spin:"_spin_1ah4d_9"},$v=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Fv.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"})}),De=({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($v,{size:14}):null,i]}),Ie={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"},jv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=be(d=>{var f,y;return(y=(f=d.editorConfig)==null?void 0:f.config)==null?void 0:y.objectType})||"Content",s=be(d=>d.publishChecklist)??[],[i,o]=h.useState({}),a=s.every(d=>i[d.code]),c=s.length===0||a,u=()=>{t()};return l.jsx("div",{className:Ie.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ie.modal,children:[l.jsxs("div",{className:Ie.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Ie.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ie.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:Ie.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(d=>l.jsxs("label",{className:Ie.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[d.code],onChange:f=>o(y=>({...y,[d.code]:f.target.checked}))}),l.jsx("span",{children:d.label})]},d.code))]})}),l.jsxs("div",{className:Ie.modalFooter,children:[l.jsx(De,{variant:"ghost",onClick:r,children:"No"}),l.jsx(De,{variant:"primary",onClick:u,disabled:!c,children:"Yes"})]})]})})},Bv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=h.useState(""),[o,a]=h.useState(7),c=t==="approve",u=c?"Review Quality":"Reject Content",d=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:Ie.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Ie.modal,children:[l.jsxs("div",{className:Ie.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:u}),l.jsx("button",{className:Ie.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ie.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ie.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Ie.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:y=>a(Number(y.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Ie.sliderValue,children:o})]}),l.jsxs("div",{className:Ie.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Ie.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:Ie.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:y=>i(y.target.value),rows:4})]})]}):l.jsxs("div",{className:Ie.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:Ie.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:y=>i(y.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:Ie.modalFooter,children:[l.jsx(De,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(De,{variant:c?"primary":"danger",onClick:f,disabled:d,children:c?"Approve":"Reject"})]})]})})};function Jc(e,t){return function(){return e.apply(t,arguments)}}const{toString:Vv}=Object.prototype,{getPrototypeOf:gn}=Object,{iterator:us,toStringTag:eu}=Symbol,hi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ds=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),hi(r,t))return!0;r=gn(r)}return!1},Uv=(e,t)=>e!=null&&ds(e,t)?e[t]:void 0,Ro=(e=>t=>{const r=Vv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Wt=e=>(e=e.toLowerCase(),t=>Ro(t)===e),pi=e=>t=>typeof t===e,{isArray:Br}=Array,yn=pi("undefined");function vn(e){return e!==null&&!yn(e)&&e.constructor!==null&&!yn(e.constructor)&&St(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const tu=Wt("ArrayBuffer");function zv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&tu(e.buffer),t}const qv=pi("string"),St=pi("function"),ru=pi("number"),mn=e=>e!==null&&typeof e=="object",Hv=e=>e===!0||e===!1,gi=e=>{if(!mn(e))return!1;const t=gn(e);return(t===null||t===Object.prototype||gn(t)===null)&&!ds(e,eu)&&!ds(e,us)},Wv=e=>{if(!mn(e)||vn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Kv=Wt("Date"),Gv=Wt("File"),Qv=e=>!!(e&&typeof e.uri<"u"),Yv=e=>e&&typeof e.getParts<"u",Rv=Wt("Blob"),Xv=Wt("FileList"),Zv=e=>mn(e)&&St(e.pipe);function Jv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const nu=Jv(),su=typeof nu.FormData<"u"?nu.FormData:void 0,em=e=>{if(!e)return!1;if(su&&e instanceof su)return!0;const t=gn(e);if(!t||t===Object.prototype||!St(e.append))return!1;const r=Ro(e);return r==="formdata"||r==="object"&&St(e.toString)&&e.toString()==="[object FormData]"},tm=Wt("URLSearchParams"),[rm,nm,sm,im]=["ReadableStream","Request","Response","Headers"].map(Wt),om=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),Br(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(vn(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 iu(e,t){if(vn(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 Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ou=e=>!yn(e)&&e!==Vr;function Xo(...e){const{caseless:t,skipUndefined:r}=ou(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&iu(n,o)||o,c=hi(n,a)?n[a]:void 0;gi(c)&&gi(i)?n[a]=Xo(c,i):gi(i)?n[a]=Xo({},i):Br(i)?n[a]=i.slice():(!r||!yn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||vn(a)||(fs(a,s),typeof a!="object"||Br(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let u=0;u<c.length;u++){const d=c[u];mm.call(a,d)&&s(a[d],d)}}return n}const am=(e,t,r,{allOwnKeys:n}={})=>(fs(t,(s,i)=>{r&&St(s)?Object.defineProperty(e,i,{__proto__:null,value:Jc(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),lm=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)},um=(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&&gn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},dm=(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},fm=e=>{if(!e)return null;if(Br(e))return e;let t=e.length;if(!ru(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},hm=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gn(Uint8Array)),pm=(e,t)=>{const n=(e&&e[us]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},gm=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},ym=Wt("HTMLFormElement"),vm=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:mm}=Object.prototype,bm=Wt("RegExp"),au=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};fs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},_m=e=>{au(e,(t,r)=>{if(St(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(St(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+"'")})}})},wm=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return Br(e)?n(e):n(String(e).split(t)),r},Sm=()=>{},Cm=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Om(e){return!!(e&&St(e.append)&&e[eu]==="FormData"&&e[us])}const Em=e=>{const t=new WeakSet,r=n=>{if(mn(n)){if(t.has(n))return;if(vn(n))return n;if(!("toJSON"in n)){t.add(n);const s=Br(n)?[]:{};return fs(n,(i,o)=>{const a=r(i);!yn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Dm=Wt("AsyncFunction"),Im=e=>e&&(mn(e)||St(e))&&St(e.then)&&St(e.catch),lu=((e,t)=>e?setImmediate:t?((r,n)=>(Vr.addEventListener("message",({source:s,data:i})=>{s===Vr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Vr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",St(Vr.postMessage)),Tm=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||lu,cu=e=>e!=null&&St(e[us]),D={isArray:Br,isArrayBuffer:tu,isBuffer:vn,isFormData:em,isArrayBufferView:zv,isString:qv,isNumber:ru,isBoolean:Hv,isObject:mn,isPlainObject:gi,isEmptyObject:Wv,isReadableStream:rm,isRequest:nm,isResponse:sm,isHeaders:im,isUndefined:yn,isDate:Kv,isFile:Gv,isReactNativeBlob:Qv,isReactNative:Yv,isBlob:Rv,isRegExp:bm,isFunction:St,isStream:Zv,isURLSearchParams:tm,isTypedArray:hm,isFileList:Xv,forEach:fs,merge:Xo,extend:am,trim:om,stripBOM:lm,inherits:cm,toFlatObject:um,kindOf:Ro,kindOfTest:Wt,endsWith:dm,toArray:fm,forEachEntry:pm,matchAll:gm,isHTMLForm:ym,hasOwnProperty:hi,hasOwnProp:hi,hasOwnInPrototypeChain:ds,getSafeProp:Uv,reduceDescriptors:au,freezeMethods:_m,toObjectSet:wm,toCamelCase:vm,noop:Sm,toFiniteNumber:Cm,findKey:iu,global:Vr,isContextDefined:ou,isSpecCompliantForm:Om,toJSONObject:Em,isAsyncFn:Dm,isThenable:Im,setImmediate:lu,asap:Tm,isIterable:cu,isSafeIterable:e=>e!=null&&ds(e,us)&&cu(e)},Nm=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"]),xm=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]&&Nm[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function km(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 Am=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Pm=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Zo(e,t){return D.isArray(e)?e.map(r=>Zo(r,t)):km(String(e).replace(t,""))}const Mm=e=>Zo(e,Am),Lm=e=>Zo(e,Pm);function uu(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=Lm(r)}),t}const du=Symbol("internals");function hs(e){return e&&String(e).trim().toLowerCase()}function yi(e){return e===!1||e==null?e:D.isArray(e)?e.map(yi):Mm(String(e))}function Fm(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 $m=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Jo(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 jm(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Bm(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 lt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,u){const d=hs(c);if(!d)return;const f=D.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=yi(a))}const o=(a,c)=>D.forEach(a,(u,d)=>i(u,d,c));if(D.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(D.isString(t)&&(t=t.trim())&&!$m(t))o(xm(t),r);else if(D.isObject(t)&&D.isSafeIterable(t)){let a=Object.create(null),c,u;for(const d of t){if(!D.isArray(d))throw new TypeError("Object iterator must return a key-value pair");u=d[0],D.hasOwnProp(a,u)?(c=a[u],a[u]=D.isArray(c)?[...c,d[1]]:[c,d[1]]):a[u]=d[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=hs(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Fm(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=hs(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Jo(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=hs(o),o){const a=D.findKey(n,o);a&&(!r||Jo(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||Jo(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]=yi(s),delete r[i];return}const a=t?jm(i):String(i).trim();a!==i&&delete r[i],r[a]=yi(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[du]=this[du]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=hs(o);n[a]||(Bm(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};lt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(lt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),D.freezeMethods(lt);const Vm="[REDACTED ****]";function Um(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 zm(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 lt&&(i=i.toJSON()),n.push(i);let o;if(D.isArray(i))o=[],i.forEach((a,c)=>{const u=s(a);D.isUndefined(u)||(o[c]=u)});else{if(!D.isPlainObject(i)&&Um(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const u=r.has(a.toLowerCase())?Vm:s(c);D.isUndefined(u)||(o[a]=u)}}return n.pop(),o};return s(e)}let R=class Rh extends Error{static from(t,r,n,s,i,o){const a=new Rh(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?zm(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}}};R.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",R.ERR_BAD_OPTION="ERR_BAD_OPTION",R.ECONNABORTED="ECONNABORTED",R.ETIMEDOUT="ETIMEDOUT",R.ECONNREFUSED="ECONNREFUSED",R.ERR_NETWORK="ERR_NETWORK",R.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",R.ERR_DEPRECATED="ERR_DEPRECATED",R.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",R.ERR_BAD_REQUEST="ERR_BAD_REQUEST",R.ERR_CANCELED="ERR_CANCELED",R.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",R.ERR_INVALID_URL="ERR_INVALID_URL",R.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const qm=null,fu=100;function ea(e){return D.isPlainObject(e)||D.isArray(e)}function hu(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function ta(e,t,r){return e?e.concat(t).map(function(s,i){return s=hu(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Hm(e){return D.isArray(e)&&!e.some(ea)}const Wm=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function vi(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(b,S){return!D.isUndefined(S[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?fu:r.maxDepth,u=a&&D.isSpecCompliantForm(t),d=[];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(!u&&D.isBlob(m))throw new R("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(m)||D.isTypedArray(m)?u&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function y(m){if(m>c)throw new R("Object is too deeply nested ("+m+" levels). Max depth: "+c,R.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(m,b){if(c===1/0)return JSON.stringify(m);const S=[];return JSON.stringify(m,function(O,I){if(!D.isObject(I))return I;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(I),y(b+S.length-1),I})}function _(m,b,S){let w=m;if(D.isReactNative(t)&&D.isReactNativeBlob(m))return t.append(ta(S,b,i),f(m)),!1;if(m&&!S&&typeof m=="object"){if(D.endsWith(b,"{}"))b=n?b:b.slice(0,-2),m=g(m,1);else if(D.isArray(m)&&Hm(m)||(D.isFileList(m)||D.endsWith(b,"[]"))&&(w=D.toArray(m)))return b=hu(b),w.forEach(function(I,k){!(D.isUndefined(I)||I===null)&&t.append(o===!0?ta([b],k,i):o===null?b:b+"[]",f(I))}),!1}return ea(m)?!0:(t.append(ta(S,b,i),f(m)),!1)}const p=Object.assign(Wm,{defaultVisitor:_,convertValue:f,isVisitable:ea});function v(m,b,S=0){if(!D.isUndefined(m)){if(y(S),d.indexOf(m)!==-1)throw new Error("Circular reference detected in "+b.join("."));d.push(m),D.forEach(m,function(O,I){(!(D.isUndefined(O)||O===null)&&s.call(t,O,D.isString(I)?I.trim():I,b,p))===!0&&v(O,b?b.concat(I):[I],S+1)}),d.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return v(e),t}function pu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function ra(e,t){this._pairs=[],e&&vi(e,this,t)}const gu=ra.prototype;gu.append=function(t,r){this._pairs.push([t,r])},gu.toString=function(t){const r=t?function(n){return t.call(this,n,pu)}:pu;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Km(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yu(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||Km,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new ra(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class vu{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 na={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Gm={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ra,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},sa=typeof window<"u"&&typeof document<"u",ia=typeof navigator=="object"&&navigator||void 0,Qm=sa&&(!ia||["ReactNative","NativeScript","NS"].indexOf(ia.product)<0),Ym=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Rm=sa&&window.location.href||"http://localhost",rt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:sa,hasStandardBrowserEnv:Qm,hasStandardBrowserWebWorkerEnv:Ym,navigator:ia,origin:Rm},Symbol.toStringTag,{value:"Module"})),...Gm};function Xm(e,t){return vi(e,new rt.classes.URLSearchParams,{visitor:function(r,n,s,i){return rt.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const mu=fu;function bu(e){if(e>mu)throw new R("FormData field is too deeply nested ("+e+" levels). Max depth: "+mu,R.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Zm(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)bu(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function Jm(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 _u(e){function t(r,n,s,i){bu(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]=Jm(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(Zm(n),s,r,0)}),r}return null}const bn=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function eb(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 ps={transitional:na,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(_u(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=bn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Xm(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=bn(this,"env"),d=u&&u.FormData;return vi(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(r.setContentType("application/json",!1),eb(t)):t}],transformResponse:[function(t){const r=bn(this,"transitional")||ps.transitional,n=r&&r.forcedJSONParsing,s=bn(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,bn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?R.from(c,R.ERR_BAD_RESPONSE,this,null,bn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:rt.classes.FormData,Blob:rt.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=>{ps.headers[e]={}});function oa(e,t){const r=this||ps,n=t||r,s=lt.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 wu(e){return!!(e&&e.__CANCEL__)}let gs=class extends R{constructor(t,r,n){super(t??"canceled",R.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Su(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new R("Request failed with status code "+r.status,r.status>=400&&r.status<500?R.ERR_BAD_REQUEST:R.ERR_BAD_RESPONSE,r.config,r.request,r))}function tb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function rb(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 u=Date.now(),d=n[i];o||(o=u),r[s]=c,n[s]=u;let f=i,y=0;for(;f!==s;)y+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const g=d&&u-d;return g?Math.round(y*1e3/g):void 0}}function nb(e,t){let r=0,n=1e3/t,s,i;const o=(u,d=Date.now())=>{r=d,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const d=Date.now(),f=d-r;f>=n?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const mi=(e,t,r=3)=>{let n=0;const s=rb(50,250);return nb(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,u=Math.max(0,c-n),d=s(u);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:u,rate:d||void 0,estimated:d&&a?(a-c)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},Cu=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ou=e=>(...t)=>D.asap(()=>e(...t)),sb=rt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,rt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(rt.origin),rt.navigator&&/(msie|trident)/i.test(rt.navigator.userAgent)):()=>!0,ib=rt.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 ob(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ab(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const lb=/^https?:(?!\/\/)/i,cb=/[\t\n\r]/g;function ub(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function db(e){return ub(e).replace(cb,"")}function Eu(e,t){if(typeof e=="string"&&lb.test(db(e)))throw new R('Invalid URL: missing "//" after protocol',R.ERR_INVALID_URL,t)}function Du(e,t,r,n){Eu(t,n);let s=!ob(t);return e&&(s||r===!1)?(Eu(e,n),ab(e,t)):t}const Iu=e=>e instanceof lt?{...e}:e;function Ur(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(d,f,y,g){return D.isPlainObject(d)&&D.isPlainObject(f)?D.merge.call({caseless:g},d,f):D.isPlainObject(f)?D.merge({},f):D.isArray(f)?f.slice():f}function s(d,f,y,g){if(D.isUndefined(f)){if(!D.isUndefined(d))return n(void 0,d,y,g)}else return n(d,f,y,g)}function i(d,f){if(!D.isUndefined(f))return n(void 0,f)}function o(d,f){if(D.isUndefined(f)){if(!D.isUndefined(d))return n(void 0,d)}else return n(void 0,f)}function a(d){const f=D.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!D.isUndefined(f))if(D.isPlainObject(f)){if(D.hasOwnProp(f,d))return f[d]}else return;const y=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(y)&&D.hasOwnProp(y,d))return y[d]}function c(d,f,y){if(D.hasOwnProp(t,y))return n(d,f);if(D.hasOwnProp(e,y))return n(void 0,d)}const u={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:(d,f,y)=>s(Iu(d),Iu(f),y,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const y=D.hasOwnProp(u,f)?u[f]:s,g=D.hasOwnProp(e,f)?e[f]:void 0,_=D.hasOwnProp(t,f)?t[f]:void 0,p=y(g,_,f);D.isUndefined(p)&&y!==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 fb=["content-type","content-length"];function hb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{fb.includes(n.toLowerCase())&&e.set(n,s)})}const pb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Tu(e){const t=Ur({},e),r=y=>D.hasOwnProp(t,y)?t[y]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=lt.from(a),t.url=yu(Du(u,f,d,t),r("params"),r("paramsSerializer")),c){const y=D.getSafeProp(c,"username")||"",g=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(y+":"+(g?pb(g):"")))}if(D.isFormData(n)&&(rt.hasStandardBrowserEnv||rt.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&hb(a,n.getHeaders(),r("formDataHeaderPolicy"))),rt.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&sb(t.url))){const g=i&&o&&ib.read(o);g&&a.set(i,g)}return t}const gb=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=Tu(e);let i=s.data;const o=lt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=s,d,f,y,g,_;function p(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function m(){if(!v)return;const S=lt.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};Su(function(k){r(k),p()},function(k){n(k),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 R("Request aborted",R.ECONNABORTED,e,v)),p(),v=null)},v.onerror=function(w){const O=w&&w.message?w.message:"Network Error",I=new R(O,R.ERR_NETWORK,e,v);I.event=w||null,n(I),p(),v=null},v.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||na;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new R(w,O.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,e,v)),p(),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&D.forEach(uu(o),function(w,O){v.setRequestHeader(O,w)}),D.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),a&&a!=="json"&&(v.responseType=s.responseType),u&&([y,_]=mi(u,!0),v.addEventListener("progress",y)),c&&v.upload&&([f,g]=mi(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=S=>{v&&(n(!S||S.type?new gs(null,e,v):S),v.abort(),p(),v=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const b=tb(s.url);if(b&&!rt.protocols.includes(b)){n(new R("Unsupported protocol "+b+":",R.ERR_BAD_REQUEST,e));return}v.send(i||null)})},yb=(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 u=c instanceof Error?c:this.reason;r.abort(u instanceof R?u:new gs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new R(`timeout of ${t}ms exceeded`,R.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},vb=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},mb=async function*(e,t){for await(const r of bb(e))yield*vb(r,t)},bb=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()}},Nu=(e,t,r,n)=>{const s=mb(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){a(),c.close();return}let f=d.byteLength;if(r){let y=i+=f;r(y)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},bi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,_b=(e,t,r)=>t+2<r&&bi(e.charCodeAt(t+1))&&bi(e.charCodeAt(t+2));function wb(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let g=0;g<a;g++)if(n.charCodeAt(g)===37&&g+2<a){const _=n.charCodeAt(g+1),p=n.charCodeAt(g+2);bi(_)&&bi(p)&&(o-=2,g+=2)}let c=0,u=a-1;const d=g=>g>=2&&n.charCodeAt(g-2)===37&&n.charCodeAt(g-1)===51&&(n.charCodeAt(g)===68||n.charCodeAt(g)===100);u>=0&&(n.charCodeAt(u)===61?(c++,u--):d(u)&&(c++,u-=3)),c===1&&u>=0&&(n.charCodeAt(u)===61||d(u))&&c++;const y=Math.floor(o/4)*3-(c||0);return y>0?y:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&_b(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 u=n.charCodeAt(o+1);u>=56320&&u<=57343?(i+=4,o++):i+=3}else i+=3}return i}const aa="1.18.0",xu=64*1024,{isFunction:_i}=D,Sb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),ku=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Au=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Cb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Ob=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?_i(s):typeof fetch=="function",c=_i(i),u=_i(o);if(!a)return!1;const d=a&&_i(r),f=a&&(typeof n=="function"?(m=>b=>m.encode(b))(new n):async m=>new Uint8Array(await new i(m).arrayBuffer())),y=c&&d&&Au(()=>{let m=!1;const b=new i(rt.origin,{body:new r,method:"POST",get duplex(){return m=!0,"half"}}),S=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),m&&!S}),g=u&&d&&Au(()=>D.isReadableStream(new o("").body)),_={stream:g&&(m=>m.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!_[m]&&(_[m]=(b,S)=>{let w=b&&b[m];if(w)return w.call(b);throw new R(`Response type '${m}' is not supported`,R.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(rt.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,b)=>{const S=D.toFiniteNumber(m.getContentLength());return S??p(b)};return async m=>{let{url:b,method:S,data:w,signal:O,cancelToken:I,timeout:k,onDownloadProgress:P,onUploadProgress:$,responseType:T,headers:A,withCredentials:F="same-origin",fetchOptions:M,maxContentLength:V,maxBodyLength:j}=Tu(m);const re=D.isNumber(V)&&V>-1,ue=D.isNumber(j)&&j>-1,K=J=>D.hasOwnProp(m,J)?m[J]:void 0;let z=s||fetch;T=T?(T+"").toLowerCase():"text";let X=yb([O,I&&I.toAbortSignal()],k),B=null;const G=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let Z,ve=null;const Te=()=>new R("Request body larger than maxBodyLength limit",R.ERR_BAD_REQUEST,m,B);try{let J;const Ce=K("auth");if(Ce){const te=D.getSafeProp(Ce,"username")||"",Me=D.getSafeProp(Ce,"password")||"";J={username:te,password:Me}}if(Cb(b)){const te=new URL(b,rt.origin);if(!J&&(te.username||te.password)){const Me=ku(te.username),Ve=ku(te.password);J={username:Me,password:Ve}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(J&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(Sb((J.username||"")+":"+(J.password||""))))),re&&typeof b=="string"&&b.startsWith("data:")&&wb(b)>V)throw new R("maxContentLength size of "+V+" exceeded",R.ERR_BAD_RESPONSE,m,B);if(ue&&S!=="get"&&S!=="head"){const te=await p(w);if(typeof te=="number"&&isFinite(te)&&(Z=te,te>j))throw Te()}const se=ue&&(D.isReadableStream(w)||D.isStream(w)),me=(te,Me,Ve)=>Nu(te,xu,ot=>{if(ue&&ot>j)throw ve=Te();Me&&Me(ot)},Ve);if(y&&S!=="get"&&S!=="head"&&($||se)){if(Z=Z??await v(A,w),Z!==0||se){let te=new i(b,{method:"POST",body:w,duplex:"half"}),Me;if(D.isFormData(w)&&(Me=te.headers.get("content-type"))&&A.setContentType(Me),te.body){const[Ve,ot]=$&&Cu(Z,mi(Ou($)))||[];w=me(te.body,Ve,ot)}}}else if(se&&!c&&d&&S!=="get"&&S!=="head")w=me(w);else if(se&&c&&!y&&S!=="get"&&S!=="head")throw new R("Stream request bodies are not supported by the current fetch implementation",R.ERR_NOT_SUPPORT,m,B);D.isString(F)||(F=F?"include":"omit");const oe=c&&"credentials"in i.prototype;if(D.isFormData(w)){const te=A.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&A.delete("content-type")}A.set("User-Agent","axios/"+aa,!1);const yt={...M,signal:X,method:S.toUpperCase(),headers:uu(A.normalize()),body:w,duplex:"half",credentials:oe?F:void 0};B=c&&new i(b,yt);let Ee=await(c?z(B,M):z(b,yt));const it=lt.from(Ee.headers);if(re){const te=D.toFiniteNumber(it.getContentLength());if(te!=null&&te>V)throw new R("maxContentLength size of "+V+" exceeded",R.ERR_BAD_RESPONSE,m,B)}const Je=g&&(T==="stream"||T==="response");if(g&&Ee.body&&(P||re||Je&&G)){const te={};["status","statusText","headers"].forEach(Ut=>{te[Ut]=Ee[Ut]});const Me=D.toFiniteNumber(it.getContentLength()),[Ve,ot]=P&&Cu(Me,mi(Ou(P),!0))||[];let Dt=0;const hr=Ut=>{if(re&&(Dt=Ut,Dt>V))throw new R("maxContentLength size of "+V+" exceeded",R.ERR_BAD_RESPONSE,m,B);Ve&&Ve(Ut)};Ee=new o(Nu(Ee.body,xu,hr,()=>{ot&&ot(),G&&G()}),te)}T=T||"text";let He=await _[D.findKey(_,T)||"text"](Ee,m);if(re&&!g&&!Je){let te;if(He!=null&&(typeof He.byteLength=="number"?te=He.byteLength:typeof He.size=="number"?te=He.size:typeof He=="string"&&(te=typeof n=="function"?new n().encode(He).byteLength:He.length)),typeof te=="number"&&te>V)throw new R("maxContentLength size of "+V+" exceeded",R.ERR_BAD_RESPONSE,m,B)}return!Je&&G&&G(),await new Promise((te,Me)=>{Su(te,Me,{data:He,headers:lt.from(Ee.headers),status:Ee.status,statusText:Ee.statusText,config:m,request:B})})}catch(J){if(G&&G(),X&&X.aborted&&X.reason instanceof R){const Ce=X.reason;throw Ce.config=m,B&&(Ce.request=B),J!==Ce&&(Ce.cause=J),Ce}throw ve?(B&&!ve.request&&(ve.request=B),ve):J instanceof R?(B&&!J.request&&(J.request=B),J):J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new R("Network Error",R.ERR_NETWORK,m,B,J&&J.response),{cause:J.cause||J}):R.from(J,J&&J.code,m,B,J&&J.response)}}},Eb=new Map,Pu=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,u,d=Eb;for(;a--;)c=i[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:Ob(t)),d=u;return u};Pu();const la={http:qm,xhr:gb,fetch:{get:Pu}};D.forEach(la,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Mu=e=>`- ${e}`,Db=e=>D.isFunction(e)||e===null||e===!1;function Ib(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,!Db(n)&&(s=la[(a=String(n)).toLowerCase()],s===void 0))throw new R(`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,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
451
451
  `+o.map(Mu).join(`
452
452
  `):" "+Mu(o[0]):"as no adapter specified";throw new R("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Lu={getAdapter:Ib,adapters:la};function ca(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new gs(null,e)}function Fu(e){return ca(e),e.headers=lt.from(e.headers),e.data=oa.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Lu.getAdapter(e.adapter||ps.adapter,e)(e).then(function(n){ca(e),e.response=n;try{n.data=oa.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=lt.from(n.headers),n},function(n){if(!wu(n)&&(ca(e),n&&n.response)){e.response=n.response;try{n.response.data=oa.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=lt.from(n.response.headers)}return Promise.reject(n)})}const wi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wi[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const $u={};wi.transitional=function(t,r,n){function s(i,o){return"[Axios v"+aa+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new R(s(o," has been removed"+(r?" in "+r:"")),R.ERR_DEPRECATED);return r&&!$u[o]&&($u[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}},wi.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Tb(e,t,r){if(typeof e!="object")throw new R("options must be an object",R.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 R("option "+i+" must be "+c,R.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new R("Unknown option "+i,R.ERR_BAD_OPTION)}}const Si={assertOptions:Tb,validators:wi},ct=Si.validators;let zr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new vu,response:new vu}}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=Ur(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Si.assertOptions(n,{silentJSONParsing:ct.transitional(ct.boolean),forcedJSONParsing:ct.transitional(ct.boolean),clarifyTimeoutError:ct.transitional(ct.boolean),legacyInterceptorReqResOrdering:ct.transitional(ct.boolean),advertiseZstdAcceptEncoding:ct.transitional(ct.boolean),validateStatusUndefinedResolves:ct.transitional(ct.boolean)},!1),s!=null&&(I.isFunction(s)?r.paramsSerializer={serialize:s}:Si.assertOptions(s,{encode:ct.function,serialize:ct.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Si.assertOptions(r,{baseUrl:ct.spelling("baseURL"),withXsrfToken:ct.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&I.merge(i.common,i[r.method]);i&&I.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=lt.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||na;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let d,f=0,y;if(!c){const _=[Fu.bind(this),void 0];for(_.unshift(...a),_.push(...u),y=_.length,d=Promise.resolve(r);f<y;)d=d.then(_[f++],_[f++]);return d}y=a.length;let g=r;for(;f<y;){const _=a[f++],p=a[f++];try{g=_(g)}catch(v){p.call(this,v);break}}try{d=Fu.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,y=u.length;f<y;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Ur(this.defaults,t);const r=Du(t.baseURL,t.url,t.allowAbsoluteUrls,t);return yu(r,t.params,t.paramsSerializer)}};I.forEach(["delete","get","head","options"],function(t){zr.prototype[t]=function(r,n){return this.request(Ur(n||{},{method:t,url:r,data:n&&I.hasOwnProp(n,"data")?n.data:void 0}))}}),I.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(Ur(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}zr.prototype[t]=r(),t!=="query"&&(zr.prototype[t+"Form"]=r(!0))});let Nb=class Xh{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 gs(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 Xh(function(s){t=s}),cancel:t}}};function xb(e){return function(r){return e.apply(null,r)}}function kb(e){return I.isObject(e)&&e.isAxiosError===!0}const ua={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(ua).forEach(([e,t])=>{ua[t]=e});function ju(e){const t=new zr(e),r=Jc(zr.prototype.request,t);return I.extend(r,zr.prototype,t,{allOwnKeys:!0}),I.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return ju(Ur(e,s))},r}const He=ju(ps);He.Axios=zr,He.CanceledError=gs,He.CancelToken=Nb,He.isCancel=wu,He.VERSION=aa,He.toFormData=vi,He.AxiosError=R,He.Cancel=He.CanceledError,He.all=function(t){return Promise.all(t)},He.spread=xb,He.isAxiosError=kb,He.mergeConfig=Ur,He.AxiosHeaders=lt,He.formToJSON=e=>_u(I.isHTMLForm(e)?new FormData(e):e),He.getAdapter=Lu.getAdapter,He.HttpStatusCode=ua,He.default=He;const{Axios:JO,AxiosError:eD,CanceledError:tD,isCancel:rD,CancelToken:nD,VERSION:sD,all:iD,Cancel:oD,isAxiosError:aD,spread:lD,toFormData:cD,AxiosHeaders:uD,HttpStatusCode:dD,formToJSON:fD,getAdapter:hD,mergeConfig:pD,create:gD}=He;let da="";function Bu(e){da=e}const Fe=He.create({timeout:3e4});Fe.interceptors.request.use(async e=>{var s,i;const{useEditorStore:t}=await Promise.resolve().then(()=>Yc),n=(i=(s=t.getState().editorConfig)==null?void 0:s.context)==null?void 0:i.authToken;return n&&(e.headers=e.headers??{},e.headers.Authorization=`Bearer ${n}`),da&&(e.baseURL=da),e});const Vu=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Ab(e,t={}){var s,i,o;const r={"organisations.roles":"CONTENT_CREATOR"};return t.rootOrgId&&(r.rootOrgId=[t.rootOrgId]),((o=(i=(s=(await Fe.post("/action/user/v1/search",{request:{query:e,filters:r,fields:Vu,offset:0,limit:t.limit??20}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:s.result)==null?void 0:i.response)==null?void 0:o.content)??[]}async function Pb(e){var r,n,s;return e.length?((s=(n=(r=(await Fe.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Vu,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 Uu(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(u=>Uu(u,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 zu(e){var s,i,o,a,c,u,d;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)||((u=(c=t.data)==null?void 0:c.params)==null?void 0:u.err)||((d=t.data)==null?void 0:d.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Uu(r);return{content:r,rootNode:n}}async function Mb(e,t,r,n){await Fe.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})}async function Lb(e,t=""){await Fe.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function Fb(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 $b(e){await Fe.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function jb(e,t){await Fe.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function Bb(e,t){await Fe.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const Ce={container:"_container_1cpb1_1",header:"_header_1cpb1_13",title:"_title_1cpb1_22",closeBtn:"_closeBtn_1cpb1_29",body:"_body_1cpb1_45",label:"_label_1cpb1_54",searchSection:"_searchSection_1cpb1_62",searchRow:"_searchRow_1cpb1_68",searchInput:"_searchInput_1cpb1_74",searchSpinner:"_searchSpinner_1cpb1_89",resultsList:"_resultsList_1cpb1_105",resultItem:"_resultItem_1cpb1_118",userInfo:"_userInfo_1cpb1_133",userName:"_userName_1cpb1_141",userEmail:"_userEmail_1cpb1_150",noResults:"_noResults_1cpb1_158",collabSection:"_collabSection_1cpb1_165",sectionTitle:"_sectionTitle_1cpb1_170",badge:"_badge_1cpb1_180",emptyCollab:"_emptyCollab_1cpb1_194",collabList:"_collabList_1cpb1_205",collabItem:"_collabItem_1cpb1_214",userAvatar:"_userAvatar_1cpb1_228",error:"_error_1cpb1_242",success:"_success_1cpb1_248",footer:"_footer_1cpb1_254"},Vb=({contentId:e,onClose:t})=>{const[r,n]=h.useState(""),[s,i]=h.useState([]),[o,a]=h.useState(!1),[c,u]=h.useState([]),[d,f]=h.useState(!1),[y,g]=h.useState(""),[_,p]=h.useState(!1),v=h.useRef(null);h.useEffect(()=>{let C=!1;return(async()=>{try{const D=await Fb(e),x=(D==null?void 0:D.collaborators)??[];if(!x.length)return;const A=await Pb(x);if(C)return;const F=x.map(k=>A.find(P=>P.identifier===k)??{identifier:k,firstName:k});u(F)}catch{}})(),()=>{C=!0}},[e]),h.useEffect(()=>{v.current&&clearTimeout(v.current);const C=r.trim();if(C.length<2){i([]);return}return v.current=setTimeout(async()=>{a(!0);try{const D=await Ab(C),x=new Set(c.map(A=>A.identifier));i(D.filter(A=>!x.has(A.identifier)))}catch{i([])}finally{a(!1)}},300),()=>{v.current&&clearTimeout(v.current)}},[r,c]);const m=h.useCallback(C=>{u(D=>D.find(x=>x.identifier===C.identifier)?D:[...D,C]),i(D=>D.filter(x=>x.identifier!==C.identifier)),p(!1)},[]),b=h.useCallback(C=>{u(D=>D.filter(x=>x.identifier!==C)),p(!1)},[]),S=h.useCallback(async()=>{f(!0),g(""),p(!1);try{await Bb(e,c.map(C=>C.identifier)),p(!0)}catch{g("Failed to save collaborators. Please try again.")}finally{f(!1)}},[e,c]),w=C=>`${C.firstName}${C.lastName?` ${C.lastName}`:""}`;return l.jsxs("div",{className:Ce.container,children:[l.jsxs("div",{className:Ce.header,children:[l.jsx("h2",{className:Ce.title,children:"Manage Collaborators"}),l.jsx("button",{className:Ce.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ce.body,children:[l.jsxs("div",{className:Ce.searchSection,children:[l.jsx("label",{className:Ce.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Ce.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Ce.searchInput,placeholder:"Search by name or email...",value:r,onChange:C=>n(C.target.value)}),o&&l.jsx("span",{className:Ce.searchSpinner,"aria-label":"Searching..."})]}),s.length>0&&l.jsx("ul",{className:Ce.resultsList,role:"listbox","aria-label":"Search results",children:s.map(C=>l.jsxs("li",{className:Ce.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Ce.userInfo,children:[l.jsx("span",{className:Ce.userName,children:w(C)}),C.email&&l.jsx("span",{className:Ce.userEmail,children:C.email})]}),l.jsx(Oe,{variant:"primary",size:"sm",onClick:()=>m(C),children:"Add"})]},C.identifier))}),r.trim().length>=2&&!o&&s.length===0&&l.jsx("p",{className:Ce.noResults,children:"No users found."})]}),l.jsxs("div",{className:Ce.collabSection,children:[l.jsxs("h3",{className:Ce.sectionTitle,children:["Current Collaborators",c.length>0&&l.jsx("span",{className:Ce.badge,children:c.length})]}),c.length===0?l.jsx("p",{className:Ce.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Ce.collabList,children:c.map(C=>l.jsxs("li",{className:Ce.collabItem,children:[l.jsx("div",{className:Ce.userAvatar,"aria-hidden":"true",children:w(C).charAt(0).toUpperCase()}),l.jsxs("div",{className:Ce.userInfo,children:[l.jsx("span",{className:Ce.userName,children:w(C)}),C.email&&l.jsx("span",{className:Ce.userEmail,children:C.email})]}),l.jsx(Oe,{variant:"danger",size:"sm",onClick:()=>b(C.identifier),children:"Remove"})]},C.identifier))})]}),y&&l.jsx("p",{className:Ce.error,role:"alert",children:y}),_&&l.jsx("p",{className:Ce.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Ce.footer,children:[l.jsx(Oe,{variant:"ghost",onClick:t,disabled:d,children:"Cancel"}),l.jsx(Oe,{variant:"primary",isLoading:d,onClick:S,children:"Save"})]})]})};async function Ub(e){return(await Fe.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function zb(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 r;return((r=(await Fe.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}const ie={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 Hb(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Wb(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const qu=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=h.useState(""),u=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${u}-title`,children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:`${u}-title`,className:ie.sbModalTitle,children:e}),l.jsx("button",{className:ie.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ie.sbModalBody,children:[l.jsxs("label",{className:ie.sbLabel,htmlFor:`${u}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${u}-comment`,className:ie.sbTextarea,placeholder:r,value:a,onChange:d=>c(d.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ie.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ie.sbModalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Oe,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Kb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ie.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ie.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ie.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:ie.sbModalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Oe,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Gb=({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:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ie.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ie.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ie.sbModalBody,children:[l.jsxs("label",{className:ie.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:ie.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:ie.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ie.sbModalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Oe,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Qb=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,onToolbarEvent:s})=>{var J,Se;const o=Me(re=>re.treeData)[0],a=(o==null?void 0:o.name)??"Untitled",c=Wb(((J=o==null?void 0:o.metadata)==null?void 0:J.status)??(o==null?void 0:o.status)),u=be(re=>{var me,oe,yt,Ne;return((oe=(me=re.editorConfig)==null?void 0:me.context)==null?void 0:oe.contentId)??((Ne=(yt=re.editorConfig)==null?void 0:yt.context)==null?void 0:Ne.identifier)??""}),{activeModal:d,modalData:f,closeModal:y,openModal:g}=Lv(),_=be(re=>re.buttonLoaders),[p,v]=h.useState(!1),[m,b]=h.useState(!1),[S,w]=h.useState(!1),[C,D]=h.useState(!1),x=h.useRef(null),[A,F]=h.useState(!1);h.useEffect(()=>{if(!C)return;const re=me=>{var oe;(oe=x.current)!=null&&oe.contains(me.target)||D(!1)};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[C]);const[k,P]=h.useState(!1),[z,M]=h.useState(!1),{updateNode:H}=Me(),$=(Se=o==null?void 0:o.metadata)==null?void 0:Se.qrCodeProcessId,se=h.useCallback(async re=>{if(u){F(!1),P(!0);try{const{processId:me,reservedDialcodes:oe}=await zb(u,re);me&&o&&H(o.id,{qrCodeProcessId:me,reservedDialcodes:oe}),Pe.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Pe.error("Failed to generate QR Codes. Please try again.")}finally{P(!1)}}},[u,o,H]),ue=h.useCallback(async()=>{const re=(o==null?void 0:o.metadata)??{};if(!re.medium||!re.gradeLevel||!re.subject){Pe.error("Please ensure Medium, Class and Subject are set before downloading QR Codes.");return}if(!$){Pe.error("No QR codes generated yet. Generate QR Codes first.");return}M(!0);try{const me=await qb($);if(me.status==="in-process"){Pe("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const oe=me.url;if(!oe){Pe.error("QR Codes not ready yet. Please wait and try again.");return}const yt=await fetch(oe).then(Be=>Be.blob()),Ne=await new Promise(Be=>{const Mt=new FileReader;Mt.onloadend=()=>Be(Mt.result),Mt.readAsDataURL(yt)}),ot=Be=>Array.isArray(Be)?Be.join("_"):typeof Be=="string"?Be:"",et=ot(re.medium),qe=ot(re.gradeLevel),te=ot(re.subject),Ke=new Date().toISOString().replace(/[:.]/g,"-"),vt=`${u}_${et}_${qe}_${te}_${Ke}.zip`,Ge=document.createElement("a");Ge.href=Ne,Ge.download=vt,Ge.style.display="none",document.body.appendChild(Ge),Ge.click(),document.body.removeChild(Ge),Pe.success("QR codes downloaded.")}catch{Pe.error("Failed to download QR Codes.")}finally{M(!1)}},[$,o,u]),K=e==="edit",V=e==="review",X=e==="sourcingreview",j=e==="read",G=h.useCallback((re,me)=>{s({action:re,data:me})},[s]),Z=h.useCallback(()=>{y(),G("publish")},[y,G]),ve=h.useCallback((re,me)=>{const oe=f==null?void 0:f.action;y(),oe==="approve"?G("sourcingApprove",{comment:re,score:me}):G("reject",{comment:re})},[y,G,f]),Ie=h.useCallback(re=>{v(!1),G("sendBackForCorrections",{comment:re})},[G]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ie.topbar,role:"banner",children:[l.jsxs("div",{className:ie.left,children:[l.jsx("button",{className:ie.backBtn,onClick:()=>G("back"),"aria-label":"Go back",type:"button",children:l.jsx(tv,{size:18})}),l.jsx("h1",{className:ie.title,title:a,children:a}),l.jsx("span",{className:`sbx-chip ${ie.statusChip}`,"aria-label":`Status: ${c}`,children:c})]}),l.jsxs("div",{className:ie.right,children:[t?l.jsx("span",{className:ie.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ie.savedIndicator} ${ie.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ie.savedIndicator,"aria-live":"polite",children:[l.jsx(fn,{size:14,"aria-hidden":"true"}),"Saved ",Hb(n)]}):null,!j&&!V&&!X&&c!=="Review"&&l.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>G("saveCollection"),children:"Save as Draft"}),K&&l.jsxs(l.Fragment,{children:[l.jsxs(Oe,{variant:"primary",size:"sm",onClick:()=>w(!0),disabled:_.saveCollection,isLoading:_.saveCollection,children:[l.jsx(vv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ie.iconBtn,onClick:()=>g("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(_v,{size:16,"aria-hidden":"true"})}),l.jsxs("div",{className:ie.qrDropdown,ref:x,children:[l.jsxs("button",{className:ie.iconBtn,onClick:()=>D(re=>!re),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":C,children:[l.jsx($c,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ie.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),C&&l.jsxs("div",{className:ie.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{D(!1),F(!0)},disabled:k,children:[l.jsx($c,{size:14}),k?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{D(!1),ue()},disabled:z||!$,children:[l.jsx(ov,{size:14}),z?"Downloading…":"Download QR Codes"]})]})]})]}),V&&l.jsxs("div",{className:ie.reviewBtns,children:[l.jsxs(Oe,{variant:"primary",size:"sm",onClick:()=>g("publishChecklist"),disabled:_.publishCollection,isLoading:_.publishCollection,children:[l.jsx(Ac,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Oe,{variant:"danger",size:"sm",onClick:()=>b(!0),disabled:_.rejectCollection,isLoading:_.rejectCollection,children:[l.jsx(Lo,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:()=>v(!0),children:[l.jsx(gv,{size:14,"aria-hidden":"true"})," Send Back"]})]}),X&&l.jsxs("div",{className:ie.sourcingBtns,children:[l.jsxs(Oe,{variant:"primary",size:"sm",onClick:()=>g("qualityParams",{action:"approve"}),children:[l.jsx(mv,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Oe,{variant:"danger",size:"sm",onClick:()=>g("qualityParams",{action:"reject"}),children:[l.jsx(Lo,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),d==="publishChecklist"&&l.jsx(jv,{contentId:u,onConfirm:Z,onCancel:y}),d==="qualityParams"&&l.jsx(Bv,{contentId:u,action:(f==null?void 0:f.action)??"reject",onConfirm:ve,onCancel:y}),d==="manageCollaborators"&&l.jsx("div",{className:ie.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(Vb,{contentId:u,onClose:y})}),S&&l.jsx(Kb,{onConfirm:()=>{w(!1),G("sendForReview")},onCancel:()=>w(!1)}),m&&l.jsx(qu,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",submitVariant:"danger",onConfirm:re=>{b(!1),G("reject",{comment:re})},onCancel:()=>b(!1)}),p&&l.jsx(qu,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",onConfirm:Ie,onCancel:()=>v(!1)}),A&&l.jsx(Gb,{onConfirm:se,onCancel:()=>F(!1)})]})},Yb=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Le.createPortal(l.jsx("div",{className:De.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:De.modal,children:[l.jsxs("div",{className:De.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:De.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:De.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:De.modalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Oe,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Oe,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var Rb=Go();const Hu=h.createContext(null);function Et(){const e=h.useContext(Hu);if(e===null)throw new Error("No Tree Api Provided");return e}const Wu=h.createContext(null);function Xb(){const e=h.useContext(Wu);if(e===null)throw new Error("Provide a NodesContext");return e}const Ku=h.createContext(null);function Zb(){const e=h.useContext(Ku);if(e===null)throw new Error("Provide a DnDContext");return e}const Gu=h.createContext(0);function Qu(){h.useContext(Gu)}function Ci(e,t,r){return Math.max(Math.min(e,r),t)}function Yu(e){return e&&e.isLeaf}function Ru(e){return e&&e.isInternal&&!e.isOpen}function Xu(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Zu=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Ju=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function fa(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=fa(r,t);if(n)return n}return null}function Ei(e,t){if(t(e),e.children)for(let r of e.children)Ei(r,t)}function ed(e){const t=rd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Jb(t,n);break}r==null||r.focus()}function td(e){const t=rd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=e_(t,n);break}r==null||r.focus()}function Jb(e,t){return t+1<e.length?e[t+1]:e[0]}function e_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function rd(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 ys(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function _n(e){return typeof e=="string"?e:e.id}function t_(e,...t){if(e)return e(...t)}function nd(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function sd(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 id(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const r_=Object.freeze(Object.defineProperty({__proto__:null,access:ys,bound:Ci,dfs:fa,focusNextElement:ed,focusPrevElement:td,getInsertIndex:sd,getInsertParentId:id,identify:_n,indexOf:Ju,isClosed:Ru,isDescendant:Zu,isItem:Yu,isOpenWithEmptyChildren:Xu,safeRun:t_,waitFor:nd,walk:Ei},Symbol.toStringTag,{value:"Module"})),n_={display:"flex",alignItems:"center",zIndex:1},s_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},i_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},o_=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({},n_),s),children:[l.jsx("div",{style:Object.assign({},i_)}),l.jsx("div",{style:Object.assign({},s_)})]})});function a_({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 l_(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(u_,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 u_({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 vs="__REACT_ARBORIST_INTERNAL_ROOT__";function od(e){var t;function r(i,o,a){const c=e.accessId(i),u=new ms({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),d=e.accessChildren(i);return d&&(u.children=d.map(f=>r(f,o+1,u))),u}const n=new ms({tree:e,id:vs,data:{id:vs},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 ms{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===vs}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 ms(Object.assign({},this))}edit(){return this.tree.edit(this)}}function ha(e){return{type:"EDIT",id:e}}function d_(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function wn(e){return{type:"FOCUS",id:e}}function f_(){return{type:"TREE_BLUR"}}function h_(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 pa={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 ad(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 p_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:ad(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:ad(e.unfiltered,t)}):e}const Sn=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}}},Cr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:_n(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(_n)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(_n)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:_n(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:_n(e)})};function g_(e=Sn().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 Cn={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 y_(e=Sn().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 Sn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const v_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},m_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},b_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function ld({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(__,{isDragging:s,children:[l.jsx(w_,{offset:e,children:l.jsx(C_,{id:r,dragIds:n})}),l.jsx(S_,{mouse:t,count:n.length})]})}const __=h.memo(function(t){return t.isDragging?l.jsx("div",{style:v_,children:t.children}):null});function w_(e){return l.jsx("div",{className:"row preview",style:m_(e.offset),children:e.children})}function S_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:b_(r),children:t}):null}const C_=h.memo(function(t){const r=Et(),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 ga(){return ga=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},ga.apply(null,arguments)}function cd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ya(e,t){return ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ya(e,t)}function E_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ya(e,t)}var ud=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function O_(e,t){return!!(e===t||ud(e)&&ud(t))}function D_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!O_(e[r],t[r]))return!1;return!0}function va(e,t){t===void 0&&(t=D_);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 I_=typeof performance=="object"&&typeof performance.now=="function",dd=I_?function(){return performance.now()}:function(){return Date.now()};function fd(e){cancelAnimationFrame(e.id)}function T_(e,t){var r=dd();function n(){dd()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var ma=-1;function hd(e){if(e===void 0&&(e=!1),ma===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),ma=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return ma}var En=null;function pd(e){if(e===void 0&&(e=!1),En===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?En="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?En="negative":En="positive-ascending"),document.body.removeChild(t),En}return En}process.env.NODE_ENV;var N_=150,x_=function(t,r){return t},Oi=null,Di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Oi=new WeakSet,Di=new WeakSet);function gd(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,d=e.validateProps;return t=function(f){E_(y,f);function y(_){var p;return p=f.call(this,_)||this,p._instanceProps=c(p.props,cd(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:cd(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=va(function(v,m,b,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:b,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=va(function(v,m,b){return p.props.onScroll({scrollDirection:v,scrollOffset:m,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var m=p.props,b=m.direction,S=m.itemSize,w=m.layout,C=p._getItemStyleCache(u&&S,u&&w,u&&b),D;if(C.hasOwnProperty(v))D=C[v];else{var x=r(p.props,v,p._instanceProps),A=s(p.props,v,p._instanceProps),F=b==="horizontal"||w==="horizontal",k=b==="rtl",P=F?x:0;C[v]=D={position:"absolute",left:k?void 0:P,right:k?P:void 0,top:F?0:x,height:F?"100%":A,width:F?A:"100%"}}return D},p._getItemStyleCache=void 0,p._getItemStyleCache=va(function(v,m,b){return{}}),p._onScrollHorizontal=function(v){var m=v.currentTarget,b=m.clientWidth,S=m.scrollLeft,w=m.scrollWidth;p.setState(function(C){if(C.scrollOffset===S)return null;var D=p.props.direction,x=S;if(D==="rtl")switch(pd()){case"negative":x=-S;break;case"positive-descending":x=w-b-S;break}return x=Math.max(0,Math.min(x,w-b)),{isScrolling:!0,scrollDirection:C.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var m=v.currentTarget,b=m.clientHeight,S=m.scrollHeight,w=m.scrollTop;p.setState(function(C){if(C.scrollOffset===w)return null;var D=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:C.scrollOffset<D?"forward":"backward",scrollOffset:D,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&&fd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=T_(p._resetIsScrolling,N_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}y.getDerivedStateFromProps=function(p,v){return k_(p,v),d(p),null};var g=y.prototype;return g.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)},g.scrollToItem=function(p,v){v===void 0&&(v="auto");var m=this.props,b=m.itemCount,S=m.layout,w=this.state.scrollOffset;p=Math.max(0,Math.min(p,b-1));var C=0;if(this._outerRef){var D=this._outerRef;S==="vertical"?C=D.scrollWidth>D.clientWidth?hd():0:C=D.scrollHeight>D.clientHeight?hd():0}this.scrollTo(i(this.props,p,v,w,this._instanceProps,C))},g.componentDidMount=function(){var p=this.props,v=p.direction,m=p.initialScrollOffset,b=p.layout;if(typeof m=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||b==="horizontal"?S.scrollLeft=m:S.scrollTop=m}this._callPropsCallbacks()},g.componentDidUpdate=function(){var p=this.props,v=p.direction,m=p.layout,b=this.state,S=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(v==="horizontal"||m==="horizontal")if(v==="rtl")switch(pd()){case"negative":C.scrollLeft=-S;break;case"positive-ascending":C.scrollLeft=S;break;default:var D=C.clientWidth,x=C.scrollWidth;C.scrollLeft=x-D-S;break}else C.scrollLeft=S;else C.scrollTop=S}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&fd(this._resetIsScrollingTimeoutId)},g.render=function(){var p=this.props,v=p.children,m=p.className,b=p.direction,S=p.height,w=p.innerRef,C=p.innerElementType,D=p.innerTagName,x=p.itemCount,A=p.itemData,F=p.itemKey,k=F===void 0?x_:F,P=p.layout,z=p.outerElementType,M=p.outerTagName,H=p.style,$=p.useIsScrolling,se=p.width,ue=this.state.isScrolling,K=b==="horizontal"||P==="horizontal",V=K?this._onScrollHorizontal:this._onScrollVertical,X=this._getRangeToRender(),j=X[0],G=X[1],Z=[];if(x>0)for(var ve=j;ve<=G;ve++)Z.push(h.createElement(v,{data:A,key:k(ve,A),index:ve,isScrolling:$?ue:void 0,style:this._getItemStyle(ve)}));var Ie=n(this.props,this._instanceProps);return h.createElement(z||M||"div",{className:m,onScroll:V,ref:this._outerRefSetter,style:ga({position:"relative",height:S,width:se,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},H)},h.createElement(C||D||"div",{children:Z,ref:w,style:{height:K?"100%":Ie,pointerEvents:ue?"none":void 0,width:K?Ie:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],b=v[1],S=v[2],w=v[3];this._callOnItemsRendered(m,b,S,w)}}if(typeof this.props.onScroll=="function"){var C=this.state,D=C.scrollDirection,x=C.scrollOffset,A=C.scrollUpdateWasRequested;this._callOnScroll(D,x,A)}},g._getRangeToRender=function(){var p=this.props,v=p.itemCount,m=p.overscanCount,b=this.state,S=b.isScrolling,w=b.scrollDirection,C=b.scrollOffset;if(v===0)return[0,0,0,0];var D=o(this.props,C,this._instanceProps),x=a(this.props,D,C,this._instanceProps),A=!S||w==="backward"?Math.max(1,m):1,F=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,D-A),Math.max(0,Math.min(v-1,x+F)),D,x]},y}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var k_=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,d=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Di&&!Di.has(d)&&(Di.add(d),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":Oi&&!Oi.has(d)&&(Oi.add(d),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 u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" 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.'))}},A_=50,On=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 u=o[a];c=u.offset+u.size}for(var d=a+1;d<=r;d++){var f=i(d);o[d]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},P_=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?yd(t,r,i,0,n):M_(t,r,Math.max(0,i),n)},yd=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=On(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},M_=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&On(t,n,r).offset<s;)n+=o,o*=2;return yd(t,r,Math.min(n,i-1),Math.floor(n/2),s)},vd=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 u=n-o-1,d=u*i;return a+d},L_=gd({getItemOffset:function(t,r,n){return On(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:vd,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.layout,d=t.width,f=a==="horizontal"||u==="horizontal",y=f?d:c,g=On(t,r,i),_=vd(t,i),p=Math.max(0,Math.min(_-y,g.offset)),v=Math.max(0,g.offset-y+g.size+o);switch(n==="smart"&&(s>=v-y&&s<=p+y?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 P_(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,u=t.width,d=i==="horizontal"||c==="horizontal",f=d?u:o,y=On(t,r,s),g=n+f,_=y.offset+y.size,p=r;p<a-1&&_<g;)p++,_+=On(t,p,s).size;return p},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||A_,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.'))}}),F_=gd({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,u=t.itemCount,d=t.itemSize,f=t.layout,y=t.width,g=a==="horizontal"||f==="horizontal",_=g?y:c,p=Math.max(0,u*d-_),v=Math.min(p,r*d),m=Math.max(0,r*d-_+d+o);switch(n==="smart"&&(s>=m-_&&s<=v+_?n="auto":n="center"),n){case"start":return v;case"end":return m;case"center":{var b=Math.round(m+(v-m)/2);return b<Math.ceil(_/2)?0:b>p+Math.floor(_/2)?p:b}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,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,y=d?u:i,g=Math.ceil((y+n-f)/a);return Math.max(0,Math.min(o-1,r+g-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 $_(){var e,t;const r=Et(),s=Zb().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 j_=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 B_=h.forwardRef(function(t,r){const{children:n}=t,s=j_(t,["children"]),i=Et();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(V_,{}),n]}))}),V_=()=>{const e=Et();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx($_,{})})};var U_=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 z_=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=U_(t,["style"]);const u=Et(),d=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=u.props.padding)!==null&&i!==void 0?i:u.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)+d+f}px`})},c))});var md=h.createContext({dragDropManager:void 0}),$t;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})($t||($t={}));function le(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 ba="dnd-core/INIT_COORDS",Ii="dnd-core/BEGIN_DRAG",_a="dnd-core/PUBLISH_DRAG_SOURCE",Ti="dnd-core/HOVER",Ni="dnd-core/DROP",xi="dnd-core/END_DRAG";function bd(e,t){return{type:ba,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function ki(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ki=function(r){return typeof r}:ki=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ki(e)}function q_(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function H_(e,t){return e.filter(function(r){return r!==t})}function _d(e){return ki(e)==="object"}function W_(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 K_(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var G_={type:ba,payload:{clientOffset:null,sourceClientOffset:null}};function Q_(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(),u=e.getRegistry();e.dispatch(bd(o)),Y_(r,c,u);var d=Z_(r,c);if(d===null){e.dispatch(G_);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");R_(a),f=a(d)}e.dispatch(bd(o,f));var y=u.getSource(d),g=y.beginDrag(c,d);if(g!=null){X_(g),u.pinSource(d);var _=u.getSourceType(d);return{type:Ii,payload:{itemType:_,item:g,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function Y_(e,t,r){le(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){le(r.getSource(n),"Expected sourceIds to be registered.")})}function R_(e){le(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function X_(e){le(_d(e),"Item must be an object.")}function Z_(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 J_(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:_a}}}function wa(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function ew(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;tw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();rw(i,o,a);var c=o.getItemType();return nw(i,a,c),sw(i,o,a),{type:Ti,payload:{targetIds:i,clientOffset:s||null}}}}function tw(e){le(Array.isArray(e),"Expected targetIds to be an array.")}function rw(e,t,r){le(t.isDragging(),"Cannot call hover while not dragging."),le(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];le(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);le(i,"Expected targetIds to be registered.")}}function nw(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);wa(i,r)||e.splice(n,1)}}function sw(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function wd(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 Sd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wd(Object(r),!0).forEach(function(n){iw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ow(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();aw(n);var i=uw(n);i.forEach(function(o,a){var c=lw(o,a,s,n),u={type:Ni,payload:{dropResult:Sd(Sd({},r),c)}};e.dispatch(u)})}}function aw(e){le(e.isDragging(),"Cannot call drop while not dragging."),le(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function lw(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){le(typeof e>"u"||_d(e),"Drop result must either be an object or undefined.")}function uw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function dw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();fw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:xi}}}function fw(e){le(e.isDragging(),"Cannot call endDrag while not dragging.")}function hw(e){return{beginDrag:Q_(e),publishDragSource:J_(e),hover:ew(e),drop:ow(e),endDrag:dw(e)}}function pw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gw(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 yw(e,t,r){return t&&gw(e.prototype,t),e}function bs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vw=function(){function e(t,r){var n=this;pw(this,e),bs(this,"store",void 0),bs(this,"monitor",void 0),bs(this,"backend",void 0),bs(this,"isSetUp",!1),bs(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 yw(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),u=0;u<a;u++)c[u]=arguments[u];var d=o.apply(r,c);typeof d<"u"&&n(d)}}var i=hw(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 jt(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 Cd=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ed=function(){return Math.random().toString(36).substring(7).split("").join(".")},Od={INIT:"@@redux/INIT"+Ed(),REPLACE:"@@redux/REPLACE"+Ed()};function mw(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 bw(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(Sw(e))return"date";if(ww(e))return"error";var r=_w(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 _w(e){return typeof e.constructor=="function"?e.constructor.name:null}function ww(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Sw(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Dn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=bw(e)),t}function Dd(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"?jt(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"?jt(1):"Expected the enhancer to be a function. Instead, received: '"+Dn(r)+"'");return r(Dd)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?jt(2):"Expected the root reducer to be a function. Instead, received: '"+Dn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function u(){a===o&&(a=o.slice())}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?jt(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"?jt(4):"Expected the listener to be a function. Instead, received: '"+Dn(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?jt(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 u(),a.push(p),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?jt(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,u();var b=a.indexOf(p);a.splice(b,1),o=null}}}function y(p){if(!mw(p))throw new Error(process.env.NODE_ENV==="production"?jt(7):"Actions must be plain objects. Instead, the actual type was: '"+Dn(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"?jt(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"?jt(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 b=v[m];b()}return p}function g(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?jt(10):"Expected the nextReducer to be a function. Instead, received: '"+Dn(p));s=p,y({type:Od.REPLACE})}function _(){var p,v=f;return p={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?jt(11):"Expected the observer to be an object. Instead, received: '"+Dn(b)+"'");function S(){b.next&&b.next(d())}S();var w=v(S);return{unsubscribe:w}}},p[Cd]=function(){return this},p}return y({type:Od.INIT}),n={dispatch:y,subscribe:f,getState:d,replaceReducer:g},n[Cd]=_,n}var Cw=function(t,r){return t===r};function Ew(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Ow(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Cw;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 Id(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 Td(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Id(Object(r),!0).forEach(function(n){Dw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Id(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Nd={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Iw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nd,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ba:case Ii:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Ti:return Ew(e.clientOffset,r.clientOffset)?e:Td(Td({},e),{},{clientOffset:r.clientOffset});case xi:case Ni:return Nd;default:return e}}var Sa="dnd-core/ADD_SOURCE",Ca="dnd-core/ADD_TARGET",Ea="dnd-core/REMOVE_SOURCE",Ai="dnd-core/REMOVE_TARGET";function Tw(e){return{type:Sa,payload:{sourceId:e}}}function Nw(e){return{type:Ca,payload:{targetId:e}}}function xw(e){return{type:Ea,payload:{sourceId:e}}}function kw(e){return{type:Ai,payload:{targetId:e}}}function xd(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 Bt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xd(Object(r),!0).forEach(function(n){Aw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Aw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Pw={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Mw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Pw,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ii:return Bt(Bt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case _a:return Bt(Bt({},e),{},{isSourcePublic:!0});case Ti:return Bt(Bt({},e),{},{targetIds:r.targetIds});case Ai:return e.targetIds.indexOf(r.targetId)===-1?e:Bt(Bt({},e),{},{targetIds:H_(e.targetIds,r.targetId)});case Ni:return Bt(Bt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case xi:return Bt(Bt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Lw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Sa:case Ca:return e+1;case Ea:case Ai:return e-1;default:return e}}var Pi=[],Oa=[];Pi.__IS_NONE__=!0,Oa.__IS_ALL__=!0;function Fw(e,t){if(e===Pi)return!1;if(e===Oa||typeof t>"u")return!0;var r=K_(t,e);return r.length>0}function $w(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Ti:break;case Sa:case Ca:case Ai:case Ea:return Pi;case Ii:case _a:case xi:case Ni:default:return Oa}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=W_(n,i),a=o.length>0||!Ow(n,i);if(!a)return Pi;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function jw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}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 Ad(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 Vw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:$w(e.dirtyHandlerIds,{type:t.type,payload:Ad(Ad({},t.payload),{},{prevTargetIds:q_(e,"dragOperation.targetIds",[])})}),dragOffset:Iw(e.dragOffset,t),refCount:Lw(e.refCount,t),dragOperation:Mw(e.dragOperation,t),stateId:jw(e.stateId)}}function Uw(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Pd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zw(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Pd(Uw(t,n),r)}function qw(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Pd(t,r)}function Hw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ww(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&&Ww(e.prototype,t),e}function Md(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Gw=function(){function e(t,r){Hw(this,e),Md(this,"store",void 0),Md(this,"registry",void 0),this.store=t,this.registry=r}return Kw(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;le(typeof r=="function","listener must be a function."),le(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var u=n.store.getState(),d=u.stateId;try{var f=d===o||d===o+1&&!Fw(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;le(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 le(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(le(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return wa(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(le(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!wa(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return zw(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return qw(this.store.getState().dragOffset)}}]),e}(),Qw=0;function Yw(){return Qw++}function Mi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mi=function(r){return typeof r}:Mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Mi(e)}function Rw(e){le(typeof e.canDrag=="function","Expected canDrag to be a function."),le(typeof e.beginDrag=="function","Expected beginDrag to be a function."),le(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Xw(e){le(typeof e.canDrop=="function","Expected canDrop to be a function."),le(typeof e.hover=="function","Expected hover to be a function."),le(typeof e.drop=="function","Expected beginDrag to be a function.")}function Da(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Da(r,!1)});return}le(typeof e=="string"||Mi(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Ld=typeof global<"u"?global:self,Fd=Ld.MutationObserver||Ld.WebKitMutationObserver;function $d(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function Zw(e){let t=1;const r=new Fd(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const Jw=typeof Fd=="function"?Zw:$d;class eS{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=Jw(this.flush),this.requestErrorThrow=$d(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class tS{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 rS{create(t){const r=this.freeTasks,n=r.length?r.pop():new tS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const jd=new eS,nS=new rS(jd.registerPendingError);function sS(e){jd.enqueueTask(nS.create(e))}function iS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oS(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 aS(e,t,r){return t&&oS(e.prototype,t),e}function In(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lS(e,t){return fS(e)||dS(e,t)||uS(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 uS(e,t){if(e){if(typeof e=="string")return Bd(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 Bd(e,t)}}function Bd(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 dS(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 hS(e){var t=Yw().toString();switch(e){case $t.SOURCE:return"S".concat(t);case $t.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Vd(e){switch(e[0]){case"S":return $t.SOURCE;case"T":return $t.TARGET;default:le(!1,"Cannot parse handler ID: ".concat(e))}}function Ud(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=lS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var pS=function(){function e(t){iS(this,e),In(this,"types",new Map),In(this,"dragSources",new Map),In(this,"dropTargets",new Map),In(this,"pinnedSourceId",null),In(this,"pinnedSource",null),In(this,"store",void 0),this.store=t}return aS(e,[{key:"addSource",value:function(r,n){Da(r),Rw(n);var s=this.addHandler($t.SOURCE,r,n);return this.store.dispatch(Tw(s)),s}},{key:"addTarget",value:function(r,n){Da(r,!0),Xw(n);var s=this.addHandler($t.TARGET,r,n);return this.store.dispatch(Nw(s)),s}},{key:"containsHandler",value:function(r){return Ud(this.dragSources,r)||Ud(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;le(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 le(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return le(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return le(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Vd(r);return n===$t.SOURCE}},{key:"isTargetId",value:function(r){var n=Vd(r);return n===$t.TARGET}},{key:"removeSource",value:function(r){var n=this;le(this.getSource(r),"Expected an existing source."),this.store.dispatch(xw(r)),sS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){le(this.getTarget(r),"Expected an existing target."),this.store.dispatch(kw(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);le(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){le(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=hS(r);return this.types.set(i,n),r===$t.SOURCE?this.dragSources.set(i,s):r===$t.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function gS(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=yS(n),i=new Gw(s,new pS(s)),o=new vw(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function yS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Dd(Vw,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var vS=["children"];function mS(e,t){return SS(e)||wS(e,t)||_S(e,t)||bS()}function bS(){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 _S(e,t){if(e){if(typeof e=="string")return zd(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 zd(e,t)}}function zd(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 wS(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 SS(e){if(Array.isArray(e))return e}function CS(e,t){if(e==null)return{};var r=ES(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 ES(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 qd=0,Li=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),OS=h.memo(function(t){var r=t.children,n=CS(t,vS),s=DS(n),i=mS(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=Hd();return++qd,function(){--qd===0&&(c[Li]=null)}}},[]),l.jsx(md.Provider,Object.assign({value:o},{children:r}),void 0)});function DS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=IS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function IS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hd(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[Li]||(s[Li]={dragDropManager:gS(e,t,r,n)}),s[Li]}function Hd(){return typeof global<"u"?global:window}function TS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function xS(e,t,r){return t&&NS(e.prototype,t),e}function Wd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ia=!1,Ta=!1,kS=function(){function e(t){TS(this,e),Wd(this,"internalMonitor",void 0),Wd(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return xS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){le(!Ia,"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 Ia=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ia=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;le(!Ta,"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 Ta=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ta=!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 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 Kd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Na=!1,LS=function(){function e(t){AS(this,e),Kd(this,"internalMonitor",void 0),Kd(this,"targetId",null),this.internalMonitor=t.getMonitor()}return MS(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;le(!Na,"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 Na=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Na=!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 FS(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 $S(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;FS(s);var i=r?function(o){return e(o,r)}:e;return jS(s,i)}}function Gd(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=$S(n);t[r]=function(){return s}}}),t}function Qd(e,t){typeof e=="function"?e(t):e.current=t}function jS(e,t){var r=e.ref;return le(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){Qd(r,s),Qd(t,s)}}):h.cloneElement(e,{ref:t})}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 xa(e){return e!==null&&Fi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function ka(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 u=i[c];if(!a(u))return!1;var d=e[u],f=t[u];if(s=void 0,s===!1||s===void 0&&d!==f)return!1}return!0}function BS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VS(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 US(e,t,r){return t&&VS(e.prototype,t),e}function ut(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var zS=function(){function e(t){var r=this;BS(this,e),ut(this,"hooks",Gd({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,xa(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,xa(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),ut(this,"handlerId",null),ut(this,"dragSourceRef",null),ut(this,"dragSourceNode",void 0),ut(this,"dragSourceOptionsInternal",null),ut(this,"dragSourceUnsubscribe",void 0),ut(this,"dragPreviewRef",null),ut(this,"dragPreviewNode",void 0),ut(this,"dragPreviewOptionsInternal",null),ut(this,"dragPreviewUnsubscribe",void 0),ut(this,"lastConnectedHandlerId",null),ut(this,"lastConnectedDragSource",null),ut(this,"lastConnectedDragSourceOptions",null),ut(this,"lastConnectedDragPreview",null),ut(this,"lastConnectedDragPreviewOptions",null),ut(this,"backend",void 0),this.backend=t}return US(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!ka(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!ka(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 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 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 KS=function(){function e(t){var r=this;qS(this,e),er(this,"hooks",Gd({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,xa(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 WS(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!ka(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 GS(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function QS(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 $i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$i=function(r){return typeof r}:$i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$i(e)}function YS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function XS(e,t,r){return t&&RS(e.prototype,t),e}function Aa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ZS=function(){function e(t,r,n){YS(this,e),Aa(this,"spec",void 0),Aa(this,"monitor",void 0),Aa(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return XS(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return $i(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 JS(e,t,r){var n=h.useMemo(function(){return new ZS(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Hr(){var e=h.useContext(md),t=e.dragDropManager;return le(t!=null,"Expected drag drop context"),t}function eC(e){return h.useMemo(function(){var t=e.type;return le(t!=null,"spec.type must be defined"),t},[e])}function tC(e,t){return iC(e)||sC(e,t)||nC(e,t)||rC()}function rC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
456
+ `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Ur(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Si.assertOptions(n,{silentJSONParsing:ct.transitional(ct.boolean),forcedJSONParsing:ct.transitional(ct.boolean),clarifyTimeoutError:ct.transitional(ct.boolean),legacyInterceptorReqResOrdering:ct.transitional(ct.boolean),advertiseZstdAcceptEncoding:ct.transitional(ct.boolean),validateStatusUndefinedResolves:ct.transitional(ct.boolean)},!1),s!=null&&(D.isFunction(s)?r.paramsSerializer={serialize:s}:Si.assertOptions(s,{encode:ct.function,serialize:ct.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Si.assertOptions(r,{baseUrl:ct.spelling("baseURL"),withXsrfToken:ct.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"],_=>{delete i[_]}),r.headers=lt.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||na;v&&v.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let d,f=0,y;if(!c){const _=[Fu.bind(this),void 0];for(_.unshift(...a),_.push(...u),y=_.length,d=Promise.resolve(r);f<y;)d=d.then(_[f++],_[f++]);return d}y=a.length;let g=r;for(;f<y;){const _=a[f++],p=a[f++];try{g=_(g)}catch(v){p.call(this,v);break}}try{d=Fu.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,y=u.length;f<y;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Ur(this.defaults,t);const r=Du(t.baseURL,t.url,t.allowAbsoluteUrls,t);return yu(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){zr.prototype[t]=function(r,n){return this.request(Ur(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(Ur(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}zr.prototype[t]=r(),t!=="query"&&(zr.prototype[t+"Form"]=r(!0))});let Nb=class Xh{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 gs(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 Xh(function(s){t=s}),cancel:t}}};function xb(e){return function(r){return e.apply(null,r)}}function kb(e){return D.isObject(e)&&e.isAxiosError===!0}const ua={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(ua).forEach(([e,t])=>{ua[t]=e});function ju(e){const t=new zr(e),r=Jc(zr.prototype.request,t);return D.extend(r,zr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return ju(Ur(e,s))},r}const We=ju(ps);We.Axios=zr,We.CanceledError=gs,We.CancelToken=Nb,We.isCancel=wu,We.VERSION=aa,We.toFormData=vi,We.AxiosError=R,We.Cancel=We.CanceledError,We.all=function(t){return Promise.all(t)},We.spread=xb,We.isAxiosError=kb,We.mergeConfig=Ur,We.AxiosHeaders=lt,We.formToJSON=e=>_u(D.isHTMLForm(e)?new FormData(e):e),We.getAdapter=Lu.getAdapter,We.HttpStatusCode=ua,We.default=We;const{Axios:JE,AxiosError:eD,CanceledError:tD,isCancel:rD,CancelToken:nD,VERSION:sD,all:iD,Cancel:oD,isAxiosError:aD,spread:lD,toFormData:cD,AxiosHeaders:uD,HttpStatusCode:dD,formToJSON:fD,getAdapter:hD,mergeConfig:pD,create:gD}=We;let da="";function Bu(e){da=e}const $e=We.create({timeout:3e4});$e.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Yc),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.channel&&(e.headers["X-Channel-Id"]=n.channel),da&&(e.baseURL=da),e});const Vu=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Ab(e,t={}){var c,u,d,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:Vu,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(d=(u=(await $e.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:u.result)==null?void 0:d.response)==null?void 0:f.content)??[]}async function Pb(e){var r,n,s;return e.length?((s=(n=(r=(await $e.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Vu,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 Uu(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(u=>Uu(u,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 zu(e){var s,i,o,a,c,u,d;const t=await $e.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)||((u=(c=t.data)==null?void 0:c.params)==null?void 0:u.err)||((d=t.data)==null?void 0:d.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=Uu(r);return{content:r,rootNode:n}}async function Mb(e,t,r,n){await $e.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})}async function Lb(e,t=""){await $e.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function Fb(e){var r,n;return(n=(r=(await $e.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function $b(e){await $e.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function jb(e,t){await $e.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function Bb(e,t){await $e.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const _e={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"},Vb=({contentId:e,onClose:t})=>{var P,$;const r=be(T=>T.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([]),[u,d]=h.useState(!1),[f,y]=h.useState([]),[g,_]=h.useState(!1),[p,v]=h.useState(""),[m,b]=h.useState(!1),S=h.useRef(null);h.useEffect(()=>{let T=!1;return(async()=>{try{const A=await Fb(e),F=(A==null?void 0:A.collaborators)??[];if(!F.length)return;const M=await Pb(F);if(T)return;const V=F.map(j=>M.find(re=>re.identifier===j)??{identifier:j,firstName:j});y(V)}catch{}})(),()=>{T=!0}},[e]),h.useEffect(()=>{S.current&&clearTimeout(S.current);const T=i.trim();if(T.length<2){c([]);return}return S.current=setTimeout(async()=>{d(!0);try{const A=await Ab(T,{rootOrgId:n,objectType:s}),F=new Set(f.map(M=>M.identifier));c(A.filter(M=>!F.has(M.identifier)))}catch{c([])}finally{d(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=h.useCallback(T=>{y(A=>A.find(F=>F.identifier===T.identifier)?A:[...A,T]),c(A=>A.filter(F=>F.identifier!==T.identifier)),b(!1)},[]),O=h.useCallback(T=>{y(A=>A.filter(F=>F.identifier!==T)),b(!1)},[]),I=h.useCallback(async()=>{_(!0),v(""),b(!1);try{await Bb(e,f.map(T=>T.identifier)),b(!0)}catch{v("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),k=T=>`${T.firstName}${T.lastName?` ${T.lastName}`:""}`;return l.jsxs("div",{className:_e.container,children:[l.jsxs("div",{className:_e.header,children:[l.jsx("h2",{className:_e.title,children:"Manage Collaborators"}),l.jsx("button",{className:_e.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:_e.body,children:[l.jsxs("div",{className:_e.searchSection,children:[l.jsx("label",{className:_e.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:_e.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:_e.searchInput,placeholder:"Search by name or email...",value:i,onChange:T=>o(T.target.value)}),u&&l.jsx("span",{className:_e.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:_e.resultsList,role:"listbox","aria-label":"Search results",children:a.map(T=>{var A,F,M,V;return l.jsxs("li",{className:_e.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:_e.userInfo,children:[l.jsx("span",{className:_e.userName,children:k(T)}),T.email&&l.jsx("span",{className:_e.userEmail,children:T.email}),(((F=(A=T.organisations)==null?void 0:A[0])==null?void 0:F.orgName)??T.rootOrgName)&&l.jsx("span",{className:_e.userOrg,children:((V=(M=T.organisations)==null?void 0:M[0])==null?void 0:V.orgName)??T.rootOrgName})]}),l.jsx(De,{variant:"primary",size:"sm",onClick:()=>w(T),children:"Add"})]},T.identifier)})}),i.trim().length>=2&&!u&&a.length===0&&l.jsx("p",{className:_e.noResults,children:"No users found."})]}),l.jsxs("div",{className:_e.collabSection,children:[l.jsxs("h3",{className:_e.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:_e.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:_e.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:_e.collabList,children:f.map(T=>{var A,F,M,V;return l.jsxs("li",{className:_e.collabItem,children:[l.jsx("div",{className:_e.userAvatar,"aria-hidden":"true",children:k(T).charAt(0).toUpperCase()}),l.jsxs("div",{className:_e.userInfo,children:[l.jsx("span",{className:_e.userName,children:k(T)}),T.email&&l.jsx("span",{className:_e.userEmail,children:T.email}),(((F=(A=T.organisations)==null?void 0:A[0])==null?void 0:F.orgName)??T.rootOrgName)&&l.jsx("span",{className:_e.userOrg,children:((V=(M=T.organisations)==null?void 0:M[0])==null?void 0:V.orgName)??T.rootOrgName})]}),l.jsx(De,{variant:"danger",size:"sm",onClick:()=>O(T.identifier),children:"Remove"})]},T.identifier)})})]}),p&&l.jsx("p",{className:_e.error,role:"alert",children:p}),m&&l.jsx("p",{className:_e.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:_e.footer,children:[l.jsx(De,{variant:"ghost",onClick:t,disabled:g,children:"Cancel"}),l.jsx(De,{variant:"primary",isLoading:g,onClick:I,children:"Save"})]})]})};async function Ub(e){return(await $e.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function zb(e,t){var s;const n=((s=(await $e.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 r;return((r=(await $e.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}const ie={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 Hb(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Wb(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const qu=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=h.useState(""),u=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${u}-title`,children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:`${u}-title`,className:ie.sbModalTitle,children:e}),l.jsx("button",{className:ie.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ie.sbModalBody,children:[l.jsxs("label",{className:ie.sbLabel,htmlFor:`${u}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${u}-comment`,className:ie.sbTextarea,placeholder:r,value:a,onChange:d=>c(d.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ie.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ie.sbModalFooter,children:[l.jsx(De,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(De,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Kb=({onConfirm:e,onCancel:t})=>{const[r,n]=h.useState(!1);return l.jsx("div",{className:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ie.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ie.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ie.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:ie.sbModalFooter,children:[l.jsx(De,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(De,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Gb=({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:ie.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ie.sbModal,children:[l.jsxs("div",{className:ie.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ie.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ie.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ie.sbModalBody,children:[l.jsxs("label",{className:ie.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:ie.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:ie.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ie.sbModalFooter,children:[l.jsx(De,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(De,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Qb=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,onToolbarEvent:s})=>{var J,Ce;const o=Pe(se=>se.treeData)[0],a=(o==null?void 0:o.name)??"Untitled",c=Wb(((J=o==null?void 0:o.metadata)==null?void 0:J.status)??(o==null?void 0:o.status)),u=be(se=>{var me,oe,yt,Ee;return((oe=(me=se.editorConfig)==null?void 0:me.context)==null?void 0:oe.contentId)??((Ee=(yt=se.editorConfig)==null?void 0:yt.context)==null?void 0:Ee.identifier)??""}),{activeModal:d,modalData:f,closeModal:y,openModal:g}=Lv(),_=be(se=>se.buttonLoaders),[p,v]=h.useState(!1),[m,b]=h.useState(!1),[S,w]=h.useState(!1),[O,I]=h.useState(!1),k=h.useRef(null),[P,$]=h.useState(!1);h.useEffect(()=>{if(!O)return;const se=me=>{var oe;(oe=k.current)!=null&&oe.contains(me.target)||I(!1)};return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[O]);const[T,A]=h.useState(!1),[F,M]=h.useState(!1),{updateNode:V}=Pe(),j=(Ce=o==null?void 0:o.metadata)==null?void 0:Ce.qrCodeProcessId,re=h.useCallback(async se=>{if(u){$(!1),A(!0);try{const{processId:me,reservedDialcodes:oe}=await zb(u,se);me&&o&&V(o.id,{qrCodeProcessId:me,reservedDialcodes:oe}),Le.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Le.error("Failed to generate QR Codes. Please try again.")}finally{A(!1)}}},[u,o,V]),ue=h.useCallback(async()=>{if(!j){Le.error("No QR codes generated yet. Generate QR Codes first.");return}M(!0);try{const se=await qb(j);if(se.status==="in-process"){Le("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const me=se.url;if(!me){Le.error("QR Codes not ready yet. Please wait and try again.");return}const oe=await fetch(me).then(Ve=>Ve.blob()),yt=await new Promise(Ve=>{const ot=new FileReader;ot.onloadend=()=>Ve(ot.result),ot.readAsDataURL(oe)}),Ee=(o==null?void 0:o.metadata)??{},it=Ve=>Array.isArray(Ve)?Ve.join("_"):typeof Ve=="string"?Ve:"",Je=[u,it(Ee.medium),it(Ee.gradeLevel),it(Ee.subject)].filter(Boolean),He=new Date().toISOString().replace(/[:.]/g,"-"),te=`${Je.join("_")}_${He}.zip`,Me=document.createElement("a");Me.href=yt,Me.download=te,Me.style.display="none",document.body.appendChild(Me),Me.click(),document.body.removeChild(Me),Le.success("QR codes downloaded.")}catch{Le.error("Failed to download QR Codes.")}finally{M(!1)}},[j,o,u]),K=e==="edit",z=e==="review",X=e==="sourcingreview",B=e==="read",G=h.useCallback((se,me)=>{s({action:se,data:me})},[s]),Z=h.useCallback(()=>{y(),G("publish")},[y,G]),ve=h.useCallback((se,me)=>{const oe=f==null?void 0:f.action;y(),oe==="approve"?G("sourcingApprove",{comment:se,score:me}):G("reject",{comment:se})},[y,G,f]),Te=h.useCallback(se=>{v(!1),G("sendBackForCorrections",{comment:se})},[G]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ie.topbar,role:"banner",children:[l.jsxs("div",{className:ie.left,children:[l.jsx("button",{className:ie.backBtn,onClick:()=>G("back"),"aria-label":"Go back",type:"button",children:l.jsx(tv,{size:18})}),l.jsx("h1",{className:ie.title,title:a,children:a}),l.jsx("span",{className:`sbx-chip ${ie.statusChip}`,"aria-label":`Status: ${c}`,children:c})]}),l.jsxs("div",{className:ie.right,children:[t?l.jsx("span",{className:ie.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${ie.savedIndicator} ${ie.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ie.savedIndicator,"aria-live":"polite",children:[l.jsx(fn,{size:14,"aria-hidden":"true"}),"Saved ",Hb(n)]}):null,!B&&!z&&!X&&c!=="Review"&&l.jsx(De,{variant:"ghost",size:"sm",onClick:()=>G("saveCollection"),children:"Save as Draft"}),K&&l.jsxs(l.Fragment,{children:[l.jsxs(De,{variant:"primary",size:"sm",onClick:()=>w(!0),disabled:_.saveCollection,isLoading:_.saveCollection,children:[l.jsx(vv,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ie.iconBtn,onClick:()=>g("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(_v,{size:16,"aria-hidden":"true"})}),l.jsxs("div",{className:ie.qrDropdown,ref:k,children:[l.jsxs("button",{className:ie.iconBtn,onClick:()=>I(se=>!se),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":O,children:[l.jsx($c,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ie.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),O&&l.jsxs("div",{className:ie.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{I(!1),$(!0)},disabled:T,children:[l.jsx($c,{size:14}),T?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{I(!1),ue()},disabled:F||!j,children:[l.jsx(ov,{size:14}),F?"Downloading…":"Download QR Codes"]})]})]})]}),z&&l.jsxs("div",{className:ie.reviewBtns,children:[l.jsxs(De,{variant:"primary",size:"sm",onClick:()=>g("publishChecklist"),disabled:_.publishCollection,isLoading:_.publishCollection,children:[l.jsx(Ac,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(De,{variant:"danger",size:"sm",onClick:()=>b(!0),disabled:_.rejectCollection,isLoading:_.rejectCollection,children:[l.jsx(Lo,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(De,{variant:"ghost",size:"sm",onClick:()=>v(!0),children:[l.jsx(gv,{size:14,"aria-hidden":"true"})," Send Back"]})]}),X&&l.jsxs("div",{className:ie.sourcingBtns,children:[l.jsxs(De,{variant:"primary",size:"sm",onClick:()=>g("qualityParams",{action:"approve"}),children:[l.jsx(mv,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(De,{variant:"danger",size:"sm",onClick:()=>g("qualityParams",{action:"reject"}),children:[l.jsx(Lo,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),d==="publishChecklist"&&l.jsx(jv,{contentId:u,onConfirm:Z,onCancel:y}),d==="qualityParams"&&l.jsx(Bv,{contentId:u,action:(f==null?void 0:f.action)??"reject",onConfirm:ve,onCancel:y}),d==="manageCollaborators"&&l.jsx("div",{className:ie.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(Vb,{contentId:u,onClose:y})}),S&&l.jsx(Kb,{onConfirm:()=>{w(!1),G("sendForReview")},onCancel:()=>w(!1)}),m&&l.jsx(qu,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",submitVariant:"danger",onConfirm:se=>{b(!1),G("reject",{comment:se})},onCancel:()=>b(!1)}),p&&l.jsx(qu,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",onConfirm:Te,onCancel:()=>v(!1)}),P&&l.jsx(Gb,{onConfirm:re,onCancel:()=>$(!1)})]})},Yb=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Fe.createPortal(l.jsx("div",{className:Ie.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Ie.modal,children:[l.jsxs("div",{className:Ie.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Ie.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Ie.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:Ie.modalFooter,children:[l.jsx(De,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(De,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(De,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var Rb=Go();const Hu=h.createContext(null);function Ct(){const e=h.useContext(Hu);if(e===null)throw new Error("No Tree Api Provided");return e}const Wu=h.createContext(null);function Xb(){const e=h.useContext(Wu);if(e===null)throw new Error("Provide a NodesContext");return e}const Ku=h.createContext(null);function Zb(){const e=h.useContext(Ku);if(e===null)throw new Error("Provide a DnDContext");return e}const Gu=h.createContext(0);function Qu(){h.useContext(Gu)}function Ci(e,t,r){return Math.max(Math.min(e,r),t)}function Yu(e){return e&&e.isLeaf}function Ru(e){return e&&e.isInternal&&!e.isOpen}function Xu(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Zu=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Ju=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function fa(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=fa(r,t);if(n)return n}return null}function Oi(e,t){if(t(e),e.children)for(let r of e.children)Oi(r,t)}function ed(e){const t=rd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=Jb(t,n);break}r==null||r.focus()}function td(e){const t=rd(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=e_(t,n);break}r==null||r.focus()}function Jb(e,t){return t+1<e.length?e[t+1]:e[0]}function e_(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function rd(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 ys(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function _n(e){return typeof e=="string"?e:e.id}function t_(e,...t){if(e)return e(...t)}function nd(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function sd(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 id(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const r_=Object.freeze(Object.defineProperty({__proto__:null,access:ys,bound:Ci,dfs:fa,focusNextElement:ed,focusPrevElement:td,getInsertIndex:sd,getInsertParentId:id,identify:_n,indexOf:Ju,isClosed:Ru,isDescendant:Zu,isItem:Yu,isOpenWithEmptyChildren:Xu,safeRun:t_,waitFor:nd,walk:Oi},Symbol.toStringTag,{value:"Module"})),n_={display:"flex",alignItems:"center",zIndex:1},s_={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},i_={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},o_=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({},n_),s),children:[l.jsx("div",{style:Object.assign({},i_)}),l.jsx("div",{style:Object.assign({},s_)})]})});function a_({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 l_(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(u_,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 u_({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 vs="__REACT_ARBORIST_INTERNAL_ROOT__";function od(e){var t;function r(i,o,a){const c=e.accessId(i),u=new ms({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),d=e.accessChildren(i);return d&&(u.children=d.map(f=>r(f,o+1,u))),u}const n=new ms({tree:e,id:vs,data:{id:vs},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 ms{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===vs}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 ms(Object.assign({},this))}edit(){return this.tree.edit(this)}}function ha(e){return{type:"EDIT",id:e}}function d_(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function wn(e){return{type:"FOCUS",id:e}}function f_(){return{type:"TREE_BLUR"}}function h_(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 pa={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 ad(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 p_(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:ad(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:ad(e.unfiltered,t)}):e}const Sn=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}}},Cr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:_n(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(_n)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(_n)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:_n(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:_n(e)})};function g_(e=Sn().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 Cn={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 y_(e=Sn().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 Sn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const v_={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},m_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},b_=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function ld({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(__,{isDragging:s,children:[l.jsx(w_,{offset:e,children:l.jsx(C_,{id:r,dragIds:n})}),l.jsx(S_,{mouse:t,count:n.length})]})}const __=h.memo(function(t){return t.isDragging?l.jsx("div",{style:v_,children:t.children}):null});function w_(e){return l.jsx("div",{className:"row preview",style:m_(e.offset),children:e.children})}function S_(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:b_(r),children:t}):null}const C_=h.memo(function(t){const r=Ct(),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 ga(){return ga=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},ga.apply(null,arguments)}function cd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ya(e,t){return ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ya(e,t)}function O_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ya(e,t)}var ud=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function E_(e,t){return!!(e===t||ud(e)&&ud(t))}function D_(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!E_(e[r],t[r]))return!1;return!0}function va(e,t){t===void 0&&(t=D_);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 I_=typeof performance=="object"&&typeof performance.now=="function",dd=I_?function(){return performance.now()}:function(){return Date.now()};function fd(e){cancelAnimationFrame(e.id)}function T_(e,t){var r=dd();function n(){dd()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var ma=-1;function hd(e){if(e===void 0&&(e=!1),ma===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),ma=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return ma}var On=null;function pd(e){if(e===void 0&&(e=!1),On===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?On="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?On="negative":On="positive-ascending"),document.body.removeChild(t),On}return On}process.env.NODE_ENV;var N_=150,x_=function(t,r){return t},Ei=null,Di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Ei=new WeakSet,Di=new WeakSet);function gd(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,d=e.validateProps;return t=function(f){O_(y,f);function y(_){var p;return p=f.call(this,_)||this,p._instanceProps=c(p.props,cd(p)),p._outerRef=void 0,p._resetIsScrollingTimeoutId=null,p.state={instance:cd(p),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof p.props.initialScrollOffset=="number"?p.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},p._callOnItemsRendered=void 0,p._callOnItemsRendered=va(function(v,m,b,S){return p.props.onItemsRendered({overscanStartIndex:v,overscanStopIndex:m,visibleStartIndex:b,visibleStopIndex:S})}),p._callOnScroll=void 0,p._callOnScroll=va(function(v,m,b){return p.props.onScroll({scrollDirection:v,scrollOffset:m,scrollUpdateWasRequested:b})}),p._getItemStyle=void 0,p._getItemStyle=function(v){var m=p.props,b=m.direction,S=m.itemSize,w=m.layout,O=p._getItemStyleCache(u&&S,u&&w,u&&b),I;if(O.hasOwnProperty(v))I=O[v];else{var k=r(p.props,v,p._instanceProps),P=s(p.props,v,p._instanceProps),$=b==="horizontal"||w==="horizontal",T=b==="rtl",A=$?k:0;O[v]=I={position:"absolute",left:T?void 0:A,right:T?A:void 0,top:$?0:k,height:$?"100%":P,width:$?P:"100%"}}return I},p._getItemStyleCache=void 0,p._getItemStyleCache=va(function(v,m,b){return{}}),p._onScrollHorizontal=function(v){var m=v.currentTarget,b=m.clientWidth,S=m.scrollLeft,w=m.scrollWidth;p.setState(function(O){if(O.scrollOffset===S)return null;var I=p.props.direction,k=S;if(I==="rtl")switch(pd()){case"negative":k=-S;break;case"positive-descending":k=w-b-S;break}return k=Math.max(0,Math.min(k,w-b)),{isScrolling:!0,scrollDirection:O.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},p._resetIsScrollingDebounced)},p._onScrollVertical=function(v){var m=v.currentTarget,b=m.clientHeight,S=m.scrollHeight,w=m.scrollTop;p.setState(function(O){if(O.scrollOffset===w)return null;var I=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:O.scrollOffset<I?"forward":"backward",scrollOffset:I,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&&fd(p._resetIsScrollingTimeoutId),p._resetIsScrollingTimeoutId=T_(p._resetIsScrolling,N_)},p._resetIsScrolling=function(){p._resetIsScrollingTimeoutId=null,p.setState({isScrolling:!1},function(){p._getItemStyleCache(-1,null)})},p}y.getDerivedStateFromProps=function(p,v){return k_(p,v),d(p),null};var g=y.prototype;return g.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)},g.scrollToItem=function(p,v){v===void 0&&(v="auto");var m=this.props,b=m.itemCount,S=m.layout,w=this.state.scrollOffset;p=Math.max(0,Math.min(p,b-1));var O=0;if(this._outerRef){var I=this._outerRef;S==="vertical"?O=I.scrollWidth>I.clientWidth?hd():0:O=I.scrollHeight>I.clientHeight?hd():0}this.scrollTo(i(this.props,p,v,w,this._instanceProps,O))},g.componentDidMount=function(){var p=this.props,v=p.direction,m=p.initialScrollOffset,b=p.layout;if(typeof m=="number"&&this._outerRef!=null){var S=this._outerRef;v==="horizontal"||b==="horizontal"?S.scrollLeft=m:S.scrollTop=m}this._callPropsCallbacks()},g.componentDidUpdate=function(){var p=this.props,v=p.direction,m=p.layout,b=this.state,S=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var O=this._outerRef;if(v==="horizontal"||m==="horizontal")if(v==="rtl")switch(pd()){case"negative":O.scrollLeft=-S;break;case"positive-ascending":O.scrollLeft=S;break;default:var I=O.clientWidth,k=O.scrollWidth;O.scrollLeft=k-I-S;break}else O.scrollLeft=S;else O.scrollTop=S}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&fd(this._resetIsScrollingTimeoutId)},g.render=function(){var p=this.props,v=p.children,m=p.className,b=p.direction,S=p.height,w=p.innerRef,O=p.innerElementType,I=p.innerTagName,k=p.itemCount,P=p.itemData,$=p.itemKey,T=$===void 0?x_:$,A=p.layout,F=p.outerElementType,M=p.outerTagName,V=p.style,j=p.useIsScrolling,re=p.width,ue=this.state.isScrolling,K=b==="horizontal"||A==="horizontal",z=K?this._onScrollHorizontal:this._onScrollVertical,X=this._getRangeToRender(),B=X[0],G=X[1],Z=[];if(k>0)for(var ve=B;ve<=G;ve++)Z.push(h.createElement(v,{data:P,key:T(ve,P),index:ve,isScrolling:j?ue:void 0,style:this._getItemStyle(ve)}));var Te=n(this.props,this._instanceProps);return h.createElement(F||M||"div",{className:m,onScroll:z,ref:this._outerRefSetter,style:ga({position:"relative",height:S,width:re,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},V)},h.createElement(O||I||"div",{children:Z,ref:w,style:{height:K?"100%":Te,pointerEvents:ue?"none":void 0,width:K?Te:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var p=this.props.itemCount;if(p>0){var v=this._getRangeToRender(),m=v[0],b=v[1],S=v[2],w=v[3];this._callOnItemsRendered(m,b,S,w)}}if(typeof this.props.onScroll=="function"){var O=this.state,I=O.scrollDirection,k=O.scrollOffset,P=O.scrollUpdateWasRequested;this._callOnScroll(I,k,P)}},g._getRangeToRender=function(){var p=this.props,v=p.itemCount,m=p.overscanCount,b=this.state,S=b.isScrolling,w=b.scrollDirection,O=b.scrollOffset;if(v===0)return[0,0,0,0];var I=o(this.props,O,this._instanceProps),k=a(this.props,I,O,this._instanceProps),P=!S||w==="backward"?Math.max(1,m):1,$=!S||w==="forward"?Math.max(1,m):1;return[Math.max(0,I-P),Math.max(0,Math.min(v-1,k+$)),I,k]},y}(h.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var k_=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,d=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Di&&!Di.has(d)&&(Di.add(d),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":Ei&&!Ei.has(d)&&(Ei.add(d),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 u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" 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.'))}},A_=50,En=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 u=o[a];c=u.offset+u.size}for(var d=a+1;d<=r;d++){var f=i(d);o[d]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},P_=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?yd(t,r,i,0,n):M_(t,r,Math.max(0,i),n)},yd=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=En(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},M_=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&En(t,n,r).offset<s;)n+=o,o*=2;return yd(t,r,Math.min(n,i-1),Math.floor(n/2),s)},vd=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 u=n-o-1,d=u*i;return a+d},L_=gd({getItemOffset:function(t,r,n){return En(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:vd,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,u=t.layout,d=t.width,f=a==="horizontal"||u==="horizontal",y=f?d:c,g=En(t,r,i),_=vd(t,i),p=Math.max(0,Math.min(_-y,g.offset)),v=Math.max(0,g.offset-y+g.size+o);switch(n==="smart"&&(s>=v-y&&s<=p+y?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 P_(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,u=t.width,d=i==="horizontal"||c==="horizontal",f=d?u:o,y=En(t,r,s),g=n+f,_=y.offset+y.size,p=r;p<a-1&&_<g;)p++,_+=En(t,p,s).size;return p},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||A_,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.'))}}),F_=gd({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,u=t.itemCount,d=t.itemSize,f=t.layout,y=t.width,g=a==="horizontal"||f==="horizontal",_=g?y:c,p=Math.max(0,u*d-_),v=Math.min(p,r*d),m=Math.max(0,r*d-_+d+o);switch(n==="smart"&&(s>=m-_&&s<=v+_?n="auto":n="center"),n){case"start":return v;case"end":return m;case"center":{var b=Math.round(m+(v-m)/2);return b<Math.ceil(_/2)?0:b>p+Math.floor(_/2)?p:b}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,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,y=d?u:i,g=Math.ceil((y+n-f)/a);return Math.max(0,Math.min(o-1,r+g-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 $_(){var e,t;const r=Ct(),s=Zb().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 j_=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 B_=h.forwardRef(function(t,r){const{children:n}=t,s=j_(t,["children"]),i=Ct();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(V_,{}),n]}))}),V_=()=>{const e=Ct();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx($_,{})})};var U_=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 z_=h.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=U_(t,["style"]);const u=Ct(),d=(s=(n=u.props.padding)!==null&&n!==void 0?n:u.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=u.props.padding)!==null&&i!==void 0?i:u.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)+d+f}px`})},c))});var md=h.createContext({dragDropManager:void 0}),Ft;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Ft||(Ft={}));function le(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 ba="dnd-core/INIT_COORDS",Ii="dnd-core/BEGIN_DRAG",_a="dnd-core/PUBLISH_DRAG_SOURCE",Ti="dnd-core/HOVER",Ni="dnd-core/DROP",xi="dnd-core/END_DRAG";function bd(e,t){return{type:ba,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function ki(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ki=function(r){return typeof r}:ki=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ki(e)}function q_(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function H_(e,t){return e.filter(function(r){return r!==t})}function _d(e){return ki(e)==="object"}function W_(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 K_(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var G_={type:ba,payload:{clientOffset:null,sourceClientOffset:null}};function Q_(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(),u=e.getRegistry();e.dispatch(bd(o)),Y_(r,c,u);var d=Z_(r,c);if(d===null){e.dispatch(G_);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");R_(a),f=a(d)}e.dispatch(bd(o,f));var y=u.getSource(d),g=y.beginDrag(c,d);if(g!=null){X_(g),u.pinSource(d);var _=u.getSourceType(d);return{type:Ii,payload:{itemType:_,item:g,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function Y_(e,t,r){le(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){le(r.getSource(n),"Expected sourceIds to be registered.")})}function R_(e){le(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function X_(e){le(_d(e),"Item must be an object.")}function Z_(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 J_(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:_a}}}function wa(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function ew(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;tw(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();rw(i,o,a);var c=o.getItemType();return nw(i,a,c),sw(i,o,a),{type:Ti,payload:{targetIds:i,clientOffset:s||null}}}}function tw(e){le(Array.isArray(e),"Expected targetIds to be an array.")}function rw(e,t,r){le(t.isDragging(),"Cannot call hover while not dragging."),le(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];le(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);le(i,"Expected targetIds to be registered.")}}function nw(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);wa(i,r)||e.splice(n,1)}}function sw(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function wd(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 Sd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wd(Object(r),!0).forEach(function(n){iw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ow(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();aw(n);var i=uw(n);i.forEach(function(o,a){var c=lw(o,a,s,n),u={type:Ni,payload:{dropResult:Sd(Sd({},r),c)}};e.dispatch(u)})}}function aw(e){le(e.isDragging(),"Cannot call drop while not dragging."),le(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function lw(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){le(typeof e>"u"||_d(e),"Drop result must either be an object or undefined.")}function uw(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function dw(e){return function(){var r=e.getMonitor(),n=e.getRegistry();fw(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:xi}}}function fw(e){le(e.isDragging(),"Cannot call endDrag while not dragging.")}function hw(e){return{beginDrag:Q_(e),publishDragSource:J_(e),hover:ew(e),drop:ow(e),endDrag:dw(e)}}function pw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gw(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 yw(e,t,r){return t&&gw(e.prototype,t),e}function bs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vw=function(){function e(t,r){var n=this;pw(this,e),bs(this,"store",void 0),bs(this,"monitor",void 0),bs(this,"backend",void 0),bs(this,"isSetUp",!1),bs(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 yw(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),u=0;u<a;u++)c[u]=arguments[u];var d=o.apply(r,c);typeof d<"u"&&n(d)}}var i=hw(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 $t(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 Cd=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Od=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ed={INIT:"@@redux/INIT"+Od(),REPLACE:"@@redux/REPLACE"+Od()};function mw(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 bw(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(Sw(e))return"date";if(ww(e))return"error";var r=_w(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 _w(e){return typeof e.constructor=="function"?e.constructor.name:null}function ww(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Sw(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Dn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=bw(e)),t}function Dd(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"?$t(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"?$t(1):"Expected the enhancer to be a function. Instead, received: '"+Dn(r)+"'");return r(Dd)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?$t(2):"Expected the root reducer to be a function. Instead, received: '"+Dn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function u(){a===o&&(a=o.slice())}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?$t(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"?$t(4):"Expected the listener to be a function. Instead, received: '"+Dn(p)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?$t(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 u(),a.push(p),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?$t(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,u();var b=a.indexOf(p);a.splice(b,1),o=null}}}function y(p){if(!mw(p))throw new Error(process.env.NODE_ENV==="production"?$t(7):"Actions must be plain objects. Instead, the actual type was: '"+Dn(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"?$t(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"?$t(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 b=v[m];b()}return p}function g(p){if(typeof p!="function")throw new Error(process.env.NODE_ENV==="production"?$t(10):"Expected the nextReducer to be a function. Instead, received: '"+Dn(p));s=p,y({type:Ed.REPLACE})}function _(){var p,v=f;return p={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?$t(11):"Expected the observer to be an object. Instead, received: '"+Dn(b)+"'");function S(){b.next&&b.next(d())}S();var w=v(S);return{unsubscribe:w}}},p[Cd]=function(){return this},p}return y({type:Ed.INIT}),n={dispatch:y,subscribe:f,getState:d,replaceReducer:g},n[Cd]=_,n}var Cw=function(t,r){return t===r};function Ow(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function Ew(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Cw;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 Id(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 Td(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Id(Object(r),!0).forEach(function(n){Dw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Id(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Nd={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Iw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nd,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ba:case Ii:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Ti:return Ow(e.clientOffset,r.clientOffset)?e:Td(Td({},e),{},{clientOffset:r.clientOffset});case xi:case Ni:return Nd;default:return e}}var Sa="dnd-core/ADD_SOURCE",Ca="dnd-core/ADD_TARGET",Oa="dnd-core/REMOVE_SOURCE",Ai="dnd-core/REMOVE_TARGET";function Tw(e){return{type:Sa,payload:{sourceId:e}}}function Nw(e){return{type:Ca,payload:{targetId:e}}}function xw(e){return{type:Oa,payload:{sourceId:e}}}function kw(e){return{type:Ai,payload:{targetId:e}}}function xd(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 jt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xd(Object(r),!0).forEach(function(n){Aw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Aw(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Pw={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Mw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Pw,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Ii:return jt(jt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case _a:return jt(jt({},e),{},{isSourcePublic:!0});case Ti:return jt(jt({},e),{},{targetIds:r.targetIds});case Ai:return e.targetIds.indexOf(r.targetId)===-1?e:jt(jt({},e),{},{targetIds:H_(e.targetIds,r.targetId)});case Ni:return jt(jt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case xi:return jt(jt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Lw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Sa:case Ca:return e+1;case Oa:case Ai:return e-1;default:return e}}var Pi=[],Ea=[];Pi.__IS_NONE__=!0,Ea.__IS_ALL__=!0;function Fw(e,t){if(e===Pi)return!1;if(e===Ea||typeof t>"u")return!0;var r=K_(t,e);return r.length>0}function $w(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Ti:break;case Sa:case Ca:case Ai:case Oa:return Pi;case Ii:case _a:case xi:case Ni:default:return Ea}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=W_(n,i),a=o.length>0||!Ew(n,i);if(!a)return Pi;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function jw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}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 Ad(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 Vw(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:$w(e.dirtyHandlerIds,{type:t.type,payload:Ad(Ad({},t.payload),{},{prevTargetIds:q_(e,"dragOperation.targetIds",[])})}),dragOffset:Iw(e.dragOffset,t),refCount:Lw(e.refCount,t),dragOperation:Mw(e.dragOperation,t),stateId:jw(e.stateId)}}function Uw(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Pd(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zw(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Pd(Uw(t,n),r)}function qw(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Pd(t,r)}function Hw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ww(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&&Ww(e.prototype,t),e}function Md(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Gw=function(){function e(t,r){Hw(this,e),Md(this,"store",void 0),Md(this,"registry",void 0),this.store=t,this.registry=r}return Kw(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;le(typeof r=="function","listener must be a function."),le(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var u=n.store.getState(),d=u.stateId;try{var f=d===o||d===o+1&&!Fw(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;le(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 le(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(le(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return wa(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(le(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!wa(i,o))return!1;var a=this.getTargetIds();if(!a.length)return!1;var c=a.indexOf(r);return s?c===a.length-1:c>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return zw(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return qw(this.store.getState().dragOffset)}}]),e}(),Qw=0;function Yw(){return Qw++}function Mi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mi=function(r){return typeof r}:Mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Mi(e)}function Rw(e){le(typeof e.canDrag=="function","Expected canDrag to be a function."),le(typeof e.beginDrag=="function","Expected beginDrag to be a function."),le(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Xw(e){le(typeof e.canDrop=="function","Expected canDrop to be a function."),le(typeof e.hover=="function","Expected hover to be a function."),le(typeof e.drop=="function","Expected beginDrag to be a function.")}function Da(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Da(r,!1)});return}le(typeof e=="string"||Mi(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Ld=typeof global<"u"?global:self,Fd=Ld.MutationObserver||Ld.WebKitMutationObserver;function $d(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function Zw(e){let t=1;const r=new Fd(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const Jw=typeof Fd=="function"?Zw:$d;class eS{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=Jw(this.flush),this.requestErrorThrow=$d(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class tS{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 rS{create(t){const r=this.freeTasks,n=r.length?r.pop():new tS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const jd=new eS,nS=new rS(jd.registerPendingError);function sS(e){jd.enqueueTask(nS.create(e))}function iS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oS(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 aS(e,t,r){return t&&oS(e.prototype,t),e}function In(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lS(e,t){return fS(e)||dS(e,t)||uS(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 uS(e,t){if(e){if(typeof e=="string")return Bd(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 Bd(e,t)}}function Bd(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 dS(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 hS(e){var t=Yw().toString();switch(e){case Ft.SOURCE:return"S".concat(t);case Ft.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Vd(e){switch(e[0]){case"S":return Ft.SOURCE;case"T":return Ft.TARGET;default:le(!1,"Cannot parse handler ID: ".concat(e))}}function Ud(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=lS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var pS=function(){function e(t){iS(this,e),In(this,"types",new Map),In(this,"dragSources",new Map),In(this,"dropTargets",new Map),In(this,"pinnedSourceId",null),In(this,"pinnedSource",null),In(this,"store",void 0),this.store=t}return aS(e,[{key:"addSource",value:function(r,n){Da(r),Rw(n);var s=this.addHandler(Ft.SOURCE,r,n);return this.store.dispatch(Tw(s)),s}},{key:"addTarget",value:function(r,n){Da(r,!0),Xw(n);var s=this.addHandler(Ft.TARGET,r,n);return this.store.dispatch(Nw(s)),s}},{key:"containsHandler",value:function(r){return Ud(this.dragSources,r)||Ud(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;le(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 le(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return le(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return le(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Vd(r);return n===Ft.SOURCE}},{key:"isTargetId",value:function(r){var n=Vd(r);return n===Ft.TARGET}},{key:"removeSource",value:function(r){var n=this;le(this.getSource(r),"Expected an existing source."),this.store.dispatch(xw(r)),sS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){le(this.getTarget(r),"Expected an existing target."),this.store.dispatch(kw(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);le(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){le(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=hS(r);return this.types.set(i,n),r===Ft.SOURCE?this.dragSources.set(i,s):r===Ft.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function gS(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=yS(n),i=new Gw(s,new pS(s)),o=new vw(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function yS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Dd(Vw,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var vS=["children"];function mS(e,t){return SS(e)||wS(e,t)||_S(e,t)||bS()}function bS(){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 _S(e,t){if(e){if(typeof e=="string")return zd(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 zd(e,t)}}function zd(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 wS(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 SS(e){if(Array.isArray(e))return e}function CS(e,t){if(e==null)return{};var r=OS(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 OS(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 qd=0,Li=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),ES=h.memo(function(t){var r=t.children,n=CS(t,vS),s=DS(n),i=mS(s,2),o=i[0],a=i[1];return h.useEffect(function(){if(a){var c=Hd();return++qd,function(){--qd===0&&(c[Li]=null)}}},[]),l.jsx(md.Provider,Object.assign({value:o},{children:r}),void 0)});function DS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=IS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function IS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hd(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[Li]||(s[Li]={dragDropManager:gS(e,t,r,n)}),s[Li]}function Hd(){return typeof global<"u"?global:window}function TS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function xS(e,t,r){return t&&NS(e.prototype,t),e}function Wd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ia=!1,Ta=!1,kS=function(){function e(t){TS(this,e),Wd(this,"internalMonitor",void 0),Wd(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return xS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){le(!Ia,"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 Ia=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ia=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;le(!Ta,"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 Ta=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Ta=!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 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 Kd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Na=!1,LS=function(){function e(t){AS(this,e),Kd(this,"internalMonitor",void 0),Kd(this,"targetId",null),this.internalMonitor=t.getMonitor()}return MS(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;le(!Na,"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 Na=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Na=!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 FS(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 $S(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;FS(s);var i=r?function(o){return e(o,r)}:e;return jS(s,i)}}function Gd(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=$S(n);t[r]=function(){return s}}}),t}function Qd(e,t){typeof e=="function"?e(t):e.current=t}function jS(e,t){var r=e.ref;return le(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){Qd(r,s),Qd(t,s)}}):h.cloneElement(e,{ref:t})}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 xa(e){return e!==null&&Fi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function ka(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 u=i[c];if(!a(u))return!1;var d=e[u],f=t[u];if(s=void 0,s===!1||s===void 0&&d!==f)return!1}return!0}function BS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VS(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 US(e,t,r){return t&&VS(e.prototype,t),e}function ut(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var zS=function(){function e(t){var r=this;BS(this,e),ut(this,"hooks",Gd({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,xa(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,xa(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),ut(this,"handlerId",null),ut(this,"dragSourceRef",null),ut(this,"dragSourceNode",void 0),ut(this,"dragSourceOptionsInternal",null),ut(this,"dragSourceUnsubscribe",void 0),ut(this,"dragPreviewRef",null),ut(this,"dragPreviewNode",void 0),ut(this,"dragPreviewOptionsInternal",null),ut(this,"dragPreviewUnsubscribe",void 0),ut(this,"lastConnectedHandlerId",null),ut(this,"lastConnectedDragSource",null),ut(this,"lastConnectedDragSourceOptions",null),ut(this,"lastConnectedDragPreview",null),ut(this,"lastConnectedDragPreviewOptions",null),ut(this,"backend",void 0),this.backend=t}return US(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!ka(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!ka(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 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 Jt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var KS=function(){function e(t){var r=this;qS(this,e),Jt(this,"hooks",Gd({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,xa(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),Jt(this,"handlerId",null),Jt(this,"dropTargetRef",null),Jt(this,"dropTargetNode",void 0),Jt(this,"dropTargetOptionsInternal",null),Jt(this,"unsubscribeDropTarget",void 0),Jt(this,"lastConnectedHandlerId",null),Jt(this,"lastConnectedDropTarget",null),Jt(this,"lastConnectedDropTargetOptions",null),Jt(this,"backend",void 0),this.backend=t}return WS(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!ka(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 GS(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function QS(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 $i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$i=function(r){return typeof r}:$i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$i(e)}function YS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function XS(e,t,r){return t&&RS(e.prototype,t),e}function Aa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ZS=function(){function e(t,r,n){YS(this,e),Aa(this,"spec",void 0),Aa(this,"monitor",void 0),Aa(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return XS(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return $i(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 JS(e,t,r){var n=h.useMemo(function(){return new ZS(e,t,r)},[t,r]);return h.useEffect(function(){n.spec=e},[e]),n}function Hr(){var e=h.useContext(md),t=e.dragDropManager;return le(t!=null,"Expected drag drop context"),t}function eC(e){return h.useMemo(function(){var t=e.type;return le(t!=null,"spec.type must be defined"),t},[e])}function tC(e,t){return iC(e)||sC(e,t)||nC(e,t)||rC()}function rC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
459
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nC(e,t){if(e){if(typeof e=="string")return Yd(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 Yd(e,t)}}function Yd(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 sC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function iC(e){if(Array.isArray(e))return e}function oC(e,t,r){var n=Hr(),s=JS(e,t,r),i=eC(e);qr(function(){if(i!=null){var a=QS(i,s,n),c=tC(a,2),u=c[0],d=c[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),d}},[n,t,r,s,i])}function aC(e){return dC(e)||uC(e)||cC(e)||lC()}function lC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
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 Pa(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 Pa(e,t)}}function uC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function dC(e){if(Array.isArray(e))return Pa(e)}function Pa(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 Rd(e,t){var r=aC(t||[]);return t==null&&typeof e!="function"&&r.push(e),h.useMemo(function(){return typeof e=="function"?e():e},r)}function fC(){var e=Hr();return h.useMemo(function(){return new kS(e)},[e])}function hC(e,t){var r=Hr(),n=h.useMemo(function(){return new zS(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 pC=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 gC=Vc(pC);function yC(e,t){return _C(e)||bC(e,t)||mC(e,t)||vC()}function vC(){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 mC(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 bC(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 _C(e){if(Array.isArray(e))return e}function Zd(e,t,r){var n=h.useState(function(){return t(e)}),s=yC(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);gC(i,c)||(o(c),r&&r())},[i,e,r]);return qr(a),[i,a]}function wC(e,t){return OC(e)||EC(e,t)||CC(e,t)||SC()}function SC(){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 CC(e,t){if(e){if(typeof e=="string")return Jd(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 Jd(e,t)}}function Jd(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 EC(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 DC(e,t,r){var n=Zd(e,t,r),s=wC(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 ef(e,t,r){return DC(t,e||function(){return{}},function(){return r.reconnect()})}function IC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function TC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function NC(e,t){var r=Rd(e,t);le(!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=fC(),s=hC(r.options,r.previewOptions);return oC(r,n,s),[ef(r.collect,n,s),IC(s),TC(s)]}function xC(e){var t=e.accept;return h.useMemo(function(){return le(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function kC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function PC(e,t,r){return t&&AC(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 MC=function(){function e(t,r){kC(this,e),tf(this,"spec",void 0),tf(this,"monitor",void 0),this.spec=t,this.monitor=r}return PC(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 LC(e,t){var r=h.useMemo(function(){return new MC(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function FC(e,t){return VC(e)||BC(e,t)||jC(e,t)||$C()}function $C(){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 mC(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 bC(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 _C(e){if(Array.isArray(e))return e}function Zd(e,t,r){var n=h.useState(function(){return t(e)}),s=yC(n,2),i=s[0],o=s[1],a=h.useCallback(function(){var c=t(e);gC(i,c)||(o(c),r&&r())},[i,e,r]);return qr(a),[i,a]}function wC(e,t){return EC(e)||OC(e,t)||CC(e,t)||SC()}function SC(){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 CC(e,t){if(e){if(typeof e=="string")return Jd(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 Jd(e,t)}}function Jd(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 OC(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 EC(e){if(Array.isArray(e))return e}function DC(e,t,r){var n=Zd(e,t,r),s=wC(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 ef(e,t,r){return DC(t,e||function(){return{}},function(){return r.reconnect()})}function IC(e){return h.useMemo(function(){return e.hooks.dragSource()},[e])}function TC(e){return h.useMemo(function(){return e.hooks.dragPreview()},[e])}function NC(e,t){var r=Rd(e,t);le(!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=fC(),s=hC(r.options,r.previewOptions);return oC(r,n,s),[ef(r.collect,n,s),IC(s),TC(s)]}function xC(e){var t=e.accept;return h.useMemo(function(){return le(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function kC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function PC(e,t,r){return t&&AC(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 MC=function(){function e(t,r){kC(this,e),tf(this,"spec",void 0),tf(this,"monitor",void 0),this.spec=t,this.monitor=r}return PC(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 LC(e,t){var r=h.useMemo(function(){return new MC(e,t)},[t]);return h.useEffect(function(){r.spec=e},[e]),r}function FC(e,t){return VC(e)||BC(e,t)||jC(e,t)||$C()}function $C(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
463
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jC(e,t){if(e){if(typeof e=="string")return 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 BC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function VC(e){if(Array.isArray(e))return e}function UC(e,t,r){var n=Hr(),s=LC(e,t),i=xC(e);qr(function(){var a=GS(i,s,n),c=FC(a,2),u=c[0],d=c[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),d},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function zC(){var e=Hr();return h.useMemo(function(){return new LS(e)},[e])}function qC(e){var t=Hr(),r=h.useMemo(function(){return new KS(t.getBackend())},[t]);return qr(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function HC(e){return h.useMemo(function(){return e.hooks.dropTarget()},[e])}function nf(e,t){var r=Rd(e,t),n=zC(),s=qC(r.options);return UC(r,n,s),[ef(r.collect,n,s),HC(s)]}function WC(e,t){return YC(e)||QC(e,t)||GC(e,t)||KC()}function KC(){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 GC(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 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 YC(e){if(Array.isArray(e))return e}function RC(e){var t=Hr(),r=t.getMonitor(),n=Zd(r,e),s=WC(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 of(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function XC(e,t){return e.filter(function(r){return r!==t})}function ZC(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 JC(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 t0(e,t,r){return t&&e0(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 r0=function(){function e(t){JC(this,e),af(this,"entered",[]),af(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return t0(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=ZC(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=XC(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),n0=of(function(){return/firefox/i.test(navigator.userAgent)}),lf=of(function(){return!!window.safari});function s0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o0(e,t,r){return t&&i0(e.prototype,t),e}function _s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cf=function(){function e(t,r){s0(this,e),_s(this,"xs",void 0),_s(this,"ys",void 0),_s(this,"c1s",void 0),_s(this,"c2s",void 0),_s(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(A,F){return t[A]<t[F]?-1:1});for(var o=[],a=[],c,u,d=0;d<n-1;d++)c=t[d+1]-t[d],u=r[d+1]-r[d],o.push(c),a.push(u/c);for(var f=[a[0]],y=0;y<o.length-1;y++){var g=a[y],_=a[y+1];if(g*_<=0)f.push(0);else{c=o[y];var p=o[y+1],v=c+p;f.push(3*v/((v+p)/g+(v+c)/_))}}f.push(a[a.length-1]);for(var m=[],b=[],S,w=0;w<f.length-1;w++){S=a[w];var C=f[w],D=1/o[w],x=C+f[w+1]-S-S;m.push((S-C-x)*D),b.push(x*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=m,this.c3s=b}return o0(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 u=0,d=a.length-1,f;u<=d;){f=Math.floor(.5*(u+d));var y=n[f];if(y<r)u=f+1;else if(y>r)d=f-1;else return s[f]}c=Math.max(0,d);var g=r-n[c],_=g*g;return s[c]+i[c]*g+o[c]*_+a[c]*g*_}}]),e}(),a0=1;function uf(e){var t=e.nodeType===a0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function ji(e){return{x:e.clientX,y:e.clientY}}function l0(e){var t;return e.nodeName==="IMG"&&(n0()||!((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 lf()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function u0(e,t,r,n,s){var i=l0(t),o=i?e:t,a=uf(o),c={x:r.x-a.x,y:r.y-a.y},u=e.offsetWidth,d=e.offsetHeight,f=n.anchorX,y=n.anchorY,g=c0(i,t,u,d),_=g.dragPreviewWidth,p=g.dragPreviewHeight,v=function(){var x=new cf([0,.5,1],[c.y,c.y/d*p,c.y+p-d]),A=x.interpolate(y);return lf()&&i&&(A+=(window.devicePixelRatio-1)*p),A},m=function(){var x=new cf([0,.5,1],[c.x,c.x/u*_,c.x+_-u]);return x.interpolate(f)},b=s.offsetX,S=s.offsetY,w=b===0||b,C=S===0||S;return{x:w?b:m(),y:C?S:v()}}var df="__NATIVE_FILE__",ff="__NATIVE_URL__",hf="__NATIVE_TEXT__",pf="__NATIVE_HTML__";const gf=Object.freeze(Object.defineProperty({__proto__:null,FILE:df,HTML:pf,TEXT:hf,URL:ff},Symbol.toStringTag,{value:"Module"}));function Ma(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var Tn;function Bi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var La=(Tn={},Bi(Tn,df,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Bi(Tn,pf,{exposeProperties:{html:function(t,r){return Ma(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Bi(Tn,ff,{exposeProperties:{urls:function(t,r){return Ma(t,r,"").split(`
465
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Bi(Tn,hf,{exposeProperties:{text:function(t,r){return Ma(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Tn);function d0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h0(e,t,r){return t&&f0(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 p0=function(){function e(t){d0(this,e),yf(this,"item",void 0),yf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return h0(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 g0(e,t){var r=new p0(La[e]);return r.loadDataTransfer(t),r}function Fa(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(La).filter(function(r){var n=La[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function y0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m0(e,t,r){return t&&v0(e.prototype,t),e}function $a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b0=function(){function e(t,r){y0(this,e),$a(this,"ownerDocument",null),$a(this,"globalContext",void 0),$a(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return m0(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 vf(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 mf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vf(Object(r),!0).forEach(function(n){fe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}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 fe(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,n){var s=this;_0(this,e),fe(this,"options",void 0),fe(this,"actions",void 0),fe(this,"monitor",void 0),fe(this,"registry",void 0),fe(this,"enterLeaveCounter",void 0),fe(this,"sourcePreviewNodes",new Map),fe(this,"sourcePreviewNodeOptions",new Map),fe(this,"sourceNodes",new Map),fe(this,"sourceNodeOptions",new Map),fe(this,"dragStartSourceIds",null),fe(this,"dropTargetIds",[]),fe(this,"dragEnterTargetIds",[]),fe(this,"currentNativeSource",null),fe(this,"currentNativeHandle",null),fe(this,"currentDragSourceNode",null),fe(this,"altKeyPressed",!1),fe(this,"mouseMoveTimeoutTimer",null),fe(this,"asyncEndDragFrameId",null),fe(this,"dragOverTargetIds",null),fe(this,"lastClientOffset",null),fe(this,"hoverRafId",null),fe(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&uf(o)||null}),fe(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),fe(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),fe(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),fe(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=ji(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,u=Fa(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var d=s.monitor.getSourceId(),f=s.sourceNodes.get(d),y=s.sourcePreviewNodes.get(d)||f;if(y){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,p=g.anchorY,v=g.offsetX,m=g.offsetY,b={anchorX:_,anchorY:p},S={offsetX:v,offsetY:m},w=u0(f,y,a,b,S);c.setDragImage(y,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var C=s.getCurrentSourcePreviewNodeOptions(),D=C.captureDraggingState;D?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(u)s.beginDragNativeItem(u);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),fe(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Fa(a);c&&s.beginDragNativeItem(c,a)}}),fe(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:ji(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),fe(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),fe(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=ji(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"))}),fe(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),fe(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 Fa(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),fe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:ji(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),fe(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 b0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new r0(this.isNodeInDocument)}return S0(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(u){return i.handleDragStart(u,r)},a=function(u){return i.handleSelectStart(u)};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(u){return s.handleDragEnter(u,r)},o=function(u){return s.handleDragOver(u,r)},a=function(u){return s.handleDrop(u,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 mf({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 mf({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(gf).some(function(n){return gf[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=g0(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}(),Vi;function E0(){return Vi||(Vi=new Image,Vi.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Vi}var O0=function(t,r,n){return new C0(t,r,n)};function D0(e,t){return typeof e=="function"?e(t):e??"NODE"}function I0(e){return e.isDraggable&&!e.isEditing}function T0(e){const t=Et(),r=t.selectedIds,[n,s,i]=NC(()=>({canDrag:()=>I0(e),type:D0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Cn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Cn.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{i(E0())},[i]),s}function N0(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,u=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:u,atTop:!u&&o,atBottom:!u&&a}}function x0(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 Ui(e,t){return{parentId:e||null,index:t}}function Nn(e,t){return{type:"line",index:e,level:t}}function k0(e){return{type:"highlight",id:e}}function ja(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=Ju(n)+1;return{parentId:s,index:i}}function bf(e){var t;const r=N0(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,u]=x0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Ui(i.id,null),cursor:k0(i.id)};if(!c)return{drop:Ui((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:Nn(0,0)};if(Yu(c)){const d=Ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:ja(c,d),cursor:Nn(c.rowIndex+1,d)}}if(Ru(c)){const d=Ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:ja(c,d),cursor:Nn(c.rowIndex+1,d)}}if(Xu(c)){const d=Ci(s,0,c.level+1);return d>c.level?{drop:Ui(c.id,0),cursor:Nn(c.rowIndex+1,d)}:{drop:ja(c,d),cursor:Nn(c.rowIndex+1,d)}}return{drop:Ui(c==null?void 0:c.id,0),cursor:Nn(c.rowIndex+1,c.level+1)}}function A0(e,t){const r=Et(),[n,s]=nf(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:u}=bf({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Cn.hovering(u.parentId,u.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 P0(e){const t=Et(),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 _f=h.memo(function({index:t,style:r}){Qu(),Xb();const n=Et(),s=P0(t),i=h.useRef(null),o=T0(s),a=A0(i,s),c=h.useCallback(p=>{i.current=p,a(p)},[a]),u=n.indent*s.level,d=h.useMemo(()=>({paddingLeft:u}),[u]),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]),y={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 g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:y,children:l.jsx(g,{node:s,tree:n,style:d,dragHandle:o})})});let Ba="",wf=null;function Sf(){Qu();const e=Et();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(),ed(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),td(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(wf),Ba+=t.key,wf=setTimeout(()=>{Ba=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Ba):!1});n&&e.focus(n.id)},children:l.jsx(M0,{})})}function M0(){var e,t;const r=Et(),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:B_,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:z_,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(L_,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:_f})):l.jsx(F_,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:_f}))}function Cf(e){return e.isFiltered?F0(e.root,e.isMatch.bind(e)):L0(e.root)}function L0(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(Ef),t}function F0(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(Ef),n}function Ef(e,t){e.rowIndex=t}const Of=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Va=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(d){try{u(n.next(d))}catch(f){o(f)}}function c(d){try{u(n.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};const{safeRun:dt}=r_;class ws{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=od(this),this.visibleNodes=Cf(this),this.idToIndex=Of(this.visibleNodes)}update(t){this.props=t,this.root=od(this),this.visibleNodes=Cf(this),this.idToIndex=Of(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=ys(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ys(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 ms)return t.id;const r=this.props.idAccessor||"id";return ys(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 Va(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?id(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:sd(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield dt(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 Va(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 dt(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(ha(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=>{ws.editPromise=i})}submit(t,r){return Va(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield dt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(ha(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(ha(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&dt(this.props.onActivate,r)}resolveEdit(t){const r=ws.editPromise;r&&r(t),ws.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(wn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&dt(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(wn(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&&dt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Cr.remove(r)),dt(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(wn(n.id)),n.isSelectable&&(this.dispatch(Cr.add(n.id)),this.dispatch(Cr.anchor(n.id)),this.dispatch(Cr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&dt(this.props.onFocus,this.focusedNode),dt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(wn(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(Cr.remove(this.nodesBetween(s,i))),this.dispatch(Cr.add(o)),this.dispatch(Cr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&dt(this.props.onFocus,this.focusedNode),dt(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(wn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&dt(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(Cr.set({ids:n,anchor:s,mostRecent:i})),dt(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&&Zu(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;dt(this.props.onMove,{dragIds:n,parentId:t===vs?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Cn.cursor({type:"none"}))}showCursor(t){this.dispatch(Cn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(pa.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),dt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(pa.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),dt(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=fa(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(){Ei(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ei(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),nd(()=>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===vs)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!ys(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(wn(t.id))}onBlur(){this.dispatch(f_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Sf}get renderRow(){return this.props.renderRow||a_}get renderNode(){return this.props.children||l_}get renderDragPreview(){return this.props.renderDragPreview||ld}get renderCursor(){return this.props.renderCursor||o_}}function ft(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 $0=typeof Symbol=="function"&&Symbol.observable||"@@observable",Df=$0,Ua=()=>Math.random().toString(36).substring(7).split("").join("."),j0={INIT:`@@redux/INIT${Ua()}`,REPLACE:`@@redux/REPLACE${Ua()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ua()}`},Wr=j0;function If(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 B0(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(z0(e))return"date";if(U0(e))return"error";const r=V0(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 V0(e){return typeof e.constructor=="function"?e.constructor.name:null}function U0(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function z0(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Er(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=B0(e)),t}function Tf(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ft(2):`Expected the root reducer to be a function. Instead, received: '${Er(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?ft(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"?ft(1):`Expected the enhancer to be a function. Instead, received: '${Er(r)}'`);return r(Tf)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function u(){o===i&&(o=new Map,i.forEach((v,m)=>{o.set(m,v)}))}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?ft(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"?ft(4):`Expected the listener to be a function. Instead, received: '${Er(v)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?ft(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;u();const b=a++;return o.set(b,v),function(){if(m){if(c)throw new Error(process.env.NODE_ENV==="production"?ft(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,u(),o.delete(b),i=null}}}function y(v){if(!If(v))throw new Error(process.env.NODE_ENV==="production"?ft(7):`Actions must be plain objects. Instead, the actual type was: '${Er(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"?ft(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"?ft(17):`Action "type" property must be a string. Instead, the actual type was: '${Er(v.type)}'. Value was: '${v.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?ft(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,v)}finally{c=!1}return(i=o).forEach(b=>{b()}),v}function g(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ft(10):`Expected the nextReducer to be a function. Instead, received: '${Er(v)}`);n=v,y({type:Wr.REPLACE})}function _(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?ft(11):`Expected the observer to be an object. Instead, received: '${Er(m)}'`);function b(){const w=m;w.next&&w.next(d())}return b(),{unsubscribe:v(b)}},[Df](){return this}}}return y({type:Wr.INIT}),{dispatch:y,subscribe:f,getState:d,replaceReducer:g,[Df]:_}}function Nf(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===Wr.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(!If(e))return`The ${i} has unexpected type of "${Er(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===Wr.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 H0(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Wr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?ft(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:Wr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ft(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Wr.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 xf(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"&&Nf(`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{H0(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&&Nf(f)}let u=!1;const d={};for(let f=0;f<n.length;f++){const y=n[f],g=r[y],_=a[y],p=g(_,c);if(typeof p>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ft(14):`When called with an action of type ${v?`"${String(v)}"`:"(unknown type)"}, the slice reducer for key "${y}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}d[y]=p,u=u||p!==_}return u=u||n.length!==Object.keys(a).length,u?d:a}}function W0(e=Sn().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 K0=xf({nodes:xf({focus:h_,edit:d_,open:p_,selection:g_,drag:W0}),dnd:y_}),G0=Sn();function Q0({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(Tf(K0,Sn(e))),o=Rb.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>G0),a=h.useMemo(()=>new ws(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(pa.clear(!0))},[a.props.searchTerm]),l.jsx(Hu.Provider,{value:a,children:l.jsx(Gu.Provider,{value:c.current,children:l.jsx(Wu.Provider,{value:o.nodes,children:l.jsx(Ku.Provider,{value:o.dnd,children:l.jsx(OS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||O0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function Y0(){const e=Et(),[,t]=nf(()=>({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}=bf({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Cn.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 R0(e){return Y0(),e.children}function X0(){const t=Et().props.renderContainer||Sf;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function Z0(){const e=Et(),{offset:t,mouse:r,item:n,isDragging:s}=RC(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||ld;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 J0(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 e1{constructor(t,r={}){this.accessors=J0(r),this.root=t1(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 t1(e,t){const r=new kf({},null,t,"ROOT");return r.children=e.map(n=>za(n,r,t)),r}function za(e,t,r){const n=new kf(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>za(i,n,r))),n}class kf{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=za(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 r1=0;function n1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new e1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const p of _.dragIds)o.move({id:p,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:p})=>{o.update({id:p,changes:{name:_}}),n(o.data)},u=typeof s=="string"?s:"id",d=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,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={[u]:`simple-tree-id-${r1++}`,name:""};return v==="internal"&&(m[d]=[]),o.create({parentId:_,index:p,data:m}),n(o.data),m},onDelete:_=>{_.ids.forEach(p=>o.drop({id:p})),n(o.data)}}]}function s1(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]=n1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function i1(e,t){const r=s1(e);return l.jsxs(Q0,{treeProps:r,imperativeHandle:t,children:[l.jsx(R0,{children:l.jsx(X0,{})}),l.jsx(Z0,{})]})}const o1=h.forwardRef(i1);function qa(){return Me(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 a1(){return Me(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 Af={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Pf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Mf=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],l1=[{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 zi(e){const t=c1(e);return{key:t,color:Af[t]??Af.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Pf[t]??Pf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const Ot={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"},u1={video:zo,pdf:Fo,h5p:$o,scorm:Bo,audio:jo,quiz:Mo,default:hn},d1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,u]=h.useState(e.data.name),d=h.useRef(null),f=n==="edit",y=qa(),g=zi(e.data),_=u1[g.key]??hn,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),b=v?nv:m?lv:_;h.useEffect(()=>{if(!s)return;const C=D=>{var x;(x=d.current)!=null&&x.contains(D.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const S=h.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=h.useCallback(C=>{C.key==="Enter"&&S(),C.key==="Escape"&&(u(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[Ot.row,p?Ot.selected:"",e.state.isOver&&m?Ot.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:Ot.grip,"aria-hidden":"true",children:l.jsx(Lc,{size:14})}),l.jsx("button",{className:Ot.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(kc,{size:14}):l.jsx(ls,{size:14})}),l.jsx("span",{className:`${Ot.ctIcon} ${v||m?Ot.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:Ot.renameInput,value:c,autoFocus:!0,onChange:C=>u(C.target.value),onBlur:S,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:Ot.title,onDoubleClick:()=>f&&a(!0),children:e.data.name}),e.state.isOver&&m&&l.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ot.menuWrap,ref:d,children:[l.jsx("button",{className:Ot.menuBtn,onClick:C=>{C.stopPropagation(),i(D=>!D)},"aria-label":"Node options",children:l.jsx(Pc,{size:14})}),s&&l.jsxs("div",{className:Ot.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(pv,{size:13})," Rename"]}),m&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Mc,{size:13})," Add sub-unit"]}),e.data.parent&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(cs,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Uo,{size:13})," Delete"]})]})]})]})};async function f1(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 h1(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 p1(e,t){var o;const r=await f1(e,t.name),n=await h1(r,t);return{processId:(((o=(await Fe.post(`/action/collection/v1/import/${e}`,{request:{fileUrl:n,mimeType:"text/csv"}})).data)==null?void 0:o.result)??{}).processId??""}}async function g1(e){var r;return((r=(await Fe.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Lf(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 y1(e){return Lf(e)}const Ee={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"},v1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,u]=h.useState("idle"),[d,f]=h.useState(""),[y,g]=h.useState([]),[_,p]=h.useState(null),v=h.useRef(null),m=h.useRef(null),b=h.useCallback(()=>{m.current!==null&&(clearInterval(m.current),m.current=null)},[]);h.useEffect(()=>()=>b(),[b]);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(""),g([]),p(null),u("idle"),S(k)&&i(k)},[]),C=h.useCallback(k=>{k.preventDefault(),a(!1);const P=k.dataTransfer.files[0];P&&w(P)},[w]),D=h.useCallback(k=>{var z;const P=(z=k.target.files)==null?void 0:z[0];P&&w(P),k.target.value=""},[w]),x=h.useCallback(async()=>{try{const k=await y1(e),P=document.createElement("a");P.href=k,P.download="sample_hierarchy.csv",P.target="_blank",P.click()}catch{f("Failed to download sample CSV.")}},[e]),A=h.useCallback(async()=>{if(s){u("uploading"),f(""),g([]);try{const{processId:k}=await p1(e,s);if(!k){u("done"),p(null),setTimeout(t,1500);return}u("processing"),m.current=setInterval(async()=>{try{const P=await g1(k);P.status==="COMPLETED"?(b(),u("done"),p(P.successCount??null),P.failedRecords&&P.failedRecords.length>0?g(P.failedRecords):setTimeout(t,1500)):P.status==="FAILED"&&(b(),u("error"),f("Upload processing failed. Please check the error rows below."),P.failedRecords&&g(P.failedRecords))}catch{b(),u("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{u("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),F={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ee.container,children:[l.jsxs("div",{className:Ee.header,children:[l.jsx("h2",{className:Ee.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ee.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ee.body,children:[l.jsxs("div",{className:`${Ee.dropZone} ${o?Ee.dragOver:""} ${s?Ee.hasFile:""}`,onDragEnter:k=>{k.preventDefault(),a(!0)},onDragOver:k=>{k.preventDefault(),a(!0)},onDragLeave:k=>{k.preventDefault(),a(!1)},onDrop:C,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 P;return k.key==="Enter"&&((P=v.current)==null?void 0:P.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:Ee.hiddenInput,onChange:D,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ee.fileInfo,children:[l.jsx("span",{className:Ee.fileIcon,children:"📄"}),l.jsx("span",{className:Ee.fileName,children:s.name}),l.jsxs("span",{className:Ee.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ee.dropHint,children:[l.jsx("span",{className:Ee.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ee.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ee.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ee.sampleLink,onClick:x,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ee.statusBar} ${Ee[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ee.spinner,"aria-hidden":"true"}),F[c],c==="done"&&_!==null&&l.jsxs("span",{className:Ee.successDetail,children:[" — ",_," item(s) imported"]})]}),d&&l.jsx("p",{className:Ee.errorMsg,role:"alert",children:d}),y.length>0&&l.jsxs("div",{className:Ee.failedSection,children:[l.jsxs("h4",{className:Ee.failedTitle,children:["Failed Rows (",y.length,")"]}),l.jsx("div",{className:Ee.tableWrap,children:l.jsxs("table",{className:Ee.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:y.map((k,P)=>l.jsxs("tr",{children:[l.jsx("td",{children:k.rowNumber??P+1}),l.jsx("td",{children:k.name??"—"}),l.jsx("td",{className:Ee.reasonCell,children:k.reason??"Unknown error"})]},P))})]})})]})]}),l.jsxs("div",{className:Ee.footer,children:[l.jsx(Oe,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Oe,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:A,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"},m1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var K;const n=h.useRef(null),s=h.useRef(null),i=h.useRef(null),[o,a]=h.useState(400),[c,u]=h.useState(!1),[d,f]=h.useState(!1),[y,g]=h.useState("create"),{treeData:_,selectedNodeId:p,selectNode:v,addNode:m,deleteNode:b,reorderChildren:S,setTreeData:w}=Me(),C=e==="edit",D=qa(),x=C&&D,A=(((K=_[0])==null?void 0:K.children)??[]).some(V=>V.isFolder),F=be(V=>{var X,j,G,Z;return((j=(X=V.editorConfig)==null?void 0:X.context)==null?void 0:j.contentId)??((Z=(G=V.editorConfig)==null?void 0:G.context)==null?void 0:Z.identifier)??""});h.useEffect(()=>{const V=s.current;if(!V)return;const X=new ResizeObserver(()=>{a(V.clientHeight||400)});return X.observe(V),a(V.clientHeight||400),()=>X.disconnect()},[]),h.useEffect(()=>{if(!c)return;const V=X=>{var j;(j=i.current)!=null&&j.contains(X.target)||u(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[c]);const k=h.useCallback(V=>{V.length>0&&v(V[0].data.id)},[v]),P=h.useCallback(({parentId:V,index:X,dragIds:j})=>{if(!V)return;const G=j[0],Z=Ff(_,V);if(!(Z!=null&&Z.children))return;const ve=Z.children.findIndex(Ie=>Ie.id===G);ve<0||S(V,ve,X>ve?X-1:X)},[_,S]),z=h.useCallback(({ids:V})=>{V.forEach(X=>b(X))},[b]),M=h.useCallback(({parentId:V})=>{var G;const X=V??((G=_[0])==null?void 0:G.id)??"";if(!X)return{id:crypto.randomUUID()};const j=m(X,"unit");return j?{id:j}:(Pe.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,_]),H=h.useCallback(()=>{var X;const V=(X=_[0])==null?void 0:X.id;V&&(m(V,"unit")||Pe.error("Maximum depth reached"))},[_,m]),$=h.useCallback(()=>{p&&(m(p,"subunit")||Pe.error("Maximum depth reached"))},[p,m]),se=h.useCallback(async()=>{if(u(!1),!!F)try{const V=await Lf(F),X=await fetch(V).then(Z=>Z.blob()),j=URL.createObjectURL(X),G=document.createElement("a");G.href=j,G.download=`${F}-folders.csv`,G.style.display="none",document.body.appendChild(G),G.click(),document.body.removeChild(G),URL.revokeObjectURL(j)}catch{Pe.error("Failed to download CSV")}},[F]),ue=h.useCallback(async()=>{if(f(!1),!!F)try{const{rootNode:V}=await zu(F);w([V]),Pe.success("Course outline refreshed.")}catch{Pe.error("Outline could not be refreshed automatically. Please reload the page.")}},[F,w]);return l.jsxs("div",{className:tr.container,children:[l.jsx("div",{className:tr.header,children:l.jsxs("div",{className:tr.headerActions,children:[C&&l.jsxs("div",{className:tr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:tr.iconBtn,onClick:()=>u(V=>!V),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Pc,{size:15})}),c&&l.jsxs("div",{className:tr.dropdownMenu,role:"menu",children:[l.jsx("button",{role:"menuitem",type:"button",disabled:A,title:A?'Folders already exist — use "Update" instead':void 0,onClick:()=>{u(!1),g("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!A,title:A?void 0:'No folders yet — use "Create" first',onClick:se,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!A,title:A?void 0:'No folders yet — use "Create" first',onClick:()=>{u(!1),g("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(fv,{size:15}):l.jsx(dv,{size:15})})]})}),l.jsx("div",{className:tr.treeWrapper,ref:s,children:l.jsx(o1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:k,onMove:C?P:void 0,onDelete:C?z:void 0,onCreate:C?M:void 0,disableEdit:!C,disableDrop:!C,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:V=>l.jsx(d1,{...V,editorMode:e})})}),C&&l.jsxs("div",{className:tr.footer,children:[l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:H,disabled:!x,children:[l.jsx(cs,{size:14})," Add Unit"]}),l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:$,disabled:!x||!p,children:[l.jsx(Mc,{size:14})," Add Sub-unit"]})]}),d&&l.jsx("div",{className:tr.csvModal,children:l.jsx(v1,{contentId:F,mode:y,onComplete:ue,onClose:()=>f(!1)})})]})};function Ff(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Ff(r.children,t);if(n)return n}}}const Ss={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},b1=({crumbs:e})=>{const t=Me(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Ss.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Ss.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(cv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(kc,{size:13,className:Ss.sep}),n<e.length-1?l.jsx("button",{className:Ss.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Ss.current,children:r.name})]},r.id))]}):null},Cs={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},$f=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],_1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?$f.filter(i=>n.includes(i.id)):$f;return l.jsx("div",{className:Cs.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:[Cs.tab,e===i.id?Cs.active:"",r.includes(i.id)?Cs.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Cs.errorDot,"aria-label":"Has errors"})]},i.id))})};var Es=e=>e.type==="checkbox",Kr=e=>e instanceof Date,st=e=>e==null;const jf=e=>typeof e=="object";var $e=e=>!st(e)&&!Array.isArray(e)&&jf(e)&&!Kr(e),Ha=e=>$e(e)&&e.target?Es(e.target)?e.target.checked:e.target.value:e,Bf=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Vf=e=>{const t=e.constructor&&e.constructor.prototype;return $e(t)&&t.hasOwnProperty("isPrototypeOf")},qi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ue(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(qi&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!($e(e)&&Vf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ue(e[s]));return n}const Or={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Gt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Wa="form",Uf="root",zf=["__proto__","constructor","prototype"];var Os=e=>/^\w*$/.test(e),xe=e=>e===void 0,Hi=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!$e(e))return r;const n=Os(t)?[t]:Hi(t);if(n.some(i=>zf.includes(i)))return r;const s=n.reduce((i,o)=>st(i)?void 0:i[o],e);return xe(s)||s===e?xe(e[t])?r:e[t]:s},xt=e=>typeof e=="boolean",ht=e=>typeof e=="function",Te=(e,t,r)=>{let n=-1;const s=Os(t)?[t]:Hi(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const u=e[a];c=$e(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(zf.includes(a))return;e[a]=c,e=e[a]}};const Ka=h.createContext(null);Ka.displayName="HookFormControlContext";const Ga=()=>h.useContext(Ka);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]!==Gt.all&&(t._proxyFormState[o]=!n||Gt.all),r&&(r[o]=!0),e[o]}});return s};const Qa=qi?h.useLayoutEffect:h.useEffect;function w1(e){const t=Ga(),{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 Qa(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u,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 pt=e=>typeof e=="string",Ya=(e,t,r,n,s)=>pt(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),Ra=e=>st(e)||!jf(e);const Hf=(e,t)=>t.length===0&&!Array.isArray(e)&&!Vf(e);function kt(e,t,r=new WeakMap){if(e===t)return!0;if(Ra(e)||Ra(t))return Object.is(e,t);if(Kr(e)&&Kr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Hf(e,n)||Hf(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Kr(a)&&Kr(c)||($e(a)||Array.isArray(a))&&($e(c)||Array.isArray(c))?!kt(a,c,r):!Object.is(a,c))return!1}}return!0}function S1(e){const t=Ga(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=h.useRef(s),u=h.useRef(a),d=h.useRef(void 0),f=h.useRef(r),y=h.useRef(n);u.current=a;const[g,_]=h.useState(()=>{const w=r._getWatch(n,c.current);return u.current?u.current(w):w}),p=h.useCallback(w=>{const C=Ya(n,r._names,w||r._formValues,!1,c.current);return u.current?u.current(C):C},[r._formValues,r._names,n]),v=h.useCallback(w=>{if(!i){const C=Ya(n,r._names,w||r._formValues,!1,c.current);if(u.current){const D=u.current(C);kt(D,d.current)||(_(D),d.current=D)}else _(C)}},[r._formValues,r._names,i,n]);Qa(()=>((f.current!==r||!kt(y.current,n))&&(f.current=r,y.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,b=y.current,S=h.useMemo(()=>{if(i)return null;const w=!m&&!kt(b,n);return m||w?p():null},[i,m,n,b,p]);return S!==null?S:g}function Wi(e){const t=Ga(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Bf(s._names.array,r),u=h.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,o)),[s,r,o]),d=S1({control:s,name:r,defaultValue:u,exact:a}),f=w1({control:s,name:r,exact:a}),y=h.useRef(e),g=h.useRef(null),_=h.useRef(s.register(r,{...e.rules,value:d,...xt(e.disabled)?{disabled:e.disabled}:{}}));y.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 C=Ha(w);return W(s._fields,r)||(_.current=s.register(r,{...y.current.rules,value:C})),_.current.onChange({target:{value:Ha(w),name:r},type:Or.CHANGE})},[r,s]),m=h.useCallback(()=>_.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Or.BLUR}),[r,s._formValues]),b=h.useCallback(w=>{w&&(g.current={focus:()=>ht(w.focus)&&w.focus(),select:()=>ht(w.select)&&w.select(),setCustomValidity:D=>ht(w.setCustomValidity)&&w.setCustomValidity(D),reportValidity:()=>ht(w.reportValidity)&&w.reportValidity()});const C=W(s._fields,r);C&&C._f&&w&&(C._f.ref=g.current)},[s._fields,r]),S=h.useMemo(()=>({name:r,value:d,...xt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:m,ref:b}),[r,n,f.disabled,v,m,b,d]);return h.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...y.current.rules,...xt(y.current.disabled)?{disabled:y.current.disabled}:{}});const C=(D,x)=>{const A=W(s._fields,D);A&&A._f&&(A._f.mount=x)};if(C(r,!0),w){const D=Ue(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,y.current.defaultValue)));Te(s._defaultValues,r,D),xe(W(s._formValues,r))&&Te(s._formValues,r,D)}if(!c&&s.register(r),g.current){const D=W(s._fields,r);D&&D._f&&(D._f.ref=g.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(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 Xa=h.createContext(null);Xa.displayName="HookFormContext";const Yt=()=>h.useContext(Xa),C1=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m})=>{const b=h.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m}),[i,_,u,n,r,y,p,f,d,s,v,o,a,m,c,g,t]);return h.createElement(Xa.Provider,{value:b},h.createElement(Ka.Provider,{value:b.control},e))};var E1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Wf=e=>Array.isArray(e)?e.filter(Boolean):[],Ki=e=>Array.isArray(e)?e:[e],Kf=()=>{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 Gf(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&$e(s)&&i){const o=Gf(s,i);$e(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Xe=e=>$e(e)&&!Object.keys(e).length,Za=e=>e.type==="file",Gi=e=>{if(!qi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Qf=e=>e.type==="select-multiple",Ja=e=>e.type==="radio",O1=e=>Ja(e)||Es(e),el=e=>Gi(e)&&e.isConnected;function D1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(st(e)){e=void 0;break}e=e[t[n]],n++}return e}function I1(e){for(const t in e)if(e.hasOwnProperty(t)&&!xe(e[t]))return!1;return!0}function We(e,t){if(pt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Os(t)?[t]:Hi(t),n=r.length===1?e:D1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&($e(n)&&Xe(n)||Array.isArray(n)&&I1(n))&&We(e,r.slice(0,-1)),e}var T1=e=>{for(const t in e)if(ht(e[t]))return!0;return!1};function Yf(e){return Array.isArray(e)||$e(e)&&!T1(e)}function tl(e,t={}){for(const r in e){const n=e[r];Yf(n)?(t[r]=Array.isArray(n)?[]:{},tl(n,t[r])):xe(n)||(t[r]=!0)}return t}function rl(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>rl(r));return t.some(r=>r!==void 0)?t:void 0}if($e(e)){const t={};for(const r in e){const n=rl(e[r]);xe(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Gr(e,t,r){r||(r=tl(t));for(const n in e){const s=e[n];if(Yf(s))xe(t)||Ra(r[n])?r[n]=tl(s,Array.isArray(s)?[]:{}):Gr(s,st(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!kt(s,i)}}return rl(r)||{}}const Rf={value:!1,isValid:!1},Xf={value:!0,isValid:!0};var Zf=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&&!xe(e[0].attributes.value)?xe(e[0].value)||e[0].value===""?Xf:{value:e[0].value,isValid:!0}:Xf:Rf}return Rf},Jf=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>xe(e)?e:t?e===""?NaN:e&&+e:r&&pt(e)?new Date(e):n?n(e):e;const eh={isValid:!1,value:null};var th=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,eh):eh;function rh(e){const t=e.ref;return Za(t)?t.files:Ja(t)?th(e.refs).value:Qf(t)?[...t.selectedOptions].map(({value:r})=>r):Es(t)?Zf(e.refs).value:Jf(xe(t.value)?e.ref.value:t.value,e)}var N1=(e,t,r,n)=>{const s={};for(const i of e){const o=W(t,i);o&&Te(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Qi=e=>e instanceof RegExp,Ds=e=>xe(e)?e:Qi(e)?e.source:$e(e)?Qi(e.value)?e.value.source:e.value:e,nh=e=>({isOnSubmit:!e||e===Gt.onSubmit,isOnBlur:e===Gt.onBlur,isOnChange:e===Gt.onChange,isOnAll:e===Gt.all,isOnTouch:e===Gt.onTouched});const sh="AsyncFunction";var x1=e=>!!e&&!!e.validate&&!!(ht(e.validate)&&e.validate.constructor.name===sh||$e(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===sh)),k1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),nl=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const Is=(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(Is(a,t))break}else if($e(a)&&Is(a,t))break}}};function ih(e,t,r){const n=W(e,r);if(n||Os(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 A1=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Xe(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Gt.all))},P1=(e,t,r)=>!e||!t||e===t||Ki(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),M1=(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,L1=(e,t)=>!Wf(W(e,t)).length&&We(e,t),oh=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return Te(s,Uf,t[r]),Te(e,r,s),e};function ah(e,t,r="validate"){if(pt(e)||Array.isArray(e)&&e.every(pt)||xt(e)&&!e)return{type:r,message:pt(e)?e:"",ref:t}}var xn=e=>$e(e)&&!Qi(e)?e:{value:e,message:""},lh=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:u,minLength:d,min:f,max:y,pattern:g,validate:_,name:p,valueAsNumber:v,mount:m}=e._f,b=W(r,p);if(!m||t.has(p))return{};const S=a?a[0]:o,w=z=>{if(s&&S.reportValidity){const M=xt(z)?"":z||"";a?a.forEach(H=>H.setCustomValidity(M)):S.setCustomValidity(M),S.reportValidity()}},C={},D=Ja(o),x=Es(o),A=D||x,F=(v||Za(o))&&xe(o.value)&&xe(b)||Gi(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,k=E1.bind(null,p,n,C),P=(z,M,H,$=Qt.maxLength,se=Qt.minLength)=>{const ue=z?M:H;C[p]={type:z?$:se,message:ue,ref:o,...k(z?$:se,ue)}};if(i?!Array.isArray(b)||!b.length:c&&(!A&&(F||st(b))||xt(b)&&!b||x&&!Zf(a).isValid||D&&!th(a).isValid)){const{value:z,message:M}=pt(c)?{value:!!c,message:c}:xn(c);if(z&&(C[p]={type:Qt.required,message:M,ref:S,...k(Qt.required,M)},!n))return w(M),C}if(!F&&(!st(f)||!st(y))){let z,M;const H=xn(y),$=xn(f);if(!st(b)&&!isNaN(b)){const se=o.valueAsNumber||b&&+b;st(H.value)||(z=se>H.value),st($.value)||(M=se<$.value)}else{const se=o.valueAsDate||new Date(b),ue=X=>new Date(new Date().toDateString()+" "+X),K=o.type=="time",V=o.type=="week";pt(H.value)&&b&&(z=K?ue(b)>ue(H.value):V?b>H.value:se>new Date(H.value)),pt($.value)&&b&&(M=K?ue(b)<ue($.value):V?b<$.value:se<new Date($.value))}if((z||M)&&(P(!!z,H.message,$.message,Qt.max,Qt.min),!n))return w(C[p].message),C}if((u||d)&&!F&&(pt(b)||i&&Array.isArray(b))){const z=xn(u),M=xn(d),H=!st(z.value)&&b.length>+z.value,$=!st(M.value)&&b.length<+M.value;if((H||$)&&(P(H,z.message,M.message),!n))return w(C[p].message),C}if(g&&!F&&pt(b)){const{value:z,message:M}=xn(g);if(Qi(z)&&!b.match(z)&&(C[p]={type:Qt.pattern,message:M,ref:o,...k(Qt.pattern,M)},!n))return w(M),C}if(_){if(ht(_)){const z=await _(b,r),M=ah(z,S);if(M&&(C[p]={...M,...k(Qt.validate,M.message)},!n))return w(M.message),C}else if($e(_)){let z={};for(const M in _){if(!Xe(z)&&!n)break;const H=ah(await _[M](b,r),S,M);H&&(z={...H,...k(M,H.message)},w(H.message),n&&(C[p]=z))}if(!Xe(z)&&(C[p]={ref:S,...z},!n))return C}}return w(!0),C};const F1={mode:Gt.onSubmit,reValidateMode:Gt.onChange,shouldFocusError:!0},ch={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function $1(e={}){let t={...F1,...e},r={...Ue(ch),isLoading:ht(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=$e(t.defaultValues)||$e(t.values)?Ue(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ue(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,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...d};let y={...f};const g={array:Kf(),state:Kf()},_=t.criteriaMode===Gt.all,p=E=>T=>{clearTimeout(u),u=setTimeout(E,T)},v=async E=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||y.isValid||E)){let T;t.resolver?(T=Xe((await k()).errors),m()):T=await M({fields:n,onlyCheckValid:!0,eventType:Or.VALID}),T!==r.isValid&&g.state.next({isValid:T})}},m=(E,T)=>{!t.disabled&&(f.isValidating||f.validatingFields||y.isValidating||y.validatingFields)&&((E||Array.from(a.mount)).forEach(N=>{N&&(T?Te(r.validatingFields,N,T):We(r.validatingFields,N))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Xe(r.validatingFields)}))},b=()=>{r.dirtyFields=Gr(s,i)},S=(E,T=[],N,B,U=!0,Q=!0)=>{if(B&&N&&!t.disabled){if(o.action=!0,Q&&Array.isArray(W(n,E))){const q=N(W(n,E),B.argA,B.argB);U&&Te(n,E,q)}if(Q&&Array.isArray(W(r.errors,E))){const q=N(W(r.errors,E),B.argA,B.argB);U&&Te(r.errors,E,q),L1(r.errors,E)}if((f.touchedFields||y.touchedFields)&&Q&&Array.isArray(W(r.touchedFields,E))){const q=N(W(r.touchedFields,E),B.argA,B.argB);U&&Te(r.touchedFields,E,q)}(f.dirtyFields||y.dirtyFields)&&b(),g.state.next({name:E,isDirty:$(E,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Te(i,E,T)},w=(E,T)=>{Te(r.errors,E,T),r.errors={...r.errors},g.state.next({errors:r.errors})},C=E=>{r.errors=E,g.state.next({errors:r.errors,isValid:!1})},D=E=>{const T=Os(E)?[E]:Hi(E);let N=i,B=s;for(let U=0;U<T.length-1;U++){const Q=T[U];if(N=st(N)?N:N[Q],B=st(B)?B:B[Q],N===null&&B!==null)return!0}return!1},x=(E,T,N,B)=>{const U=W(n,E);if(U){if(D(E))return;const Q=xe(W(i,E)),q=W(i,E,xe(N)?W(s,E):N);xe(q)||B&&B.defaultChecked||T?Te(i,E,T?q:rh(U._f)):K(E,q),o.mount&&!o.action&&(v(),Q&&r.isDirty&&(f.isDirty||y.isDirty)&&($()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!xe(W(i,E))&&nl(E,a)&&(o.watch=!0))}},A=(E,T,N,B,U)=>{let Q=!1,q=!1;const ee={name:E};if(!t.disabled){if(!N||B){(f.isDirty||y.isDirty)&&(q=r.isDirty,r.isDirty=ee.isDirty=$(),Q=q!==ee.isDirty);const de=kt(W(s,E),T);q=!!W(r.dirtyFields,E),de!==r.isDirty?r.dirtyFields=Gr(s,i):de?We(r.dirtyFields,E):Te(r.dirtyFields,E,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||y.dirtyFields)&&q!==!de}if(N){const de=W(r.touchedFields,E);de||(Te(r.touchedFields,E,N),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||y.touchedFields)&&de!==N)}Q&&U&&g.state.next(ee)}return Q?ee:{}},F=(E,T,N,B)=>{const U=W(r.errors,E),Q=(f.isValid||y.isValid)&&xt(T)&&r.isValid!==T;if(t.delayError&&N?(c=p(()=>w(E,N)),c(t.delayError)):(clearTimeout(u),c=null,N?Te(r.errors,E,N):We(r.errors,E),r.errors={...r.errors}),(N?!kt(U,N):U)||!Xe(B)||Q){const q={...B,...Q&&xt(T)?{isValid:T}:{},errors:r.errors,name:E};r={...r,...q},g.state.next(q)}},k=async E=>(m(E,!0),await t.resolver(i,t.context,N1(E||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),P=async E=>{const{errors:T}=await k(E);if(m(E),E){for(const N of E){const B=W(T,N);B?a.array.has(N)&&$e(B)&&!Object.keys(B).some(U=>!Number.isNaN(Number(U)))?oh(r.errors,{[N]:B},N):Te(r.errors,N,B):We(r.errors,N)}r.errors={...r.errors}}else r.errors=T;return T},z=async({name:E,eventType:T})=>{if(e.validate){const N=await e.validate({formValues:i,formState:r,name:E,eventType:T});if($e(N))for(const B in N){const U=N[B];U&&me(`${Wa}.${B}`,{message:pt(U.message)?U.message:"",type:U.type||Qt.validate})}else pt(N)||!N?me(Wa,{message:N||"",type:Qt.validate}):re(Wa);return N}return!0},M=async({fields:E,onlyCheckValid:T,name:N,eventType:B,context:U={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(U.runRootValidation=!0,!await z({name:N,eventType:B})&&(U.valid=!1,T)))return U.valid;for(const Q in E){const q=E[Q];if(q){const{_f:ee,...de}=q;if(ee){const Ve=a.array.has(ee.name),It=q._f&&x1(q._f),Tt=f.validatingFields||f.isValidating||y.validatingFields||y.isValidating;It&&Tt&&m([ee.name],!0);const pr=await lh(q,a.disabled,i,_,t.shouldUseNativeValidation&&!T,Ve);if(It&&Tt&&m([ee.name]),pr[ee.name]&&(U.valid=!1,T)||(!T&&(W(pr,ee.name)?Ve?oh(r.errors,pr,ee.name):Te(r.errors,ee.name,pr[ee.name]):We(r.errors,ee.name)),e.shouldUseNativeValidation&&pr[ee.name]))break}!Xe(de)&&await M({context:U,onlyCheckValid:T,fields:de,name:Q,eventType:B})}}return U.valid},H=()=>{for(const E of a.unMount){const T=W(n,E);T&&(T._f.refs?T._f.refs.every(N=>!el(N)):!el(T._f.ref))&&ot(E)}a.unMount=new Set},$=(E,T)=>!t.disabled&&(E&&T&&Te(i,E,T),!kt(J(),s)),se=(E,T,N)=>Ya(E,a,{...o.mount?i:xe(T)?s:pt(E)?{[E]:T}:T},N,T),ue=E=>Wf(W(o.mount?i:s,E,t.shouldUnregister?W(s,E,[]):[])),K=(E,T,N={},B=!1)=>{const U=W(n,E);let Q=T;if(U){const q=U._f;q&&(!q.disabled&&Te(i,E,Jf(T,q)),Q=Gi(q.ref)&&st(T)?"":T,Qf(q.ref)?[...q.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):q.refs?Es(q.ref)?q.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(Q)?ee.checked=!!Q.find(de=>de===ee.value):ee.checked=Q===ee.value||!!Q)}):q.refs.forEach(ee=>ee.checked=ee.value===Q):Za(q.ref)?q.ref.value="":(q.ref.value=Q,q.ref.type||g.state.next({name:E,values:B?i:Ue(i)})))}(N.shouldDirty||N.shouldTouch)&&A(E,Q,N.shouldTouch,N.shouldDirty,!0),N.shouldValidate&&Ie(E)},V=(E,T,N,B=!1)=>{for(const U in T){if(!T.hasOwnProperty(U))return;const Q=T[U],q=E+"."+U,ee=W(n,q);(a.array.has(E)||$e(Q)||ee&&!ee._f)&&!Kr(Q)?V(q,Q,N,B):K(q,Q,N,B)}},X=(E,T,N,B)=>{const U=W(n,E),Q=a.array.has(E),q=B?T:Ue(T),ee=W(i,E),de=kt(ee,q);if(de||Te(i,E,q),Q)g.array.next({name:E,values:B?i:Ue(i)}),(f.isDirty||f.dirtyFields||y.isDirty||y.dirtyFields)&&N.shouldDirty&&(b(),g.state.next({name:E,dirtyFields:r.dirtyFields,isDirty:$(E,q)}));else{const Ve=Array.isArray(q)&&!q.length||Xe(q);!U||U._f||st(q)||Ve?K(E,q,N,B):V(E,q,N,B)}if(!de){const Ve=nl(E,a),It=B?i:Ue(i);g.state.next({...Ve&&r,name:o.mount||Ve?E:void 0,values:It})}},j=(E,T,N={})=>X(E,T,N,!1),G=(E,T={})=>{const N=ht(E)?E(i):E;if(!kt(i,N)){i={...i,...N};for(const B of a.mount)X(B,W(N,B),T,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),T.shouldValidate&&v()}},Z=async E=>{o.mount=!0;const T=E.target;let N=T.name,B=!0;const U=W(n,N),Q=de=>{B=Number.isNaN(de)||Kr(de)&&isNaN(de.getTime())||kt(de,W(i,N,de))},q=nh(t.mode),ee=nh(t.reValidateMode);if(U){let de,Ve;const It=T.type?rh(U._f):Ha(E),Tt=E.type===Or.BLUR||E.type===Or.FOCUS_OUT,pr=!k1(U._f)&&!e.validate&&!t.resolver&&!W(r.errors,N)&&!U._f.deps||M1(Tt,W(r.touchedFields,N),r.isSubmitted,ee,q),$s=nl(N,a,Tt);Te(i,N,It),Tt?(!T||!T.readOnly)&&(U._f.onBlur&&U._f.onBlur(E),c&&c(0)):U._f.onChange&&U._f.onChange(E);const an=A(N,It,Tt),tt=!Xe(an)||$s;if(!Tt&&g.state.next({name:N,type:E.type,values:Ue(i)}),pr)return(f.isValid||y.isValid)&&(t.mode==="onBlur"?Tt&&v():Tt||v()),tt&&g.state.next({name:N,...$s?{}:an});if(!t.resolver&&e.validate&&await z({name:N,eventType:E.type}),!Tt&&$s&&g.state.next({...r}),t.resolver){const{errors:mt}=await k([N]);if(m([N]),Q(It),!B){!Xe(an)&&g.state.next(an);return}const wt=ih(r.errors,n,N),Zt=ih(mt,n,wt.name||N);de=Zt.error,N=Zt.name,Ve=Xe(mt)}else m([N],!0),de=(await lh(U,a.disabled,i,_,t.shouldUseNativeValidation))[N],m([N]),Q(It),B&&(de?Ve=!1:(f.isValid||y.isValid)&&(Ve=await M({fields:n,onlyCheckValid:!0,name:N,eventType:E.type})));B&&(U._f.deps&&(!Array.isArray(U._f.deps)||U._f.deps.length>0)&&Ie(U._f.deps),F(N,Ve,de,an))}},ve=(E,T)=>{if(W(r.errors,T)&&E.focus)return E.focus(),1},Ie=async(E,T={})=>{let N,B;const U=Ki(E);if(t.resolver){const Q=await P(xe(E)?E:U);N=Xe(Q),B=E?!U.some(q=>W(Q,q)):N}else E?(B=(await Promise.all(U.map(async Q=>{const q=W(n,Q);return await M({fields:q&&q._f?{[Q]:q}:q,eventType:Or.TRIGGER})}))).every(Boolean),!(!B&&!r.isValid)&&v()):B=N=await M({fields:n,name:E,eventType:Or.TRIGGER});return g.state.next({...!pt(E)||(f.isValid||y.isValid)&&N!==r.isValid?{}:{name:E},...t.resolver||!E?{isValid:N}:{},errors:r.errors}),T.shouldFocus&&!B&&Is(n,ve,E?U:a.mount),B},J=(E,T)=>{let N={...o.mount?i:s};return T&&(N=Gf(T.dirtyFields?r.dirtyFields:r.touchedFields,N)),xe(E)?N:pt(E)?W(N,E):E.map(B=>W(N,B))},Se=(E,T)=>({invalid:!!W((T||r).errors,E),isDirty:!!W((T||r).dirtyFields,E),error:W((T||r).errors,E),isValidating:!!W(r.validatingFields,E),isTouched:!!W((T||r).touchedFields,E)}),re=E=>{const T=E?Ki(E):void 0;T==null||T.forEach(N=>We(r.errors,N)),T?T.forEach(N=>{g.state.next({name:N,errors:r.errors})}):g.state.next({errors:{}})},me=(E,T,N)=>{const B=(W(n,E,{_f:{}})._f||{}).ref,U=W(r.errors,E)||{},{ref:Q,message:q,type:ee,...de}=U;Te(r.errors,E,{...de,...T,ref:B}),g.state.next({name:E,errors:r.errors,isValid:!1}),N&&N.shouldFocus&&B&&B.focus&&B.focus()},oe=(E,T)=>ht(E)?g.state.subscribe({next:N=>"values"in N&&E(N.values||se(void 0,T),N)}):se(E,T,!0),yt=E=>g.state.subscribe({next:T=>{if(P1(E.name,T.name,E.exact)&&A1(T,E.formState||f,to,E.reRenderRoot)){const N={...i};E.callback({values:N,...r,...T,defaultValues:s})}}}).unsubscribe,Ne=E=>(o.mount=!0,y={...y,...E.formState},yt({...E,formState:{...d,...E.formState}})),ot=(E,T={})=>{for(const N of E?Ki(E):a.mount)a.mount.delete(N),a.array.delete(N),T.keepValue||(We(n,N),We(i,N)),!T.keepError&&We(r.errors,N),!T.keepDirty&&We(r.dirtyFields,N),!T.keepTouched&&We(r.touchedFields,N),!T.keepIsValidating&&We(r.validatingFields,N),!t.shouldUnregister&&!T.keepDefaultValue&&We(s,N);g.state.next({values:Ue(i)}),g.state.next({...r,...T.keepDirty?{isDirty:$()}:{}}),!T.keepIsValid&&v()},et=({disabled:E,name:T})=>{if(xt(E)&&o.mount||E||a.disabled.has(T)){const U=a.disabled.has(T)!==!!E;E?a.disabled.add(T):a.disabled.delete(T),U&&o.mount&&!o.action&&v()}},qe=(E,T={})=>{let N=W(n,E);const B=xt(T.disabled)||xt(t.disabled),U=!a.registerName.has(E)&&N&&N._f&&!N._f.mount;return Te(n,E,{...N||{},_f:{...N&&N._f?N._f:{ref:{name:E}},name:E,mount:!0,...T}}),a.mount.add(E),N&&!U?et({disabled:xt(T.disabled)?T.disabled:t.disabled,name:E}):x(E,!0,T.value),{...B?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:Ds(T.min),max:Ds(T.max),minLength:Ds(T.minLength),maxLength:Ds(T.maxLength),pattern:Ds(T.pattern)}:{},name:E,onChange:Z,onBlur:Z,ref:Q=>{if(Q){a.registerName.add(E),qe(E,T),a.registerName.delete(E),N=W(n,E);const q=xe(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=O1(q),de=N._f.refs||[];if(ee?de.find(Ve=>Ve===q):q===N._f.ref)return;Te(n,E,{_f:{...N._f,...ee?{refs:[...de.filter(el),q,...Array.isArray(W(s,E))?[{}]:[]],ref:{type:q.type,name:E}}:{ref:q}}}),x(E,!1,void 0,q)}else N=W(n,E,{}),N._f&&(N._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(Bf(a.array,E)&&o.action)&&a.unMount.add(E)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Is(n,ve,a.mount),Ke=E=>{xt(E)&&(g.state.next({disabled:E}),Is(n,(T,N)=>{const B=W(n,N);B&&(T.disabled=B._f.disabled||E,Array.isArray(B._f.refs)&&B._f.refs.forEach(U=>{U.disabled=B._f.disabled||E}))},0,!1))},vt=(E,T)=>async N=>{let B;N&&(N.preventDefault&&N.preventDefault(),N.persist&&N.persist());let U=Ue(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:q}=await k();m(),r.errors=Q,U=Ue(q)}else await M({fields:n,eventType:Or.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)We(U,Q);if(We(r.errors,Uf),Xe(r.errors)){g.state.next({errors:{}});try{await E(U,N)}catch(Q){B=Q}}else T&&await T({...r.errors},N),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Xe(r.errors)&&!B,submitCount:r.submitCount+1,errors:r.errors}),B)throw B},Ge=(E,T={})=>{W(n,E)&&(xe(T.defaultValue)?j(E,Ue(W(s,E))):(j(E,T.defaultValue),Te(s,E,Ue(T.defaultValue))),T.keepTouched||We(r.touchedFields,E),T.keepDirty||(We(r.dirtyFields,E),r.isDirty=T.defaultValue?$(E,Ue(W(s,E))):$()),T.keepError||(We(r.errors,E),f.isValid&&v()),g.state.next({...r}))},Be=(E,T={})=>{const N=E?Ue(E):s,B=Ue(N),U=Xe(E),Q=B;if(T.keepDefaultValues||(s=N),!T.keepValues){if(T.keepDirtyValues){const q=new Set([...a.mount,...Object.keys(Gr(s,i))]);for(const ee of Array.from(q)){const de=W(r.dirtyFields,ee),Ve=W(i,ee),It=W(Q,ee);de&&!xe(Ve)?Te(Q,ee,Ve):!de&&!xe(It)&&j(ee,It)}}else{if(qi&&xe(E))for(const q of a.mount){const ee=W(n,q);if(ee&&ee._f){const de=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Gi(de)){const Ve=de.closest("form");if(Ve){Ve.reset();break}}}}if(T.keepFieldsRef)for(const q of a.mount)j(q,W(Q,q));else n={}}if(t.shouldUnregister){if(i=T.keepDefaultValues?Ue(s):{},T.keepFieldsRef)for(const q of a.mount)Te(i,q,W(Q,q))}else i=Ue(Q);g.array.next({values:{...Q}}),g.state.next({values:{...Q}})}a={mount:T.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||!!T.keepIsValid||!!T.keepDirtyValues||!t.shouldUnregister&&!Xe(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!T.keepIsValid,o.action=!1,T.keepErrors||(r.errors={}),g.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:U?!1:T.keepDirty?r.isDirty:T.keepValues?$():!!(T.keepDefaultValues&&!kt(E,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:U?{}:T.keepDirtyValues?T.keepDefaultValues&&i?Gr(s,i):r.dirtyFields:T.keepDefaultValues&&E?Gr(s,E):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Mt=(E,T)=>Be(ht(E)?E(i):E,{...t.resetOptions,...T}),zt=(E,T={})=>{const N=W(n,E),B=N&&N._f;if(B){const U=B.refs?B.refs[0]:B.ref;U.focus&&setTimeout(()=>{U.focus(),T.shouldSelect&&ht(U.select)&&U.select()})}},to=E=>{r={...r,...E}},ro={control:{register:qe,unregister:ot,getFieldState:Se,handleSubmit:vt,setError:me,_subscribe:yt,_runSchema:k,_updateIsValidating:m,_focusError:te,_getWatch:se,_getDirty:$,_setValid:v,_setFieldArray:S,_setDisabledField:et,_setErrors:C,_getFieldArray:ue,_reset:Be,_resetDefaultValues:()=>ht(t.defaultValues)&&t.defaultValues().then(E=>{Mt(E,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:H,_disableForm:Ke,_subjects:g,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(E){o=E},get _defaultValues(){return s},get _names(){return a},set _names(E){a=E},get _formState(){return r},get _options(){return t},set _options(E){t={...t,...E}}},subscribe:Ne,trigger:Ie,register:qe,handleSubmit:vt,watch:oe,setValue:j,setValues:G,getValues:J,reset:Mt,resetField:Ge,resetDefaultValues:(E,T={})=>{if(s=Ue(E),!T.keepDirty){const N=Gr(s,i);r.dirtyFields=N,r.isDirty=!Xe(N)}T.keepIsValid||v(),g.state.next({...r,defaultValues:s})},clearErrors:re,unregister:ot,setError:me,setFocus:zt,getFieldState:Se};return{...ro,formControl:ro}}function j1(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...Ue(ch),isLoading:ht(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ht(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&&!ht(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=$1(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,Qa(()=>{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&&!kt(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 uh(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}function dh(e,t){const r=Fl({queryKey:["framework",e],queryFn:()=>uh(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Fl({queryKey:["framework",n],queryFn:()=>uh(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}const B1={"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."},"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."}},fh={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},V1={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"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"},hh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},ph=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function U1(e,t,r,n){return e!=null&&e.length?e.filter(s=>!(n&&(s.code==="dialCode"||s.code==="dialcode")||s.visible===!1)).map(s=>{const i=s.code??"",o=W1(s),a=K1(s,r,t),c=t[i],u=gh(c,o);return{code:i,label:s.label??i,inputType:o,required:!!(s.required??s.validations),editable:s.editable!==!1,placeholder:s.placeholder,maxLength:s.maxLength,options:q1(a,u,o,r),depends:s.depends,tab:H1(s),section:s.section,defaultValue:s.defaultValue??s.default,currentValue:u}}):Y1(t,n,r)}function z1(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 q1(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=z1(n);for(const c of s){const u=String(c);o.has(u)||(i.push({label:a.get(u)??u,value:u}),o.add(u))}return i}function H1(e){const t=e.section;if(t&&fh[t])return fh[t];const r=e.code??"";return V1[r]??"details"}function gh(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 W1(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"||t==="framework"?"select":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 K1(e,t,r){const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(a=>({label:a,value:a})):n.map(a=>({label:a.name,value:a.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(a=>({label:a,value:a}));const i=e.code??"",o=e.sourceCategory??hh[i];if(o)return yh(i,o,e,t,r)}function yh(e,t,r,n,s){var f,y,g,_,p;const i=ph.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=v=>({label:v.name,value:i?v.identifier:v.name}),a=(y=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:y.find(v=>v.code===t),c=(p=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:p.find(v=>v.code===t);let u=(ph.has(e)?c==null?void 0:c.terms:a==null?void 0:a.terms)??(c==null?void 0:c.terms)??(a==null?void 0:a.terms)??[];const d=r.depends;if(d!=null&&d.length){const v=d.flatMap(m=>{const b=s[m];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(v.length){const m=u.filter(b=>{const S=b.associations;return!S||!S.length?!0:S.some(w=>v.includes(w.identifier)||v.includes(w.code)||v.includes(w.name))});m.length&&(u=m)}}return u.map(o)}function kn(e,t){const r=hh[e];if(r)return yh(e,r,{},t,{})}const G1=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],Q1=[{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-ND 4.0",value:"CC BY-ND 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-NC-ND 4.0",value:"CC BY-NC-ND 4.0"},{label:"CC0 1.0",value:"CC0 1.0"},{label:"All Rights Reserved",value:"All Rights Reserved"}];function it(e,t,r){return gh(e[t],r)}function Y1(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:it(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:it(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:it(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:it(e,"primaryCategory","select"),options:[{label:"Course",value:"Course"},{label:"Digital Textbook",value:"Digital Textbook"},{label:"Teacher Resource",value:"Teacher Resource"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"}]},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:it(e,"additionalCategories","multiselect"),options:[{label:"Lesson Plan",value:"Lesson Plan"},{label:"Textbook",value:"Textbook"},{label:"TV Lesson",value:"TV Lesson"},{label:"Revision Material",value:"Revision Material"}]},{code:"board",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:kn("board",r),currentValue:it(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:kn("subject",r),currentValue:it(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:G1,currentValue:it(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:kn("targetBoardIds",r),currentValue:it(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:kn("targetMediumIds",r),currentValue:it(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:kn("targetGradeLevelIds",r),currentValue:it(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:kn("targetSubjectIds",r),currentValue:it(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:it(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:it(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:it(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:it(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:Q1,currentValue:it(e,"license","select")})),n}function R1(e,t){const{watch:r,setValue:n}=e;h.useEffect(()=>{const s=r((i,{name:o})=>{o&&t.forEach(a=>{var c;(c=a.depends)!=null&&c.includes(o)&&n(a.code,a.inputType==="multiselect"||a.inputType==="chips"?[]:"",{shouldDirty:!0})})});return()=>s.unsubscribe()},[r,n,t])}const An={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},X1=({title:e,description:t,children:r})=>l.jsxs("div",{className:An.section,children:[l.jsxs("div",{className:An.header,children:[l.jsx("h3",{className:An.title,children:e}),t&&l.jsx("p",{className:An.description,children:t})]}),l.jsx("hr",{className:An.divider}),l.jsx("div",{className:An.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"},vh=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Yt(),u=c[e],d={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,u?L.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,d)}):l.jsx("input",{id:e,type:"text",className:[L.input,u?L.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,d)}),u&&l.jsx("span",{className:L.error,children:String(u.message)})]})},Z1=({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:u,setValue:d,formState:{errors:f}}=Yt(),y=u(e),g=((p=r.find(v=>v.value===y))==null?void 0:p.label)??"Select…",_=f[e];return h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.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,_?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y?L.selectedVal:L.placeholder,children:g}),l.jsx(ls,{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,y===v.value?L.optionSelected:""].join(" "),onClick:()=>{d(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:v.label}),y===v.value&&l.jsx(fn,{size:13})]},v.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},J1=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Yt(),y=u(e)??[],g=f[e],_=y.length?`${y.length} selected`:"Select…";h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const p=v=>{const m=y.includes(v)?y.filter(b=>b!==v):[...y,v];d(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,g?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y.length?L.selectedVal:L.placeholder,children:_}),l.jsx(ls,{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,y.includes(v.value)?L.optionSelected:""].join(" "),onClick:()=>p(v.value),children:[l.jsx(fn,{size:13,style:{opacity:y.includes(v.value)?1:0}}),l.jsx("span",{children:v.label})]},v.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:L.error,children:String(g.message)})]})},eE=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=h.useState(""),[a,c]=h.useState(!1),u=h.useRef(null),{watch:d,setValue:f,formState:{errors:y}}=Yt(),g=d(e)??[],_=y[e],p=()=>{const m=i.trim();m&&!g.includes(m)&&f(e,[...g,m],{shouldDirty:!0}),o(""),c(!1)},v=m=>f(e,g.filter(b=>b!==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:[g.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:u,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=u.current)==null?void 0:m.focus()},50)},children:[l.jsx(cs,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},tE=({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)})]})},ce={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"},mh=18,bh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=h.useState("my"),[o,a]=h.useState(""),[c,u]=h.useState([]),[d,f]=h.useState(0),[y,g]=h.useState(!1),[_,p]=h.useState(null),[v,m]=h.useState(0),[b,S]=h.useState(null),[w,C]=h.useState(""),[D,x]=h.useState(!1),[A,F]=h.useState(""),k=h.useRef(null),P=be(j=>{var G,Z;return((Z=(G=j.editorConfig)==null?void 0:G.context)==null?void 0:Z.channel)??""}),z=be(j=>{var G,Z;return((Z=(G=j.editorConfig)==null?void 0:G.context)==null?void 0:Z.uid)??""}),M=h.useCallback(async(j,G,Z=!1)=>{var ve;g(!0);try{const Ie={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&z&&(Ie.createdBy=z),P&&(Ie.channel=P);const Se=((ve=(await Fe.post("/action/composite/v3/search",{request:{filters:Ie,query:j,limit:mh,offset:G,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ve.result)??{},re=Se.content??[];f(Se.count??0),u(me=>Z?[...me,...re]:re)}catch{}finally{g(!1)}},[s,z,P]);h.useEffect(()=>{s!=="upload"&&(u([]),m(0),M(o,0))},[s]);const H=h.useRef(),$=j=>{a(j),clearTimeout(H.current),H.current=setTimeout(()=>{u([]),m(0),M(j,0)},400)},se=()=>{const j=v+mh;m(j),M(o,j,!0)},ue=()=>{const j=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";j&&r(j)},K=j=>{var Z;const G=(Z=j.target.files)==null?void 0:Z[0];if(j.target.value="",!!G){if(!G.type.startsWith("image/")){F("Only image files are accepted.");return}if(G.size>4*1024*1024){F("Image must be under 4 MB.");return}S(G),C(URL.createObjectURL(G)),F("")}},V=async()=>{var j,G;if(b){x(!0),F("");try{const Z=new FormData;Z.append("file",b);const Ie=(G=(j=(await Fe.post(`/action/content/v3/upload/${e}?fileType=image`,Z,{headers:{"Content-Type":"multipart/form-data"}})).data)==null?void 0:j.result)==null?void 0:G.artifactUrl;if(!Ie)throw new Error("No URL in response");r(Ie)}catch(Z){F(Z instanceof Error?Z.message:"Upload failed.")}finally{x(!1)}}},X=c.length<d;return l.jsx("div",{className:ce.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:ce.modal,children:[l.jsxs("div",{className:ce.header,children:[l.jsx("span",{className:ce.title,children:"Select App Icon"}),l.jsx("button",{className:ce.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(jr,{size:18})})]}),l.jsxs("div",{className:ce.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${ce.tab} ${s==="my"?ce.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${ce.tab} ${s==="all"?ce.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${ce.tab} ${s==="upload"?ce.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(jc,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:ce.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ce.searchWrap,children:[l.jsx(Vo,{size:14,className:ce.searchIcon}),l.jsx("input",{type:"search",className:ce.searchInput,placeholder:"Search images…",value:o,onChange:j=>$(j.target.value)})]}),y&&c.length===0?l.jsxs("div",{className:ce.loadingRow,children:[l.jsx(ci,{size:20,className:ce.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:ce.empty,children:"No images found"}):l.jsx("div",{className:ce.grid,children:c.map(j=>{const G=j.appIcon??j.artifactUrl??j.downloadUrl??"",Z=(_==null?void 0:_.identifier)===j.identifier;return l.jsxs("button",{type:"button",className:`${ce.imgCell} ${Z?ce.imgCellSelected:""}`,onClick:()=>p(j),title:j.name,children:[G?l.jsx("img",{src:G,alt:j.name,className:ce.thumb}):l.jsx("div",{className:ce.noThumb,children:"IMG"}),Z&&l.jsx("div",{className:ce.checkBadge,children:l.jsx(fn,{size:12})})]},j.identifier)})}),X&&!y&&l.jsx("button",{className:ce.loadMoreBtn,onClick:se,children:"Load More"}),y&&c.length>0&&l.jsx("div",{className:ce.loadingRow,children:l.jsx(ci,{size:16,className:ce.spinner})})]}):l.jsxs("div",{className:ce.uploadArea,children:[l.jsx("div",{className:ce.dropZone,onClick:()=>{var j;return(j=k.current)==null?void 0:j.click()},onDragOver:j=>j.preventDefault(),onDrop:j=>{j.preventDefault();const G=j.dataTransfer.files[0];G&&K({target:{files:[G],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:ce.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(jc,{size:32,className:ce.uploadIcon}),l.jsx("p",{className:ce.dropText,children:"Drag & drop or click to browse"}),l.jsx("p",{className:ce.dropSubtext,children:"PNG, JPG, SVG · max 4 MB"})]})}),l.jsx("input",{ref:k,type:"file",accept:"image/*",className:ce.hiddenInput,onChange:K}),b&&l.jsx("p",{className:ce.fileName,children:b.name}),A&&l.jsx("p",{className:ce.errorText,children:A})]})}),l.jsxs("div",{className:ce.footer,children:[l.jsx("button",{className:ce.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:ce.confirmBtn,disabled:!b||D,onClick:V,children:D?l.jsxs(l.Fragment,{children:[l.jsx(ci,{size:14,className:ce.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:ce.confirmBtn,disabled:!_,onClick:ue,children:"Use Selected"})]})]})})},rE=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),{watch:a,setValue:c,register:u,formState:{errors:d}}=Yt(),f=a(e),y=d[e],g=p=>{c(e,p,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{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",...u(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(Fc,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:L.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(Uo,{size:13}),l.jsx("span",{children:"Remove"})]}),y&&l.jsx("span",{className:L.error,children:String(y.message)}),i&&l.jsx(bh,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},nE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({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)})]})},sE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=h.useState(""),u=h.useRef(null),d=i.value??[],f=p=>{const v=p.trim();!v||d.includes(v)||i.onChange([...d,v])},y=p=>{i.onChange(d.filter(v=>v!==p))},g=p=>{p.key==="Enter"||p.key===","?(p.preventDefault(),f(a),c("")):p.key==="Backspace"&&a===""&&d.length>0&&y(d[d.length-1])},_=()=>{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=u.current)==null?void 0:p.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(p=>l.jsxs("span",{className:L.tagChip,children:[p,!n&&l.jsx("button",{type:"button",className:L.tagChipRemove,onClick:v=>{v.stopPropagation(),y(p)},"aria-label":`Remove ${p}`,children:l.jsx(jr,{size:11})})]},p)),!n&&l.jsx("input",{ref:u,className:L.chipInput,value:a,onChange:p=>c(p.target.value),onKeyDown:g,onBlur:_,placeholder:d.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},iE=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=Wi({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},u=(d,f,y)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[d]=y;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};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((d,f)=>{const y=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}_${d.code}`,children:d.label}),l.jsxs("select",{id:`${e}_${d.code}`,className:[L.input,a?L.inputError:""].join(" "),disabled:s||y,value:c[d.code]??"",onChange:g=>u(d.code,f,g.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),d.options.map(g=>l.jsx("option",{value:g.value,children:g.label},g.value))]})]},d.code)})}),a&&l.jsx("span",{className:L.error,children:String(a.message)})]})},_h=[{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"}],oE=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=h.useState(!1),o=h.useRef(null),{register:a,watch:c,setValue:u,formState:{errors:d}}=Yt(),f=c(e),y=_h.find(p=>p.value===f),g=(y==null?void 0:y.label)??"Select license…",_=d[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,_?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:g}),l.jsx(ls,{size:14,className:s?L.chevronUp:""})]}),s&&l.jsx("div",{className:L.dropdown,role:"listbox",children:_h.map(p=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===p.value,className:[L.option,f===p.value?L.optionSelected:""].join(" "),onClick:()=>{u(e,p.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:p.label}),f===p.value&&l.jsx(fn,{size:13})]},p.value))}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},aE=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=h.useState("idle"),[u,d]=h.useState(""),f=async()=>{const g=(i.value??"").trim();if(!g){c("invalid"),d("Enter a dial code to validate.");return}c("loading"),d("");try{const _=await Ub(g),p=_==null?void 0:_.result,v=p==null?void 0:p.dialcodes;Array.isArray(v)&&v.length>0?(c("valid"),d("Dial code is valid.")):(c("invalid"),d("Dial code not found."))}catch{c("invalid"),d("Validation failed. Please try again.")}},y=()=>a==="loading"?l.jsx(ci,{size:16,className:L.dialcodeSpinner}):a==="valid"?l.jsx(Ac,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(Lo,{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:g=>{i.onChange(g),c("idle"),d("")},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"}),y()]}),o&&l.jsx("span",{className:L.error,children:String(o.message)}),!o&&u&&l.jsx("span",{className:a==="valid"?L.dialcodeValid:L.error,children:u})]})},sl={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},lE=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var $,se,ue;const a=be(K=>K.editorConfig),c=be(K=>K.rootFormConfig),u=be(K=>K.unitFormConfig),{organisationFramework:d,targetFrameworks:f,isLoading:y}=dh(($=a==null?void 0:a.context)==null?void 0:$.framework,(se=a==null?void 0:a.context)==null?void 0:se.targetFWIds),g={organisationFramework:d,targetFrameworks:f},_=Me(K=>K.selectedNodeId),p=Me(K=>K.treeCache),v=_?p[_]??{}:{},m={...e,...v},b=r?c:u,S=b||(((ue=a==null?void 0:a.config.hierarchy)==null?void 0:ue.formConfig)??[]),w=U1(S,m,g,r),C=w.filter(K=>K.tab===t&&K.inputType!=="appIcon"),D=j1({mode:"onChange",defaultValues:Object.fromEntries(w.map(K=>{const V=["multiselect","chips","keywords","tagsinput"],X=["nestedselect"];return V.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??[]]:X.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??{}]:[K.code,K.currentValue??K.defaultValue??""]}))});R1(D,w);const{updateNode:x}=Me(),A=h.useRef(w);A.current=w;const F=h.useRef(_);F.current=_;const k=h.useRef(i);k.current=i;const P=h.useRef(o);P.current=o,h.useEffect(()=>{const K=D.watch((V,{name:X})=>{const j=F.current;if(!j)return;const G=A.current,Z=new Set(G.map(J=>J.code));if(X&&Z.has(X)){const J=D.getValues(X);x(j,{[X]:J}),k.current({[X]:J})}else if(!X){const J=D.getValues(),Se=Object.fromEntries(Object.entries(J).filter(([re])=>Z.has(re)));Object.keys(Se).length>0&&(x(j,Se),k.current(Se))}const ve=D.formState.errors,Ie=Array.from(new Set(Object.keys(ve).map(J=>{var Se;return(Se=G.find(re=>re.code===J))==null?void 0:Se.tab}).filter(Boolean)));P.current(Object.keys(ve).length===0,Ie)});return()=>K.unsubscribe()},[D]);const z=s!=="edit",M=C.reduce((K,V)=>{const X=K[K.length-1];return X&&X.section===V.section?X.fields.push(V):K.push({section:V.section,fields:[V]}),K},[]),H=K=>{const V={key:K.code,name:K.code,label:K.label,required:K.required,disabled:z||K.editable===!1};switch(K.inputType){case"textarea":return l.jsx(vh,{...V,multiline:!0,maxLength:K.maxLength});case"select":return l.jsx(Z1,{...V,options:K.options??[]});case"multiselect":return l.jsx(J1,{...V,options:K.options??[]});case"chips":return l.jsx(eE,{...V});case"radio":return l.jsx(tE,{...V,options:K.options??[]});case"appIcon":return l.jsx(rE,{...V,nodeId:_??""});case"datepicker":case"datetime":return l.jsx(nE,{...V});case"keywords":case"tagsinput":return l.jsx(sE,{...V});case"nestedselect":return l.jsx(iE,{...V,levels:K.levels??[]});case"license":return l.jsx(oE,{...V});case"dialcode":return l.jsx(aE,{...V});default:return l.jsx(vh,{...V,maxLength:K.maxLength})}};return l.jsx(C1,{...D,children:l.jsxs("div",{className:sl.form,children:[M.map((K,V)=>{const X=K.section?B1[K.section]:void 0;return X?l.jsx(X1,{title:X.title,description:X.description,children:K.fields.map(H)},K.section??V):l.jsx("div",{className:sl.ungrouped,children:K.fields.map(H)},V)}),C.length===0&&!y&&l.jsx("p",{className:sl.noFields,children:"No fields configured for this tab."})]})})};function wh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function cE(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Yi(e){return e!==null&&e>=0}function uE(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 dE(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Sh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=wh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Ri={scaleX:1,scaleY:1},fE=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 u=i[o];return u?{x:0,y:r<o?u.top+u.height-(a.top+a.height):u.top-a.top,...Ri}:null}const c=hE(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Ri}:s<r&&s>=o?{x:0,y:a.height+c,...Ri}:{x:0,y:0,...Ri}};function hE(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 Ch="Sortable",Eh=h.createContext({activeIndex:-1,containerId:Ch,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sh,disabled:{draggable:!1,droppable:!1}});function pE(e){let{children:t,id:r,items:n,strategy:s=Sh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=Tc(),f=ts(Ch,r),y=a.rect!==null,g=h.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),_=o!=null,p=o?g.indexOf(o.id):-1,v=u?g.indexOf(u.id):-1,m=h.useRef(g),b=!uE(g,m.current),S=v!==-1&&p===-1||b,w=dE(i);Ht(()=>{b&&_&&d(g)},[b,g,_,d]),h.useEffect(()=>{m.current=g},[g]);const C=h.useMemo(()=>({activeIndex:p,containerId:f,disabled:w,disableTransforms:S,items:g,overIndex:v,useDragOverlay:y,sortedRects:cE(g,c),strategy:s}),[p,f,w.draggable,w.droppable,S,g,v,c,y,s]);return h.createElement(Eh.Provider,{value:C},t)}const gE=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return wh(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:u}=e;return!u||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},vE={duration:200,easing:"ease"},Oh="transform",mE=wr.Transition.toString({property:Oh,duration:0,easing:"linear"}),bE={roleDescription:"sortable"};function _E(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 u=dn(n.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}r!==a.current&&(a.current=r)},[t,r,n,s]),h.useEffect(()=>{i&&o(null)},[i]),i}function wE(e){let{animateLayoutChanges:t=yE,attributes:r,disabled:n,data:s,getNewIndex:i=gE,id:o,strategy:a,resizeObserverConfig:c,transition:u=vE}=e;const{items:d,containerId:f,activeIndex:y,disabled:g,disableTransforms:_,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:b}=h.useContext(Eh),S=SE(n,g),w=d.indexOf(o),C=h.useMemo(()=>({sortable:{containerId:f,index:w,items:d},...s}),[f,s,w,d]),D=h.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:x,node:A,isOver:F,setNodeRef:k}=Vy({id:o,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:P,activatorEvent:z,activeNodeRect:M,attributes:H,setNodeRef:$,listeners:se,isDragging:ue,over:K,setActivatorNodeRef:V,transform:X}=Ic({id:o,data:C,attributes:{...bE,...r},disabled:S.draggable}),j=Og(k,$),G=!!P,Z=G&&!_&&Yi(y)&&Yi(v),ve=!m&&ue,Ie=ve&&Z?X:null,Se=Z?Ie??(a??b)({rects:p,activeNodeRect:M,activeIndex:y,overIndex:v,index:w}):null,re=Yi(y)&&Yi(v)?i({id:o,items:d,activeIndex:y,overIndex:v}):w,me=P==null?void 0:P.id,oe=h.useRef({activeId:me,items:d,newIndex:re,containerId:f}),yt=d!==oe.current.items,Ne=t({active:P,containerId:f,isDragging:ue,isSorting:G,id:o,index:w,items:d,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:u,wasDragging:oe.current.activeId!=null}),ot=_E({disabled:!Ne,index:w,node:A,rect:x});return h.useEffect(()=>{G&&oe.current.newIndex!==re&&(oe.current.newIndex=re),f!==oe.current.containerId&&(oe.current.containerId=f),d!==oe.current.items&&(oe.current.items=d)},[G,re,f,d]),h.useEffect(()=>{if(me===oe.current.activeId)return;if(me&&!oe.current.activeId){oe.current.activeId=me;return}const qe=setTimeout(()=>{oe.current.activeId=me},50);return()=>clearTimeout(qe)},[me]),{active:P,activeIndex:y,attributes:H,data:C,rect:x,index:w,newIndex:re,items:d,isOver:F,isSorting:G,isDragging:ue,listeners:se,node:A,overIndex:v,over:K,setNodeRef:j,setActivatorNodeRef:V,setDroppableNodeRef:k,setDraggableNodeRef:$,transform:ot??Se,transition:et()};function et(){if(ot||yt&&oe.current.newIndex===w)return mE;if(!(ve&&!ei(z)||!u)&&(G||Ne))return wr.Transition.toString({...u,property:Oh})}}function SE(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 Xi(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 CE=[ge.Down,ge.Right,ge.Up,ge.Left],EE=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(CE.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const y=s.get(f.id);if(y)switch(e.code){case ge.Down:n.top<y.top&&c.push(f);break;case ge.Up:n.top>y.top&&c.push(f);break;case ge.Left:n.left>y.left&&c.push(f);break;case ge.Right:n.left<y.left&&c.push(f);break}});const u=zg({collisionRect:n,droppableRects:s,droppableContainers:c});let d=Jl(u,"id");if(d===(o==null?void 0:o.id)&&u.length>1&&(d=u[1].id),d!=null){const f=i.get(r.id),y=i.get(d),g=y?s.get(y.id):null,_=y==null?void 0:y.node.current;if(_&&g&&f&&y){const v=ni(_).some((D,x)=>a[x]!==D),m=Dh(f,y),b=OE(f,y),S=v||!m?{x:0,y:0}:{x:b?n.width-g.width:0,y:b?n.height-g.height:0},w={x:g.left,y:g.top};return S.x&&S.y?w:rs(w,S)}}}};function Dh(e,t){return!Xi(e)||!Xi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function OE(e,t){return!Xi(e)||!Xi(t)||!Dh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Qr={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"},DE={video:zo,pdf:Fo,h5p:$o,scorm:Bo,audio:jo,quiz:Mo,default:hn},IE=({item:e,onRemove:t,isEditable:r})=>{const n=zi(e),s=DE[n.key]??hn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:u,isDragging:d}=wE({id:e.id,disabled:!r}),f={transform:wr.Transform.toString(c),transition:u,opacity:d?.5:1};return l.jsxs("div",{ref:a,style:f,className:Qr.row,role:"listitem",children:[r&&l.jsx("span",{className:Qr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Lc,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Qr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Qr.info,children:[l.jsx("span",{className:Qr.name,title:e.name,children:e.name}),l.jsx("span",{className:Qr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Qr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(jr,{size:14})})]})},Yr={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"},TE=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Me(),i=t?r(t):[],o=e==="edit",a=Yl(Co(si,{activationConstraint:{distance:5}}),Co(To,{coordinateGetter:EE})),c=h.useCallback(d=>{const{active:f,over:y}=d;if(!y||f.id===y.id||!t)return;const g=Me.getState().getChildrenOf(t),_=g.findIndex(v=>v.id===f.id),p=g.findIndex(v=>v.id===y.id);_<0||p<0||n(t,_,p)},[t,n]),u=h.useCallback(d=>{window.confirm("Remove this content from the unit?")&&s(d)},[s]);return t?l.jsxs("div",{className:Yr.container,children:[l.jsxs("div",{className:Yr.header,children:[l.jsx("span",{className:Yr.heading,children:"Content in this unit"}),l.jsx("span",{className:Yr.count,children:i.length})]}),i.length>0?l.jsx(Oc,{sensors:a,collisionDetection:Ug,onDragEnd:c,children:l.jsx(pE,{items:i.map(d=>d.id),strategy:fE,children:l.jsx("div",{className:Yr.list,role:"list",children:i.map(d=>l.jsx(IE,{item:d,onRemove:u,isEditable:o},d.id))})})}):l.jsxs("div",{className:Yr.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:Yr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(cs,{size:14})," Add content"]})]}):null},Ih={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},NE=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Ih.dropZone} ${e?Ih.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 xE(e){var s;const t={status:["Live"],contentType:["Resource"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((s=(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:s.result)??{};return{content:n.content??[],count:n.count??0}}async function kE(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 ke={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"},AE=[{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 PE(e){return AE.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const ME={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},LE={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},FE={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},$E="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function il(e){for(const[t,r]of Object.entries(ME))if(r.includes(e))return t;return"default-player"}function jE(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 BE(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 VE(e,t,r=100){await BE(LE[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 zE({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:ke.infoStrip,children:r.map(n=>l.jsxs("div",{className:ke.infoChip,children:[n.icon&&l.jsx("span",{className:ke.infoChipIcon,children:n.icon}),l.jsx("span",{className:ke.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function qE({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${ke.coverOverlay} ${t?ke.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:ke.coverThumb}),l.jsx("div",{className:ke.coverPlayRing,children:l.jsx("div",{className:ke.coverPlayIcon})}),l.jsx("span",{className:ke.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:ke.coverSkeleton})})}function HE({message:e}){return l.jsxs("div",{className:ke.playerError,children:[l.jsx("span",{className:ke.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:ke.playerErrorMsg,children:e})]})}function WE({mimeType:e}){const t=PE(e);return l.jsxs("span",{className:ke.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:ke.typeDot}),t.label]})}const ol=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(GE,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:ke.contentPlayerRoot,children:[l.jsxs("div",{className:ke.stage,children:[l.jsxs("div",{className:ke.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:ke.playerHeaderThumb}),l.jsx("span",{className:ke.playerHeaderTitle,children:e.name}),l.jsx(WE,{mimeType:e.mimeType??""})]}),l.jsx(KE,{node:e})]}),l.jsx(zE,{node:e})]})};function KE({node:e}){var v;const t=be(m=>m.editorConfig),[r,n]=h.useState(()=>il(e.mimeType??"")),[s,i]=h.useState(!1),[o,a]=h.useState(null),[c,u]=h.useState(e.metadata??{}),[d,f]=h.useState(!1),y=h.useRef(null),g=h.useRef(null),_=((v=t==null?void 0:t.config)==null?void 0:v.previewCdnUrl)??$E;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),u(e.metadata??{}),n(il(e.mimeType??"")),kE(e.identifier).then(b=>{if(m)return;const S={...e.metadata??{},...b};u(S);const w=b.mimeType??e.mimeType??"";n(il(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=jE(e,c,t);return h.useEffect(()=>{if(!d||r!=="default-player")return;const m=y.current;if(!m)return;m.src=_;const b=()=>{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",b),m.addEventListener("error",S),()=>{m.removeEventListener("load",b),m.removeEventListener("error",S),m.src=""}},[e.identifier,r,_,d]),h.useEffect(()=>{if(!d||r==="default-player")return;const m=g.current;if(!m)return;const b=FE[r];if(!b)return;const S=p;VE(b,r).then(()=>{if(!g.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);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,d]),l.jsxs("div",{className:ke.aspectRatio,children:[o?l.jsx(HE,{message:o}):l.jsx(qE,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:y,id:"contentPlayer",title:e.name,className:ke.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:ke.playerFrame})]})}function GE({node:e,editorMode:t}){const r=be(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:ke.qumlRoot,children:l.jsx("div",{ref:n,className:ke.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 QE(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 YE=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var d;const{treeData:s,moveNode:i}=Me(),o=QE(s,((d=s[0])==null?void 0:d.id)??"",r),[a,c]=h.useState(null),u=()=>{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(jr,{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(av,{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:u,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 RE(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 XE=({onClose:e})=>{const{treeData:t,updateNode:r}=Me(),n=RE(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(jr,{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(u=>({...u,[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(yv,{size:14})," Save"]})]})]})})},je={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"},ZE=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var P,z;const{updateNode:s,markDirty:i}=Me(),o=t==="edit",a=zi(e),c=be(M=>M.relationalFormConfig),u=M=>c==null?void 0:c.find(H=>H.code===M),d=M=>!c||!!u(M),f=(M,H)=>{var $;return(($=u(M))==null?void 0:$.label)||H},[y,g]=h.useState(!0),_=((P=e.metadata)==null?void 0:P.relationalMetadata)??{},[p,v]=h.useState(_.name??e.name??""),[m,b]=h.useState(""),[S,w]=h.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((z=e.metadata)==null?void 0:z.keywords)?e.metadata.keywords:[]),[C,D]=h.useState(!!_.optional);h.useEffect(()=>{var H,$;const M=((H=e.metadata)==null?void 0:H.relationalMetadata)??{};v(M.name??e.name??""),w(Array.isArray(M.keywords)?M.keywords:Array.isArray(($=e.metadata)==null?void 0:$.keywords)?e.metadata.keywords:[]),D(!!M.optional)},[e.id]);const x=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},A=()=>{const M=m.trim();if(M&&!S.includes(M)){const H=[...S,M];w(H),s(e.id,{keywords:H}),i()}b("")},F=M=>{const H=S.filter($=>$!==M);w(H),s(e.id,{keywords:H}),i()},k=M=>{D(M),s(e.id,{optional:M}),i()};return l.jsxs("div",{className:je.container,children:[l.jsxs("div",{className:je.panelHeader,children:[l.jsxs("div",{className:je.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:je.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:je.panelCollapseBtn,onClick:()=>g(M=>!M),"aria-expanded":y,"aria-label":y?"Collapse metadata panel":"Expand metadata panel",title:y?"Collapse":"Expand",children:y?l.jsx(ls,{size:15}):l.jsx(sv,{size:15})})]}),y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:je.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:je.icon}),l.jsx("input",{type:"text",className:je.nameInput,value:p,disabled:!o,onChange:M=>v(M.target.value),onBlur:x,placeholder:"Content name"})]}),d("keywords")&&l.jsxs("div",{className:je.field,children:[l.jsx("div",{className:je.fieldHeader,children:l.jsxs("label",{className:je.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:je.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:je.chips,children:S.map(M=>l.jsxs("span",{className:je.chip,children:[M,o&&l.jsx("button",{type:"button",className:je.chipRemove,onClick:()=>F(M),children:"×"})]},M))}),o&&l.jsxs("div",{className:je.keywordInput,children:[l.jsx("input",{type:"text",className:je.input,value:m,placeholder:"Add keyword and press Enter",onChange:M=>b(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),A())}}),l.jsx("button",{type:"button",className:je.addBtn,onClick:A,children:"Add"})]})]}),d("optional")&&l.jsxs("div",{className:je.field,children:[l.jsx("label",{className:je.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:je.radioGroup,children:[l.jsxs("label",{className:je.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>k(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:je.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>k(!1),disabled:!o}),"No"]})]})]})]}),n]})},Ts={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},JE=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=Me(),a=u=>{i(e,{appIcon:u}),o(),s(!1)},c=u=>{u.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[Ts.iconBtn,r?Ts.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:u=>{r&&(u.key==="Enter"||u.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:Ts.iconImg}):l.jsx("div",{className:Ts.placeholder,children:l.jsx(Fc,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:Ts.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Uo,{size:11})})]}),n&&l.jsx(bh,{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"},eO=["application/vnd.sunbird.questionset"],tO=({editorMode:e,onToolbarEvent:t})=>{var P,z,M,H;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,u]=h.useState(!1),d=h.useRef(null),f=h.useRef(),{selectedNodeId:y,breadcrumb:g,activeNodeMeta:_,updateNode:p,treeData:v}=Me(),m=be($=>{var se,ue,K,V;return((ue=(se=$.editorConfig)==null?void 0:se.context)==null?void 0:ue.contentId)??((V=(K=$.editorConfig)==null?void 0:K.context)==null?void 0:V.identifier)??""}),b=y?Th(v,y):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),C=b&&eO.includes(b.mimeType??""),D=b&&!b.isFolder&&!C&&!S,x=((P=b==null?void 0:b.metadata)==null?void 0:P.rejectComment)??(S?(M=(z=v[0])==null?void 0:z.metadata)==null?void 0:M.rejectComment:void 0),A=h.useCallback(()=>{const $=d.current;if(!$||!y)return;const se=$.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(y,{name:se})},600)},[y,p]),F=h.useCallback($=>{t({action:"onFormValueChange",data:$})},[t]),k=h.useCallback(($,se)=>{i(se),t({action:"onFormStatusChange",data:{isValid:$}})},[t]);return b?C?l.jsx(ol,{node:b,editorMode:e,type:"quml"}):D?l.jsxs("div",{className:Rt.leafContentLayout,children:[l.jsx(ol,{node:b,editorMode:e,type:"content"}),l.jsx(ZE,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(YE,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Rt.container,children:[l.jsx(b1,{crumbs:g}),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&&y&&l.jsx(JE,{nodeId:y,value:String(b.appIcon??((H=b.metadata)==null?void 0:H.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:d,className:Rt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:A,onBlur:A,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(_1,{activeTab:r,onChange:$=>n($),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Rt.formArea,children:l.jsx(lE,{nodeMetadata:_,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:F,onFormStatusChange:k},`${y??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Rt.contentListArea,children:l.jsx(TE,{editorMode:e})}),l.jsx(NE,{isActive:!1,label:"Drop to add content to this unit",nodeId:y??void 0,className:Rt.dropZone}),c&&l.jsx(XE,{contentId:m,onClose:()=>u(!1)})]}):l.jsx("div",{className:Rt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Th(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Th(r.children,t);if(n)return n}}}const Nh=di((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})}})),rO=20;function xh(){var u;const e=be(d=>d.editorConfig),t=Me(d=>d.selectedNodeId),r=Me(d=>d.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function d(f,y,g=0){var _;for(const p of f){if(p.id===y)return g;if((_=p.children)!=null&&_.length){const v=d(p.children,y,g+1);if(v>=0)return v}}return-1}return Math.max(0,d(r,t))},[t,r])(),s=(u=e==null?void 0:e.config)==null?void 0:u.hierarchy;if(!s)return[...Mf];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:[...Mf]}function nO(){const e=Nh(),t=be(f=>{var y,g;return((g=(y=f.editorConfig)==null?void 0:y.context)==null?void 0:g.channel)??""}),r=xh(),n=h.useRef(),s=h.useCallback(async(f="",y="all",g={},_=!0,p=!1)=>{var v,m,b,S,w;e.setLoading(!0);try{const C={status:["Live"],contentType:["Resource"],primaryCategory:y&&y!=="all"?[y]:r};(v=g==null?void 0:g.board)!=null&&v.length&&(C.board=g.board),(m=g==null?void 0:g.medium)!=null&&m.length&&(C.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(C.gradeLevel=g.gradeLevel),(S=g==null?void 0:g.subject)!=null&&S.length&&(C.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(C.primaryCategory=g.primaryCategory);const D=_?0:e.offset,{content:x,count:A}=await xE({filters:C,query:f,limit:f?50:rO,offset:D,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(x,A):e.appendContent(x,A)}catch(C){console.error("[useLibrary] load error:",C)}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]),u=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]),d=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:d,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:u,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const ur={card:"_card_grbmp_1",addBtn:"_addBtn_grbmp_17",dragging:"_dragging_grbmp_24",ctIcon:"_ctIcon_grbmp_29",info:"_info_grbmp_33",name:"_name_grbmp_41",meta:"_meta_grbmp_50",added:"_added_grbmp_78",addedBadge:"_addedBadge_grbmp_87"},sO={video:zo,pdf:Fo,h5p:$o,scorm:Bo,audio:jo,quiz:Mo,default:hn},iO=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=zi(e),o=sO[i.key]??hn,a=qa(),c=a1(),u=a&&!s&&c,{attributes:d,listeners:f,setNodeRef:y,isDragging:g}=Ic({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:y,className:[ur.card,g?ur.dragging:"",s?ur.added:""].join(" "),"aria-label":e.name,...n?{...d,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,ur.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:ur.info,children:[l.jsx("span",{className:ur.name,title:e.name,children:e.name}),l.jsxs("span",{className:ur.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:ur.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(fn,{size:12})}),!s&&l.jsx("button",{type:"button",className:ur.addBtn,onClick:m=>{m.stopPropagation(),u&&t(e)},disabled:!u,"aria-label":`Add ${e.name} to unit`,title:a?"Add to unit":"Only Draft content can be edited",children:l.jsx(cs,{size:14})})]})},kh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},oO=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:kh.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",kh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),Ze={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"},aO=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],lO=new Set(["board","medium","gradeLevel","subject","topic"]),cO=({local:e,toggle:t})=>{const r=xh();return r.length?l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:Ze.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[Ze.chip,(e.primaryCategory??[]).includes(n)?Ze.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},uO=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=be(p=>p.editorConfig),i=be(p=>p.searchFormConfig),{organisationFramework:o}=dh((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=h.useState(t),u=i!=null&&i.length?i.filter(p=>lO.has(p.code)).map(p=>({key:p.code,label:p.label||p.code})):aO;h.useEffect(()=>{c(t)},[t]);const d=(p,v)=>{c(m=>{const b=m[p]??[],S=b.includes(v)?b.filter(w=>w!==v):[...b,v];return{...m,[p]:S}})},f=(o==null?void 0:o.categories)??[],y=p=>{var v;return((v=f.find(m=>m.code===p))==null?void 0:v.terms)??[]};return e?l.jsxs("div",{className:Ze.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:Ze.header,children:[l.jsx("span",{className:Ze.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:Ze.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(jr,{size:16})})]}),l.jsxs("div",{className:Ze.body,children:[u.map(({key:p,label:v})=>{const m=y(p);return m.length?l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionLabel,children:v}),l.jsx("div",{className:Ze.chips,children:m.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[Ze.chip,(a[p]??[]).includes(b.name)?Ze.active:""].join(" "),onClick:()=>d(p,b.name),children:b.name},b.identifier))})]},p):null}),l.jsx(cO,{local:a,toggle:d})]}),l.jsxs("div",{className:Ze.footer,children:[l.jsx("button",{type:"button",className:Ze.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:Ze.applyBtn,onClick:()=>{r(a),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"},dO=({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 Le.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(jr,{size:16})})})]}),l.jsx("div",{className:dr.playerArea,children:l.jsx(ol,{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)},Ae={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 fO(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 hO=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:u,search:d,setFilter:f,applyAdvancedFilters:y,toggleSort:g,loadMore:_}=nO(),{addResource:p,selectedNodeId:v,treeData:m}=Me(),b=e==="edit",[S,w]=h.useState(!1),[C,D]=h.useState({}),[x,A]=h.useState(null),F=h.useMemo(()=>fO(m),[m]),k=h.useCallback($=>{if(!v){Pe.error("Select a unit first");return}p($,v),Pe.success(`Added "${$.name}"`)},[v,p]),P=h.useCallback($=>{D($),y($)},[y]),z=h.useCallback($=>{A($)},[]),M=h.useCallback($=>{k($),A(null)},[k]),H=h.useMemo(()=>Object.values(C).reduce(($,se)=>$+((se==null?void 0:se.length)??0),0),[C]);return l.jsxs("div",{className:Ae.dock,children:[l.jsx("div",{className:Ae.header,children:l.jsxs("div",{className:Ae.headerLeft,children:[l.jsx("button",{type:"button",className:Ae.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(hv,{size:15})}),l.jsx(uv,{size:16}),l.jsx("span",{className:Ae.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ae.count,children:i})]})}),l.jsxs("div",{className:Ae.searchRow,children:[l.jsxs("div",{className:Ae.searchWrap,children:[l.jsx(Vo,{size:14,className:Ae.searchIcon}),l.jsx("input",{type:"search",className:Ae.searchInput,placeholder:"Search content…",value:a,onChange:$=>d($.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ae.filterToggleBtn,c?Ae.filterToggleBtnActive:""].join(" "),onClick:g,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(rv,{size:15}):l.jsx(iv,{size:15})}),l.jsxs("button",{type:"button",className:[Ae.filterToggleBtn,S?Ae.filterToggleBtnActive:""].join(" "),onClick:()=>w($=>!$),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(bv,{size:15}),H>0&&l.jsx("span",{className:Ae.filterBadge,children:H})]})]}),l.jsx("div",{className:Ae.filters,children:l.jsx(oO,{filters:l1,active:o,onChange:f})}),l.jsxs("div",{className:Ae.mainArea,children:[l.jsx("div",{className:Ae.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map(($,se)=>l.jsxs("div",{className:Ae.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ae.skeletonIcon}),l.jsxs("div",{className:Ae.skeletonText,children:[l.jsx("div",{className:Ae.skeletonLine}),l.jsx("div",{className:Ae.skeletonLineSm})]})]},se)):n.length>0?l.jsxs(l.Fragment,{children:[n.map($=>l.jsx(iO,{item:$,onAdd:k,onPreview:z,isDraggable:b,isAdded:F.has($.identifier)},$.identifier)),u&&l.jsx("button",{type:"button",className:Ae.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ae.emptyState,children:[l.jsx(Vo,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:Ae.sidePanelOverlay,children:l.jsx(uO,{isOpen:S,filters:C,onApply:P,onClose:()=>w(!1)})}),x&&l.jsx(dO,{content:x,onAdd:M,onClose:()=>A(null)})]})]})};function pO(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","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","medium","gradeLevel","subject","additionalCategories","keywords","language"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function u(y,g=!1){const _={};for(const[p,v]of Object.entries(y))if(!i.has(p)&&!(g&&o.has(p)))if(a.has(p))Array.isArray(v)?_[p]=v:v!=null&&v!==""?_[p]=[v]:_[p]=[];else if(c.has(p)){const m=Number(v);isNaN(m)||(_[p]=m)}else _[p]=v;return _}function d(y){var _;const g={};for(const p of y.children??[]){if(p.isFolder)continue;const v=t[p.identifier];if(!v)continue;const{isNew:m,...b}=v;if(Object.keys(b).length===0)continue;const S=((_=p.metadata)==null?void 0:_.relationalMetadata)??{};g[p.identifier]={name:p.name,...S,...b}}return g}function f(y,g){var S,w;const _=y.identifier,p=t[_],v=_.startsWith("temp-")||!!(p!=null&&p.isNew),m=!y.isFolder&&!g;if(g||v||p&&!m){let C;if(v)C={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((S=y.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=y.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:y.name,visibility:"Parent",channel:r,...u(y.metadata??{})};else if(g){const{isNew:D,...x}=p??{};C={...u(y.metadata??{},!0),...u(x,!1),name:y.name}}else{const{isNew:D,...x}=p??{};C={name:y.name,visibility:"Parent",...u(x,!0)}}n[_]={metadata:C,objectType:y.objectType||(y.isFolder?"Collection":"Content"),root:g,isNew:v}}const b=y.isFolder?d(y):{};s[_]={name:y.name,children:(y.children??[]).map(C=>C.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(y.children??[]).forEach(C=>f(C,!1))}return e.forEach((y,g)=>f(y,g===0)),{nodesModified:n,hierarchy:s}}function gO(){const[e,t]=h.useState(!1),r=Me(u=>u.treeCache),n=Me(u=>u.treeData),s=be(u=>u.isDirty),{setIsDirty:i,setLastSaved:o}=be(),a=be(u=>u.editorConfig);return{save:h.useCallback(async()=>{if(!a||e)return;const u=a.context.contentId??a.context.identifier??"";if(!u)return;const d=a.context.channel??"",f=a.context.userId??a.context.uid??"";t(!0);try{const{nodesModified:y,hierarchy:g}=pO(n,r,d);await Mb(u,y,g,f);const _=new Date().toISOString();o(_),i(!1)}catch(y){console.error("[useSaveHierarchy] save failed:",y),Pe.error("Failed to save. Please try again.")}finally{t(!1)}},[a,e,n,r,i,o]),isSaving:e,isDirty:s,lastSaved:be.getState().lastSaved}}function yO(e){const t=be(s=>s.editorConfig),r=be(s=>s.setButtonLoader);return{runAction:h.useCallback(async(s,i)=>{var c,u,d,f;const o=((c=t==null?void 0:t.context)==null?void 0:c.contentId)??((u=t==null?void 0:t.context)==null?void 0:u.identifier)??"";if(!o)return Pe.error("No content identifier found."),!1;const a=((d=t==null?void 0:t.context)==null?void 0:d.userId)??((f=t==null?void 0:t.context)==null?void 0:f.uid)??"";try{switch(s){case"sendForReview":return r("saveCollection",!0),await e(),await $b(o),Pe.success("Content sent for review"),!0;case"reject":{r("rejectCollection",!0);const y=(i==null?void 0:i.comment)??"";return await jb(o,y),Pe.success("Content rejected and sent back to the author"),!0}case"publish":return r("publishCollection",!0),await e(),await Lb(o,a),Pe.success("Content published successfully"),!0;default:return!1}}catch(y){console.error(`[useToolbarActions] ${s} failed`,y);const g=s==="sendForReview"?"send for review":s==="reject"?"reject":"publish";return Pe.error(`Failed to ${g}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const At={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"},vO=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,u]=h.useState(!1),[d,f]=h.useState(!1),{addResource:y,treeData:g}=Me(),_=Me(k=>k.selectedNodeId),{save:p,isSaving:v,isDirty:m,lastSaved:b}=gO(),{runAction:S}=yO(p);h.useEffect(()=>{if(!m)return;const k=P=>{P.preventDefault(),P.returnValue=""};return window.addEventListener("beforeunload",k),()=>window.removeEventListener("beforeunload",k)},[m]);const w=Yl(Co(si,{activationConstraint:{distance:8}})),C=h.useCallback(k=>{var z;const P=(z=k.active.data.current)==null?void 0:z.item;P&&i(P)},[]),D=h.useCallback(k=>{var $,se;i(null);const P=($=k.active.data.current)==null?void 0:$.item;if(!P)return;const z=k.over,M=(z==null?void 0:z.id)??_??void 0;if(!M){Pe.error("Drop onto a unit to add content");return}const H=(se=g[0])==null?void 0:se.id;if(M===H){Pe.error("Drop content onto a unit, not directly on the course.");return}y(P,M),r==null||r(P,M),Pe.success(`Added "${P.name}" to unit`)},[_,y,r]),x=h.useCallback(async k=>{if(k.action==="back"&&m){f(!0);return}if(k.action==="saveCollection"){await p(),n==null||n(g),t==null||t(k);return}if(k.action==="sendForReview"||k.action==="reject"||k.action==="publish"){await S(k.action,k.data)&&(t==null||t(k));return}t==null||t(k)},[p,S,t,n,g,m]),A=h.useCallback(async()=>{await p(),f(!1),n==null||n(g),t==null||t({action:"back"})},[p,n,t,g]),F=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Oc,{sensors:w,onDragStart:C,onDragEnd:D,children:[l.jsxs("div",{className:At.shell,children:[l.jsx(Qb,{editorMode:e,isSaving:v,isDirty:m,lastSaved:b,onToolbarEvent:x}),l.jsxs("div",{className:[At.workspace,o?At.sidebarCollapsed:"",c?At.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[At.outline,o?At.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(m1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(k=>!k)})}),o&&l.jsx("button",{className:At.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:At.editor,role:"main","aria-label":"Content editor",children:l.jsx(tO,{editorMode:e,onToolbarEvent:x})}),l.jsx("aside",{className:[At.dock,c?At.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(hO,{editorMode:e,collapsed:c,onToggleCollapse:()=>u(k=>!k)})}),c&&l.jsx("button",{className:At.dockReopenTab,onClick:()=>u(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Xy,{dropAnimation:null,children:s?l.jsx("div",{className:At.dragChip,children:l.jsx("span",{className:At.dragChipLabel,children:s.name})}):null}),d&&l.jsx(Yb,{onSave:A,onDiscard:F,onCancel:()=>f(!1),isSaving:v})]})},mO="v4";function bO(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 Ah(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:bO(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 Dr(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.title??n.name??void 0;for(const i of n.fields)i.code&&r.push(Ah(i,s))}else n.code&&r.push(Ah(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function _O(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 wO(e,t,r="Collection"){var c,u;const s=(u=(c=(await Fe.post(`/action/object/category/definition/${mO}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:c.result)==null?void 0:u.objectCategoryDefinition,i=(s==null?void 0:s.forms)??{},o=(s==null?void 0:s.objectMetadata)??{},a=o.config??{};return{rootForm:Dr(i.create),unitForm:Dr(i.unitMetadata),childForm:Dr(i.childMetadata),searchForm:Dr(i.search??i.searchConfig),relationalForm:Dr(i.relationalMetadata),publishChecklist:Dr(i.publishchecklist),reviewChecklist:Dr(i.review),rfcChecklist:Dr(i.requestforchangeschecklist),schemaDefaults:_O(o.schema),frameworkMetadata:a.frameworkMetadata??{},sourcingSettings:a.sourcingSettings??{}}}function SO({config:e,onError:t}){const[r,n]=h.useState(!0),[s,i]=h.useState(null),[o,a]=h.useState(!1),{setEditorConfig:c,setEditorMode:u,setCategoryDefinition:d}=be(),{setTreeData:f,selectNode:y}=Me();return h.useEffect(()=>{let g=!1;async function _(){var p,v;try{n(!0),i(null),e.apiBaseUrl&&Bu(e.apiBaseUrl),c(e),u(e.config.mode);const m=e.context.contentId??e.context.identifier??"";if(m){const{rootNode:b}=await zu(m);g||(f(b?[b]:[]),b&&y(b.id));const S=e.config.primaryCategory??"Course",w=e.context.channel??"";try{const C=await wO(S,w,e.config.objectType??"Collection");if(!g){d(C);const D=(v=(p=C.sourcingSettings)==null?void 0:p.collection)==null?void 0:v.maxDepth;D&&!e.config.maxDepth&&c({...e,config:{...e.config,maxDepth:D}})}}catch{}}g||a(!0)}catch(m){if(!g){const b=m instanceof Error?m:new Error(String(m));i(b),t==null||t(b)}}finally{g||n(!1)}}return _(),()=>{g=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Ns={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},CO=new Cp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class EO 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:Ns.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 OO(e){const{isLoading:t,error:r}=SO({config:e,onError:e.onError}),n=be(s=>s.editorMode);return t?l.jsxs("div",{className:Ns.loadingState,children:[l.jsx("div",{className:Ns.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:Ns.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${Ns.root}`,children:l.jsx(vO,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Ph=e=>l.jsx(EO,{onError:e.onError,children:l.jsxs(Op,{client:CO,children:[l.jsx(OO,{...e}),l.jsx(Eg,{position:"top-right",toastOptions:{duration:3e3}})]})}),Zi=Symbol.for("r2wc.reactRender"),Mh=Symbol.for("r2wc.shouldRender"),Ji=Symbol.for("r2wc.root");function DO(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function IO(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Lh={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Zi]()}}),e[Zi]()}};function TO(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var u=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?u.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.'),u.attachShadow({mode:"open"})),u},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(u,d){return d in e.propTypes||d in a},set:function(u,d,f,y){return i&&(s[d]=!0),typeof d=="symbol"||s[d]||d in u?(e.propTypes&&d in e.propTypes&&Lh.expando(y,d,f),Reflect.set(u,d,f,y)):(Lh.expando(y,d,f),!0)},getOwnPropertyDescriptor:function(u,d){var f=Reflect.getOwnPropertyDescriptor(u,d);if(f)return f;if(d in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Mh]=!0,this[Zi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[Ji].unmount():r.unmountComponentAtNode(this)},a[Zi]=function(){if(this[Mh]===!0){var u={};Object.keys(this).forEach(function(y){s[y]!==!1&&(u[y]=this[y])},this),i=!0;const d=n.shadow?this.shadowRoot:this,f=t.createElement(e,u);typeof r.createRoot=="function"?(this[Ji]||(this[Ji]=r.createRoot(d)),this[Ji].render(f)):r.render(f,d),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return DO(u)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(u,d,f){var y=n.dashStyleAttributes?IO(u):u;this[y]=f}),o}var xs={},ks=Le;if(process.env.NODE_ENV==="production")xs.createRoot=ks.createRoot,xs.hydrateRoot=ks.hydrateRoot;else{var eo=ks.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;xs.createRoot=function(e,t){eo.usingClientEntryPoint=!0;try{return ks.createRoot(e,t)}finally{eo.usingClientEntryPoint=!1}},xs.hydrateRoot=function(e,t,r){eo.usingClientEntryPoint=!0;try{return ks.hydrateRoot(e,t,r)}finally{eo.usingClientEntryPoint=!1}}}function NO(){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 xO(e="sb-collection-editor"){if(NO(),typeof customElements>"u"||customElements.get(e))return;const t=TO(Ph,h,xs,{});customElements.define(e,t)}pe.CollectionEditor=Ph,pe.registerCollectionEditor=xO,pe.setApiBaseUrl=Bu,pe.useEditorStore=be,pe.useLibraryStore=Nh,pe.useTreeStore=Me,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});
464
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GC(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 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 YC(e){if(Array.isArray(e))return e}function RC(e){var t=Hr(),r=t.getMonitor(),n=Zd(r,e),s=WC(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 of(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function XC(e,t){return e.filter(function(r){return r!==t})}function ZC(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 JC(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 t0(e,t,r){return t&&e0(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 r0=function(){function e(t){JC(this,e),af(this,"entered",[]),af(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return t0(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=ZC(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=XC(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),n0=of(function(){return/firefox/i.test(navigator.userAgent)}),lf=of(function(){return!!window.safari});function s0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o0(e,t,r){return t&&i0(e.prototype,t),e}function _s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cf=function(){function e(t,r){s0(this,e),_s(this,"xs",void 0),_s(this,"ys",void 0),_s(this,"c1s",void 0),_s(this,"c2s",void 0),_s(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,u,d=0;d<n-1;d++)c=t[d+1]-t[d],u=r[d+1]-r[d],o.push(c),a.push(u/c);for(var f=[a[0]],y=0;y<o.length-1;y++){var g=a[y],_=a[y+1];if(g*_<=0)f.push(0);else{c=o[y];var p=o[y+1],v=c+p;f.push(3*v/((v+p)/g+(v+c)/_))}}f.push(a[a.length-1]);for(var m=[],b=[],S,w=0;w<f.length-1;w++){S=a[w];var O=f[w],I=1/o[w],k=O+f[w+1]-S-S;m.push((S-O-k)*I),b.push(k*I*I)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=m,this.c3s=b}return o0(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 u=0,d=a.length-1,f;u<=d;){f=Math.floor(.5*(u+d));var y=n[f];if(y<r)u=f+1;else if(y>r)d=f-1;else return s[f]}c=Math.max(0,d);var g=r-n[c],_=g*g;return s[c]+i[c]*g+o[c]*_+a[c]*g*_}}]),e}(),a0=1;function uf(e){var t=e.nodeType===a0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function ji(e){return{x:e.clientX,y:e.clientY}}function l0(e){var t;return e.nodeName==="IMG"&&(n0()||!((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 lf()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function u0(e,t,r,n,s){var i=l0(t),o=i?e:t,a=uf(o),c={x:r.x-a.x,y:r.y-a.y},u=e.offsetWidth,d=e.offsetHeight,f=n.anchorX,y=n.anchorY,g=c0(i,t,u,d),_=g.dragPreviewWidth,p=g.dragPreviewHeight,v=function(){var k=new cf([0,.5,1],[c.y,c.y/d*p,c.y+p-d]),P=k.interpolate(y);return lf()&&i&&(P+=(window.devicePixelRatio-1)*p),P},m=function(){var k=new cf([0,.5,1],[c.x,c.x/u*_,c.x+_-u]);return k.interpolate(f)},b=s.offsetX,S=s.offsetY,w=b===0||b,O=S===0||S;return{x:w?b:m(),y:O?S:v()}}var df="__NATIVE_FILE__",ff="__NATIVE_URL__",hf="__NATIVE_TEXT__",pf="__NATIVE_HTML__";const gf=Object.freeze(Object.defineProperty({__proto__:null,FILE:df,HTML:pf,TEXT:hf,URL:ff},Symbol.toStringTag,{value:"Module"}));function Ma(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var Tn;function Bi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var La=(Tn={},Bi(Tn,df,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Bi(Tn,pf,{exposeProperties:{html:function(t,r){return Ma(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Bi(Tn,ff,{exposeProperties:{urls:function(t,r){return Ma(t,r,"").split(`
465
+ `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Bi(Tn,hf,{exposeProperties:{text:function(t,r){return Ma(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),Tn);function d0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h0(e,t,r){return t&&f0(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 p0=function(){function e(t){d0(this,e),yf(this,"item",void 0),yf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return h0(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 g0(e,t){var r=new p0(La[e]);return r.loadDataTransfer(t),r}function Fa(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(La).filter(function(r){var n=La[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function y0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m0(e,t,r){return t&&v0(e.prototype,t),e}function $a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b0=function(){function e(t,r){y0(this,e),$a(this,"ownerDocument",null),$a(this,"globalContext",void 0),$a(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return m0(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 vf(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 mf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vf(Object(r),!0).forEach(function(n){fe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}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 fe(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,n){var s=this;_0(this,e),fe(this,"options",void 0),fe(this,"actions",void 0),fe(this,"monitor",void 0),fe(this,"registry",void 0),fe(this,"enterLeaveCounter",void 0),fe(this,"sourcePreviewNodes",new Map),fe(this,"sourcePreviewNodeOptions",new Map),fe(this,"sourceNodes",new Map),fe(this,"sourceNodeOptions",new Map),fe(this,"dragStartSourceIds",null),fe(this,"dropTargetIds",[]),fe(this,"dragEnterTargetIds",[]),fe(this,"currentNativeSource",null),fe(this,"currentNativeHandle",null),fe(this,"currentDragSourceNode",null),fe(this,"altKeyPressed",!1),fe(this,"mouseMoveTimeoutTimer",null),fe(this,"asyncEndDragFrameId",null),fe(this,"dragOverTargetIds",null),fe(this,"lastClientOffset",null),fe(this,"hoverRafId",null),fe(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&uf(o)||null}),fe(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),fe(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),fe(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),fe(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=ji(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,u=Fa(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var d=s.monitor.getSourceId(),f=s.sourceNodes.get(d),y=s.sourcePreviewNodes.get(d)||f;if(y){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,p=g.anchorY,v=g.offsetX,m=g.offsetY,b={anchorX:_,anchorY:p},S={offsetX:v,offsetY:m},w=u0(f,y,a,b,S);c.setDragImage(y,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var O=s.getCurrentSourcePreviewNodeOptions(),I=O.captureDraggingState;I?s.actions.publishDragSource():setTimeout(function(){return s.actions.publishDragSource()},0)}else if(u)s.beginDragNativeItem(u);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),fe(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),fe(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Fa(a);c&&s.beginDragNativeItem(c,a)}}),fe(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:ji(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),fe(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),fe(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=ji(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"))}),fe(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),fe(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 Fa(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),fe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:ji(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),fe(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 b0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new r0(this.isNodeInDocument)}return S0(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(u){return i.handleDragStart(u,r)},a=function(u){return i.handleSelectStart(u)};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(u){return s.handleDragEnter(u,r)},o=function(u){return s.handleDragOver(u,r)},a=function(u){return s.handleDrop(u,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 mf({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 mf({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(gf).some(function(n){return gf[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=g0(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}(),Vi;function O0(){return Vi||(Vi=new Image,Vi.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Vi}var E0=function(t,r,n){return new C0(t,r,n)};function D0(e,t){return typeof e=="function"?e(t):e??"NODE"}function I0(e){return e.isDraggable&&!e.isEditing}function T0(e){const t=Ct(),r=t.selectedIds,[n,s,i]=NC(()=>({canDrag:()=>I0(e),type:D0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Cn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Cn.dragEnd())}}),[r,e,t.props.dragType]);return h.useEffect(()=>{i(O0())},[i]),s}function N0(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,u=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:u,atTop:!u&&o,atBottom:!u&&a}}function x0(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 Ui(e,t){return{parentId:e||null,index:t}}function Nn(e,t){return{type:"line",index:e,level:t}}function k0(e){return{type:"highlight",id:e}}function ja(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=Ju(n)+1;return{parentId:s,index:i}}function bf(e){var t;const r=N0(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,u]=x0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Ui(i.id,null),cursor:k0(i.id)};if(!c)return{drop:Ui((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:Nn(0,0)};if(Yu(c)){const d=Ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:ja(c,d),cursor:Nn(c.rowIndex+1,d)}}if(Ru(c)){const d=Ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:ja(c,d),cursor:Nn(c.rowIndex+1,d)}}if(Xu(c)){const d=Ci(s,0,c.level+1);return d>c.level?{drop:Ui(c.id,0),cursor:Nn(c.rowIndex+1,d)}:{drop:ja(c,d),cursor:Nn(c.rowIndex+1,d)}}return{drop:Ui(c==null?void 0:c.id,0),cursor:Nn(c.rowIndex+1,c.level+1)}}function A0(e,t){const r=Ct(),[n,s]=nf(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:u}=bf({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Cn.hovering(u.parentId,u.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 P0(e){const t=Ct(),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 _f=h.memo(function({index:t,style:r}){Qu(),Xb();const n=Ct(),s=P0(t),i=h.useRef(null),o=T0(s),a=A0(i,s),c=h.useCallback(p=>{i.current=p,a(p)},[a]),u=n.indent*s.level,d=h.useMemo(()=>({paddingLeft:u}),[u]),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]),y={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 g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:y,children:l.jsx(g,{node:s,tree:n,style:d,dragHandle:o})})});let Ba="",wf=null;function Sf(){Qu();const e=Ct();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(),ed(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),td(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(wf),Ba+=t.key,wf=setTimeout(()=>{Ba=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Ba):!1});n&&e.focus(n.id)},children:l.jsx(M0,{})})}function M0(){var e,t;const r=Ct(),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:B_,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:z_,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(L_,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:_f})):l.jsx(F_,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:_f}))}function Cf(e){return e.isFiltered?F0(e.root,e.isMatch.bind(e)):L0(e.root)}function L0(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(Of),t}function F0(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(Of),n}function Of(e,t){e.rowIndex=t}const Ef=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Va=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(d){try{u(n.next(d))}catch(f){o(f)}}function c(d){try{u(n.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):s(d.value).then(a,c)}u((n=n.apply(e,t||[])).next())})};const{safeRun:dt}=r_;class ws{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=od(this),this.visibleNodes=Cf(this),this.idToIndex=Ef(this.visibleNodes)}update(t){this.props=t,this.root=od(this),this.visibleNodes=Cf(this),this.idToIndex=Ef(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=ys(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=ys(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 ms)return t.id;const r=this.props.idAccessor||"id";return ys(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 Va(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?id(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:sd(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield dt(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 Va(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 dt(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(ha(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=>{ws.editPromise=i})}submit(t,r){return Va(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield dt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(ha(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(ha(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&dt(this.props.onActivate,r)}resolveEdit(t){const r=ws.editPromise;r&&r(t),ws.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(wn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&dt(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(wn(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&&dt(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(Cr.remove(r)),dt(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(wn(n.id)),n.isSelectable&&(this.dispatch(Cr.add(n.id)),this.dispatch(Cr.anchor(n.id)),this.dispatch(Cr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&dt(this.props.onFocus,this.focusedNode),dt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(wn(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(Cr.remove(this.nodesBetween(s,i))),this.dispatch(Cr.add(o)),this.dispatch(Cr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&dt(this.props.onFocus,this.focusedNode),dt(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(wn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&dt(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(Cr.set({ids:n,anchor:s,mostRecent:i})),dt(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&&Zu(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;dt(this.props.onMove,{dragIds:n,parentId:t===vs?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Cn.cursor({type:"none"}))}showCursor(t){this.dispatch(Cn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(pa.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),dt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(pa.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),dt(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=fa(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(){Oi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Oi(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),nd(()=>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===vs)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!ys(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(wn(t.id))}onBlur(){this.dispatch(f_())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Sf}get renderRow(){return this.props.renderRow||a_}get renderNode(){return this.props.children||l_}get renderDragPreview(){return this.props.renderDragPreview||ld}get renderCursor(){return this.props.renderCursor||o_}}function ft(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 $0=typeof Symbol=="function"&&Symbol.observable||"@@observable",Df=$0,Ua=()=>Math.random().toString(36).substring(7).split("").join("."),j0={INIT:`@@redux/INIT${Ua()}`,REPLACE:`@@redux/REPLACE${Ua()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ua()}`},Wr=j0;function If(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 B0(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(z0(e))return"date";if(U0(e))return"error";const r=V0(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 V0(e){return typeof e.constructor=="function"?e.constructor.name:null}function U0(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function z0(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Or(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=B0(e)),t}function Tf(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?ft(2):`Expected the root reducer to be a function. Instead, received: '${Or(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?ft(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"?ft(1):`Expected the enhancer to be a function. Instead, received: '${Or(r)}'`);return r(Tf)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function u(){o===i&&(o=new Map,i.forEach((v,m)=>{o.set(m,v)}))}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?ft(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"?ft(4):`Expected the listener to be a function. Instead, received: '${Or(v)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?ft(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;u();const b=a++;return o.set(b,v),function(){if(m){if(c)throw new Error(process.env.NODE_ENV==="production"?ft(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,u(),o.delete(b),i=null}}}function y(v){if(!If(v))throw new Error(process.env.NODE_ENV==="production"?ft(7):`Actions must be plain objects. Instead, the actual type was: '${Or(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"?ft(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"?ft(17):`Action "type" property must be a string. Instead, the actual type was: '${Or(v.type)}'. Value was: '${v.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?ft(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,v)}finally{c=!1}return(i=o).forEach(b=>{b()}),v}function g(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?ft(10):`Expected the nextReducer to be a function. Instead, received: '${Or(v)}`);n=v,y({type:Wr.REPLACE})}function _(){const v=f;return{subscribe(m){if(typeof m!="object"||m===null)throw new Error(process.env.NODE_ENV==="production"?ft(11):`Expected the observer to be an object. Instead, received: '${Or(m)}'`);function b(){const w=m;w.next&&w.next(d())}return b(),{unsubscribe:v(b)}},[Df](){return this}}}return y({type:Wr.INIT}),{dispatch:y,subscribe:f,getState:d,replaceReducer:g,[Df]:_}}function Nf(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===Wr.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(!If(e))return`The ${i} has unexpected type of "${Or(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===Wr.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 H0(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Wr.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?ft(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:Wr.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?ft(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Wr.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 xf(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"&&Nf(`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{H0(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&&Nf(f)}let u=!1;const d={};for(let f=0;f<n.length;f++){const y=n[f],g=r[y],_=a[y],p=g(_,c);if(typeof p>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ft(14):`When called with an action of type ${v?`"${String(v)}"`:"(unknown type)"}, the slice reducer for key "${y}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}d[y]=p,u=u||p!==_}return u=u||n.length!==Object.keys(a).length,u?d:a}}function W0(e=Sn().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 K0=xf({nodes:xf({focus:h_,edit:d_,open:p_,selection:g_,drag:W0}),dnd:y_}),G0=Sn();function Q0({treeProps:e,imperativeHandle:t,children:r}){const n=h.useRef(null),s=h.useRef(null),i=h.useRef(Tf(K0,Sn(e))),o=Rb.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>G0),a=h.useMemo(()=>new ws(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(pa.clear(!0))},[a.props.searchTerm]),l.jsx(Hu.Provider,{value:a,children:l.jsx(Gu.Provider,{value:c.current,children:l.jsx(Wu.Provider,{value:o.nodes,children:l.jsx(Ku.Provider,{value:o.dnd,children:l.jsx(ES,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||E0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function Y0(){const e=Ct(),[,t]=nf(()=>({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}=bf({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Cn.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 R0(e){return Y0(),e.children}function X0(){const t=Ct().props.renderContainer||Sf;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function Z0(){const e=Ct(),{offset:t,mouse:r,item:n,isDragging:s}=RC(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||ld;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 J0(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 e1{constructor(t,r={}){this.accessors=J0(r),this.root=t1(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 t1(e,t){const r=new kf({},null,t,"ROOT");return r.children=e.map(n=>za(n,r,t)),r}function za(e,t,r){const n=new kf(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>za(i,n,r))),n}class kf{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=za(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 r1=0;function n1(e,t={}){const[r,n]=h.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=h.useMemo(()=>new e1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const p of _.dragIds)o.move({id:p,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:p})=>{o.update({id:p,changes:{name:_}}),n(o.data)},u=typeof s=="string"?s:"id",d=typeof i=="string"?i:"children";return[r,{onMove:a,onRename:c,onCreate:({parentId:_,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={[u]:`simple-tree-id-${r1++}`,name:""};return v==="internal"&&(m[d]=[]),o.create({parentId:_,index:p,data:m}),n(o.data),m},onDelete:_=>{_.ids.forEach(p=>o.drop({id:p})),n(o.data)}}]}function s1(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]=n1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function i1(e,t){const r=s1(e);return l.jsxs(Q0,{treeProps:r,imperativeHandle:t,children:[l.jsx(R0,{children:l.jsx(X0,{})}),l.jsx(Z0,{})]})}const o1=h.forwardRef(i1);function qa(){return Pe(e=>{var n;const t=e.treeData[0];return(((n=t==null?void 0:t.metadata)==null?void 0:n.status)??(t==null?void 0:t.status)??"Draft").toLowerCase()==="draft"})}function a1(){return Pe(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const Af={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Pf={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},Mf=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],l1=[{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 zi(e){const t=c1(e);return{key:t,color:Af[t]??Af.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Pf[t]??Pf.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const Ot={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"},u1={video:zo,pdf:Fo,h5p:$o,scorm:Bo,audio:jo,quiz:Mo,default:hn},d1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=h.useState(!1),[o,a]=h.useState(!1),[c,u]=h.useState(e.data.name),d=h.useRef(null),f=n==="edit",y=qa(),g=zi(e.data),_=u1[g.key]??hn,p=e.isSelected,v=e.level===0,m=e.data.isFolder??(e.children&&e.children.length>0),b=v?nv:m?lv:_;h.useEffect(()=>{if(!s)return;const O=I=>{var k;(k=d.current)!=null&&k.contains(I.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"&&(u(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[Ot.row,p?Ot.selected:"",e.state.isOver&&m?Ot.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:Ot.grip,"aria-hidden":"true",children:l.jsx(Lc,{size:14})}),l.jsx("button",{className:Ot.toggle,onClick:O=>{O.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:m?"visible":"hidden"},children:e.isClosed?l.jsx(kc,{size:14}):l.jsx(ls,{size:14})}),l.jsx("span",{className:`${Ot.ctIcon} ${v||m?Ot.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:Ot.renameInput,value:c,autoFocus:!0,onChange:O=>u(O.target.value),onBlur:S,onKeyDown:w,onClick:O=>O.stopPropagation()}):l.jsx("span",{className:Ot.title,onDoubleClick:()=>f&&a(!0),children:e.data.name}),e.state.isOver&&m&&l.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ot.menuWrap,ref:d,children:[l.jsx("button",{className:Ot.menuBtn,onClick:O=>{O.stopPropagation(),i(I=>!I)},"aria-label":"Node options",children:l.jsx(Pc,{size:14})}),s&&l.jsxs("div",{className:Ot.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(pv,{size:13})," Rename"]}),m&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Mc,{size:13})," Add sub-unit"]}),e.data.parent&&y&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(cs,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Uo,{size:13})," Delete"]})]})]})]})};async function f1(e,t){var i,o;const n=((i=(await $e.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 h1(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 p1(e,t){var a;const r=await f1(e,t.name),n=await h1(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await $e.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function g1(e){var r;return((r=(await $e.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Lf(e){var n,s,i;const r=(i=(s=(n=(await $e.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 y1(e){return Lf(e)}const Oe={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"},v1=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,u]=h.useState("idle"),[d,f]=h.useState(""),[y,g]=h.useState([]),[_,p]=h.useState(null),v=h.useRef(null),m=h.useRef(null),b=h.useCallback(()=>{m.current!==null&&(clearInterval(m.current),m.current=null)},[]);h.useEffect(()=>()=>b(),[b]);const S=T=>T.name.toLowerCase().endsWith(".csv")?T.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=h.useCallback(T=>{f(""),g([]),p(null),u("idle"),S(T)&&i(T)},[]),O=h.useCallback(T=>{T.preventDefault(),a(!1);const A=T.dataTransfer.files[0];A&&w(A)},[w]),I=h.useCallback(T=>{var F;const A=(F=T.target.files)==null?void 0:F[0];A&&w(A),T.target.value=""},[w]),k=h.useCallback(async()=>{try{const T=await y1(e),A=document.createElement("a");A.href=T,A.download="sample_hierarchy.csv",A.target="_blank",A.click()}catch{f("Failed to download sample CSV.")}},[e]),P=h.useCallback(async()=>{if(s){u("uploading"),f(""),g([]);try{const{processId:T}=await p1(e,s);if(!T){u("done"),p(null),setTimeout(t,1500);return}u("processing"),m.current=setInterval(async()=>{try{const A=await g1(T);A.status==="COMPLETED"?(b(),u("done"),p(A.successCount??null),A.failedRecords&&A.failedRecords.length>0?g(A.failedRecords):setTimeout(t,1500)):A.status==="FAILED"&&(b(),u("error"),f("Upload processing failed. Please check the error rows below."),A.failedRecords&&g(A.failedRecords))}catch{b(),u("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{u("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),$={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Oe.container,children:[l.jsxs("div",{className:Oe.header,children:[l.jsx("h2",{className:Oe.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Oe.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Oe.body,children:[l.jsxs("div",{className:`${Oe.dropZone} ${o?Oe.dragOver:""} ${s?Oe.hasFile:""}`,onDragEnter:T=>{T.preventDefault(),a(!0)},onDragOver:T=>{T.preventDefault(),a(!0)},onDragLeave:T=>{T.preventDefault(),a(!1)},onDrop:O,onClick:()=>{var T;return(T=v.current)==null?void 0:T.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:T=>{var A;return T.key==="Enter"&&((A=v.current)==null?void 0:A.click())},children:[l.jsx("input",{ref:v,type:"file",accept:".csv",className:Oe.hiddenInput,onChange:I,"aria-hidden":"true"}),s?l.jsxs("div",{className:Oe.fileInfo,children:[l.jsx("span",{className:Oe.fileIcon,children:"📄"}),l.jsx("span",{className:Oe.fileName,children:s.name}),l.jsxs("span",{className:Oe.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Oe.dropHint,children:[l.jsx("span",{className:Oe.dropIcon,children:"⬆️"}),l.jsx("p",{className:Oe.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Oe.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Oe.sampleLink,onClick:k,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Oe.statusBar} ${Oe[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Oe.spinner,"aria-hidden":"true"}),$[c],c==="done"&&_!==null&&l.jsxs("span",{className:Oe.successDetail,children:[" — ",_," item(s) imported"]})]}),d&&l.jsx("p",{className:Oe.errorMsg,role:"alert",children:d}),y.length>0&&l.jsxs("div",{className:Oe.failedSection,children:[l.jsxs("h4",{className:Oe.failedTitle,children:["Failed Rows (",y.length,")"]}),l.jsx("div",{className:Oe.tableWrap,children:l.jsxs("table",{className:Oe.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:y.map((T,A)=>l.jsxs("tr",{children:[l.jsx("td",{children:T.rowNumber??A+1}),l.jsx("td",{children:T.name??"—"}),l.jsx("td",{className:Oe.reasonCell,children:T.reason??"Unknown error"})]},A))})]})})]})]}),l.jsxs("div",{className:Oe.footer,children:[l.jsx(De,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(De,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:P,children:c==="done"?"Uploaded":"Upload"})]})]})},er={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"},m1=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var K;const n=h.useRef(null),s=h.useRef(null),i=h.useRef(null),[o,a]=h.useState(400),[c,u]=h.useState(!1),[d,f]=h.useState(!1),[y,g]=h.useState("create"),{treeData:_,selectedNodeId:p,selectNode:v,addNode:m,deleteNode:b,reorderChildren:S,setTreeData:w}=Pe(),O=e==="edit",I=qa(),k=O&&I,P=(((K=_[0])==null?void 0:K.children)??[]).some(z=>z.isFolder),$=be(z=>{var X,B,G,Z;return((B=(X=z.editorConfig)==null?void 0:X.context)==null?void 0:B.contentId)??((Z=(G=z.editorConfig)==null?void 0:G.context)==null?void 0:Z.identifier)??""});h.useEffect(()=>{const z=s.current;if(!z)return;const X=new ResizeObserver(()=>{a(z.clientHeight||400)});return X.observe(z),a(z.clientHeight||400),()=>X.disconnect()},[]),h.useEffect(()=>{if(!c)return;const z=X=>{var B;(B=i.current)!=null&&B.contains(X.target)||u(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[c]);const T=h.useCallback(z=>{z.length>0&&v(z[0].data.id)},[v]),A=h.useCallback(({parentId:z,index:X,dragIds:B})=>{if(!z)return;const G=B[0],Z=Ff(_,z);if(!(Z!=null&&Z.children))return;const ve=Z.children.findIndex(Te=>Te.id===G);ve<0||S(z,ve,X>ve?X-1:X)},[_,S]),F=h.useCallback(({ids:z})=>{z.forEach(X=>b(X))},[b]),M=h.useCallback(({parentId:z})=>{var G;const X=z??((G=_[0])==null?void 0:G.id)??"";if(!X)return{id:crypto.randomUUID()};const B=m(X,"unit");return B?{id:B}:(Le.error("Maximum depth reached"),{id:crypto.randomUUID()})},[m,_]),V=h.useCallback(()=>{var X;const z=(X=_[0])==null?void 0:X.id;z&&(m(z,"unit")||Le.error("Maximum depth reached"))},[_,m]),j=h.useCallback(()=>{p&&(m(p,"subunit")||Le.error("Maximum depth reached"))},[p,m]),re=h.useCallback(async()=>{if(u(!1),!!$)try{const z=await Lf($),X=await fetch(z).then(Z=>Z.blob()),B=URL.createObjectURL(X),G=document.createElement("a");G.href=B,G.download=`${$}-folders.csv`,G.style.display="none",document.body.appendChild(G),G.click(),document.body.removeChild(G),URL.revokeObjectURL(B)}catch{Le.error("Failed to download CSV")}},[$]),ue=h.useCallback(async()=>{if(f(!1),!!$)try{const{rootNode:z}=await zu($);w([z]),Le.success("Course outline refreshed.")}catch{Le.error("Outline could not be refreshed automatically. Please reload the page.")}},[$,w]);return l.jsxs("div",{className:er.container,children:[l.jsx("div",{className:er.header,children:l.jsxs("div",{className:er.headerActions,children:[O&&l.jsxs("div",{className:er.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:er.iconBtn,onClick:()=>u(z=>!z),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Pc,{size:15})}),c&&l.jsxs("div",{className:er.dropdownMenu,role:"menu",children:[l.jsx("button",{role:"menuitem",type:"button",disabled:P,title:P?'Folders already exist — use "Update" instead':void 0,onClick:()=>{u(!1),g("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!P,title:P?void 0:'No folders yet — use "Create" first',onClick:re,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!P,title:P?void 0:'No folders yet — use "Create" first',onClick:()=>{u(!1),g("update"),f(!0)},children:"Update folder metadata using csv file"})]})]}),r&&l.jsx("button",{type:"button",className:er.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(fv,{size:15}):l.jsx(dv,{size:15})})]})}),l.jsx("div",{className:er.treeWrapper,ref:s,children:l.jsx(o1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:T,onMove:O?A:void 0,onDelete:O?F:void 0,onCreate:O?M:void 0,disableEdit:!O,disableDrop:!O,selection:p??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:z=>l.jsx(d1,{...z,editorMode:e})})}),O&&l.jsxs("div",{className:er.footer,children:[l.jsxs(De,{variant:"ghost",size:"sm",onClick:V,disabled:!k,children:[l.jsx(cs,{size:14})," Add Unit"]}),l.jsxs(De,{variant:"ghost",size:"sm",onClick:j,disabled:!k||!p,children:[l.jsx(Mc,{size:14})," Add Sub-unit"]})]}),d&&l.jsx("div",{className:er.csvModal,children:l.jsx(v1,{contentId:$,mode:y,onComplete:ue,onClose:()=>f(!1)})})]})};function Ff(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Ff(r.children,t);if(n)return n}}}const Ss={breadcrumb:"_breadcrumb_zd1aj_1",crumb:"_crumb_zd1aj_10",sep:"_sep_zd1aj_26",current:"_current_zd1aj_31"},b1=({crumbs:e})=>{const t=Pe(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Ss.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Ss.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(cv,{size:13})}),e.map((r,n)=>l.jsxs(h.Fragment,{children:[l.jsx(kc,{size:13,className:Ss.sep}),n<e.length-1?l.jsx("button",{className:Ss.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Ss.current,children:r.name})]},r.id))]}):null},Cs={tabBar:"_tabBar_qhks1_1",tab:"_tab_qhks1_1",active:"_active_qhks1_29",error:"_error_qhks1_35",errorDot:"_errorDot_qhks1_39"},$f=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],_1=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?$f.filter(i=>n.includes(i.id)):$f;return l.jsx("div",{className:Cs.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:[Cs.tab,e===i.id?Cs.active:"",r.includes(i.id)?Cs.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:Cs.errorDot,"aria-label":"Has errors"})]},i.id))})};var Os=e=>e.type==="checkbox",Kr=e=>e instanceof Date,nt=e=>e==null;const jf=e=>typeof e=="object";var je=e=>!nt(e)&&!Array.isArray(e)&&jf(e)&&!Kr(e),Ha=e=>je(e)&&e.target?Os(e.target)?e.target.checked:e.target.value:e,Bf=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Vf=e=>{const t=e.constructor&&e.constructor.prototype;return je(t)&&t.hasOwnProperty("isPrototypeOf")},qi=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ze(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(qi&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(je(e)&&Vf(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=ze(e[s]));return n}const Er={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Kt={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"},Wa="form",Uf="root",zf=["__proto__","constructor","prototype"];var Es=e=>/^\w*$/.test(e),xe=e=>e===void 0,Hi=e=>e.split(/[.[\]'"]/g).filter(Boolean),W=(e,t,r)=>{if(!t||!je(e))return r;const n=Es(t)?[t]:Hi(t);if(n.some(i=>zf.includes(i)))return r;const s=n.reduce((i,o)=>nt(i)?void 0:i[o],e);return xe(s)||s===e?xe(e[t])?r:e[t]:s},xt=e=>typeof e=="boolean",ht=e=>typeof e=="function",Ne=(e,t,r)=>{let n=-1;const s=Es(t)?[t]:Hi(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const u=e[a];c=je(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(zf.includes(a))return;e[a]=c,e=e[a]}};const Ka=h.createContext(null);Ka.displayName="HookFormControlContext";const Ga=()=>h.useContext(Ka);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]!==Kt.all&&(t._proxyFormState[o]=!n||Kt.all),r&&(r[o]=!0),e[o]}});return s};const Qa=qi?h.useLayoutEffect:h.useEffect;function w1(e){const t=Ga(),{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 Qa(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u,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 pt=e=>typeof e=="string",Ya=(e,t,r,n,s)=>pt(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),Ra=e=>nt(e)||!jf(e);const Hf=(e,t)=>t.length===0&&!Array.isArray(e)&&!Vf(e);function kt(e,t,r=new WeakMap){if(e===t)return!0;if(Ra(e)||Ra(t))return Object.is(e,t);if(Kr(e)&&Kr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Hf(e,n)||Hf(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Kr(a)&&Kr(c)||(je(a)||Array.isArray(a))&&(je(c)||Array.isArray(c))?!kt(a,c,r):!Object.is(a,c))return!1}}return!0}function S1(e){const t=Ga(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=h.useRef(s),u=h.useRef(a),d=h.useRef(void 0),f=h.useRef(r),y=h.useRef(n);u.current=a;const[g,_]=h.useState(()=>{const w=r._getWatch(n,c.current);return u.current?u.current(w):w}),p=h.useCallback(w=>{const O=Ya(n,r._names,w||r._formValues,!1,c.current);return u.current?u.current(O):O},[r._formValues,r._names,n]),v=h.useCallback(w=>{if(!i){const O=Ya(n,r._names,w||r._formValues,!1,c.current);if(u.current){const I=u.current(O);kt(I,d.current)||(_(I),d.current=I)}else _(O)}},[r._formValues,r._names,i,n]);Qa(()=>((f.current!==r||!kt(y.current,n))&&(f.current=r,y.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,b=y.current,S=h.useMemo(()=>{if(i)return null;const w=!m&&!kt(b,n);return m||w?p():null},[i,m,n,b,p]);return S!==null?S:g}function Wi(e){const t=Ga(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Bf(s._names.array,r),u=h.useMemo(()=>W(s._formValues,r,W(s._defaultValues,r,o)),[s,r,o]),d=S1({control:s,name:r,defaultValue:u,exact:a}),f=w1({control:s,name:r,exact:a}),y=h.useRef(e),g=h.useRef(null),_=h.useRef(s.register(r,{...e.rules,value:d,...xt(e.disabled)?{disabled:e.disabled}:{}}));y.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=Ha(w);return W(s._fields,r)||(_.current=s.register(r,{...y.current.rules,value:O})),_.current.onChange({target:{value:Ha(w),name:r},type:Er.CHANGE})},[r,s]),m=h.useCallback(()=>_.current.onBlur({target:{value:W(s._formValues,r),name:r},type:Er.BLUR}),[r,s._formValues]),b=h.useCallback(w=>{w&&(g.current={focus:()=>ht(w.focus)&&w.focus(),select:()=>ht(w.select)&&w.select(),setCustomValidity:I=>ht(w.setCustomValidity)&&w.setCustomValidity(I),reportValidity:()=>ht(w.reportValidity)&&w.reportValidity()});const O=W(s._fields,r);O&&O._f&&w&&(O._f.ref=g.current)},[s._fields,r]),S=h.useMemo(()=>({name:r,value:d,...xt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:m,ref:b}),[r,n,f.disabled,v,m,b,d]);return h.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...y.current.rules,...xt(y.current.disabled)?{disabled:y.current.disabled}:{}});const O=(I,k)=>{const P=W(s._fields,I);P&&P._f&&(P._f.mount=k)};if(O(r,!0),w){const I=ze(W(i?s._defaultValues:s._options.values||s._defaultValues,r,W(s._options.defaultValues,r,y.current.defaultValue)));Ne(s._defaultValues,r,I),xe(W(s._formValues,r))&&Ne(s._formValues,r,I)}if(!c&&s.register(r),g.current){const I=W(s._fields,r);I&&I._f&&(I._f.ref=g.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 Xa=h.createContext(null);Xa.displayName="HookFormContext";const Qt=()=>h.useContext(Xa),C1=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m})=>{const b=h.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:y,unregister:g,control:_,register:p,setFocus:v,subscribe:m}),[i,_,u,n,r,y,p,f,d,s,v,o,a,m,c,g,t]);return h.createElement(Xa.Provider,{value:b},h.createElement(Ka.Provider,{value:b.control},e))};var O1=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Wf=e=>Array.isArray(e)?e.filter(Boolean):[],Ki=e=>Array.isArray(e)?e:[e],Kf=()=>{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 Gf(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&je(s)&&i){const o=Gf(s,i);je(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Re=e=>je(e)&&!Object.keys(e).length,Za=e=>e.type==="file",Gi=e=>{if(!qi)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Qf=e=>e.type==="select-multiple",Ja=e=>e.type==="radio",E1=e=>Ja(e)||Os(e),el=e=>Gi(e)&&e.isConnected;function D1(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(nt(e)){e=void 0;break}e=e[t[n]],n++}return e}function I1(e){for(const t in e)if(e.hasOwnProperty(t)&&!xe(e[t]))return!1;return!0}function Ke(e,t){if(pt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Es(t)?[t]:Hi(t),n=r.length===1?e:D1(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(je(n)&&Re(n)||Array.isArray(n)&&I1(n))&&Ke(e,r.slice(0,-1)),e}var T1=e=>{for(const t in e)if(ht(e[t]))return!0;return!1};function Yf(e){return Array.isArray(e)||je(e)&&!T1(e)}function tl(e,t={}){for(const r in e){const n=e[r];Yf(n)?(t[r]=Array.isArray(n)?[]:{},tl(n,t[r])):xe(n)||(t[r]=!0)}return t}function rl(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>rl(r));return t.some(r=>r!==void 0)?t:void 0}if(je(e)){const t={};for(const r in e){const n=rl(e[r]);xe(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function Gr(e,t,r){r||(r=tl(t));for(const n in e){const s=e[n];if(Yf(s))xe(t)||Ra(r[n])?r[n]=tl(s,Array.isArray(s)?[]:{}):Gr(s,nt(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!kt(s,i)}}return rl(r)||{}}const Rf={value:!1,isValid:!1},Xf={value:!0,isValid:!0};var Zf=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&&!xe(e[0].attributes.value)?xe(e[0].value)||e[0].value===""?Xf:{value:e[0].value,isValid:!0}:Xf:Rf}return Rf},Jf=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>xe(e)?e:t?e===""?NaN:e&&+e:r&&pt(e)?new Date(e):n?n(e):e;const eh={isValid:!1,value:null};var th=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,eh):eh;function rh(e){const t=e.ref;return Za(t)?t.files:Ja(t)?th(e.refs).value:Qf(t)?[...t.selectedOptions].map(({value:r})=>r):Os(t)?Zf(e.refs).value:Jf(xe(t.value)?e.ref.value:t.value,e)}var N1=(e,t,r,n)=>{const s={};for(const i of e){const o=W(t,i);o&&Ne(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Qi=e=>e instanceof RegExp,Ds=e=>xe(e)?e:Qi(e)?e.source:je(e)?Qi(e.value)?e.value.source:e.value:e,nh=e=>({isOnSubmit:!e||e===Kt.onSubmit,isOnBlur:e===Kt.onBlur,isOnChange:e===Kt.onChange,isOnAll:e===Kt.all,isOnTouch:e===Kt.onTouched});const sh="AsyncFunction";var x1=e=>!!e&&!!e.validate&&!!(ht(e.validate)&&e.validate.constructor.name===sh||je(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===sh)),k1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),nl=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const Is=(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(Is(a,t))break}else if(je(a)&&Is(a,t))break}}};function ih(e,t,r){const n=W(e,r);if(n||Es(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 A1=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Re(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Kt.all))},P1=(e,t,r)=>!e||!t||e===t||Ki(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),M1=(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,L1=(e,t)=>!Wf(W(e,t)).length&&Ke(e,t),oh=(e,t,r)=>{const n=W(e,r),s=Array.isArray(n)?n:[];return Ne(s,Uf,t[r]),Ne(e,r,s),e};function ah(e,t,r="validate"){if(pt(e)||Array.isArray(e)&&e.every(pt)||xt(e)&&!e)return{type:r,message:pt(e)?e:"",ref:t}}var xn=e=>je(e)&&!Qi(e)?e:{value:e,message:""},lh=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:u,minLength:d,min:f,max:y,pattern:g,validate:_,name:p,valueAsNumber:v,mount:m}=e._f,b=W(r,p);if(!m||t.has(p))return{};const S=a?a[0]:o,w=F=>{if(s&&S.reportValidity){const M=xt(F)?"":F||"";a?a.forEach(V=>V.setCustomValidity(M)):S.setCustomValidity(M),S.reportValidity()}},O={},I=Ja(o),k=Os(o),P=I||k,$=(v||Za(o))&&xe(o.value)&&xe(b)||Gi(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,T=O1.bind(null,p,n,O),A=(F,M,V,j=Gt.maxLength,re=Gt.minLength)=>{const ue=F?M:V;O[p]={type:F?j:re,message:ue,ref:o,...T(F?j:re,ue)}};if(i?!Array.isArray(b)||!b.length:c&&(!P&&($||nt(b))||xt(b)&&!b||k&&!Zf(a).isValid||I&&!th(a).isValid)){const{value:F,message:M}=pt(c)?{value:!!c,message:c}:xn(c);if(F&&(O[p]={type:Gt.required,message:M,ref:S,...T(Gt.required,M)},!n))return w(M),O}if(!$&&(!nt(f)||!nt(y))){let F,M;const V=xn(y),j=xn(f);if(!nt(b)&&!isNaN(b)){const re=o.valueAsNumber||b&&+b;nt(V.value)||(F=re>V.value),nt(j.value)||(M=re<j.value)}else{const re=o.valueAsDate||new Date(b),ue=X=>new Date(new Date().toDateString()+" "+X),K=o.type=="time",z=o.type=="week";pt(V.value)&&b&&(F=K?ue(b)>ue(V.value):z?b>V.value:re>new Date(V.value)),pt(j.value)&&b&&(M=K?ue(b)<ue(j.value):z?b<j.value:re<new Date(j.value))}if((F||M)&&(A(!!F,V.message,j.message,Gt.max,Gt.min),!n))return w(O[p].message),O}if((u||d)&&!$&&(pt(b)||i&&Array.isArray(b))){const F=xn(u),M=xn(d),V=!nt(F.value)&&b.length>+F.value,j=!nt(M.value)&&b.length<+M.value;if((V||j)&&(A(V,F.message,M.message),!n))return w(O[p].message),O}if(g&&!$&&pt(b)){const{value:F,message:M}=xn(g);if(Qi(F)&&!b.match(F)&&(O[p]={type:Gt.pattern,message:M,ref:o,...T(Gt.pattern,M)},!n))return w(M),O}if(_){if(ht(_)){const F=await _(b,r),M=ah(F,S);if(M&&(O[p]={...M,...T(Gt.validate,M.message)},!n))return w(M.message),O}else if(je(_)){let F={};for(const M in _){if(!Re(F)&&!n)break;const V=ah(await _[M](b,r),S,M);V&&(F={...V,...T(M,V.message)},w(V.message),n&&(O[p]=F))}if(!Re(F)&&(O[p]={ref:S,...F},!n))return O}}return w(!0),O};const F1={mode:Kt.onSubmit,reValidateMode:Kt.onChange,shouldFocusError:!0},ch={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function $1(e={}){let t={...F1,...e},r={...ze(ch),isLoading:ht(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=je(t.defaultValues)||je(t.values)?ze(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:ze(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,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...d};let y={...f};const g={array:Kf(),state:Kf()},_=t.criteriaMode===Kt.all,p=C=>N=>{clearTimeout(u),u=setTimeout(C,N)},v=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||y.isValid||C)){let N;t.resolver?(N=Re((await T()).errors),m()):N=await M({fields:n,onlyCheckValid:!0,eventType:Er.VALID}),N!==r.isValid&&g.state.next({isValid:N})}},m=(C,N)=>{!t.disabled&&(f.isValidating||f.validatingFields||y.isValidating||y.validatingFields)&&((C||Array.from(a.mount)).forEach(x=>{x&&(N?Ne(r.validatingFields,x,N):Ke(r.validatingFields,x))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Re(r.validatingFields)}))},b=()=>{r.dirtyFields=Gr(s,i)},S=(C,N=[],x,U,q=!0,Q=!0)=>{if(U&&x&&!t.disabled){if(o.action=!0,Q&&Array.isArray(W(n,C))){const H=x(W(n,C),U.argA,U.argB);q&&Ne(n,C,H)}if(Q&&Array.isArray(W(r.errors,C))){const H=x(W(r.errors,C),U.argA,U.argB);q&&Ne(r.errors,C,H),L1(r.errors,C)}if((f.touchedFields||y.touchedFields)&&Q&&Array.isArray(W(r.touchedFields,C))){const H=x(W(r.touchedFields,C),U.argA,U.argB);q&&Ne(r.touchedFields,C,H)}(f.dirtyFields||y.dirtyFields)&&b(),g.state.next({name:C,isDirty:j(C,N),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ne(i,C,N)},w=(C,N)=>{Ne(r.errors,C,N),r.errors={...r.errors},g.state.next({errors:r.errors})},O=C=>{r.errors=C,g.state.next({errors:r.errors,isValid:!1})},I=C=>{const N=Es(C)?[C]:Hi(C);let x=i,U=s;for(let q=0;q<N.length-1;q++){const Q=N[q];if(x=nt(x)?x:x[Q],U=nt(U)?U:U[Q],x===null&&U!==null)return!0}return!1},k=(C,N,x,U)=>{const q=W(n,C);if(q){if(I(C))return;const Q=xe(W(i,C)),H=W(i,C,xe(x)?W(s,C):x);xe(H)||U&&U.defaultChecked||N?Ne(i,C,N?H:rh(q._f)):K(C,H),o.mount&&!o.action&&(v(),Q&&r.isDirty&&(f.isDirty||y.isDirty)&&(j()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!xe(W(i,C))&&nl(C,a)&&(o.watch=!0))}},P=(C,N,x,U,q)=>{let Q=!1,H=!1;const ee={name:C};if(!t.disabled){if(!x||U){(f.isDirty||y.isDirty)&&(H=r.isDirty,r.isDirty=ee.isDirty=j(),Q=H!==ee.isDirty);const de=kt(W(s,C),N);H=!!W(r.dirtyFields,C),de!==r.isDirty?r.dirtyFields=Gr(s,i):de?Ke(r.dirtyFields,C):Ne(r.dirtyFields,C,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||y.dirtyFields)&&H!==!de}if(x){const de=W(r.touchedFields,C);de||(Ne(r.touchedFields,C,x),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||y.touchedFields)&&de!==x)}Q&&q&&g.state.next(ee)}return Q?ee:{}},$=(C,N,x,U)=>{const q=W(r.errors,C),Q=(f.isValid||y.isValid)&&xt(N)&&r.isValid!==N;if(t.delayError&&x?(c=p(()=>w(C,x)),c(t.delayError)):(clearTimeout(u),c=null,x?Ne(r.errors,C,x):Ke(r.errors,C),r.errors={...r.errors}),(x?!kt(q,x):q)||!Re(U)||Q){const H={...U,...Q&&xt(N)?{isValid:N}:{},errors:r.errors,name:C};r={...r,...H},g.state.next(H)}},T=async C=>(m(C,!0),await t.resolver(i,t.context,N1(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),A=async C=>{const{errors:N}=await T(C);if(m(C),C){for(const x of C){const U=W(N,x);U?a.array.has(x)&&je(U)&&!Object.keys(U).some(q=>!Number.isNaN(Number(q)))?oh(r.errors,{[x]:U},x):Ne(r.errors,x,U):Ke(r.errors,x)}r.errors={...r.errors}}else r.errors=N;return N},F=async({name:C,eventType:N})=>{if(e.validate){const x=await e.validate({formValues:i,formState:r,name:C,eventType:N});if(je(x))for(const U in x){const q=x[U];q&&me(`${Wa}.${U}`,{message:pt(q.message)?q.message:"",type:q.type||Gt.validate})}else pt(x)||!x?me(Wa,{message:x||"",type:Gt.validate}):se(Wa);return x}return!0},M=async({fields:C,onlyCheckValid:N,name:x,eventType:U,context:q={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(q.runRootValidation=!0,!await F({name:x,eventType:U})&&(q.valid=!1,N)))return q.valid;for(const Q in C){const H=C[Q];if(H){const{_f:ee,...de}=H;if(ee){const Ue=a.array.has(ee.name),It=H._f&&x1(H._f),Tt=f.validatingFields||f.isValidating||y.validatingFields||y.isValidating;It&&Tt&&m([ee.name],!0);const pr=await lh(H,a.disabled,i,_,t.shouldUseNativeValidation&&!N,Ue);if(It&&Tt&&m([ee.name]),pr[ee.name]&&(q.valid=!1,N)||(!N&&(W(pr,ee.name)?Ue?oh(r.errors,pr,ee.name):Ne(r.errors,ee.name,pr[ee.name]):Ke(r.errors,ee.name)),e.shouldUseNativeValidation&&pr[ee.name]))break}!Re(de)&&await M({context:q,onlyCheckValid:N,fields:de,name:Q,eventType:U})}}return q.valid},V=()=>{for(const C of a.unMount){const N=W(n,C);N&&(N._f.refs?N._f.refs.every(x=>!el(x)):!el(N._f.ref))&&it(C)}a.unMount=new Set},j=(C,N)=>!t.disabled&&(C&&N&&Ne(i,C,N),!kt(J(),s)),re=(C,N,x)=>Ya(C,a,{...o.mount?i:xe(N)?s:pt(C)?{[C]:N}:N},x,N),ue=C=>Wf(W(o.mount?i:s,C,t.shouldUnregister?W(s,C,[]):[])),K=(C,N,x={},U=!1)=>{const q=W(n,C);let Q=N;if(q){const H=q._f;H&&(!H.disabled&&Ne(i,C,Jf(N,H)),Q=Gi(H.ref)&&nt(N)?"":N,Qf(H.ref)?[...H.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):H.refs?Os(H.ref)?H.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(Q)?ee.checked=!!Q.find(de=>de===ee.value):ee.checked=Q===ee.value||!!Q)}):H.refs.forEach(ee=>ee.checked=ee.value===Q):Za(H.ref)?H.ref.value="":(H.ref.value=Q,H.ref.type||g.state.next({name:C,values:U?i:ze(i)})))}(x.shouldDirty||x.shouldTouch)&&P(C,Q,x.shouldTouch,x.shouldDirty,!0),x.shouldValidate&&Te(C)},z=(C,N,x,U=!1)=>{for(const q in N){if(!N.hasOwnProperty(q))return;const Q=N[q],H=C+"."+q,ee=W(n,H);(a.array.has(C)||je(Q)||ee&&!ee._f)&&!Kr(Q)?z(H,Q,x,U):K(H,Q,x,U)}},X=(C,N,x,U)=>{const q=W(n,C),Q=a.array.has(C),H=U?N:ze(N),ee=W(i,C),de=kt(ee,H);if(de||Ne(i,C,H),Q)g.array.next({name:C,values:U?i:ze(i)}),(f.isDirty||f.dirtyFields||y.isDirty||y.dirtyFields)&&x.shouldDirty&&(b(),g.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:j(C,H)}));else{const Ue=Array.isArray(H)&&!H.length||Re(H);!q||q._f||nt(H)||Ue?K(C,H,x,U):z(C,H,x,U)}if(!de){const Ue=nl(C,a),It=U?i:ze(i);g.state.next({...Ue&&r,name:o.mount||Ue?C:void 0,values:It})}},B=(C,N,x={})=>X(C,N,x,!1),G=(C,N={})=>{const x=ht(C)?C(i):C;if(!kt(i,x)){i={...i,...x};for(const U of a.mount)X(U,W(x,U),N,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),N.shouldValidate&&v()}},Z=async C=>{o.mount=!0;const N=C.target;let x=N.name,U=!0;const q=W(n,x),Q=de=>{U=Number.isNaN(de)||Kr(de)&&isNaN(de.getTime())||kt(de,W(i,x,de))},H=nh(t.mode),ee=nh(t.reValidateMode);if(q){let de,Ue;const It=N.type?rh(q._f):Ha(C),Tt=C.type===Er.BLUR||C.type===Er.FOCUS_OUT,pr=!k1(q._f)&&!e.validate&&!t.resolver&&!W(r.errors,x)&&!q._f.deps||M1(Tt,W(r.touchedFields,x),r.isSubmitted,ee,H),$s=nl(x,a,Tt);Ne(i,x,It),Tt?(!N||!N.readOnly)&&(q._f.onBlur&&q._f.onBlur(C),c&&c(0)):q._f.onChange&&q._f.onChange(C);const an=P(x,It,Tt),et=!Re(an)||$s;if(!Tt&&g.state.next({name:x,type:C.type,values:ze(i)}),pr)return(f.isValid||y.isValid)&&(t.mode==="onBlur"?Tt&&v():Tt||v()),et&&g.state.next({name:x,...$s?{}:an});if(!t.resolver&&e.validate&&await F({name:x,eventType:C.type}),!Tt&&$s&&g.state.next({...r}),t.resolver){const{errors:vt}=await T([x]);if(m([x]),Q(It),!U){!Re(an)&&g.state.next(an);return}const _t=ih(r.errors,n,x),Xt=ih(vt,n,_t.name||x);de=Xt.error,x=Xt.name,Ue=Re(vt)}else m([x],!0),de=(await lh(q,a.disabled,i,_,t.shouldUseNativeValidation))[x],m([x]),Q(It),U&&(de?Ue=!1:(f.isValid||y.isValid)&&(Ue=await M({fields:n,onlyCheckValid:!0,name:x,eventType:C.type})));U&&(q._f.deps&&(!Array.isArray(q._f.deps)||q._f.deps.length>0)&&Te(q._f.deps),$(x,Ue,de,an))}},ve=(C,N)=>{if(W(r.errors,N)&&C.focus)return C.focus(),1},Te=async(C,N={})=>{let x,U;const q=Ki(C);if(t.resolver){const Q=await A(xe(C)?C:q);x=Re(Q),U=C?!q.some(H=>W(Q,H)):x}else C?(U=(await Promise.all(q.map(async Q=>{const H=W(n,Q);return await M({fields:H&&H._f?{[Q]:H}:H,eventType:Er.TRIGGER})}))).every(Boolean),!(!U&&!r.isValid)&&v()):U=x=await M({fields:n,name:C,eventType:Er.TRIGGER});return g.state.next({...!pt(C)||(f.isValid||y.isValid)&&x!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:x}:{},errors:r.errors}),N.shouldFocus&&!U&&Is(n,ve,C?q:a.mount),U},J=(C,N)=>{let x={...o.mount?i:s};return N&&(x=Gf(N.dirtyFields?r.dirtyFields:r.touchedFields,x)),xe(C)?x:pt(C)?W(x,C):C.map(U=>W(x,U))},Ce=(C,N)=>({invalid:!!W((N||r).errors,C),isDirty:!!W((N||r).dirtyFields,C),error:W((N||r).errors,C),isValidating:!!W(r.validatingFields,C),isTouched:!!W((N||r).touchedFields,C)}),se=C=>{const N=C?Ki(C):void 0;N==null||N.forEach(x=>Ke(r.errors,x)),N?N.forEach(x=>{g.state.next({name:x,errors:r.errors})}):g.state.next({errors:{}})},me=(C,N,x)=>{const U=(W(n,C,{_f:{}})._f||{}).ref,q=W(r.errors,C)||{},{ref:Q,message:H,type:ee,...de}=q;Ne(r.errors,C,{...de,...N,ref:U}),g.state.next({name:C,errors:r.errors,isValid:!1}),x&&x.shouldFocus&&U&&U.focus&&U.focus()},oe=(C,N)=>ht(C)?g.state.subscribe({next:x=>"values"in x&&C(x.values||re(void 0,N),x)}):re(C,N,!0),yt=C=>g.state.subscribe({next:N=>{if(P1(C.name,N.name,C.exact)&&A1(N,C.formState||f,to,C.reRenderRoot)){const x={...i};C.callback({values:x,...r,...N,defaultValues:s})}}}).unsubscribe,Ee=C=>(o.mount=!0,y={...y,...C.formState},yt({...C,formState:{...d,...C.formState}})),it=(C,N={})=>{for(const x of C?Ki(C):a.mount)a.mount.delete(x),a.array.delete(x),N.keepValue||(Ke(n,x),Ke(i,x)),!N.keepError&&Ke(r.errors,x),!N.keepDirty&&Ke(r.dirtyFields,x),!N.keepTouched&&Ke(r.touchedFields,x),!N.keepIsValidating&&Ke(r.validatingFields,x),!t.shouldUnregister&&!N.keepDefaultValue&&Ke(s,x);g.state.next({values:ze(i)}),g.state.next({...r,...N.keepDirty?{isDirty:j()}:{}}),!N.keepIsValid&&v()},Je=({disabled:C,name:N})=>{if(xt(C)&&o.mount||C||a.disabled.has(N)){const q=a.disabled.has(N)!==!!C;C?a.disabled.add(N):a.disabled.delete(N),q&&o.mount&&!o.action&&v()}},He=(C,N={})=>{let x=W(n,C);const U=xt(N.disabled)||xt(t.disabled),q=!a.registerName.has(C)&&x&&x._f&&!x._f.mount;return Ne(n,C,{...x||{},_f:{...x&&x._f?x._f:{ref:{name:C}},name:C,mount:!0,...N}}),a.mount.add(C),x&&!q?Je({disabled:xt(N.disabled)?N.disabled:t.disabled,name:C}):k(C,!0,N.value),{...U?{disabled:N.disabled||t.disabled}:{},...t.progressive?{required:!!N.required,min:Ds(N.min),max:Ds(N.max),minLength:Ds(N.minLength),maxLength:Ds(N.maxLength),pattern:Ds(N.pattern)}:{},name:C,onChange:Z,onBlur:Z,ref:Q=>{if(Q){a.registerName.add(C),He(C,N),a.registerName.delete(C),x=W(n,C);const H=xe(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=E1(H),de=x._f.refs||[];if(ee?de.find(Ue=>Ue===H):H===x._f.ref)return;Ne(n,C,{_f:{...x._f,...ee?{refs:[...de.filter(el),H,...Array.isArray(W(s,C))?[{}]:[]],ref:{type:H.type,name:C}}:{ref:H}}}),k(C,!1,void 0,H)}else x=W(n,C,{}),x._f&&(x._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(Bf(a.array,C)&&o.action)&&a.unMount.add(C)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Is(n,ve,a.mount),Me=C=>{xt(C)&&(g.state.next({disabled:C}),Is(n,(N,x)=>{const U=W(n,x);U&&(N.disabled=U._f.disabled||C,Array.isArray(U._f.refs)&&U._f.refs.forEach(q=>{q.disabled=U._f.disabled||C}))},0,!1))},Ve=(C,N)=>async x=>{let U;x&&(x.preventDefault&&x.preventDefault(),x.persist&&x.persist());let q=ze(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:H}=await T();m(),r.errors=Q,q=ze(H)}else await M({fields:n,eventType:Er.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)Ke(q,Q);if(Ke(r.errors,Uf),Re(r.errors)){g.state.next({errors:{}});try{await C(q,x)}catch(Q){U=Q}}else N&&await N({...r.errors},x),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Re(r.errors)&&!U,submitCount:r.submitCount+1,errors:r.errors}),U)throw U},ot=(C,N={})=>{W(n,C)&&(xe(N.defaultValue)?B(C,ze(W(s,C))):(B(C,N.defaultValue),Ne(s,C,ze(N.defaultValue))),N.keepTouched||Ke(r.touchedFields,C),N.keepDirty||(Ke(r.dirtyFields,C),r.isDirty=N.defaultValue?j(C,ze(W(s,C))):j()),N.keepError||(Ke(r.errors,C),f.isValid&&v()),g.state.next({...r}))},Dt=(C,N={})=>{const x=C?ze(C):s,U=ze(x),q=Re(C),Q=U;if(N.keepDefaultValues||(s=x),!N.keepValues){if(N.keepDirtyValues){const H=new Set([...a.mount,...Object.keys(Gr(s,i))]);for(const ee of Array.from(H)){const de=W(r.dirtyFields,ee),Ue=W(i,ee),It=W(Q,ee);de&&!xe(Ue)?Ne(Q,ee,Ue):!de&&!xe(It)&&B(ee,It)}}else{if(qi&&xe(C))for(const H of a.mount){const ee=W(n,H);if(ee&&ee._f){const de=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Gi(de)){const Ue=de.closest("form");if(Ue){Ue.reset();break}}}}if(N.keepFieldsRef)for(const H of a.mount)B(H,W(Q,H));else n={}}if(t.shouldUnregister){if(i=N.keepDefaultValues?ze(s):{},N.keepFieldsRef)for(const H of a.mount)Ne(i,H,W(Q,H))}else i=ze(Q);g.array.next({values:{...Q}}),g.state.next({values:{...Q}})}a={mount:N.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||!!N.keepIsValid||!!N.keepDirtyValues||!t.shouldUnregister&&!Re(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!N.keepIsValid,o.action=!1,N.keepErrors||(r.errors={}),g.state.next({submitCount:N.keepSubmitCount?r.submitCount:0,isDirty:q?!1:N.keepDirty?r.isDirty:N.keepValues?j():!!(N.keepDefaultValues&&!kt(C,s)),isSubmitted:N.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q?{}:N.keepDirtyValues?N.keepDefaultValues&&i?Gr(s,i):r.dirtyFields:N.keepDefaultValues&&C?Gr(s,C):N.keepDirty?r.dirtyFields:{},touchedFields:N.keepTouched?r.touchedFields:{},errors:N.keepErrors?r.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},hr=(C,N)=>Dt(ht(C)?C(i):C,{...t.resetOptions,...N}),Ut=(C,N={})=>{const x=W(n,C),U=x&&x._f;if(U){const q=U.refs?U.refs[0]:U.ref;q.focus&&setTimeout(()=>{q.focus(),N.shouldSelect&&ht(q.select)&&q.select()})}},to=C=>{r={...r,...C}},ro={control:{register:He,unregister:it,getFieldState:Ce,handleSubmit:Ve,setError:me,_subscribe:yt,_runSchema:T,_updateIsValidating:m,_focusError:te,_getWatch:re,_getDirty:j,_setValid:v,_setFieldArray:S,_setDisabledField:Je,_setErrors:O,_getFieldArray:ue,_reset:Dt,_resetDefaultValues:()=>ht(t.defaultValues)&&t.defaultValues().then(C=>{hr(C,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:V,_disableForm:Me,_subjects:g,_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:Ee,trigger:Te,register:He,handleSubmit:Ve,watch:oe,setValue:B,setValues:G,getValues:J,reset:hr,resetField:ot,resetDefaultValues:(C,N={})=>{if(s=ze(C),!N.keepDirty){const x=Gr(s,i);r.dirtyFields=x,r.isDirty=!Re(x)}N.keepIsValid||v(),g.state.next({...r,defaultValues:s})},clearErrors:se,unregister:it,setError:me,setFocus:Ut,getFieldState:Ce};return{...ro,formControl:ro}}function j1(e={}){const t=h.useRef(void 0),r=h.useRef(void 0),n=h.useRef(e.formControl),[s,i]=h.useState(()=>({...ze(ch),isLoading:ht(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ht(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&&!ht(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=$1(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,Qa(()=>{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&&!kt(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 uh(e){var r,n;return(n=(r=(await $e.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}function dh(e,t){const r=Fl({queryKey:["framework",e],queryFn:()=>uh(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Fl({queryKey:["framework",n],queryFn:()=>uh(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}const B1={"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."},"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."}},fh={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},V1={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"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"},hh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},ph=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function U1(e,t,r,n){return e!=null&&e.length?e.filter(s=>!(n&&(s.code==="dialCode"||s.code==="dialcode")||s.visible===!1)).map(s=>{const i=s.code??"",o=W1(s),a=K1(s,r,t),c=t[i],u=gh(c,o);return{code:i,label:s.label??i,inputType:o,required:!!(s.required??s.validations),editable:s.editable!==!1,placeholder:s.placeholder,maxLength:s.maxLength,options:q1(a,u,o,r),depends:s.depends,tab:H1(s),section:s.section,defaultValue:s.defaultValue??s.default,currentValue:u}}):Y1(t,n,r)}function z1(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 q1(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=z1(n);for(const c of s){const u=String(c);o.has(u)||(i.push({label:a.get(u)??u,value:u}),o.add(u))}return i}function H1(e){const t=e.section;if(t&&fh[t])return fh[t];const r=e.code??"";return V1[r]??"details"}function gh(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 W1(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"||t==="framework"?"select":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 K1(e,t,r){const n=e.range;if(Array.isArray(n)&&n.length)return typeof n[0]=="string"?n.map(a=>({label:a,value:a})):n.map(a=>({label:a.name,value:a.identifier}));const s=e.enum;if(s!=null&&s.length)return s.map(a=>({label:a,value:a}));const i=e.code??"",o=e.sourceCategory??hh[i];if(o)return yh(i,o,e,t,r)}function yh(e,t,r,n,s){var f,y,g,_,p;const i=ph.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=v=>({label:v.name,value:i?v.identifier:v.name}),a=(y=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:y.find(v=>v.code===t),c=(p=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:p.find(v=>v.code===t);let u=(ph.has(e)?c==null?void 0:c.terms:a==null?void 0:a.terms)??(c==null?void 0:c.terms)??(a==null?void 0:a.terms)??[];const d=r.depends;if(d!=null&&d.length){const v=d.flatMap(m=>{const b=s[m];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(v.length){const m=u.filter(b=>{const S=b.associations;return!S||!S.length?!0:S.some(w=>v.includes(w.identifier)||v.includes(w.code)||v.includes(w.name))});m.length&&(u=m)}}return u.map(o)}function kn(e,t){const r=hh[e];if(r)return yh(e,r,{},t,{})}const G1=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],Q1=[{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-ND 4.0",value:"CC BY-ND 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-NC-ND 4.0",value:"CC BY-NC-ND 4.0"},{label:"CC0 1.0",value:"CC0 1.0"},{label:"All Rights Reserved",value:"All Rights Reserved"}];function st(e,t,r){return gh(e[t],r)}function Y1(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:st(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:st(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:st(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:st(e,"primaryCategory","select"),options:[{label:"Course",value:"Course"},{label:"Digital Textbook",value:"Digital Textbook"},{label:"Teacher Resource",value:"Teacher Resource"},{label:"Learning Resource",value:"Learning Resource"},{label:"Practice Question Set",value:"Practice Question Set"}]},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:st(e,"additionalCategories","multiselect"),options:[{label:"Lesson Plan",value:"Lesson Plan"},{label:"Textbook",value:"Textbook"},{label:"TV Lesson",value:"TV Lesson"},{label:"Revision Material",value:"Revision Material"}]},{code:"board",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:kn("board",r),currentValue:st(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:kn("subject",r),currentValue:st(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:G1,currentValue:st(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:kn("targetBoardIds",r),currentValue:st(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:kn("targetMediumIds",r),currentValue:st(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:kn("targetGradeLevelIds",r),currentValue:st(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:kn("targetSubjectIds",r),currentValue:st(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:st(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:st(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:st(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:st(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:Q1,currentValue:st(e,"license","select")})),n}function R1(e,t){const{watch:r,setValue:n}=e;h.useEffect(()=>{const s=r((i,{name:o})=>{o&&t.forEach(a=>{var c;(c=a.depends)!=null&&c.includes(o)&&n(a.code,a.inputType==="multiselect"||a.inputType==="chips"?[]:"",{shouldDirty:!0})})});return()=>s.unsubscribe()},[r,n,t])}const An={section:"_section_ylgu8_1",header:"_header_ylgu8_11",title:"_title_ylgu8_17",description:"_description_ylgu8_24",divider:"_divider_ylgu8_30",fields:"_fields_ylgu8_36"},X1=({title:e,description:t,children:r})=>l.jsxs("div",{className:An.section,children:[l.jsxs("div",{className:An.header,children:[l.jsx("h3",{className:An.title,children:e}),t&&l.jsx("p",{className:An.description,children:t})]}),l.jsx("hr",{className:An.divider}),l.jsx("div",{className:An.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"},vh=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Qt(),u=c[e],d={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,u?L.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,d)}):l.jsx("input",{id:e,type:"text",className:[L.input,u?L.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,d)}),u&&l.jsx("span",{className:L.error,children:String(u.message)})]})},Z1=({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:u,setValue:d,formState:{errors:f}}=Qt(),y=u(e),g=((p=r.find(v=>v.value===y))==null?void 0:p.label)??"Select…",_=f[e];return h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.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,_?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y?L.selectedVal:L.placeholder,children:g}),l.jsx(ls,{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,y===v.value?L.optionSelected:""].join(" "),onClick:()=>{d(e,v.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:v.label}),y===v.value&&l.jsx(fn,{size:13})]},v.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},J1=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),a=h.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Qt(),y=u(e)??[],g=f[e],_=y.length?`${y.length} selected`:"Select…";h.useEffect(()=>{if(!i)return;const v=m=>{var b;(b=a.current)!=null&&b.contains(m.target)||o(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);const p=v=>{const m=y.includes(v)?y.filter(b=>b!==v):[...y,v];d(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,g?L.inputError:"",i?L.selectOpen:""].join(" "),onClick:()=>o(v=>!v),children:[l.jsx("span",{className:y.length?L.selectedVal:L.placeholder,children:_}),l.jsx(ls,{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,y.includes(v.value)?L.optionSelected:""].join(" "),onClick:()=>p(v.value),children:[l.jsx(fn,{size:13,style:{opacity:y.includes(v.value)?1:0}}),l.jsx("span",{children:v.label})]},v.value)),!r.length&&l.jsx("span",{className:L.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:L.error,children:String(g.message)})]})},eO=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=h.useState(""),[a,c]=h.useState(!1),u=h.useRef(null),{watch:d,setValue:f,formState:{errors:y}}=Qt(),g=d(e)??[],_=y[e],p=()=>{const m=i.trim();m&&!g.includes(m)&&f(e,[...g,m],{shouldDirty:!0}),o(""),c(!1)},v=m=>f(e,g.filter(b=>b!==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:[g.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:u,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=u.current)==null?void 0:m.focus()},50)},children:[l.jsx(cs,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},tO=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Qt(),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)})]})},ce={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"},mh=18,bh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=h.useState("my"),[o,a]=h.useState(""),[c,u]=h.useState([]),[d,f]=h.useState(0),[y,g]=h.useState(!1),[_,p]=h.useState(null),[v,m]=h.useState(0),[b,S]=h.useState(null),[w,O]=h.useState(""),[I,k]=h.useState(!1),[P,$]=h.useState(""),T=h.useRef(null),A=be(B=>{var G,Z;return((Z=(G=B.editorConfig)==null?void 0:G.context)==null?void 0:Z.channel)??""}),F=be(B=>{var G,Z;return((Z=(G=B.editorConfig)==null?void 0:G.context)==null?void 0:Z.uid)??""}),M=h.useCallback(async(B,G,Z=!1)=>{var ve;g(!0);try{const Te={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&F&&(Te.createdBy=F),A&&(Te.channel=A);const Ce=((ve=(await $e.post("/action/composite/v3/search",{request:{filters:Te,query:B,limit:mh,offset:G,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:ve.result)??{},se=Ce.content??[];f(Ce.count??0),u(me=>Z?[...me,...se]:se)}catch{}finally{g(!1)}},[s,F,A]);h.useEffect(()=>{s!=="upload"&&(u([]),m(0),M(o,0))},[s]);const V=h.useRef(),j=B=>{a(B),clearTimeout(V.current),V.current=setTimeout(()=>{u([]),m(0),M(B,0)},400)},re=()=>{const B=v+mh;m(B),M(o,B,!0)},ue=()=>{const B=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";B&&r(B)},K=B=>{var Z;const G=(Z=B.target.files)==null?void 0:Z[0];if(B.target.value="",!!G){if(!G.type.startsWith("image/")){$("Only image files are accepted.");return}if(G.size>4*1024*1024){$("Image must be under 4 MB.");return}S(G),O(URL.createObjectURL(G)),$("")}},z=async()=>{var B,G;if(b){k(!0),$("");try{const Z=new FormData;Z.append("file",b);const Te=(G=(B=(await $e.post(`/action/content/v3/upload/${e}?fileType=image`,Z,{headers:{"Content-Type":"multipart/form-data"}})).data)==null?void 0:B.result)==null?void 0:G.artifactUrl;if(!Te)throw new Error("No URL in response");r(Te)}catch(Z){$(Z instanceof Error?Z.message:"Upload failed.")}finally{k(!1)}}},X=c.length<d;return l.jsx("div",{className:ce.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:ce.modal,children:[l.jsxs("div",{className:ce.header,children:[l.jsx("span",{className:ce.title,children:"Select App Icon"}),l.jsx("button",{className:ce.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(jr,{size:18})})]}),l.jsxs("div",{className:ce.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${ce.tab} ${s==="my"?ce.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${ce.tab} ${s==="all"?ce.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${ce.tab} ${s==="upload"?ce.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(jc,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:ce.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ce.searchWrap,children:[l.jsx(Vo,{size:14,className:ce.searchIcon}),l.jsx("input",{type:"search",className:ce.searchInput,placeholder:"Search images…",value:o,onChange:B=>j(B.target.value)})]}),y&&c.length===0?l.jsxs("div",{className:ce.loadingRow,children:[l.jsx(ci,{size:20,className:ce.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:ce.empty,children:"No images found"}):l.jsx("div",{className:ce.grid,children:c.map(B=>{const G=B.appIcon??B.artifactUrl??B.downloadUrl??"",Z=(_==null?void 0:_.identifier)===B.identifier;return l.jsxs("button",{type:"button",className:`${ce.imgCell} ${Z?ce.imgCellSelected:""}`,onClick:()=>p(B),title:B.name,children:[G?l.jsx("img",{src:G,alt:B.name,className:ce.thumb}):l.jsx("div",{className:ce.noThumb,children:"IMG"}),Z&&l.jsx("div",{className:ce.checkBadge,children:l.jsx(fn,{size:12})})]},B.identifier)})}),X&&!y&&l.jsx("button",{className:ce.loadMoreBtn,onClick:re,children:"Load More"}),y&&c.length>0&&l.jsx("div",{className:ce.loadingRow,children:l.jsx(ci,{size:16,className:ce.spinner})})]}):l.jsxs("div",{className:ce.uploadArea,children:[l.jsx("div",{className:ce.dropZone,onClick:()=>{var B;return(B=T.current)==null?void 0:B.click()},onDragOver:B=>B.preventDefault(),onDrop:B=>{B.preventDefault();const G=B.dataTransfer.files[0];G&&K({target:{files:[G],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:ce.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(jc,{size:32,className:ce.uploadIcon}),l.jsx("p",{className:ce.dropText,children:"Drag & drop or click to browse"}),l.jsx("p",{className:ce.dropSubtext,children:"PNG, JPG, SVG · max 4 MB"})]})}),l.jsx("input",{ref:T,type:"file",accept:"image/*",className:ce.hiddenInput,onChange:K}),b&&l.jsx("p",{className:ce.fileName,children:b.name}),P&&l.jsx("p",{className:ce.errorText,children:P})]})}),l.jsxs("div",{className:ce.footer,children:[l.jsx("button",{className:ce.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:ce.confirmBtn,disabled:!b||I,onClick:z,children:I?l.jsxs(l.Fragment,{children:[l.jsx(ci,{size:14,className:ce.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:ce.confirmBtn,disabled:!_,onClick:ue,children:"Use Selected"})]})]})})},rO=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=h.useState(!1),{watch:a,setValue:c,register:u,formState:{errors:d}}=Qt(),f=a(e),y=d[e],g=p=>{c(e,p,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{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",...u(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(Fc,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:L.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(Uo,{size:13}),l.jsx("span",{children:"Remove"})]}),y&&l.jsx("span",{className:L.error,children:String(y.message)}),i&&l.jsx(bh,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},nO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Qt(),{field:i,fieldState:{error:o}}=Wi({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)})]})},sO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Qt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=h.useState(""),u=h.useRef(null),d=i.value??[],f=p=>{const v=p.trim();!v||d.includes(v)||i.onChange([...d,v])},y=p=>{i.onChange(d.filter(v=>v!==p))},g=p=>{p.key==="Enter"||p.key===","?(p.preventDefault(),f(a),c("")):p.key==="Backspace"&&a===""&&d.length>0&&y(d[d.length-1])},_=()=>{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=u.current)==null?void 0:p.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(p=>l.jsxs("span",{className:L.tagChip,children:[p,!n&&l.jsx("button",{type:"button",className:L.tagChipRemove,onClick:v=>{v.stopPropagation(),y(p)},"aria-label":`Remove ${p}`,children:l.jsx(jr,{size:11})})]},p)),!n&&l.jsx("input",{ref:u,className:L.chipInput,value:a,onChange:p=>c(p.target.value),onKeyDown:g,onBlur:_,placeholder:d.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:L.error,children:String(o.message)})]})},iO=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Qt(),{field:o,fieldState:{error:a}}=Wi({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},u=(d,f,y)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[d]=y;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};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((d,f)=>{const y=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}_${d.code}`,children:d.label}),l.jsxs("select",{id:`${e}_${d.code}`,className:[L.input,a?L.inputError:""].join(" "),disabled:s||y,value:c[d.code]??"",onChange:g=>u(d.code,f,g.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),d.options.map(g=>l.jsx("option",{value:g.value,children:g.label},g.value))]})]},d.code)})}),a&&l.jsx("span",{className:L.error,children:String(a.message)})]})},_h=[{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"}],oO=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=h.useState(!1),o=h.useRef(null),{register:a,watch:c,setValue:u,formState:{errors:d}}=Qt(),f=c(e),y=_h.find(p=>p.value===f),g=(y==null?void 0:y.label)??"Select license…",_=d[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,_?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:g}),l.jsx(ls,{size:14,className:s?L.chevronUp:""})]}),s&&l.jsx("div",{className:L.dropdown,role:"listbox",children:_h.map(p=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===p.value,className:[L.option,f===p.value?L.optionSelected:""].join(" "),onClick:()=>{u(e,p.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:p.label}),f===p.value&&l.jsx(fn,{size:13})]},p.value))}),_&&l.jsx("span",{className:L.error,children:String(_.message)})]})},aO=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Qt(),{field:i,fieldState:{error:o}}=Wi({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=h.useState("idle"),[u,d]=h.useState(""),f=async()=>{const g=(i.value??"").trim();if(!g){c("invalid"),d("Enter a dial code to validate.");return}c("loading"),d("");try{const _=await Ub(g),p=_==null?void 0:_.result,v=p==null?void 0:p.dialcodes;Array.isArray(v)&&v.length>0?(c("valid"),d("Dial code is valid.")):(c("invalid"),d("Dial code not found."))}catch{c("invalid"),d("Validation failed. Please try again.")}},y=()=>a==="loading"?l.jsx(ci,{size:16,className:L.dialcodeSpinner}):a==="valid"?l.jsx(Ac,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(Lo,{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:g=>{i.onChange(g),c("idle"),d("")},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"}),y()]}),o&&l.jsx("span",{className:L.error,children:String(o.message)}),!o&&u&&l.jsx("span",{className:a==="valid"?L.dialcodeValid:L.error,children:u})]})},sl={form:"_form_szqex_1",ungrouped:"_ungrouped_szqex_7",noFields:"_noFields_szqex_18"},lO=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var j,re,ue;const a=be(K=>K.editorConfig),c=be(K=>K.rootFormConfig),u=be(K=>K.unitFormConfig),{organisationFramework:d,targetFrameworks:f,isLoading:y}=dh((j=a==null?void 0:a.context)==null?void 0:j.framework,(re=a==null?void 0:a.context)==null?void 0:re.targetFWIds),g={organisationFramework:d,targetFrameworks:f},_=Pe(K=>K.selectedNodeId),p=Pe(K=>K.treeCache),v=_?p[_]??{}:{},m={...e,...v},b=r?c:u,S=b||(((ue=a==null?void 0:a.config.hierarchy)==null?void 0:ue.formConfig)??[]),w=U1(S,m,g,r),O=w.filter(K=>K.tab===t&&K.inputType!=="appIcon"),I=j1({mode:"onChange",defaultValues:Object.fromEntries(w.map(K=>{const z=["multiselect","chips","keywords","tagsinput"],X=["nestedselect"];return z.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??[]]:X.includes(K.inputType)?[K.code,K.currentValue??K.defaultValue??{}]:[K.code,K.currentValue??K.defaultValue??""]}))});R1(I,w);const{updateNode:k}=Pe(),P=h.useRef(w);P.current=w;const $=h.useRef(_);$.current=_;const T=h.useRef(i);T.current=i;const A=h.useRef(o);A.current=o,h.useEffect(()=>{const K=I.watch((z,{name:X})=>{const B=$.current;if(!B)return;const G=P.current,Z=new Set(G.map(J=>J.code));if(X&&Z.has(X)){const J=I.getValues(X);k(B,{[X]:J}),T.current({[X]:J})}else if(!X){const J=I.getValues(),Ce=Object.fromEntries(Object.entries(J).filter(([se])=>Z.has(se)));Object.keys(Ce).length>0&&(k(B,Ce),T.current(Ce))}const ve=I.formState.errors,Te=Array.from(new Set(Object.keys(ve).map(J=>{var Ce;return(Ce=G.find(se=>se.code===J))==null?void 0:Ce.tab}).filter(Boolean)));A.current(Object.keys(ve).length===0,Te)});return()=>K.unsubscribe()},[I]);const F=s!=="edit",M=O.reduce((K,z)=>{const X=K[K.length-1];return X&&X.section===z.section?X.fields.push(z):K.push({section:z.section,fields:[z]}),K},[]),V=K=>{const z={key:K.code,name:K.code,label:K.label,required:K.required,disabled:F||K.editable===!1};switch(K.inputType){case"textarea":return l.jsx(vh,{...z,multiline:!0,maxLength:K.maxLength});case"select":return l.jsx(Z1,{...z,options:K.options??[]});case"multiselect":return l.jsx(J1,{...z,options:K.options??[]});case"chips":return l.jsx(eO,{...z});case"radio":return l.jsx(tO,{...z,options:K.options??[]});case"appIcon":return l.jsx(rO,{...z,nodeId:_??""});case"datepicker":case"datetime":return l.jsx(nO,{...z});case"keywords":case"tagsinput":return l.jsx(sO,{...z});case"nestedselect":return l.jsx(iO,{...z,levels:K.levels??[]});case"license":return l.jsx(oO,{...z});case"dialcode":return l.jsx(aO,{...z});default:return l.jsx(vh,{...z,maxLength:K.maxLength})}};return l.jsx(C1,{...I,children:l.jsxs("div",{className:sl.form,children:[M.map((K,z)=>{const X=K.section?B1[K.section]:void 0;return X?l.jsx(X1,{title:X.title,description:X.description,children:K.fields.map(V)},K.section??z):l.jsx("div",{className:sl.ungrouped,children:K.fields.map(V)},z)}),O.length===0&&!y&&l.jsx("p",{className:sl.noFields,children:"No fields configured for this tab."})]})})};function wh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function cO(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Yi(e){return e!==null&&e>=0}function uO(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 dO(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Sh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=wh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},Ri={scaleX:1,scaleY:1},fO=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 u=i[o];return u?{x:0,y:r<o?u.top+u.height-(a.top+a.height):u.top-a.top,...Ri}:null}const c=hO(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Ri}:s<r&&s>=o?{x:0,y:a.height+c,...Ri}:{x:0,y:0,...Ri}};function hO(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 Ch="Sortable",Oh=h.createContext({activeIndex:-1,containerId:Ch,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sh,disabled:{draggable:!1,droppable:!1}});function pO(e){let{children:t,id:r,items:n,strategy:s=Sh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=Tc(),f=ts(Ch,r),y=a.rect!==null,g=h.useMemo(()=>n.map(I=>typeof I=="object"&&"id"in I?I.id:I),[n]),_=o!=null,p=o?g.indexOf(o.id):-1,v=u?g.indexOf(u.id):-1,m=h.useRef(g),b=!uO(g,m.current),S=v!==-1&&p===-1||b,w=dO(i);qt(()=>{b&&_&&d(g)},[b,g,_,d]),h.useEffect(()=>{m.current=g},[g]);const O=h.useMemo(()=>({activeIndex:p,containerId:f,disabled:w,disableTransforms:S,items:g,overIndex:v,useDragOverlay:y,sortedRects:cO(g,c),strategy:s}),[p,f,w.draggable,w.droppable,S,g,v,c,y,s]);return h.createElement(Oh.Provider,{value:O},t)}const gO=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return wh(r,n,s).indexOf(t)},yO=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:u}=e;return!u||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},vO={duration:200,easing:"ease"},Eh="transform",mO=wr.Transition.toString({property:Eh,duration:0,easing:"linear"}),bO={roleDescription:"sortable"};function _O(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=h.useState(null),a=h.useRef(r);return qt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const u=dn(n.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}r!==a.current&&(a.current=r)},[t,r,n,s]),h.useEffect(()=>{i&&o(null)},[i]),i}function wO(e){let{animateLayoutChanges:t=yO,attributes:r,disabled:n,data:s,getNewIndex:i=gO,id:o,strategy:a,resizeObserverConfig:c,transition:u=vO}=e;const{items:d,containerId:f,activeIndex:y,disabled:g,disableTransforms:_,sortedRects:p,overIndex:v,useDragOverlay:m,strategy:b}=h.useContext(Oh),S=SO(n,g),w=d.indexOf(o),O=h.useMemo(()=>({sortable:{containerId:f,index:w,items:d},...s}),[f,s,w,d]),I=h.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:k,node:P,isOver:$,setNodeRef:T}=Vy({id:o,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...c}}),{active:A,activatorEvent:F,activeNodeRect:M,attributes:V,setNodeRef:j,listeners:re,isDragging:ue,over:K,setActivatorNodeRef:z,transform:X}=Ic({id:o,data:O,attributes:{...bO,...r},disabled:S.draggable}),B=Eg(T,j),G=!!A,Z=G&&!_&&Yi(y)&&Yi(v),ve=!m&&ue,Te=ve&&Z?X:null,Ce=Z?Te??(a??b)({rects:p,activeNodeRect:M,activeIndex:y,overIndex:v,index:w}):null,se=Yi(y)&&Yi(v)?i({id:o,items:d,activeIndex:y,overIndex:v}):w,me=A==null?void 0:A.id,oe=h.useRef({activeId:me,items:d,newIndex:se,containerId:f}),yt=d!==oe.current.items,Ee=t({active:A,containerId:f,isDragging:ue,isSorting:G,id:o,index:w,items:d,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:u,wasDragging:oe.current.activeId!=null}),it=_O({disabled:!Ee,index:w,node:P,rect:k});return h.useEffect(()=>{G&&oe.current.newIndex!==se&&(oe.current.newIndex=se),f!==oe.current.containerId&&(oe.current.containerId=f),d!==oe.current.items&&(oe.current.items=d)},[G,se,f,d]),h.useEffect(()=>{if(me===oe.current.activeId)return;if(me&&!oe.current.activeId){oe.current.activeId=me;return}const He=setTimeout(()=>{oe.current.activeId=me},50);return()=>clearTimeout(He)},[me]),{active:A,activeIndex:y,attributes:V,data:O,rect:k,index:w,newIndex:se,items:d,isOver:$,isSorting:G,isDragging:ue,listeners:re,node:P,overIndex:v,over:K,setNodeRef:B,setActivatorNodeRef:z,setDroppableNodeRef:T,setDraggableNodeRef:j,transform:it??Ce,transition:Je()};function Je(){if(it||yt&&oe.current.newIndex===w)return mO;if(!(ve&&!ei(F)||!u)&&(G||Ee))return wr.Transition.toString({...u,property:Eh})}}function SO(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 Xi(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 CO=[ge.Down,ge.Right,ge.Up,ge.Left],OO=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(CO.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const y=s.get(f.id);if(y)switch(e.code){case ge.Down:n.top<y.top&&c.push(f);break;case ge.Up:n.top>y.top&&c.push(f);break;case ge.Left:n.left>y.left&&c.push(f);break;case ge.Right:n.left<y.left&&c.push(f);break}});const u=zg({collisionRect:n,droppableRects:s,droppableContainers:c});let d=Jl(u,"id");if(d===(o==null?void 0:o.id)&&u.length>1&&(d=u[1].id),d!=null){const f=i.get(r.id),y=i.get(d),g=y?s.get(y.id):null,_=y==null?void 0:y.node.current;if(_&&g&&f&&y){const v=ni(_).some((I,k)=>a[k]!==I),m=Dh(f,y),b=EO(f,y),S=v||!m?{x:0,y:0}:{x:b?n.width-g.width:0,y:b?n.height-g.height:0},w={x:g.left,y:g.top};return S.x&&S.y?w:rs(w,S)}}}};function Dh(e,t){return!Xi(e)||!Xi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function EO(e,t){return!Xi(e)||!Xi(t)||!Dh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Qr={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"},DO={video:zo,pdf:Fo,h5p:$o,scorm:Bo,audio:jo,quiz:Mo,default:hn},IO=({item:e,onRemove:t,isEditable:r})=>{const n=zi(e),s=DO[n.key]??hn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:u,isDragging:d}=wO({id:e.id,disabled:!r}),f={transform:wr.Transform.toString(c),transition:u,opacity:d?.5:1};return l.jsxs("div",{ref:a,style:f,className:Qr.row,role:"listitem",children:[r&&l.jsx("span",{className:Qr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(Lc,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Qr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Qr.info,children:[l.jsx("span",{className:Qr.name,title:e.name,children:e.name}),l.jsx("span",{className:Qr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Qr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(jr,{size:14})})]})},Yr={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"},TO=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Pe(),i=t?r(t):[],o=e==="edit",a=Yl(Co(si,{activationConstraint:{distance:5}}),Co(To,{coordinateGetter:OO})),c=h.useCallback(d=>{const{active:f,over:y}=d;if(!y||f.id===y.id||!t)return;const g=Pe.getState().getChildrenOf(t),_=g.findIndex(v=>v.id===f.id),p=g.findIndex(v=>v.id===y.id);_<0||p<0||n(t,_,p)},[t,n]),u=h.useCallback(d=>{window.confirm("Remove this content from the unit?")&&s(d)},[s]);return t?l.jsxs("div",{className:Yr.container,children:[l.jsxs("div",{className:Yr.header,children:[l.jsx("span",{className:Yr.heading,children:"Content in this unit"}),l.jsx("span",{className:Yr.count,children:i.length})]}),i.length>0?l.jsx(Ec,{sensors:a,collisionDetection:Ug,onDragEnd:c,children:l.jsx(pO,{items:i.map(d=>d.id),strategy:fO,children:l.jsx("div",{className:Yr.list,role:"list",children:i.map(d=>l.jsx(IO,{item:d,onRemove:u,isEditable:o},d.id))})})}):l.jsxs("div",{className:Yr.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:Yr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(cs,{size:14})," Add content"]})]}):null},Ih={dropZone:"_dropZone_ijo5w_1",active:"_active_ijo5w_14"},NO=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Ih.dropZone} ${e?Ih.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 xO(e){var s;const t={status:["Live"],contentType:["Resource"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((s=(await $e.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:s.result)??{};return{content:n.content??[],count:n.count??0}}async function kO(e){var r,n;return(n=(r=(await $e.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const ke={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"},AO=[{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 PO(e){return AO.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"]},LO={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},FO={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},$O="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function il(e){for(const[t,r]of Object.entries(MO))if(r.includes(e))return t;return"default-player"}function jO(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 BO(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 VO(e,t,r=100){await BO(LO[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 UO=[{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 zO({node:e}){const t=e.metadata??{},r=UO.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:ke.infoStrip,children:r.map(n=>l.jsxs("div",{className:ke.infoChip,children:[n.icon&&l.jsx("span",{className:ke.infoChipIcon,children:n.icon}),l.jsx("span",{className:ke.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function qO({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${ke.coverOverlay} ${t?ke.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:ke.coverThumb}),l.jsx("div",{className:ke.coverPlayRing,children:l.jsx("div",{className:ke.coverPlayIcon})}),l.jsx("span",{className:ke.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:ke.coverSkeleton})})}function HO({message:e}){return l.jsxs("div",{className:ke.playerError,children:[l.jsx("span",{className:ke.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:ke.playerErrorMsg,children:e})]})}function WO({mimeType:e}){const t=PO(e);return l.jsxs("span",{className:ke.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:ke.typeDot}),t.label]})}const ol=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(GO,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:ke.contentPlayerRoot,children:[l.jsxs("div",{className:ke.stage,children:[l.jsxs("div",{className:ke.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:ke.playerHeaderThumb}),l.jsx("span",{className:ke.playerHeaderTitle,children:e.name}),l.jsx(WO,{mimeType:e.mimeType??""})]}),l.jsx(KO,{node:e})]}),l.jsx(zO,{node:e})]})};function KO({node:e}){var v;const t=be(m=>m.editorConfig),[r,n]=h.useState(()=>il(e.mimeType??"")),[s,i]=h.useState(!1),[o,a]=h.useState(null),[c,u]=h.useState(e.metadata??{}),[d,f]=h.useState(!1),y=h.useRef(null),g=h.useRef(null),_=((v=t==null?void 0:t.config)==null?void 0:v.previewCdnUrl)??$O;h.useEffect(()=>{let m=!1;return f(!1),i(!1),a(null),u(e.metadata??{}),n(il(e.mimeType??"")),kO(e.identifier).then(b=>{if(m)return;const S={...e.metadata??{},...b};u(S);const w=b.mimeType??e.mimeType??"";n(il(w)),f(!0)}).catch(()=>{m||f(!0)}),()=>{m=!0}},[e.identifier]);const p=jO(e,c,t);return h.useEffect(()=>{if(!d||r!=="default-player")return;const m=y.current;if(!m)return;m.src=_;const b=()=>{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",b),m.addEventListener("error",S),()=>{m.removeEventListener("load",b),m.removeEventListener("error",S),m.src=""}},[e.identifier,r,_,d]),h.useEffect(()=>{if(!d||r==="default-player")return;const m=g.current;if(!m)return;const b=FO[r];if(!b)return;const S=p;VO(b,r).then(()=>{if(!g.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);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,d]),l.jsxs("div",{className:ke.aspectRatio,children:[o?l.jsx(HO,{message:o}):l.jsx(qO,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:y,id:"contentPlayer",title:e.name,className:ke.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:ke.playerFrame})]})}function GO({node:e,editorMode:t}){const r=be(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:ke.qumlRoot,children:l.jsx("div",{ref:n,className:ke.playerWrapper})})}const Bt={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 QO(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 YO=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var d;const{treeData:s,moveNode:i}=Pe(),o=QO(s,((d=s[0])==null?void 0:d.id)??"",r),[a,c]=h.useState(null),u=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Bt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Bt.modal,children:[l.jsxs("div",{className:Bt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(jr,{size:16})})]}),l.jsxs("div",{className:Bt.body,children:[l.jsx("p",{className:Bt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Bt.list,children:[o.map(f=>l.jsxs("li",{className:`${Bt.item} ${a===f.id?Bt.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(av,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Bt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Bt.footer,children:[l.jsx("button",{className:Bt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Bt.moveBtn,onClick:u,disabled:!a,children:"Move here"})]})]})})},tr={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 RO(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 XO=({onClose:e})=>{const{treeData:t,updateNode:r}=Pe(),n=RO(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:tr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:tr.modal,children:[l.jsxs("div",{className:tr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(jr,{size:16})})]}),l.jsx("div",{className:tr.body,children:n.length===0?l.jsx("p",{className:tr.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:tr.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(u=>({...u,[a.id]:c.target.value})),className:tr.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:tr.footer,children:[l.jsx("button",{className:tr.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:tr.saveBtn,onClick:o,children:[l.jsx(yv,{size:14})," Save"]})]})]})})},Be={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"},ZO=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var A,F;const{updateNode:s,markDirty:i}=Pe(),o=t==="edit",a=zi(e),c=be(M=>M.relationalFormConfig),u=M=>c==null?void 0:c.find(V=>V.code===M),d=M=>!c||!!u(M),f=(M,V)=>{var j;return((j=u(M))==null?void 0:j.label)||V},[y,g]=h.useState(!0),_=((A=e.metadata)==null?void 0:A.relationalMetadata)??{},[p,v]=h.useState(_.name??e.name??""),[m,b]=h.useState(""),[S,w]=h.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((F=e.metadata)==null?void 0:F.keywords)?e.metadata.keywords:[]),[O,I]=h.useState(!!_.optional);h.useEffect(()=>{var V,j;const M=((V=e.metadata)==null?void 0:V.relationalMetadata)??{};v(M.name??e.name??""),w(Array.isArray(M.keywords)?M.keywords:Array.isArray((j=e.metadata)==null?void 0:j.keywords)?e.metadata.keywords:[]),I(!!M.optional)},[e.id]);const k=()=>{p.trim()&&p!==e.name&&(s(e.id,{name:p.trim()}),i())},P=()=>{const M=m.trim();if(M&&!S.includes(M)){const V=[...S,M];w(V),s(e.id,{keywords:V}),i()}b("")},$=M=>{const V=S.filter(j=>j!==M);w(V),s(e.id,{keywords:V}),i()},T=M=>{I(M),s(e.id,{optional:M}),i()};return l.jsxs("div",{className:Be.container,children:[l.jsxs("div",{className:Be.panelHeader,children:[l.jsxs("div",{className:Be.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Be.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Be.panelCollapseBtn,onClick:()=>g(M=>!M),"aria-expanded":y,"aria-label":y?"Collapse metadata panel":"Expand metadata panel",title:y?"Collapse":"Expand",children:y?l.jsx(ls,{size:15}):l.jsx(sv,{size:15})})]}),y&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Be.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Be.icon}),l.jsx("input",{type:"text",className:Be.nameInput,value:p,disabled:!o,onChange:M=>v(M.target.value),onBlur:k,placeholder:"Content name"})]}),d("keywords")&&l.jsxs("div",{className:Be.field,children:[l.jsx("div",{className:Be.fieldHeader,children:l.jsxs("label",{className:Be.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:Be.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:Be.chips,children:S.map(M=>l.jsxs("span",{className:Be.chip,children:[M,o&&l.jsx("button",{type:"button",className:Be.chipRemove,onClick:()=>$(M),children:"×"})]},M))}),o&&l.jsxs("div",{className:Be.keywordInput,children:[l.jsx("input",{type:"text",className:Be.input,value:m,placeholder:"Add keyword and press Enter",onChange:M=>b(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),P())}}),l.jsx("button",{type:"button",className:Be.addBtn,onClick:P,children:"Add"})]})]}),d("optional")&&l.jsxs("div",{className:Be.field,children:[l.jsx("label",{className:Be.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Be.radioGroup,children:[l.jsxs("label",{className:Be.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!0,onChange:()=>T(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Be.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:O===!1,onChange:()=>T(!1),disabled:!o}),"No"]})]})]})]}),n]})},Ts={iconBtn:"_iconBtn_vl14u_1",editable:"_editable_vl14u_14",iconImg:"_iconImg_vl14u_26",placeholder:"_placeholder_vl14u_34",removeBtn:"_removeBtn_vl14u_41"},JO=({nodeId:e,value:t,editable:r})=>{const[n,s]=h.useState(!1),{updateNode:i,markDirty:o}=Pe(),a=u=>{i(e,{appIcon:u}),o(),s(!1)},c=u=>{u.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[Ts.iconBtn,r?Ts.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:u=>{r&&(u.key==="Enter"||u.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:Ts.iconImg}):l.jsx("div",{className:Ts.placeholder,children:l.jsx(Fc,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:Ts.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Uo,{size:11})})]}),n&&l.jsx(bh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Yt={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"},eE=["application/vnd.sunbird.questionset"],tE=({editorMode:e,onToolbarEvent:t})=>{var A,F,M,V;const[r,n]=h.useState("details"),[s,i]=h.useState([]),[o,a]=h.useState(null),[c,u]=h.useState(!1),d=h.useRef(null),f=h.useRef(),{selectedNodeId:y,breadcrumb:g,activeNodeMeta:_,updateNode:p,treeData:v}=Pe(),m=be(j=>{var re,ue,K,z;return((ue=(re=j.editorConfig)==null?void 0:re.context)==null?void 0:ue.contentId)??((z=(K=j.editorConfig)==null?void 0:K.context)==null?void 0:z.identifier)??""}),b=y?Th(v,y):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),O=b&&eE.includes(b.mimeType??""),I=b&&!b.isFolder&&!O&&!S,k=((A=b==null?void 0:b.metadata)==null?void 0:A.rejectComment)??(S?(M=(F=v[0])==null?void 0:F.metadata)==null?void 0:M.rejectComment:void 0),P=h.useCallback(()=>{const j=d.current;if(!j||!y)return;const re=j.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{p(y,{name:re})},600)},[y,p]),$=h.useCallback(j=>{t({action:"onFormValueChange",data:j})},[t]),T=h.useCallback((j,re)=>{i(re),t({action:"onFormStatusChange",data:{isValid:j}})},[t]);return b?O?l.jsx(ol,{node:b,editorMode:e,type:"quml"}):I?l.jsxs("div",{className:Yt.leafContentLayout,children:[l.jsx(ol,{node:b,editorMode:e,type:"content"}),l.jsx(ZO,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(YO,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Yt.container,children:[l.jsx(b1,{crumbs:g}),k&&l.jsxs("div",{className:Yt.reviewComment,role:"alert",children:[l.jsx("span",{className:Yt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Yt.reviewCommentText,children:k})]}),l.jsxs("div",{className:Yt.titleRow,children:[S&&y&&l.jsx(JO,{nodeId:y,value:String(b.appIcon??((V=b.metadata)==null?void 0:V.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:d,className:Yt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:P,onBlur:P,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(_1,{activeTab:r,onChange:j=>n(j),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Yt.formArea,children:l.jsx(lO,{nodeMetadata:_,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:$,onFormStatusChange:T},`${y??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Yt.contentListArea,children:l.jsx(TO,{editorMode:e})}),l.jsx(NO,{isActive:!1,label:"Drop to add content to this unit",nodeId:y??void 0,className:Yt.dropZone}),c&&l.jsx(XO,{contentId:m,onClose:()=>u(!1)})]}):l.jsx("div",{className:Yt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Th(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Th(r.children,t);if(n)return n}}}const Nh=di((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})}})),rE=20;function xh(){var u;const e=be(d=>d.editorConfig),t=Pe(d=>d.selectedNodeId),r=Pe(d=>d.treeData),n=h.useCallback(()=>{if(!t||!r.length)return 0;function d(f,y,g=0){var _;for(const p of f){if(p.id===y)return g;if((_=p.children)!=null&&_.length){const v=d(p.children,y,g+1);if(v>=0)return v}}return-1}return Math.max(0,d(r,t))},[t,r])(),s=(u=e==null?void 0:e.config)==null?void 0:u.hierarchy;if(!s)return[...Mf];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:[...Mf]}function nE(){const e=Nh(),t=be(f=>{var y,g;return((g=(y=f.editorConfig)==null?void 0:y.context)==null?void 0:g.channel)??""}),r=xh(),n=h.useRef(),s=h.useCallback(async(f="",y="all",g={},_=!0,p=!1)=>{var v,m,b,S,w;e.setLoading(!0);try{const O={status:["Live"],contentType:["Resource"],primaryCategory:y&&y!=="all"?[y]:r};(v=g==null?void 0:g.board)!=null&&v.length&&(O.board=g.board),(m=g==null?void 0:g.medium)!=null&&m.length&&(O.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(O.gradeLevel=g.gradeLevel),(S=g==null?void 0:g.subject)!=null&&S.length&&(O.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(O.primaryCategory=g.primaryCategory);const I=_?0:e.offset,{content:k,count:P}=await xO({filters:O,query:f,limit:f?50:rE,offset:I,channel:t||void 0,sortBy:p?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(k,P):e.appendContent(k,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]),u=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]),d=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:d,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:u,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const cr={card:"_card_grbmp_1",addBtn:"_addBtn_grbmp_17",dragging:"_dragging_grbmp_24",ctIcon:"_ctIcon_grbmp_29",info:"_info_grbmp_33",name:"_name_grbmp_41",meta:"_meta_grbmp_50",added:"_added_grbmp_78",addedBadge:"_addedBadge_grbmp_87"},sE={video:zo,pdf:Fo,h5p:$o,scorm:Bo,audio:jo,quiz:Mo,default:hn},iE=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var p,v;const i=zi(e),o=sE[i.key]??hn,a=qa(),c=a1(),u=a&&!s&&c,{attributes:d,listeners:f,setNodeRef:y,isDragging:g}=Ic({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:y,className:[cr.card,g?cr.dragging:"",s?cr.added:""].join(" "),"aria-label":e.name,...n?{...d,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,cr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:cr.info,children:[l.jsx("span",{className:cr.name,title:e.name,children:e.name}),l.jsxs("span",{className:cr.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:cr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(fn,{size:12})}),!s&&l.jsx("button",{type:"button",className:cr.addBtn,onClick:m=>{m.stopPropagation(),u&&t(e)},disabled:!u,"aria-label":`Add ${e.name} to unit`,title:a?"Add to unit":"Only Draft content can be edited",children:l.jsx(cs,{size:14})})]})},kh={chips:"_chips_xhhaq_1",chip:"_chip_xhhaq_1"},oE=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:kh.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",kh.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),Xe={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"},aE=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],lE=new Set(["board","medium","gradeLevel","subject","topic"]),cE=({local:e,toggle:t})=>{const r=xh();return r.length?l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:Xe.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[Xe.chip,(e.primaryCategory??[]).includes(n)?Xe.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},uE=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=be(p=>p.editorConfig),i=be(p=>p.searchFormConfig),{organisationFramework:o}=dh((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=h.useState(t),u=i!=null&&i.length?i.filter(p=>lE.has(p.code)).map(p=>({key:p.code,label:p.label||p.code})):aE;h.useEffect(()=>{c(t)},[t]);const d=(p,v)=>{c(m=>{const b=m[p]??[],S=b.includes(v)?b.filter(w=>w!==v):[...b,v];return{...m,[p]:S}})},f=(o==null?void 0:o.categories)??[],y=p=>{var v;return((v=f.find(m=>m.code===p))==null?void 0:v.terms)??[]};return e?l.jsxs("div",{className:Xe.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:Xe.header,children:[l.jsx("span",{className:Xe.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:Xe.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(jr,{size:16})})]}),l.jsxs("div",{className:Xe.body,children:[u.map(({key:p,label:v})=>{const m=y(p);return m.length?l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionLabel,children:v}),l.jsx("div",{className:Xe.chips,children:m.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[Xe.chip,(a[p]??[]).includes(b.name)?Xe.active:""].join(" "),onClick:()=>d(p,b.name),children:b.name},b.identifier))})]},p):null}),l.jsx(cE,{local:a,toggle:d})]}),l.jsxs("div",{className:Xe.footer,children:[l.jsx("button",{type:"button",className:Xe.resetBtn,onClick:()=>c({}),children:"Reset"}),l.jsx("button",{type:"button",className:Xe.applyBtn,onClick:()=>{r(a),n()},children:"Apply"})]})]}):null},ur={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"},dE=({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 Fe.createPortal(l.jsx("div",{className:ur.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:ur.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:ur.header,children:[l.jsx("span",{className:ur.title,title:e.name,children:e.name}),l.jsx("div",{className:ur.headerActions,children:l.jsx("button",{type:"button",className:ur.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(jr,{size:16})})})]}),l.jsx("div",{className:ur.playerArea,children:l.jsx(ol,{node:n,editorMode:"read",type:"content"})}),l.jsx("div",{className:ur.footer,children:l.jsx("button",{type:"button",className:ur.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},Ae={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 fE(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 hE=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:u,search:d,setFilter:f,applyAdvancedFilters:y,toggleSort:g,loadMore:_}=nE(),{addResource:p,selectedNodeId:v,treeData:m}=Pe(),b=e==="edit",[S,w]=h.useState(!1),[O,I]=h.useState({}),[k,P]=h.useState(null),$=h.useMemo(()=>fE(m),[m]),T=h.useCallback(j=>{if(!v){Le.error("Select a unit first");return}p(j,v),Le.success(`Added "${j.name}"`)},[v,p]),A=h.useCallback(j=>{I(j),y(j)},[y]),F=h.useCallback(j=>{P(j)},[]),M=h.useCallback(j=>{T(j),P(null)},[T]),V=h.useMemo(()=>Object.values(O).reduce((j,re)=>j+((re==null?void 0:re.length)??0),0),[O]);return l.jsxs("div",{className:Ae.dock,children:[l.jsx("div",{className:Ae.header,children:l.jsxs("div",{className:Ae.headerLeft,children:[l.jsx("button",{type:"button",className:Ae.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(hv,{size:15})}),l.jsx(uv,{size:16}),l.jsx("span",{className:Ae.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ae.count,children:i})]})}),l.jsxs("div",{className:Ae.searchRow,children:[l.jsxs("div",{className:Ae.searchWrap,children:[l.jsx(Vo,{size:14,className:Ae.searchIcon}),l.jsx("input",{type:"search",className:Ae.searchInput,placeholder:"Search content…",value:a,onChange:j=>d(j.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ae.filterToggleBtn,c?Ae.filterToggleBtnActive:""].join(" "),onClick:g,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(rv,{size:15}):l.jsx(iv,{size:15})}),l.jsxs("button",{type:"button",className:[Ae.filterToggleBtn,S?Ae.filterToggleBtnActive:""].join(" "),onClick:()=>w(j=>!j),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(bv,{size:15}),V>0&&l.jsx("span",{className:Ae.filterBadge,children:V})]})]}),l.jsx("div",{className:Ae.filters,children:l.jsx(oE,{filters:l1,active:o,onChange:f})}),l.jsxs("div",{className:Ae.mainArea,children:[l.jsx("div",{className:Ae.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((j,re)=>l.jsxs("div",{className:Ae.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ae.skeletonIcon}),l.jsxs("div",{className:Ae.skeletonText,children:[l.jsx("div",{className:Ae.skeletonLine}),l.jsx("div",{className:Ae.skeletonLineSm})]})]},re)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(j=>l.jsx(iE,{item:j,onAdd:T,onPreview:F,isDraggable:b,isAdded:$.has(j.identifier)},j.identifier)),u&&l.jsx("button",{type:"button",className:Ae.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ae.emptyState,children:[l.jsx(Vo,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:Ae.sidePanelOverlay,children:l.jsx(uE,{isOpen:S,filters:O,onApply:A,onClose:()=>w(!1)})}),k&&l.jsx(dE,{content:k,onAdd:M,onClose:()=>P(null)})]})]})};function pE(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","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","medium","gradeLevel","subject","additionalCategories","keywords","language"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function u(y,g=!1){const _={};for(const[p,v]of Object.entries(y))if(!i.has(p)&&!(g&&o.has(p)))if(a.has(p))Array.isArray(v)?_[p]=v:v!=null&&v!==""?_[p]=[v]:_[p]=[];else if(c.has(p)){const m=Number(v);isNaN(m)||(_[p]=m)}else _[p]=v;return _}function d(y){var _;const g={};for(const p of y.children??[]){if(p.isFolder)continue;const v=t[p.identifier];if(!v)continue;const{isNew:m,...b}=v;if(Object.keys(b).length===0)continue;const S=((_=p.metadata)==null?void 0:_.relationalMetadata)??{};g[p.identifier]={name:p.name,...S,...b}}return g}function f(y,g){var S,w;const _=y.identifier,p=t[_],v=_.startsWith("temp-")||!!(p!=null&&p.isNew),m=!y.isFolder&&!g;if(g||v||p&&!m){let O;if(v)O={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((S=y.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=y.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:y.name,visibility:"Parent",channel:r,...u(y.metadata??{})};else if(g){const{isNew:I,...k}=p??{};O={...u(y.metadata??{},!0),...u(k,!1),name:y.name}}else{const{isNew:I,...k}=p??{};O={name:y.name,visibility:"Parent",...u(k,!0)}}n[_]={metadata:O,objectType:y.objectType||(y.isFolder?"Collection":"Content"),root:g,isNew:v}}const b=y.isFolder?d(y):{};s[_]={name:y.name,children:(y.children??[]).map(O=>O.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(y.children??[]).forEach(O=>f(O,!1))}return e.forEach((y,g)=>f(y,g===0)),{nodesModified:n,hierarchy:s}}function gE(){const[e,t]=h.useState(!1),r=Pe(u=>u.treeCache),n=Pe(u=>u.treeData),s=be(u=>u.isDirty),{setIsDirty:i,setLastSaved:o}=be(),a=be(u=>u.editorConfig);return{save:h.useCallback(async()=>{if(!a||e)return;const u=a.context.contentId??a.context.identifier??"";if(!u)return;const d=a.context.channel??"",f=a.context.userId??a.context.uid??"";t(!0);try{const{nodesModified:y,hierarchy:g}=pE(n,r,d);await Mb(u,y,g,f);const _=new Date().toISOString();o(_),i(!1)}catch(y){console.error("[useSaveHierarchy] save failed:",y),Le.error("Failed to save. Please try again.")}finally{t(!1)}},[a,e,n,r,i,o]),isSaving:e,isDirty:s,lastSaved:be.getState().lastSaved}}function yE(e){const t=be(s=>s.editorConfig),r=be(s=>s.setButtonLoader);return{runAction:h.useCallback(async(s,i)=>{var c,u,d,f;const o=((c=t==null?void 0:t.context)==null?void 0:c.contentId)??((u=t==null?void 0:t.context)==null?void 0:u.identifier)??"";if(!o)return Le.error("No content identifier found."),!1;const a=((d=t==null?void 0:t.context)==null?void 0:d.userId)??((f=t==null?void 0:t.context)==null?void 0:f.uid)??"";try{switch(s){case"sendForReview":return r("saveCollection",!0),await e(),await $b(o),Le.success("Content sent for review"),!0;case"reject":{r("rejectCollection",!0);const y=(i==null?void 0:i.comment)??"";return await jb(o,y),Le.success("Content rejected and sent back to the author"),!0}case"publish":return r("publishCollection",!0),await e(),await Lb(o,a),Le.success("Content published successfully"),!0;default:return!1}}catch(y){console.error(`[useToolbarActions] ${s} failed`,y);const g=s==="sendForReview"?"send for review":s==="reject"?"reject":"publish";return Le.error(`Failed to ${g}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const At={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"},vE=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=h.useState(null),[o,a]=h.useState(!1),[c,u]=h.useState(!1),[d,f]=h.useState(!1),{addResource:y,treeData:g}=Pe(),_=Pe(T=>T.selectedNodeId),{save:p,isSaving:v,isDirty:m,lastSaved:b}=gE(),{runAction:S}=yE(p);h.useEffect(()=>{if(!m)return;const T=A=>{A.preventDefault(),A.returnValue=""};return window.addEventListener("beforeunload",T),()=>window.removeEventListener("beforeunload",T)},[m]);const w=Yl(Co(si,{activationConstraint:{distance:8}})),O=h.useCallback(T=>{var F;const A=(F=T.active.data.current)==null?void 0:F.item;A&&i(A)},[]),I=h.useCallback(T=>{var j,re;i(null);const A=(j=T.active.data.current)==null?void 0:j.item;if(!A)return;const F=T.over,M=(F==null?void 0:F.id)??_??void 0;if(!M){Le.error("Drop onto a unit to add content");return}const V=(re=g[0])==null?void 0:re.id;if(M===V){Le.error("Drop content onto a unit, not directly on the course.");return}y(A,M),r==null||r(A,M),Le.success(`Added "${A.name}" to unit`)},[_,y,r]),k=h.useCallback(async T=>{if(T.action==="back"&&m){f(!0);return}if(T.action==="saveCollection"){await p(),n==null||n(g),t==null||t(T);return}if(T.action==="sendForReview"||T.action==="reject"||T.action==="publish"){await S(T.action,T.data)&&(t==null||t(T));return}t==null||t(T)},[p,S,t,n,g,m]),P=h.useCallback(async()=>{await p(),f(!1),n==null||n(g),t==null||t({action:"back"})},[p,n,t,g]),$=h.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Ec,{sensors:w,onDragStart:O,onDragEnd:I,children:[l.jsxs("div",{className:At.shell,children:[l.jsx(Qb,{editorMode:e,isSaving:v,isDirty:m,lastSaved:b,onToolbarEvent:k}),l.jsxs("div",{className:[At.workspace,o?At.sidebarCollapsed:"",c?At.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[At.outline,o?At.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(m1,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(T=>!T)})}),o&&l.jsx("button",{className:At.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:At.editor,role:"main","aria-label":"Content editor",children:l.jsx(tE,{editorMode:e,onToolbarEvent:k})}),l.jsx("aside",{className:[At.dock,c?At.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(hE,{editorMode:e,collapsed:c,onToggleCollapse:()=>u(T=>!T)})}),c&&l.jsx("button",{className:At.dockReopenTab,onClick:()=>u(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Xy,{dropAnimation:null,children:s?l.jsx("div",{className:At.dragChip,children:l.jsx("span",{className:At.dragChipLabel,children:s.name})}):null}),d&&l.jsx(Yb,{onSave:P,onDiscard:$,onCancel:()=>f(!1),isSaving:v})]})},mE="v4";function bE(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 Ah(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:bE(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 Dr(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.title??n.name??void 0;for(const i of n.fields)i.code&&r.push(Ah(i,s))}else n.code&&r.push(Ah(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function _E(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 wE(e,t,r="Collection"){var c,u;const s=(u=(c=(await $e.post(`/action/object/category/definition/${mE}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:c.result)==null?void 0:u.objectCategoryDefinition,i=(s==null?void 0:s.forms)??{},o=(s==null?void 0:s.objectMetadata)??{},a=o.config??{};return{rootForm:Dr(i.create),unitForm:Dr(i.unitMetadata),childForm:Dr(i.childMetadata),searchForm:Dr(i.search??i.searchConfig),relationalForm:Dr(i.relationalMetadata),publishChecklist:Dr(i.publishchecklist),reviewChecklist:Dr(i.review),rfcChecklist:Dr(i.requestforchangeschecklist),schemaDefaults:_E(o.schema),frameworkMetadata:a.frameworkMetadata??{},sourcingSettings:a.sourcingSettings??{}}}function SE({config:e,onError:t}){const[r,n]=h.useState(!0),[s,i]=h.useState(null),[o,a]=h.useState(!1),{setEditorConfig:c,setEditorMode:u,setCategoryDefinition:d}=be(),{setTreeData:f,selectNode:y}=Pe();return h.useEffect(()=>{let g=!1;async function _(){var p,v;try{n(!0),i(null),e.apiBaseUrl&&Bu(e.apiBaseUrl),c(e),u(e.config.mode);const m=e.context.contentId??e.context.identifier??"";if(m){const{rootNode:b}=await zu(m);g||(f(b?[b]:[]),b&&y(b.id));const S=e.config.primaryCategory??"Course",w=e.context.channel??"";try{const O=await wE(S,w,e.config.objectType??"Collection");if(!g){d(O);const I=(v=(p=O.sourcingSettings)==null?void 0:p.collection)==null?void 0:v.maxDepth;I&&!e.config.maxDepth&&c({...e,config:{...e.config,maxDepth:I}})}}catch{}}g||a(!0)}catch(m){if(!g){const b=m instanceof Error?m:new Error(String(m));i(b),t==null||t(b)}}finally{g||n(!1)}}return _(),()=>{g=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const Ns={root:"_root_qcpw6_1",loadingState:"_loadingState_qcpw6_10",loadingSpinner:"_loadingSpinner_qcpw6_20",errorState:"_errorState_qcpw6_34"},CE=new Cp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class OE 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:Ns.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 EE(e){const{isLoading:t,error:r}=SE({config:e,onError:e.onError}),n=be(s=>s.editorMode);return t?l.jsxs("div",{className:Ns.loadingState,children:[l.jsx("div",{className:Ns.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:Ns.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${Ns.root}`,children:l.jsx(vE,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Ph=e=>l.jsx(OE,{onError:e.onError,children:l.jsxs(Ep,{client:CE,children:[l.jsx(EE,{...e}),l.jsx(Og,{position:"top-right",toastOptions:{duration:3e3}})]})}),Zi=Symbol.for("r2wc.reactRender"),Mh=Symbol.for("r2wc.shouldRender"),Ji=Symbol.for("r2wc.root");function DE(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function IE(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Lh={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Zi]()}}),e[Zi]()}};function TE(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var u=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?u.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.'),u.attachShadow({mode:"open"})),u},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(u,d){return d in e.propTypes||d in a},set:function(u,d,f,y){return i&&(s[d]=!0),typeof d=="symbol"||s[d]||d in u?(e.propTypes&&d in e.propTypes&&Lh.expando(y,d,f),Reflect.set(u,d,f,y)):(Lh.expando(y,d,f),!0)},getOwnPropertyDescriptor:function(u,d){var f=Reflect.getOwnPropertyDescriptor(u,d);if(f)return f;if(d in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Mh]=!0,this[Zi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[Ji].unmount():r.unmountComponentAtNode(this)},a[Zi]=function(){if(this[Mh]===!0){var u={};Object.keys(this).forEach(function(y){s[y]!==!1&&(u[y]=this[y])},this),i=!0;const d=n.shadow?this.shadowRoot:this,f=t.createElement(e,u);typeof r.createRoot=="function"?(this[Ji]||(this[Ji]=r.createRoot(d)),this[Ji].render(f)):r.render(f,d),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return DE(u)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(u,d,f){var y=n.dashStyleAttributes?IE(u):u;this[y]=f}),o}var xs={},ks=Fe;if(process.env.NODE_ENV==="production")xs.createRoot=ks.createRoot,xs.hydrateRoot=ks.hydrateRoot;else{var eo=ks.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;xs.createRoot=function(e,t){eo.usingClientEntryPoint=!0;try{return ks.createRoot(e,t)}finally{eo.usingClientEntryPoint=!1}},xs.hydrateRoot=function(e,t,r){eo.usingClientEntryPoint=!0;try{return ks.hydrateRoot(e,t,r)}finally{eo.usingClientEntryPoint=!1}}}function NE(){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 xE(e="sb-collection-editor"){if(NE(),typeof customElements>"u"||customElements.get(e))return;const t=TE(Ph,h,xs,{});customElements.define(e,t)}pe.CollectionEditor=Ph,pe.registerCollectionEditor=xE,pe.setApiBaseUrl=Bu,pe.useEditorStore=be,pe.useLibraryStore=Nh,pe.useTreeStore=Pe,Object.defineProperty(pe,Symbol.toStringTag,{value:"Module"})});