@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.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ml=e=>{throw TypeError(e)};var io=(e,t,r)=>t.has(e)||ml("Cannot "+r);var E=(e,t,r)=>(io(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?ml("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),G=(e,t,r,n)=>(io(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),he=(e,t,r)=>(io(e,t,"access private method"),r);var zs=(e,t,r,n)=>({set _(s){G(e,t,s,r)},get _(){return E(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Rr=require("react-dom"),l=require("react/jsx-runtime");function Yh(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=Yh(p);var Ds=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(){}},zr,Er,xn,Bu,Xh=(Bu=class extends Ds{constructor(){super();ne(this,zr);ne(this,Er);ne(this,xn);G(this,xn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Er)||this.setEventListener(E(this,xn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Er))==null||t.call(this),G(this,Er,void 0))}setEventListener(t){var r;G(this,xn,t),(r=E(this,Er))==null||r.call(this),G(this,Er,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,zr)!==t&&(G(this,zr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,zr)=="boolean"?E(this,zr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zr=new WeakMap,Er=new WeakMap,xn=new WeakMap,Bu),Na=new Xh,Zh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rr,qr,Vu,Jh=(Vu=class{constructor(){ne(this,rr,Zh);ne(this,qr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,qr)&&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}),G(this,rr,e),process.env.NODE_ENV!=="production"&&G(this,qr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,qr,!0),E(this,rr).setTimeout(e,t)}clearTimeout(e){E(this,rr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,qr,!0),E(this,rr).setInterval(e,t)}clearInterval(e){E(this,rr).clearInterval(e)}},rr=new WeakMap,qr=new WeakMap,Vu),Br=new Jh;function ep(e){setTimeout(e,0)}var tp=typeof window>"u"||"Deno"in globalThis;function Ct(){}function rp(e,t){return typeof e=="function"?e(t):e}function Fo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Yu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kr(e,t){return typeof e=="function"?e(t):e}function jt(e,t){return typeof e=="function"?e(t):e}function yl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Ta(o,t.options))return!1}else if(!ps(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 vl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(hs(t.options.mutationKey)!==hs(i))return!1}else if(!ps(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Ta(e,t){return((t==null?void 0:t.queryKeyHashFn)||hs)(e)}function hs(e){return JSON.stringify(e,(t,r)=>Vo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ps(e[r],t[r])):!1}var np=Object.prototype.hasOwnProperty;function $o(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=bl(e)&&bl(t);if(!n&&!(Vo(e)&&Vo(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],m=e[f],g=t[f];if(m===g){c[f]=m,(n?d<i:np.call(e,f))&&u++;continue}if(m===null||g===null||typeof m!="object"||typeof g!="object"){c[f]=g;continue}const _=$o(m,g,r+1);c[f]=_,_===m&&u++}return i===a&&u===i?e:c}function Bo(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 bl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vo(e){if(!_l(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!_l(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function _l(e){return Object.prototype.toString.call(e)==="[object Object]"}function sp(e){return new Promise(t=>{Br.setTimeout(t,e)})}function Uo(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 $o(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 $o(e,t)}return t}function ip(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function op(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var vi=Symbol();function Xu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===vi&&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===vi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Zu(e,t){return typeof e=="function"?e(...t):!!e}function ap(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 gs=(()=>{let e=()=>tp;return{isServer(){return e()},setIsServer(t){e=t}}})();function zo(){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 lp=ep;function cp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=lp;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 st=cp(),Sn,Or,Cn,Uu,up=(Uu=class extends Ds{constructor(){super();ne(this,Sn,!0);ne(this,Or);ne(this,Cn);G(this,Cn,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,Or)||this.setEventListener(E(this,Cn))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Or))==null||t.call(this),G(this,Or,void 0))}setEventListener(t){var r;G(this,Cn,t),(r=E(this,Or))==null||r.call(this),G(this,Or,t(this.setOnline.bind(this)))}setOnline(t){E(this,Sn)!==t&&(G(this,Sn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Sn)}},Sn=new WeakMap,Or=new WeakMap,Cn=new WeakMap,Uu),bi=new up;function dp(e){return Math.min(1e3*2**e,3e4)}function Ju(e){return(e??"online")==="online"?bi.isOnline():!0}var qo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ed(e){let t=!1,r=0,n;const s=zo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new qo(h);m(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>Na.isFocused()&&(e.networkMode==="always"||bi.isOnline())&&e.canRun(),d=()=>Ju(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},m=h=>{i()||(n==null||n(),s.reject(h))},g=()=>new Promise(h=>{var y;n=v=>{(i()||u())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),_=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(f).catch(v=>{var O;if(i())return;const b=e.retry??(gs.isServer()?0:3),x=e.retryDelay??dp,w=typeof x=="function"?x(r,v):x,S=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!S){m(v);return}r++,(O=e.onFail)==null||O.call(e,r,v),sp(w).then(()=>u()?void 0:g()).then(()=>{t?m(v):_()})})};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 Hr,zu,td=(zu=class{constructor(){ne(this,Hr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fo(this.gcTime)&&G(this,Hr,Br.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gs.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Hr)!==void 0&&(Br.clearTimeout(E(this,Hr)),G(this,Hr,void 0))}},Hr=new WeakMap,zu);function fp(e){return{onFetch:(t,r)=>{var d,f,m,g,_;const n=t.options,s=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.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 h=!1;const y=x=>{ap(x,()=>t.signal,()=>h=!0)},v=Xu(t.options,t.fetchOptions),b=async(x,w,S)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const T=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:w,direction:S?"backward":"forward",meta:t.options.meta};return y(k),k})(),R=await v(T),{maxPages:M}=t.options,j=S?op:ip;return{pages:j(x.pages,R,M),pageParams:j(x.pageParams,w,M)}};if(s&&i.length){const x=s==="backward",w=x?hp:wl,S={pages:i,pageParams:o},O=w(n,S);a=await b(S,O,x)}else{const x=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:wl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function wl(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 hp(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 En,Wr,On,$t,Kr,Ye,xs,Qr,Tt,rd,dr,qu,pp=(qu=class extends td{constructor(t){super();ne(this,Tt);ne(this,En);ne(this,Wr);ne(this,On);ne(this,$t);ne(this,Kr);ne(this,Ye);ne(this,xs);ne(this,Qr);G(this,Qr,!1),G(this,xs,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,Kr,t.client),G(this,$t,E(this,Kr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Wr,Sl(this.options)),this.state=t.state??E(this,Wr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,En)}get promise(){var t;return(t=E(this,Ye))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,xs),...t},t!=null&&t._type&&G(this,En,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Sl(this.options);r.data!==void 0&&(this.setState(xl(r.data,r.dataUpdatedAt)),G(this,Wr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,$t).remove(this)}setData(t,r){const n=Uo(this.state.data,t,this.options);return he(this,Tt,dr).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,Tt,dr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,Ye))==null?void 0:n.promise;return(s=E(this,Ye))==null||s.cancel(t),r?r.then(Ct).catch(Ct):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Wr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>jt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>kr(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:!Yu(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,Ye))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,Ye))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,$t).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(E(this,Ye)&&(E(this,Qr)||he(this,Tt,rd).call(this)?E(this,Ye).cancel({revert:!0}):E(this,Ye).cancelRetry()),this.scheduleGc()),E(this,$t).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Tt,dr).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,m,g,_,h,y,v,b,x;if(this.state.fetchStatus!=="idle"&&((u=E(this,Ye))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,Ye))return E(this,Ye).continueRetry(),E(this,Ye).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(S=>S.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(G(this,Qr,!0),n.signal)})},i=()=>{const w=Xu(this.options,r),O=(()=>{const T={client:E(this,Kr),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return G(this,Qr,!1),this.options.persister?this.options.persister(w,O,this):w(O)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,Kr),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,En)==="infinite"?fp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),G(this,On,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&he(this,Tt,dr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),G(this,Ye,ed({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof qo&&w.revert&&this.setState({...E(this,On),fetchStatus:"idle"}),n.abort()},onFail:(w,S)=>{he(this,Tt,dr).call(this,{type:"failed",failureCount:w,error:S})},onPause:()=>{he(this,Tt,dr).call(this,{type:"pause"})},onContinue:()=>{he(this,Tt,dr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,Ye).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=(m=E(this,$t).config).onSuccess)==null||g.call(m,w,this),(h=(_=E(this,$t).config).onSettled)==null||h.call(_,w,this.state.error,this),w}catch(w){if(w instanceof qo){if(w.silent)return E(this,Ye).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,Tt,dr).call(this,{type:"error",error:w}),(v=(y=E(this,$t).config).onError)==null||v.call(y,w,this),(x=(b=E(this,$t).config).onSettled)==null||x.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},En=new WeakMap,Wr=new WeakMap,On=new WeakMap,$t=new WeakMap,Kr=new WeakMap,Ye=new WeakMap,xs=new WeakMap,Qr=new WeakMap,Tt=new WeakSet,rd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},dr=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,...nd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...xl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,On,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),st.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,$t).notify({query:this,type:"updated",action:t})})},qu);function nd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ju(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function xl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Sl(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 St,ge,Ss,vt,Gr,Dn,fr,Dr,Cs,In,Nn,Yr,Xr,Ir,Tn,we,ss,Ho,Wo,Ko,Qo,Go,Yo,Xo,sd,Hu,gp=(Hu=class extends Ds{constructor(t,r){super();ne(this,we);ne(this,St);ne(this,ge);ne(this,Ss);ne(this,vt);ne(this,Gr);ne(this,Dn);ne(this,fr);ne(this,Dr);ne(this,Cs);ne(this,In);ne(this,Nn);ne(this,Yr);ne(this,Xr);ne(this,Ir);ne(this,Tn,new Set);this.options=r,G(this,St,t),G(this,Dr,null),G(this,fr,zo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,ge).addObserver(this),Cl(E(this,ge),this.options)?he(this,we,ss).call(this):this.updateResult(),he(this,we,Qo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zo(E(this,ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zo(E(this,ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,we,Go).call(this),he(this,we,Yo).call(this),E(this,ge).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,ge);if(this.options=E(this,St).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof jt(this.options.enabled,E(this,ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,we,Xo).call(this),E(this,ge).setOptions(this.options),r._defaulted&&!Bo(this.options,r)&&E(this,St).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,ge),observer:this});const s=this.hasListeners();s&&El(E(this,ge),n,this.options,r)&&he(this,we,ss).call(this),this.updateResult(),s&&(E(this,ge)!==n||jt(this.options.enabled,E(this,ge))!==jt(r.enabled,E(this,ge))||kr(this.options.staleTime,E(this,ge))!==kr(r.staleTime,E(this,ge)))&&he(this,we,Ho).call(this);const i=he(this,we,Wo).call(this);s&&(E(this,ge)!==n||jt(this.options.enabled,E(this,ge))!==jt(r.enabled,E(this,ge))||i!==E(this,Ir))&&he(this,we,Ko).call(this,i)}getOptimisticResult(t){const r=E(this,St).getQueryCache().build(E(this,St),t),n=this.createResult(r,t);return yp(this,n)&&(G(this,vt,n),G(this,Dn,this.options),G(this,Gr,E(this,ge).state)),n}getCurrentResult(){return E(this,vt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,fr).status==="pending"&&E(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,Tn).add(t)}getCurrentQuery(){return E(this,ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,St).defaultQueryOptions(t),n=E(this,St).getQueryCache().build(E(this,St),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return he(this,we,ss).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,vt)))}createResult(t,r){var M;const n=E(this,ge),s=this.options,i=E(this,vt),o=E(this,Gr),a=E(this,Dn),u=t!==n?t.state:E(this,Ss),{state:d}=t;let f={...d},m=!1,g;if(r._optimisticResults){const j=this.hasListeners(),k=!j&&Cl(t,r),U=j&&El(t,n,r,s);(k||U)&&(f={...f,...nd(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:h,status:y}=f;g=f.data;let v=!1;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let j;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(j=i.data,v=!0):j=typeof r.placeholderData=="function"?r.placeholderData((M=E(this,Nn))==null?void 0:M.state.data,E(this,Nn)):r.placeholderData,j!==void 0&&(y="success",g=Uo(i==null?void 0:i.data,j,r),m=!0)}if(r.select&&g!==void 0&&!v)if(i&&g===(o==null?void 0:o.data)&&r.select===E(this,Cs))g=E(this,In);else try{G(this,Cs,r.select),g=r.select(g),g=Uo(i==null?void 0:i.data,g,r),G(this,In,g),G(this,Dr,null)}catch(j){G(this,Dr,j)}E(this,Dr)&&(_=E(this,Dr),g=E(this,In),h=Date.now(),y="error");const b=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",S=x&&b,O=g!==void 0,R={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:S,isLoading:S,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:h,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&&!x,isLoadingError:w&&!O,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:w&&O,isStale:ja(t,r),refetch:this.refetch,promise:E(this,fr),isEnabled:jt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const j=R.data!==void 0,k=R.status==="error"&&!j,U=L=>{k?L.reject(R.error):j&&L.resolve(R.data)},A=()=>{const L=G(this,fr,R.promise=zo());U(L)},q=E(this,fr);switch(q.status){case"pending":t.queryHash===n.queryHash&&U(q);break;case"fulfilled":(k||R.data!==q.value)&&A();break;case"rejected":(!k||R.error!==q.reason)&&A();break}}return R}updateResult(){const t=E(this,vt),r=this.createResult(E(this,ge),this.options);if(G(this,Gr,E(this,ge).state),G(this,Dn,this.options),E(this,Gr).data!==void 0&&G(this,Nn,E(this,ge)),Bo(r,t))return;G(this,vt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,Tn).size)return!0;const o=new Set(i??E(this,Tn));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,vt)).some(a=>{const c=a;return E(this,vt)[c]!==t[c]&&o.has(c)})};he(this,we,sd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,we,Qo).call(this)}},St=new WeakMap,ge=new WeakMap,Ss=new WeakMap,vt=new WeakMap,Gr=new WeakMap,Dn=new WeakMap,fr=new WeakMap,Dr=new WeakMap,Cs=new WeakMap,In=new WeakMap,Nn=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Ir=new WeakMap,Tn=new WeakMap,we=new WeakSet,ss=function(t){he(this,we,Xo).call(this);let r=E(this,ge).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ct)),r},Ho=function(){he(this,we,Go).call(this);const t=kr(this.options.staleTime,E(this,ge));if(gs.isServer()||E(this,vt).isStale||!Fo(t))return;const n=Yu(E(this,vt).dataUpdatedAt,t)+1;G(this,Yr,Br.setTimeout(()=>{E(this,vt).isStale||this.updateResult()},n))},Wo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,ge)):this.options.refetchInterval)??!1},Ko=function(t){he(this,we,Yo).call(this),G(this,Ir,t),!(gs.isServer()||jt(this.options.enabled,E(this,ge))===!1||!Fo(E(this,Ir))||E(this,Ir)===0)&&G(this,Xr,Br.setInterval(()=>{(this.options.refetchIntervalInBackground||Na.isFocused())&&he(this,we,ss).call(this)},E(this,Ir)))},Qo=function(){he(this,we,Ho).call(this),he(this,we,Ko).call(this,he(this,we,Wo).call(this))},Go=function(){E(this,Yr)!==void 0&&(Br.clearTimeout(E(this,Yr)),G(this,Yr,void 0))},Yo=function(){E(this,Xr)!==void 0&&(Br.clearInterval(E(this,Xr)),G(this,Xr,void 0))},Xo=function(){const t=E(this,St).getQueryCache().build(E(this,St),this.options);if(t===E(this,ge))return;const r=E(this,ge);G(this,ge,t),G(this,Ss,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},sd=function(t){st.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,vt))}),E(this,St).getQueryCache().notify({query:E(this,ge),type:"observerResultsUpdated"})})},Hu);function mp(e,t){return jt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&jt(t.retryOnMount,e)===!1)}function Cl(e,t){return mp(e,t)||e.state.data!==void 0&&Zo(e,t,t.refetchOnMount)}function Zo(e,t,r){if(jt(t.enabled,e)!==!1&&kr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&ja(e,t)}return!1}function El(e,t,r,n){return(e!==t||jt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&ja(e,r)}function ja(e,t){return jt(t.enabled,e)!==!1&&e.isStaleByTime(kr(t.staleTime,e))}function yp(e,t){return!Bo(e.getCurrentResult(),t)}var Es,nr,ht,Zr,sr,_r,Wu,vp=(Wu=class extends td{constructor(t){super();ne(this,sr);ne(this,Es);ne(this,nr);ne(this,ht);ne(this,Zr);G(this,Es,t.client),this.mutationId=t.mutationId,G(this,ht,t.mutationCache),G(this,nr,[]),this.state=t.state||bp(),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,ht).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,nr,E(this,nr).filter(r=>r!==t)),this.scheduleGc(),E(this,ht).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,nr).length||(this.state.status==="pending"?this.scheduleGc():E(this,ht).remove(this))}continue(){var t;return((t=E(this,Zr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,f,m,g,_,h,y,v,b,x,w,S,O,T;const r=()=>{he(this,sr,_r).call(this,{type:"continue"})},n={client:E(this,Es),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,Zr,ed({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(R,M)=>{he(this,sr,_r).call(this,{type:"failed",failureCount:R,error:M})},onPause:()=>{he(this,sr,_r).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,ht).canRun(this)}));const s=this.state.status==="pending",i=!E(this,Zr).canStart();try{if(s)r();else{he(this,sr,_r).call(this,{type:"pending",variables:t,isPaused:i}),E(this,ht).config.onMutate&&await E(this,ht).config.onMutate(t,this,n);const M=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));M!==this.state.context&&he(this,sr,_r).call(this,{type:"pending",context:M,variables:t,isPaused:i})}const R=await E(this,Zr).start();return await((u=(c=E(this,ht).config).onSuccess)==null?void 0:u.call(c,R,t,this.state.context,this,n)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,R,t,this.state.context,n)),await((g=(m=E(this,ht).config).onSettled)==null?void 0:g.call(m,R,null,this.state.variables,this.state.context,this,n)),await((h=(_=this.options).onSettled)==null?void 0:h.call(_,R,null,t,this.state.context,n)),he(this,sr,_r).call(this,{type:"success",data:R}),R}catch(R){try{await((v=(y=E(this,ht).config).onError)==null?void 0:v.call(y,R,t,this.state.context,this,n))}catch(M){Promise.reject(M)}try{await((x=(b=this.options).onError)==null?void 0:x.call(b,R,t,this.state.context,n))}catch(M){Promise.reject(M)}try{await((S=(w=E(this,ht).config).onSettled)==null?void 0:S.call(w,void 0,R,this.state.variables,this.state.context,this,n))}catch(M){Promise.reject(M)}try{await((T=(O=this.options).onSettled)==null?void 0:T.call(O,void 0,R,t,this.state.context,n))}catch(M){Promise.reject(M)}throw he(this,sr,_r).call(this,{type:"error",error:R}),R}finally{E(this,ht).runNext(this)}}},Es=new WeakMap,nr=new WeakMap,ht=new WeakMap,Zr=new WeakMap,sr=new WeakSet,_r=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),st.batch(()=>{E(this,nr).forEach(n=>{n.onMutationUpdate(t)}),E(this,ht).notify({mutation:this,type:"updated",action:t})})},Wu);function bp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hr,Ht,Os,Ku,_p=(Ku=class extends Ds{constructor(t={}){super();ne(this,hr);ne(this,Ht);ne(this,Os);this.config=t,G(this,hr,new Set),G(this,Ht,new Map),G(this,Os,0)}build(t,r,n){const s=new vp({client:t,mutationCache:this,mutationId:++zs(this,Os)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,hr).add(t);const r=qs(t);if(typeof r=="string"){const n=E(this,Ht).get(r);n?n.push(t):E(this,Ht).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,hr).delete(t)){const r=qs(t);if(typeof r=="string"){const n=E(this,Ht).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&E(this,Ht).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=qs(t);if(typeof r=="string"){const n=E(this,Ht).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=qs(t);if(typeof r=="string"){const s=(n=E(this,Ht).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){st.batch(()=>{E(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,hr).clear(),E(this,Ht).clear()})}getAll(){return Array.from(E(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>vl(r,n))}findAll(t={}){return this.getAll().filter(r=>vl(t,r))}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return st.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ct))))}},hr=new WeakMap,Ht=new WeakMap,Os=new WeakMap,Ku);function qs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ir,Qu,wp=(Qu=class extends Ds{constructor(t={}){super();ne(this,ir);this.config=t,G(this,ir,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Ta(s,r);let o=this.get(i);return o||(o=new pp({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(){st.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=>yl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>yl(t,n)):r}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){st.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){st.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ir=new WeakMap,Qu),Ve,Nr,Tr,jn,Rn,jr,kn,An,Gu,xp=(Gu=class{constructor(e={}){ne(this,Ve);ne(this,Nr);ne(this,Tr);ne(this,jn);ne(this,Rn);ne(this,jr);ne(this,kn);ne(this,An);G(this,Ve,e.queryCache||new wp),G(this,Nr,e.mutationCache||new _p),G(this,Tr,e.defaultOptions||{}),G(this,jn,new Map),G(this,Rn,new Map),G(this,jr,0)}mount(){zs(this,jr)._++,E(this,jr)===1&&(G(this,kn,Na.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ve).onFocus())})),G(this,An,bi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Ve).onOnline())})))}unmount(){var e,t;zs(this,jr)._--,E(this,jr)===0&&((e=E(this,kn))==null||e.call(this),G(this,kn,void 0),(t=E(this,An))==null||t.call(this),G(this,An,void 0))}isFetching(e){return E(this,Ve).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Nr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,Ve).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,Ve).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(kr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,Ve).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,Ve).get(n.queryHash),i=s==null?void 0:s.state.data,o=rp(t,i);if(o!==void 0)return E(this,Ve).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return st.batch(()=>E(this,Ve).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,Ve).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,Ve);st.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,Ve);return st.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=st.batch(()=>E(this,Ve).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ct).catch(Ct)}invalidateQueries(e,t={}){return st.batch(()=>(E(this,Ve).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=st.batch(()=>E(this,Ve).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ct)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Ct)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,Ve).build(this,t);return r.isStaleByTime(kr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ct).catch(Ct)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ct).catch(Ct)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return bi.isOnline()?E(this,Nr).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Ve)}getMutationCache(){return E(this,Nr)}getDefaultOptions(){return E(this,Tr)}setDefaultOptions(e){G(this,Tr,e)}setQueryDefaults(e,t){E(this,jn).set(hs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,jn).values()],r={};return t.forEach(n=>{ps(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,Rn).set(hs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Rn).values()],r={};return t.forEach(n=>{ps(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Tr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ta(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===vi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Tr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Ve).clear(),E(this,Nr).clear()}},Ve=new WeakMap,Nr=new WeakMap,Tr=new WeakMap,jn=new WeakMap,Rn=new WeakMap,jr=new WeakMap,kn=new WeakMap,An=new WeakMap,Gu),id=_e.createContext(void 0),Sp=e=>{const t=_e.useContext(id);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Cp=({client:e,children:t})=>(_e.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(id.Provider,{value:e,children:t})),od=_e.createContext(!1),Ep=()=>_e.useContext(od);od.Provider;function Op(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dp=_e.createContext(Op()),Ip=()=>_e.useContext(Dp),Np=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Zu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Tp=e=>{_e.useEffect(()=>{e.clearReset()},[e])},jp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Zu(r,[e.error,n])),Rp=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},kp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ap=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ol=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Pp(e,t,r){var g,_,h,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Ep(),s=Ip(),i=Sp(),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,Rp(o),Np(o,s,a),Tp(s);const u=!i.getQueryCache().get(o.queryHash),[d]=_e.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),m=!n&&c;if(_e.useSyncExternalStore(_e.useCallback(v=>{const b=m?d.subscribe(st.batchCalls(v)):Ct;return d.updateResult(),b},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),_e.useEffect(()=>{d.setOptions(o)},[o,d]),Ap(o,f))throw Ol(o,d,s);if(jp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!gs.isServer()&&kp(f,n)){const v=u?Ol(o,d,s):a==null?void 0:a.promise;v==null||v.catch(Ct).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Dl(e,t){return Pp(e,gp)}let Mp={data:""},Lp=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||Mp},Fp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,$p=/\/\*[^]*?\*\/| +/g,Il=/\n+/g,Cr=(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"?Cr(o,i):i+"{"+Cr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Cr(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+=Cr.p?Cr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},yr={},ad=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+ad(e[r]);return t}return e},Bp=(e,t,r,n,s)=>{let i=ad(e),o=yr[i]||(yr[i]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(i));if(!yr[o]){let c=i!==e?e:(u=>{let d,f,m=[{}];for(;d=Fp.exec(u.replace($p,""));)d[4]?m.shift():d[3]?(f=d[3].replace(Il," ").trim(),m.unshift(m[0][f]=m[0][f]||{})):m[0][d[1]]=d[2].replace(Il," ").trim();return m[0]})(e);yr[o]=Cr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&yr.g;return r&&(yr.g=yr[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)})(yr[o],t,n,a),o},Vp=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":Cr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Pi(e){let t=this||{},r=e.call?e(t.p):e;return Bp(r.unshift?r.raw?Vp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Lp(t.target),t.g,t.o,t.k)}let ld,Jo,ea;Pi.bind({g:1});let pr=Pi.bind({k:1});function Up(e,t,r,n){Cr.p=t,ld=e,Jo=r,ea=n}function Pr(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:Jo&&Jo()},a),r.o=/go\d/.test(c),a.className=Pi.apply(r,n)+(c?" "+c:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),ea&&u[0]&&ea(a),ld(u,a)}return s}}var zp=e=>typeof e=="function",_i=(e,t)=>zp(e)?e(t):e,qp=(()=>{let e=0;return()=>(++e).toString()})(),cd=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Hp=20,Ra="default",ud=(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 ud(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}))}}},ri=[],dd={toasts:[],pausedAt:void 0,settings:{toastLimit:Hp}},or={},fd=(e,t=Ra)=>{or[t]=ud(or[t]||dd,e),ri.forEach(([r,n])=>{r===t&&n(or[t])})},hd=e=>Object.keys(or).forEach(t=>fd(e,t)),Wp=e=>Object.keys(or).find(t=>or[t].toasts.some(r=>r.id===e)),Mi=(e=Ra)=>t=>{fd(t,e)},Kp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Qp=(e={},t=Ra)=>{let[r,n]=p.useState(or[t]||dd),s=p.useRef(or[t]);p.useEffect(()=>(s.current!==or[t]&&n(or[t]),ri.push([t,n]),()=>{let o=ri.findIndex(([a])=>a===t);o>-1&&ri.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)||Kp[o.type],style:{...e.style,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...r,toasts:i}},Gp=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||qp()}),Is=e=>(t,r)=>{let n=Gp(t,e,r);return Mi(n.toasterId||Wp(n.id))({type:2,toast:n}),n.id},Ke=(e,t)=>Is("blank")(e,t);Ke.error=Is("error");Ke.success=Is("success");Ke.loading=Is("loading");Ke.custom=Is("custom");Ke.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Mi(t)(r):hd(r)};Ke.dismissAll=e=>Ke.dismiss(void 0,e);Ke.remove=(e,t)=>{let r={type:4,toastId:e};t?Mi(t)(r):hd(r)};Ke.removeAll=e=>Ke.remove(void 0,e);Ke.promise=(e,t,r)=>{let n=Ke.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?_i(t.success,s):void 0;return i?Ke.success(i,{id:n,...r,...r==null?void 0:r.success}):Ke.dismiss(n),s}).catch(s=>{let i=t.error?_i(t.error,s):void 0;i?Ke.error(i,{id:n,...r,...r==null?void 0:r.error}):Ke.dismiss(n)}),e};var Yp=1e3,Xp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Qp(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,m=Yp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},m);s.set(f,g)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),m=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&Ke.dismiss(g.id);return}return setTimeout(()=>Ke.dismiss(g.id,t),_)});return()=>{m.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=p.useCallback(Mi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,m)=>{o({type:1,toast:{id:f,height:m}})},[o]),u=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),d=p.useCallback((f,m)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:h}=m||{},y=r.filter(x=>(x.position||h)===(f.position||h)&&x.height),v=y.findIndex(x=>x.id===f.id),b=y.filter((x,w)=>w<v&&x.visible).length;return y.filter(x=>x.visible).slice(...g?[b+1]:[0,b]).reduce((x,w)=>x+(w.height||0)+_,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let m=s.get(f.id);m&&(clearTimeout(m),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:u,calculateOffset:d}}},Zp=pr`
1
+ "use strict";var ml=e=>{throw TypeError(e)};var io=(e,t,r)=>t.has(e)||ml("Cannot "+r);var O=(e,t,r)=>(io(e,t,"read from private field"),r?r.call(e):t.get(e)),ne=(e,t,r)=>t.has(e)?ml("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),G=(e,t,r,n)=>(io(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),he=(e,t,r)=>(io(e,t,"access private method"),r);var zs=(e,t,r,n)=>({set _(s){G(e,t,s,r)},get _(){return O(e,t,n)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),Rr=require("react-dom"),l=require("react/jsx-runtime");function Yh(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=Yh(p);var Ds=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(){}},zr,Or,xn,Bu,Xh=(Bu=class extends Ds{constructor(){super();ne(this,zr);ne(this,Or);ne(this,xn);G(this,xn,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){O(this,Or)||this.setEventListener(O(this,xn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Or))==null||t.call(this),G(this,Or,void 0))}setEventListener(t){var r;G(this,xn,t),(r=O(this,Or))==null||r.call(this),G(this,Or,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){O(this,zr)!==t&&(G(this,zr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof O(this,zr)=="boolean"?O(this,zr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zr=new WeakMap,Or=new WeakMap,xn=new WeakMap,Bu),Na=new Xh,Zh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},tr,qr,Vu,Jh=(Vu=class{constructor(){ne(this,tr,Zh);ne(this,qr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&O(this,qr)&&e!==O(this,tr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:O(this,tr),provider:e}),G(this,tr,e),process.env.NODE_ENV!=="production"&&G(this,qr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,qr,!0),O(this,tr).setTimeout(e,t)}clearTimeout(e){O(this,tr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,qr,!0),O(this,tr).setInterval(e,t)}clearInterval(e){O(this,tr).clearInterval(e)}},tr=new WeakMap,qr=new WeakMap,Vu),Br=new Jh;function ep(e){setTimeout(e,0)}var tp=typeof window>"u"||"Deno"in globalThis;function Ct(){}function rp(e,t){return typeof e=="function"?e(t):e}function Fo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Yu(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kr(e,t){return typeof e=="function"?e(t):e}function Tt(e,t){return typeof e=="function"?e(t):e}function yl(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Ta(o,t.options))return!1}else if(!ps(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 vl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(hs(t.options.mutationKey)!==hs(i))return!1}else if(!ps(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Ta(e,t){return((t==null?void 0:t.queryKeyHashFn)||hs)(e)}function hs(e){return JSON.stringify(e,(t,r)=>Vo(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ps(e[r],t[r])):!1}var np=Object.prototype.hasOwnProperty;function $o(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=bl(e)&&bl(t);if(!n&&!(Vo(e)&&Vo(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],m=e[f],g=t[f];if(m===g){c[f]=m,(n?d<i:np.call(e,f))&&u++;continue}if(m===null||g===null||typeof m!="object"||typeof g!="object"){c[f]=g;continue}const _=$o(m,g,r+1);c[f]=_,_===m&&u++}return i===a&&u===i?e:c}function Bo(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 bl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vo(e){if(!_l(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!_l(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function _l(e){return Object.prototype.toString.call(e)==="[object Object]"}function sp(e){return new Promise(t=>{Br.setTimeout(t,e)})}function Uo(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 $o(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 $o(e,t)}return t}function ip(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function op(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var vi=Symbol();function Xu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===vi&&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===vi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Zu(e,t){return typeof e=="function"?e(...t):!!e}function ap(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 gs=(()=>{let e=()=>tp;return{isServer(){return e()},setIsServer(t){e=t}}})();function zo(){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 lp=ep;function cp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=lp;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 st=cp(),Sn,Er,Cn,Uu,up=(Uu=class extends Ds{constructor(){super();ne(this,Sn,!0);ne(this,Er);ne(this,Cn);G(this,Cn,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,Er)||this.setEventListener(O(this,Cn))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Er))==null||t.call(this),G(this,Er,void 0))}setEventListener(t){var r;G(this,Cn,t),(r=O(this,Er))==null||r.call(this),G(this,Er,t(this.setOnline.bind(this)))}setOnline(t){O(this,Sn)!==t&&(G(this,Sn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return O(this,Sn)}},Sn=new WeakMap,Er=new WeakMap,Cn=new WeakMap,Uu),bi=new up;function dp(e){return Math.min(1e3*2**e,3e4)}function Ju(e){return(e??"online")==="online"?bi.isOnline():!0}var qo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ed(e){let t=!1,r=0,n;const s=zo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new qo(h);m(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>Na.isFocused()&&(e.networkMode==="always"||bi.isOnline())&&e.canRun(),d=()=>Ju(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},m=h=>{i()||(n==null||n(),s.reject(h))},g=()=>new Promise(h=>{var y;n=v=>{(i()||u())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),_=()=>{if(i())return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(v){h=Promise.reject(v)}Promise.resolve(h).then(f).catch(v=>{var D;if(i())return;const b=e.retry??(gs.isServer()?0:3),x=e.retryDelay??dp,w=typeof x=="function"?x(r,v):x,C=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!C){m(v);return}r++,(D=e.onFail)==null||D.call(e,r,v),sp(w).then(()=>u()?void 0:g()).then(()=>{t?m(v):_()})})};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 Hr,zu,td=(zu=class{constructor(){ne(this,Hr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fo(this.gcTime)&&G(this,Hr,Br.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gs.isServer()?1/0:5*60*1e3))}clearGcTimeout(){O(this,Hr)!==void 0&&(Br.clearTimeout(O(this,Hr)),G(this,Hr,void 0))}},Hr=new WeakMap,zu);function fp(e){return{onFetch:(t,r)=>{var d,f,m,g,_;const n=t.options,s=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.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 h=!1;const y=x=>{ap(x,()=>t.signal,()=>h=!0)},v=Xu(t.options,t.fetchOptions),b=async(x,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&x.pages.length)return Promise.resolve(x);const j=(()=>{const R={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return y(R),R})(),k=await v(j),{maxPages:L}=t.options,I=C?op:ip;return{pages:I(x.pages,k,L),pageParams:I(x.pageParams,w,L)}};if(s&&i.length){const x=s==="backward",w=x?hp:wl,C={pages:i,pageParams:o},D=w(n,C);a=await b(C,D,x)}else{const x=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:wl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function wl(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 hp(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 On,Wr,En,Ft,Kr,Ge,xs,Qr,Nt,rd,dr,qu,pp=(qu=class extends td{constructor(t){super();ne(this,Nt);ne(this,On);ne(this,Wr);ne(this,En);ne(this,Ft);ne(this,Kr);ne(this,Ge);ne(this,xs);ne(this,Qr);G(this,Qr,!1),G(this,xs,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,Kr,t.client),G(this,Ft,O(this,Kr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Wr,Sl(this.options)),this.state=t.state??O(this,Wr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return O(this,On)}get promise(){var t;return(t=O(this,Ge))==null?void 0:t.promise}setOptions(t){if(this.options={...O(this,xs),...t},t!=null&&t._type&&G(this,On,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Sl(this.options);r.data!==void 0&&(this.setState(xl(r.data,r.dataUpdatedAt)),G(this,Wr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Ft).remove(this)}setData(t,r){const n=Uo(this.state.data,t,this.options);return he(this,Nt,dr).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,Nt,dr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=O(this,Ge))==null?void 0:n.promise;return(s=O(this,Ge))==null||s.cancel(t),r?r.then(Ct).catch(Ct):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return O(this,Wr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Tt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>kr(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:!Yu(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ge))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=O(this,Ge))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Ft).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,Ge)&&(O(this,Qr)||he(this,Nt,rd).call(this)?O(this,Ge).cancel({revert:!0}):O(this,Ge).cancelRetry()),this.scheduleGc()),O(this,Ft).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Nt,dr).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,m,g,_,h,y,v,b,x;if(this.state.fetchStatus!=="idle"&&((u=O(this,Ge))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(O(this,Ge))return O(this,Ge).continueRetry(),O(this,Ge).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(G(this,Qr,!0),n.signal)})},i=()=>{const w=Xu(this.options,r),D=(()=>{const j={client:O(this,Kr),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return G(this,Qr,!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,Kr),state:this.state,fetchFn:i};return s(w),w})(),c=O(this,On)==="infinite"?fp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),G(this,En,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&he(this,Nt,dr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),G(this,Ge,ed({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof qo&&w.revert&&this.setState({...O(this,En),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{he(this,Nt,dr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{he(this,Nt,dr).call(this,{type:"pause"})},onContinue:()=>{he(this,Nt,dr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await O(this,Ge).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=(m=O(this,Ft).config).onSuccess)==null||g.call(m,w,this),(h=(_=O(this,Ft).config).onSettled)==null||h.call(_,w,this.state.error,this),w}catch(w){if(w instanceof qo){if(w.silent)return O(this,Ge).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw he(this,Nt,dr).call(this,{type:"error",error:w}),(v=(y=O(this,Ft).config).onError)==null||v.call(y,w,this),(x=(b=O(this,Ft).config).onSettled)==null||x.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},On=new WeakMap,Wr=new WeakMap,En=new WeakMap,Ft=new WeakMap,Kr=new WeakMap,Ge=new WeakMap,xs=new WeakMap,Qr=new WeakMap,Nt=new WeakSet,rd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},dr=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,...nd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...xl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,En,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),st.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),O(this,Ft).notify({query:this,type:"updated",action:t})})},qu);function nd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ju(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function xl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Sl(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 St,ge,Ss,yt,Gr,Dn,fr,Dr,Cs,In,Nn,Yr,Xr,Ir,Tn,xe,ss,Ho,Wo,Ko,Qo,Go,Yo,Xo,sd,Hu,gp=(Hu=class extends Ds{constructor(t,r){super();ne(this,xe);ne(this,St);ne(this,ge);ne(this,Ss);ne(this,yt);ne(this,Gr);ne(this,Dn);ne(this,fr);ne(this,Dr);ne(this,Cs);ne(this,In);ne(this,Nn);ne(this,Yr);ne(this,Xr);ne(this,Ir);ne(this,Tn,new Set);this.options=r,G(this,St,t),G(this,Dr,null),G(this,fr,zo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ge).addObserver(this),Cl(O(this,ge),this.options)?he(this,xe,ss).call(this):this.updateResult(),he(this,xe,Qo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Zo(O(this,ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Zo(O(this,ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,xe,Go).call(this),he(this,xe,Yo).call(this),O(this,ge).removeObserver(this)}setOptions(t){const r=this.options,n=O(this,ge);if(this.options=O(this,St).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tt(this.options.enabled,O(this,ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,xe,Xo).call(this),O(this,ge).setOptions(this.options),r._defaulted&&!Bo(this.options,r)&&O(this,St).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ge),observer:this});const s=this.hasListeners();s&&Ol(O(this,ge),n,this.options,r)&&he(this,xe,ss).call(this),this.updateResult(),s&&(O(this,ge)!==n||Tt(this.options.enabled,O(this,ge))!==Tt(r.enabled,O(this,ge))||kr(this.options.staleTime,O(this,ge))!==kr(r.staleTime,O(this,ge)))&&he(this,xe,Ho).call(this);const i=he(this,xe,Wo).call(this);s&&(O(this,ge)!==n||Tt(this.options.enabled,O(this,ge))!==Tt(r.enabled,O(this,ge))||i!==O(this,Ir))&&he(this,xe,Ko).call(this,i)}getOptimisticResult(t){const r=O(this,St).getQueryCache().build(O(this,St),t),n=this.createResult(r,t);return yp(this,n)&&(G(this,yt,n),G(this,Dn,this.options),G(this,Gr,O(this,ge).state)),n}getCurrentResult(){return O(this,yt)}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,Tn).add(t)}getCurrentQuery(){return O(this,ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=O(this,St).defaultQueryOptions(t),n=O(this,St).getQueryCache().build(O(this,St),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return he(this,xe,ss).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,yt)))}createResult(t,r){var L;const n=O(this,ge),s=this.options,i=O(this,yt),o=O(this,Gr),a=O(this,Dn),u=t!==n?t.state:O(this,Ss),{state:d}=t;let f={...d},m=!1,g;if(r._optimisticResults){const I=this.hasListeners(),R=!I&&Cl(t,r),M=I&&Ol(t,n,r,s);(R||M)&&(f={...f,...nd(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:h,status:y}=f;g=f.data;let v=!1;if(r.placeholderData!==void 0&&g===void 0&&y==="pending"){let I;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(I=i.data,v=!0):I=typeof r.placeholderData=="function"?r.placeholderData((L=O(this,Nn))==null?void 0:L.state.data,O(this,Nn)):r.placeholderData,I!==void 0&&(y="success",g=Uo(i==null?void 0:i.data,I,r),m=!0)}if(r.select&&g!==void 0&&!v)if(i&&g===(o==null?void 0:o.data)&&r.select===O(this,Cs))g=O(this,In);else try{G(this,Cs,r.select),g=r.select(g),g=Uo(i==null?void 0:i.data,g,r),G(this,In,g),G(this,Dr,null)}catch(I){G(this,Dr,I)}O(this,Dr)&&(_=O(this,Dr),g=O(this,In),h=Date.now(),y="error");const b=f.fetchStatus==="fetching",x=y==="pending",w=y==="error",C=x&&b,D=g!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:g,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:h,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&&!x,isLoadingError:w&&!D,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:w&&D,isStale:ja(t,r),refetch:this.refetch,promise:O(this,fr),isEnabled:Tt(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=k.data!==void 0,R=k.status==="error"&&!I,M=F=>{R?F.reject(k.error):I&&F.resolve(k.data)},A=()=>{const F=G(this,fr,k.promise=zo());M(F)},B=O(this,fr);switch(B.status){case"pending":t.queryHash===n.queryHash&&M(B);break;case"fulfilled":(R||k.data!==B.value)&&A();break;case"rejected":(!R||k.error!==B.reason)&&A();break}}return k}updateResult(){const t=O(this,yt),r=this.createResult(O(this,ge),this.options);if(G(this,Gr,O(this,ge).state),G(this,Dn,this.options),O(this,Gr).data!==void 0&&G(this,Nn,O(this,ge)),Bo(r,t))return;G(this,yt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,Tn).size)return!0;const o=new Set(i??O(this,Tn));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,yt)).some(a=>{const c=a;return O(this,yt)[c]!==t[c]&&o.has(c)})};he(this,xe,sd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,xe,Qo).call(this)}},St=new WeakMap,ge=new WeakMap,Ss=new WeakMap,yt=new WeakMap,Gr=new WeakMap,Dn=new WeakMap,fr=new WeakMap,Dr=new WeakMap,Cs=new WeakMap,In=new WeakMap,Nn=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Ir=new WeakMap,Tn=new WeakMap,xe=new WeakSet,ss=function(t){he(this,xe,Xo).call(this);let r=O(this,ge).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ct)),r},Ho=function(){he(this,xe,Go).call(this);const t=kr(this.options.staleTime,O(this,ge));if(gs.isServer()||O(this,yt).isStale||!Fo(t))return;const n=Yu(O(this,yt).dataUpdatedAt,t)+1;G(this,Yr,Br.setTimeout(()=>{O(this,yt).isStale||this.updateResult()},n))},Wo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ge)):this.options.refetchInterval)??!1},Ko=function(t){he(this,xe,Yo).call(this),G(this,Ir,t),!(gs.isServer()||Tt(this.options.enabled,O(this,ge))===!1||!Fo(O(this,Ir))||O(this,Ir)===0)&&G(this,Xr,Br.setInterval(()=>{(this.options.refetchIntervalInBackground||Na.isFocused())&&he(this,xe,ss).call(this)},O(this,Ir)))},Qo=function(){he(this,xe,Ho).call(this),he(this,xe,Ko).call(this,he(this,xe,Wo).call(this))},Go=function(){O(this,Yr)!==void 0&&(Br.clearTimeout(O(this,Yr)),G(this,Yr,void 0))},Yo=function(){O(this,Xr)!==void 0&&(Br.clearInterval(O(this,Xr)),G(this,Xr,void 0))},Xo=function(){const t=O(this,St).getQueryCache().build(O(this,St),this.options);if(t===O(this,ge))return;const r=O(this,ge);G(this,ge,t),G(this,Ss,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},sd=function(t){st.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(O(this,yt))}),O(this,St).getQueryCache().notify({query:O(this,ge),type:"observerResultsUpdated"})})},Hu);function mp(e,t){return Tt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Tt(t.retryOnMount,e)===!1)}function Cl(e,t){return mp(e,t)||e.state.data!==void 0&&Zo(e,t,t.refetchOnMount)}function Zo(e,t,r){if(Tt(t.enabled,e)!==!1&&kr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&ja(e,t)}return!1}function Ol(e,t,r,n){return(e!==t||Tt(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&ja(e,r)}function ja(e,t){return Tt(t.enabled,e)!==!1&&e.isStaleByTime(kr(t.staleTime,e))}function yp(e,t){return!Bo(e.getCurrentResult(),t)}var Os,rr,ft,Zr,nr,_r,Wu,vp=(Wu=class extends td{constructor(t){super();ne(this,nr);ne(this,Os);ne(this,rr);ne(this,ft);ne(this,Zr);G(this,Os,t.client),this.mutationId=t.mutationId,G(this,ft,t.mutationCache),G(this,rr,[]),this.state=t.state||bp(),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,rr).includes(t)||(O(this,rr).push(t),this.clearGcTimeout(),O(this,ft).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,rr,O(this,rr).filter(r=>r!==t)),this.scheduleGc(),O(this,ft).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,rr).length||(this.state.status==="pending"?this.scheduleGc():O(this,ft).remove(this))}continue(){var t;return((t=O(this,Zr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,d,f,m,g,_,h,y,v,b,x,w,C,D,j;const r=()=>{he(this,nr,_r).call(this,{type:"continue"})},n={client:O(this,Os),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,Zr,ed({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(k,L)=>{he(this,nr,_r).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{he(this,nr,_r).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ft).canRun(this)}));const s=this.state.status==="pending",i=!O(this,Zr).canStart();try{if(s)r();else{he(this,nr,_r).call(this,{type:"pending",variables:t,isPaused:i}),O(this,ft).config.onMutate&&await O(this,ft).config.onMutate(t,this,n);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));L!==this.state.context&&he(this,nr,_r).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const k=await O(this,Zr).start();return await((u=(c=O(this,ft).config).onSuccess)==null?void 0:u.call(c,k,t,this.state.context,this,n)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,k,t,this.state.context,n)),await((g=(m=O(this,ft).config).onSettled)==null?void 0:g.call(m,k,null,this.state.variables,this.state.context,this,n)),await((h=(_=this.options).onSettled)==null?void 0:h.call(_,k,null,t,this.state.context,n)),he(this,nr,_r).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(y=O(this,ft).config).onError)==null?void 0:v.call(y,k,t,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((x=(b=this.options).onError)==null?void 0:x.call(b,k,t,this.state.context,n))}catch(L){Promise.reject(L)}try{await((C=(w=O(this,ft).config).onSettled)==null?void 0:C.call(w,void 0,k,this.state.variables,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((j=(D=this.options).onSettled)==null?void 0:j.call(D,void 0,k,t,this.state.context,n))}catch(L){Promise.reject(L)}throw he(this,nr,_r).call(this,{type:"error",error:k}),k}finally{O(this,ft).runNext(this)}}},Os=new WeakMap,rr=new WeakMap,ft=new WeakMap,Zr=new WeakMap,nr=new WeakSet,_r=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),st.batch(()=>{O(this,rr).forEach(n=>{n.onMutationUpdate(t)}),O(this,ft).notify({mutation:this,type:"updated",action:t})})},Wu);function bp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hr,qt,Es,Ku,_p=(Ku=class extends Ds{constructor(t={}){super();ne(this,hr);ne(this,qt);ne(this,Es);this.config=t,G(this,hr,new Set),G(this,qt,new Map),G(this,Es,0)}build(t,r,n){const s=new vp({client:t,mutationCache:this,mutationId:++zs(this,Es)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){O(this,hr).add(t);const r=qs(t);if(typeof r=="string"){const n=O(this,qt).get(r);n?n.push(t):O(this,qt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,hr).delete(t)){const r=qs(t);if(typeof r=="string"){const n=O(this,qt).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,qt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=qs(t);if(typeof r=="string"){const n=O(this,qt).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=qs(t);if(typeof r=="string"){const s=(n=O(this,qt).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(){st.batch(()=>{O(this,hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,hr).clear(),O(this,qt).clear()})}getAll(){return Array.from(O(this,hr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>vl(r,n))}findAll(t={}){return this.getAll().filter(r=>vl(t,r))}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return st.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ct))))}},hr=new WeakMap,qt=new WeakMap,Es=new WeakMap,Ku);function qs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var sr,Qu,wp=(Qu=class extends Ds{constructor(t={}){super();ne(this,sr);this.config=t,G(this,sr,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Ta(s,r);let o=this.get(i);return o||(o=new pp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){O(this,sr).has(t.queryHash)||(O(this,sr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=O(this,sr).get(t.queryHash);r&&(t.destroy(),r===t&&O(this,sr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){st.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,sr).get(t)}getAll(){return[...O(this,sr).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>yl(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>yl(t,n)):r}notify(t){st.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){st.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){st.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},sr=new WeakMap,Qu),Ue,Nr,Tr,jn,Rn,jr,kn,An,Gu,xp=(Gu=class{constructor(e={}){ne(this,Ue);ne(this,Nr);ne(this,Tr);ne(this,jn);ne(this,Rn);ne(this,jr);ne(this,kn);ne(this,An);G(this,Ue,e.queryCache||new wp),G(this,Nr,e.mutationCache||new _p),G(this,Tr,e.defaultOptions||{}),G(this,jn,new Map),G(this,Rn,new Map),G(this,jr,0)}mount(){zs(this,jr)._++,O(this,jr)===1&&(G(this,kn,Na.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ue).onFocus())})),G(this,An,bi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Ue).onOnline())})))}unmount(){var e,t;zs(this,jr)._--,O(this,jr)===0&&((e=O(this,kn))==null||e.call(this),G(this,kn,void 0),(t=O(this,An))==null||t.call(this),G(this,An,void 0))}isFetching(e){return O(this,Ue).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Nr).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=O(this,Ue).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=O(this,Ue).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(kr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return O(this,Ue).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,Ue).get(n.queryHash),i=s==null?void 0:s.state.data,o=rp(t,i);if(o!==void 0)return O(this,Ue).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return st.batch(()=>O(this,Ue).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,Ue).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=O(this,Ue);st.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=O(this,Ue);return st.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=st.batch(()=>O(this,Ue).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ct).catch(Ct)}invalidateQueries(e,t={}){return st.batch(()=>(O(this,Ue).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=st.batch(()=>O(this,Ue).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(Ct)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Ct)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=O(this,Ue).build(this,t);return r.isStaleByTime(kr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ct).catch(Ct)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ct).catch(Ct)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return bi.isOnline()?O(this,Nr).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ue)}getMutationCache(){return O(this,Nr)}getDefaultOptions(){return O(this,Tr)}setDefaultOptions(e){G(this,Tr,e)}setQueryDefaults(e,t){O(this,jn).set(hs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,jn).values()],r={};return t.forEach(n=>{ps(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){O(this,Rn).set(hs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Rn).values()],r={};return t.forEach(n=>{ps(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,Tr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ta(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===vi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Tr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Ue).clear(),O(this,Nr).clear()}},Ue=new WeakMap,Nr=new WeakMap,Tr=new WeakMap,jn=new WeakMap,Rn=new WeakMap,jr=new WeakMap,kn=new WeakMap,An=new WeakMap,Gu),id=we.createContext(void 0),Sp=e=>{const t=we.useContext(id);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Cp=({client:e,children:t})=>(we.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(id.Provider,{value:e,children:t})),od=we.createContext(!1),Op=()=>we.useContext(od);od.Provider;function Ep(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Dp=we.createContext(Ep()),Ip=()=>we.useContext(Dp),Np=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Zu(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Tp=e=>{we.useEffect(()=>{e.clearReset()},[e])},jp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Zu(r,[e.error,n])),Rp=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},kp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ap=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,El=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Pp(e,t,r){var g,_,h,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Op(),s=Ip(),i=Sp(),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,Rp(o),Np(o,s,a),Tp(s);const u=!i.getQueryCache().get(o.queryHash),[d]=we.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),m=!n&&c;if(we.useSyncExternalStore(we.useCallback(v=>{const b=m?d.subscribe(st.batchCalls(v)):Ct;return d.updateResult(),b},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),we.useEffect(()=>{d.setOptions(o)},[o,d]),Ap(o,f))throw El(o,d,s);if(jp({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,f),o.experimental_prefetchInRender&&!gs.isServer()&&kp(f,n)){const v=u?El(o,d,s):a==null?void 0:a.promise;v==null||v.catch(Ct).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Dl(e,t){return Pp(e,gp)}let Mp={data:""},Lp=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||Mp},Fp=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,$p=/\/\*[^]*?\*\/| +/g,Il=/\n+/g,Cr=(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"?Cr(o,i):i+"{"+Cr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Cr(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+=Cr.p?Cr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},yr={},ad=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+ad(e[r]);return t}return e},Bp=(e,t,r,n,s)=>{let i=ad(e),o=yr[i]||(yr[i]=(c=>{let u=0,d=11;for(;u<c.length;)d=101*d+c.charCodeAt(u++)>>>0;return"go"+d})(i));if(!yr[o]){let c=i!==e?e:(u=>{let d,f,m=[{}];for(;d=Fp.exec(u.replace($p,""));)d[4]?m.shift():d[3]?(f=d[3].replace(Il," ").trim(),m.unshift(m[0][f]=m[0][f]||{})):m[0][d[1]]=d[2].replace(Il," ").trim();return m[0]})(e);yr[o]=Cr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&yr.g;return r&&(yr.g=yr[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)})(yr[o],t,n,a),o},Vp=(e,t,r)=>e.reduce((n,s,i)=>{let o=t[i];if(o&&o.call){let a=o(r),c=a&&a.props&&a.props.className||/^go/.test(a)&&a;o=c?"."+c:a&&typeof a=="object"?a.props?"":Cr(a,""):a===!1?"":a}return n+s+(o??"")},"");function Pi(e){let t=this||{},r=e.call?e(t.p):e;return Bp(r.unshift?r.raw?Vp(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,Lp(t.target),t.g,t.o,t.k)}let ld,Jo,ea;Pi.bind({g:1});let pr=Pi.bind({k:1});function Up(e,t,r,n){Cr.p=t,ld=e,Jo=r,ea=n}function Pr(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:Jo&&Jo()},a),r.o=/go\d/.test(c),a.className=Pi.apply(r,n)+(c?" "+c:"");let u=e;return e[0]&&(u=a.as||e,delete a.as),ea&&u[0]&&ea(a),ld(u,a)}return s}}var zp=e=>typeof e=="function",_i=(e,t)=>zp(e)?e(t):e,qp=(()=>{let e=0;return()=>(++e).toString()})(),cd=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Hp=20,Ra="default",ud=(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 ud(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}))}}},ri=[],dd={toasts:[],pausedAt:void 0,settings:{toastLimit:Hp}},ir={},fd=(e,t=Ra)=>{ir[t]=ud(ir[t]||dd,e),ri.forEach(([r,n])=>{r===t&&n(ir[t])})},hd=e=>Object.keys(ir).forEach(t=>fd(e,t)),Wp=e=>Object.keys(ir).find(t=>ir[t].toasts.some(r=>r.id===e)),Mi=(e=Ra)=>t=>{fd(t,e)},Kp={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Qp=(e={},t=Ra)=>{let[r,n]=p.useState(ir[t]||dd),s=p.useRef(ir[t]);p.useEffect(()=>(s.current!==ir[t]&&n(ir[t]),ri.push([t,n]),()=>{let o=ri.findIndex(([a])=>a===t);o>-1&&ri.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)||Kp[o.type],style:{...e.style,...(u=e[o.type])==null?void 0:u.style,...o.style}}});return{...r,toasts:i}},Gp=(e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(r==null?void 0:r.id)||qp()}),Is=e=>(t,r)=>{let n=Gp(t,e,r);return Mi(n.toasterId||Wp(n.id))({type:2,toast:n}),n.id},We=(e,t)=>Is("blank")(e,t);We.error=Is("error");We.success=Is("success");We.loading=Is("loading");We.custom=Is("custom");We.dismiss=(e,t)=>{let r={type:3,toastId:e};t?Mi(t)(r):hd(r)};We.dismissAll=e=>We.dismiss(void 0,e);We.remove=(e,t)=>{let r={type:4,toastId:e};t?Mi(t)(r):hd(r)};We.removeAll=e=>We.remove(void 0,e);We.promise=(e,t,r)=>{let n=We.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?_i(t.success,s):void 0;return i?We.success(i,{id:n,...r,...r==null?void 0:r.success}):We.dismiss(n),s}).catch(s=>{let i=t.error?_i(t.error,s):void 0;i?We.error(i,{id:n,...r,...r==null?void 0:r.error}):We.dismiss(n)}),e};var Yp=1e3,Xp=(e,t="default")=>{let{toasts:r,pausedAt:n}=Qp(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,m=Yp)=>{if(s.has(f))return;let g=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},m);s.set(f,g)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),m=r.map(g=>{if(g.duration===1/0)return;let _=(g.duration||0)+g.pauseDuration-(f-g.createdAt);if(_<0){g.visible&&We.dismiss(g.id);return}return setTimeout(()=>We.dismiss(g.id,t),_)});return()=>{m.forEach(g=>g&&clearTimeout(g))}},[r,n,t]);let o=p.useCallback(Mi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,m)=>{o({type:1,toast:{id:f,height:m}})},[o]),u=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),d=p.useCallback((f,m)=>{let{reverseOrder:g=!1,gutter:_=8,defaultPosition:h}=m||{},y=r.filter(x=>(x.position||h)===(f.position||h)&&x.height),v=y.findIndex(x=>x.id===f.id),b=y.filter((x,w)=>w<v&&x.visible).length;return y.filter(x=>x.visible).slice(...g?[b+1]:[0,b]).reduce((x,w)=>x+(w.height||0)+_,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let m=s.get(f.id);m&&(clearTimeout(m),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:u,calculateOffset:d}}},Zp=pr`
2
2
  from {
3
3
  transform: scale(0) rotate(45deg);
4
4
  opacity: 0;
@@ -144,7 +144,7 @@ to {
144
144
  min-width: 20px;
145
145
  animation: ${cg} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
146
146
  forwards;
147
- `,dg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?_e.createElement(ug,null,t):t:r==="blank"?null:_e.createElement(lg,null,_e.createElement(ng,{...n}),r!=="loading"&&_e.createElement(ag,null,r==="error"?_e.createElement(tg,{...n}):_e.createElement(og,{...n})))},fg=e=>`
147
+ `,dg=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?we.createElement(ug,null,t):t:r==="blank"?null:we.createElement(lg,null,we.createElement(ng,{...n}),r!=="loading"&&we.createElement(ag,null,r==="error"?we.createElement(tg,{...n}):we.createElement(og,{...n})))},fg=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
  `,hg=e=>`
@@ -169,16 +169,16 @@ to {
169
169
  color: inherit;
170
170
  flex: 1 1 auto;
171
171
  white-space: pre-line;
172
- `,vg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=cd()?[pg,gg]:[fg(r),hg(r)];return{animation:t?`${pr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${pr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},bg=_e.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?vg(e.position||t||"top-center",e.visible):{opacity:0},i=_e.createElement(dg,{toast:e}),o=_e.createElement(yg,{...e.ariaProps},_i(e.message,e));return _e.createElement(mg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):_e.createElement(_e.Fragment,null,i,o))});Up(_e.createElement);var _g=({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)},wg=(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:cd()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},xg=Pi`
172
+ `,vg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=cd()?[pg,gg]:[fg(r),hg(r)];return{animation:t?`${pr(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${pr(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},bg=we.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?vg(e.position||t||"top-center",e.visible):{opacity:0},i=we.createElement(dg,{toast:e}),o=we.createElement(yg,{...e.ariaProps},_i(e.message,e));return we.createElement(mg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):we.createElement(we.Fragment,null,i,o))});Up(we.createElement);var _g=({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)},wg=(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:cd()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},xg=Pi`
173
173
  z-index: 9999;
174
174
  > * {
175
175
  pointer-events: auto;
176
176
  }
177
- `,Hs=16,Sg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:u}=Xp(r,i);return _e.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Hs,left:Hs,right:Hs,bottom:Hs,pointerEvents:"none",...o},className:a,onMouseEnter:u.startPause,onMouseLeave:u.endPause},c.map(d=>{let f=d.position||t,m=u.calculateOffset(d,{reverseOrder:e,gutter:n,defaultPosition:t}),g=wg(f,m);return _e.createElement(_g,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?xg:"",style:g},d.type==="custom"?_i(d.message,d):s?s(d):_e.createElement(bg,{toast:d,position:f}))}))},Re=Ke;function Cg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Li=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $n(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ka(e){return"nodeType"in e}function bt(e){var t,r;return e?$n(e)?e:ka(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Aa(e){const{Document:t}=bt(e);return e instanceof t}function Ns(e){return $n(e)?!1:e instanceof bt(e).HTMLElement}function pd(e){return e instanceof bt(e).SVGElement}function Bn(e){return e?$n(e)?e.document:ka(e)?Aa(e)?e:Ns(e)||pd(e)?e.ownerDocument:document:document:document}const Kt=Li?p.useLayoutEffect:p.useEffect;function Fi(e){const t=p.useRef(e);return Kt(()=>{t.current=e}),p.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Eg(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function ms(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Kt(()=>{r.current!==e&&(r.current=e)},t),r}function Ts(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function wi(e){const t=Fi(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function xi(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let oo={};function js(e,t){return p.useMemo(()=>{if(t)return t;const r=oo[e]==null?0:oo[e]+1;return oo[e]=r,e+"-"+r},[e,t])}function gd(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 wn=gd(1),ys=gd(-1);function Og(e){return"clientX"in e&&"clientY"in e}function $i(e){if(!e)return!1;const{KeyboardEvent:t}=bt(e.target);return t&&e instanceof t}function Dg(e){if(!e)return!1;const{TouchEvent:t}=bt(e.target);return t&&e instanceof t}function Si(e){if(Dg(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 Og(e)?{x:e.clientX,y:e.clientY}:null}const Ar=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[Ar.Translate.toString(e),Ar.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Nl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ig(e){return e.matches(Nl)?e:e.querySelector(Nl)}const Ng={display:"none"};function Tg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:Ng},r)}function jg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return p.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Rg(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const md=p.createContext(null);function kg(e){const t=p.useContext(md);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ag(){const[e]=p.useState(()=>new Set),t=p.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[p.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Pg={draggable:`
177
+ `,Hs=16,Sg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:u}=Xp(r,i);return we.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Hs,left:Hs,right:Hs,bottom:Hs,pointerEvents:"none",...o},className:a,onMouseEnter:u.startPause,onMouseLeave:u.endPause},c.map(d=>{let f=d.position||t,m=u.calculateOffset(d,{reverseOrder:e,gutter:n,defaultPosition:t}),g=wg(f,m);return we.createElement(_g,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?xg:"",style:g},d.type==="custom"?_i(d.message,d):s?s(d):we.createElement(bg,{toast:d,position:f}))}))},Ae=We;function Cg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Li=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $n(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ka(e){return"nodeType"in e}function vt(e){var t,r;return e?$n(e)?e:ka(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Aa(e){const{Document:t}=vt(e);return e instanceof t}function Ns(e){return $n(e)?!1:e instanceof vt(e).HTMLElement}function pd(e){return e instanceof vt(e).SVGElement}function Bn(e){return e?$n(e)?e.document:ka(e)?Aa(e)?e:Ns(e)||pd(e)?e.ownerDocument:document:document:document}const Wt=Li?p.useLayoutEffect:p.useEffect;function Fi(e){const t=p.useRef(e);return Wt(()=>{t.current=e}),p.useCallback(function(){for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return t.current==null?void 0:t.current(...n)},[])}function Og(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function ms(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Wt(()=>{r.current!==e&&(r.current=e)},t),r}function Ts(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function wi(e){const t=Fi(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function xi(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let oo={};function js(e,t){return p.useMemo(()=>{if(t)return t;const r=oo[e]==null?0:oo[e]+1;return oo[e]=r,e+"-"+r},[e,t])}function gd(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 wn=gd(1),ys=gd(-1);function Eg(e){return"clientX"in e&&"clientY"in e}function $i(e){if(!e)return!1;const{KeyboardEvent:t}=vt(e.target);return t&&e instanceof t}function Dg(e){if(!e)return!1;const{TouchEvent:t}=vt(e.target);return t&&e instanceof t}function Si(e){if(Dg(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 Eg(e)?{x:e.clientX,y:e.clientY}:null}const Ar=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[Ar.Translate.toString(e),Ar.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Nl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ig(e){return e.matches(Nl)?e:e.querySelector(Nl)}const Ng={display:"none"};function Tg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:Ng},r)}function jg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return p.createElement("div",{id:t,style:s,role:"status","aria-live":n,"aria-atomic":!0},r)}function Rg(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const md=p.createContext(null);function kg(e){const t=p.useContext(md);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ag(){const[e]=p.useState(()=>new Set),t=p.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[p.useCallback(n=>{let{type:s,event:i}=n;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const Pg={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
- `},Mg={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 Lg(e){let{announcements:t=Mg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Pg}=e;const{announce:i,announcement:o}=Rg(),a=js("DndLiveRegion"),[c,u]=p.useState(!1);if(p.useEffect(()=>{u(!0)},[]),kg(p.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;t.onDragMove&&i(t.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;i(t.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;i(t.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;i(t.onDragCancel({active:m,over:g}))}}),[i,t])),!c)return null;const d=p.createElement(p.Fragment,null,p.createElement(Tg,{id:n,value:s.draggable}),p.createElement(jg,{id:a,announcement:o}));return r?Rr.createPortal(d,r):d}var We;(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"})(We||(We={}));function Ci(){}function ta(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function yd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Qt=Object.freeze({x:0,y:0});function vd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fg(e,t){const r=Si(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 bd(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function $g(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Tl(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 _d(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function jl(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 Bg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=jl(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=vd(jl(c),s);i.push({id:a,data:{droppableContainer:o,value:u}})}}return i.sort(bd)},Vg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Tl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Tl(c),d=s.reduce((m,g,_)=>m+vd(u[_],g),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(bd)};function Ug(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 zg=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=Ug(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort($g)};function qg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function wd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Qt}function Hg(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 Wg=Hg(1);function xd(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 Kg(e,t,r){const n=xd(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 Qg={ignoreTransform:!1};function Vn(e,t){t===void 0&&(t=Qg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=bt(e).getComputedStyle(e);u&&(r=Kg(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 Rl(e){return Vn(e,{ignoreTransform:!0})}function Gg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Yg(e,t){return t===void 0&&(t=bt(e).getComputedStyle(e)),t.position==="fixed"}function Xg(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 Bi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Aa(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ns(s)||pd(s)||r.includes(s))return r;const i=bt(e).getComputedStyle(s);return s!==e&&Xg(s,i)&&r.push(s),Yg(s,i)?r:n(s.parentNode)}return e?n(e):r}function Sd(e){const[t]=Bi(e,1);return t??null}function ao(e){return!Li||!e?null:$n(e)?e:ka(e)?Aa(e)||e===Bn(e).scrollingElement?window:Ns(e)?e:null:null}function Cd(e){return $n(e)?e.scrollX:e.scrollLeft}function Ed(e){return $n(e)?e.scrollY:e.scrollTop}function ra(e){return{x:Cd(e),y:Ed(e)}}var Je;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Je||(Je={}));function Od(e){return!Li||!e?!1:e===document.scrollingElement}function Dd(e){const t={x:0,y:0},r=Od(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 Zg={x:.2,y:.2};function Jg(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Zg);const{isTop:u,isBottom:d,isLeft:f,isRight:m}=Dd(e),g={x:0,y:0},_={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+h.height?(g.y=Je.Backward,_.y=n*Math.abs((t.top+h.height-i)/h.height)):!d&&c>=t.bottom-h.height&&(g.y=Je.Forward,_.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!m&&a>=t.right-h.width?(g.x=Je.Forward,_.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(g.x=Je.Backward,_.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:g,speed:_}}function em(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 Id(e){return e.reduce((t,r)=>wn(t,ra(r)),Qt)}function tm(e){return e.reduce((t,r)=>t+Cd(r),0)}function rm(e){return e.reduce((t,r)=>t+Ed(r),0)}function Nd(e,t){if(t===void 0&&(t=Vn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Sd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const nm=[["x",["left","right"],tm],["y",["top","bottom"],rm]];class Pa{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=Bi(r),s=Id(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of nm)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 ls{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function sm(e){const{EventTarget:t}=bt(e);return e instanceof t?e:Bn(e)}function lo(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Bt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Bt||(Bt={}));function kl(e){e.preventDefault()}function im(e){e.stopPropagation()}var me;(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"})(me||(me={}));const Td={start:[me.Space,me.Enter],cancel:[me.Esc],end:[me.Space,me.Enter,me.Tab]},om=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case me.Right:return{...r,x:r.x+25};case me.Left:return{...r,x:r.x-25};case me.Down:return{...r,y:r.y+25};case me.Up:return{...r,y:r.y-25}}};class Ma{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ls(Bn(r)),this.windowListeners=new ls(bt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Nd(n),r(Qt)}handleKeyDown(t){if($i(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Td,coordinateGetter:o=om,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}:Qt;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const m=ys(f,d),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const h of _){const y=t.code,{isTop:v,isRight:b,isLeft:x,isBottom:w,maxScroll:S,minScroll:O}=Dd(h),T=em(h),R={x:Math.min(y===me.Right?T.right-T.width/2:T.right,Math.max(y===me.Right?T.left:T.left+T.width/2,f.x)),y:Math.min(y===me.Down?T.bottom-T.height/2:T.bottom,Math.max(y===me.Down?T.top:T.top+T.height/2,f.y))},M=y===me.Right&&!b||y===me.Left&&!x,j=y===me.Down&&!w||y===me.Up&&!v;if(M&&R.x!==f.x){const k=h.scrollLeft+m.x,U=y===me.Right&&k<=S.x||y===me.Left&&k>=O.x;if(U&&!m.y){h.scrollTo({left:k,behavior:a});return}U?g.x=h.scrollLeft-k:g.x=y===me.Right?h.scrollLeft-S.x:h.scrollLeft-O.x,g.x&&h.scrollBy({left:-g.x,behavior:a});break}else if(j&&R.y!==f.y){const k=h.scrollTop+m.y,U=y===me.Down&&k<=S.y||y===me.Up&&k>=O.y;if(U&&!m.x){h.scrollTo({top:k,behavior:a});return}U?g.y=h.scrollTop-k:g.y=y===me.Down?h.scrollTop-S.y:h.scrollTop-O.y,g.y&&h.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,wn(ys(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()}}Ma.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Td,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 Al(e){return!!(e&&"distance"in e)}function Pl(e){return!!(e&&"delay"in e)}class La{constructor(t,r,n){var s;n===void 0&&(n=sm(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=Bn(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(bt(o)),this.initialCoordinates=(s=Si(i))!=null?s:Qt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Bt.Resize,this.handleCancel),this.windowListeners.add(Bt.DragStart,kl),this.windowListeners.add(Bt.VisibilityChange,this.handleCancel),this.windowListeners.add(Bt.ContextMenu,kl),this.documentListeners.add(Bt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Pl(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Al(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Bt.Click,im,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Si(t))!=null?r:Qt,u=ys(s,c);if(!n&&a){if(Al(a)){if(a.tolerance!=null&&lo(u,a.tolerance))return this.handleCancel();if(lo(u,a.distance))return this.handleStart()}if(Pl(a)&&lo(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===me.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const am={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vi extends La{constructor(t){const{event:r}=t,n=Bn(r.target);super(t,am,n)}}Vi.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 lm={move:{name:"mousemove"},end:{name:"mouseup"}};var na;(function(e){e[e.RightClick=2]="RightClick"})(na||(na={}));class cm extends La{constructor(t){super(t,lm,Bn(t.event.target))}}cm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===na.RightClick?!1:(n==null||n({event:r}),!0)}}];const co={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class um extends La{constructor(t){super(t,co)}static setup(){return window.addEventListener(co.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(co.move.name,t)};function t(){}}}um.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var Ei;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ei||(Ei={}));function dm(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Ei.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:m}=e;const g=hm({delta:f,disabled:!i}),[_,h]=Eg(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),b=p.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),x=p.useRef(null),w=p.useCallback(()=>{const O=x.current;if(!O)return;const T=y.current.x*v.current.x,R=y.current.y*v.current.y;O.scrollBy(T,R)},[]),S=p.useMemo(()=>a===Ei.TreeOrder?[...u].reverse():u,[a,u]);p.useEffect(()=>{if(!i||!u.length||!b){h();return}for(const O of S){if((n==null?void 0:n(O))===!1)continue;const T=u.indexOf(O),R=d[T];if(!R)continue;const{direction:M,speed:j}=Jg(O,R,b,t,m);for(const k of["x","y"])g[k][M[k]]||(j[k]=0,M[k]=0);if(j.x>0||j.y>0){h(),x.current=O,_(w,o),y.current=j,v.current=M;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(b),JSON.stringify(g),_,u,S,d,JSON.stringify(m)])}const fm={x:{[Je.Backward]:!1,[Je.Forward]:!1},y:{[Je.Backward]:!1,[Je.Forward]:!1}};function hm(e){let{delta:t,disabled:r}=e;const n=xi(t);return Ts(s=>{if(r||!n||!s)return fm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Je.Backward]:s.x[Je.Backward]||i.x===-1,[Je.Forward]:s.x[Je.Forward]||i.x===1},y:{[Je.Backward]:s.y[Je.Backward]||i.y===-1,[Je.Forward]:s.y[Je.Forward]||i.y===1}}},[r,t,n])}function pm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ts(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function gm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var vs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(vs||(vs={}));var sa;(function(e){e.Optimized="optimized"})(sa||(sa={}));const Ml=new Map;function mm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:u}=s,d=p.useRef(e),f=y(),m=ms(f),g=p.useCallback(function(v){v===void 0&&(v=[]),!m.current&&o(b=>b===null?v:b.concat(v.filter(x=>!b.includes(x))))},[m]),_=p.useRef(null),h=Ts(v=>{if(f&&!r)return Ml;if(!v||v===Ml||d.current!==e||i!=null){const b=new Map;for(let x of e){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){b.set(x.id,x.rect.current);continue}const w=x.node.current,S=w?new Pa(c(w),w):null;x.rect.current=S,S&&b.set(x.id,S)}return b}return v},[e,i,r,f,c]);return p.useEffect(()=>{d.current=e},[e]),p.useEffect(()=>{f||g()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:h,measureDroppableContainers:g,measuringScheduled:i!=null};function y(){switch(u){case vs.Always:return!1;case vs.BeforeDragging:return r;default:return!r}}}function Fa(e,t){return Ts(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ym(e,t){return Fa(e,t)}function vm(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Ui(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function bm(e){return new Pa(Vn(e),e)}function Ll(e,t,r){t===void 0&&(t=bm);const[n,s]=p.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=vm({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=Ui({callback:i});return Kt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function _m(e){const t=Fa(e);return wd(e,t)}const Fl=[];function wm(e){const t=p.useRef(e),r=Ts(n=>e?n&&n!==Fl&&e&&t.current&&e.parentNode===t.current.parentNode?n:Bi(e):Fl,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function xm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=ao(i.target);o&&r(a=>a?(a.set(o,ra(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const u=ao(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,ra(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=ao(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>wn(i,o),Qt):Id(e):Qt,[e,t])}function $l(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Qt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ys(e,r.current):Qt}function Sm(e){p.useEffect(()=>{if(!Li)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 Cm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function jd(e){return p.useMemo(()=>e?Gg(e):null,[e])}const Bl=[];function Em(e,t){t===void 0&&(t=Vn);const[r]=e,n=jd(r?bt(r):null),[s,i]=p.useState(Bl);function o(){i(()=>e.length?e.map(c=>Od(c)?n:new Pa(t(c),c)):Bl)}const a=Ui({callback:o});return Kt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Rd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ns(t)?t:e}function Om(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(u=>{for(const{target:d}of u)if(Ns(d)){n(f=>{const m=t(d);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=Ui({callback:s}),o=p.useCallback(u=>{const d=Rd(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[a,c]=wi(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Dm=[{sensor:Vi,options:{}},{sensor:Ma,options:{}}],Im={current:{}},ni={draggable:{measure:Rl},droppable:{measure:Rl,strategy:vs.WhileDragging,frequency:sa.Optimized},dragOverlay:{measure:Vn}};class us 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 Nm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new us,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ci},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ni,measureDroppableContainers:Ci,windowRect:null,measuringScheduled:!1},kd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ci,draggableNodes:new Map,over:null,measureDroppableContainers:Ci},Rs=p.createContext(kd),Ad=p.createContext(Nm);function Tm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new us}}}function jm(e,t){switch(t.type){case We.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case We.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 We.DragEnd:case We.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case We.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new us(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case We.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 us(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case We.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new us(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Rm(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext(Rs),i=xi(n),o=xi(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!$i(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=Ig(d);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Pd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function km(e){return p.useMemo(()=>({draggable:{...ni.draggable,...e==null?void 0:e.draggable},droppable:{...ni.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ni.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 Am(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=p.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Kt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=r(u),f=wd(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 m=Sd(u);m&&m.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const zi=p.createContext({...Qt,scaleX:1,scaleY:1});var xr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xr||(xr={}));const Md=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=Dm,collisionDetection:f=zg,measuring:m,modifiers:g,..._}=t;const h=p.useReducer(jm,void 0,Tm),[y,v]=h,[b,x]=Ag(),[w,S]=p.useState(xr.Uninitialized),O=w===xr.Initialized,{draggable:{active:T,nodes:R,translate:M},droppable:{containers:j}}=y,k=T!=null?R.get(T):null,U=p.useRef({initial:null,translated:null}),A=p.useMemo(()=>{var Ge;return T!=null?{id:T,data:(Ge=k==null?void 0:k.data)!=null?Ge:Im,rect:U}:null},[T,k]),q=p.useRef(null),[L,se]=p.useState(null),[ce,W]=p.useState(null),B=ms(_,Object.values(_)),X=js("DndDescribedBy",o),F=p.useMemo(()=>j.getEnabled(),[j]),K=km(m),{droppableRects:Z,measureDroppableContainers:pe,measuringScheduled:Ce}=mm(F,{dragging:O,dependencies:[M.x,M.y],config:K.droppable}),J=pm(R,T),be=p.useMemo(()=>ce?Si(ce):null,[ce]),re=Mr(),ye=ym(J,K.draggable.measure);Am({activeNode:T!=null?R.get(T):null,config:re.layoutShiftCompensation,initialRect:ye,measure:K.draggable.measure});const ie=Ll(J,K.draggable.measure,ye),ot=Ll(J?J.parentElement:null),De=p.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),et=j.getNodeFor((r=De.current.over)==null?void 0:r.id),Qe=Om({measure:K.dragOverlay.measure}),$e=(n=Qe.nodeRef.current)!=null?n:J,te=O?(s=Qe.rect)!=null?s:ie:null,ze=!!(Qe.nodeRef.current&&Qe.rect),at=_m(ze?null:ie),qe=jd($e?bt($e):null),Ae=wm(O?et??J:null),Dt=Em(Ae),At=Pd(g,{transform:{x:M.x-at.x,y:M.y-at.y,scaleX:1,scaleY:1},activatorEvent:ce,active:A,activeNodeRect:ie,containerNodeRect:ot,draggingNodeRect:te,over:De.current.over,overlayNodeRect:Qe.rect,scrollableAncestors:Ae,scrollableAncestorRects:Dt,windowRect:qe}),Vs=be?wn(be,M):null,no=xm(Ae),gl=$l(no),Us=$l(no,[ie]),C=wn(At,gl),I=te?Wg(te,At):null,N=A&&I?f({active:A,collisionRect:I,droppableRects:Z,droppableContainers:F,pointerCoordinates:Vs}):null,$=_d(N,"id"),[V,Q]=p.useState(null),z=ze?At:wn(At,Us),ee=qg(z,(i=V==null?void 0:V.rect)!=null?i:null,ie),de=p.useRef(null),Pe=p.useCallback((Ge,lt)=>{let{sensor:yt,options:Ut}=lt;if(q.current==null)return;const Pt=R.get(q.current);if(!Pt)return;const It=Ge.nativeEvent,Xt=new yt({active:q.current,activeNode:Pt,event:It,options:Ut,context:De,onAbort(tt){if(!R.get(tt))return;const{onDragAbort:Zt}=B.current,lr={id:tt};Zt==null||Zt(lr),b({type:"onDragAbort",event:lr})},onPending(tt,gr,Zt,lr){if(!R.get(tt))return;const{onDragPending:Qn}=B.current,mr={id:tt,constraint:gr,initialCoordinates:Zt,offset:lr};Qn==null||Qn(mr),b({type:"onDragPending",event:mr})},onStart(tt){const gr=q.current;if(gr==null)return;const Zt=R.get(gr);if(!Zt)return;const{onDragStart:lr}=B.current,Kn={activatorEvent:It,active:{id:gr,data:Zt.data,rect:U}};Rr.unstable_batchedUpdates(()=>{lr==null||lr(Kn),S(xr.Initializing),v({type:We.DragStart,initialCoordinates:tt,active:gr}),b({type:"onDragStart",event:Kn}),se(de.current),W(It)})},onMove(tt){v({type:We.DragMove,coordinates:tt})},onEnd:an(We.DragEnd),onCancel:an(We.DragCancel)});de.current=Xt;function an(tt){return async function(){const{active:Zt,collisions:lr,over:Kn,scrollAdjustedTranslate:Qn}=De.current;let mr=null;if(Zt&&Qn){const{cancelDrop:Gn}=B.current;mr={activatorEvent:It,active:Zt,collisions:lr,delta:Qn,over:Kn},tt===We.DragEnd&&typeof Gn=="function"&&await Promise.resolve(Gn(mr))&&(tt=We.DragCancel)}q.current=null,Rr.unstable_batchedUpdates(()=>{v({type:tt}),S(xr.Uninitialized),Q(null),se(null),W(null),de.current=null;const Gn=tt===We.DragEnd?"onDragEnd":"onDragCancel";if(mr){const so=B.current[Gn];so==null||so(mr),b({type:Gn,event:mr})}})}}},[R]),_t=p.useCallback((Ge,lt)=>(yt,Ut)=>{const Pt=yt.nativeEvent,It=R.get(Ut);if(q.current!==null||!It||Pt.dndKit||Pt.defaultPrevented)return;const Xt={active:It};Ge(yt,lt.options,Xt)===!0&&(Pt.dndKit={capturedBy:lt.sensor},q.current=Ut,Pe(yt,lt))},[R,Pe]),wt=gm(d,_t);Sm(d),Kt(()=>{ie&&w===xr.Initializing&&S(xr.Initialized)},[ie,w]),p.useEffect(()=>{const{onDragMove:Ge}=B.current,{active:lt,activatorEvent:yt,collisions:Ut,over:Pt}=De.current;if(!lt||!yt)return;const It={active:lt,activatorEvent:yt,collisions:Ut,delta:{x:C.x,y:C.y},over:Pt};Rr.unstable_batchedUpdates(()=>{Ge==null||Ge(It),b({type:"onDragMove",event:It})})},[C.x,C.y]),p.useEffect(()=>{const{active:Ge,activatorEvent:lt,collisions:yt,droppableContainers:Ut,scrollAdjustedTranslate:Pt}=De.current;if(!Ge||q.current==null||!lt||!Pt)return;const{onDragOver:It}=B.current,Xt=Ut.get($),an=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,tt={active:Ge,activatorEvent:lt,collisions:yt,delta:{x:Pt.x,y:Pt.y},over:an};Rr.unstable_batchedUpdates(()=>{Q(an),It==null||It(tt),b({type:"onDragOver",event:tt})})},[$]),Kt(()=>{De.current={activatorEvent:ce,active:A,activeNode:J,collisionRect:I,collisions:N,droppableRects:Z,draggableNodes:R,draggingNode:$e,draggingNodeRect:te,droppableContainers:j,over:V,scrollableAncestors:Ae,scrollAdjustedTranslate:C},U.current={initial:te,translated:I}},[A,J,N,I,R,$e,te,Z,j,V,Ae,C]),dm({...re,delta:M,draggingRect:I,pointerCoordinates:Vs,scrollableAncestors:Ae,scrollableAncestorRects:Dt});const ar=p.useMemo(()=>({active:A,activeNode:J,activeNodeRect:ie,activatorEvent:ce,collisions:N,containerNodeRect:ot,dragOverlay:Qe,draggableNodes:R,droppableContainers:j,droppableRects:Z,over:V,measureDroppableContainers:pe,scrollableAncestors:Ae,scrollableAncestorRects:Dt,measuringConfiguration:K,measuringScheduled:Ce,windowRect:qe}),[A,J,ie,ce,N,ot,Qe,R,j,Z,V,pe,Ae,Dt,K,Ce,qe]),Wn=p.useMemo(()=>({activatorEvent:ce,activators:wt,active:A,activeNodeRect:ie,ariaDescribedById:{draggable:X},dispatch:v,draggableNodes:R,over:V,measureDroppableContainers:pe}),[ce,wt,A,ie,v,X,R,V,pe]);return p.createElement(md.Provider,{value:x},p.createElement(Rs.Provider,{value:Wn},p.createElement(Ad.Provider,{value:ar},p.createElement(zi.Provider,{value:ee},u)),p.createElement(Rm,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(Lg,{...a,hiddenTextDescribedById:X}));function Mr(){const Ge=(L==null?void 0:L.autoScrollEnabled)===!1,lt=typeof c=="object"?c.enabled===!1:c===!1,yt=O&&!Ge&&!lt;return typeof c=="object"?{...c,enabled:yt}:{enabled:yt}}}),Pm=p.createContext(null),Vl="button",Mm="Draggable";function Ld(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=js(Mm),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:m}=p.useContext(Rs),{role:g=Vl,roleDescription:_="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?zi:Pm),[b,x]=wi(),[w,S]=wi(),O=Cm(o,t),T=ms(r);Kt(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:T}),()=>{const M=f.get(t);M&&M.key===i&&f.delete(t)}),[f,t]);const R=p.useMemo(()=>({role:g,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&g===Vl?!0:void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[n,g,h,y,_,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:R,isDragging:y,listeners:n?void 0:O,node:b,over:m,setNodeRef:x,setActivatorNodeRef:S,transform:v}}function Fd(){return p.useContext(Ad)}const Lm="Droppable",Fm={timeout:25};function $m(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=js(Lm),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=p.useContext(Rs),d=p.useRef({disabled:r}),f=p.useRef(!1),m=p.useRef(null),g=p.useRef(null),{disabled:_,updateMeasurementsFor:h,timeout:y}={...Fm,...s},v=ms(h??n),b=p.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),g.current=null},y)},[y]),x=Ui({callback:b,disabled:_||!o}),w=p.useCallback((R,M)=>{x&&(M&&(x.unobserve(M),f.current=!1),R&&x.observe(R))},[x]),[S,O]=wi(w),T=ms(t);return p.useEffect(()=>{!x||!S.current||(x.disconnect(),f.current=!1,x.observe(S.current))},[S,x]),p.useEffect(()=>(a({type:We.RegisterDroppable,element:{id:n,key:i,disabled:r,node:S,rect:m,data:T}}),()=>a({type:We.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==d.current.disabled&&(a({type:We.SetDroppableDisabled,id:n,key:i,disabled:r}),d.current.disabled=r)},[n,i,r,a]),{active:o,rect:m,isOver:(c==null?void 0:c.id)===n,node:S,over:c,setNodeRef:O}}function Bm(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=xi(r);return!r&&!n&&a&&s(a),Kt(()=>{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]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const Vm={x:0,y:0,scaleX:1,scaleY:1};function Um(e){let{children:t}=e;return p.createElement(Rs.Provider,{value:kd},p.createElement(zi.Provider,{value:Vm},t))}const zm={position:"fixed",touchAction:"none"},qm=e=>$i(e)?"transform 250ms ease":void 0,Hm=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:u,transition:d=qm}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},m={...zm,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ar.Transform.toString(f),transformOrigin:s&&n?Fg(n,a):void 0,transition:typeof d=="function"?d(n):d,...c};return p.createElement(r,{className:o,style:m,ref:t},i)}),Wm=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)}},Km=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ar.Transform.toString(t)},{transform:Ar.Transform.toString(r)}]},Qm={duration:250,easing:"ease",keyframes:Km,sideEffects:Wm({styles:{active:{opacity:"0"}}})};function Gm(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Fi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=Rd(o);if(!u)return;const{transform:d}=bt(o).getComputedStyle(o),f=xd(d);if(!f)return;const m=typeof t=="function"?t:Ym(t);return Nd(c,s.draggable.measure),m({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 Ym(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Qm,...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},m={x:c.x-d.x,y:c.y-d.y,...f},g=s({...u,active:o,dragOverlay:a,transform:{initial:c,final:m}}),[_]=g,h=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...u}),v=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let Ul=0;function Xm(e){return p.useMemo(()=>{if(e!=null)return Ul++,Ul},[e])}const Zm=p.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:m,containerNodeRect:g,draggableNodes:_,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:w,windowRect:S}=Fd(),O=p.useContext(zi),T=Xm(f==null?void 0:f.id),R=Pd(o,{activatorEvent:d,active:f,activeNodeRect:m,containerNodeRect:g,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:w,transform:O,windowRect:S}),M=Fa(m),j=Gm({config:n,draggableNodes:_,droppableContainers:h,measuringConfiguration:b}),k=M?y.setRef:void 0;return p.createElement(Um,null,p.createElement(Bm,{animation:j},f&&T?p.createElement(Hm,{key:T,id:f.id,ref:k,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:M,style:{zIndex:u,...s},transform:R},r):null))});/**
181
+ `},Mg={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 Lg(e){let{announcements:t=Mg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Pg}=e;const{announce:i,announcement:o}=Rg(),a=js("DndLiveRegion"),[c,u]=p.useState(!1);if(p.useEffect(()=>{u(!0)},[]),kg(p.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;t.onDragMove&&i(t.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;i(t.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;i(t.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;i(t.onDragCancel({active:m,over:g}))}}),[i,t])),!c)return null;const d=p.createElement(p.Fragment,null,p.createElement(Tg,{id:n,value:s.draggable}),p.createElement(jg,{id:a,announcement:o}));return r?Rr.createPortal(d,r):d}var He;(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"})(He||(He={}));function Ci(){}function ta(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function yd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Kt=Object.freeze({x:0,y:0});function vd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fg(e,t){const r=Si(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 bd(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function $g(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Tl(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 _d(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function jl(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 Bg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=jl(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=vd(jl(c),s);i.push({id:a,data:{droppableContainer:o,value:u}})}}return i.sort(bd)},Vg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Tl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const u=Tl(c),d=s.reduce((m,g,_)=>m+vd(u[_],g),0),f=Number((d/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(bd)};function Ug(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 zg=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=Ug(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort($g)};function qg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function wd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Kt}function Hg(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 Wg=Hg(1);function xd(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 Kg(e,t,r){const n=xd(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 Qg={ignoreTransform:!1};function Vn(e,t){t===void 0&&(t=Qg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=vt(e).getComputedStyle(e);u&&(r=Kg(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 Rl(e){return Vn(e,{ignoreTransform:!0})}function Gg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Yg(e,t){return t===void 0&&(t=vt(e).getComputedStyle(e)),t.position==="fixed"}function Xg(e,t){t===void 0&&(t=vt(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 Bi(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Aa(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ns(s)||pd(s)||r.includes(s))return r;const i=vt(e).getComputedStyle(s);return s!==e&&Xg(s,i)&&r.push(s),Yg(s,i)?r:n(s.parentNode)}return e?n(e):r}function Sd(e){const[t]=Bi(e,1);return t??null}function ao(e){return!Li||!e?null:$n(e)?e:ka(e)?Aa(e)||e===Bn(e).scrollingElement?window:Ns(e)?e:null:null}function Cd(e){return $n(e)?e.scrollX:e.scrollLeft}function Od(e){return $n(e)?e.scrollY:e.scrollTop}function ra(e){return{x:Cd(e),y:Od(e)}}var Ze;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ze||(Ze={}));function Ed(e){return!Li||!e?!1:e===document.scrollingElement}function Dd(e){const t={x:0,y:0},r=Ed(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 Zg={x:.2,y:.2};function Jg(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=Zg);const{isTop:u,isBottom:d,isLeft:f,isRight:m}=Dd(e),g={x:0,y:0},_={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+h.height?(g.y=Ze.Backward,_.y=n*Math.abs((t.top+h.height-i)/h.height)):!d&&c>=t.bottom-h.height&&(g.y=Ze.Forward,_.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!m&&a>=t.right-h.width?(g.x=Ze.Forward,_.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(g.x=Ze.Backward,_.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:g,speed:_}}function em(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 Id(e){return e.reduce((t,r)=>wn(t,ra(r)),Kt)}function tm(e){return e.reduce((t,r)=>t+Cd(r),0)}function rm(e){return e.reduce((t,r)=>t+Od(r),0)}function Nd(e,t){if(t===void 0&&(t=Vn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Sd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const nm=[["x",["left","right"],tm],["y",["top","bottom"],rm]];class Pa{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=Bi(r),s=Id(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of nm)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 ls{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var s;(s=this.target)==null||s.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function sm(e){const{EventTarget:t}=vt(e);return e instanceof t?e:Bn(e)}function lo(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var $t;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($t||($t={}));function kl(e){e.preventDefault()}function im(e){e.stopPropagation()}var me;(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"})(me||(me={}));const Td={start:[me.Space,me.Enter],cancel:[me.Esc],end:[me.Space,me.Enter,me.Tab]},om=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case me.Right:return{...r,x:r.x+25};case me.Left:return{...r,x:r.x-25};case me.Down:return{...r,y:r.y+25};case me.Up:return{...r,y:r.y-25}}};class Ma{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new ls(Bn(r)),this.windowListeners=new ls(vt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($t.Resize,this.handleCancel),this.windowListeners.add($t.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($t.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Nd(n),r(Kt)}handleKeyDown(t){if($i(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Td,coordinateGetter:o=om,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}:Kt;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const m=ys(f,d),g={x:0,y:0},{scrollableAncestors:_}=n.current;for(const h of _){const y=t.code,{isTop:v,isRight:b,isLeft:x,isBottom:w,maxScroll:C,minScroll:D}=Dd(h),j=em(h),k={x:Math.min(y===me.Right?j.right-j.width/2:j.right,Math.max(y===me.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===me.Down?j.bottom-j.height/2:j.bottom,Math.max(y===me.Down?j.top:j.top+j.height/2,f.y))},L=y===me.Right&&!b||y===me.Left&&!x,I=y===me.Down&&!w||y===me.Up&&!v;if(L&&k.x!==f.x){const R=h.scrollLeft+m.x,M=y===me.Right&&R<=C.x||y===me.Left&&R>=D.x;if(M&&!m.y){h.scrollTo({left:R,behavior:a});return}M?g.x=h.scrollLeft-R:g.x=y===me.Right?h.scrollLeft-C.x:h.scrollLeft-D.x,g.x&&h.scrollBy({left:-g.x,behavior:a});break}else if(I&&k.y!==f.y){const R=h.scrollTop+m.y,M=y===me.Down&&R<=C.y||y===me.Up&&R>=D.y;if(M&&!m.x){h.scrollTo({top:R,behavior:a});return}M?g.y=h.scrollTop-R:g.y=y===me.Down?h.scrollTop-C.y:h.scrollTop-D.y,g.y&&h.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,wn(ys(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()}}Ma.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Td,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 Al(e){return!!(e&&"distance"in e)}function Pl(e){return!!(e&&"delay"in e)}class La{constructor(t,r,n){var s;n===void 0&&(n=sm(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=Bn(o),this.documentListeners=new ls(this.document),this.listeners=new ls(n),this.windowListeners=new ls(vt(o)),this.initialCoordinates=(s=Si(i))!=null?s:Kt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($t.Resize,this.handleCancel),this.windowListeners.add($t.DragStart,kl),this.windowListeners.add($t.VisibilityChange,this.handleCancel),this.windowListeners.add($t.ContextMenu,kl),this.documentListeners.add($t.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Pl(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Al(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:s}=this.props;s(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add($t.Click,im,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($t.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Si(t))!=null?r:Kt,u=ys(s,c);if(!n&&a){if(Al(a)){if(a.tolerance!=null&&lo(u,a.tolerance))return this.handleCancel();if(lo(u,a.distance))return this.handleStart()}if(Pl(a)&&lo(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===me.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const am={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vi extends La{constructor(t){const{event:r}=t,n=Bn(r.target);super(t,am,n)}}Vi.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 lm={move:{name:"mousemove"},end:{name:"mouseup"}};var na;(function(e){e[e.RightClick=2]="RightClick"})(na||(na={}));class cm extends La{constructor(t){super(t,lm,Bn(t.event.target))}}cm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===na.RightClick?!1:(n==null||n({event:r}),!0)}}];const co={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class um extends La{constructor(t){super(t,co)}static setup(){return window.addEventListener(co.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(co.move.name,t)};function t(){}}}um.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:s}=r;return s.length>1?!1:(n==null||n({event:r}),!0)}}];var cs;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(cs||(cs={}));var Oi;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Oi||(Oi={}));function dm(e){let{acceleration:t,activator:r=cs.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=Oi.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:m}=e;const g=hm({delta:f,disabled:!i}),[_,h]=Og(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),b=p.useMemo(()=>{switch(r){case cs.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cs.DraggableRect:return s}},[r,s,c]),x=p.useRef(null),w=p.useCallback(()=>{const D=x.current;if(!D)return;const j=y.current.x*v.current.x,k=y.current.y*v.current.y;D.scrollBy(j,k)},[]),C=p.useMemo(()=>a===Oi.TreeOrder?[...u].reverse():u,[a,u]);p.useEffect(()=>{if(!i||!u.length||!b){h();return}for(const D of C){if((n==null?void 0:n(D))===!1)continue;const j=u.indexOf(D),k=d[j];if(!k)continue;const{direction:L,speed:I}=Jg(D,k,b,t,m);for(const R of["x","y"])g[R][L[R]]||(I[R]=0,L[R]=0);if(I.x>0||I.y>0){h(),x.current=D,_(w,o),y.current=I,v.current=L;return}}y.current={x:0,y:0},v.current={x:0,y:0},h()},[t,w,n,h,i,o,JSON.stringify(b),JSON.stringify(g),_,u,C,d,JSON.stringify(m)])}const fm={x:{[Ze.Backward]:!1,[Ze.Forward]:!1},y:{[Ze.Backward]:!1,[Ze.Forward]:!1}};function hm(e){let{delta:t,disabled:r}=e;const n=xi(t);return Ts(s=>{if(r||!n||!s)return fm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Ze.Backward]:s.x[Ze.Backward]||i.x===-1,[Ze.Forward]:s.x[Ze.Forward]||i.x===1},y:{[Ze.Backward]:s.y[Ze.Backward]||i.y===-1,[Ze.Forward]:s.y[Ze.Forward]||i.y===1}}},[r,t,n])}function pm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ts(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function gm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var vs;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(vs||(vs={}));var sa;(function(e){e.Optimized="optimized"})(sa||(sa={}));const Ml=new Map;function mm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:u}=s,d=p.useRef(e),f=y(),m=ms(f),g=p.useCallback(function(v){v===void 0&&(v=[]),!m.current&&o(b=>b===null?v:b.concat(v.filter(x=>!b.includes(x))))},[m]),_=p.useRef(null),h=Ts(v=>{if(f&&!r)return Ml;if(!v||v===Ml||d.current!==e||i!=null){const b=new Map;for(let x of e){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){b.set(x.id,x.rect.current);continue}const w=x.node.current,C=w?new Pa(c(w),w):null;x.rect.current=C,C&&b.set(x.id,C)}return b}return v},[e,i,r,f,c]);return p.useEffect(()=>{d.current=e},[e]),p.useEffect(()=>{f||g()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{g(),_.current=null},a))},[a,f,g,...n]),{droppableRects:h,measureDroppableContainers:g,measuringScheduled:i!=null};function y(){switch(u){case vs.Always:return!1;case vs.BeforeDragging:return r;default:return!r}}}function Fa(e,t){return Ts(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ym(e,t){return Fa(e,t)}function vm(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Ui(e){let{callback:t,disabled:r}=e;const n=Fi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function bm(e){return new Pa(Vn(e),e)}function Ll(e,t,r){t===void 0&&(t=bm);const[n,s]=p.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=vm({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=Ui({callback:i});return Wt(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),n}function _m(e){const t=Fa(e);return wd(e,t)}const Fl=[];function wm(e){const t=p.useRef(e),r=Ts(n=>e?n&&n!==Fl&&e&&t.current&&e.parentNode===t.current.parentNode?n:Bi(e):Fl,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function xm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=ao(i.target);o&&r(a=>a?(a.set(o,ra(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const u=ao(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,ra(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=ao(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>wn(i,o),Kt):Id(e):Kt,[e,t])}function $l(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Kt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?ys(e,r.current):Kt}function Sm(e){p.useEffect(()=>{if(!Li)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 Cm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function jd(e){return p.useMemo(()=>e?Gg(e):null,[e])}const Bl=[];function Om(e,t){t===void 0&&(t=Vn);const[r]=e,n=jd(r?vt(r):null),[s,i]=p.useState(Bl);function o(){i(()=>e.length?e.map(c=>Ed(c)?n:new Pa(t(c),c)):Bl)}const a=Ui({callback:o});return Wt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Rd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ns(t)?t:e}function Em(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(u=>{for(const{target:d}of u)if(Ns(d)){n(f=>{const m=t(d);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=Ui({callback:s}),o=p.useCallback(u=>{const d=Rd(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[a,c]=wi(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Dm=[{sensor:Vi,options:{}},{sensor:Ma,options:{}}],Im={current:{}},ni={draggable:{measure:Rl},droppable:{measure:Rl,strategy:vs.WhileDragging,frequency:sa.Optimized},dragOverlay:{measure:Vn}};class us 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 Nm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new us,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ci},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ni,measureDroppableContainers:Ci,windowRect:null,measuringScheduled:!1},kd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ci,draggableNodes:new Map,over:null,measureDroppableContainers:Ci},Rs=p.createContext(kd),Ad=p.createContext(Nm);function Tm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new us}}}function jm(e,t){switch(t.type){case He.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case He.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 He.DragEnd:case He.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case He.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new us(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case He.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 us(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case He.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new us(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Rm(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext(Rs),i=xi(n),o=xi(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!$i(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=Ig(d);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Pd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function km(e){return p.useMemo(()=>({draggable:{...ni.draggable,...e==null?void 0:e.draggable},droppable:{...ni.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ni.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 Am(e){let{activeNode:t,measure:r,initialRect:n,config:s=!0}=e;const i=p.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;Wt(()=>{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=wd(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 m=Sd(u);m&&m.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const zi=p.createContext({...Kt,scaleX:1,scaleY:1});var xr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xr||(xr={}));const Md=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:u,sensors:d=Dm,collisionDetection:f=zg,measuring:m,modifiers:g,..._}=t;const h=p.useReducer(jm,void 0,Tm),[y,v]=h,[b,x]=Ag(),[w,C]=p.useState(xr.Uninitialized),D=w===xr.Initialized,{draggable:{active:j,nodes:k,translate:L},droppable:{containers:I}}=y,R=j!=null?k.get(j):null,M=p.useRef({initial:null,translated:null}),A=p.useMemo(()=>{var Qe;return j!=null?{id:j,data:(Qe=R==null?void 0:R.data)!=null?Qe:Im,rect:M}:null},[j,R]),B=p.useRef(null),[F,re]=p.useState(null),[ce,W]=p.useState(null),U=ms(_,Object.values(_)),X=js("DndDescribedBy",o),$=p.useMemo(()=>I.getEnabled(),[I]),K=km(m),{droppableRects:Z,measureDroppableContainers:pe,measuringScheduled:Oe}=mm($,{dragging:D,dependencies:[L.x,L.y],config:K.droppable}),J=pm(k,j),_e=p.useMemo(()=>ce?Si(ce):null,[ce]),se=Mr(),ye=ym(J,K.draggable.measure);Am({activeNode:j!=null?k.get(j):null,config:se.layoutShiftCompensation,initialRect:ye,measure:K.draggable.measure});const oe=Ll(J,K.draggable.measure,ye),ot=Ll(J?J.parentElement:null),Se=p.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Je=I.getNodeFor((r=Se.current.over)==null?void 0:r.id),Ke=Em({measure:K.dragOverlay.measure}),Be=(n=Ke.nodeRef.current)!=null?n:J,te=D?(s=Ke.rect)!=null?s:oe:null,Re=!!(Ke.nodeRef.current&&Ke.rect),Pe=_m(Re?null:oe),et=jd(Be?vt(Be):null),bt=wm(D?Je??J:null),or=Om(bt),kt=Pd(g,{transform:{x:L.x-Pe.x,y:L.y-Pe.y,scaleX:1,scaleY:1},activatorEvent:ce,active:A,activeNodeRect:oe,containerNodeRect:ot,draggingNodeRect:te,over:Se.current.over,overlayNodeRect:Ke.rect,scrollableAncestors:bt,scrollableAncestorRects:or,windowRect:et}),Vs=_e?wn(_e,L):null,no=xm(bt),gl=$l(no),Us=$l(no,[oe]),S=wn(kt,gl),N=te?Wg(te,kt):null,T=A&&N?f({active:A,collisionRect:N,droppableRects:Z,droppableContainers:$,pointerCoordinates:Vs}):null,V=_d(T,"id"),[z,Q]=p.useState(null),q=Re?kt:wn(kt,Us),ee=qg(q,(i=z==null?void 0:z.rect)!=null?i:null,oe),de=p.useRef(null),Me=p.useCallback((Qe,at)=>{let{sensor:mt,options:Vt}=at;if(B.current==null)return;const At=k.get(B.current);if(!At)return;const Dt=Qe.nativeEvent,Yt=new mt({active:B.current,activeNode:At,event:Dt,options:Vt,context:Se,onAbort(tt){if(!k.get(tt))return;const{onDragAbort:Xt}=U.current,lr={id:tt};Xt==null||Xt(lr),b({type:"onDragAbort",event:lr})},onPending(tt,gr,Xt,lr){if(!k.get(tt))return;const{onDragPending:Qn}=U.current,mr={id:tt,constraint:gr,initialCoordinates:Xt,offset:lr};Qn==null||Qn(mr),b({type:"onDragPending",event:mr})},onStart(tt){const gr=B.current;if(gr==null)return;const Xt=k.get(gr);if(!Xt)return;const{onDragStart:lr}=U.current,Kn={activatorEvent:Dt,active:{id:gr,data:Xt.data,rect:M}};Rr.unstable_batchedUpdates(()=>{lr==null||lr(Kn),C(xr.Initializing),v({type:He.DragStart,initialCoordinates:tt,active:gr}),b({type:"onDragStart",event:Kn}),re(de.current),W(Dt)})},onMove(tt){v({type:He.DragMove,coordinates:tt})},onEnd:an(He.DragEnd),onCancel:an(He.DragCancel)});de.current=Yt;function an(tt){return async function(){const{active:Xt,collisions:lr,over:Kn,scrollAdjustedTranslate:Qn}=Se.current;let mr=null;if(Xt&&Qn){const{cancelDrop:Gn}=U.current;mr={activatorEvent:Dt,active:Xt,collisions:lr,delta:Qn,over:Kn},tt===He.DragEnd&&typeof Gn=="function"&&await Promise.resolve(Gn(mr))&&(tt=He.DragCancel)}B.current=null,Rr.unstable_batchedUpdates(()=>{v({type:tt}),C(xr.Uninitialized),Q(null),re(null),W(null),de.current=null;const Gn=tt===He.DragEnd?"onDragEnd":"onDragCancel";if(mr){const so=U.current[Gn];so==null||so(mr),b({type:Gn,event:mr})}})}}},[k]),_t=p.useCallback((Qe,at)=>(mt,Vt)=>{const At=mt.nativeEvent,Dt=k.get(Vt);if(B.current!==null||!Dt||At.dndKit||At.defaultPrevented)return;const Yt={active:Dt};Qe(mt,at.options,Yt)===!0&&(At.dndKit={capturedBy:at.sensor},B.current=Vt,Me(mt,at))},[k,Me]),wt=gm(d,_t);Sm(d),Wt(()=>{oe&&w===xr.Initializing&&C(xr.Initialized)},[oe,w]),p.useEffect(()=>{const{onDragMove:Qe}=U.current,{active:at,activatorEvent:mt,collisions:Vt,over:At}=Se.current;if(!at||!mt)return;const Dt={active:at,activatorEvent:mt,collisions:Vt,delta:{x:S.x,y:S.y},over:At};Rr.unstable_batchedUpdates(()=>{Qe==null||Qe(Dt),b({type:"onDragMove",event:Dt})})},[S.x,S.y]),p.useEffect(()=>{const{active:Qe,activatorEvent:at,collisions:mt,droppableContainers:Vt,scrollAdjustedTranslate:At}=Se.current;if(!Qe||B.current==null||!at||!At)return;const{onDragOver:Dt}=U.current,Yt=Vt.get(V),an=Yt&&Yt.rect.current?{id:Yt.id,rect:Yt.rect.current,data:Yt.data,disabled:Yt.disabled}:null,tt={active:Qe,activatorEvent:at,collisions:mt,delta:{x:At.x,y:At.y},over:an};Rr.unstable_batchedUpdates(()=>{Q(an),Dt==null||Dt(tt),b({type:"onDragOver",event:tt})})},[V]),Wt(()=>{Se.current={activatorEvent:ce,active:A,activeNode:J,collisionRect:N,collisions:T,droppableRects:Z,draggableNodes:k,draggingNode:Be,draggingNodeRect:te,droppableContainers:I,over:z,scrollableAncestors:bt,scrollAdjustedTranslate:S},M.current={initial:te,translated:N}},[A,J,T,N,k,Be,te,Z,I,z,bt,S]),dm({...se,delta:L,draggingRect:N,pointerCoordinates:Vs,scrollableAncestors:bt,scrollableAncestorRects:or});const ar=p.useMemo(()=>({active:A,activeNode:J,activeNodeRect:oe,activatorEvent:ce,collisions:T,containerNodeRect:ot,dragOverlay:Ke,draggableNodes:k,droppableContainers:I,droppableRects:Z,over:z,measureDroppableContainers:pe,scrollableAncestors:bt,scrollableAncestorRects:or,measuringConfiguration:K,measuringScheduled:Oe,windowRect:et}),[A,J,oe,ce,T,ot,Ke,k,I,Z,z,pe,bt,or,K,Oe,et]),Wn=p.useMemo(()=>({activatorEvent:ce,activators:wt,active:A,activeNodeRect:oe,ariaDescribedById:{draggable:X},dispatch:v,draggableNodes:k,over:z,measureDroppableContainers:pe}),[ce,wt,A,oe,v,X,k,z,pe]);return p.createElement(md.Provider,{value:x},p.createElement(Rs.Provider,{value:Wn},p.createElement(Ad.Provider,{value:ar},p.createElement(zi.Provider,{value:ee},u)),p.createElement(Rm,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(Lg,{...a,hiddenTextDescribedById:X}));function Mr(){const Qe=(F==null?void 0:F.autoScrollEnabled)===!1,at=typeof c=="object"?c.enabled===!1:c===!1,mt=D&&!Qe&&!at;return typeof c=="object"?{...c,enabled:mt}:{enabled:mt}}}),Pm=p.createContext(null),Vl="button",Mm="Draggable";function Ld(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=js(Mm),{activators:o,activatorEvent:a,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:m}=p.useContext(Rs),{role:g=Vl,roleDescription:_="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?zi:Pm),[b,x]=wi(),[w,C]=wi(),D=Cm(o,t),j=ms(r);Wt(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:w,data:j}),()=>{const L=f.get(t);L&&L.key===i&&f.delete(t)}),[f,t]);const k=p.useMemo(()=>({role:g,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&g===Vl?!0:void 0,"aria-roledescription":_,"aria-describedby":d.draggable}),[n,g,h,y,_,d.draggable]);return{active:c,activatorEvent:a,activeNodeRect:u,attributes:k,isDragging:y,listeners:n?void 0:D,node:b,over:m,setNodeRef:x,setActivatorNodeRef:C,transform:v}}function Fd(){return p.useContext(Ad)}const Lm="Droppable",Fm={timeout:25};function $m(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=js(Lm),{active:o,dispatch:a,over:c,measureDroppableContainers:u}=p.useContext(Rs),d=p.useRef({disabled:r}),f=p.useRef(!1),m=p.useRef(null),g=p.useRef(null),{disabled:_,updateMeasurementsFor:h,timeout:y}={...Fm,...s},v=ms(h??n),b=p.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),g.current=null},y)},[y]),x=Ui({callback:b,disabled:_||!o}),w=p.useCallback((k,L)=>{x&&(L&&(x.unobserve(L),f.current=!1),k&&x.observe(k))},[x]),[C,D]=wi(w),j=ms(t);return p.useEffect(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),p.useEffect(()=>(a({type:He.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:m,data:j}}),()=>a({type:He.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==d.current.disabled&&(a({type:He.SetDroppableDisabled,id:n,key:i,disabled:r}),d.current.disabled=r)},[n,i,r,a]),{active:o,rect:m,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:D}}function Bm(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=xi(r);return!r&&!n&&a&&s(a),Wt(()=>{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]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const Vm={x:0,y:0,scaleX:1,scaleY:1};function Um(e){let{children:t}=e;return p.createElement(Rs.Provider,{value:kd},p.createElement(zi.Provider,{value:Vm},t))}const zm={position:"fixed",touchAction:"none"},qm=e=>$i(e)?"transform 250ms ease":void 0,Hm=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:u,transition:d=qm}=e;if(!a)return null;const f=s?u:{...u,scaleX:1,scaleY:1},m={...zm,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ar.Transform.toString(f),transformOrigin:s&&n?Fg(n,a):void 0,transition:typeof d=="function"?d(n):d,...c};return p.createElement(r,{className:o,style:m,ref:t},i)}),Wm=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)}},Km=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ar.Transform.toString(t)},{transform:Ar.Transform.toString(r)}]},Qm={duration:250,easing:"ease",keyframes:Km,sideEffects:Wm({styles:{active:{opacity:"0"}}})};function Gm(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Fi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const u=Rd(o);if(!u)return;const{transform:d}=vt(o).getComputedStyle(o),f=xd(d);if(!f)return;const m=typeof t=="function"?t:Ym(t);return Nd(c,s.draggable.measure),m({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 Ym(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...Qm,...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},m={x:c.x-d.x,y:c.y-d.y,...f},g=s({...u,active:o,dragOverlay:a,transform:{initial:c,final:m}}),[_]=g,h=g[g.length-1];if(JSON.stringify(_)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...u}),v=a.node.animate(g,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let Ul=0;function Xm(e){return p.useMemo(()=>{if(e!=null)return Ul++,Ul},[e])}const Zm=p.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:m,containerNodeRect:g,draggableNodes:_,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:x,scrollableAncestorRects:w,windowRect:C}=Fd(),D=p.useContext(zi),j=Xm(f==null?void 0:f.id),k=Pd(o,{activatorEvent:d,active:f,activeNodeRect:m,containerNodeRect:g,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:w,transform:D,windowRect:C}),L=Fa(m),I=Gm({config:n,draggableNodes:_,droppableContainers:h,measuringConfiguration:b}),R=L?y.setRef:void 0;return p.createElement(Um,null,p.createElement(Bm,{animation:I},f&&j?p.createElement(Hm,{key:j,id:f.id,ref:R,as:a,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:L,style:{zIndex:u,...s},transform:k},r):null))});/**
182
182
  * @license lucide-react v0.400.0 - ISC
183
183
  *
184
184
  * This source code is licensed under the ISC license.
@@ -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 Kl;function Ey(){return Kl||(Kl=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 h=_();if(!f){var y=_();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:_}});var v=y[0].inst,b=y[1];return c(function(){v.value=h,v.getSnapshot=_,r(v)&&b({inst:v})},[g,h,_]),a(function(){return r(v)&&b({inst:v}),g(function(){r(v)&&b({inst:v})})},[g]),u(h),h}function r(g){var _=g.getSnapshot;g=g.value;try{var h=_();return!i(g,h)}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=p,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,u=s.useDebugValue,d=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;ho.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ho}var Ql;function Wa(){return Ql||(Ql=1,process.env.NODE_ENV==="production"?Ws.exports=Cy():Ws.exports=Ey()),Ws.exports}/**
432
+ */var Kl;function Oy(){return Kl||(Kl=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 h=_();if(!f){var y=_();i(h,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:h,getSnapshot:_}});var v=y[0].inst,b=y[1];return c(function(){v.value=h,v.getSnapshot=_,r(v)&&b({inst:v})},[g,h,_]),a(function(){return r(v)&&b({inst:v}),g(function(){r(v)&&b({inst:v})})},[g]),u(h),h}function r(g){var _=g.getSnapshot;g=g.value;try{var h=_();return!i(g,h)}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=p,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,c=s.useLayoutEffect,u=s.useDebugValue,d=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;ho.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ho}var Ql;function Wa(){return Ql||(Ql=1,process.env.NODE_ENV==="production"?Ws.exports=Cy():Ws.exports=Oy()),Ws.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 Gl;function Oy(){if(Gl)return uo;Gl=1;var e=p,t=Wa();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 uo.useSyncExternalStoreWithSelector=function(u,d,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(O){if(!b){if(b=!0,x=O,O=m(O),g!==void 0&&h.hasValue){var T=h.value;if(g(T,O))return w=T}return w=O}if(T=w,n(x,O))return T;var R=m(O);return g!==void 0&&g(T,R)?(x=O,T):(x=O,w=R)}var b=!1,x,w,S=f===void 0?null:f;return[function(){return v(d())},S===null?void 0:function(){return v(S())}]},[d,f,m,g]);var y=s(u,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},uo}var po={};/**
440
+ */var Gl;function Ey(){if(Gl)return uo;Gl=1;var e=p,t=Wa();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 uo.useSyncExternalStoreWithSelector=function(u,d,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(D){if(!b){if(b=!0,x=D,D=m(D),g!==void 0&&h.hasValue){var j=h.value;if(g(j,D))return w=j}return w=D}if(j=w,n(x,D))return j;var k=m(D);return g!==void 0&&g(j,k)?(x=D,j):(x=D,w=k)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(d())},C===null?void 0:function(){return v(C())}]},[d,f,m,g]);var y=s(u,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},uo}var po={};/**
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 Yl;function Dy(){return Yl||(Yl=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=p,r=Wa(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(u,d,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(O){if(!b){if(b=!0,x=O,O=m(O),g!==void 0&&h.hasValue){var T=h.value;if(g(T,O))return w=T}return w=O}if(T=w,n(x,O))return T;var R=m(O);return g!==void 0&&g(T,R)?(x=O,T):(x=O,w=R)}var b=!1,x,w,S=f===void 0?null:f;return[function(){return v(d())},S===null?void 0:function(){return v(S())}]},[d,f,m,g]);var y=s(u,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),po}process.env.NODE_ENV==="production"?aa.exports=Oy():aa.exports=Dy();var Iy=aa.exports;const Ny=Wd(Iy),Kd={},{useDebugValue:Ty}=p,{useSyncExternalStoreWithSelector:jy}=Ny;let Xl=!1;const Ry=e=>e;function ky(e,t=Ry,r){(Kd?"production":void 0)!=="production"&&r&&!Xl&&(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"),Xl=!0);const n=jy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Ty(n),n}const Zl=e=>{(Kd?"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"?Sy(e):e,r=(n,s)=>ky(t,n,s);return Object.assign(r,t),r},qi=e=>e?Zl(e):Zl,ve=qi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,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}})})),Qd=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ve},Symbol.toStringTag,{value:"Module"}));function bn(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 Gd(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=Gd(s.children,t,r+1);if(i>=0)return i}}return-1}const Ay=new Set(["name","appIcon","description","keywords","trackable"]);function Yd(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Ay)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Yd(n.children,t,r)}:n})}function ii(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:ii(n.children,t,r)}:n)}function la(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?la(r.children,t):[]}))}function Xd(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:Xd(s.children,t,r,n)}:s})}function Py(e,t){const r=bn(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?bn(e,s.parent):void 0;return n}const ke=qi((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=bn(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ve.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:Yd(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),ve.getState().setIsDirty(!0)},addNode:(r,n)=>{var u,d;const s=t(),i=((d=(u=ve.getState().editorConfig)==null?void 0:u.config)==null?void 0:d.maxDepth)??4,o=Gd(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:ii(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),t().selectNode(a),a},deleteNode:r=>{e(n=>({treeData:la(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Xd(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=bn(i.treeData,r);if(!o)return i;let a=la(i.treeData,r);return a=ii(a,s,{...o,parent:s}),{treeData:a,isDirty:!0}})},addResource:(r,n)=>{var c,u;const s=ve.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:ii(d.treeData,n,a)})),t().markDirty()},markDirty:()=>{Promise.resolve().then(()=>Qd).then(({useEditorStore:r})=>{r.getState().setIsDirty(!0)})},getNodeById:r=>bn(t().treeData,r),getChildrenOf:r=>{const n=bn(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Py(t().treeData,r)})),My=qi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Ly="_spin_1ah4d_9",Fy={spin:Ly},$y=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Fy.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($y,{size:14}):null,i]}),By="_overlay_w9xez_1",Vy="_modal_w9xez_11",Uy="_modalHeader_w9xez_23",zy="_modalHeaderClose_w9xez_33",qy="_modalBody_w9xez_51",Hy="_modalFooter_w9xez_58",Wy="_checkRow_w9xez_65",Ky="_formGroup_w9xez_108",Qy="_textarea_w9xez_119",Gy="_sliderGroup_w9xez_140",Yy="_sliderValue_w9xez_152",Xy="_sliderLabels_w9xez_160",Zy="_sectionTitle_w9xez_168",Ee={overlay:By,modal:Vy,modalHeader:Uy,modalHeaderClose:zy,modalBody:qy,modalFooter:Hy,checkRow:Wy,formGroup:Ky,textarea:Qy,sliderGroup:Gy,sliderValue:Yy,sliderLabels:Xy,sectionTitle:Zy},Jy=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ve(d=>{var f,m;return(m=(f=d.editorConfig)==null?void 0:f.config)==null?void 0:m.objectType})||"Content",s=ve(d=>d.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(d=>i[d.code]),c=s.length===0||a,u=()=>{t()};return l.jsx("div",{className:Ee.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ee.modal,children:[l.jsxs("div",{className:Ee.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Ee.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ee.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:Ee.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:Ee.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[d.code],onChange:f=>o(m=>({...m,[d.code]:f.target.checked}))}),l.jsx("span",{children:d.label})]},d.code))]})}),l.jsxs("div",{className:Ee.modalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Oe,{variant:"primary",onClick:u,disabled:!c,children:"Yes"})]})]})})},ev=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.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:Ee.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Ee.modal,children:[l.jsxs("div",{className:Ee.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:u}),l.jsx("button",{className:Ee.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ee.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ee.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Ee.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:m=>a(Number(m.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Ee.sliderValue,children:o})]}),l.jsxs("div",{className:Ee.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Ee.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:Ee.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:m=>i(m.target.value),rows:4})]})]}):l.jsxs("div",{className:Ee.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:Ee.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:m=>i(m.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:Ee.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 Zd(e,t){return function(){return e.apply(t,arguments)}}const{toString:tv}=Object.prototype,{getPrototypeOf:Pn}=Object,{iterator:Ps,toStringTag:Jd}=Symbol,Oi=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bs=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Oi(r,t))return!0;r=Pn(r)}return!1},rv=(e,t)=>e!=null&&bs(e,t)?e[t]:void 0,Ka=(e=>t=>{const r=tv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Gt=e=>(e=e.toLowerCase(),t=>Ka(t)===e),Hi=e=>t=>typeof t===e,{isArray:tn}=Array,Mn=Hi("undefined");function qn(e){return e!==null&&!Mn(e)&&e.constructor!==null&&!Mn(e.constructor)&&Et(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ef=Gt("ArrayBuffer");function nv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ef(e.buffer),t}const sv=Hi("string"),Et=Hi("function"),tf=Hi("number"),Hn=e=>e!==null&&typeof e=="object",iv=e=>e===!0||e===!1,oi=e=>{if(!Hn(e))return!1;const t=Pn(e);return(t===null||t===Object.prototype||Pn(t)===null)&&!bs(e,Jd)&&!bs(e,Ps)},ov=e=>{if(!Hn(e)||qn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},av=Gt("Date"),lv=Gt("File"),cv=e=>!!(e&&typeof e.uri<"u"),uv=e=>e&&typeof e.getParts<"u",dv=Gt("Blob"),fv=Gt("FileList"),hv=e=>Hn(e)&&Et(e.pipe);function pv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Jl=pv(),ec=typeof Jl.FormData<"u"?Jl.FormData:void 0,gv=e=>{if(!e)return!1;if(ec&&e instanceof ec)return!0;const t=Pn(e);if(!t||t===Object.prototype||!Et(e.append))return!1;const r=Ka(e);return r==="formdata"||r==="object"&&Et(e.toString)&&e.toString()==="[object FormData]"},mv=Gt("URLSearchParams"),[yv,vv,bv,_v]=["ReadableStream","Request","Response","Headers"].map(Gt),wv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ms(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),tn(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(qn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function rf(e,t){if(qn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nf=e=>!Mn(e)&&e!==Vr;function ca(...e){const{caseless:t,skipUndefined:r}=nf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&rf(n,o)||o,c=Oi(n,a)?n[a]:void 0;oi(c)&&oi(i)?n[a]=ca(c,i):oi(i)?n[a]=ca({},i):tn(i)?n[a]=i.slice():(!r||!Mn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||qn(a)||(Ms(a,s),typeof a!="object"||tn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let u=0;u<c.length;u++){const d=c[u];kv.call(a,d)&&s(a[d],d)}}return n}const xv=(e,t,r,{allOwnKeys:n}={})=>(Ms(t,(s,i)=>{r&&Et(s)?Object.defineProperty(e,i,{__proto__:null,value:Zd(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),Sv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Cv=(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)},Ev=(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&&Pn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Ov=(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},Dv=e=>{if(!e)return null;if(tn(e))return e;let t=e.length;if(!tf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Iv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Pn(Uint8Array)),Nv=(e,t)=>{const n=(e&&e[Ps]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Tv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},jv=Gt("HTMLFormElement"),Rv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:kv}=Object.prototype,Av=Gt("RegExp"),sf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ms(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Pv=e=>{sf(e,(t,r)=>{if(Et(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Et(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Mv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return tn(e)?n(e):n(String(e).split(t)),r},Lv=()=>{},Fv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function $v(e){return!!(e&&Et(e.append)&&e[Jd]==="FormData"&&e[Ps])}const Bv=e=>{const t=new WeakSet,r=n=>{if(Hn(n)){if(t.has(n))return;if(qn(n))return n;if(!("toJSON"in n)){t.add(n);const s=tn(n)?[]:{};return Ms(n,(i,o)=>{const a=r(i);!Mn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Vv=Gt("AsyncFunction"),Uv=e=>e&&(Hn(e)||Et(e))&&Et(e.then)&&Et(e.catch),of=((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",Et(Vr.postMessage)),zv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||of,af=e=>e!=null&&Et(e[Ps]),qv=e=>e!=null&&bs(e,Ps)&&af(e),D={isArray:tn,isArrayBuffer:ef,isBuffer:qn,isFormData:gv,isArrayBufferView:nv,isString:sv,isNumber:tf,isBoolean:iv,isObject:Hn,isPlainObject:oi,isEmptyObject:ov,isReadableStream:yv,isRequest:vv,isResponse:bv,isHeaders:_v,isUndefined:Mn,isDate:av,isFile:lv,isReactNativeBlob:cv,isReactNative:uv,isBlob:dv,isRegExp:Av,isFunction:Et,isStream:hv,isURLSearchParams:mv,isTypedArray:Iv,isFileList:fv,forEach:Ms,merge:ca,extend:xv,trim:wv,stripBOM:Sv,inherits:Cv,toFlatObject:Ev,kindOf:Ka,kindOfTest:Gt,endsWith:Ov,toArray:Dv,forEachEntry:Nv,matchAll:Tv,isHTMLForm:jv,hasOwnProperty:Oi,hasOwnProp:Oi,hasOwnInPrototypeChain:bs,getSafeProp:rv,reduceDescriptors:sf,freezeMethods:Pv,toObjectSet:Mv,toCamelCase:Rv,noop:Lv,toFiniteNumber:Fv,findKey:rf,global:Vr,isContextDefined:nf,isSpecCompliantForm:$v,toJSONObject:Bv,isAsyncFn:Vv,isThenable:Uv,setImmediate:of,asap:zv,isIterable:af,isSafeIterable:qv},Hv=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"]),Wv=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]&&Hv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Kv(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 Qv=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Gv=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Qa(e,t){return D.isArray(e)?e.map(r=>Qa(r,t)):Kv(String(e).replace(t,""))}const Yv=e=>Qa(e,Qv),Xv=e=>Qa(e,Gv);function lf(e){const t=Object.create(null);return D.forEach(e.toJSON(),(r,n)=>{t[n]=Xv(r)}),t}const tc=Symbol("internals");function Yn(e){return e&&String(e).trim().toLowerCase()}function ai(e){return e===!1||e==null?e:D.isArray(e)?e.map(ai):Yv(String(e))}function Zv(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 Jv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function go(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 eb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function tb(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 mt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,u){const d=Yn(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]=ai(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())&&!Jv(t))o(Wv(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=Yn(t),t){const n=D.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Zv(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=Yn(t),t){const n=D.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||go(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=Yn(o),o){const a=D.findKey(n,o);a&&(!r||go(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||go(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]=ai(s),delete r[i];return}const a=t?eb(i):String(i).trim();a!==i&&delete r[i],r[a]=ai(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[tc]=this[tc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Yn(o);n[a]||(tb(s,o),n[a]=!0)}return D.isArray(t)?t.forEach(i):i(t),this}};mt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);D.reduceDescriptors(mt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});D.freezeMethods(mt);const rb="[REDACTED ****]";function nb(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 sb(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 mt&&(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)&&nb(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const u=r.has(a.toLowerCase())?rb:s(c);D.isUndefined(u)||(o[a]=u)}}return n.pop(),o};return s(e)}let Y=class cf extends Error{static from(t,r,n,s,i,o){const a=new cf(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?sb(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}}};Y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Y.ERR_BAD_OPTION="ERR_BAD_OPTION";Y.ECONNABORTED="ECONNABORTED";Y.ETIMEDOUT="ETIMEDOUT";Y.ECONNREFUSED="ECONNREFUSED";Y.ERR_NETWORK="ERR_NETWORK";Y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Y.ERR_DEPRECATED="ERR_DEPRECATED";Y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Y.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Y.ERR_CANCELED="ERR_CANCELED";Y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Y.ERR_INVALID_URL="ERR_INVALID_URL";Y.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ib=null,uf=100;function ua(e){return D.isPlainObject(e)||D.isArray(e)}function df(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function mo(e,t,r){return e?e.concat(t).map(function(s,i){return s=df(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function ob(e){return D.isArray(e)&&!e.some(ua)}const ab=D.toFlatObject(D,{},null,function(t){return/^is[A-Z]/.test(t)});function Wi(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,x){return!D.isUndefined(x[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?uf:r.maxDepth,u=a&&D.isSpecCompliantForm(t),d=[];if(!D.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(D.isDate(v))return v.toISOString();if(D.isBoolean(v))return v.toString();if(!u&&D.isBlob(v))throw new Y("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(v)||D.isTypedArray(v)?u&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function m(v){if(v>c)throw new Y("Object is too deeply nested ("+v+" levels). Max depth: "+c,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(v,b){if(c===1/0)return JSON.stringify(v);const x=[];return JSON.stringify(v,function(S,O){if(!D.isObject(O))return O;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(O),m(b+x.length-1),O})}function _(v,b,x){let w=v;if(D.isReactNative(t)&&D.isReactNativeBlob(v))return t.append(mo(x,b,i),f(v)),!1;if(v&&!x&&typeof v=="object"){if(D.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=g(v,1);else if(D.isArray(v)&&ob(v)||(D.isFileList(v)||D.endsWith(b,"[]"))&&(w=D.toArray(v)))return b=df(b),w.forEach(function(O,T){!(D.isUndefined(O)||O===null)&&t.append(o===!0?mo([b],T,i):o===null?b:b+"[]",f(O))}),!1}return ua(v)?!0:(t.append(mo(x,b,i),f(v)),!1)}const h=Object.assign(ab,{defaultVisitor:_,convertValue:f,isVisitable:ua});function y(v,b,x=0){if(!D.isUndefined(v)){if(m(x),d.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));d.push(v),D.forEach(v,function(S,O){(!(D.isUndefined(S)||S===null)&&s.call(t,S,D.isString(O)?O.trim():O,b,h))===!0&&y(S,b?b.concat(O):[O],x+1)}),d.pop()}}if(!D.isObject(e))throw new TypeError("data must be an object");return y(e),t}function rc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function Ga(e,t){this._pairs=[],e&&Wi(e,this,t)}const ff=Ga.prototype;ff.append=function(t,r){this._pairs.push([t,r])};ff.toString=function(t){const r=t?function(n){return t.call(this,n,rc)}:rc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function lb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function hf(e,t,r){if(!t)return e;const n=D.isFunction(r)?{serialize:r}:r,s=D.getSafeProp(n,"encode")||lb,i=D.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=D.isURLSearchParams(t)?t.toString():new Ga(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class nc{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 Ya={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},cb=typeof URLSearchParams<"u"?URLSearchParams:Ga,ub=typeof FormData<"u"?FormData:null,db=typeof Blob<"u"?Blob:null,fb={isBrowser:!0,classes:{URLSearchParams:cb,FormData:ub,Blob:db},protocols:["http","https","file","blob","url","data"]},Xa=typeof window<"u"&&typeof document<"u",da=typeof navigator=="object"&&navigator||void 0,hb=Xa&&(!da||["ReactNative","NativeScript","NS"].indexOf(da.product)<0),pb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gb=Xa&&window.location.href||"http://localhost",mb=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xa,hasStandardBrowserEnv:hb,hasStandardBrowserWebWorkerEnv:pb,navigator:da,origin:gb},Symbol.toStringTag,{value:"Module"})),it={...mb,...fb};function yb(e,t){return Wi(e,new it.classes.URLSearchParams,{visitor:function(r,n,s,i){return it.isNode&&D.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const sc=uf;function pf(e){if(e>sc)throw new Y("FormData field is too deeply nested ("+e+" levels). Max depth: "+sc,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function vb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)pf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function bb(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 gf(e){function t(r,n,s,i){pf(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]=bb(s[o])),!a)}if(D.isFormData(e)&&D.isFunction(e.entries)){const r={};return D.forEachEntry(e,(n,s)=>{t(vb(n),s,r,0)}),r}return null}const ln=(e,t)=>e!=null&&D.hasOwnProp(e,t)?e[t]:void 0;function _b(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 Ls={transitional:Ya,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(gf(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=ln(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return yb(t,c).toString();if((a=D.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=ln(this,"env"),d=u&&u.FormData;return Wi(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(r.setContentType("application/json",!1),_b(t)):t}],transformResponse:[function(t){const r=ln(this,"transitional")||Ls.transitional,n=r&&r.forcedJSONParsing,s=ln(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,ln(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Y.from(c,Y.ERR_BAD_RESPONSE,this,null,ln(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:it.classes.FormData,Blob:it.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=>{Ls.headers[e]={}});function yo(e,t){const r=this||Ls,n=t||r,s=mt.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 mf(e){return!!(e&&e.__CANCEL__)}let Fs=class extends Y{constructor(t,r,n){super(t??"canceled",Y.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function yf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Y("Request failed with status code "+r.status,r.status>=400&&r.status<500?Y.ERR_BAD_REQUEST:Y.ERR_BAD_RESPONSE,r.config,r.request,r))}function wb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function xb(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,m=0;for(;f!==s;)m+=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(m*1e3/g):void 0}}function Sb(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 Di=(e,t,r=3)=>{let n=0;const s=xb(50,250);return Sb(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)},ic=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},oc=e=>(...t)=>D.asap(()=>e(...t)),Cb=it.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,it.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,Eb=it.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 Db(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Ib=/^https?:(?!\/\/)/i,Nb=/[\t\n\r]/g;function Tb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function jb(e){return Tb(e).replace(Nb,"")}function ac(e,t){if(typeof e=="string"&&Ib.test(jb(e)))throw new Y('Invalid URL: missing "//" after protocol',Y.ERR_INVALID_URL,t)}function vf(e,t,r,n){ac(t,n);let s=!Ob(t);return e&&(s||r===!1)?(ac(e,n),Db(e,t)):t}const lc=e=>e instanceof mt?{...e}:e;function rn(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,m,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,m,g){if(D.isUndefined(f)){if(!D.isUndefined(d))return n(void 0,d,m,g)}else return n(d,f,m,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 m=D.hasOwnProp(e,"transitional")?e.transitional:void 0;if(D.isPlainObject(m)&&D.hasOwnProp(m,d))return m[d]}function c(d,f,m){if(D.hasOwnProp(t,m))return n(d,f);if(D.hasOwnProp(e,m))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,m)=>s(lc(d),lc(f),m,!0)};return D.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=D.hasOwnProp(u,f)?u[f]:s,g=D.hasOwnProp(e,f)?e[f]:void 0,_=D.hasOwnProp(t,f)?t[f]:void 0,h=m(g,_,f);D.isUndefined(h)&&m!==c||(r[f]=h)}),D.hasOwnProp(t,"validateStatus")&&D.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(D.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Rb=["content-type","content-length"];function kb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Rb.includes(n.toLowerCase())&&e.set(n,s)})}const Ab=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function bf(e){const t=rn({},e),r=m=>D.hasOwnProp(t,m)?t[m]: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=mt.from(a),t.url=hf(vf(u,f,d,t),r("params"),r("paramsSerializer")),c){const m=D.getSafeProp(c,"username")||"",g=D.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(g?Ab(g):"")))}if(D.isFormData(n)&&(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv||D.isReactNative(n)?a.setContentType(void 0):D.isFunction(n.getHeaders)&&kb(a,n.getHeaders(),r("formDataHeaderPolicy"))),it.hasStandardBrowserEnv&&(D.isFunction(s)&&(s=s(t)),s===!0||s==null&&Cb(t.url))){const g=i&&o&&Eb.read(o);g&&a.set(i,g)}return t}const Pb=typeof XMLHttpRequest<"u",Mb=Pb&&function(e){return new Promise(function(r,n){const s=bf(e);let i=s.data;const o=mt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=s,d,f,m,g,_;function h(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const x=mt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};yf(function(T){r(T),h()},function(T){n(T),h()},S),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new Y("Request aborted",Y.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(w){const S=w&&w.message?w.message:"Network Error",O=new Y(S,Y.ERR_NETWORK,e,y);O.event=w||null,n(O),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||Ya;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Y(w,S.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&D.forEach(lf(o),function(w,S){y.setRequestHeader(S,w)}),D.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),u&&([m,_]=Di(u,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,g]=Di(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=x=>{y&&(n(!x||x.type?new Fs(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const b=wb(s.url);if(b&&!it.protocols.includes(b)){n(new Y("Unsupported protocol "+b+":",Y.ERR_BAD_REQUEST,e));return}y.send(i||null)})},Lb=(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 Y?u:new Fs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new Y(`timeout of ${t}ms exceeded`,Y.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},Fb=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},$b=async function*(e,t){for await(const r of Bb(e))yield*Fb(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()}},cc=(e,t,r,n)=>{const s=$b(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 m=i+=f;r(m)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ii=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Vb=(e,t,r)=>t+2<r&&Ii(e.charCodeAt(t+1))&&Ii(e.charCodeAt(t+2));function Ub(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),h=n.charCodeAt(g+2);Ii(_)&&Ii(h)&&(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 m=Math.floor(o/4)*3-(c||0);return m>0?m:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&Vb(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 Za="1.18.0",uc=64*1024,{isFunction:Ks}=D,zb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),dc=e=>{if(!D.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},fc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},qb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Hb=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?Ks(s):typeof fetch=="function",c=Ks(i),u=Ks(o);if(!a)return!1;const d=a&&Ks(r),f=a&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),m=c&&d&&fc(()=>{let v=!1;const b=new i(it.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),x=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!x}),g=u&&d&&fc(()=>D.isReadableStream(new o("").body)),_={stream:g&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!_[v]&&(_[v]=(b,x)=>{let w=b&&b[v];if(w)return w.call(b);throw new Y(`Response type '${v}' is not supported`,Y.ERR_NOT_SUPPORT,x)})});const h=async v=>{if(v==null)return 0;if(D.isBlob(v))return v.size;if(D.isSpecCompliantForm(v))return(await new i(it.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(D.isArrayBufferView(v)||D.isArrayBuffer(v))return v.byteLength;if(D.isURLSearchParams(v)&&(v=v+""),D.isString(v))return(await f(v)).byteLength},y=async(v,b)=>{const x=D.toFiniteNumber(v.getContentLength());return x??h(b)};return async v=>{let{url:b,method:x,data:w,signal:S,cancelToken:O,timeout:T,onDownloadProgress:R,onUploadProgress:M,responseType:j,headers:k,withCredentials:U="same-origin",fetchOptions:A,maxContentLength:q,maxBodyLength:L}=bf(v);const se=D.isNumber(q)&&q>-1,ce=D.isNumber(L)&&L>-1,W=J=>D.hasOwnProp(v,J)?v[J]:void 0;let B=s||fetch;j=j?(j+"").toLowerCase():"text";let X=Lb([S,O&&O.toAbortSignal()],T),F=null;const K=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let Z,pe=null;const Ce=()=>new Y("Request body larger than maxBodyLength limit",Y.ERR_BAD_REQUEST,v,F);try{let J;const be=W("auth");if(be){const te=D.getSafeProp(be,"username")||"",ze=D.getSafeProp(be,"password")||"";J={username:te,password:ze}}if(qb(b)){const te=new URL(b,it.origin);if(!J&&(te.username||te.password)){const ze=dc(te.username),at=dc(te.password);J={username:ze,password:at}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(J&&(k.delete("authorization"),k.set("Authorization","Basic "+btoa(zb((J.username||"")+":"+(J.password||""))))),se&&typeof b=="string"&&b.startsWith("data:")&&Ub(b)>q)throw new Y("maxContentLength size of "+q+" exceeded",Y.ERR_BAD_RESPONSE,v,F);if(ce&&x!=="get"&&x!=="head"){const te=await h(w);if(typeof te=="number"&&isFinite(te)&&(Z=te,te>L))throw Ce()}const re=ce&&(D.isReadableStream(w)||D.isStream(w)),ye=(te,ze,at)=>cc(te,uc,qe=>{if(ce&&qe>L)throw pe=Ce();ze&&ze(qe)},at);if(m&&x!=="get"&&x!=="head"&&(M||re)){if(Z=Z??await y(k,w),Z!==0||re){let te=new i(b,{method:"POST",body:w,duplex:"half"}),ze;if(D.isFormData(w)&&(ze=te.headers.get("content-type"))&&k.setContentType(ze),te.body){const[at,qe]=M&&ic(Z,Di(oc(M)))||[];w=ye(te.body,at,qe)}}}else if(re&&!c&&d&&x!=="get"&&x!=="head")w=ye(w);else if(re&&c&&!m&&x!=="get"&&x!=="head")throw new Y("Stream request bodies are not supported by the current fetch implementation",Y.ERR_NOT_SUPPORT,v,F);D.isString(U)||(U=U?"include":"omit");const ie=c&&"credentials"in i.prototype;if(D.isFormData(w)){const te=k.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&k.delete("content-type")}k.set("User-Agent","axios/"+Za,!1);const ot={...A,signal:X,method:x.toUpperCase(),headers:lf(k.normalize()),body:w,duplex:"half",credentials:ie?U:void 0};F=c&&new i(b,ot);let De=await(c?B(F,A):B(b,ot));const et=mt.from(De.headers);if(se){const te=D.toFiniteNumber(et.getContentLength());if(te!=null&&te>q)throw new Y("maxContentLength size of "+q+" exceeded",Y.ERR_BAD_RESPONSE,v,F)}const Qe=g&&(j==="stream"||j==="response");if(g&&De.body&&(R||se||Qe&&K)){const te={};["status","statusText","headers"].forEach(At=>{te[At]=De[At]});const ze=D.toFiniteNumber(et.getContentLength()),[at,qe]=R&&ic(ze,Di(oc(R),!0))||[];let Ae=0;const Dt=At=>{if(se&&(Ae=At,Ae>q))throw new Y("maxContentLength size of "+q+" exceeded",Y.ERR_BAD_RESPONSE,v,F);at&&at(At)};De=new o(cc(De.body,uc,Dt,()=>{qe&&qe(),K&&K()}),te)}j=j||"text";let $e=await _[D.findKey(_,j)||"text"](De,v);if(se&&!g&&!Qe){let te;if($e!=null&&(typeof $e.byteLength=="number"?te=$e.byteLength:typeof $e.size=="number"?te=$e.size:typeof $e=="string"&&(te=typeof n=="function"?new n().encode($e).byteLength:$e.length)),typeof te=="number"&&te>q)throw new Y("maxContentLength size of "+q+" exceeded",Y.ERR_BAD_RESPONSE,v,F)}return!Qe&&K&&K(),await new Promise((te,ze)=>{yf(te,ze,{data:$e,headers:mt.from(De.headers),status:De.status,statusText:De.statusText,config:v,request:F})})}catch(J){if(K&&K(),X&&X.aborted&&X.reason instanceof Y){const be=X.reason;throw be.config=v,F&&(be.request=F),J!==be&&(be.cause=J),be}throw pe?(F&&!pe.request&&(pe.request=F),pe):J instanceof Y?(F&&!J.request&&(J.request=F),J):J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new Y("Network Error",Y.ERR_NETWORK,v,F,J&&J.response),{cause:J.cause||J}):Y.from(J,J&&J.code,v,F,J&&J.response)}}},Wb=new Map,_f=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=Wb;for(;a--;)c=i[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:Hb(t)),d=u;return u};_f();const Ja={http:ib,xhr:Mb,fetch:{get:_f}};D.forEach(Ja,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const hc=e=>`- ${e}`,Kb=e=>D.isFunction(e)||e===null||e===!1;function Qb(e,t){e=D.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Kb(n)&&(s=Ja[(a=String(n)).toLowerCase()],s===void 0))throw new Y(`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 :
448
+ */var Yl;function Dy(){return Yl||(Yl=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=p,r=Wa(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(u,d,f,m,g){var _=i(null);if(_.current===null){var h={hasValue:!1,value:null};_.current=h}else h=_.current;_=a(function(){function v(D){if(!b){if(b=!0,x=D,D=m(D),g!==void 0&&h.hasValue){var j=h.value;if(g(j,D))return w=j}return w=D}if(j=w,n(x,D))return j;var k=m(D);return g!==void 0&&g(j,k)?(x=D,j):(x=D,w=k)}var b=!1,x,w,C=f===void 0?null:f;return[function(){return v(d())},C===null?void 0:function(){return v(C())}]},[d,f,m,g]);var y=s(u,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),po}process.env.NODE_ENV==="production"?aa.exports=Ey():aa.exports=Dy();var Iy=aa.exports;const Ny=Wd(Iy),Kd={},{useDebugValue:Ty}=p,{useSyncExternalStoreWithSelector:jy}=Ny;let Xl=!1;const Ry=e=>e;function ky(e,t=Ry,r){(Kd?"production":void 0)!=="production"&&r&&!Xl&&(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"),Xl=!0);const n=jy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Ty(n),n}const Zl=e=>{(Kd?"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"?Sy(e):e,r=(n,s)=>ky(t,n,s);return Object.assign(r,t),r},qi=e=>e?Zl(e):Zl,ve=qi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sendBackCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,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}})})),Qd=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ve},Symbol.toStringTag,{value:"Module"}));function bn(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 Gd(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=Gd(s.children,t,r+1);if(i>=0)return i}}return-1}const Ay=new Set(["name","appIcon","description","keywords","trackable"]);function Yd(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Ay)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:Yd(n.children,t,r)}:n})}function ii(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:ii(n.children,t,r)}:n)}function la(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?la(r.children,t):[]}))}function Xd(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:Xd(s.children,t,r,n)}:s})}function Py(e,t){const r=bn(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?bn(e,s.parent):void 0;return n}const ke=qi((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=bn(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ve.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:Yd(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),ve.getState().setIsDirty(!0)},addNode:(r,n)=>{var u,d;const s=t(),i=((d=(u=ve.getState().editorConfig)==null?void 0:u.config)==null?void 0:d.maxDepth)??4,o=Gd(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:ii(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),t().selectNode(a),a},deleteNode:r=>{e(n=>({treeData:la(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:Xd(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=bn(i.treeData,r);if(!o)return i;let a=la(i.treeData,r);return a=ii(a,s,{...o,parent:s}),{treeData:a,isDirty:!0}})},addResource:(r,n)=>{var c,u;const s=ve.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:ii(d.treeData,n,a)})),t().markDirty()},markDirty:()=>{Promise.resolve().then(()=>Qd).then(({useEditorStore:r})=>{r.getState().setIsDirty(!0)})},getNodeById:r=>bn(t().treeData,r),getChildrenOf:r=>{const n=bn(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>Py(t().treeData,r)})),My=qi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),Ly="_spin_1ah4d_9",Fy={spin:Ly},$y=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:Fy.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($y,{size:14}):null,i]}),By="_overlay_w9xez_1",Vy="_modal_w9xez_11",Uy="_modalHeader_w9xez_23",zy="_modalHeaderClose_w9xez_33",qy="_modalBody_w9xez_51",Hy="_modalFooter_w9xez_58",Wy="_checkRow_w9xez_65",Ky="_formGroup_w9xez_108",Qy="_textarea_w9xez_119",Gy="_sliderGroup_w9xez_140",Yy="_sliderValue_w9xez_152",Xy="_sliderLabels_w9xez_160",Zy="_sectionTitle_w9xez_168",Ee={overlay:By,modal:Vy,modalHeader:Uy,modalHeaderClose:zy,modalBody:qy,modalFooter:Hy,checkRow:Wy,formGroup:Ky,textarea:Qy,sliderGroup:Gy,sliderValue:Yy,sliderLabels:Xy,sectionTitle:Zy},Jy=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ve(d=>{var f,m;return(m=(f=d.editorConfig)==null?void 0:f.config)==null?void 0:m.objectType})||"Content",s=ve(d=>d.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(d=>i[d.code]),c=s.length===0||a,u=()=>{t()};return l.jsx("div",{className:Ee.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Ee.modal,children:[l.jsxs("div",{className:Ee.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Ee.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ee.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:Ee.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:Ee.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[d.code],onChange:f=>o(m=>({...m,[d.code]:f.target.checked}))}),l.jsx("span",{children:d.label})]},d.code))]})}),l.jsxs("div",{className:Ee.modalFooter,children:[l.jsx(De,{variant:"ghost",onClick:r,children:"No"}),l.jsx(De,{variant:"primary",onClick:u,disabled:!c,children:"Yes"})]})]})})},ev=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.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:Ee.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Ee.modal,children:[l.jsxs("div",{className:Ee.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:u}),l.jsx("button",{className:Ee.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Ee.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ee.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Ee.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:m=>a(Number(m.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Ee.sliderValue,children:o})]}),l.jsxs("div",{className:Ee.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Ee.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:Ee.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:m=>i(m.target.value),rows:4})]})]}):l.jsxs("div",{className:Ee.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:Ee.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:m=>i(m.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:Ee.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 Zd(e,t){return function(){return e.apply(t,arguments)}}const{toString:tv}=Object.prototype,{getPrototypeOf:Pn}=Object,{iterator:Ps,toStringTag:Jd}=Symbol,Ei=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),bs=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Ei(r,t))return!0;r=Pn(r)}return!1},rv=(e,t)=>e!=null&&bs(e,t)?e[t]:void 0,Ka=(e=>t=>{const r=tv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Qt=e=>(e=e.toLowerCase(),t=>Ka(t)===e),Hi=e=>t=>typeof t===e,{isArray:tn}=Array,Mn=Hi("undefined");function qn(e){return e!==null&&!Mn(e)&&e.constructor!==null&&!Mn(e.constructor)&&Ot(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ef=Qt("ArrayBuffer");function nv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ef(e.buffer),t}const sv=Hi("string"),Ot=Hi("function"),tf=Hi("number"),Hn=e=>e!==null&&typeof e=="object",iv=e=>e===!0||e===!1,oi=e=>{if(!Hn(e))return!1;const t=Pn(e);return(t===null||t===Object.prototype||Pn(t)===null)&&!bs(e,Jd)&&!bs(e,Ps)},ov=e=>{if(!Hn(e)||qn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},av=Qt("Date"),lv=Qt("File"),cv=e=>!!(e&&typeof e.uri<"u"),uv=e=>e&&typeof e.getParts<"u",dv=Qt("Blob"),fv=Qt("FileList"),hv=e=>Hn(e)&&Ot(e.pipe);function pv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Jl=pv(),ec=typeof Jl.FormData<"u"?Jl.FormData:void 0,gv=e=>{if(!e)return!1;if(ec&&e instanceof ec)return!0;const t=Pn(e);if(!t||t===Object.prototype||!Ot(e.append))return!1;const r=Ka(e);return r==="formdata"||r==="object"&&Ot(e.toString)&&e.toString()==="[object FormData]"},mv=Qt("URLSearchParams"),[yv,vv,bv,_v]=["ReadableStream","Request","Response","Headers"].map(Qt),wv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ms(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),tn(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(qn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function rf(e,t){if(qn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nf=e=>!Mn(e)&&e!==Vr;function ca(...e){const{caseless:t,skipUndefined:r}=nf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&rf(n,o)||o,c=Ei(n,a)?n[a]:void 0;oi(c)&&oi(i)?n[a]=ca(c,i):oi(i)?n[a]=ca({},i):tn(i)?n[a]=i.slice():(!r||!Mn(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||qn(a)||(Ms(a,s),typeof a!="object"||tn(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let u=0;u<c.length;u++){const d=c[u];kv.call(a,d)&&s(a[d],d)}}return n}const xv=(e,t,r,{allOwnKeys:n}={})=>(Ms(t,(s,i)=>{r&&Ot(s)?Object.defineProperty(e,i,{__proto__:null,value:Zd(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),Sv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Cv=(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)},Ov=(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&&Pn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Ev=(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},Dv=e=>{if(!e)return null;if(tn(e))return e;let t=e.length;if(!tf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Iv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Pn(Uint8Array)),Nv=(e,t)=>{const n=(e&&e[Ps]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Tv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},jv=Qt("HTMLFormElement"),Rv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:kv}=Object.prototype,Av=Qt("RegExp"),sf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ms(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},Pv=e=>{sf(e,(t,r)=>{if(Ot(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Ot(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+"'")})}})},Mv=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return tn(e)?n(e):n(String(e).split(t)),r},Lv=()=>{},Fv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function $v(e){return!!(e&&Ot(e.append)&&e[Jd]==="FormData"&&e[Ps])}const Bv=e=>{const t=new WeakSet,r=n=>{if(Hn(n)){if(t.has(n))return;if(qn(n))return n;if(!("toJSON"in n)){t.add(n);const s=tn(n)?[]:{};return Ms(n,(i,o)=>{const a=r(i);!Mn(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},Vv=Qt("AsyncFunction"),Uv=e=>e&&(Hn(e)||Ot(e))&&Ot(e.then)&&Ot(e.catch),of=((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",Ot(Vr.postMessage)),zv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vr):typeof process<"u"&&process.nextTick||of,af=e=>e!=null&&Ot(e[Ps]),qv=e=>e!=null&&bs(e,Ps)&&af(e),E={isArray:tn,isArrayBuffer:ef,isBuffer:qn,isFormData:gv,isArrayBufferView:nv,isString:sv,isNumber:tf,isBoolean:iv,isObject:Hn,isPlainObject:oi,isEmptyObject:ov,isReadableStream:yv,isRequest:vv,isResponse:bv,isHeaders:_v,isUndefined:Mn,isDate:av,isFile:lv,isReactNativeBlob:cv,isReactNative:uv,isBlob:dv,isRegExp:Av,isFunction:Ot,isStream:hv,isURLSearchParams:mv,isTypedArray:Iv,isFileList:fv,forEach:Ms,merge:ca,extend:xv,trim:wv,stripBOM:Sv,inherits:Cv,toFlatObject:Ov,kindOf:Ka,kindOfTest:Qt,endsWith:Ev,toArray:Dv,forEachEntry:Nv,matchAll:Tv,isHTMLForm:jv,hasOwnProperty:Ei,hasOwnProp:Ei,hasOwnInPrototypeChain:bs,getSafeProp:rv,reduceDescriptors:sf,freezeMethods:Pv,toObjectSet:Mv,toCamelCase:Rv,noop:Lv,toFiniteNumber:Fv,findKey:rf,global:Vr,isContextDefined:nf,isSpecCompliantForm:$v,toJSONObject:Bv,isAsyncFn:Vv,isThenable:Uv,setImmediate:of,asap:zv,isIterable:af,isSafeIterable:qv},Hv=E.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"]),Wv=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]&&Hv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function Kv(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 Qv=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Gv=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Qa(e,t){return E.isArray(e)?e.map(r=>Qa(r,t)):Kv(String(e).replace(t,""))}const Yv=e=>Qa(e,Qv),Xv=e=>Qa(e,Gv);function lf(e){const t=Object.create(null);return E.forEach(e.toJSON(),(r,n)=>{t[n]=Xv(r)}),t}const tc=Symbol("internals");function Yn(e){return e&&String(e).trim().toLowerCase()}function ai(e){return e===!1||e==null?e:E.isArray(e)?e.map(ai):Yv(String(e))}function Zv(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 Jv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function go(e,t,r,n,s){if(E.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!E.isString(t)){if(E.isString(n))return t.indexOf(n)!==-1;if(E.isRegExp(n))return n.test(t)}}function eb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function tb(e,t){const r=E.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 gt=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,u){const d=Yn(c);if(!d)return;const f=E.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=ai(a))}const o=(a,c)=>E.forEach(a,(u,d)=>i(u,d,c));if(E.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(E.isString(t)&&(t=t.trim())&&!Jv(t))o(Wv(t),r);else if(E.isObject(t)&&E.isSafeIterable(t)){let a=Object.create(null),c,u;for(const d of t){if(!E.isArray(d))throw new TypeError("Object iterator must return a key-value pair");u=d[0],E.hasOwnProp(a,u)?(c=a[u],a[u]=E.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=Yn(t),t){const n=E.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Zv(s);if(E.isFunction(r))return r.call(this,s,n);if(E.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Yn(t),t){const n=E.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||go(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=Yn(o),o){const a=E.findKey(n,o);a&&(!r||go(n,n[a],a,r))&&(delete n[a],s=!0)}}return E.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||go(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return E.forEach(this,(s,i)=>{const o=E.findKey(n,i);if(o){r[o]=ai(s),delete r[i];return}const a=t?eb(i):String(i).trim();a!==i&&delete r[i],r[a]=ai(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return E.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&E.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[tc]=this[tc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Yn(o);n[a]||(tb(s,o),n[a]=!0)}return E.isArray(t)?t.forEach(i):i(t),this}};gt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);E.reduceDescriptors(gt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});E.freezeMethods(gt);const rb="[REDACTED ****]";function nb(e){if(E.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(E.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function sb(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||E.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof gt&&(i=i.toJSON()),n.push(i);let o;if(E.isArray(i))o=[],i.forEach((a,c)=>{const u=s(a);E.isUndefined(u)||(o[c]=u)});else{if(!E.isPlainObject(i)&&nb(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const u=r.has(a.toLowerCase())?rb:s(c);E.isUndefined(u)||(o[a]=u)}}return n.pop(),o};return s(e)}let Y=class cf extends Error{static from(t,r,n,s,i,o){const a=new cf(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&&E.hasOwnProp(t,"redact")?t.redact:void 0,n=E.isArray(r)&&r.length>0?sb(t,r):E.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}}};Y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Y.ERR_BAD_OPTION="ERR_BAD_OPTION";Y.ECONNABORTED="ECONNABORTED";Y.ETIMEDOUT="ETIMEDOUT";Y.ECONNREFUSED="ECONNREFUSED";Y.ERR_NETWORK="ERR_NETWORK";Y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Y.ERR_DEPRECATED="ERR_DEPRECATED";Y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Y.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Y.ERR_CANCELED="ERR_CANCELED";Y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Y.ERR_INVALID_URL="ERR_INVALID_URL";Y.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ib=null,uf=100;function ua(e){return E.isPlainObject(e)||E.isArray(e)}function df(e){return E.endsWith(e,"[]")?e.slice(0,-2):e}function mo(e,t,r){return e?e.concat(t).map(function(s,i){return s=df(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function ob(e){return E.isArray(e)&&!e.some(ua)}const ab=E.toFlatObject(E,{},null,function(t){return/^is[A-Z]/.test(t)});function Wi(e,t,r){if(!E.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=E.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,x){return!E.isUndefined(x[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?uf:r.maxDepth,u=a&&E.isSpecCompliantForm(t),d=[];if(!E.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(E.isDate(v))return v.toISOString();if(E.isBoolean(v))return v.toString();if(!u&&E.isBlob(v))throw new Y("Blob is not supported. Use a Buffer instead.");return E.isArrayBuffer(v)||E.isTypedArray(v)?u&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function m(v){if(v>c)throw new Y("Object is too deeply nested ("+v+" levels). Max depth: "+c,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function g(v,b){if(c===1/0)return JSON.stringify(v);const x=[];return JSON.stringify(v,function(C,D){if(!E.isObject(D))return D;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(D),m(b+x.length-1),D})}function _(v,b,x){let w=v;if(E.isReactNative(t)&&E.isReactNativeBlob(v))return t.append(mo(x,b,i),f(v)),!1;if(v&&!x&&typeof v=="object"){if(E.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=g(v,1);else if(E.isArray(v)&&ob(v)||(E.isFileList(v)||E.endsWith(b,"[]"))&&(w=E.toArray(v)))return b=df(b),w.forEach(function(D,j){!(E.isUndefined(D)||D===null)&&t.append(o===!0?mo([b],j,i):o===null?b:b+"[]",f(D))}),!1}return ua(v)?!0:(t.append(mo(x,b,i),f(v)),!1)}const h=Object.assign(ab,{defaultVisitor:_,convertValue:f,isVisitable:ua});function y(v,b,x=0){if(!E.isUndefined(v)){if(m(x),d.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));d.push(v),E.forEach(v,function(C,D){(!(E.isUndefined(C)||C===null)&&s.call(t,C,E.isString(D)?D.trim():D,b,h))===!0&&y(C,b?b.concat(D):[D],x+1)}),d.pop()}}if(!E.isObject(e))throw new TypeError("data must be an object");return y(e),t}function rc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function Ga(e,t){this._pairs=[],e&&Wi(e,this,t)}const ff=Ga.prototype;ff.append=function(t,r){this._pairs.push([t,r])};ff.toString=function(t){const r=t?function(n){return t.call(this,n,rc)}:rc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function lb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function hf(e,t,r){if(!t)return e;const n=E.isFunction(r)?{serialize:r}:r,s=E.getSafeProp(n,"encode")||lb,i=E.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=E.isURLSearchParams(t)?t.toString():new Ga(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class nc{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){E.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Ya={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},cb=typeof URLSearchParams<"u"?URLSearchParams:Ga,ub=typeof FormData<"u"?FormData:null,db=typeof Blob<"u"?Blob:null,fb={isBrowser:!0,classes:{URLSearchParams:cb,FormData:ub,Blob:db},protocols:["http","https","file","blob","url","data"]},Xa=typeof window<"u"&&typeof document<"u",da=typeof navigator=="object"&&navigator||void 0,hb=Xa&&(!da||["ReactNative","NativeScript","NS"].indexOf(da.product)<0),pb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gb=Xa&&window.location.href||"http://localhost",mb=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xa,hasStandardBrowserEnv:hb,hasStandardBrowserWebWorkerEnv:pb,navigator:da,origin:gb},Symbol.toStringTag,{value:"Module"})),it={...mb,...fb};function yb(e,t){return Wi(e,new it.classes.URLSearchParams,{visitor:function(r,n,s,i){return it.isNode&&E.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const sc=uf;function pf(e){if(e>sc)throw new Y("FormData field is too deeply nested ("+e+" levels). Max depth: "+sc,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function vb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)pf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function bb(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 gf(e){function t(r,n,s,i){pf(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&E.isArray(s)?s.length:o,c?(E.hasOwnProp(s,o)?s[o]=E.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!E.hasOwnProp(s,o)||!E.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&E.isArray(s[o])&&(s[o]=bb(s[o])),!a)}if(E.isFormData(e)&&E.isFunction(e.entries)){const r={};return E.forEachEntry(e,(n,s)=>{t(vb(n),s,r,0)}),r}return null}const ln=(e,t)=>e!=null&&E.hasOwnProp(e,t)?e[t]:void 0;function _b(e,t,r){if(E.isString(e))try{return(t||JSON.parse)(e),E.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const Ls={transitional:Ya,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=E.isObject(t);if(i&&E.isHTMLForm(t)&&(t=new FormData(t)),E.isFormData(t))return s?JSON.stringify(gf(t)):t;if(E.isArrayBuffer(t)||E.isBuffer(t)||E.isStream(t)||E.isFile(t)||E.isBlob(t)||E.isReadableStream(t))return t;if(E.isArrayBufferView(t))return t.buffer;if(E.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=ln(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return yb(t,c).toString();if((a=E.isFileList(t))||n.indexOf("multipart/form-data")>-1){const u=ln(this,"env"),d=u&&u.FormData;return Wi(a?{"files[]":t}:t,d&&new d,c)}}return i||s?(r.setContentType("application/json",!1),_b(t)):t}],transformResponse:[function(t){const r=ln(this,"transitional")||Ls.transitional,n=r&&r.forcedJSONParsing,s=ln(this,"responseType"),i=s==="json";if(E.isResponse(t)||E.isReadableStream(t))return t;if(t&&E.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,ln(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Y.from(c,Y.ERR_BAD_RESPONSE,this,null,ln(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:it.classes.FormData,Blob:it.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch","query"],e=>{Ls.headers[e]={}});function yo(e,t){const r=this||Ls,n=t||r,s=gt.from(n.headers);let i=n.data;return E.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function mf(e){return!!(e&&e.__CANCEL__)}let Fs=class extends Y{constructor(t,r,n){super(t??"canceled",Y.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function yf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Y("Request failed with status code "+r.status,r.status>=400&&r.status<500?Y.ERR_BAD_REQUEST:Y.ERR_BAD_RESPONSE,r.config,r.request,r))}function wb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function xb(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,m=0;for(;f!==s;)m+=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(m*1e3/g):void 0}}function Sb(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 Di=(e,t,r=3)=>{let n=0;const s=xb(50,250);return Sb(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)},ic=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},oc=e=>(...t)=>E.asap(()=>e(...t)),Cb=it.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,it.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,Ob=it.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];E.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),E.isString(n)&&a.push(`path=${n}`),E.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),E.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 Eb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Db(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Ib=/^https?:(?!\/\/)/i,Nb=/[\t\n\r]/g;function Tb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function jb(e){return Tb(e).replace(Nb,"")}function ac(e,t){if(typeof e=="string"&&Ib.test(jb(e)))throw new Y('Invalid URL: missing "//" after protocol',Y.ERR_INVALID_URL,t)}function vf(e,t,r,n){ac(t,n);let s=!Eb(t);return e&&(s||r===!1)?(ac(e,n),Db(e,t)):t}const lc=e=>e instanceof gt?{...e}:e;function rn(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,m,g){return E.isPlainObject(d)&&E.isPlainObject(f)?E.merge.call({caseless:g},d,f):E.isPlainObject(f)?E.merge({},f):E.isArray(f)?f.slice():f}function s(d,f,m,g){if(E.isUndefined(f)){if(!E.isUndefined(d))return n(void 0,d,m,g)}else return n(d,f,m,g)}function i(d,f){if(!E.isUndefined(f))return n(void 0,f)}function o(d,f){if(E.isUndefined(f)){if(!E.isUndefined(d))return n(void 0,d)}else return n(void 0,f)}function a(d){const f=E.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!E.isUndefined(f))if(E.isPlainObject(f)){if(E.hasOwnProp(f,d))return f[d]}else return;const m=E.hasOwnProp(e,"transitional")?e.transitional:void 0;if(E.isPlainObject(m)&&E.hasOwnProp(m,d))return m[d]}function c(d,f,m){if(E.hasOwnProp(t,m))return n(d,f);if(E.hasOwnProp(e,m))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,m)=>s(lc(d),lc(f),m,!0)};return E.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=E.hasOwnProp(u,f)?u[f]:s,g=E.hasOwnProp(e,f)?e[f]:void 0,_=E.hasOwnProp(t,f)?t[f]:void 0,h=m(g,_,f);E.isUndefined(h)&&m!==c||(r[f]=h)}),E.hasOwnProp(t,"validateStatus")&&E.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(E.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Rb=["content-type","content-length"];function kb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Rb.includes(n.toLowerCase())&&e.set(n,s)})}const Ab=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function bf(e){const t=rn({},e),r=m=>E.hasOwnProp(t,m)?t[m]: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=gt.from(a),t.url=hf(vf(u,f,d,t),r("params"),r("paramsSerializer")),c){const m=E.getSafeProp(c,"username")||"",g=E.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(m+":"+(g?Ab(g):"")))}if(E.isFormData(n)&&(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv||E.isReactNative(n)?a.setContentType(void 0):E.isFunction(n.getHeaders)&&kb(a,n.getHeaders(),r("formDataHeaderPolicy"))),it.hasStandardBrowserEnv&&(E.isFunction(s)&&(s=s(t)),s===!0||s==null&&Cb(t.url))){const g=i&&o&&Ob.read(o);g&&a.set(i,g)}return t}const Pb=typeof XMLHttpRequest<"u",Mb=Pb&&function(e){return new Promise(function(r,n){const s=bf(e);let i=s.data;const o=gt.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=s,d,f,m,g,_;function h(){g&&g(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const x=gt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};yf(function(j){r(j),h()},function(j){n(j),h()},C),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new Y("Request aborted",Y.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(w){const C=w&&w.message?w.message:"Network Error",D=new Y(C,Y.ERR_NETWORK,e,y);D.event=w||null,n(D),h(),y=null},y.ontimeout=function(){let w=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||Ya;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new Y(w,C.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&E.forEach(lf(o),function(w,C){y.setRequestHeader(C,w)}),E.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),u&&([m,_]=Di(u,!0),y.addEventListener("progress",m)),c&&y.upload&&([f,g]=Di(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(d=x=>{y&&(n(!x||x.type?new Fs(null,e,y):x),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const b=wb(s.url);if(b&&!it.protocols.includes(b)){n(new Y("Unsupported protocol "+b+":",Y.ERR_BAD_REQUEST,e));return}y.send(i||null)})},Lb=(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 Y?u:new Fs(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,s(new Y(`timeout of ${t}ms exceeded`,Y.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=()=>E.asap(o),a},Fb=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},$b=async function*(e,t){for await(const r of Bb(e))yield*Fb(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()}},cc=(e,t,r,n)=>{const s=$b(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 m=i+=f;r(m)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Ii=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Vb=(e,t,r)=>t+2<r&&Ii(e.charCodeAt(t+1))&&Ii(e.charCodeAt(t+2));function Ub(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),h=n.charCodeAt(g+2);Ii(_)&&Ii(h)&&(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 m=Math.floor(o/4)*3-(c||0);return m>0?m:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&Vb(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 Za="1.18.0",uc=64*1024,{isFunction:Ks}=E,zb=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),dc=e=>{if(!E.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},fc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},qb=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},Hb=e=>{const t=E.global!==void 0&&E.global!==null?E.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=E.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Ks(s):typeof fetch=="function",c=Ks(i),u=Ks(o);if(!a)return!1;const d=a&&Ks(r),f=a&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),m=c&&d&&fc(()=>{let v=!1;const b=new i(it.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),x=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!x}),g=u&&d&&fc(()=>E.isReadableStream(new o("").body)),_={stream:g&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!_[v]&&(_[v]=(b,x)=>{let w=b&&b[v];if(w)return w.call(b);throw new Y(`Response type '${v}' is not supported`,Y.ERR_NOT_SUPPORT,x)})});const h=async v=>{if(v==null)return 0;if(E.isBlob(v))return v.size;if(E.isSpecCompliantForm(v))return(await new i(it.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(E.isArrayBufferView(v)||E.isArrayBuffer(v))return v.byteLength;if(E.isURLSearchParams(v)&&(v=v+""),E.isString(v))return(await f(v)).byteLength},y=async(v,b)=>{const x=E.toFiniteNumber(v.getContentLength());return x??h(b)};return async v=>{let{url:b,method:x,data:w,signal:C,cancelToken:D,timeout:j,onDownloadProgress:k,onUploadProgress:L,responseType:I,headers:R,withCredentials:M="same-origin",fetchOptions:A,maxContentLength:B,maxBodyLength:F}=bf(v);const re=E.isNumber(B)&&B>-1,ce=E.isNumber(F)&&F>-1,W=J=>E.hasOwnProp(v,J)?v[J]:void 0;let U=s||fetch;I=I?(I+"").toLowerCase():"text";let X=Lb([C,D&&D.toAbortSignal()],j),$=null;const K=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let Z,pe=null;const Oe=()=>new Y("Request body larger than maxBodyLength limit",Y.ERR_BAD_REQUEST,v,$);try{let J;const _e=W("auth");if(_e){const te=E.getSafeProp(_e,"username")||"",Re=E.getSafeProp(_e,"password")||"";J={username:te,password:Re}}if(qb(b)){const te=new URL(b,it.origin);if(!J&&(te.username||te.password)){const Re=dc(te.username),Pe=dc(te.password);J={username:Re,password:Pe}}(te.username||te.password)&&(te.username="",te.password="",b=te.href)}if(J&&(R.delete("authorization"),R.set("Authorization","Basic "+btoa(zb((J.username||"")+":"+(J.password||""))))),re&&typeof b=="string"&&b.startsWith("data:")&&Ub(b)>B)throw new Y("maxContentLength size of "+B+" exceeded",Y.ERR_BAD_RESPONSE,v,$);if(ce&&x!=="get"&&x!=="head"){const te=await h(w);if(typeof te=="number"&&isFinite(te)&&(Z=te,te>F))throw Oe()}const se=ce&&(E.isReadableStream(w)||E.isStream(w)),ye=(te,Re,Pe)=>cc(te,uc,et=>{if(ce&&et>F)throw pe=Oe();Re&&Re(et)},Pe);if(m&&x!=="get"&&x!=="head"&&(L||se)){if(Z=Z??await y(R,w),Z!==0||se){let te=new i(b,{method:"POST",body:w,duplex:"half"}),Re;if(E.isFormData(w)&&(Re=te.headers.get("content-type"))&&R.setContentType(Re),te.body){const[Pe,et]=L&&ic(Z,Di(oc(L)))||[];w=ye(te.body,Pe,et)}}}else if(se&&!c&&d&&x!=="get"&&x!=="head")w=ye(w);else if(se&&c&&!m&&x!=="get"&&x!=="head")throw new Y("Stream request bodies are not supported by the current fetch implementation",Y.ERR_NOT_SUPPORT,v,$);E.isString(M)||(M=M?"include":"omit");const oe=c&&"credentials"in i.prototype;if(E.isFormData(w)){const te=R.getContentType();te&&/^multipart\/form-data/i.test(te)&&!/boundary=/i.test(te)&&R.delete("content-type")}R.set("User-Agent","axios/"+Za,!1);const ot={...A,signal:X,method:x.toUpperCase(),headers:lf(R.normalize()),body:w,duplex:"half",credentials:oe?M:void 0};$=c&&new i(b,ot);let Se=await(c?U($,A):U(b,ot));const Je=gt.from(Se.headers);if(re){const te=E.toFiniteNumber(Je.getContentLength());if(te!=null&&te>B)throw new Y("maxContentLength size of "+B+" exceeded",Y.ERR_BAD_RESPONSE,v,$)}const Ke=g&&(I==="stream"||I==="response");if(g&&Se.body&&(k||re||Ke&&K)){const te={};["status","statusText","headers"].forEach(kt=>{te[kt]=Se[kt]});const Re=E.toFiniteNumber(Je.getContentLength()),[Pe,et]=k&&ic(Re,Di(oc(k),!0))||[];let bt=0;const or=kt=>{if(re&&(bt=kt,bt>B))throw new Y("maxContentLength size of "+B+" exceeded",Y.ERR_BAD_RESPONSE,v,$);Pe&&Pe(kt)};Se=new o(cc(Se.body,uc,or,()=>{et&&et(),K&&K()}),te)}I=I||"text";let Be=await _[E.findKey(_,I)||"text"](Se,v);if(re&&!g&&!Ke){let te;if(Be!=null&&(typeof Be.byteLength=="number"?te=Be.byteLength:typeof Be.size=="number"?te=Be.size:typeof Be=="string"&&(te=typeof n=="function"?new n().encode(Be).byteLength:Be.length)),typeof te=="number"&&te>B)throw new Y("maxContentLength size of "+B+" exceeded",Y.ERR_BAD_RESPONSE,v,$)}return!Ke&&K&&K(),await new Promise((te,Re)=>{yf(te,Re,{data:Be,headers:gt.from(Se.headers),status:Se.status,statusText:Se.statusText,config:v,request:$})})}catch(J){if(K&&K(),X&&X.aborted&&X.reason instanceof Y){const _e=X.reason;throw _e.config=v,$&&(_e.request=$),J!==_e&&(_e.cause=J),_e}throw pe?($&&!pe.request&&(pe.request=$),pe):J instanceof Y?($&&!J.request&&(J.request=$),J):J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new Y("Network Error",Y.ERR_NETWORK,v,$,J&&J.response),{cause:J.cause||J}):Y.from(J,J&&J.code,v,$,J&&J.response)}}},Wb=new Map,_f=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=Wb;for(;a--;)c=i[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:Hb(t)),d=u;return u};_f();const Ja={http:ib,xhr:Mb,fetch:{get:_f}};E.forEach(Ja,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const hc=e=>`- ${e}`,Kb=e=>E.isFunction(e)||e===null||e===!1;function Qb(e,t){e=E.isArray(e)?e:[e];const{length:r}=e;let n,s;const i={};for(let o=0;o<r;o++){n=e[o];let a;if(s=n,!Kb(n)&&(s=Ja[(a=String(n)).toLowerCase()],s===void 0))throw new Y(`Unknown adapter '${a}'`);if(s&&(E.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(hc).join(`
452
- `):" "+hc(o[0]):"as no adapter specified";throw new Y("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const wf={getAdapter:Qb,adapters:Ja};function vo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fs(null,e)}function pc(e){return vo(e),e.headers=mt.from(e.headers),e.data=yo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),wf.getAdapter(e.adapter||Ls.adapter,e)(e).then(function(n){vo(e),e.response=n;try{n.data=yo.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=mt.from(n.headers),n},function(n){if(!mf(n)&&(vo(e),n&&n.response)){e.response=n.response;try{n.response.data=yo.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=mt.from(n.response.headers)}return Promise.reject(n)})}const Ki={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ki[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const gc={};Ki.transitional=function(t,r,n){function s(i,o){return"[Axios v"+Za+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new Y(s(o," has been removed"+(r?" in "+r:"")),Y.ERR_DEPRECATED);return r&&!gc[o]&&(gc[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}};Ki.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Gb(e,t,r){if(typeof e!="object")throw new Y("options must be an object",Y.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 Y("option "+i+" must be "+c,Y.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Y("Unknown option "+i,Y.ERR_BAD_OPTION)}}const li={assertOptions:Gb,validators:Ki},ct=li.validators;let Jr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new nc,response:new nc}}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(`
452
+ `):" "+hc(o[0]):"as no adapter specified";throw new Y("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const wf={getAdapter:Qb,adapters:Ja};function vo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fs(null,e)}function pc(e){return vo(e),e.headers=gt.from(e.headers),e.data=yo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),wf.getAdapter(e.adapter||Ls.adapter,e)(e).then(function(n){vo(e),e.response=n;try{n.data=yo.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=gt.from(n.headers),n},function(n){if(!mf(n)&&(vo(e),n&&n.response)){e.response=n.response;try{n.response.data=yo.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=gt.from(n.response.headers)}return Promise.reject(n)})}const Ki={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ki[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const gc={};Ki.transitional=function(t,r,n){function s(i,o){return"[Axios v"+Za+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,a)=>{if(t===!1)throw new Y(s(o," has been removed"+(r?" in "+r:"")),Y.ERR_DEPRECATED);return r&&!gc[o]&&(gc[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}};Ki.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Gb(e,t,r){if(typeof e!="object")throw new Y("options must be an object",Y.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 Y("option "+i+" must be "+c,Y.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Y("Unknown option "+i,Y.ERR_BAD_OPTION)}}const li={assertOptions:Gb,validators:Ki},lt=li.validators;let Jr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new nc,response:new nc}}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=rn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&li.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}:li.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),li.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=mt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||Ya;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,m;if(!c){const _=[pc.bind(this),void 0];for(_.unshift(...a),_.push(...u),m=_.length,d=Promise.resolve(r);f<m;)d=d.then(_[f++],_[f++]);return d}m=a.length;let g=r;for(;f<m;){const _=a[f++],h=a[f++];try{g=_(g)}catch(y){h.call(this,y);break}}try{d=pc.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,m=u.length;f<m;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=rn(this.defaults,t);const r=vf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return hf(r,t.params,t.paramsSerializer)}};D.forEach(["delete","get","head","options"],function(t){Jr.prototype[t]=function(r,n){return this.request(rn(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(rn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Jr.prototype[t]=r(),t!=="query"&&(Jr.prototype[t+"Form"]=r(!0))});let Yb=class xf{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 Fs(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 xf(function(s){t=s}),cancel:t}}};function Xb(e){return function(r){return e.apply(null,r)}}function Zb(e){return D.isObject(e)&&e.isAxiosError===!0}const fa={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(fa).forEach(([e,t])=>{fa[t]=e});function Sf(e){const t=new Jr(e),r=Zd(Jr.prototype.request,t);return D.extend(r,Jr.prototype,t,{allOwnKeys:!0}),D.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Sf(rn(e,s))},r}const Ue=Sf(Ls);Ue.Axios=Jr;Ue.CanceledError=Fs;Ue.CancelToken=Yb;Ue.isCancel=mf;Ue.VERSION=Za;Ue.toFormData=Wi;Ue.AxiosError=Y;Ue.Cancel=Ue.CanceledError;Ue.all=function(t){return Promise.all(t)};Ue.spread=Xb;Ue.isAxiosError=Zb;Ue.mergeConfig=rn;Ue.AxiosHeaders=mt;Ue.formToJSON=e=>gf(D.isHTMLForm(e)?new FormData(e):e);Ue.getAdapter=wf.getAdapter;Ue.HttpStatusCode=fa;Ue.default=Ue;const{Axios:zR,AxiosError:qR,CanceledError:HR,isCancel:WR,CancelToken:KR,VERSION:QR,all:GR,Cancel:YR,isAxiosError:XR,spread:ZR,toFormData:JR,AxiosHeaders:ek,HttpStatusCode:tk,formToJSON:rk,getAdapter:nk,mergeConfig:sk,create:ik}=Ue;let ha="";function Cf(e){ha=e}const Fe=Ue.create({timeout:3e4});Fe.interceptors.request.use(async e=>{var s,i;const{useEditorStore:t}=await Promise.resolve().then(()=>Qd),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}`),ha&&(e.baseURL=ha),e});const Ef=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Jb(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:Ef,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 e_(e){var r,n,s;return e.length?((s=(n=(r=(await Fe.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Ef,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 Of(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=>Of(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 Df(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=Of(r);return{content:r,rootNode:n}}async function t_(e,t,r,n){await Fe.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})}async function r_(e,t=""){await Fe.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function n_(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 s_(e){await Fe.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function i_(e,t){await Fe.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function o_(e,t){await Fe.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const a_="_container_1cpb1_1",l_="_header_1cpb1_13",c_="_title_1cpb1_22",u_="_closeBtn_1cpb1_29",d_="_body_1cpb1_45",f_="_label_1cpb1_54",h_="_searchSection_1cpb1_62",p_="_searchRow_1cpb1_68",g_="_searchInput_1cpb1_74",m_="_searchSpinner_1cpb1_89",y_="_resultsList_1cpb1_105",v_="_resultItem_1cpb1_118",b_="_userInfo_1cpb1_133",__="_userName_1cpb1_141",w_="_userEmail_1cpb1_150",x_="_noResults_1cpb1_158",S_="_collabSection_1cpb1_165",C_="_sectionTitle_1cpb1_170",E_="_badge_1cpb1_180",O_="_emptyCollab_1cpb1_194",D_="_collabList_1cpb1_205",I_="_collabItem_1cpb1_214",N_="_userAvatar_1cpb1_228",T_="_error_1cpb1_242",j_="_success_1cpb1_248",R_="_footer_1cpb1_254",xe={container:a_,header:l_,title:c_,closeBtn:u_,body:d_,label:f_,searchSection:h_,searchRow:p_,searchInput:g_,searchSpinner:m_,resultsList:y_,resultItem:v_,userInfo:b_,userName:__,userEmail:w_,noResults:x_,collabSection:S_,sectionTitle:C_,badge:E_,emptyCollab:O_,collabList:D_,collabItem:I_,userAvatar:N_,error:T_,success:j_,footer:R_},k_=({contentId:e,onClose:t})=>{const[r,n]=p.useState(""),[s,i]=p.useState([]),[o,a]=p.useState(!1),[c,u]=p.useState([]),[d,f]=p.useState(!1),[m,g]=p.useState(""),[_,h]=p.useState(!1),y=p.useRef(null);p.useEffect(()=>{let S=!1;return(async()=>{try{const O=await n_(e),T=(O==null?void 0:O.collaborators)??[];if(!T.length)return;const R=await e_(T);if(S)return;const M=T.map(j=>R.find(k=>k.identifier===j)??{identifier:j,firstName:j});u(M)}catch{}})(),()=>{S=!0}},[e]),p.useEffect(()=>{y.current&&clearTimeout(y.current);const S=r.trim();if(S.length<2){i([]);return}return y.current=setTimeout(async()=>{a(!0);try{const O=await Jb(S),T=new Set(c.map(R=>R.identifier));i(O.filter(R=>!T.has(R.identifier)))}catch{i([])}finally{a(!1)}},300),()=>{y.current&&clearTimeout(y.current)}},[r,c]);const v=p.useCallback(S=>{u(O=>O.find(T=>T.identifier===S.identifier)?O:[...O,S]),i(O=>O.filter(T=>T.identifier!==S.identifier)),h(!1)},[]),b=p.useCallback(S=>{u(O=>O.filter(T=>T.identifier!==S)),h(!1)},[]),x=p.useCallback(async()=>{f(!0),g(""),h(!1);try{await o_(e,c.map(S=>S.identifier)),h(!0)}catch{g("Failed to save collaborators. Please try again.")}finally{f(!1)}},[e,c]),w=S=>`${S.firstName}${S.lastName?` ${S.lastName}`:""}`;return l.jsxs("div",{className:xe.container,children:[l.jsxs("div",{className:xe.header,children:[l.jsx("h2",{className:xe.title,children:"Manage Collaborators"}),l.jsx("button",{className:xe.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:xe.body,children:[l.jsxs("div",{className:xe.searchSection,children:[l.jsx("label",{className:xe.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:xe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:xe.searchInput,placeholder:"Search by name or email...",value:r,onChange:S=>n(S.target.value)}),o&&l.jsx("span",{className:xe.searchSpinner,"aria-label":"Searching..."})]}),s.length>0&&l.jsx("ul",{className:xe.resultsList,role:"listbox","aria-label":"Search results",children:s.map(S=>l.jsxs("li",{className:xe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:w(S)}),S.email&&l.jsx("span",{className:xe.userEmail,children:S.email})]}),l.jsx(Oe,{variant:"primary",size:"sm",onClick:()=>v(S),children:"Add"})]},S.identifier))}),r.trim().length>=2&&!o&&s.length===0&&l.jsx("p",{className:xe.noResults,children:"No users found."})]}),l.jsxs("div",{className:xe.collabSection,children:[l.jsxs("h3",{className:xe.sectionTitle,children:["Current Collaborators",c.length>0&&l.jsx("span",{className:xe.badge,children:c.length})]}),c.length===0?l.jsx("p",{className:xe.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:xe.collabList,children:c.map(S=>l.jsxs("li",{className:xe.collabItem,children:[l.jsx("div",{className:xe.userAvatar,"aria-hidden":"true",children:w(S).charAt(0).toUpperCase()}),l.jsxs("div",{className:xe.userInfo,children:[l.jsx("span",{className:xe.userName,children:w(S)}),S.email&&l.jsx("span",{className:xe.userEmail,children:S.email})]}),l.jsx(Oe,{variant:"danger",size:"sm",onClick:()=>b(S.identifier),children:"Remove"})]},S.identifier))})]}),m&&l.jsx("p",{className:xe.error,role:"alert",children:m}),_&&l.jsx("p",{className:xe.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:xe.footer,children:[l.jsx(Oe,{variant:"ghost",onClick:t,disabled:d,children:"Cancel"}),l.jsx(Oe,{variant:"primary",isLoading:d,onClick:x,children:"Save"})]})]})};async function A_(e){return(await Fe.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function P_(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 M_(e){var r;return((r=(await Fe.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}const L_="_topbar_zj8wk_1",F_="_left_zj8wk_15",$_="_right_zj8wk_23",B_="_backBtn_zj8wk_30",V_="_title_zj8wk_49",U_="_statusChip_zj8wk_61",z_="_savedIndicator_zj8wk_73",q_="_unsaved_zj8wk_83",H_="_iconBtn_zj8wk_88",W_="_iconBtnLabel_zj8wk_115",K_="_qrDropdown_zj8wk_119",Q_="_qrMenu_zj8wk_123",G_="_reviewBtns_zj8wk_158",Y_="_sourcingBtns_zj8wk_167",X_="_modalOverlay_zj8wk_176",Z_="_sbOverlay_zj8wk_186",J_="_sbModal_zj8wk_196",ew="_sbModalHeader_zj8wk_207",tw="_sbModalTitle_zj8wk_215",rw="_sbModalClose_zj8wk_222",nw="_sbModalBody_zj8wk_235",sw="_sbLabel_zj8wk_242",iw="_sbTextarea_zj8wk_249",ow="_sbError_zj8wk_266",aw="_sbModalFooter_zj8wk_273",oe={topbar:L_,left:F_,right:$_,backBtn:B_,title:V_,statusChip:U_,savedIndicator:z_,unsaved:q_,iconBtn:H_,iconBtnLabel:W_,qrDropdown:K_,qrMenu:Q_,reviewBtns:G_,sourcingBtns:Y_,modalOverlay:X_,sbOverlay:Z_,sbModal:J_,sbModalHeader:ew,sbModalTitle:tw,sbModalClose:rw,sbModalBody:nw,sbLabel:sw,sbTextarea:iw,sbError:ow,sbModalFooter:aw};function lw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function cw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const mc=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.useState(""),u=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:oe.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${u}-title`,children:l.jsxs("div",{className:oe.sbModal,children:[l.jsxs("div",{className:oe.sbModalHeader,children:[l.jsx("span",{id:`${u}-title`,className:oe.sbModalTitle,children:e}),l.jsx("button",{className:oe.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:oe.sbModalBody,children:[l.jsxs("label",{className:oe.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:oe.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:oe.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:oe.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})]})]})})},uw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(!1);return l.jsx("div",{className:oe.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:oe.sbModal,children:[l.jsxs("div",{className:oe.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:oe.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:oe.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:oe.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:oe.sbModalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Oe,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},dw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:oe.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:oe.sbModal,children:[l.jsxs("div",{className:oe.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:oe.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:oe.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:oe.sbModalBody,children:[l.jsxs("label",{className:oe.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:oe.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:oe.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:oe.sbModalFooter,children:[l.jsx(Oe,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Oe,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},fw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,onToolbarEvent:s})=>{var J,be;const o=ke(re=>re.treeData)[0],a=(o==null?void 0:o.name)??"Untitled",c=cw(((J=o==null?void 0:o.metadata)==null?void 0:J.status)??(o==null?void 0:o.status)),u=ve(re=>{var ye,ie,ot,De;return((ie=(ye=re.editorConfig)==null?void 0:ye.context)==null?void 0:ie.contentId)??((De=(ot=re.editorConfig)==null?void 0:ot.context)==null?void 0:De.identifier)??""}),{activeModal:d,modalData:f,closeModal:m,openModal:g}=My(),_=ve(re=>re.buttonLoaders),[h,y]=p.useState(!1),[v,b]=p.useState(!1),[x,w]=p.useState(!1),[S,O]=p.useState(!1),T=p.useRef(null),[R,M]=p.useState(!1);p.useEffect(()=>{if(!S)return;const re=ye=>{var ie;(ie=T.current)!=null&&ie.contains(ye.target)||O(!1)};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[S]);const[j,k]=p.useState(!1),[U,A]=p.useState(!1),{updateNode:q}=ke(),L=(be=o==null?void 0:o.metadata)==null?void 0:be.qrCodeProcessId,se=p.useCallback(async re=>{if(u){M(!1),k(!0);try{const{processId:ye,reservedDialcodes:ie}=await P_(u,re);ye&&o&&q(o.id,{qrCodeProcessId:ye,reservedDialcodes:ie}),Re.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Re.error("Failed to generate QR Codes. Please try again.")}finally{k(!1)}}},[u,o,q]),ce=p.useCallback(async()=>{const re=(o==null?void 0:o.metadata)??{};if(!re.medium||!re.gradeLevel||!re.subject){Re.error("Please ensure Medium, Class and Subject are set before downloading QR Codes.");return}if(!L){Re.error("No QR codes generated yet. Generate QR Codes first.");return}A(!0);try{const ye=await M_(L);if(ye.status==="in-process"){Re("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const ie=ye.url;if(!ie){Re.error("QR Codes not ready yet. Please wait and try again.");return}const ot=await fetch(ie).then(Ae=>Ae.blob()),De=await new Promise(Ae=>{const Dt=new FileReader;Dt.onloadend=()=>Ae(Dt.result),Dt.readAsDataURL(ot)}),et=Ae=>Array.isArray(Ae)?Ae.join("_"):typeof Ae=="string"?Ae:"",Qe=et(re.medium),$e=et(re.gradeLevel),te=et(re.subject),ze=new Date().toISOString().replace(/[:.]/g,"-"),at=`${u}_${Qe}_${$e}_${te}_${ze}.zip`,qe=document.createElement("a");qe.href=De,qe.download=at,qe.style.display="none",document.body.appendChild(qe),qe.click(),document.body.removeChild(qe),Re.success("QR codes downloaded.")}catch{Re.error("Failed to download QR Codes.")}finally{A(!1)}},[L,o,u]),W=e==="edit",B=e==="review",X=e==="sourcingreview",F=e==="read",K=p.useCallback((re,ye)=>{s({action:re,data:ye})},[s]),Z=p.useCallback(()=>{m(),K("publish")},[m,K]),pe=p.useCallback((re,ye)=>{const ie=f==null?void 0:f.action;m(),ie==="approve"?K("sourcingApprove",{comment:re,score:ye}):K("reject",{comment:re})},[m,K,f]),Ce=p.useCallback(re=>{y(!1),K("sendBackForCorrections",{comment:re})},[K]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:oe.topbar,role:"banner",children:[l.jsxs("div",{className:oe.left,children:[l.jsx("button",{className:oe.backBtn,onClick:()=>K("back"),"aria-label":"Go back",type:"button",children:l.jsx(ry,{size:18})}),l.jsx("h1",{className:oe.title,title:a,children:a}),l.jsx("span",{className:`sbx-chip ${oe.statusChip}`,"aria-label":`Status: ${c}`,children:c})]}),l.jsxs("div",{className:oe.right,children:[t?l.jsx("span",{className:oe.savedIndicator,"aria-live":"polite",children:"Saving…"}):r?l.jsx("span",{className:`${oe.savedIndicator} ${oe.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:oe.savedIndicator,"aria-live":"polite",children:[l.jsx(Un,{size:14,"aria-hidden":"true"}),"Saved ",lw(n)]}):null,!F&&!B&&!X&&c!=="Review"&&l.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>K("saveCollection"),children:"Save as Draft"}),W&&l.jsxs(l.Fragment,{children:[l.jsxs(Oe,{variant:"primary",size:"sm",onClick:()=>w(!0),disabled:_.saveCollection,isLoading:_.saveCollection,children:[l.jsx(vy,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:oe.iconBtn,onClick:()=>g("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(wy,{size:16,"aria-hidden":"true"})}),l.jsxs("div",{className:oe.qrDropdown,ref:T,children:[l.jsxs("button",{className:oe.iconBtn,onClick:()=>O(re=>!re),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":S,children:[l.jsx(zl,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:oe.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),S&&l.jsxs("div",{className:oe.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{O(!1),M(!0)},disabled:j,children:[l.jsx(zl,{size:14}),j?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{O(!1),ce()},disabled:U||!L,children:[l.jsx(ay,{size:14}),U?"Downloading…":"Download QR Codes"]})]})]})]}),B&&l.jsxs("div",{className:oe.reviewBtns,children:[l.jsxs(Oe,{variant:"primary",size:"sm",onClick:()=>g("publishChecklist"),disabled:_.publishCollection,isLoading:_.publishCollection,children:[l.jsx(Vd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Oe,{variant:"danger",size:"sm",onClick:()=>b(!0),disabled:_.rejectCollection,isLoading:_.rejectCollection,children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:()=>y(!0),children:[l.jsx(my,{size:14,"aria-hidden":"true"})," Send Back"]})]}),X&&l.jsxs("div",{className:oe.sourcingBtns,children:[l.jsxs(Oe,{variant:"primary",size:"sm",onClick:()=>g("qualityParams",{action:"approve"}),children:[l.jsx(by,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Oe,{variant:"danger",size:"sm",onClick:()=>g("qualityParams",{action:"reject"}),children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),d==="publishChecklist"&&l.jsx(Jy,{contentId:u,onConfirm:Z,onCancel:m}),d==="qualityParams"&&l.jsx(ev,{contentId:u,action:(f==null?void 0:f.action)??"reject",onConfirm:pe,onCancel:m}),d==="manageCollaborators"&&l.jsx("div",{className:oe.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(k_,{contentId:u,onClose:m})}),x&&l.jsx(uw,{onConfirm:()=>{w(!1),K("sendForReview")},onCancel:()=>w(!1)}),v&&l.jsx(mc,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",submitVariant:"danger",onConfirm:re=>{b(!1),K("reject",{comment:re})},onCancel:()=>b(!1)}),h&&l.jsx(mc,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",onConfirm:Ce,onCancel:()=>y(!1)}),R&&l.jsx(dw,{onConfirm:se,onCancel:()=>M(!1)})]})},hw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Rr.createPortal(l.jsx("div",{className:Ee.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Ee.modal,children:[l.jsxs("div",{className:Ee.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Ee.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Ee.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:Ee.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 pw=Wa();const If=p.createContext(null);function Ot(){const e=p.useContext(If);if(e===null)throw new Error("No Tree Api Provided");return e}const Nf=p.createContext(null);function gw(){const e=p.useContext(Nf);if(e===null)throw new Error("Provide a NodesContext");return e}const Tf=p.createContext(null);function mw(){const e=p.useContext(Tf);if(e===null)throw new Error("Provide a DnDContext");return e}const jf=p.createContext(0);function Rf(){p.useContext(jf)}function ci(e,t,r){return Math.max(Math.min(e,r),t)}function kf(e){return e&&e.isLeaf}function Af(e){return e&&e.isInternal&&!e.isOpen}function Pf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Mf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Lf=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function el(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=el(r,t);if(n)return n}return null}function Ni(e,t){if(t(e),e.children)for(let r of e.children)Ni(r,t)}function Ff(e){const t=Bf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=yw(t,n);break}r==null||r.focus()}function $f(e){const t=Bf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=vw(t,n);break}r==null||r.focus()}function yw(e,t){return t+1<e.length?e[t+1]:e[0]}function vw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Bf(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 is(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function vn(e){return typeof e=="string"?e:e.id}function bw(e,...t){if(e)return e(...t)}function Vf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function Uf(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 zf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const _w=Object.freeze(Object.defineProperty({__proto__:null,access:is,bound:ci,dfs:el,focusNextElement:Ff,focusPrevElement:$f,getInsertIndex:Uf,getInsertParentId:zf,identify:vn,indexOf:Lf,isClosed:Af,isDescendant:Mf,isItem:kf,isOpenWithEmptyChildren:Pf,safeRun:bw,waitFor:Vf,walk:Ni},Symbol.toStringTag,{value:"Module"})),ww={display:"flex",alignItems:"center",zIndex:1},xw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Sw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Cw=p.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},ww),s),children:[l.jsx("div",{style:Object.assign({},Sw)}),l.jsx("div",{style:Object.assign({},xw)})]})});function Ew({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 Ow(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(Iw,Object.assign({},e)):l.jsx(Dw,Object.assign({},e))]})}function Dw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function Iw({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const _s="__REACT_ARBORIST_INTERNAL_ROOT__";function yc(e){var t;function r(i,o,a){const c=e.accessId(i),u=new ws({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 ws({tree:e,id:_s,data:{id:_s},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class ws{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===_s}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new ws(Object.assign({},this))}edit(){return this.tree.edit(this)}}function bo(e){return{type:"EDIT",id:e}}function Nw(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function cn(e){return{type:"FOCUS",id:e}}function Tw(){return{type:"TREE_BLUR"}}function jw(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 vc(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 Rw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:vc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:vc(e.unfiltered,t)}):e}const Ln=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}}},vr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:vn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(vn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(vn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:vn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:vn(e)})};function kw(e=Ln().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 Fn={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 Aw(e=Ln().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 Ln().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Pw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Mw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},Lw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function qf({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(Fw,{isDragging:s,children:[l.jsx($w,{offset:e,children:l.jsx(Vw,{id:r,dragIds:n})}),l.jsx(Bw,{mouse:t,count:n.length})]})}const Fw=p.memo(function(t){return t.isDragging?l.jsx("div",{style:Pw,children:t.children}):null});function $w(e){return l.jsx("div",{className:"row preview",style:Mw(e.offset),children:e.children})}function Bw(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:Lw(r),children:t}):null}const Vw=p.memo(function(t){const r=Ot(),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 bc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ma(e,t){return ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ma(e,t)}function Uw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ma(e,t)}var _c=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function zw(e,t){return!!(e===t||_c(e)&&_c(t))}function qw(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!zw(e[r],t[r]))return!1;return!0}function _o(e,t){t===void 0&&(t=qw);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 Hw=typeof performance=="object"&&typeof performance.now=="function",wc=Hw?function(){return performance.now()}:function(){return Date.now()};function xc(e){cancelAnimationFrame(e.id)}function Ww(e,t){var r=wc();function n(){wc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var wo=-1;function Sc(e){if(e===void 0&&(e=!1),wo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),wo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return wo}var un=null;function Cc(e){if(e===void 0&&(e=!1),un===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?un="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?un="negative":un="positive-ascending"),document.body.removeChild(t),un}return un}process.env.NODE_ENV;var Kw=150,Qw=function(t,r){return t},ui=null,di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ui=new WeakSet,di=new WeakSet);function Hf(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){Uw(m,f);function m(_){var h;return h=f.call(this,_)||this,h._instanceProps=c(h.props,bc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:bc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=_o(function(y,v,b,x){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:x})}),h._callOnScroll=void 0,h._callOnScroll=_o(function(y,v,b){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:b})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,b=v.direction,x=v.itemSize,w=v.layout,S=h._getItemStyleCache(u&&x,u&&w,u&&b),O;if(S.hasOwnProperty(y))O=S[y];else{var T=r(h.props,y,h._instanceProps),R=s(h.props,y,h._instanceProps),M=b==="horizontal"||w==="horizontal",j=b==="rtl",k=M?T:0;S[y]=O={position:"absolute",left:j?void 0:k,right:j?k:void 0,top:M?0:T,height:M?"100%":R,width:M?R:"100%"}}return O},h._getItemStyleCache=void 0,h._getItemStyleCache=_o(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,x=v.scrollLeft,w=v.scrollWidth;h.setState(function(S){if(S.scrollOffset===x)return null;var O=h.props.direction,T=x;if(O==="rtl")switch(Cc()){case"negative":T=-x;break;case"positive-descending":T=w-b-x;break}return T=Math.max(0,Math.min(T,w-b)),{isScrolling:!0,scrollDirection:S.scrollOffset<T?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,x=v.scrollHeight,w=v.scrollTop;h.setState(function(S){if(S.scrollOffset===w)return null;var O=Math.max(0,Math.min(w,x-b));return{isScrolling:!0,scrollDirection:S.scrollOffset<O?"forward":"backward",scrollOffset:O,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&xc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=Ww(h._resetIsScrolling,Kw)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}m.getDerivedStateFromProps=function(h,y){return Gw(h,y),d(h),null};var g=m.prototype;return g.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,x=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,b-1));var S=0;if(this._outerRef){var O=this._outerRef;x==="vertical"?S=O.scrollWidth>O.clientWidth?Sc():0:S=O.scrollHeight>O.clientHeight?Sc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,S))},g.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var x=this._outerRef;y==="horizontal"||b==="horizontal"?x.scrollLeft=v:x.scrollTop=v}this._callPropsCallbacks()},g.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,x=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var S=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Cc()){case"negative":S.scrollLeft=-x;break;case"positive-ascending":S.scrollLeft=x;break;default:var O=S.clientWidth,T=S.scrollWidth;S.scrollLeft=T-O-x;break}else S.scrollLeft=x;else S.scrollTop=x}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&xc(this._resetIsScrollingTimeoutId)},g.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,x=h.height,w=h.innerRef,S=h.innerElementType,O=h.innerTagName,T=h.itemCount,R=h.itemData,M=h.itemKey,j=M===void 0?Qw:M,k=h.layout,U=h.outerElementType,A=h.outerTagName,q=h.style,L=h.useIsScrolling,se=h.width,ce=this.state.isScrolling,W=b==="horizontal"||k==="horizontal",B=W?this._onScrollHorizontal:this._onScrollVertical,X=this._getRangeToRender(),F=X[0],K=X[1],Z=[];if(T>0)for(var pe=F;pe<=K;pe++)Z.push(p.createElement(y,{data:R,key:j(pe,R),index:pe,isScrolling:L?ce:void 0,style:this._getItemStyle(pe)}));var Ce=n(this.props,this._instanceProps);return p.createElement(U||A||"div",{className:v,onScroll:B,ref:this._outerRefSetter,style:ga({position:"relative",height:x,width:se,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},q)},p.createElement(S||O||"div",{children:Z,ref:w,style:{height:W?"100%":Ce,pointerEvents:ce?"none":void 0,width:W?Ce:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],b=y[1],x=y[2],w=y[3];this._callOnItemsRendered(v,b,x,w)}}if(typeof this.props.onScroll=="function"){var S=this.state,O=S.scrollDirection,T=S.scrollOffset,R=S.scrollUpdateWasRequested;this._callOnScroll(O,T,R)}},g._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,x=b.isScrolling,w=b.scrollDirection,S=b.scrollOffset;if(y===0)return[0,0,0,0];var O=o(this.props,S,this._instanceProps),T=a(this.props,O,S,this._instanceProps),R=!x||w==="backward"?Math.max(1,v):1,M=!x||w==="forward"?Math.max(1,v):1;return[Math.max(0,O-R),Math.max(0,Math.min(y-1,T+M)),O,T]},m}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Gw=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":ui&&!ui.has(d)&&(ui.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.'))}},Yw=50,_n=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]},Xw=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Wf(t,r,i,0,n):Zw(t,r,Math.max(0,i),n)},Wf=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=_n(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},Zw=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&_n(t,n,r).offset<s;)n+=o,o*=2;return Wf(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Ec=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},Jw=Hf({getItemOffset:function(t,r,n){return _n(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Ec,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",m=f?d:c,g=_n(t,r,i),_=Ec(t,i),h=Math.max(0,Math.min(_-m,g.offset)),y=Math.max(0,g.offset-m+g.size+o);switch(n==="smart"&&(s>=y-m&&s<=h+m?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return Xw(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,m=_n(t,r,s),g=n+f,_=m.offset+m.size,h=r;h<a-1&&_<g;)h++,_+=_n(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||Yw,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.'))}}),ex=Hf({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,m=t.width,g=a==="horizontal"||f==="horizontal",_=g?m:c,h=Math.max(0,u*d-_),y=Math.min(h,r*d),v=Math.max(0,r*d-_+d+o);switch(n==="smart"&&(s>=v-_&&s<=y+_?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var b=Math.round(v+(y-v)/2);return b<Math.ceil(_/2)?0:b>h+Math.floor(_/2)?h:b}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,m=d?u:i,g=Math.ceil((m+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 tx(){var e,t;const r=Ot(),s=mw().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 rx=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 nx=p.forwardRef(function(t,r){const{children:n}=t,s=rx(t,["children"]),i=Ot();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(sx,{}),n]}))}),sx=()=>{const e=Ot();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(tx,{})})};var ix=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 ox=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=ix(t,["style"]);const u=Ot(),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 Kf=p.createContext({dragDropManager:void 0}),Vt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Vt||(Vt={}));function ae(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 tl="dnd-core/INIT_COORDS",Qi="dnd-core/BEGIN_DRAG",rl="dnd-core/PUBLISH_DRAG_SOURCE",Gi="dnd-core/HOVER",Yi="dnd-core/DROP",Xi="dnd-core/END_DRAG";function Oc(e,t){return{type:tl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function fi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fi=function(r){return typeof r}:fi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fi(e)}function ax(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function lx(e,t){return e.filter(function(r){return r!==t})}function Qf(e){return fi(e)==="object"}function cx(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 ux(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var dx={type:tl,payload:{clientOffset:null,sourceClientOffset:null}};function fx(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(Oc(o)),hx(r,c,u);var d=mx(r,c);if(d===null){e.dispatch(dx);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");px(a),f=a(d)}e.dispatch(Oc(o,f));var m=u.getSource(d),g=m.beginDrag(c,d);if(g!=null){gx(g),u.pinSource(d);var _=u.getSourceType(d);return{type:Qi,payload:{itemType:_,item:g,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function hx(e,t,r){ae(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){ae(r.getSource(n),"Expected sourceIds to be registered.")})}function px(e){ae(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function gx(e){ae(Qf(e),"Item must be an object.")}function mx(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 yx(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:rl}}}function ya(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function vx(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;bx(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();_x(i,o,a);var c=o.getItemType();return wx(i,a,c),xx(i,o,a),{type:Gi,payload:{targetIds:i,clientOffset:s||null}}}}function bx(e){ae(Array.isArray(e),"Expected targetIds to be an array.")}function _x(e,t,r){ae(t.isDragging(),"Cannot call hover while not dragging."),ae(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];ae(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);ae(i,"Expected targetIds to be registered.")}}function wx(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);ya(i,r)||e.splice(n,1)}}function xx(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Dc(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 Ic(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dc(Object(r),!0).forEach(function(n){Sx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Cx(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Ex(n);var i=Ix(n);i.forEach(function(o,a){var c=Ox(o,a,s,n),u={type:Yi,payload:{dropResult:Ic(Ic({},r),c)}};e.dispatch(u)})}}function Ex(e){ae(e.isDragging(),"Cannot call drop while not dragging."),ae(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Ox(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Dx(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Dx(e){ae(typeof e>"u"||Qf(e),"Drop result must either be an object or undefined.")}function Ix(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Nx(e){return function(){var r=e.getMonitor(),n=e.getRegistry();Tx(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Xi}}}function Tx(e){ae(e.isDragging(),"Cannot call endDrag while not dragging.")}function jx(e){return{beginDrag:fx(e),publishDragSource:yx(e),hover:vx(e),drop:Cx(e),endDrag:Nx(e)}}function Rx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kx(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 Ax(e,t,r){return t&&kx(e.prototype,t),e}function Xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Px=function(){function e(t,r){var n=this;Rx(this,e),Xn(this,"store",void 0),Xn(this,"monitor",void 0),Xn(this,"backend",void 0),Xn(this,"isSetUp",!1),Xn(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 Ax(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=jx(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function Mt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Nc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Tc=function(){return Math.random().toString(36).substring(7).split("").join(".")},jc={INIT:"@@redux/INIT"+Tc(),REPLACE:"@@redux/REPLACE"+Tc()};function Mx(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 Lx(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(Bx(e))return"date";if($x(e))return"error";var r=Fx(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 Fx(e){return typeof e.constructor=="function"?e.constructor.name:null}function $x(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Bx(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=Lx(e)),t}function Gf(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Mt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(1):"Expected the enhancer to be a function. Instead, received: '"+dn(r)+"'");return r(Gf)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(2):"Expected the root reducer to be a function. Instead, received: '"+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"?Mt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(4):"Expected the listener to be a function. Instead, received: '"+dn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return u(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,u();var b=a.indexOf(h);a.splice(b,1),o=null}}}function m(h){if(!Mx(h))throw new Error(process.env.NODE_ENV==="production"?Mt(7):"Actions must be plain objects. Instead, the actual type was: '"+dn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Mt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?Mt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var b=y[v];b()}return h}function g(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Mt(10):"Expected the nextReducer to be a function. Instead, received: '"+dn(h));s=h,m({type:jc.REPLACE})}function _(){var h,y=f;return h={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Mt(11):"Expected the observer to be an object. Instead, received: '"+dn(b)+"'");function x(){b.next&&b.next(d())}x();var w=y(x);return{unsubscribe:w}}},h[Nc]=function(){return this},h}return m({type:jc.INIT}),n={dispatch:m,subscribe:f,getState:d,replaceReducer:g},n[Nc]=_,n}var Vx=function(t,r){return t===r};function Ux(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function zx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vx;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 Rc(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 kc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rc(Object(r),!0).forEach(function(n){qx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ac={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Hx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ac,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case tl:case Qi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Gi:return Ux(e.clientOffset,r.clientOffset)?e:kc(kc({},e),{},{clientOffset:r.clientOffset});case Xi:case Yi:return Ac;default:return e}}var nl="dnd-core/ADD_SOURCE",sl="dnd-core/ADD_TARGET",il="dnd-core/REMOVE_SOURCE",Zi="dnd-core/REMOVE_TARGET";function Wx(e){return{type:nl,payload:{sourceId:e}}}function Kx(e){return{type:sl,payload:{targetId:e}}}function Qx(e){return{type:il,payload:{sourceId:e}}}function Gx(e){return{type:Zi,payload:{targetId:e}}}function Pc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Lt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pc(Object(r),!0).forEach(function(n){Yx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Yx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Xx={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Zx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xx,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Qi:return Lt(Lt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case rl:return Lt(Lt({},e),{},{isSourcePublic:!0});case Gi:return Lt(Lt({},e),{},{targetIds:r.targetIds});case Zi:return e.targetIds.indexOf(r.targetId)===-1?e:Lt(Lt({},e),{},{targetIds:lx(e.targetIds,r.targetId)});case Yi:return Lt(Lt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Xi:return Lt(Lt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Jx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case nl:case sl:return e+1;case il:case Zi:return e-1;default:return e}}var Ti=[],ol=[];Ti.__IS_NONE__=!0;ol.__IS_ALL__=!0;function eS(e,t){if(e===Ti)return!1;if(e===ol||typeof t>"u")return!0;var r=ux(t,e);return r.length>0}function tS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Gi:break;case nl:case sl:case Zi:case il:return Ti;case Qi:case rl:case Xi:case Yi:default:return ol}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=cx(n,i),a=o.length>0||!zx(n,i);if(!a)return Ti;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function rS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Mc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Lc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mc(Object(r),!0).forEach(function(n){nS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:tS(e.dirtyHandlerIds,{type:t.type,payload:Lc(Lc({},t.payload),{},{prevTargetIds:ax(e,"dragOperation.targetIds",[])})}),dragOffset:Hx(e.dragOffset,t),refCount:Jx(e.refCount,t),dragOperation:Zx(e.dragOperation,t),stateId:rS(e.stateId)}}function iS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Yf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function oS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Yf(iS(t,n),r)}function aS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Yf(t,r)}function lS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cS(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&&cS(e.prototype,t),e}function Fc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var dS=function(){function e(t,r){lS(this,e),Fc(this,"store",void 0),Fc(this,"registry",void 0),this.store=t,this.registry=r}return uS(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;ae(typeof r=="function","listener must be a function."),ae(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&&!eS(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;ae(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 ae(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(ae(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 ya(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(ae(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&&!ya(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 oS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return aS(this.store.getState().dragOffset)}}]),e}(),fS=0;function hS(){return fS++}function hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hi=function(r){return typeof r}:hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hi(e)}function pS(e){ae(typeof e.canDrag=="function","Expected canDrag to be a function."),ae(typeof e.beginDrag=="function","Expected beginDrag to be a function."),ae(typeof e.endDrag=="function","Expected endDrag to be a function.")}function gS(e){ae(typeof e.canDrop=="function","Expected canDrop to be a function."),ae(typeof e.hover=="function","Expected hover to be a function."),ae(typeof e.drop=="function","Expected beginDrag to be a function.")}function va(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return va(r,!1)});return}ae(typeof e=="string"||hi(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 $c=typeof global<"u"?global:self,Xf=$c.MutationObserver||$c.WebKitMutationObserver;function Zf(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function mS(e){let t=1;const r=new Xf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const yS=typeof Xf=="function"?mS:Zf;class vS{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=yS(this.flush),this.requestErrorThrow=Zf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class bS{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 _S{create(t){const r=this.freeTasks,n=r.length?r.pop():new bS(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Jf=new vS,wS=new _S(Jf.registerPendingError);function xS(e){Jf.enqueueTask(wS.create(e))}function SS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CS(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 ES(e,t,r){return t&&CS(e.prototype,t),e}function fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function OS(e,t){return TS(e)||NS(e,t)||IS(e,t)||DS()}function DS(){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 IS(e,t){if(e){if(typeof e=="string")return Bc(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 Bc(e,t)}}function Bc(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 NS(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 TS(e){if(Array.isArray(e))return e}function jS(e){var t=hS().toString();switch(e){case Vt.SOURCE:return"S".concat(t);case Vt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Vc(e){switch(e[0]){case"S":return Vt.SOURCE;case"T":return Vt.TARGET;default:ae(!1,"Cannot parse handler ID: ".concat(e))}}function Uc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=OS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var RS=function(){function e(t){SS(this,e),fn(this,"types",new Map),fn(this,"dragSources",new Map),fn(this,"dropTargets",new Map),fn(this,"pinnedSourceId",null),fn(this,"pinnedSource",null),fn(this,"store",void 0),this.store=t}return ES(e,[{key:"addSource",value:function(r,n){va(r),pS(n);var s=this.addHandler(Vt.SOURCE,r,n);return this.store.dispatch(Wx(s)),s}},{key:"addTarget",value:function(r,n){va(r,!0),gS(n);var s=this.addHandler(Vt.TARGET,r,n);return this.store.dispatch(Kx(s)),s}},{key:"containsHandler",value:function(r){return Uc(this.dragSources,r)||Uc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;ae(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 ae(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return ae(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return ae(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Vc(r);return n===Vt.SOURCE}},{key:"isTargetId",value:function(r){var n=Vc(r);return n===Vt.TARGET}},{key:"removeSource",value:function(r){var n=this;ae(this.getSource(r),"Expected an existing source."),this.store.dispatch(Qx(r)),xS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){ae(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Gx(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);ae(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){ae(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=jS(r);return this.types.set(i,n),r===Vt.SOURCE?this.dragSources.set(i,s):r===Vt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function kS(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=AS(n),i=new dS(s,new RS(s)),o=new Px(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function AS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Gf(sS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var PS=["children"];function MS(e,t){return BS(e)||$S(e,t)||FS(e,t)||LS()}function LS(){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 FS(e,t){if(e){if(typeof e=="string")return zc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zc(e,t)}}function zc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $S(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 BS(e){if(Array.isArray(e))return e}function VS(e,t){if(e==null)return{};var r=US(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 US(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var qc=0,pi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),zS=p.memo(function(t){var r=t.children,n=VS(t,PS),s=qS(n),i=MS(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=eh();return++qc,function(){--qc===0&&(c[pi]=null)}}},[]),l.jsx(Kf.Provider,Object.assign({value:o},{children:r}),void 0)});function qS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=HS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function HS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:eh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[pi]||(s[pi]={dragDropManager:kS(e,t,r,n)}),s[pi]}function eh(){return typeof global<"u"?global:window}function WS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KS(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 QS(e,t,r){return t&&KS(e.prototype,t),e}function Hc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xo=!1,So=!1,GS=function(){function e(t){WS(this,e),Hc(this,"internalMonitor",void 0),Hc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return QS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){ae(!xo,"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 xo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{xo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;ae(!So,"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 So=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{So=!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 YS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XS(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 ZS(e,t,r){return t&&XS(e.prototype,t),e}function Wc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Co=!1,JS=function(){function e(t){YS(this,e),Wc(this,"internalMonitor",void 0),Wc(this,"targetId",null),this.internalMonitor=t.getMonitor()}return ZS(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;ae(!Co,"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 Co=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Co=!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 eC(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 tC(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;eC(s);var i=r?function(o){return e(o,r)}:e;return rC(s,i)}}function th(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=tC(n);t[r]=function(){return s}}}),t}function Kc(e,t){typeof e=="function"?e(t):e.current=t}function rC(e,t){var r=e.ref;return ae(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?p.cloneElement(e,{ref:function(s){Kc(r,s),Kc(t,s)}}):p.cloneElement(e,{ref:t})}function gi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gi=function(r){return typeof r}:gi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gi(e)}function ba(e){return e!==null&&gi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function _a(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 nC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function iC(e,t,r){return t&&sC(e.prototype,t),e}function 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 oC=function(){function e(t){var r=this;nC(this,e),ut(this,"hooks",th({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ba(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ba(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 iC(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!_a(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!_a(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 aC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lC(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 cC(e,t,r){return t&&lC(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 uC=function(){function e(t){var r=this;aC(this,e),Jt(this,"hooks",th({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ba(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 cC(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!_a(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 dC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function fC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var nn=typeof window<"u"?p.useLayoutEffect:p.useEffect;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 hC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function gC(e,t,r){return t&&pC(e.prototype,t),e}function Eo(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,n){hC(this,e),Eo(this,"spec",void 0),Eo(this,"monitor",void 0),Eo(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return gC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return mi(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 yC(e,t,r){var n=p.useMemo(function(){return new mC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function on(){var e=p.useContext(Kf),t=e.dragDropManager;return ae(t!=null,"Expected drag drop context"),t}function vC(e){return p.useMemo(function(){var t=e.type;return ae(t!=null,"spec.type must be defined"),t},[e])}function bC(e,t){return SC(e)||xC(e,t)||wC(e,t)||_C()}function _C(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wC(e,t){if(e){if(typeof e=="string")return Qc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qc(e,t)}}function Qc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xC(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 SC(e){if(Array.isArray(e))return e}function CC(e,t,r){var n=on(),s=yC(e,t,r),i=vC(e);nn(function(){if(i!=null){var a=fC(i,s,n),c=bC(a,2),u=c[0],d=c[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),d}},[n,t,r,s,i])}function EC(e){return NC(e)||IC(e)||DC(e)||OC()}function OC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DC(e,t){if(e){if(typeof e=="string")return wa(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 wa(e,t)}}function IC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function NC(e){if(Array.isArray(e))return wa(e)}function wa(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 rh(e,t){var r=EC(t||[]);return t==null&&typeof e!="function"&&r.push(e),p.useMemo(function(){return typeof e=="function"?e():e},r)}function TC(){var e=on();return p.useMemo(function(){return new GS(e)},[e])}function jC(e,t){var r=on(),n=p.useMemo(function(){return new oC(r.getBackend())},[r]);return nn(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),nn(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var RC=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 kC=Wd(RC);function AC(e,t){return FC(e)||LC(e,t)||MC(e,t)||PC()}function PC(){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 Gc(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 Gc(e,t)}}function Gc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function LC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function FC(e){if(Array.isArray(e))return e}function nh(e,t,r){var n=p.useState(function(){return t(e)}),s=AC(n,2),i=s[0],o=s[1],a=p.useCallback(function(){var c=t(e);kC(i,c)||(o(c),r&&r())},[i,e,r]);return nn(a),[i,a]}function $C(e,t){return zC(e)||UC(e,t)||VC(e,t)||BC()}function BC(){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 VC(e,t){if(e){if(typeof e=="string")return Yc(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 Yc(e,t)}}function Yc(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 UC(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 zC(e){if(Array.isArray(e))return e}function qC(e,t,r){var n=nh(e,t,r),s=$C(n,2),i=s[0],o=s[1];return nn(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function sh(e,t,r){return qC(t,e||function(){return{}},function(){return r.reconnect()})}function HC(e){return p.useMemo(function(){return e.hooks.dragSource()},[e])}function WC(e){return p.useMemo(function(){return e.hooks.dragPreview()},[e])}function KC(e,t){var r=rh(e,t);ae(!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=TC(),s=jC(r.options,r.previewOptions);return CC(r,n,s),[sh(r.collect,n,s),HC(s),WC(s)]}function QC(e){var t=e.accept;return p.useMemo(function(){return ae(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function GC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YC(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 XC(e,t,r){return t&&YC(e.prototype,t),e}function Xc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ZC=function(){function e(t,r){GC(this,e),Xc(this,"spec",void 0),Xc(this,"monitor",void 0),this.spec=t,this.monitor=r}return XC(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 JC(e,t){var r=p.useMemo(function(){return new ZC(e,t)},[t]);return p.useEffect(function(){r.spec=e},[e]),r}function e0(e,t){return s0(e)||n0(e,t)||r0(e,t)||t0()}function t0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r0(e,t){if(e){if(typeof e=="string")return Zc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zc(e,t)}}function Zc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n0(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 s0(e){if(Array.isArray(e))return e}function i0(e,t,r){var n=on(),s=JC(e,t),i=QC(e);nn(function(){var a=dC(i,s,n),c=e0(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 o0(){var e=on();return p.useMemo(function(){return new JS(e)},[e])}function a0(e){var t=on(),r=p.useMemo(function(){return new uC(t.getBackend())},[t]);return nn(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function l0(e){return p.useMemo(function(){return e.hooks.dropTarget()},[e])}function ih(e,t){var r=rh(e,t),n=o0(),s=a0(r.options);return i0(r,n,s),[sh(r.collect,n,s),l0(s)]}function c0(e,t){return h0(e)||f0(e,t)||d0(e,t)||u0()}function u0(){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 d0(e,t){if(e){if(typeof e=="string")return Jc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jc(e,t)}}function Jc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f0(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 h0(e){if(Array.isArray(e))return e}function p0(e){var t=on(),r=t.getMonitor(),n=nh(r,e),s=c0(n,2),i=s[0],o=s[1];return p.useEffect(function(){return r.subscribeToOffsetChange(o)}),p.useEffect(function(){return r.subscribeToStateChange(o)}),i}function oh(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function g0(e,t){return e.filter(function(r){return r!==t})}function m0(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 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 b0(e,t,r){return t&&v0(e.prototype,t),e}function eu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _0=function(){function e(t){y0(this,e),eu(this,"entered",[]),eu(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return b0(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=m0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=g0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),w0=oh(function(){return/firefox/i.test(navigator.userAgent)}),ah=oh(function(){return!!window.safari});function x0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C0(e,t,r){return t&&S0(e.prototype,t),e}function Zn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var tu=function(){function e(t,r){x0(this,e),Zn(this,"xs",void 0),Zn(this,"ys",void 0),Zn(this,"c1s",void 0),Zn(this,"c2s",void 0),Zn(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(R,M){return t[R]<t[M]?-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]],m=0;m<o.length-1;m++){var g=a[m],_=a[m+1];if(g*_<=0)f.push(0);else{c=o[m];var h=o[m+1],y=c+h;f.push(3*y/((y+h)/g+(y+c)/_))}}f.push(a[a.length-1]);for(var v=[],b=[],x,w=0;w<f.length-1;w++){x=a[w];var S=f[w],O=1/o[w],T=S+f[w+1]-x-x;v.push((x-S-T)*O),b.push(T*O*O)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,this.c3s=b}return C0(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 m=n[f];if(m<r)u=f+1;else if(m>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}(),E0=1;function lh(e){var t=e.nodeType===E0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Qs(e){return{x:e.clientX,y:e.clientY}}function O0(e){var t;return e.nodeName==="IMG"&&(w0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function D0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return ah()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function I0(e,t,r,n,s){var i=O0(t),o=i?e:t,a=lh(o),c={x:r.x-a.x,y:r.y-a.y},u=e.offsetWidth,d=e.offsetHeight,f=n.anchorX,m=n.anchorY,g=D0(i,t,u,d),_=g.dragPreviewWidth,h=g.dragPreviewHeight,y=function(){var T=new tu([0,.5,1],[c.y,c.y/d*h,c.y+h-d]),R=T.interpolate(m);return ah()&&i&&(R+=(window.devicePixelRatio-1)*h),R},v=function(){var T=new tu([0,.5,1],[c.x,c.x/u*_,c.x+_-u]);return T.interpolate(f)},b=s.offsetX,x=s.offsetY,w=b===0||b,S=x===0||x;return{x:w?b:v(),y:S?x:y()}}var ch="__NATIVE_FILE__",uh="__NATIVE_URL__",dh="__NATIVE_TEXT__",fh="__NATIVE_HTML__";const ru=Object.freeze(Object.defineProperty({__proto__:null,FILE:ch,HTML:fh,TEXT:dh,URL:uh},Symbol.toStringTag,{value:"Module"}));function Oo(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var hn;function Gs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xa=(hn={},Gs(hn,ch,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Gs(hn,fh,{exposeProperties:{html:function(t,r){return Oo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Gs(hn,uh,{exposeProperties:{urls:function(t,r){return Oo(t,r,"").split(`
465
- `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Gs(hn,dh,{exposeProperties:{text:function(t,r){return Oo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),hn);function N0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function j0(e,t,r){return t&&T0(e.prototype,t),e}function nu(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){N0(this,e),nu(this,"item",void 0),nu(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return j0(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 k0(e,t){var r=new R0(xa[e]);return r.loadDataTransfer(t),r}function Do(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(xa).filter(function(r){var n=xa[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function A0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M0(e,t,r){return t&&P0(e.prototype,t),e}function Io(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L0=function(){function e(t,r){A0(this,e),Io(this,"ownerDocument",null),Io(this,"globalContext",void 0),Io(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 su(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 iu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?su(Object(r),!0).forEach(function(n){fe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):su(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function F0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $0(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 B0(e,t,r){return t&&$0(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 V0=function(){function e(t,r,n){var s=this;F0(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&&lh(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=Qs(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,u=Do(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var d=s.monitor.getSourceId(),f=s.sourceNodes.get(d),m=s.sourcePreviewNodes.get(d)||f;if(m){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,h=g.anchorY,y=g.offsetX,v=g.offsetY,b={anchorX:_,anchorY:h},x={offsetX:y,offsetY:v},w=I0(f,m,a,b,x);c.setDragImage(m,w.x,w.y)}}try{c==null||c.setData("application/json",{})}catch{}s.setCurrentDragSourceNode(i.target);var S=s.getCurrentSourcePreviewNodeOptions(),O=S.captureDraggingState;O?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=Do(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:Qs(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=Qs(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 Do(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),fe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Qs(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 L0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new _0(this.isNodeInDocument)}return B0(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 iu({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 iu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(ru).some(function(n){return ru[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=k0(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}(),Ys;function U0(){return Ys||(Ys=new Image,Ys.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ys}var z0=function(t,r,n){return new V0(t,r,n)};function q0(e,t){return typeof e=="function"?e(t):e??"NODE"}function H0(e){return e.isDraggable&&!e.isEditing}function W0(e){const t=Ot(),r=t.selectedIds,[n,s,i]=KC(()=>({canDrag:()=>H0(e),type:q0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Fn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Fn.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(U0())},[i]),s}function K0(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 Q0(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 Xs(e,t){return{parentId:e||null,index:t}}function pn(e,t){return{type:"line",index:e,level:t}}function G0(e){return{type:"highlight",id:e}}function No(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=Lf(n)+1;return{parentId:s,index:i}}function hh(e){var t;const r=K0(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]=Q0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Xs(i.id,null),cursor:G0(i.id)};if(!c)return{drop:Xs((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:pn(0,0)};if(kf(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:No(c,d),cursor:pn(c.rowIndex+1,d)}}if(Af(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:No(c,d),cursor:pn(c.rowIndex+1,d)}}if(Pf(c)){const d=ci(s,0,c.level+1);return d>c.level?{drop:Xs(c.id,0),cursor:pn(c.rowIndex+1,d)}:{drop:No(c,d),cursor:pn(c.rowIndex+1,d)}}return{drop:Xs(c==null?void 0:c.id,0),cursor:pn(c.rowIndex+1,c.level+1)}}function Y0(e,t){const r=Ot(),[n,s]=ih(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:u}=hh({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Fn.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 X0(e){const t=Ot(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const ou=p.memo(function({index:t,style:r}){Rf(),gw();const n=Ot(),s=X0(t),i=p.useRef(null),o=W0(s),a=Y0(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),u=n.indent*s.level,d=p.useMemo(()=>({paddingLeft:u}),[u]),f=p.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),m={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:m,children:l.jsx(g,{node:s,tree:n,style:d,dragHandle:o})})});let To="",au=null;function ph(){Rf();const e=Ot();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(),Ff(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),$f(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(au),To+=t.key,au=setTimeout(()=>{To=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(To):!1});n&&e.focus(n.id)},children:l.jsx(Z0,{})})}function Z0(){var e,t;const r=Ot(),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:nx,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:ox,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(Jw,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:ou})):l.jsx(ex,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:ou}))}function lu(e){return e.isFiltered?e1(e.root,e.isMatch.bind(e)):J0(e.root)}function J0(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(gh),t}function e1(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(gh),n}function gh(e,t){e.rowIndex=t}const cu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var jo=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}=_w;class ds{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=yc(this),this.visibleNodes=lu(this),this.idToIndex=cu(this.visibleNodes)}update(t){this.props=t,this.root=yc(this),this.visibleNodes=lu(this),this.idToIndex=cu(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=is(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=is(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof ws)return t.id;const r=this.props.idAccessor||"id";return is(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 jo(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?zf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:Uf(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 jo(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(bo(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{ds.editPromise=i})}submit(t,r){return jo(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(bo(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(bo(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=ds.editPromise;r&&r(t),ds.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(cn(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(cn(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(vr.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(cn(n.id)),n.isSelectable&&(this.dispatch(vr.add(n.id)),this.dispatch(vr.anchor(n.id)),this.dispatch(vr.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(cn(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(vr.remove(this.nodesBetween(s,i))),this.dispatch(vr.add(o)),this.dispatch(vr.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(cn((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(vr.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&&Mf(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===_s?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Fn.cursor({type:"none"}))}showCursor(t){this.dispatch(Fn.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=el(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Ni(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ni(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),Vf(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===_s)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!is(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(cn(t.id))}onBlur(){this.dispatch(Tw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||ph}get renderRow(){return this.props.renderRow||Ew}get renderNode(){return this.props.children||Ow}get renderDragPreview(){return this.props.renderDragPreview||qf}get renderCursor(){return this.props.renderCursor||Cw}}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 t1=typeof Symbol=="function"&&Symbol.observable||"@@observable",uu=t1,Ro=()=>Math.random().toString(36).substring(7).split("").join("."),r1={INIT:`@@redux/INIT${Ro()}`,REPLACE:`@@redux/REPLACE${Ro()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ro()}`},en=r1;function mh(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 n1(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(o1(e))return"date";if(i1(e))return"error";const r=s1(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 s1(e){return typeof e.constructor=="function"?e.constructor.name:null}function i1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function o1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function wr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=n1(e)),t}function yh(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: '${wr(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: '${wr(r)}'`);return r(yh)(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((y,v)=>{o.set(v,y)}))}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(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ft(4):`Expected the listener to be a function. Instead, received: '${wr(y)}'`);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 v=!0;u();const b=a++;return o.set(b,y),function(){if(v){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.");v=!1,u(),o.delete(b),i=null}}}function m(y){if(!mh(y))throw new Error(process.env.NODE_ENV==="production"?ft(7):`Actions must be plain objects. Instead, the actual type was: '${wr(y)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?ft(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?ft(17):`Action "type" property must be a string. Instead, the actual type was: '${wr(y.type)}'. Value was: '${y.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,y)}finally{c=!1}return(i=o).forEach(b=>{b()}),y}function g(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?ft(10):`Expected the nextReducer to be a function. Instead, received: '${wr(y)}`);n=y,m({type:en.REPLACE})}function _(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?ft(11):`Expected the observer to be an object. Instead, received: '${wr(v)}'`);function b(){const w=v;w.next&&w.next(d())}return b(),{unsubscribe:y(b)}},[uu](){return this}}}return m({type:en.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:g,[uu]:_}}function du(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function a1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===en.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(!mh(e))return`The ${i} has unexpected type of "${wr(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===en.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 l1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:en.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:en.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 '${en.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 fu(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"&&du(`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{l1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=a1(a,r,c,s);f&&du(f)}let u=!1;const d={};for(let f=0;f<n.length;f++){const m=n[f],g=r[m],_=a[m],h=g(_,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?ft(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${m}" 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[m]=h,u=u||h!==_}return u=u||n.length!==Object.keys(a).length,u?d:a}}function c1(e=Ln().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 u1=fu({nodes:fu({focus:jw,edit:Nw,open:Rw,selection:kw,drag:c1}),dnd:Aw}),d1=Ln();function f1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(yh(u1,Ln(e))),o=pw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>d1),a=p.useMemo(()=>new ds(i.current,e,n,s),[]),c=p.useRef(0);return p.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),p.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),p.useImperativeHandle(t,()=>a),p.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),p.useEffect(()=>{a.props.searchTerm||i.current.dispatch(pa.clear(!0))},[a.props.searchTerm]),l.jsx(If.Provider,{value:a,children:l.jsx(jf.Provider,{value:c.current,children:l.jsx(Nf.Provider,{value:o.nodes,children:l.jsx(Tf.Provider,{value:o.dnd,children:l.jsx(zS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||z0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function h1(){const e=Ot(),[,t]=ih(()=>({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}=hh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Fn.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 p1(e){return h1(),e.children}function g1(){const t=Ot().props.renderContainer||ph;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function m1(){const e=Ot(),{offset:t,mouse:r,item:n,isDragging:s}=p0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||qf;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 y1(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 v1{constructor(t,r={}){this.accessors=y1(r),this.root=b1(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 b1(e,t){const r=new vh({},null,t,"ROOT");return r.children=e.map(n=>al(n,r,t)),r}function al(e,t,r){const n=new vh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>al(i,n,r))),n}class vh{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=al(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 _1=0;function w1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new v1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const h of _.dragIds)o.move({id:h,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:h})=>{o.update({id:h,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:h,type:y})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(y==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const v={[u]:`simple-tree-id-${_1++}`,name:""};return y==="internal"&&(v[d]=[]),o.create({parentId:_,index:h,data:v}),n(o.data),v},onDelete:_=>{_.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function x1(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]=w1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function S1(e,t){const r=x1(e);return l.jsxs(f1,{treeProps:r,imperativeHandle:t,children:[l.jsx(p1,{children:l.jsx(g1,{})}),l.jsx(m1,{})]})}const C1=p.forwardRef(S1);function ll(){return ke(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 E1(){return ke(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 hu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},pu={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},gu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],O1=[{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 D1(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 Ji(e){const t=D1(e);return{key:t,color:hu[t]??hu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:pu[t]??pu.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const I1="_row_i3qt2_1",N1="_grip_i3qt2_16",T1="_menuBtn_i3qt2_19",j1="_selected_i3qt2_23",R1="_title_i3qt2_28",k1="_dropTarget_i3qt2_33",A1="_toggle_i3qt2_50",P1="_ctIcon_i3qt2_65",M1="_folderIcon_i3qt2_77",L1="_renameInput_i3qt2_92",F1="_dropHere_i3qt2_101",$1="_menuWrap_i3qt2_111",B1="_menu_i3qt2_19",V1="_dangerItem_i3qt2_163",xt={row:I1,grip:N1,menuBtn:T1,selected:j1,title:R1,dropTarget:k1,toggle:A1,ctIcon:P1,folderIcon:M1,renameInput:L1,dropHere:F1,menuWrap:$1,menu:B1,dangerItem:V1},U1={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},z1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,u]=p.useState(e.data.name),d=p.useRef(null),f=n==="edit",m=ll(),g=Ji(e.data),_=U1[g.key]??zn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),b=y?sy:v?cy:_;p.useEffect(()=>{if(!s)return;const S=O=>{var T;(T=d.current)!=null&&T.contains(O.target)||i(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[s]);const x=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(S=>{S.key==="Enter"&&x(),S.key==="Escape"&&(u(e.data.name),a(!1))},[x,e.data.name]);return l.jsxs("div",{className:[xt.row,h?xt.selected:"",e.state.isOver&&v?xt.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":v?"true":void 0,role:"treeitem","aria-selected":h,"aria-expanded":v?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:xt.grip,"aria-hidden":"true",children:l.jsx(qd,{size:14})}),l.jsx("button",{className:xt.toggle,onClick:S=>{S.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(Bd,{size:14}):l.jsx(ks,{size:14})}),l.jsx("span",{className:`${xt.ctIcon} ${y||v?xt.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:xt.renameInput,value:c,autoFocus:!0,onChange:S=>u(S.target.value),onBlur:x,onKeyDown:w,onClick:S=>S.stopPropagation()}):l.jsx("span",{className:xt.title,onDoubleClick:()=>f&&a(!0),children:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:xt.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:xt.menuWrap,ref:d,children:[l.jsx("button",{className:xt.menuBtn,onClick:S=>{S.stopPropagation(),i(O=>!O)},"aria-label":"Node options",children:l.jsx(Ud,{size:14})}),s&&l.jsxs("div",{className:xt.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(gy,{size:13})," Rename"]}),v&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(zd,{size:13})," Add sub-unit"]}),e.data.parent&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(As,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:xt.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(qa,{size:13})," Delete"]})]})]})]})};async function q1(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 W1(e,t){var o;const r=await q1(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 K1(e){var r;return((r=(await Fe.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function bh(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 Q1(e){return bh(e)}const G1="_container_jr3ij_1",Y1="_header_jr3ij_13",X1="_title_jr3ij_22",Z1="_closeBtn_jr3ij_29",J1="_body_jr3ij_45",eE="_dropZone_jr3ij_54",tE="_dragOver_jr3ij_67",rE="_hasFile_jr3ij_72",nE="_hiddenInput_jr3ij_78",sE="_fileInfo_jr3ij_82",iE="_fileIcon_jr3ij_89",oE="_fileName_jr3ij_93",aE="_fileSize_jr3ij_100",lE="_dropHint_jr3ij_105",cE="_dropIcon_jr3ij_112",uE="_dropText_jr3ij_117",dE="_dropSubtext_jr3ij_124",fE="_sampleLink_jr3ij_130",hE="_statusBar_jr3ij_145",pE="_status_uploading_jr3ij_154",gE="_status_processing_jr3ij_154",mE="_status_done_jr3ij_159",yE="_status_error_jr3ij_164",vE="_successDetail_jr3ij_170",bE="_spinner_jr3ij_175",_E="_spin_jr3ij_175",wE="_errorMsg_jr3ij_191",xE="_failedSection_jr3ij_197",SE="_failedTitle_jr3ij_203",CE="_tableWrap_jr3ij_213",EE="_failedTable_jr3ij_219",OE="_reasonCell_jr3ij_244",DE="_footer_jr3ij_248",Se={container:G1,header:Y1,title:X1,closeBtn:Z1,body:J1,dropZone:eE,dragOver:tE,hasFile:rE,hiddenInput:nE,fileInfo:sE,fileIcon:iE,fileName:oE,fileSize:aE,dropHint:lE,dropIcon:cE,dropText:uE,dropSubtext:dE,sampleLink:fE,statusBar:hE,status_uploading:pE,status_processing:gE,status_done:mE,status_error:yE,successDetail:vE,spinner:bE,spin:_E,errorMsg:wE,failedSection:xE,failedTitle:SE,tableWrap:CE,failedTable:EE,reasonCell:OE,footer:DE},IE=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,u]=p.useState("idle"),[d,f]=p.useState(""),[m,g]=p.useState([]),[_,h]=p.useState(null),y=p.useRef(null),v=p.useRef(null),b=p.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);p.useEffect(()=>()=>b(),[b]);const x=j=>j.name.toLowerCase().endsWith(".csv")?j.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(j=>{f(""),g([]),h(null),u("idle"),x(j)&&i(j)},[]),S=p.useCallback(j=>{j.preventDefault(),a(!1);const k=j.dataTransfer.files[0];k&&w(k)},[w]),O=p.useCallback(j=>{var U;const k=(U=j.target.files)==null?void 0:U[0];k&&w(k),j.target.value=""},[w]),T=p.useCallback(async()=>{try{const j=await Q1(e),k=document.createElement("a");k.href=j,k.download="sample_hierarchy.csv",k.target="_blank",k.click()}catch{f("Failed to download sample CSV.")}},[e]),R=p.useCallback(async()=>{if(s){u("uploading"),f(""),g([]);try{const{processId:j}=await W1(e,s);if(!j){u("done"),h(null),setTimeout(t,1500);return}u("processing"),v.current=setInterval(async()=>{try{const k=await K1(j);k.status==="COMPLETED"?(b(),u("done"),h(k.successCount??null),k.failedRecords&&k.failedRecords.length>0?g(k.failedRecords):setTimeout(t,1500)):k.status==="FAILED"&&(b(),u("error"),f("Upload processing failed. Please check the error rows below."),k.failedRecords&&g(k.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]),M={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Se.container,children:[l.jsxs("div",{className:Se.header,children:[l.jsx("h2",{className:Se.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Se.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Se.body,children:[l.jsxs("div",{className:`${Se.dropZone} ${o?Se.dragOver:""} ${s?Se.hasFile:""}`,onDragEnter:j=>{j.preventDefault(),a(!0)},onDragOver:j=>{j.preventDefault(),a(!0)},onDragLeave:j=>{j.preventDefault(),a(!1)},onDrop:S,onClick:()=>{var j;return(j=y.current)==null?void 0:j.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:j=>{var k;return j.key==="Enter"&&((k=y.current)==null?void 0:k.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:Se.hiddenInput,onChange:O,"aria-hidden":"true"}),s?l.jsxs("div",{className:Se.fileInfo,children:[l.jsx("span",{className:Se.fileIcon,children:"📄"}),l.jsx("span",{className:Se.fileName,children:s.name}),l.jsxs("span",{className:Se.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Se.dropHint,children:[l.jsx("span",{className:Se.dropIcon,children:"⬆️"}),l.jsx("p",{className:Se.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Se.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Se.sampleLink,onClick:T,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Se.statusBar} ${Se[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Se.spinner,"aria-hidden":"true"}),M[c],c==="done"&&_!==null&&l.jsxs("span",{className:Se.successDetail,children:[" — ",_," item(s) imported"]})]}),d&&l.jsx("p",{className:Se.errorMsg,role:"alert",children:d}),m.length>0&&l.jsxs("div",{className:Se.failedSection,children:[l.jsxs("h4",{className:Se.failedTitle,children:["Failed Rows (",m.length,")"]}),l.jsx("div",{className:Se.tableWrap,children:l.jsxs("table",{className:Se.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:m.map((j,k)=>l.jsxs("tr",{children:[l.jsx("td",{children:j.rowNumber??k+1}),l.jsx("td",{children:j.name??"—"}),l.jsx("td",{className:Se.reasonCell,children:j.reason??"Unknown error"})]},k))})]})})]})]}),l.jsxs("div",{className:Se.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:R,children:c==="done"?"Uploaded":"Upload"})]})]})},NE="_container_1y30m_1",TE="_header_1y30m_8",jE="_headerActions_1y30m_19",RE="_iconBtn_1y30m_25",kE="_menuWrap_1y30m_43",AE="_dropdownMenu_1y30m_47",PE="_treeWrapper_1y30m_79",ME="_csvModal_1y30m_95",LE="_footer_1y30m_105",er={container:NE,header:TE,headerActions:jE,iconBtn:RE,menuWrap:kE,dropdownMenu:AE,treeWrapper:PE,csvModal:ME,footer:LE},FE=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var W;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,u]=p.useState(!1),[d,f]=p.useState(!1),[m,g]=p.useState("create"),{treeData:_,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:b,reorderChildren:x,setTreeData:w}=ke(),S=e==="edit",O=ll(),T=S&&O,R=(((W=_[0])==null?void 0:W.children)??[]).some(B=>B.isFolder),M=ve(B=>{var X,F,K,Z;return((F=(X=B.editorConfig)==null?void 0:X.context)==null?void 0:F.contentId)??((Z=(K=B.editorConfig)==null?void 0:K.context)==null?void 0:Z.identifier)??""});p.useEffect(()=>{const B=s.current;if(!B)return;const X=new ResizeObserver(()=>{a(B.clientHeight||400)});return X.observe(B),a(B.clientHeight||400),()=>X.disconnect()},[]),p.useEffect(()=>{if(!c)return;const B=X=>{var F;(F=i.current)!=null&&F.contains(X.target)||u(!1)};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[c]);const j=p.useCallback(B=>{B.length>0&&y(B[0].data.id)},[y]),k=p.useCallback(({parentId:B,index:X,dragIds:F})=>{if(!B)return;const K=F[0],Z=_h(_,B);if(!(Z!=null&&Z.children))return;const pe=Z.children.findIndex(Ce=>Ce.id===K);pe<0||x(B,pe,X>pe?X-1:X)},[_,x]),U=p.useCallback(({ids:B})=>{B.forEach(X=>b(X))},[b]),A=p.useCallback(({parentId:B})=>{var K;const X=B??((K=_[0])==null?void 0:K.id)??"";if(!X)return{id:crypto.randomUUID()};const F=v(X,"unit");return F?{id:F}:(Re.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,_]),q=p.useCallback(()=>{var X;const B=(X=_[0])==null?void 0:X.id;B&&(v(B,"unit")||Re.error("Maximum depth reached"))},[_,v]),L=p.useCallback(()=>{h&&(v(h,"subunit")||Re.error("Maximum depth reached"))},[h,v]),se=p.useCallback(async()=>{if(u(!1),!!M)try{const B=await bh(M),X=await fetch(B).then(Z=>Z.blob()),F=URL.createObjectURL(X),K=document.createElement("a");K.href=F,K.download=`${M}-folders.csv`,K.style.display="none",document.body.appendChild(K),K.click(),document.body.removeChild(K),URL.revokeObjectURL(F)}catch{Re.error("Failed to download CSV")}},[M]),ce=p.useCallback(async()=>{if(f(!1),!!M)try{const{rootNode:B}=await Df(M);w([B]),Re.success("Course outline refreshed.")}catch{Re.error("Outline could not be refreshed automatically. Please reload the page.")}},[M,w]);return l.jsxs("div",{className:er.container,children:[l.jsx("div",{className:er.header,children:l.jsxs("div",{className:er.headerActions,children:[S&&l.jsxs("div",{className:er.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:er.iconBtn,onClick:()=>u(B=>!B),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Ud,{size:15})}),c&&l.jsxs("div",{className:er.dropdownMenu,role:"menu",children:[l.jsx("button",{role:"menuitem",type:"button",disabled:R,title:R?'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:!R,title:R?void 0:'No folders yet — use "Create" first',onClick:se,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!R,title:R?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(hy,{size:15}):l.jsx(fy,{size:15})})]})}),l.jsx("div",{className:er.treeWrapper,ref:s,children:l.jsx(C1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:j,onMove:S?k:void 0,onDelete:S?U:void 0,onCreate:S?A:void 0,disableEdit:!S,disableDrop:!S,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:B=>l.jsx(z1,{...B,editorMode:e})})}),S&&l.jsxs("div",{className:er.footer,children:[l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:q,disabled:!T,children:[l.jsx(As,{size:14})," Add Unit"]}),l.jsxs(Oe,{variant:"ghost",size:"sm",onClick:L,disabled:!T||!h,children:[l.jsx(zd,{size:14})," Add Sub-unit"]})]}),d&&l.jsx("div",{className:er.csvModal,children:l.jsx(IE,{contentId:M,mode:m,onComplete:ce,onClose:()=>f(!1)})})]})};function _h(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=_h(r.children,t);if(n)return n}}}const $E="_breadcrumb_zd1aj_1",BE="_crumb_zd1aj_10",VE="_sep_zd1aj_26",UE="_current_zd1aj_31",Jn={breadcrumb:$E,crumb:BE,sep:VE,current:UE},zE=({crumbs:e})=>{const t=ke(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Jn.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Jn.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(uy,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Bd,{size:13,className:Jn.sep}),n<e.length-1?l.jsx("button",{className:Jn.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Jn.current,children:r.name})]},r.id))]}):null},qE="_tabBar_qhks1_1",HE="_tab_qhks1_1",WE="_active_qhks1_29",KE="_error_qhks1_35",QE="_errorDot_qhks1_39",es={tabBar:qE,tab:HE,active:WE,error:KE,errorDot:QE},mu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],GE=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?mu.filter(i=>n.includes(i.id)):mu;return l.jsx("div",{className:es.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:[es.tab,e===i.id?es.active:"",r.includes(i.id)?es.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:es.errorDot,"aria-label":"Has errors"})]},i.id))})};var $s=e=>e.type==="checkbox",Ur=e=>e instanceof Date,nt=e=>e==null;const wh=e=>typeof e=="object";var Le=e=>!nt(e)&&!Array.isArray(e)&&wh(e)&&!Ur(e),Sa=e=>Le(e)&&e.target?$s(e.target)?e.target.checked:e.target.value:e,xh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Sh=e=>{const t=e.constructor&&e.constructor.prototype;return Le(t)&&t.hasOwnProperty("isPrototypeOf")},eo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Be(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(eo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Le(e)&&Sh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Be(e[s]));return n}const Sr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Wt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ko="form",Ch="root",Eh=["__proto__","constructor","prototype"];var Bs=e=>/^\w*$/.test(e),Te=e=>e===void 0,to=e=>e.split(/[.[\]'"]/g).filter(Boolean),H=(e,t,r)=>{if(!t||!Le(e))return r;const n=Bs(t)?[t]:to(t);if(n.some(i=>Eh.includes(i)))return r;const s=n.reduce((i,o)=>nt(i)?void 0:i[o],e);return Te(s)||s===e?Te(e[t])?r:e[t]:s},Rt=e=>typeof e=="boolean",pt=e=>typeof e=="function",Ie=(e,t,r)=>{let n=-1;const s=Bs(t)?[t]:to(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=Le(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(Eh.includes(a))return;e[a]=c,e=e[a]}};const cl=p.createContext(null);cl.displayName="HookFormControlContext";const ul=()=>p.useContext(cl);var Oh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Wt.all&&(t._proxyFormState[o]=!n||Wt.all),r&&(r[o]=!0),e[o]}});return s};const dl=eo?p.useLayoutEffect:p.useEffect;function YE(e){const t=ul(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return dl(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Oh(o,r,c.current,!1),[o,r])}var gt=e=>typeof e=="string",Ca=(e,t,r,n,s)=>gt(e)?(n&&t.watch.add(e),H(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),H(r,i))):(n&&(t.watchAll=!0),r),Ea=e=>nt(e)||!wh(e);const yu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Sh(e);function kt(e,t,r=new WeakMap){if(e===t)return!0;if(Ea(e)||Ea(t))return Object.is(e,t);if(Ur(e)&&Ur(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(yu(e,n)||yu(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(Ur(a)&&Ur(c)||(Le(a)||Array.isArray(a))&&(Le(c)||Array.isArray(c))?!kt(a,c,r):!Object.is(a,c))return!1}}return!0}function XE(e){const t=ul(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),u=p.useRef(a),d=p.useRef(void 0),f=p.useRef(r),m=p.useRef(n);u.current=a;const[g,_]=p.useState(()=>{const w=r._getWatch(n,c.current);return u.current?u.current(w):w}),h=p.useCallback(w=>{const S=Ca(n,r._names,w||r._formValues,!1,c.current);return u.current?u.current(S):S},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const S=Ca(n,r._names,w||r._formValues,!1,c.current);if(u.current){const O=u.current(S);kt(O,d.current)||(_(O),d.current=O)}else _(S)}},[r._formValues,r._names,i,n]);dl(()=>((f.current!==r||!kt(m.current,n))&&(f.current=r,m.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,b=m.current,x=p.useMemo(()=>{if(i)return null;const w=!v&&!kt(b,n);return v||w?h():null},[i,v,n,b,h]);return x!==null?x:g}function ro(e){const t=ul(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=xh(s._names.array,r),u=p.useMemo(()=>H(s._formValues,r,H(s._defaultValues,r,o)),[s,r,o]),d=XE({control:s,name:r,defaultValue:u,exact:a}),f=YE({control:s,name:r,exact:a}),m=p.useRef(e),g=p.useRef(null),_=p.useRef(s.register(r,{...e.rules,value:d,...Rt(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!H(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!H(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!H(f.validatingFields,r)},error:{enumerable:!0,get:()=>H(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const S=Sa(w);return H(s._fields,r)||(_.current=s.register(r,{...m.current.rules,value:S})),_.current.onChange({target:{value:Sa(w),name:r},type:Sr.CHANGE})},[r,s]),v=p.useCallback(()=>_.current.onBlur({target:{value:H(s._formValues,r),name:r},type:Sr.BLUR}),[r,s._formValues]),b=p.useCallback(w=>{w&&(g.current={focus:()=>pt(w.focus)&&w.focus(),select:()=>pt(w.select)&&w.select(),setCustomValidity:O=>pt(w.setCustomValidity)&&w.setCustomValidity(O),reportValidity:()=>pt(w.reportValidity)&&w.reportValidity()});const S=H(s._fields,r);S&&S._f&&w&&(S._f.ref=g.current)},[s._fields,r]),x=p.useMemo(()=>({name:r,value:d,...Rt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,f.disabled,y,v,b,d]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...m.current.rules,...Rt(m.current.disabled)?{disabled:m.current.disabled}:{}});const S=(O,T)=>{const R=H(s._fields,O);R&&R._f&&(R._f.mount=T)};if(S(r,!0),w){const O=Be(H(i?s._defaultValues:s._options.values||s._defaultValues,r,H(s._options.defaultValues,r,m.current.defaultValue)));Ie(s._defaultValues,r,O),Te(H(s._formValues,r))&&Ie(s._formValues,r,O)}if(!c&&s.register(r),g.current){const O=H(s._fields,r);O&&O._f&&(O._f.ref=g.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):S(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:x,formState:f,fieldState:h}),[x,f,h])}const fl=p.createContext(null);fl.displayName="HookFormContext";const Yt=()=>p.useContext(fl),ZE=({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:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v})=>{const b=p.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v}),[i,_,u,n,r,m,h,f,d,s,y,o,a,v,c,g,t]);return p.createElement(fl.Provider,{value:b},p.createElement(cl.Provider,{value:b.control},e))};var JE=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Dh=e=>Array.isArray(e)?e.filter(Boolean):[],yi=e=>Array.isArray(e)?e:[e],vu=()=>{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 Ih(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&Le(s)&&i){const o=Ih(s,i);Le(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Xe=e=>Le(e)&&!Object.keys(e).length,hl=e=>e.type==="file",ji=e=>{if(!eo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Nh=e=>e.type==="select-multiple",pl=e=>e.type==="radio",eO=e=>pl(e)||$s(e),Ao=e=>ji(e)&&e.isConnected;function tO(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 rO(e){for(const t in e)if(e.hasOwnProperty(t)&&!Te(e[t]))return!1;return!0}function He(e,t){if(gt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Bs(t)?[t]:to(t),n=r.length===1?e:tO(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(Le(n)&&Xe(n)||Array.isArray(n)&&rO(n))&&He(e,r.slice(0,-1)),e}var nO=e=>{for(const t in e)if(pt(e[t]))return!0;return!1};function Th(e){return Array.isArray(e)||Le(e)&&!nO(e)}function Oa(e,t={}){for(const r in e){const n=e[r];Th(n)?(t[r]=Array.isArray(n)?[]:{},Oa(n,t[r])):Te(n)||(t[r]=!0)}return t}function Da(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Da(r));return t.some(r=>r!==void 0)?t:void 0}if(Le(e)){const t={};for(const r in e){const n=Da(e[r]);Te(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function $r(e,t,r){r||(r=Oa(t));for(const n in e){const s=e[n];if(Th(s))Te(t)||Ea(r[n])?r[n]=Oa(s,Array.isArray(s)?[]:{}):$r(s,nt(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!kt(s,i)}}return Da(r)||{}}const bu={value:!1,isValid:!1},_u={value:!0,isValid:!0};var jh=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&&!Te(e[0].attributes.value)?Te(e[0].value)||e[0].value===""?_u:{value:e[0].value,isValid:!0}:_u:bu}return bu},Rh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Te(e)?e:t?e===""?NaN:e&&+e:r&&gt(e)?new Date(e):n?n(e):e;const wu={isValid:!1,value:null};var kh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,wu):wu;function xu(e){const t=e.ref;return hl(t)?t.files:pl(t)?kh(e.refs).value:Nh(t)?[...t.selectedOptions].map(({value:r})=>r):$s(t)?jh(e.refs).value:Rh(Te(t.value)?e.ref.value:t.value,e)}var sO=(e,t,r,n)=>{const s={};for(const i of e){const o=H(t,i);o&&Ie(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ri=e=>e instanceof RegExp,ts=e=>Te(e)?e:Ri(e)?e.source:Le(e)?Ri(e.value)?e.value.source:e.value:e,Su=e=>({isOnSubmit:!e||e===Wt.onSubmit,isOnBlur:e===Wt.onBlur,isOnChange:e===Wt.onChange,isOnAll:e===Wt.all,isOnTouch:e===Wt.onTouched});const Cu="AsyncFunction";var iO=e=>!!e&&!!e.validate&&!!(pt(e.validate)&&e.validate.constructor.name===Cu||Le(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Cu)),oO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Po=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const fs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=H(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(fs(a,t))break}else if(Le(a)&&fs(a,t))break}}};function Eu(e,t,r){const n=H(e,r);if(n||Bs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=H(t,i),a=H(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var aO=(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||Wt.all))},lO=(e,t,r)=>!e||!t||e===t||yi(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),cO=(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,uO=(e,t)=>!Dh(H(e,t)).length&&He(e,t),Ou=(e,t,r)=>{const n=H(e,r),s=Array.isArray(n)?n:[];return Ie(s,Ch,t[r]),Ie(e,r,s),e};function Du(e,t,r="validate"){if(gt(e)||Array.isArray(e)&&e.every(gt)||Rt(e)&&!e)return{type:r,message:gt(e)?e:"",ref:t}}var gn=e=>Le(e)&&!Ri(e)?e:{value:e,message:""},Iu=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:u,minLength:d,min:f,max:m,pattern:g,validate:_,name:h,valueAsNumber:y,mount:v}=e._f,b=H(r,h);if(!v||t.has(h))return{};const x=a?a[0]:o,w=U=>{if(s&&x.reportValidity){const A=Rt(U)?"":U||"";a?a.forEach(q=>q.setCustomValidity(A)):x.setCustomValidity(A),x.reportValidity()}},S={},O=pl(o),T=$s(o),R=O||T,M=(y||hl(o))&&Te(o.value)&&Te(b)||ji(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,j=JE.bind(null,h,n,S),k=(U,A,q,L=qt.maxLength,se=qt.minLength)=>{const ce=U?A:q;S[h]={type:U?L:se,message:ce,ref:o,...j(U?L:se,ce)}};if(i?!Array.isArray(b)||!b.length:c&&(!R&&(M||nt(b))||Rt(b)&&!b||T&&!jh(a).isValid||O&&!kh(a).isValid)){const{value:U,message:A}=gt(c)?{value:!!c,message:c}:gn(c);if(U&&(S[h]={type:qt.required,message:A,ref:x,...j(qt.required,A)},!n))return w(A),S}if(!M&&(!nt(f)||!nt(m))){let U,A;const q=gn(m),L=gn(f);if(!nt(b)&&!isNaN(b)){const se=o.valueAsNumber||b&&+b;nt(q.value)||(U=se>q.value),nt(L.value)||(A=se<L.value)}else{const se=o.valueAsDate||new Date(b),ce=X=>new Date(new Date().toDateString()+" "+X),W=o.type=="time",B=o.type=="week";gt(q.value)&&b&&(U=W?ce(b)>ce(q.value):B?b>q.value:se>new Date(q.value)),gt(L.value)&&b&&(A=W?ce(b)<ce(L.value):B?b<L.value:se<new Date(L.value))}if((U||A)&&(k(!!U,q.message,L.message,qt.max,qt.min),!n))return w(S[h].message),S}if((u||d)&&!M&&(gt(b)||i&&Array.isArray(b))){const U=gn(u),A=gn(d),q=!nt(U.value)&&b.length>+U.value,L=!nt(A.value)&&b.length<+A.value;if((q||L)&&(k(q,U.message,A.message),!n))return w(S[h].message),S}if(g&&!M&&gt(b)){const{value:U,message:A}=gn(g);if(Ri(U)&&!b.match(U)&&(S[h]={type:qt.pattern,message:A,ref:o,...j(qt.pattern,A)},!n))return w(A),S}if(_){if(pt(_)){const U=await _(b,r),A=Du(U,x);if(A&&(S[h]={...A,...j(qt.validate,A.message)},!n))return w(A.message),S}else if(Le(_)){let U={};for(const A in _){if(!Xe(U)&&!n)break;const q=Du(await _[A](b,r),x,A);q&&(U={...q,...j(A,q.message)},w(q.message),n&&(S[h]=U))}if(!Xe(U)&&(S[h]={ref:x,...U},!n))return S}}return w(!0),S};const dO={mode:Wt.onSubmit,reValidateMode:Wt.onChange,shouldFocusError:!0},Ah={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function fO(e={}){let t={...dO,...e},r={...Be(Ah),isLoading:pt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=Le(t.defaultValues)||Le(t.values)?Be(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Be(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 m={...f};const g={array:vu(),state:vu()},_=t.criteriaMode===Wt.all,h=C=>I=>{clearTimeout(u),u=setTimeout(C,I)},y=async C=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||m.isValid||C)){let I;t.resolver?(I=Xe((await j()).errors),v()):I=await A({fields:n,onlyCheckValid:!0,eventType:Sr.VALID}),I!==r.isValid&&g.state.next({isValid:I})}},v=(C,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||m.isValidating||m.validatingFields)&&((C||Array.from(a.mount)).forEach(N=>{N&&(I?Ie(r.validatingFields,N,I):He(r.validatingFields,N))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Xe(r.validatingFields)}))},b=()=>{r.dirtyFields=$r(s,i)},x=(C,I=[],N,$,V=!0,Q=!0)=>{if($&&N&&!t.disabled){if(o.action=!0,Q&&Array.isArray(H(n,C))){const z=N(H(n,C),$.argA,$.argB);V&&Ie(n,C,z)}if(Q&&Array.isArray(H(r.errors,C))){const z=N(H(r.errors,C),$.argA,$.argB);V&&Ie(r.errors,C,z),uO(r.errors,C)}if((f.touchedFields||m.touchedFields)&&Q&&Array.isArray(H(r.touchedFields,C))){const z=N(H(r.touchedFields,C),$.argA,$.argB);V&&Ie(r.touchedFields,C,z)}(f.dirtyFields||m.dirtyFields)&&b(),g.state.next({name:C,isDirty:L(C,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ie(i,C,I)},w=(C,I)=>{Ie(r.errors,C,I),r.errors={...r.errors},g.state.next({errors:r.errors})},S=C=>{r.errors=C,g.state.next({errors:r.errors,isValid:!1})},O=C=>{const I=Bs(C)?[C]:to(C);let N=i,$=s;for(let V=0;V<I.length-1;V++){const Q=I[V];if(N=nt(N)?N:N[Q],$=nt($)?$:$[Q],N===null&&$!==null)return!0}return!1},T=(C,I,N,$)=>{const V=H(n,C);if(V){if(O(C))return;const Q=Te(H(i,C)),z=H(i,C,Te(N)?H(s,C):N);Te(z)||$&&$.defaultChecked||I?Ie(i,C,I?z:xu(V._f)):W(C,z),o.mount&&!o.action&&(y(),Q&&r.isDirty&&(f.isDirty||m.isDirty)&&(L()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!Te(H(i,C))&&Po(C,a)&&(o.watch=!0))}},R=(C,I,N,$,V)=>{let Q=!1,z=!1;const ee={name:C};if(!t.disabled){if(!N||$){(f.isDirty||m.isDirty)&&(z=r.isDirty,r.isDirty=ee.isDirty=L(),Q=z!==ee.isDirty);const de=kt(H(s,C),I);z=!!H(r.dirtyFields,C),de!==r.isDirty?r.dirtyFields=$r(s,i):de?He(r.dirtyFields,C):Ie(r.dirtyFields,C,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||m.dirtyFields)&&z!==!de}if(N){const de=H(r.touchedFields,C);de||(Ie(r.touchedFields,C,N),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||m.touchedFields)&&de!==N)}Q&&V&&g.state.next(ee)}return Q?ee:{}},M=(C,I,N,$)=>{const V=H(r.errors,C),Q=(f.isValid||m.isValid)&&Rt(I)&&r.isValid!==I;if(t.delayError&&N?(c=h(()=>w(C,N)),c(t.delayError)):(clearTimeout(u),c=null,N?Ie(r.errors,C,N):He(r.errors,C),r.errors={...r.errors}),(N?!kt(V,N):V)||!Xe($)||Q){const z={...$,...Q&&Rt(I)?{isValid:I}:{},errors:r.errors,name:C};r={...r,...z},g.state.next(z)}},j=async C=>(v(C,!0),await t.resolver(i,t.context,sO(C||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),k=async C=>{const{errors:I}=await j(C);if(v(C),C){for(const N of C){const $=H(I,N);$?a.array.has(N)&&Le($)&&!Object.keys($).some(V=>!Number.isNaN(Number(V)))?Ou(r.errors,{[N]:$},N):Ie(r.errors,N,$):He(r.errors,N)}r.errors={...r.errors}}else r.errors=I;return I},U=async({name:C,eventType:I})=>{if(e.validate){const N=await e.validate({formValues:i,formState:r,name:C,eventType:I});if(Le(N))for(const $ in N){const V=N[$];V&&ye(`${ko}.${$}`,{message:gt(V.message)?V.message:"",type:V.type||qt.validate})}else gt(N)||!N?ye(ko,{message:N||"",type:qt.validate}):re(ko);return N}return!0},A=async({fields:C,onlyCheckValid:I,name:N,eventType:$,context:V={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(V.runRootValidation=!0,!await U({name:N,eventType:$})&&(V.valid=!1,I)))return V.valid;for(const Q in C){const z=C[Q];if(z){const{_f:ee,...de}=z;if(ee){const Pe=a.array.has(ee.name),_t=z._f&&iO(z._f),wt=f.validatingFields||f.isValidating||m.validatingFields||m.isValidating;_t&&wt&&v([ee.name],!0);const ar=await Iu(z,a.disabled,i,_,t.shouldUseNativeValidation&&!I,Pe);if(_t&&wt&&v([ee.name]),ar[ee.name]&&(V.valid=!1,I)||(!I&&(H(ar,ee.name)?Pe?Ou(r.errors,ar,ee.name):Ie(r.errors,ee.name,ar[ee.name]):He(r.errors,ee.name)),e.shouldUseNativeValidation&&ar[ee.name]))break}!Xe(de)&&await A({context:V,onlyCheckValid:I,fields:de,name:Q,eventType:$})}}return V.valid},q=()=>{for(const C of a.unMount){const I=H(n,C);I&&(I._f.refs?I._f.refs.every(N=>!Ao(N)):!Ao(I._f.ref))&&et(C)}a.unMount=new Set},L=(C,I)=>!t.disabled&&(C&&I&&Ie(i,C,I),!kt(J(),s)),se=(C,I,N)=>Ca(C,a,{...o.mount?i:Te(I)?s:gt(C)?{[C]:I}:I},N,I),ce=C=>Dh(H(o.mount?i:s,C,t.shouldUnregister?H(s,C,[]):[])),W=(C,I,N={},$=!1)=>{const V=H(n,C);let Q=I;if(V){const z=V._f;z&&(!z.disabled&&Ie(i,C,Rh(I,z)),Q=ji(z.ref)&&nt(I)?"":I,Nh(z.ref)?[...z.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):z.refs?$s(z.ref)?z.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(Q)?ee.checked=!!Q.find(de=>de===ee.value):ee.checked=Q===ee.value||!!Q)}):z.refs.forEach(ee=>ee.checked=ee.value===Q):hl(z.ref)?z.ref.value="":(z.ref.value=Q,z.ref.type||g.state.next({name:C,values:$?i:Be(i)})))}(N.shouldDirty||N.shouldTouch)&&R(C,Q,N.shouldTouch,N.shouldDirty,!0),N.shouldValidate&&Ce(C)},B=(C,I,N,$=!1)=>{for(const V in I){if(!I.hasOwnProperty(V))return;const Q=I[V],z=C+"."+V,ee=H(n,z);(a.array.has(C)||Le(Q)||ee&&!ee._f)&&!Ur(Q)?B(z,Q,N,$):W(z,Q,N,$)}},X=(C,I,N,$)=>{const V=H(n,C),Q=a.array.has(C),z=$?I:Be(I),ee=H(i,C),de=kt(ee,z);if(de||Ie(i,C,z),Q)g.array.next({name:C,values:$?i:Be(i)}),(f.isDirty||f.dirtyFields||m.isDirty||m.dirtyFields)&&N.shouldDirty&&(b(),g.state.next({name:C,dirtyFields:r.dirtyFields,isDirty:L(C,z)}));else{const Pe=Array.isArray(z)&&!z.length||Xe(z);!V||V._f||nt(z)||Pe?W(C,z,N,$):B(C,z,N,$)}if(!de){const Pe=Po(C,a),_t=$?i:Be(i);g.state.next({...Pe&&r,name:o.mount||Pe?C:void 0,values:_t})}},F=(C,I,N={})=>X(C,I,N,!1),K=(C,I={})=>{const N=pt(C)?C(i):C;if(!kt(i,N)){i={...i,...N};for(const $ of a.mount)X($,H(N,$),I,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&y()}},Z=async C=>{o.mount=!0;const I=C.target;let N=I.name,$=!0;const V=H(n,N),Q=de=>{$=Number.isNaN(de)||Ur(de)&&isNaN(de.getTime())||kt(de,H(i,N,de))},z=Su(t.mode),ee=Su(t.reValidateMode);if(V){let de,Pe;const _t=I.type?xu(V._f):Sa(C),wt=C.type===Sr.BLUR||C.type===Sr.FOCUS_OUT,ar=!oO(V._f)&&!e.validate&&!t.resolver&&!H(r.errors,N)&&!V._f.deps||cO(wt,H(r.touchedFields,N),r.isSubmitted,ee,z),Wn=Po(N,a,wt);Ie(i,N,_t),wt?(!I||!I.readOnly)&&(V._f.onBlur&&V._f.onBlur(C),c&&c(0)):V._f.onChange&&V._f.onChange(C);const Mr=R(N,_t,wt),Ge=!Xe(Mr)||Wn;if(!wt&&g.state.next({name:N,type:C.type,values:Be(i)}),ar)return(f.isValid||m.isValid)&&(t.mode==="onBlur"?wt&&y():wt||y()),Ge&&g.state.next({name:N,...Wn?{}:Mr});if(!t.resolver&&e.validate&&await U({name:N,eventType:C.type}),!wt&&Wn&&g.state.next({...r}),t.resolver){const{errors:lt}=await j([N]);if(v([N]),Q(_t),!$){!Xe(Mr)&&g.state.next(Mr);return}const yt=Eu(r.errors,n,N),Ut=Eu(lt,n,yt.name||N);de=Ut.error,N=Ut.name,Pe=Xe(lt)}else v([N],!0),de=(await Iu(V,a.disabled,i,_,t.shouldUseNativeValidation))[N],v([N]),Q(_t),$&&(de?Pe=!1:(f.isValid||m.isValid)&&(Pe=await A({fields:n,onlyCheckValid:!0,name:N,eventType:C.type})));$&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&Ce(V._f.deps),M(N,Pe,de,Mr))}},pe=(C,I)=>{if(H(r.errors,I)&&C.focus)return C.focus(),1},Ce=async(C,I={})=>{let N,$;const V=yi(C);if(t.resolver){const Q=await k(Te(C)?C:V);N=Xe(Q),$=C?!V.some(z=>H(Q,z)):N}else C?($=(await Promise.all(V.map(async Q=>{const z=H(n,Q);return await A({fields:z&&z._f?{[Q]:z}:z,eventType:Sr.TRIGGER})}))).every(Boolean),!(!$&&!r.isValid)&&y()):$=N=await A({fields:n,name:C,eventType:Sr.TRIGGER});return g.state.next({...!gt(C)||(f.isValid||m.isValid)&&N!==r.isValid?{}:{name:C},...t.resolver||!C?{isValid:N}:{},errors:r.errors}),I.shouldFocus&&!$&&fs(n,pe,C?V:a.mount),$},J=(C,I)=>{let N={...o.mount?i:s};return I&&(N=Ih(I.dirtyFields?r.dirtyFields:r.touchedFields,N)),Te(C)?N:gt(C)?H(N,C):C.map($=>H(N,$))},be=(C,I)=>({invalid:!!H((I||r).errors,C),isDirty:!!H((I||r).dirtyFields,C),error:H((I||r).errors,C),isValidating:!!H(r.validatingFields,C),isTouched:!!H((I||r).touchedFields,C)}),re=C=>{const I=C?yi(C):void 0;I==null||I.forEach(N=>He(r.errors,N)),I?I.forEach(N=>{g.state.next({name:N,errors:r.errors})}):g.state.next({errors:{}})},ye=(C,I,N)=>{const $=(H(n,C,{_f:{}})._f||{}).ref,V=H(r.errors,C)||{},{ref:Q,message:z,type:ee,...de}=V;Ie(r.errors,C,{...de,...I,ref:$}),g.state.next({name:C,errors:r.errors,isValid:!1}),N&&N.shouldFocus&&$&&$.focus&&$.focus()},ie=(C,I)=>pt(C)?g.state.subscribe({next:N=>"values"in N&&C(N.values||se(void 0,I),N)}):se(C,I,!0),ot=C=>g.state.subscribe({next:I=>{if(lO(C.name,I.name,C.exact)&&aO(I,C.formState||f,Vs,C.reRenderRoot)){const N={...i};C.callback({values:N,...r,...I,defaultValues:s})}}}).unsubscribe,De=C=>(o.mount=!0,m={...m,...C.formState},ot({...C,formState:{...d,...C.formState}})),et=(C,I={})=>{for(const N of C?yi(C):a.mount)a.mount.delete(N),a.array.delete(N),I.keepValue||(He(n,N),He(i,N)),!I.keepError&&He(r.errors,N),!I.keepDirty&&He(r.dirtyFields,N),!I.keepTouched&&He(r.touchedFields,N),!I.keepIsValidating&&He(r.validatingFields,N),!t.shouldUnregister&&!I.keepDefaultValue&&He(s,N);g.state.next({values:Be(i)}),g.state.next({...r,...I.keepDirty?{isDirty:L()}:{}}),!I.keepIsValid&&y()},Qe=({disabled:C,name:I})=>{if(Rt(C)&&o.mount||C||a.disabled.has(I)){const V=a.disabled.has(I)!==!!C;C?a.disabled.add(I):a.disabled.delete(I),V&&o.mount&&!o.action&&y()}},$e=(C,I={})=>{let N=H(n,C);const $=Rt(I.disabled)||Rt(t.disabled),V=!a.registerName.has(C)&&N&&N._f&&!N._f.mount;return Ie(n,C,{...N||{},_f:{...N&&N._f?N._f:{ref:{name:C}},name:C,mount:!0,...I}}),a.mount.add(C),N&&!V?Qe({disabled:Rt(I.disabled)?I.disabled:t.disabled,name:C}):T(C,!0,I.value),{...$?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:ts(I.min),max:ts(I.max),minLength:ts(I.minLength),maxLength:ts(I.maxLength),pattern:ts(I.pattern)}:{},name:C,onChange:Z,onBlur:Z,ref:Q=>{if(Q){a.registerName.add(C),$e(C,I),a.registerName.delete(C),N=H(n,C);const z=Te(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=eO(z),de=N._f.refs||[];if(ee?de.find(Pe=>Pe===z):z===N._f.ref)return;Ie(n,C,{_f:{...N._f,...ee?{refs:[...de.filter(Ao),z,...Array.isArray(H(s,C))?[{}]:[]],ref:{type:z.type,name:C}}:{ref:z}}}),T(C,!1,void 0,z)}else N=H(n,C,{}),N._f&&(N._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(xh(a.array,C)&&o.action)&&a.unMount.add(C)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&fs(n,pe,a.mount),ze=C=>{Rt(C)&&(g.state.next({disabled:C}),fs(n,(I,N)=>{const $=H(n,N);$&&(I.disabled=$._f.disabled||C,Array.isArray($._f.refs)&&$._f.refs.forEach(V=>{V.disabled=$._f.disabled||C}))},0,!1))},at=(C,I)=>async N=>{let $;N&&(N.preventDefault&&N.preventDefault(),N.persist&&N.persist());let V=Be(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:z}=await j();v(),r.errors=Q,V=Be(z)}else await A({fields:n,eventType:Sr.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)He(V,Q);if(He(r.errors,Ch),Xe(r.errors)){g.state.next({errors:{}});try{await C(V,N)}catch(Q){$=Q}}else I&&await I({...r.errors},N),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Xe(r.errors)&&!$,submitCount:r.submitCount+1,errors:r.errors}),$)throw $},qe=(C,I={})=>{H(n,C)&&(Te(I.defaultValue)?F(C,Be(H(s,C))):(F(C,I.defaultValue),Ie(s,C,Be(I.defaultValue))),I.keepTouched||He(r.touchedFields,C),I.keepDirty||(He(r.dirtyFields,C),r.isDirty=I.defaultValue?L(C,Be(H(s,C))):L()),I.keepError||(He(r.errors,C),f.isValid&&y()),g.state.next({...r}))},Ae=(C,I={})=>{const N=C?Be(C):s,$=Be(N),V=Xe(C),Q=$;if(I.keepDefaultValues||(s=N),!I.keepValues){if(I.keepDirtyValues){const z=new Set([...a.mount,...Object.keys($r(s,i))]);for(const ee of Array.from(z)){const de=H(r.dirtyFields,ee),Pe=H(i,ee),_t=H(Q,ee);de&&!Te(Pe)?Ie(Q,ee,Pe):!de&&!Te(_t)&&F(ee,_t)}}else{if(eo&&Te(C))for(const z of a.mount){const ee=H(n,z);if(ee&&ee._f){const de=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(ji(de)){const Pe=de.closest("form");if(Pe){Pe.reset();break}}}}if(I.keepFieldsRef)for(const z of a.mount)F(z,H(Q,z));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?Be(s):{},I.keepFieldsRef)for(const z of a.mount)Ie(i,z,H(Q,z))}else i=Be(Q);g.array.next({values:{...Q}}),g.state.next({values:{...Q}})}a={mount:I.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!Xe(Q),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),g.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:V?!1:I.keepDirty?r.isDirty:I.keepValues?L():!!(I.keepDefaultValues&&!kt(C,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:V?{}:I.keepDirtyValues?I.keepDefaultValues&&i?$r(s,i):r.dirtyFields:I.keepDefaultValues&&C?$r(s,C):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Dt=(C,I)=>Ae(pt(C)?C(i):C,{...t.resetOptions,...I}),At=(C,I={})=>{const N=H(n,C),$=N&&N._f;if($){const V=$.refs?$.refs[0]:$.ref;V.focus&&setTimeout(()=>{V.focus(),I.shouldSelect&&pt(V.select)&&V.select()})}},Vs=C=>{r={...r,...C}},Us={control:{register:$e,unregister:et,getFieldState:be,handleSubmit:at,setError:ye,_subscribe:ot,_runSchema:j,_updateIsValidating:v,_focusError:te,_getWatch:se,_getDirty:L,_setValid:y,_setFieldArray:x,_setDisabledField:Qe,_setErrors:S,_getFieldArray:ce,_reset:Ae,_resetDefaultValues:()=>pt(t.defaultValues)&&t.defaultValues().then(C=>{Dt(C,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:q,_disableForm:ze,_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:De,trigger:Ce,register:$e,handleSubmit:at,watch:ie,setValue:F,setValues:K,getValues:J,reset:Dt,resetField:qe,resetDefaultValues:(C,I={})=>{if(s=Be(C),!I.keepDirty){const N=$r(s,i);r.dirtyFields=N,r.isDirty=!Xe(N)}I.keepIsValid||y(),g.state.next({...r,defaultValues:s})},clearErrors:re,unregister:et,setError:ye,setFocus:At,getFieldState:be};return{...Us,formControl:Us}}function hO(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...Be(Ah),isLoading:pt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:pt(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&&!pt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=fO(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,dl(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!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]),p.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=p.useMemo(()=>Oh(s,o),[o,s]),t.current}async function Nu(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 Ph(e,t){const r=Dl({queryKey:["framework",e],queryFn:()=>Nu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Dl({queryKey:["framework",n],queryFn:()=>Nu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}const pO={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"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."}},Tu={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},gO={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"},Mh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},ju=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function mO(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=_O(s),a=wO(s,r,t),c=t[i],u=Lh(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:vO(a,u,o,r),depends:s.depends,tab:bO(s),section:s.section,defaultValue:s.defaultValue??s.default,currentValue:u}}):CO(t,n,r)}function yO(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 vO(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=yO(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 bO(e){const t=e.section;if(t&&Tu[t])return Tu[t];const r=e.code??"";return gO[r]??"details"}function Lh(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 _O(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 wO(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??Mh[i];if(o)return Fh(i,o,e,t,r)}function Fh(e,t,r,n,s){var f,m,g,_,h;const i=ju.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=y=>({label:y.name,value:i?y.identifier:y.name}),a=(m=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:m.find(y=>y.code===t),c=(h=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:h.find(y=>y.code===t);let u=(ju.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 y=d.flatMap(v=>{const b=s[v];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(y.length){const v=u.filter(b=>{const x=b.associations;return!x||!x.length?!0:x.some(w=>y.includes(w.identifier)||y.includes(w.code)||y.includes(w.name))});v.length&&(u=v)}}return u.map(o)}function mn(e,t){const r=Mh[e];if(r)return Fh(e,r,{},t,{})}const xO=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],SO=[{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 rt(e,t,r){return Lh(e[t],r)}function CO(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:rt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:rt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:rt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:rt(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:rt(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:mn("board",r),currentValue:rt(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:mn("subject",r),currentValue:rt(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:xO,currentValue:rt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:mn("targetBoardIds",r),currentValue:rt(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:mn("targetMediumIds",r),currentValue:rt(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:mn("targetGradeLevelIds",r),currentValue:rt(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:mn("targetSubjectIds",r),currentValue:rt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:SO,currentValue:rt(e,"license","select")})),n}function EO(e,t){const{watch:r,setValue:n}=e;p.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 OO="_section_ylgu8_1",DO="_header_ylgu8_11",IO="_title_ylgu8_17",NO="_description_ylgu8_24",TO="_divider_ylgu8_30",jO="_fields_ylgu8_36",yn={section:OO,header:DO,title:IO,description:NO,divider:TO,fields:jO},RO=({title:e,description:t,children:r})=>l.jsxs("div",{className:yn.section,children:[l.jsxs("div",{className:yn.header,children:[l.jsx("h3",{className:yn.title,children:e}),t&&l.jsx("p",{className:yn.description,children:t})]}),l.jsx("hr",{className:yn.divider}),l.jsx("div",{className:yn.fields,children:r})]}),kO="_field_1s288_1",AO="_fullWidth_1s288_7",PO="_label_1s288_11",MO="_required_1s288_19",LO="_input_1s288_24",FO="_textarea_1s288_45",$O="_inputError_1s288_50",BO="_error_1s288_54",VO="_selectBtn_1s288_59",UO="_selectOpen_1s288_83",zO="_placeholder_1s288_87",qO="_selectedVal_1s288_91",HO="_chevronUp_1s288_95",WO="_dropdown_1s288_100",KO="_option_1s288_116",QO="_optionSelected_1s288_134",GO="_noOpts_1s288_139",YO="_chipGroup_1s288_146",XO="_chipInput_1s288_158",ZO="_addChipBtn_1s288_167",JO="_radioGroup_1s288_184",eD="_radioLabel_1s288_191",tD="_iconWrap_1s288_199",rD="_iconPreview_1s288_214",nD="_iconPlaceholder_1s288_220",sD="_removeIconBtn_1s288_233",iD="_tagChip_1s288_252",oD="_tagChipRemove_1s288_264",aD="_nestedSelectRow_1s288_278",lD="_dialcodeRow_1s288_287",cD="_validateBtn_1s288_293",uD="_dialcodeValid_1s288_315",dD="_dialcodeSpinner_1s288_325",P={field:kO,fullWidth:AO,label:PO,required:MO,input:LO,textarea:FO,inputError:$O,error:BO,selectBtn:VO,selectOpen:UO,placeholder:zO,selectedVal:qO,chevronUp:HO,dropdown:WO,option:KO,optionSelected:QO,noOpts:GO,chipGroup:YO,chipInput:XO,addChipBtn:ZO,radioGroup:JO,radioLabel:eD,iconWrap:tD,iconPreview:rD,iconPlaceholder:nD,removeIconBtn:sD,tagChip:iD,tagChipRemove:oD,nestedSelectRow:aD,dialcodeRow:lD,validateBtn:cD,dialcodeValid:uD,dialcodeSpinner:dD},Ru=({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:[P.field,s?P.fullWidth:""].join(" "),children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[P.input,P.textarea,u?P.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,d)}):l.jsx("input",{id:e,type:"text",className:[P.input,u?P.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,d)}),u&&l.jsx("span",{className:P.error,children:String(u.message)})]})},fD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Yt(),m=u(e),g=((h=r.find(y=>y.value===m))==null?void 0:h.label)??"Select…",_=f[e];return p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,_?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m?P.selectedVal:P.placeholder,children:g}),l.jsx(ks,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,m===y.value?P.optionSelected:""].join(" "),onClick:()=>{d(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),m===y.value&&l.jsx(Un,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:P.error,children:String(_.message)})]})},hD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Yt(),m=u(e)??[],g=f[e],_=m.length?`${m.length} selected`:"Select…";p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=m.includes(y)?m.filter(b=>b!==y):[...m,y];d(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,g?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m.length?P.selectedVal:P.placeholder,children:_}),l.jsx(ks,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,m.includes(y.value)?P.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Un,{size:13,style:{opacity:m.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:P.error,children:String(g.message)})]})},pD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),u=p.useRef(null),{watch:d,setValue:f,formState:{errors:m}}=Yt(),g=d(e)??[],_=m[e],h=()=>{const v=i.trim();v&&!g.includes(v)&&f(e,[...g,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,g.filter(b=>b!==v),{shouldDirty:!0});return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.chipGroup,children:[g.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:u,autoFocus:!0,className:P.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:P.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=u.current)==null?void 0:v.focus()},50)},children:[l.jsx(As,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:P.error,children:String(_.message)})]})},gD=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Yt(),a=o[e];return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.radioGroup,children:r.map(c=>l.jsxs("label",{className:P.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:P.error,children:String(a.message)})]})},mD="_overlay_ga6eh_1",yD="_modal_ga6eh_12",vD="_header_ga6eh_24",bD="_title_ga6eh_33",_D="_closeBtn_ga6eh_39",wD="_tabs_ga6eh_57",xD="_tab_ga6eh_57",SD="_activeTab_ga6eh_83",CD="_body_ga6eh_88",ED="_searchWrap_ga6eh_99",OD="_searchIcon_ga6eh_104",DD="_searchInput_ga6eh_113",ID="_grid_ga6eh_132",ND="_imgCell_ga6eh_148",TD="_imgCellSelected_ga6eh_166",jD="_thumb_ga6eh_171",RD="_noThumb_ga6eh_177",kD="_checkBadge_ga6eh_183",AD="_loadMoreBtn_ga6eh_198",PD="_loadingRow_ga6eh_220",MD="_empty_ga6eh_230",LD="_spinner_ga6eh_237",FD="_uploadArea_ga6eh_247",$D="_dropZone_ga6eh_256",BD="_uploadIcon_ga6eh_277",VD="_dropText_ga6eh_281",UD="_dropSubtext_ga6eh_288",zD="_uploadPreview_ga6eh_294",qD="_hiddenInput_ga6eh_301",HD="_fileName_ga6eh_305",WD="_errorText_ga6eh_311",KD="_footer_ga6eh_318",QD="_cancelBtn_ga6eh_328",GD="_confirmBtn_ga6eh_345",ue={overlay:mD,modal:yD,header:vD,title:bD,closeBtn:_D,tabs:wD,tab:xD,activeTab:SD,body:CD,searchWrap:ED,searchIcon:OD,searchInput:DD,grid:ID,imgCell:ND,imgCellSelected:TD,thumb:jD,noThumb:RD,checkBadge:kD,loadMoreBtn:AD,loadingRow:PD,empty:MD,spinner:LD,uploadArea:FD,dropZone:$D,uploadIcon:BD,dropText:VD,dropSubtext:UD,uploadPreview:zD,hiddenInput:qD,fileName:HD,errorText:WD,footer:KD,cancelBtn:QD,confirmBtn:GD},ku=18,$h=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,u]=p.useState([]),[d,f]=p.useState(0),[m,g]=p.useState(!1),[_,h]=p.useState(null),[y,v]=p.useState(0),[b,x]=p.useState(null),[w,S]=p.useState(""),[O,T]=p.useState(!1),[R,M]=p.useState(""),j=p.useRef(null),k=ve(F=>{var K,Z;return((Z=(K=F.editorConfig)==null?void 0:K.context)==null?void 0:Z.channel)??""}),U=ve(F=>{var K,Z;return((Z=(K=F.editorConfig)==null?void 0:K.context)==null?void 0:Z.uid)??""}),A=p.useCallback(async(F,K,Z=!1)=>{var pe;g(!0);try{const Ce={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&U&&(Ce.createdBy=U),k&&(Ce.channel=k);const be=((pe=(await Fe.post("/action/composite/v3/search",{request:{filters:Ce,query:F,limit:ku,offset:K,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:pe.result)??{},re=be.content??[];f(be.count??0),u(ye=>Z?[...ye,...re]:re)}catch{}finally{g(!1)}},[s,U,k]);p.useEffect(()=>{s!=="upload"&&(u([]),v(0),A(o,0))},[s]);const q=p.useRef(),L=F=>{a(F),clearTimeout(q.current),q.current=setTimeout(()=>{u([]),v(0),A(F,0)},400)},se=()=>{const F=y+ku;v(F),A(o,F,!0)},ce=()=>{const F=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";F&&r(F)},W=F=>{var Z;const K=(Z=F.target.files)==null?void 0:Z[0];if(F.target.value="",!!K){if(!K.type.startsWith("image/")){M("Only image files are accepted.");return}if(K.size>4*1024*1024){M("Image must be under 4 MB.");return}x(K),S(URL.createObjectURL(K)),M("")}},B=async()=>{var F,K;if(b){T(!0),M("");try{const Z=new FormData;Z.append("file",b);const Ce=(K=(F=(await Fe.post(`/action/content/v3/upload/${e}?fileType=image`,Z,{headers:{"Content-Type":"multipart/form-data"}})).data)==null?void 0:F.result)==null?void 0:K.artifactUrl;if(!Ce)throw new Error("No URL in response");r(Ce)}catch(Z){M(Z instanceof Error?Z.message:"Upload failed.")}finally{T(!1)}}},X=c.length<d;return l.jsx("div",{className:ue.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:ue.modal,children:[l.jsxs("div",{className:ue.header,children:[l.jsx("span",{className:ue.title,children:"Select App Icon"}),l.jsx("button",{className:ue.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:18})})]}),l.jsxs("div",{className:ue.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${ue.tab} ${s==="my"?ue.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${ue.tab} ${s==="all"?ue.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${ue.tab} ${s==="upload"?ue.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(ql,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:ue.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ue.searchWrap,children:[l.jsx(oa,{size:14,className:ue.searchIcon}),l.jsx("input",{type:"search",className:ue.searchInput,placeholder:"Search images…",value:o,onChange:F=>L(F.target.value)})]}),m&&c.length===0?l.jsxs("div",{className:ue.loadingRow,children:[l.jsx(si,{size:20,className:ue.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:ue.empty,children:"No images found"}):l.jsx("div",{className:ue.grid,children:c.map(F=>{const K=F.appIcon??F.artifactUrl??F.downloadUrl??"",Z=(_==null?void 0:_.identifier)===F.identifier;return l.jsxs("button",{type:"button",className:`${ue.imgCell} ${Z?ue.imgCellSelected:""}`,onClick:()=>h(F),title:F.name,children:[K?l.jsx("img",{src:K,alt:F.name,className:ue.thumb}):l.jsx("div",{className:ue.noThumb,children:"IMG"}),Z&&l.jsx("div",{className:ue.checkBadge,children:l.jsx(Un,{size:12})})]},F.identifier)})}),X&&!m&&l.jsx("button",{className:ue.loadMoreBtn,onClick:se,children:"Load More"}),m&&c.length>0&&l.jsx("div",{className:ue.loadingRow,children:l.jsx(si,{size:16,className:ue.spinner})})]}):l.jsxs("div",{className:ue.uploadArea,children:[l.jsx("div",{className:ue.dropZone,onClick:()=>{var F;return(F=j.current)==null?void 0:F.click()},onDragOver:F=>F.preventDefault(),onDrop:F=>{F.preventDefault();const K=F.dataTransfer.files[0];K&&W({target:{files:[K],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:ue.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(ql,{size:32,className:ue.uploadIcon}),l.jsx("p",{className:ue.dropText,children:"Drag & drop or click to browse"}),l.jsx("p",{className:ue.dropSubtext,children:"PNG, JPG, SVG · max 4 MB"})]})}),l.jsx("input",{ref:j,type:"file",accept:"image/*",className:ue.hiddenInput,onChange:W}),b&&l.jsx("p",{className:ue.fileName,children:b.name}),R&&l.jsx("p",{className:ue.errorText,children:R})]})}),l.jsxs("div",{className:ue.footer,children:[l.jsx("button",{className:ue.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:ue.confirmBtn,disabled:!b||O,onClick:B,children:O?l.jsxs(l.Fragment,{children:[l.jsx(si,{size:14,className:ue.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:ue.confirmBtn,disabled:!_,onClick:ce,children:"Use Selected"})]})]})})},YD=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:u,formState:{errors:d}}=Yt(),f=a(e),m=d[e],g=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...u(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:P.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:P.iconPreview}):l.jsxs("div",{className:P.iconPlaceholder,children:[l.jsx(Hd,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:P.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(qa,{size:13}),l.jsx("span",{children:"Remove"})]}),m&&l.jsx("span",{className:P.error,children:String(m.message)}),i&&l.jsx($h,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},XD=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:P.error,children:String(o.message)})]})},ZD=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),u=p.useRef(null),d=i.value??[],f=h=>{const y=h.trim();!y||d.includes(y)||i.onChange([...d,y])},m=h=>{i.onChange(d.filter(y=>y!==h))},g=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&d.length>0&&m(d[d.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:[P.chipGroup,o?P.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=u.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(h=>l.jsxs("span",{className:P.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:P.tagChipRemove,onClick:y=>{y.stopPropagation(),m(h)},"aria-label":`Remove ${h}`,children:l.jsx(sn,{size:11})})]},h)),!n&&l.jsx("input",{ref:u,className:P.chipInput,value:a,onChange:h=>c(h.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:P.error,children:String(o.message)})]})},JD=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Yt(),{field:o,fieldState:{error:a}}=ro({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},u=(d,f,m)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[d]=m;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.nestedSelectRow,children:r.map((d,f)=>{const m=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:P.field,style:{flex:1},children:[l.jsx("label",{className:P.label,htmlFor:`${e}_${d.code}`,children:d.label}),l.jsxs("select",{id:`${e}_${d.code}`,className:[P.input,a?P.inputError:""].join(" "),disabled:s||m,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:P.error,children:String(a.message)})]})},Au=[{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"}],eI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:u,formState:{errors:d}}=Yt(),f=c(e),m=Au.find(h=>h.value===f),g=(m==null?void 0:m.label)??"Select license…",_=d[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:P.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[P.selectBtn,_?P.inputError:"",s?P.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?P.selectedVal:P.placeholder,children:g}),l.jsx(ks,{size:14,className:s?P.chevronUp:""})]}),s&&l.jsx("div",{className:P.dropdown,role:"listbox",children:Au.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[P.option,f===h.value?P.optionSelected:""].join(" "),onClick:()=>{u(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Un,{size:13})]},h.value))}),_&&l.jsx("span",{className:P.error,children:String(_.message)})]})},tI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Yt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[u,d]=p.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 A_(g),h=_==null?void 0:_.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.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.")}},m=()=>a==="loading"?l.jsx(si,{size:16,className:P.dialcodeSpinner}):a==="valid"?l.jsx(Vd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(ia,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange: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:P.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),m()]}),o&&l.jsx("span",{className:P.error,children:String(o.message)}),!o&&u&&l.jsx("span",{className:a==="valid"?P.dialcodeValid:P.error,children:u})]})},rI="_form_szqex_1",nI="_ungrouped_szqex_7",sI="_noFields_szqex_18",Mo={form:rI,ungrouped:nI,noFields:sI},iI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var L,se,ce;const a=ve(W=>W.editorConfig),c=ve(W=>W.rootFormConfig),u=ve(W=>W.unitFormConfig),{organisationFramework:d,targetFrameworks:f,isLoading:m}=Ph((L=a==null?void 0:a.context)==null?void 0:L.framework,(se=a==null?void 0:a.context)==null?void 0:se.targetFWIds),g={organisationFramework:d,targetFrameworks:f},_=ke(W=>W.selectedNodeId),h=ke(W=>W.treeCache),y=_?h[_]??{}:{},v={...e,...y},b=r?c:u,x=b||(((ce=a==null?void 0:a.config.hierarchy)==null?void 0:ce.formConfig)??[]),w=mO(x,v,g,r),S=w.filter(W=>W.tab===t&&W.inputType!=="appIcon"),O=hO({mode:"onChange",defaultValues:Object.fromEntries(w.map(W=>{const B=["multiselect","chips","keywords","tagsinput"],X=["nestedselect"];return B.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??[]]:X.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??{}]:[W.code,W.currentValue??W.defaultValue??""]}))});EO(O,w);const{updateNode:T}=ke(),R=p.useRef(w);R.current=w;const M=p.useRef(_);M.current=_;const j=p.useRef(i);j.current=i;const k=p.useRef(o);k.current=o,p.useEffect(()=>{const W=O.watch((B,{name:X})=>{const F=M.current;if(!F)return;const K=R.current,Z=new Set(K.map(J=>J.code));if(X&&Z.has(X)){const J=O.getValues(X);T(F,{[X]:J}),j.current({[X]:J})}else if(!X){const J=O.getValues(),be=Object.fromEntries(Object.entries(J).filter(([re])=>Z.has(re)));Object.keys(be).length>0&&(T(F,be),j.current(be))}const pe=O.formState.errors,Ce=Array.from(new Set(Object.keys(pe).map(J=>{var be;return(be=K.find(re=>re.code===J))==null?void 0:be.tab}).filter(Boolean)));k.current(Object.keys(pe).length===0,Ce)});return()=>W.unsubscribe()},[O]);const U=s!=="edit",A=S.reduce((W,B)=>{const X=W[W.length-1];return X&&X.section===B.section?X.fields.push(B):W.push({section:B.section,fields:[B]}),W},[]),q=W=>{const B={key:W.code,name:W.code,label:W.label,required:W.required,disabled:U||W.editable===!1};switch(W.inputType){case"textarea":return l.jsx(Ru,{...B,multiline:!0,maxLength:W.maxLength});case"select":return l.jsx(fD,{...B,options:W.options??[]});case"multiselect":return l.jsx(hD,{...B,options:W.options??[]});case"chips":return l.jsx(pD,{...B});case"radio":return l.jsx(gD,{...B,options:W.options??[]});case"appIcon":return l.jsx(YD,{...B,nodeId:_??""});case"datepicker":case"datetime":return l.jsx(XD,{...B});case"keywords":case"tagsinput":return l.jsx(ZD,{...B});case"nestedselect":return l.jsx(JD,{...B,levels:W.levels??[]});case"license":return l.jsx(eI,{...B});case"dialcode":return l.jsx(tI,{...B});default:return l.jsx(Ru,{...B,maxLength:W.maxLength})}};return l.jsx(ZE,{...O,children:l.jsxs("div",{className:Mo.form,children:[A.map((W,B)=>{const X=W.section?pO[W.section]:void 0;return X?l.jsx(RO,{title:X.title,description:X.description,children:W.fields.map(q)},W.section??B):l.jsx("div",{className:Mo.ungrouped,children:W.fields.map(q)},B)}),S.length===0&&!m&&l.jsx("p",{className:Mo.noFields,children:"No fields configured for this tab."})]})})};function Bh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function oI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Zs(e){return e!==null&&e>=0}function aI(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 lI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Vh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Bh(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}},Js={scaleX:1,scaleY:1},cI=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,...Js}:null}const c=uI(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Js}:s<r&&s>=o?{x:0,y:a.height+c,...Js}:{x:0,y:0,...Js}};function uI(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 Uh="Sortable",zh=p.createContext({activeIndex:-1,containerId:Uh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vh,disabled:{draggable:!1,droppable:!1}});function dI(e){let{children:t,id:r,items:n,strategy:s=Vh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=Fd(),f=js(Uh,r),m=a.rect!==null,g=p.useMemo(()=>n.map(O=>typeof O=="object"&&"id"in O?O.id:O),[n]),_=o!=null,h=o?g.indexOf(o.id):-1,y=u?g.indexOf(u.id):-1,v=p.useRef(g),b=!aI(g,v.current),x=y!==-1&&h===-1||b,w=lI(i);Kt(()=>{b&&_&&d(g)},[b,g,_,d]),p.useEffect(()=>{v.current=g},[g]);const S=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:x,items:g,overIndex:y,useDragOverlay:m,sortedRects:oI(g,c),strategy:s}),[h,f,w.draggable,w.droppable,x,g,y,c,m,s]);return p.createElement(zh.Provider,{value:S},t)}const fI=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Bh(r,n,s).indexOf(t)},hI=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},pI={duration:200,easing:"ease"},qh="transform",gI=Ar.Transition.toString({property:qh,duration:0,easing:"linear"}),mI={roleDescription:"sortable"};function yI(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Kt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const u=Vn(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]),p.useEffect(()=>{i&&o(null)},[i]),i}function vI(e){let{animateLayoutChanges:t=hI,attributes:r,disabled:n,data:s,getNewIndex:i=fI,id:o,strategy:a,resizeObserverConfig:c,transition:u=pI}=e;const{items:d,containerId:f,activeIndex:m,disabled:g,disableTransforms:_,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=p.useContext(zh),x=bI(n,g),w=d.indexOf(o),S=p.useMemo(()=>({sortable:{containerId:f,index:w,items:d},...s}),[f,s,w,d]),O=p.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:T,node:R,isOver:M,setNodeRef:j}=$m({id:o,data:S,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...c}}),{active:k,activatorEvent:U,activeNodeRect:A,attributes:q,setNodeRef:L,listeners:se,isDragging:ce,over:W,setActivatorNodeRef:B,transform:X}=Ld({id:o,data:S,attributes:{...mI,...r},disabled:x.draggable}),F=Cg(j,L),K=!!k,Z=K&&!_&&Zs(m)&&Zs(y),pe=!v&&ce,Ce=pe&&Z?X:null,be=Z?Ce??(a??b)({rects:h,activeNodeRect:A,activeIndex:m,overIndex:y,index:w}):null,re=Zs(m)&&Zs(y)?i({id:o,items:d,activeIndex:m,overIndex:y}):w,ye=k==null?void 0:k.id,ie=p.useRef({activeId:ye,items:d,newIndex:re,containerId:f}),ot=d!==ie.current.items,De=t({active:k,containerId:f,isDragging:ce,isSorting:K,id:o,index:w,items:d,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:u,wasDragging:ie.current.activeId!=null}),et=yI({disabled:!De,index:w,node:R,rect:T});return p.useEffect(()=>{K&&ie.current.newIndex!==re&&(ie.current.newIndex=re),f!==ie.current.containerId&&(ie.current.containerId=f),d!==ie.current.items&&(ie.current.items=d)},[K,re,f,d]),p.useEffect(()=>{if(ye===ie.current.activeId)return;if(ye&&!ie.current.activeId){ie.current.activeId=ye;return}const $e=setTimeout(()=>{ie.current.activeId=ye},50);return()=>clearTimeout($e)},[ye]),{active:k,activeIndex:m,attributes:q,data:S,rect:T,index:w,newIndex:re,items:d,isOver:M,isSorting:K,isDragging:ce,listeners:se,node:R,overIndex:y,over:W,setNodeRef:F,setActivatorNodeRef:B,setDroppableNodeRef:j,setDraggableNodeRef:L,transform:et??be,transition:Qe()};function Qe(){if(et||ot&&ie.current.newIndex===w)return gI;if(!(pe&&!$i(U)||!u)&&(K||De))return Ar.Transition.toString({...u,property:qh})}}function bI(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 ki(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 _I=[me.Down,me.Right,me.Up,me.Left],wI=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(_I.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=s.get(f.id);if(m)switch(e.code){case me.Down:n.top<m.top&&c.push(f);break;case me.Up:n.top>m.top&&c.push(f);break;case me.Left:n.left>m.left&&c.push(f);break;case me.Right:n.left<m.left&&c.push(f);break}});const u=Vg({collisionRect:n,droppableRects:s,droppableContainers:c});let d=_d(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),m=i.get(d),g=m?s.get(m.id):null,_=m==null?void 0:m.node.current;if(_&&g&&f&&m){const y=Bi(_).some((O,T)=>a[T]!==O),v=Hh(f,m),b=xI(f,m),x=y||!v?{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 x.x&&x.y?w:ys(w,x)}}}};function Hh(e,t){return!ki(e)||!ki(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function xI(e,t){return!ki(e)||!ki(t)||!Hh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const SI="_row_11nth_1",CI="_removeBtn_11nth_14",EI="_grip_11nth_17",OI="_ctIcon_11nth_34",DI="_info_11nth_38",II="_name_11nth_46",NI="_meta_11nth_55",Lr={row:SI,removeBtn:CI,grip:EI,ctIcon:OI,info:DI,name:II,meta:NI},TI={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},jI=({item:e,onRemove:t,isEditable:r})=>{const n=Ji(e),s=TI[n.key]??zn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:u,isDragging:d}=vI({id:e.id,disabled:!r}),f={transform:Ar.Transform.toString(c),transition:u,opacity:d?.5:1};return l.jsxs("div",{ref:a,style:f,className:Lr.row,role:"listitem",children:[r&&l.jsx("span",{className:Lr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(qd,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Lr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Lr.info,children:[l.jsx("span",{className:Lr.name,title:e.name,children:e.name}),l.jsx("span",{className:Lr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Lr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(sn,{size:14})})]})},RI="_container_lzvke_1",kI="_header_lzvke_7",AI="_heading_lzvke_13",PI="_count_lzvke_21",MI="_list_lzvke_30",LI="_emptyState_lzvke_36",FI="_addRow_lzvke_52",Fr={container:RI,header:kI,heading:AI,count:PI,list:MI,emptyState:LI,addRow:FI},$I=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=ke(),i=t?r(t):[],o=e==="edit",a=yd(ta(Vi,{activationConstraint:{distance:5}}),ta(Ma,{coordinateGetter:wI})),c=p.useCallback(d=>{const{active:f,over:m}=d;if(!m||f.id===m.id||!t)return;const g=ke.getState().getChildrenOf(t),_=g.findIndex(y=>y.id===f.id),h=g.findIndex(y=>y.id===m.id);_<0||h<0||n(t,_,h)},[t,n]),u=p.useCallback(d=>{window.confirm("Remove this content from the unit?")&&s(d)},[s]);return t?l.jsxs("div",{className:Fr.container,children:[l.jsxs("div",{className:Fr.header,children:[l.jsx("span",{className:Fr.heading,children:"Content in this unit"}),l.jsx("span",{className:Fr.count,children:i.length})]}),i.length>0?l.jsx(Md,{sensors:a,collisionDetection:Bg,onDragEnd:c,children:l.jsx(dI,{items:i.map(d=>d.id),strategy:cI,children:l.jsx("div",{className:Fr.list,role:"list",children:i.map(d=>l.jsx(jI,{item:d,onRemove:u,isEditable:o},d.id))})})}):l.jsxs("div",{className:Fr.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:Fr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(As,{size:14})," Add content"]})]}):null},BI="_dropZone_ijo5w_1",VI="_active_ijo5w_14",Pu={dropZone:BI,active:VI},UI=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Pu.dropZone} ${e?Pu.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 zI(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 qI(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 HI="_contentPlayerRoot_ryh6z_1",WI="_stage_ryh6z_9",KI="_playerHeader_ryh6z_19",QI="_playerHeaderThumb_ryh6z_33",GI="_playerHeaderTitle_ryh6z_43",YI="_typeBadge_ryh6z_53",XI="_typeDot_ryh6z_92",ZI="_aspectRatio_ryh6z_99",JI="_playerFrame_ryh6z_112",eN="_coverOverlay_ryh6z_120",tN="_coverHidden_ryh6z_132",rN="_coverThumb_ryh6z_137",nN="_coverPlayRing_ryh6z_146",sN="_coverPlayIcon_ryh6z_159",iN="_coverLabel_ryh6z_168",oN="_coverSkeleton_ryh6z_174",aN="_playerWrapper_ryh6z_200",lN="_infoStrip_ryh6z_210",cN="_infoChip_ryh6z_226",uN="_infoChipLabel_ryh6z_245",dN="_infoChipIcon_ryh6z_254",fN="_playerError_ryh6z_260",hN="_playerErrorIcon_ryh6z_274",pN="_playerErrorMsg_ryh6z_279",gN="_qumlRoot_ryh6z_286",je={contentPlayerRoot:HI,stage:WI,playerHeader:KI,playerHeaderThumb:QI,playerHeaderTitle:GI,typeBadge:YI,typeDot:XI,aspectRatio:ZI,playerFrame:JI,coverOverlay:eN,coverHidden:tN,coverThumb:rN,coverPlayRing:nN,coverPlayIcon:sN,coverLabel:iN,coverSkeleton:oN,playerWrapper:aN,infoStrip:lN,infoChip:cN,infoChipLabel:uN,infoChipIcon:dN,playerError:fN,playerErrorIcon:hN,playerErrorMsg:pN,qumlRoot:gN},mN=[{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 yN(e){return mN.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const vN={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},bN={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},_N={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},wN="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Lo(e){for(const[t,r]of Object.entries(vN))if(r.includes(e))return t;return"default-player"}function xN(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 SN(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 CN(e,t,r=100){await SN(bN[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 EN=[{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 ON({node:e}){const t=e.metadata??{},r=EN.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:je.infoStrip,children:r.map(n=>l.jsxs("div",{className:je.infoChip,children:[n.icon&&l.jsx("span",{className:je.infoChipIcon,children:n.icon}),l.jsx("span",{className:je.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function DN({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${je.coverOverlay} ${t?je.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:je.coverThumb}),l.jsx("div",{className:je.coverPlayRing,children:l.jsx("div",{className:je.coverPlayIcon})}),l.jsx("span",{className:je.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:je.coverSkeleton})})}function IN({message:e}){return l.jsxs("div",{className:je.playerError,children:[l.jsx("span",{className:je.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:je.playerErrorMsg,children:e})]})}function NN({mimeType:e}){const t=yN(e);return l.jsxs("span",{className:je.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:je.typeDot}),t.label]})}const Ia=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(jN,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:je.contentPlayerRoot,children:[l.jsxs("div",{className:je.stage,children:[l.jsxs("div",{className:je.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:je.playerHeaderThumb}),l.jsx("span",{className:je.playerHeaderTitle,children:e.name}),l.jsx(NN,{mimeType:e.mimeType??""})]}),l.jsx(TN,{node:e})]}),l.jsx(ON,{node:e})]})};function TN({node:e}){var y;const t=ve(v=>v.editorConfig),[r,n]=p.useState(()=>Lo(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,u]=p.useState(e.metadata??{}),[d,f]=p.useState(!1),m=p.useRef(null),g=p.useRef(null),_=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??wN;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),u(e.metadata??{}),n(Lo(e.mimeType??"")),qI(e.identifier).then(b=>{if(v)return;const x={...e.metadata??{},...b};u(x);const w=b.mimeType??e.mimeType??"";n(Lo(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=xN(e,c,t);return p.useEffect(()=>{if(!d||r!=="default-player")return;const v=m.current;if(!v)return;v.src=_;const b=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},x=()=>a("Preview player could not be loaded.");return v.addEventListener("load",b),v.addEventListener("error",x),()=>{v.removeEventListener("load",b),v.removeEventListener("error",x),v.src=""}},[e.identifier,r,_,d]),p.useEffect(()=>{if(!d||r==="default-player")return;const v=g.current;if(!v)return;const b=_N[r];if(!b)return;const x=h;CN(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(x)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=x}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,d]),l.jsxs("div",{className:je.aspectRatio,children:[o?l.jsx(IN,{message:o}):l.jsx(DN,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:m,id:"contentPlayer",title:e.name,className:je.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:je.playerFrame})]})}function jN({node:e,editorMode:t}){const r=ve(s=>s.editorConfig),n=p.useRef(null);return p.useEffect(()=>{var a;if(!n.current)return;const s=r==null?void 0:r.context,i={context:{mode:t==="edit"?"edit":"play",pdata:{id:((a=s==null?void 0:s.pdata)==null?void 0:a.id)??"sunbird.portal",ver:"1.0",pid:"sunbird-portal"},contentId:e.identifier,sid:(s==null?void 0:s.sid)??"",uid:(s==null?void 0:s.uid)??"",channel:(s==null?void 0:s.channel)??"",did:(s==null?void 0:s.did)??""},config:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1},metadata:e.metadata??{},data:{}},o=document.createElement("sunbird-quml-player");o.setAttribute("player-config",JSON.stringify(i)),n.current.innerHTML="",n.current.appendChild(o)},[e.identifier,t]),l.jsx("div",{className:je.qumlRoot,children:l.jsx("div",{ref:n,className:je.playerWrapper})})}const RN="_overlay_ifddx_1",kN="_modal_ifddx_11",AN="_header_ifddx_21",PN="_body_ifddx_37",MN="_hint_ifddx_43",LN="_list_ifddx_49",FN="_item_ifddx_55",$N="_selected_ifddx_68",BN="_empty_ifddx_73",VN="_footer_ifddx_79",UN="_cancelBtn_ifddx_87",zN="_moveBtn_ifddx_95",Ft={overlay:RN,modal:kN,header:AN,body:PN,hint:MN,list:LN,item:FN,selected:$N,empty:BN,footer:VN,cancelBtn:UN,moveBtn:zN};function qN(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 HN=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var d;const{treeData:s,moveNode:i}=ke(),o=qN(s,((d=s[0])==null?void 0:d.id)??"",r),[a,c]=p.useState(null),u=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Ft.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Ft.modal,children:[l.jsxs("div",{className:Ft.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:16})})]}),l.jsxs("div",{className:Ft.body,children:[l.jsx("p",{className:Ft.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Ft.list,children:[o.map(f=>l.jsxs("li",{className:`${Ft.item} ${a===f.id?Ft.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(ly,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Ft.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Ft.footer,children:[l.jsx("button",{className:Ft.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Ft.moveBtn,onClick:u,disabled:!a,children:"Move here"})]})]})})},WN="_overlay_16at9_1",KN="_modal_16at9_11",QN="_header_16at9_21",GN="_body_16at9_37",YN="_table_16at9_43",XN="_pageInput_16at9_61",ZN="_empty_16at9_68",JN="_footer_16at9_74",eT="_cancelBtn_16at9_82",tT="_saveBtn_16at9_90",tr={overlay:WN,modal:KN,header:QN,body:GN,table:YN,pageInput:XN,empty:ZN,footer:JN,cancelBtn:eT,saveBtn:tT};function rT(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 nT=({onClose:e})=>{const{treeData:t,updateNode:r}=ke(),n=rT(t),[s,i]=p.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=p.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:tr.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:tr.modal,children:[l.jsxs("div",{className:tr.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(sn,{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(yy,{size:14})," Save"]})]})]})})},sT="_container_1a7t2_1",iT="_panelHeader_1a7t2_10",oT="_panelHeaderLeft_1a7t2_19",aT="_panelCollapseBtn_1a7t2_27",lT="_titleRow_1a7t2_46",cT="_field_1a7t2_47",uT="_moveBtn_1a7t2_64",dT="_icon_1a7t2_84",fT="_nameInput_1a7t2_93",hT="_fieldHeader_1a7t2_118",pT="_label_1a7t2_124",gT="_fieldCount_1a7t2_133",mT="_chips_1a7t2_170",yT="_chip_1a7t2_170",vT="_chipRemove_1a7t2_188",bT="_keywordInput_1a7t2_202",_T="_input_1a7t2_207",wT="_addBtn_1a7t2_220",xT="_radioGroup_1a7t2_234",ST="_radioLabel_1a7t2_239",Me={container:sT,panelHeader:iT,panelHeaderLeft:oT,panelCollapseBtn:aT,titleRow:lT,field:cT,moveBtn:uT,icon:dT,nameInput:fT,fieldHeader:hT,label:pT,fieldCount:gT,chips:mT,chip:yT,chipRemove:vT,keywordInput:bT,input:_T,addBtn:wT,radioGroup:xT,radioLabel:ST},CT=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var k,U;const{updateNode:s,markDirty:i}=ke(),o=t==="edit",a=Ji(e),c=ve(A=>A.relationalFormConfig),u=A=>c==null?void 0:c.find(q=>q.code===A),d=A=>!c||!!u(A),f=(A,q)=>{var L;return((L=u(A))==null?void 0:L.label)||q},[m,g]=p.useState(!0),_=((k=e.metadata)==null?void 0:k.relationalMetadata)??{},[h,y]=p.useState(_.name??e.name??""),[v,b]=p.useState(""),[x,w]=p.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((U=e.metadata)==null?void 0:U.keywords)?e.metadata.keywords:[]),[S,O]=p.useState(!!_.optional);p.useEffect(()=>{var q,L;const A=((q=e.metadata)==null?void 0:q.relationalMetadata)??{};y(A.name??e.name??""),w(Array.isArray(A.keywords)?A.keywords:Array.isArray((L=e.metadata)==null?void 0:L.keywords)?e.metadata.keywords:[]),O(!!A.optional)},[e.id]);const T=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},R=()=>{const A=v.trim();if(A&&!x.includes(A)){const q=[...x,A];w(q),s(e.id,{keywords:q}),i()}b("")},M=A=>{const q=x.filter(L=>L!==A);w(q),s(e.id,{keywords:q}),i()},j=A=>{O(A),s(e.id,{optional:A}),i()};return l.jsxs("div",{className:Me.container,children:[l.jsxs("div",{className:Me.panelHeader,children:[l.jsxs("div",{className:Me.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Me.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Me.panelCollapseBtn,onClick:()=>g(A=>!A),"aria-expanded":m,"aria-label":m?"Collapse metadata panel":"Expand metadata panel",title:m?"Collapse":"Expand",children:m?l.jsx(ks,{size:15}):l.jsx(iy,{size:15})})]}),m&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Me.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Me.icon}),l.jsx("input",{type:"text",className:Me.nameInput,value:h,disabled:!o,onChange:A=>y(A.target.value),onBlur:T,placeholder:"Content name"})]}),d("keywords")&&l.jsxs("div",{className:Me.field,children:[l.jsx("div",{className:Me.fieldHeader,children:l.jsxs("label",{className:Me.label,children:[f("keywords","Keywords"),x.length>0&&l.jsx("span",{className:Me.fieldCount,children:x.length})]})}),x.length>0&&l.jsx("div",{className:Me.chips,children:x.map(A=>l.jsxs("span",{className:Me.chip,children:[A,o&&l.jsx("button",{type:"button",className:Me.chipRemove,onClick:()=>M(A),children:"×"})]},A))}),o&&l.jsxs("div",{className:Me.keywordInput,children:[l.jsx("input",{type:"text",className:Me.input,value:v,placeholder:"Add keyword and press Enter",onChange:A=>b(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),R())}}),l.jsx("button",{type:"button",className:Me.addBtn,onClick:R,children:"Add"})]})]}),d("optional")&&l.jsxs("div",{className:Me.field,children:[l.jsx("label",{className:Me.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Me.radioGroup,children:[l.jsxs("label",{className:Me.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:S===!0,onChange:()=>j(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Me.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:S===!1,onChange:()=>j(!1),disabled:!o}),"No"]})]})]})]}),n]})},ET="_iconBtn_vl14u_1",OT="_editable_vl14u_14",DT="_iconImg_vl14u_26",IT="_placeholder_vl14u_34",NT="_removeBtn_vl14u_41",rs={iconBtn:ET,editable:OT,iconImg:DT,placeholder:IT,removeBtn:NT},TT=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=ke(),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:[rs.iconBtn,r?rs.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:rs.iconImg}):l.jsx("div",{className:rs.placeholder,children:l.jsx(Hd,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:rs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(qa,{size:11})})]}),n&&l.jsx($h,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},jT="_leafContentLayout_1osey_1",RT="_container_1osey_17",kT="_emptyState_1osey_26",AT="_titleRow_1osey_36",PT="_nodeTitle_1osey_52",MT="_formArea_1osey_74",LT="_contentListArea_1osey_78",FT="_dropZone_1osey_83",$T="_reviewComment_1osey_90",BT="_reviewCommentLabel_1osey_103",VT="_reviewCommentText_1osey_109",zt={leafContentLayout:jT,container:RT,emptyState:kT,titleRow:AT,nodeTitle:PT,formArea:MT,contentListArea:LT,dropZone:FT,reviewComment:$T,reviewCommentLabel:BT,reviewCommentText:VT},UT=["application/vnd.sunbird.questionset"],zT=({editorMode:e,onToolbarEvent:t})=>{var k,U,A,q;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,u]=p.useState(!1),d=p.useRef(null),f=p.useRef(),{selectedNodeId:m,breadcrumb:g,activeNodeMeta:_,updateNode:h,treeData:y}=ke(),v=ve(L=>{var se,ce,W,B;return((ce=(se=L.editorConfig)==null?void 0:se.context)==null?void 0:ce.contentId)??((B=(W=L.editorConfig)==null?void 0:W.context)==null?void 0:B.identifier)??""}),b=m?Wh(y,m):null,x=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),S=b&&UT.includes(b.mimeType??""),O=b&&!b.isFolder&&!S&&!x,T=((k=b==null?void 0:b.metadata)==null?void 0:k.rejectComment)??(x?(A=(U=y[0])==null?void 0:U.metadata)==null?void 0:A.rejectComment:void 0),R=p.useCallback(()=>{const L=d.current;if(!L||!m)return;const se=L.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(m,{name:se})},600)},[m,h]),M=p.useCallback(L=>{t({action:"onFormValueChange",data:L})},[t]),j=p.useCallback((L,se)=>{i(se),t({action:"onFormStatusChange",data:{isValid:L}})},[t]);return b?S?l.jsx(Ia,{node:b,editorMode:e,type:"quml"}):O?l.jsxs("div",{className:zt.leafContentLayout,children:[l.jsx(Ia,{node:b,editorMode:e,type:"content"}),l.jsx(CT,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(HN,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:zt.container,children:[l.jsx(zE,{crumbs:g}),T&&l.jsxs("div",{className:zt.reviewComment,role:"alert",children:[l.jsx("span",{className:zt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:zt.reviewCommentText,children:T})]}),l.jsxs("div",{className:zt.titleRow,children:[x&&m&&l.jsx(TT,{nodeId:m,value:String(b.appIcon??((q=b.metadata)==null?void 0:q.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:d,className:zt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:R,onBlur:R,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(GE,{activeTab:r,onChange:L=>n(L),errorTabs:s,visibleTabs:x?void 0:["details"]}),l.jsx("div",{className:zt.formArea,children:l.jsx(iI,{nodeMetadata:_,activeTab:r,isRoot:x,isFolder:w,editorMode:e,onFormValueChange:M,onFormStatusChange:j},`${m??"none"}:${x?"root":"node"}`)}),(w||x)&&r==="details"&&l.jsx("div",{className:zt.contentListArea,children:l.jsx($I,{editorMode:e})}),l.jsx(UI,{isActive:!1,label:"Drop to add content to this unit",nodeId:m??void 0,className:zt.dropZone}),c&&l.jsx(nT,{contentId:v,onClose:()=>u(!1)})]}):l.jsx("div",{className:zt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Wh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Wh(r.children,t);if(n)return n}}}const Kh=qi((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),qT=20;function Qh(){var u;const e=ve(d=>d.editorConfig),t=ke(d=>d.selectedNodeId),r=ke(d=>d.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function d(f,m,g=0){var _;for(const h of f){if(h.id===m)return g;if((_=h.children)!=null&&_.length){const y=d(h.children,m,g+1);if(y>=0)return y}}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[...gu];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:[...gu]}function HT(){const e=Kh(),t=ve(f=>{var m,g;return((g=(m=f.editorConfig)==null?void 0:m.context)==null?void 0:g.channel)??""}),r=Qh(),n=p.useRef(),s=p.useCallback(async(f="",m="all",g={},_=!0,h=!1)=>{var y,v,b,x,w;e.setLoading(!0);try{const S={status:["Live"],contentType:["Resource"],primaryCategory:m&&m!=="all"?[m]:r};(y=g==null?void 0:g.board)!=null&&y.length&&(S.board=g.board),(v=g==null?void 0:g.medium)!=null&&v.length&&(S.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(S.gradeLevel=g.gradeLevel),(x=g==null?void 0:g.subject)!=null&&x.length&&(S.subject=g.subject),(w=g==null?void 0:g.primaryCategory)!=null&&w.length&&(S.primaryCategory=g.primaryCategory);const O=_?0:e.offset,{content:T,count:R}=await zI({filters:S,query:f,limit:f?50:qT,offset:O,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(T,R):e.appendContent(T,R)}catch(S){console.error("[useLibrary] load error:",S)}finally{e.setLoading(!1)}},[r,t]);p.useEffect(()=>{s()},[t]);const i=p.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=p.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=p.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=p.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),u=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),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 WT="_card_grbmp_1",KT="_addBtn_grbmp_17",QT="_dragging_grbmp_24",GT="_ctIcon_grbmp_29",YT="_info_grbmp_33",XT="_name_grbmp_41",ZT="_meta_grbmp_50",JT="_added_grbmp_78",ej="_addedBadge_grbmp_87",cr={card:WT,addBtn:KT,dragging:QT,ctIcon:GT,info:YT,name:XT,meta:ZT,added:JT,addedBadge:ej},tj={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},rj=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=Ji(e),o=tj[i.key]??zn,a=ll(),c=E1(),u=a&&!s&&c,{attributes:d,listeners:f,setNodeRef:m,isDragging:g}=Ld({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:m,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:[((h=e.organisation)==null?void 0:h[0])??e.channel??"",(y=e.organisation)!=null&&y[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:cr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Un,{size:12})}),!s&&l.jsx("button",{type:"button",className:cr.addBtn,onClick:v=>{v.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(As,{size:14})})]})},nj="_chips_xhhaq_1",sj="_chip_xhhaq_1",Mu={chips:nj,chip:sj},ij=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Mu.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",Mu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),oj="_panel_1cl11_1",aj="_header_1cl11_10",lj="_headerTitle_1cl11_19",cj="_closeBtn_1cl11_25",uj="_body_1cl11_43",dj="_section_1cl11_59",fj="_sectionLabel_1cl11_65",hj="_chips_1cl11_73",pj="_chip_1cl11_73",gj="_active_1cl11_96",mj="_footer_1cl11_102",yj="_resetBtn_1cl11_112",vj="_applyBtn_1cl11_129",Ze={panel:oj,header:aj,headerTitle:lj,closeBtn:cj,body:uj,section:dj,sectionLabel:fj,chips:hj,chip:pj,active:gj,footer:mj,resetBtn:yj,applyBtn:vj},bj=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],_j=new Set(["board","medium","gradeLevel","subject","topic"]),wj=({local:e,toggle:t})=>{const r=Qh();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},xj=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=ve(h=>h.editorConfig),i=ve(h=>h.searchFormConfig),{organisationFramework:o}=Ph((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=p.useState(t),u=i!=null&&i.length?i.filter(h=>_j.has(h.code)).map(h=>({key:h.code,label:h.label||h.code})):bj;p.useEffect(()=>{c(t)},[t]);const d=(h,y)=>{c(v=>{const b=v[h]??[],x=b.includes(y)?b.filter(w=>w!==y):[...b,y];return{...v,[h]:x}})},f=(o==null?void 0:o.categories)??[],m=h=>{var y;return((y=f.find(v=>v.code===h))==null?void 0:y.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(sn,{size:16})})]}),l.jsxs("div",{className:Ze.body,children:[u.map(({key:h,label:y})=>{const v=m(h);return v.length?l.jsxs("div",{className:Ze.section,children:[l.jsx("div",{className:Ze.sectionLabel,children:y}),l.jsx("div",{className:Ze.chips,children:v.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[Ze.chip,(a[h]??[]).includes(b.name)?Ze.active:""].join(" "),onClick:()=>d(h,b.name),children:b.name},b.identifier))})]},h):null}),l.jsx(wj,{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},Sj="_header_6qdpu_10",Cj="_title_6qdpu_20",Ej="_headerActions_6qdpu_31",Oj="_iconBtn_6qdpu_38",Dj="_playerArea_6qdpu_56",Ij="_footer_6qdpu_64",Nj="_addBtn_6qdpu_73",Tj="_modalOverlay_6qdpu_92",jj="_modalPanel_6qdpu_103",ur={header:Sj,title:Cj,headerActions:Ej,iconBtn:Oj,playerArea:Dj,footer:Ij,addBtn:Nj,modalOverlay:Tj,modalPanel:jj},Rj=({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 Rr.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(sn,{size:16})})})]}),l.jsx("div",{className:ur.playerArea,children:l.jsx(Ia,{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)},kj="_dock_1lpg0_1",Aj="_header_1lpg0_8",Pj="_headerLeft_1lpg0_17",Mj="_headerTitle_1lpg0_24",Lj="_count_1lpg0_30",Fj="_searchRow_1lpg0_39",$j="_searchWrap_1lpg0_47",Bj="_searchIcon_1lpg0_53",Vj="_searchInput_1lpg0_62",Uj="_filterToggleBtn_1lpg0_80",zj="_filterToggleBtnActive_1lpg0_99",qj="_filterBadge_1lpg0_105",Hj="_filters_1lpg0_124",Wj="_mainArea_1lpg0_134",Kj="_sidePanelOverlay_1lpg0_143",Qj="_cardList_1lpg0_152",Gj="_skeleton_1lpg0_168",Yj="_skeletonIcon_1lpg0_178",Xj="_skeletonText_1lpg0_186",Zj="_skeletonLine_1lpg0_193",Jj="_skeletonLineSm_1lpg0_200",eR="_loadMoreBtn_1lpg0_215",tR="_emptyState_1lpg0_240",rR="_collapseBtn_1lpg0_260",Ne={dock:kj,header:Aj,headerLeft:Pj,headerTitle:Mj,count:Lj,searchRow:Fj,searchWrap:$j,searchIcon:Bj,searchInput:Vj,filterToggleBtn:Uj,filterToggleBtnActive:zj,filterBadge:qj,filters:Hj,mainArea:Wj,sidePanelOverlay:Kj,cardList:Qj,skeleton:Gj,skeletonIcon:Yj,skeletonText:Xj,skeletonLine:Zj,skeletonLineSm:Jj,loadMoreBtn:eR,emptyState:tR,collapseBtn:rR};function nR(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 sR=({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:m,toggleSort:g,loadMore:_}=HT(),{addResource:h,selectedNodeId:y,treeData:v}=ke(),b=e==="edit",[x,w]=p.useState(!1),[S,O]=p.useState({}),[T,R]=p.useState(null),M=p.useMemo(()=>nR(v),[v]),j=p.useCallback(L=>{if(!y){Re.error("Select a unit first");return}h(L,y),Re.success(`Added "${L.name}"`)},[y,h]),k=p.useCallback(L=>{O(L),m(L)},[m]),U=p.useCallback(L=>{R(L)},[]),A=p.useCallback(L=>{j(L),R(null)},[j]),q=p.useMemo(()=>Object.values(S).reduce((L,se)=>L+((se==null?void 0:se.length)??0),0),[S]);return l.jsxs("div",{className:Ne.dock,children:[l.jsx("div",{className:Ne.header,children:l.jsxs("div",{className:Ne.headerLeft,children:[l.jsx("button",{type:"button",className:Ne.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(py,{size:15})}),l.jsx(dy,{size:16}),l.jsx("span",{className:Ne.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ne.count,children:i})]})}),l.jsxs("div",{className:Ne.searchRow,children:[l.jsxs("div",{className:Ne.searchWrap,children:[l.jsx(oa,{size:14,className:Ne.searchIcon}),l.jsx("input",{type:"search",className:Ne.searchInput,placeholder:"Search content…",value:a,onChange:L=>d(L.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ne.filterToggleBtn,c?Ne.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(ny,{size:15}):l.jsx(oy,{size:15})}),l.jsxs("button",{type:"button",className:[Ne.filterToggleBtn,x?Ne.filterToggleBtnActive:""].join(" "),onClick:()=>w(L=>!L),"aria-label":"Toggle advanced filters","aria-pressed":x,title:"Advanced filters",children:[l.jsx(_y,{size:15}),q>0&&l.jsx("span",{className:Ne.filterBadge,children:q})]})]}),l.jsx("div",{className:Ne.filters,children:l.jsx(ij,{filters:O1,active:o,onChange:f})}),l.jsxs("div",{className:Ne.mainArea,children:[l.jsx("div",{className:Ne.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((L,se)=>l.jsxs("div",{className:Ne.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ne.skeletonIcon}),l.jsxs("div",{className:Ne.skeletonText,children:[l.jsx("div",{className:Ne.skeletonLine}),l.jsx("div",{className:Ne.skeletonLineSm})]})]},se)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(L=>l.jsx(rj,{item:L,onAdd:j,onPreview:U,isDraggable:b,isAdded:M.has(L.identifier)},L.identifier)),u&&l.jsx("button",{type:"button",className:Ne.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ne.emptyState,children:[l.jsx(oa,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),x&&l.jsx("div",{className:Ne.sidePanelOverlay,children:l.jsx(xj,{isOpen:x,filters:S,onApply:k,onClose:()=>w(!1)})}),T&&l.jsx(Rj,{content:T,onAdd:A,onClose:()=>R(null)})]})]})};function iR(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(m,g=!1){const _={};for(const[h,y]of Object.entries(m))if(!i.has(h)&&!(g&&o.has(h)))if(a.has(h))Array.isArray(y)?_[h]=y:y!=null&&y!==""?_[h]=[y]:_[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(_[h]=v)}else _[h]=y;return _}function d(m){var _;const g={};for(const h of m.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,...b}=y;if(Object.keys(b).length===0)continue;const x=((_=h.metadata)==null?void 0:_.relationalMetadata)??{};g[h.identifier]={name:h.name,...x,...b}}return g}function f(m,g){var x,w;const _=m.identifier,h=t[_],y=_.startsWith("temp-")||!!(h!=null&&h.isNew),v=!m.isFolder&&!g;if(g||y||h&&!v){let S;if(y)S={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((x=m.metadata)==null?void 0:x.contentType)??"CourseUnit",primaryCategory:((w=m.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:m.name,visibility:"Parent",channel:r,...u(m.metadata??{})};else if(g){const{isNew:O,...T}=h??{};S={...u(m.metadata??{},!0),...u(T,!1),name:m.name}}else{const{isNew:O,...T}=h??{};S={name:m.name,visibility:"Parent",...u(T,!0)}}n[_]={metadata:S,objectType:m.objectType||(m.isFolder?"Collection":"Content"),root:g,isNew:y}}const b=m.isFolder?d(m):{};s[_]={name:m.name,children:(m.children??[]).map(S=>S.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(m.children??[]).forEach(S=>f(S,!1))}return e.forEach((m,g)=>f(m,g===0)),{nodesModified:n,hierarchy:s}}function oR(){const[e,t]=p.useState(!1),r=ke(u=>u.treeCache),n=ke(u=>u.treeData),s=ve(u=>u.isDirty),{setIsDirty:i,setLastSaved:o}=ve(),a=ve(u=>u.editorConfig);return{save:p.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:m,hierarchy:g}=iR(n,r,d);await t_(u,m,g,f);const _=new Date().toISOString();o(_),i(!1)}catch(m){console.error("[useSaveHierarchy] save failed:",m),Re.error("Failed to save. Please try again.")}finally{t(!1)}},[a,e,n,r,i,o]),isSaving:e,isDirty:s,lastSaved:ve.getState().lastSaved}}function aR(e){const t=ve(s=>s.editorConfig),r=ve(s=>s.setButtonLoader);return{runAction:p.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 Re.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 s_(o),Re.success("Content sent for review"),!0;case"reject":{r("rejectCollection",!0);const m=(i==null?void 0:i.comment)??"";return await i_(o,m),Re.success("Content rejected and sent back to the author"),!0}case"publish":return r("publishCollection",!0),await e(),await r_(o,a),Re.success("Content published successfully"),!0;default:return!1}}catch(m){console.error(`[useToolbarActions] ${s} failed`,m);const g=s==="sendForReview"?"send for review":s==="reject"?"reject":"publish";return Re.error(`Failed to ${g}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const lR="_shell_90fon_1",cR="_workspace_90fon_8",uR="_sidebarCollapsed_90fon_16",dR="_dockCollapsed_90fon_19",fR="_dock_90fon_19",hR="_outline_90fon_40",pR="_reopenTab_90fon_45",gR="_outlineHidden_90fon_79",mR="_editor_90fon_86",yR="_dockHidden_90fon_101",vR="_dockReopenTab_90fon_108",bR="_dragChip_90fon_133",_R="_dragChipLabel_90fon_148",Nt={shell:lR,workspace:cR,sidebarCollapsed:uR,dockCollapsed:dR,dock:fR,outline:hR,reopenTab:pR,outlineHidden:gR,editor:mR,dockHidden:yR,dockReopenTab:vR,dragChip:bR,dragChipLabel:_R},wR=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,u]=p.useState(!1),[d,f]=p.useState(!1),{addResource:m,treeData:g}=ke(),_=ke(j=>j.selectedNodeId),{save:h,isSaving:y,isDirty:v,lastSaved:b}=oR(),{runAction:x}=aR(h);p.useEffect(()=>{if(!v)return;const j=k=>{k.preventDefault(),k.returnValue=""};return window.addEventListener("beforeunload",j),()=>window.removeEventListener("beforeunload",j)},[v]);const w=yd(ta(Vi,{activationConstraint:{distance:8}})),S=p.useCallback(j=>{var U;const k=(U=j.active.data.current)==null?void 0:U.item;k&&i(k)},[]),O=p.useCallback(j=>{var L,se;i(null);const k=(L=j.active.data.current)==null?void 0:L.item;if(!k)return;const U=j.over,A=(U==null?void 0:U.id)??_??void 0;if(!A){Re.error("Drop onto a unit to add content");return}const q=(se=g[0])==null?void 0:se.id;if(A===q){Re.error("Drop content onto a unit, not directly on the course.");return}m(k,A),r==null||r(k,A),Re.success(`Added "${k.name}" to unit`)},[_,m,r]),T=p.useCallback(async j=>{if(j.action==="back"&&v){f(!0);return}if(j.action==="saveCollection"){await h(),n==null||n(g),t==null||t(j);return}if(j.action==="sendForReview"||j.action==="reject"||j.action==="publish"){await x(j.action,j.data)&&(t==null||t(j));return}t==null||t(j)},[h,x,t,n,g,v]),R=p.useCallback(async()=>{await h(),f(!1),n==null||n(g),t==null||t({action:"back"})},[h,n,t,g]),M=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Md,{sensors:w,onDragStart:S,onDragEnd:O,children:[l.jsxs("div",{className:Nt.shell,children:[l.jsx(fw,{editorMode:e,isSaving:y,isDirty:v,lastSaved:b,onToolbarEvent:T}),l.jsxs("div",{className:[Nt.workspace,o?Nt.sidebarCollapsed:"",c?Nt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[Nt.outline,o?Nt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(FE,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(j=>!j)})}),o&&l.jsx("button",{className:Nt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:Nt.editor,role:"main","aria-label":"Content editor",children:l.jsx(zT,{editorMode:e,onToolbarEvent:T})}),l.jsx("aside",{className:[Nt.dock,c?Nt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(sR,{editorMode:e,collapsed:c,onToggleCollapse:()=>u(j=>!j)})}),c&&l.jsx("button",{className:Nt.dockReopenTab,onClick:()=>u(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Zm,{dropAnimation:null,children:s?l.jsx("div",{className:Nt.dragChip,children:l.jsx("span",{className:Nt.dragChipLabel,children:s.name})}):null}),d&&l.jsx(hw,{onSave:R,onDiscard:M,onCancel:()=>f(!1),isSaving:y})]})},xR="v4";function SR(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 Lu(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:SR(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 br(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(Lu(i,s))}else n.code&&r.push(Lu(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function CR(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 ER(e,t,r="Collection"){var c,u;const s=(u=(c=(await Fe.post(`/action/object/category/definition/${xR}/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:br(i.create),unitForm:br(i.unitMetadata),childForm:br(i.childMetadata),searchForm:br(i.search??i.searchConfig),relationalForm:br(i.relationalMetadata),publishChecklist:br(i.publishchecklist),reviewChecklist:br(i.review),rfcChecklist:br(i.requestforchangeschecklist),schemaDefaults:CR(o.schema),frameworkMetadata:a.frameworkMetadata??{},sourcingSettings:a.sourcingSettings??{}}}function OR({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:u,setCategoryDefinition:d}=ve(),{setTreeData:f,selectNode:m}=ke();return p.useEffect(()=>{let g=!1;async function _(){var h,y;try{n(!0),i(null),e.apiBaseUrl&&Cf(e.apiBaseUrl),c(e),u(e.config.mode);const v=e.context.contentId??e.context.identifier??"";if(v){const{rootNode:b}=await Df(v);g||(f(b?[b]:[]),b&&m(b.id));const x=e.config.primaryCategory??"Course",w=e.context.channel??"";try{const S=await ER(x,w,e.config.objectType??"Collection");if(!g){d(S);const O=(y=(h=S.sourcingSettings)==null?void 0:h.collection)==null?void 0:y.maxDepth;O&&!e.config.maxDepth&&c({...e,config:{...e.config,maxDepth:O}})}}catch{}}g||a(!0)}catch(v){if(!g){const b=v instanceof Error?v:new Error(String(v));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 DR="_root_qcpw6_1",IR="_loadingState_qcpw6_10",NR="_loadingSpinner_qcpw6_20",TR="_errorState_qcpw6_34",os={root:DR,loadingState:IR,loadingSpinner:NR,errorState:TR},jR=new xp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class RR extends p.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?l.jsxs("div",{className:os.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 kR(e){const{isLoading:t,error:r}=OR({config:e,onError:e.onError}),n=ve(s=>s.editorMode);return t?l.jsxs("div",{className:os.loadingState,children:[l.jsx("div",{className:os.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${os.root}`,children:l.jsx(wR,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Gh=e=>l.jsx(RR,{onError:e.onError,children:l.jsxs(Cp,{client:jR,children:[l.jsx(kR,{...e}),l.jsx(Sg,{position:"top-right",toastOptions:{duration:3e3}})]})}),Ai=Symbol.for("r2wc.reactRender"),Fu=Symbol.for("r2wc.shouldRender"),ei=Symbol.for("r2wc.root");function AR(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function PR(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var $u={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Ai]()}}),e[Ai]()}};function MR(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,m){return i&&(s[d]=!0),typeof d=="symbol"||s[d]||d in u?(e.propTypes&&d in e.propTypes&&$u.expando(m,d,f),Reflect.set(u,d,f,m)):($u.expando(m,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[Fu]=!0,this[Ai]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ei].unmount():r.unmountComponentAtNode(this)},a[Ai]=function(){if(this[Fu]===!0){var u={};Object.keys(this).forEach(function(m){s[m]!==!1&&(u[m]=this[m])},this),i=!0;const d=n.shadow?this.shadowRoot:this,f=t.createElement(e,u);typeof r.createRoot=="function"?(this[ei]||(this[ei]=r.createRoot(d)),this[ei].render(f)):r.render(f,d),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return AR(u)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(u,d,f){var m=n.dashStyleAttributes?PR(u):u;this[m]=f}),o}var as={},ns=Rr;if(process.env.NODE_ENV==="production")as.createRoot=ns.createRoot,as.hydrateRoot=ns.hydrateRoot;else{var ti=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;as.createRoot=function(e,t){ti.usingClientEntryPoint=!0;try{return ns.createRoot(e,t)}finally{ti.usingClientEntryPoint=!1}},as.hydrateRoot=function(e,t,r){ti.usingClientEntryPoint=!0;try{return ns.hydrateRoot(e,t,r)}finally{ti.usingClientEntryPoint=!1}}}function LR(){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 FR(e="sb-collection-editor"){if(LR(),typeof customElements>"u"||customElements.get(e))return;const t=MR(Gh,p,as,{});customElements.define(e,t)}exports.CollectionEditor=Gh;exports.registerCollectionEditor=FR;exports.setApiBaseUrl=Cf;exports.useEditorStore=ve;exports.useLibraryStore=Kh;exports.useTreeStore=ke;
456
+ `+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=rn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&li.assertOptions(n,{silentJSONParsing:lt.transitional(lt.boolean),forcedJSONParsing:lt.transitional(lt.boolean),clarifyTimeoutError:lt.transitional(lt.boolean),legacyInterceptorReqResOrdering:lt.transitional(lt.boolean),advertiseZstdAcceptEncoding:lt.transitional(lt.boolean),validateStatusUndefinedResolves:lt.transitional(lt.boolean)},!1),s!=null&&(E.isFunction(s)?r.paramsSerializer={serialize:s}:li.assertOptions(s,{encode:lt.function,serialize:lt.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),li.assertOptions(r,{baseUrl:lt.spelling("baseURL"),withXsrfToken:lt.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&E.merge(i.common,i[r.method]);i&&E.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=gt.concat(o,i);const a=[];let c=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(r)===!1)return;c=c&&h.synchronous;const y=r.transitional||Ya;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let d,f=0,m;if(!c){const _=[pc.bind(this),void 0];for(_.unshift(...a),_.push(...u),m=_.length,d=Promise.resolve(r);f<m;)d=d.then(_[f++],_[f++]);return d}m=a.length;let g=r;for(;f<m;){const _=a[f++],h=a[f++];try{g=_(g)}catch(y){h.call(this,y);break}}try{d=pc.call(this,g)}catch(_){return Promise.reject(_)}for(f=0,m=u.length;f<m;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=rn(this.defaults,t);const r=vf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return hf(r,t.params,t.paramsSerializer)}};E.forEach(["delete","get","head","options"],function(t){Jr.prototype[t]=function(r,n){return this.request(rn(n||{},{method:t,url:r,data:n&&E.hasOwnProp(n,"data")?n.data:void 0}))}});E.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(rn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Jr.prototype[t]=r(),t!=="query"&&(Jr.prototype[t+"Form"]=r(!0))});let Yb=class xf{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 Fs(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 xf(function(s){t=s}),cancel:t}}};function Xb(e){return function(r){return e.apply(null,r)}}function Zb(e){return E.isObject(e)&&e.isAxiosError===!0}const fa={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(fa).forEach(([e,t])=>{fa[t]=e});function Sf(e){const t=new Jr(e),r=Zd(Jr.prototype.request,t);return E.extend(r,Jr.prototype,t,{allOwnKeys:!0}),E.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Sf(rn(e,s))},r}const ze=Sf(Ls);ze.Axios=Jr;ze.CanceledError=Fs;ze.CancelToken=Yb;ze.isCancel=mf;ze.VERSION=Za;ze.toFormData=Wi;ze.AxiosError=Y;ze.Cancel=ze.CanceledError;ze.all=function(t){return Promise.all(t)};ze.spread=Xb;ze.isAxiosError=Zb;ze.mergeConfig=rn;ze.AxiosHeaders=gt;ze.formToJSON=e=>gf(E.isHTMLForm(e)?new FormData(e):e);ze.getAdapter=wf.getAdapter;ze.HttpStatusCode=fa;ze.default=ze;const{Axios:qR,AxiosError:HR,CanceledError:WR,isCancel:KR,CancelToken:QR,VERSION:GR,all:YR,Cancel:XR,isAxiosError:ZR,spread:JR,toFormData:ek,AxiosHeaders:tk,HttpStatusCode:rk,formToJSON:nk,getAdapter:sk,mergeConfig:ik,create:ok}=ze;let ha="";function Cf(e){ha=e}const $e=ze.create({timeout:3e4});$e.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Qd),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),ha&&(e.baseURL=ha),e});const Of=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function Jb(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:Of,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 e_(e){var r,n,s;return e.length?((s=(n=(r=(await $e.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Of,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 Ef(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=>Ef(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 Df(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=Ef(r);return{content:r,rootNode:n}}async function t_(e,t,r,n){await $e.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})}async function r_(e,t=""){await $e.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function n_(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 s_(e){await $e.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function i_(e,t){await $e.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function o_(e,t){await $e.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const a_="_container_r27rp_1",l_="_header_r27rp_13",c_="_title_r27rp_22",u_="_closeBtn_r27rp_29",d_="_body_r27rp_45",f_="_label_r27rp_54",h_="_searchSection_r27rp_62",p_="_searchRow_r27rp_68",g_="_searchInput_r27rp_74",m_="_searchSpinner_r27rp_89",y_="_resultsList_r27rp_105",v_="_resultItem_r27rp_118",b_="_userInfo_r27rp_133",__="_userName_r27rp_141",w_="_userEmail_r27rp_150",x_="_userOrg_r27rp_158",S_="_noResults_r27rp_167",C_="_collabSection_r27rp_174",O_="_sectionTitle_r27rp_179",E_="_badge_r27rp_189",D_="_emptyCollab_r27rp_203",I_="_collabList_r27rp_214",N_="_collabItem_r27rp_223",T_="_userAvatar_r27rp_237",j_="_error_r27rp_251",R_="_success_r27rp_257",k_="_footer_r27rp_263",be={container:a_,header:l_,title:c_,closeBtn:u_,body:d_,label:f_,searchSection:h_,searchRow:p_,searchInput:g_,searchSpinner:m_,resultsList:y_,resultItem:v_,userInfo:b_,userName:__,userEmail:w_,userOrg:x_,noResults:S_,collabSection:C_,sectionTitle:O_,badge:E_,emptyCollab:D_,collabList:I_,collabItem:N_,userAvatar:T_,error:j_,success:R_,footer:k_},A_=({contentId:e,onClose:t})=>{var k,L;const r=ve(I=>I.editorConfig),n=(k=r==null?void 0:r.context)==null?void 0:k.channel,s=(L=r==null?void 0:r.config)==null?void 0:L.objectType,[i,o]=p.useState(""),[a,c]=p.useState([]),[u,d]=p.useState(!1),[f,m]=p.useState([]),[g,_]=p.useState(!1),[h,y]=p.useState(""),[v,b]=p.useState(!1),x=p.useRef(null);p.useEffect(()=>{let I=!1;return(async()=>{try{const R=await n_(e),M=(R==null?void 0:R.collaborators)??[];if(!M.length)return;const A=await e_(M);if(I)return;const B=M.map(F=>A.find(re=>re.identifier===F)??{identifier:F,firstName:F});m(B)}catch{}})(),()=>{I=!0}},[e]),p.useEffect(()=>{x.current&&clearTimeout(x.current);const I=i.trim();if(I.length<2){c([]);return}return x.current=setTimeout(async()=>{d(!0);try{const R=await Jb(I,{rootOrgId:n,objectType:s}),M=new Set(f.map(A=>A.identifier));c(R.filter(A=>!M.has(A.identifier)))}catch{c([])}finally{d(!1)}},300),()=>{x.current&&clearTimeout(x.current)}},[i,f,n,s]);const w=p.useCallback(I=>{m(R=>R.find(M=>M.identifier===I.identifier)?R:[...R,I]),c(R=>R.filter(M=>M.identifier!==I.identifier)),b(!1)},[]),C=p.useCallback(I=>{m(R=>R.filter(M=>M.identifier!==I)),b(!1)},[]),D=p.useCallback(async()=>{_(!0),y(""),b(!1);try{await o_(e,f.map(I=>I.identifier)),b(!0)}catch{y("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),j=I=>`${I.firstName}${I.lastName?` ${I.lastName}`:""}`;return l.jsxs("div",{className:be.container,children:[l.jsxs("div",{className:be.header,children:[l.jsx("h2",{className:be.title,children:"Manage Collaborators"}),l.jsx("button",{className:be.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:be.body,children:[l.jsxs("div",{className:be.searchSection,children:[l.jsx("label",{className:be.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:be.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:be.searchInput,placeholder:"Search by name or email...",value:i,onChange:I=>o(I.target.value)}),u&&l.jsx("span",{className:be.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:be.resultsList,role:"listbox","aria-label":"Search results",children:a.map(I=>{var R,M,A,B;return l.jsxs("li",{className:be.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:be.userInfo,children:[l.jsx("span",{className:be.userName,children:j(I)}),I.email&&l.jsx("span",{className:be.userEmail,children:I.email}),(((M=(R=I.organisations)==null?void 0:R[0])==null?void 0:M.orgName)??I.rootOrgName)&&l.jsx("span",{className:be.userOrg,children:((B=(A=I.organisations)==null?void 0:A[0])==null?void 0:B.orgName)??I.rootOrgName})]}),l.jsx(De,{variant:"primary",size:"sm",onClick:()=>w(I),children:"Add"})]},I.identifier)})}),i.trim().length>=2&&!u&&a.length===0&&l.jsx("p",{className:be.noResults,children:"No users found."})]}),l.jsxs("div",{className:be.collabSection,children:[l.jsxs("h3",{className:be.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:be.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:be.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:be.collabList,children:f.map(I=>{var R,M,A,B;return l.jsxs("li",{className:be.collabItem,children:[l.jsx("div",{className:be.userAvatar,"aria-hidden":"true",children:j(I).charAt(0).toUpperCase()}),l.jsxs("div",{className:be.userInfo,children:[l.jsx("span",{className:be.userName,children:j(I)}),I.email&&l.jsx("span",{className:be.userEmail,children:I.email}),(((M=(R=I.organisations)==null?void 0:R[0])==null?void 0:M.orgName)??I.rootOrgName)&&l.jsx("span",{className:be.userOrg,children:((B=(A=I.organisations)==null?void 0:A[0])==null?void 0:B.orgName)??I.rootOrgName})]}),l.jsx(De,{variant:"danger",size:"sm",onClick:()=>C(I.identifier),children:"Remove"})]},I.identifier)})})]}),h&&l.jsx("p",{className:be.error,role:"alert",children:h}),v&&l.jsx("p",{className:be.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:be.footer,children:[l.jsx(De,{variant:"ghost",onClick:t,disabled:g,children:"Cancel"}),l.jsx(De,{variant:"primary",isLoading:g,onClick:D,children:"Save"})]})]})};async function P_(e){return(await $e.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function M_(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 L_(e){var r;return((r=(await $e.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}const F_="_topbar_zj8wk_1",$_="_left_zj8wk_15",B_="_right_zj8wk_23",V_="_backBtn_zj8wk_30",U_="_title_zj8wk_49",z_="_statusChip_zj8wk_61",q_="_savedIndicator_zj8wk_73",H_="_unsaved_zj8wk_83",W_="_iconBtn_zj8wk_88",K_="_iconBtnLabel_zj8wk_115",Q_="_qrDropdown_zj8wk_119",G_="_qrMenu_zj8wk_123",Y_="_reviewBtns_zj8wk_158",X_="_sourcingBtns_zj8wk_167",Z_="_modalOverlay_zj8wk_176",J_="_sbOverlay_zj8wk_186",ew="_sbModal_zj8wk_196",tw="_sbModalHeader_zj8wk_207",rw="_sbModalTitle_zj8wk_215",nw="_sbModalClose_zj8wk_222",sw="_sbModalBody_zj8wk_235",iw="_sbLabel_zj8wk_242",ow="_sbTextarea_zj8wk_249",aw="_sbError_zj8wk_266",lw="_sbModalFooter_zj8wk_273",ie={topbar:F_,left:$_,right:B_,backBtn:V_,title:U_,statusChip:z_,savedIndicator:q_,unsaved:H_,iconBtn:W_,iconBtnLabel:K_,qrDropdown:Q_,qrMenu:G_,reviewBtns:Y_,sourcingBtns:X_,modalOverlay:Z_,sbOverlay:J_,sbModal:ew,sbModalHeader:tw,sbModalTitle:rw,sbModalClose:nw,sbModalBody:sw,sbLabel:iw,sbTextarea:ow,sbError:aw,sbModalFooter:lw};function cw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function uw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const mc=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.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})]})]})})},dw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.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"})]})]})})},fw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className: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"})]})]})})},hw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,onToolbarEvent:s})=>{var J,_e;const o=ke(se=>se.treeData)[0],a=(o==null?void 0:o.name)??"Untitled",c=uw(((J=o==null?void 0:o.metadata)==null?void 0:J.status)??(o==null?void 0:o.status)),u=ve(se=>{var ye,oe,ot,Se;return((oe=(ye=se.editorConfig)==null?void 0:ye.context)==null?void 0:oe.contentId)??((Se=(ot=se.editorConfig)==null?void 0:ot.context)==null?void 0:Se.identifier)??""}),{activeModal:d,modalData:f,closeModal:m,openModal:g}=My(),_=ve(se=>se.buttonLoaders),[h,y]=p.useState(!1),[v,b]=p.useState(!1),[x,w]=p.useState(!1),[C,D]=p.useState(!1),j=p.useRef(null),[k,L]=p.useState(!1);p.useEffect(()=>{if(!C)return;const se=ye=>{var oe;(oe=j.current)!=null&&oe.contains(ye.target)||D(!1)};return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[C]);const[I,R]=p.useState(!1),[M,A]=p.useState(!1),{updateNode:B}=ke(),F=(_e=o==null?void 0:o.metadata)==null?void 0:_e.qrCodeProcessId,re=p.useCallback(async se=>{if(u){L(!1),R(!0);try{const{processId:ye,reservedDialcodes:oe}=await M_(u,se);ye&&o&&B(o.id,{qrCodeProcessId:ye,reservedDialcodes:oe}),Ae.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ae.error("Failed to generate QR Codes. Please try again.")}finally{R(!1)}}},[u,o,B]),ce=p.useCallback(async()=>{if(!F){Ae.error("No QR codes generated yet. Generate QR Codes first.");return}A(!0);try{const se=await L_(F);if(se.status==="in-process"){Ae("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const ye=se.url;if(!ye){Ae.error("QR Codes not ready yet. Please wait and try again.");return}const oe=await fetch(ye).then(Pe=>Pe.blob()),ot=await new Promise(Pe=>{const et=new FileReader;et.onloadend=()=>Pe(et.result),et.readAsDataURL(oe)}),Se=(o==null?void 0:o.metadata)??{},Je=Pe=>Array.isArray(Pe)?Pe.join("_"):typeof Pe=="string"?Pe:"",Ke=[u,Je(Se.medium),Je(Se.gradeLevel),Je(Se.subject)].filter(Boolean),Be=new Date().toISOString().replace(/[:.]/g,"-"),te=`${Ke.join("_")}_${Be}.zip`,Re=document.createElement("a");Re.href=ot,Re.download=te,Re.style.display="none",document.body.appendChild(Re),Re.click(),document.body.removeChild(Re),Ae.success("QR codes downloaded.")}catch{Ae.error("Failed to download QR Codes.")}finally{A(!1)}},[F,o,u]),W=e==="edit",U=e==="review",X=e==="sourcingreview",$=e==="read",K=p.useCallback((se,ye)=>{s({action:se,data:ye})},[s]),Z=p.useCallback(()=>{m(),K("publish")},[m,K]),pe=p.useCallback((se,ye)=>{const oe=f==null?void 0:f.action;m(),oe==="approve"?K("sourcingApprove",{comment:se,score:ye}):K("reject",{comment:se})},[m,K,f]),Oe=p.useCallback(se=>{y(!1),K("sendBackForCorrections",{comment:se})},[K]);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:()=>K("back"),"aria-label":"Go back",type:"button",children:l.jsx(ry,{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(Un,{size:14,"aria-hidden":"true"}),"Saved ",cw(n)]}):null,!$&&!U&&!X&&c!=="Review"&&l.jsx(De,{variant:"ghost",size:"sm",onClick:()=>K("saveCollection"),children:"Save as Draft"}),W&&l.jsxs(l.Fragment,{children:[l.jsxs(De,{variant:"primary",size:"sm",onClick:()=>w(!0),disabled:_.saveCollection,isLoading:_.saveCollection,children:[l.jsx(vy,{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(wy,{size:16,"aria-hidden":"true"})}),l.jsxs("div",{className:ie.qrDropdown,ref:j,children:[l.jsxs("button",{className:ie.iconBtn,onClick:()=>D(se=>!se),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":C,children:[l.jsx(zl,{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),L(!0)},disabled:I,children:[l.jsx(zl,{size:14}),I?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{D(!1),ce()},disabled:M||!F,children:[l.jsx(ay,{size:14}),M?"Downloading…":"Download QR Codes"]})]})]})]}),U&&l.jsxs("div",{className:ie.reviewBtns,children:[l.jsxs(De,{variant:"primary",size:"sm",onClick:()=>g("publishChecklist"),disabled:_.publishCollection,isLoading:_.publishCollection,children:[l.jsx(Vd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(De,{variant:"danger",size:"sm",onClick:()=>b(!0),disabled:_.rejectCollection,isLoading:_.rejectCollection,children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]}),l.jsxs(De,{variant:"ghost",size:"sm",onClick:()=>y(!0),children:[l.jsx(my,{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(by,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(De,{variant:"danger",size:"sm",onClick:()=>g("qualityParams",{action:"reject"}),children:[l.jsx(ia,{size:14,"aria-hidden":"true"})," Reject"]})]})]})]}),d==="publishChecklist"&&l.jsx(Jy,{contentId:u,onConfirm:Z,onCancel:m}),d==="qualityParams"&&l.jsx(ev,{contentId:u,action:(f==null?void 0:f.action)??"reject",onConfirm:pe,onCancel:m}),d==="manageCollaborators"&&l.jsx("div",{className:ie.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(A_,{contentId:u,onClose:m})}),x&&l.jsx(dw,{onConfirm:()=>{w(!1),K("sendForReview")},onCancel:()=>w(!1)}),v&&l.jsx(mc,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",submitVariant:"danger",onConfirm:se=>{b(!1),K("reject",{comment:se})},onCancel:()=>b(!1)}),h&&l.jsx(mc,{titleText:"Add Review Comments",labelText:"Enter your comments",placeholderText:"Add comment",submitLabel:"Submit Review",onConfirm:Oe,onCancel:()=>y(!1)}),k&&l.jsx(fw,{onConfirm:re,onCancel:()=>L(!1)})]})},pw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Rr.createPortal(l.jsx("div",{className:Ee.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Ee.modal,children:[l.jsxs("div",{className:Ee.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Ee.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Ee.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:Ee.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 gw=Wa();const If=p.createContext(null);function Et(){const e=p.useContext(If);if(e===null)throw new Error("No Tree Api Provided");return e}const Nf=p.createContext(null);function mw(){const e=p.useContext(Nf);if(e===null)throw new Error("Provide a NodesContext");return e}const Tf=p.createContext(null);function yw(){const e=p.useContext(Tf);if(e===null)throw new Error("Provide a DnDContext");return e}const jf=p.createContext(0);function Rf(){p.useContext(jf)}function ci(e,t,r){return Math.max(Math.min(e,r),t)}function kf(e){return e&&e.isLeaf}function Af(e){return e&&e.isInternal&&!e.isOpen}function Pf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Mf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Lf=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function el(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=el(r,t);if(n)return n}return null}function Ni(e,t){if(t(e),e.children)for(let r of e.children)Ni(r,t)}function Ff(e){const t=Bf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=vw(t,n);break}r==null||r.focus()}function $f(e){const t=Bf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=bw(t,n);break}r==null||r.focus()}function vw(e,t){return t+1<e.length?e[t+1]:e[0]}function bw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Bf(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 is(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function vn(e){return typeof e=="string"?e:e.id}function _w(e,...t){if(e)return e(...t)}function Vf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function Uf(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 zf(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const ww=Object.freeze(Object.defineProperty({__proto__:null,access:is,bound:ci,dfs:el,focusNextElement:Ff,focusPrevElement:$f,getInsertIndex:Uf,getInsertParentId:zf,identify:vn,indexOf:Lf,isClosed:Af,isDescendant:Mf,isItem:kf,isOpenWithEmptyChildren:Pf,safeRun:_w,waitFor:Vf,walk:Ni},Symbol.toStringTag,{value:"Module"})),xw={display:"flex",alignItems:"center",zIndex:1},Sw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Cw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Ow=p.memo(function({top:t,left:r,indent:n}){const s={position:"absolute",pointerEvents:"none",top:t-2+"px",left:r+"px",right:n+"px"};return l.jsxs("div",{style:Object.assign(Object.assign({},xw),s),children:[l.jsx("div",{style:Object.assign({},Cw)}),l.jsx("div",{style:Object.assign({},Sw)})]})});function Ew({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 Dw(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(Nw,Object.assign({},e)):l.jsx(Iw,Object.assign({},e))]})}function Iw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function Nw({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const _s="__REACT_ARBORIST_INTERNAL_ROOT__";function yc(e){var t;function r(i,o,a){const c=e.accessId(i),u=new ws({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 ws({tree:e,id:_s,data:{id:_s},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class ws{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===_s}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new ws(Object.assign({},this))}edit(){return this.tree.edit(this)}}function bo(e){return{type:"EDIT",id:e}}function Tw(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function cn(e){return{type:"FOCUS",id:e}}function jw(){return{type:"TREE_BLUR"}}function Rw(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 vc(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 kw(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:vc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:vc(e.unfiltered,t)}):e}const Ln=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}}},vr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:vn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(vn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(vn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:vn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:vn(e)})};function Aw(e=Ln().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 Fn={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 Pw(e=Ln().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 Ln().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Mw={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Lw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},Fw=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function qf({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs($w,{isDragging:s,children:[l.jsx(Bw,{offset:e,children:l.jsx(Uw,{id:r,dragIds:n})}),l.jsx(Vw,{mouse:t,count:n.length})]})}const $w=p.memo(function(t){return t.isDragging?l.jsx("div",{style:Mw,children:t.children}):null});function Bw(e){return l.jsx("div",{className:"row preview",style:Lw(e.offset),children:e.children})}function Vw(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:Fw(r),children:t}):null}const Uw=p.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 bc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ma(e,t){return ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},ma(e,t)}function zw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ma(e,t)}var _c=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function qw(e,t){return!!(e===t||_c(e)&&_c(t))}function Hw(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!qw(e[r],t[r]))return!1;return!0}function _o(e,t){t===void 0&&(t=Hw);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 Ww=typeof performance=="object"&&typeof performance.now=="function",wc=Ww?function(){return performance.now()}:function(){return Date.now()};function xc(e){cancelAnimationFrame(e.id)}function Kw(e,t){var r=wc();function n(){wc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var wo=-1;function Sc(e){if(e===void 0&&(e=!1),wo===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),wo=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return wo}var un=null;function Cc(e){if(e===void 0&&(e=!1),un===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?un="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?un="negative":un="positive-ascending"),document.body.removeChild(t),un}return un}process.env.NODE_ENV;var Qw=150,Gw=function(t,r){return t},ui=null,di=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ui=new WeakSet,di=new WeakSet);function Hf(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){zw(m,f);function m(_){var h;return h=f.call(this,_)||this,h._instanceProps=c(h.props,bc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:bc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=_o(function(y,v,b,x){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:x})}),h._callOnScroll=void 0,h._callOnScroll=_o(function(y,v,b){return h.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:b})}),h._getItemStyle=void 0,h._getItemStyle=function(y){var v=h.props,b=v.direction,x=v.itemSize,w=v.layout,C=h._getItemStyleCache(u&&x,u&&w,u&&b),D;if(C.hasOwnProperty(y))D=C[y];else{var j=r(h.props,y,h._instanceProps),k=s(h.props,y,h._instanceProps),L=b==="horizontal"||w==="horizontal",I=b==="rtl",R=L?j:0;C[y]=D={position:"absolute",left:I?void 0:R,right:I?R:void 0,top:L?0:j,height:L?"100%":k,width:L?k:"100%"}}return D},h._getItemStyleCache=void 0,h._getItemStyleCache=_o(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,x=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===x)return null;var D=h.props.direction,j=x;if(D==="rtl")switch(Cc()){case"negative":j=-x;break;case"positive-descending":j=w-b-x;break}return j=Math.max(0,Math.min(j,w-b)),{isScrolling:!0,scrollDirection:C.scrollOffset<j?"forward":"backward",scrollOffset:j,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._onScrollVertical=function(y){var v=y.currentTarget,b=v.clientHeight,x=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var D=Math.max(0,Math.min(w,x-b));return{isScrolling:!0,scrollDirection:C.scrollOffset<D?"forward":"backward",scrollOffset:D,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&xc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=Kw(h._resetIsScrolling,Qw)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}m.getDerivedStateFromProps=function(h,y){return Yw(h,y),d(h),null};var g=m.prototype;return g.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,x=v.layout,w=this.state.scrollOffset;h=Math.max(0,Math.min(h,b-1));var C=0;if(this._outerRef){var D=this._outerRef;x==="vertical"?C=D.scrollWidth>D.clientWidth?Sc():0:C=D.scrollHeight>D.clientHeight?Sc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},g.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var x=this._outerRef;y==="horizontal"||b==="horizontal"?x.scrollLeft=v:x.scrollTop=v}this._callPropsCallbacks()},g.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,x=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Cc()){case"negative":C.scrollLeft=-x;break;case"positive-ascending":C.scrollLeft=x;break;default:var D=C.clientWidth,j=C.scrollWidth;C.scrollLeft=j-D-x;break}else C.scrollLeft=x;else C.scrollTop=x}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&xc(this._resetIsScrollingTimeoutId)},g.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,x=h.height,w=h.innerRef,C=h.innerElementType,D=h.innerTagName,j=h.itemCount,k=h.itemData,L=h.itemKey,I=L===void 0?Gw:L,R=h.layout,M=h.outerElementType,A=h.outerTagName,B=h.style,F=h.useIsScrolling,re=h.width,ce=this.state.isScrolling,W=b==="horizontal"||R==="horizontal",U=W?this._onScrollHorizontal:this._onScrollVertical,X=this._getRangeToRender(),$=X[0],K=X[1],Z=[];if(j>0)for(var pe=$;pe<=K;pe++)Z.push(p.createElement(y,{data:k,key:I(pe,k),index:pe,isScrolling:F?ce:void 0,style:this._getItemStyle(pe)}));var Oe=n(this.props,this._instanceProps);return p.createElement(M||A||"div",{className:v,onScroll:U,ref:this._outerRefSetter,style:ga({position:"relative",height:x,width:re,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},B)},p.createElement(C||D||"div",{children:Z,ref:w,style:{height:W?"100%":Oe,pointerEvents:ce?"none":void 0,width:W?Oe:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],b=y[1],x=y[2],w=y[3];this._callOnItemsRendered(v,b,x,w)}}if(typeof this.props.onScroll=="function"){var C=this.state,D=C.scrollDirection,j=C.scrollOffset,k=C.scrollUpdateWasRequested;this._callOnScroll(D,j,k)}},g._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,x=b.isScrolling,w=b.scrollDirection,C=b.scrollOffset;if(y===0)return[0,0,0,0];var D=o(this.props,C,this._instanceProps),j=a(this.props,D,C,this._instanceProps),k=!x||w==="backward"?Math.max(1,v):1,L=!x||w==="forward"?Math.max(1,v):1;return[Math.max(0,D-k),Math.max(0,Math.min(y-1,j+L)),D,j]},m}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Yw=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":ui&&!ui.has(d)&&(ui.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.'))}},Xw=50,_n=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]},Zw=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?Wf(t,r,i,0,n):Jw(t,r,Math.max(0,i),n)},Wf=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=_n(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},Jw=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&_n(t,n,r).offset<s;)n+=o,o*=2;return Wf(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Oc=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},ex=Hf({getItemOffset:function(t,r,n){return _n(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Oc,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",m=f?d:c,g=_n(t,r,i),_=Oc(t,i),h=Math.max(0,Math.min(_-m,g.offset)),y=Math.max(0,g.offset-m+g.size+o);switch(n==="smart"&&(s>=y-m&&s<=h+m?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return Zw(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,m=_n(t,r,s),g=n+f,_=m.offset+m.size,h=r;h<a-1&&_<g;)h++,_+=_n(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||Xw,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.'))}}),tx=Hf({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,m=t.width,g=a==="horizontal"||f==="horizontal",_=g?m:c,h=Math.max(0,u*d-_),y=Math.min(h,r*d),v=Math.max(0,r*d-_+d+o);switch(n==="smart"&&(s>=v-_&&s<=y+_?n="auto":n="center"),n){case"start":return y;case"end":return v;case"center":{var b=Math.round(v+(y-v)/2);return b<Math.ceil(_/2)?0:b>h+Math.floor(_/2)?h:b}case"auto":default:return s>=v&&s<=y?s:s<v?v:y}},getStartIndexForOffset:function(t,r){var n=t.itemCount,s=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/s)))},getStopIndexForStartIndex:function(t,r,n){var s=t.direction,i=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,d=s==="horizontal"||c==="horizontal",f=r*a,m=d?u:i,g=Math.ceil((m+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 rx(){var e,t;const r=Et(),s=yw().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 nx=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 sx=p.forwardRef(function(t,r){const{children:n}=t,s=nx(t,["children"]),i=Et();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(ix,{}),n]}))}),ix=()=>{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(rx,{})})};var ox=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 ax=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=ox(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 Kf=p.createContext({dragDropManager:void 0}),Bt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(Bt||(Bt={}));function ae(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 tl="dnd-core/INIT_COORDS",Qi="dnd-core/BEGIN_DRAG",rl="dnd-core/PUBLISH_DRAG_SOURCE",Gi="dnd-core/HOVER",Yi="dnd-core/DROP",Xi="dnd-core/END_DRAG";function Ec(e,t){return{type:tl,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function fi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fi=function(r){return typeof r}:fi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fi(e)}function lx(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function cx(e,t){return e.filter(function(r){return r!==t})}function Qf(e){return fi(e)==="object"}function ux(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 dx(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var fx={type:tl,payload:{clientOffset:null,sourceClientOffset:null}};function hx(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(Ec(o)),px(r,c,u);var d=yx(r,c);if(d===null){e.dispatch(fx);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");gx(a),f=a(d)}e.dispatch(Ec(o,f));var m=u.getSource(d),g=m.beginDrag(c,d);if(g!=null){mx(g),u.pinSource(d);var _=u.getSourceType(d);return{type:Qi,payload:{itemType:_,item:g,sourceId:d,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function px(e,t,r){ae(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){ae(r.getSource(n),"Expected sourceIds to be registered.")})}function gx(e){ae(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function mx(e){ae(Qf(e),"Item must be an object.")}function yx(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 vx(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:rl}}}function ya(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function bx(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;_x(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();wx(i,o,a);var c=o.getItemType();return xx(i,a,c),Sx(i,o,a),{type:Gi,payload:{targetIds:i,clientOffset:s||null}}}}function _x(e){ae(Array.isArray(e),"Expected targetIds to be an array.")}function wx(e,t,r){ae(t.isDragging(),"Cannot call hover while not dragging."),ae(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];ae(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);ae(i,"Expected targetIds to be registered.")}}function xx(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);ya(i,r)||e.splice(n,1)}}function Sx(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Dc(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 Ic(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dc(Object(r),!0).forEach(function(n){Cx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ox(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();Ex(n);var i=Nx(n);i.forEach(function(o,a){var c=Dx(o,a,s,n),u={type:Yi,payload:{dropResult:Ic(Ic({},r),c)}};e.dispatch(u)})}}function Ex(e){ae(e.isDragging(),"Cannot call drop while not dragging."),ae(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Dx(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return Ix(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function Ix(e){ae(typeof e>"u"||Qf(e),"Drop result must either be an object or undefined.")}function Nx(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Tx(e){return function(){var r=e.getMonitor(),n=e.getRegistry();jx(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:Xi}}}function jx(e){ae(e.isDragging(),"Cannot call endDrag while not dragging.")}function Rx(e){return{beginDrag:hx(e),publishDragSource:vx(e),hover:bx(e),drop:Ox(e),endDrag:Tx(e)}}function kx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ax(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 Px(e,t,r){return t&&Ax(e.prototype,t),e}function Xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Mx=function(){function e(t,r){var n=this;kx(this,e),Xn(this,"store",void 0),Xn(this,"monitor",void 0),Xn(this,"backend",void 0),Xn(this,"isSetUp",!1),Xn(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 Px(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=Rx(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 Pt(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Nc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Tc=function(){return Math.random().toString(36).substring(7).split("").join(".")},jc={INIT:"@@redux/INIT"+Tc(),REPLACE:"@@redux/REPLACE"+Tc()};function Lx(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 Fx(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(Vx(e))return"date";if(Bx(e))return"error";var r=$x(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 $x(e){return typeof e.constructor=="function"?e.constructor.name:null}function Bx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Vx(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=Fx(e)),t}function Gf(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"?Pt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?Pt(1):"Expected the enhancer to be a function. Instead, received: '"+dn(r)+"'");return r(Gf)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?Pt(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"?Pt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Pt(4):"Expected the listener to be a function. Instead, received: '"+dn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?Pt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return u(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?Pt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,u();var b=a.indexOf(h);a.splice(b,1),o=null}}}function m(h){if(!Lx(h))throw new Error(process.env.NODE_ENV==="production"?Pt(7):"Actions must be plain objects. Instead, the actual type was: '"+dn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?Pt(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"?Pt(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var b=y[v];b()}return h}function g(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?Pt(10):"Expected the nextReducer to be a function. Instead, received: '"+dn(h));s=h,m({type:jc.REPLACE})}function _(){var h,y=f;return h={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(process.env.NODE_ENV==="production"?Pt(11):"Expected the observer to be an object. Instead, received: '"+dn(b)+"'");function x(){b.next&&b.next(d())}x();var w=y(x);return{unsubscribe:w}}},h[Nc]=function(){return this},h}return m({type:jc.INIT}),n={dispatch:m,subscribe:f,getState:d,replaceReducer:g},n[Nc]=_,n}var Ux=function(t,r){return t===r};function zx(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function qx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ux;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 Rc(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 kc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rc(Object(r),!0).forEach(function(n){Hx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ac={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Wx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ac,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case tl:case Qi:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Gi:return zx(e.clientOffset,r.clientOffset)?e:kc(kc({},e),{},{clientOffset:r.clientOffset});case Xi:case Yi:return Ac;default:return e}}var nl="dnd-core/ADD_SOURCE",sl="dnd-core/ADD_TARGET",il="dnd-core/REMOVE_SOURCE",Zi="dnd-core/REMOVE_TARGET";function Kx(e){return{type:nl,payload:{sourceId:e}}}function Qx(e){return{type:sl,payload:{targetId:e}}}function Gx(e){return{type:il,payload:{sourceId:e}}}function Yx(e){return{type:Zi,payload:{targetId:e}}}function Pc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Mt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pc(Object(r),!0).forEach(function(n){Xx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Xx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Zx={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Jx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Zx,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case Qi:return Mt(Mt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case rl:return Mt(Mt({},e),{},{isSourcePublic:!0});case Gi:return Mt(Mt({},e),{},{targetIds:r.targetIds});case Zi:return e.targetIds.indexOf(r.targetId)===-1?e:Mt(Mt({},e),{},{targetIds:cx(e.targetIds,r.targetId)});case Yi:return Mt(Mt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Xi:return Mt(Mt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function eS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case nl:case sl:return e+1;case il:case Zi:return e-1;default:return e}}var Ti=[],ol=[];Ti.__IS_NONE__=!0;ol.__IS_ALL__=!0;function tS(e,t){if(e===Ti)return!1;if(e===ol||typeof t>"u")return!0;var r=dx(t,e);return r.length>0}function rS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case Gi:break;case nl:case sl:case Zi:case il:return Ti;case Qi:case rl:case Xi:case Yi:default:return ol}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=ux(n,i),a=o.length>0||!qx(n,i);if(!a)return Ti;var c=i[i.length-1],u=n[n.length-1];return c!==u&&(c&&o.push(c),u&&o.push(u)),o}function nS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Mc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Lc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mc(Object(r),!0).forEach(function(n){sS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:rS(e.dirtyHandlerIds,{type:t.type,payload:Lc(Lc({},t.payload),{},{prevTargetIds:lx(e,"dragOperation.targetIds",[])})}),dragOffset:Wx(e.dragOffset,t),refCount:eS(e.refCount,t),dragOperation:Jx(e.dragOperation,t),stateId:nS(e.stateId)}}function oS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Yf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function aS(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:Yf(oS(t,n),r)}function lS(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:Yf(t,r)}function cS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function uS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function dS(e,t,r){return t&&uS(e.prototype,t),e}function Fc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var fS=function(){function e(t,r){cS(this,e),Fc(this,"store",void 0),Fc(this,"registry",void 0),this.store=t,this.registry=r}return dS(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;ae(typeof r=="function","listener must be a function."),ae(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&&!tS(u.dirtyHandlerIds,i);f||r()}finally{o=d}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;ae(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 ae(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(ae(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 ya(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(ae(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&&!ya(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 aS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return lS(this.store.getState().dragOffset)}}]),e}(),hS=0;function pS(){return hS++}function hi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hi=function(r){return typeof r}:hi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hi(e)}function gS(e){ae(typeof e.canDrag=="function","Expected canDrag to be a function."),ae(typeof e.beginDrag=="function","Expected beginDrag to be a function."),ae(typeof e.endDrag=="function","Expected endDrag to be a function.")}function mS(e){ae(typeof e.canDrop=="function","Expected canDrop to be a function."),ae(typeof e.hover=="function","Expected hover to be a function."),ae(typeof e.drop=="function","Expected beginDrag to be a function.")}function va(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return va(r,!1)});return}ae(typeof e=="string"||hi(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 $c=typeof global<"u"?global:self,Xf=$c.MutationObserver||$c.WebKitMutationObserver;function Zf(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function yS(e){let t=1;const r=new Xf(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const vS=typeof Xf=="function"?yS:Zf;class bS{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=vS(this.flush),this.requestErrorThrow=Zf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class _S{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 wS{create(t){const r=this.freeTasks,n=r.length?r.pop():new _S(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Jf=new bS,xS=new wS(Jf.registerPendingError);function SS(e){Jf.enqueueTask(xS.create(e))}function CS(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 ES(e,t,r){return t&&OS(e.prototype,t),e}function fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DS(e,t){return jS(e)||TS(e,t)||NS(e,t)||IS()}function IS(){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 NS(e,t){if(e){if(typeof e=="string")return Bc(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 Bc(e,t)}}function Bc(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 TS(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 jS(e){if(Array.isArray(e))return e}function RS(e){var t=pS().toString();switch(e){case Bt.SOURCE:return"S".concat(t);case Bt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Vc(e){switch(e[0]){case"S":return Bt.SOURCE;case"T":return Bt.TARGET;default:ae(!1,"Cannot parse handler ID: ".concat(e))}}function Uc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=DS(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var kS=function(){function e(t){CS(this,e),fn(this,"types",new Map),fn(this,"dragSources",new Map),fn(this,"dropTargets",new Map),fn(this,"pinnedSourceId",null),fn(this,"pinnedSource",null),fn(this,"store",void 0),this.store=t}return ES(e,[{key:"addSource",value:function(r,n){va(r),gS(n);var s=this.addHandler(Bt.SOURCE,r,n);return this.store.dispatch(Kx(s)),s}},{key:"addTarget",value:function(r,n){va(r,!0),mS(n);var s=this.addHandler(Bt.TARGET,r,n);return this.store.dispatch(Qx(s)),s}},{key:"containsHandler",value:function(r){return Uc(this.dragSources,r)||Uc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;ae(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 ae(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return ae(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return ae(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Vc(r);return n===Bt.SOURCE}},{key:"isTargetId",value:function(r){var n=Vc(r);return n===Bt.TARGET}},{key:"removeSource",value:function(r){var n=this;ae(this.getSource(r),"Expected an existing source."),this.store.dispatch(Gx(r)),SS(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){ae(this.getTarget(r),"Expected an existing target."),this.store.dispatch(Yx(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);ae(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){ae(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=RS(r);return this.types.set(i,n),r===Bt.SOURCE?this.dragSources.set(i,s):r===Bt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function AS(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=PS(n),i=new fS(s,new kS(s)),o=new Mx(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function PS(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Gf(iS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var MS=["children"];function LS(e,t){return VS(e)||BS(e,t)||$S(e,t)||FS()}function FS(){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 zc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zc(e,t)}}function zc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function BS(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 VS(e){if(Array.isArray(e))return e}function US(e,t){if(e==null)return{};var r=zS(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 zS(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var qc=0,pi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),qS=p.memo(function(t){var r=t.children,n=US(t,MS),s=HS(n),i=LS(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=eh();return++qc,function(){--qc===0&&(c[pi]=null)}}},[]),l.jsx(Kf.Provider,Object.assign({value:o},{children:r}),void 0)});function HS(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=WS(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function WS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:eh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[pi]||(s[pi]={dragDropManager:AS(e,t,r,n)}),s[pi]}function eh(){return typeof global<"u"?global:window}function KS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function GS(e,t,r){return t&&QS(e.prototype,t),e}function Hc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xo=!1,So=!1,YS=function(){function e(t){KS(this,e),Hc(this,"internalMonitor",void 0),Hc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return GS(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){ae(!xo,"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 xo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{xo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;ae(!So,"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 So=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{So=!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 XS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZS(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function JS(e,t,r){return t&&ZS(e.prototype,t),e}function Wc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Co=!1,eC=function(){function e(t){XS(this,e),Wc(this,"internalMonitor",void 0),Wc(this,"targetId",null),this.internalMonitor=t.getMonitor()}return JS(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;ae(!Co,"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 Co=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Co=!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 tC(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 rC(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;tC(s);var i=r?function(o){return e(o,r)}:e;return nC(s,i)}}function th(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=rC(n);t[r]=function(){return s}}}),t}function Kc(e,t){typeof e=="function"?e(t):e.current=t}function nC(e,t){var r=e.ref;return ae(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?p.cloneElement(e,{ref:function(s){Kc(r,s),Kc(t,s)}}):p.cloneElement(e,{ref:t})}function gi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gi=function(r){return typeof r}:gi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gi(e)}function ba(e){return e!==null&&gi(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function _a(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 sC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function oC(e,t,r){return t&&iC(e.prototype,t),e}function ct(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var aC=function(){function e(t){var r=this;sC(this,e),ct(this,"hooks",th({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,ba(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,ba(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),ct(this,"handlerId",null),ct(this,"dragSourceRef",null),ct(this,"dragSourceNode",void 0),ct(this,"dragSourceOptionsInternal",null),ct(this,"dragSourceUnsubscribe",void 0),ct(this,"dragPreviewRef",null),ct(this,"dragPreviewNode",void 0),ct(this,"dragPreviewOptionsInternal",null),ct(this,"dragPreviewUnsubscribe",void 0),ct(this,"lastConnectedHandlerId",null),ct(this,"lastConnectedDragSource",null),ct(this,"lastConnectedDragSourceOptions",null),ct(this,"lastConnectedDragPreview",null),ct(this,"lastConnectedDragPreviewOptions",null),ct(this,"backend",void 0),this.backend=t}return oC(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!_a(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!_a(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 lC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function uC(e,t,r){return t&&cC(e.prototype,t),e}function Zt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var dC=function(){function e(t){var r=this;lC(this,e),Zt(this,"hooks",th({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,ba(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),Zt(this,"handlerId",null),Zt(this,"dropTargetRef",null),Zt(this,"dropTargetNode",void 0),Zt(this,"dropTargetOptionsInternal",null),Zt(this,"unsubscribeDropTarget",void 0),Zt(this,"lastConnectedHandlerId",null),Zt(this,"lastConnectedDropTarget",null),Zt(this,"lastConnectedDropTargetOptions",null),Zt(this,"backend",void 0),this.backend=t}return uC(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!_a(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 fC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function hC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var nn=typeof window<"u"?p.useLayoutEffect:p.useEffect;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 pC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gC(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 mC(e,t,r){return t&&gC(e.prototype,t),e}function Oo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yC=function(){function e(t,r,n){pC(this,e),Oo(this,"spec",void 0),Oo(this,"monitor",void 0),Oo(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return mC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return mi(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 vC(e,t,r){var n=p.useMemo(function(){return new yC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function on(){var e=p.useContext(Kf),t=e.dragDropManager;return ae(t!=null,"Expected drag drop context"),t}function bC(e){return p.useMemo(function(){var t=e.type;return ae(t!=null,"spec.type must be defined"),t},[e])}function _C(e,t){return CC(e)||SC(e,t)||xC(e,t)||wC()}function wC(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
459
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xC(e,t){if(e){if(typeof e=="string")return Qc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qc(e,t)}}function Qc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function 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 CC(e){if(Array.isArray(e))return e}function OC(e,t,r){var n=on(),s=vC(e,t,r),i=bC(e);nn(function(){if(i!=null){var a=hC(i,s,n),c=_C(a,2),u=c[0],d=c[1];return t.receiveHandlerId(u),r.receiveHandlerId(u),d}},[n,t,r,s,i])}function EC(e){return TC(e)||NC(e)||IC(e)||DC()}function DC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
460
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IC(e,t){if(e){if(typeof e=="string")return wa(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 wa(e,t)}}function NC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function TC(e){if(Array.isArray(e))return wa(e)}function wa(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 rh(e,t){var r=EC(t||[]);return t==null&&typeof e!="function"&&r.push(e),p.useMemo(function(){return typeof e=="function"?e():e},r)}function jC(){var e=on();return p.useMemo(function(){return new YS(e)},[e])}function RC(e,t){var r=on(),n=p.useMemo(function(){return new aC(r.getBackend())},[r]);return nn(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),nn(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var kC=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 AC=Wd(kC);function PC(e,t){return $C(e)||FC(e,t)||LC(e,t)||MC()}function MC(){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 LC(e,t){if(e){if(typeof e=="string")return Gc(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 Gc(e,t)}}function Gc(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 FC(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 nh(e,t,r){var n=p.useState(function(){return t(e)}),s=PC(n,2),i=s[0],o=s[1],a=p.useCallback(function(){var c=t(e);AC(i,c)||(o(c),r&&r())},[i,e,r]);return nn(a),[i,a]}function BC(e,t){return qC(e)||zC(e,t)||UC(e,t)||VC()}function VC(){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 UC(e,t){if(e){if(typeof e=="string")return Yc(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 Yc(e,t)}}function Yc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function qC(e){if(Array.isArray(e))return e}function HC(e,t,r){var n=nh(e,t,r),s=BC(n,2),i=s[0],o=s[1];return nn(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function sh(e,t,r){return HC(t,e||function(){return{}},function(){return r.reconnect()})}function WC(e){return p.useMemo(function(){return e.hooks.dragSource()},[e])}function KC(e){return p.useMemo(function(){return e.hooks.dragPreview()},[e])}function QC(e,t){var r=rh(e,t);ae(!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=jC(),s=RC(r.options,r.previewOptions);return OC(r,n,s),[sh(r.collect,n,s),WC(s),KC(s)]}function GC(e){var t=e.accept;return p.useMemo(function(){return ae(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function YC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function XC(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 ZC(e,t,r){return t&&XC(e.prototype,t),e}function Xc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var JC=function(){function e(t,r){YC(this,e),Xc(this,"spec",void 0),Xc(this,"monitor",void 0),this.spec=t,this.monitor=r}return ZC(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 e0(e,t){var r=p.useMemo(function(){return new JC(e,t)},[t]);return p.useEffect(function(){r.spec=e},[e]),r}function t0(e,t){return i0(e)||s0(e,t)||n0(e,t)||r0()}function r0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
463
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n0(e,t){if(e){if(typeof e=="string")return Zc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Zc(e,t)}}function Zc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function s0(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 i0(e){if(Array.isArray(e))return e}function o0(e,t,r){var n=on(),s=e0(e,t),i=GC(e);nn(function(){var a=fC(i,s,n),c=t0(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 a0(){var e=on();return p.useMemo(function(){return new eC(e)},[e])}function l0(e){var t=on(),r=p.useMemo(function(){return new dC(t.getBackend())},[t]);return nn(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function c0(e){return p.useMemo(function(){return e.hooks.dropTarget()},[e])}function ih(e,t){var r=rh(e,t),n=a0(),s=l0(r.options);return o0(r,n,s),[sh(r.collect,n,s),c0(s)]}function u0(e,t){return p0(e)||h0(e,t)||f0(e,t)||d0()}function d0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
464
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f0(e,t){if(e){if(typeof e=="string")return Jc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jc(e,t)}}function Jc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function h0(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 p0(e){if(Array.isArray(e))return e}function g0(e){var t=on(),r=t.getMonitor(),n=nh(r,e),s=u0(n,2),i=s[0],o=s[1];return p.useEffect(function(){return r.subscribeToOffsetChange(o)}),p.useEffect(function(){return r.subscribeToStateChange(o)}),i}function oh(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function m0(e,t){return e.filter(function(r){return r!==t})}function y0(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 v0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _0(e,t,r){return t&&b0(e.prototype,t),e}function eu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var w0=function(){function e(t){v0(this,e),eu(this,"entered",[]),eu(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return _0(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=y0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=m0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),x0=oh(function(){return/firefox/i.test(navigator.userAgent)}),ah=oh(function(){return!!window.safari});function S0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function O0(e,t,r){return t&&C0(e.prototype,t),e}function Zn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var tu=function(){function e(t,r){S0(this,e),Zn(this,"xs",void 0),Zn(this,"ys",void 0),Zn(this,"c1s",void 0),Zn(this,"c2s",void 0),Zn(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(k,L){return t[k]<t[L]?-1:1});for(var o=[],a=[],c,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]],m=0;m<o.length-1;m++){var g=a[m],_=a[m+1];if(g*_<=0)f.push(0);else{c=o[m];var h=o[m+1],y=c+h;f.push(3*y/((y+h)/g+(y+c)/_))}}f.push(a[a.length-1]);for(var v=[],b=[],x,w=0;w<f.length-1;w++){x=a[w];var C=f[w],D=1/o[w],j=C+f[w+1]-x-x;v.push((x-C-j)*D),b.push(j*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,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 m=n[f];if(m<r)u=f+1;else if(m>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}(),E0=1;function lh(e){var t=e.nodeType===E0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Qs(e){return{x:e.clientX,y:e.clientY}}function D0(e){var t;return e.nodeName==="IMG"&&(x0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function I0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return ah()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function N0(e,t,r,n,s){var i=D0(t),o=i?e:t,a=lh(o),c={x:r.x-a.x,y:r.y-a.y},u=e.offsetWidth,d=e.offsetHeight,f=n.anchorX,m=n.anchorY,g=I0(i,t,u,d),_=g.dragPreviewWidth,h=g.dragPreviewHeight,y=function(){var j=new tu([0,.5,1],[c.y,c.y/d*h,c.y+h-d]),k=j.interpolate(m);return ah()&&i&&(k+=(window.devicePixelRatio-1)*h),k},v=function(){var j=new tu([0,.5,1],[c.x,c.x/u*_,c.x+_-u]);return j.interpolate(f)},b=s.offsetX,x=s.offsetY,w=b===0||b,C=x===0||x;return{x:w?b:v(),y:C?x:y()}}var ch="__NATIVE_FILE__",uh="__NATIVE_URL__",dh="__NATIVE_TEXT__",fh="__NATIVE_HTML__";const ru=Object.freeze(Object.defineProperty({__proto__:null,FILE:ch,HTML:fh,TEXT:dh,URL:uh},Symbol.toStringTag,{value:"Module"}));function Eo(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var hn;function Gs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xa=(hn={},Gs(hn,ch,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Gs(hn,fh,{exposeProperties:{html:function(t,r){return Eo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Gs(hn,uh,{exposeProperties:{urls:function(t,r){return Eo(t,r,"").split(`
465
+ `)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Gs(hn,dh,{exposeProperties:{text:function(t,r){return Eo(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),hn);function T0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function R0(e,t,r){return t&&j0(e.prototype,t),e}function nu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var k0=function(){function e(t){T0(this,e),nu(this,"item",void 0),nu(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return R0(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 A0(e,t){var r=new k0(xa[e]);return r.loadDataTransfer(t),r}function Do(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(xa).filter(function(r){var n=xa[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function P0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L0(e,t,r){return t&&M0(e.prototype,t),e}function Io(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var F0=function(){function e(t,r){P0(this,e),Io(this,"ownerDocument",null),Io(this,"globalContext",void 0),Io(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return L0(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 su(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 iu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?su(Object(r),!0).forEach(function(n){fe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):su(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 B0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function V0(e,t,r){return t&&B0(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 U0=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&&lh(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=Qs(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,u=Do(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var d=s.monitor.getSourceId(),f=s.sourceNodes.get(d),m=s.sourcePreviewNodes.get(d)||f;if(m){var g=s.getCurrentSourcePreviewNodeOptions(),_=g.anchorX,h=g.anchorY,y=g.offsetX,v=g.offsetY,b={anchorX:_,anchorY:h},x={offsetX:y,offsetY:v},w=N0(f,m,a,b,x);c.setDragImage(m,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=Do(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:Qs(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=Qs(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 Do(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),fe(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Qs(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 F0(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new w0(this.isNodeInDocument)}return V0(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 iu({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 iu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(ru).some(function(n){return ru[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=A0(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}(),Ys;function z0(){return Ys||(Ys=new Image,Ys.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ys}var q0=function(t,r,n){return new U0(t,r,n)};function H0(e,t){return typeof e=="function"?e(t):e??"NODE"}function W0(e){return e.isDraggable&&!e.isEditing}function K0(e){const t=Et(),r=t.selectedIds,[n,s,i]=QC(()=>({canDrag:()=>W0(e),type:H0(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(Fn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Fn.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(z0())},[i]),s}function Q0(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,u=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:u,atTop:!u&&o,atBottom:!u&&a}}function G0(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 Xs(e,t){return{parentId:e||null,index:t}}function pn(e,t){return{type:"line",index:e,level:t}}function Y0(e){return{type:"highlight",id:e}}function No(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=Lf(n)+1;return{parentId:s,index:i}}function hh(e){var t;const r=Q0(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,u]=G0(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:Xs(i.id,null),cursor:Y0(i.id)};if(!c)return{drop:Xs((t=u==null?void 0:u.parent)===null||t===void 0?void 0:t.id,0),cursor:pn(0,0)};if(kf(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:No(c,d),cursor:pn(c.rowIndex+1,d)}}if(Af(c)){const d=ci(s,(u==null?void 0:u.level)||0,c.level);return{drop:No(c,d),cursor:pn(c.rowIndex+1,d)}}if(Pf(c)){const d=ci(s,0,c.level+1);return d>c.level?{drop:Xs(c.id,0),cursor:pn(c.rowIndex+1,d)}:{drop:No(c,d),cursor:pn(c.rowIndex+1,d)}}return{drop:Xs(c==null?void 0:c.id,0),cursor:pn(c.rowIndex+1,c.level+1)}}function X0(e,t){const r=Et(),[n,s]=ih(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:u}=hh({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});u&&r.dispatch(Fn.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 Z0(e){const t=Et(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const ou=p.memo(function({index:t,style:r}){Rf(),mw();const n=Et(),s=Z0(t),i=p.useRef(null),o=K0(s),a=X0(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),u=n.indent*s.level,d=p.useMemo(()=>({paddingLeft:u}),[u]),f=p.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),m={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const g=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:m,children:l.jsx(g,{node:s,tree:n,style:d,dragHandle:o})})});let To="",au=null;function ph(){Rf();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(),Ff(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),$f(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(au),To+=t.key,au=setTimeout(()=>{To=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(To):!1});n&&e.focus(n.id)},children:l.jsx(J0,{})})}function J0(){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:sx,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:ax,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(ex,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:ou})):l.jsx(tx,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:ou}))}function lu(e){return e.isFiltered?t1(e.root,e.isMatch.bind(e)):e1(e.root)}function e1(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(gh),t}function t1(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(gh),n}function gh(e,t){e.rowIndex=t}const cu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var jo=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:ut}=ww;class ds{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=yc(this),this.visibleNodes=lu(this),this.idToIndex=cu(this.visibleNodes)}update(t){this.props=t,this.root=yc(this),this.visibleNodes=lu(this),this.idToIndex=cu(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=is(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=is(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof ws)return t.id;const r=this.props.idAccessor||"id";return is(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 jo(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?zf(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:Uf(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield ut(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 jo(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 ut(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(bo(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{ds.editPromise=i})}submit(t,r){return jo(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield ut(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(bo(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(bo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&&ut(this.props.onActivate,r)}resolveEdit(t){const r=ds.editPromise;r&&r(t),ds.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(cn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&&ut(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(cn(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&&ut(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(vr.remove(r)),ut(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(cn(n.id)),n.isSelectable&&(this.dispatch(vr.add(n.id)),this.dispatch(vr.anchor(n.id)),this.dispatch(vr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&&ut(this.props.onFocus,this.focusedNode),ut(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(cn(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(vr.remove(this.nodesBetween(s,i))),this.dispatch(vr.add(o)),this.dispatch(vr.mostRecent(n))}this.scrollTo(n),this.focusedNode&&ut(this.props.onFocus,this.focusedNode),ut(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(cn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&&ut(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(vr.set({ids:n,anchor:s,mostRecent:i})),ut(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&&Mf(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;ut(this.props.onMove,{dragIds:n,parentId:t===_s?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Fn.cursor({type:"none"}))}showCursor(t){this.dispatch(Fn.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),ut(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),ut(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=el(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Ni(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ni(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),Vf(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===_s)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!is(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(cn(t.id))}onBlur(){this.dispatch(jw())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||ph}get renderRow(){return this.props.renderRow||Ew}get renderNode(){return this.props.children||Dw}get renderDragPreview(){return this.props.renderDragPreview||qf}get renderCursor(){return this.props.renderCursor||Ow}}function dt(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 r1=typeof Symbol=="function"&&Symbol.observable||"@@observable",uu=r1,Ro=()=>Math.random().toString(36).substring(7).split("").join("."),n1={INIT:`@@redux/INIT${Ro()}`,REPLACE:`@@redux/REPLACE${Ro()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Ro()}`},en=n1;function mh(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 s1(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(a1(e))return"date";if(o1(e))return"error";const r=i1(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 i1(e){return typeof e.constructor=="function"?e.constructor.name:null}function o1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function a1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function wr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=s1(e)),t}function yh(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?dt(2):`Expected the root reducer to be a function. Instead, received: '${wr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?dt(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"?dt(1):`Expected the enhancer to be a function. Instead, received: '${wr(r)}'`);return r(yh)(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((y,v)=>{o.set(v,y)}))}function d(){if(c)throw new Error(process.env.NODE_ENV==="production"?dt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?dt(4):`Expected the listener to be a function. Instead, received: '${wr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?dt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let v=!0;u();const b=a++;return o.set(b,y),function(){if(v){if(c)throw new Error(process.env.NODE_ENV==="production"?dt(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(),o.delete(b),i=null}}}function m(y){if(!mh(y))throw new Error(process.env.NODE_ENV==="production"?dt(7):`Actions must be plain objects. Instead, the actual type was: '${wr(y)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?dt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?dt(17):`Action "type" property must be a string. Instead, the actual type was: '${wr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?dt(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(b=>{b()}),y}function g(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?dt(10):`Expected the nextReducer to be a function. Instead, received: '${wr(y)}`);n=y,m({type:en.REPLACE})}function _(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?dt(11):`Expected the observer to be an object. Instead, received: '${wr(v)}'`);function b(){const w=v;w.next&&w.next(d())}return b(),{unsubscribe:y(b)}},[uu](){return this}}}return m({type:en.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:g,[uu]:_}}function du(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function l1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===en.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(!mh(e))return`The ${i} has unexpected type of "${wr(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===en.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 c1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:en.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?dt(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:en.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?dt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${en.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 fu(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"&&du(`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{c1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=l1(a,r,c,s);f&&du(f)}let u=!1;const d={};for(let f=0;f<n.length;f++){const m=n[f],g=r[m],_=a[m],h=g(_,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?dt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${m}" 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[m]=h,u=u||h!==_}return u=u||n.length!==Object.keys(a).length,u?d:a}}function u1(e=Ln().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const d1=fu({nodes:fu({focus:Rw,edit:Tw,open:kw,selection:Aw,drag:u1}),dnd:Pw}),f1=Ln();function h1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(yh(d1,Ln(e))),o=gw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>f1),a=p.useMemo(()=>new ds(i.current,e,n,s),[]),c=p.useRef(0);return p.useMemo(()=>{c.current+=1,a.update(e)},Object.values(e)),p.useMemo(()=>{c.current+=1,a.update(a.props)},[o.nodes.open]),p.useImperativeHandle(t,()=>a),p.useEffect(()=>{a.props.selection?a.select(a.props.selection,{focus:!1}):a.deselectAll()},[a.props.selection]),p.useEffect(()=>{a.props.searchTerm||i.current.dispatch(pa.clear(!0))},[a.props.searchTerm]),l.jsx(If.Provider,{value:a,children:l.jsx(jf.Provider,{value:c.current,children:l.jsx(Nf.Provider,{value:o.nodes,children:l.jsx(Tf.Provider,{value:o.dnd,children:l.jsx(qS,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||q0,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function p1(){const e=Et(),[,t]=ih(()=>({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}=hh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(Fn.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 g1(e){return p1(),e.children}function m1(){const t=Et().props.renderContainer||ph;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function y1(){const e=Et(),{offset:t,mouse:r,item:n,isDragging:s}=g0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||qf;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 v1(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 b1{constructor(t,r={}){this.accessors=v1(r),this.root=_1(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 _1(e,t){const r=new vh({},null,t,"ROOT");return r.children=e.map(n=>al(n,r,t)),r}function al(e,t,r){const n=new vh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>al(i,n,r))),n}class vh{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=al(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 w1=0;function x1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new b1(r,{idAccessor:s,childrenAccessor:i}),[r,s,i]),a=_=>{for(const h of _.dragIds)o.move({id:h,parentId:_.parentId,index:_.index});n(o.data)},c=({name:_,id:h})=>{o.update({id:h,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:h,type:y})=>{if(typeof s=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(y==="internal"&&typeof i=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const v={[u]:`simple-tree-id-${w1++}`,name:""};return y==="internal"&&(v[d]=[]),o.create({parentId:_,index:h,data:v}),n(o.data),v},onDelete:_=>{_.ids.forEach(h=>o.drop({id:h})),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]=x1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function C1(e,t){const r=S1(e);return l.jsxs(h1,{treeProps:r,imperativeHandle:t,children:[l.jsx(g1,{children:l.jsx(m1,{})}),l.jsx(y1,{})]})}const O1=p.forwardRef(C1);function ll(){return ke(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 E1(){return ke(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 hu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},pu={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},gu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],D1=[{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 I1(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 Ji(e){const t=I1(e);return{key:t,color:hu[t]??hu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:pu[t]??pu.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const N1="_row_i3qt2_1",T1="_grip_i3qt2_16",j1="_menuBtn_i3qt2_19",R1="_selected_i3qt2_23",k1="_title_i3qt2_28",A1="_dropTarget_i3qt2_33",P1="_toggle_i3qt2_50",M1="_ctIcon_i3qt2_65",L1="_folderIcon_i3qt2_77",F1="_renameInput_i3qt2_92",$1="_dropHere_i3qt2_101",B1="_menuWrap_i3qt2_111",V1="_menu_i3qt2_19",U1="_dangerItem_i3qt2_163",xt={row:N1,grip:T1,menuBtn:j1,selected:R1,title:k1,dropTarget:A1,toggle:P1,ctIcon:M1,folderIcon:L1,renameInput:F1,dropHere:$1,menuWrap:B1,menu:V1,dangerItem:U1},z1={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},q1=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,u]=p.useState(e.data.name),d=p.useRef(null),f=n==="edit",m=ll(),g=Ji(e.data),_=z1[g.key]??zn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),b=y?sy:v?cy:_;p.useEffect(()=>{if(!s)return;const C=D=>{var j;(j=d.current)!=null&&j.contains(D.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const x=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(C=>{C.key==="Enter"&&x(),C.key==="Escape"&&(u(e.data.name),a(!1))},[x,e.data.name]);return l.jsxs("div",{className:[xt.row,h?xt.selected:"",e.state.isOver&&v?xt.dropTarget:""].filter(Boolean).join(" "),style:t,onClick:()=>e.select(),"data-node-id":e.data.id,"data-droppable":v?"true":void 0,role:"treeitem","aria-selected":h,"aria-expanded":v?!e.isClosed:void 0,children:[f&&l.jsx("span",{ref:r,className:xt.grip,"aria-hidden":"true",children:l.jsx(qd,{size:14})}),l.jsx("button",{className:xt.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(Bd,{size:14}):l.jsx(ks,{size:14})}),l.jsx("span",{className:`${xt.ctIcon} ${y||v?xt.folderIcon:g.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:xt.renameInput,value:c,autoFocus:!0,onChange:C=>u(C.target.value),onBlur:x,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:xt.title,onDoubleClick:()=>f&&a(!0),children:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:xt.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:xt.menuWrap,ref:d,children:[l.jsx("button",{className:xt.menuBtn,onClick:C=>{C.stopPropagation(),i(D=>!D)},"aria-label":"Node options",children:l.jsx(Ud,{size:14})}),s&&l.jsxs("div",{className:xt.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(gy,{size:13})," Rename"]}),v&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(zd,{size:13})," Add sub-unit"]}),e.data.parent&&m&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(As,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:xt.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(qa,{size:13})," Delete"]})]})]})]})};async function H1(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 W1(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 K1(e,t){var a;const r=await H1(e,t.name),n=await W1(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 Q1(e){var r;return((r=(await $e.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function bh(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 G1(e){return bh(e)}const Y1="_container_jr3ij_1",X1="_header_jr3ij_13",Z1="_title_jr3ij_22",J1="_closeBtn_jr3ij_29",eO="_body_jr3ij_45",tO="_dropZone_jr3ij_54",rO="_dragOver_jr3ij_67",nO="_hasFile_jr3ij_72",sO="_hiddenInput_jr3ij_78",iO="_fileInfo_jr3ij_82",oO="_fileIcon_jr3ij_89",aO="_fileName_jr3ij_93",lO="_fileSize_jr3ij_100",cO="_dropHint_jr3ij_105",uO="_dropIcon_jr3ij_112",dO="_dropText_jr3ij_117",fO="_dropSubtext_jr3ij_124",hO="_sampleLink_jr3ij_130",pO="_statusBar_jr3ij_145",gO="_status_uploading_jr3ij_154",mO="_status_processing_jr3ij_154",yO="_status_done_jr3ij_159",vO="_status_error_jr3ij_164",bO="_successDetail_jr3ij_170",_O="_spinner_jr3ij_175",wO="_spin_jr3ij_175",xO="_errorMsg_jr3ij_191",SO="_failedSection_jr3ij_197",CO="_failedTitle_jr3ij_203",OO="_tableWrap_jr3ij_213",EO="_failedTable_jr3ij_219",DO="_reasonCell_jr3ij_244",IO="_footer_jr3ij_248",Ce={container:Y1,header:X1,title:Z1,closeBtn:J1,body:eO,dropZone:tO,dragOver:rO,hasFile:nO,hiddenInput:sO,fileInfo:iO,fileIcon:oO,fileName:aO,fileSize:lO,dropHint:cO,dropIcon:uO,dropText:dO,dropSubtext:fO,sampleLink:hO,statusBar:pO,status_uploading:gO,status_processing:mO,status_done:yO,status_error:vO,successDetail:bO,spinner:_O,spin:wO,errorMsg:xO,failedSection:SO,failedTitle:CO,tableWrap:OO,failedTable:EO,reasonCell:DO,footer:IO},NO=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,u]=p.useState("idle"),[d,f]=p.useState(""),[m,g]=p.useState([]),[_,h]=p.useState(null),y=p.useRef(null),v=p.useRef(null),b=p.useCallback(()=>{v.current!==null&&(clearInterval(v.current),v.current=null)},[]);p.useEffect(()=>()=>b(),[b]);const x=I=>I.name.toLowerCase().endsWith(".csv")?I.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(I=>{f(""),g([]),h(null),u("idle"),x(I)&&i(I)},[]),C=p.useCallback(I=>{I.preventDefault(),a(!1);const R=I.dataTransfer.files[0];R&&w(R)},[w]),D=p.useCallback(I=>{var M;const R=(M=I.target.files)==null?void 0:M[0];R&&w(R),I.target.value=""},[w]),j=p.useCallback(async()=>{try{const I=await G1(e),R=document.createElement("a");R.href=I,R.download="sample_hierarchy.csv",R.target="_blank",R.click()}catch{f("Failed to download sample CSV.")}},[e]),k=p.useCallback(async()=>{if(s){u("uploading"),f(""),g([]);try{const{processId:I}=await K1(e,s);if(!I){u("done"),h(null),setTimeout(t,1500);return}u("processing"),v.current=setInterval(async()=>{try{const R=await Q1(I);R.status==="COMPLETED"?(b(),u("done"),h(R.successCount??null),R.failedRecords&&R.failedRecords.length>0?g(R.failedRecords):setTimeout(t,1500)):R.status==="FAILED"&&(b(),u("error"),f("Upload processing failed. Please check the error rows below."),R.failedRecords&&g(R.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]),L={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:Ce.container,children:[l.jsxs("div",{className:Ce.header,children:[l.jsx("h2",{className:Ce.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:Ce.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ce.body,children:[l.jsxs("div",{className:`${Ce.dropZone} ${o?Ce.dragOver:""} ${s?Ce.hasFile:""}`,onDragEnter:I=>{I.preventDefault(),a(!0)},onDragOver:I=>{I.preventDefault(),a(!0)},onDragLeave:I=>{I.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var I;return(I=y.current)==null?void 0:I.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:I=>{var R;return I.key==="Enter"&&((R=y.current)==null?void 0:R.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:Ce.hiddenInput,onChange:D,"aria-hidden":"true"}),s?l.jsxs("div",{className:Ce.fileInfo,children:[l.jsx("span",{className:Ce.fileIcon,children:"📄"}),l.jsx("span",{className:Ce.fileName,children:s.name}),l.jsxs("span",{className:Ce.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:Ce.dropHint,children:[l.jsx("span",{className:Ce.dropIcon,children:"⬆️"}),l.jsx("p",{className:Ce.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:Ce.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:Ce.sampleLink,onClick:j,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${Ce.statusBar} ${Ce[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:Ce.spinner,"aria-hidden":"true"}),L[c],c==="done"&&_!==null&&l.jsxs("span",{className:Ce.successDetail,children:[" — ",_," item(s) imported"]})]}),d&&l.jsx("p",{className:Ce.errorMsg,role:"alert",children:d}),m.length>0&&l.jsxs("div",{className:Ce.failedSection,children:[l.jsxs("h4",{className:Ce.failedTitle,children:["Failed Rows (",m.length,")"]}),l.jsx("div",{className:Ce.tableWrap,children:l.jsxs("table",{className:Ce.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:m.map((I,R)=>l.jsxs("tr",{children:[l.jsx("td",{children:I.rowNumber??R+1}),l.jsx("td",{children:I.name??"—"}),l.jsx("td",{className:Ce.reasonCell,children:I.reason??"Unknown error"})]},R))})]})})]})]}),l.jsxs("div",{className:Ce.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:k,children:c==="done"?"Uploaded":"Upload"})]})]})},TO="_container_1y30m_1",jO="_header_1y30m_8",RO="_headerActions_1y30m_19",kO="_iconBtn_1y30m_25",AO="_menuWrap_1y30m_43",PO="_dropdownMenu_1y30m_47",MO="_treeWrapper_1y30m_79",LO="_csvModal_1y30m_95",FO="_footer_1y30m_105",Jt={container:TO,header:jO,headerActions:RO,iconBtn:kO,menuWrap:AO,dropdownMenu:PO,treeWrapper:MO,csvModal:LO,footer:FO},$O=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var W;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,u]=p.useState(!1),[d,f]=p.useState(!1),[m,g]=p.useState("create"),{treeData:_,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:b,reorderChildren:x,setTreeData:w}=ke(),C=e==="edit",D=ll(),j=C&&D,k=(((W=_[0])==null?void 0:W.children)??[]).some(U=>U.isFolder),L=ve(U=>{var X,$,K,Z;return(($=(X=U.editorConfig)==null?void 0:X.context)==null?void 0:$.contentId)??((Z=(K=U.editorConfig)==null?void 0:K.context)==null?void 0:Z.identifier)??""});p.useEffect(()=>{const U=s.current;if(!U)return;const X=new ResizeObserver(()=>{a(U.clientHeight||400)});return X.observe(U),a(U.clientHeight||400),()=>X.disconnect()},[]),p.useEffect(()=>{if(!c)return;const U=X=>{var $;($=i.current)!=null&&$.contains(X.target)||u(!1)};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[c]);const I=p.useCallback(U=>{U.length>0&&y(U[0].data.id)},[y]),R=p.useCallback(({parentId:U,index:X,dragIds:$})=>{if(!U)return;const K=$[0],Z=_h(_,U);if(!(Z!=null&&Z.children))return;const pe=Z.children.findIndex(Oe=>Oe.id===K);pe<0||x(U,pe,X>pe?X-1:X)},[_,x]),M=p.useCallback(({ids:U})=>{U.forEach(X=>b(X))},[b]),A=p.useCallback(({parentId:U})=>{var K;const X=U??((K=_[0])==null?void 0:K.id)??"";if(!X)return{id:crypto.randomUUID()};const $=v(X,"unit");return $?{id:$}:(Ae.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,_]),B=p.useCallback(()=>{var X;const U=(X=_[0])==null?void 0:X.id;U&&(v(U,"unit")||Ae.error("Maximum depth reached"))},[_,v]),F=p.useCallback(()=>{h&&(v(h,"subunit")||Ae.error("Maximum depth reached"))},[h,v]),re=p.useCallback(async()=>{if(u(!1),!!L)try{const U=await bh(L),X=await fetch(U).then(Z=>Z.blob()),$=URL.createObjectURL(X),K=document.createElement("a");K.href=$,K.download=`${L}-folders.csv`,K.style.display="none",document.body.appendChild(K),K.click(),document.body.removeChild(K),URL.revokeObjectURL($)}catch{Ae.error("Failed to download CSV")}},[L]),ce=p.useCallback(async()=>{if(f(!1),!!L)try{const{rootNode:U}=await Df(L);w([U]),Ae.success("Course outline refreshed.")}catch{Ae.error("Outline could not be refreshed automatically. Please reload the page.")}},[L,w]);return l.jsxs("div",{className:Jt.container,children:[l.jsx("div",{className:Jt.header,children:l.jsxs("div",{className:Jt.headerActions,children:[C&&l.jsxs("div",{className:Jt.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:Jt.iconBtn,onClick:()=>u(U=>!U),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Ud,{size:15})}),c&&l.jsxs("div",{className:Jt.dropdownMenu,role:"menu",children:[l.jsx("button",{role:"menuitem",type:"button",disabled:k,title:k?'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:!k,title:k?void 0:'No folders yet — use "Create" first',onClick:re,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!k,title:k?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:Jt.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(hy,{size:15}):l.jsx(fy,{size:15})})]})}),l.jsx("div",{className:Jt.treeWrapper,ref:s,children:l.jsx(O1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:I,onMove:C?R:void 0,onDelete:C?M:void 0,onCreate:C?A:void 0,disableEdit:!C,disableDrop:!C,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:U=>l.jsx(q1,{...U,editorMode:e})})}),C&&l.jsxs("div",{className:Jt.footer,children:[l.jsxs(De,{variant:"ghost",size:"sm",onClick:B,disabled:!j,children:[l.jsx(As,{size:14})," Add Unit"]}),l.jsxs(De,{variant:"ghost",size:"sm",onClick:F,disabled:!j||!h,children:[l.jsx(zd,{size:14})," Add Sub-unit"]})]}),d&&l.jsx("div",{className:Jt.csvModal,children:l.jsx(NO,{contentId:L,mode:m,onComplete:ce,onClose:()=>f(!1)})})]})};function _h(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=_h(r.children,t);if(n)return n}}}const BO="_breadcrumb_zd1aj_1",VO="_crumb_zd1aj_10",UO="_sep_zd1aj_26",zO="_current_zd1aj_31",Jn={breadcrumb:BO,crumb:VO,sep:UO,current:zO},qO=({crumbs:e})=>{const t=ke(r=>r.selectNode);return e.length?l.jsxs("nav",{className:Jn.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:Jn.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(uy,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Bd,{size:13,className:Jn.sep}),n<e.length-1?l.jsx("button",{className:Jn.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:Jn.current,children:r.name})]},r.id))]}):null},HO="_tabBar_qhks1_1",WO="_tab_qhks1_1",KO="_active_qhks1_29",QO="_error_qhks1_35",GO="_errorDot_qhks1_39",es={tabBar:HO,tab:WO,active:KO,error:QO,errorDot:GO},mu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],YO=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?mu.filter(i=>n.includes(i.id)):mu;return l.jsx("div",{className:es.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:[es.tab,e===i.id?es.active:"",r.includes(i.id)?es.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:es.errorDot,"aria-label":"Has errors"})]},i.id))})};var $s=e=>e.type==="checkbox",Ur=e=>e instanceof Date,nt=e=>e==null;const wh=e=>typeof e=="object";var Fe=e=>!nt(e)&&!Array.isArray(e)&&wh(e)&&!Ur(e),Sa=e=>Fe(e)&&e.target?$s(e.target)?e.target.checked:e.target.value:e,xh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Sh=e=>{const t=e.constructor&&e.constructor.prototype;return Fe(t)&&t.hasOwnProperty("isPrototypeOf")},eo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ve(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(eo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Fe(e)&&Sh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Ve(e[s]));return n}const Sr={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Ht={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},zt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},ko="form",Ch="root",Oh=["__proto__","constructor","prototype"];var Bs=e=>/^\w*$/.test(e),Te=e=>e===void 0,to=e=>e.split(/[.[\]'"]/g).filter(Boolean),H=(e,t,r)=>{if(!t||!Fe(e))return r;const n=Bs(t)?[t]:to(t);if(n.some(i=>Oh.includes(i)))return r;const s=n.reduce((i,o)=>nt(i)?void 0:i[o],e);return Te(s)||s===e?Te(e[t])?r:e[t]:s},jt=e=>typeof e=="boolean",ht=e=>typeof e=="function",Ie=(e,t,r)=>{let n=-1;const s=Bs(t)?[t]:to(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=Fe(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(Oh.includes(a))return;e[a]=c,e=e[a]}};const cl=p.createContext(null);cl.displayName="HookFormControlContext";const ul=()=>p.useContext(cl);var Eh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Ht.all&&(t._proxyFormState[o]=!n||Ht.all),r&&(r[o]=!0),e[o]}});return s};const dl=eo?p.useLayoutEffect:p.useEffect;function XO(e){const t=ul(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return dl(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Eh(o,r,c.current,!1),[o,r])}var pt=e=>typeof e=="string",Ca=(e,t,r,n,s)=>pt(e)?(n&&t.watch.add(e),H(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),H(r,i))):(n&&(t.watchAll=!0),r),Oa=e=>nt(e)||!wh(e);const yu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Sh(e);function Rt(e,t,r=new WeakMap){if(e===t)return!0;if(Oa(e)||Oa(t))return Object.is(e,t);if(Ur(e)&&Ur(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(yu(e,n)||yu(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(Ur(a)&&Ur(c)||(Fe(a)||Array.isArray(a))&&(Fe(c)||Array.isArray(c))?!Rt(a,c,r):!Object.is(a,c))return!1}}return!0}function ZO(e){const t=ul(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),u=p.useRef(a),d=p.useRef(void 0),f=p.useRef(r),m=p.useRef(n);u.current=a;const[g,_]=p.useState(()=>{const w=r._getWatch(n,c.current);return u.current?u.current(w):w}),h=p.useCallback(w=>{const C=Ca(n,r._names,w||r._formValues,!1,c.current);return u.current?u.current(C):C},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const C=Ca(n,r._names,w||r._formValues,!1,c.current);if(u.current){const D=u.current(C);Rt(D,d.current)||(_(D),d.current=D)}else _(C)}},[r._formValues,r._names,i,n]);dl(()=>((f.current!==r||!Rt(m.current,n))&&(f.current=r,m.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,b=m.current,x=p.useMemo(()=>{if(i)return null;const w=!v&&!Rt(b,n);return v||w?h():null},[i,v,n,b,h]);return x!==null?x:g}function ro(e){const t=ul(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=xh(s._names.array,r),u=p.useMemo(()=>H(s._formValues,r,H(s._defaultValues,r,o)),[s,r,o]),d=ZO({control:s,name:r,defaultValue:u,exact:a}),f=XO({control:s,name:r,exact:a}),m=p.useRef(e),g=p.useRef(null),_=p.useRef(s.register(r,{...e.rules,value:d,...jt(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!H(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!H(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!H(f.validatingFields,r)},error:{enumerable:!0,get:()=>H(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const C=Sa(w);return H(s._fields,r)||(_.current=s.register(r,{...m.current.rules,value:C})),_.current.onChange({target:{value:Sa(w),name:r},type:Sr.CHANGE})},[r,s]),v=p.useCallback(()=>_.current.onBlur({target:{value:H(s._formValues,r),name:r},type:Sr.BLUR}),[r,s._formValues]),b=p.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=H(s._fields,r);C&&C._f&&w&&(C._f.ref=g.current)},[s._fields,r]),x=p.useMemo(()=>({name:r,value:d,...jt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,f.disabled,y,v,b,d]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...m.current.rules,...jt(m.current.disabled)?{disabled:m.current.disabled}:{}});const C=(D,j)=>{const k=H(s._fields,D);k&&k._f&&(k._f.mount=j)};if(C(r,!0),w){const D=Ve(H(i?s._defaultValues:s._options.values||s._defaultValues,r,H(s._options.defaultValues,r,m.current.defaultValue)));Ie(s._defaultValues,r,D),Te(H(s._formValues,r))&&Ie(s._formValues,r,D)}if(!c&&s.register(r),g.current){const D=H(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]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:x,formState:f,fieldState:h}),[x,f,h])}const fl=p.createContext(null);fl.displayName="HookFormContext";const Gt=()=>p.useContext(fl),JO=({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:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v})=>{const b=p.useMemo(()=>({watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:u,resetField:d,reset:f,handleSubmit:m,unregister:g,control:_,register:h,setFocus:y,subscribe:v}),[i,_,u,n,r,m,h,f,d,s,y,o,a,v,c,g,t]);return p.createElement(fl.Provider,{value:b},p.createElement(cl.Provider,{value:b.control},e))};var eE=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Dh=e=>Array.isArray(e)?e.filter(Boolean):[],yi=e=>Array.isArray(e)?e:[e],vu=()=>{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 Ih(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&Fe(s)&&i){const o=Ih(s,i);Fe(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var Ye=e=>Fe(e)&&!Object.keys(e).length,hl=e=>e.type==="file",ji=e=>{if(!eo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Nh=e=>e.type==="select-multiple",pl=e=>e.type==="radio",tE=e=>pl(e)||$s(e),Ao=e=>ji(e)&&e.isConnected;function rE(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 nE(e){for(const t in e)if(e.hasOwnProperty(t)&&!Te(e[t]))return!1;return!0}function qe(e,t){if(pt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Bs(t)?[t]:to(t),n=r.length===1?e:rE(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(Fe(n)&&Ye(n)||Array.isArray(n)&&nE(n))&&qe(e,r.slice(0,-1)),e}var sE=e=>{for(const t in e)if(ht(e[t]))return!0;return!1};function Th(e){return Array.isArray(e)||Fe(e)&&!sE(e)}function Ea(e,t={}){for(const r in e){const n=e[r];Th(n)?(t[r]=Array.isArray(n)?[]:{},Ea(n,t[r])):Te(n)||(t[r]=!0)}return t}function Da(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Da(r));return t.some(r=>r!==void 0)?t:void 0}if(Fe(e)){const t={};for(const r in e){const n=Da(e[r]);Te(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function $r(e,t,r){r||(r=Ea(t));for(const n in e){const s=e[n];if(Th(s))Te(t)||Oa(r[n])?r[n]=Ea(s,Array.isArray(s)?[]:{}):$r(s,nt(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Rt(s,i)}}return Da(r)||{}}const bu={value:!1,isValid:!1},_u={value:!0,isValid:!0};var jh=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&&!Te(e[0].attributes.value)?Te(e[0].value)||e[0].value===""?_u:{value:e[0].value,isValid:!0}:_u:bu}return bu},Rh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Te(e)?e:t?e===""?NaN:e&&+e:r&&pt(e)?new Date(e):n?n(e):e;const wu={isValid:!1,value:null};var kh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,wu):wu;function xu(e){const t=e.ref;return hl(t)?t.files:pl(t)?kh(e.refs).value:Nh(t)?[...t.selectedOptions].map(({value:r})=>r):$s(t)?jh(e.refs).value:Rh(Te(t.value)?e.ref.value:t.value,e)}var iE=(e,t,r,n)=>{const s={};for(const i of e){const o=H(t,i);o&&Ie(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ri=e=>e instanceof RegExp,ts=e=>Te(e)?e:Ri(e)?e.source:Fe(e)?Ri(e.value)?e.value.source:e.value:e,Su=e=>({isOnSubmit:!e||e===Ht.onSubmit,isOnBlur:e===Ht.onBlur,isOnChange:e===Ht.onChange,isOnAll:e===Ht.all,isOnTouch:e===Ht.onTouched});const Cu="AsyncFunction";var oE=e=>!!e&&!!e.validate&&!!(ht(e.validate)&&e.validate.constructor.name===Cu||Fe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Cu)),aE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Po=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const fs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=H(e,s);if(i){const{_f:o,...a}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!n)return!0;if(o.ref&&t(o.ref,o.name)&&!n)return!0;if(fs(a,t))break}else if(Fe(a)&&fs(a,t))break}}};function Ou(e,t,r){const n=H(e,r);if(n||Bs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=H(t,i),a=H(e,i);if(o&&!Array.isArray(o)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var lE=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return Ye(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Ht.all))},cE=(e,t,r)=>!e||!t||e===t||yi(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),uE=(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,dE=(e,t)=>!Dh(H(e,t)).length&&qe(e,t),Eu=(e,t,r)=>{const n=H(e,r),s=Array.isArray(n)?n:[];return Ie(s,Ch,t[r]),Ie(e,r,s),e};function Du(e,t,r="validate"){if(pt(e)||Array.isArray(e)&&e.every(pt)||jt(e)&&!e)return{type:r,message:pt(e)?e:"",ref:t}}var gn=e=>Fe(e)&&!Ri(e)?e:{value:e,message:""},Iu=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:u,minLength:d,min:f,max:m,pattern:g,validate:_,name:h,valueAsNumber:y,mount:v}=e._f,b=H(r,h);if(!v||t.has(h))return{};const x=a?a[0]:o,w=M=>{if(s&&x.reportValidity){const A=jt(M)?"":M||"";a?a.forEach(B=>B.setCustomValidity(A)):x.setCustomValidity(A),x.reportValidity()}},C={},D=pl(o),j=$s(o),k=D||j,L=(y||hl(o))&&Te(o.value)&&Te(b)||ji(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,I=eE.bind(null,h,n,C),R=(M,A,B,F=zt.maxLength,re=zt.minLength)=>{const ce=M?A:B;C[h]={type:M?F:re,message:ce,ref:o,...I(M?F:re,ce)}};if(i?!Array.isArray(b)||!b.length:c&&(!k&&(L||nt(b))||jt(b)&&!b||j&&!jh(a).isValid||D&&!kh(a).isValid)){const{value:M,message:A}=pt(c)?{value:!!c,message:c}:gn(c);if(M&&(C[h]={type:zt.required,message:A,ref:x,...I(zt.required,A)},!n))return w(A),C}if(!L&&(!nt(f)||!nt(m))){let M,A;const B=gn(m),F=gn(f);if(!nt(b)&&!isNaN(b)){const re=o.valueAsNumber||b&&+b;nt(B.value)||(M=re>B.value),nt(F.value)||(A=re<F.value)}else{const re=o.valueAsDate||new Date(b),ce=X=>new Date(new Date().toDateString()+" "+X),W=o.type=="time",U=o.type=="week";pt(B.value)&&b&&(M=W?ce(b)>ce(B.value):U?b>B.value:re>new Date(B.value)),pt(F.value)&&b&&(A=W?ce(b)<ce(F.value):U?b<F.value:re<new Date(F.value))}if((M||A)&&(R(!!M,B.message,F.message,zt.max,zt.min),!n))return w(C[h].message),C}if((u||d)&&!L&&(pt(b)||i&&Array.isArray(b))){const M=gn(u),A=gn(d),B=!nt(M.value)&&b.length>+M.value,F=!nt(A.value)&&b.length<+A.value;if((B||F)&&(R(B,M.message,A.message),!n))return w(C[h].message),C}if(g&&!L&&pt(b)){const{value:M,message:A}=gn(g);if(Ri(M)&&!b.match(M)&&(C[h]={type:zt.pattern,message:A,ref:o,...I(zt.pattern,A)},!n))return w(A),C}if(_){if(ht(_)){const M=await _(b,r),A=Du(M,x);if(A&&(C[h]={...A,...I(zt.validate,A.message)},!n))return w(A.message),C}else if(Fe(_)){let M={};for(const A in _){if(!Ye(M)&&!n)break;const B=Du(await _[A](b,r),x,A);B&&(M={...B,...I(A,B.message)},w(B.message),n&&(C[h]=M))}if(!Ye(M)&&(C[h]={ref:x,...M},!n))return C}}return w(!0),C};const fE={mode:Ht.onSubmit,reValidateMode:Ht.onChange,shouldFocusError:!0},Ah={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function hE(e={}){let t={...fE,...e},r={...Ve(Ah),isLoading:ht(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=Fe(t.defaultValues)||Fe(t.values)?Ve(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ve(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 m={...f};const g={array:vu(),state:vu()},_=t.criteriaMode===Ht.all,h=S=>N=>{clearTimeout(u),u=setTimeout(S,N)},y=async S=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||m.isValid||S)){let N;t.resolver?(N=Ye((await I()).errors),v()):N=await A({fields:n,onlyCheckValid:!0,eventType:Sr.VALID}),N!==r.isValid&&g.state.next({isValid:N})}},v=(S,N)=>{!t.disabled&&(f.isValidating||f.validatingFields||m.isValidating||m.validatingFields)&&((S||Array.from(a.mount)).forEach(T=>{T&&(N?Ie(r.validatingFields,T,N):qe(r.validatingFields,T))}),g.state.next({validatingFields:r.validatingFields,isValidating:!Ye(r.validatingFields)}))},b=()=>{r.dirtyFields=$r(s,i)},x=(S,N=[],T,V,z=!0,Q=!0)=>{if(V&&T&&!t.disabled){if(o.action=!0,Q&&Array.isArray(H(n,S))){const q=T(H(n,S),V.argA,V.argB);z&&Ie(n,S,q)}if(Q&&Array.isArray(H(r.errors,S))){const q=T(H(r.errors,S),V.argA,V.argB);z&&Ie(r.errors,S,q),dE(r.errors,S)}if((f.touchedFields||m.touchedFields)&&Q&&Array.isArray(H(r.touchedFields,S))){const q=T(H(r.touchedFields,S),V.argA,V.argB);z&&Ie(r.touchedFields,S,q)}(f.dirtyFields||m.dirtyFields)&&b(),g.state.next({name:S,isDirty:F(S,N),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ie(i,S,N)},w=(S,N)=>{Ie(r.errors,S,N),r.errors={...r.errors},g.state.next({errors:r.errors})},C=S=>{r.errors=S,g.state.next({errors:r.errors,isValid:!1})},D=S=>{const N=Bs(S)?[S]:to(S);let T=i,V=s;for(let z=0;z<N.length-1;z++){const Q=N[z];if(T=nt(T)?T:T[Q],V=nt(V)?V:V[Q],T===null&&V!==null)return!0}return!1},j=(S,N,T,V)=>{const z=H(n,S);if(z){if(D(S))return;const Q=Te(H(i,S)),q=H(i,S,Te(T)?H(s,S):T);Te(q)||V&&V.defaultChecked||N?Ie(i,S,N?q:xu(z._f)):W(S,q),o.mount&&!o.action&&(y(),Q&&r.isDirty&&(f.isDirty||m.isDirty)&&(F()||(r.isDirty=!1,g.state.next({...r}))),e.shouldUnregister&&Q&&!Te(H(i,S))&&Po(S,a)&&(o.watch=!0))}},k=(S,N,T,V,z)=>{let Q=!1,q=!1;const ee={name:S};if(!t.disabled){if(!T||V){(f.isDirty||m.isDirty)&&(q=r.isDirty,r.isDirty=ee.isDirty=F(),Q=q!==ee.isDirty);const de=Rt(H(s,S),N);q=!!H(r.dirtyFields,S),de!==r.isDirty?r.dirtyFields=$r(s,i):de?qe(r.dirtyFields,S):Ie(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,Q=Q||(f.dirtyFields||m.dirtyFields)&&q!==!de}if(T){const de=H(r.touchedFields,S);de||(Ie(r.touchedFields,S,T),ee.touchedFields=r.touchedFields,Q=Q||(f.touchedFields||m.touchedFields)&&de!==T)}Q&&z&&g.state.next(ee)}return Q?ee:{}},L=(S,N,T,V)=>{const z=H(r.errors,S),Q=(f.isValid||m.isValid)&&jt(N)&&r.isValid!==N;if(t.delayError&&T?(c=h(()=>w(S,T)),c(t.delayError)):(clearTimeout(u),c=null,T?Ie(r.errors,S,T):qe(r.errors,S),r.errors={...r.errors}),(T?!Rt(z,T):z)||!Ye(V)||Q){const q={...V,...Q&&jt(N)?{isValid:N}:{},errors:r.errors,name:S};r={...r,...q},g.state.next(q)}},I=async S=>(v(S,!0),await t.resolver(i,t.context,iE(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),R=async S=>{const{errors:N}=await I(S);if(v(S),S){for(const T of S){const V=H(N,T);V?a.array.has(T)&&Fe(V)&&!Object.keys(V).some(z=>!Number.isNaN(Number(z)))?Eu(r.errors,{[T]:V},T):Ie(r.errors,T,V):qe(r.errors,T)}r.errors={...r.errors}}else r.errors=N;return N},M=async({name:S,eventType:N})=>{if(e.validate){const T=await e.validate({formValues:i,formState:r,name:S,eventType:N});if(Fe(T))for(const V in T){const z=T[V];z&&ye(`${ko}.${V}`,{message:pt(z.message)?z.message:"",type:z.type||zt.validate})}else pt(T)||!T?ye(ko,{message:T||"",type:zt.validate}):se(ko);return T}return!0},A=async({fields:S,onlyCheckValid:N,name:T,eventType:V,context:z={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(z.runRootValidation=!0,!await M({name:T,eventType:V})&&(z.valid=!1,N)))return z.valid;for(const Q in S){const q=S[Q];if(q){const{_f:ee,...de}=q;if(ee){const Me=a.array.has(ee.name),_t=q._f&&oE(q._f),wt=f.validatingFields||f.isValidating||m.validatingFields||m.isValidating;_t&&wt&&v([ee.name],!0);const ar=await Iu(q,a.disabled,i,_,t.shouldUseNativeValidation&&!N,Me);if(_t&&wt&&v([ee.name]),ar[ee.name]&&(z.valid=!1,N)||(!N&&(H(ar,ee.name)?Me?Eu(r.errors,ar,ee.name):Ie(r.errors,ee.name,ar[ee.name]):qe(r.errors,ee.name)),e.shouldUseNativeValidation&&ar[ee.name]))break}!Ye(de)&&await A({context:z,onlyCheckValid:N,fields:de,name:Q,eventType:V})}}return z.valid},B=()=>{for(const S of a.unMount){const N=H(n,S);N&&(N._f.refs?N._f.refs.every(T=>!Ao(T)):!Ao(N._f.ref))&&Je(S)}a.unMount=new Set},F=(S,N)=>!t.disabled&&(S&&N&&Ie(i,S,N),!Rt(J(),s)),re=(S,N,T)=>Ca(S,a,{...o.mount?i:Te(N)?s:pt(S)?{[S]:N}:N},T,N),ce=S=>Dh(H(o.mount?i:s,S,t.shouldUnregister?H(s,S,[]):[])),W=(S,N,T={},V=!1)=>{const z=H(n,S);let Q=N;if(z){const q=z._f;q&&(!q.disabled&&Ie(i,S,Rh(N,q)),Q=ji(q.ref)&&nt(N)?"":N,Nh(q.ref)?[...q.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):q.refs?$s(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):hl(q.ref)?q.ref.value="":(q.ref.value=Q,q.ref.type||g.state.next({name:S,values:V?i:Ve(i)})))}(T.shouldDirty||T.shouldTouch)&&k(S,Q,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&Oe(S)},U=(S,N,T,V=!1)=>{for(const z in N){if(!N.hasOwnProperty(z))return;const Q=N[z],q=S+"."+z,ee=H(n,q);(a.array.has(S)||Fe(Q)||ee&&!ee._f)&&!Ur(Q)?U(q,Q,T,V):W(q,Q,T,V)}},X=(S,N,T,V)=>{const z=H(n,S),Q=a.array.has(S),q=V?N:Ve(N),ee=H(i,S),de=Rt(ee,q);if(de||Ie(i,S,q),Q)g.array.next({name:S,values:V?i:Ve(i)}),(f.isDirty||f.dirtyFields||m.isDirty||m.dirtyFields)&&T.shouldDirty&&(b(),g.state.next({name:S,dirtyFields:r.dirtyFields,isDirty:F(S,q)}));else{const Me=Array.isArray(q)&&!q.length||Ye(q);!z||z._f||nt(q)||Me?W(S,q,T,V):U(S,q,T,V)}if(!de){const Me=Po(S,a),_t=V?i:Ve(i);g.state.next({...Me&&r,name:o.mount||Me?S:void 0,values:_t})}},$=(S,N,T={})=>X(S,N,T,!1),K=(S,N={})=>{const T=ht(S)?S(i):S;if(!Rt(i,T)){i={...i,...T};for(const V of a.mount)X(V,H(T,V),N,!0);g.state.next({...r,name:void 0,type:void 0,values:i}),N.shouldValidate&&y()}},Z=async S=>{o.mount=!0;const N=S.target;let T=N.name,V=!0;const z=H(n,T),Q=de=>{V=Number.isNaN(de)||Ur(de)&&isNaN(de.getTime())||Rt(de,H(i,T,de))},q=Su(t.mode),ee=Su(t.reValidateMode);if(z){let de,Me;const _t=N.type?xu(z._f):Sa(S),wt=S.type===Sr.BLUR||S.type===Sr.FOCUS_OUT,ar=!aE(z._f)&&!e.validate&&!t.resolver&&!H(r.errors,T)&&!z._f.deps||uE(wt,H(r.touchedFields,T),r.isSubmitted,ee,q),Wn=Po(T,a,wt);Ie(i,T,_t),wt?(!N||!N.readOnly)&&(z._f.onBlur&&z._f.onBlur(S),c&&c(0)):z._f.onChange&&z._f.onChange(S);const Mr=k(T,_t,wt),Qe=!Ye(Mr)||Wn;if(!wt&&g.state.next({name:T,type:S.type,values:Ve(i)}),ar)return(f.isValid||m.isValid)&&(t.mode==="onBlur"?wt&&y():wt||y()),Qe&&g.state.next({name:T,...Wn?{}:Mr});if(!t.resolver&&e.validate&&await M({name:T,eventType:S.type}),!wt&&Wn&&g.state.next({...r}),t.resolver){const{errors:at}=await I([T]);if(v([T]),Q(_t),!V){!Ye(Mr)&&g.state.next(Mr);return}const mt=Ou(r.errors,n,T),Vt=Ou(at,n,mt.name||T);de=Vt.error,T=Vt.name,Me=Ye(at)}else v([T],!0),de=(await Iu(z,a.disabled,i,_,t.shouldUseNativeValidation))[T],v([T]),Q(_t),V&&(de?Me=!1:(f.isValid||m.isValid)&&(Me=await A({fields:n,onlyCheckValid:!0,name:T,eventType:S.type})));V&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&Oe(z._f.deps),L(T,Me,de,Mr))}},pe=(S,N)=>{if(H(r.errors,N)&&S.focus)return S.focus(),1},Oe=async(S,N={})=>{let T,V;const z=yi(S);if(t.resolver){const Q=await R(Te(S)?S:z);T=Ye(Q),V=S?!z.some(q=>H(Q,q)):T}else S?(V=(await Promise.all(z.map(async Q=>{const q=H(n,Q);return await A({fields:q&&q._f?{[Q]:q}:q,eventType:Sr.TRIGGER})}))).every(Boolean),!(!V&&!r.isValid)&&y()):V=T=await A({fields:n,name:S,eventType:Sr.TRIGGER});return g.state.next({...!pt(S)||(f.isValid||m.isValid)&&T!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:T}:{},errors:r.errors}),N.shouldFocus&&!V&&fs(n,pe,S?z:a.mount),V},J=(S,N)=>{let T={...o.mount?i:s};return N&&(T=Ih(N.dirtyFields?r.dirtyFields:r.touchedFields,T)),Te(S)?T:pt(S)?H(T,S):S.map(V=>H(T,V))},_e=(S,N)=>({invalid:!!H((N||r).errors,S),isDirty:!!H((N||r).dirtyFields,S),error:H((N||r).errors,S),isValidating:!!H(r.validatingFields,S),isTouched:!!H((N||r).touchedFields,S)}),se=S=>{const N=S?yi(S):void 0;N==null||N.forEach(T=>qe(r.errors,T)),N?N.forEach(T=>{g.state.next({name:T,errors:r.errors})}):g.state.next({errors:{}})},ye=(S,N,T)=>{const V=(H(n,S,{_f:{}})._f||{}).ref,z=H(r.errors,S)||{},{ref:Q,message:q,type:ee,...de}=z;Ie(r.errors,S,{...de,...N,ref:V}),g.state.next({name:S,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&V&&V.focus&&V.focus()},oe=(S,N)=>ht(S)?g.state.subscribe({next:T=>"values"in T&&S(T.values||re(void 0,N),T)}):re(S,N,!0),ot=S=>g.state.subscribe({next:N=>{if(cE(S.name,N.name,S.exact)&&lE(N,S.formState||f,Vs,S.reRenderRoot)){const T={...i};S.callback({values:T,...r,...N,defaultValues:s})}}}).unsubscribe,Se=S=>(o.mount=!0,m={...m,...S.formState},ot({...S,formState:{...d,...S.formState}})),Je=(S,N={})=>{for(const T of S?yi(S):a.mount)a.mount.delete(T),a.array.delete(T),N.keepValue||(qe(n,T),qe(i,T)),!N.keepError&&qe(r.errors,T),!N.keepDirty&&qe(r.dirtyFields,T),!N.keepTouched&&qe(r.touchedFields,T),!N.keepIsValidating&&qe(r.validatingFields,T),!t.shouldUnregister&&!N.keepDefaultValue&&qe(s,T);g.state.next({values:Ve(i)}),g.state.next({...r,...N.keepDirty?{isDirty:F()}:{}}),!N.keepIsValid&&y()},Ke=({disabled:S,name:N})=>{if(jt(S)&&o.mount||S||a.disabled.has(N)){const z=a.disabled.has(N)!==!!S;S?a.disabled.add(N):a.disabled.delete(N),z&&o.mount&&!o.action&&y()}},Be=(S,N={})=>{let T=H(n,S);const V=jt(N.disabled)||jt(t.disabled),z=!a.registerName.has(S)&&T&&T._f&&!T._f.mount;return Ie(n,S,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:S}},name:S,mount:!0,...N}}),a.mount.add(S),T&&!z?Ke({disabled:jt(N.disabled)?N.disabled:t.disabled,name:S}):j(S,!0,N.value),{...V?{disabled:N.disabled||t.disabled}:{},...t.progressive?{required:!!N.required,min:ts(N.min),max:ts(N.max),minLength:ts(N.minLength),maxLength:ts(N.maxLength),pattern:ts(N.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:Q=>{if(Q){a.registerName.add(S),Be(S,N),a.registerName.delete(S),T=H(n,S);const q=Te(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=tE(q),de=T._f.refs||[];if(ee?de.find(Me=>Me===q):q===T._f.ref)return;Ie(n,S,{_f:{...T._f,...ee?{refs:[...de.filter(Ao),q,...Array.isArray(H(s,S))?[{}]:[]],ref:{type:q.type,name:S}}:{ref:q}}}),j(S,!1,void 0,q)}else T=H(n,S,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(xh(a.array,S)&&o.action)&&a.unMount.add(S)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&fs(n,pe,a.mount),Re=S=>{jt(S)&&(g.state.next({disabled:S}),fs(n,(N,T)=>{const V=H(n,T);V&&(N.disabled=V._f.disabled||S,Array.isArray(V._f.refs)&&V._f.refs.forEach(z=>{z.disabled=V._f.disabled||S}))},0,!1))},Pe=(S,N)=>async T=>{let V;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let z=Ve(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:q}=await I();v(),r.errors=Q,z=Ve(q)}else await A({fields:n,eventType:Sr.SUBMIT});if(a.disabled.size)for(const Q of a.disabled)qe(z,Q);if(qe(r.errors,Ch),Ye(r.errors)){g.state.next({errors:{}});try{await S(z,T)}catch(Q){V=Q}}else N&&await N({...r.errors},T),te(),setTimeout(te);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ye(r.errors)&&!V,submitCount:r.submitCount+1,errors:r.errors}),V)throw V},et=(S,N={})=>{H(n,S)&&(Te(N.defaultValue)?$(S,Ve(H(s,S))):($(S,N.defaultValue),Ie(s,S,Ve(N.defaultValue))),N.keepTouched||qe(r.touchedFields,S),N.keepDirty||(qe(r.dirtyFields,S),r.isDirty=N.defaultValue?F(S,Ve(H(s,S))):F()),N.keepError||(qe(r.errors,S),f.isValid&&y()),g.state.next({...r}))},bt=(S,N={})=>{const T=S?Ve(S):s,V=Ve(T),z=Ye(S),Q=V;if(N.keepDefaultValues||(s=T),!N.keepValues){if(N.keepDirtyValues){const q=new Set([...a.mount,...Object.keys($r(s,i))]);for(const ee of Array.from(q)){const de=H(r.dirtyFields,ee),Me=H(i,ee),_t=H(Q,ee);de&&!Te(Me)?Ie(Q,ee,Me):!de&&!Te(_t)&&$(ee,_t)}}else{if(eo&&Te(S))for(const q of a.mount){const ee=H(n,q);if(ee&&ee._f){const de=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(ji(de)){const Me=de.closest("form");if(Me){Me.reset();break}}}}if(N.keepFieldsRef)for(const q of a.mount)$(q,H(Q,q));else n={}}if(t.shouldUnregister){if(i=N.keepDefaultValues?Ve(s):{},N.keepFieldsRef)for(const q of a.mount)Ie(i,q,H(Q,q))}else i=Ve(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&&!Ye(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:z?!1:N.keepDirty?r.isDirty:N.keepValues?F():!!(N.keepDefaultValues&&!Rt(S,s)),isSubmitted:N.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:z?{}:N.keepDirtyValues?N.keepDefaultValues&&i?$r(s,i):r.dirtyFields:N.keepDefaultValues&&S?$r(s,S):N.keepDirty?r.dirtyFields:{},touchedFields:N.keepTouched?r.touchedFields:{},errors:N.keepErrors?r.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},or=(S,N)=>bt(ht(S)?S(i):S,{...t.resetOptions,...N}),kt=(S,N={})=>{const T=H(n,S),V=T&&T._f;if(V){const z=V.refs?V.refs[0]:V.ref;z.focus&&setTimeout(()=>{z.focus(),N.shouldSelect&&ht(z.select)&&z.select()})}},Vs=S=>{r={...r,...S}},Us={control:{register:Be,unregister:Je,getFieldState:_e,handleSubmit:Pe,setError:ye,_subscribe:ot,_runSchema:I,_updateIsValidating:v,_focusError:te,_getWatch:re,_getDirty:F,_setValid:y,_setFieldArray:x,_setDisabledField:Ke,_setErrors:C,_getFieldArray:ce,_reset:bt,_resetDefaultValues:()=>ht(t.defaultValues)&&t.defaultValues().then(S=>{or(S,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:B,_disableForm:Re,_subjects:g,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(S){o=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},get _options(){return t},set _options(S){t={...t,...S}}},subscribe:Se,trigger:Oe,register:Be,handleSubmit:Pe,watch:oe,setValue:$,setValues:K,getValues:J,reset:or,resetField:et,resetDefaultValues:(S,N={})=>{if(s=Ve(S),!N.keepDirty){const T=$r(s,i);r.dirtyFields=T,r.isDirty=!Ye(T)}N.keepIsValid||y(),g.state.next({...r,defaultValues:s})},clearErrors:se,unregister:Je,setError:ye,setFocus:kt,getFieldState:_e};return{...Us,formControl:Us}}function pE(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...Ve(Ah),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}=hE(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,dl(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!Rt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((a=o._options.resetOptions)===null||a===void 0)&&a.keepIsValid||o._setValid(),r.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),p.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=p.useMemo(()=>Eh(s,o),[o,s]),t.current}async function Nu(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 Ph(e,t){const r=Dl({queryKey:["framework",e],queryFn:()=>Nu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=Dl({queryKey:["framework",n],queryFn:()=>Nu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}const gE={"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."}},Tu={"First Section":"details","Second Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing"},mE={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"},Mh={board:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},ju=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function yE(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=wE(s),a=xE(s,r,t),c=t[i],u=Lh(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:bE(a,u,o,r),depends:s.depends,tab:_E(s),section:s.section,defaultValue:s.defaultValue??s.default,currentValue:u}}):OE(t,n,r)}function vE(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 bE(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=vE(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 _E(e){const t=e.section;if(t&&Tu[t])return Tu[t];const r=e.code??"";return mE[r]??"details"}function Lh(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 wE(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 xE(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??Mh[i];if(o)return Fh(i,o,e,t,r)}function Fh(e,t,r,n,s){var f,m,g,_,h;const i=ju.has(e)||r.output==="identifier"||typeof r.section=="string"&&r.section.includes("Target"),o=y=>({label:y.name,value:i?y.identifier:y.name}),a=(m=(f=n.organisationFramework)==null?void 0:f.categories)==null?void 0:m.find(y=>y.code===t),c=(h=(_=(g=n.targetFrameworks)==null?void 0:g[0])==null?void 0:_.categories)==null?void 0:h.find(y=>y.code===t);let u=(ju.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 y=d.flatMap(v=>{const b=s[v];return Array.isArray(b)?b:b!=null&&b!==""?[b]:[]}).map(String);if(y.length){const v=u.filter(b=>{const x=b.associations;return!x||!x.length?!0:x.some(w=>y.includes(w.identifier)||y.includes(w.code)||y.includes(w.name))});v.length&&(u=v)}}return u.map(o)}function mn(e,t){const r=Mh[e];if(r)return Fh(e,r,{},t,{})}const SE=[{label:"Student",value:"Student"},{label:"Teacher",value:"Teacher"},{label:"Administrator",value:"Administrator"},{label:"Parent",value:"Parent"},{label:"Other",value:"Other"}],CE=[{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 rt(e,t,r){return Lh(e[t],r)}function OE(e,t,r){const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:rt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:rt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:rt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:rt(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:rt(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:mn("board",r),currentValue:rt(e,"board","select")},{code:"subject",label:"Subjects covered in the course",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:mn("subject",r),currentValue:rt(e,"subject","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",options:SE,currentValue:rt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:mn("targetBoardIds",r),currentValue:rt(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:mn("targetMediumIds",r),currentValue:rt(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:mn("targetGradeLevelIds",r),currentValue:rt(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:mn("targetSubjectIds",r),currentValue:rt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:rt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",options:CE,currentValue:rt(e,"license","select")})),n}function EE(e,t){const{watch:r,setValue:n}=e;p.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 DE="_section_ylgu8_1",IE="_header_ylgu8_11",NE="_title_ylgu8_17",TE="_description_ylgu8_24",jE="_divider_ylgu8_30",RE="_fields_ylgu8_36",yn={section:DE,header:IE,title:NE,description:TE,divider:jE,fields:RE},kE=({title:e,description:t,children:r})=>l.jsxs("div",{className:yn.section,children:[l.jsxs("div",{className:yn.header,children:[l.jsx("h3",{className:yn.title,children:e}),t&&l.jsx("p",{className:yn.description,children:t})]}),l.jsx("hr",{className:yn.divider}),l.jsx("div",{className:yn.fields,children:r})]}),AE="_field_1s288_1",PE="_fullWidth_1s288_7",ME="_label_1s288_11",LE="_required_1s288_19",FE="_input_1s288_24",$E="_textarea_1s288_45",BE="_inputError_1s288_50",VE="_error_1s288_54",UE="_selectBtn_1s288_59",zE="_selectOpen_1s288_83",qE="_placeholder_1s288_87",HE="_selectedVal_1s288_91",WE="_chevronUp_1s288_95",KE="_dropdown_1s288_100",QE="_option_1s288_116",GE="_optionSelected_1s288_134",YE="_noOpts_1s288_139",XE="_chipGroup_1s288_146",ZE="_chipInput_1s288_158",JE="_addChipBtn_1s288_167",eD="_radioGroup_1s288_184",tD="_radioLabel_1s288_191",rD="_iconWrap_1s288_199",nD="_iconPreview_1s288_214",sD="_iconPlaceholder_1s288_220",iD="_removeIconBtn_1s288_233",oD="_tagChip_1s288_252",aD="_tagChipRemove_1s288_264",lD="_nestedSelectRow_1s288_278",cD="_dialcodeRow_1s288_287",uD="_validateBtn_1s288_293",dD="_dialcodeValid_1s288_315",fD="_dialcodeSpinner_1s288_325",P={field:AE,fullWidth:PE,label:ME,required:LE,input:FE,textarea:$E,inputError:BE,error:VE,selectBtn:UE,selectOpen:zE,placeholder:qE,selectedVal:HE,chevronUp:WE,dropdown:KE,option:QE,optionSelected:GE,noOpts:YE,chipGroup:XE,chipInput:ZE,addChipBtn:JE,radioGroup:eD,radioLabel:tD,iconWrap:rD,iconPreview:nD,iconPlaceholder:sD,removeIconBtn:iD,tagChip:oD,tagChipRemove:aD,nestedSelectRow:lD,dialcodeRow:cD,validateBtn:uD,dialcodeValid:dD,dialcodeSpinner:fD},Ru=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Gt(),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:[P.field,s?P.fullWidth:""].join(" "),children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[P.input,P.textarea,u?P.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,d)}):l.jsx("input",{id:e,type:"text",className:[P.input,u?P.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,d)}),u&&l.jsx("span",{className:P.error,children:String(u.message)})]})},hD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Gt(),m=u(e),g=((h=r.find(y=>y.value===m))==null?void 0:h.label)??"Select…",_=f[e];return p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,_?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m?P.selectedVal:P.placeholder,children:g}),l.jsx(ks,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,m===y.value?P.optionSelected:""].join(" "),onClick:()=>{d(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),m===y.value&&l.jsx(Un,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:P.error,children:String(_.message)})]})},pD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:u,setValue:d,formState:{errors:f}}=Gt(),m=u(e)??[],g=f[e],_=m.length?`${m.length} selected`:"Select…";p.useEffect(()=>{if(!i)return;const y=v=>{var b;(b=a.current)!=null&&b.contains(v.target)||o(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const h=y=>{const v=m.includes(y)?m.filter(b=>b!==y):[...m,y];d(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[P.selectBtn,g?P.inputError:"",i?P.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:m.length?P.selectedVal:P.placeholder,children:_}),l.jsx(ks,{size:14,className:i?P.chevronUp:""})]}),i&&l.jsxs("div",{className:P.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[P.option,m.includes(y.value)?P.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Un,{size:13,style:{opacity:m.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:P.noOpts,children:"No options"})]}),g&&l.jsx("span",{className:P.error,children:String(g.message)})]})},gD=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),u=p.useRef(null),{watch:d,setValue:f,formState:{errors:m}}=Gt(),g=d(e)??[],_=m[e],h=()=>{const v=i.trim();v&&!g.includes(v)&&f(e,[...g,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,g.filter(b=>b!==v),{shouldDirty:!0});return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.chipGroup,children:[g.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:u,autoFocus:!0,className:P.chipInput,value:i,onChange:v=>o(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h()),v.key==="Escape"&&(o(""),c(!1))},onBlur:h,placeholder:s}):l.jsxs("button",{type:"button",className:P.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=u.current)==null?void 0:v.focus()},50)},children:[l.jsx(As,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:P.error,children:String(_.message)})]})},mD=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Gt(),a=o[e];return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.radioGroup,children:r.map(c=>l.jsxs("label",{className:P.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:P.error,children:String(a.message)})]})},yD="_overlay_ga6eh_1",vD="_modal_ga6eh_12",bD="_header_ga6eh_24",_D="_title_ga6eh_33",wD="_closeBtn_ga6eh_39",xD="_tabs_ga6eh_57",SD="_tab_ga6eh_57",CD="_activeTab_ga6eh_83",OD="_body_ga6eh_88",ED="_searchWrap_ga6eh_99",DD="_searchIcon_ga6eh_104",ID="_searchInput_ga6eh_113",ND="_grid_ga6eh_132",TD="_imgCell_ga6eh_148",jD="_imgCellSelected_ga6eh_166",RD="_thumb_ga6eh_171",kD="_noThumb_ga6eh_177",AD="_checkBadge_ga6eh_183",PD="_loadMoreBtn_ga6eh_198",MD="_loadingRow_ga6eh_220",LD="_empty_ga6eh_230",FD="_spinner_ga6eh_237",$D="_uploadArea_ga6eh_247",BD="_dropZone_ga6eh_256",VD="_uploadIcon_ga6eh_277",UD="_dropText_ga6eh_281",zD="_dropSubtext_ga6eh_288",qD="_uploadPreview_ga6eh_294",HD="_hiddenInput_ga6eh_301",WD="_fileName_ga6eh_305",KD="_errorText_ga6eh_311",QD="_footer_ga6eh_318",GD="_cancelBtn_ga6eh_328",YD="_confirmBtn_ga6eh_345",ue={overlay:yD,modal:vD,header:bD,title:_D,closeBtn:wD,tabs:xD,tab:SD,activeTab:CD,body:OD,searchWrap:ED,searchIcon:DD,searchInput:ID,grid:ND,imgCell:TD,imgCellSelected:jD,thumb:RD,noThumb:kD,checkBadge:AD,loadMoreBtn:PD,loadingRow:MD,empty:LD,spinner:FD,uploadArea:$D,dropZone:BD,uploadIcon:VD,dropText:UD,dropSubtext:zD,uploadPreview:qD,hiddenInput:HD,fileName:WD,errorText:KD,footer:QD,cancelBtn:GD,confirmBtn:YD},ku=18,$h=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,u]=p.useState([]),[d,f]=p.useState(0),[m,g]=p.useState(!1),[_,h]=p.useState(null),[y,v]=p.useState(0),[b,x]=p.useState(null),[w,C]=p.useState(""),[D,j]=p.useState(!1),[k,L]=p.useState(""),I=p.useRef(null),R=ve($=>{var K,Z;return((Z=(K=$.editorConfig)==null?void 0:K.context)==null?void 0:Z.channel)??""}),M=ve($=>{var K,Z;return((Z=(K=$.editorConfig)==null?void 0:K.context)==null?void 0:Z.uid)??""}),A=p.useCallback(async($,K,Z=!1)=>{var pe;g(!0);try{const Oe={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&M&&(Oe.createdBy=M),R&&(Oe.channel=R);const _e=((pe=(await $e.post("/action/composite/v3/search",{request:{filters:Oe,query:$,limit:ku,offset:K,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:pe.result)??{},se=_e.content??[];f(_e.count??0),u(ye=>Z?[...ye,...se]:se)}catch{}finally{g(!1)}},[s,M,R]);p.useEffect(()=>{s!=="upload"&&(u([]),v(0),A(o,0))},[s]);const B=p.useRef(),F=$=>{a($),clearTimeout(B.current),B.current=setTimeout(()=>{u([]),v(0),A($,0)},400)},re=()=>{const $=y+ku;v($),A(o,$,!0)},ce=()=>{const $=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";$&&r($)},W=$=>{var Z;const K=(Z=$.target.files)==null?void 0:Z[0];if($.target.value="",!!K){if(!K.type.startsWith("image/")){L("Only image files are accepted.");return}if(K.size>4*1024*1024){L("Image must be under 4 MB.");return}x(K),C(URL.createObjectURL(K)),L("")}},U=async()=>{var $,K;if(b){j(!0),L("");try{const Z=new FormData;Z.append("file",b);const Oe=(K=($=(await $e.post(`/action/content/v3/upload/${e}?fileType=image`,Z,{headers:{"Content-Type":"multipart/form-data"}})).data)==null?void 0:$.result)==null?void 0:K.artifactUrl;if(!Oe)throw new Error("No URL in response");r(Oe)}catch(Z){L(Z instanceof Error?Z.message:"Upload failed.")}finally{j(!1)}}},X=c.length<d;return l.jsx("div",{className:ue.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:ue.modal,children:[l.jsxs("div",{className:ue.header,children:[l.jsx("span",{className:ue.title,children:"Select App Icon"}),l.jsx("button",{className:ue.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:18})})]}),l.jsxs("div",{className:ue.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${ue.tab} ${s==="my"?ue.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${ue.tab} ${s==="all"?ue.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${ue.tab} ${s==="upload"?ue.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(ql,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:ue.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:ue.searchWrap,children:[l.jsx(oa,{size:14,className:ue.searchIcon}),l.jsx("input",{type:"search",className:ue.searchInput,placeholder:"Search images…",value:o,onChange:$=>F($.target.value)})]}),m&&c.length===0?l.jsxs("div",{className:ue.loadingRow,children:[l.jsx(si,{size:20,className:ue.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:ue.empty,children:"No images found"}):l.jsx("div",{className:ue.grid,children:c.map($=>{const K=$.appIcon??$.artifactUrl??$.downloadUrl??"",Z=(_==null?void 0:_.identifier)===$.identifier;return l.jsxs("button",{type:"button",className:`${ue.imgCell} ${Z?ue.imgCellSelected:""}`,onClick:()=>h($),title:$.name,children:[K?l.jsx("img",{src:K,alt:$.name,className:ue.thumb}):l.jsx("div",{className:ue.noThumb,children:"IMG"}),Z&&l.jsx("div",{className:ue.checkBadge,children:l.jsx(Un,{size:12})})]},$.identifier)})}),X&&!m&&l.jsx("button",{className:ue.loadMoreBtn,onClick:re,children:"Load More"}),m&&c.length>0&&l.jsx("div",{className:ue.loadingRow,children:l.jsx(si,{size:16,className:ue.spinner})})]}):l.jsxs("div",{className:ue.uploadArea,children:[l.jsx("div",{className:ue.dropZone,onClick:()=>{var $;return($=I.current)==null?void 0:$.click()},onDragOver:$=>$.preventDefault(),onDrop:$=>{$.preventDefault();const K=$.dataTransfer.files[0];K&&W({target:{files:[K],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:ue.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(ql,{size:32,className:ue.uploadIcon}),l.jsx("p",{className:ue.dropText,children:"Drag & drop or click to browse"}),l.jsx("p",{className:ue.dropSubtext,children:"PNG, JPG, SVG · max 4 MB"})]})}),l.jsx("input",{ref:I,type:"file",accept:"image/*",className:ue.hiddenInput,onChange:W}),b&&l.jsx("p",{className:ue.fileName,children:b.name}),k&&l.jsx("p",{className:ue.errorText,children:k})]})}),l.jsxs("div",{className:ue.footer,children:[l.jsx("button",{className:ue.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:ue.confirmBtn,disabled:!b||D,onClick:U,children:D?l.jsxs(l.Fragment,{children:[l.jsx(si,{size:14,className:ue.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:ue.confirmBtn,disabled:!_,onClick:ce,children:"Use Selected"})]})]})})},XD=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:u,formState:{errors:d}}=Gt(),f=a(e),m=d[e],g=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...u(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:P.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:P.iconPreview}):l.jsxs("div",{className:P.iconPlaceholder,children:[l.jsx(Hd,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:P.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(qa,{size:13}),l.jsx("span",{children:"Remove"})]}),m&&l.jsx("span",{className:P.error,children:String(m.message)}),i&&l.jsx($h,{nodeId:r,currentValue:f,onSelect:g,onClose:()=>o(!1)})]})},ZD=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Gt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:P.error,children:String(o.message)})]})},JD=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Gt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),u=p.useRef(null),d=i.value??[],f=h=>{const y=h.trim();!y||d.includes(y)||i.onChange([...d,y])},m=h=>{i.onChange(d.filter(y=>y!==h))},g=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&d.length>0&&m(d[d.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:[P.chipGroup,o?P.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=u.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[d.map(h=>l.jsxs("span",{className:P.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:P.tagChipRemove,onClick:y=>{y.stopPropagation(),m(h)},"aria-label":`Remove ${h}`,children:l.jsx(sn,{size:11})})]},h)),!n&&l.jsx("input",{ref:u,className:P.chipInput,value:a,onChange:h=>c(h.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:P.error,children:String(o.message)})]})},eI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Gt(),{field:o,fieldState:{error:a}}=ro({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},u=(d,f,m)=>{const g={};for(let _=0;_<f;_++)g[r[_].code]=c[r[_].code]??"";g[d]=m;for(let _=f+1;_<r.length;_++)g[r[_].code]="";o.onChange(g)};return l.jsxs("div",{className:[P.field,P.fullWidth].join(" "),children:[l.jsxs("label",{className:P.label,children:[t,n&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("div",{className:P.nestedSelectRow,children:r.map((d,f)=>{const m=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:P.field,style:{flex:1},children:[l.jsx("label",{className:P.label,htmlFor:`${e}_${d.code}`,children:d.label}),l.jsxs("select",{id:`${e}_${d.code}`,className:[P.input,a?P.inputError:""].join(" "),disabled:s||m,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:P.error,children:String(a.message)})]})},Au=[{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"}],tI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:u,formState:{errors:d}}=Gt(),f=c(e),m=Au.find(h=>h.value===f),g=(m==null?void 0:m.label)??"Select license…",_=d[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:P.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:P.label,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[P.selectBtn,_?P.inputError:"",s?P.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?P.selectedVal:P.placeholder,children:g}),l.jsx(ks,{size:14,className:s?P.chevronUp:""})]}),s&&l.jsx("div",{className:P.dropdown,role:"listbox",children:Au.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[P.option,f===h.value?P.optionSelected:""].join(" "),onClick:()=>{u(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Un,{size:13})]},h.value))}),_&&l.jsx("span",{className:P.error,children:String(_.message)})]})},rI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Gt(),{field:i,fieldState:{error:o}}=ro({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[u,d]=p.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 P_(g),h=_==null?void 0:_.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.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.")}},m=()=>a==="loading"?l.jsx(si,{size:16,className:P.dialcodeSpinner}):a==="valid"?l.jsx(Vd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(ia,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:P.field,children:[l.jsxs("label",{className:P.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:P.required,children:"*"})]}),l.jsxs("div",{className:P.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[P.input,o?P.inputError:""].join(" "),disabled:n,value:i.value??"",onChange: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:P.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),m()]}),o&&l.jsx("span",{className:P.error,children:String(o.message)}),!o&&u&&l.jsx("span",{className:a==="valid"?P.dialcodeValid:P.error,children:u})]})},nI="_form_szqex_1",sI="_ungrouped_szqex_7",iI="_noFields_szqex_18",Mo={form:nI,ungrouped:sI,noFields:iI},oI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var F,re,ce;const a=ve(W=>W.editorConfig),c=ve(W=>W.rootFormConfig),u=ve(W=>W.unitFormConfig),{organisationFramework:d,targetFrameworks:f,isLoading:m}=Ph((F=a==null?void 0:a.context)==null?void 0:F.framework,(re=a==null?void 0:a.context)==null?void 0:re.targetFWIds),g={organisationFramework:d,targetFrameworks:f},_=ke(W=>W.selectedNodeId),h=ke(W=>W.treeCache),y=_?h[_]??{}:{},v={...e,...y},b=r?c:u,x=b||(((ce=a==null?void 0:a.config.hierarchy)==null?void 0:ce.formConfig)??[]),w=yE(x,v,g,r),C=w.filter(W=>W.tab===t&&W.inputType!=="appIcon"),D=pE({mode:"onChange",defaultValues:Object.fromEntries(w.map(W=>{const U=["multiselect","chips","keywords","tagsinput"],X=["nestedselect"];return U.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??[]]:X.includes(W.inputType)?[W.code,W.currentValue??W.defaultValue??{}]:[W.code,W.currentValue??W.defaultValue??""]}))});EE(D,w);const{updateNode:j}=ke(),k=p.useRef(w);k.current=w;const L=p.useRef(_);L.current=_;const I=p.useRef(i);I.current=i;const R=p.useRef(o);R.current=o,p.useEffect(()=>{const W=D.watch((U,{name:X})=>{const $=L.current;if(!$)return;const K=k.current,Z=new Set(K.map(J=>J.code));if(X&&Z.has(X)){const J=D.getValues(X);j($,{[X]:J}),I.current({[X]:J})}else if(!X){const J=D.getValues(),_e=Object.fromEntries(Object.entries(J).filter(([se])=>Z.has(se)));Object.keys(_e).length>0&&(j($,_e),I.current(_e))}const pe=D.formState.errors,Oe=Array.from(new Set(Object.keys(pe).map(J=>{var _e;return(_e=K.find(se=>se.code===J))==null?void 0:_e.tab}).filter(Boolean)));R.current(Object.keys(pe).length===0,Oe)});return()=>W.unsubscribe()},[D]);const M=s!=="edit",A=C.reduce((W,U)=>{const X=W[W.length-1];return X&&X.section===U.section?X.fields.push(U):W.push({section:U.section,fields:[U]}),W},[]),B=W=>{const U={key:W.code,name:W.code,label:W.label,required:W.required,disabled:M||W.editable===!1};switch(W.inputType){case"textarea":return l.jsx(Ru,{...U,multiline:!0,maxLength:W.maxLength});case"select":return l.jsx(hD,{...U,options:W.options??[]});case"multiselect":return l.jsx(pD,{...U,options:W.options??[]});case"chips":return l.jsx(gD,{...U});case"radio":return l.jsx(mD,{...U,options:W.options??[]});case"appIcon":return l.jsx(XD,{...U,nodeId:_??""});case"datepicker":case"datetime":return l.jsx(ZD,{...U});case"keywords":case"tagsinput":return l.jsx(JD,{...U});case"nestedselect":return l.jsx(eI,{...U,levels:W.levels??[]});case"license":return l.jsx(tI,{...U});case"dialcode":return l.jsx(rI,{...U});default:return l.jsx(Ru,{...U,maxLength:W.maxLength})}};return l.jsx(JO,{...D,children:l.jsxs("div",{className:Mo.form,children:[A.map((W,U)=>{const X=W.section?gE[W.section]:void 0;return X?l.jsx(kE,{title:X.title,description:X.description,children:W.fields.map(B)},W.section??U):l.jsx("div",{className:Mo.ungrouped,children:W.fields.map(B)},U)}),C.length===0&&!m&&l.jsx("p",{className:Mo.noFields,children:"No fields configured for this tab."})]})})};function Bh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function aI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function Zs(e){return e!==null&&e>=0}function lI(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 cI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Vh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Bh(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}},Js={scaleX:1,scaleY:1},uI=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,...Js}:null}const c=dI(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...Js}:s<r&&s>=o?{x:0,y:a.height+c,...Js}:{x:0,y:0,...Js}};function dI(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 Uh="Sortable",zh=p.createContext({activeIndex:-1,containerId:Uh,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vh,disabled:{draggable:!1,droppable:!1}});function fI(e){let{children:t,id:r,items:n,strategy:s=Vh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:u,measureDroppableContainers:d}=Fd(),f=js(Uh,r),m=a.rect!==null,g=p.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),_=o!=null,h=o?g.indexOf(o.id):-1,y=u?g.indexOf(u.id):-1,v=p.useRef(g),b=!lI(g,v.current),x=y!==-1&&h===-1||b,w=cI(i);Wt(()=>{b&&_&&d(g)},[b,g,_,d]),p.useEffect(()=>{v.current=g},[g]);const C=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:x,items:g,overIndex:y,useDragOverlay:m,sortedRects:aI(g,c),strategy:s}),[h,f,w.draggable,w.droppable,x,g,y,c,m,s]);return p.createElement(zh.Provider,{value:C},t)}const hI=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Bh(r,n,s).indexOf(t)},pI=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},gI={duration:200,easing:"ease"},qh="transform",mI=Ar.Transition.toString({property:qh,duration:0,easing:"linear"}),yI={roleDescription:"sortable"};function vI(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Wt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const u=Vn(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]),p.useEffect(()=>{i&&o(null)},[i]),i}function bI(e){let{animateLayoutChanges:t=pI,attributes:r,disabled:n,data:s,getNewIndex:i=hI,id:o,strategy:a,resizeObserverConfig:c,transition:u=gI}=e;const{items:d,containerId:f,activeIndex:m,disabled:g,disableTransforms:_,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=p.useContext(zh),x=_I(n,g),w=d.indexOf(o),C=p.useMemo(()=>({sortable:{containerId:f,index:w,items:d},...s}),[f,s,w,d]),D=p.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:j,node:k,isOver:L,setNodeRef:I}=$m({id:o,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:R,activatorEvent:M,activeNodeRect:A,attributes:B,setNodeRef:F,listeners:re,isDragging:ce,over:W,setActivatorNodeRef:U,transform:X}=Ld({id:o,data:C,attributes:{...yI,...r},disabled:x.draggable}),$=Cg(I,F),K=!!R,Z=K&&!_&&Zs(m)&&Zs(y),pe=!v&&ce,Oe=pe&&Z?X:null,_e=Z?Oe??(a??b)({rects:h,activeNodeRect:A,activeIndex:m,overIndex:y,index:w}):null,se=Zs(m)&&Zs(y)?i({id:o,items:d,activeIndex:m,overIndex:y}):w,ye=R==null?void 0:R.id,oe=p.useRef({activeId:ye,items:d,newIndex:se,containerId:f}),ot=d!==oe.current.items,Se=t({active:R,containerId:f,isDragging:ce,isSorting:K,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}),Je=vI({disabled:!Se,index:w,node:k,rect:j});return p.useEffect(()=>{K&&oe.current.newIndex!==se&&(oe.current.newIndex=se),f!==oe.current.containerId&&(oe.current.containerId=f),d!==oe.current.items&&(oe.current.items=d)},[K,se,f,d]),p.useEffect(()=>{if(ye===oe.current.activeId)return;if(ye&&!oe.current.activeId){oe.current.activeId=ye;return}const Be=setTimeout(()=>{oe.current.activeId=ye},50);return()=>clearTimeout(Be)},[ye]),{active:R,activeIndex:m,attributes:B,data:C,rect:j,index:w,newIndex:se,items:d,isOver:L,isSorting:K,isDragging:ce,listeners:re,node:k,overIndex:y,over:W,setNodeRef:$,setActivatorNodeRef:U,setDroppableNodeRef:I,setDraggableNodeRef:F,transform:Je??_e,transition:Ke()};function Ke(){if(Je||ot&&oe.current.newIndex===w)return mI;if(!(pe&&!$i(M)||!u)&&(K||Se))return Ar.Transition.toString({...u,property:qh})}}function _I(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 ki(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 wI=[me.Down,me.Right,me.Up,me.Left],xI=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(wI.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=s.get(f.id);if(m)switch(e.code){case me.Down:n.top<m.top&&c.push(f);break;case me.Up:n.top>m.top&&c.push(f);break;case me.Left:n.left>m.left&&c.push(f);break;case me.Right:n.left<m.left&&c.push(f);break}});const u=Vg({collisionRect:n,droppableRects:s,droppableContainers:c});let d=_d(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),m=i.get(d),g=m?s.get(m.id):null,_=m==null?void 0:m.node.current;if(_&&g&&f&&m){const y=Bi(_).some((D,j)=>a[j]!==D),v=Hh(f,m),b=SI(f,m),x=y||!v?{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 x.x&&x.y?w:ys(w,x)}}}};function Hh(e,t){return!ki(e)||!ki(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function SI(e,t){return!ki(e)||!ki(t)||!Hh(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const CI="_row_11nth_1",OI="_removeBtn_11nth_14",EI="_grip_11nth_17",DI="_ctIcon_11nth_34",II="_info_11nth_38",NI="_name_11nth_46",TI="_meta_11nth_55",Lr={row:CI,removeBtn:OI,grip:EI,ctIcon:DI,info:II,name:NI,meta:TI},jI={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},RI=({item:e,onRemove:t,isEditable:r})=>{const n=Ji(e),s=jI[n.key]??zn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:u,isDragging:d}=bI({id:e.id,disabled:!r}),f={transform:Ar.Transform.toString(c),transition:u,opacity:d?.5:1};return l.jsxs("div",{ref:a,style:f,className:Lr.row,role:"listitem",children:[r&&l.jsx("span",{className:Lr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(qd,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Lr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Lr.info,children:[l.jsx("span",{className:Lr.name,title:e.name,children:e.name}),l.jsx("span",{className:Lr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Lr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(sn,{size:14})})]})},kI="_container_lzvke_1",AI="_header_lzvke_7",PI="_heading_lzvke_13",MI="_count_lzvke_21",LI="_list_lzvke_30",FI="_emptyState_lzvke_36",$I="_addRow_lzvke_52",Fr={container:kI,header:AI,heading:PI,count:MI,list:LI,emptyState:FI,addRow:$I},BI=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=ke(),i=t?r(t):[],o=e==="edit",a=yd(ta(Vi,{activationConstraint:{distance:5}}),ta(Ma,{coordinateGetter:xI})),c=p.useCallback(d=>{const{active:f,over:m}=d;if(!m||f.id===m.id||!t)return;const g=ke.getState().getChildrenOf(t),_=g.findIndex(y=>y.id===f.id),h=g.findIndex(y=>y.id===m.id);_<0||h<0||n(t,_,h)},[t,n]),u=p.useCallback(d=>{window.confirm("Remove this content from the unit?")&&s(d)},[s]);return t?l.jsxs("div",{className:Fr.container,children:[l.jsxs("div",{className:Fr.header,children:[l.jsx("span",{className:Fr.heading,children:"Content in this unit"}),l.jsx("span",{className:Fr.count,children:i.length})]}),i.length>0?l.jsx(Md,{sensors:a,collisionDetection:Bg,onDragEnd:c,children:l.jsx(fI,{items:i.map(d=>d.id),strategy:uI,children:l.jsx("div",{className:Fr.list,role:"list",children:i.map(d=>l.jsx(RI,{item:d,onRemove:u,isEditable:o},d.id))})})}):l.jsxs("div",{className:Fr.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:Fr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(As,{size:14})," Add content"]})]}):null},VI="_dropZone_ijo5w_1",UI="_active_ijo5w_14",Pu={dropZone:VI,active:UI},zI=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Pu.dropZone} ${e?Pu.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 qI(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 HI(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 WI="_contentPlayerRoot_ryh6z_1",KI="_stage_ryh6z_9",QI="_playerHeader_ryh6z_19",GI="_playerHeaderThumb_ryh6z_33",YI="_playerHeaderTitle_ryh6z_43",XI="_typeBadge_ryh6z_53",ZI="_typeDot_ryh6z_92",JI="_aspectRatio_ryh6z_99",eN="_playerFrame_ryh6z_112",tN="_coverOverlay_ryh6z_120",rN="_coverHidden_ryh6z_132",nN="_coverThumb_ryh6z_137",sN="_coverPlayRing_ryh6z_146",iN="_coverPlayIcon_ryh6z_159",oN="_coverLabel_ryh6z_168",aN="_coverSkeleton_ryh6z_174",lN="_playerWrapper_ryh6z_200",cN="_infoStrip_ryh6z_210",uN="_infoChip_ryh6z_226",dN="_infoChipLabel_ryh6z_245",fN="_infoChipIcon_ryh6z_254",hN="_playerError_ryh6z_260",pN="_playerErrorIcon_ryh6z_274",gN="_playerErrorMsg_ryh6z_279",mN="_qumlRoot_ryh6z_286",je={contentPlayerRoot:WI,stage:KI,playerHeader:QI,playerHeaderThumb:GI,playerHeaderTitle:YI,typeBadge:XI,typeDot:ZI,aspectRatio:JI,playerFrame:eN,coverOverlay:tN,coverHidden:rN,coverThumb:nN,coverPlayRing:sN,coverPlayIcon:iN,coverLabel:oN,coverSkeleton:aN,playerWrapper:lN,infoStrip:cN,infoChip:uN,infoChipLabel:dN,infoChipIcon:fN,playerError:hN,playerErrorIcon:pN,playerErrorMsg:gN,qumlRoot:mN},yN=[{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 vN(e){return yN.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const bN={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},_N={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},wN={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},xN="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Lo(e){for(const[t,r]of Object.entries(bN))if(r.includes(e))return t;return"default-player"}function SN(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 CN(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 ON(e,t,r=100){await CN(_N[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 EN=[{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 DN({node:e}){const t=e.metadata??{},r=EN.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:je.infoStrip,children:r.map(n=>l.jsxs("div",{className:je.infoChip,children:[n.icon&&l.jsx("span",{className:je.infoChipIcon,children:n.icon}),l.jsx("span",{className:je.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function IN({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${je.coverOverlay} ${t?je.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:je.coverThumb}),l.jsx("div",{className:je.coverPlayRing,children:l.jsx("div",{className:je.coverPlayIcon})}),l.jsx("span",{className:je.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:je.coverSkeleton})})}function NN({message:e}){return l.jsxs("div",{className:je.playerError,children:[l.jsx("span",{className:je.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:je.playerErrorMsg,children:e})]})}function TN({mimeType:e}){const t=vN(e);return l.jsxs("span",{className:je.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:je.typeDot}),t.label]})}const Ia=({node:e,editorMode:t,type:r})=>{var s;if(r==="quml")return l.jsx(RN,{node:e,editorMode:t});const n=e.appIcon??((s=e.metadata)==null?void 0:s.appIcon);return l.jsxs("div",{className:je.contentPlayerRoot,children:[l.jsxs("div",{className:je.stage,children:[l.jsxs("div",{className:je.playerHeader,children:[n&&l.jsx("img",{src:n,alt:"",className:je.playerHeaderThumb}),l.jsx("span",{className:je.playerHeaderTitle,children:e.name}),l.jsx(TN,{mimeType:e.mimeType??""})]}),l.jsx(jN,{node:e})]}),l.jsx(DN,{node:e})]})};function jN({node:e}){var y;const t=ve(v=>v.editorConfig),[r,n]=p.useState(()=>Lo(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,u]=p.useState(e.metadata??{}),[d,f]=p.useState(!1),m=p.useRef(null),g=p.useRef(null),_=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??xN;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),u(e.metadata??{}),n(Lo(e.mimeType??"")),HI(e.identifier).then(b=>{if(v)return;const x={...e.metadata??{},...b};u(x);const w=b.mimeType??e.mimeType??"";n(Lo(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=SN(e,c,t);return p.useEffect(()=>{if(!d||r!=="default-player")return;const v=m.current;if(!v)return;v.src=_;const b=()=>{try{const w=v.contentWindow;if(typeof(w==null?void 0:w.initializePreview)!="function"){a("Preview player unavailable. Check that /content/preview is reachable.");return}w.initializePreview(h),setTimeout(()=>i(!0),300)}catch(w){console.error("[ContentPlayer] initializePreview failed",w),a("Failed to initialize the content player.")}},x=()=>a("Preview player could not be loaded.");return v.addEventListener("load",b),v.addEventListener("error",x),()=>{v.removeEventListener("load",b),v.removeEventListener("error",x),v.src=""}},[e.identifier,r,_,d]),p.useEffect(()=>{if(!d||r==="default-player")return;const v=g.current;if(!v)return;const b=wN[r];if(!b)return;const x=h;ON(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(x)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=x}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,d]),l.jsxs("div",{className:je.aspectRatio,children:[o?l.jsx(NN,{message:o}):l.jsx(IN,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:m,id:"contentPlayer",title:e.name,className:je.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:g,className:je.playerFrame})]})}function RN({node:e,editorMode:t}){const r=ve(s=>s.editorConfig),n=p.useRef(null);return p.useEffect(()=>{var a;if(!n.current)return;const s=r==null?void 0:r.context,i={context:{mode:t==="edit"?"edit":"play",pdata:{id:((a=s==null?void 0:s.pdata)==null?void 0:a.id)??"sunbird.portal",ver:"1.0",pid:"sunbird-portal"},contentId:e.identifier,sid:(s==null?void 0:s.sid)??"",uid:(s==null?void 0:s.uid)??"",channel:(s==null?void 0:s.channel)??"",did:(s==null?void 0:s.did)??""},config:{enable:!1,showShare:!1,showDownload:!1,showReplay:!0,showExit:!1},metadata:e.metadata??{},data:{}},o=document.createElement("sunbird-quml-player");o.setAttribute("player-config",JSON.stringify(i)),n.current.innerHTML="",n.current.appendChild(o)},[e.identifier,t]),l.jsx("div",{className:je.qumlRoot,children:l.jsx("div",{ref:n,className:je.playerWrapper})})}const kN="_overlay_ifddx_1",AN="_modal_ifddx_11",PN="_header_ifddx_21",MN="_body_ifddx_37",LN="_hint_ifddx_43",FN="_list_ifddx_49",$N="_item_ifddx_55",BN="_selected_ifddx_68",VN="_empty_ifddx_73",UN="_footer_ifddx_79",zN="_cancelBtn_ifddx_87",qN="_moveBtn_ifddx_95",Lt={overlay:kN,modal:AN,header:PN,body:MN,hint:LN,list:FN,item:$N,selected:BN,empty:VN,footer:UN,cancelBtn:zN,moveBtn:qN};function HN(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 WN=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var d;const{treeData:s,moveNode:i}=ke(),o=HN(s,((d=s[0])==null?void 0:d.id)??"",r),[a,c]=p.useState(null),u=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Lt.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Lt.modal,children:[l.jsxs("div",{className:Lt.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(sn,{size:16})})]}),l.jsxs("div",{className:Lt.body,children:[l.jsx("p",{className:Lt.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Lt.list,children:[o.map(f=>l.jsxs("li",{className:`${Lt.item} ${a===f.id?Lt.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(ly,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Lt.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Lt.footer,children:[l.jsx("button",{className:Lt.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Lt.moveBtn,onClick:u,disabled:!a,children:"Move here"})]})]})})},KN="_overlay_16at9_1",QN="_modal_16at9_11",GN="_header_16at9_21",YN="_body_16at9_37",XN="_table_16at9_43",ZN="_pageInput_16at9_61",JN="_empty_16at9_68",eT="_footer_16at9_74",tT="_cancelBtn_16at9_82",rT="_saveBtn_16at9_90",er={overlay:KN,modal:QN,header:GN,body:YN,table:XN,pageInput:ZN,empty:JN,footer:eT,cancelBtn:tT,saveBtn:rT};function nT(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 sT=({onClose:e})=>{const{treeData:t,updateNode:r}=ke(),n=nT(t),[s,i]=p.useState(()=>Object.fromEntries(n.map(a=>{var c;return[a.id,String(((c=a.metadata)==null?void 0:c.pageNumber)??"")]}))),o=p.useCallback(()=>{for(const[a,c]of Object.entries(s))c!==""&&r(a,{pageNumber:parseInt(c,10)||void 0});e()},[s,r,e]);return l.jsx("div",{className:er.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:er.modal,children:[l.jsxs("div",{className:er.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(sn,{size:16})})]}),l.jsx("div",{className:er.body,children:n.length===0?l.jsx("p",{className:er.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:er.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:er.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:er.footer,children:[l.jsx("button",{className:er.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:er.saveBtn,onClick:o,children:[l.jsx(yy,{size:14})," Save"]})]})]})})},iT="_container_1a7t2_1",oT="_panelHeader_1a7t2_10",aT="_panelHeaderLeft_1a7t2_19",lT="_panelCollapseBtn_1a7t2_27",cT="_titleRow_1a7t2_46",uT="_field_1a7t2_47",dT="_moveBtn_1a7t2_64",fT="_icon_1a7t2_84",hT="_nameInput_1a7t2_93",pT="_fieldHeader_1a7t2_118",gT="_label_1a7t2_124",mT="_fieldCount_1a7t2_133",yT="_chips_1a7t2_170",vT="_chip_1a7t2_170",bT="_chipRemove_1a7t2_188",_T="_keywordInput_1a7t2_202",wT="_input_1a7t2_207",xT="_addBtn_1a7t2_220",ST="_radioGroup_1a7t2_234",CT="_radioLabel_1a7t2_239",Le={container:iT,panelHeader:oT,panelHeaderLeft:aT,panelCollapseBtn:lT,titleRow:cT,field:uT,moveBtn:dT,icon:fT,nameInput:hT,fieldHeader:pT,label:gT,fieldCount:mT,chips:yT,chip:vT,chipRemove:bT,keywordInput:_T,input:wT,addBtn:xT,radioGroup:ST,radioLabel:CT},OT=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var R,M;const{updateNode:s,markDirty:i}=ke(),o=t==="edit",a=Ji(e),c=ve(A=>A.relationalFormConfig),u=A=>c==null?void 0:c.find(B=>B.code===A),d=A=>!c||!!u(A),f=(A,B)=>{var F;return((F=u(A))==null?void 0:F.label)||B},[m,g]=p.useState(!0),_=((R=e.metadata)==null?void 0:R.relationalMetadata)??{},[h,y]=p.useState(_.name??e.name??""),[v,b]=p.useState(""),[x,w]=p.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((M=e.metadata)==null?void 0:M.keywords)?e.metadata.keywords:[]),[C,D]=p.useState(!!_.optional);p.useEffect(()=>{var B,F;const A=((B=e.metadata)==null?void 0:B.relationalMetadata)??{};y(A.name??e.name??""),w(Array.isArray(A.keywords)?A.keywords:Array.isArray((F=e.metadata)==null?void 0:F.keywords)?e.metadata.keywords:[]),D(!!A.optional)},[e.id]);const j=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},k=()=>{const A=v.trim();if(A&&!x.includes(A)){const B=[...x,A];w(B),s(e.id,{keywords:B}),i()}b("")},L=A=>{const B=x.filter(F=>F!==A);w(B),s(e.id,{keywords:B}),i()},I=A=>{D(A),s(e.id,{optional:A}),i()};return l.jsxs("div",{className:Le.container,children:[l.jsxs("div",{className:Le.panelHeader,children:[l.jsxs("div",{className:Le.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Le.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Le.panelCollapseBtn,onClick:()=>g(A=>!A),"aria-expanded":m,"aria-label":m?"Collapse metadata panel":"Expand metadata panel",title:m?"Collapse":"Expand",children:m?l.jsx(ks,{size:15}):l.jsx(iy,{size:15})})]}),m&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Le.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Le.icon}),l.jsx("input",{type:"text",className:Le.nameInput,value:h,disabled:!o,onChange:A=>y(A.target.value),onBlur:j,placeholder:"Content name"})]}),d("keywords")&&l.jsxs("div",{className:Le.field,children:[l.jsx("div",{className:Le.fieldHeader,children:l.jsxs("label",{className:Le.label,children:[f("keywords","Keywords"),x.length>0&&l.jsx("span",{className:Le.fieldCount,children:x.length})]})}),x.length>0&&l.jsx("div",{className:Le.chips,children:x.map(A=>l.jsxs("span",{className:Le.chip,children:[A,o&&l.jsx("button",{type:"button",className:Le.chipRemove,onClick:()=>L(A),children:"×"})]},A))}),o&&l.jsxs("div",{className:Le.keywordInput,children:[l.jsx("input",{type:"text",className:Le.input,value:v,placeholder:"Add keyword and press Enter",onChange:A=>b(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),k())}}),l.jsx("button",{type:"button",className:Le.addBtn,onClick:k,children:"Add"})]})]}),d("optional")&&l.jsxs("div",{className:Le.field,children:[l.jsx("label",{className:Le.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Le.radioGroup,children:[l.jsxs("label",{className:Le.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>I(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Le.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>I(!1),disabled:!o}),"No"]})]})]})]}),n]})},ET="_iconBtn_vl14u_1",DT="_editable_vl14u_14",IT="_iconImg_vl14u_26",NT="_placeholder_vl14u_34",TT="_removeBtn_vl14u_41",rs={iconBtn:ET,editable:DT,iconImg:IT,placeholder:NT,removeBtn:TT},jT=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=ke(),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:[rs.iconBtn,r?rs.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:rs.iconImg}):l.jsx("div",{className:rs.placeholder,children:l.jsx(Hd,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:rs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(qa,{size:11})})]}),n&&l.jsx($h,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},RT="_leafContentLayout_1osey_1",kT="_container_1osey_17",AT="_emptyState_1osey_26",PT="_titleRow_1osey_36",MT="_nodeTitle_1osey_52",LT="_formArea_1osey_74",FT="_contentListArea_1osey_78",$T="_dropZone_1osey_83",BT="_reviewComment_1osey_90",VT="_reviewCommentLabel_1osey_103",UT="_reviewCommentText_1osey_109",Ut={leafContentLayout:RT,container:kT,emptyState:AT,titleRow:PT,nodeTitle:MT,formArea:LT,contentListArea:FT,dropZone:$T,reviewComment:BT,reviewCommentLabel:VT,reviewCommentText:UT},zT=["application/vnd.sunbird.questionset"],qT=({editorMode:e,onToolbarEvent:t})=>{var R,M,A,B;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,u]=p.useState(!1),d=p.useRef(null),f=p.useRef(),{selectedNodeId:m,breadcrumb:g,activeNodeMeta:_,updateNode:h,treeData:y}=ke(),v=ve(F=>{var re,ce,W,U;return((ce=(re=F.editorConfig)==null?void 0:re.context)==null?void 0:ce.contentId)??((U=(W=F.editorConfig)==null?void 0:W.context)==null?void 0:U.identifier)??""}),b=m?Wh(y,m):null,x=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),C=b&&zT.includes(b.mimeType??""),D=b&&!b.isFolder&&!C&&!x,j=((R=b==null?void 0:b.metadata)==null?void 0:R.rejectComment)??(x?(A=(M=y[0])==null?void 0:M.metadata)==null?void 0:A.rejectComment:void 0),k=p.useCallback(()=>{const F=d.current;if(!F||!m)return;const re=F.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(m,{name:re})},600)},[m,h]),L=p.useCallback(F=>{t({action:"onFormValueChange",data:F})},[t]),I=p.useCallback((F,re)=>{i(re),t({action:"onFormStatusChange",data:{isValid:F}})},[t]);return b?C?l.jsx(Ia,{node:b,editorMode:e,type:"quml"}):D?l.jsxs("div",{className:Ut.leafContentLayout,children:[l.jsx(Ia,{node:b,editorMode:e,type:"content"}),l.jsx(OT,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(WN,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Ut.container,children:[l.jsx(qO,{crumbs:g}),j&&l.jsxs("div",{className:Ut.reviewComment,role:"alert",children:[l.jsx("span",{className:Ut.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Ut.reviewCommentText,children:j})]}),l.jsxs("div",{className:Ut.titleRow,children:[x&&m&&l.jsx(jT,{nodeId:m,value:String(b.appIcon??((B=b.metadata)==null?void 0:B.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:d,className:Ut.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:k,onBlur:k,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(YO,{activeTab:r,onChange:F=>n(F),errorTabs:s,visibleTabs:x?void 0:["details"]}),l.jsx("div",{className:Ut.formArea,children:l.jsx(oI,{nodeMetadata:_,activeTab:r,isRoot:x,isFolder:w,editorMode:e,onFormValueChange:L,onFormStatusChange:I},`${m??"none"}:${x?"root":"node"}`)}),(w||x)&&r==="details"&&l.jsx("div",{className:Ut.contentListArea,children:l.jsx(BI,{editorMode:e})}),l.jsx(zI,{isActive:!1,label:"Drop to add content to this unit",nodeId:m??void 0,className:Ut.dropZone}),c&&l.jsx(sT,{contentId:v,onClose:()=>u(!1)})]}):l.jsx("div",{className:Ut.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function Wh(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Wh(r.children,t);if(n)return n}}}const Kh=qi((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),HT=20;function Qh(){var u;const e=ve(d=>d.editorConfig),t=ke(d=>d.selectedNodeId),r=ke(d=>d.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function d(f,m,g=0){var _;for(const h of f){if(h.id===m)return g;if((_=h.children)!=null&&_.length){const y=d(h.children,m,g+1);if(y>=0)return y}}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[...gu];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:[...gu]}function WT(){const e=Kh(),t=ve(f=>{var m,g;return((g=(m=f.editorConfig)==null?void 0:m.context)==null?void 0:g.channel)??""}),r=Qh(),n=p.useRef(),s=p.useCallback(async(f="",m="all",g={},_=!0,h=!1)=>{var y,v,b,x,w;e.setLoading(!0);try{const C={status:["Live"],contentType:["Resource"],primaryCategory:m&&m!=="all"?[m]:r};(y=g==null?void 0:g.board)!=null&&y.length&&(C.board=g.board),(v=g==null?void 0:g.medium)!=null&&v.length&&(C.medium=g.medium),(b=g==null?void 0:g.gradeLevel)!=null&&b.length&&(C.gradeLevel=g.gradeLevel),(x=g==null?void 0:g.subject)!=null&&x.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:j,count:k}=await qI({filters:C,query:f,limit:f?50:HT,offset:D,channel:t||void 0,sortBy:h?{name:"asc"}:{lastUpdatedOn:"desc"}});_?e.setContent(j,k):e.appendContent(j,k)}catch(C){console.error("[useLibrary] load error:",C)}finally{e.setLoading(!1)}},[r,t]);p.useEffect(()=>{s()},[t]);const i=p.useCallback(f=>{e.setSearch(f),clearTimeout(n.current),n.current=setTimeout(()=>s(f,e.activeFilter,e.advancedFilters,!0,e.sortAZ),300)},[e.activeFilter,e.advancedFilters,e.sortAZ,s]),o=p.useCallback(f=>{e.setFilter(f),s(e.searchQuery,f,e.advancedFilters,!0,e.sortAZ)},[e.searchQuery,e.advancedFilters,e.sortAZ,s]),a=p.useCallback(f=>{e.setAdvancedFilters(f),s(e.searchQuery,e.activeFilter,f,!0,e.sortAZ)},[e.searchQuery,e.activeFilter,e.sortAZ,s]),c=p.useCallback(()=>{const f=!e.sortAZ;e.setSortAZ(f),s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,f)},[e.sortAZ,e.searchQuery,e.activeFilter,e.advancedFilters,s]),u=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),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 KT="_card_grbmp_1",QT="_addBtn_grbmp_17",GT="_dragging_grbmp_24",YT="_ctIcon_grbmp_29",XT="_info_grbmp_33",ZT="_name_grbmp_41",JT="_meta_grbmp_50",ej="_added_grbmp_78",tj="_addedBadge_grbmp_87",cr={card:KT,addBtn:QT,dragging:GT,ctIcon:YT,info:XT,name:ZT,meta:JT,added:ej,addedBadge:tj},rj={video:Ha,pdf:Ba,h5p:Va,scorm:za,audio:Ua,quiz:$a,default:zn},nj=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=Ji(e),o=rj[i.key]??zn,a=ll(),c=E1(),u=a&&!s&&c,{attributes:d,listeners:f,setNodeRef:m,isDragging:g}=Ld({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:m,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:[((h=e.organisation)==null?void 0:h[0])??e.channel??"",(y=e.organisation)!=null&&y[0]&&e.primaryCategory?" · ":"",e.primaryCategory??""]})]}),s&&l.jsx("span",{className:cr.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Un,{size:12})}),!s&&l.jsx("button",{type:"button",className:cr.addBtn,onClick:v=>{v.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(As,{size:14})})]})},sj="_chips_xhhaq_1",ij="_chip_xhhaq_1",Mu={chips:sj,chip:ij},oj=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Mu.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",Mu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),aj="_panel_1cl11_1",lj="_header_1cl11_10",cj="_headerTitle_1cl11_19",uj="_closeBtn_1cl11_25",dj="_body_1cl11_43",fj="_section_1cl11_59",hj="_sectionLabel_1cl11_65",pj="_chips_1cl11_73",gj="_chip_1cl11_73",mj="_active_1cl11_96",yj="_footer_1cl11_102",vj="_resetBtn_1cl11_112",bj="_applyBtn_1cl11_129",Xe={panel:aj,header:lj,headerTitle:cj,closeBtn:uj,body:dj,section:fj,sectionLabel:hj,chips:pj,chip:gj,active:mj,footer:yj,resetBtn:vj,applyBtn:bj},_j=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],wj=new Set(["board","medium","gradeLevel","subject","topic"]),xj=({local:e,toggle:t})=>{const r=Qh();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},Sj=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var g,_;const s=ve(h=>h.editorConfig),i=ve(h=>h.searchFormConfig),{organisationFramework:o}=Ph((g=s==null?void 0:s.context)==null?void 0:g.framework,(_=s==null?void 0:s.context)==null?void 0:_.targetFWIds),[a,c]=p.useState(t),u=i!=null&&i.length?i.filter(h=>wj.has(h.code)).map(h=>({key:h.code,label:h.label||h.code})):_j;p.useEffect(()=>{c(t)},[t]);const d=(h,y)=>{c(v=>{const b=v[h]??[],x=b.includes(y)?b.filter(w=>w!==y):[...b,y];return{...v,[h]:x}})},f=(o==null?void 0:o.categories)??[],m=h=>{var y;return((y=f.find(v=>v.code===h))==null?void 0:y.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(sn,{size:16})})]}),l.jsxs("div",{className:Xe.body,children:[u.map(({key:h,label:y})=>{const v=m(h);return v.length?l.jsxs("div",{className:Xe.section,children:[l.jsx("div",{className:Xe.sectionLabel,children:y}),l.jsx("div",{className:Xe.chips,children:v.slice(0,20).map(b=>l.jsx("button",{type:"button",className:[Xe.chip,(a[h]??[]).includes(b.name)?Xe.active:""].join(" "),onClick:()=>d(h,b.name),children:b.name},b.identifier))})]},h):null}),l.jsx(xj,{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},Cj="_header_6qdpu_10",Oj="_title_6qdpu_20",Ej="_headerActions_6qdpu_31",Dj="_iconBtn_6qdpu_38",Ij="_playerArea_6qdpu_56",Nj="_footer_6qdpu_64",Tj="_addBtn_6qdpu_73",jj="_modalOverlay_6qdpu_92",Rj="_modalPanel_6qdpu_103",ur={header:Cj,title:Oj,headerActions:Ej,iconBtn:Dj,playerArea:Ij,footer:Nj,addBtn:Tj,modalOverlay:jj,modalPanel:Rj},kj=({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 Rr.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(sn,{size:16})})})]}),l.jsx("div",{className:ur.playerArea,children:l.jsx(Ia,{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)},Aj="_dock_1lpg0_1",Pj="_header_1lpg0_8",Mj="_headerLeft_1lpg0_17",Lj="_headerTitle_1lpg0_24",Fj="_count_1lpg0_30",$j="_searchRow_1lpg0_39",Bj="_searchWrap_1lpg0_47",Vj="_searchIcon_1lpg0_53",Uj="_searchInput_1lpg0_62",zj="_filterToggleBtn_1lpg0_80",qj="_filterToggleBtnActive_1lpg0_99",Hj="_filterBadge_1lpg0_105",Wj="_filters_1lpg0_124",Kj="_mainArea_1lpg0_134",Qj="_sidePanelOverlay_1lpg0_143",Gj="_cardList_1lpg0_152",Yj="_skeleton_1lpg0_168",Xj="_skeletonIcon_1lpg0_178",Zj="_skeletonText_1lpg0_186",Jj="_skeletonLine_1lpg0_193",eR="_skeletonLineSm_1lpg0_200",tR="_loadMoreBtn_1lpg0_215",rR="_emptyState_1lpg0_240",nR="_collapseBtn_1lpg0_260",Ne={dock:Aj,header:Pj,headerLeft:Mj,headerTitle:Lj,count:Fj,searchRow:$j,searchWrap:Bj,searchIcon:Vj,searchInput:Uj,filterToggleBtn:zj,filterToggleBtnActive:qj,filterBadge:Hj,filters:Wj,mainArea:Kj,sidePanelOverlay:Qj,cardList:Gj,skeleton:Yj,skeletonIcon:Xj,skeletonText:Zj,skeletonLine:Jj,skeletonLineSm:eR,loadMoreBtn:tR,emptyState:rR,collapseBtn:nR};function sR(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 iR=({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:m,toggleSort:g,loadMore:_}=WT(),{addResource:h,selectedNodeId:y,treeData:v}=ke(),b=e==="edit",[x,w]=p.useState(!1),[C,D]=p.useState({}),[j,k]=p.useState(null),L=p.useMemo(()=>sR(v),[v]),I=p.useCallback(F=>{if(!y){Ae.error("Select a unit first");return}h(F,y),Ae.success(`Added "${F.name}"`)},[y,h]),R=p.useCallback(F=>{D(F),m(F)},[m]),M=p.useCallback(F=>{k(F)},[]),A=p.useCallback(F=>{I(F),k(null)},[I]),B=p.useMemo(()=>Object.values(C).reduce((F,re)=>F+((re==null?void 0:re.length)??0),0),[C]);return l.jsxs("div",{className:Ne.dock,children:[l.jsx("div",{className:Ne.header,children:l.jsxs("div",{className:Ne.headerLeft,children:[l.jsx("button",{type:"button",className:Ne.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(py,{size:15})}),l.jsx(dy,{size:16}),l.jsx("span",{className:Ne.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Ne.count,children:i})]})}),l.jsxs("div",{className:Ne.searchRow,children:[l.jsxs("div",{className:Ne.searchWrap,children:[l.jsx(oa,{size:14,className:Ne.searchIcon}),l.jsx("input",{type:"search",className:Ne.searchInput,placeholder:"Search content…",value:a,onChange:F=>d(F.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Ne.filterToggleBtn,c?Ne.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(ny,{size:15}):l.jsx(oy,{size:15})}),l.jsxs("button",{type:"button",className:[Ne.filterToggleBtn,x?Ne.filterToggleBtnActive:""].join(" "),onClick:()=>w(F=>!F),"aria-label":"Toggle advanced filters","aria-pressed":x,title:"Advanced filters",children:[l.jsx(_y,{size:15}),B>0&&l.jsx("span",{className:Ne.filterBadge,children:B})]})]}),l.jsx("div",{className:Ne.filters,children:l.jsx(oj,{filters:D1,active:o,onChange:f})}),l.jsxs("div",{className:Ne.mainArea,children:[l.jsx("div",{className:Ne.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((F,re)=>l.jsxs("div",{className:Ne.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Ne.skeletonIcon}),l.jsxs("div",{className:Ne.skeletonText,children:[l.jsx("div",{className:Ne.skeletonLine}),l.jsx("div",{className:Ne.skeletonLineSm})]})]},re)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(F=>l.jsx(nj,{item:F,onAdd:I,onPreview:M,isDraggable:b,isAdded:L.has(F.identifier)},F.identifier)),u&&l.jsx("button",{type:"button",className:Ne.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Ne.emptyState,children:[l.jsx(oa,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),x&&l.jsx("div",{className:Ne.sidePanelOverlay,children:l.jsx(Sj,{isOpen:x,filters:C,onApply:R,onClose:()=>w(!1)})}),j&&l.jsx(kj,{content:j,onAdd:A,onClose:()=>k(null)})]})]})};function oR(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(m,g=!1){const _={};for(const[h,y]of Object.entries(m))if(!i.has(h)&&!(g&&o.has(h)))if(a.has(h))Array.isArray(y)?_[h]=y:y!=null&&y!==""?_[h]=[y]:_[h]=[];else if(c.has(h)){const v=Number(y);isNaN(v)||(_[h]=v)}else _[h]=y;return _}function d(m){var _;const g={};for(const h of m.children??[]){if(h.isFolder)continue;const y=t[h.identifier];if(!y)continue;const{isNew:v,...b}=y;if(Object.keys(b).length===0)continue;const x=((_=h.metadata)==null?void 0:_.relationalMetadata)??{};g[h.identifier]={name:h.name,...x,...b}}return g}function f(m,g){var x,w;const _=m.identifier,h=t[_],y=_.startsWith("temp-")||!!(h!=null&&h.isNew),v=!m.isFolder&&!g;if(g||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((x=m.metadata)==null?void 0:x.contentType)??"CourseUnit",primaryCategory:((w=m.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:m.name,visibility:"Parent",channel:r,...u(m.metadata??{})};else if(g){const{isNew:D,...j}=h??{};C={...u(m.metadata??{},!0),...u(j,!1),name:m.name}}else{const{isNew:D,...j}=h??{};C={name:m.name,visibility:"Parent",...u(j,!0)}}n[_]={metadata:C,objectType:m.objectType||(m.isFolder?"Collection":"Content"),root:g,isNew:y}}const b=m.isFolder?d(m):{};s[_]={name:m.name,children:(m.children??[]).map(C=>C.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:g},(m.children??[]).forEach(C=>f(C,!1))}return e.forEach((m,g)=>f(m,g===0)),{nodesModified:n,hierarchy:s}}function aR(){const[e,t]=p.useState(!1),r=ke(u=>u.treeCache),n=ke(u=>u.treeData),s=ve(u=>u.isDirty),{setIsDirty:i,setLastSaved:o}=ve(),a=ve(u=>u.editorConfig);return{save:p.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:m,hierarchy:g}=oR(n,r,d);await t_(u,m,g,f);const _=new Date().toISOString();o(_),i(!1)}catch(m){console.error("[useSaveHierarchy] save failed:",m),Ae.error("Failed to save. Please try again.")}finally{t(!1)}},[a,e,n,r,i,o]),isSaving:e,isDirty:s,lastSaved:ve.getState().lastSaved}}function lR(e){const t=ve(s=>s.editorConfig),r=ve(s=>s.setButtonLoader);return{runAction:p.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 Ae.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 s_(o),Ae.success("Content sent for review"),!0;case"reject":{r("rejectCollection",!0);const m=(i==null?void 0:i.comment)??"";return await i_(o,m),Ae.success("Content rejected and sent back to the author"),!0}case"publish":return r("publishCollection",!0),await e(),await r_(o,a),Ae.success("Content published successfully"),!0;default:return!1}}catch(m){console.error(`[useToolbarActions] ${s} failed`,m);const g=s==="sendForReview"?"send for review":s==="reject"?"reject":"publish";return Ae.error(`Failed to ${g}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r])}}const cR="_shell_90fon_1",uR="_workspace_90fon_8",dR="_sidebarCollapsed_90fon_16",fR="_dockCollapsed_90fon_19",hR="_dock_90fon_19",pR="_outline_90fon_40",gR="_reopenTab_90fon_45",mR="_outlineHidden_90fon_79",yR="_editor_90fon_86",vR="_dockHidden_90fon_101",bR="_dockReopenTab_90fon_108",_R="_dragChip_90fon_133",wR="_dragChipLabel_90fon_148",It={shell:cR,workspace:uR,sidebarCollapsed:dR,dockCollapsed:fR,dock:hR,outline:pR,reopenTab:gR,outlineHidden:mR,editor:yR,dockHidden:vR,dockReopenTab:bR,dragChip:_R,dragChipLabel:wR},xR=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,u]=p.useState(!1),[d,f]=p.useState(!1),{addResource:m,treeData:g}=ke(),_=ke(I=>I.selectedNodeId),{save:h,isSaving:y,isDirty:v,lastSaved:b}=aR(),{runAction:x}=lR(h);p.useEffect(()=>{if(!v)return;const I=R=>{R.preventDefault(),R.returnValue=""};return window.addEventListener("beforeunload",I),()=>window.removeEventListener("beforeunload",I)},[v]);const w=yd(ta(Vi,{activationConstraint:{distance:8}})),C=p.useCallback(I=>{var M;const R=(M=I.active.data.current)==null?void 0:M.item;R&&i(R)},[]),D=p.useCallback(I=>{var F,re;i(null);const R=(F=I.active.data.current)==null?void 0:F.item;if(!R)return;const M=I.over,A=(M==null?void 0:M.id)??_??void 0;if(!A){Ae.error("Drop onto a unit to add content");return}const B=(re=g[0])==null?void 0:re.id;if(A===B){Ae.error("Drop content onto a unit, not directly on the course.");return}m(R,A),r==null||r(R,A),Ae.success(`Added "${R.name}" to unit`)},[_,m,r]),j=p.useCallback(async I=>{if(I.action==="back"&&v){f(!0);return}if(I.action==="saveCollection"){await h(),n==null||n(g),t==null||t(I);return}if(I.action==="sendForReview"||I.action==="reject"||I.action==="publish"){await x(I.action,I.data)&&(t==null||t(I));return}t==null||t(I)},[h,x,t,n,g,v]),k=p.useCallback(async()=>{await h(),f(!1),n==null||n(g),t==null||t({action:"back"})},[h,n,t,g]),L=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Md,{sensors:w,onDragStart:C,onDragEnd:D,children:[l.jsxs("div",{className:It.shell,children:[l.jsx(hw,{editorMode:e,isSaving:y,isDirty:v,lastSaved:b,onToolbarEvent:j}),l.jsxs("div",{className:[It.workspace,o?It.sidebarCollapsed:"",c?It.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[It.outline,o?It.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx($O,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(I=>!I)})}),o&&l.jsx("button",{className:It.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:It.editor,role:"main","aria-label":"Content editor",children:l.jsx(qT,{editorMode:e,onToolbarEvent:j})}),l.jsx("aside",{className:[It.dock,c?It.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(iR,{editorMode:e,collapsed:c,onToggleCollapse:()=>u(I=>!I)})}),c&&l.jsx("button",{className:It.dockReopenTab,onClick:()=>u(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(Zm,{dropAnimation:null,children:s?l.jsx("div",{className:It.dragChip,children:l.jsx("span",{className:It.dragChipLabel,children:s.name})}):null}),d&&l.jsx(pw,{onSave:k,onDiscard:L,onCancel:()=>f(!1),isSaving:y})]})},SR="v4";function CR(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 Lu(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:CR(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 br(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(Lu(i,s))}else n.code&&r.push(Lu(n));return r.sort((n,s)=>(n.index??0)-(s.index??0))}function OR(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 ER(e,t,r="Collection"){var c,u;const s=(u=(c=(await $e.post(`/action/object/category/definition/${SR}/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:br(i.create),unitForm:br(i.unitMetadata),childForm:br(i.childMetadata),searchForm:br(i.search??i.searchConfig),relationalForm:br(i.relationalMetadata),publishChecklist:br(i.publishchecklist),reviewChecklist:br(i.review),rfcChecklist:br(i.requestforchangeschecklist),schemaDefaults:OR(o.schema),frameworkMetadata:a.frameworkMetadata??{},sourcingSettings:a.sourcingSettings??{}}}function DR({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:u,setCategoryDefinition:d}=ve(),{setTreeData:f,selectNode:m}=ke();return p.useEffect(()=>{let g=!1;async function _(){var h,y;try{n(!0),i(null),e.apiBaseUrl&&Cf(e.apiBaseUrl),c(e),u(e.config.mode);const v=e.context.contentId??e.context.identifier??"";if(v){const{rootNode:b}=await Df(v);g||(f(b?[b]:[]),b&&m(b.id));const x=e.config.primaryCategory??"Course",w=e.context.channel??"";try{const C=await ER(x,w,e.config.objectType??"Collection");if(!g){d(C);const D=(y=(h=C.sourcingSettings)==null?void 0:h.collection)==null?void 0:y.maxDepth;D&&!e.config.maxDepth&&c({...e,config:{...e.config,maxDepth:D}})}}catch{}}g||a(!0)}catch(v){if(!g){const b=v instanceof Error?v:new Error(String(v));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 IR="_root_qcpw6_1",NR="_loadingState_qcpw6_10",TR="_loadingSpinner_qcpw6_20",jR="_errorState_qcpw6_34",os={root:IR,loadingState:NR,loadingSpinner:TR,errorState:jR},RR=new xp({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class kR extends p.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t){var r,n;(n=(r=this.props).onError)==null||n.call(r,t)}render(){return this.state.error?l.jsxs("div",{className:os.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 AR(e){const{isLoading:t,error:r}=DR({config:e,onError:e.onError}),n=ve(s=>s.editorMode);return t?l.jsxs("div",{className:os.loadingState,children:[l.jsx("div",{className:os.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:os.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${os.root}`,children:l.jsx(xR,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const Gh=e=>l.jsx(kR,{onError:e.onError,children:l.jsxs(Cp,{client:RR,children:[l.jsx(AR,{...e}),l.jsx(Sg,{position:"top-right",toastOptions:{duration:3e3}})]})}),Ai=Symbol.for("r2wc.reactRender"),Fu=Symbol.for("r2wc.shouldRender"),ei=Symbol.for("r2wc.root");function PR(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function MR(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var $u={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Ai]()}}),e[Ai]()}};function LR(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,m){return i&&(s[d]=!0),typeof d=="symbol"||s[d]||d in u?(e.propTypes&&d in e.propTypes&&$u.expando(m,d,f),Reflect.set(u,d,f,m)):($u.expando(m,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[Fu]=!0,this[Ai]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ei].unmount():r.unmountComponentAtNode(this)},a[Ai]=function(){if(this[Fu]===!0){var u={};Object.keys(this).forEach(function(m){s[m]!==!1&&(u[m]=this[m])},this),i=!0;const d=n.shadow?this.shadowRoot:this,f=t.createElement(e,u);typeof r.createRoot=="function"?(this[ei]||(this[ei]=r.createRoot(d)),this[ei].render(f)):r.render(f,d),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(u){return PR(u)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(u,d,f){var m=n.dashStyleAttributes?MR(u):u;this[m]=f}),o}var as={},ns=Rr;if(process.env.NODE_ENV==="production")as.createRoot=ns.createRoot,as.hydrateRoot=ns.hydrateRoot;else{var ti=ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;as.createRoot=function(e,t){ti.usingClientEntryPoint=!0;try{return ns.createRoot(e,t)}finally{ti.usingClientEntryPoint=!1}},as.hydrateRoot=function(e,t,r){ti.usingClientEntryPoint=!0;try{return ns.hydrateRoot(e,t,r)}finally{ti.usingClientEntryPoint=!1}}}function FR(){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 $R(e="sb-collection-editor"){if(FR(),typeof customElements>"u"||customElements.get(e))return;const t=LR(Gh,p,as,{});customElements.define(e,t)}exports.CollectionEditor=Gh;exports.registerCollectionEditor=$R;exports.setApiBaseUrl=Cf;exports.useEditorStore=ve;exports.useLibraryStore=Kh;exports.useTreeStore=ke;