@project-sunbird/collection-editor-react 0.1.25 → 0.1.26
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/collection-editor.umd.js +71 -71
- package/dist/index.cjs +76 -76
- package/dist/index.js +2785 -2779
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var fp=Object.defineProperty;var El=e=>{throw TypeError(e)};var hp=(e,t,r)=>t in e?fp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ts=(e,t,r)=>hp(e,typeof t!="symbol"?t+"":t,r),ho=(e,t,r)=>t.has(e)||El("Cannot "+r);var E=(e,t,r)=>(ho(e,t,"read from private field"),r?r.call(e):t.get(e)),ie=(e,t,r)=>t.has(e)?El("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),G=(e,t,r,n)=>(ho(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),_e=(e,t,r)=>(ho(e,t,"access private method"),r);var Ks=(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"),Lr=require("react-dom"),l=require("react/jsx-runtime");function pp(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ie=pp(p);var As=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Gr,Nr,On,Yu,gp=(Yu=class extends As{constructor(){super();ie(this,Gr);ie(this,Nr);ie(this,On);G(this,On,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Nr)||this.setEventListener(E(this,On))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Nr))==null||t.call(this),G(this,Nr,void 0))}setEventListener(t){var r;G(this,On,t),(r=E(this,Nr))==null||r.call(this),G(this,Nr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Gr)!==t&&(G(this,Gr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,Gr)=="boolean"?E(this,Gr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gr=new WeakMap,Nr=new WeakMap,On=new WeakMap,Yu),La=new gp,mp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ar,Yr,Xu,yp=(Xu=class{constructor(){ie(this,ar,mp);ie(this,Yr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,Yr)&&e!==E(this,ar)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,ar),provider:e}),G(this,ar,e),process.env.NODE_ENV!=="production"&&G(this,Yr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,Yr,!0),E(this,ar).setTimeout(e,t)}clearTimeout(e){E(this,ar).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,Yr,!0),E(this,ar).setInterval(e,t)}clearInterval(e){E(this,ar).clearInterval(e)}},ar=new WeakMap,Yr=new WeakMap,Xu),Wr=new yp;function vp(e){setTimeout(e,0)}var bp=typeof window>"u"||"Deno"in globalThis;function It(){}function _p(e,t){return typeof e=="function"?e(t):e}function Wo(e){return typeof e=="number"&&e>=0&&e!==1/0}function od(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Fr(e,t){return typeof e=="function"?e(t):e}function At(e,t){return typeof e=="function"?e(t):e}function Ol(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Fa(o,t.options))return!1}else if(!ws(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Dl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(_s(t.options.mutationKey)!==_s(i))return!1}else if(!ws(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Fa(e,t){return((t==null?void 0:t.queryKeyHashFn)||_s)(e)}function _s(e){return JSON.stringify(e,(t,r)=>Go(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ws(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ws(e[r],t[r])):!1}var wp=Object.prototype.hasOwnProperty;function Qo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Il(e)&&Il(t);if(!n&&!(Go(e)&&Go(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],g=e[f],m=t[f];if(g===m){c[f]=g,(n?u<i:wp.call(e,f))&&d++;continue}if(g===null||m===null||typeof g!="object"||typeof m!="object"){c[f]=m;continue}const _=Qo(g,m,r+1);c[f]=_,_===g&&d++}return i===a&&d===i?e:c}function Ko(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Il(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Go(e){if(!Tl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Tl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Tl(e){return Object.prototype.toString.call(e)==="[object Object]"}function Sp(e){return new Promise(t=>{Wr.setTimeout(t,e)})}function Yo(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Qo(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 Qo(e,t)}return t}function xp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Cp(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ei=Symbol();function ad(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ei&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ei?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ld(e,t){return typeof e=="function"?e(...t):!!e}function Ep(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 Ss=(()=>{let e=()=>bp;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xo(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var Op=vp;function Dp(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=Op;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 ut=Dp(),Dn,jr,In,Zu,Ip=(Zu=class extends As{constructor(){super();ie(this,Dn,!0);ie(this,jr);ie(this,In);G(this,In,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,jr)||this.setEventListener(E(this,In))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,jr))==null||t.call(this),G(this,jr,void 0))}setEventListener(t){var r;G(this,In,t),(r=E(this,jr))==null||r.call(this),G(this,jr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Dn)!==t&&(G(this,Dn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Dn)}},Dn=new WeakMap,jr=new WeakMap,In=new WeakMap,Zu),Oi=new Ip;function Tp(e){return Math.min(1e3*2**e,3e4)}function cd(e){return(e??"online")==="online"?Oi.isOnline():!0}var Zo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ud(e){let t=!1,r=0,n;const s=Xo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new Zo(h);g(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>La.isFocused()&&(e.networkMode==="always"||Oi.isOnline())&&e.canRun(),u=()=>cd(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},g=h=>{i()||(n==null||n(),s.reject(h))},m=()=>new Promise(h=>{var y;n=v=>{(i()||d())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),_=()=>{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??(Ss.isServer()?0:3),S=e.retryDelay??Tp,w=typeof S=="function"?S(r,v):S,C=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!C){g(v);return}r++,(D=e.onFail)==null||D.call(e,r,v),Sp(w).then(()=>d()?void 0:m()).then(()=>{t?g(v):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?_():m().then(_),s)}}var Xr,Ju,dd=(Ju=class{constructor(){ie(this,Xr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wo(this.gcTime)&&G(this,Xr,Wr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ss.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Xr)!==void 0&&(Wr.clearTimeout(E(this,Xr)),G(this,Xr,void 0))}},Xr=new WeakMap,Ju);function Np(e){return{onFetch:(t,r)=>{var u,f,g,m,_;const n=t.options,s=(g=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const y=S=>{Ep(S,()=>t.signal,()=>h=!0)},v=ad(t.options,t.fetchOptions),b=async(S,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const j=(()=>{const 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,T=C?Cp:xp;return{pages:T(S.pages,k,L),pageParams:T(S.pageParams,w,L)}};if(s&&i.length){const S=s==="backward",w=S?jp:Nl,C={pages:i,pageParams:o},D=w(n,C);a=await b(C,D,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Nl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Nl(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function jp(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Tn,Zr,Nn,Vt,Jr,rt,Ts,en,Rt,fd,mr,ed,kp=(ed=class extends dd{constructor(t){super();ie(this,Rt);ie(this,Tn);ie(this,Zr);ie(this,Nn);ie(this,Vt);ie(this,Jr);ie(this,rt);ie(this,Ts);ie(this,en);G(this,en,!1),G(this,Ts,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,Jr,t.client),G(this,Vt,E(this,Jr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Zr,kl(this.options)),this.state=t.state??E(this,Zr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Tn)}get promise(){var t;return(t=E(this,rt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Ts),...t},t!=null&&t._type&&G(this,Tn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=kl(this.options);r.data!==void 0&&(this.setState(jl(r.data,r.dataUpdatedAt)),G(this,Zr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,Vt).remove(this)}setData(t,r){const n=Yo(this.state.data,t,this.options);return _e(this,Rt,mr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){_e(this,Rt,mr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,rt))==null?void 0:n.promise;return(s=E(this,rt))==null||s.cancel(t),r?r.then(It).catch(It):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Zr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>At(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ei||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Fr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!od(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,rt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,rt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,Vt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(E(this,rt)&&(E(this,en)||_e(this,Rt,fd).call(this)?E(this,rt).cancel({revert:!0}):E(this,rt).cancelRetry()),this.scheduleGc()),E(this,Vt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_e(this,Rt,mr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,g,m,_,h,y,v,b,S;if(this.state.fetchStatus!=="idle"&&((d=E(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,rt))return E(this,rt).continueRetry(),E(this,rt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(G(this,en,!0),n.signal)})},i=()=>{const w=ad(this.options,r),D=(()=>{const j={client:E(this,Jr),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return G(this,en,!1),this.options.persister?this.options.persister(w,D,this):w(D)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,Jr),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,Tn)==="infinite"?Np(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),G(this,Nn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&_e(this,Rt,mr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),G(this,rt,ud({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof Zo&&w.revert&&this.setState({...E(this,Nn),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{_e(this,Rt,mr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{_e(this,Rt,mr).call(this,{type:"pause"})},onContinue:()=>{_e(this,Rt,mr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,rt).start();if(w===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(w),(m=(g=E(this,Vt).config).onSuccess)==null||m.call(g,w,this),(h=(_=E(this,Vt).config).onSettled)==null||h.call(_,w,this.state.error,this),w}catch(w){if(w instanceof Zo){if(w.silent)return E(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw _e(this,Rt,mr).call(this,{type:"error",error:w}),(v=(y=E(this,Vt).config).onError)==null||v.call(y,w,this),(S=(b=E(this,Vt).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Tn=new WeakMap,Zr=new WeakMap,Nn=new WeakMap,Vt=new WeakMap,Jr=new WeakMap,rt=new WeakMap,Ts=new WeakMap,en=new WeakMap,Rt=new WeakSet,fd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},mr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...hd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...jl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,Nn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),ut.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,Vt).notify({query:this,type:"updated",action:t})})},ed);function hd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function jl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function kl(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 Dt,we,Ns,St,tn,jn,yr,kr,js,kn,Rn,rn,nn,Rr,An,Te,ds,Jo,ea,ta,ra,na,sa,ia,pd,td,Rp=(td=class extends As{constructor(t,r){super();ie(this,Te);ie(this,Dt);ie(this,we);ie(this,Ns);ie(this,St);ie(this,tn);ie(this,jn);ie(this,yr);ie(this,kr);ie(this,js);ie(this,kn);ie(this,Rn);ie(this,rn);ie(this,nn);ie(this,Rr);ie(this,An,new Set);this.options=r,G(this,Dt,t),G(this,kr,null),G(this,yr,Xo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,we).addObserver(this),Rl(E(this,we),this.options)?_e(this,Te,ds).call(this):this.updateResult(),_e(this,Te,ra).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return oa(E(this,we),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return oa(E(this,we),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_e(this,Te,na).call(this),_e(this,Te,sa).call(this),E(this,we).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,we);if(this.options=E(this,Dt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof At(this.options.enabled,E(this,we))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_e(this,Te,ia).call(this),E(this,we).setOptions(this.options),r._defaulted&&!Ko(this.options,r)&&E(this,Dt).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,we),observer:this});const s=this.hasListeners();s&&Al(E(this,we),n,this.options,r)&&_e(this,Te,ds).call(this),this.updateResult(),s&&(E(this,we)!==n||At(this.options.enabled,E(this,we))!==At(r.enabled,E(this,we))||Fr(this.options.staleTime,E(this,we))!==Fr(r.staleTime,E(this,we)))&&_e(this,Te,Jo).call(this);const i=_e(this,Te,ea).call(this);s&&(E(this,we)!==n||At(this.options.enabled,E(this,we))!==At(r.enabled,E(this,we))||i!==E(this,Rr))&&_e(this,Te,ta).call(this,i)}getOptimisticResult(t){const r=E(this,Dt).getQueryCache().build(E(this,Dt),t),n=this.createResult(r,t);return Pp(this,n)&&(G(this,St,n),G(this,jn,this.options),G(this,tn,E(this,we).state)),n}getCurrentResult(){return E(this,St)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,yr).status==="pending"&&E(this,yr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,An).add(t)}getCurrentQuery(){return E(this,we)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,Dt).defaultQueryOptions(t),n=E(this,Dt).getQueryCache().build(E(this,Dt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return _e(this,Te,ds).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,St)))}createResult(t,r){var L;const n=E(this,we),s=this.options,i=E(this,St),o=E(this,tn),a=E(this,jn),d=t!==n?t.state:E(this,Ns),{state:u}=t;let f={...u},g=!1,m;if(r._optimisticResults){const T=this.hasListeners(),R=!T&&Rl(t,r),B=T&&Al(t,n,r,s);(R||B)&&(f={...f,...hd(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:h,status:y}=f;m=f.data;let v=!1;if(r.placeholderData!==void 0&&m===void 0&&y==="pending"){let T;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(T=i.data,v=!0):T=typeof r.placeholderData=="function"?r.placeholderData((L=E(this,Rn))==null?void 0:L.state.data,E(this,Rn)):r.placeholderData,T!==void 0&&(y="success",m=Yo(i==null?void 0:i.data,T,r),g=!0)}if(r.select&&m!==void 0&&!v)if(i&&m===(o==null?void 0:o.data)&&r.select===E(this,js))m=E(this,kn);else try{G(this,js,r.select),m=r.select(m),m=Yo(i==null?void 0:i.data,m,r),G(this,kn,m),G(this,kr,null)}catch(T){G(this,kr,T)}E(this,kr)&&(_=E(this,kr),m=E(this,kn),h=Date.now(),y="error");const b=f.fetchStatus==="fetching",S=y==="pending",w=y==="error",C=S&&b,D=m!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:S,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:w&&!D,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&D,isStale:$a(t,r),refetch:this.refetch,promise:E(this,yr),isEnabled:At(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const T=k.data!==void 0,R=k.status==="error"&&!T,B=F=>{R?F.reject(k.error):T&&F.resolve(k.data)},A=()=>{const F=G(this,yr,k.promise=Xo());B(F)},P=E(this,yr);switch(P.status){case"pending":t.queryHash===n.queryHash&&B(P);break;case"fulfilled":(R||k.data!==P.value)&&A();break;case"rejected":(!R||k.error!==P.reason)&&A();break}}return k}updateResult(){const t=E(this,St),r=this.createResult(E(this,we),this.options);if(G(this,tn,E(this,we).state),G(this,jn,this.options),E(this,tn).data!==void 0&&G(this,Rn,E(this,we)),Ko(r,t))return;G(this,St,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,An).size)return!0;const o=new Set(i??E(this,An));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,St)).some(a=>{const c=a;return E(this,St)[c]!==t[c]&&o.has(c)})};_e(this,Te,pd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_e(this,Te,ra).call(this)}},Dt=new WeakMap,we=new WeakMap,Ns=new WeakMap,St=new WeakMap,tn=new WeakMap,jn=new WeakMap,yr=new WeakMap,kr=new WeakMap,js=new WeakMap,kn=new WeakMap,Rn=new WeakMap,rn=new WeakMap,nn=new WeakMap,Rr=new WeakMap,An=new WeakMap,Te=new WeakSet,ds=function(t){_e(this,Te,ia).call(this);let r=E(this,we).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(It)),r},Jo=function(){_e(this,Te,na).call(this);const t=Fr(this.options.staleTime,E(this,we));if(Ss.isServer()||E(this,St).isStale||!Wo(t))return;const n=od(E(this,St).dataUpdatedAt,t)+1;G(this,rn,Wr.setTimeout(()=>{E(this,St).isStale||this.updateResult()},n))},ea=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,we)):this.options.refetchInterval)??!1},ta=function(t){_e(this,Te,sa).call(this),G(this,Rr,t),!(Ss.isServer()||At(this.options.enabled,E(this,we))===!1||!Wo(E(this,Rr))||E(this,Rr)===0)&&G(this,nn,Wr.setInterval(()=>{(this.options.refetchIntervalInBackground||La.isFocused())&&_e(this,Te,ds).call(this)},E(this,Rr)))},ra=function(){_e(this,Te,Jo).call(this),_e(this,Te,ta).call(this,_e(this,Te,ea).call(this))},na=function(){E(this,rn)!==void 0&&(Wr.clearTimeout(E(this,rn)),G(this,rn,void 0))},sa=function(){E(this,nn)!==void 0&&(Wr.clearInterval(E(this,nn)),G(this,nn,void 0))},ia=function(){const t=E(this,Dt).getQueryCache().build(E(this,Dt),this.options);if(t===E(this,we))return;const r=E(this,we);G(this,we,t),G(this,Ns,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},pd=function(t){ut.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,St))}),E(this,Dt).getQueryCache().notify({query:E(this,we),type:"observerResultsUpdated"})})},td);function Ap(e,t){return At(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&At(t.retryOnMount,e)===!1)}function Rl(e,t){return Ap(e,t)||e.state.data!==void 0&&oa(e,t,t.refetchOnMount)}function oa(e,t,r){if(At(t.enabled,e)!==!1&&Fr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&$a(e,t)}return!1}function Al(e,t,r,n){return(e!==t||At(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&$a(e,r)}function $a(e,t){return At(t.enabled,e)!==!1&&e.isStaleByTime(Fr(t.staleTime,e))}function Pp(e,t){return!Ko(e.getCurrentResult(),t)}var ks,lr,yt,sn,cr,Er,rd,Mp=(rd=class extends dd{constructor(t){super();ie(this,cr);ie(this,ks);ie(this,lr);ie(this,yt);ie(this,sn);G(this,ks,t.client),this.mutationId=t.mutationId,G(this,yt,t.mutationCache),G(this,lr,[]),this.state=t.state||Lp(),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,lr).includes(t)||(E(this,lr).push(t),this.clearGcTimeout(),E(this,yt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,lr,E(this,lr).filter(r=>r!==t)),this.scheduleGc(),E(this,yt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,lr).length||(this.state.status==="pending"?this.scheduleGc():E(this,yt).remove(this))}continue(){var t;return((t=E(this,sn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,g,m,_,h,y,v,b,S,w,C,D,j;const r=()=>{_e(this,cr,Er).call(this,{type:"continue"})},n={client:E(this,ks),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,sn,ud({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(k,L)=>{_e(this,cr,Er).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{_e(this,cr,Er).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,yt).canRun(this)}));const s=this.state.status==="pending",i=!E(this,sn).canStart();try{if(s)r();else{_e(this,cr,Er).call(this,{type:"pending",variables:t,isPaused:i}),E(this,yt).config.onMutate&&await E(this,yt).config.onMutate(t,this,n);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,n));L!==this.state.context&&_e(this,cr,Er).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const k=await E(this,sn).start();return await((d=(c=E(this,yt).config).onSuccess)==null?void 0:d.call(c,k,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,n)),await((m=(g=E(this,yt).config).onSettled)==null?void 0:m.call(g,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)),_e(this,cr,Er).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(y=E(this,yt).config).onError)==null?void 0:v.call(y,k,t,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((S=(b=this.options).onError)==null?void 0:S.call(b,k,t,this.state.context,n))}catch(L){Promise.reject(L)}try{await((C=(w=E(this,yt).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 _e(this,cr,Er).call(this,{type:"error",error:k}),k}finally{E(this,yt).runNext(this)}}},ks=new WeakMap,lr=new WeakMap,yt=new WeakMap,sn=new WeakMap,cr=new WeakSet,Er=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),ut.batch(()=>{E(this,lr).forEach(n=>{n.onMutationUpdate(t)}),E(this,yt).notify({mutation:this,type:"updated",action:t})})},rd);function Lp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vr,Kt,Rs,nd,Fp=(nd=class extends As{constructor(t={}){super();ie(this,vr);ie(this,Kt);ie(this,Rs);this.config=t,G(this,vr,new Set),G(this,Kt,new Map),G(this,Rs,0)}build(t,r,n){const s=new Mp({client:t,mutationCache:this,mutationId:++Ks(this,Rs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,vr).add(t);const r=Gs(t);if(typeof r=="string"){const n=E(this,Kt).get(r);n?n.push(t):E(this,Kt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,vr).delete(t)){const r=Gs(t);if(typeof r=="string"){const n=E(this,Kt).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,Kt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Gs(t);if(typeof r=="string"){const n=E(this,Kt).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Gs(t);if(typeof r=="string"){const s=(n=E(this,Kt).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(){ut.batch(()=>{E(this,vr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,vr).clear(),E(this,Kt).clear()})}getAll(){return Array.from(E(this,vr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Dl(r,n))}findAll(t={}){return this.getAll().filter(r=>Dl(t,r))}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return ut.batch(()=>Promise.all(t.map(r=>r.continue().catch(It))))}},vr=new WeakMap,Kt=new WeakMap,Rs=new WeakMap,nd);function Gs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ur,sd,$p=(sd=class extends As{constructor(t={}){super();ie(this,ur);this.config=t,G(this,ur,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Fa(s,r);let o=this.get(i);return o||(o=new kp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,ur).has(t.queryHash)||(E(this,ur).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,ur).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,ur).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ut.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,ur).get(t)}getAll(){return[...E(this,ur).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ol(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Ol(t,n)):r}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){ut.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ut.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ur=new WeakMap,sd),He,Ar,Pr,Pn,Mn,Mr,Ln,Fn,id,Bp=(id=class{constructor(e={}){ie(this,He);ie(this,Ar);ie(this,Pr);ie(this,Pn);ie(this,Mn);ie(this,Mr);ie(this,Ln);ie(this,Fn);G(this,He,e.queryCache||new $p),G(this,Ar,e.mutationCache||new Fp),G(this,Pr,e.defaultOptions||{}),G(this,Pn,new Map),G(this,Mn,new Map),G(this,Mr,0)}mount(){Ks(this,Mr)._++,E(this,Mr)===1&&(G(this,Ln,La.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onFocus())})),G(this,Fn,Oi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onOnline())})))}unmount(){var e,t;Ks(this,Mr)._--,E(this,Mr)===0&&((e=E(this,Ln))==null||e.call(this),G(this,Ln,void 0),(t=E(this,Fn))==null||t.call(this),G(this,Fn,void 0))}isFetching(e){return E(this,He).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Ar).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,He).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,He).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Fr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,He).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,He).get(n.queryHash),i=s==null?void 0:s.state.data,o=_p(t,i);if(o!==void 0)return E(this,He).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return ut.batch(()=>E(this,He).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,He).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,He);ut.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,He);return ut.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=ut.batch(()=>E(this,He).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(It).catch(It)}invalidateQueries(e,t={}){return ut.batch(()=>(E(this,He).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=ut.batch(()=>E(this,He).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(It)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(It)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,He).build(this,t);return r.isStaleByTime(Fr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(It).catch(It)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(It).catch(It)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Oi.isOnline()?E(this,Ar).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,He)}getMutationCache(){return E(this,Ar)}getDefaultOptions(){return E(this,Pr)}setDefaultOptions(e){G(this,Pr,e)}setQueryDefaults(e,t){E(this,Pn).set(_s(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,Pn).values()],r={};return t.forEach(n=>{ws(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,Mn).set(_s(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Mn).values()],r={};return t.forEach(n=>{ws(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Pr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Fa(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ei&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Pr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,He).clear(),E(this,Ar).clear()}},He=new WeakMap,Ar=new WeakMap,Pr=new WeakMap,Pn=new WeakMap,Mn=new WeakMap,Mr=new WeakMap,Ln=new WeakMap,Fn=new WeakMap,id),gd=Ie.createContext(void 0),Up=e=>{const t=Ie.useContext(gd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Vp=({client:e,children:t})=>(Ie.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(gd.Provider,{value:e,children:t})),md=Ie.createContext(!1),qp=()=>Ie.useContext(md);md.Provider;function zp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Hp=Ie.createContext(zp()),Wp=()=>Ie.useContext(Hp),Qp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?ld(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Kp=e=>{Ie.useEffect(()=>{e.clearReset()},[e])},Gp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||ld(r,[e.error,n])),Yp=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))}},Xp=(e,t)=>e.isLoading&&e.isFetching&&!t,Zp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Pl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Jp(e,t,r){var m,_,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=qp(),s=Wp(),i=Up(),o=i.defaultQueryOptions(e);(_=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||_.call(m,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Yp(o),Qp(o,s,a),Kp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ie.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Ie.useSyncExternalStore(Ie.useCallback(v=>{const b=g?u.subscribe(ut.batchCalls(v)):It;return u.updateResult(),b},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ie.useEffect(()=>{u.setOptions(o)},[o,u]),Zp(o,f))throw Pl(o,u,s);if(Gp({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&&!Ss.isServer()&&Xp(f,n)){const v=d?Pl(o,u,s):a==null?void 0:a.promise;v==null||v.catch(It).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function $n(e,t){return Jp(e,Rp)}let eg={data:""},tg=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||eg},rg=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ng=/\/\*[^]*?\*\/| +/g,Ml=/\n+/g,Tr=(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"?Tr(o,i):i+"{"+Tr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Tr(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+=Tr.p?Tr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},Sr={},yd=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+yd(e[r]);return t}return e},sg=(e,t,r,n,s)=>{let i=yd(e),o=Sr[i]||(Sr[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!Sr[o]){let c=i!==e?e:(d=>{let u,f,g=[{}];for(;u=rg.exec(d.replace(ng,""));)u[4]?g.shift():u[3]?(f=u[3].replace(Ml," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Ml," ").trim();return g[0]})(e);Sr[o]=Tr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&Sr.g;return r&&(Sr.g=Sr[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(Sr[o],t,n,a),o},ig=(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?"":Tr(a,""):a===!1?"":a}return n+s+(o??"")},"");function qi(e){let t=this||{},r=e.call?e(t.p):e;return sg(r.unshift?r.raw?ig(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,tg(t.target),t.g,t.o,t.k)}let vd,aa,la;qi.bind({g:1});let br=qi.bind({k:1});function og(e,t,r,n){Tr.p=t,vd=e,aa=r,la=n}function Br(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:aa&&aa()},a),r.o=/go\d/.test(c),a.className=qi.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),la&&d[0]&&la(a),vd(d,a)}return s}}var ag=e=>typeof e=="function",Di=(e,t)=>ag(e)?e(t):e,lg=(()=>{let e=0;return()=>(++e).toString()})(),bd=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),cg=20,Ba="default",_d=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(o=>o.id===t.toast.id?{...o,...t.toast}:o)};case 2:let{toast:n}=t;return _d(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ci=[],wd={toasts:[],pausedAt:void 0,settings:{toastLimit:cg}},dr={},Sd=(e,t=Ba)=>{dr[t]=_d(dr[t]||wd,e),ci.forEach(([r,n])=>{r===t&&n(dr[t])})},xd=e=>Object.keys(dr).forEach(t=>Sd(e,t)),ug=e=>Object.keys(dr).find(t=>dr[t].toasts.some(r=>r.id===e)),zi=(e=Ba)=>t=>{Sd(t,e)},dg={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},fg=(e={},t=Ba)=>{let[r,n]=p.useState(dr[t]||wd),s=p.useRef(dr[t]);p.useEffect(()=>(s.current!==dr[t]&&n(dr[t]),ci.push([t,n]),()=>{let o=ci.findIndex(([a])=>a===t);o>-1&&ci.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||dg[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},hg=(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)||lg()}),Ps=e=>(t,r)=>{let n=hg(t,e,r);return zi(n.toasterId||ug(n.id))({type:2,toast:n}),n.id},Je=(e,t)=>Ps("blank")(e,t);Je.error=Ps("error");Je.success=Ps("success");Je.loading=Ps("loading");Je.custom=Ps("custom");Je.dismiss=(e,t)=>{let r={type:3,toastId:e};t?zi(t)(r):xd(r)};Je.dismissAll=e=>Je.dismiss(void 0,e);Je.remove=(e,t)=>{let r={type:4,toastId:e};t?zi(t)(r):xd(r)};Je.removeAll=e=>Je.remove(void 0,e);Je.promise=(e,t,r)=>{let n=Je.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Di(t.success,s):void 0;return i?Je.success(i,{id:n,...r,...r==null?void 0:r.success}):Je.dismiss(n),s}).catch(s=>{let i=t.error?Di(t.error,s):void 0;i?Je.error(i,{id:n,...r,...r==null?void 0:r.error}):Je.dismiss(n)}),e};var pg=1e3,gg=(e,t="default")=>{let{toasts:r,pausedAt:n}=fg(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,g=pg)=>{if(s.has(f))return;let m=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},g);s.set(f,m)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),g=r.map(m=>{if(m.duration===1/0)return;let _=(m.duration||0)+m.pauseDuration-(f-m.createdAt);if(_<0){m.visible&&Je.dismiss(m.id);return}return setTimeout(()=>Je.dismiss(m.id,t),_)});return()=>{g.forEach(m=>m&&clearTimeout(m))}},[r,n,t]);let o=p.useCallback(zi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,g)=>{o({type:1,toast:{id:f,height:g}})},[o]),d=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=p.useCallback((f,g)=>{let{reverseOrder:m=!1,gutter:_=8,defaultPosition:h}=g||{},y=r.filter(S=>(S.position||h)===(f.position||h)&&S.height),v=y.findIndex(S=>S.id===f.id),b=y.filter((S,w)=>w<v&&S.visible).length;return y.filter(S=>S.visible).slice(...m?[b+1]:[0,b]).reduce((S,w)=>S+(w.height||0)+_,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let g=s.get(f.id);g&&(clearTimeout(g),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},mg=br`
|
|
1
|
+
"use strict";var hp=Object.defineProperty;var El=e=>{throw TypeError(e)};var pp=(e,t,r)=>t in e?hp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ts=(e,t,r)=>pp(e,typeof t!="symbol"?t+"":t,r),ho=(e,t,r)=>t.has(e)||El("Cannot "+r);var E=(e,t,r)=>(ho(e,t,"read from private field"),r?r.call(e):t.get(e)),ie=(e,t,r)=>t.has(e)?El("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),G=(e,t,r,n)=>(ho(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),be=(e,t,r)=>(ho(e,t,"access private method"),r);var Ks=(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"),Lr=require("react-dom"),l=require("react/jsx-runtime");function gp(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ie=gp(p);var As=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Gr,Nr,On,Xu,mp=(Xu=class extends As{constructor(){super();ie(this,Gr);ie(this,Nr);ie(this,On);G(this,On,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){E(this,Nr)||this.setEventListener(E(this,On))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Nr))==null||t.call(this),G(this,Nr,void 0))}setEventListener(t){var r;G(this,On,t),(r=E(this,Nr))==null||r.call(this),G(this,Nr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Gr)!==t&&(G(this,Gr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof E(this,Gr)=="boolean"?E(this,Gr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gr=new WeakMap,Nr=new WeakMap,On=new WeakMap,Xu),La=new mp,yp={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ar,Yr,Zu,vp=(Zu=class{constructor(){ie(this,ar,yp);ie(this,Yr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,Yr)&&e!==E(this,ar)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,ar),provider:e}),G(this,ar,e),process.env.NODE_ENV!=="production"&&G(this,Yr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&G(this,Yr,!0),E(this,ar).setTimeout(e,t)}clearTimeout(e){E(this,ar).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&G(this,Yr,!0),E(this,ar).setInterval(e,t)}clearInterval(e){E(this,ar).clearInterval(e)}},ar=new WeakMap,Yr=new WeakMap,Zu),Wr=new vp;function bp(e){setTimeout(e,0)}var _p=typeof window>"u"||"Deno"in globalThis;function It(){}function wp(e,t){return typeof e=="function"?e(t):e}function Wo(e){return typeof e=="number"&&e>=0&&e!==1/0}function ad(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Fr(e,t){return typeof e=="function"?e(t):e}function At(e,t){return typeof e=="function"?e(t):e}function Ol(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==Fa(o,t.options))return!1}else if(!ws(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function Dl(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(_s(t.options.mutationKey)!==_s(i))return!1}else if(!ws(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Fa(e,t){return((t==null?void 0:t.queryKeyHashFn)||_s)(e)}function _s(e){return JSON.stringify(e,(t,r)=>Go(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ws(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ws(e[r],t[r])):!1}var Sp=Object.prototype.hasOwnProperty;function Qo(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Il(e)&&Il(t);if(!n&&!(Go(e)&&Go(t)))return t;const i=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),a=o.length,c=n?new Array(a):{};let d=0;for(let u=0;u<a;u++){const f=n?u:o[u],g=e[f],m=t[f];if(g===m){c[f]=g,(n?u<i:Sp.call(e,f))&&d++;continue}if(g===null||m===null||typeof g!="object"||typeof m!="object"){c[f]=m;continue}const _=Qo(g,m,r+1);c[f]=_,_===g&&d++}return i===a&&d===i?e:c}function Ko(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Il(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Go(e){if(!Tl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Tl(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Tl(e){return Object.prototype.toString.call(e)==="[object Object]"}function xp(e){return new Promise(t=>{Wr.setTimeout(t,e)})}function Yo(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Qo(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 Qo(e,t)}return t}function Cp(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Ep(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Ei=Symbol();function ld(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ei&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ei?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function cd(e,t){return typeof e=="function"?e(...t):!!e}function Op(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 Ss=(()=>{let e=()=>_p;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xo(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var Dp=bp;function Ip(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=Dp;const i=a=>{t?e.push(a):s(()=>{r(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var ut=Ip(),Dn,jr,In,Ju,Tp=(Ju=class extends As{constructor(){super();ie(this,Dn,!0);ie(this,jr);ie(this,In);G(this,In,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,jr)||this.setEventListener(E(this,In))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,jr))==null||t.call(this),G(this,jr,void 0))}setEventListener(t){var r;G(this,In,t),(r=E(this,jr))==null||r.call(this),G(this,jr,t(this.setOnline.bind(this)))}setOnline(t){E(this,Dn)!==t&&(G(this,Dn,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,Dn)}},Dn=new WeakMap,jr=new WeakMap,In=new WeakMap,Ju),Oi=new Tp;function Np(e){return Math.min(1e3*2**e,3e4)}function ud(e){return(e??"online")==="online"?Oi.isOnline():!0}var Zo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function dd(e){let t=!1,r=0,n;const s=Xo(),i=()=>s.status!=="pending",o=h=>{var y;if(!i()){const v=new Zo(h);g(v),(y=e.onCancel)==null||y.call(e,v)}},a=()=>{t=!0},c=()=>{t=!1},d=()=>La.isFocused()&&(e.networkMode==="always"||Oi.isOnline())&&e.canRun(),u=()=>ud(e.networkMode)&&e.canRun(),f=h=>{i()||(n==null||n(),s.resolve(h))},g=h=>{i()||(n==null||n(),s.reject(h))},m=()=>new Promise(h=>{var y;n=v=>{(i()||d())&&h(v)},(y=e.onPause)==null||y.call(e)}).then(()=>{var h;n=void 0,i()||(h=e.onContinue)==null||h.call(e)}),_=()=>{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??(Ss.isServer()?0:3),S=e.retryDelay??Np,w=typeof S=="function"?S(r,v):S,C=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!C){g(v);return}r++,(D=e.onFail)==null||D.call(e,r,v),xp(w).then(()=>d()?void 0:m()).then(()=>{t?g(v):_()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?_():m().then(_),s)}}var Xr,ed,fd=(ed=class{constructor(){ie(this,Xr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wo(this.gcTime)&&G(this,Xr,Wr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ss.isServer()?1/0:5*60*1e3))}clearGcTimeout(){E(this,Xr)!==void 0&&(Wr.clearTimeout(E(this,Xr)),G(this,Xr,void 0))}},Xr=new WeakMap,ed);function jp(e){return{onFetch:(t,r)=>{var u,f,g,m,_;const n=t.options,s=(g=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let h=!1;const y=S=>{Op(S,()=>t.signal,()=>h=!0)},v=ld(t.options,t.fetchOptions),b=async(S,w,C)=>{if(h)return Promise.reject(t.signal.reason);if(w==null&&S.pages.length)return Promise.resolve(S);const j=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return y(A),A})(),k=await v(j),{maxPages:L}=t.options,T=C?Ep:Cp;return{pages:T(S.pages,k,L),pageParams:T(S.pageParams,w,L)}};if(s&&i.length){const S=s==="backward",w=S?kp:Nl,C={pages:i,pageParams:o},D=w(n,C);a=await b(C,D,S)}else{const S=e??i.length;do{const w=c===0?o[0]??n.initialPageParam:Nl(n,a);if(c>0&&w==null)break;a=await b(a,w),c++}while(c<S)}return a};t.options.persister?t.fetchFn=()=>{var h,y;return(y=(h=t.options).persister)==null?void 0:y.call(h,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function Nl(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function kp(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Tn,Zr,Nn,Vt,Jr,rt,Ts,en,Rt,hd,mr,td,Rp=(td=class extends fd{constructor(t){super();ie(this,Rt);ie(this,Tn);ie(this,Zr);ie(this,Nn);ie(this,Vt);ie(this,Jr);ie(this,rt);ie(this,Ts);ie(this,en);G(this,en,!1),G(this,Ts,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,Jr,t.client),G(this,Vt,E(this,Jr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Zr,kl(this.options)),this.state=t.state??E(this,Zr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,Tn)}get promise(){var t;return(t=E(this,rt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Ts),...t},t!=null&&t._type&&G(this,Tn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=kl(this.options);r.data!==void 0&&(this.setState(jl(r.data,r.dataUpdatedAt)),G(this,Zr,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,Vt).remove(this)}setData(t,r){const n=Yo(this.state.data,t,this.options);return be(this,Rt,mr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){be(this,Rt,mr).call(this,{type:"setState",state:t})}cancel(t){var n,s;const r=(n=E(this,rt))==null?void 0:n.promise;return(s=E(this,rt))==null||s.cancel(t),r?r.then(It).catch(It):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Zr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>At(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ei||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Fr(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:!ad(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,rt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=E(this,rt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,Vt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(E(this,rt)&&(E(this,en)||be(this,Rt,hd).call(this)?E(this,rt).cancel({revert:!0}):E(this,rt).cancelRetry()),this.scheduleGc()),E(this,Vt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,Rt,mr).call(this,{type:"invalidate"})}async fetch(t,r){var d,u,f,g,m,_,h,y,v,b,S;if(this.state.fetchStatus!=="idle"&&((d=E(this,rt))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(E(this,rt))return E(this,rt).continueRetry(),E(this,rt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(C=>C.options.queryFn);w&&this.setOptions(w.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(G(this,en,!0),n.signal)})},i=()=>{const w=ld(this.options,r),D=(()=>{const j={client:E(this,Jr),queryKey:this.queryKey,meta:this.meta};return s(j),j})();return G(this,en,!1),this.options.persister?this.options.persister(w,D,this):w(D)},a=(()=>{const w={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:E(this,Jr),state:this.state,fetchFn:i};return s(w),w})(),c=E(this,Tn)==="infinite"?jp(this.options.pages):this.options.behavior;c==null||c.onFetch(a,this),G(this,Nn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&be(this,Rt,mr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),G(this,rt,dd({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,onCancel:w=>{w instanceof Zo&&w.revert&&this.setState({...E(this,Nn),fetchStatus:"idle"}),n.abort()},onFail:(w,C)=>{be(this,Rt,mr).call(this,{type:"failed",failureCount:w,error:C})},onPause:()=>{be(this,Rt,mr).call(this,{type:"pause"})},onContinue:()=>{be(this,Rt,mr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const w=await E(this,rt).start();if(w===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(w),(m=(g=E(this,Vt).config).onSuccess)==null||m.call(g,w,this),(h=(_=E(this,Vt).config).onSettled)==null||h.call(_,w,this.state.error,this),w}catch(w){if(w instanceof Zo){if(w.silent)return E(this,rt).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw be(this,Rt,mr).call(this,{type:"error",error:w}),(v=(y=E(this,Vt).config).onError)==null||v.call(y,w,this),(S=(b=E(this,Vt).config).onSettled)==null||S.call(b,this.state.data,w,this),w}finally{this.scheduleGc()}}},Tn=new WeakMap,Zr=new WeakMap,Nn=new WeakMap,Vt=new WeakMap,Jr=new WeakMap,rt=new WeakMap,Ts=new WeakMap,en=new WeakMap,Rt=new WeakSet,hd=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},mr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...pd(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...jl(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,Nn,t.manual?s:void 0),s;case"error":const i=t.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),ut.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,Vt).notify({query:this,type:"updated",action:t})})},td);function pd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ud(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function jl(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function kl(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 Dt,_e,Ns,St,tn,jn,yr,kr,js,kn,Rn,rn,nn,Rr,An,Te,ds,Jo,ea,ta,ra,na,sa,ia,gd,rd,Ap=(rd=class extends As{constructor(t,r){super();ie(this,Te);ie(this,Dt);ie(this,_e);ie(this,Ns);ie(this,St);ie(this,tn);ie(this,jn);ie(this,yr);ie(this,kr);ie(this,js);ie(this,kn);ie(this,Rn);ie(this,rn);ie(this,nn);ie(this,Rr);ie(this,An,new Set);this.options=r,G(this,Dt,t),G(this,kr,null),G(this,yr,Xo()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,_e).addObserver(this),Rl(E(this,_e),this.options)?be(this,Te,ds).call(this):this.updateResult(),be(this,Te,ra).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return oa(E(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return oa(E(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,Te,na).call(this),be(this,Te,sa).call(this),E(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=E(this,_e);if(this.options=E(this,Dt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof At(this.options.enabled,E(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,Te,ia).call(this),E(this,_e).setOptions(this.options),r._defaulted&&!Ko(this.options,r)&&E(this,Dt).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,_e),observer:this});const s=this.hasListeners();s&&Al(E(this,_e),n,this.options,r)&&be(this,Te,ds).call(this),this.updateResult(),s&&(E(this,_e)!==n||At(this.options.enabled,E(this,_e))!==At(r.enabled,E(this,_e))||Fr(this.options.staleTime,E(this,_e))!==Fr(r.staleTime,E(this,_e)))&&be(this,Te,Jo).call(this);const i=be(this,Te,ea).call(this);s&&(E(this,_e)!==n||At(this.options.enabled,E(this,_e))!==At(r.enabled,E(this,_e))||i!==E(this,Rr))&&be(this,Te,ta).call(this,i)}getOptimisticResult(t){const r=E(this,Dt).getQueryCache().build(E(this,Dt),t),n=this.createResult(r,t);return Mp(this,n)&&(G(this,St,n),G(this,jn,this.options),G(this,tn,E(this,_e).state)),n}getCurrentResult(){return E(this,St)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,yr).status==="pending"&&E(this,yr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){E(this,An).add(t)}getCurrentQuery(){return E(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=E(this,Dt).defaultQueryOptions(t),n=E(this,Dt).getQueryCache().build(E(this,Dt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return be(this,Te,ds).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,St)))}createResult(t,r){var L;const n=E(this,_e),s=this.options,i=E(this,St),o=E(this,tn),a=E(this,jn),d=t!==n?t.state:E(this,Ns),{state:u}=t;let f={...u},g=!1,m;if(r._optimisticResults){const T=this.hasListeners(),A=!T&&Rl(t,r),B=T&&Al(t,n,r,s);(A||B)&&(f={...f,...pd(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:_,errorUpdatedAt:h,status:y}=f;m=f.data;let v=!1;if(r.placeholderData!==void 0&&m===void 0&&y==="pending"){let T;i!=null&&i.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(T=i.data,v=!0):T=typeof r.placeholderData=="function"?r.placeholderData((L=E(this,Rn))==null?void 0:L.state.data,E(this,Rn)):r.placeholderData,T!==void 0&&(y="success",m=Yo(i==null?void 0:i.data,T,r),g=!0)}if(r.select&&m!==void 0&&!v)if(i&&m===(o==null?void 0:o.data)&&r.select===E(this,js))m=E(this,kn);else try{G(this,js,r.select),m=r.select(m),m=Yo(i==null?void 0:i.data,m,r),G(this,kn,m),G(this,kr,null)}catch(T){G(this,kr,T)}E(this,kr)&&(_=E(this,kr),m=E(this,kn),h=Date.now(),y="error");const b=f.fetchStatus==="fetching",S=y==="pending",w=y==="error",C=S&&b,D=m!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:S,isSuccess:y==="success",isError:w,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:_,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:w&&!D,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:w&&D,isStale:$a(t,r),refetch:this.refetch,promise:E(this,yr),isEnabled:At(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const T=k.data!==void 0,A=k.status==="error"&&!T,B=F=>{A?F.reject(k.error):T&&F.resolve(k.data)},R=()=>{const F=G(this,yr,k.promise=Xo());B(F)},P=E(this,yr);switch(P.status){case"pending":t.queryHash===n.queryHash&&B(P);break;case"fulfilled":(A||k.data!==P.value)&&R();break;case"rejected":(!A||k.error!==P.reason)&&R();break}}return k}updateResult(){const t=E(this,St),r=this.createResult(E(this,_e),this.options);if(G(this,tn,E(this,_e).state),G(this,jn,this.options),E(this,tn).data!==void 0&&G(this,Rn,E(this,_e)),Ko(r,t))return;G(this,St,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,An).size)return!0;const o=new Set(i??E(this,An));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,St)).some(a=>{const c=a;return E(this,St)[c]!==t[c]&&o.has(c)})};be(this,Te,gd).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,Te,ra).call(this)}},Dt=new WeakMap,_e=new WeakMap,Ns=new WeakMap,St=new WeakMap,tn=new WeakMap,jn=new WeakMap,yr=new WeakMap,kr=new WeakMap,js=new WeakMap,kn=new WeakMap,Rn=new WeakMap,rn=new WeakMap,nn=new WeakMap,Rr=new WeakMap,An=new WeakMap,Te=new WeakSet,ds=function(t){be(this,Te,ia).call(this);let r=E(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(It)),r},Jo=function(){be(this,Te,na).call(this);const t=Fr(this.options.staleTime,E(this,_e));if(Ss.isServer()||E(this,St).isStale||!Wo(t))return;const n=ad(E(this,St).dataUpdatedAt,t)+1;G(this,rn,Wr.setTimeout(()=>{E(this,St).isStale||this.updateResult()},n))},ea=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,_e)):this.options.refetchInterval)??!1},ta=function(t){be(this,Te,sa).call(this),G(this,Rr,t),!(Ss.isServer()||At(this.options.enabled,E(this,_e))===!1||!Wo(E(this,Rr))||E(this,Rr)===0)&&G(this,nn,Wr.setInterval(()=>{(this.options.refetchIntervalInBackground||La.isFocused())&&be(this,Te,ds).call(this)},E(this,Rr)))},ra=function(){be(this,Te,Jo).call(this),be(this,Te,ta).call(this,be(this,Te,ea).call(this))},na=function(){E(this,rn)!==void 0&&(Wr.clearTimeout(E(this,rn)),G(this,rn,void 0))},sa=function(){E(this,nn)!==void 0&&(Wr.clearInterval(E(this,nn)),G(this,nn,void 0))},ia=function(){const t=E(this,Dt).getQueryCache().build(E(this,Dt),this.options);if(t===E(this,_e))return;const r=E(this,_e);G(this,_e,t),G(this,Ns,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},gd=function(t){ut.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(E(this,St))}),E(this,Dt).getQueryCache().notify({query:E(this,_e),type:"observerResultsUpdated"})})},rd);function Pp(e,t){return At(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&At(t.retryOnMount,e)===!1)}function Rl(e,t){return Pp(e,t)||e.state.data!==void 0&&oa(e,t,t.refetchOnMount)}function oa(e,t,r){if(At(t.enabled,e)!==!1&&Fr(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&$a(e,t)}return!1}function Al(e,t,r,n){return(e!==t||At(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&$a(e,r)}function $a(e,t){return At(t.enabled,e)!==!1&&e.isStaleByTime(Fr(t.staleTime,e))}function Mp(e,t){return!Ko(e.getCurrentResult(),t)}var ks,lr,yt,sn,cr,Er,nd,Lp=(nd=class extends fd{constructor(t){super();ie(this,cr);ie(this,ks);ie(this,lr);ie(this,yt);ie(this,sn);G(this,ks,t.client),this.mutationId=t.mutationId,G(this,yt,t.mutationCache),G(this,lr,[]),this.state=t.state||Fp(),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,lr).includes(t)||(E(this,lr).push(t),this.clearGcTimeout(),E(this,yt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,lr,E(this,lr).filter(r=>r!==t)),this.scheduleGc(),E(this,yt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,lr).length||(this.state.status==="pending"?this.scheduleGc():E(this,yt).remove(this))}continue(){var t;return((t=E(this,sn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,d,u,f,g,m,_,h,y,v,b,S,w,C,D,j;const r=()=>{be(this,cr,Er).call(this,{type:"continue"})},n={client:E(this,ks),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,sn,dd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(k,L)=>{be(this,cr,Er).call(this,{type:"failed",failureCount:k,error:L})},onPause:()=>{be(this,cr,Er).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,yt).canRun(this)}));const s=this.state.status==="pending",i=!E(this,sn).canStart();try{if(s)r();else{be(this,cr,Er).call(this,{type:"pending",variables:t,isPaused:i}),E(this,yt).config.onMutate&&await E(this,yt).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&&be(this,cr,Er).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const k=await E(this,sn).start();return await((d=(c=E(this,yt).config).onSuccess)==null?void 0:d.call(c,k,t,this.state.context,this,n)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,n)),await((m=(g=E(this,yt).config).onSettled)==null?void 0:m.call(g,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)),be(this,cr,Er).call(this,{type:"success",data:k}),k}catch(k){try{await((v=(y=E(this,yt).config).onError)==null?void 0:v.call(y,k,t,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((S=(b=this.options).onError)==null?void 0:S.call(b,k,t,this.state.context,n))}catch(L){Promise.reject(L)}try{await((C=(w=E(this,yt).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 be(this,cr,Er).call(this,{type:"error",error:k}),k}finally{E(this,yt).runNext(this)}}},ks=new WeakMap,lr=new WeakMap,yt=new WeakMap,sn=new WeakMap,cr=new WeakSet,Er=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),ut.batch(()=>{E(this,lr).forEach(n=>{n.onMutationUpdate(t)}),E(this,yt).notify({mutation:this,type:"updated",action:t})})},nd);function Fp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var vr,Kt,Rs,sd,$p=(sd=class extends As{constructor(t={}){super();ie(this,vr);ie(this,Kt);ie(this,Rs);this.config=t,G(this,vr,new Set),G(this,Kt,new Map),G(this,Rs,0)}build(t,r,n){const s=new Lp({client:t,mutationCache:this,mutationId:++Ks(this,Rs)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){E(this,vr).add(t);const r=Gs(t);if(typeof r=="string"){const n=E(this,Kt).get(r);n?n.push(t):E(this,Kt).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,vr).delete(t)){const r=Gs(t);if(typeof r=="string"){const n=E(this,Kt).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,Kt).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Gs(t);if(typeof r=="string"){const n=E(this,Kt).get(r),s=n==null?void 0:n.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Gs(t);if(typeof r=="string"){const s=(n=E(this,Kt).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(){ut.batch(()=>{E(this,vr).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,vr).clear(),E(this,Kt).clear()})}getAll(){return Array.from(E(this,vr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Dl(r,n))}findAll(t={}){return this.getAll().filter(r=>Dl(t,r))}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return ut.batch(()=>Promise.all(t.map(r=>r.continue().catch(It))))}},vr=new WeakMap,Kt=new WeakMap,Rs=new WeakMap,sd);function Gs(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ur,id,Bp=(id=class extends As{constructor(t={}){super();ie(this,ur);this.config=t,G(this,ur,new Map)}build(t,r,n){const s=r.queryKey,i=r.queryHash??Fa(s,r);let o=this.get(i);return o||(o=new Rp({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,ur).has(t.queryHash)||(E(this,ur).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=E(this,ur).get(t.queryHash);r&&(t.destroy(),r===t&&E(this,ur).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ut.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,ur).get(t)}getAll(){return[...E(this,ur).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Ol(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>Ol(t,n)):r}notify(t){ut.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){ut.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ut.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ur=new WeakMap,id),He,Ar,Pr,Pn,Mn,Mr,Ln,Fn,od,Up=(od=class{constructor(e={}){ie(this,He);ie(this,Ar);ie(this,Pr);ie(this,Pn);ie(this,Mn);ie(this,Mr);ie(this,Ln);ie(this,Fn);G(this,He,e.queryCache||new Bp),G(this,Ar,e.mutationCache||new $p),G(this,Pr,e.defaultOptions||{}),G(this,Pn,new Map),G(this,Mn,new Map),G(this,Mr,0)}mount(){Ks(this,Mr)._++,E(this,Mr)===1&&(G(this,Ln,La.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onFocus())})),G(this,Fn,Oi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,He).onOnline())})))}unmount(){var e,t;Ks(this,Mr)._--,E(this,Mr)===0&&((e=E(this,Ln))==null||e.call(this),G(this,Ln,void 0),(t=E(this,Fn))==null||t.call(this),G(this,Fn,void 0))}isFetching(e){return E(this,He).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,Ar).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=E(this,He).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=E(this,He).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Fr(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,He).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,He).get(n.queryHash),i=s==null?void 0:s.state.data,o=wp(t,i);if(o!==void 0)return E(this,He).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return ut.batch(()=>E(this,He).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,He).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=E(this,He);ut.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=E(this,He);return ut.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=ut.batch(()=>E(this,He).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(It).catch(It)}invalidateQueries(e,t={}){return ut.batch(()=>(E(this,He).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=ut.batch(()=>E(this,He).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,r);return r.throwOnError||(i=i.catch(It)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(It)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=E(this,He).build(this,t);return r.isStaleByTime(Fr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(It).catch(It)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(It).catch(It)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Oi.isOnline()?E(this,Ar).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,He)}getMutationCache(){return E(this,Ar)}getDefaultOptions(){return E(this,Pr)}setDefaultOptions(e){G(this,Pr,e)}setQueryDefaults(e,t){E(this,Pn).set(_s(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,Pn).values()],r={};return t.forEach(n=>{ws(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){E(this,Mn).set(_s(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,Mn).values()],r={};return t.forEach(n=>{ws(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,Pr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Fa(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ei&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,Pr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,He).clear(),E(this,Ar).clear()}},He=new WeakMap,Ar=new WeakMap,Pr=new WeakMap,Pn=new WeakMap,Mn=new WeakMap,Mr=new WeakMap,Ln=new WeakMap,Fn=new WeakMap,od),md=Ie.createContext(void 0),Vp=e=>{const t=Ie.useContext(md);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qp=({client:e,children:t})=>(Ie.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(md.Provider,{value:e,children:t})),yd=Ie.createContext(!1),zp=()=>Ie.useContext(yd);yd.Provider;function Hp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Wp=Ie.createContext(Hp()),Qp=()=>Ie.useContext(Wp),Kp=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?cd(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Gp=e=>{Ie.useEffect(()=>{e.clearReset()},[e])},Yp=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||cd(r,[e.error,n])),Xp=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))}},Zp=(e,t)=>e.isLoading&&e.isFetching&&!t,Jp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Pl=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function eg(e,t,r){var m,_,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=zp(),s=Qp(),i=Vp(),o=i.defaultQueryOptions(e);(_=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||_.call(m,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=n?"isRestoring":c?"optimistic":void 0,Xp(o),Kp(o,s,a),Gp(s);const d=!i.getQueryCache().get(o.queryHash),[u]=Ie.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!n&&c;if(Ie.useSyncExternalStore(Ie.useCallback(v=>{const b=g?u.subscribe(ut.batchCalls(v)):It;return u.updateResult(),b},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ie.useEffect(()=>{u.setOptions(o)},[o,u]),Jp(o,f))throw Pl(o,u,s);if(Yp({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&&!Ss.isServer()&&Zp(f,n)){const v=d?Pl(o,u,s):a==null?void 0:a.promise;v==null||v.catch(It).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function $n(e,t){return eg(e,Ap)}let tg={data:""},rg=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||tg},ng=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,sg=/\/\*[^]*?\*\/| +/g,Ml=/\n+/g,Tr=(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"?Tr(o,i):i+"{"+Tr(o,i[1]=="k"?"":t)+"}":typeof o=="object"?n+=Tr(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+=Tr.p?Tr.p(i,o):i+":"+o+";")}return r+(t&&s?t+"{"+s+"}":s)+n},Sr={},vd=e=>{if(typeof e=="object"){let t="";for(let r in e)t+=r+vd(e[r]);return t}return e},ig=(e,t,r,n,s)=>{let i=vd(e),o=Sr[i]||(Sr[i]=(c=>{let d=0,u=11;for(;d<c.length;)u=101*u+c.charCodeAt(d++)>>>0;return"go"+u})(i));if(!Sr[o]){let c=i!==e?e:(d=>{let u,f,g=[{}];for(;u=ng.exec(d.replace(sg,""));)u[4]?g.shift():u[3]?(f=u[3].replace(Ml," ").trim(),g.unshift(g[0][f]=g[0][f]||{})):g[0][u[1]]=u[2].replace(Ml," ").trim();return g[0]})(e);Sr[o]=Tr(s?{["@keyframes "+o]:c}:c,r?"":"."+o)}let a=r&&Sr.g;return r&&(Sr.g=Sr[o]),((c,d,u,f)=>{f?d.data=d.data.replace(f,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(Sr[o],t,n,a),o},og=(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?"":Tr(a,""):a===!1?"":a}return n+s+(o??"")},"");function qi(e){let t=this||{},r=e.call?e(t.p):e;return ig(r.unshift?r.raw?og(r,[].slice.call(arguments,1),t.p):r.reduce((n,s)=>Object.assign(n,s&&s.call?s(t.p):s),{}):r,rg(t.target),t.g,t.o,t.k)}let bd,aa,la;qi.bind({g:1});let br=qi.bind({k:1});function ag(e,t,r,n){Tr.p=t,bd=e,aa=r,la=n}function Br(e,t){let r=this||{};return function(){let n=arguments;function s(i,o){let a=Object.assign({},i),c=a.className||s.className;r.p=Object.assign({theme:aa&&aa()},a),r.o=/go\d/.test(c),a.className=qi.apply(r,n)+(c?" "+c:"");let d=e;return e[0]&&(d=a.as||e,delete a.as),la&&d[0]&&la(a),bd(d,a)}return s}}var lg=e=>typeof e=="function",Di=(e,t)=>lg(e)?e(t):e,cg=(()=>{let e=0;return()=>(++e).toString()})(),_d=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),ug=20,Ba="default",wd=(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 wd(e,{type:e.toasts.find(o=>o.id===n.id)?1:0,toast:n});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,dismissed:!0,visible:!1}:o)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(o=>o.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(o=>({...o,pauseDuration:o.pauseDuration+i}))}}},ci=[],Sd={toasts:[],pausedAt:void 0,settings:{toastLimit:ug}},dr={},xd=(e,t=Ba)=>{dr[t]=wd(dr[t]||Sd,e),ci.forEach(([r,n])=>{r===t&&n(dr[t])})},Cd=e=>Object.keys(dr).forEach(t=>xd(e,t)),dg=e=>Object.keys(dr).find(t=>dr[t].toasts.some(r=>r.id===e)),zi=(e=Ba)=>t=>{xd(t,e)},fg={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},hg=(e={},t=Ba)=>{let[r,n]=p.useState(dr[t]||Sd),s=p.useRef(dr[t]);p.useEffect(()=>(s.current!==dr[t]&&n(dr[t]),ci.push([t,n]),()=>{let o=ci.findIndex(([a])=>a===t);o>-1&&ci.splice(o,1)}),[t]);let i=r.toasts.map(o=>{var a,c,d;return{...e,...e[o.type],...o,removeDelay:o.removeDelay||((a=e[o.type])==null?void 0:a.removeDelay)||(e==null?void 0:e.removeDelay),duration:o.duration||((c=e[o.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||fg[o.type],style:{...e.style,...(d=e[o.type])==null?void 0:d.style,...o.style}}});return{...r,toasts:i}},pg=(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)||cg()}),Ps=e=>(t,r)=>{let n=pg(t,e,r);return zi(n.toasterId||dg(n.id))({type:2,toast:n}),n.id},Je=(e,t)=>Ps("blank")(e,t);Je.error=Ps("error");Je.success=Ps("success");Je.loading=Ps("loading");Je.custom=Ps("custom");Je.dismiss=(e,t)=>{let r={type:3,toastId:e};t?zi(t)(r):Cd(r)};Je.dismissAll=e=>Je.dismiss(void 0,e);Je.remove=(e,t)=>{let r={type:4,toastId:e};t?zi(t)(r):Cd(r)};Je.removeAll=e=>Je.remove(void 0,e);Je.promise=(e,t,r)=>{let n=Je.loading(t.loading,{...r,...r==null?void 0:r.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Di(t.success,s):void 0;return i?Je.success(i,{id:n,...r,...r==null?void 0:r.success}):Je.dismiss(n),s}).catch(s=>{let i=t.error?Di(t.error,s):void 0;i?Je.error(i,{id:n,...r,...r==null?void 0:r.error}):Je.dismiss(n)}),e};var gg=1e3,mg=(e,t="default")=>{let{toasts:r,pausedAt:n}=hg(e,t),s=p.useRef(new Map).current,i=p.useCallback((f,g=gg)=>{if(s.has(f))return;let m=setTimeout(()=>{s.delete(f),o({type:4,toastId:f})},g);s.set(f,m)},[]);p.useEffect(()=>{if(n)return;let f=Date.now(),g=r.map(m=>{if(m.duration===1/0)return;let _=(m.duration||0)+m.pauseDuration-(f-m.createdAt);if(_<0){m.visible&&Je.dismiss(m.id);return}return setTimeout(()=>Je.dismiss(m.id,t),_)});return()=>{g.forEach(m=>m&&clearTimeout(m))}},[r,n,t]);let o=p.useCallback(zi(t),[t]),a=p.useCallback(()=>{o({type:5,time:Date.now()})},[o]),c=p.useCallback((f,g)=>{o({type:1,toast:{id:f,height:g}})},[o]),d=p.useCallback(()=>{n&&o({type:6,time:Date.now()})},[n,o]),u=p.useCallback((f,g)=>{let{reverseOrder:m=!1,gutter:_=8,defaultPosition:h}=g||{},y=r.filter(S=>(S.position||h)===(f.position||h)&&S.height),v=y.findIndex(S=>S.id===f.id),b=y.filter((S,w)=>w<v&&S.visible).length;return y.filter(S=>S.visible).slice(...m?[b+1]:[0,b]).reduce((S,w)=>S+(w.height||0)+_,0)},[r]);return p.useEffect(()=>{r.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let g=s.get(f.id);g&&(clearTimeout(g),s.delete(f.id))}})},[r,i]),{toasts:r,handlers:{updateHeight:c,startPause:a,endPause:d,calculateOffset:u}}},yg=br`
|
|
2
2
|
from {
|
|
3
3
|
transform: scale(0) rotate(45deg);
|
|
4
4
|
opacity: 0;
|
|
@@ -6,7 +6,7 @@ from {
|
|
|
6
6
|
to {
|
|
7
7
|
transform: scale(1) rotate(45deg);
|
|
8
8
|
opacity: 1;
|
|
9
|
-
}`,
|
|
9
|
+
}`,vg=br`
|
|
10
10
|
from {
|
|
11
11
|
transform: scale(0);
|
|
12
12
|
opacity: 0;
|
|
@@ -14,7 +14,7 @@ from {
|
|
|
14
14
|
to {
|
|
15
15
|
transform: scale(1);
|
|
16
16
|
opacity: 1;
|
|
17
|
-
}`,
|
|
17
|
+
}`,bg=br`
|
|
18
18
|
from {
|
|
19
19
|
transform: scale(0) rotate(90deg);
|
|
20
20
|
opacity: 0;
|
|
@@ -22,7 +22,7 @@ from {
|
|
|
22
22
|
to {
|
|
23
23
|
transform: scale(1) rotate(90deg);
|
|
24
24
|
opacity: 1;
|
|
25
|
-
}`,
|
|
25
|
+
}`,_g=Br("div")`
|
|
26
26
|
width: 20px;
|
|
27
27
|
opacity: 0;
|
|
28
28
|
height: 20px;
|
|
@@ -31,14 +31,14 @@ to {
|
|
|
31
31
|
position: relative;
|
|
32
32
|
transform: rotate(45deg);
|
|
33
33
|
|
|
34
|
-
animation: ${
|
|
34
|
+
animation: ${yg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
35
35
|
forwards;
|
|
36
36
|
animation-delay: 100ms;
|
|
37
37
|
|
|
38
38
|
&:after,
|
|
39
39
|
&:before {
|
|
40
40
|
content: '';
|
|
41
|
-
animation: ${
|
|
41
|
+
animation: ${vg} 0.15s ease-out forwards;
|
|
42
42
|
animation-delay: 150ms;
|
|
43
43
|
position: absolute;
|
|
44
44
|
border-radius: 3px;
|
|
@@ -51,18 +51,18 @@ to {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
&:before {
|
|
54
|
-
animation: ${
|
|
54
|
+
animation: ${bg} 0.15s ease-out forwards;
|
|
55
55
|
animation-delay: 180ms;
|
|
56
56
|
transform: rotate(90deg);
|
|
57
57
|
}
|
|
58
|
-
`,
|
|
58
|
+
`,wg=br`
|
|
59
59
|
from {
|
|
60
60
|
transform: rotate(0deg);
|
|
61
61
|
}
|
|
62
62
|
to {
|
|
63
63
|
transform: rotate(360deg);
|
|
64
64
|
}
|
|
65
|
-
`,
|
|
65
|
+
`,Sg=Br("div")`
|
|
66
66
|
width: 12px;
|
|
67
67
|
height: 12px;
|
|
68
68
|
box-sizing: border-box;
|
|
@@ -70,8 +70,8 @@ to {
|
|
|
70
70
|
border-radius: 100%;
|
|
71
71
|
border-color: ${e=>e.secondary||"#e0e0e0"};
|
|
72
72
|
border-right-color: ${e=>e.primary||"#616161"};
|
|
73
|
-
animation: ${
|
|
74
|
-
`,
|
|
73
|
+
animation: ${wg} 1s linear infinite;
|
|
74
|
+
`,xg=br`
|
|
75
75
|
from {
|
|
76
76
|
transform: scale(0) rotate(45deg);
|
|
77
77
|
opacity: 0;
|
|
@@ -79,7 +79,7 @@ from {
|
|
|
79
79
|
to {
|
|
80
80
|
transform: scale(1) rotate(45deg);
|
|
81
81
|
opacity: 1;
|
|
82
|
-
}`,
|
|
82
|
+
}`,Cg=br`
|
|
83
83
|
0% {
|
|
84
84
|
height: 0;
|
|
85
85
|
width: 0;
|
|
@@ -93,7 +93,7 @@ to {
|
|
|
93
93
|
100% {
|
|
94
94
|
opacity: 1;
|
|
95
95
|
height: 10px;
|
|
96
|
-
}`,
|
|
96
|
+
}`,Eg=Br("div")`
|
|
97
97
|
width: 20px;
|
|
98
98
|
opacity: 0;
|
|
99
99
|
height: 20px;
|
|
@@ -102,13 +102,13 @@ to {
|
|
|
102
102
|
position: relative;
|
|
103
103
|
transform: rotate(45deg);
|
|
104
104
|
|
|
105
|
-
animation: ${
|
|
105
|
+
animation: ${xg} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
106
106
|
forwards;
|
|
107
107
|
animation-delay: 100ms;
|
|
108
108
|
&:after {
|
|
109
109
|
content: '';
|
|
110
110
|
box-sizing: border-box;
|
|
111
|
-
animation: ${
|
|
111
|
+
animation: ${Cg} 0.2s ease-out forwards;
|
|
112
112
|
opacity: 0;
|
|
113
113
|
animation-delay: 200ms;
|
|
114
114
|
position: absolute;
|
|
@@ -120,16 +120,16 @@ to {
|
|
|
120
120
|
height: 10px;
|
|
121
121
|
width: 6px;
|
|
122
122
|
}
|
|
123
|
-
`,Eg=Br("div")`
|
|
124
|
-
position: absolute;
|
|
125
123
|
`,Og=Br("div")`
|
|
124
|
+
position: absolute;
|
|
125
|
+
`,Dg=Br("div")`
|
|
126
126
|
position: relative;
|
|
127
127
|
display: flex;
|
|
128
128
|
justify-content: center;
|
|
129
129
|
align-items: center;
|
|
130
130
|
min-width: 20px;
|
|
131
131
|
min-height: 20px;
|
|
132
|
-
`,
|
|
132
|
+
`,Ig=br`
|
|
133
133
|
from {
|
|
134
134
|
transform: scale(0.6);
|
|
135
135
|
opacity: 0.4;
|
|
@@ -137,20 +137,20 @@ from {
|
|
|
137
137
|
to {
|
|
138
138
|
transform: scale(1);
|
|
139
139
|
opacity: 1;
|
|
140
|
-
}`,
|
|
140
|
+
}`,Tg=Br("div")`
|
|
141
141
|
position: relative;
|
|
142
142
|
transform: scale(0.6);
|
|
143
143
|
opacity: 0.4;
|
|
144
144
|
min-width: 20px;
|
|
145
|
-
animation: ${
|
|
145
|
+
animation: ${Ig} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
146
146
|
forwards;
|
|
147
|
-
`,
|
|
147
|
+
`,Ng=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return t!==void 0?typeof t=="string"?Ie.createElement(Tg,null,t):t:r==="blank"?null:Ie.createElement(Dg,null,Ie.createElement(Sg,{...n}),r!=="loading"&&Ie.createElement(Og,null,r==="error"?Ie.createElement(_g,{...n}):Ie.createElement(Eg,{...n})))},jg=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
|
+
`,kg=e=>`
|
|
151
151
|
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
|
|
152
152
|
100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
|
|
153
|
-
`,
|
|
153
|
+
`,Rg="0%{opacity:0;} 100%{opacity:1;}",Ag="0%{opacity:1;} 100%{opacity:0;}",Pg=Br("div")`
|
|
154
154
|
display: flex;
|
|
155
155
|
align-items: center;
|
|
156
156
|
background: #fff;
|
|
@@ -162,58 +162,58 @@ to {
|
|
|
162
162
|
pointer-events: auto;
|
|
163
163
|
padding: 8px 10px;
|
|
164
164
|
border-radius: 8px;
|
|
165
|
-
`,
|
|
165
|
+
`,Mg=Br("div")`
|
|
166
166
|
display: flex;
|
|
167
167
|
justify-content: center;
|
|
168
168
|
margin: 4px 10px;
|
|
169
169
|
color: inherit;
|
|
170
170
|
flex: 1 1 auto;
|
|
171
171
|
white-space: pre-line;
|
|
172
|
-
`,
|
|
172
|
+
`,Lg=(e,t)=>{let r=e.includes("top")?1:-1,[n,s]=_d()?[Rg,Ag]:[jg(r),kg(r)];return{animation:t?`${br(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${br(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Fg=Ie.memo(({toast:e,position:t,style:r,children:n})=>{let s=e.height?Lg(e.position||t||"top-center",e.visible):{opacity:0},i=Ie.createElement(Ng,{toast:e}),o=Ie.createElement(Mg,{...e.ariaProps},Di(e.message,e));return Ie.createElement(Pg,{className:e.className,style:{...s,...r,...e.style}},typeof n=="function"?n({icon:i,message:o}):Ie.createElement(Ie.Fragment,null,i,o))});ag(Ie.createElement);var $g=({id:e,className:t,style:r,onHeightUpdate:n,children:s})=>{let i=Ie.useCallback(o=>{if(o){let a=()=>{let c=o.getBoundingClientRect().height;n(e,c)};a(),new MutationObserver(a).observe(o,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return Ie.createElement("div",{ref:i,className:t,style:r},s)},Bg=(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:_d()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(r?1:-1)}px)`,...n,...s}},Ug=qi`
|
|
173
173
|
z-index: 9999;
|
|
174
174
|
> * {
|
|
175
175
|
pointer-events: auto;
|
|
176
176
|
}
|
|
177
|
-
`,Ys=16,
|
|
177
|
+
`,Ys=16,Vg=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:s,toasterId:i,containerStyle:o,containerClassName:a})=>{let{toasts:c,handlers:d}=mg(r,i);return Ie.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Ys,left:Ys,right:Ys,bottom:Ys,pointerEvents:"none",...o},className:a,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let f=u.position||t,g=d.calculateOffset(u,{reverseOrder:e,gutter:n,defaultPosition:t}),m=Bg(f,g);return Ie.createElement($g,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?Ug:"",style:m},u.type==="custom"?Di(u.message,u):s?s(u):Ie.createElement(Fg,{toast:u,position:f}))}))},Ce=Je;function qg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>n=>{t.forEach(s=>s(n))},t)}const Hi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ua(e){return"nodeType"in e}function xt(e){var t,r;return e?zn(e)?e:Ua(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Va(e){const{Document:t}=xt(e);return e instanceof t}function Ms(e){return zn(e)?!1:e instanceof xt(e).HTMLElement}function Ed(e){return e instanceof xt(e).SVGElement}function Hn(e){return e?zn(e)?e.document:Ua(e)?Va(e)?e:Ms(e)||Ed(e)?e.ownerDocument:document:document:document}const Yt=Hi?p.useLayoutEffect:p.useEffect;function Wi(e){const t=p.useRef(e);return Yt(()=>{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 zg(){const e=p.useRef(null),t=p.useCallback((n,s)=>{e.current=setInterval(n,s)},[]),r=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function xs(e,t){t===void 0&&(t=[e]);const r=p.useRef(e);return Yt(()=>{r.current!==e&&(r.current=e)},t),r}function Ls(e,t){const r=p.useRef();return p.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Ii(e){const t=Wi(e),r=p.useRef(null),n=p.useCallback(s=>{s!==r.current&&(t==null||t(s,r.current)),r.current=s},[]);return[r,n]}function Ti(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let po={};function Fs(e,t){return p.useMemo(()=>{if(t)return t;const r=po[e]==null?0:po[e]+1;return po[e]=r,e+"-"+r},[e,t])}function Od(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return n.reduce((i,o)=>{const a=Object.entries(o);for(const[c,d]of a){const u=i[c];u!=null&&(i[c]=u+e*d)}return i},{...t})}}const En=Od(1),Cs=Od(-1);function Hg(e){return"clientX"in e&&"clientY"in e}function Qi(e){if(!e)return!1;const{KeyboardEvent:t}=xt(e.target);return t&&e instanceof t}function Wg(e){if(!e)return!1;const{TouchEvent:t}=xt(e.target);return t&&e instanceof t}function Ni(e){if(Wg(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 Hg(e)?{x:e.clientX,y:e.clientY}:null}const $r=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[$r.Translate.toString(e),$r.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Ll="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qg(e){return e.matches(Ll)?e:e.querySelector(Ll)}const Kg={display:"none"};function Gg(e){let{id:t,value:r}=e;return p.createElement("div",{id:t,style:Kg},r)}function Yg(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 Xg(){const[e,t]=p.useState("");return{announce:p.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Dd=p.createContext(null);function Zg(e){const t=p.useContext(Dd);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Jg(){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 em={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
|
-
`},em={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 tm(e){let{announcements:t=em,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=Jg}=e;const{announce:i,announcement:o}=Yg(),a=Fs("DndLiveRegion"),[c,d]=p.useState(!1);if(p.useEffect(()=>{d(!0)},[]),Xg(p.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:m}=f;t.onDragMove&&i(t.onDragMove({active:g,over:m}))},onDragOver(f){let{active:g,over:m}=f;i(t.onDragOver({active:g,over:m}))},onDragEnd(f){let{active:g,over:m}=f;i(t.onDragEnd({active:g,over:m}))},onDragCancel(f){let{active:g,over:m}=f;i(t.onDragCancel({active:g,over:m}))}}),[i,t])),!c)return null;const u=p.createElement(p.Fragment,null,p.createElement(Kg,{id:n,value:s.draggable}),p.createElement(Gg,{id:a,announcement:o}));return r?Lr.createPortal(u,r):u}var Ze;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ze||(Ze={}));function ji(){}function ca(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Dd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return p.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Xt=Object.freeze({x:0,y:0});function Id(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rm(e,t){const r=Ni(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Td(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function nm(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Fl(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function Nd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function $l(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const sm=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=$l(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Id($l(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(Td)},im=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Fl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Fl(c),u=s.reduce((g,m,_)=>g+Id(d[_],m),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(Td)};function om(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const am=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=om(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(nm)};function lm(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function jd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Xt}function cm(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 um=cm(1);function kd(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 dm(e,t,r){const n=kd(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const fm={ignoreTransform:!1};function Wn(e,t){t===void 0&&(t=fm);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=xt(e).getComputedStyle(e);d&&(r=dm(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function Bl(e){return Wn(e,{ignoreTransform:!0})}function hm(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function pm(e,t){return t===void 0&&(t=xt(e).getComputedStyle(e)),t.position==="fixed"}function gm(e,t){t===void 0&&(t=xt(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 Ki(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Va(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ms(s)||Cd(s)||r.includes(s))return r;const i=xt(e).getComputedStyle(s);return s!==e&&gm(s,i)&&r.push(s),pm(s,i)?r:n(s.parentNode)}return e?n(e):r}function Rd(e){const[t]=Ki(e,1);return t??null}function go(e){return!Hi||!e?null:zn(e)?e:Ua(e)?Va(e)||e===Hn(e).scrollingElement?window:Ms(e)?e:null:null}function Ad(e){return zn(e)?e.scrollX:e.scrollLeft}function Pd(e){return zn(e)?e.scrollY:e.scrollTop}function ua(e){return{x:Ad(e),y:Pd(e)}}var it;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(it||(it={}));function Md(e){return!Hi||!e?!1:e===document.scrollingElement}function Ld(e){const t={x:0,y:0},r=Md(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}const mm={x:.2,y:.2};function ym(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=mm);const{isTop:d,isBottom:u,isLeft:f,isRight:g}=Ld(e),m={x:0,y:0},_={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+h.height?(m.y=it.Backward,_.y=n*Math.abs((t.top+h.height-i)/h.height)):!u&&c>=t.bottom-h.height&&(m.y=it.Forward,_.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!g&&a>=t.right-h.width?(m.x=it.Forward,_.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(m.x=it.Backward,_.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:m,speed:_}}function vm(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:n,bottom:s}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Fd(e){return e.reduce((t,r)=>En(t,ua(r)),Xt)}function bm(e){return e.reduce((t,r)=>t+Ad(r),0)}function _m(e){return e.reduce((t,r)=>t+Pd(r),0)}function $d(e,t){if(t===void 0&&(t=Wn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Rd(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const wm=[["x",["left","right"],bm],["y",["top","bottom"],_m]];class qa{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ki(r),s=Fd(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of wm)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class gs{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}=xt(e);return e instanceof t?e:Hn(e)}function mo(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var qt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(qt||(qt={}));function Ul(e){e.preventDefault()}function xm(e){e.stopPropagation()}var Se;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Se||(Se={}));const Bd={start:[Se.Space,Se.Enter],cancel:[Se.Esc],end:[Se.Space,Se.Enter,Se.Tab]},Cm=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Se.Right:return{...r,x:r.x+25};case Se.Left:return{...r,x:r.x-25};case Se.Down:return{...r,y:r.y+25};case Se.Up:return{...r,y:r.y-25}}};class za{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 gs(Hn(r)),this.windowListeners=new gs(xt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qt.Resize,this.handleCancel),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&$d(n),r(Xt)}handleKeyDown(t){if(Qi(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Bd,coordinateGetter:o=Cm,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Xt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const g=Cs(f,u),m={x:0,y:0},{scrollableAncestors:_}=n.current;for(const h of _){const y=t.code,{isTop:v,isRight:b,isLeft:S,isBottom:w,maxScroll:C,minScroll:D}=Ld(h),j=vm(h),k={x:Math.min(y===Se.Right?j.right-j.width/2:j.right,Math.max(y===Se.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===Se.Down?j.bottom-j.height/2:j.bottom,Math.max(y===Se.Down?j.top:j.top+j.height/2,f.y))},L=y===Se.Right&&!b||y===Se.Left&&!S,T=y===Se.Down&&!w||y===Se.Up&&!v;if(L&&k.x!==f.x){const R=h.scrollLeft+g.x,B=y===Se.Right&&R<=C.x||y===Se.Left&&R>=D.x;if(B&&!g.y){h.scrollTo({left:R,behavior:a});return}B?m.x=h.scrollLeft-R:m.x=y===Se.Right?h.scrollLeft-C.x:h.scrollLeft-D.x,m.x&&h.scrollBy({left:-m.x,behavior:a});break}else if(T&&k.y!==f.y){const R=h.scrollTop+g.y,B=y===Se.Down&&R<=C.y||y===Se.Up&&R>=D.y;if(B&&!g.x){h.scrollTo({top:R,behavior:a});return}B?m.y=h.scrollTop-R:m.y=y===Se.Down?h.scrollTop-C.y:h.scrollTop-D.y,m.y&&h.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,En(Cs(f,this.referenceCoordinates),m))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}za.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Bd,onActivation:s}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function Vl(e){return!!(e&&"distance"in e)}function ql(e){return!!(e&&"delay"in e)}class Ha{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=Hn(o),this.documentListeners=new gs(this.document),this.listeners=new gs(n),this.windowListeners=new gs(xt(o)),this.initialCoordinates=(s=Ni(i))!=null?s:Xt,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(qt.Resize,this.handleCancel),this.windowListeners.add(qt.DragStart,Ul),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),this.windowListeners.add(qt.ContextMenu,Ul),this.documentListeners.add(qt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ql(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Vl(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(qt.Click,xm,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Ni(t))!=null?r:Xt,d=Cs(s,c);if(!n&&a){if(Vl(a)){if(a.tolerance!=null&&mo(d,a.tolerance))return this.handleCancel();if(mo(d,a.distance))return this.handleStart()}if(ql(a)&&mo(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Se.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Em={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Gi extends Ha{constructor(t){const{event:r}=t,n=Hn(r.target);super(t,Em,n)}}Gi.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const Om={move:{name:"mousemove"},end:{name:"mouseup"}};var da;(function(e){e[e.RightClick=2]="RightClick"})(da||(da={}));class Dm extends Ha{constructor(t){super(t,Om,Hn(t.event.target))}}Dm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===da.RightClick?!1:(n==null||n({event:r}),!0)}}];const yo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Im extends Ha{constructor(t){super(t,yo)}static setup(){return window.addEventListener(yo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(yo.move.name,t)};function t(){}}}Im.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 ms;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ms||(ms={}));var ki;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ki||(ki={}));function Tm(e){let{acceleration:t,activator:r=ms.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=ki.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:g}=e;const m=jm({delta:f,disabled:!i}),[_,h]=qg(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),b=p.useMemo(()=>{switch(r){case ms.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ms.DraggableRect:return s}},[r,s,c]),S=p.useRef(null),w=p.useCallback(()=>{const D=S.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===ki.TreeOrder?[...d].reverse():d,[a,d]);p.useEffect(()=>{if(!i||!d.length||!b){h();return}for(const D of C){if((n==null?void 0:n(D))===!1)continue;const j=d.indexOf(D),k=u[j];if(!k)continue;const{direction:L,speed:T}=ym(D,k,b,t,g);for(const R of["x","y"])m[R][L[R]]||(T[R]=0,L[R]=0);if(T.x>0||T.y>0){h(),S.current=D,_(w,o),y.current=T,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(m),_,d,C,u,JSON.stringify(g)])}const Nm={x:{[it.Backward]:!1,[it.Forward]:!1},y:{[it.Backward]:!1,[it.Forward]:!1}};function jm(e){let{delta:t,disabled:r}=e;const n=Ti(t);return Ls(s=>{if(r||!n||!s)return Nm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[it.Backward]:s.x[it.Backward]||i.x===-1,[it.Forward]:s.x[it.Forward]||i.x===1},y:{[it.Backward]:s.y[it.Backward]||i.y===-1,[it.Forward]:s.y[it.Forward]||i.y===1}}},[r,t,n])}function km(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ls(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function Rm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var Es;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Es||(Es={}));var fa;(function(e){e.Optimized="optimized"})(fa||(fa={}));const zl=new Map;function Am(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:d}=s,u=p.useRef(e),f=y(),g=xs(f),m=p.useCallback(function(v){v===void 0&&(v=[]),!g.current&&o(b=>b===null?v:b.concat(v.filter(S=>!b.includes(S))))},[g]),_=p.useRef(null),h=Ls(v=>{if(f&&!r)return zl;if(!v||v===zl||u.current!==e||i!=null){const b=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){b.set(S.id,S.rect.current);continue}const w=S.node.current,C=w?new qa(c(w),w):null;S.rect.current=C,C&&b.set(S.id,C)}return b}return v},[e,i,r,f,c]);return p.useEffect(()=>{u.current=e},[e]),p.useEffect(()=>{f||m()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{m(),_.current=null},a))},[a,f,m,...n]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:i!=null};function y(){switch(d){case Es.Always:return!1;case Es.BeforeDragging:return r;default:return!r}}}function Wa(e,t){return Ls(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Pm(e,t){return Wa(e,t)}function Mm(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Yi(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Lm(e){return new qa(Wn(e),e)}function Hl(e,t,r){t===void 0&&(t=Lm);const[n,s]=p.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=Mm({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Yi({callback:i});return Yt(()=>{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 Fm(e){const t=Wa(e);return jd(e,t)}const Wl=[];function $m(e){const t=p.useRef(e),r=Ls(n=>e?n&&n!==Wl&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ki(e):Wl,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function Bm(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=go(i.target);o&&r(a=>a?(a.set(o,ua(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=go(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,ua(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=go(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>En(i,o),Xt):Fd(e):Xt,[e,t])}function Ql(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Xt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Cs(e,r.current):Xt}function Um(e){p.useEffect(()=>{if(!Hi)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Vm(e,t){return p.useMemo(()=>e.reduce((r,n)=>{let{eventName:s,handler:i}=n;return r[s]=o=>{i(o,t)},r},{}),[e,t])}function Ud(e){return p.useMemo(()=>e?hm(e):null,[e])}const Kl=[];function qm(e,t){t===void 0&&(t=Wn);const[r]=e,n=Ud(r?xt(r):null),[s,i]=p.useState(Kl);function o(){i(()=>e.length?e.map(c=>Md(c)?n:new qa(t(c),c)):Kl)}const a=Yi({callback:o});return Yt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function Vd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ms(t)?t:e}function zm(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(d=>{for(const{target:u}of d)if(Ms(u)){n(f=>{const g=t(u);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=Yi({callback:s}),o=p.useCallback(d=>{const u=Vd(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=Ii(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Hm=[{sensor:Gi,options:{}},{sensor:za,options:{}}],Wm={current:{}},ui={draggable:{measure:Bl},droppable:{measure:Bl,strategy:Es.WhileDragging,frequency:fa.Optimized},dragOverlay:{measure:Wn}};class ys 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 Qm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ys,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ji},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ui,measureDroppableContainers:ji,windowRect:null,measuringScheduled:!1},qd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ji,draggableNodes:new Map,over:null,measureDroppableContainers:ji},$s=p.createContext(qd),zd=p.createContext(Qm);function Km(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ys}}}function Gm(e,t){switch(t.type){case Ze.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ze.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ze.DragEnd:case Ze.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ze.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new ys(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Ze.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new ys(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Ze.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new ys(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Ym(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext($s),i=Ti(n),o=Ti(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!Qi(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Wg(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Hd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Xm(e){return p.useMemo(()=>({draggable:{...ui.draggable,...e==null?void 0:e.draggable},droppable:{...ui.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ui.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Zm(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;Yt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=jd(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=Rd(d);g&&g.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const Xi=p.createContext({...Xt,scaleX:1,scaleY:1});var Dr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Dr||(Dr={}));const Wd=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Hm,collisionDetection:f=am,measuring:g,modifiers:m,..._}=t;const h=p.useReducer(Gm,void 0,Km),[y,v]=h,[b,S]=Zg(),[w,C]=p.useState(Dr.Uninitialized),D=w===Dr.Initialized,{draggable:{active:j,nodes:k,translate:L},droppable:{containers:T}}=y,R=j!=null?k.get(j):null,B=p.useRef({initial:null,translated:null}),A=p.useMemo(()=>{var et;return j!=null?{id:j,data:(et=R==null?void 0:R.data)!=null?et:Wm,rect:B}:null},[j,R]),P=p.useRef(null),[F,Y]=p.useState(null),[se,Ce]=p.useState(null),ve=xs(_,Object.values(_)),me=Fs("DndDescribedBy",o),q=p.useMemo(()=>T.getEnabled(),[T]),J=Xm(g),{droppableRects:te,measureDroppableContainers:U,measuringScheduled:Z}=Am(q,{dragging:D,dependencies:[L.x,L.y],config:J.droppable}),K=km(k,j),le=p.useMemo(()=>se?Ni(se):null,[se]),ee=Ur(),pe=Pm(K,J.draggable.measure);Zm({activeNode:j!=null?k.get(j):null,config:ee.layoutShiftCompensation,initialRect:pe,measure:J.draggable.measure});const oe=Hl(K,J.draggable.measure,pe),We=Hl(K?K.parentElement:null),xe=p.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=T.getNodeFor((r=xe.current.over)==null?void 0:r.id),Qe=zm({measure:J.dragOverlay.measure}),Be=(n=Qe.nodeRef.current)!=null?n:K,re=D?(s=Qe.rect)!=null?s:oe:null,ke=!!(Qe.nodeRef.current&&Qe.rect),Le=Fm(ke?null:oe),Ye=Ud(Be?xt(Be):null),ot=$m(D?Ge??K:null),Lt=qm(ot),H=Hd(m,{transform:{x:L.x-Le.x,y:L.y-Le.y,scaleX:1,scaleY:1},activatorEvent:se,active:A,activeNodeRect:oe,containerNodeRect:We,draggingNodeRect:re,over:xe.current.over,overlayNodeRect:Qe.rect,scrollableAncestors:ot,scrollableAncestorRects:Lt,windowRect:Ye}),ue=le?En(le,L):null,ye=Bm(ot),er=Ql(ye),fr=Ql(ye,[oe]),x=En(H,er),I=re?um(re,H):null,N=A&&I?f({active:A,collisionRect:I,droppableRects:te,droppableContainers:q,pointerCoordinates:ue}):null,$=Nd(N,"id"),[V,W]=p.useState(null),z=ke?H:En(H,fr),ne=lm(z,(i=V==null?void 0:V.rect)!=null?i:null,oe),ge=p.useRef(null),Ue=p.useCallback((et,ft)=>{let{sensor:wt,options:Ht}=ft;if(P.current==null)return;const Ft=k.get(P.current);if(!Ft)return;const jt=et.nativeEvent,tr=new wt({active:P.current,activeNode:Ft,event:jt,options:Ht,context:xe,onAbort(at){if(!k.get(at))return;const{onDragAbort:rr}=ve.current,pr={id:at};rr==null||rr(pr),b({type:"onDragAbort",event:pr})},onPending(at,_r,rr,pr){if(!k.get(at))return;const{onDragPending:Jn}=ve.current,wr={id:at,constraint:_r,initialCoordinates:rr,offset:pr};Jn==null||Jn(wr),b({type:"onDragPending",event:wr})},onStart(at){const _r=P.current;if(_r==null)return;const rr=k.get(_r);if(!rr)return;const{onDragStart:pr}=ve.current,Zn={activatorEvent:jt,active:{id:_r,data:rr.data,rect:B}};Lr.unstable_batchedUpdates(()=>{pr==null||pr(Zn),C(Dr.Initializing),v({type:Ze.DragStart,initialCoordinates:at,active:_r}),b({type:"onDragStart",event:Zn}),Y(ge.current),Ce(jt)})},onMove(at){v({type:Ze.DragMove,coordinates:at})},onEnd:hn(Ze.DragEnd),onCancel:hn(Ze.DragCancel)});ge.current=tr;function hn(at){return async function(){const{active:rr,collisions:pr,over:Zn,scrollAdjustedTranslate:Jn}=xe.current;let wr=null;if(rr&&Jn){const{cancelDrop:es}=ve.current;wr={activatorEvent:jt,active:rr,collisions:pr,delta:Jn,over:Zn},at===Ze.DragEnd&&typeof es=="function"&&await Promise.resolve(es(wr))&&(at=Ze.DragCancel)}P.current=null,Lr.unstable_batchedUpdates(()=>{v({type:at}),C(Dr.Uninitialized),W(null),Y(null),Ce(null),ge.current=null;const es=at===Ze.DragEnd?"onDragEnd":"onDragCancel";if(wr){const fo=ve.current[es];fo==null||fo(wr),b({type:es,event:wr})}})}}},[k]),Ct=p.useCallback((et,ft)=>(wt,Ht)=>{const Ft=wt.nativeEvent,jt=k.get(Ht);if(P.current!==null||!jt||Ft.dndKit||Ft.defaultPrevented)return;const tr={active:jt};et(wt,ft.options,tr)===!0&&(Ft.dndKit={capturedBy:ft.sensor},P.current=Ht,Ue(wt,ft))},[k,Ue]),Et=Rm(u,Ct);Um(u),Yt(()=>{oe&&w===Dr.Initializing&&C(Dr.Initialized)},[oe,w]),p.useEffect(()=>{const{onDragMove:et}=ve.current,{active:ft,activatorEvent:wt,collisions:Ht,over:Ft}=xe.current;if(!ft||!wt)return;const jt={active:ft,activatorEvent:wt,collisions:Ht,delta:{x:x.x,y:x.y},over:Ft};Lr.unstable_batchedUpdates(()=>{et==null||et(jt),b({type:"onDragMove",event:jt})})},[x.x,x.y]),p.useEffect(()=>{const{active:et,activatorEvent:ft,collisions:wt,droppableContainers:Ht,scrollAdjustedTranslate:Ft}=xe.current;if(!et||P.current==null||!ft||!Ft)return;const{onDragOver:jt}=ve.current,tr=Ht.get($),hn=tr&&tr.rect.current?{id:tr.id,rect:tr.rect.current,data:tr.data,disabled:tr.disabled}:null,at={active:et,activatorEvent:ft,collisions:wt,delta:{x:Ft.x,y:Ft.y},over:hn};Lr.unstable_batchedUpdates(()=>{W(hn),jt==null||jt(at),b({type:"onDragOver",event:at})})},[$]),Yt(()=>{xe.current={activatorEvent:se,active:A,activeNode:K,collisionRect:I,collisions:N,droppableRects:te,draggableNodes:k,draggingNode:Be,draggingNodeRect:re,droppableContainers:T,over:V,scrollableAncestors:ot,scrollAdjustedTranslate:x},B.current={initial:re,translated:I}},[A,K,N,I,k,Be,re,te,T,V,ot,x]),Tm({...ee,delta:L,draggingRect:I,pointerCoordinates:ue,scrollableAncestors:ot,scrollableAncestorRects:Lt});const hr=p.useMemo(()=>({active:A,activeNode:K,activeNodeRect:oe,activatorEvent:se,collisions:N,containerNodeRect:We,dragOverlay:Qe,draggableNodes:k,droppableContainers:T,droppableRects:te,over:V,measureDroppableContainers:U,scrollableAncestors:ot,scrollableAncestorRects:Lt,measuringConfiguration:J,measuringScheduled:Z,windowRect:Ye}),[A,K,oe,se,N,We,Qe,k,T,te,V,U,ot,Lt,J,Z,Ye]),Xn=p.useMemo(()=>({activatorEvent:se,activators:Et,active:A,activeNodeRect:oe,ariaDescribedById:{draggable:me},dispatch:v,draggableNodes:k,over:V,measureDroppableContainers:U}),[se,Et,A,oe,v,me,k,V,U]);return p.createElement(Od.Provider,{value:S},p.createElement($s.Provider,{value:Xn},p.createElement(zd.Provider,{value:hr},p.createElement(Xi.Provider,{value:ne},d)),p.createElement(Ym,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(tm,{...a,hiddenTextDescribedById:me}));function Ur(){const et=(F==null?void 0:F.autoScrollEnabled)===!1,ft=typeof c=="object"?c.enabled===!1:c===!1,wt=D&&!et&&!ft;return typeof c=="object"?{...c,enabled:wt}:{enabled:wt}}}),Jm=p.createContext(null),Gl="button",ey="Draggable";function Qd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=Fs(ey),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:g}=p.useContext($s),{role:m=Gl,roleDescription:_="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?Xi:Jm),[b,S]=Ii(),[w,C]=Ii(),D=Vm(o,t),j=xs(r);Yt(()=>(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:m,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&m===Gl?!0:void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[n,m,h,y,_,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:y,listeners:n?void 0:D,node:b,over:g,setNodeRef:S,setActivatorNodeRef:C,transform:v}}function Kd(){return p.useContext(zd)}const ty="Droppable",ry={timeout:25};function ny(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=Fs(ty),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=p.useContext($s),u=p.useRef({disabled:r}),f=p.useRef(!1),g=p.useRef(null),m=p.useRef(null),{disabled:_,updateMeasurementsFor:h,timeout:y}={...ry,...s},v=xs(h??n),b=p.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),m.current=null},y)},[y]),S=Yi({callback:b,disabled:_||!o}),w=p.useCallback((k,L)=>{S&&(L&&(S.unobserve(L),f.current=!1),k&&S.observe(k))},[S]),[C,D]=Ii(w),j=xs(t);return p.useEffect(()=>{!S||!C.current||(S.disconnect(),f.current=!1,S.observe(C.current))},[C,S]),p.useEffect(()=>(a({type:Ze.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:g,data:j}}),()=>a({type:Ze.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==u.current.disabled&&(a({type:Ze.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:g,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:D}}function sy(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=Ti(r);return!r&&!n&&a&&s(a),Yt(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const iy={x:0,y:0,scaleX:1,scaleY:1};function oy(e){let{children:t}=e;return p.createElement($s.Provider,{value:qd},p.createElement(Xi.Provider,{value:iy},t))}const ay={position:"fixed",touchAction:"none"},ly=e=>Qi(e)?"transform 250ms ease":void 0,cy=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=ly}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...ay,width:a.width,height:a.height,top:a.top,left:a.left,transform:$r.Transform.toString(f),transformOrigin:s&&n?rm(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return p.createElement(r,{className:o,style:g,ref:t},i)}),uy=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}},dy=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:$r.Transform.toString(t)},{transform:$r.Transform.toString(r)}]},fy={duration:250,easing:"ease",keyframes:dy,sideEffects:uy({styles:{active:{opacity:"0"}}})};function hy(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Wi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=Vd(o);if(!d)return;const{transform:u}=xt(o).getComputedStyle(o),f=kd(u);if(!f)return;const g=typeof t=="function"?t:py(t);return $d(c,s.draggable.measure),g({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function py(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...fy,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},g={x:c.x-u.x,y:c.y-u.y,...f},m=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:g}}),[_]=m,h=m[m.length-1];if(JSON.stringify(_)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...d}),v=a.node.animate(m,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let Yl=0;function gy(e){return p.useMemo(()=>{if(e!=null)return Yl++,Yl},[e])}const my=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggableNodes:_,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:C}=Kd(),D=p.useContext(Xi),j=gy(f==null?void 0:f.id),k=Hd(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:D,windowRect:C}),L=Wa(g),T=hy({config:n,draggableNodes:_,droppableContainers:h,measuringConfiguration:b}),R=L?y.setRef:void 0;return p.createElement(oy,null,p.createElement(sy,{animation:T},f&&j?p.createElement(cy,{key:j,id:f.id,ref:R,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:L,style:{zIndex:d,...s},transform:k},r):null))});/**
|
|
181
|
+
`},tm={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 rm(e){let{announcements:t=tm,container:r,hiddenTextDescribedById:n,screenReaderInstructions:s=em}=e;const{announce:i,announcement:o}=Xg(),a=Fs("DndLiveRegion"),[c,d]=p.useState(!1);if(p.useEffect(()=>{d(!0)},[]),Zg(p.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:m}=f;t.onDragMove&&i(t.onDragMove({active:g,over:m}))},onDragOver(f){let{active:g,over:m}=f;i(t.onDragOver({active:g,over:m}))},onDragEnd(f){let{active:g,over:m}=f;i(t.onDragEnd({active:g,over:m}))},onDragCancel(f){let{active:g,over:m}=f;i(t.onDragCancel({active:g,over:m}))}}),[i,t])),!c)return null;const u=p.createElement(p.Fragment,null,p.createElement(Gg,{id:n,value:s.draggable}),p.createElement(Yg,{id:a,announcement:o}));return r?Lr.createPortal(u,r):u}var Ze;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ze||(Ze={}));function ji(){}function ca(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Id(){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 Xt=Object.freeze({x:0,y:0});function Td(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nm(e,t){const r=Ni(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Nd(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function sm(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Fl(e){let{left:t,top:r,height:n,width:s}=e;return[{x:t,y:r},{x:t+s,y:r},{x:t,y:r+n},{x:t+s,y:r+n}]}function jd(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function $l(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const im=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=$l(t,t.left,t.top),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Td($l(c),s);i.push({id:a,data:{droppableContainer:o,value:d}})}}return i.sort(Nd)},om=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const s=Fl(t),i=[];for(const o of n){const{id:a}=o,c=r.get(a);if(c){const d=Fl(c),u=s.reduce((g,m,_)=>g+Td(d[_],m),0),f=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:f}})}}return i.sort(Nd)};function am(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-n,a=i-r;if(n<s&&r<i){const c=t.width*t.height,d=e.width*e.height,u=o*a,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const lm=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=am(a,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(sm)};function cm(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function kd(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Xt}function um(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 dm=um(1);function Rd(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function fm(e,t,r){const n=Rd(t);if(!n)return e;const{scaleX:s,scaleY:i,x:o,y:a}=n,c=e.left-o-(1-s)*parseFloat(r),d=e.top-a-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const hm={ignoreTransform:!1};function Wn(e,t){t===void 0&&(t=hm);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=xt(e).getComputedStyle(e);d&&(r=fm(r,d,u))}const{top:n,left:s,width:i,height:o,bottom:a,right:c}=r;return{top:n,left:s,width:i,height:o,bottom:a,right:c}}function Bl(e){return Wn(e,{ignoreTransform:!0})}function pm(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function gm(e,t){return t===void 0&&(t=xt(e).getComputedStyle(e)),t.position==="fixed"}function mm(e,t){t===void 0&&(t=xt(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 Ki(e,t){const r=[];function n(s){if(t!=null&&r.length>=t||!s)return r;if(Va(s)&&s.scrollingElement!=null&&!r.includes(s.scrollingElement))return r.push(s.scrollingElement),r;if(!Ms(s)||Ed(s)||r.includes(s))return r;const i=xt(e).getComputedStyle(s);return s!==e&&mm(s,i)&&r.push(s),gm(s,i)?r:n(s.parentNode)}return e?n(e):r}function Ad(e){const[t]=Ki(e,1);return t??null}function go(e){return!Hi||!e?null:zn(e)?e:Ua(e)?Va(e)||e===Hn(e).scrollingElement?window:Ms(e)?e:null:null}function Pd(e){return zn(e)?e.scrollX:e.scrollLeft}function Md(e){return zn(e)?e.scrollY:e.scrollTop}function ua(e){return{x:Pd(e),y:Md(e)}}var it;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(it||(it={}));function Ld(e){return!Hi||!e?!1:e===document.scrollingElement}function Fd(e){const t={x:0,y:0},r=Ld(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 ym={x:.2,y:.2};function vm(e,t,r,n,s){let{top:i,left:o,right:a,bottom:c}=r;n===void 0&&(n=10),s===void 0&&(s=ym);const{isTop:d,isBottom:u,isLeft:f,isRight:g}=Fd(e),m={x:0,y:0},_={x:0,y:0},h={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+h.height?(m.y=it.Backward,_.y=n*Math.abs((t.top+h.height-i)/h.height)):!u&&c>=t.bottom-h.height&&(m.y=it.Forward,_.y=n*Math.abs((t.bottom-h.height-c)/h.height)),!g&&a>=t.right-h.width?(m.x=it.Forward,_.x=n*Math.abs((t.right-h.width-a)/h.width)):!f&&o<=t.left+h.width&&(m.x=it.Backward,_.x=n*Math.abs((t.left+h.width-o)/h.width)),{direction:m,speed:_}}function bm(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 $d(e){return e.reduce((t,r)=>En(t,ua(r)),Xt)}function _m(e){return e.reduce((t,r)=>t+Pd(r),0)}function wm(e){return e.reduce((t,r)=>t+Md(r),0)}function Bd(e,t){if(t===void 0&&(t=Wn),!e)return;const{top:r,left:n,bottom:s,right:i}=t(e);Ad(e)&&(s<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Sm=[["x",["left","right"],_m],["y",["top","bottom"],wm]];class qa{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Ki(r),s=$d(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of Sm)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=a(n),u=s[i]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class gs{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 xm(e){const{EventTarget:t}=xt(e);return e instanceof t?e:Hn(e)}function mo(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var qt;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(qt||(qt={}));function Ul(e){e.preventDefault()}function Cm(e){e.stopPropagation()}var we;(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"})(we||(we={}));const Ud={start:[we.Space,we.Enter],cancel:[we.Esc],end:[we.Space,we.Enter,we.Tab]},Em=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case we.Right:return{...r,x:r.x+25};case we.Left:return{...r,x:r.x-25};case we.Down:return{...r,y:r.y+25};case we.Up:return{...r,y:r.y-25}}};class za{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 gs(Hn(r)),this.windowListeners=new gs(xt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qt.Resize,this.handleCancel),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qt.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Bd(n),r(Xt)}handleKeyDown(t){if(Qi(t)){const{active:r,context:n,options:s}=this.props,{keyboardCodes:i=Ud,coordinateGetter:o=Em,scrollBehavior:a="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=n.current,u=d?{x:d.left,y:d.top}:Xt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=o(t,{active:r,context:n.current,currentCoordinates:u});if(f){const g=Cs(f,u),m={x:0,y:0},{scrollableAncestors:_}=n.current;for(const h of _){const y=t.code,{isTop:v,isRight:b,isLeft:S,isBottom:w,maxScroll:C,minScroll:D}=Fd(h),j=bm(h),k={x:Math.min(y===we.Right?j.right-j.width/2:j.right,Math.max(y===we.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(y===we.Down?j.bottom-j.height/2:j.bottom,Math.max(y===we.Down?j.top:j.top+j.height/2,f.y))},L=y===we.Right&&!b||y===we.Left&&!S,T=y===we.Down&&!w||y===we.Up&&!v;if(L&&k.x!==f.x){const A=h.scrollLeft+g.x,B=y===we.Right&&A<=C.x||y===we.Left&&A>=D.x;if(B&&!g.y){h.scrollTo({left:A,behavior:a});return}B?m.x=h.scrollLeft-A:m.x=y===we.Right?h.scrollLeft-C.x:h.scrollLeft-D.x,m.x&&h.scrollBy({left:-m.x,behavior:a});break}else if(T&&k.y!==f.y){const A=h.scrollTop+g.y,B=y===we.Down&&A<=C.y||y===we.Up&&A>=D.y;if(B&&!g.x){h.scrollTo({top:A,behavior:a});return}B?m.y=h.scrollTop-A:m.y=y===we.Down?h.scrollTop-C.y:h.scrollTop-D.y,m.y&&h.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,En(Cs(f,this.referenceCoordinates),m))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}za.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Ud,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 Vl(e){return!!(e&&"distance"in e)}function ql(e){return!!(e&&"delay"in e)}class Ha{constructor(t,r,n){var s;n===void 0&&(n=xm(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:o}=i;this.props=t,this.events=r,this.document=Hn(o),this.documentListeners=new gs(this.document),this.listeners=new gs(n),this.windowListeners=new gs(xt(o)),this.initialCoordinates=(s=Ni(i))!=null?s:Xt,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(qt.Resize,this.handleCancel),this.windowListeners.add(qt.DragStart,Ul),this.windowListeners.add(qt.VisibilityChange,this.handleCancel),this.windowListeners.add(qt.ContextMenu,Ul),this.documentListeners.add(qt.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ql(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Vl(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(qt.Click,Cm,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qt.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const c=(r=Ni(t))!=null?r:Xt,d=Cs(s,c);if(!n&&a){if(Vl(a)){if(a.tolerance!=null&&mo(d,a.tolerance))return this.handleCancel();if(mo(d,a.distance))return this.handleStart()}if(ql(a)&&mo(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===we.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Om={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Gi extends Ha{constructor(t){const{event:r}=t,n=Hn(r.target);super(t,Om,n)}}Gi.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const Dm={move:{name:"mousemove"},end:{name:"mouseup"}};var da;(function(e){e[e.RightClick=2]="RightClick"})(da||(da={}));class Im extends Ha{constructor(t){super(t,Dm,Hn(t.event.target))}}Im.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===da.RightClick?!1:(n==null||n({event:r}),!0)}}];const yo={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Tm extends Ha{constructor(t){super(t,yo)}static setup(){return window.addEventListener(yo.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(yo.move.name,t)};function t(){}}}Tm.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 ms;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ms||(ms={}));var ki;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ki||(ki={}));function Nm(e){let{acceleration:t,activator:r=ms.Pointer,canScroll:n,draggingRect:s,enabled:i,interval:o=5,order:a=ki.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:g}=e;const m=km({delta:f,disabled:!i}),[_,h]=zg(),y=p.useRef({x:0,y:0}),v=p.useRef({x:0,y:0}),b=p.useMemo(()=>{switch(r){case ms.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ms.DraggableRect:return s}},[r,s,c]),S=p.useRef(null),w=p.useCallback(()=>{const D=S.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===ki.TreeOrder?[...d].reverse():d,[a,d]);p.useEffect(()=>{if(!i||!d.length||!b){h();return}for(const D of C){if((n==null?void 0:n(D))===!1)continue;const j=d.indexOf(D),k=u[j];if(!k)continue;const{direction:L,speed:T}=vm(D,k,b,t,g);for(const A of["x","y"])m[A][L[A]]||(T[A]=0,L[A]=0);if(T.x>0||T.y>0){h(),S.current=D,_(w,o),y.current=T,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(m),_,d,C,u,JSON.stringify(g)])}const jm={x:{[it.Backward]:!1,[it.Forward]:!1},y:{[it.Backward]:!1,[it.Forward]:!1}};function km(e){let{delta:t,disabled:r}=e;const n=Ti(t);return Ls(s=>{if(r||!n||!s)return jm;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[it.Backward]:s.x[it.Backward]||i.x===-1,[it.Forward]:s.x[it.Forward]||i.x===1},y:{[it.Backward]:s.y[it.Backward]||i.y===-1,[it.Forward]:s.y[it.Forward]||i.y===1}}},[r,t,n])}function Rm(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Ls(s=>{var i;return t==null?null:(i=n??s)!=null?i:null},[n,t])}function Am(e,t){return p.useMemo(()=>e.reduce((r,n)=>{const{sensor:s}=n,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var Es;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Es||(Es={}));var fa;(function(e){e.Optimized="optimized"})(fa||(fa={}));const zl=new Map;function Pm(e,t){let{dragging:r,dependencies:n,config:s}=t;const[i,o]=p.useState(null),{frequency:a,measure:c,strategy:d}=s,u=p.useRef(e),f=y(),g=xs(f),m=p.useCallback(function(v){v===void 0&&(v=[]),!g.current&&o(b=>b===null?v:b.concat(v.filter(S=>!b.includes(S))))},[g]),_=p.useRef(null),h=Ls(v=>{if(f&&!r)return zl;if(!v||v===zl||u.current!==e||i!=null){const b=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){b.set(S.id,S.rect.current);continue}const w=S.node.current,C=w?new qa(c(w),w):null;S.rect.current=C,C&&b.set(S.id,C)}return b}return v},[e,i,r,f,c]);return p.useEffect(()=>{u.current=e},[e]),p.useEffect(()=>{f||m()},[r,f]),p.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),p.useEffect(()=>{f||typeof a!="number"||_.current!==null||(_.current=setTimeout(()=>{m(),_.current=null},a))},[a,f,m,...n]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:i!=null};function y(){switch(d){case Es.Always:return!1;case Es.BeforeDragging:return r;default:return!r}}}function Wa(e,t){return Ls(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function Mm(e,t){return Wa(e,t)}function Lm(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Yi(e){let{callback:t,disabled:r}=e;const n=Wi(t),s=p.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return p.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Fm(e){return new qa(Wn(e),e)}function Hl(e,t,r){t===void 0&&(t=Fm);const[n,s]=p.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=Lm({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),a=Yi({callback:i});return Yt(()=>{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=Wa(e);return kd(e,t)}const Wl=[];function Bm(e){const t=p.useRef(e),r=Ls(n=>e?n&&n!==Wl&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ki(e):Wl,[e]);return p.useEffect(()=>{t.current=e},[e]),r}function Um(e){const[t,r]=p.useState(null),n=p.useRef(e),s=p.useCallback(i=>{const o=go(i.target);o&&r(a=>a?(a.set(o,ua(o)),new Map(a)):null)},[]);return p.useEffect(()=>{const i=n.current;if(e!==i){o(i);const a=e.map(c=>{const d=go(c);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,ua(d)]):null}).filter(c=>c!=null);r(a.length?new Map(a):null),n.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(c=>{const d=go(c);d==null||d.removeEventListener("scroll",s)})}},[s,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>En(i,o),Xt):$d(e):Xt,[e,t])}function Ql(e,t){t===void 0&&(t=[]);const r=p.useRef(null);return p.useEffect(()=>{r.current=null},t),p.useEffect(()=>{const n=e!==Xt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Cs(e,r.current):Xt}function Vm(e){p.useEffect(()=>{if(!Hi)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function qm(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 Vd(e){return p.useMemo(()=>e?pm(e):null,[e])}const Kl=[];function zm(e,t){t===void 0&&(t=Wn);const[r]=e,n=Vd(r?xt(r):null),[s,i]=p.useState(Kl);function o(){i(()=>e.length?e.map(c=>Ld(c)?n:new qa(t(c),c)):Kl)}const a=Yi({callback:o});return Yt(()=>{a==null||a.disconnect(),o(),e.forEach(c=>a==null?void 0:a.observe(c))},[e]),s}function qd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ms(t)?t:e}function Hm(e){let{measure:t}=e;const[r,n]=p.useState(null),s=p.useCallback(d=>{for(const{target:u}of d)if(Ms(u)){n(f=>{const g=t(u);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=Yi({callback:s}),o=p.useCallback(d=>{const u=qd(d);i==null||i.disconnect(),u&&(i==null||i.observe(u)),n(u?t(u):null)},[t,i]),[a,c]=Ii(o);return p.useMemo(()=>({nodeRef:a,rect:r,setRef:c}),[r,a,c])}const Wm=[{sensor:Gi,options:{}},{sensor:za,options:{}}],Qm={current:{}},ui={draggable:{measure:Bl},droppable:{measure:Bl,strategy:Es.WhileDragging,frequency:fa.Optimized},dragOverlay:{measure:Wn}};class ys 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 Km={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ys,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ji},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ui,measureDroppableContainers:ji,windowRect:null,measuringScheduled:!1},zd={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ji,draggableNodes:new Map,over:null,measureDroppableContainers:ji},$s=p.createContext(zd),Hd=p.createContext(Km);function Gm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ys}}}function Ym(e,t){switch(t.type){case Ze.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ze.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ze.DragEnd:case Ze.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ze.RegisterDroppable:{const{element:r}=t,{id:n}=r,s=new ys(e.droppable.containers);return s.set(n,r),{...e,droppable:{...e.droppable,containers:s}}}case Ze.SetDroppableDisabled:{const{id:r,key:n,disabled:s}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new ys(e.droppable.containers);return o.set(r,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Ze.UnregisterDroppable:{const{id:r,key:n}=t,s=e.droppable.containers.get(r);if(!s||n!==s.key)return e;const i=new ys(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Xm(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:s}=p.useContext($s),i=Ti(n),o=Ti(r==null?void 0:r.id);return p.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!Qi(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Qg(u);if(f){f.focus();break}}})}},[n,t,s,o,i]),null}function Wd(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...n}),r):r}function Zm(e){return p.useMemo(()=>({draggable:{...ui.draggable,...e==null?void 0:e.draggable},droppable:{...ui.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ui.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Jm(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;Yt(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!n)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=kd(u,n);if(o||(f.x=0),a||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=Ad(d);g&&g.scrollBy({top:f.y,left:f.x})}},[t,o,a,n,r])}const Xi=p.createContext({...Xt,scaleX:1,scaleY:1});var Dr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Dr||(Dr={}));const Qd=p.memo(function(t){var r,n,s,i;let{id:o,accessibility:a,autoScroll:c=!0,children:d,sensors:u=Wm,collisionDetection:f=lm,measuring:g,modifiers:m,..._}=t;const h=p.useReducer(Ym,void 0,Gm),[y,v]=h,[b,S]=Jg(),[w,C]=p.useState(Dr.Uninitialized),D=w===Dr.Initialized,{draggable:{active:j,nodes:k,translate:L},droppable:{containers:T}}=y,A=j!=null?k.get(j):null,B=p.useRef({initial:null,translated:null}),R=p.useMemo(()=>{var et;return j!=null?{id:j,data:(et=A==null?void 0:A.data)!=null?et:Qm,rect:B}:null},[j,A]),P=p.useRef(null),[F,X]=p.useState(null),[se,De]=p.useState(null),Se=xs(_,Object.values(_)),ve=Fs("DndDescribedBy",o),q=p.useMemo(()=>T.getEnabled(),[T]),J=Zm(g),{droppableRects:te,measureDroppableContainers:U,measuringScheduled:Z}=Pm(q,{dragging:D,dependencies:[L.x,L.y],config:J.droppable}),K=Rm(k,j),le=p.useMemo(()=>se?Ni(se):null,[se]),ee=Ur(),pe=Mm(K,J.draggable.measure);Jm({activeNode:j!=null?k.get(j):null,config:ee.layoutShiftCompensation,initialRect:pe,measure:J.draggable.measure});const oe=Hl(K,J.draggable.measure,pe),We=Hl(K?K.parentElement:null),xe=p.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=T.getNodeFor((r=xe.current.over)==null?void 0:r.id),Qe=Hm({measure:J.dragOverlay.measure}),Be=(n=Qe.nodeRef.current)!=null?n:K,re=D?(s=Qe.rect)!=null?s:oe:null,ke=!!(Qe.nodeRef.current&&Qe.rect),Le=$m(ke?null:oe),Ye=Vd(Be?xt(Be):null),ot=Bm(D?Ge??K:null),Lt=zm(ot),H=Wd(m,{transform:{x:L.x-Le.x,y:L.y-Le.y,scaleX:1,scaleY:1},activatorEvent:se,active:R,activeNodeRect:oe,containerNodeRect:We,draggingNodeRect:re,over:xe.current.over,overlayNodeRect:Qe.rect,scrollableAncestors:ot,scrollableAncestorRects:Lt,windowRect:Ye}),ue=le?En(le,L):null,me=Um(ot),er=Ql(me),fr=Ql(me,[oe]),x=En(H,er),I=re?dm(re,H):null,N=R&&I?f({active:R,collisionRect:I,droppableRects:te,droppableContainers:q,pointerCoordinates:ue}):null,$=jd(N,"id"),[V,W]=p.useState(null),z=ke?H:En(H,fr),ne=cm(z,(i=V==null?void 0:V.rect)!=null?i:null,oe),ge=p.useRef(null),Ue=p.useCallback((et,ft)=>{let{sensor:wt,options:Ht}=ft;if(P.current==null)return;const Ft=k.get(P.current);if(!Ft)return;const jt=et.nativeEvent,tr=new wt({active:P.current,activeNode:Ft,event:jt,options:Ht,context:xe,onAbort(at){if(!k.get(at))return;const{onDragAbort:rr}=Se.current,pr={id:at};rr==null||rr(pr),b({type:"onDragAbort",event:pr})},onPending(at,_r,rr,pr){if(!k.get(at))return;const{onDragPending:Jn}=Se.current,wr={id:at,constraint:_r,initialCoordinates:rr,offset:pr};Jn==null||Jn(wr),b({type:"onDragPending",event:wr})},onStart(at){const _r=P.current;if(_r==null)return;const rr=k.get(_r);if(!rr)return;const{onDragStart:pr}=Se.current,Zn={activatorEvent:jt,active:{id:_r,data:rr.data,rect:B}};Lr.unstable_batchedUpdates(()=>{pr==null||pr(Zn),C(Dr.Initializing),v({type:Ze.DragStart,initialCoordinates:at,active:_r}),b({type:"onDragStart",event:Zn}),X(ge.current),De(jt)})},onMove(at){v({type:Ze.DragMove,coordinates:at})},onEnd:hn(Ze.DragEnd),onCancel:hn(Ze.DragCancel)});ge.current=tr;function hn(at){return async function(){const{active:rr,collisions:pr,over:Zn,scrollAdjustedTranslate:Jn}=xe.current;let wr=null;if(rr&&Jn){const{cancelDrop:es}=Se.current;wr={activatorEvent:jt,active:rr,collisions:pr,delta:Jn,over:Zn},at===Ze.DragEnd&&typeof es=="function"&&await Promise.resolve(es(wr))&&(at=Ze.DragCancel)}P.current=null,Lr.unstable_batchedUpdates(()=>{v({type:at}),C(Dr.Uninitialized),W(null),X(null),De(null),ge.current=null;const es=at===Ze.DragEnd?"onDragEnd":"onDragCancel";if(wr){const fo=Se.current[es];fo==null||fo(wr),b({type:es,event:wr})}})}}},[k]),Ct=p.useCallback((et,ft)=>(wt,Ht)=>{const Ft=wt.nativeEvent,jt=k.get(Ht);if(P.current!==null||!jt||Ft.dndKit||Ft.defaultPrevented)return;const tr={active:jt};et(wt,ft.options,tr)===!0&&(Ft.dndKit={capturedBy:ft.sensor},P.current=Ht,Ue(wt,ft))},[k,Ue]),Et=Am(u,Ct);Vm(u),Yt(()=>{oe&&w===Dr.Initializing&&C(Dr.Initialized)},[oe,w]),p.useEffect(()=>{const{onDragMove:et}=Se.current,{active:ft,activatorEvent:wt,collisions:Ht,over:Ft}=xe.current;if(!ft||!wt)return;const jt={active:ft,activatorEvent:wt,collisions:Ht,delta:{x:x.x,y:x.y},over:Ft};Lr.unstable_batchedUpdates(()=>{et==null||et(jt),b({type:"onDragMove",event:jt})})},[x.x,x.y]),p.useEffect(()=>{const{active:et,activatorEvent:ft,collisions:wt,droppableContainers:Ht,scrollAdjustedTranslate:Ft}=xe.current;if(!et||P.current==null||!ft||!Ft)return;const{onDragOver:jt}=Se.current,tr=Ht.get($),hn=tr&&tr.rect.current?{id:tr.id,rect:tr.rect.current,data:tr.data,disabled:tr.disabled}:null,at={active:et,activatorEvent:ft,collisions:wt,delta:{x:Ft.x,y:Ft.y},over:hn};Lr.unstable_batchedUpdates(()=>{W(hn),jt==null||jt(at),b({type:"onDragOver",event:at})})},[$]),Yt(()=>{xe.current={activatorEvent:se,active:R,activeNode:K,collisionRect:I,collisions:N,droppableRects:te,draggableNodes:k,draggingNode:Be,draggingNodeRect:re,droppableContainers:T,over:V,scrollableAncestors:ot,scrollAdjustedTranslate:x},B.current={initial:re,translated:I}},[R,K,N,I,k,Be,re,te,T,V,ot,x]),Nm({...ee,delta:L,draggingRect:I,pointerCoordinates:ue,scrollableAncestors:ot,scrollableAncestorRects:Lt});const hr=p.useMemo(()=>({active:R,activeNode:K,activeNodeRect:oe,activatorEvent:se,collisions:N,containerNodeRect:We,dragOverlay:Qe,draggableNodes:k,droppableContainers:T,droppableRects:te,over:V,measureDroppableContainers:U,scrollableAncestors:ot,scrollableAncestorRects:Lt,measuringConfiguration:J,measuringScheduled:Z,windowRect:Ye}),[R,K,oe,se,N,We,Qe,k,T,te,V,U,ot,Lt,J,Z,Ye]),Xn=p.useMemo(()=>({activatorEvent:se,activators:Et,active:R,activeNodeRect:oe,ariaDescribedById:{draggable:ve},dispatch:v,draggableNodes:k,over:V,measureDroppableContainers:U}),[se,Et,R,oe,v,ve,k,V,U]);return p.createElement(Dd.Provider,{value:S},p.createElement($s.Provider,{value:Xn},p.createElement(Hd.Provider,{value:hr},p.createElement(Xi.Provider,{value:ne},d)),p.createElement(Xm,{disabled:(a==null?void 0:a.restoreFocus)===!1})),p.createElement(rm,{...a,hiddenTextDescribedById:ve}));function Ur(){const et=(F==null?void 0:F.autoScrollEnabled)===!1,ft=typeof c=="object"?c.enabled===!1:c===!1,wt=D&&!et&&!ft;return typeof c=="object"?{...c,enabled:wt}:{enabled:wt}}}),ey=p.createContext(null),Gl="button",ty="Draggable";function Kd(e){let{id:t,data:r,disabled:n=!1,attributes:s}=e;const i=Fs(ty),{activators:o,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:g}=p.useContext($s),{role:m=Gl,roleDescription:_="draggable",tabIndex:h=0}=s??{},y=(c==null?void 0:c.id)===t,v=p.useContext(y?Xi:ey),[b,S]=Ii(),[w,C]=Ii(),D=qm(o,t),j=xs(r);Yt(()=>(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:m,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&m===Gl?!0:void 0,"aria-roledescription":_,"aria-describedby":u.draggable}),[n,m,h,y,_,u.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:k,isDragging:y,listeners:n?void 0:D,node:b,over:g,setNodeRef:S,setActivatorNodeRef:C,transform:v}}function Gd(){return p.useContext(Hd)}const ry="Droppable",ny={timeout:25};function sy(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:s}=e;const i=Fs(ry),{active:o,dispatch:a,over:c,measureDroppableContainers:d}=p.useContext($s),u=p.useRef({disabled:r}),f=p.useRef(!1),g=p.useRef(null),m=p.useRef(null),{disabled:_,updateMeasurementsFor:h,timeout:y}={...ny,...s},v=xs(h??n),b=p.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),m.current=null},y)},[y]),S=Yi({callback:b,disabled:_||!o}),w=p.useCallback((k,L)=>{S&&(L&&(S.unobserve(L),f.current=!1),k&&S.observe(k))},[S]),[C,D]=Ii(w),j=xs(t);return p.useEffect(()=>{!S||!C.current||(S.disconnect(),f.current=!1,S.observe(C.current))},[C,S]),p.useEffect(()=>(a({type:Ze.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:g,data:j}}),()=>a({type:Ze.UnregisterDroppable,key:i,id:n})),[n]),p.useEffect(()=>{r!==u.current.disabled&&(a({type:Ze.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)},[n,i,r,a]),{active:o,rect:g,isOver:(c==null?void 0:c.id)===n,node:C,over:c,setNodeRef:D}}function iy(e){let{animation:t,children:r}=e;const[n,s]=p.useState(null),[i,o]=p.useState(null),a=Ti(r);return!r&&!n&&a&&s(a),Yt(()=>{if(!i)return;const c=n==null?void 0:n.key,d=n==null?void 0:n.props.id;if(c==null||d==null){s(null);return}Promise.resolve(t(d,i)).then(()=>{s(null)})},[t,n,i]),p.createElement(p.Fragment,null,r,n?p.cloneElement(n,{ref:o}):null)}const oy={x:0,y:0,scaleX:1,scaleY:1};function ay(e){let{children:t}=e;return p.createElement($s.Provider,{value:zd},p.createElement(Xi.Provider,{value:oy},t))}const ly={position:"fixed",touchAction:"none"},cy=e=>Qi(e)?"transform 250ms ease":void 0,uy=p.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:s,children:i,className:o,rect:a,style:c,transform:d,transition:u=cy}=e;if(!a)return null;const f=s?d:{...d,scaleX:1,scaleY:1},g={...ly,width:a.width,height:a.height,top:a.top,left:a.left,transform:$r.Transform.toString(f),transformOrigin:s&&n?nm(n,a):void 0,transition:typeof u=="function"?u(n):u,...c};return p.createElement(r,{className:o,style:g,ref:t},i)}),dy=e=>t=>{let{active:r,dragOverlay:n}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,c]of Object.entries(i.active))c!==void 0&&(s[a]=r.node.style.getPropertyValue(a),r.node.style.setProperty(a,c));if(i!=null&&i.dragOverlay)for(const[a,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(a,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,d]of Object.entries(s))r.node.style.setProperty(c,d);o!=null&&o.active&&r.node.classList.remove(o.active)}},fy=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:$r.Transform.toString(t)},{transform:$r.Transform.toString(r)}]},hy={duration:250,easing:"ease",keyframes:fy,sideEffects:dy({styles:{active:{opacity:"0"}}})};function py(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:s}=e;return Wi((i,o)=>{if(t===null)return;const a=r.get(i);if(!a)return;const c=a.node.current;if(!c)return;const d=qd(o);if(!d)return;const{transform:u}=xt(o).getComputedStyle(o),f=Rd(u);if(!f)return;const g=typeof t=="function"?t:gy(t);return Bd(c,s.draggable.measure),g({active:{id:i,data:a.data,node:c,rect:s.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:s.dragOverlay.measure(d)},droppableContainers:n,measuringConfiguration:s,transform:f})})}function gy(e){const{duration:t,easing:r,sideEffects:n,keyframes:s}={...hy,...e};return i=>{let{active:o,dragOverlay:a,transform:c,...d}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/a.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/a.rect.height:1},g={x:c.x-u.x,y:c.y-u.y,...f},m=s({...d,active:o,dragOverlay:a,transform:{initial:c,final:g}}),[_]=m,h=m[m.length-1];if(JSON.stringify(_)===JSON.stringify(h))return;const y=n==null?void 0:n({active:o,dragOverlay:a,...d}),v=a.node.animate(m,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{y==null||y(),b()}})}}let Yl=0;function my(e){return p.useMemo(()=>{if(e!=null)return Yl++,Yl},[e])}const yy=p.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggableNodes:_,droppableContainers:h,dragOverlay:y,over:v,measuringConfiguration:b,scrollableAncestors:S,scrollableAncestorRects:w,windowRect:C}=Gd(),D=p.useContext(Xi),j=my(f==null?void 0:f.id),k=Wd(o,{activatorEvent:u,active:f,activeNodeRect:g,containerNodeRect:m,draggingNodeRect:y.rect,over:v,overlayNodeRect:y.rect,scrollableAncestors:S,scrollableAncestorRects:w,transform:D,windowRect:C}),L=Wa(g),T=py({config:n,draggableNodes:_,droppableContainers:h,measuringConfiguration:b}),A=L?y.setRef:void 0;return p.createElement(ay,null,p.createElement(iy,{animation:T},f&&j?p.createElement(uy,{key:j,id:f.id,ref:A,as:a,activatorEvent:u,adjustScale:t,className:c,transition:i,rect:L,style:{zIndex:d,...s},transform:k},r):null))});/**
|
|
182
182
|
* @license lucide-react v0.400.0 - ISC
|
|
183
183
|
*
|
|
184
184
|
* This source code is licensed under the ISC license.
|
|
185
185
|
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const
|
|
186
|
+
*/const vy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Yd=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
|
|
187
187
|
* @license lucide-react v0.400.0 - ISC
|
|
188
188
|
*
|
|
189
189
|
* This source code is licensed under the ISC license.
|
|
190
190
|
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
-
*/var
|
|
191
|
+
*/var by={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
192
192
|
* @license lucide-react v0.400.0 - ISC
|
|
193
193
|
*
|
|
194
194
|
* This source code is licensed under the ISC license.
|
|
195
195
|
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
-
*/const
|
|
196
|
+
*/const _y=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:i,iconNode:o,...a},c)=>p.createElement("svg",{ref:c,...by,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Yd("lucide",s),...a},[...o.map(([d,u])=>p.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
|
|
197
197
|
* @license lucide-react v0.400.0 - ISC
|
|
198
198
|
*
|
|
199
199
|
* This source code is licensed under the ISC license.
|
|
200
200
|
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
-
*/const fe=(e,t)=>{const r=p.forwardRef(({className:n,...s},i)=>p.createElement(
|
|
201
|
+
*/const fe=(e,t)=>{const r=p.forwardRef(({className:n,...s},i)=>p.createElement(_y,{ref:i,iconNode:t,className:Yd(`lucide-${vy(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
|
|
202
202
|
* @license lucide-react v0.400.0 - ISC
|
|
203
203
|
*
|
|
204
204
|
* This source code is licensed under the ISC license.
|
|
205
205
|
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
-
*/const
|
|
206
|
+
*/const wy=fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
207
207
|
* @license lucide-react v0.400.0 - ISC
|
|
208
208
|
*
|
|
209
209
|
* This source code is licensed under the ISC license.
|
|
210
210
|
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
-
*/const
|
|
211
|
+
*/const Sy=fe("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/**
|
|
212
212
|
* @license lucide-react v0.400.0 - ISC
|
|
213
213
|
*
|
|
214
214
|
* This source code is licensed under the ISC license.
|
|
215
215
|
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
-
*/const
|
|
216
|
+
*/const xy=fe("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/**
|
|
217
217
|
* @license lucide-react v0.400.0 - ISC
|
|
218
218
|
*
|
|
219
219
|
* This source code is licensed under the ISC license.
|
|
@@ -228,17 +228,17 @@ to {
|
|
|
228
228
|
*
|
|
229
229
|
* This source code is licensed under the ISC license.
|
|
230
230
|
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
-
*/const
|
|
231
|
+
*/const Xd=fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
232
232
|
* @license lucide-react v0.400.0 - ISC
|
|
233
233
|
*
|
|
234
234
|
* This source code is licensed under the ISC license.
|
|
235
235
|
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
-
*/const
|
|
236
|
+
*/const Cy=fe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
237
237
|
* @license lucide-react v0.400.0 - ISC
|
|
238
238
|
*
|
|
239
239
|
* This source code is licensed under the ISC license.
|
|
240
240
|
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
-
*/const
|
|
241
|
+
*/const Zd=fe("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
242
242
|
* @license lucide-react v0.400.0 - ISC
|
|
243
243
|
*
|
|
244
244
|
* This source code is licensed under the ISC license.
|
|
@@ -248,22 +248,22 @@ to {
|
|
|
248
248
|
*
|
|
249
249
|
* This source code is licensed under the ISC license.
|
|
250
250
|
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
-
*/const
|
|
251
|
+
*/const Ey=fe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
252
252
|
* @license lucide-react v0.400.0 - ISC
|
|
253
253
|
*
|
|
254
254
|
* This source code is licensed under the ISC license.
|
|
255
255
|
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
-
*/const
|
|
256
|
+
*/const Oy=fe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
257
257
|
* @license lucide-react v0.400.0 - ISC
|
|
258
258
|
*
|
|
259
259
|
* This source code is licensed under the ISC license.
|
|
260
260
|
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
-
*/const
|
|
261
|
+
*/const Dy=fe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
262
262
|
* @license lucide-react v0.400.0 - ISC
|
|
263
263
|
*
|
|
264
264
|
* This source code is licensed under the ISC license.
|
|
265
265
|
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
-
*/const
|
|
266
|
+
*/const Jd=fe("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
|
|
267
267
|
* @license lucide-react v0.400.0 - ISC
|
|
268
268
|
*
|
|
269
269
|
* This source code is licensed under the ISC license.
|
|
@@ -278,32 +278,32 @@ to {
|
|
|
278
278
|
*
|
|
279
279
|
* This source code is licensed under the ISC license.
|
|
280
280
|
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
-
*/const
|
|
281
|
+
*/const Iy=fe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
282
282
|
* @license lucide-react v0.400.0 - ISC
|
|
283
283
|
*
|
|
284
284
|
* This source code is licensed under the ISC license.
|
|
285
285
|
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
-
*/const
|
|
286
|
+
*/const ef=fe("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
287
287
|
* @license lucide-react v0.400.0 - ISC
|
|
288
288
|
*
|
|
289
289
|
* This source code is licensed under the ISC license.
|
|
290
290
|
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
-
*/const
|
|
291
|
+
*/const Ty=fe("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
292
292
|
* @license lucide-react v0.400.0 - ISC
|
|
293
293
|
*
|
|
294
294
|
* This source code is licensed under the ISC license.
|
|
295
295
|
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
-
*/const
|
|
296
|
+
*/const tf=fe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
297
297
|
* @license lucide-react v0.400.0 - ISC
|
|
298
298
|
*
|
|
299
299
|
* This source code is licensed under the ISC license.
|
|
300
300
|
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
-
*/const
|
|
301
|
+
*/const Ny=fe("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
|
|
302
302
|
* @license lucide-react v0.400.0 - ISC
|
|
303
303
|
*
|
|
304
304
|
* This source code is licensed under the ISC license.
|
|
305
305
|
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
-
*/const
|
|
306
|
+
*/const rf=fe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
307
307
|
* @license lucide-react v0.400.0 - ISC
|
|
308
308
|
*
|
|
309
309
|
* This source code is licensed under the ISC license.
|
|
@@ -313,7 +313,7 @@ to {
|
|
|
313
313
|
*
|
|
314
314
|
* This source code is licensed under the ISC license.
|
|
315
315
|
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
-
*/const
|
|
316
|
+
*/const jy=fe("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
317
317
|
* @license lucide-react v0.400.0 - ISC
|
|
318
318
|
*
|
|
319
319
|
* This source code is licensed under the ISC license.
|
|
@@ -333,22 +333,22 @@ to {
|
|
|
333
333
|
*
|
|
334
334
|
* This source code is licensed under the ISC license.
|
|
335
335
|
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
-
*/const
|
|
336
|
+
*/const ky=fe("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
|
|
337
337
|
* @license lucide-react v0.400.0 - ISC
|
|
338
338
|
*
|
|
339
339
|
* This source code is licensed under the ISC license.
|
|
340
340
|
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
-
*/const
|
|
341
|
+
*/const Ry=fe("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
|
|
342
342
|
* @license lucide-react v0.400.0 - ISC
|
|
343
343
|
*
|
|
344
344
|
* This source code is licensed under the ISC license.
|
|
345
345
|
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
-
*/const
|
|
346
|
+
*/const Ay=fe("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
|
|
347
347
|
* @license lucide-react v0.400.0 - ISC
|
|
348
348
|
*
|
|
349
349
|
* This source code is licensed under the ISC license.
|
|
350
350
|
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
-
*/const
|
|
351
|
+
*/const Py=fe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
352
352
|
* @license lucide-react v0.400.0 - ISC
|
|
353
353
|
*
|
|
354
354
|
* This source code is licensed under the ISC license.
|
|
@@ -368,7 +368,7 @@ to {
|
|
|
368
368
|
*
|
|
369
369
|
* This source code is licensed under the ISC license.
|
|
370
370
|
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
-
*/const
|
|
371
|
+
*/const My=fe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
|
|
372
372
|
* @license lucide-react v0.400.0 - ISC
|
|
373
373
|
*
|
|
374
374
|
* This source code is licensed under the ISC license.
|
|
@@ -378,17 +378,17 @@ to {
|
|
|
378
378
|
*
|
|
379
379
|
* This source code is licensed under the ISC license.
|
|
380
380
|
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
-
*/const
|
|
381
|
+
*/const Ly=fe("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
|
|
382
382
|
* @license lucide-react v0.400.0 - ISC
|
|
383
383
|
*
|
|
384
384
|
* This source code is licensed under the ISC license.
|
|
385
385
|
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
-
*/const
|
|
386
|
+
*/const Fy=fe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
|
|
387
387
|
* @license lucide-react v0.400.0 - ISC
|
|
388
388
|
*
|
|
389
389
|
* This source code is licensed under the ISC license.
|
|
390
390
|
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
-
*/const
|
|
391
|
+
*/const $y=fe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
|
|
392
392
|
* @license lucide-react v0.400.0 - ISC
|
|
393
393
|
*
|
|
394
394
|
* This source code is licensed under the ISC license.
|
|
@@ -403,7 +403,7 @@ to {
|
|
|
403
403
|
*
|
|
404
404
|
* This source code is licensed under the ISC license.
|
|
405
405
|
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
-
*/const
|
|
406
|
+
*/const By=fe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
407
407
|
* @license lucide-react v0.400.0 - ISC
|
|
408
408
|
*
|
|
409
409
|
* This source code is licensed under the ISC license.
|
|
@@ -413,7 +413,7 @@ to {
|
|
|
413
413
|
*
|
|
414
414
|
* This source code is licensed under the ISC license.
|
|
415
415
|
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
-
*/const dn=fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),
|
|
416
|
+
*/const dn=fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Uy={},ec=e=>{let t;const r=new Set,n=(u,f)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const m=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),r.forEach(_=>_(t,m))}},s=()=>t,c={setState:n,getState:s,getInitialState:()=>d,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(Uy?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},d=t=e(n,s,c);return c},Vy=e=>e?ec(e):ec;function nf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pa={exports:{}},vo={},Xs={exports:{}},bo={};/**
|
|
417
417
|
* @license React
|
|
418
418
|
* use-sync-external-store-shim.production.js
|
|
419
419
|
*
|
|
@@ -421,7 +421,7 @@ to {
|
|
|
421
421
|
*
|
|
422
422
|
* This source code is licensed under the MIT license found in the
|
|
423
423
|
* LICENSE file in the root directory of this source tree.
|
|
424
|
-
*/var tc;function
|
|
424
|
+
*/var tc;function qy(){if(tc)return bo;tc=1;var e=p;function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,g){var m=g(),_=n({inst:{value:m,getSnapshot:g}}),h=_[0].inst,y=_[1];return i(function(){h.value=m,h.getSnapshot=g,c(h)&&y({inst:h})},[f,m,g]),s(function(){return c(h)&&y({inst:h}),f(function(){c(h)&&y({inst:h})})},[f]),o(m),m}function c(f){var g=f.getSnapshot;f=f.value;try{var m=g();return!r(f,m)}catch{return!0}}function d(f,g){return g()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return bo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,bo}var _o={};/**
|
|
425
425
|
* @license React
|
|
426
426
|
* use-sync-external-store-shim.development.js
|
|
427
427
|
*
|
|
@@ -429,7 +429,7 @@ to {
|
|
|
429
429
|
*
|
|
430
430
|
* This source code is licensed under the MIT license found in the
|
|
431
431
|
* LICENSE file in the root directory of this source tree.
|
|
432
|
-
*/var rc;function
|
|
432
|
+
*/var rc;function zy(){return rc||(rc=1,process.env.NODE_ENV!=="production"&&function(){function e(m,_){return m===_&&(m!==0||1/m===1/_)||m!==m&&_!==_}function t(m,_){u||s.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=_();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})},[m,h,_]),a(function(){return r(v)&&b({inst:v}),m(function(){r(v)&&b({inst:v})})},[m]),d(h),h}function r(m){var _=m.getSnapshot;m=m.value;try{var h=_();return!i(m,h)}catch{return!0}}function n(m,_){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,d=s.useDebugValue,u=!1,f=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:t;_o.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),_o}var nc;function el(){return nc||(nc=1,process.env.NODE_ENV==="production"?Xs.exports=qy():Xs.exports=zy()),Xs.exports}/**
|
|
433
433
|
* @license React
|
|
434
434
|
* use-sync-external-store-shim/with-selector.production.js
|
|
435
435
|
*
|
|
@@ -437,7 +437,7 @@ to {
|
|
|
437
437
|
*
|
|
438
438
|
* This source code is licensed under the MIT license found in the
|
|
439
439
|
* LICENSE file in the root directory of this source tree.
|
|
440
|
-
*/var sc;function
|
|
440
|
+
*/var sc;function Hy(){if(sc)return vo;sc=1;var e=p,t=el();function r(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var n=typeof Object.is=="function"?Object.is:r,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return vo.useSyncExternalStoreWithSelector=function(d,u,f,g,m){var _=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,S=D,D=g(D),m!==void 0&&h.hasValue){var j=h.value;if(m(j,D))return w=j}return w=D}if(j=w,n(S,D))return j;var k=g(D);return m!==void 0&&m(j,k)?(S=D,j):(S=D,w=k)}var b=!1,S,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,g,m]);var y=s(d,_[0],_[1]);return o(function(){h.hasValue=!0,h.value=y},[y]),c(y),y},vo}var wo={};/**
|
|
441
441
|
* @license React
|
|
442
442
|
* use-sync-external-store-shim/with-selector.development.js
|
|
443
443
|
*
|
|
@@ -445,22 +445,22 @@ to {
|
|
|
445
445
|
*
|
|
446
446
|
* This source code is licensed under the MIT license found in the
|
|
447
447
|
* LICENSE file in the root directory of this source tree.
|
|
448
|
-
*/var ic;function Hy(){return ic||(ic=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,r=el(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;wo.useSyncExternalStoreWithSelector=function(d,u,f,g,m){var _=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,S=D,D=g(D),m!==void 0&&h.hasValue){var j=h.value;if(m(j,D))return w=j}return w=D}if(j=w,n(S,D))return j;var k=g(D);return m!==void 0&&m(j,k)?(S=D,j):(S=D,w=k)}var b=!1,S,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,g,m]);var y=s(d,_[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())}()),wo}process.env.NODE_ENV==="production"?pa.exports=zy():pa.exports=Hy();var Wy=pa.exports;const Qy=rf(Wy),nf={},{useDebugValue:Ky}=p,{useSyncExternalStoreWithSelector:Gy}=Qy;let oc=!1;const Yy=e=>e;function Xy(e,t=Yy,r){(nf?"production":void 0)!=="production"&&r&&!oc&&(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"),oc=!0);const n=Gy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Ky(n),n}const ac=e=>{(nf?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Uy(e):e,r=(n,s)=>Xy(t,n,s);return Object.assign(r,t),r},Zi=e=>e?ac(e):ac,ae=Zi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},contentFramework:null,contentTargetFWIds:null,rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setContentFramework:(t,r)=>e({contentFramework:t,contentTargetFWIds:r}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ae.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),Zy=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ae},Symbol.toStringTag,{value:"Module"}));function Hr(e,t){const r=[...e];for(;r.length>0;){const n=r.shift();if(n.id===t)return n;n.children&&r.push(...n.children)}}function sf(e,t,r=0){var n;for(const s of e){if(s.id===t)return r;if((n=s.children)!=null&&n.length){const i=sf(s.children,t,r+1);if(i>=0)return i}}return-1}const Jy=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function of(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of Jy)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:of(n.children,t,r)}:n})}function fi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:fi(n.children,t,r)}:n)}function ga(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?ga(r.children,t):[]}))}function af(e,t,r,n){return e.map(s=>{if(s.id===t){const i=[...s.children??[]],[o]=i.splice(r,1);return i.splice(n,0,o),{...s,children:i}}return s.children&&s.children.length>0?{...s,children:af(s.children,t,r,n)}:s})}function lf(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?lf(r.children,t):[]}})}function ev(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function tv(e,t){const r=Hr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Hr(e,s.parent):void 0;return n}const De=Zi((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=Hr(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ae.getState().setNodeFlags({isFolder:(o==null?void 0:o.isFolder)??!1,isRoot:!(o!=null&&o.parent),isQuml:!1}),e({selectedNodeId:r,breadcrumb:a,activeNodeMeta:c})},updateNode:(r,n)=>{e(s=>({treeData:of(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),t().markDirty()},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=ae.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=sf(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:fi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:ga(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:af(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Hr(i.treeData,r);if(!o)return i;let a=ga(i.treeData,r);return a=fi(a,s,{...o,parent:s}),{treeData:a}}),t().markDirty()},addResource:(r,n)=>{var u,f,g;const s=ae.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Hr(t().treeData,r.identifier))return!1;const a=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if(ev(t().treeData)>=a)return!1;const d={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:r};return e(m=>({treeData:fi(m.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=ae.getState();r==="edit"&&n(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=lf(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Hr(t().treeData,r),getChildrenOf:r=>{const n=Hr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>tv(t().treeData,r)})),rv=Zi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),nv="_spin_1ah4d_9",sv={spin:nv},iv=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:sv.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),Me=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(iv,{size:14}):null,i]}),ov="_overlay_w9xez_1",av="_modal_w9xez_11",lv="_modalHeader_w9xez_23",cv="_modalHeaderClose_w9xez_33",uv="_modalBody_w9xez_51",dv="_modalFooter_w9xez_58",fv="_checkRow_w9xez_65",hv="_formGroup_w9xez_108",pv="_textarea_w9xez_119",gv="_sliderGroup_w9xez_140",mv="_sliderValue_w9xez_152",yv="_sliderLabels_w9xez_160",vv="_sectionTitle_w9xez_168",Re={overlay:ov,modal:av,modalHeader:lv,modalHeaderClose:cv,modalBody:uv,modalFooter:dv,checkRow:fv,formGroup:hv,textarea:pv,sliderGroup:gv,sliderValue:mv,sliderLabels:yv,sectionTitle:vv},bv=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ae(u=>{var f,g;return(g=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:g.objectType})||"Content",s=ae(u=>u.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Re.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Re.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:Re.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(g=>({...g,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Me,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},_v=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Re.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Re.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Re.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:g=>a(Number(g.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Re.sliderValue,children:o})]}),l.jsxs("div",{className:Re.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Re.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:Re.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:Re.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Re.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:g=>i(g.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Me,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function cf(e,t){return function(){return e.apply(t,arguments)}}const{toString:wv}=Object.prototype,{getPrototypeOf:Bn}=Object,{iterator:Vs,toStringTag:uf}=Symbol,Ri=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Os=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Ri(r,t))return!0;r=Bn(r)}return!1},Sv=(e,t)=>e!=null&&Os(e,t)?e[t]:void 0,tl=(e=>t=>{const r=wv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Zt=e=>(e=e.toLowerCase(),t=>tl(t)===e),Ji=e=>t=>typeof t===e,{isArray:ln}=Array,Un=Ji("undefined");function Gn(e){return e!==null&&!Un(e)&&e.constructor!==null&&!Un(e.constructor)&&Tt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const df=Zt("ArrayBuffer");function xv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&df(e.buffer),t}const Cv=Ji("string"),Tt=Ji("function"),ff=Ji("number"),Yn=e=>e!==null&&typeof e=="object",Ev=e=>e===!0||e===!1,hi=e=>{if(!Yn(e))return!1;const t=Bn(e);return(t===null||t===Object.prototype||Bn(t)===null)&&!Os(e,uf)&&!Os(e,Vs)},Ov=e=>{if(!Yn(e)||Gn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Dv=Zt("Date"),Iv=Zt("File"),Tv=e=>!!(e&&typeof e.uri<"u"),Nv=e=>e&&typeof e.getParts<"u",jv=Zt("Blob"),kv=Zt("FileList"),Rv=e=>Yn(e)&&Tt(e.pipe);function Av(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const lc=Av(),cc=typeof lc.FormData<"u"?lc.FormData:void 0,Pv=e=>{if(!e)return!1;if(cc&&e instanceof cc)return!0;const t=Bn(e);if(!t||t===Object.prototype||!Tt(e.append))return!1;const r=tl(e);return r==="formdata"||r==="object"&&Tt(e.toString)&&e.toString()==="[object FormData]"},Mv=Zt("URLSearchParams"),[Lv,Fv,$v,Bv]=["ReadableStream","Request","Response","Headers"].map(Zt),Uv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),ln(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Gn(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function hf(e,t){if(Gn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Qr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,pf=e=>!Un(e)&&e!==Qr;function ma(...e){const{caseless:t,skipUndefined:r}=pf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&hf(n,o)||o,c=Ri(n,a)?n[a]:void 0;hi(c)&&hi(i)?n[a]=ma(c,i):hi(i)?n[a]=ma({},i):ln(i)?n[a]=i.slice():(!r||!Un(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Gn(a)||(qs(a,s),typeof a!="object"||ln(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];Jv.call(a,u)&&s(a[u],u)}}return n}const Vv=(e,t,r,{allOwnKeys:n}={})=>(qs(t,(s,i)=>{r&&Tt(s)?Object.defineProperty(e,i,{__proto__:null,value:cf(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),qv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zv=(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)},Hv=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&Bn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Wv=(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},Qv=e=>{if(!e)return null;if(ln(e))return e;let t=e.length;if(!ff(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Kv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Bn(Uint8Array)),Gv=(e,t)=>{const n=(e&&e[Vs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Yv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Xv=Zt("HTMLFormElement"),Zv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:Jv}=Object.prototype,eb=Zt("RegExp"),gf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};qs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},tb=e=>{gf(e,(t,r)=>{if(Tt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Tt(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+"'")})}})},rb=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return ln(e)?n(e):n(String(e).split(t)),r},nb=()=>{},sb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ib(e){return!!(e&&Tt(e.append)&&e[uf]==="FormData"&&e[Vs])}const ob=e=>{const t=new WeakSet,r=n=>{if(Yn(n)){if(t.has(n))return;if(Gn(n))return n;if(!("toJSON"in n)){t.add(n);const s=ln(n)?[]:{};return qs(n,(i,o)=>{const a=r(i);!Un(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},ab=Zt("AsyncFunction"),lb=e=>e&&(Yn(e)||Tt(e))&&Tt(e.then)&&Tt(e.catch),mf=((e,t)=>e?setImmediate:t?((r,n)=>(Qr.addEventListener("message",({source:s,data:i})=>{s===Qr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Qr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Tt(Qr.postMessage)),cb=typeof queueMicrotask<"u"?queueMicrotask.bind(Qr):typeof process<"u"&&process.nextTick||mf,yf=e=>e!=null&&Tt(e[Vs]),ub=e=>e!=null&&Os(e,Vs)&&yf(e),O={isArray:ln,isArrayBuffer:df,isBuffer:Gn,isFormData:Pv,isArrayBufferView:xv,isString:Cv,isNumber:ff,isBoolean:Ev,isObject:Yn,isPlainObject:hi,isEmptyObject:Ov,isReadableStream:Lv,isRequest:Fv,isResponse:$v,isHeaders:Bv,isUndefined:Un,isDate:Dv,isFile:Iv,isReactNativeBlob:Tv,isReactNative:Nv,isBlob:jv,isRegExp:eb,isFunction:Tt,isStream:Rv,isURLSearchParams:Mv,isTypedArray:Kv,isFileList:kv,forEach:qs,merge:ma,extend:Vv,trim:Uv,stripBOM:qv,inherits:zv,toFlatObject:Hv,kindOf:tl,kindOfTest:Zt,endsWith:Wv,toArray:Qv,forEachEntry:Gv,matchAll:Yv,isHTMLForm:Xv,hasOwnProperty:Ri,hasOwnProp:Ri,hasOwnInPrototypeChain:Os,getSafeProp:Sv,reduceDescriptors:gf,freezeMethods:tb,toObjectSet:rb,toCamelCase:Zv,noop:nb,toFiniteNumber:sb,findKey:hf,global:Qr,isContextDefined:pf,isSpecCompliantForm:ib,toJSONObject:ob,isAsyncFn:ab,isThenable:lb,setImmediate:mf,asap:cb,isIterable:yf,isSafeIterable:ub},db=O.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"]),fb=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]&&
|
|
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[uc]=this[uc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=rs(o);n[a]||(wb(s,o),n[a]=!0)}return O.isArray(t)?t.forEach(i):i(t),this}};_t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);O.reduceDescriptors(_t.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});O.freezeMethods(_t);const Sb="[REDACTED ****]";function xb(e){if(O.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(O.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Cb(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||O.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof _t&&(i=i.toJSON()),n.push(i);let o;if(O.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);O.isUndefined(d)||(o[c]=d)});else{if(!O.isPlainObject(i)&&xb(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?Sb:s(c);O.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let X=class bf extends Error{static from(t,r,n,s,i,o){const a=new bf(t.message,r||t.code,n,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,r,n,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,r=t&&O.hasOwnProp(t,"redact")?t.redact:void 0,n=O.isArray(r)&&r.length>0?Cb(t,r):O.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}};X.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";X.ERR_BAD_OPTION="ERR_BAD_OPTION";X.ECONNABORTED="ECONNABORTED";X.ETIMEDOUT="ETIMEDOUT";X.ECONNREFUSED="ECONNREFUSED";X.ERR_NETWORK="ERR_NETWORK";X.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";X.ERR_DEPRECATED="ERR_DEPRECATED";X.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";X.ERR_BAD_REQUEST="ERR_BAD_REQUEST";X.ERR_CANCELED="ERR_CANCELED";X.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";X.ERR_INVALID_URL="ERR_INVALID_URL";X.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Eb=null,_f=100;function ya(e){return O.isPlainObject(e)||O.isArray(e)}function wf(e){return O.endsWith(e,"[]")?e.slice(0,-2):e}function xo(e,t,r){return e?e.concat(t).map(function(s,i){return s=wf(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Ob(e){return O.isArray(e)&&!e.some(ya)}const Db=O.toFlatObject(O,{},null,function(t){return/^is[A-Z]/.test(t)});function eo(e,t,r){if(!O.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=O.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!O.isUndefined(S[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?_f:r.maxDepth,d=a&&O.isSpecCompliantForm(t),u=[];if(!O.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(O.isDate(v))return v.toISOString();if(O.isBoolean(v))return v.toString();if(!d&&O.isBlob(v))throw new X("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(v)||O.isTypedArray(v)?d&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function g(v){if(v>c)throw new X("Object is too deeply nested ("+v+" levels). Max depth: "+c,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(v,b){if(c===1/0)return JSON.stringify(v);const S=[];return JSON.stringify(v,function(C,D){if(!O.isObject(D))return D;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(D),g(b+S.length-1),D})}function _(v,b,S){let w=v;if(O.isReactNative(t)&&O.isReactNativeBlob(v))return t.append(xo(S,b,i),f(v)),!1;if(v&&!S&&typeof v=="object"){if(O.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=m(v,1);else if(O.isArray(v)&&Ob(v)||(O.isFileList(v)||O.endsWith(b,"[]"))&&(w=O.toArray(v)))return b=wf(b),w.forEach(function(D,j){!(O.isUndefined(D)||D===null)&&t.append(o===!0?xo([b],j,i):o===null?b:b+"[]",f(D))}),!1}return ya(v)?!0:(t.append(xo(S,b,i),f(v)),!1)}const h=Object.assign(Db,{defaultVisitor:_,convertValue:f,isVisitable:ya});function y(v,b,S=0){if(!O.isUndefined(v)){if(g(S),u.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));u.push(v),O.forEach(v,function(C,D){(!(O.isUndefined(C)||C===null)&&s.call(t,C,O.isString(D)?D.trim():D,b,h))===!0&&y(C,b?b.concat(D):[D],S+1)}),u.pop()}}if(!O.isObject(e))throw new TypeError("data must be an object");return y(e),t}function dc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function nl(e,t){this._pairs=[],e&&eo(e,this,t)}const Sf=nl.prototype;Sf.append=function(t,r){this._pairs.push([t,r])};Sf.toString=function(t){const r=t?function(n){return t.call(this,n,dc)}:dc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Ib(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xf(e,t,r){if(!t)return e;const n=O.isFunction(r)?{serialize:r}:r,s=O.getSafeProp(n,"encode")||Ib,i=O.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=O.isURLSearchParams(t)?t.toString():new nl(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class fc{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){O.forEach(this.handlers,function(n){n!==null&&t(n)})}}const sl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Tb=typeof URLSearchParams<"u"?URLSearchParams:nl,Nb=typeof FormData<"u"?FormData:null,jb=typeof Blob<"u"?Blob:null,kb={isBrowser:!0,classes:{URLSearchParams:Tb,FormData:Nb,Blob:jb},protocols:["http","https","file","blob","url","data"]},il=typeof window<"u"&&typeof document<"u",va=typeof navigator=="object"&&navigator||void 0,Rb=il&&(!va||["ReactNative","NativeScript","NS"].indexOf(va.product)<0),Ab=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pb=il&&window.location.href||"http://localhost",Mb=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:il,hasStandardBrowserEnv:Rb,hasStandardBrowserWebWorkerEnv:Ab,navigator:va,origin:Pb},Symbol.toStringTag,{value:"Module"})),dt={...Mb,...kb};function Lb(e,t){return eo(e,new dt.classes.URLSearchParams,{visitor:function(r,n,s,i){return dt.isNode&&O.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const hc=_f;function Cf(e){if(e>hc)throw new X("FormData field is too deeply nested ("+e+" levels). Max depth: "+hc,X.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Fb(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Cf(t.length),t.push(n[0]==="[]"?"":n[1]||n[0]);return t}function $b(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}function Ef(e){function t(r,n,s,i){Cf(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&O.isArray(s)?s.length:o,c?(O.hasOwnProp(s,o)?s[o]=O.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!O.hasOwnProp(s,o)||!O.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&O.isArray(s[o])&&(s[o]=$b(s[o])),!a)}if(O.isFormData(e)&&O.isFunction(e.entries)){const r={};return O.forEachEntry(e,(n,s)=>{t(Fb(n),s,r,0)}),r}return null}const pn=(e,t)=>e!=null&&O.hasOwnProp(e,t)?e[t]:void 0;function Bb(e,t,r){if(O.isString(e))try{return(t||JSON.parse)(e),O.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const zs={transitional:sl,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=O.isObject(t);if(i&&O.isHTMLForm(t)&&(t=new FormData(t)),O.isFormData(t))return s?JSON.stringify(Ef(t)):t;if(O.isArrayBuffer(t)||O.isBuffer(t)||O.isStream(t)||O.isFile(t)||O.isBlob(t)||O.isReadableStream(t))return t;if(O.isArrayBufferView(t))return t.buffer;if(O.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=pn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Lb(t,c).toString();if((a=O.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=pn(this,"env"),u=d&&d.FormData;return eo(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),Bb(t)):t}],transformResponse:[function(t){const r=pn(this,"transitional")||zs.transitional,n=r&&r.forcedJSONParsing,s=pn(this,"responseType"),i=s==="json";if(O.isResponse(t)||O.isReadableStream(t))return t;if(t&&O.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,pn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?X.from(c,X.ERR_BAD_RESPONSE,this,null,pn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:dt.classes.FormData,Blob:dt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch","query"],e=>{zs.headers[e]={}});function Co(e,t){const r=this||zs,n=t||r,s=_t.from(n.headers);let i=n.data;return O.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Of(e){return!!(e&&e.__CANCEL__)}let Hs=class extends X{constructor(t,r,n){super(t??"canceled",X.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function Df(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new X("Request failed with status code "+r.status,r.status>=400&&r.status<500?X.ERR_BAD_REQUEST:X.ERR_BAD_RESPONSE,r.config,r.request,r))}function Ub(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Vb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,g=0;for(;f!==s;)g+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const m=u&&d-u;return m?Math.round(g*1e3/m):void 0}}function qb(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Ai=(e,t,r=3)=>{let n=0;const s=Vb(50,250);return qb(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},pc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},gc=e=>(...t)=>O.asap(()=>e(...t)),zb=dt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,dt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(dt.origin),dt.navigator&&/(msie|trident)/i.test(dt.navigator.userAgent)):()=>!0,Hb=dt.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];O.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),O.isString(n)&&a.push(`path=${n}`),O.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),O.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 Wb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Kb=/^https?:(?!\/\/)/i,Gb=/[\t\n\r]/g;function Yb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Xb(e){return Yb(e).replace(Gb,"")}function mc(e,t){if(typeof e=="string"&&Kb.test(Xb(e)))throw new X('Invalid URL: missing "//" after protocol',X.ERR_INVALID_URL,t)}function If(e,t,r,n){mc(t,n);let s=!Wb(t);return e&&(s||r===!1)?(mc(e,n),Qb(e,t)):t}const yc=e=>e instanceof _t?{...e}:e;function cn(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,g,m){return O.isPlainObject(u)&&O.isPlainObject(f)?O.merge.call({caseless:m},u,f):O.isPlainObject(f)?O.merge({},f):O.isArray(f)?f.slice():f}function s(u,f,g,m){if(O.isUndefined(f)){if(!O.isUndefined(u))return n(void 0,u,g,m)}else return n(u,f,g,m)}function i(u,f){if(!O.isUndefined(f))return n(void 0,f)}function o(u,f){if(O.isUndefined(f)){if(!O.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=O.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!O.isUndefined(f))if(O.isPlainObject(f)){if(O.hasOwnProp(f,u))return f[u]}else return;const g=O.hasOwnProp(e,"transitional")?e.transitional:void 0;if(O.isPlainObject(g)&&O.hasOwnProp(g,u))return g[u]}function c(u,f,g){if(O.hasOwnProp(t,g))return n(u,f);if(O.hasOwnProp(e,g))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,g)=>s(yc(u),yc(f),g,!0)};return O.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const g=O.hasOwnProp(d,f)?d[f]:s,m=O.hasOwnProp(e,f)?e[f]:void 0,_=O.hasOwnProp(t,f)?t[f]:void 0,h=g(m,_,f);O.isUndefined(h)&&g!==c||(r[f]=h)}),O.hasOwnProp(t,"validateStatus")&&O.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(O.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Zb=["content-type","content-length"];function Jb(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Zb.includes(n.toLowerCase())&&e.set(n,s)})}const e_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Tf(e){const t=cn({},e),r=g=>O.hasOwnProp(t,g)?t[g]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=_t.from(a),t.url=xf(If(d,f,u,t),r("params"),r("paramsSerializer")),c){const g=O.getSafeProp(c,"username")||"",m=O.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(m?e_(m):"")))}if(O.isFormData(n)&&(dt.hasStandardBrowserEnv||dt.hasStandardBrowserWebWorkerEnv||O.isReactNative(n)?a.setContentType(void 0):O.isFunction(n.getHeaders)&&Jb(a,n.getHeaders(),r("formDataHeaderPolicy"))),dt.hasStandardBrowserEnv&&(O.isFunction(s)&&(s=s(t)),s===!0||s==null&&zb(t.url))){const m=i&&o&&Hb.read(o);m&&a.set(i,m)}return t}const t_=typeof XMLHttpRequest<"u",r_=t_&&function(e){return new Promise(function(r,n){const s=Tf(e);let i=s.data;const o=_t.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,g,m,_;function h(){m&&m(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const S=_t.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:S,config:e,request:y};Df(function(j){r(j),h()},function(j){n(j),h()},C),y=null}"onloadend"in y?y.onloadend=v:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(v)},y.onabort=function(){y&&(n(new X("Request aborted",X.ECONNABORTED,e,y)),h(),y=null)},y.onerror=function(w){const C=w&&w.message?w.message:"Network Error",D=new X(C,X.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||sl;s.timeoutErrorMessage&&(w=s.timeoutErrorMessage),n(new X(w,C.clarifyTimeoutError?X.ETIMEDOUT:X.ECONNABORTED,e,y)),h(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&O.forEach(vf(o),function(w,C){y.setRequestHeader(C,w)}),O.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([g,_]=Ai(d,!0),y.addEventListener("progress",g)),c&&y.upload&&([f,m]=Ai(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(u=S=>{y&&(n(!S||S.type?new Hs(null,e,y):S),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const b=Ub(s.url);if(b&&!dt.protocols.includes(b)){n(new X("Unsupported protocol "+b+":",X.ERR_BAD_REQUEST,e));return}y.send(i||null)})},n_=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof X?d:new Hs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new X(`timeout of ${t}ms exceeded`,X.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>O.asap(o),a},s_=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},i_=async function*(e,t){for await(const r of o_(e))yield*s_(r,t)},o_=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()}},vc=(e,t,r,n)=>{const s=i_(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let g=i+=f;r(g)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Pi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,a_=(e,t,r)=>t+2<r&&Pi(e.charCodeAt(t+1))&&Pi(e.charCodeAt(t+2));function l_(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let m=0;m<a;m++)if(n.charCodeAt(m)===37&&m+2<a){const _=n.charCodeAt(m+1),h=n.charCodeAt(m+2);Pi(_)&&Pi(h)&&(o-=2,m+=2)}let c=0,d=a-1;const u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const g=Math.floor(o/4)*3-(c||0);return g>0?g:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&a_(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const ol="1.18.0",bc=64*1024,{isFunction:Zs}=O,c_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),_c=e=>{if(!O.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},wc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},u_=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},d_=e=>{const t=O.global!==void 0&&O.global!==null?O.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=O.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Zs(s):typeof fetch=="function",c=Zs(i),d=Zs(o);if(!a)return!1;const u=a&&Zs(r),f=a&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),g=c&&u&&wc(()=>{let v=!1;const b=new i(dt.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),S=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!S}),m=d&&u&&wc(()=>O.isReadableStream(new o("").body)),_={stream:m&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!_[v]&&(_[v]=(b,S)=>{let w=b&&b[v];if(w)return w.call(b);throw new X(`Response type '${v}' is not supported`,X.ERR_NOT_SUPPORT,S)})});const h=async v=>{if(v==null)return 0;if(O.isBlob(v))return v.size;if(O.isSpecCompliantForm(v))return(await new i(dt.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(O.isArrayBufferView(v)||O.isArrayBuffer(v))return v.byteLength;if(O.isURLSearchParams(v)&&(v=v+""),O.isString(v))return(await f(v)).byteLength},y=async(v,b)=>{const S=O.toFiniteNumber(v.getContentLength());return S??h(b)};return async v=>{let{url:b,method:S,data:w,signal:C,cancelToken:D,timeout:j,onDownloadProgress:k,onUploadProgress:L,responseType:T,headers:R,withCredentials:B="same-origin",fetchOptions:A,maxContentLength:P,maxBodyLength:F}=Tf(v);const Y=O.isNumber(P)&&P>-1,se=O.isNumber(F)&&F>-1,Ce=K=>O.hasOwnProp(v,K)?v[K]:void 0;let ve=s||fetch;T=T?(T+"").toLowerCase():"text";let me=n_([C,D&&D.toAbortSignal()],j),q=null;const J=me&&me.unsubscribe&&(()=>{me.unsubscribe()});let te,U=null;const Z=()=>new X("Request body larger than maxBodyLength limit",X.ERR_BAD_REQUEST,v,q);try{let K;const le=Ce("auth");if(le){const re=O.getSafeProp(le,"username")||"",ke=O.getSafeProp(le,"password")||"";K={username:re,password:ke}}if(u_(b)){const re=new URL(b,dt.origin);if(!K&&(re.username||re.password)){const ke=_c(re.username),Le=_c(re.password);K={username:ke,password:Le}}(re.username||re.password)&&(re.username="",re.password="",b=re.href)}if(K&&(R.delete("authorization"),R.set("Authorization","Basic "+btoa(c_((K.username||"")+":"+(K.password||""))))),Y&&typeof b=="string"&&b.startsWith("data:")&&l_(b)>P)throw new X("maxContentLength size of "+P+" exceeded",X.ERR_BAD_RESPONSE,v,q);if(se&&S!=="get"&&S!=="head"){const re=await h(w);if(typeof re=="number"&&isFinite(re)&&(te=re,re>F))throw Z()}const ee=se&&(O.isReadableStream(w)||O.isStream(w)),pe=(re,ke,Le)=>vc(re,bc,Ye=>{if(se&&Ye>F)throw U=Z();ke&&ke(Ye)},Le);if(g&&S!=="get"&&S!=="head"&&(L||ee)){if(te=te??await y(R,w),te!==0||ee){let re=new i(b,{method:"POST",body:w,duplex:"half"}),ke;if(O.isFormData(w)&&(ke=re.headers.get("content-type"))&&R.setContentType(ke),re.body){const[Le,Ye]=L&&pc(te,Ai(gc(L)))||[];w=pe(re.body,Le,Ye)}}}else if(ee&&!c&&u&&S!=="get"&&S!=="head")w=pe(w);else if(ee&&c&&!g&&S!=="get"&&S!=="head")throw new X("Stream request bodies are not supported by the current fetch implementation",X.ERR_NOT_SUPPORT,v,q);O.isString(B)||(B=B?"include":"omit");const oe=c&&"credentials"in i.prototype;if(O.isFormData(w)){const re=R.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&R.delete("content-type")}R.set("User-Agent","axios/"+ol,!1);const We={...A,signal:me,method:S.toUpperCase(),headers:vf(R.normalize()),body:w,duplex:"half",credentials:oe?B:void 0};q=c&&new i(b,We);let xe=await(c?ve(q,A):ve(b,We));const Ge=_t.from(xe.headers);if(Y){const re=O.toFiniteNumber(Ge.getContentLength());if(re!=null&&re>P)throw new X("maxContentLength size of "+P+" exceeded",X.ERR_BAD_RESPONSE,v,q)}const Qe=m&&(T==="stream"||T==="response");if(m&&xe.body&&(k||Y||Qe&&J)){const re={};["status","statusText","headers"].forEach(H=>{re[H]=xe[H]});const ke=O.toFiniteNumber(Ge.getContentLength()),[Le,Ye]=k&&pc(ke,Ai(gc(k),!0))||[];let ot=0;const Lt=H=>{if(Y&&(ot=H,ot>P))throw new X("maxContentLength size of "+P+" exceeded",X.ERR_BAD_RESPONSE,v,q);Le&&Le(H)};xe=new o(vc(xe.body,bc,Lt,()=>{Ye&&Ye(),J&&J()}),re)}T=T||"text";let Be=await _[O.findKey(_,T)||"text"](xe,v);if(Y&&!m&&!Qe){let re;if(Be!=null&&(typeof Be.byteLength=="number"?re=Be.byteLength:typeof Be.size=="number"?re=Be.size:typeof Be=="string"&&(re=typeof n=="function"?new n().encode(Be).byteLength:Be.length)),typeof re=="number"&&re>P)throw new X("maxContentLength size of "+P+" exceeded",X.ERR_BAD_RESPONSE,v,q)}return!Qe&&J&&J(),await new Promise((re,ke)=>{Df(re,ke,{data:Be,headers:_t.from(xe.headers),status:xe.status,statusText:xe.statusText,config:v,request:q})})}catch(K){if(J&&J(),me&&me.aborted&&me.reason instanceof X){const le=me.reason;throw le.config=v,q&&(le.request=q),K!==le&&(le.cause=K),le}throw U?(q&&!U.request&&(U.request=q),U):K instanceof X?(q&&!K.request&&(K.request=q),K):K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new X("Network Error",X.ERR_NETWORK,v,q,K&&K.response),{cause:K.cause||K}):X.from(K,K&&K.code,v,q,K&&K.response)}}},f_=new Map,Nf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=f_;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:d_(t)),u=d;return d};Nf();const al={http:Eb,xhr:r_,fetch:{get:Nf}};O.forEach(al,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Sc=e=>`- ${e}`,h_=e=>O.isFunction(e)||e===null||e===!1;function p_(e,t){e=O.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,!h_(n)&&(s=al[(a=String(n)).toLowerCase()],s===void 0))throw new X(`Unknown adapter '${a}'`);if(s&&(O.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
|
|
448
|
+
*/var ic;function Wy(){return ic||(ic=1,process.env.NODE_ENV!=="production"&&function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,r=el(),n=typeof Object.is=="function"?Object.is:e,s=r.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;wo.useSyncExternalStoreWithSelector=function(d,u,f,g,m){var _=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,S=D,D=g(D),m!==void 0&&h.hasValue){var j=h.value;if(m(j,D))return w=j}return w=D}if(j=w,n(S,D))return j;var k=g(D);return m!==void 0&&m(j,k)?(S=D,j):(S=D,w=k)}var b=!1,S,w,C=f===void 0?null:f;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,f,g,m]);var y=s(d,_[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())}()),wo}process.env.NODE_ENV==="production"?pa.exports=Hy():pa.exports=Wy();var Qy=pa.exports;const Ky=nf(Qy),sf={},{useDebugValue:Gy}=p,{useSyncExternalStoreWithSelector:Yy}=Ky;let oc=!1;const Xy=e=>e;function Zy(e,t=Xy,r){(sf?"production":void 0)!=="production"&&r&&!oc&&(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"),oc=!0);const n=Yy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Gy(n),n}const ac=e=>{(sf?"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"?Vy(e):e,r=(n,s)=>Zy(t,n,s);return Object.assign(r,t),r},Zi=e=>e?ac(e):ac,ae=Zi(e=>({editorConfig:null,editorMode:"edit",buttonLoaders:{saveCollection:!1,publishCollection:!1,addFromLibrary:!1,rejectCollection:!1,sourcingApproveCollection:!1,sourcingRejectCollection:!1},showPreview:!1,pageId:"collection_editor",isCurrentNodeFolder:!1,isCurrentNodeRoot:!1,isQumlPlayer:!1,isDirty:!1,lastSaved:null,formStatusMapper:{},contentFramework:null,contentTargetFWIds:null,rootFormConfig:null,unitFormConfig:null,childFormConfig:null,searchFormConfig:null,relationalFormConfig:null,publishChecklist:null,reviewChecklist:null,rfcChecklist:null,categoryMeta:null,setEditorConfig:t=>e({editorConfig:t}),setEditorMode:t=>e({editorMode:t}),setButtonLoader:(t,r)=>e(n=>({buttonLoaders:{...n.buttonLoaders,[t]:r}})),setShowPreview:t=>e({showPreview:t}),setPageId:t=>e({pageId:t}),setNodeFlags:t=>e({...t.isFolder!==void 0&&{isCurrentNodeFolder:t.isFolder},...t.isRoot!==void 0&&{isCurrentNodeRoot:t.isRoot},...t.isQuml!==void 0&&{isQumlPlayer:t.isQuml}}),setLastSaved:t=>e({lastSaved:t}),setIsDirty:t=>e({isDirty:t}),setContentFramework:(t,r)=>e({contentFramework:t,contentTargetFWIds:r}),setFormStatus:(t,r)=>e(n=>({formStatusMapper:{...n.formStatusMapper,[t]:r}})),validateAllForms:t=>{const r=ae.getState().formStatusMapper,n=[...t];for(;n.length>0;){const s=n.shift();if(r[s.id]===!1)return!1;s.children&&n.push(...s.children)}return!0},setCategoryDefinition:t=>e({rootFormConfig:t.rootForm,unitFormConfig:t.unitForm,childFormConfig:t.childForm,searchFormConfig:t.searchForm,relationalFormConfig:t.relationalForm,publishChecklist:t.publishChecklist,reviewChecklist:t.reviewChecklist,rfcChecklist:t.rfcChecklist,categoryMeta:{schemaDefaults:t.schemaDefaults,frameworkMetadata:t.frameworkMetadata,sourcingSettings:t.sourcingSettings}})})),Jy=Object.freeze(Object.defineProperty({__proto__:null,useEditorStore:ae},Symbol.toStringTag,{value:"Module"}));function Hr(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 of(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=of(s.children,t,r+1);if(i>=0)return i}}return-1}const ev=new Set(["name","appIcon","description","keywords","trackable","qrCodeProcessId","reservedDialcodes"]);function af(e,t,r){return e.map(n=>{if(n.id===t){const s=r.metadata??{},i={};for(const o of ev)o in r&&(i[o]=r[o]);return{...n,...r,metadata:{...n.metadata??{},...i,...s}}}return n.children&&n.children.length>0?{...n,children:af(n.children,t,r)}:n})}function fi(e,t,r){return e.map(n=>n.id===t?{...n,children:[...n.children??[],r]}:n.children&&n.children.length>0?{...n,children:fi(n.children,t,r)}:n)}function ga(e,t){return e.filter(r=>r.id!==t).map(r=>({...r,children:r.children?ga(r.children,t):[]}))}function lf(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:lf(s.children,t,r,n)}:s})}function cf(e,t){return e.map(r=>{const n=t[r.id]??r.id,s=r.parent?t[r.parent]??r.parent:r.parent;return{...r,id:n,identifier:n,parent:s,children:r.children?cf(r.children,t):[]}})}function tv(e){let t=0;const r=[...e];for(;r.length>0;){const n=r.shift();n.isFolder||t++,n.children&&r.push(...n.children)}return t}function rv(e,t){const r=Hr(e,t);if(!r)return[];const n=[];let s=r;for(;s;)n.unshift({id:s.id,name:s.name}),s=s.parent?Hr(e,s.parent):void 0;return n}const Oe=Zi((e,t)=>({treeData:[],selectedNodeId:null,treeCache:{},breadcrumb:[],activeNodeMeta:{},setTreeData:r=>{var s;const n=((s=r[0])==null?void 0:s.id)??null;e({treeData:r,selectedNodeId:n}),n&&setTimeout(()=>t().selectNode(n),0)},selectNode:r=>{const{treeData:n,treeCache:s,getBreadcrumb:i}=t(),o=Hr(n,r),a=i(r),c={...(o==null?void 0:o.metadata)??{},...s[r]??{}};ae.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:af(s.treeData,r,n),treeCache:{...s.treeCache,[r]:{...s.treeCache[r]??{},...n}}})),t().markDirty()},addNode:(r,n)=>{var d,u;const s=t(),i=((u=(d=ae.getState().editorConfig)==null?void 0:d.config)==null?void 0:u.maxDepth)??4,o=of(s.treeData,r);if(o>=i)return console.warn(`[tree.store] addNode: depth would exceed maxDepth (${i}). parentDepth=${o}`),"";const a="temp-"+Math.random().toString(36).slice(2),c={id:a,identifier:a,name:"Untitled Unit",isFolder:!0,children:[],parent:r,metadata:{mimeType:"application/vnd.ekstep.content-collection",code:a,name:"Untitled Unit",visibility:"Parent"}};return e(f=>({treeData:fi(f.treeData,r,c),treeCache:{...f.treeCache,[a]:{...c.metadata,isNew:!0}}})),setTimeout(()=>t().selectNode(a),0),a},deleteNode:r=>{e(n=>({treeData:ga(n.treeData,r),selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}))},reorderChildren:(r,n,s)=>{e(i=>({treeData:lf(i.treeData,r,n,s)}))},moveNode:(r,n,s)=>{e(i=>{const o=Hr(i.treeData,r);if(!o)return i;let a=ga(i.treeData,r);return a=fi(a,s,{...o,parent:s}),{treeData:a}}),t().markDirty()},addResource:(r,n)=>{var u,f,g;const s=ae.getState().editorConfig,i=((u=s==null?void 0:s.config)==null?void 0:u.allowContentUnderRoot)??!1,o=(f=t().treeData[0])==null?void 0:f.id;if(!i&&n===o||Hr(t().treeData,r.identifier))return!1;const a=((g=s==null?void 0:s.config)==null?void 0:g.maxContentsLimit)??1200;if(tv(t().treeData)>=a)return!1;const d={id:r.identifier,identifier:r.identifier,name:r.name,isFolder:!1,children:[],parent:n,mimeType:r.mimeType,primaryCategory:r.primaryCategory,contentType:r.contentType,appIcon:r.appIcon,status:r.status,metadata:r};return e(m=>({treeData:fi(m.treeData,n,d)})),t().markDirty(),!0},markDirty:()=>{const{editorMode:r,setIsDirty:n}=ae.getState();r==="edit"&&n(!0)},replaceNodeIds:r=>{!r||Object.keys(r).length===0||e(n=>{const s=cf(n.treeData,r),i={};for(const[a,c]of Object.entries(n.treeCache)){const d=r[a]??a,{isNew:u,...f}=c;i[d]=f}const o=n.selectedNodeId?r[n.selectedNodeId]??n.selectedNodeId:null;return{treeData:s,treeCache:i,selectedNodeId:o}})},getNodeById:r=>Hr(t().treeData,r),getChildrenOf:r=>{const n=Hr(t().treeData,r);return(n==null?void 0:n.children)??[]},getBreadcrumb:r=>rv(t().treeData,r)})),nv=Zi(e=>({activeModal:null,modalData:{},openModal:(t,r={})=>e({activeModal:t,modalData:r}),closeModal:()=>e({activeModal:null,modalData:{}})})),sv="_spin_1ah4d_9",iv={spin:sv},ov=({size:e=16,color:t="currentColor"})=>l.jsx("svg",{className:iv.spin,width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-label":"Loading",role:"status",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"3",strokeDasharray:"31.4",strokeDashoffset:"10",strokeLinecap:"round"})}),Me=({variant:e="ghost",size:t="md",isLoading:r,disabled:n,onClick:s,children:i,className:o,type:a="button"})=>l.jsxs("button",{type:a,className:`sbx-btn-${e} ${t==="sm"?"sbx-btn-sm":""} ${o??""}`,onClick:s,disabled:r||n,"aria-busy":r?!0:void 0,children:[r?l.jsx(ov,{size:14}):null,i]}),av="_overlay_w9xez_1",lv="_modal_w9xez_11",cv="_modalHeader_w9xez_23",uv="_modalHeaderClose_w9xez_33",dv="_modalBody_w9xez_51",fv="_modalFooter_w9xez_58",hv="_checkRow_w9xez_65",pv="_formGroup_w9xez_108",gv="_textarea_w9xez_119",mv="_sliderGroup_w9xez_140",yv="_sliderValue_w9xez_152",vv="_sliderLabels_w9xez_160",bv="_sectionTitle_w9xez_168",Re={overlay:av,modal:lv,modalHeader:cv,modalHeaderClose:uv,modalBody:dv,modalFooter:fv,checkRow:hv,formGroup:pv,textarea:gv,sliderGroup:mv,sliderValue:yv,sliderLabels:vv,sectionTitle:bv},_v=({contentId:e,onConfirm:t,onCancel:r})=>{const n=ae(u=>{var f,g;return(g=(f=u.editorConfig)==null?void 0:f.config)==null?void 0:g.objectType})||"Content",s=ae(u=>u.publishChecklist)??[],[i,o]=p.useState({}),a=s.every(u=>i[u.code]),c=s.length===0||a,d=()=>{t()};return l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsxs("span",{id:"publish-modal-title",children:["Publish ",n]}),l.jsx("button",{className:Re.modalHeaderClose,onClick:r,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:s.length===0?l.jsxs("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:["Are you sure you want to publish this ",n,"?"]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:Re.sectionTitle,children:"Please confirm that ALL the following items are verified (by ticking the check-boxes) before you can publish:"}),s.map(u=>l.jsxs("label",{className:Re.checkRow,children:[l.jsx("input",{type:"checkbox",checked:!!i[u.code],onChange:f=>o(g=>({...g,[u.code]:f.target.checked}))}),l.jsx("span",{children:u.label})]},u.code))]})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:r,children:"No"}),l.jsx(Me,{variant:"primary",onClick:d,disabled:!c,children:"Yes"})]})]})})},wv=({contentId:e,action:t,onConfirm:r,onCancel:n})=>{const[s,i]=p.useState(""),[o,a]=p.useState(7),c=t==="approve",d=c?"Review Quality":"Reject Content",u=!c&&s.trim().length===0,f=()=>{c?r(s.trim(),o):r(s.trim())};return l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"quality-modal-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsx("span",{id:"quality-modal-title",children:d}),l.jsx("button",{className:Re.modalHeaderClose,onClick:n,"aria-label":"Close",children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:c?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Re.formGroup,children:[l.jsx("label",{htmlFor:"quality-score",children:"Quality Score"}),l.jsxs("div",{className:Re.sliderGroup,children:[l.jsx("input",{id:"quality-score",type:"range",min:0,max:10,step:1,value:o,onChange:g=>a(Number(g.target.value)),"aria-valuemin":0,"aria-valuemax":10,"aria-valuenow":o}),l.jsx("span",{className:Re.sliderValue,children:o})]}),l.jsxs("div",{className:Re.sliderLabels,children:[l.jsx("span",{children:"0 — Poor"}),l.jsx("span",{children:"10 — Excellent"})]})]}),l.jsxs("div",{className:Re.formGroup,children:[l.jsxs("label",{htmlFor:"quality-comment",children:["Comment"," ",l.jsx("span",{style:{fontWeight:400,color:"var(--sbx-gray-400, #9CA3AF)"},children:"(optional)"})]}),l.jsx("textarea",{id:"quality-comment",className:Re.textarea,placeholder:"Add any notes for the content creator…",value:s,onChange:g=>i(g.target.value),rows:4})]})]}):l.jsxs("div",{className:Re.formGroup,children:[l.jsxs("label",{htmlFor:"reject-reason",children:["Rejection Reason"," ",l.jsx("span",{style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:"reject-reason",className:Re.textarea,placeholder:"Describe why this content is being rejected…",value:s,onChange:g=>i(g.target.value),rows:5,required:!0,"aria-required":"true"}),s.trim().length===0&&l.jsx("p",{style:{fontSize:12,color:"var(--sbx-error, #DC2626)",marginTop:4},children:"A rejection reason is required."})]})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:n,children:"Cancel"}),l.jsx(Me,{variant:c?"primary":"danger",onClick:f,disabled:u,children:c?"Approve":"Reject"})]})]})})};function uf(e,t){return function(){return e.apply(t,arguments)}}const{toString:Sv}=Object.prototype,{getPrototypeOf:Bn}=Object,{iterator:Vs,toStringTag:df}=Symbol,Ri=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Os=(e,t)=>{let r=e;const n=[];for(;r!=null&&r!==Object.prototype;){if(n.indexOf(r)!==-1)return!1;if(n.push(r),Ri(r,t))return!0;r=Bn(r)}return!1},xv=(e,t)=>e!=null&&Os(e,t)?e[t]:void 0,tl=(e=>t=>{const r=Sv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Zt=e=>(e=e.toLowerCase(),t=>tl(t)===e),Ji=e=>t=>typeof t===e,{isArray:ln}=Array,Un=Ji("undefined");function Gn(e){return e!==null&&!Un(e)&&e.constructor!==null&&!Un(e.constructor)&&Tt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ff=Zt("ArrayBuffer");function Cv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ff(e.buffer),t}const Ev=Ji("string"),Tt=Ji("function"),hf=Ji("number"),Yn=e=>e!==null&&typeof e=="object",Ov=e=>e===!0||e===!1,hi=e=>{if(!Yn(e))return!1;const t=Bn(e);return(t===null||t===Object.prototype||Bn(t)===null)&&!Os(e,df)&&!Os(e,Vs)},Dv=e=>{if(!Yn(e)||Gn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Iv=Zt("Date"),Tv=Zt("File"),Nv=e=>!!(e&&typeof e.uri<"u"),jv=e=>e&&typeof e.getParts<"u",kv=Zt("Blob"),Rv=Zt("FileList"),Av=e=>Yn(e)&&Tt(e.pipe);function Pv(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const lc=Pv(),cc=typeof lc.FormData<"u"?lc.FormData:void 0,Mv=e=>{if(!e)return!1;if(cc&&e instanceof cc)return!0;const t=Bn(e);if(!t||t===Object.prototype||!Tt(e.append))return!1;const r=tl(e);return r==="formdata"||r==="object"&&Tt(e.toString)&&e.toString()==="[object FormData]"},Lv=Zt("URLSearchParams"),[Fv,$v,Bv,Uv]=["ReadableStream","Request","Response","Headers"].map(Zt),Vv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qs(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),ln(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{if(Gn(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 pf(e,t){if(Gn(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Qr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gf=e=>!Un(e)&&e!==Qr;function ma(...e){const{caseless:t,skipUndefined:r}=gf(this)&&this||{},n={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&pf(n,o)||o,c=Ri(n,a)?n[a]:void 0;hi(c)&&hi(i)?n[a]=ma(c,i):hi(i)?n[a]=ma({},i):ln(i)?n[a]=i.slice():(!r||!Un(i))&&(n[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Gn(a)||(qs(a,s),typeof a!="object"||ln(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];eb.call(a,u)&&s(a[u],u)}}return n}const qv=(e,t,r,{allOwnKeys:n}={})=>(qs(t,(s,i)=>{r&&Tt(s)?Object.defineProperty(e,i,{__proto__:null,value:uf(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),zv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Hv=(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)},Wv=(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!n||n(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=r!==!1&&Bn(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Qv=(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},Kv=e=>{if(!e)return null;if(ln(e))return e;let t=e.length;if(!hf(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Gv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Bn(Uint8Array)),Yv=(e,t)=>{const n=(e&&e[Vs]).call(e);let s;for(;(s=n.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Xv=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Zv=Zt("HTMLFormElement"),Jv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),{propertyIsEnumerable:eb}=Object.prototype,tb=Zt("RegExp"),mf=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};qs(r,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(n[i]=o||s)}),Object.defineProperties(e,n)},rb=e=>{mf(e,(t,r)=>{if(Tt(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];if(Tt(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+"'")})}})},nb=(e,t)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return ln(e)?n(e):n(String(e).split(t)),r},sb=()=>{},ib=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ob(e){return!!(e&&Tt(e.append)&&e[df]==="FormData"&&e[Vs])}const ab=e=>{const t=new WeakSet,r=n=>{if(Yn(n)){if(t.has(n))return;if(Gn(n))return n;if(!("toJSON"in n)){t.add(n);const s=ln(n)?[]:{};return qs(n,(i,o)=>{const a=r(i);!Un(a)&&(s[o]=a)}),t.delete(n),s}}return n};return r(e)},lb=Zt("AsyncFunction"),cb=e=>e&&(Yn(e)||Tt(e))&&Tt(e.then)&&Tt(e.catch),yf=((e,t)=>e?setImmediate:t?((r,n)=>(Qr.addEventListener("message",({source:s,data:i})=>{s===Qr&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),Qr.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Tt(Qr.postMessage)),ub=typeof queueMicrotask<"u"?queueMicrotask.bind(Qr):typeof process<"u"&&process.nextTick||yf,vf=e=>e!=null&&Tt(e[Vs]),db=e=>e!=null&&Os(e,Vs)&&vf(e),O={isArray:ln,isArrayBuffer:ff,isBuffer:Gn,isFormData:Mv,isArrayBufferView:Cv,isString:Ev,isNumber:hf,isBoolean:Ov,isObject:Yn,isPlainObject:hi,isEmptyObject:Dv,isReadableStream:Fv,isRequest:$v,isResponse:Bv,isHeaders:Uv,isUndefined:Un,isDate:Iv,isFile:Tv,isReactNativeBlob:Nv,isReactNative:jv,isBlob:kv,isRegExp:tb,isFunction:Tt,isStream:Av,isURLSearchParams:Lv,isTypedArray:Gv,isFileList:Rv,forEach:qs,merge:ma,extend:qv,trim:Vv,stripBOM:zv,inherits:Hv,toFlatObject:Wv,kindOf:tl,kindOfTest:Zt,endsWith:Qv,toArray:Kv,forEachEntry:Yv,matchAll:Xv,isHTMLForm:Zv,hasOwnProperty:Ri,hasOwnProp:Ri,hasOwnInPrototypeChain:Os,getSafeProp:xv,reduceDescriptors:mf,freezeMethods:rb,toObjectSet:nb,toCamelCase:Jv,noop:sb,toFiniteNumber:ib,findKey:pf,global:Qr,isContextDefined:gf,isSpecCompliantForm:ob,toJSONObject:ab,isAsyncFn:lb,isThenable:cb,setImmediate:yf,asap:ub,isIterable:vf,isSafeIterable:db},fb=O.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"]),hb=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]&&fb[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};function pb(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 gb=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),mb=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function rl(e,t){return O.isArray(e)?e.map(r=>rl(r,t)):pb(String(e).replace(t,""))}const yb=e=>rl(e,gb),vb=e=>rl(e,mb);function bf(e){const t=Object.create(null);return O.forEach(e.toJSON(),(r,n)=>{t[n]=vb(r)}),t}const uc=Symbol("internals");function rs(e){return e&&String(e).trim().toLowerCase()}function pi(e){return e===!1||e==null?e:O.isArray(e)?e.map(pi):yb(String(e))}function bb(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 _b=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function So(e,t,r,n,s){if(O.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!O.isString(t)){if(O.isString(n))return t.indexOf(n)!==-1;if(O.isRegExp(n))return n.test(t)}}function wb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Sb(e,t){const r=O.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 _t=class{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function i(a,c,d){const u=rs(c);if(!u)return;const f=O.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||c]=pi(a))}const o=(a,c)=>O.forEach(a,(d,u)=>i(d,u,c));if(O.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(O.isString(t)&&(t=t.trim())&&!_b(t))o(hb(t),r);else if(O.isObject(t)&&O.isSafeIterable(t)){let a=Object.create(null),c,d;for(const u of t){if(!O.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],O.hasOwnProp(a,d)?(c=a[d],a[d]=O.isArray(c)?[...c,u[1]]:[c,u[1]]):a[d]=u[1]}o(a,r)}else t!=null&&i(r,t,n);return this}get(t,r){if(t=rs(t),t){const n=O.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return bb(s);if(O.isFunction(r))return r.call(this,s,n);if(O.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=rs(t),t){const n=O.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||So(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function i(o){if(o=rs(o),o){const a=O.findKey(n,o);a&&(!r||So(n,n[a],a,r))&&(delete n[a],s=!0)}}return O.isArray(t)?t.forEach(i):i(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!t||So(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const r=this,n={};return O.forEach(this,(s,i)=>{const o=O.findKey(n,i);if(o){r[o]=pi(s),delete r[i];return}const a=t?wb(i):String(i).trim();a!==i&&delete r[i],r[a]=pi(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return O.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&O.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[uc]=this[uc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=rs(o);n[a]||(Sb(s,o),n[a]=!0)}return O.isArray(t)?t.forEach(i):i(t),this}};_t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);O.reduceDescriptors(_t.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});O.freezeMethods(_t);const xb="[REDACTED ****]";function Cb(e){if(O.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(O.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Eb(e,t){const r=new Set(t.map(i=>String(i).toLowerCase())),n=[],s=i=>{if(i===null||typeof i!="object"||O.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof _t&&(i=i.toJSON()),n.push(i);let o;if(O.isArray(i))o=[],i.forEach((a,c)=>{const d=s(a);O.isUndefined(d)||(o[c]=d)});else{if(!O.isPlainObject(i)&&Cb(i))return n.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?xb:s(c);O.isUndefined(d)||(o[a]=d)}}return n.pop(),o};return s(e)}let Y=class _f extends Error{static from(t,r,n,s,i,o){const a=new _f(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&&O.hasOwnProp(t,"redact")?t.redact:void 0,n=O.isArray(r)&&r.length>0?Eb(t,r):O.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 Ob=null,wf=100;function ya(e){return O.isPlainObject(e)||O.isArray(e)}function Sf(e){return O.endsWith(e,"[]")?e.slice(0,-2):e}function xo(e,t,r){return e?e.concat(t).map(function(s,i){return s=Sf(s),!r&&i?"["+s+"]":s}).join(r?".":""):t}function Db(e){return O.isArray(e)&&!e.some(ya)}const Ib=O.toFlatObject(O,{},null,function(t){return/^is[A-Z]/.test(t)});function eo(e,t,r){if(!O.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=O.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,S){return!O.isUndefined(S[b])});const n=r.metaTokens,s=r.visitor||_,i=r.dots,o=r.indexes,a=r.Blob||typeof Blob<"u"&&Blob,c=r.maxDepth===void 0?wf:r.maxDepth,d=a&&O.isSpecCompliantForm(t),u=[];if(!O.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(O.isDate(v))return v.toISOString();if(O.isBoolean(v))return v.toString();if(!d&&O.isBlob(v))throw new Y("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(v)||O.isTypedArray(v)?d&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function g(v){if(v>c)throw new Y("Object is too deeply nested ("+v+" levels). Max depth: "+c,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(v,b){if(c===1/0)return JSON.stringify(v);const S=[];return JSON.stringify(v,function(C,D){if(!O.isObject(D))return D;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(D),g(b+S.length-1),D})}function _(v,b,S){let w=v;if(O.isReactNative(t)&&O.isReactNativeBlob(v))return t.append(xo(S,b,i),f(v)),!1;if(v&&!S&&typeof v=="object"){if(O.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=m(v,1);else if(O.isArray(v)&&Db(v)||(O.isFileList(v)||O.endsWith(b,"[]"))&&(w=O.toArray(v)))return b=Sf(b),w.forEach(function(D,j){!(O.isUndefined(D)||D===null)&&t.append(o===!0?xo([b],j,i):o===null?b:b+"[]",f(D))}),!1}return ya(v)?!0:(t.append(xo(S,b,i),f(v)),!1)}const h=Object.assign(Ib,{defaultVisitor:_,convertValue:f,isVisitable:ya});function y(v,b,S=0){if(!O.isUndefined(v)){if(g(S),u.indexOf(v)!==-1)throw new Error("Circular reference detected in "+b.join("."));u.push(v),O.forEach(v,function(C,D){(!(O.isUndefined(C)||C===null)&&s.call(t,C,O.isString(D)?D.trim():D,b,h))===!0&&y(C,b?b.concat(D):[D],S+1)}),u.pop()}}if(!O.isObject(e))throw new TypeError("data must be an object");return y(e),t}function dc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(n){return t[n]})}function nl(e,t){this._pairs=[],e&&eo(e,this,t)}const xf=nl.prototype;xf.append=function(t,r){this._pairs.push([t,r])};xf.toString=function(t){const r=t?function(n){return t.call(this,n,dc)}:dc;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Tb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Cf(e,t,r){if(!t)return e;const n=O.isFunction(r)?{serialize:r}:r,s=O.getSafeProp(n,"encode")||Tb,i=O.getSafeProp(n,"serialize");let o;if(i?o=i(t,n):o=O.isURLSearchParams(t)?t.toString():new nl(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class fc{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){O.forEach(this.handlers,function(n){n!==null&&t(n)})}}const sl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Nb=typeof URLSearchParams<"u"?URLSearchParams:nl,jb=typeof FormData<"u"?FormData:null,kb=typeof Blob<"u"?Blob:null,Rb={isBrowser:!0,classes:{URLSearchParams:Nb,FormData:jb,Blob:kb},protocols:["http","https","file","blob","url","data"]},il=typeof window<"u"&&typeof document<"u",va=typeof navigator=="object"&&navigator||void 0,Ab=il&&(!va||["ReactNative","NativeScript","NS"].indexOf(va.product)<0),Pb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Mb=il&&window.location.href||"http://localhost",Lb=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:il,hasStandardBrowserEnv:Ab,hasStandardBrowserWebWorkerEnv:Pb,navigator:va,origin:Mb},Symbol.toStringTag,{value:"Module"})),dt={...Lb,...Rb};function Fb(e,t){return eo(e,new dt.classes.URLSearchParams,{visitor:function(r,n,s,i){return dt.isNode&&O.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const hc=wf;function Ef(e){if(e>hc)throw new Y("FormData field is too deeply nested ("+e+" levels). Max depth: "+hc,Y.ERR_FORM_DATA_DEPTH_EXCEEDED)}function $b(e){const t=[],r=/\w+|\[(\w*)]/g;let n;for(;(n=r.exec(e))!==null;)Ef(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 Of(e){function t(r,n,s,i){Ef(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&O.isArray(s)?s.length:o,c?(O.hasOwnProp(s,o)?s[o]=O.isArray(s[o])?s[o].concat(n):[s[o],n]:s[o]=n,!a):((!O.hasOwnProp(s,o)||!O.isObject(s[o]))&&(s[o]=[]),t(r,n,s[o],i)&&O.isArray(s[o])&&(s[o]=Bb(s[o])),!a)}if(O.isFormData(e)&&O.isFunction(e.entries)){const r={};return O.forEachEntry(e,(n,s)=>{t($b(n),s,r,0)}),r}return null}const pn=(e,t)=>e!=null&&O.hasOwnProp(e,t)?e[t]:void 0;function Ub(e,t,r){if(O.isString(e))try{return(t||JSON.parse)(e),O.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const zs={transitional:sl,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=O.isObject(t);if(i&&O.isHTMLForm(t)&&(t=new FormData(t)),O.isFormData(t))return s?JSON.stringify(Of(t)):t;if(O.isArrayBuffer(t)||O.isBuffer(t)||O.isStream(t)||O.isFile(t)||O.isBlob(t)||O.isReadableStream(t))return t;if(O.isArrayBufferView(t))return t.buffer;if(O.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const c=pn(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Fb(t,c).toString();if((a=O.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=pn(this,"env"),u=d&&d.FormData;return eo(a?{"files[]":t}:t,u&&new u,c)}}return i||s?(r.setContentType("application/json",!1),Ub(t)):t}],transformResponse:[function(t){const r=pn(this,"transitional")||zs.transitional,n=r&&r.forcedJSONParsing,s=pn(this,"responseType"),i=s==="json";if(O.isResponse(t)||O.isReadableStream(t))return t;if(t&&O.isString(t)&&(n&&!s||i)){const a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,pn(this,"parseReviver"))}catch(c){if(a)throw c.name==="SyntaxError"?Y.from(c,Y.ERR_BAD_RESPONSE,this,null,pn(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:dt.classes.FormData,Blob:dt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};O.forEach(["delete","get","head","post","put","patch","query"],e=>{zs.headers[e]={}});function Co(e,t){const r=this||zs,n=t||r,s=_t.from(n.headers);let i=n.data;return O.forEach(e,function(a){i=a.call(r,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Df(e){return!!(e&&e.__CANCEL__)}let Hs=class extends Y{constructor(t,r,n){super(t??"canceled",Y.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function If(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 Vb(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function qb(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=n[i];o||(o=d),r[s]=c,n[s]=d;let f=i,g=0;for(;f!==s;)g+=r[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const m=u&&d-u;return m?Math.round(g*1e3/m):void 0}}function zb(e,t){let r=0,n=1e3/t,s,i;const o=(d,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-r;f>=n?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},n-f)))},()=>s&&o(s)]}const Ai=(e,t,r=3)=>{let n=0;const s=qb(50,250);return zb(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=a!=null?Math.min(o,a):o,d=Math.max(0,c-n),u=s(d);n=Math.max(n,c);const f={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},pc=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},gc=e=>(...t)=>O.asap(()=>e(...t)),Hb=dt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,dt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(dt.origin),dt.navigator&&/(msie|trident)/i.test(dt.navigator.userAgent)):()=>!0,Wb=dt.hasStandardBrowserEnv?{write(e,t,r,n,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];O.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),O.isString(n)&&a.push(`path=${n}`),O.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),O.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 Qb(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Kb(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Gb=/^https?:(?!\/\/)/i,Yb=/[\t\n\r]/g;function Xb(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Zb(e){return Xb(e).replace(Yb,"")}function mc(e,t){if(typeof e=="string"&&Gb.test(Zb(e)))throw new Y('Invalid URL: missing "//" after protocol',Y.ERR_INVALID_URL,t)}function Tf(e,t,r,n){mc(t,n);let s=!Qb(t);return e&&(s||r===!1)?(mc(e,n),Kb(e,t)):t}const yc=e=>e instanceof _t?{...e}:e;function cn(e,t){t=t||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(u,f,g,m){return O.isPlainObject(u)&&O.isPlainObject(f)?O.merge.call({caseless:m},u,f):O.isPlainObject(f)?O.merge({},f):O.isArray(f)?f.slice():f}function s(u,f,g,m){if(O.isUndefined(f)){if(!O.isUndefined(u))return n(void 0,u,g,m)}else return n(u,f,g,m)}function i(u,f){if(!O.isUndefined(f))return n(void 0,f)}function o(u,f){if(O.isUndefined(f)){if(!O.isUndefined(u))return n(void 0,u)}else return n(void 0,f)}function a(u){const f=O.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!O.isUndefined(f))if(O.isPlainObject(f)){if(O.hasOwnProp(f,u))return f[u]}else return;const g=O.hasOwnProp(e,"transitional")?e.transitional:void 0;if(O.isPlainObject(g)&&O.hasOwnProp(g,u))return g[u]}function c(u,f,g){if(O.hasOwnProp(t,g))return n(u,f);if(O.hasOwnProp(e,g))return n(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,f,g)=>s(yc(u),yc(f),g,!0)};return O.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const g=O.hasOwnProp(d,f)?d[f]:s,m=O.hasOwnProp(e,f)?e[f]:void 0,_=O.hasOwnProp(t,f)?t[f]:void 0,h=g(m,_,f);O.isUndefined(h)&&g!==c||(r[f]=h)}),O.hasOwnProp(t,"validateStatus")&&O.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(O.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const Jb=["content-type","content-length"];function e_(e,t,r){if(r!=="content-only"){e.set(t);return}Object.entries(t).forEach(([n,s])=>{Jb.includes(n.toLowerCase())&&e.set(n,s)})}const t_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16)));function Nf(e){const t=cn({},e),r=g=>O.hasOwnProp(t,g)?t[g]:void 0,n=r("data");let s=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),f=r("url");if(t.headers=a=_t.from(a),t.url=Cf(Tf(d,f,u,t),r("params"),r("paramsSerializer")),c){const g=O.getSafeProp(c,"username")||"",m=O.getSafeProp(c,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(m?t_(m):"")))}if(O.isFormData(n)&&(dt.hasStandardBrowserEnv||dt.hasStandardBrowserWebWorkerEnv||O.isReactNative(n)?a.setContentType(void 0):O.isFunction(n.getHeaders)&&e_(a,n.getHeaders(),r("formDataHeaderPolicy"))),dt.hasStandardBrowserEnv&&(O.isFunction(s)&&(s=s(t)),s===!0||s==null&&Hb(t.url))){const m=i&&o&&Wb.read(o);m&&a.set(i,m)}return t}const r_=typeof XMLHttpRequest<"u",n_=r_&&function(e){return new Promise(function(r,n){const s=Nf(e);let i=s.data;const o=_t.from(s.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:d}=s,u,f,g,m,_;function h(){m&&m(),_&&_(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function v(){if(!y)return;const S=_t.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:S,config:e,request:y};If(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||sl;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&&O.forEach(bf(o),function(w,C){y.setRequestHeader(C,w)}),O.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([g,_]=Ai(d,!0),y.addEventListener("progress",g)),c&&y.upload&&([f,m]=Ai(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(u=S=>{y&&(n(!S||S.type?new Hs(null,e,y):S),y.abort(),h(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const b=Vb(s.url);if(b&&!dt.protocols.includes(b)){n(new Y("Unsupported protocol "+b+":",Y.ERR_BAD_REQUEST,e));return}y.send(i||null)})},s_=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const s=function(c){if(!n){n=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof Y?d:new Hs(d instanceof Error?d.message:d))}};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=()=>O.asap(o),a},i_=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},o_=async function*(e,t){for await(const r of a_(e))yield*i_(r,t)},a_=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()}},vc=(e,t,r,n)=>{const s=o_(e,t);let i=0,o,a=c=>{o||(o=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await s.next();if(d){a(),c.close();return}let f=u.byteLength;if(r){let g=i+=f;r(g)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),s.return()}},{highWaterMark:2})},Pi=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,l_=(e,t,r)=>t+2<r&&Pi(e.charCodeAt(t+1))&&Pi(e.charCodeAt(t+2));function c_(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length;const a=n.length;for(let m=0;m<a;m++)if(n.charCodeAt(m)===37&&m+2<a){const _=n.charCodeAt(m+1),h=n.charCodeAt(m+2);Pi(_)&&Pi(h)&&(o-=2,m+=2)}let c=0,d=a-1;const u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||u(d))&&c++;const g=Math.floor(o/4)*3-(c||0);return g>0?g:0}let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&l_(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const ol="1.18.0",bc=64*1024,{isFunction:Zs}=O,u_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,r)=>String.fromCharCode(parseInt(r,16))),_c=e=>{if(!O.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},wc=(e,...t)=>{try{return!!e(...t)}catch{return!1}},d_=e=>{const t=e.indexOf("://");let r=e;return t!==-1&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")},f_=e=>{const t=O.global!==void 0&&O.global!==null?O.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=O.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Zs(s):typeof fetch=="function",c=Zs(i),d=Zs(o);if(!a)return!1;const u=a&&Zs(r),f=a&&(typeof n=="function"?(v=>b=>v.encode(b))(new n):async v=>new Uint8Array(await new i(v).arrayBuffer())),g=c&&u&&wc(()=>{let v=!1;const b=new i(dt.origin,{body:new r,method:"POST",get duplex(){return v=!0,"half"}}),S=b.headers.has("Content-Type");return b.body!=null&&b.body.cancel(),v&&!S}),m=d&&u&&wc(()=>O.isReadableStream(new o("").body)),_={stream:m&&(v=>v.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!_[v]&&(_[v]=(b,S)=>{let w=b&&b[v];if(w)return w.call(b);throw new Y(`Response type '${v}' is not supported`,Y.ERR_NOT_SUPPORT,S)})});const h=async v=>{if(v==null)return 0;if(O.isBlob(v))return v.size;if(O.isSpecCompliantForm(v))return(await new i(dt.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(O.isArrayBufferView(v)||O.isArrayBuffer(v))return v.byteLength;if(O.isURLSearchParams(v)&&(v=v+""),O.isString(v))return(await f(v)).byteLength},y=async(v,b)=>{const S=O.toFiniteNumber(v.getContentLength());return S??h(b)};return async v=>{let{url:b,method:S,data:w,signal:C,cancelToken:D,timeout:j,onDownloadProgress:k,onUploadProgress:L,responseType:T,headers:A,withCredentials:B="same-origin",fetchOptions:R,maxContentLength:P,maxBodyLength:F}=Nf(v);const X=O.isNumber(P)&&P>-1,se=O.isNumber(F)&&F>-1,De=K=>O.hasOwnProp(v,K)?v[K]:void 0;let Se=s||fetch;T=T?(T+"").toLowerCase():"text";let ve=s_([C,D&&D.toAbortSignal()],j),q=null;const J=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let te,U=null;const Z=()=>new Y("Request body larger than maxBodyLength limit",Y.ERR_BAD_REQUEST,v,q);try{let K;const le=De("auth");if(le){const re=O.getSafeProp(le,"username")||"",ke=O.getSafeProp(le,"password")||"";K={username:re,password:ke}}if(d_(b)){const re=new URL(b,dt.origin);if(!K&&(re.username||re.password)){const ke=_c(re.username),Le=_c(re.password);K={username:ke,password:Le}}(re.username||re.password)&&(re.username="",re.password="",b=re.href)}if(K&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(u_((K.username||"")+":"+(K.password||""))))),X&&typeof b=="string"&&b.startsWith("data:")&&c_(b)>P)throw new Y("maxContentLength size of "+P+" exceeded",Y.ERR_BAD_RESPONSE,v,q);if(se&&S!=="get"&&S!=="head"){const re=await h(w);if(typeof re=="number"&&isFinite(re)&&(te=re,re>F))throw Z()}const ee=se&&(O.isReadableStream(w)||O.isStream(w)),pe=(re,ke,Le)=>vc(re,bc,Ye=>{if(se&&Ye>F)throw U=Z();ke&&ke(Ye)},Le);if(g&&S!=="get"&&S!=="head"&&(L||ee)){if(te=te??await y(A,w),te!==0||ee){let re=new i(b,{method:"POST",body:w,duplex:"half"}),ke;if(O.isFormData(w)&&(ke=re.headers.get("content-type"))&&A.setContentType(ke),re.body){const[Le,Ye]=L&&pc(te,Ai(gc(L)))||[];w=pe(re.body,Le,Ye)}}}else if(ee&&!c&&u&&S!=="get"&&S!=="head")w=pe(w);else if(ee&&c&&!g&&S!=="get"&&S!=="head")throw new Y("Stream request bodies are not supported by the current fetch implementation",Y.ERR_NOT_SUPPORT,v,q);O.isString(B)||(B=B?"include":"omit");const oe=c&&"credentials"in i.prototype;if(O.isFormData(w)){const re=A.getContentType();re&&/^multipart\/form-data/i.test(re)&&!/boundary=/i.test(re)&&A.delete("content-type")}A.set("User-Agent","axios/"+ol,!1);const We={...R,signal:ve,method:S.toUpperCase(),headers:bf(A.normalize()),body:w,duplex:"half",credentials:oe?B:void 0};q=c&&new i(b,We);let xe=await(c?Se(q,R):Se(b,We));const Ge=_t.from(xe.headers);if(X){const re=O.toFiniteNumber(Ge.getContentLength());if(re!=null&&re>P)throw new Y("maxContentLength size of "+P+" exceeded",Y.ERR_BAD_RESPONSE,v,q)}const Qe=m&&(T==="stream"||T==="response");if(m&&xe.body&&(k||X||Qe&&J)){const re={};["status","statusText","headers"].forEach(H=>{re[H]=xe[H]});const ke=O.toFiniteNumber(Ge.getContentLength()),[Le,Ye]=k&&pc(ke,Ai(gc(k),!0))||[];let ot=0;const Lt=H=>{if(X&&(ot=H,ot>P))throw new Y("maxContentLength size of "+P+" exceeded",Y.ERR_BAD_RESPONSE,v,q);Le&&Le(H)};xe=new o(vc(xe.body,bc,Lt,()=>{Ye&&Ye(),J&&J()}),re)}T=T||"text";let Be=await _[O.findKey(_,T)||"text"](xe,v);if(X&&!m&&!Qe){let re;if(Be!=null&&(typeof Be.byteLength=="number"?re=Be.byteLength:typeof Be.size=="number"?re=Be.size:typeof Be=="string"&&(re=typeof n=="function"?new n().encode(Be).byteLength:Be.length)),typeof re=="number"&&re>P)throw new Y("maxContentLength size of "+P+" exceeded",Y.ERR_BAD_RESPONSE,v,q)}return!Qe&&J&&J(),await new Promise((re,ke)=>{If(re,ke,{data:Be,headers:_t.from(xe.headers),status:xe.status,statusText:xe.statusText,config:v,request:q})})}catch(K){if(J&&J(),ve&&ve.aborted&&ve.reason instanceof Y){const le=ve.reason;throw le.config=v,q&&(le.request=q),K!==le&&(le.cause=K),le}throw U?(q&&!U.request&&(U.request=q),U):K instanceof Y?(q&&!K.request&&(K.request=q),K):K&&K.name==="TypeError"&&/Load failed|fetch/i.test(K.message)?Object.assign(new Y("Network Error",Y.ERR_NETWORK,v,q,K&&K.response),{cause:K.cause||K}):Y.from(K,K&&K.code,v,q,K&&K.response)}}},h_=new Map,jf=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:s}=t,i=[n,s,r];let o=i.length,a=o,c,d,u=h_;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:f_(t)),u=d;return d};jf();const al={http:Ob,xhr:n_,fetch:{get:jf}};O.forEach(al,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Sc=e=>`- ${e}`,p_=e=>O.isFunction(e)||e===null||e===!1;function g_(e,t){e=O.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,!p_(n)&&(s=al[(a=String(n)).toLowerCase()],s===void 0))throw new Y(`Unknown adapter '${a}'`);if(s&&(O.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
|
|
451
451
|
`+o.map(Sc).join(`
|
|
452
|
-
`):" "+Sc(o[0]):"as no adapter specified";throw new
|
|
452
|
+
`):" "+Sc(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 kf={getAdapter:g_,adapters:al};function Eo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Hs(null,e)}function xc(e){return Eo(e),e.headers=_t.from(e.headers),e.data=Co.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),kf.getAdapter(e.adapter||zs.adapter,e)(e).then(function(n){Eo(e),e.response=n;try{n.data=Co.call(e,e.transformResponse,n)}finally{delete e.response}return n.headers=_t.from(n.headers),n},function(n){if(!Df(n)&&(Eo(e),n&&n.response)){e.response=n.response;try{n.response.data=Co.call(e,e.transformResponse,n.response)}finally{delete e.response}n.response.headers=_t.from(n.response.headers)}return Promise.reject(n)})}const to={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{to[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Cc={};to.transitional=function(t,r,n){function s(i,o){return"[Axios v"+ol+"] 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&&!Cc[o]&&(Cc[o]=!0,console.warn(s(o," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(i,o,a):!0}};to.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function m_(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 gi={assertOptions:m_,validators:to},ht=gi.validators;let on=class{constructor(t){this.defaults=t||{},this.interceptors={request:new fc,response:new fc}}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=cn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&gi.assertOptions(n,{silentJSONParsing:ht.transitional(ht.boolean),forcedJSONParsing:ht.transitional(ht.boolean),clarifyTimeoutError:ht.transitional(ht.boolean),legacyInterceptorReqResOrdering:ht.transitional(ht.boolean),advertiseZstdAcceptEncoding:ht.transitional(ht.boolean),validateStatusUndefinedResolves:ht.transitional(ht.boolean)},!1),s!=null&&(O.isFunction(s)?r.paramsSerializer={serialize:s}:gi.assertOptions(s,{encode:ht.function,serialize:ht.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),gi.assertOptions(r,{baseUrl:ht.spelling("baseURL"),withXsrfToken:ht.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&O.merge(i.common,i[r.method]);i&&O.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=_t.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||sl;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,g;if(!c){const _=[xc.bind(this),void 0];for(_.unshift(...a),_.push(...d),g=_.length,u=Promise.resolve(r);f<g;)u=u.then(_[f++],_[f++]);return u}g=a.length;let m=r;for(;f<g;){const _=a[f++],h=a[f++];try{m=_(m)}catch(y){h.call(this,y);break}}try{u=xc.call(this,m)}catch(_){return Promise.reject(_)}for(f=0,g=d.length;f<g;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=cn(this.defaults,t);const r=If(t.baseURL,t.url,t.allowAbsoluteUrls,t);return xf(r,t.params,t.paramsSerializer)}};O.forEach(["delete","get","head","options"],function(t){on.prototype[t]=function(r,n){return this.request(cn(n||{},{method:t,url:r,data:n&&O.hasOwnProp(n,"data")?n.data:void 0}))}});O.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(cn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}on.prototype[t]=r(),t!=="query"&&(on.prototype[t+"Form"]=r(!0))});let m_=class kf{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new Hs(i,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new kf(function(s){t=s}),cancel:t}}};function y_(e){return function(r){return e.apply(null,r)}}function v_(e){return O.isObject(e)&&e.isAxiosError===!0}const ba={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(ba).forEach(([e,t])=>{ba[t]=e});function Rf(e){const t=new on(e),r=cf(on.prototype.request,t);return O.extend(r,on.prototype,t,{allOwnKeys:!0}),O.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Rf(cn(e,s))},r}const Ke=Rf(zs);Ke.Axios=on;Ke.CanceledError=Hs;Ke.CancelToken=m_;Ke.isCancel=Of;Ke.VERSION=ol;Ke.toFormData=eo;Ke.AxiosError=X;Ke.Cancel=Ke.CanceledError;Ke.all=function(t){return Promise.all(t)};Ke.spread=y_;Ke.isAxiosError=v_;Ke.mergeConfig=cn;Ke.AxiosHeaders=_t;Ke.formToJSON=e=>Ef(O.isHTMLForm(e)?new FormData(e):e);Ke.getAdapter=jf.getAdapter;Ke.HttpStatusCode=ba;Ke.default=Ke;const{Axios:zR,AxiosError:HR,CanceledError:WR,isCancel:QR,CancelToken:KR,VERSION:GR,all:YR,Cancel:XR,isAxiosError:ZR,spread:JR,toFormData:eA,AxiosHeaders:tA,HttpStatusCode:rA,formToJSON:nA,getAdapter:sA,mergeConfig:iA,create:oA}=Ke;let _a="";function Af(e){_a=e}const Ne=Ke.create({timeout:3e4});Ne.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Zy),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),_a&&(e.baseURL=_a),e});const Pf=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function b_(e,t={}){var c,d,u,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:Pf,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Ne.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function __(e){var r,n,s;return e.length?((s=(n=(r=(await Ne.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Pf,limit:e.length}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:r.result)==null?void 0:n.response)==null?void 0:s.content)??[]:[]}async function w_(e){var r,n;return((n=(r=(await Ne.get(`/portal/user/v5/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.response)??{}}const Mf="/portal";async function Lf(e){var n,s,i,o,a,c,d;const t=await Ne.get(`${Mf}/questionset/v2/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.questionset;if(!r||!r.identifier){const u=((o=(i=t.data)==null?void 0:i.params)==null?void 0:o.errmsg)||((c=(a=t.data)==null?void 0:a.params)==null?void 0:c.err)||((d=t.data)==null?void 0:d.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${u}`)}return r}async function S_(e){var r,n;return e.length?((n=(r=(await Ne.post(`${Mf}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function ll(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",o=r.children,a=Array.isArray(o)?o.map(d=>ll(d,n)):[],c=i==="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"||i==="application/vnd.sunbird.questionset"&&a.length>0;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:c,children:a,metadata:r,parent:t}}async function Ff(e){var s,i,o,a,c,d,u;const t=await Ne.get(`/action/content/v3/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=ll(r);return{content:r,rootNode:n}}async function x_(e){const t=await Lf(e),r=ll(t);return{content:t,rootNode:r}}async function C_(e,t,r,n){var i;return((i=(await Ne.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function E_(e,t=""){await Ne.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function O_(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function D_(e){await Ne.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function I_(e,t){await Ne.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function T_(e,t){await Ne.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const N_="_container_r27rp_1",j_="_header_r27rp_13",k_="_title_r27rp_22",R_="_closeBtn_r27rp_29",A_="_body_r27rp_45",P_="_label_r27rp_54",M_="_searchSection_r27rp_62",L_="_searchRow_r27rp_68",F_="_searchInput_r27rp_74",$_="_searchSpinner_r27rp_89",B_="_resultsList_r27rp_105",U_="_resultItem_r27rp_118",V_="_userInfo_r27rp_133",q_="_userName_r27rp_141",z_="_userEmail_r27rp_150",H_="_userOrg_r27rp_158",W_="_noResults_r27rp_167",Q_="_collabSection_r27rp_174",K_="_sectionTitle_r27rp_179",G_="_badge_r27rp_189",Y_="_emptyCollab_r27rp_203",X_="_collabList_r27rp_214",Z_="_collabItem_r27rp_223",J_="_userAvatar_r27rp_237",ew="_error_r27rp_251",tw="_success_r27rp_257",rw="_footer_r27rp_263",Oe={container:N_,header:j_,title:k_,closeBtn:R_,body:A_,label:P_,searchSection:M_,searchRow:L_,searchInput:F_,searchSpinner:$_,resultsList:B_,resultItem:U_,userInfo:V_,userName:q_,userEmail:z_,userOrg:H_,noResults:W_,collabSection:Q_,sectionTitle:K_,badge:G_,emptyCollab:Y_,collabList:X_,collabItem:Z_,userAvatar:J_,error:ew,success:tw,footer:rw},nw=({contentId:e,onClose:t})=>{var k,L;const r=ae(T=>T.editorConfig),n=(k=r==null?void 0:r.context)==null?void 0:k.channel,s=(L=r==null?void 0:r.config)==null?void 0:L.objectType,[i,o]=p.useState(""),[a,c]=p.useState([]),[d,u]=p.useState(!1),[f,g]=p.useState([]),[m,_]=p.useState(!1),[h,y]=p.useState(""),[v,b]=p.useState(!1),S=p.useRef(null);p.useEffect(()=>{let T=!1;return(async()=>{try{const R=await O_(e),B=(R==null?void 0:R.collaborators)??[];if(!B.length)return;const A=await __(B);if(T)return;const P=B.map(F=>A.find(Y=>Y.identifier===F)??{identifier:F,firstName:F});g(P)}catch{}})(),()=>{T=!0}},[e]),p.useEffect(()=>{S.current&&clearTimeout(S.current);const T=i.trim();if(T.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const R=await b_(T,{rootOrgId:n,objectType:s}),B=new Set(f.map(A=>A.identifier));c(R.filter(A=>!B.has(A.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=p.useCallback(T=>{g(R=>R.find(B=>B.identifier===T.identifier)?R:[...R,T]),c(R=>R.filter(B=>B.identifier!==T.identifier)),b(!1)},[]),C=p.useCallback(T=>{g(R=>R.filter(B=>B.identifier!==T)),b(!1)},[]),D=p.useCallback(async()=>{_(!0),y(""),b(!1);try{await T_(e,f.map(T=>T.identifier)),b(!0)}catch{y("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),j=T=>`${T.firstName}${T.lastName?` ${T.lastName}`:""}`;return l.jsxs("div",{className:Oe.container,children:[l.jsxs("div",{className:Oe.header,children:[l.jsx("h2",{className:Oe.title,children:"Manage Collaborators"}),l.jsx("button",{className:Oe.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Oe.body,children:[l.jsxs("div",{className:Oe.searchSection,children:[l.jsx("label",{className:Oe.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Oe.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Oe.searchInput,placeholder:"Search by name or email...",value:i,onChange:T=>o(T.target.value)}),d&&l.jsx("span",{className:Oe.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Oe.resultsList,role:"listbox","aria-label":"Search results",children:a.map(T=>{var R,B,A,P;return l.jsxs("li",{className:Oe.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Oe.userInfo,children:[l.jsx("span",{className:Oe.userName,children:j(T)}),T.email&&l.jsx("span",{className:Oe.userEmail,children:T.email}),(((B=(R=T.organisations)==null?void 0:R[0])==null?void 0:B.orgName)??T.rootOrgName)&&l.jsx("span",{className:Oe.userOrg,children:((P=(A=T.organisations)==null?void 0:A[0])==null?void 0:P.orgName)??T.rootOrgName})]}),l.jsx(Me,{variant:"primary",size:"sm",onClick:()=>w(T),children:"Add"})]},T.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Oe.noResults,children:"No users found."})]}),l.jsxs("div",{className:Oe.collabSection,children:[l.jsxs("h3",{className:Oe.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Oe.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Oe.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Oe.collabList,children:f.map(T=>{var R,B,A,P;return l.jsxs("li",{className:Oe.collabItem,children:[l.jsx("div",{className:Oe.userAvatar,"aria-hidden":"true",children:j(T).charAt(0).toUpperCase()}),l.jsxs("div",{className:Oe.userInfo,children:[l.jsx("span",{className:Oe.userName,children:j(T)}),T.email&&l.jsx("span",{className:Oe.userEmail,children:T.email}),(((B=(R=T.organisations)==null?void 0:R[0])==null?void 0:B.orgName)??T.rootOrgName)&&l.jsx("span",{className:Oe.userOrg,children:((P=(A=T.organisations)==null?void 0:A[0])==null?void 0:P.orgName)??T.rootOrgName})]}),l.jsx(Me,{variant:"danger",size:"sm",onClick:()=>C(T.identifier),children:"Remove"})]},T.identifier)})})]}),h&&l.jsx("p",{className:Oe.error,role:"alert",children:h}),v&&l.jsx("p",{className:Oe.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Oe.footer,children:[l.jsx(Me,{variant:"ghost",onClick:t,disabled:m,children:"Cancel"}),l.jsx(Me,{variant:"primary",isLoading:m,onClick:D,children:"Save"})]})]})};async function sw(e){return(await Ne.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function iw(e,t){var s;const n=((s=(await Ne.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 ow(e){var n;const r=((n=(await Ne.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const aw="_topbar_zj8wk_1",lw="_left_zj8wk_15",cw="_right_zj8wk_23",uw="_backBtn_zj8wk_30",dw="_title_zj8wk_49",fw="_statusChip_zj8wk_61",hw="_savedIndicator_zj8wk_73",pw="_unsaved_zj8wk_83",gw="_iconBtn_zj8wk_88",mw="_iconBtnLabel_zj8wk_115",yw="_qrDropdown_zj8wk_119",vw="_qrMenu_zj8wk_123",bw="_reviewBtns_zj8wk_158",_w="_sourcingBtns_zj8wk_167",ww="_modalOverlay_zj8wk_176",Sw="_sbOverlay_zj8wk_186",xw="_sbModal_zj8wk_196",Cw="_sbModalHeader_zj8wk_207",Ew="_sbModalTitle_zj8wk_215",Ow="_sbModalClose_zj8wk_222",Dw="_sbModalBody_zj8wk_235",Iw="_sbLabel_zj8wk_242",Tw="_sbTextarea_zj8wk_249",Nw="_sbError_zj8wk_266",jw="_sbModalFooter_zj8wk_273",ce={topbar:aw,left:lw,right:cw,backBtn:uw,title:dw,statusChip:fw,savedIndicator:hw,unsaved:pw,iconBtn:gw,iconBtnLabel:mw,qrDropdown:yw,qrMenu:vw,reviewBtns:bw,sourcingBtns:_w,modalOverlay:ww,sbOverlay:Sw,sbModal:xw,sbModalHeader:Cw,sbModalTitle:Ew,sbModalClose:Ow,sbModalBody:Dw,sbLabel:Iw,sbTextarea:Tw,sbError:Nw,sbModalFooter:jw};function kw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Rw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const Aw=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ce.sbModalTitle,children:e}),l.jsx("button",{className:ce.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:ce.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ce.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Me,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Pw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(!1);return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ce.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ce.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Me,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Mw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ce.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ce.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ce.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Me,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Lw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var K,le;const a=De(ee=>ee.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=Rw(((K=a==null?void 0:a.metadata)==null?void 0:K.status)??(a==null?void 0:a.status)),u=ae(ee=>{var pe,oe,We,xe;return((oe=(pe=ee.editorConfig)==null?void 0:pe.context)==null?void 0:oe.contentId)??((xe=(We=ee.editorConfig)==null?void 0:We.context)==null?void 0:xe.identifier)??""}),{activeModal:f,modalData:g,closeModal:m,openModal:_}=rv(),h=ae(ee=>ee.buttonLoaders),y=ae(ee=>ee.categoryMeta),v=!y||y.schemaDefaults.generateDIALCodes!=="No",[b,S]=p.useState(!1),[w,C]=p.useState(!1),[D,j]=p.useState(!1),k=p.useRef(null),[L,T]=p.useState(!1);p.useEffect(()=>{if(!D)return;const ee=pe=>{var oe;(oe=k.current)!=null&&oe.contains(pe.target)||j(!1)};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[D]);const[R,B]=p.useState(!1),[A,P]=p.useState(!1),{updateNode:F}=De(),Y=(le=a==null?void 0:a.metadata)==null?void 0:le.qrCodeProcessId,se=p.useCallback(async ee=>{if(u){T(!1),B(!0);try{const{processId:pe,reservedDialcodes:oe}=await iw(u,ee);pe&&a&&F(a.id,{qrCodeProcessId:pe,reservedDialcodes:oe}),Ee.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ee.error("Failed to generate QR Codes. Please try again.")}finally{B(!1)}}},[u,a,F]),Ce=p.useCallback(async()=>{if(!Y){Ee.error("No QR codes generated yet. Generate QR Codes first.");return}P(!0);try{const ee=await ow(Y);if(ee.status==="in-process"){Ee("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const pe=ee.url;if(!pe){Ee.error("QR Codes not ready yet. Please wait and try again.");return}const oe=await fetch(pe).then(Le=>Le.blob()),We=await new Promise(Le=>{const Ye=new FileReader;Ye.onloadend=()=>Le(Ye.result),Ye.readAsDataURL(oe)}),xe=(a==null?void 0:a.metadata)??{},Ge=Le=>Array.isArray(Le)?Le.join("_"):typeof Le=="string"?Le:"",Qe=[u,Ge(xe.medium),Ge(xe.gradeLevel),Ge(xe.subject)].filter(Boolean),Be=new Date().toISOString().replace(/[:.]/g,"-"),re=`${Qe.join("_")}_${Be}.zip`,ke=document.createElement("a");ke.href=We,ke.download=re,ke.style.display="none",document.body.appendChild(ke),ke.click(),document.body.removeChild(ke),Ee.success("QR codes downloaded.")}catch{Ee.error("Failed to download QR Codes.")}finally{P(!1)}},[Y,a,u]),ve=e==="edit",me=e==="review",q=e==="sourcingreview",J=e==="read",te=p.useCallback((ee,pe)=>{i({action:ee,data:pe})},[i]),U=p.useCallback(()=>{m(),te("publish")},[m,te]),Z=p.useCallback((ee,pe)=>{const oe=g==null?void 0:g.action;m(),oe==="approve"?te("sourcingApprove",{comment:ee,score:pe}):te("reject",{comment:ee})},[m,te,g]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ce.topbar,role:"banner",children:[l.jsxs("div",{className:ce.left,children:[l.jsx("button",{className:ce.backBtn,onClick:()=>te("back"),"aria-label":"Go back",type:"button",children:l.jsx(_y,{size:18})}),l.jsx("h1",{className:ce.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ce.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ce.right,children:[t?l.jsx("span",{className:ce.savedIndicator,"aria-live":"polite",children:"Saving…"}):r&&ve?l.jsx("span",{className:`${ce.savedIndicator} ${ce.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ce.savedIndicator,"aria-live":"polite",children:[l.jsx(Qn,{size:14,"aria-hidden":"true"}),"Saved ",kw(n)]}):null,!J&&!me&&!q&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>te("saveCollection"),disabled:!s,children:"Save as Draft"})}),ve&&l.jsxs(l.Fragment,{children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>C(!0),disabled:h.saveCollection,isLoading:h.saveCollection,children:[l.jsx(My,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ce.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx($y,{size:16,"aria-hidden":"true"})}),v&&l.jsxs("div",{className:ce.qrDropdown,ref:k,children:[l.jsxs("button",{className:ce.iconBtn,onClick:()=>j(ee=>!ee),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":D,children:[l.jsx(Xl,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ce.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),D&&l.jsxs("div",{className:ce.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{j(!1),T(!0)},disabled:R,children:[l.jsx(Xl,{size:14}),R?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{j(!1),Ce()},disabled:A||!Y,children:[l.jsx(Oy,{size:14}),A?"Downloading…":"Download QR Codes"]})]})]})]}),me&&l.jsxs("div",{className:ce.reviewBtns,children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:h.publishCollection,isLoading:h.publishCollection,children:[l.jsx(Xd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>S(!0),disabled:h.rejectCollection,isLoading:h.rejectCollection,children:[l.jsx(Zl,{size:14,"aria-hidden":"true"})," Request for Changes"]})]}),q&&l.jsxs("div",{className:ce.sourcingBtns,children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(Ly,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx(Zl,{size:14,"aria-hidden":"true"})," Request for Changes"]})]})]})]}),f==="publishChecklist"&&l.jsx(bv,{contentId:u,onConfirm:U,onCancel:m}),f==="qualityParams"&&l.jsx(_v,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:Z,onCancel:m}),f==="manageCollaborators"&&l.jsx("div",{className:ce.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(nw,{contentId:u,onClose:m})}),w&&l.jsx(Pw,{onConfirm:()=>{C(!1),te("sendForReview")},onCancel:()=>C(!1)}),b&&l.jsx(Aw,{titleText:"Request Changes",labelText:"Changes requested",placeholderText:"Describe the changes the author needs to make",submitLabel:"Request for Changes",submitVariant:"primary",onConfirm:ee=>{S(!1),te("reject",{comment:ee})},onCancel:()=>S(!1)}),L&&l.jsx(Mw,{onConfirm:se,onCancel:()=>T(!1)})]})},Fw=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Lr.createPortal(l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Re.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Me,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Me,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var $w=el();const $f=p.createContext(null);function Nt(){const e=p.useContext($f);if(e===null)throw new Error("No Tree Api Provided");return e}const Bf=p.createContext(null);function Bw(){const e=p.useContext(Bf);if(e===null)throw new Error("Provide a NodesContext");return e}const Uf=p.createContext(null);function Uw(){const e=p.useContext(Uf);if(e===null)throw new Error("Provide a DnDContext");return e}const Vf=p.createContext(0);function qf(){p.useContext(Vf)}function mi(e,t,r){return Math.max(Math.min(e,r),t)}function zf(e){return e&&e.isLeaf}function Hf(e){return e&&e.isInternal&&!e.isOpen}function Wf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Qf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Kf=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function cl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=cl(r,t);if(n)return n}return null}function Mi(e,t){if(t(e),e.children)for(let r of e.children)Mi(r,t)}function Gf(e){const t=Xf(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 Yf(e){const t=Xf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=qw(t,n);break}r==null||r.focus()}function Vw(e,t){return t+1<e.length?e[t+1]:e[0]}function qw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Xf(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 fs(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function xn(e){return typeof e=="string"?e:e.id}function zw(e,...t){if(e)return e(...t)}function Zf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function Jf(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 eh(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const Hw=Object.freeze(Object.defineProperty({__proto__:null,access:fs,bound:mi,dfs:cl,focusNextElement:Gf,focusPrevElement:Yf,getInsertIndex:Jf,getInsertParentId:eh,identify:xn,indexOf:Kf,isClosed:Hf,isDescendant:Qf,isItem:zf,isOpenWithEmptyChildren:Wf,safeRun:zw,waitFor:Zf,walk:Mi},Symbol.toStringTag,{value:"Module"})),Ww={display:"flex",alignItems:"center",zIndex:1},Qw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Kw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Gw=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({},Kw)}),l.jsx("div",{style:Object.assign({},Qw)})]})});function Yw({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 Xw(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(Jw,Object.assign({},e)):l.jsx(Zw,Object.assign({},e))]})}function Zw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function Jw({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const Ds="__REACT_ARBORIST_INTERNAL_ROOT__";function Ec(e){var t;function r(i,o,a){const c=e.accessId(i),d=new Is({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new Is({tree:e,id:Ds,data:{id:Ds},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class Is{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===Ds}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Is(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Oo(e){return{type:"EDIT",id:e}}function eS(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function gn(e){return{type:"FOCUS",id:e}}function tS(){return{type:"TREE_BLUR"}}function rS(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 wa={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function Oc(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function nS(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:Oc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:Oc(e.unfiltered,t)}):e}const Vn=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}}},xr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:xn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(xn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(xn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:xn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:xn(e)})};function sS(e=Vn().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 qn={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 iS(e=Vn().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 Vn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const oS={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},aS=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},lS=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function th({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(cS,{isDragging:s,children:[l.jsx(uS,{offset:e,children:l.jsx(fS,{id:r,dragIds:n})}),l.jsx(dS,{mouse:t,count:n.length})]})}const cS=p.memo(function(t){return t.isDragging?l.jsx("div",{style:oS,children:t.children}):null});function uS(e){return l.jsx("div",{className:"row preview",style:aS(e.offset),children:e.children})}function dS(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:lS(r),children:t}):null}const fS=p.memo(function(t){const r=Nt(),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 Sa(){return Sa=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},Sa.apply(null,arguments)}function Dc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xa(e,t){return xa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},xa(e,t)}function hS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xa(e,t)}var Ic=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function pS(e,t){return!!(e===t||Ic(e)&&Ic(t))}function gS(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!pS(e[r],t[r]))return!1;return!0}function Do(e,t){t===void 0&&(t=gS);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 mS=typeof performance=="object"&&typeof performance.now=="function",Tc=mS?function(){return performance.now()}:function(){return Date.now()};function Nc(e){cancelAnimationFrame(e.id)}function yS(e,t){var r=Tc();function n(){Tc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Io=-1;function jc(e){if(e===void 0&&(e=!1),Io===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Io=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Io}var mn=null;function kc(e){if(e===void 0&&(e=!1),mn===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?mn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?mn="negative":mn="positive-ascending"),document.body.removeChild(t),mn}return mn}process.env.NODE_ENV;var vS=150,bS=function(t,r){return t},yi=null,vi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(yi=new WeakSet,vi=new WeakSet);function rh(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){hS(g,f);function g(_){var h;return h=f.call(this,_)||this,h._instanceProps=c(h.props,Dc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:Dc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=Do(function(y,v,b,S){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:S})}),h._callOnScroll=void 0,h._callOnScroll=Do(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,S=v.itemSize,w=v.layout,C=h._getItemStyleCache(d&&S,d&&w,d&&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",T=b==="rtl",R=L?j:0;C[y]=D={position:"absolute",left:T?void 0:R,right:T?R:void 0,top:L?0:j,height:L?"100%":k,width:L?k:"100%"}}return D},h._getItemStyleCache=void 0,h._getItemStyleCache=Do(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,S=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===S)return null;var D=h.props.direction,j=S;if(D==="rtl")switch(kc()){case"negative":j=-S;break;case"positive-descending":j=w-b-S;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,S=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var D=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:C.scrollOffset<D?"forward":"backward",scrollOffset:D,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&Nc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=yS(h._resetIsScrolling,vS)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}g.getDerivedStateFromProps=function(h,y){return _S(h,y),u(h),null};var m=g.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,S=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;S==="vertical"?C=D.scrollWidth>D.clientWidth?jc():0:C=D.scrollHeight>D.clientHeight?jc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},m.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var S=this._outerRef;y==="horizontal"||b==="horizontal"?S.scrollLeft=v:S.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,S=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(kc()){case"negative":C.scrollLeft=-S;break;case"positive-ascending":C.scrollLeft=S;break;default:var D=C.clientWidth,j=C.scrollWidth;C.scrollLeft=j-D-S;break}else C.scrollLeft=S;else C.scrollTop=S}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Nc(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,S=h.height,w=h.innerRef,C=h.innerElementType,D=h.innerTagName,j=h.itemCount,k=h.itemData,L=h.itemKey,T=L===void 0?bS:L,R=h.layout,B=h.outerElementType,A=h.outerTagName,P=h.style,F=h.useIsScrolling,Y=h.width,se=this.state.isScrolling,Ce=b==="horizontal"||R==="horizontal",ve=Ce?this._onScrollHorizontal:this._onScrollVertical,me=this._getRangeToRender(),q=me[0],J=me[1],te=[];if(j>0)for(var U=q;U<=J;U++)te.push(p.createElement(y,{data:k,key:T(U,k),index:U,isScrolling:F?se:void 0,style:this._getItemStyle(U)}));var Z=n(this.props,this._instanceProps);return p.createElement(B||A||"div",{className:v,onScroll:ve,ref:this._outerRefSetter,style:Sa({position:"relative",height:S,width:Y,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},P)},p.createElement(C||D||"div",{children:te,ref:w,style:{height:Ce?"100%":Z,pointerEvents:se?"none":void 0,width:Ce?Z:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],b=y[1],S=y[2],w=y[3];this._callOnItemsRendered(v,b,S,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)}},m._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,S=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=!S||w==="backward"?Math.max(1,v):1,L=!S||w==="forward"?Math.max(1,v):1;return[Math.max(0,D-k),Math.max(0,Math.min(y-1,j+L)),D,j]},g}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var _S=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&vi&&!vi.has(u)&&(vi.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":yi&&!yi.has(u)&&(yi.add(u),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},wS=50,Cn=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},SS=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?nh(t,r,i,0,n):xS(t,r,Math.max(0,i),n)},nh=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Cn(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},xS=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Cn(t,n,r).offset<s;)n+=o,o*=2;return nh(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Rc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var d=n-o-1,u=d*i;return a+u},CS=rh({getItemOffset:function(t,r,n){return Cn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Rc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",g=f?u:c,m=Cn(t,r,i),_=Rc(t,i),h=Math.max(0,Math.min(_-g,m.offset)),y=Math.max(0,m.offset-g+m.size+o);switch(n==="smart"&&(s>=y-g&&s<=h+g?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return SS(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,g=Cn(t,r,s),m=n+f,_=g.offset+g.size,h=r;h<a-1&&_<m;)h++,_+=Cn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||wS,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.'))}}),ES=rh({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.itemCount,u=t.itemSize,f=t.layout,g=t.width,m=a==="horizontal"||f==="horizontal",_=m?g:c,h=Math.max(0,d*u-_),y=Math.min(h,r*u),v=Math.max(0,r*u-_+u+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,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,g=u?d:i,m=Math.ceil((g+n-f)/a);return Math.max(0,Math.min(o-1,r+m-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function OS(){var e,t;const r=Nt(),s=Uw().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 DS=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 IS=p.forwardRef(function(t,r){const{children:n}=t,s=DS(t,["children"]),i=Nt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(TS,{}),n]}))}),TS=()=>{const e=Nt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(OS,{})})};var NS=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 jS=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=NS(t,["style"]);const d=Nt(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var sh=p.createContext({dragDropManager:void 0}),zt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(zt||(zt={}));function de(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var ul="dnd-core/INIT_COORDS",ro="dnd-core/BEGIN_DRAG",dl="dnd-core/PUBLISH_DRAG_SOURCE",no="dnd-core/HOVER",so="dnd-core/DROP",io="dnd-core/END_DRAG";function Ac(e,t){return{type:ul,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function bi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bi=function(r){return typeof r}:bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bi(e)}function kS(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function RS(e,t){return e.filter(function(r){return r!==t})}function ih(e){return bi(e)==="object"}function AS(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 PS(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var MS={type:ul,payload:{clientOffset:null,sourceClientOffset:null}};function LS(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(Ac(o)),FS(r,c,d);var u=US(r,c);if(u===null){e.dispatch(MS);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");$S(a),f=a(u)}e.dispatch(Ac(o,f));var g=d.getSource(u),m=g.beginDrag(c,u);if(m!=null){BS(m),d.pinSource(u);var _=d.getSourceType(u);return{type:ro,payload:{itemType:_,item:m,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function FS(e,t,r){de(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){de(r.getSource(n),"Expected sourceIds to be registered.")})}function $S(e){de(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function BS(e){de(ih(e),"Item must be an object.")}function US(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 VS(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:dl}}}function Ca(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function qS(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;zS(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();HS(i,o,a);var c=o.getItemType();return WS(i,a,c),QS(i,o,a),{type:no,payload:{targetIds:i,clientOffset:s||null}}}}function zS(e){de(Array.isArray(e),"Expected targetIds to be an array.")}function HS(e,t,r){de(t.isDragging(),"Cannot call hover while not dragging."),de(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];de(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);de(i,"Expected targetIds to be registered.")}}function WS(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Ca(i,r)||e.splice(n,1)}}function QS(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Pc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Mc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pc(Object(r),!0).forEach(function(n){KS(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 KS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function GS(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();YS(n);var i=JS(n);i.forEach(function(o,a){var c=XS(o,a,s,n),d={type:so,payload:{dropResult:Mc(Mc({},r),c)}};e.dispatch(d)})}}function YS(e){de(e.isDragging(),"Cannot call drop while not dragging."),de(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function XS(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return ZS(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function ZS(e){de(typeof e>"u"||ih(e),"Drop result must either be an object or undefined.")}function JS(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function ex(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:io}}}function tx(e){de(e.isDragging(),"Cannot call endDrag while not dragging.")}function rx(e){return{beginDrag:LS(e),publishDragSource:VS(e),hover:qS(e),drop:GS(e),endDrag:ex(e)}}function nx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sx(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 ix(e,t,r){return t&&sx(e.prototype,t),e}function ns(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ox=function(){function e(t,r){var n=this;nx(this,e),ns(this,"store",void 0),ns(this,"monitor",void 0),ns(this,"backend",void 0),ns(this,"isSetUp",!1),ns(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 ix(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=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 $t(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Lc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Fc=function(){return Math.random().toString(36).substring(7).split("").join(".")},$c={INIT:"@@redux/INIT"+Fc(),REPLACE:"@@redux/REPLACE"+Fc()};function ax(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(dx(e))return"date";if(ux(e))return"error";var r=cx(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 cx(e){return typeof e.constructor=="function"?e.constructor.name:null}function ux(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function dx(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function yn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=lx(e)),t}function oh(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?$t(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?$t(1):"Expected the enhancer to be a function. Instead, received: '"+yn(r)+"'");return r(oh)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?$t(2):"Expected the root reducer to be a function. Instead, received: '"+yn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?$t(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?$t(4):"Expected the listener to be a function. Instead, received: '"+yn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?$t(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return d(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?$t(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,d();var b=a.indexOf(h);a.splice(b,1),o=null}}}function g(h){if(!ax(h))throw new Error(process.env.NODE_ENV==="production"?$t(7):"Actions must be plain objects. Instead, the actual type was: '"+yn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?$t(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?$t(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var b=y[v];b()}return h}function m(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?$t(10):"Expected the nextReducer to be a function. Instead, received: '"+yn(h));s=h,g({type:$c.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"?$t(11):"Expected the observer to be an object. Instead, received: '"+yn(b)+"'");function S(){b.next&&b.next(u())}S();var w=y(S);return{unsubscribe:w}}},h[Lc]=function(){return this},h}return g({type:$c.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:m},n[Lc]=_,n}var fx=function(t,r){return t===r};function hx(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function px(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fx;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Bc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Uc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bc(Object(r),!0).forEach(function(n){gx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Vc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function mx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ul:case ro:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case no:return hx(e.clientOffset,r.clientOffset)?e:Uc(Uc({},e),{},{clientOffset:r.clientOffset});case io:case so:return Vc;default:return e}}var fl="dnd-core/ADD_SOURCE",hl="dnd-core/ADD_TARGET",pl="dnd-core/REMOVE_SOURCE",oo="dnd-core/REMOVE_TARGET";function yx(e){return{type:fl,payload:{sourceId:e}}}function vx(e){return{type:hl,payload:{targetId:e}}}function bx(e){return{type:pl,payload:{sourceId:e}}}function _x(e){return{type:oo,payload:{targetId:e}}}function qc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Bt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qc(Object(r),!0).forEach(function(n){wx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Sx={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function xx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Sx,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ro:return Bt(Bt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case dl:return Bt(Bt({},e),{},{isSourcePublic:!0});case no:return Bt(Bt({},e),{},{targetIds:r.targetIds});case oo:return e.targetIds.indexOf(r.targetId)===-1?e:Bt(Bt({},e),{},{targetIds:RS(e.targetIds,r.targetId)});case so:return Bt(Bt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case io:return Bt(Bt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Cx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case fl:case hl:return e+1;case pl:case oo:return e-1;default:return e}}var Li=[],gl=[];Li.__IS_NONE__=!0;gl.__IS_ALL__=!0;function Ex(e,t){if(e===Li)return!1;if(e===gl||typeof t>"u")return!0;var r=PS(t,e);return r.length>0}function Ox(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case no:break;case fl:case hl:case oo:case pl:return Li;case ro:case dl:case io:case so:default:return gl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=AS(n,i),a=o.length>0||!px(n,i);if(!a)return Li;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function Dx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function zc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Hc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zc(Object(r),!0).forEach(function(n){Ix(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ix(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Ox(e.dirtyHandlerIds,{type:t.type,payload:Hc(Hc({},t.payload),{},{prevTargetIds:kS(e,"dragOperation.targetIds",[])})}),dragOffset:mx(e.dragOffset,t),refCount:Cx(e.refCount,t),dragOperation:xx(e.dragOperation,t),stateId:Dx(e.stateId)}}function Nx(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ah(e,t){return{x:e.x-t.x,y:e.y-t.y}}function jx(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:ah(Nx(t,n),r)}function kx(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:ah(t,r)}function Rx(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 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 Mx=function(){function e(t,r){Rx(this,e),Wc(this,"store",void 0),Wc(this,"registry",void 0),this.store=t,this.registry=r}return Px(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;de(typeof r=="function","listener must be a function."),de(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!Ex(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;de(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return de(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(de(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Ca(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(de(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!Ca(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 jx(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return kx(this.store.getState().dragOffset)}}]),e}(),Lx=0;function Fx(){return Lx++}function _i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_i=function(r){return typeof r}:_i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_i(e)}function $x(e){de(typeof e.canDrag=="function","Expected canDrag to be a function."),de(typeof e.beginDrag=="function","Expected beginDrag to be a function."),de(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Bx(e){de(typeof e.canDrop=="function","Expected canDrop to be a function."),de(typeof e.hover=="function","Expected hover to be a function."),de(typeof e.drop=="function","Expected beginDrag to be a function.")}function Ea(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Ea(r,!1)});return}de(typeof e=="string"||_i(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Qc=typeof global<"u"?global:self,lh=Qc.MutationObserver||Qc.WebKitMutationObserver;function ch(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function Ux(e){let t=1;const r=new lh(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const Vx=typeof lh=="function"?Ux:ch;class qx{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=Vx(this.flush),this.requestErrorThrow=ch(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class zx{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 Hx{create(t){const r=this.freeTasks,n=r.length?r.pop():new zx(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const uh=new qx,Wx=new Hx(uh.registerPendingError);function Qx(e){uh.enqueueTask(Wx.create(e))}function Kx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gx(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 Yx(e,t,r){return t&&Gx(e.prototype,t),e}function vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xx(e,t){return tC(e)||eC(e,t)||Jx(e,t)||Zx()}function Zx(){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
|
|
458
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cC(e,t){if(e){if(typeof e=="string")return Xc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xc(e,t)}}function Xc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function 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 dC(e){if(Array.isArray(e))return e}function fC(e,t){if(e==null)return{};var r=hC(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 hC(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Zc=0,wi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),pC=p.memo(function(t){var r=t.children,n=fC(t,oC),s=gC(n),i=aC(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=dh();return++Zc,function(){--Zc===0&&(c[wi]=null)}}},[]),l.jsx(sh.Provider,Object.assign({value:o},{children:r}),void 0)});function gC(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=mC(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function mC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:dh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[wi]||(s[wi]={dragDropManager:sC(e,t,r,n)}),s[wi]}function dh(){return typeof global<"u"?global:window}function yC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vC(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 bC(e,t,r){return t&&vC(e.prototype,t),e}function Jc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var To=!1,No=!1,_C=function(){function e(t){yC(this,e),Jc(this,"internalMonitor",void 0),Jc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return bC(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){de(!To,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return To=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{To=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;de(!No,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return No=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{No=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function wC(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 xC(e,t,r){return t&&SC(e.prototype,t),e}function eu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jo=!1,CC=function(){function e(t){wC(this,e),eu(this,"internalMonitor",void 0),eu(this,"targetId",null),this.internalMonitor=t.getMonitor()}return xC(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;de(!jo,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return jo=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{jo=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function 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 OC(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!p.isValidElement(t)){var n=t;return e(n,r),n}var s=t;EC(s);var i=r?function(o){return e(o,r)}:e;return DC(s,i)}}function fh(e){var t={};return Object.keys(e).forEach(function(r){var n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{var s=OC(n);t[r]=function(){return s}}}),t}function tu(e,t){typeof e=="function"?e(t):e.current=t}function DC(e,t){var r=e.ref;return de(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?p.cloneElement(e,{ref:function(s){tu(r,s),tu(t,s)}}):p.cloneElement(e,{ref:t})}function Si(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Si=function(r){return typeof r}:Si=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Si(e)}function Oa(e){return e!==null&&Si(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Da(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function IC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function NC(e,t,r){return t&&TC(e.prototype,t),e}function pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jC=function(){function e(t){var r=this;IC(this,e),pt(this,"hooks",fh({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Oa(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Oa(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),pt(this,"handlerId",null),pt(this,"dragSourceRef",null),pt(this,"dragSourceNode",void 0),pt(this,"dragSourceOptionsInternal",null),pt(this,"dragSourceUnsubscribe",void 0),pt(this,"dragPreviewRef",null),pt(this,"dragPreviewNode",void 0),pt(this,"dragPreviewOptionsInternal",null),pt(this,"dragPreviewUnsubscribe",void 0),pt(this,"lastConnectedHandlerId",null),pt(this,"lastConnectedDragSource",null),pt(this,"lastConnectedDragSourceOptions",null),pt(this,"lastConnectedDragPreview",null),pt(this,"lastConnectedDragPreviewOptions",null),pt(this,"backend",void 0),this.backend=t}return NC(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!Da(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Da(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 kC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function AC(e,t,r){return t&&RC(e.prototype,t),e}function nr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var PC=function(){function e(t){var r=this;kC(this,e),nr(this,"hooks",fh({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Oa(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),nr(this,"handlerId",null),nr(this,"dropTargetRef",null),nr(this,"dropTargetNode",void 0),nr(this,"dropTargetOptionsInternal",null),nr(this,"unsubscribeDropTarget",void 0),nr(this,"lastConnectedHandlerId",null),nr(this,"lastConnectedDropTarget",null),nr(this,"lastConnectedDropTargetOptions",null),nr(this,"backend",void 0),this.backend=t}return AC(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!Da(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function MC(e,t,r){var n=r.getRegistry(),s=n.addTarget(e,t);return[s,function(){return n.removeTarget(s)}]}function LC(e,t,r){var n=r.getRegistry(),s=n.addSource(e,t);return[s,function(){return n.removeSource(s)}]}var un=typeof window<"u"?p.useLayoutEffect:p.useEffect;function xi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?xi=function(r){return typeof r}:xi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},xi(e)}function FC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $C(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 BC(e,t,r){return t&&$C(e.prototype,t),e}function ko(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,r,n){FC(this,e),ko(this,"spec",void 0),ko(this,"monitor",void 0),ko(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return BC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return xi(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,o=s.isDragging;return o?o(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e}();function VC(e,t,r){var n=p.useMemo(function(){return new UC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function fn(){var e=p.useContext(sh),t=e.dragDropManager;return de(t!=null,"Expected drag drop context"),t}function qC(e){return p.useMemo(function(){var t=e.type;return de(t!=null,"spec.type must be defined"),t},[e])}function zC(e,t){return KC(e)||QC(e,t)||WC(e,t)||HC()}function HC(){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
|
|
460
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
461
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
462
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
463
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
464
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
465
|
-
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),ei(bn,Sh,{exposeProperties:{text:function(t,r){return Ro(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),bn);function e1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t1(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 r1(e,t,r){return t&&t1(e.prototype,t),e}function du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n1=function(){function e(t){e1(this,e),du(this,"item",void 0),du(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return r1(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 s1(e,t){var r=new n1(Ta[e]);return r.loadDataTransfer(t),r}function Ao(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ta).filter(function(r){var n=Ta[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function i1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o1(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 a1(e,t,r){return t&&o1(e.prototype,t),e}function Po(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l1=function(){function e(t,r){i1(this,e),Po(this,"ownerDocument",null),Po(this,"globalContext",void 0),Po(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return a1(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),e}();function fu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function hu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function c1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u1(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 d1(e,t,r){return t&&u1(e.prototype,t),e}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f1=function(){function e(t,r,n){var s=this;c1(this,e),be(this,"options",void 0),be(this,"actions",void 0),be(this,"monitor",void 0),be(this,"registry",void 0),be(this,"enterLeaveCounter",void 0),be(this,"sourcePreviewNodes",new Map),be(this,"sourcePreviewNodeOptions",new Map),be(this,"sourceNodes",new Map),be(this,"sourceNodeOptions",new Map),be(this,"dragStartSourceIds",null),be(this,"dropTargetIds",[]),be(this,"dragEnterTargetIds",[]),be(this,"currentNativeSource",null),be(this,"currentNativeHandle",null),be(this,"currentDragSourceNode",null),be(this,"altKeyPressed",!1),be(this,"mouseMoveTimeoutTimer",null),be(this,"asyncEndDragFrameId",null),be(this,"dragOverTargetIds",null),be(this,"lastClientOffset",null),be(this,"hoverRafId",null),be(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&bh(o)||null}),be(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),be(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),be(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),be(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Js(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Ao(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),g=s.sourcePreviewNodes.get(u)||f;if(g){var m=s.getCurrentSourcePreviewNodeOptions(),_=m.anchorX,h=m.anchorY,y=m.offsetX,v=m.offsetY,b={anchorX:_,anchorY:h},S={offsetX:y,offsetY:v},w=J0(f,g,a,b,S);c.setDragImage(g,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(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),be(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Ao(a);c&&s.beginDragNativeItem(c,a)}}),be(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Js(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),be(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),be(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=Js(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),be(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),be(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Ao(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),be(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Js(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),be(this,"handleSelectStart",function(i){var o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))}),this.options=new l1(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new H0(this.isNodeInDocument)}return d1(e,[{key:"profile",value:function(){var r,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((r=this.dragStartSourceIds)===null||r===void 0?void 0:r.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var r=this.rootElement;if(r!==void 0){if(r.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");r.__isReactDndBackendSetUp=!0,this.addEventListeners(r)}}},{key:"teardown",value:function(){var r=this.rootElement;if(r!==void 0&&(r.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(r,n,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(r){r.addEventListener&&(r.addEventListener("dragstart",this.handleTopDragStart),r.addEventListener("dragstart",this.handleTopDragStartCapture,!0),r.addEventListener("dragend",this.handleTopDragEndCapture,!0),r.addEventListener("dragenter",this.handleTopDragEnter),r.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.addEventListener("dragover",this.handleTopDragOver),r.addEventListener("dragover",this.handleTopDragOverCapture,!0),r.addEventListener("drop",this.handleTopDrop),r.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(r){r.removeEventListener&&(r.removeEventListener("dragstart",this.handleTopDragStart),r.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),r.removeEventListener("dragend",this.handleTopDragEndCapture,!0),r.removeEventListener("dragenter",this.handleTopDragEnter),r.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.removeEventListener("dragover",this.handleTopDragOver),r.removeEventListener("dragover",this.handleTopDragOverCapture,!0),r.removeEventListener("drop",this.handleTopDrop),r.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(r);return hu({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(r);return hu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(uu).some(function(n){return uu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=s1(r,n),this.currentNativeHandle=this.registry.addSource(r,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(r){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=r;var s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var r;(r=this.window)===null||r===void 0||r.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(r,n){r.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(r,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(r,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(r,n){this.dropTargetIds.unshift(n)}}]),e}(),ti;function h1(){return ti||(ti=new Image,ti.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),ti}var p1=function(t,r,n){return new f1(t,r,n)};function g1(e,t){return typeof e=="function"?e(t):e??"NODE"}function m1(e){return e.isDraggable&&!e.isEditing}function y1(e){const t=Nt(),r=t.selectedIds,[n,s,i]=v0(()=>({canDrag:()=>m1(e),type:g1(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(qn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(qn.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(h1())},[i]),s}function v1(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function b1(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function ri(e,t){return{parentId:e||null,index:t}}function _n(e,t){return{type:"line",index:e,level:t}}function _1(e){return{type:"highlight",id:e}}function Mo(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=Kf(n)+1;return{parentId:s,index:i}}function Ch(e){var t;const r=v1(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=b1(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:ri(i.id,null),cursor:_1(i.id)};if(!c)return{drop:ri((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:_n(0,0)};if(zf(c)){const u=mi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}if(Hf(c)){const u=mi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}if(Wf(c)){const u=mi(s,0,c.level+1);return u>c.level?{drop:ri(c.id,0),cursor:_n(c.rowIndex+1,u)}:{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}return{drop:ri(c==null?void 0:c.id,0),cursor:_n(c.rowIndex+1,c.level+1)}}function w1(e,t){const r=Nt(),[n,s]=mh(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=Ch({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(qn.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function S1(e){const t=Nt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const pu=p.memo(function({index:t,style:r}){qf(),Bw();const n=Nt(),s=S1(t),i=p.useRef(null),o=y1(s),a=w1(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),d=n.indent*s.level,u=p.useMemo(()=>({paddingLeft:d}),[d]),f=p.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const m=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:g,children:l.jsx(m,{node:s,tree:n,style:u,dragHandle:o})})});let Lo="",gu=null;function Eh(){qf();const e=Nt();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(),Gf(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Yf(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(gu),Lo+=t.key,gu=setTimeout(()=>{Lo=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Lo):!1});n&&e.focus(n.id)},children:l.jsx(x1,{})})}function x1(){var e,t;const r=Nt(),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:IS,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:jS,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(CS,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:pu})):l.jsx(ES,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:pu}))}function mu(e){return e.isFiltered?E1(e.root,e.isMatch.bind(e)):C1(e.root)}function C1(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(Oh),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(Oh),n}function Oh(e,t){e.rowIndex=t}const yu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Fo=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:gt}=Hw;class vs{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=Ec(this),this.visibleNodes=mu(this),this.idToIndex=yu(this.visibleNodes)}update(t){this.props=t,this.root=Ec(this),this.visibleNodes=mu(this),this.idToIndex=yu(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=fs(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=fs(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof Is)return t.id;const r=this.props.idAccessor||"id";return fs(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+1)}indexOf(t){const r=this.identifyNull(t);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Fo(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?eh(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:Jf(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield gt(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return Fo(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield gt(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(Oo(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{vs.editPromise=i})}submit(t,r){return Fo(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield gt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(Oo(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Oo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&>(this.props.onActivate,r)}resolveEdit(t){const r=vs.editPromise;r&&r(t),vs.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(gn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&>(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(gn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(xr.remove(r)),gt(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(gn(n.id)),n.isSelectable&&(this.dispatch(xr.add(n.id)),this.dispatch(xr.anchor(n.id)),this.dispatch(xr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(gn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(xr.remove(this.nodesBetween(s,i))),this.dispatch(xr.add(o)),this.dispatch(xr.mostRecent(n))}this.scrollTo(n),this.focusedNode&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(gn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&>(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(xr.set({ids:n,anchor:s,mostRecent:i})),gt(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&Qf(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;gt(this.props.onMove,{dragIds:n,parentId:t===Ds?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(qn.cursor({type:"none"}))}showCursor(t){this.dispatch(qn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(wa.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(wa.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=cl(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Mi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Mi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),Zf(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===Ds)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!fs(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(gn(t.id))}onBlur(){this.dispatch(tS())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Eh}get renderRow(){return this.props.renderRow||Yw}get renderNode(){return this.props.children||Xw}get renderDragPreview(){return this.props.renderDragPreview||th}get renderCursor(){return this.props.renderCursor||Gw}}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 O1=typeof Symbol=="function"&&Symbol.observable||"@@observable",vu=O1,$o=()=>Math.random().toString(36).substring(7).split("").join("."),D1={INIT:`@@redux/INIT${$o()}`,REPLACE:`@@redux/REPLACE${$o()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$o()}`},an=D1;function Dh(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 I1(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(j1(e))return"date";if(N1(e))return"error";const r=T1(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 T1(e){return typeof e.constructor=="function"?e.constructor.name:null}function N1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function j1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Or(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=I1(e)),t}function Ih(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?mt(2):`Expected the root reducer to be a function. Instead, received: '${Or(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?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: '${Or(r)}'`);return r(Ih)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?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 s}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?mt(4):`Expected the listener to be a function. Instead, received: '${Or(y)}'`);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.");let v=!0;d();const b=a++;return o.set(b,y),function(){if(v){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.");v=!1,d(),o.delete(b),i=null}}}function g(y){if(!Dh(y))throw new Error(process.env.NODE_ENV==="production"?mt(7):`Actions must be plain objects. Instead, the actual type was: '${Or(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"?mt(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"?mt(17):`Action "type" property must be a string. Instead, the actual type was: '${Or(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?mt(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(b=>{b()}),y}function m(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?mt(10):`Expected the nextReducer to be a function. Instead, received: '${Or(y)}`);n=y,g({type:an.REPLACE})}function _(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?mt(11):`Expected the observer to be an object. Instead, received: '${Or(v)}'`);function b(){const w=v;w.next&&w.next(u())}return b(),{unsubscribe:y(b)}},[vu](){return this}}}return g({type:an.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:m,[vu]:_}}function bu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function k1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===an.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(!Dh(e))return`The ${i} has unexpected type of "${Or(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===an.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 R1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:an.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?mt(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:an.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?mt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${an.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function _u(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&bu(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{R1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=k1(a,r,c,s);f&&bu(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const g=n[f],m=r[g],_=a[g],h=m(_,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?mt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${g}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}u[g]=h,d=d||h!==_}return d=d||n.length!==Object.keys(a).length,d?u:a}}function A1(e=Vn().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 P1=_u({nodes:_u({focus:rS,edit:eS,open:nS,selection:sS,drag:A1}),dnd:iS}),M1=Vn();function L1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(Ih(P1,Vn(e))),o=$w.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>M1),a=p.useMemo(()=>new vs(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(wa.clear(!0))},[a.props.searchTerm]),l.jsx($f.Provider,{value:a,children:l.jsx(Vf.Provider,{value:c.current,children:l.jsx(Bf.Provider,{value:o.nodes,children:l.jsx(Uf.Provider,{value:o.dnd,children:l.jsx(pC,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||p1,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function F1(){const e=Nt(),[,t]=mh(()=>({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}=Ch({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(qn.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 $1(e){return F1(),e.children}function B1(){const t=Nt().props.renderContainer||Eh;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function U1(){const e=Nt(),{offset:t,mouse:r,item:n,isDragging:s}=$0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||th;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 q1{constructor(t,r={}){this.accessors=V1(r),this.root=z1(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 z1(e,t){const r=new Th({},null,t,"ROOT");return r.children=e.map(n=>ml(n,r,t)),r}function ml(e,t,r){const n=new Th(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>ml(i,n,r))),n}class Th{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=ml(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let H1=0;function W1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new q1(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)},d=typeof s=="string"?s:"id",u=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={[d]:`simple-tree-id-${H1++}`,name:""};return y==="internal"&&(v[u]=[]),o.create({parentId:_,index:h,data:v}),n(o.data),v},onDelete:_=>{_.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function Q1(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 K1(e,t){const r=Q1(e);return l.jsxs(L1,{treeProps:r,imperativeHandle:t,children:[l.jsx($1,{children:l.jsx(B1,{})}),l.jsx(U1,{})]})}const G1=p.forwardRef(K1);function yl(){return De(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 Y1(){return De(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const wu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Su={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},xu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],X1=[{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 Z1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function ao(e){const t=Z1(e);return{key:t,color:wu[t]??wu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Su[t]??Su.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const J1="_row_i3qt2_1",eE="_grip_i3qt2_16",tE="_menuBtn_i3qt2_19",rE="_selected_i3qt2_23",nE="_title_i3qt2_28",sE="_dropTarget_i3qt2_33",iE="_toggle_i3qt2_50",oE="_ctIcon_i3qt2_65",aE="_folderIcon_i3qt2_77",lE="_renameInput_i3qt2_92",cE="_dropHere_i3qt2_101",uE="_menuWrap_i3qt2_111",dE="_menu_i3qt2_19",fE="_dangerItem_i3qt2_163",Ot={row:J1,grip:eE,menuBtn:tE,selected:rE,title:nE,dropTarget:sE,toggle:iE,ctIcon:oE,folderIcon:aE,renameInput:lE,dropHere:cE,menuWrap:uE,menu:dE,dangerItem:fE},hE={video:Ja,pdf:Ka,h5p:Ga,scorm:Xa,audio:Ya,quiz:Qa,default:Kn},pE=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,d]=p.useState(e.data.name),u=p.useRef(null),f=n==="edit",g=yl(),m=ao(e.data),_=hE[m.key]??Kn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),b=y?Sy:v?Iy:_;p.useEffect(()=>{if(!s)return;const C=D=>{var j;(j=u.current)!=null&&j.contains(D.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const S=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(C=>{C.key==="Enter"&&S(),C.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[Ot.row,h?Ot.selected:"",e.state.isOver&&v?Ot.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:Ot.grip,"aria-hidden":"true",children:l.jsx(ef,{size:14})}),l.jsx("button",{className:Ot.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(Yd,{size:14}):l.jsx(Bs,{size:14})}),l.jsx("span",{className:`${Ot.ctIcon} ${y||v?Ot.folderIcon:m.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:Ot.renameInput,value:c,autoFocus:!0,onChange:C=>d(C.target.value),onBlur:S,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:Ot.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ot.menuWrap,ref:u,children:[l.jsx("button",{className:Ot.menuBtn,onClick:C=>{C.stopPropagation(),i(D=>!D)},"aria-label":"Node options",children:l.jsx(Zd,{size:14})}),s&&l.jsxs("div",{className:Ot.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(Ay,{size:13})," Rename"]}),v&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(Jd,{size:13})," Add sub-unit"]}),e.data.parent&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(Us,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Za,{size:13})," Delete"]})]})]})]})};async function gE(e,t){var i,o;const n=((i=(await Ne.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 mE(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 yE(e,t){var a;const r=await gE(e,t.name),n=await mE(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Ne.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function vE(e){var r;return((r=(await Ne.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function Nh(e){var n,s,i;const r=(i=(s=(n=(await Ne.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 bE(e){return Nh(e)}const _E="_container_jr3ij_1",wE="_header_jr3ij_13",SE="_title_jr3ij_22",xE="_closeBtn_jr3ij_29",CE="_body_jr3ij_45",EE="_dropZone_jr3ij_54",OE="_dragOver_jr3ij_67",DE="_hasFile_jr3ij_72",IE="_hiddenInput_jr3ij_78",TE="_fileInfo_jr3ij_82",NE="_fileIcon_jr3ij_89",jE="_fileName_jr3ij_93",kE="_fileSize_jr3ij_100",RE="_dropHint_jr3ij_105",AE="_dropIcon_jr3ij_112",PE="_dropText_jr3ij_117",ME="_dropSubtext_jr3ij_124",LE="_sampleLink_jr3ij_130",FE="_statusBar_jr3ij_145",$E="_status_uploading_jr3ij_154",BE="_status_processing_jr3ij_154",UE="_status_done_jr3ij_159",VE="_status_error_jr3ij_164",qE="_successDetail_jr3ij_170",zE="_spinner_jr3ij_175",HE="_spin_jr3ij_175",WE="_errorMsg_jr3ij_191",QE="_failedSection_jr3ij_197",KE="_failedTitle_jr3ij_203",GE="_tableWrap_jr3ij_213",YE="_failedTable_jr3ij_219",XE="_reasonCell_jr3ij_244",ZE="_footer_jr3ij_248",je={container:_E,header:wE,title:SE,closeBtn:xE,body:CE,dropZone:EE,dragOver:OE,hasFile:DE,hiddenInput:IE,fileInfo:TE,fileIcon:NE,fileName:jE,fileSize:kE,dropHint:RE,dropIcon:AE,dropText:PE,dropSubtext:ME,sampleLink:LE,statusBar:FE,status_uploading:$E,status_processing:BE,status_done:UE,status_error:VE,successDetail:qE,spinner:zE,spin:HE,errorMsg:WE,failedSection:QE,failedTitle:KE,tableWrap:GE,failedTable:YE,reasonCell:XE,footer:ZE},JE=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState("idle"),[u,f]=p.useState(""),[g,m]=p.useState([]),[_,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 S=T=>T.name.toLowerCase().endsWith(".csv")?T.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(T=>{f(""),m([]),h(null),d("idle"),S(T)&&i(T)},[]),C=p.useCallback(T=>{T.preventDefault(),a(!1);const R=T.dataTransfer.files[0];R&&w(R)},[w]),D=p.useCallback(T=>{var B;const R=(B=T.target.files)==null?void 0:B[0];R&&w(R),T.target.value=""},[w]),j=p.useCallback(async()=>{try{const T=await bE(e),R=document.createElement("a");R.href=T,R.download="sample_hierarchy.csv",R.target="_blank",R.click()}catch{f("Failed to download sample CSV.")}},[e]),k=p.useCallback(async()=>{if(s){d("uploading"),f(""),m([]);try{const{processId:T}=await yE(e,s);if(!T){d("done"),h(null),setTimeout(t,1500);return}d("processing"),v.current=setInterval(async()=>{try{const R=await vE(T);R.status==="COMPLETED"?(b(),d("done"),h(R.successCount??null),R.failedRecords&&R.failedRecords.length>0?m(R.failedRecords):setTimeout(t,1500)):R.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),R.failedRecords&&m(R.failedRecords))}catch{b(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),L={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:je.container,children:[l.jsxs("div",{className:je.header,children:[l.jsx("h2",{className:je.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:je.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:je.body,children:[l.jsxs("div",{className:`${je.dropZone} ${o?je.dragOver:""} ${s?je.hasFile:""}`,onDragEnter:T=>{T.preventDefault(),a(!0)},onDragOver:T=>{T.preventDefault(),a(!0)},onDragLeave:T=>{T.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var T;return(T=y.current)==null?void 0:T.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:T=>{var R;return T.key==="Enter"&&((R=y.current)==null?void 0:R.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:je.hiddenInput,onChange:D,"aria-hidden":"true"}),s?l.jsxs("div",{className:je.fileInfo,children:[l.jsx("span",{className:je.fileIcon,children:"📄"}),l.jsx("span",{className:je.fileName,children:s.name}),l.jsxs("span",{className:je.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:je.dropHint,children:[l.jsx("span",{className:je.dropIcon,children:"⬆️"}),l.jsx("p",{className:je.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:je.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:je.sampleLink,onClick:j,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${je.statusBar} ${je[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:je.spinner,"aria-hidden":"true"}),L[c],c==="done"&&_!==null&&l.jsxs("span",{className:je.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:je.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:je.failedSection,children:[l.jsxs("h4",{className:je.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:je.tableWrap,children:l.jsxs("table",{className:je.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:g.map((T,R)=>l.jsxs("tr",{children:[l.jsx("td",{children:T.rowNumber??R+1}),l.jsx("td",{children:T.name??"—"}),l.jsx("td",{className:je.reasonCell,children:T.reason??"Unknown error"})]},R))})]})})]})]}),l.jsxs("div",{className:je.footer,children:[l.jsx(Me,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Me,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:k,children:c==="done"?"Uploaded":"Upload"})]})]})},eO="_container_1y30m_1",tO="_header_1y30m_8",rO="_headerActions_1y30m_19",nO="_iconBtn_1y30m_25",sO="_menuWrap_1y30m_43",iO="_dropdownMenu_1y30m_47",oO="_treeWrapper_1y30m_79",aO="_csvModal_1y30m_95",lO="_footer_1y30m_105",sr={container:eO,header:tO,headerActions:rO,iconBtn:nO,menuWrap:sO,dropdownMenu:iO,treeWrapper:oO,csvModal:aO,footer:lO},cO=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var me;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[g,m]=p.useState("create"),{treeData:_,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:b,reorderChildren:S,moveNode:w,setTreeData:C}=De(),D=e==="edit",j=yl(),k=D&&j,L=(((me=_[0])==null?void 0:me.children)??[]).some(q=>q.isFolder),T=ae(q=>{var J,te,U,Z;return((te=(J=q.editorConfig)==null?void 0:J.context)==null?void 0:te.contentId)??((Z=(U=q.editorConfig)==null?void 0:U.context)==null?void 0:Z.identifier)??""}),R=ae(q=>{var te,U;const J=(U=(te=q.categoryMeta)==null?void 0:te.sourcingSettings)==null?void 0:U.collection;return(J==null?void 0:J.enableBulkUpload)!==!1});p.useEffect(()=>{const q=s.current;if(!q)return;const J=new ResizeObserver(()=>{a(q.clientHeight||400)});return J.observe(q),a(q.clientHeight||400),()=>J.disconnect()},[]),p.useEffect(()=>{if(!c)return;const q=J=>{var te;(te=i.current)!=null&&te.contains(J.target)||d(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[c]);const B=p.useCallback(q=>{q.length>0&&y(q[0].data.id)},[y]),A=p.useCallback(({parentId:q,index:J,dragIds:te})=>{if(!q)return;const U=te[0],Z=Na(_,U);if(!Z)return;const K=Z.parent;if(K===q){const le=Na(_,q);if(!(le!=null&&le.children))return;const ee=le.children.findIndex(pe=>pe.id===U);if(ee<0)return;S(q,ee,J>ee?J-1:J)}else w(U,K??"",q)},[_,S,w]),P=p.useCallback(({ids:q})=>{q.forEach(J=>b(J))},[b]),F=p.useCallback(({parentId:q})=>{var U;const J=q??((U=_[0])==null?void 0:U.id)??"";if(!J)return{id:crypto.randomUUID()};const te=v(J,"unit");return te?{id:te}:(Ee.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,_]),Y=p.useCallback(()=>{var J;const q=(J=_[0])==null?void 0:J.id;q&&(v(q,"unit")||Ee.error("Maximum depth reached"))},[_,v]),se=p.useCallback(()=>{h&&(v(h,"subunit")||Ee.error("Maximum depth reached"))},[h,v]),Ce=p.useCallback(async()=>{if(d(!1),!!T)try{const q=await Nh(T),J=await fetch(q).then(Z=>Z.blob()),te=URL.createObjectURL(J),U=document.createElement("a");U.href=te,U.download=`${T}-folders.csv`,U.style.display="none",document.body.appendChild(U),U.click(),document.body.removeChild(U),URL.revokeObjectURL(te)}catch{Ee.error("Failed to download CSV")}},[T]),ve=p.useCallback(async()=>{if(f(!1),!!T)try{const{rootNode:q}=await Ff(T);C([q]),Ee.success("Course outline refreshed.")}catch{Ee.error("Outline could not be refreshed automatically. Please reload the page.")}},[T,C]);return l.jsxs("div",{className:sr.container,children:[l.jsx("div",{className:sr.header,children:l.jsxs("div",{className:sr.headerActions,children:[D&&l.jsxs("div",{className:sr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:sr.iconBtn,onClick:()=>d(q=>!q),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Zd,{size:15})}),c&&l.jsx("div",{className:sr.dropdownMenu,role:"menu",children:R&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:L,title:L?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),m("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:Ce,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),m("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:sr.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(ky,{size:15}):l.jsx(jy,{size:15})})]})}),l.jsx("div",{className:sr.treeWrapper,ref:s,children:l.jsx(G1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:B,onMove:D?A:void 0,onDelete:D?P:void 0,onCreate:D?F:void 0,disableEdit:!D,disableDrop:!D,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:q=>l.jsx(pE,{...q,editorMode:e})})}),D&&l.jsxs("div",{className:sr.footer,children:[l.jsxs(Me,{variant:"ghost",size:"sm",onClick:Y,disabled:!k,children:[l.jsx(Us,{size:14})," Add Unit"]}),l.jsxs(Me,{variant:"ghost",size:"sm",onClick:se,disabled:!k||!h,children:[l.jsx(Jd,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:sr.csvModal,children:l.jsx(JE,{contentId:T,mode:g,onComplete:ve,onClose:()=>f(!1)})})]})};function Na(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Na(r.children,t);if(n)return n}}}const uO="_breadcrumb_zd1aj_1",dO="_crumb_zd1aj_10",fO="_sep_zd1aj_26",hO="_current_zd1aj_31",is={breadcrumb:uO,crumb:dO,sep:fO,current:hO},pO=({crumbs:e})=>{const t=De(r=>r.selectNode);return e.length?l.jsxs("nav",{className:is.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:is.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(Ty,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Yd,{size:13,className:is.sep}),n<e.length-1?l.jsx("button",{className:is.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:is.current,children:r.name})]},r.id))]}):null},gO="_tabBar_qhks1_1",mO="_tab_qhks1_1",yO="_active_qhks1_29",vO="_error_qhks1_35",bO="_errorDot_qhks1_39",os={tabBar:gO,tab:mO,active:yO,error:vO,errorDot:bO},Cu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],_O=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?Cu.filter(i=>n.includes(i.id)):Cu;return l.jsx("div",{className:os.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:[os.tab,e===i.id?os.active:"",r.includes(i.id)?os.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:os.errorDot,"aria-label":"Has errors"})]},i.id))})};var Ws=e=>e.type==="checkbox",Kr=e=>e instanceof Date,ct=e=>e==null;const jh=e=>typeof e=="object";var qe=e=>!ct(e)&&!Array.isArray(e)&&jh(e)&&!Kr(e),ja=e=>qe(e)&&e.target?Ws(e.target)?e.target.checked:e.target.value:e,kh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Rh=e=>{const t=e.constructor&&e.constructor.prototype;return qe(t)&&t.hasOwnProperty("isPrototypeOf")},lo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ze(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(lo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(qe(e)&&Rh(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=ze(e[s]));return n}const Ir={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Gt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Bo="form",Ah="root",Ph=["__proto__","constructor","prototype"];var Qs=e=>/^\w*$/.test(e),$e=e=>e===void 0,co=e=>e.split(/[.[\]'"]/g).filter(Boolean),Q=(e,t,r)=>{if(!t||!qe(e))return r;const n=Qs(t)?[t]:co(t);if(n.some(i=>Ph.includes(i)))return r;const s=n.reduce((i,o)=>ct(i)?void 0:i[o],e);return $e(s)||s===e?$e(e[t])?r:e[t]:s},Pt=e=>typeof e=="boolean",vt=e=>typeof e=="function",Ae=(e,t,r)=>{let n=-1;const s=Qs(t)?[t]:co(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=qe(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Ph.includes(a))return;e[a]=c,e=e[a]}};const vl=p.createContext(null);vl.displayName="HookFormControlContext";const bl=()=>p.useContext(vl);var Mh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Gt.all&&(t._proxyFormState[o]=!n||Gt.all),r&&(r[o]=!0),e[o]}});return s};const _l=lo?p.useLayoutEffect:p.useEffect;function wO(e){const t=bl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return _l(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Mh(o,r,c.current,!1),[o,r])}var bt=e=>typeof e=="string",ka=(e,t,r,n,s)=>bt(e)?(n&&t.watch.add(e),Q(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),Q(r,i))):(n&&(t.watchAll=!0),r),Ra=e=>ct(e)||!jh(e);const Eu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Rh(e);function Mt(e,t,r=new WeakMap){if(e===t)return!0;if(Ra(e)||Ra(t))return Object.is(e,t);if(Kr(e)&&Kr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Eu(e,n)||Eu(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Kr(a)&&Kr(c)||(qe(a)||Array.isArray(a))&&(qe(c)||Array.isArray(c))?!Mt(a,c,r):!Object.is(a,c))return!1}}return!0}function SO(e){const t=bl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),d=p.useRef(a),u=p.useRef(void 0),f=p.useRef(r),g=p.useRef(n);d.current=a;const[m,_]=p.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=p.useCallback(w=>{const C=ka(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const C=ka(n,r._names,w||r._formValues,!1,c.current);if(d.current){const D=d.current(C);Mt(D,u.current)||(_(D),u.current=D)}else _(C)}},[r._formValues,r._names,i,n]);_l(()=>((f.current!==r||!Mt(g.current,n))&&(f.current=r,g.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,b=g.current,S=p.useMemo(()=>{if(i)return null;const w=!v&&!Mt(b,n);return v||w?h():null},[i,v,n,b,h]);return S!==null?S:m}function uo(e){const t=bl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=kh(s._names.array,r),d=p.useMemo(()=>Q(s._formValues,r,Q(s._defaultValues,r,o)),[s,r,o]),u=SO({control:s,name:r,defaultValue:d,exact:a}),f=wO({control:s,name:r,exact:a}),g=p.useRef(e),m=p.useRef(null),_=p.useRef(s.register(r,{...e.rules,value:u,...Pt(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Q(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!Q(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Q(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Q(f.validatingFields,r)},error:{enumerable:!0,get:()=>Q(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const C=ja(w);return Q(s._fields,r)||(_.current=s.register(r,{...g.current.rules,value:C})),_.current.onChange({target:{value:ja(w),name:r},type:Ir.CHANGE})},[r,s]),v=p.useCallback(()=>_.current.onBlur({target:{value:Q(s._formValues,r),name:r},type:Ir.BLUR}),[r,s._formValues]),b=p.useCallback(w=>{w&&(m.current={focus:()=>vt(w.focus)&&w.focus(),select:()=>vt(w.select)&&w.select(),setCustomValidity:D=>vt(w.setCustomValidity)&&w.setCustomValidity(D),reportValidity:()=>vt(w.reportValidity)&&w.reportValidity()});const C=Q(s._fields,r);C&&C._f&&w&&(C._f.ref=m.current)},[s._fields,r]),S=p.useMemo(()=>({name:r,value:u,...Pt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,f.disabled,y,v,b,u]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...Pt(g.current.disabled)?{disabled:g.current.disabled}:{}});const C=(D,j)=>{const k=Q(s._fields,D);k&&k._f&&(k._f.mount=j)};if(C(r,!0),w){const D=ze(Q(i?s._defaultValues:s._options.values||s._defaultValues,r,Q(s._options.defaultValues,r,g.current.defaultValue)));Ae(s._defaultValues,r,D),$e(Q(s._formValues,r))&&Ae(s._formValues,r,D)}if(!c&&s.register(r),m.current){const D=Q(s._fields,r);D&&D._f&&(D._f.ref=m.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:S,formState:f,fieldState:h}),[S,f,h])}const wl=p.createContext(null);wl.displayName="HookFormContext";const Jt=()=>p.useContext(wl),xO=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:_,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:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:_,register:h,setFocus:y,subscribe:v}),[i,_,d,n,r,g,h,f,u,s,y,o,a,v,c,m,t]);return p.createElement(wl.Provider,{value:b},p.createElement(vl.Provider,{value:b.control},e))};var CO=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Lh=e=>Array.isArray(e)?e.filter(Boolean):[],Ci=e=>Array.isArray(e)?e:[e],Ou=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function Fh(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&qe(s)&&i){const o=Fh(s,i);qe(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var nt=e=>qe(e)&&!Object.keys(e).length,Sl=e=>e.type==="file",Fi=e=>{if(!lo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},$h=e=>e.type==="select-multiple",xl=e=>e.type==="radio",EO=e=>xl(e)||Ws(e),Uo=e=>Fi(e)&&e.isConnected;function OO(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ct(e)){e=void 0;break}e=e[t[n]],n++}return e}function DO(e){for(const t in e)if(e.hasOwnProperty(t)&&!$e(e[t]))return!1;return!0}function Xe(e,t){if(bt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Qs(t)?[t]:co(t),n=r.length===1?e:OO(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(qe(n)&&nt(n)||Array.isArray(n)&&DO(n))&&Xe(e,r.slice(0,-1)),e}var IO=e=>{for(const t in e)if(vt(e[t]))return!0;return!1};function Bh(e){return Array.isArray(e)||qe(e)&&!IO(e)}function Aa(e,t={}){for(const r in e){const n=e[r];Bh(n)?(t[r]=Array.isArray(n)?[]:{},Aa(n,t[r])):$e(n)||(t[r]=!0)}return t}function Pa(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Pa(r));return t.some(r=>r!==void 0)?t:void 0}if(qe(e)){const t={};for(const r in e){const n=Pa(e[r]);$e(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function zr(e,t,r){r||(r=Aa(t));for(const n in e){const s=e[n];if(Bh(s))$e(t)||Ra(r[n])?r[n]=Aa(s,Array.isArray(s)?[]:{}):zr(s,ct(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Mt(s,i)}}return Pa(r)||{}}const Du={value:!1,isValid:!1},Iu={value:!0,isValid:!0};var Uh=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$e(e[0].attributes.value)?$e(e[0].value)||e[0].value===""?Iu:{value:e[0].value,isValid:!0}:Iu:Du}return Du},Vh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$e(e)?e:t?e===""?NaN:e&&+e:r&&bt(e)?new Date(e):n?n(e):e;const Tu={isValid:!1,value:null};var qh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Tu):Tu;function Nu(e){const t=e.ref;return Sl(t)?t.files:xl(t)?qh(e.refs).value:$h(t)?[...t.selectedOptions].map(({value:r})=>r):Ws(t)?Uh(e.refs).value:Vh($e(t.value)?e.ref.value:t.value,e)}var TO=(e,t,r,n)=>{const s={};for(const i of e){const o=Q(t,i);o&&Ae(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},$i=e=>e instanceof RegExp,as=e=>$e(e)?e:$i(e)?e.source:qe(e)?$i(e.value)?e.value.source:e.value:e,ju=e=>({isOnSubmit:!e||e===Gt.onSubmit,isOnBlur:e===Gt.onBlur,isOnChange:e===Gt.onChange,isOnAll:e===Gt.all,isOnTouch:e===Gt.onTouched});const ku="AsyncFunction";var NO=e=>!!e&&!!e.validate&&!!(vt(e.validate)&&e.validate.constructor.name===ku||qe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===ku)),jO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Vo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const bs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=Q(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(bs(a,t))break}else if(qe(a)&&bs(a,t))break}}};function Ru(e,t,r){const n=Q(e,r);if(n||Qs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=Q(t,i),a=Q(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 kO=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return nt(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Gt.all))},RO=(e,t,r)=>!e||!t||e===t||Ci(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),AO=(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,PO=(e,t)=>!Lh(Q(e,t)).length&&Xe(e,t),Au=(e,t,r)=>{const n=Q(e,r),s=Array.isArray(n)?n:[];return Ae(s,Ah,t[r]),Ae(e,r,s),e};function Pu(e,t,r="validate"){if(bt(e)||Array.isArray(e)&&e.every(bt)||Pt(e)&&!e)return{type:r,message:bt(e)?e:"",ref:t}}var wn=e=>qe(e)&&!$i(e)?e:{value:e,message:""},Mu=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:g,pattern:m,validate:_,name:h,valueAsNumber:y,mount:v}=e._f,b=Q(r,h);if(!v||t.has(h))return{};const S=a?a[0]:o,w=B=>{if(s&&S.reportValidity){const A=Pt(B)?"":B||"";a?a.forEach(P=>P.setCustomValidity(A)):S.setCustomValidity(A),S.reportValidity()}},C={},D=xl(o),j=Ws(o),k=D||j,L=(y||Sl(o))&&$e(o.value)&&$e(b)||Fi(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,T=CO.bind(null,h,n,C),R=(B,A,P,F=Qt.maxLength,Y=Qt.minLength)=>{const se=B?A:P;C[h]={type:B?F:Y,message:se,ref:o,...T(B?F:Y,se)}};if(i?!Array.isArray(b)||!b.length:c&&(!k&&(L||ct(b))||Pt(b)&&!b||j&&!Uh(a).isValid||D&&!qh(a).isValid)){const{value:B,message:A}=bt(c)?{value:!!c,message:c}:wn(c);if(B&&(C[h]={type:Qt.required,message:A,ref:S,...T(Qt.required,A)},!n))return w(A),C}if(!L&&(!ct(f)||!ct(g))){let B,A;const P=wn(g),F=wn(f);if(!ct(b)&&!isNaN(b)){const Y=o.valueAsNumber||b&&+b;ct(P.value)||(B=Y>P.value),ct(F.value)||(A=Y<F.value)}else{const Y=o.valueAsDate||new Date(b),se=me=>new Date(new Date().toDateString()+" "+me),Ce=o.type=="time",ve=o.type=="week";bt(P.value)&&b&&(B=Ce?se(b)>se(P.value):ve?b>P.value:Y>new Date(P.value)),bt(F.value)&&b&&(A=Ce?se(b)<se(F.value):ve?b<F.value:Y<new Date(F.value))}if((B||A)&&(R(!!B,P.message,F.message,Qt.max,Qt.min),!n))return w(C[h].message),C}if((d||u)&&!L&&(bt(b)||i&&Array.isArray(b))){const B=wn(d),A=wn(u),P=!ct(B.value)&&b.length>+B.value,F=!ct(A.value)&&b.length<+A.value;if((P||F)&&(R(P,B.message,A.message),!n))return w(C[h].message),C}if(m&&!L&&bt(b)){const{value:B,message:A}=wn(m);if($i(B)&&!b.match(B)&&(C[h]={type:Qt.pattern,message:A,ref:o,...T(Qt.pattern,A)},!n))return w(A),C}if(_){if(vt(_)){const B=await _(b,r),A=Pu(B,S);if(A&&(C[h]={...A,...T(Qt.validate,A.message)},!n))return w(A.message),C}else if(qe(_)){let B={};for(const A in _){if(!nt(B)&&!n)break;const P=Pu(await _[A](b,r),S,A);P&&(B={...P,...T(A,P.message)},w(P.message),n&&(C[h]=B))}if(!nt(B)&&(C[h]={ref:S,...B},!n))return C}}return w(!0),C};const MO={mode:Gt.onSubmit,reValidateMode:Gt.onChange,shouldFocusError:!0},zh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function LO(e={}){let t={...MO,...e},r={...ze(zh),isLoading:vt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=qe(t.defaultValues)||qe(t.values)?ze(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:ze(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let g={...f};const m={array:Ou(),state:Ou()},_=t.criteriaMode===Gt.all,h=x=>I=>{clearTimeout(d),d=setTimeout(x,I)},y=async x=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||x)){let I;t.resolver?(I=nt((await T()).errors),v()):I=await A({fields:n,onlyCheckValid:!0,eventType:Ir.VALID}),I!==r.isValid&&m.state.next({isValid:I})}},v=(x,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((x||Array.from(a.mount)).forEach(N=>{N&&(I?Ae(r.validatingFields,N,I):Xe(r.validatingFields,N))}),m.state.next({validatingFields:r.validatingFields,isValidating:!nt(r.validatingFields)}))},b=()=>{r.dirtyFields=zr(s,i)},S=(x,I=[],N,$,V=!0,W=!0)=>{if($&&N&&!t.disabled){if(o.action=!0,W&&Array.isArray(Q(n,x))){const z=N(Q(n,x),$.argA,$.argB);V&&Ae(n,x,z)}if(W&&Array.isArray(Q(r.errors,x))){const z=N(Q(r.errors,x),$.argA,$.argB);V&&Ae(r.errors,x,z),PO(r.errors,x)}if((f.touchedFields||g.touchedFields)&&W&&Array.isArray(Q(r.touchedFields,x))){const z=N(Q(r.touchedFields,x),$.argA,$.argB);V&&Ae(r.touchedFields,x,z)}(f.dirtyFields||g.dirtyFields)&&b(),m.state.next({name:x,isDirty:F(x,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ae(i,x,I)},w=(x,I)=>{Ae(r.errors,x,I),r.errors={...r.errors},m.state.next({errors:r.errors})},C=x=>{r.errors=x,m.state.next({errors:r.errors,isValid:!1})},D=x=>{const I=Qs(x)?[x]:co(x);let N=i,$=s;for(let V=0;V<I.length-1;V++){const W=I[V];if(N=ct(N)?N:N[W],$=ct($)?$:$[W],N===null&&$!==null)return!0}return!1},j=(x,I,N,$)=>{const V=Q(n,x);if(V){if(D(x))return;const W=$e(Q(i,x)),z=Q(i,x,$e(N)?Q(s,x):N);$e(z)||$&&$.defaultChecked||I?Ae(i,x,I?z:Nu(V._f)):Ce(x,z),o.mount&&!o.action&&(y(),W&&r.isDirty&&(f.isDirty||g.isDirty)&&(F()||(r.isDirty=!1,m.state.next({...r}))),e.shouldUnregister&&W&&!$e(Q(i,x))&&Vo(x,a)&&(o.watch=!0))}},k=(x,I,N,$,V)=>{let W=!1,z=!1;const ne={name:x};if(!t.disabled){if(!N||$){(f.isDirty||g.isDirty)&&(z=r.isDirty,r.isDirty=ne.isDirty=F(),W=z!==ne.isDirty);const ge=Mt(Q(s,x),I);z=!!Q(r.dirtyFields,x),ge!==r.isDirty?r.dirtyFields=zr(s,i):ge?Xe(r.dirtyFields,x):Ae(r.dirtyFields,x,!0),ne.dirtyFields=r.dirtyFields,W=W||(f.dirtyFields||g.dirtyFields)&&z!==!ge}if(N){const ge=Q(r.touchedFields,x);ge||(Ae(r.touchedFields,x,N),ne.touchedFields=r.touchedFields,W=W||(f.touchedFields||g.touchedFields)&&ge!==N)}W&&V&&m.state.next(ne)}return W?ne:{}},L=(x,I,N,$)=>{const V=Q(r.errors,x),W=(f.isValid||g.isValid)&&Pt(I)&&r.isValid!==I;if(t.delayError&&N?(c=h(()=>w(x,N)),c(t.delayError)):(clearTimeout(d),c=null,N?Ae(r.errors,x,N):Xe(r.errors,x),r.errors={...r.errors}),(N?!Mt(V,N):V)||!nt($)||W){const z={...$,...W&&Pt(I)?{isValid:I}:{},errors:r.errors,name:x};r={...r,...z},m.state.next(z)}},T=async x=>(v(x,!0),await t.resolver(i,t.context,TO(x||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),R=async x=>{const{errors:I}=await T(x);if(v(x),x){for(const N of x){const $=Q(I,N);$?a.array.has(N)&&qe($)&&!Object.keys($).some(V=>!Number.isNaN(Number(V)))?Au(r.errors,{[N]:$},N):Ae(r.errors,N,$):Xe(r.errors,N)}r.errors={...r.errors}}else r.errors=I;return I},B=async({name:x,eventType:I})=>{if(e.validate){const N=await e.validate({formValues:i,formState:r,name:x,eventType:I});if(qe(N))for(const $ in N){const V=N[$];V&&pe(`${Bo}.${$}`,{message:bt(V.message)?V.message:"",type:V.type||Qt.validate})}else bt(N)||!N?pe(Bo,{message:N||"",type:Qt.validate}):ee(Bo);return N}return!0},A=async({fields:x,onlyCheckValid:I,name:N,eventType:$,context:V={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(V.runRootValidation=!0,!await B({name:N,eventType:$})&&(V.valid=!1,I)))return V.valid;for(const W in x){const z=x[W];if(z){const{_f:ne,...ge}=z;if(ne){const Ue=a.array.has(ne.name),Ct=z._f&&NO(z._f),Et=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;Ct&&Et&&v([ne.name],!0);const hr=await Mu(z,a.disabled,i,_,t.shouldUseNativeValidation&&!I,Ue);if(Ct&&Et&&v([ne.name]),hr[ne.name]&&(V.valid=!1,I)||(!I&&(Q(hr,ne.name)?Ue?Au(r.errors,hr,ne.name):Ae(r.errors,ne.name,hr[ne.name]):Xe(r.errors,ne.name)),e.shouldUseNativeValidation&&hr[ne.name]))break}!nt(ge)&&await A({context:V,onlyCheckValid:I,fields:ge,name:W,eventType:$})}}return V.valid},P=()=>{for(const x of a.unMount){const I=Q(n,x);I&&(I._f.refs?I._f.refs.every(N=>!Uo(N)):!Uo(I._f.ref))&&Ge(x)}a.unMount=new Set},F=(x,I)=>!t.disabled&&(x&&I&&Ae(i,x,I),!Mt(K(),s)),Y=(x,I,N)=>ka(x,a,{...o.mount?i:$e(I)?s:bt(x)?{[x]:I}:I},N,I),se=x=>Lh(Q(o.mount?i:s,x,t.shouldUnregister?Q(s,x,[]):[])),Ce=(x,I,N={},$=!1)=>{const V=Q(n,x);let W=I;if(V){const z=V._f;z&&(!z.disabled&&Ae(i,x,Vh(I,z)),W=Fi(z.ref)&&ct(I)?"":I,$h(z.ref)?[...z.ref.options].forEach(ne=>ne.selected=W.includes(ne.value)):z.refs?Ws(z.ref)?z.refs.forEach(ne=>{(!ne.defaultChecked||!ne.disabled)&&(Array.isArray(W)?ne.checked=!!W.find(ge=>ge===ne.value):ne.checked=W===ne.value||!!W)}):z.refs.forEach(ne=>ne.checked=ne.value===W):Sl(z.ref)?z.ref.value="":(z.ref.value=W,z.ref.type||m.state.next({name:x,values:$?i:ze(i)})))}(N.shouldDirty||N.shouldTouch)&&k(x,W,N.shouldTouch,N.shouldDirty,!0),N.shouldValidate&&Z(x)},ve=(x,I,N,$=!1)=>{for(const V in I){if(!I.hasOwnProperty(V))return;const W=I[V],z=x+"."+V,ne=Q(n,z);(a.array.has(x)||qe(W)||ne&&!ne._f)&&!Kr(W)?ve(z,W,N,$):Ce(z,W,N,$)}},me=(x,I,N,$)=>{const V=Q(n,x),W=a.array.has(x),z=$?I:ze(I),ne=Q(i,x),ge=Mt(ne,z);if(ge||Ae(i,x,z),W)m.array.next({name:x,values:$?i:ze(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&N.shouldDirty&&(b(),m.state.next({name:x,dirtyFields:r.dirtyFields,isDirty:F(x,z)}));else{const Ue=Array.isArray(z)&&!z.length||nt(z);!V||V._f||ct(z)||Ue?Ce(x,z,N,$):ve(x,z,N,$)}if(!ge){const Ue=Vo(x,a),Ct=$?i:ze(i);m.state.next({...Ue&&r,name:o.mount||Ue?x:void 0,values:Ct})}},q=(x,I,N={})=>me(x,I,N,!1),J=(x,I={})=>{const N=vt(x)?x(i):x;if(!Mt(i,N)){i={...i,...N};for(const $ of a.mount)me($,Q(N,$),I,!0);m.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&y()}},te=async x=>{o.mount=!0;const I=x.target;let N=I.name,$=!0;const V=Q(n,N),W=ge=>{$=Number.isNaN(ge)||Kr(ge)&&isNaN(ge.getTime())||Mt(ge,Q(i,N,ge))},z=ju(t.mode),ne=ju(t.reValidateMode);if(V){let ge,Ue;const Ct=I.type?Nu(V._f):ja(x),Et=x.type===Ir.BLUR||x.type===Ir.FOCUS_OUT,hr=!jO(V._f)&&!e.validate&&!t.resolver&&!Q(r.errors,N)&&!V._f.deps||AO(Et,Q(r.touchedFields,N),r.isSubmitted,ne,z),Xn=Vo(N,a,Et);Ae(i,N,Ct),Et?(!I||!I.readOnly)&&(V._f.onBlur&&V._f.onBlur(x),c&&c(0)):V._f.onChange&&V._f.onChange(x);const Ur=k(N,Ct,Et),et=!nt(Ur)||Xn;if(!Et&&m.state.next({name:N,type:x.type,values:ze(i)}),hr)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?Et&&y():Et||y()),et&&m.state.next({name:N,...Xn?{}:Ur});if(!t.resolver&&e.validate&&await B({name:N,eventType:x.type}),!Et&&Xn&&m.state.next({...r}),t.resolver){const{errors:ft}=await T([N]);if(v([N]),W(Ct),!$){!nt(Ur)&&m.state.next(Ur);return}const wt=Ru(r.errors,n,N),Ht=Ru(ft,n,wt.name||N);ge=Ht.error,N=Ht.name,Ue=nt(ft)}else v([N],!0),ge=(await Mu(V,a.disabled,i,_,t.shouldUseNativeValidation))[N],v([N]),W(Ct),$&&(ge?Ue=!1:(f.isValid||g.isValid)&&(Ue=await A({fields:n,onlyCheckValid:!0,name:N,eventType:x.type})));$&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&Z(V._f.deps),L(N,Ue,ge,Ur))}},U=(x,I)=>{if(Q(r.errors,I)&&x.focus)return x.focus(),1},Z=async(x,I={})=>{let N,$;const V=Ci(x);if(t.resolver){const W=await R($e(x)?x:V);N=nt(W),$=x?!V.some(z=>Q(W,z)):N}else x?($=(await Promise.all(V.map(async W=>{const z=Q(n,W);return await A({fields:z&&z._f?{[W]:z}:z,eventType:Ir.TRIGGER})}))).every(Boolean),!(!$&&!r.isValid)&&y()):$=N=await A({fields:n,name:x,eventType:Ir.TRIGGER});return m.state.next({...!bt(x)||(f.isValid||g.isValid)&&N!==r.isValid?{}:{name:x},...t.resolver||!x?{isValid:N}:{},errors:r.errors}),I.shouldFocus&&!$&&bs(n,U,x?V:a.mount),$},K=(x,I)=>{let N={...o.mount?i:s};return I&&(N=Fh(I.dirtyFields?r.dirtyFields:r.touchedFields,N)),$e(x)?N:bt(x)?Q(N,x):x.map($=>Q(N,$))},le=(x,I)=>({invalid:!!Q((I||r).errors,x),isDirty:!!Q((I||r).dirtyFields,x),error:Q((I||r).errors,x),isValidating:!!Q(r.validatingFields,x),isTouched:!!Q((I||r).touchedFields,x)}),ee=x=>{const I=x?Ci(x):void 0;I==null||I.forEach(N=>Xe(r.errors,N)),I?I.forEach(N=>{m.state.next({name:N,errors:r.errors})}):m.state.next({errors:{}})},pe=(x,I,N)=>{const $=(Q(n,x,{_f:{}})._f||{}).ref,V=Q(r.errors,x)||{},{ref:W,message:z,type:ne,...ge}=V;Ae(r.errors,x,{...ge,...I,ref:$}),m.state.next({name:x,errors:r.errors,isValid:!1}),N&&N.shouldFocus&&$&&$.focus&&$.focus()},oe=(x,I)=>vt(x)?m.state.subscribe({next:N=>"values"in N&&x(N.values||Y(void 0,I),N)}):Y(x,I,!0),We=x=>m.state.subscribe({next:I=>{if(RO(x.name,I.name,x.exact)&&kO(I,x.formState||f,ue,x.reRenderRoot)){const N={...i};x.callback({values:N,...r,...I,defaultValues:s})}}}).unsubscribe,xe=x=>(o.mount=!0,g={...g,...x.formState},We({...x,formState:{...u,...x.formState}})),Ge=(x,I={})=>{for(const N of x?Ci(x):a.mount)a.mount.delete(N),a.array.delete(N),I.keepValue||(Xe(n,N),Xe(i,N)),!I.keepError&&Xe(r.errors,N),!I.keepDirty&&Xe(r.dirtyFields,N),!I.keepTouched&&Xe(r.touchedFields,N),!I.keepIsValidating&&Xe(r.validatingFields,N),!t.shouldUnregister&&!I.keepDefaultValue&&Xe(s,N);m.state.next({values:ze(i)}),m.state.next({...r,...I.keepDirty?{isDirty:F()}:{}}),!I.keepIsValid&&y()},Qe=({disabled:x,name:I})=>{if(Pt(x)&&o.mount||x||a.disabled.has(I)){const V=a.disabled.has(I)!==!!x;x?a.disabled.add(I):a.disabled.delete(I),V&&o.mount&&!o.action&&y()}},Be=(x,I={})=>{let N=Q(n,x);const $=Pt(I.disabled)||Pt(t.disabled),V=!a.registerName.has(x)&&N&&N._f&&!N._f.mount;return Ae(n,x,{...N||{},_f:{...N&&N._f?N._f:{ref:{name:x}},name:x,mount:!0,...I}}),a.mount.add(x),N&&!V?Qe({disabled:Pt(I.disabled)?I.disabled:t.disabled,name:x}):j(x,!0,I.value),{...$?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:as(I.min),max:as(I.max),minLength:as(I.minLength),maxLength:as(I.maxLength),pattern:as(I.pattern)}:{},name:x,onChange:te,onBlur:te,ref:W=>{if(W){a.registerName.add(x),Be(x,I),a.registerName.delete(x),N=Q(n,x);const z=$e(W.value)&&W.querySelectorAll&&W.querySelectorAll("input,select,textarea")[0]||W,ne=EO(z),ge=N._f.refs||[];if(ne?ge.find(Ue=>Ue===z):z===N._f.ref)return;Ae(n,x,{_f:{...N._f,...ne?{refs:[...ge.filter(Uo),z,...Array.isArray(Q(s,x))?[{}]:[]],ref:{type:z.type,name:x}}:{ref:z}}}),j(x,!1,void 0,z)}else N=Q(n,x,{}),N._f&&(N._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(kh(a.array,x)&&o.action)&&a.unMount.add(x)}}},re=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&bs(n,U,a.mount),ke=x=>{Pt(x)&&(m.state.next({disabled:x}),bs(n,(I,N)=>{const $=Q(n,N);$&&(I.disabled=$._f.disabled||x,Array.isArray($._f.refs)&&$._f.refs.forEach(V=>{V.disabled=$._f.disabled||x}))},0,!1))},Le=(x,I)=>async N=>{let $;N&&(N.preventDefault&&N.preventDefault(),N.persist&&N.persist());let V=ze(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:W,values:z}=await T();v(),r.errors=W,V=ze(z)}else await A({fields:n,eventType:Ir.SUBMIT});if(a.disabled.size)for(const W of a.disabled)Xe(V,W);if(Xe(r.errors,Ah),nt(r.errors)){m.state.next({errors:{}});try{await x(V,N)}catch(W){$=W}}else I&&await I({...r.errors},N),re(),setTimeout(re);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nt(r.errors)&&!$,submitCount:r.submitCount+1,errors:r.errors}),$)throw $},Ye=(x,I={})=>{Q(n,x)&&($e(I.defaultValue)?q(x,ze(Q(s,x))):(q(x,I.defaultValue),Ae(s,x,ze(I.defaultValue))),I.keepTouched||Xe(r.touchedFields,x),I.keepDirty||(Xe(r.dirtyFields,x),r.isDirty=I.defaultValue?F(x,ze(Q(s,x))):F()),I.keepError||(Xe(r.errors,x),f.isValid&&y()),m.state.next({...r}))},ot=(x,I={})=>{const N=x?ze(x):s,$=ze(N),V=nt(x),W=$;if(I.keepDefaultValues||(s=N),!I.keepValues){if(I.keepDirtyValues){const z=new Set([...a.mount,...Object.keys(zr(s,i))]);for(const ne of Array.from(z)){const ge=Q(r.dirtyFields,ne),Ue=Q(i,ne),Ct=Q(W,ne);ge&&!$e(Ue)?Ae(W,ne,Ue):!ge&&!$e(Ct)&&q(ne,Ct)}}else{if(lo&&$e(x))for(const z of a.mount){const ne=Q(n,z);if(ne&&ne._f){const ge=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Fi(ge)){const Ue=ge.closest("form");if(Ue){Ue.reset();break}}}}if(I.keepFieldsRef)for(const z of a.mount)q(z,Q(W,z));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?ze(s):{},I.keepFieldsRef)for(const z of a.mount)Ae(i,z,Q(W,z))}else i=ze(W);m.array.next({values:{...W}}),m.state.next({values:{...W}})}a={mount:I.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!nt(W),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),m.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:V?!1:I.keepDirty?r.isDirty:I.keepValues?F():!!(I.keepDefaultValues&&!Mt(x,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:V?{}:I.keepDirtyValues?I.keepDefaultValues&&i?zr(s,i):r.dirtyFields:I.keepDefaultValues&&x?zr(s,x):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Lt=(x,I)=>ot(vt(x)?x(i):x,{...t.resetOptions,...I}),H=(x,I={})=>{const N=Q(n,x),$=N&&N._f;if($){const V=$.refs?$.refs[0]:$.ref;V.focus&&setTimeout(()=>{V.focus(),I.shouldSelect&&vt(V.select)&&V.select()})}},ue=x=>{r={...r,...x}},fr={control:{register:Be,unregister:Ge,getFieldState:le,handleSubmit:Le,setError:pe,_subscribe:We,_runSchema:T,_updateIsValidating:v,_focusError:re,_getWatch:Y,_getDirty:F,_setValid:y,_setFieldArray:S,_setDisabledField:Qe,_setErrors:C,_getFieldArray:se,_reset:ot,_resetDefaultValues:()=>vt(t.defaultValues)&&t.defaultValues().then(x=>{Lt(x,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:P,_disableForm:ke,_subjects:m,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(x){o=x},get _defaultValues(){return s},get _names(){return a},set _names(x){a=x},get _formState(){return r},get _options(){return t},set _options(x){t={...t,...x}}},subscribe:xe,trigger:Z,register:Be,handleSubmit:Le,watch:oe,setValue:q,setValues:J,getValues:K,reset:Lt,resetField:Ye,resetDefaultValues:(x,I={})=>{if(s=ze(x),!I.keepDirty){const N=zr(s,i);r.dirtyFields=N,r.isDirty=!nt(N)}I.keepIsValid||y(),m.state.next({...r,defaultValues:s})},clearErrors:ee,unregister:Ge,setError:pe,setFocus:H,getFieldState:le};return{...fr,formControl:fr}}function FO(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...ze(zh),isLoading:vt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:vt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!vt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=LO(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,_l(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!Mt(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(()=>Mh(s,o),[o,s]),t.current}async function Lu(e){var r,n;return(n=(r=(await Ne.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function $O(e){var r,n;return((n=(r=(await Ne.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function Hh(e,t){const r=$n({queryKey:["framework",e],queryFn:()=>Lu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=$n({queryKey:["framework",n],queryFn:()=>Lu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function BO(e,t,r){const n=e??[],s=new Set(n.map(u=>u.type).filter(Boolean)),i=(t??[]).filter(u=>!s.has(u)),{data:o}=$n({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>$O({type:i,systemDefault:"Yes"}),enabled:i.length>0,staleTime:10*60*1e3}),a=t&&t.length?n.filter(u=>u.type&&t.includes(u.type)):n,c=[...(o??[]).map(u=>({label:u.name,value:u.identifier})),...a.map(u=>({label:u.name,value:u.identifier}))],d=new Set;return c.filter(u=>d.has(u.value)?!1:(d.add(u.value),!0))}async function UO(e){var r,n;return(n=(r=(await Ne.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function VO(e){var r,n,s,i,o,a;const t=$n({queryKey:["channel",e],queryFn:()=>UO(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}function qO(e){const{data:t}=$n({queryKey:["user","read",e],enabled:!!e,staleTime:1/0,queryFn:()=>w_(e)});return t&&([t.firstName,t.lastName].filter(Boolean).join(" ").trim()||t.userName)||void 0}const zO={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Third Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."},"Sixth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},HO=new Set(["review","read","sourcingreview","orgreview"]),ni={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},WO={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},QO={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},Cl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Wh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function Qh(e,t,r,n,s={}){if(!(e!=null&&e.length))return aD(t,n,r);const i=new Map;for(const a of e){const c=a.code;c&&!i.has(c)&&i.set(c,a)}const o=new Set;return e.filter(a=>{if(n&&(a.code==="dialCode"||a.code==="dialcode")||a.visible===!1)return!1;const c=a.code;return o.has(c)?!1:(o.add(c),!0)}).map(a=>{const c=a.code??"",d=eD(a),u=tD(a,r,t,i,s),f=t[c],g=GO(c,Kh(f,d),d,t,s),m={code:c,label:a.label??c,inputType:d,required:!!(a.required===!0||Array.isArray(a.validations)&&a.validations.some(_=>_.type==="required")),editable:KO(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:ZO(u,g,d,r),depends:a.depends,tab:JO(a),section:a.section,defaultValue:a.defaultValue??a.default,currentValue:g};if(c==="dialcodes"){const _=t.dialcodeRequired==="Yes";return{...m,required:_,visible:_}}return m})}function KO(e,t,r){var i;const n=r.editorMode??"edit";if(!HO.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function GO(e,t,r,n,s){const i=t==null||t===""||Array.isArray(t)&&t.length===0;switch(e){case"license":return i?s.defaultLicense??"":t;case"copyright":return i&&s.channelName?s.channelName:t;case"copyrightYear":return i?String(new Date().getFullYear()):t;case"author":case"creator":return i&&s.userFullName?s.userFullName:t;case"instructions":{const o=n.instructions;return o&&typeof o=="object"&&!Array.isArray(o)?o.default??"":typeof t=="object"&&t!==null?"":t}case"maxTime":case"warningTime":{if(!i)return t;const o=n.timeLimits,a=o==null?void 0:o[e];return a!=null&&a!==""?YO(Number(a)):t}default:return t}}function YO(e){if(!Number.isFinite(e)||e<0)return"";const t=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),s=i=>String(i).padStart(2,"0");return n>0?`${s(n)}:${s(r)}:${s(t)}`:`${s(r)}:${s(t)}`}function XO(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 ZO(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=XO(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function JO(e){const t=e.section;if(t){if(ni[t])return ni[t];const n=WO[t];if(n&&ni[n])return ni[n]}const r=e.code??"";return QO[r]??"details"}function Kh(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 eD(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"?"select":t==="framework"||t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function tD(e,t,r,n,s){const i=e.code??"";if(i==="maxQuestions"){const d=s.childCount??0;if(d>0)return Array.from({length:d},(u,f)=>({label:String(f+1),value:String(f+1)}))}const o=e.range;if(Array.isArray(o)&&o.length)return typeof o[0]=="string"?o.map(d=>({label:d,value:d})):o.map(d=>({label:d.name,value:d.identifier}));const a=e.enum;if(a!=null&&a.length)return a.map(d=>({label:d,value:d}));if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories"){const u=(s.objectType??"")==="QuestionSet"?s.contentAdditionalCategories??s.collectionAdditionalCategories:s.collectionAdditionalCategories??s.contentAdditionalCategories,f=(u&&u.length?u:s.contextAdditionalCategories)??t.channelAdditionalCategories;return f!=null&&f.length?iD(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??Cl[i];if(c)return Gh(i,c,e,t,r,n)}function rD(e,t){return Wh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function nD(e,t){return Wh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function qo(e,t,r){var i,o,a,c,d;const n=(o=(i=e.organisationFramework)==null?void 0:i.categories)==null?void 0:o.find(u=>u.code===t),s=(d=(c=(a=e.targetFrameworks)==null?void 0:a[0])==null?void 0:c.categories)==null?void 0:d.find(u=>u.code===t);return r?(s==null?void 0:s.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(s==null?void 0:s.terms)??[]}function sD(e){const t=new Set,r=[];for(const n of e){const s=n.identifier??n.name;s&&!t.has(s)&&(t.add(s),r.push(n))}return r}function iD(e){return Array.from(new Set(e))}function oD(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function Gh(e,t,r,n,s,i){const o=rD(e,r),a=nD(e,r),c=h=>({label:h.name,value:o?h.identifier:h.name}),d=r.depends;if(!(d!=null&&d.length))return qo(n,t,a).map(c);const u=d.flatMap(h=>oD(s[h])).map(String);if(!u.length)return[];const f=[];for(const h of d){const y=i.get(h),v=(y==null?void 0:y.sourceCategory)??Cl[h]??h;f.push(...qo(n,v,a))}const m=f.filter(h=>u.includes(String(h.name))||u.includes(String(h.identifier))||u.includes(String(h.code))).flatMap(h=>h.associations??[]).filter(h=>String(h.category??"").toLowerCase()===t.toLowerCase()),_=sD(m);return _.length?_.map(c):qo(n,t,a).map(c)}function ls(e,t){const r=Cl[e];if(r)return Gh(e,r,{},t,{},new Map)}function lt(e,t,r){return Kh(e[t],r)}function aD(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:lt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:lt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:lt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:lt(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:lt(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:lt(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:ls("subjectIds",r),currentValue:lt(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:lt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:ls("targetBoardIds",r),currentValue:lt(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:ls("targetMediumIds",r),currentValue:lt(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:ls("targetGradeLevelIds",r),currentValue:lt(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:ls("targetSubjectIds",r),currentValue:lt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"license","select")})),n}const lD=["allowECM","levels","setPeriod","instances"];function Yh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function cD(e,t={}){const r={...e};for(const i of lD)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Yh(n)});const s=e.instances;return s!=null&&s!==""&&(r.instances={label:s}),t.isReview&&(r.name===void 0||r.name===null||r.name==="")&&t.nodeTitle&&(r.name=t.nodeTitle),r}function uD(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Yh(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function dD(e,t){const{watch:r,setValue:n}=e,s=p.useRef(!1);p.useEffect(()=>{const i=r((o,{name:a})=>{var c;if(!(!a||s.current)){s.current=!0;try{const d=new Set([a]);let u=!0;for(;u;){u=!1;for(const f of t)d.has(f.code)||(c=f.depends)!=null&&c.some(g=>d.has(g))&&(n(f.code,f.inputType==="multiselect"||f.inputType==="chips"?[]:"",{shouldDirty:!0}),d.add(f.code),u=!0)}}finally{s.current=!1}}});return()=>i.unsubscribe()},[r,n,t])}const fD="_section_ylgu8_1",hD="_header_ylgu8_11",pD="_title_ylgu8_17",gD="_description_ylgu8_24",mD="_divider_ylgu8_30",yD="_fields_ylgu8_36",Sn={section:fD,header:hD,title:pD,description:gD,divider:mD,fields:yD},vD=({title:e,description:t,children:r})=>l.jsxs("div",{className:Sn.section,children:[l.jsxs("div",{className:Sn.header,children:[l.jsx("h3",{className:Sn.title,children:e}),t&&l.jsx("p",{className:Sn.description,children:t})]}),l.jsx("hr",{className:Sn.divider}),l.jsx("div",{className:Sn.fields,children:r})]}),bD="_field_1s288_1",_D="_fullWidth_1s288_7",wD="_label_1s288_11",SD="_required_1s288_19",xD="_input_1s288_24",CD="_textarea_1s288_45",ED="_inputError_1s288_50",OD="_error_1s288_54",DD="_selectBtn_1s288_59",ID="_selectOpen_1s288_83",TD="_placeholder_1s288_87",ND="_selectedVal_1s288_91",jD="_chevronUp_1s288_95",kD="_dropdown_1s288_100",RD="_option_1s288_116",AD="_optionSelected_1s288_134",PD="_noOpts_1s288_139",MD="_chipGroup_1s288_146",LD="_chipInput_1s288_158",FD="_addChipBtn_1s288_167",$D="_radioGroup_1s288_184",BD="_radioLabel_1s288_191",UD="_iconWrap_1s288_199",VD="_iconPreview_1s288_214",qD="_iconPlaceholder_1s288_220",zD="_removeIconBtn_1s288_233",HD="_tagChip_1s288_252",WD="_tagChipRemove_1s288_264",QD="_nestedSelectRow_1s288_278",KD="_dialcodeRow_1s288_287",GD="_validateBtn_1s288_293",YD="_dialcodeValid_1s288_315",XD="_dialcodeSpinner_1s288_325",M={field:bD,fullWidth:_D,label:wD,required:SD,input:xD,textarea:CD,inputError:ED,error:OD,selectBtn:DD,selectOpen:ID,placeholder:TD,selectedVal:ND,chevronUp:jD,dropdown:kD,option:RD,optionSelected:AD,noOpts:PD,chipGroup:MD,chipInput:LD,addChipBtn:FD,radioGroup:$D,radioLabel:BD,iconWrap:UD,iconPreview:VD,iconPlaceholder:qD,removeIconBtn:zD,tagChip:HD,tagChipRemove:WD,nestedSelectRow:QD,dialcodeRow:KD,validateBtn:GD,dialcodeValid:YD,dialcodeSpinner:XD},Fu=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Jt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[M.field,s?M.fullWidth:""].join(" "),children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[M.input,M.textarea,d?M.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[M.input,d?M.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:M.error,children:String(d.message)})]})},ZD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Jt(),g=d(e),m=((h=r.find(y=>y.value===g))==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:M.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[M.selectBtn,_?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g?M.selectedVal:M.placeholder,children:m}),l.jsx(Bs,{size:14,className:i?M.chevronUp:""})]}),i&&l.jsxs("div",{className:M.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[M.option,g===y.value?M.optionSelected:""].join(" "),onClick:()=>{u(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),g===y.value&&l.jsx(Qn,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:M.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:M.error,children:String(_.message)})]})},JD=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Jt(),g=d(e)??[],m=f[e],_=g.length?`${g.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=g.includes(y)?g.filter(b=>b!==y):[...g,y];u(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:M.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[M.selectBtn,m?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g.length?M.selectedVal:M.placeholder,children:_}),l.jsx(Bs,{size:14,className:i?M.chevronUp:""})]}),i&&l.jsxs("div",{className:M.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[M.option,g.includes(y.value)?M.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Qn,{size:13,style:{opacity:g.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:M.noOpts,children:"No options"})]}),m&&l.jsx("span",{className:M.error,children:String(m.message)})]})},eI=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),d=p.useRef(null),{watch:u,setValue:f,formState:{errors:g}}=Jt(),m=u(e)??[],_=g[e],h=()=>{const v=i.trim();v&&!m.includes(v)&&f(e,[...m,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,m.filter(b=>b!==v),{shouldDirty:!0});return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:M.chipGroup,children:[m.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:M.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:M.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=d.current)==null?void 0:v.focus()},50)},children:[l.jsx(Us,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:M.error,children:String(_.message)})]})},tI=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Jt(),a=o[e];return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("div",{className:M.radioGroup,children:r.map(c=>l.jsxs("label",{className:M.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:M.error,children:String(a.message)})]})};async function rI(e,t,r,n){var o,a;const i=(a=(o=(await Ne.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function nI(e,t){var s,i;const n=(i=(s=(await Ne.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function sI(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function iI(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Ne.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const oI="_overlay_ga6eh_1",aI="_modal_ga6eh_12",lI="_header_ga6eh_24",cI="_title_ga6eh_33",uI="_closeBtn_ga6eh_39",dI="_tabs_ga6eh_57",fI="_tab_ga6eh_57",hI="_activeTab_ga6eh_83",pI="_body_ga6eh_88",gI="_searchWrap_ga6eh_99",mI="_searchIcon_ga6eh_104",yI="_searchInput_ga6eh_113",vI="_grid_ga6eh_132",bI="_imgCell_ga6eh_148",_I="_imgCellSelected_ga6eh_166",wI="_thumb_ga6eh_171",SI="_noThumb_ga6eh_177",xI="_checkBadge_ga6eh_183",CI="_loadMoreBtn_ga6eh_198",EI="_loadingRow_ga6eh_220",OI="_empty_ga6eh_230",DI="_spinner_ga6eh_237",II="_uploadArea_ga6eh_247",TI="_dropZone_ga6eh_256",NI="_uploadIcon_ga6eh_277",jI="_dropText_ga6eh_281",kI="_dropSubtext_ga6eh_288",RI="_uploadPreview_ga6eh_294",AI="_hiddenInput_ga6eh_301",PI="_fileName_ga6eh_305",MI="_errorText_ga6eh_311",LI="_footer_ga6eh_318",FI="_cancelBtn_ga6eh_328",$I="_confirmBtn_ga6eh_345",he={overlay:oI,modal:aI,header:lI,title:cI,closeBtn:uI,tabs:dI,tab:fI,activeTab:hI,body:pI,searchWrap:gI,searchIcon:mI,searchInput:yI,grid:vI,imgCell:bI,imgCellSelected:_I,thumb:wI,noThumb:SI,checkBadge:xI,loadMoreBtn:CI,loadingRow:EI,empty:OI,spinner:DI,uploadArea:II,dropZone:TI,uploadIcon:NI,dropText:jI,dropSubtext:kI,uploadPreview:RI,hiddenInput:AI,fileName:PI,errorText:MI,footer:LI,cancelBtn:FI,confirmBtn:$I},$u=18,Xh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,d]=p.useState([]),[u,f]=p.useState(0),[g,m]=p.useState(!1),[_,h]=p.useState(null),[y,v]=p.useState(0),[b,S]=p.useState(null),[w,C]=p.useState(""),[D,j]=p.useState(!1),[k,L]=p.useState(""),T=p.useRef(null),R=ae(U=>{var Z,K;return((K=(Z=U.editorConfig)==null?void 0:Z.context)==null?void 0:K.channel)??""}),B=ae(U=>{var Z,K;return((K=(Z=U.editorConfig)==null?void 0:Z.context)==null?void 0:K.uid)??""}),A=ae(U=>{var Z,K,le;return((le=(K=(Z=U.editorConfig)==null?void 0:Z.context)==null?void 0:K.cloudStorage)==null?void 0:le.presigned_headers)??{}}),P=ae(U=>{var Z,K,le;return((le=(K=(Z=U.editorConfig)==null?void 0:Z.config)==null?void 0:K.assetConfig)==null?void 0:le.size)??1*1024*1024}),F=ae(U=>{var Z,K,le;return((le=(K=(Z=U.editorConfig)==null?void 0:Z.config)==null?void 0:K.assetConfig)==null?void 0:le.accepted)??"image/png,image/jpeg"}),Y=p.useCallback(async(U,Z,K=!1)=>{var le;m(!0);try{const ee={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&B&&(ee.createdBy=B),R&&(ee.channel=R);const oe=((le=(await Ne.post("/action/composite/v3/search",{request:{filters:ee,query:U,limit:$u,offset:Z,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:le.result)??{},We=oe.content??[];f(oe.count??0),d(xe=>K?[...xe,...We]:We)}catch{}finally{m(!1)}},[s,B,R]);p.useEffect(()=>{s!=="upload"&&(d([]),v(0),Y(o,0))},[s]);const se=p.useRef(),Ce=U=>{a(U),clearTimeout(se.current),se.current=setTimeout(()=>{d([]),v(0),Y(U,0)},400)},ve=()=>{const U=y+$u;v(U),Y(o,U,!0)},me=()=>{const U=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";U&&r(U)};p.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const q=U=>{var le;const Z=(le=U.target.files)==null?void 0:le[0];if(U.target.value="",!Z)return;const K=F.split(",").map(ee=>ee.trim());if(!K.includes(Z.type)){const ee=K.map(pe=>pe.replace("image/","").toUpperCase()).join(", ");L(`Only ${ee} files are accepted.`);return}if(Z.size>P){const ee=(P/1048576).toFixed(0);L(`Image must be under ${ee} MB.`);return}w&&URL.revokeObjectURL(w),S(Z),C(URL.createObjectURL(Z)),L("")},J=async()=>{if(b){j(!0),L("");try{const U=await rI(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,B,R),Z=await nI(U,b.name);await sI(Z,b,A);const K=Z.split("?")[0],le=await iI(U,K,b.type);r(le)}catch(U){L(U instanceof Error?U.message:"Upload failed.")}finally{j(!1)}}},te=c.length<u;return l.jsx("div",{className:he.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:he.modal,children:[l.jsxs("div",{className:he.header,children:[l.jsx("span",{className:he.title,children:"Select App Icon"}),l.jsx("button",{className:he.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(dn,{size:18})})]}),l.jsxs("div",{className:he.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${he.tab} ${s==="my"?he.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${he.tab} ${s==="all"?he.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${he.tab} ${s==="upload"?he.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Jl,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:he.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:he.searchWrap,children:[l.jsx(ha,{size:14,className:he.searchIcon}),l.jsx("input",{type:"search",className:he.searchInput,placeholder:"Search images…",value:o,onChange:U=>Ce(U.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:he.loadingRow,children:[l.jsx(di,{size:20,className:he.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:he.empty,children:"No images found"}):l.jsx("div",{className:he.grid,children:c.map(U=>{const Z=U.appIcon??U.artifactUrl??U.downloadUrl??"",K=(_==null?void 0:_.identifier)===U.identifier;return l.jsxs("button",{type:"button",className:`${he.imgCell} ${K?he.imgCellSelected:""}`,onClick:()=>h(U),title:U.name,children:[Z?l.jsx("img",{src:Z,alt:U.name,className:he.thumb}):l.jsx("div",{className:he.noThumb,children:"IMG"}),K&&l.jsx("div",{className:he.checkBadge,children:l.jsx(Qn,{size:12})})]},U.identifier)})}),te&&!g&&l.jsx("button",{className:he.loadMoreBtn,onClick:ve,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:he.loadingRow,children:l.jsx(di,{size:16,className:he.spinner})})]}):l.jsxs("div",{className:he.uploadArea,children:[l.jsx("div",{className:he.dropZone,onClick:()=>{var U;return(U=T.current)==null?void 0:U.click()},onDragOver:U=>U.preventDefault(),onDrop:U=>{U.preventDefault();const Z=U.dataTransfer.files[0];Z&&q({target:{files:[Z],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:he.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Jl,{size:32,className:he.uploadIcon}),l.jsx("p",{className:he.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:he.dropSubtext,children:[F.split(",").map(U=>U.replace("image/","").toUpperCase()).join(", ")," · max ",(P/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:T,type:"file",accept:F,className:he.hiddenInput,onChange:q}),b&&l.jsx("p",{className:he.fileName,children:b.name}),k&&l.jsx("p",{className:he.errorText,children:k})]})}),l.jsxs("div",{className:he.footer,children:[l.jsx("button",{className:he.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:he.confirmBtn,disabled:!b||D,onClick:J,children:D?l.jsxs(l.Fragment,{children:[l.jsx(di,{size:14,className:he.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:he.confirmBtn,disabled:!_,onClick:me,children:"Use Selected"})]})]})})},BI=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Jt(),f=a(e),g=u[e],m=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:M.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:M.iconPreview}):l.jsxs("div",{className:M.iconPlaceholder,children:[l.jsx(tf,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:M.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(Za,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:M.error,children:String(g.message)}),i&&l.jsx(Xh,{nodeId:r,currentValue:f,onSelect:m,onClose:()=>o(!1)})]})},UI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Jt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[M.input,o?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:M.error,children:String(o.message)})]})},VI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Jt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),d=p.useRef(null),u=i.value??[],f=h=>{const y=h.trim();!y||u.includes(y)||i.onChange([...u,y])},g=h=>{i.onChange(u.filter(y=>y!==h))},m=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&u.length>0&&g(u[u.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:[M.chipGroup,o?M.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=d.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(h=>l.jsxs("span",{className:M.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:M.tagChipRemove,onClick:y=>{y.stopPropagation(),g(h)},"aria-label":`Remove ${h}`,children:l.jsx(dn,{size:11})})]},h)),!n&&l.jsx("input",{ref:d,className:M.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:m,onBlur:_,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:M.error,children:String(o.message)})]})},qI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Jt(),{field:o,fieldState:{error:a}}=uo({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,g)=>{const m={};for(let _=0;_<f;_++)m[r[_].code]=c[r[_].code]??"";m[u]=g;for(let _=f+1;_<r.length;_++)m[r[_].code]="";o.onChange(m)};return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("div",{className:M.nestedSelectRow,children:r.map((u,f)=>{const g=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:M.field,style:{flex:1},children:[l.jsx("label",{className:M.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[M.input,a?M.inputError:""].join(" "),disabled:s||g,value:c[u.code]??"",onChange:m=>d(u.code,f,m.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(m=>l.jsx("option",{value:m.value,children:m.label},m.value))]})]},u.code)})}),a&&l.jsx("span",{className:M.error,children:String(a.message)})]})},Bu=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],zI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Jt(),f=c(e),g=Bu.find(h=>h.value===f),m=(g==null?void 0:g.label)??"Select license…",_=u[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:M.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[M.selectBtn,_?M.inputError:"",s?M.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?M.selectedVal:M.placeholder,children:m}),l.jsx(Bs,{size:14,className:s?M.chevronUp:""})]}),s&&l.jsx("div",{className:M.dropdown,role:"listbox",children:Bu.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[M.option,f===h.value?M.optionSelected:""].join(" "),onClick:()=>{d(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Qn,{size:13})]},h.value))}),_&&l.jsx("span",{className:M.error,children:String(_.message)})]})},HI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Jt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[d,u]=p.useState(""),f=async()=>{const m=(i.value??"").trim();if(!m){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const _=await sw(m),h=_==null?void 0:_.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},g=()=>a==="loading"?l.jsx(di,{size:16,className:M.dialcodeSpinner}):a==="valid"?l.jsx(Xd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(Cy,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:M.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[M.input,o?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:m=>{i.onChange(m),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:M.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),g()]}),o&&l.jsx("span",{className:M.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?M.dialcodeValid:M.error,children:d})]})},WI="_form_szqex_1",QI="_ungrouped_szqex_7",KI="_noFields_szqex_18",zo={form:WI,ungrouped:QI,noFields:KI},GI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var Ge,Qe,Be,re,ke,Le,Ye,ot,Lt;const a=ae(H=>H.editorConfig),c=ae(H=>H.rootFormConfig),d=ae(H=>H.unitFormConfig),u=ae(H=>H.categoryMeta),f=ae(H=>H.contentFramework),g=ae(H=>H.contentTargetFWIds),{organisationFramework:m,targetFrameworks:_,isLoading:h}=Hh(f??((Ge=a==null?void 0:a.context)==null?void 0:Ge.framework),g??((Qe=a==null?void 0:a.context)==null?void 0:Qe.targetFWIds)),{frameworks:y,collectionAdditionalCategories:v,contentAdditionalCategories:b,defaultLicense:S,name:w}=VO((Be=a==null?void 0:a.context)==null?void 0:Be.channel),C=qO(((re=a==null?void 0:a.context)==null?void 0:re.userId)??((ke=a==null?void 0:a.context)==null?void 0:ke.uid)),D=BO(y,(Le=u==null?void 0:u.frameworkMetadata)==null?void 0:Le.orgFWType,(Ye=a==null?void 0:a.context)==null?void 0:Ye.channel),j={organisationFramework:m,targetFrameworks:_,orgFrameworks:D,channelAdditionalCategories:v},k=De(H=>H.selectedNodeId),L=De(H=>H.treeData),T=De(H=>H.treeCache),R=k?T[k]??{}:{},B={...e,...R},A=p.useMemo(()=>{var ue;if(!k)return 0;const H=[...L];for(;H.length;){const ye=H.shift();if(ye.id===k)return((ue=ye.children)==null?void 0:ue.length)??0;ye.children&&H.push(...ye.children)}return 0},[L,k]),P=(a==null?void 0:a.config)??{},F=(a==null?void 0:a.context)??{},Y={editorMode:s,editableFields:P.editableFields,objectType:P.objectType,setDefaultCopyRight:P.setDefaultCopyRight===!0,defaultLicense:F.defaultLicense??S,contextAdditionalCategories:F.additionalCategories,userFullName:((ot=F.user)==null?void 0:ot.fullName)??C,channelName:w,collectionAdditionalCategories:v,contentAdditionalCategories:b,childCount:A},se=r?c:d,Ce=se||(((Lt=a==null?void 0:a.config.hierarchy)==null?void 0:Lt.formConfig)??[]),ve=Qh(Ce,B,j,r,Y),me=ve.filter(H=>H.tab===t&&H.inputType!=="appIcon"&&H.visible!==!1),q=FO({mode:"onChange",defaultValues:Object.fromEntries(ve.map(H=>{const ue=["multiselect","chips","keywords","tagsinput"],ye=["nestedselect"];return ue.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??[]]:ye.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??{}]:[H.code,H.currentValue??H.defaultValue??""]}))});dD(q,ve);const{updateNode:J}=De(),te=p.useRef(ve);te.current=ve;const U=p.useRef(k);U.current=k;const Z=p.useRef(i);Z.current=i;const K=p.useRef(o);K.current=o;const le=p.useRef(typeof B.shuffle=="boolean"?B.shuffle:void 0),ee=p.useRef(B.name??"");ee.current=B.name??"";const pe=p.useRef(s);pe.current=s;const oe=["review","read","sourcingreview","orgreview"];p.useEffect(()=>{const H=U.current;if(H){const ue=Object.fromEntries(te.current.filter(ye=>ye.currentValue!==void 0&&ye.currentValue!==null).map(ye=>[ye.code,ye.currentValue]));Object.keys(ue).length>0&&J(H,ue)}q.trigger().then(()=>{const ue=q.formState.errors,ye=te.current,er=Array.from(new Set(Object.keys(ue).map(fr=>{var x;return(x=ye.find(I=>I.code===fr))==null?void 0:x.tab}).filter(Boolean)));K.current(Object.keys(ue).length===0,er)})},[]),p.useEffect(()=>{const H=q.watch((ue,{name:ye})=>{const er=U.current;if(!er)return;const fr=te.current,x=new Set(fr.map($=>$.code));if(ye&&x.has(ye)){let $=q.getValues(ye);ye==="dialcodes"&&($=Array.isArray($)?$:$?[$]:[]),ye==="shuffle"&&($===!0&&le.current===!1&&Ee("Shuffling is enabled for this question set.",{icon:"ℹ️"}),le.current=$);const V=uD(ye,$);V&&(J(er,V),Z.current(V))}else if(!ye){const $=q.getValues(),V=Object.fromEntries(Object.entries($).filter(([z])=>x.has(z))),W=cD(V,{isReview:oe.includes(pe.current),nodeTitle:ee.current});Object.keys(W).length>0&&(J(er,W),Z.current(W))}const I=q.formState.errors,N=Array.from(new Set(Object.keys(I).map($=>{var V;return(V=fr.find(W=>W.code===$))==null?void 0:V.tab}).filter(Boolean)));K.current(Object.keys(I).length===0,N)});return()=>H.unsubscribe()},[q]),p.useEffect(()=>{for(const H of["author","creator","copyright","copyrightYear","license"]){const ue=te.current.find(er=>er.code===H);if(!ue||ue.currentValue===void 0||ue.currentValue===null||ue.currentValue==="")continue;const ye=q.getValues(H);(ye==null||ye==="")&&q.setValue(H,ue.currentValue,{shouldDirty:!1})}},[C,w,q]);const We=me.reduce((H,ue)=>{const ye=H[H.length-1];return ye&&ye.section===ue.section?ye.fields.push(ue):H.push({section:ue.section,fields:[ue]}),H},[]),xe=H=>{const ue={key:H.code,name:H.code,label:H.label,required:H.required,disabled:H.editable===!1};switch(H.inputType){case"textarea":return l.jsx(Fu,{...ue,multiline:!0,maxLength:H.maxLength});case"select":return l.jsx(ZD,{...ue,options:H.options??[]});case"multiselect":return l.jsx(JD,{...ue,options:H.options??[]});case"chips":return l.jsx(eI,{...ue});case"radio":return l.jsx(tI,{...ue,options:H.options??[]});case"appIcon":return l.jsx(BI,{...ue,nodeId:k??""});case"datepicker":case"datetime":return l.jsx(UI,{...ue});case"keywords":case"tagsinput":return l.jsx(VI,{...ue});case"nestedselect":return l.jsx(qI,{...ue,levels:H.levels??[]});case"license":return l.jsx(zI,{...ue});case"dialcode":return l.jsx(HI,{...ue});default:return l.jsx(Fu,{...ue,maxLength:H.maxLength})}};return l.jsx(xO,{...q,children:l.jsxs("div",{className:zo.form,children:[We.map((H,ue)=>{const ye=H.section?zO[H.section]:void 0;return ye?l.jsx(vD,{title:ye.title,description:ye.description,children:H.fields.map(xe)},H.section??ue):l.jsx("div",{className:zo.ungrouped,children:H.fields.map(xe)},ue)}),me.length===0&&!h&&l.jsx("p",{className:zo.noFields,children:"No fields configured for this tab."})]})})};function Zh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function YI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function si(e){return e!==null&&e>=0}function XI(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 ZI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Jh=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Zh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},ii={scaleX:1,scaleY:1},JI=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...ii}:null}const c=eT(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...ii}:s<r&&s>=o?{x:0,y:a.height+c,...ii}:{x:0,y:0,...ii}};function eT(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 ep="Sortable",tp=p.createContext({activeIndex:-1,containerId:ep,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Jh,disabled:{draggable:!1,droppable:!1}});function tT(e){let{children:t,id:r,items:n,strategy:s=Jh,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=Kd(),f=Fs(ep,r),g=a.rect!==null,m=p.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),_=o!=null,h=o?m.indexOf(o.id):-1,y=d?m.indexOf(d.id):-1,v=p.useRef(m),b=!XI(m,v.current),S=y!==-1&&h===-1||b,w=ZI(i);Yt(()=>{b&&_&&u(m)},[b,m,_,u]),p.useEffect(()=>{v.current=m},[m]);const C=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:S,items:m,overIndex:y,useDragOverlay:g,sortedRects:YI(m,c),strategy:s}),[h,f,w.draggable,w.droppable,S,m,y,c,g,s]);return p.createElement(tp.Provider,{value:C},t)}const rT=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Zh(r,n,s).indexOf(t)},nT=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},sT={duration:200,easing:"ease"},rp="transform",iT=$r.Transition.toString({property:rp,duration:0,easing:"linear"}),oT={roleDescription:"sortable"};function aT(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Yt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=Wn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),p.useEffect(()=>{i&&o(null)},[i]),i}function lT(e){let{animateLayoutChanges:t=nT,attributes:r,disabled:n,data:s,getNewIndex:i=rT,id:o,strategy:a,resizeObserverConfig:c,transition:d=sT}=e;const{items:u,containerId:f,activeIndex:g,disabled:m,disableTransforms:_,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=p.useContext(tp),S=cT(n,m),w=u.indexOf(o),C=p.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),D=p.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:j,node:k,isOver:L,setNodeRef:T}=ny({id:o,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:R,activatorEvent:B,activeNodeRect:A,attributes:P,setNodeRef:F,listeners:Y,isDragging:se,over:Ce,setActivatorNodeRef:ve,transform:me}=Qd({id:o,data:C,attributes:{...oT,...r},disabled:S.draggable}),q=Vg(T,F),J=!!R,te=J&&!_&&si(g)&&si(y),U=!v&&se,Z=U&&te?me:null,le=te?Z??(a??b)({rects:h,activeNodeRect:A,activeIndex:g,overIndex:y,index:w}):null,ee=si(g)&&si(y)?i({id:o,items:u,activeIndex:g,overIndex:y}):w,pe=R==null?void 0:R.id,oe=p.useRef({activeId:pe,items:u,newIndex:ee,containerId:f}),We=u!==oe.current.items,xe=t({active:R,containerId:f,isDragging:se,isSorting:J,id:o,index:w,items:u,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:d,wasDragging:oe.current.activeId!=null}),Ge=aT({disabled:!xe,index:w,node:k,rect:j});return p.useEffect(()=>{J&&oe.current.newIndex!==ee&&(oe.current.newIndex=ee),f!==oe.current.containerId&&(oe.current.containerId=f),u!==oe.current.items&&(oe.current.items=u)},[J,ee,f,u]),p.useEffect(()=>{if(pe===oe.current.activeId)return;if(pe&&!oe.current.activeId){oe.current.activeId=pe;return}const Be=setTimeout(()=>{oe.current.activeId=pe},50);return()=>clearTimeout(Be)},[pe]),{active:R,activeIndex:g,attributes:P,data:C,rect:j,index:w,newIndex:ee,items:u,isOver:L,isSorting:J,isDragging:se,listeners:Y,node:k,overIndex:y,over:Ce,setNodeRef:q,setActivatorNodeRef:ve,setDroppableNodeRef:T,setDraggableNodeRef:F,transform:Ge??le,transition:Qe()};function Qe(){if(Ge||We&&oe.current.newIndex===w)return iT;if(!(U&&!Qi(B)||!d)&&(J||xe))return $r.Transition.toString({...d,property:rp})}}function cT(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function Bi(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const uT=[Se.Down,Se.Right,Se.Up,Se.Left],dT=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(uT.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const g=s.get(f.id);if(g)switch(e.code){case Se.Down:n.top<g.top&&c.push(f);break;case Se.Up:n.top>g.top&&c.push(f);break;case Se.Left:n.left>g.left&&c.push(f);break;case Se.Right:n.left<g.left&&c.push(f);break}});const d=im({collisionRect:n,droppableRects:s,droppableContainers:c});let u=Nd(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),g=i.get(u),m=g?s.get(g.id):null,_=g==null?void 0:g.node.current;if(_&&m&&f&&g){const y=Ki(_).some((D,j)=>a[j]!==D),v=np(f,g),b=fT(f,g),S=y||!v?{x:0,y:0}:{x:b?n.width-m.width:0,y:b?n.height-m.height:0},w={x:m.left,y:m.top};return S.x&&S.y?w:Cs(w,S)}}}};function np(e,t){return!Bi(e)||!Bi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function fT(e,t){return!Bi(e)||!Bi(t)||!np(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const hT="_row_11nth_1",pT="_removeBtn_11nth_14",gT="_grip_11nth_17",mT="_ctIcon_11nth_34",yT="_info_11nth_38",vT="_name_11nth_46",bT="_meta_11nth_55",Vr={row:hT,removeBtn:pT,grip:gT,ctIcon:mT,info:yT,name:vT,meta:bT},_T={video:Ja,pdf:Ka,h5p:Ga,scorm:Xa,audio:Ya,quiz:Qa,default:Kn},wT=({item:e,onRemove:t,isEditable:r})=>{const n=ao(e),s=_T[n.key]??Kn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=lT({id:e.id,disabled:!r}),f={transform:$r.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Vr.row,role:"listitem",children:[r&&l.jsx("span",{className:Vr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(ef,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Vr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Vr.info,children:[l.jsx("span",{className:Vr.name,title:e.name,children:e.name}),l.jsx("span",{className:Vr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Vr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(dn,{size:14})})]})},ST="_container_lzvke_1",xT="_header_lzvke_7",CT="_heading_lzvke_13",ET="_count_lzvke_21",OT="_list_lzvke_30",DT="_emptyState_lzvke_36",IT="_addRow_lzvke_52",qr={container:ST,header:xT,heading:CT,count:ET,list:OT,emptyState:DT,addRow:IT},TT=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=De(),i=t?r(t):[],o=e==="edit",a=Dd(ca(Gi,{activationConstraint:{distance:5}}),ca(za,{coordinateGetter:dT})),c=p.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const m=De.getState().getChildrenOf(t),_=m.findIndex(y=>y.id===f.id),h=m.findIndex(y=>y.id===g.id);_<0||h<0||n(t,_,h)},[t,n]),d=p.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:qr.container,children:[l.jsxs("div",{className:qr.header,children:[l.jsx("span",{className:qr.heading,children:"Content in this unit"}),l.jsx("span",{className:qr.count,children:i.length})]}),i.length>0?l.jsx(Wd,{sensors:a,collisionDetection:sm,onDragEnd:c,children:l.jsx(tT,{items:i.map(u=>u.id),strategy:JI,children:l.jsx("div",{className:qr.list,role:"list",children:i.map(u=>l.jsx(wT,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:qr.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:qr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(Us,{size:14})," Add content"]})]}):null},NT="_dropZone_ijo5w_1",jT="_active_ijo5w_14",Uu={dropZone:NT,active:jT},kT=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Uu.dropZone} ${e?Uu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function RT(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Ne.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function AT(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Vu="application/vnd.sunbird.question";function qu(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function sp(e,t,r){if(!e)return null;if(e.identifier===t)return{question:e,parent:r};for(const n of e.children??[]){const s=sp(n,t,e);if(s)return s}return null}function PT(e,t){const r=sp(e,t);if(!r)return null;const{question:n,parent:s}=r,i={...e,children:[n],childNodes:[t],shuffle:s==null?void 0:s.shuffle,showSolutions:(s==null?void 0:s.showSolutions)??"No",showFeedback:(s==null?void 0:s.showFeedback)??"No"};return(s==null?void 0:s.shuffle)===!0?i.maxScore=1:n.qType==="SA"?delete i.maxScore:n.maxScore!=null&&(i.maxScore=n.maxScore),i}function MT(e,t){const r=((t==null?void 0:t.enabled)??!0)&&!!e;return $n({queryKey:["quml","questionset",e],enabled:r,queryFn:async()=>{const n=await Lf(e),s=u=>{if(!u)return[];const f=u.mimeType===Vu&&u.identifier?[u.identifier]:[],g=(u.children??[]).flatMap(s);return[...f,...g]},i=s(n),o=new Map;i.length&&(await S_(i)).forEach(f=>{const g=f.identifier;g&&o.set(g,f)});const a=u=>{if(!u)return u;if(u.mimeType===Vu&&u.identifier){const f=o.get(u.identifier)??u,g=f.outcomeDeclaration;return g!=null&&g.maxScore||(f.outcomeDeclaration={...g??{},maxScore:qu(f)}),f}return Array.isArray(u.children)&&(u.children=u.children.map(f=>a(f))),u},c=a(n),d=c.outcomeDeclaration;return d!=null&&d.maxScore||(c.outcomeDeclaration={...d??{},maxScore:qu(c)}),c}})}const zu="/assets/quml-player/sunbird-quml-player.js",LT="/assets/quml-player/styles.css",Hu="sunbird-quml-player";function FT(e){const t=e.children??[];return t.length?t.every(n=>n.objectType==="Question")?[e]:t:[]}const tt=class tt{constructor(){ts(this,"eventHandlers",new WeakMap)}loadScript(){return tt.scriptLoaded||customElements.get(Hu)?(tt.scriptLoaded=!0,Promise.resolve()):(tt.scriptLoading||(tt.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=zu,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{tt.scriptLoaded=!0,tt.scriptLoading=void 0,t()},n.onerror=()=>{tt.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${zu}`))},document.body.appendChild(n)})),tt.scriptLoading)}loadStyles(){if(tt.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){tt.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=LT,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),tt.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),tt.stylesLoaded=!1}async createConfig(t,r,n){var i,o,a;return await this.loadScript(),{context:{mode:(n==null?void 0:n.mode)??"play",host:"",pdata:{id:((i=r==null?void 0:r.pdata)==null?void 0:i.id)??"sunbird.portal",ver:((o=r==null?void 0:r.pdata)==null?void 0:o.ver)??"1.0",pid:((a=r==null?void 0:r.pdata)==null?void 0:a.pid)??"sunbird-portal"},contentId:t.identifier??"",sid:(r==null?void 0:r.sid)??"",uid:(r==null?void 0:r.uid)??(r==null?void 0:r.userId)??"",channel:(r==null?void 0:r.channel)??"",did:(r==null?void 0:r.did)??"",tags:(r==null?void 0:r.tags)??[],contextRollup:(n==null?void 0:n.contextRollup)??(r==null?void 0:r.rollup)??{},objectRollup:(n==null?void 0:n.objectRollup)??{},...n!=null&&n.cdata?{cdata:n.cdata}:{}},config:{language:"en"},data:{sections:FT(t),identifier:t.identifier??""},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(Hu);return r.setAttribute("player-config",JSON.stringify(t)),r.setAttribute("data-player-id",t.metadata.identifier??"quml"),r}attachEventListeners(t,r,n){this.removeEventListeners(t);const s=o=>r==null?void 0:r(o),i=o=>n==null?void 0:n(o.detail);t.addEventListener("playerEvent",s),t.addEventListener("telemetryEvent",i),this.eventHandlers.set(t,{player:s,telemetry:i})}removeEventListeners(t){const r=this.eventHandlers.get(t);r&&(t.removeEventListener("playerEvent",r.player),t.removeEventListener("telemetryEvent",r.telemetry),this.eventHandlers.delete(t))}};ts(tt,"scriptLoaded",!1),ts(tt,"scriptLoading"),ts(tt,"stylesLoaded",!1);let Ui=tt;const oi=new Ui,$T="_contentPlayerRoot_r6xk8_1",BT="_flowLayout_r6xk8_9",UT="_stage_r6xk8_13",VT="_aspectRatio_r6xk8_16",qT="_playerHeader_r6xk8_32",zT="_playerHeaderThumb_r6xk8_46",HT="_playerHeaderTitle_r6xk8_56",WT="_typeBadge_r6xk8_66",QT="_typeDot_r6xk8_105",KT="_playerFrame_r6xk8_125",GT="_coverOverlay_r6xk8_133",YT="_coverHidden_r6xk8_145",XT="_coverThumb_r6xk8_150",ZT="_coverPlayRing_r6xk8_159",JT="_coverPlayIcon_r6xk8_172",eN="_coverLabel_r6xk8_181",tN="_coverSkeleton_r6xk8_187",rN="_playerWrapper_r6xk8_213",nN="_infoStrip_r6xk8_223",sN="_infoChip_r6xk8_239",iN="_infoChipLabel_r6xk8_258",oN="_infoChipIcon_r6xk8_267",aN="_playerError_r6xk8_273",lN="_playerErrorIcon_r6xk8_287",cN="_playerErrorMsg_r6xk8_292",uN="_qumlRoot_r6xk8_299",Pe={contentPlayerRoot:$T,flowLayout:BT,stage:UT,aspectRatio:VT,playerHeader:qT,playerHeaderThumb:zT,playerHeaderTitle:HT,typeBadge:WT,typeDot:QT,playerFrame:KT,coverOverlay:GT,coverHidden:YT,coverThumb:XT,coverPlayRing:ZT,coverPlayIcon:JT,coverLabel:eN,coverSkeleton:tN,playerWrapper:rN,infoStrip:nN,infoChip:sN,infoChipLabel:iN,infoChipIcon:oN,playerError:aN,playerErrorIcon:lN,playerErrorMsg:cN,qumlRoot:uN},dN="application/vnd.sunbird.questionset";function fN(e,t){const r=new Map,n=i=>{for(const o of i)r.set(o.id,o),o.children&&n(o.children)};n(e);let s=r.get(t);for(;s;){if(s.mimeType===dN)return s.identifier;s=s.parent?r.get(s.parent):void 0}return null}const hN=[{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 pN(e){return hN.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const gN={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},mN={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},yN={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},vN="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Ho(e){for(const[t,r]of Object.entries(gN))if(r.includes(e))return t;return"default-player"}function bN(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 _N(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 wN(e,t,r=100){await _N(mN[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 SN=[{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 xN({node:e}){const t=e.metadata??{},r=SN.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:Pe.infoStrip,children:r.map(n=>l.jsxs("div",{className:Pe.infoChip,children:[n.icon&&l.jsx("span",{className:Pe.infoChipIcon,children:n.icon}),l.jsx("span",{className:Pe.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function ip({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Pe.coverOverlay} ${t?Pe.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Pe.coverThumb}),l.jsx("div",{className:Pe.coverPlayRing,children:l.jsx("div",{className:Pe.coverPlayIcon})}),l.jsx("span",{className:Pe.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Pe.coverSkeleton})})}function op({message:e}){return l.jsxs("div",{className:Pe.playerError,children:[l.jsx("span",{className:Pe.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Pe.playerErrorMsg,children:e})]})}function CN({mimeType:e}){const t=pN(e);return l.jsxs("span",{className:Pe.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Pe.typeDot}),t.label]})}const Ma=({node:e,editorMode:t,type:r,singleQuestion:n,layout:s="fill"})=>{var o;if(r==="quml")return l.jsx(ON,{node:e,editorMode:t,singleQuestion:!!n});const i=e.appIcon??((o=e.metadata)==null?void 0:o.appIcon);return l.jsxs("div",{className:`${Pe.contentPlayerRoot} ${s==="flow"?Pe.flowLayout:""}`,children:[l.jsxs("div",{className:Pe.stage,children:[l.jsxs("div",{className:Pe.playerHeader,children:[i&&l.jsx("img",{src:i,alt:"",className:Pe.playerHeaderThumb}),l.jsx("span",{className:Pe.playerHeaderTitle,children:e.name}),l.jsx(CN,{mimeType:e.mimeType??""})]}),l.jsx(EN,{node:e})]}),l.jsx(xN,{node:e})]})};function EN({node:e}){var y;const t=ae(v=>v.editorConfig),[r,n]=p.useState(()=>Ho(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,d]=p.useState(e.metadata??{}),[u,f]=p.useState(!1),g=p.useRef(null),m=p.useRef(null),_=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??vN;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(Ho(e.mimeType??"")),AT(e.identifier).then(b=>{if(v)return;const S={...e.metadata??{},...b};d(S);const w=b.mimeType??e.mimeType??"";n(Ho(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=bN(e,c,t);return p.useEffect(()=>{if(!u||r!=="default-player")return;const v=g.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.")}},S=()=>a("Preview player could not be loaded.");return v.addEventListener("load",b),v.addEventListener("error",S),()=>{v.removeEventListener("load",b),v.removeEventListener("error",S),v.src=""}},[e.identifier,r,_,u]),p.useEffect(()=>{if(!u||r==="default-player")return;const v=m.current;if(!v)return;const b=yN[r];if(!b)return;const S=h;wN(b,r).then(()=>{if(!m.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(S)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=S}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Pe.aspectRatio,children:[o?l.jsx(op,{message:o}):l.jsx(ip,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:Pe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:m,className:Pe.playerFrame})]})}function ON({node:e,editorMode:t,singleQuestion:r}){const n=ae(g=>g.editorConfig),s=De(g=>g.treeData),i=p.useRef(null),o=r?fN(s,e.id):e.identifier,{data:a,isLoading:c,error:d}=MT(o??"",{enabled:!!o}),u=p.useMemo(()=>a?r?PT(a,e.identifier):a:null,[a,r,e.identifier]);p.useEffect(()=>{const g=i.current;if(!g||!u)return;let m=null,_=!1;return(async()=>{try{const h=await oi.createConfig(u,n==null?void 0:n.context,{mode:t==="edit"?"edit":"play"});if(_||!i.current)return;const y=oi.createElement(h);m=y,oi.attachEventListeners(y,v=>console.debug("[QumlPlayer] playerEvent",v.detail),v=>console.debug("[QumlPlayer] telemetryEvent",v)),g.innerHTML="",g.appendChild(y)}catch(h){console.error("[QumlPlayer] failed to initialize",h)}})(),()=>{_=!0,m&&(oi.removeEventListeners(m),m.remove()),Ui.unloadStyles()}},[u,n,t,r]);const f=d?`Unable to load questionset: ${d.message}`:r&&!o?"Could not resolve the parent questionset for this question.":r&&a&&!u?"Question not found in the questionset.":null;return l.jsxs("div",{className:Pe.qumlRoot,children:[f?l.jsx(op,{message:f}):c||!u?l.jsx(ip,{node:e,hidden:!1}):null,l.jsx("div",{ref:i,className:Pe.playerWrapper})]})}const DN="_overlay_ifddx_1",IN="_modal_ifddx_11",TN="_header_ifddx_21",NN="_body_ifddx_37",jN="_hint_ifddx_43",kN="_list_ifddx_49",RN="_item_ifddx_55",AN="_selected_ifddx_68",PN="_empty_ifddx_73",MN="_footer_ifddx_79",LN="_cancelBtn_ifddx_87",FN="_moveBtn_ifddx_95",Ut={overlay:DN,modal:IN,header:TN,body:NN,hint:jN,list:kN,item:RN,selected:AN,empty:PN,footer:MN,cancelBtn:LN,moveBtn:FN};function $N(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 BN=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=De(),o=$N(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=p.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Ut.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Ut.modal,children:[l.jsxs("div",{className:Ut.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(dn,{size:16})})]}),l.jsxs("div",{className:Ut.body,children:[l.jsx("p",{className:Ut.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Ut.list,children:[o.map(f=>l.jsxs("li",{className:`${Ut.item} ${a===f.id?Ut.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(Dy,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Ut.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Ut.footer,children:[l.jsx("button",{className:Ut.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Ut.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},UN="_overlay_16at9_1",VN="_modal_16at9_11",qN="_header_16at9_21",zN="_body_16at9_37",HN="_table_16at9_43",WN="_pageInput_16at9_61",QN="_empty_16at9_68",KN="_footer_16at9_74",GN="_cancelBtn_16at9_82",YN="_saveBtn_16at9_90",ir={overlay:UN,modal:VN,header:qN,body:zN,table:HN,pageInput:WN,empty:QN,footer:KN,cancelBtn:GN,saveBtn:YN};function XN(e){const t=[],r=n=>{var s;for(const i of n)!i.isFolder&&(!i.children||i.children.length===0)?t.push(i):(s=i.children)!=null&&s.length&&r(i.children)};return r(e),t}const ZN=({onClose:e})=>{const{treeData:t,updateNode:r}=De(),n=XN(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:ir.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:ir.modal,children:[l.jsxs("div",{className:ir.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(dn,{size:16})})]}),l.jsx("div",{className:ir.body,children:n.length===0?l.jsx("p",{className:ir.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:ir.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:ir.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:ir.footer,children:[l.jsx("button",{className:ir.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:ir.saveBtn,onClick:o,children:[l.jsx(Py,{size:14})," Save"]})]})]})})},JN="_container_1a7t2_1",ej="_panelHeader_1a7t2_10",tj="_panelHeaderLeft_1a7t2_19",rj="_panelCollapseBtn_1a7t2_27",nj="_titleRow_1a7t2_46",sj="_field_1a7t2_47",ij="_moveBtn_1a7t2_64",oj="_icon_1a7t2_84",aj="_nameInput_1a7t2_93",lj="_fieldHeader_1a7t2_118",cj="_label_1a7t2_124",uj="_fieldCount_1a7t2_133",dj="_chips_1a7t2_170",fj="_chip_1a7t2_170",hj="_chipRemove_1a7t2_188",pj="_keywordInput_1a7t2_202",gj="_input_1a7t2_207",mj="_addBtn_1a7t2_220",yj="_radioGroup_1a7t2_234",vj="_radioLabel_1a7t2_239",Ve={container:JN,panelHeader:ej,panelHeaderLeft:tj,panelCollapseBtn:rj,titleRow:nj,field:sj,moveBtn:ij,icon:oj,nameInput:aj,fieldHeader:lj,label:cj,fieldCount:uj,chips:dj,chip:fj,chipRemove:hj,keywordInput:pj,input:gj,addBtn:mj,radioGroup:yj,radioLabel:vj},bj=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var R,B;const{updateNode:s,markDirty:i}=De(),o=t==="edit",a=ao(e),c=ae(A=>A.relationalFormConfig),d=A=>c==null?void 0:c.find(P=>P.code===A),u=A=>!c||!!d(A),f=(A,P)=>{var F;return((F=d(A))==null?void 0:F.label)||P},[g,m]=p.useState(!0),_=((R=e.metadata)==null?void 0:R.relationalMetadata)??{},[h,y]=p.useState(_.name??e.name??""),[v,b]=p.useState(""),[S,w]=p.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((B=e.metadata)==null?void 0:B.keywords)?e.metadata.keywords:[]),[C,D]=p.useState(!!_.optional);p.useEffect(()=>{var P,F;const A=((P=e.metadata)==null?void 0:P.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&&!S.includes(A)){const P=[...S,A];w(P),s(e.id,{keywords:P}),i()}b("")},L=A=>{const P=S.filter(F=>F!==A);w(P),s(e.id,{keywords:P}),i()},T=A=>{D(A),s(e.id,{optional:A}),i()};return l.jsxs("div",{className:Ve.container,children:[l.jsxs("div",{className:Ve.panelHeader,children:[l.jsxs("div",{className:Ve.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Ve.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Ve.panelCollapseBtn,onClick:()=>m(A=>!A),"aria-expanded":g,"aria-label":g?"Collapse metadata panel":"Expand metadata panel",title:g?"Collapse":"Expand",children:g?l.jsx(Bs,{size:15}):l.jsx(xy,{size:15})})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ve.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Ve.icon}),l.jsx("input",{type:"text",className:Ve.nameInput,value:h,disabled:!o,onChange:A=>y(A.target.value),onBlur:j,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("div",{className:Ve.fieldHeader,children:l.jsxs("label",{className:Ve.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:Ve.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:Ve.chips,children:S.map(A=>l.jsxs("span",{className:Ve.chip,children:[A,o&&l.jsx("button",{type:"button",className:Ve.chipRemove,onClick:()=>L(A),children:"×"})]},A))}),o&&l.jsxs("div",{className:Ve.keywordInput,children:[l.jsx("input",{type:"text",className:Ve.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:Ve.addBtn,onClick:k,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("label",{className:Ve.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Ve.radioGroup,children:[l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>T(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>T(!1),disabled:!o}),"No"]})]})]})]}),n]})},_j="_iconBtn_vl14u_1",wj="_editable_vl14u_14",Sj="_iconImg_vl14u_26",xj="_placeholder_vl14u_34",Cj="_removeBtn_vl14u_41",cs={iconBtn:_j,editable:wj,iconImg:Sj,placeholder:xj,removeBtn:Cj},Ej=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=De(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[cs.iconBtn,r?cs.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:cs.iconImg}):l.jsx("div",{className:cs.placeholder,children:l.jsx(tf,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:cs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Za,{size:11})})]}),n&&l.jsx(Xh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Oj="_leafContentLayout_1lchu_1",Dj="_container_1lchu_15",Ij="_emptyState_1lchu_24",Tj="_titleRow_1lchu_34",Nj="_nodeTitle_1lchu_50",jj="_formArea_1lchu_72",kj="_contentListArea_1lchu_76",Rj="_dropZone_1lchu_81",Aj="_reviewComment_1lchu_88",Pj="_reviewCommentLabel_1lchu_101",Mj="_reviewCommentText_1lchu_107",Wt={leafContentLayout:Oj,container:Dj,emptyState:Ij,titleRow:Tj,nodeTitle:Nj,formArea:jj,contentListArea:kj,dropZone:Rj,reviewComment:Aj,reviewCommentLabel:Pj,reviewCommentText:Mj},Lj="application/vnd.sunbird.questionset",ap="application/vnd.sunbird.question",Fj=[Lj,ap],$j=({editorMode:e,onToolbarEvent:t})=>{var B,A,P,F;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,d]=p.useState(!1),u=p.useRef(null),f=p.useRef(),{selectedNodeId:g,breadcrumb:m,activeNodeMeta:_,updateNode:h,treeData:y}=De(),v=ae(Y=>{var se,Ce,ve,me;return((Ce=(se=Y.editorConfig)==null?void 0:se.context)==null?void 0:Ce.contentId)??((me=(ve=Y.editorConfig)==null?void 0:ve.context)==null?void 0:me.identifier)??""}),b=g?lp(y,g):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),C=b&&Fj.includes(b.mimeType??""),D=(b==null?void 0:b.mimeType)===ap,j=b&&!b.isFolder&&!C&&!S,k=((B=b==null?void 0:b.metadata)==null?void 0:B.rejectComment)??(S?(P=(A=y[0])==null?void 0:A.metadata)==null?void 0:P.rejectComment:void 0),L=p.useCallback(()=>{const Y=u.current;if(!Y||!g)return;const se=Y.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(g,{name:se})},600)},[g,h]),T=p.useCallback(Y=>{t({action:"onFormValueChange",data:Y})},[t]),R=p.useCallback((Y,se)=>{i(se),t({action:"onFormStatusChange",data:{isValid:Y,nodeId:g}})},[t,g]);return b?C?l.jsx(Ma,{node:b,editorMode:e,type:"quml",singleQuestion:D}):j?l.jsxs("div",{className:Wt.leafContentLayout,children:[l.jsx(Ma,{node:b,editorMode:e,type:"content",layout:"flow"}),l.jsx(bj,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(BN,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Wt.container,children:[l.jsx(pO,{crumbs:m}),k&&l.jsxs("div",{className:Wt.reviewComment,role:"alert",children:[l.jsx("span",{className:Wt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Wt.reviewCommentText,children:k})]}),l.jsxs("div",{className:Wt.titleRow,children:[S&&g&&l.jsx(Ej,{nodeId:g,value:String(b.appIcon??((F=b.metadata)==null?void 0:F.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Wt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:L,onBlur:L,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(_O,{activeTab:r,onChange:Y=>n(Y),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Wt.formArea,children:l.jsx(GI,{nodeMetadata:_,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:T,onFormStatusChange:R},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Wt.contentListArea,children:l.jsx(TT,{editorMode:e})}),l.jsx(kT,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Wt.dropZone}),c&&l.jsx(ZN,{contentId:v,onClose:()=>d(!1)})]}):l.jsx("div",{className:Wt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function lp(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=lp(r.children,t);if(n)return n}}}const cp=Zi((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),Bj=20;function up(){var d;const e=ae(u=>u.editorConfig),t=De(u=>u.selectedNodeId),r=De(u=>u.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function u(f,g,m=0){var _;for(const h of f){if(h.id===g)return m;if((_=h.children)!=null&&_.length){const y=u(h.children,g,m+1);if(y>=0)return y}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...xu];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...xu]}function Uj(){const e=cp(),t=ae(f=>{var g,m;return((m=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:m.channel)??""}),r=up(),n=p.useRef(),s=p.useCallback(async(f="",g="all",m={},_=!0,h=!1)=>{var y,v,b,S,w;e.setLoading(!0);try{const C={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(y=m==null?void 0:m.board)!=null&&y.length&&(C.board=m.board),(v=m==null?void 0:m.medium)!=null&&v.length&&(C.medium=m.medium),(b=m==null?void 0:m.gradeLevel)!=null&&b.length&&(C.gradeLevel=m.gradeLevel),(S=m==null?void 0:m.subject)!=null&&S.length&&(C.subject=m.subject),(w=m==null?void 0:m.primaryCategory)!=null&&w.length&&(C.primaryCategory=m.primaryCategory);const D=_?0:e.offset,{content:j,count:k}=await RT({filters:C,query:f,limit:f?50:Bj,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]),d=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const Vj="_card_jzciw_1",qj="_addBtn_jzciw_17",zj="_dragging_jzciw_24",Hj="_ctIcon_jzciw_29",Wj="_info_jzciw_33",Qj="_name_jzciw_41",Kj="_meta_jzciw_50",Gj="_addBtnMuted_jzciw_78",Yj="_added_jzciw_87",Xj="_addedBadge_jzciw_96",or={card:Vj,addBtn:qj,dragging:zj,ctIcon:Hj,info:Wj,name:Qj,meta:Kj,addBtnMuted:Gj,added:Yj,addedBadge:Xj},Zj={video:Ja,pdf:Ka,h5p:Ga,scorm:Xa,audio:Ya,quiz:Qa,default:Kn},Jj=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=ao(e),o=Zj[i.key]??Kn,a=yl(),c=Y1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:m}=Qd({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:g,className:[or.card,m?or.dragging:"",s?or.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,or.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:or.info,children:[l.jsx("span",{className:or.name,title:e.name,children:e.name}),l.jsxs("span",{className:or.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:or.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Qn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[or.addBtn,!d&&a?or.addBtnMuted:""].join(" "),onClick:v=>{v.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(Us,{size:14})})]})},ek="_chips_xhhaq_1",tk="_chip_xhhaq_1",Wu={chips:ek,chip:tk},rk=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Wu.chips,role:"group","aria-label":"Content type filters",children:e.map(n=>l.jsx("button",{type:"button",role:"radio","aria-checked":t===n.value,className:["sbx-chip",t===n.value?"filled":"outline",Wu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),nk="_panel_1cl11_1",sk="_header_1cl11_10",ik="_headerTitle_1cl11_19",ok="_closeBtn_1cl11_25",ak="_body_1cl11_43",lk="_section_1cl11_59",ck="_sectionLabel_1cl11_65",uk="_chips_1cl11_73",dk="_chip_1cl11_73",fk="_active_1cl11_96",hk="_footer_1cl11_102",pk="_resetBtn_1cl11_112",gk="_applyBtn_1cl11_129",st={panel:nk,header:sk,headerTitle:ik,closeBtn:ok,body:ak,section:lk,sectionLabel:ck,chips:uk,chip:dk,active:fk,footer:hk,resetBtn:pk,applyBtn:gk},mk=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],yk=new Set(["board","medium","gradeLevel","subject","topic"]),vk=({local:e,toggle:t})=>{const r=up();return r.length?l.jsxs("div",{className:st.section,children:[l.jsx("div",{className:st.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:st.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[st.chip,(e.primaryCategory??[]).includes(n)?st.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},bk=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var h,y;const s=ae(v=>v.editorConfig),i=ae(v=>v.searchFormConfig),o=ae(v=>v.contentFramework),a=ae(v=>v.contentTargetFWIds),{organisationFramework:c}=Hh(o??((h=s==null?void 0:s.context)==null?void 0:h.framework),a??((y=s==null?void 0:s.context)==null?void 0:y.targetFWIds)),[d,u]=p.useState(t),f=i!=null&&i.length?i.filter(v=>yk.has(v.code)).map(v=>({key:v.code,label:v.label||v.code})):mk;p.useEffect(()=>{u(t)},[t]);const g=(v,b)=>{u(S=>{const w=S[v]??[],C=w.includes(b)?w.filter(D=>D!==b):[...w,b];return{...S,[v]:C}})},m=(c==null?void 0:c.categories)??[],_=v=>{var b;return((b=m.find(S=>S.code===v))==null?void 0:b.terms)??[]};return e?l.jsxs("div",{className:st.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:st.header,children:[l.jsx("span",{className:st.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:st.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(dn,{size:16})})]}),l.jsxs("div",{className:st.body,children:[f.map(({key:v,label:b})=>{const S=_(v);return S.length?l.jsxs("div",{className:st.section,children:[l.jsx("div",{className:st.sectionLabel,children:b}),l.jsx("div",{className:st.chips,children:S.slice(0,20).map(w=>l.jsx("button",{type:"button",className:[st.chip,(d[v]??[]).includes(w.name)?st.active:""].join(" "),onClick:()=>g(v,w.name),children:w.name},w.identifier))})]},v):null}),l.jsx(vk,{local:d,toggle:g})]}),l.jsxs("div",{className:st.footer,children:[l.jsx("button",{type:"button",className:st.resetBtn,onClick:()=>u({}),children:"Reset"}),l.jsx("button",{type:"button",className:st.applyBtn,onClick:()=>{r(d),n()},children:"Apply"})]})]}):null},_k="_header_6qdpu_10",wk="_title_6qdpu_20",Sk="_headerActions_6qdpu_31",xk="_iconBtn_6qdpu_38",Ck="_playerArea_6qdpu_56",Ek="_footer_6qdpu_64",Ok="_addBtn_6qdpu_73",Dk="_modalOverlay_6qdpu_92",Ik="_modalPanel_6qdpu_103",gr={header:_k,title:wk,headerActions:Sk,iconBtn:xk,playerArea:Ck,footer:Ek,addBtn:Ok,modalOverlay:Dk,modalPanel:Ik},Tk="application/vnd.sunbird.questionset",Nk=({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 Lr.createPortal(l.jsx("div",{className:gr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:gr.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:gr.header,children:[l.jsx("span",{className:gr.title,title:e.name,children:e.name}),l.jsx("div",{className:gr.headerActions,children:l.jsx("button",{type:"button",className:gr.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(dn,{size:16})})})]}),l.jsx("div",{className:gr.playerArea,children:l.jsx(Ma,{node:n,editorMode:"read",type:e.mimeType===Tk?"quml":"content"})}),l.jsx("div",{className:gr.footer,children:l.jsx("button",{type:"button",className:gr.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},jk="_dock_1lpg0_1",kk="_header_1lpg0_8",Rk="_headerLeft_1lpg0_17",Ak="_headerTitle_1lpg0_24",Pk="_count_1lpg0_30",Mk="_searchRow_1lpg0_39",Lk="_searchWrap_1lpg0_47",Fk="_searchIcon_1lpg0_53",$k="_searchInput_1lpg0_62",Bk="_filterToggleBtn_1lpg0_80",Uk="_filterToggleBtnActive_1lpg0_99",Vk="_filterBadge_1lpg0_105",qk="_filters_1lpg0_124",zk="_mainArea_1lpg0_134",Hk="_sidePanelOverlay_1lpg0_143",Wk="_cardList_1lpg0_152",Qk="_skeleton_1lpg0_168",Kk="_skeletonIcon_1lpg0_178",Gk="_skeletonText_1lpg0_186",Yk="_skeletonLine_1lpg0_193",Xk="_skeletonLineSm_1lpg0_200",Zk="_loadMoreBtn_1lpg0_215",Jk="_emptyState_1lpg0_240",eR="_collapseBtn_1lpg0_260",Fe={dock:jk,header:kk,headerLeft:Rk,headerTitle:Ak,count:Pk,searchRow:Mk,searchWrap:Lk,searchIcon:Fk,searchInput:$k,filterToggleBtn:Bk,filterToggleBtnActive:Uk,filterBadge:Vk,filters:qk,mainArea:zk,sidePanelOverlay:Hk,cardList:Wk,skeleton:Qk,skeletonIcon:Kk,skeletonText:Gk,skeletonLine:Yk,skeletonLineSm:Xk,loadMoreBtn:Zk,emptyState:Jk,collapseBtn:eR};function tR(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 rR=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:g,toggleSort:m,loadMore:_}=Uj(),{addResource:h,selectedNodeId:y,treeData:v}=De(),b=e==="edit",[S,w]=p.useState(!1),[C,D]=p.useState({}),[j,k]=p.useState(null),L=p.useMemo(()=>tR(v),[v]),T=p.useCallback(F=>{var Ce;if(!y){Ee.error("Select a unit first");return}const Y=(Ce=v[0])==null?void 0:Ce.id;if(y===Y){Ee("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(h(F,y)===!1){Ee.error(`"${F.name}" is already in this collection`);return}Ee.success(`Added "${F.name}"`)},[y,h,v]),R=p.useCallback(F=>{D(F),g(F)},[g]),B=p.useCallback(F=>{k(F)},[]),A=p.useCallback(F=>{T(F),k(null)},[T]),P=p.useMemo(()=>Object.values(C).reduce((F,Y)=>F+((Y==null?void 0:Y.length)??0),0),[C]);return l.jsxs("div",{className:Fe.dock,children:[l.jsx("div",{className:Fe.header,children:l.jsxs("div",{className:Fe.headerLeft,children:[l.jsx("button",{type:"button",className:Fe.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(Ry,{size:15})}),l.jsx(Ny,{size:16}),l.jsx("span",{className:Fe.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Fe.count,children:i})]})}),l.jsxs("div",{className:Fe.searchRow,children:[l.jsxs("div",{className:Fe.searchWrap,children:[l.jsx(ha,{size:14,className:Fe.searchIcon}),l.jsx("input",{type:"search",className:Fe.searchInput,placeholder:"Search content…",value:a,onChange:F=>u(F.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Fe.filterToggleBtn,c?Fe.filterToggleBtnActive:""].join(" "),onClick:m,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(wy,{size:15}):l.jsx(Ey,{size:15})}),l.jsxs("button",{type:"button",className:[Fe.filterToggleBtn,S?Fe.filterToggleBtnActive:""].join(" "),onClick:()=>w(F=>!F),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx(Fy,{size:15}),P>0&&l.jsx("span",{className:Fe.filterBadge,children:P})]})]}),l.jsx("div",{className:Fe.filters,children:l.jsx(rk,{filters:X1,active:o,onChange:f})}),l.jsxs("div",{className:Fe.mainArea,children:[l.jsx("div",{className:Fe.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((F,Y)=>l.jsxs("div",{className:Fe.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Fe.skeletonIcon}),l.jsxs("div",{className:Fe.skeletonText,children:[l.jsx("div",{className:Fe.skeletonLine}),l.jsx("div",{className:Fe.skeletonLineSm})]})]},Y)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(F=>l.jsx(Jj,{item:F,onAdd:T,onPreview:B,isDraggable:b,isAdded:L.has(F.identifier)},F.identifier)),d&&l.jsx("button",{type:"button",className:Fe.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Fe.emptyState,children:[l.jsx(ha,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:Fe.sidePanelOverlay,children:l.jsx(bk,{isOpen:S,filters:C,onApply:R,onClose:()=>w(!1)})}),j&&l.jsx(Nk,{content:j,onAdd:A,onClose:()=>k(null)})]})]})};function nR(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(g,m=!1){const _={};for(const[h,y]of Object.entries(g))if(!i.has(h)&&!(m&&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 u(g){var _;const m={};for(const h of g.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 S=((_=h.metadata)==null?void 0:_.relationalMetadata)??{};m[h.identifier]={name:h.name,...S,...b}}return m}function f(g,m){var S,w;const _=g.identifier,h=t[_],y=_.startsWith("temp-")||!!(h!=null&&h.isNew),v=!g.isFolder&&!m;if(m||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((S=g.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=g.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:g.name,visibility:"Parent",channel:r,...d(g.metadata??{})};else if(m){const{isNew:D,...j}=h??{};C={...d(g.metadata??{},!0),...d(j,!1),name:g.name}}else{const{isNew:D,...j}=h??{};C={name:g.name,visibility:"Parent",...d(j,!0)}}n[_]={metadata:C,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:m,isNew:y}}const b=g.isFolder?u(g):{};s[_]={name:g.name,children:(g.children??[]).map(C=>C.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:m},(g.children??[]).forEach(C=>f(C,!1))}return e.forEach((g,m)=>f(g,m===0)),{nodesModified:n,hierarchy:s}}function sR(){const[e,t]=p.useState(!1),r=De(u=>u.treeCache),n=De(u=>u.treeData),s=ae(u=>u.isDirty),i=ae(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=ae(),c=ae(u=>u.editorConfig);return{save:p.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",g=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:m,hierarchy:_}=nR(n,r,f),{identifiers:h}=await C_(u,m,_,g);h&&Object.keys(h).length>0&&De.getState().replaceNodeIds(h);const y=new Date().toISOString();a(y),o(!1)}catch(m){console.error("[useSaveHierarchy] save failed:",m),Ee.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}const iR={};function oR(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function aR(e,t,r,n,s){const i=[],o=(a,c)=>{var d;for(const u of a){const f=c&&!u.parent,g=f?r:u.isFolder?n:null;if(g&&g.length>0){const m={...u.metadata??{},...t[u.id]??{}},h=Qh(g,m,iR,f,s).filter(y=>y.required&&y.visible!==!1&&y.inputType!=="appIcon"&&oR(y.currentValue)).map(y=>y.label);h.length>0&&i.push({nodeId:u.id,nodeName:u.name||"Untitled",missing:h})}(d=u.children)!=null&&d.length&&o(u.children,!1)}};return o(e,!0),i}function lR(e){const t=ae(f=>f.editorConfig),r=ae(f=>f.setButtonLoader),n=ae(f=>f.validateAllForms),s=ae(f=>f.rootFormConfig),i=ae(f=>f.unitFormConfig),o=De(f=>f.treeData),a=De(f=>f.treeCache),c=De(f=>f.selectNode),d=p.useCallback(()=>{var h,y,v;const f={editorMode:"edit",objectType:(h=t==null?void 0:t.config)==null?void 0:h.objectType,userFullName:(v=(y=t==null?void 0:t.context)==null?void 0:y.user)==null?void 0:v.fullName},g=aR(o,a,s,i,f);if(g.length===0)return!0;const m=g[0];Ee.error(`"${m.nodeName}": please fill required field${m.missing.length>1?"s":""} — ${m.missing.join(", ")}`);const{setFormStatus:_}=ae.getState();return g.forEach(b=>_(b.nodeId,!1)),c(m.nodeId),!1},[o,a,s,i,t,c]);return{runAction:p.useCallback(async(f,g)=>{var h,y,v,b;const m=((h=t==null?void 0:t.context)==null?void 0:h.contentId)??((y=t==null?void 0:t.context)==null?void 0:y.identifier)??"";if(!m)return Ee.error("No content identifier found."),!1;const _=((v=t==null?void 0:t.context)==null?void 0:v.userId)??((b=t==null?void 0:t.context)==null?void 0:b.uid)??"";try{switch(f){case"sendForReview":return d()?n(o)?(r("saveCollection",!0),await e(),await D_(m),Ee.success("Content sent for review"),!0):(Ee.error("Some units have missing required fields. Please fill them before sending for review."),!1):!1;case"reject":{r("rejectCollection",!0);const S=(g==null?void 0:g.comment)??"";return await I_(m,S),Ee.success("Content rejected and sent back to the author"),!0}case"publish":return d()?n(o)?(r("publishCollection",!0),await e(),await E_(m,_),Ee.success("Content published successfully"),!0):(Ee.error("Some units have missing required fields. Please fill them before publishing."),!1):!1;default:return!1}}catch(S){console.error(`[useToolbarActions] ${f} failed`,S);const w=f==="sendForReview"?"send for review":f==="reject"?"reject":"publish";return Ee.error(`Failed to ${w}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r,d,n,o]),checkRequiredFields:d}}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",kt={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},SR=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState(!1),[u,f]=p.useState(!1),{addResource:g,treeData:m}=De(),_=ae(P=>P.setFormStatus),[h,y]=p.useState(!0),v=De(P=>P.selectedNodeId),{save:b,isSaving:S,isDirty:w,lastSaved:C}=sR(),{runAction:D,checkRequiredFields:j}=lR(b);p.useEffect(()=>{if(!w)return;const P=F=>{F.preventDefault(),F.returnValue=""};return window.addEventListener("beforeunload",P),()=>window.removeEventListener("beforeunload",P)},[w]);const k=Dd(ca(Gi,{activationConstraint:{distance:8}})),L=p.useCallback(P=>{var Y;const F=(Y=P.active.data.current)==null?void 0:Y.item;F&&i(F)},[]),T=p.useCallback(P=>{var me,q;i(null);const F=(me=P.active.data.current)==null?void 0:me.item;if(!F)return;const Y=P.over,se=(Y==null?void 0:Y.id)??v??void 0;if(!se){Ee.error("Drop onto a unit to add content");return}const Ce=(q=m[0])==null?void 0:q.id;if(se===Ce){Ee.error("Drop content onto a unit, not directly on the course.");return}if(!g(F,se)){Ee.error(`"${F.name}" is already in this collection`);return}r==null||r(F,se),Ee.success(`Added "${F.name}" to unit`)},[v,g,r]),R=p.useCallback(async P=>{if(P.action==="onFormStatusChange"){const{isValid:F,nodeId:Y}=P.data??{},se=F!==!1;y(se),Y&&_(Y,se);return}if(P.action==="back"&&w&&e==="edit"){f(!0);return}if(P.action==="saveCollection"){if(!h){Ee.error("Please fill the required metadata");return}if(!j())return;await b(),n==null||n(m),t==null||t(P);return}if(P.action==="sendForReview"||P.action==="reject"||P.action==="publish"){await D(P.action,P.data)&&(t==null||t(P));return}t==null||t(P)},[b,D,j,t,n,m,w,h,e]),B=p.useCallback(async()=>{if(!j()){f(!1);return}await b(),f(!1),n==null||n(m),t==null||t({action:"back"})},[b,j,n,t,m]),A=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Wd,{sensors:k,onDragStart:L,onDragEnd:T,children:[l.jsxs("div",{className:kt.shell,children:[l.jsx(Lw,{editorMode:e,isSaving:S,isDirty:w,lastSaved:C,isFormValid:h,onToolbarEvent:R}),l.jsxs("div",{className:[kt.workspace,o?kt.sidebarCollapsed:"",c?kt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[kt.outline,o?kt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(cO,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(P=>!P)})}),o&&l.jsx("button",{className:kt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:kt.editor,role:"main","aria-label":"Content editor",children:l.jsx($j,{editorMode:e,onToolbarEvent:R})}),l.jsx("aside",{className:[kt.dock,c?kt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(rR,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(P=>!P)})}),c&&l.jsx("button",{className:kt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(my,{dropAnimation:null,children:s?l.jsx("div",{className:kt.dragChip,children:l.jsx("span",{className:kt.dragChipLabel,children:s.name})}):null}),u&&l.jsx(Fw,{onSave:B,onDiscard:A,onCancel:()=>f(!1),isSaving:S})]})},xR="v1";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 Qu(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 Cr(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.name??void 0,i=n.fields.filter(o=>!!o.code).sort((o,a)=>(o.index??0)-(a.index??0));for(const o of i)r.push(Qu(o,s))}else n.code&&r.push(Qu(n));return r}function ER(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 OR(e,t,r="Collection",n=xR){var d,u;const i=(u=(d=(await Ne.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:Cr(o.create),unitForm:Cr(o.unitMetadata),childForm:Cr(o.childMetadata),searchForm:Cr(o.search??o.searchConfig),relationalForm:Cr(o.relationalMetadata),publishChecklist:Cr(o.publishchecklist),reviewChecklist:Cr(o.review),rfcChecklist:Cr(o.requestforchangeschecklist),schemaDefaults:ER(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.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:d,setCategoryDefinition:u,setContentFramework:f}=ae(),{setTreeData:g,selectNode:m}=De();return p.useEffect(()=>{let _=!1;async function h(){var y,v;try{n(!0),i(null),e.apiBaseUrl&&Af(e.apiBaseUrl),c(e),d(e.config.mode);const b=e.context.contentId??e.context.identifier??"";if(b){const S=e.config.objectType==="QuestionSet",{rootNode:w}=S?await x_(b):await Ff(b);if(!_&&(g(w?[w]:[]),w)){m(w.id);const L=w.metadata??{},T=L.framework??e.context.framework??null,R=L.targetFWIds??e.context.targetFWIds??null;f(T,R)}const C=e.config.primaryCategory??"Course",D=e.context.channel??"",j=e.config.categoryDefinitionApiVersion??"v1";try{const k=await OR(C,D,e.config.objectType??"Collection",j);if(!_){u(k);const L=((y=k.sourcingSettings)==null?void 0:y.collection)??{},T={};L.maxDepth&&!e.config.maxDepth&&(T.maxDepth=L.maxDepth),L.children&&!e.config.children&&(T.children=L.children),L.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(T.hierarchy={...e.config.hierarchy??{},...L.hierarchy}),Object.keys(T).length>0&&c({...e,config:{...e.config,...T}})}}catch{}}_||a(!0)}catch(b){if(!_){const S=b instanceof Error?b:new Error(String(b));i(S),t==null||t(S)}}finally{_||n(!1)}}return h(),()=>{_=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const IR="_root_qcpw6_1",TR="_loadingState_qcpw6_10",NR="_loadingSpinner_qcpw6_20",jR="_errorState_qcpw6_34",hs={root:IR,loadingState:TR,loadingSpinner:NR,errorState:jR},kR=new Bp({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:hs.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=ae(s=>s.editorMode);return t?l.jsxs("div",{className:hs.loadingState,children:[l.jsx("div",{className:hs.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:hs.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${hs.root}`,children:l.jsx(SR,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const dp=e=>l.jsx(RR,{onError:e.onError,children:l.jsxs(Vp,{client:kR,children:[l.jsx(AR,{...e}),l.jsx(Ug,{position:"top-right",toastOptions:{duration:3e3}})]})}),Vi=Symbol.for("r2wc.reactRender"),Ku=Symbol.for("r2wc.shouldRender"),ai=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 Gu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Vi]()}}),e[Vi]()}};function LR(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,g){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Gu.expando(g,u,f),Reflect.set(d,u,f,g)):(Gu.expando(g,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Ku]=!0,this[Vi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ai].unmount():r.unmountComponentAtNode(this)},a[Vi]=function(){if(this[Ku]===!0){var d={};Object.keys(this).forEach(function(g){s[g]!==!1&&(d[g]=this[g])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[ai]||(this[ai]=r.createRoot(u)),this[ai].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return PR(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?MR(d):d;this[g]=f}),o}var ps={},us=Lr;if(process.env.NODE_ENV==="production")ps.createRoot=us.createRoot,ps.hydrateRoot=us.hydrateRoot;else{var li=us.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ps.createRoot=function(e,t){li.usingClientEntryPoint=!0;try{return us.createRoot(e,t)}finally{li.usingClientEntryPoint=!1}},ps.hydrateRoot=function(e,t,r){li.usingClientEntryPoint=!0;try{return us.hydrateRoot(e,t,r)}finally{li.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(dp,p,ps,{});customElements.define(e,t)}exports.CollectionEditor=dp;exports.registerCollectionEditor=$R;exports.setApiBaseUrl=Af;exports.useEditorStore=ae;exports.useLibraryStore=cp;exports.useTreeStore=De;
|
|
456
|
+
`+i)}}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=cn(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&gi.assertOptions(n,{silentJSONParsing:ht.transitional(ht.boolean),forcedJSONParsing:ht.transitional(ht.boolean),clarifyTimeoutError:ht.transitional(ht.boolean),legacyInterceptorReqResOrdering:ht.transitional(ht.boolean),advertiseZstdAcceptEncoding:ht.transitional(ht.boolean),validateStatusUndefinedResolves:ht.transitional(ht.boolean)},!1),s!=null&&(O.isFunction(s)?r.paramsSerializer={serialize:s}:gi.assertOptions(s,{encode:ht.function,serialize:ht.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),gi.assertOptions(r,{baseUrl:ht.spelling("baseURL"),withXsrfToken:ht.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&O.merge(i.common,i[r.method]);i&&O.forEach(["delete","get","head","post","put","patch","query","common"],_=>{delete i[_]}),r.headers=_t.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||sl;y&&y.legacyInterceptorReqResOrdering?a.unshift(h.fulfilled,h.rejected):a.push(h.fulfilled,h.rejected)});const d=[];this.interceptors.response.forEach(function(h){d.push(h.fulfilled,h.rejected)});let u,f=0,g;if(!c){const _=[xc.bind(this),void 0];for(_.unshift(...a),_.push(...d),g=_.length,u=Promise.resolve(r);f<g;)u=u.then(_[f++],_[f++]);return u}g=a.length;let m=r;for(;f<g;){const _=a[f++],h=a[f++];try{m=_(m)}catch(y){h.call(this,y);break}}try{u=xc.call(this,m)}catch(_){return Promise.reject(_)}for(f=0,g=d.length;f<g;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=cn(this.defaults,t);const r=Tf(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Cf(r,t.params,t.paramsSerializer)}};O.forEach(["delete","get","head","options"],function(t){on.prototype[t]=function(r,n){return this.request(cn(n||{},{method:t,url:r,data:n&&O.hasOwnProp(n,"data")?n.data:void 0}))}});O.forEach(["post","put","patch","query"],function(t){function r(n){return function(i,o,a){return this.request(cn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}on.prototype[t]=r(),t!=="query"&&(on.prototype[t+"Form"]=r(!0))});let y_=class Rf{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{n.subscribe(a),i=a}).then(s);return o.cancel=function(){n.unsubscribe(i)},o},t(function(i,o,a){n.reason||(n.reason=new Hs(i,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Rf(function(s){t=s}),cancel:t}}};function v_(e){return function(r){return e.apply(null,r)}}function b_(e){return O.isObject(e)&&e.isAxiosError===!0}const ba={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(ba).forEach(([e,t])=>{ba[t]=e});function Af(e){const t=new on(e),r=uf(on.prototype.request,t);return O.extend(r,on.prototype,t,{allOwnKeys:!0}),O.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Af(cn(e,s))},r}const Ke=Af(zs);Ke.Axios=on;Ke.CanceledError=Hs;Ke.CancelToken=y_;Ke.isCancel=Df;Ke.VERSION=ol;Ke.toFormData=eo;Ke.AxiosError=Y;Ke.Cancel=Ke.CanceledError;Ke.all=function(t){return Promise.all(t)};Ke.spread=v_;Ke.isAxiosError=b_;Ke.mergeConfig=cn;Ke.AxiosHeaders=_t;Ke.formToJSON=e=>Of(O.isHTMLForm(e)?new FormData(e):e);Ke.getAdapter=kf.getAdapter;Ke.HttpStatusCode=ba;Ke.default=Ke;const{Axios:HR,AxiosError:WR,CanceledError:QR,isCancel:KR,CancelToken:GR,VERSION:YR,all:XR,Cancel:ZR,isAxiosError:JR,spread:eA,toFormData:tA,AxiosHeaders:rA,HttpStatusCode:nA,formToJSON:sA,getAdapter:iA,mergeConfig:oA,create:aA}=Ke;let _a="";function Pf(e){_a=e}const Ne=Ke.create({timeout:3e4});Ne.interceptors.request.use(async e=>{var s;const{useEditorStore:t}=await Promise.resolve().then(()=>Jy),n=(s=t.getState().editorConfig)==null?void 0:s.context;return e.headers=e.headers??{},n!=null&&n.authToken&&(e.headers.Authorization=`Bearer ${n.authToken}`),n!=null&&n.userToken&&(e.headers["X-Authenticated-User-Token"]=n.userToken),n!=null&&n.channel&&(e.headers["X-Channel-Id"]=n.channel),_a&&(e.baseURL=_a),e});const Mf=["email","firstName","lastName","identifier","organisations","rootOrgName","phone"];async function __(e,t={}){var c,d,u,f;const n={"organisations.roles":[((c=t.objectType)==null?void 0:c.toLowerCase())==="textbook"?"BOOK_CREATOR":"CONTENT_CREATOR"]};t.rootOrgId&&(n.rootOrgId=[t.rootOrgId]);const s=e.includes("@"),i=/^\d{10,}$/.test(e.trim()),o={filters:n,fields:Mf,offset:0,limit:t.limit??200};return s?n.email=e.trim():i?n.phone=e.trim():o.query=e,((f=(u=(d=(await Ne.post("/action/user/v1/search",{request:o},{params:{fields:"orgName"},headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:d.result)==null?void 0:u.response)==null?void 0:f.content)??[]}async function w_(e){var r,n,s;return e.length?((s=(n=(r=(await Ne.post("/action/user/v1/search",{request:{filters:{userId:e},fields:Mf,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)??[]:[]}async function S_(e){var r,n;return((n=(r=(await Ne.get(`/portal/user/v5/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.response)??{}}const Lf="/portal";async function Ff(e){var n,s,i,o,a,c,d;const t=await Ne.get(`${Lf}/questionset/v2/hierarchy/${e}`,{params:{mode:"edit"}}),r=(s=(n=t.data)==null?void 0:n.result)==null?void 0:s.questionset;if(!r||!r.identifier){const u=((o=(i=t.data)==null?void 0:i.params)==null?void 0:o.errmsg)||((c=(a=t.data)==null?void 0:a.params)==null?void 0:c.err)||((d=t.data)==null?void 0:d.responseCode)||`No questionset returned for "${e}"`;throw new Error(`Unable to load questionset hierarchy: ${u}`)}return r}async function x_(e){var r,n;return e.length?((n=(r=(await Ne.post(`${Lf}/question/v2/list`,{request:{search:{identifier:e}}})).data)==null?void 0:r.result)==null?void 0:n.questions)??[]:[]}function ll(e,t){const r=e??{},n=r.identifier??"",s=r.objectType??"",i=r.mimeType??"",o=r.children,a=Array.isArray(o)?o.map(d=>ll(d,n)):[],c=i==="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"||i==="application/vnd.sunbird.questionset"&&a.length>0;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:c,children:a,metadata:r,parent:t}}async function $f(e){var s,i,o,a,c,d,u;const t=await Ne.get(`/action/content/v3/hierarchy/${e}`,{params:{mode:"edit"}}),r=(i=(s=t.data)==null?void 0:s.result)==null?void 0:i.content;if(!r||!r.identifier){const f=((a=(o=t.data)==null?void 0:o.params)==null?void 0:a.errmsg)||((d=(c=t.data)==null?void 0:c.params)==null?void 0:d.err)||((u=t.data)==null?void 0:u.responseCode)||`No content returned for "${e}"`;throw new Error(`Unable to load hierarchy: ${f}`)}const n=ll(r);return{content:r,rootNode:n}}async function C_(e){const t=await Ff(e),r=ll(t);return{content:t,rootNode:r}}async function E_(e,t,r,n){var i;return((i=(await Ne.patch("/action/content/v3/hierarchy/update",{request:{data:{nodesModified:t,hierarchy:r,...n?{lastUpdatedBy:n}:{}}}})).data)==null?void 0:i.result)??{}}async function O_(e,t=""){await Ne.post(`/action/content/v3/publish/${e}`,{request:{content:{lastPublishedBy:t}}})}async function D_(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}async function I_(e){await Ne.post(`/action/content/v3/review/${e}`,{request:{content:{}}})}async function T_(e,t){await Ne.post(`/action/content/v3/reject/${e}`,{request:{content:{rejectComment:t}}})}async function N_(e,t){await Ne.patch(`/action/content/v1/collaborator/update/${e}`,{request:{content:{collaborators:t}}})}const j_="_container_r27rp_1",k_="_header_r27rp_13",R_="_title_r27rp_22",A_="_closeBtn_r27rp_29",P_="_body_r27rp_45",M_="_label_r27rp_54",L_="_searchSection_r27rp_62",F_="_searchRow_r27rp_68",$_="_searchInput_r27rp_74",B_="_searchSpinner_r27rp_89",U_="_resultsList_r27rp_105",V_="_resultItem_r27rp_118",q_="_userInfo_r27rp_133",z_="_userName_r27rp_141",H_="_userEmail_r27rp_150",W_="_userOrg_r27rp_158",Q_="_noResults_r27rp_167",K_="_collabSection_r27rp_174",G_="_sectionTitle_r27rp_179",Y_="_badge_r27rp_189",X_="_emptyCollab_r27rp_203",Z_="_collabList_r27rp_214",J_="_collabItem_r27rp_223",ew="_userAvatar_r27rp_237",tw="_error_r27rp_251",rw="_success_r27rp_257",nw="_footer_r27rp_263",Ee={container:j_,header:k_,title:R_,closeBtn:A_,body:P_,label:M_,searchSection:L_,searchRow:F_,searchInput:$_,searchSpinner:B_,resultsList:U_,resultItem:V_,userInfo:q_,userName:z_,userEmail:H_,userOrg:W_,noResults:Q_,collabSection:K_,sectionTitle:G_,badge:Y_,emptyCollab:X_,collabList:Z_,collabItem:J_,userAvatar:ew,error:tw,success:rw,footer:nw},sw=({contentId:e,onClose:t})=>{var k,L;const r=ae(T=>T.editorConfig),n=(k=r==null?void 0:r.context)==null?void 0:k.channel,s=(L=r==null?void 0:r.config)==null?void 0:L.objectType,[i,o]=p.useState(""),[a,c]=p.useState([]),[d,u]=p.useState(!1),[f,g]=p.useState([]),[m,_]=p.useState(!1),[h,y]=p.useState(""),[v,b]=p.useState(!1),S=p.useRef(null);p.useEffect(()=>{let T=!1;return(async()=>{try{const A=await D_(e),B=(A==null?void 0:A.collaborators)??[];if(!B.length)return;const R=await w_(B);if(T)return;const P=B.map(F=>R.find(X=>X.identifier===F)??{identifier:F,firstName:F});g(P)}catch{}})(),()=>{T=!0}},[e]),p.useEffect(()=>{S.current&&clearTimeout(S.current);const T=i.trim();if(T.length<2){c([]);return}return S.current=setTimeout(async()=>{u(!0);try{const A=await __(T,{rootOrgId:n,objectType:s}),B=new Set(f.map(R=>R.identifier));c(A.filter(R=>!B.has(R.identifier)))}catch{c([])}finally{u(!1)}},300),()=>{S.current&&clearTimeout(S.current)}},[i,f,n,s]);const w=p.useCallback(T=>{g(A=>A.find(B=>B.identifier===T.identifier)?A:[...A,T]),c(A=>A.filter(B=>B.identifier!==T.identifier)),b(!1)},[]),C=p.useCallback(T=>{g(A=>A.filter(B=>B.identifier!==T)),b(!1)},[]),D=p.useCallback(async()=>{_(!0),y(""),b(!1);try{await N_(e,f.map(T=>T.identifier)),b(!0)}catch{y("Failed to save collaborators. Please try again.")}finally{_(!1)}},[e,f]),j=T=>`${T.firstName}${T.lastName?` ${T.lastName}`:""}`;return l.jsxs("div",{className:Ee.container,children:[l.jsxs("div",{className:Ee.header,children:[l.jsx("h2",{className:Ee.title,children:"Manage Collaborators"}),l.jsx("button",{className:Ee.closeBtn,onClick:t,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:Ee.body,children:[l.jsxs("div",{className:Ee.searchSection,children:[l.jsx("label",{className:Ee.label,htmlFor:"collab-search",children:"Search users"}),l.jsxs("div",{className:Ee.searchRow,children:[l.jsx("input",{id:"collab-search",type:"text",className:Ee.searchInput,placeholder:"Search by name or email...",value:i,onChange:T=>o(T.target.value)}),d&&l.jsx("span",{className:Ee.searchSpinner,"aria-label":"Searching..."})]}),a.length>0&&l.jsx("ul",{className:Ee.resultsList,role:"listbox","aria-label":"Search results",children:a.map(T=>{var A,B,R,P;return l.jsxs("li",{className:Ee.resultItem,role:"option","aria-selected":"false",children:[l.jsxs("div",{className:Ee.userInfo,children:[l.jsx("span",{className:Ee.userName,children:j(T)}),T.email&&l.jsx("span",{className:Ee.userEmail,children:T.email}),(((B=(A=T.organisations)==null?void 0:A[0])==null?void 0:B.orgName)??T.rootOrgName)&&l.jsx("span",{className:Ee.userOrg,children:((P=(R=T.organisations)==null?void 0:R[0])==null?void 0:P.orgName)??T.rootOrgName})]}),l.jsx(Me,{variant:"primary",size:"sm",onClick:()=>w(T),children:"Add"})]},T.identifier)})}),i.trim().length>=2&&!d&&a.length===0&&l.jsx("p",{className:Ee.noResults,children:"No users found."})]}),l.jsxs("div",{className:Ee.collabSection,children:[l.jsxs("h3",{className:Ee.sectionTitle,children:["Current Collaborators",f.length>0&&l.jsx("span",{className:Ee.badge,children:f.length})]}),f.length===0?l.jsx("p",{className:Ee.emptyCollab,children:"No collaborators added yet."}):l.jsx("ul",{className:Ee.collabList,children:f.map(T=>{var A,B,R,P;return l.jsxs("li",{className:Ee.collabItem,children:[l.jsx("div",{className:Ee.userAvatar,"aria-hidden":"true",children:j(T).charAt(0).toUpperCase()}),l.jsxs("div",{className:Ee.userInfo,children:[l.jsx("span",{className:Ee.userName,children:j(T)}),T.email&&l.jsx("span",{className:Ee.userEmail,children:T.email}),(((B=(A=T.organisations)==null?void 0:A[0])==null?void 0:B.orgName)??T.rootOrgName)&&l.jsx("span",{className:Ee.userOrg,children:((P=(R=T.organisations)==null?void 0:R[0])==null?void 0:P.orgName)??T.rootOrgName})]}),l.jsx(Me,{variant:"danger",size:"sm",onClick:()=>C(T.identifier),children:"Remove"})]},T.identifier)})})]}),h&&l.jsx("p",{className:Ee.error,role:"alert",children:h}),v&&l.jsx("p",{className:Ee.success,role:"status",children:"Collaborators saved successfully."})]}),l.jsxs("div",{className:Ee.footer,children:[l.jsx(Me,{variant:"ghost",onClick:t,disabled:m,children:"Cancel"}),l.jsx(Me,{variant:"primary",isLoading:m,onClick:D,children:"Save"})]})]})};async function iw(e){return(await Ne.post("/api/dialcode/v1/read",{request:{dialcodes:[e]}})).data}async function ow(e,t){var s;const n=((s=(await Ne.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 aw(e){var n;const r=((n=(await Ne.get(`/action/dialcode/v1/process/status/${e}`)).data)==null?void 0:n.result)??{status:"PENDING"};return{...r,status:r.status==="PENDING"?"in-process":r.status}}const lw="_topbar_zj8wk_1",cw="_left_zj8wk_15",uw="_right_zj8wk_23",dw="_backBtn_zj8wk_30",fw="_title_zj8wk_49",hw="_statusChip_zj8wk_61",pw="_savedIndicator_zj8wk_73",gw="_unsaved_zj8wk_83",mw="_iconBtn_zj8wk_88",yw="_iconBtnLabel_zj8wk_115",vw="_qrDropdown_zj8wk_119",bw="_qrMenu_zj8wk_123",_w="_reviewBtns_zj8wk_158",ww="_sourcingBtns_zj8wk_167",Sw="_modalOverlay_zj8wk_176",xw="_sbOverlay_zj8wk_186",Cw="_sbModal_zj8wk_196",Ew="_sbModalHeader_zj8wk_207",Ow="_sbModalTitle_zj8wk_215",Dw="_sbModalClose_zj8wk_222",Iw="_sbModalBody_zj8wk_235",Tw="_sbLabel_zj8wk_242",Nw="_sbTextarea_zj8wk_249",jw="_sbError_zj8wk_266",kw="_sbModalFooter_zj8wk_273",ce={topbar:lw,left:cw,right:uw,backBtn:dw,title:fw,statusChip:hw,savedIndicator:pw,unsaved:gw,iconBtn:mw,iconBtnLabel:yw,qrDropdown:vw,qrMenu:bw,reviewBtns:_w,sourcingBtns:ww,modalOverlay:Sw,sbOverlay:xw,sbModal:Cw,sbModalHeader:Ew,sbModalTitle:Ow,sbModalClose:Dw,sbModalBody:Iw,sbLabel:Tw,sbTextarea:Nw,sbError:jw,sbModalFooter:kw};function Rw(e){return e?new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""}function Aw(e){return typeof e=="string"&&e.trim().length>0?e.trim():"Draft"}const Pw=({titleText:e,labelText:t,placeholderText:r,submitLabel:n,submitVariant:s="primary",onConfirm:i,onCancel:o})=>{const[a,c]=p.useState(""),d=e.toLowerCase().replace(/\s+/g,"-");return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":`${d}-title`,children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:`${d}-title`,className:ce.sbModalTitle,children:e}),l.jsx("button",{className:ce.sbModalClose,onClick:o,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:`${d}-comment`,children:[t," ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("textarea",{id:`${d}-comment`,className:ce.sbTextarea,placeholder:r,value:a,onChange:u=>c(u.target.value),rows:4,required:!0,"aria-required":"true"}),a.trim().length===0&&l.jsx("p",{className:ce.sbError,children:"Fill comments"})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:o,children:"Cancel"}),l.jsx(Me,{variant:s,onClick:()=>i(a.trim()),disabled:a.trim().length===0,children:n})]})]})})},Mw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(!1);return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"review-confirm-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"review-confirm-title",className:ce.sbModalTitle,children:"Accepting Terms & Conditions"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsx("div",{className:ce.sbModalBody,children:l.jsxs("label",{style:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:1.55},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:s=>n(s.target.checked),style:{marginTop:2}}),l.jsxs("span",{children:["I agree that by submitting / publishing this Content, I confirm that this Content complies with prescribed guidelines, including the Terms of Use and Content Policy and that I consent to publish it under the"," ",l.jsx("a",{className:"sb-color-primary",style:{fontWeight:600},href:"https://creativecommons.org/licenses",target:"_blank",rel:"noreferrer",children:"Creative Commons Framework"})," ","in accordance with the ",l.jsx("strong",{children:"Content Policy"}),". I have made sure that I do not violate others’ copyright or privacy rights."]})]})}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Me,{variant:"primary",onClick:e,disabled:!r,children:"Submit"})]})]})})},Lw=({onConfirm:e,onCancel:t})=>{const[r,n]=p.useState(""),s=parseInt(r,10),i=!isNaN(s)&&s>=2&&s<=250;return l.jsx("div",{className:ce.sbOverlay,role:"dialog","aria-modal":"true","aria-labelledby":"genqr-title",children:l.jsxs("div",{className:ce.sbModal,children:[l.jsxs("div",{className:ce.sbModalHeader,children:[l.jsx("span",{id:"genqr-title",className:ce.sbModalTitle,children:"Generate QR Codes"}),l.jsx("button",{className:ce.sbModalClose,onClick:t,"aria-label":"Close",type:"button",children:"×"})]}),l.jsxs("div",{className:ce.sbModalBody,children:[l.jsxs("label",{className:ce.sbLabel,htmlFor:"qr-count",children:["Number of QR Codes ",l.jsx("span",{"aria-hidden":"true",style:{color:"var(--sbx-error, #DC2626)"},children:"*"})]}),l.jsx("input",{id:"qr-count",type:"number",min:2,max:250,className:ce.sbTextarea,style:{resize:"none",height:"40px"},placeholder:"Enter number (2–250)",value:r,onChange:o=>n(o.target.value)}),r&&!i&&l.jsx("p",{className:ce.sbError,children:"Enter a number between 2 and 250."})]}),l.jsxs("div",{className:ce.sbModalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:t,children:"Cancel"}),l.jsx(Me,{variant:"primary",onClick:()=>e(s),disabled:!i,children:"Generate"})]})]})})},Fw=({editorMode:e,isSaving:t,isDirty:r,lastSaved:n,isFormValid:s=!0,onToolbarEvent:i})=>{var K,le;const a=Oe(ee=>ee.treeData)[0],c=(a==null?void 0:a.name)??"Untitled",d=Aw(((K=a==null?void 0:a.metadata)==null?void 0:K.status)??(a==null?void 0:a.status)),u=ae(ee=>{var pe,oe,We,xe;return((oe=(pe=ee.editorConfig)==null?void 0:pe.context)==null?void 0:oe.contentId)??((xe=(We=ee.editorConfig)==null?void 0:We.context)==null?void 0:xe.identifier)??""}),{activeModal:f,modalData:g,closeModal:m,openModal:_}=nv(),h=ae(ee=>ee.buttonLoaders),y=ae(ee=>ee.categoryMeta),v=!y||y.schemaDefaults.generateDIALCodes!=="No",[b,S]=p.useState(!1),[w,C]=p.useState(!1),[D,j]=p.useState(!1),k=p.useRef(null),[L,T]=p.useState(!1);p.useEffect(()=>{if(!D)return;const ee=pe=>{var oe;(oe=k.current)!=null&&oe.contains(pe.target)||j(!1)};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[D]);const[A,B]=p.useState(!1),[R,P]=p.useState(!1),{updateNode:F}=Oe(),X=(le=a==null?void 0:a.metadata)==null?void 0:le.qrCodeProcessId,se=p.useCallback(async ee=>{if(u){T(!1),B(!0);try{const{processId:pe,reservedDialcodes:oe}=await ow(u,ee);pe&&a&&F(a.id,{qrCodeProcessId:pe,reservedDialcodes:oe}),Ce.success('QR Codes generation started. Use "Download QR Codes" once ready.')}catch{Ce.error("Failed to generate QR Codes. Please try again.")}finally{B(!1)}}},[u,a,F]),De=p.useCallback(async()=>{if(!X){Ce.error("No QR codes generated yet. Generate QR Codes first.");return}P(!0);try{const ee=await aw(X);if(ee.status==="in-process"){Ce("QR code image generation is in progress. Please try downloading after some time.",{icon:"ℹ️"});return}const pe=ee.url;if(!pe){Ce.error("QR Codes not ready yet. Please wait and try again.");return}const oe=await fetch(pe).then(Le=>Le.blob()),We=await new Promise(Le=>{const Ye=new FileReader;Ye.onloadend=()=>Le(Ye.result),Ye.readAsDataURL(oe)}),xe=(a==null?void 0:a.metadata)??{},Ge=Le=>Array.isArray(Le)?Le.join("_"):typeof Le=="string"?Le:"",Qe=[u,Ge(xe.medium),Ge(xe.gradeLevel),Ge(xe.subject)].filter(Boolean),Be=new Date().toISOString().replace(/[:.]/g,"-"),re=`${Qe.join("_")}_${Be}.zip`,ke=document.createElement("a");ke.href=We,ke.download=re,ke.style.display="none",document.body.appendChild(ke),ke.click(),document.body.removeChild(ke),Ce.success("QR codes downloaded.")}catch{Ce.error("Failed to download QR Codes.")}finally{P(!1)}},[X,a,u]),Se=e==="edit",ve=e==="review",q=e==="sourcingreview",J=e==="read",te=p.useCallback((ee,pe)=>{i({action:ee,data:pe})},[i]),U=p.useCallback(()=>{m(),te("publish")},[m,te]),Z=p.useCallback((ee,pe)=>{const oe=g==null?void 0:g.action;m(),oe==="approve"?te("sourcingApprove",{comment:ee,score:pe}):te("reject",{comment:ee})},[m,te,g]);return l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:ce.topbar,role:"banner",children:[l.jsxs("div",{className:ce.left,children:[l.jsx("button",{className:ce.backBtn,onClick:()=>te("back"),"aria-label":"Go back",type:"button",children:l.jsx(wy,{size:18})}),l.jsx("h1",{className:ce.title,title:c,children:c}),l.jsx("span",{className:`sbx-chip ${ce.statusChip}`,"aria-label":`Status: ${d}`,children:d})]}),l.jsxs("div",{className:ce.right,children:[t?l.jsx("span",{className:ce.savedIndicator,"aria-live":"polite",children:"Saving…"}):r&&Se?l.jsx("span",{className:`${ce.savedIndicator} ${ce.unsaved}`,"aria-live":"polite",children:"Unsaved"}):n?l.jsxs("span",{className:ce.savedIndicator,"aria-live":"polite",children:[l.jsx(Qn,{size:14,"aria-hidden":"true"}),"Saved ",Rw(n)]}):null,!J&&!ve&&!q&&d!=="Review"&&l.jsx("span",{title:s?void 0:"Fill all required fields before saving",children:l.jsx(Me,{variant:"ghost",size:"sm",onClick:()=>te("saveCollection"),disabled:!s,children:"Save as Draft"})}),Se&&l.jsxs(l.Fragment,{children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>C(!0),disabled:h.saveCollection,isLoading:h.saveCollection,children:[l.jsx(Ly,{size:14,"aria-hidden":"true"})," Send for review"]}),l.jsx("button",{className:ce.iconBtn,onClick:()=>_("manageCollaborators"),"aria-label":"Collaborators",title:"Collaborators",type:"button",children:l.jsx(By,{size:16,"aria-hidden":"true"})}),v&&l.jsxs("div",{className:ce.qrDropdown,ref:k,children:[l.jsxs("button",{className:ce.iconBtn,onClick:()=>j(ee=>!ee),"aria-label":"QR Codes",title:"QR Codes",type:"button","aria-haspopup":"true","aria-expanded":D,children:[l.jsx(Xl,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:ce.iconBtnLabel,children:"QR Codes"}),l.jsx("span",{style:{fontSize:10,marginLeft:2},children:"▾"})]}),D&&l.jsxs("div",{className:ce.qrMenu,role:"menu",children:[l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{j(!1),T(!0)},disabled:A,children:[l.jsx(Xl,{size:14}),A?"Generating…":"Generate QR Codes"]}),l.jsxs("button",{role:"menuitem",type:"button",onClick:()=>{j(!1),De()},disabled:R||!X,children:[l.jsx(Dy,{size:14}),R?"Downloading…":"Download QR Codes"]})]})]})]}),ve&&l.jsxs("div",{className:ce.reviewBtns,children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>_("publishChecklist"),disabled:h.publishCollection,isLoading:h.publishCollection,children:[l.jsx(Zd,{size:14,"aria-hidden":"true"})," Publish"]}),l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>S(!0),disabled:h.rejectCollection,isLoading:h.rejectCollection,children:[l.jsx(Zl,{size:14,"aria-hidden":"true"})," Request for Changes"]})]}),q&&l.jsxs("div",{className:ce.sourcingBtns,children:[l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"approve"}),children:[l.jsx(Fy,{size:14,"aria-hidden":"true"})," Approve"]}),l.jsxs(Me,{variant:"primary",size:"sm",onClick:()=>_("qualityParams",{action:"reject"}),children:[l.jsx(Zl,{size:14,"aria-hidden":"true"})," Request for Changes"]})]})]})]}),f==="publishChecklist"&&l.jsx(_v,{contentId:u,onConfirm:U,onCancel:m}),f==="qualityParams"&&l.jsx(wv,{contentId:u,action:(g==null?void 0:g.action)??"reject",onConfirm:Z,onCancel:m}),f==="manageCollaborators"&&l.jsx("div",{className:ce.modalOverlay,role:"dialog","aria-modal":"true",children:l.jsx(sw,{contentId:u,onClose:m})}),w&&l.jsx(Mw,{onConfirm:()=>{C(!1),te("sendForReview")},onCancel:()=>C(!1)}),b&&l.jsx(Pw,{titleText:"Request Changes",labelText:"Changes requested",placeholderText:"Describe the changes the author needs to make",submitLabel:"Request for Changes",submitVariant:"primary",onConfirm:ee=>{S(!1),te("reject",{comment:ee})},onCancel:()=>S(!1)}),L&&l.jsx(Lw,{onConfirm:se,onCancel:()=>T(!1)})]})},$w=({onSave:e,onDiscard:t,onCancel:r,isSaving:n})=>Lr.createPortal(l.jsx("div",{className:Re.overlay,role:"dialog","aria-modal":"true","aria-labelledby":"unsaved-title",children:l.jsxs("div",{className:Re.modal,children:[l.jsxs("div",{className:Re.modalHeader,children:[l.jsx("span",{id:"unsaved-title",children:"Unsaved changes"}),l.jsx("button",{className:Re.modalHeaderClose,onClick:r,"aria-label":"Close",disabled:n,children:"×"})]}),l.jsx("div",{className:Re.modalBody,children:l.jsx("p",{style:{margin:0,fontSize:14,lineHeight:1.5},children:"You have unsaved changes. Would you like to save them before leaving?"})}),l.jsxs("div",{className:Re.modalFooter,children:[l.jsx(Me,{variant:"ghost",onClick:r,disabled:n,children:"Cancel"}),l.jsx(Me,{variant:"danger",onClick:t,disabled:n,children:"Discard"}),l.jsx(Me,{variant:"primary",onClick:e,isLoading:n,disabled:n,children:"Save"})]})]})}),document.body);var Bw=el();const Bf=p.createContext(null);function Nt(){const e=p.useContext(Bf);if(e===null)throw new Error("No Tree Api Provided");return e}const Uf=p.createContext(null);function Uw(){const e=p.useContext(Uf);if(e===null)throw new Error("Provide a NodesContext");return e}const Vf=p.createContext(null);function Vw(){const e=p.useContext(Vf);if(e===null)throw new Error("Provide a DnDContext");return e}const qf=p.createContext(0);function zf(){p.useContext(qf)}function mi(e,t,r){return Math.max(Math.min(e,r),t)}function Hf(e){return e&&e.isLeaf}function Wf(e){return e&&e.isInternal&&!e.isOpen}function Qf(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Kf=(e,t)=>{let r=e;for(;r;){if(r.id===t.id)return!0;r=r.parent}return!1},Gf=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function cl(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let r of e.children){const n=cl(r,t);if(n)return n}return null}function Mi(e,t){if(t(e),e.children)for(let r of e.children)Mi(r,t)}function Yf(e){const t=Zf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=qw(t,n);break}r==null||r.focus()}function Xf(e){const t=Zf(e);let r;for(let n=0;n<t.length;++n)if(t[n]===e){r=zw(t,n);break}r==null||r.focus()}function qw(e,t){return t+1<e.length?e[t+1]:e[0]}function zw(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Zf(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function fs(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function xn(e){return typeof e=="string"?e:e.id}function Hw(e,...t){if(e)return e(...t)}function Jf(e){return new Promise((t,r)=>{let n=0;function s(){n+=1,n===100&&r(),e()?t():setTimeout(s,10)}s()})}function eh(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 th(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:fs,bound:mi,dfs:cl,focusNextElement:Yf,focusPrevElement:Xf,getInsertIndex:eh,getInsertParentId:th,identify:xn,indexOf:Gf,isClosed:Wf,isDescendant:Kf,isItem:Hf,isOpenWithEmptyChildren:Qf,safeRun:Hw,waitFor:Jf,walk:Mi},Symbol.toStringTag,{value:"Module"})),Qw={display:"flex",alignItems:"center",zIndex:1},Kw={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},Gw={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},Yw=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({},Qw),s),children:[l.jsx("div",{style:Object.assign({},Gw)}),l.jsx("div",{style:Object.assign({},Kw)})]})});function Xw({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 Zw(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(eS,Object.assign({},e)):l.jsx(Jw,Object.assign({},e))]})}function Jw(e){return l.jsx(l.Fragment,{children:l.jsx("span",{children:e.node.data.name})})}function eS({node:e}){const t=p.useRef();return p.useEffect(()=>{var r,n;(r=t.current)===null||r===void 0||r.focus(),(n=t.current)===null||n===void 0||n.select()},[]),l.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var n;r.key==="Escape"&&e.reset(),r.key==="Enter"&&e.submit(((n=t.current)===null||n===void 0?void 0:n.value)||"")}})}const Ds="__REACT_ARBORIST_INTERNAL_ROOT__";function Ec(e){var t;function r(i,o,a){const c=e.accessId(i),d=new Is({tree:e,data:i,level:o,parent:a,id:c,children:null,isDraggable:e.isDraggable(i),rowIndex:null}),u=e.accessChildren(i);return u&&(d.children=u.map(f=>r(f,o+1,d))),d}const n=new Is({tree:e,id:Ds,data:{id:Ds},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),s=(t=e.props.data)!==null&&t!==void 0?t:[];return n.children=s.map(i=>r(i,0,n)),n}class Is{constructor(t){this.handleClick=r=>{(r.metaKey||r.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():r.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===Ds}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,r;const n=this.childIndex;return(r=(t=this.parent)===null||t===void 0?void 0:t.children[n+1])!==null&&r!==void 0?r:null}isAncestorOf(t){if(!t)return!1;let r=t;for(;r;){if(r.id===this.id)return!0;r=r.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Is(Object.assign({},this))}edit(){return this.tree.edit(this)}}function Oo(e){return{type:"EDIT",id:e}}function tS(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function gn(e){return{type:"FOCUS",id:e}}function rS(){return{type:"TREE_BLUR"}}function nS(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 wa={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function Oc(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const r=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!r})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function sS(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:Oc(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:Oc(e.unfiltered,t)}):e}const Vn=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}}},xr={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:xn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(xn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(xn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:xn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:xn(e)})};function iS(e=Vn().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 qn={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 oS(e=Vn().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 Vn().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const aS={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},lS=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t}px, ${r}px)`}},cS=e=>{if(!e)return{display:"none"};const{x:t,y:r}=e;return{transform:`translate(${t+10}px, ${r+10}px)`}};function rh({offset:e,mouse:t,id:r,dragIds:n,isDragging:s}){return l.jsxs(uS,{isDragging:s,children:[l.jsx(dS,{offset:e,children:l.jsx(hS,{id:r,dragIds:n})}),l.jsx(fS,{mouse:t,count:n.length})]})}const uS=p.memo(function(t){return t.isDragging?l.jsx("div",{style:aS,children:t.children}):null});function dS(e){return l.jsx("div",{className:"row preview",style:lS(e.offset),children:e.children})}function fS(e){const{count:t,mouse:r}=e;return t>1?l.jsx("div",{className:"selected-count",style:cS(r),children:t}):null}const hS=p.memo(function(t){const r=Nt(),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 Sa(){return Sa=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},Sa.apply(null,arguments)}function Dc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xa(e,t){return xa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},xa(e,t)}function pS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xa(e,t)}var Ic=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function gS(e,t){return!!(e===t||Ic(e)&&Ic(t))}function mS(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!gS(e[r],t[r]))return!1;return!0}function Do(e,t){t===void 0&&(t=mS);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 yS=typeof performance=="object"&&typeof performance.now=="function",Tc=yS?function(){return performance.now()}:function(){return Date.now()};function Nc(e){cancelAnimationFrame(e.id)}function vS(e,t){var r=Tc();function n(){Tc()-r>=t?e.call(null):s.id=requestAnimationFrame(n)}var s={id:requestAnimationFrame(n)};return s}var Io=-1;function jc(e){if(e===void 0&&(e=!1),Io===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Io=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Io}var mn=null;function kc(e){if(e===void 0&&(e=!1),mn===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),s=n.style;return s.width="100px",s.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?mn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?mn="negative":mn="positive-ascending"),document.body.removeChild(t),mn}return mn}process.env.NODE_ENV;var bS=150,_S=function(t,r){return t},yi=null,vi=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(yi=new WeakSet,vi=new WeakSet);function nh(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){pS(g,f);function g(_){var h;return h=f.call(this,_)||this,h._instanceProps=c(h.props,Dc(h)),h._outerRef=void 0,h._resetIsScrollingTimeoutId=null,h.state={instance:Dc(h),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof h.props.initialScrollOffset=="number"?h.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},h._callOnItemsRendered=void 0,h._callOnItemsRendered=Do(function(y,v,b,S){return h.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:b,visibleStopIndex:S})}),h._callOnScroll=void 0,h._callOnScroll=Do(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,S=v.itemSize,w=v.layout,C=h._getItemStyleCache(d&&S,d&&w,d&&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",T=b==="rtl",A=L?j:0;C[y]=D={position:"absolute",left:T?void 0:A,right:T?A:void 0,top:L?0:j,height:L?"100%":k,width:L?k:"100%"}}return D},h._getItemStyleCache=void 0,h._getItemStyleCache=Do(function(y,v,b){return{}}),h._onScrollHorizontal=function(y){var v=y.currentTarget,b=v.clientWidth,S=v.scrollLeft,w=v.scrollWidth;h.setState(function(C){if(C.scrollOffset===S)return null;var D=h.props.direction,j=S;if(D==="rtl")switch(kc()){case"negative":j=-S;break;case"positive-descending":j=w-b-S;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,S=v.scrollHeight,w=v.scrollTop;h.setState(function(C){if(C.scrollOffset===w)return null;var D=Math.max(0,Math.min(w,S-b));return{isScrolling:!0,scrollDirection:C.scrollOffset<D?"forward":"backward",scrollOffset:D,scrollUpdateWasRequested:!1}},h._resetIsScrollingDebounced)},h._outerRefSetter=function(y){var v=h.props.outerRef;h._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},h._resetIsScrollingDebounced=function(){h._resetIsScrollingTimeoutId!==null&&Nc(h._resetIsScrollingTimeoutId),h._resetIsScrollingTimeoutId=vS(h._resetIsScrolling,bS)},h._resetIsScrolling=function(){h._resetIsScrollingTimeoutId=null,h.setState({isScrolling:!1},function(){h._getItemStyleCache(-1,null)})},h}g.getDerivedStateFromProps=function(h,y){return wS(h,y),u(h),null};var m=g.prototype;return m.scrollTo=function(h){h=Math.max(0,h),this.setState(function(y){return y.scrollOffset===h?null:{scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},m.scrollToItem=function(h,y){y===void 0&&(y="auto");var v=this.props,b=v.itemCount,S=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;S==="vertical"?C=D.scrollWidth>D.clientWidth?jc():0:C=D.scrollHeight>D.clientHeight?jc():0}this.scrollTo(i(this.props,h,y,w,this._instanceProps,C))},m.componentDidMount=function(){var h=this.props,y=h.direction,v=h.initialScrollOffset,b=h.layout;if(typeof v=="number"&&this._outerRef!=null){var S=this._outerRef;y==="horizontal"||b==="horizontal"?S.scrollLeft=v:S.scrollTop=v}this._callPropsCallbacks()},m.componentDidUpdate=function(){var h=this.props,y=h.direction,v=h.layout,b=this.state,S=b.scrollOffset,w=b.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var C=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(kc()){case"negative":C.scrollLeft=-S;break;case"positive-ascending":C.scrollLeft=S;break;default:var D=C.clientWidth,j=C.scrollWidth;C.scrollLeft=j-D-S;break}else C.scrollLeft=S;else C.scrollTop=S}this._callPropsCallbacks()},m.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Nc(this._resetIsScrollingTimeoutId)},m.render=function(){var h=this.props,y=h.children,v=h.className,b=h.direction,S=h.height,w=h.innerRef,C=h.innerElementType,D=h.innerTagName,j=h.itemCount,k=h.itemData,L=h.itemKey,T=L===void 0?_S:L,A=h.layout,B=h.outerElementType,R=h.outerTagName,P=h.style,F=h.useIsScrolling,X=h.width,se=this.state.isScrolling,De=b==="horizontal"||A==="horizontal",Se=De?this._onScrollHorizontal:this._onScrollVertical,ve=this._getRangeToRender(),q=ve[0],J=ve[1],te=[];if(j>0)for(var U=q;U<=J;U++)te.push(p.createElement(y,{data:k,key:T(U,k),index:U,isScrolling:F?se:void 0,style:this._getItemStyle(U)}));var Z=n(this.props,this._instanceProps);return p.createElement(B||R||"div",{className:v,onScroll:Se,ref:this._outerRefSetter,style:Sa({position:"relative",height:S,width:X,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:b},P)},p.createElement(C||D||"div",{children:te,ref:w,style:{height:De?"100%":Z,pointerEvents:se?"none":void 0,width:De?Z:"100%"}}))},m._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var h=this.props.itemCount;if(h>0){var y=this._getRangeToRender(),v=y[0],b=y[1],S=y[2],w=y[3];this._callOnItemsRendered(v,b,S,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)}},m._getRangeToRender=function(){var h=this.props,y=h.itemCount,v=h.overscanCount,b=this.state,S=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=!S||w==="backward"?Math.max(1,v):1,L=!S||w==="forward"?Math.max(1,v):1;return[Math.max(0,D-k),Math.max(0,Math.min(y-1,j+L)),D,j]},g}(p.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var wS=function(t,r){var n=t.children,s=t.direction,i=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,d=t.width,u=r.instance;if(process.env.NODE_ENV!=="production"){(a!=null||c!=null)&&vi&&!vi.has(u)&&(vi.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=s==="horizontal"||o==="horizontal";switch(s){case"horizontal":case"vertical":yi&&!yi.has(u)&&(yi.add(u),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+s+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!f&&typeof i!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(i===null?"null":typeof i)+'" was specified.'))}},SS=50,Cn=function(t,r,n){var s=t,i=s.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var c=0;if(a>=0){var d=o[a];c=d.offset+d.size}for(var u=a+1;u<=r;u++){var f=i(u);o[u]={offset:c,size:f},c+=f}n.lastMeasuredIndex=r}return o[r]},xS=function(t,r,n){var s=r.itemMetadataMap,i=r.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=n?sh(t,r,i,0,n):CS(t,r,Math.max(0,i),n)},sh=function(t,r,n,s,i){for(;s<=n;){var o=s+Math.floor((n-s)/2),a=Cn(t,o,r).offset;if(a===i)return o;a<i?s=o+1:a>i&&(n=o-1)}return s>0?s-1:0},CS=function(t,r,n,s){for(var i=t.itemCount,o=1;n<i&&Cn(t,n,r).offset<s;)n+=o,o*=2;return sh(t,r,Math.min(n,i-1),Math.floor(n/2),s)},Rc=function(t,r){var n=t.itemCount,s=r.itemMetadataMap,i=r.estimatedItemSize,o=r.lastMeasuredIndex,a=0;if(o>=n&&(o=n-1),o>=0){var c=s[o];a=c.offset+c.size}var d=n-o-1,u=d*i;return a+u},ES=nh({getItemOffset:function(t,r,n){return Cn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:Rc,getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.layout,u=t.width,f=a==="horizontal"||d==="horizontal",g=f?u:c,m=Cn(t,r,i),_=Rc(t,i),h=Math.max(0,Math.min(_-g,m.offset)),y=Math.max(0,m.offset-g+m.size+o);switch(n==="smart"&&(s>=y-g&&s<=h+g?n="auto":n="center"),n){case"start":return h;case"end":return y;case"center":return Math.round(y+(h-y)/2);case"auto":default:return s>=y&&s<=h?s:s<y?y:h}},getStartIndexForOffset:function(t,r,n){return xS(t,n,r)},getStopIndexForStartIndex:function(t,r,n,s){for(var i=t.direction,o=t.height,a=t.itemCount,c=t.layout,d=t.width,u=i==="horizontal"||c==="horizontal",f=u?d:o,g=Cn(t,r,s),m=n+f,_=g.offset+g.size,h=r;h<a-1&&_<m;)h++,_+=Cn(t,h,s).size;return h},initInstanceProps:function(t,r){var n=t,s=n.estimatedItemSize,i={itemMetadataMap:{},estimatedItemSize:s||SS,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.'))}}),OS=nh({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,s,i,o){var a=t.direction,c=t.height,d=t.itemCount,u=t.itemSize,f=t.layout,g=t.width,m=a==="horizontal"||f==="horizontal",_=m?g:c,h=Math.max(0,d*u-_),y=Math.min(h,r*u),v=Math.max(0,r*u-_+u+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,d=t.width,u=s==="horizontal"||c==="horizontal",f=r*a,g=u?d:i,m=Math.ceil((g+n-f)/a);return Math.max(0,Math.min(o-1,r+m-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function DS(){var e,t;const r=Nt(),s=Vw().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 IS=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 TS=p.forwardRef(function(t,r){const{children:n}=t,s=IS(t,["children"]),i=Nt();return l.jsxs("div",Object.assign({ref:r},s,{onClick:o=>{o.currentTarget===o.target&&i.deselectAll()},children:[l.jsx(NS,{}),n]}))}),NS=()=>{const e=Nt();return l.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:l.jsx(DS,{})})};var jS=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 kS=p.forwardRef(function(t,r){var n,s,i,o,{style:a}=t,c=jS(t,["style"]);const d=Nt(),u=(s=(n=d.props.padding)!==null&&n!==void 0?n:d.props.paddingTop)!==null&&s!==void 0?s:0,f=(o=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingBottom)!==null&&o!==void 0?o:0;return l.jsx("div",Object.assign({ref:r,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+u+f}px`})},c))});var ih=p.createContext({dragDropManager:void 0}),zt;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(zt||(zt={}));function de(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!e){var i;if(t===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;i=new Error(t.replace(/%s/g,function(){return n[o++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var ul="dnd-core/INIT_COORDS",ro="dnd-core/BEGIN_DRAG",dl="dnd-core/PUBLISH_DRAG_SOURCE",no="dnd-core/HOVER",so="dnd-core/DROP",io="dnd-core/END_DRAG";function Ac(e,t){return{type:ul,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function bi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bi=function(r){return typeof r}:bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bi(e)}function RS(e,t,r){return t.split(".").reduce(function(n,s){return n&&n[s]?n[s]:r||null},e)}function AS(e,t){return e.filter(function(r){return r!==t})}function oh(e){return bi(e)==="object"}function PS(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 MS(e,t){return e.filter(function(r){return t.indexOf(r)>-1})}var LS={type:ul,payload:{clientOffset:null,sourceClientOffset:null}};function FS(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},s=n.publishSource,i=s===void 0?!0:s,o=n.clientOffset,a=n.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(Ac(o)),$S(r,c,d);var u=VS(r,c);if(u===null){e.dispatch(LS);return}var f=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");BS(a),f=a(u)}e.dispatch(Ac(o,f));var g=d.getSource(u),m=g.beginDrag(c,u);if(m!=null){US(m),d.pinSource(u);var _=d.getSourceType(u);return{type:ro,payload:{itemType:_,item:m,sourceId:u,clientOffset:o||null,sourceClientOffset:f||null,isSourcePublic:!!i}}}}}function $S(e,t,r){de(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){de(r.getSource(n),"Expected sourceIds to be registered.")})}function BS(e){de(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function US(e){de(oh(e),"Item must be an object.")}function VS(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 qS(e){return function(){var r=e.getMonitor();if(r.isDragging())return{type:dl}}}function Ca(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(r){return r===t}):e===t}function zS(e){return function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.clientOffset;HS(r);var i=r.slice(0),o=e.getMonitor(),a=e.getRegistry();WS(i,o,a);var c=o.getItemType();return QS(i,a,c),KS(i,o,a),{type:no,payload:{targetIds:i,clientOffset:s||null}}}}function HS(e){de(Array.isArray(e),"Expected targetIds to be an array.")}function WS(e,t,r){de(t.isDragging(),"Cannot call hover while not dragging."),de(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var s=e[n];de(e.lastIndexOf(s)===n,"Expected targetIds to be unique in the passed array.");var i=r.getTarget(s);de(i,"Expected targetIds to be registered.")}}function QS(e,t,r){for(var n=e.length-1;n>=0;n--){var s=e[n],i=t.getTargetType(s);Ca(i,r)||e.splice(n,1)}}function KS(e,t,r){e.forEach(function(n){var s=r.getTarget(n);s.hover(t,n)})}function Pc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Mc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Pc(Object(r),!0).forEach(function(n){GS(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 GS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YS(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.getMonitor(),s=e.getRegistry();XS(n);var i=ex(n);i.forEach(function(o,a){var c=ZS(o,a,s,n),d={type:so,payload:{dropResult:Mc(Mc({},r),c)}};e.dispatch(d)})}}function XS(e){de(e.isDragging(),"Cannot call drop while not dragging."),de(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function ZS(e,t,r,n){var s=r.getTarget(e),i=s?s.drop(n,e):void 0;return JS(i),typeof i>"u"&&(i=t===0?{}:n.getDropResult()),i}function JS(e){de(typeof e>"u"||oh(e),"Drop result must either be an object or undefined.")}function ex(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();rx(r);var s=r.getSourceId();if(s!=null){var i=n.getSource(s,!0);i.endDrag(r,s),n.unpinSource()}return{type:io}}}function rx(e){de(e.isDragging(),"Cannot call endDrag while not dragging.")}function nx(e){return{beginDrag:FS(e),publishDragSource:qS(e),hover:zS(e),drop:YS(e),endDrag:tx(e)}}function sx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ix(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 ox(e,t,r){return t&&ix(e.prototype,t),e}function ns(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ax=function(){function e(t,r){var n=this;sx(this,e),ns(this,"store",void 0),ns(this,"monitor",void 0),ns(this,"backend",void 0),ns(this,"isSetUp",!1),ns(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 ox(e,[{key:"receiveBackend",value:function(r){this.backend=r}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var r=this,n=this.store.dispatch;function s(o){return function(){for(var a=arguments.length,c=new Array(a),d=0;d<a;d++)c[d]=arguments[d];var u=o.apply(r,c);typeof u<"u"&&n(u)}}var i=nx(this);return Object.keys(i).reduce(function(o,a){var c=i[a];return o[a]=s(c),o},{})}},{key:"dispatch",value:function(r){this.store.dispatch(r)}}]),e}();function $t(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Lc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Fc=function(){return Math.random().toString(36).substring(7).split("").join(".")},$c={INIT:"@@redux/INIT"+Fc(),REPLACE:"@@redux/REPLACE"+Fc()};function 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 cx(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(fx(e))return"date";if(dx(e))return"error";var r=ux(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 ux(e){return typeof e.constructor=="function"?e.constructor.name:null}function dx(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function fx(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function yn(e){var t=typeof e;return process.env.NODE_ENV!=="production"&&(t=cx(e)),t}function ah(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?$t(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?$t(1):"Expected the enhancer to be a function. Instead, received: '"+yn(r)+"'");return r(ah)(e,t)}if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?$t(2):"Expected the root reducer to be a function. Instead, received: '"+yn(e)+"'");var s=e,i=t,o=[],a=o,c=!1;function d(){a===o&&(a=o.slice())}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?$t(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?$t(4):"Expected the listener to be a function. Instead, received: '"+yn(h)+"'");if(c)throw new Error(process.env.NODE_ENV==="production"?$t(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var y=!0;return d(),a.push(h),function(){if(y){if(c)throw new Error(process.env.NODE_ENV==="production"?$t(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");y=!1,d();var b=a.indexOf(h);a.splice(b,1),o=null}}}function g(h){if(!lx(h))throw new Error(process.env.NODE_ENV==="production"?$t(7):"Actions must be plain objects. Instead, the actual type was: '"+yn(h)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof h.type>"u")throw new Error(process.env.NODE_ENV==="production"?$t(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error(process.env.NODE_ENV==="production"?$t(9):"Reducers may not dispatch actions.");try{c=!0,i=s(i,h)}finally{c=!1}for(var y=o=a,v=0;v<y.length;v++){var b=y[v];b()}return h}function m(h){if(typeof h!="function")throw new Error(process.env.NODE_ENV==="production"?$t(10):"Expected the nextReducer to be a function. Instead, received: '"+yn(h));s=h,g({type:$c.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"?$t(11):"Expected the observer to be an object. Instead, received: '"+yn(b)+"'");function S(){b.next&&b.next(u())}S();var w=y(S);return{unsubscribe:w}}},h[Lc]=function(){return this},h}return g({type:$c.INIT}),n={dispatch:g,subscribe:f,getState:u,replaceReducer:m},n[Lc]=_,n}var hx=function(t,r){return t===r};function px(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function gx(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:hx;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function Bc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Uc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bc(Object(r),!0).forEach(function(n){mx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Vc={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function yx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vc,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case ul:case ro:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case no:return px(e.clientOffset,r.clientOffset)?e:Uc(Uc({},e),{},{clientOffset:r.clientOffset});case io:case so:return Vc;default:return e}}var fl="dnd-core/ADD_SOURCE",hl="dnd-core/ADD_TARGET",pl="dnd-core/REMOVE_SOURCE",oo="dnd-core/REMOVE_TARGET";function vx(e){return{type:fl,payload:{sourceId:e}}}function bx(e){return{type:hl,payload:{targetId:e}}}function _x(e){return{type:pl,payload:{sourceId:e}}}function wx(e){return{type:oo,payload:{targetId:e}}}function qc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Bt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qc(Object(r),!0).forEach(function(n){Sx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sx(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 Cx(){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 ro:return Bt(Bt({},e),{},{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case dl:return Bt(Bt({},e),{},{isSourcePublic:!0});case no:return Bt(Bt({},e),{},{targetIds:r.targetIds});case oo:return e.targetIds.indexOf(r.targetId)===-1?e:Bt(Bt({},e),{},{targetIds:AS(e.targetIds,r.targetId)});case so:return Bt(Bt({},e),{},{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case io:return Bt(Bt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function Ex(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case fl:case hl:return e+1;case pl:case oo:return e-1;default:return e}}var Li=[],gl=[];Li.__IS_NONE__=!0;gl.__IS_ALL__=!0;function Ox(e,t){if(e===Li)return!1;if(e===gl||typeof t>"u")return!0;var r=MS(t,e);return r.length>0}function Dx(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case no:break;case fl:case hl:case oo:case pl:return Li;case ro:case dl:case io:case so:default:return gl}var t=e.payload,r=t.targetIds,n=r===void 0?[]:r,s=t.prevTargetIds,i=s===void 0?[]:s,o=PS(n,i),a=o.length>0||!gx(n,i);if(!a)return Li;var c=i[i.length-1],d=n[n.length-1];return c!==d&&(c&&o.push(c),d&&o.push(d)),o}function Ix(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function zc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Hc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zc(Object(r),!0).forEach(function(n){Tx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tx(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:Dx(e.dirtyHandlerIds,{type:t.type,payload:Hc(Hc({},t.payload),{},{prevTargetIds:RS(e,"dragOperation.targetIds",[])})}),dragOffset:yx(e.dragOffset,t),refCount:Ex(e.refCount,t),dragOperation:Cx(e.dragOperation,t),stateId:Ix(e.stateId)}}function jx(e,t){return{x:e.x+t.x,y:e.y+t.y}}function lh(e,t){return{x:e.x-t.x,y:e.y-t.y}}function kx(e){var t=e.clientOffset,r=e.initialClientOffset,n=e.initialSourceClientOffset;return!t||!r||!n?null:lh(jx(t,n),r)}function Rx(e){var t=e.clientOffset,r=e.initialClientOffset;return!t||!r?null:lh(t,r)}function Ax(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Px(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 Mx(e,t,r){return t&&Px(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 Lx=function(){function e(t,r){Ax(this,e),Wc(this,"store",void 0),Wc(this,"registry",void 0),this.store=t,this.registry=r}return Mx(e,[{key:"subscribeToStateChange",value:function(r){var n=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},i=s.handlerIds;de(typeof r=="function","listener must be a function."),de(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var d=n.store.getState(),u=d.stateId;try{var f=u===o||u===o+1&&!Ox(d.dirtyHandlerIds,i);f||r()}finally{o=u}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(r){var n=this;de(typeof r=="function","listener must be a function.");var s=this.store.getState().dragOffset,i=function(){var a=n.store.getState().dragOffset;a!==s&&(s=a,r())};return this.store.subscribe(i)}},{key:"canDragSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r);return de(n,"Expected to find a valid source. sourceId=".concat(r)),this.isDragging()?!1:n.canDrag(this,r)}},{key:"canDropOnTarget",value:function(r){if(!r)return!1;var n=this.registry.getTarget(r);if(de(n,"Expected to find a valid target. targetId=".concat(r)),!this.isDragging()||this.didDrop())return!1;var s=this.registry.getTargetType(r),i=this.getItemType();return Ca(s,i)&&n.canDrop(this,r)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(r){if(!r)return!1;var n=this.registry.getSource(r,!0);if(de(n,"Expected to find a valid source. sourceId=".concat(r)),!this.isDragging()||!this.isSourcePublic())return!1;var s=this.registry.getSourceType(r),i=this.getItemType();return s!==i?!1:n.isDragging(this,r)}},{key:"isOverTarget",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!r)return!1;var s=n.shallow;if(!this.isDragging())return!1;var i=this.registry.getTargetType(r),o=this.getItemType();if(o&&!Ca(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 kx(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return Rx(this.store.getState().dragOffset)}}]),e}(),Fx=0;function $x(){return Fx++}function _i(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_i=function(r){return typeof r}:_i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_i(e)}function Bx(e){de(typeof e.canDrag=="function","Expected canDrag to be a function."),de(typeof e.beginDrag=="function","Expected beginDrag to be a function."),de(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Ux(e){de(typeof e.canDrop=="function","Expected canDrop to be a function."),de(typeof e.hover=="function","Expected hover to be a function."),de(typeof e.drop=="function","Expected beginDrag to be a function.")}function Ea(e,t){if(t&&Array.isArray(e)){e.forEach(function(r){return Ea(r,!1)});return}de(typeof e=="string"||_i(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Qc=typeof global<"u"?global:self,ch=Qc.MutationObserver||Qc.WebKitMutationObserver;function uh(e){return function(){const r=setTimeout(s,0),n=setInterval(s,50);function s(){clearTimeout(r),clearInterval(n),e()}}}function Vx(e){let t=1;const r=new ch(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const qx=typeof ch=="function"?Vx:uh;class zx{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=qx(this.flush),this.requestErrorThrow=uh(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class Hx{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 Wx{create(t){const r=this.freeTasks,n=r.length?r.pop():new Hx(this.onError,s=>r[r.length]=s);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const dh=new zx,Qx=new Wx(dh.registerPendingError);function Kx(e){dh.enqueueTask(Qx.create(e))}function Gx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yx(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 Xx(e,t,r){return t&&Yx(e.prototype,t),e}function vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zx(e,t){return rC(e)||tC(e,t)||eC(e,t)||Jx()}function Jx(){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 eC(e,t){if(e){if(typeof e=="string")return Kc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kc(e,t)}}function Kc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function rC(e){if(Array.isArray(e))return e}function nC(e){var t=$x().toString();switch(e){case zt.SOURCE:return"S".concat(t);case zt.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Gc(e){switch(e[0]){case"S":return zt.SOURCE;case"T":return zt.TARGET;default:de(!1,"Cannot parse handler ID: ".concat(e))}}function Yc(e,t){var r=e.entries(),n=!1;do{var s=r.next(),i=s.done,o=Zx(s.value,2),a=o[1];if(a===t)return!0;n=!!i}while(!n);return!1}var sC=function(){function e(t){Gx(this,e),vn(this,"types",new Map),vn(this,"dragSources",new Map),vn(this,"dropTargets",new Map),vn(this,"pinnedSourceId",null),vn(this,"pinnedSource",null),vn(this,"store",void 0),this.store=t}return Xx(e,[{key:"addSource",value:function(r,n){Ea(r),Bx(n);var s=this.addHandler(zt.SOURCE,r,n);return this.store.dispatch(vx(s)),s}},{key:"addTarget",value:function(r,n){Ea(r,!0),Ux(n);var s=this.addHandler(zt.TARGET,r,n);return this.store.dispatch(bx(s)),s}},{key:"containsHandler",value:function(r){return Yc(this.dragSources,r)||Yc(this.dropTargets,r)}},{key:"getSource",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;de(this.isSourceId(r),"Expected a valid source ID.");var s=n&&r===this.pinnedSourceId,i=s?this.pinnedSource:this.dragSources.get(r);return i}},{key:"getTarget",value:function(r){return de(this.isTargetId(r),"Expected a valid target ID."),this.dropTargets.get(r)}},{key:"getSourceType",value:function(r){return de(this.isSourceId(r),"Expected a valid source ID."),this.types.get(r)}},{key:"getTargetType",value:function(r){return de(this.isTargetId(r),"Expected a valid target ID."),this.types.get(r)}},{key:"isSourceId",value:function(r){var n=Gc(r);return n===zt.SOURCE}},{key:"isTargetId",value:function(r){var n=Gc(r);return n===zt.TARGET}},{key:"removeSource",value:function(r){var n=this;de(this.getSource(r),"Expected an existing source."),this.store.dispatch(_x(r)),Kx(function(){n.dragSources.delete(r),n.types.delete(r)})}},{key:"removeTarget",value:function(r){de(this.getTarget(r),"Expected an existing target."),this.store.dispatch(wx(r)),this.dropTargets.delete(r),this.types.delete(r)}},{key:"pinSource",value:function(r){var n=this.getSource(r);de(n,"Expected an existing source."),this.pinnedSourceId=r,this.pinnedSource=n}},{key:"unpinSource",value:function(){de(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(r,n,s){var i=nC(r);return this.types.set(i,n),r===zt.SOURCE?this.dragSources.set(i,s):r===zt.TARGET&&this.dropTargets.set(i,s),i}}]),e}();function iC(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=oC(n),i=new Lx(s,new sC(s)),o=new ax(s,i),a=e(o,t,r);return o.receiveBackend(a),o}function oC(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return ah(Nx,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var aC=["children"];function lC(e,t){return fC(e)||dC(e,t)||uC(e,t)||cC()}function cC(){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 uC(e,t){if(e){if(typeof e=="string")return Xc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xc(e,t)}}function Xc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function dC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function fC(e){if(Array.isArray(e))return e}function hC(e,t){if(e==null)return{};var r=pC(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 pC(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,i;for(i=0;i<n.length;i++)s=n[i],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Zc=0,wi=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),gC=p.memo(function(t){var r=t.children,n=hC(t,aC),s=mC(n),i=lC(s,2),o=i[0],a=i[1];return p.useEffect(function(){if(a){var c=fh();return++Zc,function(){--Zc===0&&(c[wi]=null)}}},[]),l.jsx(ih.Provider,Object.assign({value:o},{children:r}),void 0)});function mC(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var r=yC(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[r,n]}function yC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fh(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,s=t;return s[wi]||(s[wi]={dragDropManager:iC(e,t,r,n)}),s[wi]}function fh(){return typeof global<"u"?global:window}function vC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _C(e,t,r){return t&&bC(e.prototype,t),e}function Jc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var To=!1,No=!1,wC=function(){function e(t){vC(this,e),Jc(this,"internalMonitor",void 0),Jc(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return _C(e,[{key:"receiveHandlerId",value:function(r){this.sourceId=r}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){de(!To,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return To=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{To=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;de(!No,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return No=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{No=!1}}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"isDraggingSource",value:function(r){return this.internalMonitor.isDraggingSource(r)}},{key:"isOverTarget",value:function(r,n){return this.internalMonitor.isOverTarget(r,n)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(r){return this.internalMonitor.subscribeToOffsetChange(r)}},{key:"canDragSource",value:function(r){return this.internalMonitor.canDragSource(r)}},{key:"canDropOnTarget",value:function(r){return this.internalMonitor.canDropOnTarget(r)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function SC(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 CC(e,t,r){return t&&xC(e.prototype,t),e}function eu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jo=!1,EC=function(){function e(t){SC(this,e),eu(this,"internalMonitor",void 0),eu(this,"targetId",null),this.internalMonitor=t.getMonitor()}return CC(e,[{key:"receiveHandlerId",value:function(r){this.targetId=r}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(r,n){return this.internalMonitor.subscribeToStateChange(r,n)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;de(!jo,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return jo=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{jo=!1}}},{key:"isOver",value:function(r){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,r):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function OC(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 DC(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;OC(s);var i=r?function(o){return e(o,r)}:e;return IC(s,i)}}function hh(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=DC(n);t[r]=function(){return s}}}),t}function tu(e,t){typeof e=="function"?e(t):e.current=t}function IC(e,t){var r=e.ref;return de(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?p.cloneElement(e,{ref:function(s){tu(r,s),tu(t,s)}}):p.cloneElement(e,{ref:t})}function Si(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Si=function(r){return typeof r}:Si=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Si(e)}function Oa(e){return e!==null&&Si(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Da(e,t,r,n){var s=void 0;if(s!==void 0)return!!s;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<i.length;c++){var d=i[c];if(!a(d))return!1;var u=e[d],f=t[d];if(s=void 0,s===!1||s===void 0&&u!==f)return!1}return!0}function TC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NC(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 jC(e,t,r){return t&&NC(e.prototype,t),e}function pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var kC=function(){function e(t){var r=this;TC(this,e),pt(this,"hooks",hh({dragSource:function(s,i){r.clearDragSource(),r.dragSourceOptions=i||null,Oa(s)?r.dragSourceRef=s:r.dragSourceNode=s,r.reconnectDragSource()},dragPreview:function(s,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,Oa(s)?r.dragPreviewRef=s:r.dragPreviewNode=s,r.reconnectDragPreview()}})),pt(this,"handlerId",null),pt(this,"dragSourceRef",null),pt(this,"dragSourceNode",void 0),pt(this,"dragSourceOptionsInternal",null),pt(this,"dragSourceUnsubscribe",void 0),pt(this,"dragPreviewRef",null),pt(this,"dragPreviewNode",void 0),pt(this,"dragPreviewOptionsInternal",null),pt(this,"dragPreviewUnsubscribe",void 0),pt(this,"lastConnectedHandlerId",null),pt(this,"lastConnectedDragSource",null),pt(this,"lastConnectedDragSourceOptions",null),pt(this,"lastConnectedDragPreview",null),pt(this,"lastConnectedDragPreviewOptions",null),pt(this,"backend",void 0),this.backend=t}return jC(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!Da(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!Da(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 RC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function PC(e,t,r){return t&&AC(e.prototype,t),e}function nr(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){var r=this;RC(this,e),nr(this,"hooks",hh({dropTarget:function(s,i){r.clearDropTarget(),r.dropTargetOptions=i,Oa(s)?r.dropTargetRef=s:r.dropTargetNode=s,r.reconnect()}})),nr(this,"handlerId",null),nr(this,"dropTargetRef",null),nr(this,"dropTargetNode",void 0),nr(this,"dropTargetOptionsInternal",null),nr(this,"unsubscribeDropTarget",void 0),nr(this,"lastConnectedHandlerId",null),nr(this,"lastConnectedDropTarget",null),nr(this,"lastConnectedDropTargetOptions",null),nr(this,"backend",void 0),this.backend=t}return PC(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var r=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();r&&this.disconnectDropTarget();var n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(r){r!==this.handlerId&&(this.handlerId=r,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(r){this.dropTargetOptionsInternal=r}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!Da(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 LC(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 un=typeof window<"u"?p.useLayoutEffect:p.useEffect;function xi(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?xi=function(r){return typeof r}:xi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},xi(e)}function $C(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function BC(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function UC(e,t,r){return t&&BC(e.prototype,t),e}function ko(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var VC=function(){function e(t,r,n){$C(this,e),ko(this,"spec",void 0),ko(this,"monitor",void 0),ko(this,"connector",void 0),this.spec=t,this.monitor=r,this.connector=n}return UC(e,[{key:"beginDrag",value:function(){var r,n=this.spec,s=this.monitor,i=null;return xi(n.item)==="object"?i=n.item:typeof n.item=="function"?i=n.item(s):i={},(r=i)!==null&&r!==void 0?r:null}},{key:"canDrag",value:function(){var r=this.spec,n=this.monitor;return typeof r.canDrag=="boolean"?r.canDrag:typeof r.canDrag=="function"?r.canDrag(n):!0}},{key:"isDragging",value:function(r,n){var s=this.spec,i=this.monitor,o=s.isDragging;return o?o(i):n===r.getSourceId()}},{key:"endDrag",value:function(){var r=this.spec,n=this.monitor,s=this.connector,i=r.end;i&&i(n.getItem(),n),s.reconnect()}}]),e}();function qC(e,t,r){var n=p.useMemo(function(){return new VC(e,t,r)},[t,r]);return p.useEffect(function(){n.spec=e},[e]),n}function fn(){var e=p.useContext(ih),t=e.dragDropManager;return de(t!=null,"Expected drag drop context"),t}function zC(e){return p.useMemo(function(){var t=e.type;return de(t!=null,"spec.type must be defined"),t},[e])}function HC(e,t){return GC(e)||KC(e,t)||QC(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 QC(e,t){if(e){if(typeof e=="string")return ru(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ru(e,t)}}function ru(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function KC(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function GC(e){if(Array.isArray(e))return e}function YC(e,t,r){var n=fn(),s=qC(e,t,r),i=zC(e);un(function(){if(i!=null){var a=FC(i,s,n),c=HC(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u}},[n,t,r,s,i])}function XC(e){return t0(e)||e0(e)||JC(e)||ZC()}function ZC(){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 JC(e,t){if(e){if(typeof e=="string")return Ia(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 Ia(e,t)}}function e0(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function t0(e){if(Array.isArray(e))return Ia(e)}function Ia(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 ph(e,t){var r=XC(t||[]);return t==null&&typeof e!="function"&&r.push(e),p.useMemo(function(){return typeof e=="function"?e():e},r)}function r0(){var e=fn();return p.useMemo(function(){return new wC(e)},[e])}function n0(e,t){var r=fn(),n=p.useMemo(function(){return new kC(r.getBackend())},[r]);return un(function(){return n.dragSourceOptions=e||null,n.reconnect(),function(){return n.disconnectDragSource()}},[n,e]),un(function(){return n.dragPreviewOptions=t||null,n.reconnect(),function(){return n.disconnectDragPreview()}},[n,t]),n}var s0=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 i0=nf(s0);function o0(e,t){return u0(e)||c0(e,t)||l0(e,t)||a0()}function a0(){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 l0(e,t){if(e){if(typeof e=="string")return nu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nu(e,t)}}function nu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c0(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 u0(e){if(Array.isArray(e))return e}function gh(e,t,r){var n=p.useState(function(){return t(e)}),s=o0(n,2),i=s[0],o=s[1],a=p.useCallback(function(){var c=t(e);i0(i,c)||(o(c),r&&r())},[i,e,r]);return un(a),[i,a]}function d0(e,t){return g0(e)||p0(e,t)||h0(e,t)||f0()}function f0(){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 h0(e,t){if(e){if(typeof e=="string")return su(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return su(e,t)}}function su(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p0(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 g0(e){if(Array.isArray(e))return e}function m0(e,t,r){var n=gh(e,t,r),s=d0(n,2),i=s[0],o=s[1];return un(function(){var c=e.getHandlerId();if(c!=null)return e.subscribeToStateChange(o,{handlerIds:[c]})},[e,o]),i}function mh(e,t,r){return m0(t,e||function(){return{}},function(){return r.reconnect()})}function y0(e){return p.useMemo(function(){return e.hooks.dragSource()},[e])}function v0(e){return p.useMemo(function(){return e.hooks.dragPreview()},[e])}function b0(e,t){var r=ph(e,t);de(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var n=r0(),s=n0(r.options,r.previewOptions);return YC(r,n,s),[mh(r.collect,n,s),y0(s),v0(s)]}function _0(e){var t=e.accept;return p.useMemo(function(){return de(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function w0(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 x0(e,t,r){return t&&S0(e.prototype,t),e}function iu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var C0=function(){function e(t,r){w0(this,e),iu(this,"spec",void 0),iu(this,"monitor",void 0),this.spec=t,this.monitor=r}return x0(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 C0(e,t)},[t]);return p.useEffect(function(){r.spec=e},[e]),r}function O0(e,t){return N0(e)||T0(e,t)||I0(e,t)||D0()}function D0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
463
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I0(e,t){if(e){if(typeof e=="string")return ou(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ou(e,t)}}function ou(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T0(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],s=!0,i=!1,o,a;try{for(r=r.call(e);!(s=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));s=!0);}catch(c){i=!0,a=c}finally{try{!s&&r.return!=null&&r.return()}finally{if(i)throw a}}return n}}function N0(e){if(Array.isArray(e))return e}function j0(e,t,r){var n=fn(),s=E0(e,t),i=_0(e);un(function(){var a=LC(i,s,n),c=O0(a,2),d=c[0],u=c[1];return t.receiveHandlerId(d),r.receiveHandlerId(d),u},[n,t,s,r,i.map(function(o){return o.toString()}).join("|")])}function k0(){var e=fn();return p.useMemo(function(){return new EC(e)},[e])}function R0(e){var t=fn(),r=p.useMemo(function(){return new MC(t.getBackend())},[t]);return un(function(){return r.dropTargetOptions=e||null,r.reconnect(),function(){return r.disconnectDropTarget()}},[e]),r}function A0(e){return p.useMemo(function(){return e.hooks.dropTarget()},[e])}function yh(e,t){var r=ph(e,t),n=k0(),s=R0(r.options);return j0(r,n,s),[mh(r.collect,n,s),A0(s)]}function P0(e,t){return $0(e)||F0(e,t)||L0(e,t)||M0()}function M0(){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 L0(e,t){if(e){if(typeof e=="string")return au(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return au(e,t)}}function au(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function 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 $0(e){if(Array.isArray(e))return e}function B0(e){var t=fn(),r=t.getMonitor(),n=gh(r,e),s=P0(n,2),i=s[0],o=s[1];return p.useEffect(function(){return r.subscribeToOffsetChange(o)}),p.useEffect(function(){return r.subscribeToStateChange(o)}),i}function vh(e){var t=null,r=function(){return t==null&&(t=e()),t};return r}function U0(e,t){return e.filter(function(r){return r!==t})}function V0(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 q0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z0(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function H0(e,t,r){return t&&z0(e.prototype,t),e}function lu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var W0=function(){function e(t){q0(this,e),lu(this,"entered",[]),lu(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return H0(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=V0(this.entered.filter(i),[r]),s===0&&this.entered.length>0}},{key:"leave",value:function(r){var n=this.entered.length;return this.entered=U0(this.entered.filter(this.isNodeInDocument),r),n>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),Q0=vh(function(){return/firefox/i.test(navigator.userAgent)}),bh=vh(function(){return!!window.safari});function K0(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G0(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 Y0(e,t,r){return t&&G0(e.prototype,t),e}function ss(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cu=function(){function e(t,r){K0(this,e),ss(this,"xs",void 0),ss(this,"ys",void 0),ss(this,"c1s",void 0),ss(this,"c2s",void 0),ss(this,"c3s",void 0);for(var n=t.length,s=[],i=0;i<n;i++)s.push(i);s.sort(function(k,L){return t[k]<t[L]?-1:1});for(var o=[],a=[],c,d,u=0;u<n-1;u++)c=t[u+1]-t[u],d=r[u+1]-r[u],o.push(c),a.push(d/c);for(var f=[a[0]],g=0;g<o.length-1;g++){var m=a[g],_=a[g+1];if(m*_<=0)f.push(0);else{c=o[g];var h=o[g+1],y=c+h;f.push(3*y/((y+h)/m+(y+c)/_))}}f.push(a[a.length-1]);for(var v=[],b=[],S,w=0;w<f.length-1;w++){S=a[w];var C=f[w],D=1/o[w],j=C+f[w+1]-S-S;v.push((S-C-j)*D),b.push(j*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=v,this.c3s=b}return Y0(e,[{key:"interpolate",value:function(r){var n=this.xs,s=this.ys,i=this.c1s,o=this.c2s,a=this.c3s,c=n.length-1;if(r===n[c])return s[c];for(var d=0,u=a.length-1,f;d<=u;){f=Math.floor(.5*(d+u));var g=n[f];if(g<r)d=f+1;else if(g>r)u=f-1;else return s[f]}c=Math.max(0,u);var m=r-n[c],_=m*m;return s[c]+i[c]*m+o[c]*_+a[c]*m*_}}]),e}(),X0=1;function _h(e){var t=e.nodeType===X0?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top,s=r.left;return{x:s,y:n}}function Js(e){return{x:e.clientX,y:e.clientY}}function Z0(e){var t;return e.nodeName==="IMG"&&(Q0()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function J0(e,t,r,n){var s=e?t.width:r,i=e?t.height:n;return bh()&&e&&(i/=window.devicePixelRatio,s/=window.devicePixelRatio),{dragPreviewWidth:s,dragPreviewHeight:i}}function e1(e,t,r,n,s){var i=Z0(t),o=i?e:t,a=_h(o),c={x:r.x-a.x,y:r.y-a.y},d=e.offsetWidth,u=e.offsetHeight,f=n.anchorX,g=n.anchorY,m=J0(i,t,d,u),_=m.dragPreviewWidth,h=m.dragPreviewHeight,y=function(){var j=new cu([0,.5,1],[c.y,c.y/u*h,c.y+h-u]),k=j.interpolate(g);return bh()&&i&&(k+=(window.devicePixelRatio-1)*h),k},v=function(){var j=new cu([0,.5,1],[c.x,c.x/d*_,c.x+_-d]);return j.interpolate(f)},b=s.offsetX,S=s.offsetY,w=b===0||b,C=S===0||S;return{x:w?b:v(),y:C?S:y()}}var wh="__NATIVE_FILE__",Sh="__NATIVE_URL__",xh="__NATIVE_TEXT__",Ch="__NATIVE_HTML__";const uu=Object.freeze(Object.defineProperty({__proto__:null,FILE:wh,HTML:Ch,TEXT:xh,URL:Sh},Symbol.toStringTag,{value:"Module"}));function Ro(e,t,r){var n=t.reduce(function(s,i){return s||e.getData(i)},"");return n??r}var bn;function ei(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ta=(bn={},ei(bn,wh,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),ei(bn,Ch,{exposeProperties:{html:function(t,r){return Ro(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),ei(bn,Sh,{exposeProperties:{urls:function(t,r){return Ro(t,r,"").split(`
|
|
465
|
+
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),ei(bn,xh,{exposeProperties:{text:function(t,r){return Ro(t,r,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),bn);function t1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n1(e,t,r){return t&&r1(e.prototype,t),e}function du(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s1=function(){function e(t){t1(this,e),du(this,"item",void 0),du(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return n1(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 i1(e,t){var r=new s1(Ta[e]);return r.loadDataTransfer(t),r}function Ao(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Ta).filter(function(r){var n=Ta[r].matchesTypes;return n.some(function(s){return t.indexOf(s)>-1})})[0]||null}function o1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a1(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 l1(e,t,r){return t&&a1(e.prototype,t),e}function Po(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c1=function(){function e(t,r){o1(this,e),Po(this,"ownerDocument",null),Po(this,"globalContext",void 0),Po(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=r}return l1(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var r;return(r=this.globalContext)!==null&&r!==void 0&&r.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var r;return((r=this.optionsArgs)===null||r===void 0?void 0:r.rootElement)||this.window}}]),e}();function fu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function hu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(r),!0).forEach(function(n){ye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function u1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d1(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 f1(e,t,r){return t&&d1(e.prototype,t),e}function ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var h1=function(){function e(t,r,n){var s=this;u1(this,e),ye(this,"options",void 0),ye(this,"actions",void 0),ye(this,"monitor",void 0),ye(this,"registry",void 0),ye(this,"enterLeaveCounter",void 0),ye(this,"sourcePreviewNodes",new Map),ye(this,"sourcePreviewNodeOptions",new Map),ye(this,"sourceNodes",new Map),ye(this,"sourceNodeOptions",new Map),ye(this,"dragStartSourceIds",null),ye(this,"dropTargetIds",[]),ye(this,"dragEnterTargetIds",[]),ye(this,"currentNativeSource",null),ye(this,"currentNativeHandle",null),ye(this,"currentDragSourceNode",null),ye(this,"altKeyPressed",!1),ye(this,"mouseMoveTimeoutTimer",null),ye(this,"asyncEndDragFrameId",null),ye(this,"dragOverTargetIds",null),ye(this,"lastClientOffset",null),ye(this,"hoverRafId",null),ye(this,"getSourceClientOffset",function(i){var o=s.sourceNodes.get(i);return o&&_h(o)||null}),ye(this,"endDragNativeItem",function(){s.isDraggingNativeItem()&&(s.actions.endDrag(),s.currentNativeHandle&&s.registry.removeSource(s.currentNativeHandle),s.currentNativeHandle=null,s.currentNativeSource=null)}),ye(this,"isNodeInDocument",function(i){return!!(i&&s.document&&s.document.body&&s.document.body.contains(i))}),ye(this,"endDragIfSourceWasRemovedFromDOM",function(){var i=s.currentDragSourceNode;i==null||s.isNodeInDocument(i)||s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),ye(this,"handleTopDragStartCapture",function(){s.clearCurrentDragSourceNode(),s.dragStartSourceIds=[]}),ye(this,"handleTopDragStart",function(i){if(!i.defaultPrevented){var o=s.dragStartSourceIds;s.dragStartSourceIds=null;var a=Js(i);s.monitor.isDragging()&&s.actions.endDrag(),s.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:s.getSourceClientOffset,clientOffset:a});var c=i.dataTransfer,d=Ao(c);if(s.monitor.isDragging()){if(c&&typeof c.setDragImage=="function"){var u=s.monitor.getSourceId(),f=s.sourceNodes.get(u),g=s.sourcePreviewNodes.get(u)||f;if(g){var m=s.getCurrentSourcePreviewNodeOptions(),_=m.anchorX,h=m.anchorY,y=m.offsetX,v=m.offsetY,b={anchorX:_,anchorY:h},S={offsetX:y,offsetY:v},w=e1(f,g,a,b,S);c.setDragImage(g,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(d)s.beginDragNativeItem(d);else{if(c&&!c.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}}}),ye(this,"handleTopDragEndCapture",function(){s.clearCurrentDragSourceNode()&&s.monitor.isDragging()&&s.actions.endDrag()}),ye(this,"handleTopDragEnterCapture",function(i){s.dragEnterTargetIds=[];var o=s.enterLeaveCounter.enter(i.target);if(!(!o||s.monitor.isDragging())){var a=i.dataTransfer,c=Ao(a);c&&s.beginDragNativeItem(c,a)}}),ye(this,"handleTopDragEnter",function(i){var o=s.dragEnterTargetIds;if(s.dragEnterTargetIds=[],!!s.monitor.isDragging()){s.altKeyPressed=i.altKey,o.length>0&&s.actions.hover(o,{clientOffset:Js(i)});var a=o.some(function(c){return s.monitor.canDropOnTarget(c)});a&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect()))}}),ye(this,"handleTopDragOverCapture",function(){s.dragOverTargetIds=[]}),ye(this,"handleTopDragOver",function(i){var o=s.dragOverTargetIds;if(s.dragOverTargetIds=[],!s.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}s.altKeyPressed=i.altKey,s.lastClientOffset=Js(i),s.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(s.hoverRafId=requestAnimationFrame(function(){s.monitor.isDragging()&&s.actions.hover(o||[],{clientOffset:s.lastClientOffset}),s.hoverRafId=null}));var a=(o||[]).some(function(c){return s.monitor.canDropOnTarget(c)});a?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=s.getCurrentDropEffect())):s.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))}),ye(this,"handleTopDragLeaveCapture",function(i){s.isDraggingNativeItem()&&i.preventDefault();var o=s.enterLeaveCounter.leave(i.target);o&&s.isDraggingNativeItem()&&setTimeout(function(){return s.endDragNativeItem()},0)}),ye(this,"handleTopDropCapture",function(i){if(s.dropTargetIds=[],s.isDraggingNativeItem()){var o;i.preventDefault(),(o=s.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Ao(i.dataTransfer)&&i.preventDefault();s.enterLeaveCounter.reset()}),ye(this,"handleTopDrop",function(i){var o=s.dropTargetIds;s.dropTargetIds=[],s.actions.hover(o,{clientOffset:Js(i)}),s.actions.drop({dropEffect:s.getCurrentDropEffect()}),s.isDraggingNativeItem()?s.endDragNativeItem():s.monitor.isDragging()&&s.actions.endDrag()}),ye(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 c1(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new W0(this.isNodeInDocument)}return f1(e,[{key:"profile",value:function(){var r,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((r=this.dragStartSourceIds)===null||r===void 0?void 0:r.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var r=this.rootElement;if(r!==void 0){if(r.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");r.__isReactDndBackendSetUp=!0,this.addEventListeners(r)}}},{key:"teardown",value:function(){var r=this.rootElement;if(r!==void 0&&(r.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(r,n,s){var i=this;return this.sourcePreviewNodeOptions.set(r,s),this.sourcePreviewNodes.set(r,n),function(){i.sourcePreviewNodes.delete(r),i.sourcePreviewNodeOptions.delete(r)}}},{key:"connectDragSource",value:function(r,n,s){var i=this;this.sourceNodes.set(r,n),this.sourceNodeOptions.set(r,s);var o=function(d){return i.handleDragStart(d,r)},a=function(d){return i.handleSelectStart(d)};return n.setAttribute("draggable","true"),n.addEventListener("dragstart",o),n.addEventListener("selectstart",a),function(){i.sourceNodes.delete(r),i.sourceNodeOptions.delete(r),n.removeEventListener("dragstart",o),n.removeEventListener("selectstart",a),n.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(r,n){var s=this,i=function(d){return s.handleDragEnter(d,r)},o=function(d){return s.handleDragOver(d,r)},a=function(d){return s.handleDrop(d,r)};return n.addEventListener("dragenter",i),n.addEventListener("dragover",o),n.addEventListener("drop",a),function(){n.removeEventListener("dragenter",i),n.removeEventListener("dragover",o),n.removeEventListener("drop",a)}}},{key:"addEventListeners",value:function(r){r.addEventListener&&(r.addEventListener("dragstart",this.handleTopDragStart),r.addEventListener("dragstart",this.handleTopDragStartCapture,!0),r.addEventListener("dragend",this.handleTopDragEndCapture,!0),r.addEventListener("dragenter",this.handleTopDragEnter),r.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.addEventListener("dragover",this.handleTopDragOver),r.addEventListener("dragover",this.handleTopDragOverCapture,!0),r.addEventListener("drop",this.handleTopDrop),r.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(r){r.removeEventListener&&(r.removeEventListener("dragstart",this.handleTopDragStart),r.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),r.removeEventListener("dragend",this.handleTopDragEndCapture,!0),r.removeEventListener("dragenter",this.handleTopDragEnter),r.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),r.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),r.removeEventListener("dragover",this.handleTopDragOver),r.removeEventListener("dragover",this.handleTopDragOverCapture,!0),r.removeEventListener("drop",this.handleTopDrop),r.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(r);return hu({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var r=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(r);return hu({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}},{key:"isDraggingNativeItem",value:function(){var r=this.monitor.getItemType();return Object.keys(uu).some(function(n){return uu[n]===r})}},{key:"beginDragNativeItem",value:function(r,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=i1(r,n),this.currentNativeHandle=this.registry.addSource(r,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(r){var n=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=r;var s=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var i;return(i=n.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",n.endDragIfSourceWasRemovedFromDOM,!0)},s)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var r;(r=this.window)===null||r===void 0||r.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(r,n){r.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}},{key:"handleDragEnter",value:function(r,n){this.dragEnterTargetIds.unshift(n)}},{key:"handleDragOver",value:function(r,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}},{key:"handleDrop",value:function(r,n){this.dropTargetIds.unshift(n)}}]),e}(),ti;function p1(){return ti||(ti=new Image,ti.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),ti}var g1=function(t,r,n){return new h1(t,r,n)};function m1(e,t){return typeof e=="function"?e(t):e??"NODE"}function y1(e){return e.isDraggable&&!e.isEditing}function v1(e){const t=Nt(),r=t.selectedIds,[n,s,i]=b0(()=>({canDrag:()=>y1(e),type:m1(t.props.dragType,e),item:()=>{const o=t.isSelected(e.id)?Array.from(r):[e.id];return t.dispatch(qn.dragStart(e.id,o)),{id:e.id,dragIds:o,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(qn.dragEnd())}}),[r,e,t.props.dragType]);return p.useEffect(()=>{i(p1())},[i]),s}function b1(e,t){const r=e.getBoundingClientRect(),n=t.x-Math.round(r.x),s=t.y-Math.round(r.y),i=r.height,o=s<i/2,a=!o,c=i/4,d=s>c&&s<i-c;return{x:n,inTopHalf:o,inBottomHalf:a,inMiddle:d,atTop:!d&&o,atBottom:!d&&a}}function _1(e,t,r,n){return e?e.isInternal?n.atTop?[t,e]:n.inMiddle?[e,e]:[e,r]:n.inTopHalf?[t,e]:[e,r]:[t,null]}function ri(e,t){return{parentId:e||null,index:t}}function _n(e,t){return{type:"line",index:e,level:t}}function w1(e){return{type:"highlight",id:e}}function Mo(e,t){var r;let n=e;for(;n.parent&&n.level>t;)n=n.parent;const s=((r=n.parent)===null||r===void 0?void 0:r.id)||null,i=Gf(n)+1;return{parentId:s,index:i}}function Eh(e){var t;const r=b1(e.element,e.offset),n=e.indent,s=Math.round(Math.max(0,r.x-n)/n),{node:i,nextNode:o,prevNode:a}=e,[c,d]=_1(i,a,o,r);if(i&&i.isInternal&&r.inMiddle)return{drop:ri(i.id,null),cursor:w1(i.id)};if(!c)return{drop:ri((t=d==null?void 0:d.parent)===null||t===void 0?void 0:t.id,0),cursor:_n(0,0)};if(Hf(c)){const u=mi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}if(Wf(c)){const u=mi(s,(d==null?void 0:d.level)||0,c.level);return{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}if(Qf(c)){const u=mi(s,0,c.level+1);return u>c.level?{drop:ri(c.id,0),cursor:_n(c.rowIndex+1,u)}:{drop:Mo(c,u),cursor:_n(c.rowIndex+1,u)}}return{drop:ri(c==null?void 0:c.id,0),cursor:_n(c.rowIndex+1,c.level+1)}}function S1(e,t){const r=Nt(),[n,s]=yh(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(i,o)=>{const a=o.getClientOffset();if(!e.current||!a)return;const{cursor:c,drop:d}=Eh({element:e.current,offset:a,indent:r.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&r.dispatch(qn.hovering(d.parentId,d.index)),o.canDrop()?c&&r.showCursor(c):r.hideCursor()},drop:(i,o)=>{if(!o.canDrop())return null;r.drop()}}),[t,e.current,r.props]);return s}function x1(e){const t=Nt(),r=t.at(e);if(!r)throw new Error(`Could not find node for index: ${e}`);return p.useMemo(()=>{const n=r.clone();return t.visibleNodes[e]=n,n},[...Object.values(r.state),r])}const pu=p.memo(function({index:t,style:r}){zf(),Uw();const n=Nt(),s=x1(t),i=p.useRef(null),o=v1(s),a=S1(i,s),c=p.useCallback(h=>{i.current=h,a(h)},[a]),d=n.indent*s.level,u=p.useMemo(()=>({paddingLeft:d}),[d]),f=p.useMemo(()=>{var h,y;return Object.assign(Object.assign({},r),{top:parseFloat(r.top)+((y=(h=n.props.padding)!==null&&h!==void 0?h:n.props.paddingTop)!==null&&y!==void 0?y:0),minWidth:"max-content"})},[r,n.props.padding,n.props.paddingTop]),g={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:f,tabIndex:-1,className:n.props.rowClassName};p.useEffect(()=>{var h;!s.isEditing&&s.isFocused&&((h=i.current)===null||h===void 0||h.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,i.current]);const m=n.renderNode,_=n.renderRow;return l.jsx(_,{node:s,innerRef:c,attrs:g,children:l.jsx(m,{node:s,tree:n,style:u,dragHandle:o})})});let Lo="",gu=null;function Oh(){zf();const e=Nt();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(),Yf(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Xf(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const s=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const s=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(s);return}else{if(!s)return;const i=e.focusedNode;i?i.isSelected?e.selectContiguous(s):e.selectMulti(s):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const s=e.focusedNode;if(!s)return;s.isInternal&&s.isOpen?e.focus(e.nextNode):s.isInternal&&e.open(s.id);return}if(t.key==="ArrowLeft"){const s=e.focusedNode;if(!s||s.isRoot)return;s.isInternal&&s.isOpen?e.close(s.id):!((r=s.parent)===null||r===void 0)&&r.isRoot||e.focus(s.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const s=e.focusedNode;if(!s||!s.isEditable||!e.props.onRename)return;setTimeout(()=>{s&&e.edit(s)});return}if(t.key===" "){t.preventDefault();const s=e.focusedNode;if(!s)return;s.isLeaf?(s.select(),s.activate()):s.toggle();return}if(t.key==="*"){const s=e.focusedNode;if(!s)return;e.openSiblings(s);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(gu),Lo+=t.key,gu=setTimeout(()=>{Lo=""},600);const n=e.visibleNodes.find(s=>{const i=s.data.name;return typeof i=="string"?i.toLowerCase().startsWith(Lo):!1});n&&e.focus(n.id)},children:l.jsx(C1,{})})}function C1(){var e,t;const r=Nt(),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:TS,innerElementType:(t=r.props.innerElementType)!==null&&t!==void 0?t:kS,onScroll:r.props.onScroll,onItemsRendered:r.onItemsRendered.bind(r)};return typeof r.props.rowHeight=="function"?l.jsx(ES,Object.assign({},n,{itemSize:r.rowHeightAt,ref:r.list,children:pu})):l.jsx(OS,Object.assign({},n,{itemSize:r.rowHeight,ref:r.list,children:pu}))}function mu(e){return e.isFiltered?O1(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(Dh),t}function O1(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(Dh),n}function Dh(e,t){e.rowIndex=t}const yu=e=>e.reduce((t,r,n)=>(t[r.id]=n,t),{});var Fo=function(e,t,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{d(n.next(u))}catch(f){o(f)}}function c(u){try{d(n.throw(u))}catch(f){o(f)}}function d(u){u.done?i(u.value):s(u.value).then(a,c)}d((n=n.apply(e,t||[])).next())})};const{safeRun:gt}=Ww;class vs{constructor(t,r,n,s){this.store=t,this.props=r,this.list=n,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=i=>{const o=this.props.rowHeight;if(typeof o=="function"){const a=this.at(i);return a?o(a):this.rowHeight}return o??24},this.rowTopPosition=i=>{if(typeof this.props.rowHeight!="function")return i*this.rowHeight;const o=this.getRowOffsets(),a=Math.max(0,Math.min(i,o.length-1));return o[a]},this.redrawList=(i=0)=>{this.rowOffsets=null;const o=this.list.current;o&&"resetAfterIndex"in o&&o.resetAfterIndex(Math.max(0,i))},this.root=Ec(this),this.visibleNodes=mu(this),this.idToIndex=yu(this.visibleNodes)}update(t){this.props=t,this.root=Ec(this),this.visibleNodes=mu(this),this.idToIndex=yu(this.visibleNodes),this.rowOffsets=null;const r=this.list.current;r&&"resetAfterIndex"in r&&r.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let r=0;r<this.visibleNodes.length;r++)t.push(t[r]+this.rowHeightAt(r));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const r=(t=this.props.searchMatch)!==null&&t!==void 0?t:(n,s)=>JSON.stringify(Object.values(n.data)).toLocaleLowerCase().includes(s.toLocaleLowerCase());return n=>r(n,this.searchTerm)}accessChildren(t){var r;const n=this.props.childrenAccessor||"children";return(r=fs(t,n))!==null&&r!==void 0?r:null}accessId(t){const r=this.props.idAccessor||"id",n=fs(t,r);if(!n)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return n}identify(t){if(typeof t=="string")return t;if(t instanceof Is)return t.id;const r=this.props.idAccessor||"id";return fs(t,r)}identifyNull(t){return t==null?null:this.identify(t)}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,r){var n;if(t===null||r===null)return[];const s=(n=this.indexOf(t))!==null&&n!==void 0?n:0,i=this.indexOf(r);if(i===null)return[];const o=Math.min(s,i),a=Math.max(s,i);return this.visibleNodes.slice(o,a+1)}indexOf(t){const r=this.identifyNull(t);return r?this.idToIndex[r]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return Fo(this,arguments,void 0,function*(t={}){var r,n;const s=t.parentId===void 0?th(this):t.parentId,i=(r=t.index)!==null&&r!==void 0?r:eh(this),o=(n=t.type)!==null&&n!==void 0?n:"leaf",a=yield gt(this.props.onCreate,{type:o,parentId:s,index:i,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(t){return Fo(this,void 0,void 0,function*(){if(!t)return;const n=(Array.isArray(t)?t:[t]).map(o=>this.identify(o)),s=n.map(o=>this.get(o)).filter(o=>!!o),i=s.length?Math.min(...s.map(o=>{var a;return(a=o.rowIndex)!==null&&a!==void 0?a:0})):0;yield gt(this.props.onDelete,{nodes:s,ids:n}),this.redrawList(i)})}edit(t){var r,n;const s=this.identify(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(s),this.dispatch(Oo(s)),this.redrawList((n=(r=this.get(s))===null||r===void 0?void 0:r.rowIndex)!==null&&n!==void 0?n:0),new Promise(i=>{vs.editPromise=i})}submit(t,r){return Fo(this,void 0,void 0,function*(){var n,s;if(!t)return;const i=this.identify(t);yield gt(this.props.onRename,{id:i,name:r,node:this.get(i)}),this.dispatch(Oo(null)),this.resolveEdit({cancelled:!1,value:r}),this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Oo(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const r=this.get(this.identifyNull(t));r&>(this.props.onActivate,r)}resolveEdit(t){const r=vs.editPromise;r&&r(t),vs.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let r of Array.from(this.selectedIds)){const n=this.get(r);n&&t.push(n)}return t}focus(t,r={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(gn(this.identify(t))),r.scroll!==!1&&this.scrollTo(t),this.focusedNode&>(this.props.onFocus,this.focusedNode)))}pageUp(){var t,r;const n=this.visibleStartIndex,i=this.visibleStopIndex-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o>n?o=n:o=Math.max(n-i,0),this.focus(this.at(o))}pageDown(){var t,r;const n=this.visibleStartIndex,s=this.visibleStopIndex,i=s-n;let o=(r=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&r!==void 0?r:0;o<s?o=s:o=Math.min(o+i,this.visibleNodes.length-1),this.focus(this.at(o))}select(t,r={}){var n;if(!t)return;const s=r.focus!==!1,i=this.identify(t);s&&this.dispatch(gn(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable&&this.setSelection({ids:[i],anchor:i,mostRecent:i}),this.scrollTo(i,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const r=this.identify(t);this.dispatch(xr.remove(r)),gt(this.props.onSelect,this.selectedNodes)}selectMulti(t,r={}){const n=this.get(this.identifyNull(t));if(!n)return;const s=r.focus!==!1;s&&this.dispatch(gn(n.id)),n.isSelectable&&(this.dispatch(xr.add(n.id)),this.dispatch(xr.anchor(n.id)),this.dispatch(xr.mostRecent(n.id))),this.scrollTo(n,r.align),this.focusedNode&&s&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var r;if(!t)return;const n=this.identify(t);if(this.dispatch(gn(n)),!((r=this.get(n))===null||r===void 0)&&r.isSelectable){const{anchor:s,mostRecent:i}=this.state.nodes.selection,o=this.filterSelectableNodes(this.nodesBetween(s,this.identifyNull(n)));this.dispatch(xr.remove(this.nodesBetween(s,i))),this.dispatch(xr.add(o)),this.dispatch(xr.mostRecent(n))}this.scrollTo(n),this.focusedNode&>(this.props.onFocus,this.focusedNode),gt(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,r,n;const s=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:s,anchor:(t=s[0])!==null&&t!==void 0?t:null,mostRecent:(r=s[s.length-1])!==null&&r!==void 0?r:null}),this.dispatch(gn((n=this.lastNode)===null||n===void 0?void 0:n.id)),this.focusedNode&>(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(xr.set({ids:n,anchor:s,mostRecent:i})),gt(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var t;if(this.isFiltered)return!1;const r=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,n=this.dragNodes,s=this.props.disableDrop;for(const i of n)if(!i||!r||i.isInternal&&Kf(r,i))return!1;return typeof s=="function"?!s({parentNode:r,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof s=="string"?!r.data[s]:typeof s=="boolean"?!s:!0}drop(){const{parentId:t,index:r,dragIds:n}=this.state.dnd;gt(this.props.onMove,{dragIds:n,parentId:t===Ds?null:t,index:r===null?0:r,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(qn.cursor({type:"none"}))}showCursor(t){this.dispatch(qn.cursor(t))}open(t,r=!0){var n,s;const i=this.identifyNull(t);i&&(this.isOpen(i)||(this.dispatch(wa.open(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i)))}close(t,r=!0){var n,s;const i=this.identifyNull(t);i&&this.isOpen(i)&&(this.dispatch(wa.close(i,this.isFiltered)),r&&this.redrawList((s=(n=this.get(i))===null||n===void 0?void 0:n.rowIndex)!==null&&s!==void 0?s:0),gt(this.props.onToggle,i))}toggle(t){const r=this.identifyNull(t);if(r)return this.isOpen(r)?this.close(r):this.open(r)}openParents(t){const r=this.identifyNull(t);if(!r)return;const n=cl(this.root,r);let s=n==null?void 0:n.parent;for(;s;)this.open(s.id,!1),s=s.parent;this.redrawList()}openSiblings(t){const r=t.parent;if(!r)this.toggle(t.id);else if(r.children){const n=t.isOpen;for(let s of r.children)s.isInternal&&(n?this.close(s.id,!1):this.open(s.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Mi(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Mi(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,r="smart"){if(!t)return;const n=this.identify(t);return this.openParents(n),Jf(()=>n in this.idToIndex).then(()=>{var s;const i=this.idToIndex[n];i!==void 0&&((s=this.list.current)===null||s===void 0||s.scrollToItem(i,r))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var r,n,s;if(!t)return!1;if(t===Ds)return!0;const i=(r=this.props.openByDefault)!==null&&r!==void 0?r:!0;return this.isFiltered?(n=this.state.nodes.open.filtered[t])!==null&&n!==void 0?n:!0:(s=this.state.nodes.open.unfiltered[t])!==null&&s!==void 0?s:i}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,r=()=>!1){return!fs(t,r)}isDragging(t){const r=this.identifyNull(t);return r?this.state.nodes.drag.id===r:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const r=this.identifyNull(t);if(!r)return!1;const{destinationParentId:n,destinationIndex:s}=this.state.nodes.drag;return r===n&&s===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(gn(t.id))}onBlur(){this.dispatch(rS())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||Oh}get renderRow(){return this.props.renderRow||Xw}get renderNode(){return this.props.children||Zw}get renderDragPreview(){return this.props.renderDragPreview||rh}get renderCursor(){return this.props.renderCursor||Yw}}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 D1=typeof Symbol=="function"&&Symbol.observable||"@@observable",vu=D1,$o=()=>Math.random().toString(36).substring(7).split("").join("."),I1={INIT:`@@redux/INIT${$o()}`,REPLACE:`@@redux/REPLACE${$o()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${$o()}`},an=I1;function Ih(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 T1(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(k1(e))return"date";if(j1(e))return"error";const r=N1(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 N1(e){return typeof e.constructor=="function"?e.constructor.name:null}function j1(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function k1(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Or(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=T1(e)),t}function Th(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?mt(2):`Expected the root reducer to be a function. Instead, received: '${Or(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?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: '${Or(r)}'`);return r(Th)(e,t)}let n=e,s=t,i=new Map,o=i,a=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((y,v)=>{o.set(v,y)}))}function u(){if(c)throw new Error(process.env.NODE_ENV==="production"?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 s}function f(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?mt(4):`Expected the listener to be a function. Instead, received: '${Or(y)}'`);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.");let v=!0;d();const b=a++;return o.set(b,y),function(){if(v){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.");v=!1,d(),o.delete(b),i=null}}}function g(y){if(!Ih(y))throw new Error(process.env.NODE_ENV==="production"?mt(7):`Actions must be plain objects. Instead, the actual type was: '${Or(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"?mt(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"?mt(17):`Action "type" property must be a string. Instead, the actual type was: '${Or(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?mt(9):"Reducers may not dispatch actions.");try{c=!0,s=n(s,y)}finally{c=!1}return(i=o).forEach(b=>{b()}),y}function m(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?mt(10):`Expected the nextReducer to be a function. Instead, received: '${Or(y)}`);n=y,g({type:an.REPLACE})}function _(){const y=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?mt(11):`Expected the observer to be an object. Instead, received: '${Or(v)}'`);function b(){const w=v;w.next&&w.next(u())}return b(),{unsubscribe:y(b)}},[vu](){return this}}}return g({type:an.INIT}),{dispatch:g,subscribe:f,getState:u,replaceReducer:m,[vu]:_}}function bu(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function R1(e,t,r,n){const s=Object.keys(t),i=r&&r.type===an.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(!Ih(e))return`The ${i} has unexpected type of "${Or(e)}". Expected argument to be an object with the following keys: "${s.join('", "')}"`;const o=Object.keys(e).filter(a=>!t.hasOwnProperty(a)&&!n[a]);if(o.forEach(a=>{n[a]=!0}),!(r&&r.type===an.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 A1(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:an.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?mt(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:an.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?mt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${an.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function _u(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];process.env.NODE_ENV!=="production"&&typeof e[a]>"u"&&bu(`No reducer provided for key "${a}"`),typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let s;process.env.NODE_ENV!=="production"&&(s={});let i;try{A1(r)}catch(o){i=o}return function(a={},c){if(i)throw i;if(process.env.NODE_ENV!=="production"){const f=R1(a,r,c,s);f&&bu(f)}let d=!1;const u={};for(let f=0;f<n.length;f++){const g=n[f],m=r[g],_=a[g],h=m(_,c);if(typeof h>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?mt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${g}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}u[g]=h,d=d||h!==_}return d=d||n.length!==Object.keys(a).length,d?u:a}}function P1(e=Vn().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 M1=_u({nodes:_u({focus:nS,edit:tS,open:sS,selection:iS,drag:P1}),dnd:oS}),L1=Vn();function F1({treeProps:e,imperativeHandle:t,children:r}){const n=p.useRef(null),s=p.useRef(null),i=p.useRef(Th(M1,Vn(e))),o=Bw.useSyncExternalStore(i.current.subscribe,i.current.getState,()=>L1),a=p.useMemo(()=>new vs(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(wa.clear(!0))},[a.props.searchTerm]),l.jsx(Bf.Provider,{value:a,children:l.jsx(qf.Provider,{value:c.current,children:l.jsx(Uf.Provider,{value:o.nodes,children:l.jsx(Vf.Provider,{value:o.dnd,children:l.jsx(gC,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||g1,options:{rootElement:a.props.dndRootElement||void 0}},{children:r}))})})})})}function $1(){const e=Nt(),[,t]=yh(()=>({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}=Eh({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(qn.hovering(o.parentId,o.index)),n.canDrop()?i&&e.showCursor(i):e.hideCursor()},drop:(r,n)=>{if(!n.isOver({shallow:!0})||!n.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function B1(e){return $1(),e.children}function U1(){const t=Nt().props.renderContainer||Oh;return l.jsx(l.Fragment,{children:l.jsx(t,{})})}function V1(){const e=Nt(),{offset:t,mouse:r,item:n,isDragging:s}=B0(o=>({offset:o.getSourceClientOffset(),mouse:o.getClientOffset(),item:o.getItem(),isDragging:o.isDragging()})),i=e.props.renderDragPreview||rh;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 q1(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 z1{constructor(t,r={}){this.accessors=q1(r),this.root=H1(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 H1(e,t){const r=new Nh({},null,t,"ROOT");return r.children=e.map(n=>ml(n,r,t)),r}function ml(e,t,r){const n=new Nh(e,t,r),s=r.getChildren(e);return s&&(n.children=s.map(i=>ml(i,n,r))),n}class Nh{constructor(t,r,n,s){this.data=t,this.parent=r,this.accessors=n,this.id=s??n.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,r){var n,s;const i=ml(t,this,this.accessors);this.children=(n=this.children)!==null&&n!==void 0?n:[],this.children.splice(r,0,i);const o=this.accessors.childrenKey,a=this.data;a[o]=(s=a[o])!==null&&s!==void 0?s:[],a[o].splice(r,0,t)}removeChild(t){var r,n;(r=this.children)===null||r===void 0||r.splice(t,1),(n=this.data[this.accessors.childrenKey])===null||n===void 0||n.splice(t,1)}update(t){if(this.hasParent()){const r=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),r),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let W1=0;function Q1(e,t={}){const[r,n]=p.useState(e),s=t.idAccessor,i=t.childrenAccessor,o=p.useMemo(()=>new z1(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)},d=typeof s=="string"?s:"id",u=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={[d]:`simple-tree-id-${W1++}`,name:""};return y==="internal"&&(v[u]=[]),o.create({parentId:_,index:h,data:v}),n(o.data),v},onDelete:_=>{_.ids.forEach(h=>o.drop({id:h})),n(o.data)}}]}function K1(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]=Q1(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),r),{data:t})}else return e}function G1(e,t){const r=K1(e);return l.jsxs(F1,{treeProps:r,imperativeHandle:t,children:[l.jsx(B1,{children:l.jsx(U1,{})}),l.jsx(V1,{})]})}const Y1=p.forwardRef(G1);function yl(){return Oe(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 X1(){return Oe(e=>{var s;if(!e.selectedNodeId)return!1;const t=(s=e.treeData[0])==null?void 0:s.id,r=i=>{var o;for(const a of i){if(a.id===e.selectedNodeId)return a;if((o=a.children)!=null&&o.length){const c=r(a.children);if(c)return c}}},n=r(e.treeData);return!!(n!=null&&n.isFolder)&&n.id!==t})}const wu={video:"#EA580C",pdf:"#DC2626",h5p:"#0D9488",scorm:"#7C3AED",audio:"#DB2777",quiz:"#16A34A",default:"#6B7280"},Su={video:"Video",pdf:"FileText",h5p:"Layers",scorm:"Package",audio:"Music",quiz:"HelpCircle",default:"File"},xu=["Course Assessment","eTextbook","Exam Question","Explanation Content","Learning Resource","Practice Question Set","SCORM Content","Teacher Resource"],Z1=[{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 J1(e){const t=[e.mimeType??"",e.primaryCategory??"",e.contentType??""].join(" ").toLowerCase();return t.includes("video")?"video":t.includes("pdf")||t.includes("epub")?"pdf":t.includes("h5p")?"h5p":t.includes("scorm")?"scorm":t.includes("audio")||t.includes("mp3")?"audio":t.includes("quiz")||t.includes("question")||t.includes("ecml")?"quiz":"default"}function ao(e){const t=J1(e);return{key:t,color:wu[t]??wu.default,bgClass:`sbx-ct-sq--${t}`,badgeClass:`sbx-ct-badge--${t}`,tintClass:`sbx-ct-tint--${t}`,iconName:Su[t]??Su.default,label:t.charAt(0).toUpperCase()+t.slice(1)}}const eE="_row_i3qt2_1",tE="_grip_i3qt2_16",rE="_menuBtn_i3qt2_19",nE="_selected_i3qt2_23",sE="_title_i3qt2_28",iE="_dropTarget_i3qt2_33",oE="_toggle_i3qt2_50",aE="_ctIcon_i3qt2_65",lE="_folderIcon_i3qt2_77",cE="_renameInput_i3qt2_92",uE="_dropHere_i3qt2_101",dE="_menuWrap_i3qt2_111",fE="_menu_i3qt2_19",hE="_dangerItem_i3qt2_163",Ot={row:eE,grip:tE,menuBtn:rE,selected:nE,title:sE,dropTarget:iE,toggle:oE,ctIcon:aE,folderIcon:lE,renameInput:cE,dropHere:uE,menuWrap:dE,menu:fE,dangerItem:hE},pE={video:Ja,pdf:Ka,h5p:Ga,scorm:Xa,audio:Ya,quiz:Qa,default:Kn},gE=({node:e,style:t,dragHandle:r,editorMode:n})=>{const[s,i]=p.useState(!1),[o,a]=p.useState(!1),[c,d]=p.useState(e.data.name),u=p.useRef(null),f=n==="edit",g=yl(),m=ao(e.data),_=pE[m.key]??Kn,h=e.isSelected,y=e.level===0,v=e.data.isFolder??(e.children&&e.children.length>0),b=y?xy:v?Ty:_;p.useEffect(()=>{if(!s)return;const C=D=>{var j;(j=u.current)!=null&&j.contains(D.target)||i(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[s]);const S=p.useCallback(()=>{c.trim()&&e.submit(c.trim()),a(!1)},[c,e]),w=p.useCallback(C=>{C.key==="Enter"&&S(),C.key==="Escape"&&(d(e.data.name),a(!1))},[S,e.data.name]);return l.jsxs("div",{className:[Ot.row,h?Ot.selected:"",e.state.isOver&&v?Ot.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:Ot.grip,"aria-hidden":"true",children:l.jsx(tf,{size:14})}),l.jsx("button",{className:Ot.toggle,onClick:C=>{C.stopPropagation(),e.toggle()},"aria-label":e.isClosed?"Expand":"Collapse",style:{visibility:v?"visible":"hidden"},children:e.isClosed?l.jsx(Xd,{size:14}):l.jsx(Bs,{size:14})}),l.jsx("span",{className:`${Ot.ctIcon} ${y||v?Ot.folderIcon:m.bgClass}`,"aria-hidden":"true",children:l.jsx(b,{size:12})}),o?l.jsx("input",{className:Ot.renameInput,value:c,autoFocus:!0,onChange:C=>d(C.target.value),onBlur:S,onKeyDown:w,onClick:C=>C.stopPropagation()}):l.jsx("span",{className:Ot.title,title:e.data.name,onDoubleClick:()=>f&&a(!0),children:e.data.name.length>25?`${e.data.name.slice(0,25)}...`:e.data.name}),e.state.isOver&&v&&l.jsx("span",{className:Ot.dropHere,"aria-hidden":"true",children:"Drop here"}),f&&l.jsxs("div",{className:Ot.menuWrap,ref:u,children:[l.jsx("button",{className:Ot.menuBtn,onClick:C=>{C.stopPropagation(),i(D=>!D)},"aria-label":"Node options",children:l.jsx(Jd,{size:14})}),s&&l.jsxs("div",{className:Ot.menu,role:"menu",children:[l.jsxs("button",{role:"menuitem",onClick:()=>{a(!0),i(!1)},children:[l.jsx(Py,{size:13})," Rename"]}),v&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.id}),i(!1)},children:[l.jsx(ef,{size:13})," Add sub-unit"]}),e.data.parent&&g&&l.jsxs("button",{role:"menuitem",onClick:()=>{e.tree.create({parentId:e.data.parent}),i(!1)},children:[l.jsx(Us,{size:13})," Add Sibling"]}),l.jsxs("button",{role:"menuitem",className:Ot.dangerItem,onClick:()=>{e.tree.delete(e.id),i(!1)},children:[l.jsx(Za,{size:13})," Delete"]})]})]})]})};async function mE(e,t){var i,o;const n=((i=(await Ne.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 yE(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 vE(e,t){var a;const r=await mE(e,t.name),n=await yE(r,t),s=new FormData;return s.append("fileUrl",n),s.append("mimeType",t.type||"text/csv"),{processId:(((a=(await Ne.post(`/action/collection/v1/import/${e}`,s)).data)==null?void 0:a.result)??{}).processId??""}}async function bE(e){var r;return((r=(await Ne.get(`/action/collection/v1/import/status/${e}`)).data)==null?void 0:r.result)??{status:"PENDING"}}async function jh(e){var n,s,i;const r=(i=(s=(n=(await Ne.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 _E(e){return jh(e)}const wE="_container_jr3ij_1",SE="_header_jr3ij_13",xE="_title_jr3ij_22",CE="_closeBtn_jr3ij_29",EE="_body_jr3ij_45",OE="_dropZone_jr3ij_54",DE="_dragOver_jr3ij_67",IE="_hasFile_jr3ij_72",TE="_hiddenInput_jr3ij_78",NE="_fileInfo_jr3ij_82",jE="_fileIcon_jr3ij_89",kE="_fileName_jr3ij_93",RE="_fileSize_jr3ij_100",AE="_dropHint_jr3ij_105",PE="_dropIcon_jr3ij_112",ME="_dropText_jr3ij_117",LE="_dropSubtext_jr3ij_124",FE="_sampleLink_jr3ij_130",$E="_statusBar_jr3ij_145",BE="_status_uploading_jr3ij_154",UE="_status_processing_jr3ij_154",VE="_status_done_jr3ij_159",qE="_status_error_jr3ij_164",zE="_successDetail_jr3ij_170",HE="_spinner_jr3ij_175",WE="_spin_jr3ij_175",QE="_errorMsg_jr3ij_191",KE="_failedSection_jr3ij_197",GE="_failedTitle_jr3ij_203",YE="_tableWrap_jr3ij_213",XE="_failedTable_jr3ij_219",ZE="_reasonCell_jr3ij_244",JE="_footer_jr3ij_248",je={container:wE,header:SE,title:xE,closeBtn:CE,body:EE,dropZone:OE,dragOver:DE,hasFile:IE,hiddenInput:TE,fileInfo:NE,fileIcon:jE,fileName:kE,fileSize:RE,dropHint:AE,dropIcon:PE,dropText:ME,dropSubtext:LE,sampleLink:FE,statusBar:$E,status_uploading:BE,status_processing:UE,status_done:VE,status_error:qE,successDetail:zE,spinner:HE,spin:WE,errorMsg:QE,failedSection:KE,failedTitle:GE,tableWrap:YE,failedTable:XE,reasonCell:ZE,footer:JE},eO=({contentId:e,onComplete:t,onClose:r,mode:n="create"})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState("idle"),[u,f]=p.useState(""),[g,m]=p.useState([]),[_,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 S=T=>T.name.toLowerCase().endsWith(".csv")?T.size>50*1024*1024?(f("File size must not exceed 50 MB."),!1):!0:(f("Only .csv files are accepted."),!1),w=p.useCallback(T=>{f(""),m([]),h(null),d("idle"),S(T)&&i(T)},[]),C=p.useCallback(T=>{T.preventDefault(),a(!1);const A=T.dataTransfer.files[0];A&&w(A)},[w]),D=p.useCallback(T=>{var B;const A=(B=T.target.files)==null?void 0:B[0];A&&w(A),T.target.value=""},[w]),j=p.useCallback(async()=>{try{const T=await _E(e),A=document.createElement("a");A.href=T,A.download="sample_hierarchy.csv",A.target="_blank",A.click()}catch{f("Failed to download sample CSV.")}},[e]),k=p.useCallback(async()=>{if(s){d("uploading"),f(""),m([]);try{const{processId:T}=await vE(e,s);if(!T){d("done"),h(null),setTimeout(t,1500);return}d("processing"),v.current=setInterval(async()=>{try{const A=await bE(T);A.status==="COMPLETED"?(b(),d("done"),h(A.successCount??null),A.failedRecords&&A.failedRecords.length>0?m(A.failedRecords):setTimeout(t,1500)):A.status==="FAILED"&&(b(),d("error"),f("Upload processing failed. Please check the error rows below."),A.failedRecords&&m(A.failedRecords))}catch{b(),d("error"),f("Lost connection while checking status. Please try again.")}},2e3)}catch{d("error"),f("Upload failed. Please check your file and try again.")}}},[e,s,t,b]),L={idle:"",uploading:"Uploading...",processing:"Processing...",done:"Done!",error:"Error"};return l.jsxs("div",{className:je.container,children:[l.jsxs("div",{className:je.header,children:[l.jsx("h2",{className:je.title,children:n==="update"?"Update Folder Metadata via CSV":"Create Folders via CSV"}),l.jsx("button",{className:je.closeBtn,onClick:r,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:je.body,children:[l.jsxs("div",{className:`${je.dropZone} ${o?je.dragOver:""} ${s?je.hasFile:""}`,onDragEnter:T=>{T.preventDefault(),a(!0)},onDragOver:T=>{T.preventDefault(),a(!0)},onDragLeave:T=>{T.preventDefault(),a(!1)},onDrop:C,onClick:()=>{var T;return(T=y.current)==null?void 0:T.click()},role:"button",tabIndex:0,"aria-label":"Drop CSV file here or click to browse",onKeyDown:T=>{var A;return T.key==="Enter"&&((A=y.current)==null?void 0:A.click())},children:[l.jsx("input",{ref:y,type:"file",accept:".csv",className:je.hiddenInput,onChange:D,"aria-hidden":"true"}),s?l.jsxs("div",{className:je.fileInfo,children:[l.jsx("span",{className:je.fileIcon,children:"📄"}),l.jsx("span",{className:je.fileName,children:s.name}),l.jsxs("span",{className:je.fileSize,children:["(",(s.size/1024).toFixed(1)," KB)"]})]}):l.jsxs("div",{className:je.dropHint,children:[l.jsx("span",{className:je.dropIcon,children:"⬆️"}),l.jsx("p",{className:je.dropText,children:"Drag & drop your CSV here"}),l.jsx("p",{className:je.dropSubtext,children:"or click to browse"})]})]}),l.jsx("button",{className:je.sampleLink,onClick:j,type:"button",children:"Download Sample CSV"}),c!=="idle"&&l.jsxs("div",{className:`${je.statusBar} ${je[`status_${c}`]}`,role:"status","aria-live":"polite",children:[c==="processing"&&l.jsx("span",{className:je.spinner,"aria-hidden":"true"}),L[c],c==="done"&&_!==null&&l.jsxs("span",{className:je.successDetail,children:[" — ",_," item(s) imported"]})]}),u&&l.jsx("p",{className:je.errorMsg,role:"alert",children:u}),g.length>0&&l.jsxs("div",{className:je.failedSection,children:[l.jsxs("h4",{className:je.failedTitle,children:["Failed Rows (",g.length,")"]}),l.jsx("div",{className:je.tableWrap,children:l.jsxs("table",{className:je.failedTable,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Row"}),l.jsx("th",{children:"Name"}),l.jsx("th",{children:"Reason"})]})}),l.jsx("tbody",{children:g.map((T,A)=>l.jsxs("tr",{children:[l.jsx("td",{children:T.rowNumber??A+1}),l.jsx("td",{children:T.name??"—"}),l.jsx("td",{className:je.reasonCell,children:T.reason??"Unknown error"})]},A))})]})})]})]}),l.jsxs("div",{className:je.footer,children:[l.jsx(Me,{variant:"ghost",onClick:r,disabled:c==="uploading"||c==="processing",children:"Cancel"}),l.jsx(Me,{variant:"primary",isLoading:c==="uploading"||c==="processing",disabled:!s||c==="done",onClick:k,children:c==="done"?"Uploaded":"Upload"})]})]})},tO="_container_1y30m_1",rO="_header_1y30m_8",nO="_headerActions_1y30m_19",sO="_iconBtn_1y30m_25",iO="_menuWrap_1y30m_43",oO="_dropdownMenu_1y30m_47",aO="_treeWrapper_1y30m_79",lO="_csvModal_1y30m_95",cO="_footer_1y30m_105",sr={container:tO,header:rO,headerActions:nO,iconBtn:sO,menuWrap:iO,dropdownMenu:oO,treeWrapper:aO,csvModal:lO,footer:cO},uO=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{var ve;const n=p.useRef(null),s=p.useRef(null),i=p.useRef(null),[o,a]=p.useState(400),[c,d]=p.useState(!1),[u,f]=p.useState(!1),[g,m]=p.useState("create"),{treeData:_,selectedNodeId:h,selectNode:y,addNode:v,deleteNode:b,reorderChildren:S,moveNode:w,setTreeData:C}=Oe(),D=e==="edit",j=yl(),k=D&&j,L=(((ve=_[0])==null?void 0:ve.children)??[]).some(q=>q.isFolder),T=ae(q=>{var J,te,U,Z;return((te=(J=q.editorConfig)==null?void 0:J.context)==null?void 0:te.contentId)??((Z=(U=q.editorConfig)==null?void 0:U.context)==null?void 0:Z.identifier)??""}),A=ae(q=>{var te,U;const J=(U=(te=q.categoryMeta)==null?void 0:te.sourcingSettings)==null?void 0:U.collection;return(J==null?void 0:J.enableBulkUpload)!==!1});p.useEffect(()=>{const q=s.current;if(!q)return;const J=new ResizeObserver(()=>{a(q.clientHeight||400)});return J.observe(q),a(q.clientHeight||400),()=>J.disconnect()},[]),p.useEffect(()=>{if(!c)return;const q=J=>{var te;(te=i.current)!=null&&te.contains(J.target)||d(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[c]);const B=p.useCallback(q=>{q.length>0&&y(q[0].data.id)},[y]),R=p.useCallback(({parentId:q,index:J,dragIds:te})=>{if(!q)return;const U=te[0],Z=Na(_,U);if(!Z)return;const K=Z.parent;if(K===q){const le=Na(_,q);if(!(le!=null&&le.children))return;const ee=le.children.findIndex(pe=>pe.id===U);if(ee<0)return;S(q,ee,J>ee?J-1:J)}else w(U,K??"",q)},[_,S,w]),P=p.useCallback(({ids:q})=>{q.forEach(J=>b(J))},[b]),F=p.useCallback(({parentId:q})=>{var U;const J=q??((U=_[0])==null?void 0:U.id)??"";if(!J)return{id:crypto.randomUUID()};const te=v(J,"unit");return te?{id:te}:(Ce.error("Maximum depth reached"),{id:crypto.randomUUID()})},[v,_]),X=p.useCallback(()=>{var J;const q=(J=_[0])==null?void 0:J.id;q&&(v(q,"unit")||Ce.error("Maximum depth reached"))},[_,v]),se=p.useCallback(()=>{h&&(v(h,"subunit")||Ce.error("Maximum depth reached"))},[h,v]),De=p.useCallback(async()=>{if(d(!1),!!T)try{const q=await jh(T),J=await fetch(q).then(Z=>Z.blob()),te=URL.createObjectURL(J),U=document.createElement("a");U.href=te,U.download=`${T}-folders.csv`,U.style.display="none",document.body.appendChild(U),U.click(),document.body.removeChild(U),URL.revokeObjectURL(te)}catch{Ce.error("Failed to download CSV")}},[T]),Se=p.useCallback(async()=>{if(f(!1),!!T)try{const{rootNode:q}=await $f(T);C([q]),Ce.success("Course outline refreshed.")}catch{Ce.error("Outline could not be refreshed automatically. Please reload the page.")}},[T,C]);return l.jsxs("div",{className:sr.container,children:[l.jsx("div",{className:sr.header,children:l.jsxs("div",{className:sr.headerActions,children:[D&&l.jsxs("div",{className:sr.menuWrap,ref:i,children:[l.jsx("button",{type:"button",className:sr.iconBtn,onClick:()=>d(q=>!q),"aria-label":"More options",title:"More options","aria-haspopup":"true","aria-expanded":c,children:l.jsx(Jd,{size:15})}),c&&l.jsx("div",{className:sr.dropdownMenu,role:"menu",children:A&&l.jsxs(l.Fragment,{children:[l.jsx("button",{role:"menuitem",type:"button",disabled:L,title:L?'Folders already exist — use "Update" instead':void 0,onClick:()=>{d(!1),m("create"),f(!0)},children:"Create folders using csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:De,children:"Download folders as csv file"}),l.jsx("button",{role:"menuitem",type:"button",disabled:!L,title:L?void 0:'No folders yet — use "Create" first',onClick:()=>{d(!1),m("update"),f(!0)},children:"Update folder metadata using csv file"})]})})]}),r&&l.jsx("button",{type:"button",className:sr.iconBtn,onClick:r,"aria-label":t?"Expand outline":"Collapse outline",title:t?"Expand outline":"Collapse outline",children:t?l.jsx(Ry,{size:15}):l.jsx(ky,{size:15})})]})}),l.jsx("div",{className:sr.treeWrapper,ref:s,children:l.jsx(Y1,{ref:n,data:_,idAccessor:"id",childrenAccessor:"children",onSelect:B,onMove:D?R:void 0,onDelete:D?P:void 0,onCreate:D?F:void 0,disableEdit:!D,disableDrop:!D,selection:h??void 0,rowHeight:40,indent:20,paddingBottom:16,height:o,width:"100%",children:q=>l.jsx(gE,{...q,editorMode:e})})}),D&&l.jsxs("div",{className:sr.footer,children:[l.jsxs(Me,{variant:"ghost",size:"sm",onClick:X,disabled:!k,children:[l.jsx(Us,{size:14})," Add Unit"]}),l.jsxs(Me,{variant:"ghost",size:"sm",onClick:se,disabled:!k||!h,children:[l.jsx(ef,{size:14})," Add Sub-unit"]})]}),u&&l.jsx("div",{className:sr.csvModal,children:l.jsx(eO,{contentId:T,mode:g,onComplete:Se,onClose:()=>f(!1)})})]})};function Na(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=Na(r.children,t);if(n)return n}}}const dO="_breadcrumb_zd1aj_1",fO="_crumb_zd1aj_10",hO="_sep_zd1aj_26",pO="_current_zd1aj_31",is={breadcrumb:dO,crumb:fO,sep:hO,current:pO},gO=({crumbs:e})=>{const t=Oe(r=>r.selectNode);return e.length?l.jsxs("nav",{className:is.breadcrumb,"aria-label":"Node path",children:[l.jsx("button",{className:is.crumb,onClick:()=>t(e[0].id),"aria-label":"Home",children:l.jsx(Ny,{size:13})}),e.map((r,n)=>l.jsxs(p.Fragment,{children:[l.jsx(Xd,{size:13,className:is.sep}),n<e.length-1?l.jsx("button",{className:is.crumb,onClick:()=>t(r.id),children:r.name}):l.jsx("span",{className:is.current,children:r.name})]},r.id))]}):null},mO="_tabBar_qhks1_1",yO="_tab_qhks1_1",vO="_active_qhks1_29",bO="_error_qhks1_35",_O="_errorDot_qhks1_39",os={tabBar:mO,tab:yO,active:vO,error:bO,errorDot:_O},Cu=[{id:"details",label:"Details"},{id:"audience",label:"Audience & Curriculum"},{id:"licensing",label:"Licensing"}],wO=({activeTab:e,onChange:t,errorTabs:r=[],visibleTabs:n})=>{const s=n?Cu.filter(i=>n.includes(i.id)):Cu;return l.jsx("div",{className:os.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:[os.tab,e===i.id?os.active:"",r.includes(i.id)?os.error:""].join(" "),onClick:()=>t(i.id),children:[i.label,r.includes(i.id)&&l.jsx("span",{className:os.errorDot,"aria-label":"Has errors"})]},i.id))})};var Ws=e=>e.type==="checkbox",Kr=e=>e instanceof Date,ct=e=>e==null;const kh=e=>typeof e=="object";var qe=e=>!ct(e)&&!Array.isArray(e)&&kh(e)&&!Kr(e),ja=e=>qe(e)&&e.target?Ws(e.target)?e.target.checked:e.target.value:e,Rh=(e,t)=>t.split(".").some((r,n,s)=>!isNaN(Number(r))&&e.has(s.slice(0,n).join("."))),Ah=e=>{const t=e.constructor&&e.constructor.prototype;return qe(t)&&t.hasOwnProperty("isPrototypeOf")},lo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ze(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(lo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(qe(e)&&Ah(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=ze(e[s]));return n}const Ir={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Gt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Bo="form",Ph="root",Mh=["__proto__","constructor","prototype"];var Qs=e=>/^\w*$/.test(e),$e=e=>e===void 0,co=e=>e.split(/[.[\]'"]/g).filter(Boolean),Q=(e,t,r)=>{if(!t||!qe(e))return r;const n=Qs(t)?[t]:co(t);if(n.some(i=>Mh.includes(i)))return r;const s=n.reduce((i,o)=>ct(i)?void 0:i[o],e);return $e(s)||s===e?$e(e[t])?r:e[t]:s},Pt=e=>typeof e=="boolean",vt=e=>typeof e=="function",Ae=(e,t,r)=>{let n=-1;const s=Qs(t)?[t]:co(t),i=s.length,o=i-1;for(;++n<i;){const a=s[n];let c=r;if(n!==o){const d=e[a];c=qe(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(Mh.includes(a))return;e[a]=c,e=e[a]}};const vl=p.createContext(null);vl.displayName="HookFormControlContext";const bl=()=>p.useContext(vl);var Lh=(e,t,r,n=!0)=>{const s={};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Gt.all&&(t._proxyFormState[o]=!n||Gt.all),r&&(r[o]=!0),e[o]}});return s};const _l=lo?p.useLayoutEffect:p.useEffect;function SO(e){const t=bl(),{control:r=t,disabled:n,name:s,exact:i}=e||{},[o,a]=p.useState(()=>({...r._formState,defaultValues:r._defaultValues})),c=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return _l(()=>r._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!n&&a({...r._formState,...d,defaultValues:r._defaultValues})}}),[s,n,i]),p.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),p.useMemo(()=>Lh(o,r,c.current,!1),[o,r])}var bt=e=>typeof e=="string",ka=(e,t,r,n,s)=>bt(e)?(n&&t.watch.add(e),Q(r,e,s)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),Q(r,i))):(n&&(t.watchAll=!0),r),Ra=e=>ct(e)||!kh(e);const Eu=(e,t)=>t.length===0&&!Array.isArray(e)&&!Ah(e);function Mt(e,t,r=new WeakMap){if(e===t)return!0;if(Ra(e)||Ra(t))return Object.is(e,t);if(Kr(e)&&Kr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(Eu(e,n)||Eu(t,s))return Object.is(e,t);const i=r.get(e);if(i&&i.has(t))return!0;i?i.add(t):r.set(e,new WeakSet([t]));for(const o of n){const a=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(Kr(a)&&Kr(c)||(qe(a)||Array.isArray(a))&&(qe(c)||Array.isArray(c))?!Mt(a,c,r):!Object.is(a,c))return!1}}return!0}function xO(e){const t=bl(),{control:r=t,name:n,defaultValue:s,disabled:i,exact:o,compute:a}=e||{},c=p.useRef(s),d=p.useRef(a),u=p.useRef(void 0),f=p.useRef(r),g=p.useRef(n);d.current=a;const[m,_]=p.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=p.useCallback(w=>{const C=ka(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),y=p.useCallback(w=>{if(!i){const C=ka(n,r._names,w||r._formValues,!1,c.current);if(d.current){const D=d.current(C);Mt(D,u.current)||(_(D),u.current=D)}else _(C)}},[r._formValues,r._names,i,n]);_l(()=>((f.current!==r||!Mt(g.current,n))&&(f.current=r,g.current=n,y()),r._subscribe({name:n,formState:{values:!0},exact:o,callback:w=>{y(w.values)}})),[r,o,n,y]),p.useEffect(()=>r._removeUnmounted());const v=f.current!==r,b=g.current,S=p.useMemo(()=>{if(i)return null;const w=!v&&!Mt(b,n);return v||w?h():null},[i,v,n,b,h]);return S!==null?S:m}function uo(e){const t=bl(),{name:r,disabled:n,control:s=t,shouldUnregister:i,defaultValue:o,exact:a=!0}=e,c=Rh(s._names.array,r),d=p.useMemo(()=>Q(s._formValues,r,Q(s._defaultValues,r,o)),[s,r,o]),u=xO({control:s,name:r,defaultValue:d,exact:a}),f=SO({control:s,name:r,exact:a}),g=p.useRef(e),m=p.useRef(null),_=p.useRef(s.register(r,{...e.rules,value:u,...Pt(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const h=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Q(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!Q(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Q(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Q(f.validatingFields,r)},error:{enumerable:!0,get:()=>Q(f.errors,r)}}),[f,r]),y=p.useCallback(w=>{const C=ja(w);return Q(s._fields,r)||(_.current=s.register(r,{...g.current.rules,value:C})),_.current.onChange({target:{value:ja(w),name:r},type:Ir.CHANGE})},[r,s]),v=p.useCallback(()=>_.current.onBlur({target:{value:Q(s._formValues,r),name:r},type:Ir.BLUR}),[r,s._formValues]),b=p.useCallback(w=>{w&&(m.current={focus:()=>vt(w.focus)&&w.focus(),select:()=>vt(w.select)&&w.select(),setCustomValidity:D=>vt(w.setCustomValidity)&&w.setCustomValidity(D),reportValidity:()=>vt(w.reportValidity)&&w.reportValidity()});const C=Q(s._fields,r);C&&C._f&&w&&(C._f.ref=m.current)},[s._fields,r]),S=p.useMemo(()=>({name:r,value:u,...Pt(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:y,onBlur:v,ref:b}),[r,n,f.disabled,y,v,b,u]);return p.useEffect(()=>{const w=s._options.shouldUnregister||i;s.register(r,{...g.current.rules,...Pt(g.current.disabled)?{disabled:g.current.disabled}:{}});const C=(D,j)=>{const k=Q(s._fields,D);k&&k._f&&(k._f.mount=j)};if(C(r,!0),w){const D=ze(Q(i?s._defaultValues:s._options.values||s._defaultValues,r,Q(s._options.defaultValues,r,g.current.defaultValue)));Ae(s._defaultValues,r,D),$e(Q(s._formValues,r))&&Ae(s._formValues,r,D)}if(!c&&s.register(r),m.current){const D=Q(s._fields,r);D&&D._f&&(D._f.ref=m.current)}return()=>{(c?w&&!s._state.action:w)?s.unregister(r):C(r,!1)}},[r,s,c,i]),p.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),p.useMemo(()=>({field:S,formState:f,fieldState:h}),[S,f,h])}const wl=p.createContext(null);wl.displayName="HookFormContext";const Jt=()=>p.useContext(wl),CO=({children:e,watch:t,getValues:r,getFieldState:n,setError:s,clearErrors:i,setValue:o,setValues:a,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:_,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:d,resetField:u,reset:f,handleSubmit:g,unregister:m,control:_,register:h,setFocus:y,subscribe:v}),[i,_,d,n,r,g,h,f,u,s,y,o,a,v,c,m,t]);return p.createElement(wl.Provider,{value:b},p.createElement(vl.Provider,{value:b.control},e))};var EO=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Fh=e=>Array.isArray(e)?e.filter(Boolean):[],Ci=e=>Array.isArray(e)?e:[e],Ou=()=>{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}};function $h(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const s=e[n],i=t[n];if(s&&qe(s)&&i){const o=$h(s,i);qe(o)&&(r[n]=o)}else e[n]&&(r[n]=i)}return r}var nt=e=>qe(e)&&!Object.keys(e).length,Sl=e=>e.type==="file",Fi=e=>{if(!lo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Bh=e=>e.type==="select-multiple",xl=e=>e.type==="radio",OO=e=>xl(e)||Ws(e),Uo=e=>Fi(e)&&e.isConnected;function DO(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;){if(ct(e)){e=void 0;break}e=e[t[n]],n++}return e}function IO(e){for(const t in e)if(e.hasOwnProperty(t)&&!$e(e[t]))return!1;return!0}function Xe(e,t){if(bt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Qs(t)?[t]:co(t),n=r.length===1?e:DO(e,r),s=r.length-1,i=r[s];return n&&delete n[i],s!==0&&(qe(n)&&nt(n)||Array.isArray(n)&&IO(n))&&Xe(e,r.slice(0,-1)),e}var TO=e=>{for(const t in e)if(vt(e[t]))return!0;return!1};function Uh(e){return Array.isArray(e)||qe(e)&&!TO(e)}function Aa(e,t={}){for(const r in e){const n=e[r];Uh(n)?(t[r]=Array.isArray(n)?[]:{},Aa(n,t[r])):$e(n)||(t[r]=!0)}return t}function Pa(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(r=>Pa(r));return t.some(r=>r!==void 0)?t:void 0}if(qe(e)){const t={};for(const r in e){const n=Pa(e[r]);$e(n)||(t[r]=n)}return Object.keys(t).length?t:void 0}}}function zr(e,t,r){r||(r=Aa(t));for(const n in e){const s=e[n];if(Uh(s))$e(t)||Ra(r[n])?r[n]=Aa(s,Array.isArray(s)?[]:{}):zr(s,ct(t)?{}:t[n],r[n]);else{const i=t[n];r[n]=!Mt(s,i)}}return Pa(r)||{}}const Du={value:!1,isValid:!1},Iu={value:!0,isValid:!0};var Vh=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$e(e[0].attributes.value)?$e(e[0].value)||e[0].value===""?Iu:{value:e[0].value,isValid:!0}:Iu:Du}return Du},qh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$e(e)?e:t?e===""?NaN:e&&+e:r&&bt(e)?new Date(e):n?n(e):e;const Tu={isValid:!1,value:null};var zh=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Tu):Tu;function Nu(e){const t=e.ref;return Sl(t)?t.files:xl(t)?zh(e.refs).value:Bh(t)?[...t.selectedOptions].map(({value:r})=>r):Ws(t)?Vh(e.refs).value:qh($e(t.value)?e.ref.value:t.value,e)}var NO=(e,t,r,n)=>{const s={};for(const i of e){const o=Q(t,i);o&&Ae(s,i,o._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},$i=e=>e instanceof RegExp,as=e=>$e(e)?e:$i(e)?e.source:qe(e)?$i(e.value)?e.value.source:e.value:e,ju=e=>({isOnSubmit:!e||e===Gt.onSubmit,isOnBlur:e===Gt.onBlur,isOnChange:e===Gt.onChange,isOnAll:e===Gt.all,isOnTouch:e===Gt.onTouched});const ku="AsyncFunction";var jO=e=>!!e&&!!e.validate&&!!(vt(e.validate)&&e.validate.constructor.name===ku||qe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===ku)),kO=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Vo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(`${n}.`)));const bs=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const i=Q(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(bs(a,t))break}else if(qe(a)&&bs(a,t))break}}};function Ru(e,t,r){const n=Q(e,r);if(n||Qs(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const i=s.join("."),o=Q(t,i),a=Q(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 RO=(e,t,r,n)=>{r(e);const{name:s,...i}=e;return nt(i)||n&&Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!n||Gt.all))},AO=(e,t,r)=>!e||!t||e===t||Ci(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),PO=(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,MO=(e,t)=>!Fh(Q(e,t)).length&&Xe(e,t),Au=(e,t,r)=>{const n=Q(e,r),s=Array.isArray(n)?n:[];return Ae(s,Ph,t[r]),Ae(e,r,s),e};function Pu(e,t,r="validate"){if(bt(e)||Array.isArray(e)&&e.every(bt)||Pt(e)&&!e)return{type:r,message:bt(e)?e:"",ref:t}}var wn=e=>qe(e)&&!$i(e)?e:{value:e,message:""},Mu=async(e,t,r,n,s,i)=>{const{ref:o,refs:a,required:c,maxLength:d,minLength:u,min:f,max:g,pattern:m,validate:_,name:h,valueAsNumber:y,mount:v}=e._f,b=Q(r,h);if(!v||t.has(h))return{};const S=a?a[0]:o,w=B=>{if(s&&S.reportValidity){const R=Pt(B)?"":B||"";a?a.forEach(P=>P.setCustomValidity(R)):S.setCustomValidity(R),S.reportValidity()}},C={},D=xl(o),j=Ws(o),k=D||j,L=(y||Sl(o))&&$e(o.value)&&$e(b)||Fi(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,T=EO.bind(null,h,n,C),A=(B,R,P,F=Qt.maxLength,X=Qt.minLength)=>{const se=B?R:P;C[h]={type:B?F:X,message:se,ref:o,...T(B?F:X,se)}};if(i?!Array.isArray(b)||!b.length:c&&(!k&&(L||ct(b))||Pt(b)&&!b||j&&!Vh(a).isValid||D&&!zh(a).isValid)){const{value:B,message:R}=bt(c)?{value:!!c,message:c}:wn(c);if(B&&(C[h]={type:Qt.required,message:R,ref:S,...T(Qt.required,R)},!n))return w(R),C}if(!L&&(!ct(f)||!ct(g))){let B,R;const P=wn(g),F=wn(f);if(!ct(b)&&!isNaN(b)){const X=o.valueAsNumber||b&&+b;ct(P.value)||(B=X>P.value),ct(F.value)||(R=X<F.value)}else{const X=o.valueAsDate||new Date(b),se=ve=>new Date(new Date().toDateString()+" "+ve),De=o.type=="time",Se=o.type=="week";bt(P.value)&&b&&(B=De?se(b)>se(P.value):Se?b>P.value:X>new Date(P.value)),bt(F.value)&&b&&(R=De?se(b)<se(F.value):Se?b<F.value:X<new Date(F.value))}if((B||R)&&(A(!!B,P.message,F.message,Qt.max,Qt.min),!n))return w(C[h].message),C}if((d||u)&&!L&&(bt(b)||i&&Array.isArray(b))){const B=wn(d),R=wn(u),P=!ct(B.value)&&b.length>+B.value,F=!ct(R.value)&&b.length<+R.value;if((P||F)&&(A(P,B.message,R.message),!n))return w(C[h].message),C}if(m&&!L&&bt(b)){const{value:B,message:R}=wn(m);if($i(B)&&!b.match(B)&&(C[h]={type:Qt.pattern,message:R,ref:o,...T(Qt.pattern,R)},!n))return w(R),C}if(_){if(vt(_)){const B=await _(b,r),R=Pu(B,S);if(R&&(C[h]={...R,...T(Qt.validate,R.message)},!n))return w(R.message),C}else if(qe(_)){let B={};for(const R in _){if(!nt(B)&&!n)break;const P=Pu(await _[R](b,r),S,R);P&&(B={...P,...T(R,P.message)},w(P.message),n&&(C[h]=B))}if(!nt(B)&&(C[h]={ref:S,...B},!n))return C}}return w(!0),C};const LO={mode:Gt.onSubmit,reValidateMode:Gt.onChange,shouldFocusError:!0},Hh={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function FO(e={}){let t={...LO,...e},r={...ze(Hh),isLoading:vt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},n={},s=qe(t.defaultValues)||qe(t.values)?ze(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:ze(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...u};let g={...f};const m={array:Ou(),state:Ou()},_=t.criteriaMode===Gt.all,h=x=>I=>{clearTimeout(d),d=setTimeout(x,I)},y=async x=>{if(!o.keepIsValid&&!t.disabled&&(f.isValid||g.isValid||x)){let I;t.resolver?(I=nt((await T()).errors),v()):I=await R({fields:n,onlyCheckValid:!0,eventType:Ir.VALID}),I!==r.isValid&&m.state.next({isValid:I})}},v=(x,I)=>{!t.disabled&&(f.isValidating||f.validatingFields||g.isValidating||g.validatingFields)&&((x||Array.from(a.mount)).forEach(N=>{N&&(I?Ae(r.validatingFields,N,I):Xe(r.validatingFields,N))}),m.state.next({validatingFields:r.validatingFields,isValidating:!nt(r.validatingFields)}))},b=()=>{r.dirtyFields=zr(s,i)},S=(x,I=[],N,$,V=!0,W=!0)=>{if($&&N&&!t.disabled){if(o.action=!0,W&&Array.isArray(Q(n,x))){const z=N(Q(n,x),$.argA,$.argB);V&&Ae(n,x,z)}if(W&&Array.isArray(Q(r.errors,x))){const z=N(Q(r.errors,x),$.argA,$.argB);V&&Ae(r.errors,x,z),MO(r.errors,x)}if((f.touchedFields||g.touchedFields)&&W&&Array.isArray(Q(r.touchedFields,x))){const z=N(Q(r.touchedFields,x),$.argA,$.argB);V&&Ae(r.touchedFields,x,z)}(f.dirtyFields||g.dirtyFields)&&b(),m.state.next({name:x,isDirty:F(x,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ae(i,x,I)},w=(x,I)=>{Ae(r.errors,x,I),r.errors={...r.errors},m.state.next({errors:r.errors})},C=x=>{r.errors=x,m.state.next({errors:r.errors,isValid:!1})},D=x=>{const I=Qs(x)?[x]:co(x);let N=i,$=s;for(let V=0;V<I.length-1;V++){const W=I[V];if(N=ct(N)?N:N[W],$=ct($)?$:$[W],N===null&&$!==null)return!0}return!1},j=(x,I,N,$)=>{const V=Q(n,x);if(V){if(D(x))return;const W=$e(Q(i,x)),z=Q(i,x,$e(N)?Q(s,x):N);$e(z)||$&&$.defaultChecked||I?Ae(i,x,I?z:Nu(V._f)):De(x,z),o.mount&&!o.action&&(y(),W&&r.isDirty&&(f.isDirty||g.isDirty)&&(F()||(r.isDirty=!1,m.state.next({...r}))),e.shouldUnregister&&W&&!$e(Q(i,x))&&Vo(x,a)&&(o.watch=!0))}},k=(x,I,N,$,V)=>{let W=!1,z=!1;const ne={name:x};if(!t.disabled){if(!N||$){(f.isDirty||g.isDirty)&&(z=r.isDirty,r.isDirty=ne.isDirty=F(),W=z!==ne.isDirty);const ge=Mt(Q(s,x),I);z=!!Q(r.dirtyFields,x),ge!==r.isDirty?r.dirtyFields=zr(s,i):ge?Xe(r.dirtyFields,x):Ae(r.dirtyFields,x,!0),ne.dirtyFields=r.dirtyFields,W=W||(f.dirtyFields||g.dirtyFields)&&z!==!ge}if(N){const ge=Q(r.touchedFields,x);ge||(Ae(r.touchedFields,x,N),ne.touchedFields=r.touchedFields,W=W||(f.touchedFields||g.touchedFields)&&ge!==N)}W&&V&&m.state.next(ne)}return W?ne:{}},L=(x,I,N,$)=>{const V=Q(r.errors,x),W=(f.isValid||g.isValid)&&Pt(I)&&r.isValid!==I;if(t.delayError&&N?(c=h(()=>w(x,N)),c(t.delayError)):(clearTimeout(d),c=null,N?Ae(r.errors,x,N):Xe(r.errors,x),r.errors={...r.errors}),(N?!Mt(V,N):V)||!nt($)||W){const z={...$,...W&&Pt(I)?{isValid:I}:{},errors:r.errors,name:x};r={...r,...z},m.state.next(z)}},T=async x=>(v(x,!0),await t.resolver(i,t.context,NO(x||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),A=async x=>{const{errors:I}=await T(x);if(v(x),x){for(const N of x){const $=Q(I,N);$?a.array.has(N)&&qe($)&&!Object.keys($).some(V=>!Number.isNaN(Number(V)))?Au(r.errors,{[N]:$},N):Ae(r.errors,N,$):Xe(r.errors,N)}r.errors={...r.errors}}else r.errors=I;return I},B=async({name:x,eventType:I})=>{if(e.validate){const N=await e.validate({formValues:i,formState:r,name:x,eventType:I});if(qe(N))for(const $ in N){const V=N[$];V&&pe(`${Bo}.${$}`,{message:bt(V.message)?V.message:"",type:V.type||Qt.validate})}else bt(N)||!N?pe(Bo,{message:N||"",type:Qt.validate}):ee(Bo);return N}return!0},R=async({fields:x,onlyCheckValid:I,name:N,eventType:$,context:V={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(V.runRootValidation=!0,!await B({name:N,eventType:$})&&(V.valid=!1,I)))return V.valid;for(const W in x){const z=x[W];if(z){const{_f:ne,...ge}=z;if(ne){const Ue=a.array.has(ne.name),Ct=z._f&&jO(z._f),Et=f.validatingFields||f.isValidating||g.validatingFields||g.isValidating;Ct&&Et&&v([ne.name],!0);const hr=await Mu(z,a.disabled,i,_,t.shouldUseNativeValidation&&!I,Ue);if(Ct&&Et&&v([ne.name]),hr[ne.name]&&(V.valid=!1,I)||(!I&&(Q(hr,ne.name)?Ue?Au(r.errors,hr,ne.name):Ae(r.errors,ne.name,hr[ne.name]):Xe(r.errors,ne.name)),e.shouldUseNativeValidation&&hr[ne.name]))break}!nt(ge)&&await R({context:V,onlyCheckValid:I,fields:ge,name:W,eventType:$})}}return V.valid},P=()=>{for(const x of a.unMount){const I=Q(n,x);I&&(I._f.refs?I._f.refs.every(N=>!Uo(N)):!Uo(I._f.ref))&&Ge(x)}a.unMount=new Set},F=(x,I)=>!t.disabled&&(x&&I&&Ae(i,x,I),!Mt(K(),s)),X=(x,I,N)=>ka(x,a,{...o.mount?i:$e(I)?s:bt(x)?{[x]:I}:I},N,I),se=x=>Fh(Q(o.mount?i:s,x,t.shouldUnregister?Q(s,x,[]):[])),De=(x,I,N={},$=!1)=>{const V=Q(n,x);let W=I;if(V){const z=V._f;z&&(!z.disabled&&Ae(i,x,qh(I,z)),W=Fi(z.ref)&&ct(I)?"":I,Bh(z.ref)?[...z.ref.options].forEach(ne=>ne.selected=W.includes(ne.value)):z.refs?Ws(z.ref)?z.refs.forEach(ne=>{(!ne.defaultChecked||!ne.disabled)&&(Array.isArray(W)?ne.checked=!!W.find(ge=>ge===ne.value):ne.checked=W===ne.value||!!W)}):z.refs.forEach(ne=>ne.checked=ne.value===W):Sl(z.ref)?z.ref.value="":(z.ref.value=W,z.ref.type||m.state.next({name:x,values:$?i:ze(i)})))}(N.shouldDirty||N.shouldTouch)&&k(x,W,N.shouldTouch,N.shouldDirty,!0),N.shouldValidate&&Z(x)},Se=(x,I,N,$=!1)=>{for(const V in I){if(!I.hasOwnProperty(V))return;const W=I[V],z=x+"."+V,ne=Q(n,z);(a.array.has(x)||qe(W)||ne&&!ne._f)&&!Kr(W)?Se(z,W,N,$):De(z,W,N,$)}},ve=(x,I,N,$)=>{const V=Q(n,x),W=a.array.has(x),z=$?I:ze(I),ne=Q(i,x),ge=Mt(ne,z);if(ge||Ae(i,x,z),W)m.array.next({name:x,values:$?i:ze(i)}),(f.isDirty||f.dirtyFields||g.isDirty||g.dirtyFields)&&N.shouldDirty&&(b(),m.state.next({name:x,dirtyFields:r.dirtyFields,isDirty:F(x,z)}));else{const Ue=Array.isArray(z)&&!z.length||nt(z);!V||V._f||ct(z)||Ue?De(x,z,N,$):Se(x,z,N,$)}if(!ge){const Ue=Vo(x,a),Ct=$?i:ze(i);m.state.next({...Ue&&r,name:o.mount||Ue?x:void 0,values:Ct})}},q=(x,I,N={})=>ve(x,I,N,!1),J=(x,I={})=>{const N=vt(x)?x(i):x;if(!Mt(i,N)){i={...i,...N};for(const $ of a.mount)ve($,Q(N,$),I,!0);m.state.next({...r,name:void 0,type:void 0,values:i}),I.shouldValidate&&y()}},te=async x=>{o.mount=!0;const I=x.target;let N=I.name,$=!0;const V=Q(n,N),W=ge=>{$=Number.isNaN(ge)||Kr(ge)&&isNaN(ge.getTime())||Mt(ge,Q(i,N,ge))},z=ju(t.mode),ne=ju(t.reValidateMode);if(V){let ge,Ue;const Ct=I.type?Nu(V._f):ja(x),Et=x.type===Ir.BLUR||x.type===Ir.FOCUS_OUT,hr=!kO(V._f)&&!e.validate&&!t.resolver&&!Q(r.errors,N)&&!V._f.deps||PO(Et,Q(r.touchedFields,N),r.isSubmitted,ne,z),Xn=Vo(N,a,Et);Ae(i,N,Ct),Et?(!I||!I.readOnly)&&(V._f.onBlur&&V._f.onBlur(x),c&&c(0)):V._f.onChange&&V._f.onChange(x);const Ur=k(N,Ct,Et),et=!nt(Ur)||Xn;if(!Et&&m.state.next({name:N,type:x.type,values:ze(i)}),hr)return(f.isValid||g.isValid)&&(t.mode==="onBlur"?Et&&y():Et||y()),et&&m.state.next({name:N,...Xn?{}:Ur});if(!t.resolver&&e.validate&&await B({name:N,eventType:x.type}),!Et&&Xn&&m.state.next({...r}),t.resolver){const{errors:ft}=await T([N]);if(v([N]),W(Ct),!$){!nt(Ur)&&m.state.next(Ur);return}const wt=Ru(r.errors,n,N),Ht=Ru(ft,n,wt.name||N);ge=Ht.error,N=Ht.name,Ue=nt(ft)}else v([N],!0),ge=(await Mu(V,a.disabled,i,_,t.shouldUseNativeValidation))[N],v([N]),W(Ct),$&&(ge?Ue=!1:(f.isValid||g.isValid)&&(Ue=await R({fields:n,onlyCheckValid:!0,name:N,eventType:x.type})));$&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&Z(V._f.deps),L(N,Ue,ge,Ur))}},U=(x,I)=>{if(Q(r.errors,I)&&x.focus)return x.focus(),1},Z=async(x,I={})=>{let N,$;const V=Ci(x);if(t.resolver){const W=await A($e(x)?x:V);N=nt(W),$=x?!V.some(z=>Q(W,z)):N}else x?($=(await Promise.all(V.map(async W=>{const z=Q(n,W);return await R({fields:z&&z._f?{[W]:z}:z,eventType:Ir.TRIGGER})}))).every(Boolean),!(!$&&!r.isValid)&&y()):$=N=await R({fields:n,name:x,eventType:Ir.TRIGGER});return m.state.next({...!bt(x)||(f.isValid||g.isValid)&&N!==r.isValid?{}:{name:x},...t.resolver||!x?{isValid:N}:{},errors:r.errors}),I.shouldFocus&&!$&&bs(n,U,x?V:a.mount),$},K=(x,I)=>{let N={...o.mount?i:s};return I&&(N=$h(I.dirtyFields?r.dirtyFields:r.touchedFields,N)),$e(x)?N:bt(x)?Q(N,x):x.map($=>Q(N,$))},le=(x,I)=>({invalid:!!Q((I||r).errors,x),isDirty:!!Q((I||r).dirtyFields,x),error:Q((I||r).errors,x),isValidating:!!Q(r.validatingFields,x),isTouched:!!Q((I||r).touchedFields,x)}),ee=x=>{const I=x?Ci(x):void 0;I==null||I.forEach(N=>Xe(r.errors,N)),I?I.forEach(N=>{m.state.next({name:N,errors:r.errors})}):m.state.next({errors:{}})},pe=(x,I,N)=>{const $=(Q(n,x,{_f:{}})._f||{}).ref,V=Q(r.errors,x)||{},{ref:W,message:z,type:ne,...ge}=V;Ae(r.errors,x,{...ge,...I,ref:$}),m.state.next({name:x,errors:r.errors,isValid:!1}),N&&N.shouldFocus&&$&&$.focus&&$.focus()},oe=(x,I)=>vt(x)?m.state.subscribe({next:N=>"values"in N&&x(N.values||X(void 0,I),N)}):X(x,I,!0),We=x=>m.state.subscribe({next:I=>{if(AO(x.name,I.name,x.exact)&&RO(I,x.formState||f,ue,x.reRenderRoot)){const N={...i};x.callback({values:N,...r,...I,defaultValues:s})}}}).unsubscribe,xe=x=>(o.mount=!0,g={...g,...x.formState},We({...x,formState:{...u,...x.formState}})),Ge=(x,I={})=>{for(const N of x?Ci(x):a.mount)a.mount.delete(N),a.array.delete(N),I.keepValue||(Xe(n,N),Xe(i,N)),!I.keepError&&Xe(r.errors,N),!I.keepDirty&&Xe(r.dirtyFields,N),!I.keepTouched&&Xe(r.touchedFields,N),!I.keepIsValidating&&Xe(r.validatingFields,N),!t.shouldUnregister&&!I.keepDefaultValue&&Xe(s,N);m.state.next({values:ze(i)}),m.state.next({...r,...I.keepDirty?{isDirty:F()}:{}}),!I.keepIsValid&&y()},Qe=({disabled:x,name:I})=>{if(Pt(x)&&o.mount||x||a.disabled.has(I)){const V=a.disabled.has(I)!==!!x;x?a.disabled.add(I):a.disabled.delete(I),V&&o.mount&&!o.action&&y()}},Be=(x,I={})=>{let N=Q(n,x);const $=Pt(I.disabled)||Pt(t.disabled),V=!a.registerName.has(x)&&N&&N._f&&!N._f.mount;return Ae(n,x,{...N||{},_f:{...N&&N._f?N._f:{ref:{name:x}},name:x,mount:!0,...I}}),a.mount.add(x),N&&!V?Qe({disabled:Pt(I.disabled)?I.disabled:t.disabled,name:x}):j(x,!0,I.value),{...$?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:as(I.min),max:as(I.max),minLength:as(I.minLength),maxLength:as(I.maxLength),pattern:as(I.pattern)}:{},name:x,onChange:te,onBlur:te,ref:W=>{if(W){a.registerName.add(x),Be(x,I),a.registerName.delete(x),N=Q(n,x);const z=$e(W.value)&&W.querySelectorAll&&W.querySelectorAll("input,select,textarea")[0]||W,ne=OO(z),ge=N._f.refs||[];if(ne?ge.find(Ue=>Ue===z):z===N._f.ref)return;Ae(n,x,{_f:{...N._f,...ne?{refs:[...ge.filter(Uo),z,...Array.isArray(Q(s,x))?[{}]:[]],ref:{type:z.type,name:x}}:{ref:z}}}),j(x,!1,void 0,z)}else N=Q(n,x,{}),N._f&&(N._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(Rh(a.array,x)&&o.action)&&a.unMount.add(x)}}},re=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&bs(n,U,a.mount),ke=x=>{Pt(x)&&(m.state.next({disabled:x}),bs(n,(I,N)=>{const $=Q(n,N);$&&(I.disabled=$._f.disabled||x,Array.isArray($._f.refs)&&$._f.refs.forEach(V=>{V.disabled=$._f.disabled||x}))},0,!1))},Le=(x,I)=>async N=>{let $;N&&(N.preventDefault&&N.preventDefault(),N.persist&&N.persist());let V=ze(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:W,values:z}=await T();v(),r.errors=W,V=ze(z)}else await R({fields:n,eventType:Ir.SUBMIT});if(a.disabled.size)for(const W of a.disabled)Xe(V,W);if(Xe(r.errors,Ph),nt(r.errors)){m.state.next({errors:{}});try{await x(V,N)}catch(W){$=W}}else I&&await I({...r.errors},N),re(),setTimeout(re);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nt(r.errors)&&!$,submitCount:r.submitCount+1,errors:r.errors}),$)throw $},Ye=(x,I={})=>{Q(n,x)&&($e(I.defaultValue)?q(x,ze(Q(s,x))):(q(x,I.defaultValue),Ae(s,x,ze(I.defaultValue))),I.keepTouched||Xe(r.touchedFields,x),I.keepDirty||(Xe(r.dirtyFields,x),r.isDirty=I.defaultValue?F(x,ze(Q(s,x))):F()),I.keepError||(Xe(r.errors,x),f.isValid&&y()),m.state.next({...r}))},ot=(x,I={})=>{const N=x?ze(x):s,$=ze(N),V=nt(x),W=$;if(I.keepDefaultValues||(s=N),!I.keepValues){if(I.keepDirtyValues){const z=new Set([...a.mount,...Object.keys(zr(s,i))]);for(const ne of Array.from(z)){const ge=Q(r.dirtyFields,ne),Ue=Q(i,ne),Ct=Q(W,ne);ge&&!$e(Ue)?Ae(W,ne,Ue):!ge&&!$e(Ct)&&q(ne,Ct)}}else{if(lo&&$e(x))for(const z of a.mount){const ne=Q(n,z);if(ne&&ne._f){const ge=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Fi(ge)){const Ue=ge.closest("form");if(Ue){Ue.reset();break}}}}if(I.keepFieldsRef)for(const z of a.mount)q(z,Q(W,z));else n={}}if(t.shouldUnregister){if(i=I.keepDefaultValues?ze(s):{},I.keepFieldsRef)for(const z of a.mount)Ae(i,z,Q(W,z))}else i=ze(W);m.array.next({values:{...W}}),m.state.next({values:{...W}})}a={mount:I.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!nt(W),o.watch=!!t.shouldUnregister,o.keepIsValid=!!I.keepIsValid,o.action=!1,I.keepErrors||(r.errors={}),m.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:V?!1:I.keepDirty?r.isDirty:I.keepValues?F():!!(I.keepDefaultValues&&!Mt(x,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:V?{}:I.keepDirtyValues?I.keepDefaultValues&&i?zr(s,i):r.dirtyFields:I.keepDefaultValues&&x?zr(s,x):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Lt=(x,I)=>ot(vt(x)?x(i):x,{...t.resetOptions,...I}),H=(x,I={})=>{const N=Q(n,x),$=N&&N._f;if($){const V=$.refs?$.refs[0]:$.ref;V.focus&&setTimeout(()=>{V.focus(),I.shouldSelect&&vt(V.select)&&V.select()})}},ue=x=>{r={...r,...x}},fr={control:{register:Be,unregister:Ge,getFieldState:le,handleSubmit:Le,setError:pe,_subscribe:We,_runSchema:T,_updateIsValidating:v,_focusError:re,_getWatch:X,_getDirty:F,_setValid:y,_setFieldArray:S,_setDisabledField:Qe,_setErrors:C,_getFieldArray:se,_reset:ot,_resetDefaultValues:()=>vt(t.defaultValues)&&t.defaultValues().then(x=>{Lt(x,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:P,_disableForm:ke,_subjects:m,_proxyFormState:f,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(x){o=x},get _defaultValues(){return s},get _names(){return a},set _names(x){a=x},get _formState(){return r},get _options(){return t},set _options(x){t={...t,...x}}},subscribe:xe,trigger:Z,register:Be,handleSubmit:Le,watch:oe,setValue:q,setValues:J,getValues:K,reset:Lt,resetField:Ye,resetDefaultValues:(x,I={})=>{if(s=ze(x),!I.keepDirty){const N=zr(s,i);r.dirtyFields=N,r.isDirty=!nt(N)}I.keepIsValid||y(),m.state.next({...r,defaultValues:s})},clearErrors:ee,unregister:Ge,setError:pe,setFocus:H,getFieldState:le};return{...fr,formControl:fr}}function $O(e={}){const t=p.useRef(void 0),r=p.useRef(void 0),n=p.useRef(e.formControl),[s,i]=p.useState(()=>({...ze(Hh),isLoading:vt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:vt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&n.current!==e.formControl)if(n.current=e.formControl,e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!vt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...c}=FO(e);t.current={...c,formState:s}}const o=t.current.control;return o._options=e,_l(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,a},[o]),p.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),p.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),p.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),p.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==s.isDirty&&o._subjects.state.next({isDirty:a})}},[o,s.isDirty]),p.useEffect(()=>{var a;e.values&&!Mt(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(()=>Lh(s,o),[o,s]),t.current}async function Lu(e){var r,n;return(n=(r=(await Ne.get(`/api/framework/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.framework}async function BO(e){var r,n;return((n=(r=(await Ne.post("/action/composite/v3/search",{request:{filters:{objectType:"Framework",status:["Live"],...e.type?{type:e.type}:{},...e.identifier?{identifier:e.identifier}:{},...e.channel?{channel:e.channel}:{},...e.systemDefault?{systemDefault:e.systemDefault}:{}}}})).data)==null?void 0:r.result)==null?void 0:n.Framework)??[]}function Wh(e,t){const r=$n({queryKey:["framework",e],queryFn:()=>Lu(e),enabled:!!e,staleTime:3e5}),n=t==null?void 0:t[0],s=$n({queryKey:["framework",n],queryFn:()=>Lu(n),enabled:!!n,staleTime:5*60*1e3}),i=s.data?[s.data]:[];return{organisationFramework:r.data,targetFrameworks:i,isLoading:r.isLoading||s.isLoading}}function UO(e,t,r){const n=e??[],s=new Set(n.map(u=>u.type).filter(Boolean)),i=(t??[]).filter(u=>!s.has(u)),{data:o}=$n({queryKey:["framework-search",i.sort().join(","),r],queryFn:()=>BO({type:i,systemDefault:"Yes"}),enabled:i.length>0,staleTime:10*60*1e3}),a=t&&t.length?n.filter(u=>u.type&&t.includes(u.type)):n,c=[...(o??[]).map(u=>({label:u.name,value:u.identifier})),...a.map(u=>({label:u.name,value:u.identifier}))],d=new Set;return c.filter(u=>d.has(u.value)?!1:(d.add(u.value),!0))}async function VO(e){var r,n;return(n=(r=(await Ne.get(`/api/channel/v1/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.channel}function qO(e){var r,n,s,i,o,a;const t=$n({queryKey:["channel",e],queryFn:()=>VO(e),enabled:!!e,staleTime:6e5});return{identifier:((r=t.data)==null?void 0:r.identifier)??e??"",name:(n=t.data)==null?void 0:n.name,frameworks:(s=t.data)==null?void 0:s.frameworks,collectionAdditionalCategories:(i=t.data)==null?void 0:i.collectionAdditionalCategories,contentAdditionalCategories:(o=t.data)==null?void 0:o.contentAdditionalCategories,defaultLicense:(a=t.data)==null?void 0:a.defaultLicense,isLoading:t.isLoading}}function zO(e){const{data:t}=$n({queryKey:["user","read",e],enabled:!!e,staleTime:1/0,queryFn:()=>S_(e)});return t&&([t.firstName,t.lastName].filter(Boolean).join(" ").trim()||t.userName)||void 0}const HO={"First Section":{title:"Basic Information",description:"Core details that define the content identity."},"Second Section":{title:"Categorisation",description:"Category and type classification for the content."},"Third Section":{title:"Categorisation",description:"Category and type classification for the content."},"Organisation Framework Terms":{title:"Curriculum",description:"Framework-aligned categorisation."},"Target Framework Terms":{title:"Target Audience",description:"Curriculum alignment for the intended learners."},"Fourth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."},"Sixth Section":{title:"Licensing & Attribution",description:"Copyright and usage rights information."}},WO=new Set(["review","read","sourcingreview","orgreview"]),ni={"First Section":"details","Second Section":"details","Third Section":"details","Organisation Framework Terms":"details","Target Framework Terms":"audience","Fourth Section":"licensing","Sixth Section":"licensing"},QO={Categorisation:"Second Section","Basic Information":"First Section","Licensing & Attribution":"Fourth Section",Curriculum:"Organisation Framework Terms","Target Audience":"Target Framework Terms"},KO={name:"details",description:"details",keywords:"details",appIcon:"details",primaryCategory:"details",additionalCategories:"details",board:"details",boardIds:"details",subject:"details",subjectIds:"details",medium:"details",framework:"details",topicsIds:"details",topic:"details",dialcodeRequired:"details",dialcodes:"details",audience:"audience",targetBoardIds:"audience",targetMediumIds:"audience",targetGradeLevelIds:"audience",targetSubjectIds:"audience",gradeLevel:"audience",creator:"licensing",author:"licensing",attributions:"licensing",license:"licensing",copyright:"licensing",copyrightYear:"licensing"},Cl={board:"board",boardIds:"board",medium:"medium",gradeLevel:"gradeLevel",subject:"subject",subjectIds:"subject",topicsIds:"topic",topic:"topic",targetBoardIds:"board",targetMediumIds:"medium",targetGradeLevelIds:"gradeLevel",targetSubjectIds:"subject"},Qh=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds"]);function Kh(e,t,r,n,s={}){if(!(e!=null&&e.length))return lD(t,n,r);const i=new Map;for(const a of e){const c=a.code;c&&!i.has(c)&&i.set(c,a)}const o=new Set;return e.filter(a=>{if(n&&(a.code==="dialCode"||a.code==="dialcode")||a.visible===!1)return!1;const c=a.code;return o.has(c)?!1:(o.add(c),!0)}).map(a=>{const c=a.code??"",d=tD(a),u=rD(a,r,t,i,s),f=t[c],g=YO(c,Gh(f,d),d,t,s),m={code:c,label:a.label??c,inputType:d,required:!!(a.required===!0||Array.isArray(a.validations)&&a.validations.some(_=>_.type==="required")),editable:GO(c,a.editable!==!1,s),placeholder:a.placeholder,maxLength:a.maxLength,options:JO(u,g,d,r),depends:a.depends,tab:eD(a),section:a.section,defaultValue:a.defaultValue??a.default,currentValue:g};if(c==="dialcodes"){const _=t.dialcodeRequired==="Yes";return{...m,required:_,visible:_}}return m})}function GO(e,t,r){var i;const n=r.editorMode??"edit";if(!WO.has(n))return t!==!1;const s=(i=r.editableFields)==null?void 0:i[n];return!!(s&&s.includes(e))}function YO(e,t,r,n,s){const i=t==null||t===""||Array.isArray(t)&&t.length===0;switch(e){case"license":return i?s.defaultLicense??"":t;case"copyright":return i&&s.channelName?s.channelName:t;case"copyrightYear":return i?String(new Date().getFullYear()):t;case"author":case"creator":return i&&s.userFullName?s.userFullName:t;case"instructions":{const o=n.instructions;return o&&typeof o=="object"&&!Array.isArray(o)?o.default??"":typeof t=="object"&&t!==null?"":t}case"maxTime":case"warningTime":{if(!i)return t;const o=n.timeLimits,a=o==null?void 0:o[e];return a!=null&&a!==""?XO(Number(a)):t}default:return t}}function XO(e){if(!Number.isFinite(e)||e<0)return"";const t=Math.floor(e%60),r=Math.floor(e/60%60),n=Math.floor(e/3600),s=i=>String(i).padStart(2,"0");return n>0?`${s(n)}:${s(r)}:${s(t)}`:`${s(r)}:${s(t)}`}function ZO(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 JO(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=ZO(n);for(const c of s){const d=String(c);o.has(d)||(i.push({label:a.get(d)??d,value:d}),o.add(d))}return i}function eD(e){const t=e.section;if(t){if(ni[t])return ni[t];const n=QO[t];if(n&&ni[n])return ni[n]}const r=e.code??"";return KO[r]??"details"}function Gh(e,t){const r=new Set(["multiselect","chips","keywords","tagsinput"]),n=new Set(["select","text","textarea","radio","datepicker","datetime","license"]);return r.has(t)?Array.isArray(e)?e:e!=null&&e!==""?[e]:[]:n.has(t)?Array.isArray(e)?e[0]??"":e??"":e}function tD(e){const t=(e.inputType??e.dataType??"").toLowerCase(),n=(e.dataType??"").toLowerCase()==="list";return t==="select"?"select":t==="framework"||t==="frameworkcategoryselect"?n?"multiselect":"select":t==="topicselector"?"chips":t==="multiselect"||t==="multi-select"?"multiselect":t==="keywords"||e.code==="keywords"||e.code==="topic"||e.code==="topicsIds"?"chips":t==="radio"?"radio":e.code==="appIcon"||t==="appicon"?"appIcon":t==="textarea"||e.code==="description"?"textarea":t==="datepicker"||t==="date"?"datepicker":t==="datetime"||t==="datetime-local"?"datetime":t==="tagsinput"?"tagsinput":t==="nestedselect"||t==="nested-select"?n?"multiselect":"select":t==="license"?"license":t==="dialcode"||t==="dial-code"?"dialcode":"text"}function rD(e,t,r,n,s){const i=e.code??"";if(i==="maxQuestions"){const d=s.childCount??0;if(d>0)return Array.from({length:d},(u,f)=>({label:String(f+1),value:String(f+1)}))}const o=e.range;if(Array.isArray(o)&&o.length)return typeof o[0]=="string"?o.map(d=>({label:d,value:d})):o.map(d=>({label:d.name,value:d.identifier}));const a=e.enum;if(a!=null&&a.length)return a.map(d=>({label:d,value:d}));if(i==="framework")return t.orgFrameworks;if(i==="additionalCategories"){const u=(s.objectType??"")==="QuestionSet"?s.contentAdditionalCategories??s.collectionAdditionalCategories:s.collectionAdditionalCategories??s.contentAdditionalCategories,f=(u&&u.length?u:s.contextAdditionalCategories)??t.channelAdditionalCategories;return f!=null&&f.length?oD(f).map(g=>({label:g,value:g})):void 0}const c=e.sourceCategory??Cl[i];if(c)return Yh(i,c,e,t,r,n)}function nD(e,t){return Qh.has(e)||t.output==="identifier"||typeof t.section=="string"&&t.section.includes("Target")}function sD(e,t){return Qh.has(e)||typeof t.section=="string"&&t.section.includes("Target")}function qo(e,t,r){var i,o,a,c,d;const n=(o=(i=e.organisationFramework)==null?void 0:i.categories)==null?void 0:o.find(u=>u.code===t),s=(d=(c=(a=e.targetFrameworks)==null?void 0:a[0])==null?void 0:c.categories)==null?void 0:d.find(u=>u.code===t);return r?(s==null?void 0:s.terms)??(n==null?void 0:n.terms)??[]:(n==null?void 0:n.terms)??(s==null?void 0:s.terms)??[]}function iD(e){const t=new Set,r=[];for(const n of e){const s=n.identifier??n.name;s&&!t.has(s)&&(t.add(s),r.push(n))}return r}function oD(e){return Array.from(new Set(e))}function aD(e){return Array.isArray(e)?e:e!=null&&e!==""?[e]:[]}function Yh(e,t,r,n,s,i){const o=nD(e,r),a=sD(e,r),c=h=>({label:h.name,value:o?h.identifier:h.name}),d=r.depends;if(!(d!=null&&d.length))return qo(n,t,a).map(c);const u=d.flatMap(h=>aD(s[h])).map(String);if(!u.length)return[];const f=[];for(const h of d){const y=i.get(h),v=(y==null?void 0:y.sourceCategory)??Cl[h]??h;f.push(...qo(n,v,a))}const m=f.filter(h=>u.includes(String(h.name))||u.includes(String(h.identifier))||u.includes(String(h.code))).flatMap(h=>h.associations??[]).filter(h=>String(h.category??"").toLowerCase()===t.toLowerCase()),_=iD(m);return _.length?_.map(c):qo(n,t,a).map(c)}function ls(e,t){const r=Cl[e];if(r)return Yh(e,r,{},t,{},new Map)}function lt(e,t,r){return Gh(e[t],r)}function lD(e,t,r){var s;const n=[{code:"name",label:"Title",inputType:"text",required:!0,editable:!0,tab:"details",section:"First Section",maxLength:200,currentValue:lt(e,"name","text")},{code:"description",label:"Description",inputType:"textarea",editable:!0,tab:"details",section:"First Section",maxLength:2e3,currentValue:lt(e,"description","textarea")},{code:"keywords",label:"Keywords",inputType:"chips",editable:!0,tab:"details",section:"First Section",currentValue:lt(e,"keywords","chips")}];return t&&(n.push({code:"primaryCategory",label:"Category",inputType:"select",editable:!1,tab:"details",section:"Second Section",currentValue:lt(e,"primaryCategory","select")},{code:"additionalCategories",label:"Additional Category",inputType:"multiselect",editable:!0,tab:"details",section:"Second Section",currentValue:lt(e,"additionalCategories","multiselect"),options:(s=r.channelAdditionalCategories)==null?void 0:s.map(i=>({label:i,value:i}))},{code:"framework",label:"Course Type",inputType:"select",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:r.orgFrameworks,currentValue:lt(e,"framework","select")},{code:"subjectIds",label:"Subjects covered",inputType:"multiselect",required:!0,editable:!0,tab:"details",section:"Organisation Framework Terms",options:ls("subjectIds",r),currentValue:lt(e,"subjectIds","multiselect")}),n.push({code:"audience",label:"Audience Type",inputType:"multiselect",editable:!0,tab:"audience",section:"Target Framework Terms",currentValue:lt(e,"audience","multiselect")},{code:"targetBoardIds",label:"Board/Syllabus of the audience",inputType:"select",required:!0,editable:!0,tab:"audience",section:"Target Framework Terms",options:ls("targetBoardIds",r),currentValue:lt(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:ls("targetMediumIds",r),currentValue:lt(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:ls("targetGradeLevelIds",r),currentValue:lt(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:ls("targetSubjectIds",r),currentValue:lt(e,"targetSubjectIds","multiselect")}),n.push({code:"creator",label:"Author",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"creator","text")},{code:"attributions",label:"Attributions",inputType:"text",editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"attributions","text")},{code:"copyright",label:"Copyright",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"copyright","text")},{code:"copyrightYear",label:"Copyright Year",inputType:"text",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"copyrightYear","text")},{code:"license",label:"License",inputType:"select",required:!0,editable:!0,tab:"licensing",section:"Fourth Section",currentValue:lt(e,"license","select")})),n}const cD=["allowECM","levels","setPeriod","instances"];function Xh(e){const t={};return e.forEach((r,n)=>{t[`L${n+1}`]={label:r}}),t}function uD(e,t={}){const r={...e};for(const i of cD)delete r[i];const n=e.levels;Array.isArray(n)&&n.length&&(r.outcomeDeclaration={levels:Xh(n)});const s=e.instances;return s!=null&&s!==""&&(r.instances={label:s}),t.isReview&&(r.name===void 0||r.name===null||r.name==="")&&t.nodeTitle&&(r.name=t.nodeTitle),r}function dD(e,t){return e==="allowECM"||e==="setPeriod"?null:e==="levels"?{outcomeDeclaration:{levels:Array.isArray(t)?Xh(t):{}}}:e==="instances"?{instances:t!=null&&t!==""?{label:t}:""}:{[e]:t}}function fD(e,t){const{watch:r,setValue:n}=e,s=p.useRef(!1);p.useEffect(()=>{const i=r((o,{name:a})=>{var c;if(!(!a||s.current)){s.current=!0;try{const d=new Set([a]);let u=!0;for(;u;){u=!1;for(const f of t)d.has(f.code)||(c=f.depends)!=null&&c.some(g=>d.has(g))&&(n(f.code,f.inputType==="multiselect"||f.inputType==="chips"?[]:"",{shouldDirty:!0}),d.add(f.code),u=!0)}}finally{s.current=!1}}});return()=>i.unsubscribe()},[r,n,t])}const hD="_section_ylgu8_1",pD="_header_ylgu8_11",gD="_title_ylgu8_17",mD="_description_ylgu8_24",yD="_divider_ylgu8_30",vD="_fields_ylgu8_36",Sn={section:hD,header:pD,title:gD,description:mD,divider:yD,fields:vD},bD=({title:e,description:t,children:r})=>l.jsxs("div",{className:Sn.section,children:[l.jsxs("div",{className:Sn.header,children:[l.jsx("h3",{className:Sn.title,children:e}),t&&l.jsx("p",{className:Sn.description,children:t})]}),l.jsx("hr",{className:Sn.divider}),l.jsx("div",{className:Sn.fields,children:r})]}),_D="_field_1s288_1",wD="_fullWidth_1s288_7",SD="_label_1s288_11",xD="_required_1s288_19",CD="_input_1s288_24",ED="_textarea_1s288_45",OD="_inputError_1s288_50",DD="_error_1s288_54",ID="_selectBtn_1s288_59",TD="_selectOpen_1s288_83",ND="_placeholder_1s288_87",jD="_selectedVal_1s288_91",kD="_chevronUp_1s288_95",RD="_dropdown_1s288_100",AD="_option_1s288_116",PD="_optionSelected_1s288_134",MD="_noOpts_1s288_139",LD="_chipGroup_1s288_146",FD="_chipInput_1s288_158",$D="_addChipBtn_1s288_167",BD="_radioGroup_1s288_184",UD="_radioLabel_1s288_191",VD="_iconWrap_1s288_199",qD="_iconPreview_1s288_214",zD="_iconPlaceholder_1s288_220",HD="_removeIconBtn_1s288_233",WD="_tagChip_1s288_252",QD="_tagChipRemove_1s288_264",KD="_nestedSelectRow_1s288_278",GD="_dialcodeRow_1s288_287",YD="_validateBtn_1s288_293",XD="_dialcodeValid_1s288_315",ZD="_dialcodeSpinner_1s288_325",M={field:_D,fullWidth:wD,label:SD,required:xD,input:CD,textarea:ED,inputError:OD,error:DD,selectBtn:ID,selectOpen:TD,placeholder:ND,selectedVal:jD,chevronUp:kD,dropdown:RD,option:AD,optionSelected:PD,noOpts:MD,chipGroup:LD,chipInput:FD,addChipBtn:$D,radioGroup:BD,radioLabel:UD,iconWrap:VD,iconPreview:qD,iconPlaceholder:zD,removeIconBtn:HD,tagChip:WD,tagChipRemove:QD,nestedSelectRow:KD,dialcodeRow:GD,validateBtn:YD,dialcodeValid:XD,dialcodeSpinner:ZD},Fu=({name:e,label:t,required:r,disabled:n,multiline:s,maxLength:i,placeholder:o})=>{const{register:a,formState:{errors:c}}=Jt(),d=c[e],u={required:r?`${t} is required`:!1,maxLength:i?{value:i,message:`Max ${i} characters`}:void 0};return l.jsxs("div",{className:[M.field,s?M.fullWidth:""].join(" "),children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),s?l.jsx("textarea",{id:e,className:[M.input,M.textarea,d?M.inputError:""].join(" "),disabled:n,placeholder:o,rows:3,...a(e,u)}):l.jsx("input",{id:e,type:"text",className:[M.input,d?M.inputError:""].join(" "),disabled:n,placeholder:o,...a(e,u)}),d&&l.jsx("span",{className:M.error,children:String(d.message)})]})},JD=({name:e,label:t,options:r,required:n,disabled:s})=>{var h;const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Jt(),g=d(e),m=((h=r.find(y=>y.value===g))==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:M.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[M.selectBtn,_?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g?M.selectedVal:M.placeholder,children:m}),l.jsx(Bs,{size:14,className:i?M.chevronUp:""})]}),i&&l.jsxs("div",{className:M.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[M.option,g===y.value?M.optionSelected:""].join(" "),onClick:()=>{u(e,y.value,{shouldDirty:!0,shouldValidate:!0}),o(!1)},children:[l.jsx("span",{children:y.label}),g===y.value&&l.jsx(Qn,{size:13})]},y.value)),!r.length&&l.jsx("span",{className:M.noOpts,children:"No options"})]}),_&&l.jsx("span",{className:M.error,children:String(_.message)})]})},eI=({name:e,label:t,options:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),a=p.useRef(null),{register:c,watch:d,setValue:u,formState:{errors:f}}=Jt(),g=d(e)??[],m=f[e],_=g.length?`${g.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=g.includes(y)?g.filter(b=>b!==y):[...g,y];u(e,v,{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:M.field,ref:a,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...c(e,{required:n?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:s,className:[M.selectBtn,m?M.inputError:"",i?M.selectOpen:""].join(" "),onClick:()=>o(y=>!y),children:[l.jsx("span",{className:g.length?M.selectedVal:M.placeholder,children:_}),l.jsx(Bs,{size:14,className:i?M.chevronUp:""})]}),i&&l.jsxs("div",{className:M.dropdown,children:[r.map(y=>l.jsxs("button",{type:"button",className:[M.option,g.includes(y.value)?M.optionSelected:""].join(" "),onClick:()=>h(y.value),children:[l.jsx(Qn,{size:13,style:{opacity:g.includes(y.value)?1:0}}),l.jsx("span",{children:y.label})]},y.value)),!r.length&&l.jsx("span",{className:M.noOpts,children:"No options"})]}),m&&l.jsx("span",{className:M.error,children:String(m.message)})]})},tI=({name:e,label:t,required:r,disabled:n,placeholder:s="Add…"})=>{const[i,o]=p.useState(""),[a,c]=p.useState(!1),d=p.useRef(null),{watch:u,setValue:f,formState:{errors:g}}=Jt(),m=u(e)??[],_=g[e],h=()=>{const v=i.trim();v&&!m.includes(v)&&f(e,[...m,v],{shouldDirty:!0}),o(""),c(!1)},y=v=>f(e,m.filter(b=>b!==v),{shouldDirty:!0});return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:M.chipGroup,children:[m.map(v=>l.jsxs("span",{className:"sbx-chip filled",children:[v,!n&&l.jsx("button",{type:"button",className:"sbx-chip-remove",onClick:()=>y(v),"aria-label":`Remove ${v}`,children:"×"})]},v)),!n&&(a?l.jsx("input",{ref:d,autoFocus:!0,className:M.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:M.addChipBtn,onClick:()=>{c(!0),setTimeout(()=>{var v;return(v=d.current)==null?void 0:v.focus()},50)},children:[l.jsx(Us,{size:12})," Add"]}))]}),_&&l.jsx("span",{className:M.error,children:String(_.message)})]})},rI=({name:e,label:t,options:r,required:n,disabled:s})=>{const{register:i,formState:{errors:o}}=Jt(),a=o[e];return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("div",{className:M.radioGroup,children:r.map(c=>l.jsxs("label",{className:M.radioLabel,children:[l.jsx("input",{type:"radio",value:c.value,disabled:s,...i(e,{required:n?`${t} is required`:!1})}),c.label]},c.value))}),a&&l.jsx("span",{className:M.error,children:String(a.message)})]})};async function nI(e,t,r,n){var o,a;const i=(a=(o=(await Ne.post("/action/asset/v1/create",{request:{asset:{primaryCategory:"asset",language:["English"],code:crypto.randomUUID(),name:e,mediaType:"image",mimeType:t,createdBy:r,creator:null,channel:n,keywords:""}}})).data)==null?void 0:o.result)==null?void 0:a.node_id;if(!i)throw new Error("Asset creation failed: no node_id returned");return i}async function sI(e,t){var s,i;const n=(i=(s=(await Ne.post(`/action/content/v3/upload/url/${e}`,{request:{content:{fileName:t}}})).data)==null?void 0:s.result)==null?void 0:i.pre_signed_url;if(!n)throw new Error("Pre-signed URL fetch failed");return n}async function iI(e,t,r={}){const n=await fetch(e,{method:"PUT",body:t,headers:{"x-ms-blob-type":"BlockBlob","Content-Type":"application/octet-stream",...r}});if(!n.ok)throw new Error(`Blob upload failed: ${n.status} ${n.statusText}`)}async function oI(e,t,r){var o,a;const n=new FormData;n.append("fileUrl",t),n.append("mimeType",r);const i=(a=(o=(await Ne.post(`/action/asset/v1/upload/${e}`,n,{params:{enctype:"multipart/form-data",processData:!1,contentType:!1,cache:!1}})).data)==null?void 0:o.result)==null?void 0:a.content_url;if(!i)throw new Error("Asset finalize failed: no content_url returned");return i}const aI="_overlay_ga6eh_1",lI="_modal_ga6eh_12",cI="_header_ga6eh_24",uI="_title_ga6eh_33",dI="_closeBtn_ga6eh_39",fI="_tabs_ga6eh_57",hI="_tab_ga6eh_57",pI="_activeTab_ga6eh_83",gI="_body_ga6eh_88",mI="_searchWrap_ga6eh_99",yI="_searchIcon_ga6eh_104",vI="_searchInput_ga6eh_113",bI="_grid_ga6eh_132",_I="_imgCell_ga6eh_148",wI="_imgCellSelected_ga6eh_166",SI="_thumb_ga6eh_171",xI="_noThumb_ga6eh_177",CI="_checkBadge_ga6eh_183",EI="_loadMoreBtn_ga6eh_198",OI="_loadingRow_ga6eh_220",DI="_empty_ga6eh_230",II="_spinner_ga6eh_237",TI="_uploadArea_ga6eh_247",NI="_dropZone_ga6eh_256",jI="_uploadIcon_ga6eh_277",kI="_dropText_ga6eh_281",RI="_dropSubtext_ga6eh_288",AI="_uploadPreview_ga6eh_294",PI="_hiddenInput_ga6eh_301",MI="_fileName_ga6eh_305",LI="_errorText_ga6eh_311",FI="_footer_ga6eh_318",$I="_cancelBtn_ga6eh_328",BI="_confirmBtn_ga6eh_345",he={overlay:aI,modal:lI,header:cI,title:uI,closeBtn:dI,tabs:fI,tab:hI,activeTab:pI,body:gI,searchWrap:mI,searchIcon:yI,searchInput:vI,grid:bI,imgCell:_I,imgCellSelected:wI,thumb:SI,noThumb:xI,checkBadge:CI,loadMoreBtn:EI,loadingRow:OI,empty:DI,spinner:II,uploadArea:TI,dropZone:NI,uploadIcon:jI,dropText:kI,dropSubtext:RI,uploadPreview:AI,hiddenInput:PI,fileName:MI,errorText:LI,footer:FI,cancelBtn:$I,confirmBtn:BI},$u=18,Zh=({nodeId:e,currentValue:t,onSelect:r,onClose:n})=>{const[s,i]=p.useState("my"),[o,a]=p.useState(""),[c,d]=p.useState([]),[u,f]=p.useState(0),[g,m]=p.useState(!1),[_,h]=p.useState(null),[y,v]=p.useState(0),[b,S]=p.useState(null),[w,C]=p.useState(""),[D,j]=p.useState(!1),[k,L]=p.useState(""),T=p.useRef(null),A=ae(U=>{var Z,K;return((K=(Z=U.editorConfig)==null?void 0:Z.context)==null?void 0:K.channel)??""}),B=ae(U=>{var Z,K;return((K=(Z=U.editorConfig)==null?void 0:Z.context)==null?void 0:K.uid)??""}),R=ae(U=>{var Z,K,le;return((le=(K=(Z=U.editorConfig)==null?void 0:Z.context)==null?void 0:K.cloudStorage)==null?void 0:le.presigned_headers)??{}}),P=ae(U=>{var Z,K,le;return((le=(K=(Z=U.editorConfig)==null?void 0:Z.config)==null?void 0:K.assetConfig)==null?void 0:le.size)??1*1024*1024}),F=ae(U=>{var Z,K,le;return((le=(K=(Z=U.editorConfig)==null?void 0:Z.config)==null?void 0:K.assetConfig)==null?void 0:le.accepted)??"image/png,image/jpeg"}),X=p.useCallback(async(U,Z,K=!1)=>{var le;m(!0);try{const ee={status:["Live"],mediaType:["image"],mimeType:["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml"]};s==="my"&&B&&(ee.createdBy=B),A&&(ee.channel=A);const oe=((le=(await Ne.post("/action/composite/v3/search",{request:{filters:ee,query:U,limit:$u,offset:Z,sort_by:{createdOn:"desc"},fields:["identifier","name","appIcon","artifactUrl","downloadUrl"]}},{headers:{"X-Source":"web"}})).data)==null?void 0:le.result)??{},We=oe.content??[];f(oe.count??0),d(xe=>K?[...xe,...We]:We)}catch{}finally{m(!1)}},[s,B,A]);p.useEffect(()=>{s!=="upload"&&(d([]),v(0),X(o,0))},[s]);const se=p.useRef(),De=U=>{a(U),clearTimeout(se.current),se.current=setTimeout(()=>{d([]),v(0),X(U,0)},400)},Se=()=>{const U=y+$u;v(U),X(o,U,!0)},ve=()=>{const U=(_==null?void 0:_.artifactUrl)??(_==null?void 0:_.appIcon)??(_==null?void 0:_.downloadUrl)??"";U&&r(U)};p.useEffect(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);const q=U=>{var le;const Z=(le=U.target.files)==null?void 0:le[0];if(U.target.value="",!Z)return;const K=F.split(",").map(ee=>ee.trim());if(!K.includes(Z.type)){const ee=K.map(pe=>pe.replace("image/","").toUpperCase()).join(", ");L(`Only ${ee} files are accepted.`);return}if(Z.size>P){const ee=(P/1048576).toFixed(0);L(`Image must be under ${ee} MB.`);return}w&&URL.revokeObjectURL(w),S(Z),C(URL.createObjectURL(Z)),L("")},J=async()=>{if(b){j(!0),L("");try{const U=await nI(b.name.split(".").slice(0,-1).join(".")||b.name,b.type,B,A),Z=await sI(U,b.name);await iI(Z,b,R);const K=Z.split("?")[0],le=await oI(U,K,b.type);r(le)}catch(U){L(U instanceof Error?U.message:"Upload failed.")}finally{j(!1)}}},te=c.length<u;return l.jsx("div",{className:he.overlay,role:"dialog","aria-modal":"true","aria-label":"Select App Icon",children:l.jsxs("div",{className:he.modal,children:[l.jsxs("div",{className:he.header,children:[l.jsx("span",{className:he.title,children:"Select App Icon"}),l.jsx("button",{className:he.closeBtn,onClick:n,"aria-label":"Close",children:l.jsx(dn,{size:18})})]}),l.jsxs("div",{className:he.tabs,role:"tablist",children:[l.jsx("button",{role:"tab","aria-selected":s==="my",className:`${he.tab} ${s==="my"?he.activeTab:""}`,onClick:()=>i("my"),children:"My Images"}),l.jsx("button",{role:"tab","aria-selected":s==="all",className:`${he.tab} ${s==="all"?he.activeTab:""}`,onClick:()=>i("all"),children:"All Images"}),l.jsxs("button",{role:"tab","aria-selected":s==="upload",className:`${he.tab} ${s==="upload"?he.activeTab:""}`,onClick:()=>i("upload"),children:[l.jsx(Jl,{size:13,style:{marginRight:4}}),"Upload"]})]}),l.jsx("div",{className:he.body,children:s!=="upload"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:he.searchWrap,children:[l.jsx(ha,{size:14,className:he.searchIcon}),l.jsx("input",{type:"search",className:he.searchInput,placeholder:"Search images…",value:o,onChange:U=>De(U.target.value)})]}),g&&c.length===0?l.jsxs("div",{className:he.loadingRow,children:[l.jsx(di,{size:20,className:he.spinner}),l.jsx("span",{children:"Loading…"})]}):c.length===0?l.jsx("div",{className:he.empty,children:"No images found"}):l.jsx("div",{className:he.grid,children:c.map(U=>{const Z=U.appIcon??U.artifactUrl??U.downloadUrl??"",K=(_==null?void 0:_.identifier)===U.identifier;return l.jsxs("button",{type:"button",className:`${he.imgCell} ${K?he.imgCellSelected:""}`,onClick:()=>h(U),title:U.name,children:[Z?l.jsx("img",{src:Z,alt:U.name,className:he.thumb}):l.jsx("div",{className:he.noThumb,children:"IMG"}),K&&l.jsx("div",{className:he.checkBadge,children:l.jsx(Qn,{size:12})})]},U.identifier)})}),te&&!g&&l.jsx("button",{className:he.loadMoreBtn,onClick:Se,children:"Load More"}),g&&c.length>0&&l.jsx("div",{className:he.loadingRow,children:l.jsx(di,{size:16,className:he.spinner})})]}):l.jsxs("div",{className:he.uploadArea,children:[l.jsx("div",{className:he.dropZone,onClick:()=>{var U;return(U=T.current)==null?void 0:U.click()},onDragOver:U=>U.preventDefault(),onDrop:U=>{U.preventDefault();const Z=U.dataTransfer.files[0];Z&&q({target:{files:[Z],value:""}})},children:w?l.jsx("img",{src:w,alt:"Preview",className:he.uploadPreview}):l.jsxs(l.Fragment,{children:[l.jsx(Jl,{size:32,className:he.uploadIcon}),l.jsx("p",{className:he.dropText,children:"Drag & drop or click to browse"}),l.jsxs("p",{className:he.dropSubtext,children:[F.split(",").map(U=>U.replace("image/","").toUpperCase()).join(", ")," · max ",(P/(1024*1024)).toFixed(0)," MB"]})]})}),l.jsx("input",{ref:T,type:"file",accept:F,className:he.hiddenInput,onChange:q}),b&&l.jsx("p",{className:he.fileName,children:b.name}),k&&l.jsx("p",{className:he.errorText,children:k})]})}),l.jsxs("div",{className:he.footer,children:[l.jsx("button",{className:he.cancelBtn,onClick:n,children:"Cancel"}),s==="upload"?l.jsx("button",{className:he.confirmBtn,disabled:!b||D,onClick:J,children:D?l.jsxs(l.Fragment,{children:[l.jsx(di,{size:14,className:he.spinner})," Uploading…"]}):"Upload & Use"}):l.jsx("button",{className:he.confirmBtn,disabled:!_,onClick:ve,children:"Use Selected"})]})]})})},UI=({name:e,label:t,nodeId:r,required:n,disabled:s})=>{const[i,o]=p.useState(!1),{watch:a,setValue:c,register:d,formState:{errors:u}}=Jt(),f=a(e),g=u[e],m=h=>{c(e,h,{shouldDirty:!0,shouldValidate:!0}),o(!1)},_=()=>{c(e,"",{shouldDirty:!0,shouldValidate:!0})};return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...d(e,{required:n?`${t} is required`:!1})}),l.jsx("div",{className:M.iconWrap,role:"button",tabIndex:s?-1:0,"aria-label":"Select app icon",onClick:()=>!s&&o(!0),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&!s&&o(!0)},children:f?l.jsx("img",{src:f,alt:"App icon",className:M.iconPreview}):l.jsxs("div",{className:M.iconPlaceholder,children:[l.jsx(rf,{size:20}),l.jsx("span",{children:"Select icon"})]})}),f&&!s&&l.jsxs("button",{type:"button",className:M.removeIconBtn,onClick:_,"aria-label":"Remove app icon",children:[l.jsx(Za,{size:13}),l.jsx("span",{children:"Remove"})]}),g&&l.jsx("span",{className:M.error,children:String(g.message)}),i&&l.jsx(Zh,{nodeId:r,currentValue:f,onSelect:m,onClose:()=>o(!1)})]})},VI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Jt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1}});return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{id:e,type:"datetime-local",className:[M.input,o?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,ref:i.ref}),o&&l.jsx("span",{className:M.error,children:String(o.message)})]})},qI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Jt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:[]}),[a,c]=p.useState(""),d=p.useRef(null),u=i.value??[],f=h=>{const y=h.trim();!y||u.includes(y)||i.onChange([...u,y])},g=h=>{i.onChange(u.filter(y=>y!==h))},m=h=>{h.key==="Enter"||h.key===","?(h.preventDefault(),f(a),c("")):h.key==="Backspace"&&a===""&&u.length>0&&g(u[u.length-1])},_=()=>{a.trim()&&(f(a),c("")),i.onBlur()};return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:[M.chipGroup,o?M.inputError:""].join(" "),onClick:()=>{var h;return!n&&((h=d.current)==null?void 0:h.focus())},style:{cursor:n?"not-allowed":"text"},children:[u.map(h=>l.jsxs("span",{className:M.tagChip,children:[h,!n&&l.jsx("button",{type:"button",className:M.tagChipRemove,onClick:y=>{y.stopPropagation(),g(h)},"aria-label":`Remove ${h}`,children:l.jsx(dn,{size:11})})]},h)),!n&&l.jsx("input",{ref:d,className:M.chipInput,value:a,onChange:h=>c(h.target.value),onKeyDown:m,onBlur:_,placeholder:u.length===0?"Type and press Enter or comma…":"",style:{flexGrow:1,minWidth:120}})]}),o&&l.jsx("span",{className:M.error,children:String(o.message)})]})},zI=({name:e,label:t,levels:r,required:n,disabled:s})=>{const{control:i}=Jt(),{field:o,fieldState:{error:a}}=uo({name:e,control:i,rules:{required:n?`${t} is required`:!1},defaultValue:{}}),c=o.value??{},d=(u,f,g)=>{const m={};for(let _=0;_<f;_++)m[r[_].code]=c[r[_].code]??"";m[u]=g;for(let _=f+1;_<r.length;_++)m[r[_].code]="";o.onChange(m)};return l.jsxs("div",{className:[M.field,M.fullWidth].join(" "),children:[l.jsxs("label",{className:M.label,children:[t,n&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("div",{className:M.nestedSelectRow,children:r.map((u,f)=>{const g=f>0&&!c[r[f-1].code];return l.jsxs("div",{className:M.field,style:{flex:1},children:[l.jsx("label",{className:M.label,htmlFor:`${e}_${u.code}`,children:u.label}),l.jsxs("select",{id:`${e}_${u.code}`,className:[M.input,a?M.inputError:""].join(" "),disabled:s||g,value:c[u.code]??"",onChange:m=>d(u.code,f,m.target.value),onBlur:o.onBlur,children:[l.jsx("option",{value:"",children:"Select…"}),u.options.map(m=>l.jsx("option",{value:m.value,children:m.label},m.value))]})]},u.code)})}),a&&l.jsx("span",{className:M.error,children:String(a.message)})]})},Bu=[{label:"CC BY 4.0",value:"CC BY 4.0"},{label:"CC BY-SA 4.0",value:"CC BY-SA 4.0"},{label:"CC BY-NC 4.0",value:"CC BY-NC 4.0"},{label:"CC BY-NC-SA 4.0",value:"CC BY-NC-SA 4.0"},{label:"CC BY-ND 4.0",value:"CC BY-ND 4.0"},{label:"CC0 1.0 (Public Domain)",value:"CC0 1.0"}],HI=({name:e,label:t,required:r,disabled:n})=>{const[s,i]=p.useState(!1),o=p.useRef(null),{register:a,watch:c,setValue:d,formState:{errors:u}}=Jt(),f=c(e),g=Bu.find(h=>h.value===f),m=(g==null?void 0:g.label)??"Select license…",_=u[e];return p.useEffect(()=>{if(!s)return;const h=y=>{var v;(v=o.current)!=null&&v.contains(y.target)||i(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),l.jsxs("div",{className:M.field,ref:o,style:{position:"relative"},children:[l.jsxs("label",{className:M.label,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsx("input",{type:"hidden",...a(e,{required:r?`${t} is required`:!1})}),l.jsxs("button",{type:"button",disabled:n,className:[M.selectBtn,_?M.inputError:"",s?M.selectOpen:""].join(" "),onClick:()=>i(h=>!h),"aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:f?M.selectedVal:M.placeholder,children:m}),l.jsx(Bs,{size:14,className:s?M.chevronUp:""})]}),s&&l.jsx("div",{className:M.dropdown,role:"listbox",children:Bu.map(h=>l.jsxs("button",{type:"button",role:"option","aria-selected":f===h.value,className:[M.option,f===h.value?M.optionSelected:""].join(" "),onClick:()=>{d(e,h.value,{shouldDirty:!0,shouldValidate:!0}),i(!1)},children:[l.jsx("span",{children:h.label}),f===h.value&&l.jsx(Qn,{size:13})]},h.value))}),_&&l.jsx("span",{className:M.error,children:String(_.message)})]})},WI=({name:e,label:t,required:r,disabled:n})=>{const{control:s}=Jt(),{field:i,fieldState:{error:o}}=uo({name:e,control:s,rules:{required:r?`${t} is required`:!1},defaultValue:""}),[a,c]=p.useState("idle"),[d,u]=p.useState(""),f=async()=>{const m=(i.value??"").trim();if(!m){c("invalid"),u("Enter a dial code to validate.");return}c("loading"),u("");try{const _=await iw(m),h=_==null?void 0:_.result,y=h==null?void 0:h.dialcodes;Array.isArray(y)&&y.length>0?(c("valid"),u("Dial code is valid.")):(c("invalid"),u("Dial code not found."))}catch{c("invalid"),u("Validation failed. Please try again.")}},g=()=>a==="loading"?l.jsx(di,{size:16,className:M.dialcodeSpinner}):a==="valid"?l.jsx(Zd,{size:16,color:"var(--sbx-success, #2e7d32)"}):a==="invalid"?l.jsx(Ey,{size:16,color:"var(--sbx-error)"}):null;return l.jsxs("div",{className:M.field,children:[l.jsxs("label",{className:M.label,htmlFor:e,children:[t,r&&l.jsx("span",{className:M.required,children:"*"})]}),l.jsxs("div",{className:M.dialcodeRow,children:[l.jsx("input",{id:e,type:"text",className:[M.input,o?M.inputError:""].join(" "),disabled:n,value:i.value??"",onChange:m=>{i.onChange(m),c("idle"),u("")},onBlur:i.onBlur,ref:i.ref,placeholder:"e.g. A1B2C3",style:{flex:1}}),l.jsx("button",{type:"button",className:M.validateBtn,onClick:f,disabled:n||a==="loading","aria-label":"Validate dial code",children:a==="loading"?"Validating…":"Validate"}),g()]}),o&&l.jsx("span",{className:M.error,children:String(o.message)}),!o&&d&&l.jsx("span",{className:a==="valid"?M.dialcodeValid:M.error,children:d})]})},QI="_form_szqex_1",KI="_ungrouped_szqex_7",GI="_noFields_szqex_18",zo={form:QI,ungrouped:KI,noFields:GI},YI=({nodeMetadata:e,activeTab:t,isRoot:r,isFolder:n,editorMode:s,onFormValueChange:i,onFormStatusChange:o})=>{var Ge,Qe,Be,re,ke,Le,Ye,ot,Lt;const a=ae(H=>H.editorConfig),c=ae(H=>H.rootFormConfig),d=ae(H=>H.unitFormConfig),u=ae(H=>H.categoryMeta),f=ae(H=>H.contentFramework),g=ae(H=>H.contentTargetFWIds),{organisationFramework:m,targetFrameworks:_,isLoading:h}=Wh(f??((Ge=a==null?void 0:a.context)==null?void 0:Ge.framework),g??((Qe=a==null?void 0:a.context)==null?void 0:Qe.targetFWIds)),{frameworks:y,collectionAdditionalCategories:v,contentAdditionalCategories:b,defaultLicense:S,name:w}=qO((Be=a==null?void 0:a.context)==null?void 0:Be.channel),C=zO(((re=a==null?void 0:a.context)==null?void 0:re.userId)??((ke=a==null?void 0:a.context)==null?void 0:ke.uid)),D=UO(y,(Le=u==null?void 0:u.frameworkMetadata)==null?void 0:Le.orgFWType,(Ye=a==null?void 0:a.context)==null?void 0:Ye.channel),j={organisationFramework:m,targetFrameworks:_,orgFrameworks:D,channelAdditionalCategories:v},k=Oe(H=>H.selectedNodeId),L=Oe(H=>H.treeData),T=Oe(H=>H.treeCache),A=k?T[k]??{}:{},B={...e,...A},R=p.useMemo(()=>{var ue;if(!k)return 0;const H=[...L];for(;H.length;){const me=H.shift();if(me.id===k)return((ue=me.children)==null?void 0:ue.length)??0;me.children&&H.push(...me.children)}return 0},[L,k]),P=(a==null?void 0:a.config)??{},F=(a==null?void 0:a.context)??{},X={editorMode:s,editableFields:P.editableFields,objectType:P.objectType,setDefaultCopyRight:P.setDefaultCopyRight===!0,defaultLicense:F.defaultLicense??S,contextAdditionalCategories:F.additionalCategories,userFullName:((ot=F.user)==null?void 0:ot.fullName)??C,channelName:w,collectionAdditionalCategories:v,contentAdditionalCategories:b,childCount:R},se=r?c:d,De=se||(((Lt=a==null?void 0:a.config.hierarchy)==null?void 0:Lt.formConfig)??[]),Se=Kh(De,B,j,r,X),ve=Se.filter(H=>H.tab===t&&H.inputType!=="appIcon"&&H.visible!==!1),q=$O({mode:"onChange",defaultValues:Object.fromEntries(Se.map(H=>{const ue=["multiselect","chips","keywords","tagsinput"],me=["nestedselect"];return ue.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??[]]:me.includes(H.inputType)?[H.code,H.currentValue??H.defaultValue??{}]:[H.code,H.currentValue??H.defaultValue??""]}))});fD(q,Se);const{updateNode:J}=Oe(),te=p.useRef(Se);te.current=Se;const U=p.useRef(k);U.current=k;const Z=p.useRef(i);Z.current=i;const K=p.useRef(o);K.current=o;const le=p.useRef(typeof B.shuffle=="boolean"?B.shuffle:void 0),ee=p.useRef(B.name??"");ee.current=B.name??"";const pe=p.useRef(s);pe.current=s;const oe=["review","read","sourcingreview","orgreview"];p.useEffect(()=>{const H=U.current;if(H){const ue=Object.fromEntries(te.current.filter(me=>me.currentValue!==void 0&&me.currentValue!==null).map(me=>[me.code,me.currentValue]));Object.keys(ue).length>0&&J(H,ue)}q.trigger().then(()=>{const ue=q.formState.errors,me=te.current,er=Array.from(new Set(Object.keys(ue).map(fr=>{var x;return(x=me.find(I=>I.code===fr))==null?void 0:x.tab}).filter(Boolean)));K.current(Object.keys(ue).length===0,er)})},[]),p.useEffect(()=>{const H=q.watch((ue,{name:me})=>{const er=U.current;if(!er)return;const fr=te.current,x=new Set(fr.map($=>$.code));if(me&&x.has(me)){let $=q.getValues(me);me==="dialcodes"&&($=Array.isArray($)?$:$?[$]:[]),me==="shuffle"&&($===!0&&le.current===!1&&Ce("Shuffling is enabled for this question set.",{icon:"ℹ️"}),le.current=$);const V=dD(me,$);V&&(J(er,V),Z.current(V))}else if(!me){const $=q.getValues(),V=Object.fromEntries(Object.entries($).filter(([z])=>x.has(z))),W=uD(V,{isReview:oe.includes(pe.current),nodeTitle:ee.current});Object.keys(W).length>0&&(J(er,W),Z.current(W))}const I=q.formState.errors,N=Array.from(new Set(Object.keys(I).map($=>{var V;return(V=fr.find(W=>W.code===$))==null?void 0:V.tab}).filter(Boolean)));K.current(Object.keys(I).length===0,N)});return()=>H.unsubscribe()},[q]),p.useEffect(()=>{for(const H of["author","creator","copyright","copyrightYear","license"]){const ue=te.current.find(er=>er.code===H);if(!ue||ue.currentValue===void 0||ue.currentValue===null||ue.currentValue==="")continue;const me=q.getValues(H);(me==null||me==="")&&q.setValue(H,ue.currentValue,{shouldDirty:!1})}},[C,w,q]);const We=ve.reduce((H,ue)=>{const me=H[H.length-1];return me&&me.section===ue.section?me.fields.push(ue):H.push({section:ue.section,fields:[ue]}),H},[]),xe=H=>{const ue={key:H.code,name:H.code,label:H.label,required:H.required,disabled:H.editable===!1};switch(H.inputType){case"textarea":return l.jsx(Fu,{...ue,multiline:!0,maxLength:H.maxLength});case"select":return l.jsx(JD,{...ue,options:H.options??[]});case"multiselect":return l.jsx(eI,{...ue,options:H.options??[]});case"chips":return l.jsx(tI,{...ue});case"radio":return l.jsx(rI,{...ue,options:H.options??[]});case"appIcon":return l.jsx(UI,{...ue,nodeId:k??""});case"datepicker":case"datetime":return l.jsx(VI,{...ue});case"keywords":case"tagsinput":return l.jsx(qI,{...ue});case"nestedselect":return l.jsx(zI,{...ue,levels:H.levels??[]});case"license":return l.jsx(HI,{...ue});case"dialcode":return l.jsx(WI,{...ue});default:return l.jsx(Fu,{...ue,maxLength:H.maxLength})}};return l.jsx(CO,{...q,children:l.jsxs("div",{className:zo.form,children:[We.map((H,ue)=>{const me=H.section?HO[H.section]:void 0;return me?l.jsx(bD,{title:me.title,description:me.description,children:H.fields.map(xe)},H.section??ue):l.jsx("div",{className:zo.ungrouped,children:H.fields.map(xe)},ue)}),ve.length===0&&!h&&l.jsx("p",{className:zo.noFields,children:"No fields configured for this tab."})]})})};function Jh(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function XI(e,t){return e.reduce((r,n,s)=>{const i=t.get(n);return i&&(r[s]=i),r},Array(e.length))}function si(e){return e!==null&&e>=0}function ZI(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 JI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ep=e=>{let{rects:t,activeIndex:r,overIndex:n,index:s}=e;const i=Jh(t,n,r),o=t[s],a=i[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},ii={scaleX:1,scaleY:1},eT=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:s,rects:i,overIndex:o}=e;const a=(t=i[r])!=null?t:n;if(!a)return null;if(s===r){const d=i[o];return d?{x:0,y:r<o?d.top+d.height-(a.top+a.height):d.top-a.top,...ii}:null}const c=tT(i,s,r);return s>r&&s<=o?{x:0,y:-a.height-c,...ii}:s<r&&s>=o?{x:0,y:a.height+c,...ii}:{x:0,y:0,...ii}};function tT(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 tp="Sortable",rp=p.createContext({activeIndex:-1,containerId:tp,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ep,disabled:{draggable:!1,droppable:!1}});function rT(e){let{children:t,id:r,items:n,strategy:s=ep,disabled:i=!1}=e;const{active:o,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:u}=Gd(),f=Fs(tp,r),g=a.rect!==null,m=p.useMemo(()=>n.map(D=>typeof D=="object"&&"id"in D?D.id:D),[n]),_=o!=null,h=o?m.indexOf(o.id):-1,y=d?m.indexOf(d.id):-1,v=p.useRef(m),b=!ZI(m,v.current),S=y!==-1&&h===-1||b,w=JI(i);Yt(()=>{b&&_&&u(m)},[b,m,_,u]),p.useEffect(()=>{v.current=m},[m]);const C=p.useMemo(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:S,items:m,overIndex:y,useDragOverlay:g,sortedRects:XI(m,c),strategy:s}),[h,f,w.draggable,w.droppable,S,m,y,c,g,s]);return p.createElement(rp.Provider,{value:C},t)}const nT=e=>{let{id:t,items:r,activeIndex:n,overIndex:s}=e;return Jh(r,n,s).indexOf(t)},sT=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:s,items:i,newIndex:o,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!n||a!==i&&s===o?!1:r?!0:o!==s&&t===c},iT={duration:200,easing:"ease"},np="transform",oT=$r.Transition.toString({property:np,duration:0,easing:"linear"}),aT={roleDescription:"sortable"};function lT(e){let{disabled:t,index:r,node:n,rect:s}=e;const[i,o]=p.useState(null),a=p.useRef(r);return Yt(()=>{if(!t&&r!==a.current&&n.current){const c=s.current;if(c){const d=Wn(n.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}r!==a.current&&(a.current=r)},[t,r,n,s]),p.useEffect(()=>{i&&o(null)},[i]),i}function cT(e){let{animateLayoutChanges:t=sT,attributes:r,disabled:n,data:s,getNewIndex:i=nT,id:o,strategy:a,resizeObserverConfig:c,transition:d=iT}=e;const{items:u,containerId:f,activeIndex:g,disabled:m,disableTransforms:_,sortedRects:h,overIndex:y,useDragOverlay:v,strategy:b}=p.useContext(rp),S=uT(n,m),w=u.indexOf(o),C=p.useMemo(()=>({sortable:{containerId:f,index:w,items:u},...s}),[f,s,w,u]),D=p.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:j,node:k,isOver:L,setNodeRef:T}=sy({id:o,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...c}}),{active:A,activatorEvent:B,activeNodeRect:R,attributes:P,setNodeRef:F,listeners:X,isDragging:se,over:De,setActivatorNodeRef:Se,transform:ve}=Kd({id:o,data:C,attributes:{...aT,...r},disabled:S.draggable}),q=qg(T,F),J=!!A,te=J&&!_&&si(g)&&si(y),U=!v&&se,Z=U&&te?ve:null,le=te?Z??(a??b)({rects:h,activeNodeRect:R,activeIndex:g,overIndex:y,index:w}):null,ee=si(g)&&si(y)?i({id:o,items:u,activeIndex:g,overIndex:y}):w,pe=A==null?void 0:A.id,oe=p.useRef({activeId:pe,items:u,newIndex:ee,containerId:f}),We=u!==oe.current.items,xe=t({active:A,containerId:f,isDragging:se,isSorting:J,id:o,index:w,items:u,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:d,wasDragging:oe.current.activeId!=null}),Ge=lT({disabled:!xe,index:w,node:k,rect:j});return p.useEffect(()=>{J&&oe.current.newIndex!==ee&&(oe.current.newIndex=ee),f!==oe.current.containerId&&(oe.current.containerId=f),u!==oe.current.items&&(oe.current.items=u)},[J,ee,f,u]),p.useEffect(()=>{if(pe===oe.current.activeId)return;if(pe&&!oe.current.activeId){oe.current.activeId=pe;return}const Be=setTimeout(()=>{oe.current.activeId=pe},50);return()=>clearTimeout(Be)},[pe]),{active:A,activeIndex:g,attributes:P,data:C,rect:j,index:w,newIndex:ee,items:u,isOver:L,isSorting:J,isDragging:se,listeners:X,node:k,overIndex:y,over:De,setNodeRef:q,setActivatorNodeRef:Se,setDroppableNodeRef:T,setDraggableNodeRef:F,transform:Ge??le,transition:Qe()};function Qe(){if(Ge||We&&oe.current.newIndex===w)return oT;if(!(U&&!Qi(B)||!d)&&(J||xe))return $r.Transition.toString({...d,property:np})}}function uT(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function Bi(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const dT=[we.Down,we.Right,we.Up,we.Left],fT=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:a}}=t;if(dT.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const g=s.get(f.id);if(g)switch(e.code){case we.Down:n.top<g.top&&c.push(f);break;case we.Up:n.top>g.top&&c.push(f);break;case we.Left:n.left>g.left&&c.push(f);break;case we.Right:n.left<g.left&&c.push(f);break}});const d=om({collisionRect:n,droppableRects:s,droppableContainers:c});let u=jd(d,"id");if(u===(o==null?void 0:o.id)&&d.length>1&&(u=d[1].id),u!=null){const f=i.get(r.id),g=i.get(u),m=g?s.get(g.id):null,_=g==null?void 0:g.node.current;if(_&&m&&f&&g){const y=Ki(_).some((D,j)=>a[j]!==D),v=sp(f,g),b=hT(f,g),S=y||!v?{x:0,y:0}:{x:b?n.width-m.width:0,y:b?n.height-m.height:0},w={x:m.left,y:m.top};return S.x&&S.y?w:Cs(w,S)}}}};function sp(e,t){return!Bi(e)||!Bi(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function hT(e,t){return!Bi(e)||!Bi(t)||!sp(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const pT="_row_11nth_1",gT="_removeBtn_11nth_14",mT="_grip_11nth_17",yT="_ctIcon_11nth_34",vT="_info_11nth_38",bT="_name_11nth_46",_T="_meta_11nth_55",Vr={row:pT,removeBtn:gT,grip:mT,ctIcon:yT,info:vT,name:bT,meta:_T},wT={video:Ja,pdf:Ka,h5p:Ga,scorm:Xa,audio:Ya,quiz:Qa,default:Kn},ST=({item:e,onRemove:t,isEditable:r})=>{const n=ao(e),s=wT[n.key]??Kn,{attributes:i,listeners:o,setNodeRef:a,transform:c,transition:d,isDragging:u}=cT({id:e.id,disabled:!r}),f={transform:$r.Transform.toString(c),transition:d,opacity:u?.5:1};return l.jsxs("div",{ref:a,style:f,className:Vr.row,role:"listitem",children:[r&&l.jsx("span",{className:Vr.grip,...i,...o,"aria-label":"Drag to reorder",children:l.jsx(tf,{size:15})}),l.jsx("span",{className:[`sbx-ct-sq--${n.key}`,Vr.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(s,{size:14})}),l.jsxs("div",{className:Vr.info,children:[l.jsx("span",{className:Vr.name,title:e.name,children:e.name}),l.jsx("span",{className:Vr.meta,children:n.label})]}),l.jsx("span",{className:`sbx-ct-badge--${n.key}`,children:n.label}),r&&l.jsx("button",{type:"button",className:Vr.removeBtn,onClick:()=>t(e.id),"aria-label":`Remove ${e.name}`,children:l.jsx(dn,{size:14})})]})},xT="_container_lzvke_1",CT="_header_lzvke_7",ET="_heading_lzvke_13",OT="_count_lzvke_21",DT="_list_lzvke_30",IT="_emptyState_lzvke_36",TT="_addRow_lzvke_52",qr={container:xT,header:CT,heading:ET,count:OT,list:DT,emptyState:IT,addRow:TT},NT=({editorMode:e})=>{const{selectedNodeId:t,getChildrenOf:r,reorderChildren:n,deleteNode:s}=Oe(),i=t?r(t):[],o=e==="edit",a=Id(ca(Gi,{activationConstraint:{distance:5}}),ca(za,{coordinateGetter:fT})),c=p.useCallback(u=>{const{active:f,over:g}=u;if(!g||f.id===g.id||!t)return;const m=Oe.getState().getChildrenOf(t),_=m.findIndex(y=>y.id===f.id),h=m.findIndex(y=>y.id===g.id);_<0||h<0||n(t,_,h)},[t,n]),d=p.useCallback(u=>{window.confirm("Remove this content from the unit?")&&s(u)},[s]);return t?l.jsxs("div",{className:qr.container,children:[l.jsxs("div",{className:qr.header,children:[l.jsx("span",{className:qr.heading,children:"Content in this unit"}),l.jsx("span",{className:qr.count,children:i.length})]}),i.length>0?l.jsx(Qd,{sensors:a,collisionDetection:im,onDragEnd:c,children:l.jsx(rT,{items:i.map(u=>u.id),strategy:eT,children:l.jsx("div",{className:qr.list,role:"list",children:i.map(u=>l.jsx(ST,{item:u,onRemove:d,isEditable:o},u.id))})})}):l.jsxs("div",{className:qr.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:qr.addRow,type:"button","aria-label":"Add content to unit",children:[l.jsx(Us,{size:14})," Add content"]})]}):null},jT="_dropZone_ijo5w_1",kT="_active_ijo5w_14",Uu={dropZone:jT,active:kT},RT=({isActive:e,label:t="Drop here",nodeId:r,className:n})=>l.jsx("div",{className:`${Uu.dropZone} ${e?Uu.active:""} ${n??""}`,"data-droppable":e?"true":void 0,"data-node-id":r,"aria-label":t,role:"region",children:l.jsx("span",{children:t})});async function AT(e){var o;const t={status:["Live"],...e.filters??{}};e.channel&&(t.channel=e.channel);const n=((o=(await Ne.post("/action/composite/v3/search",{request:{filters:t,query:e.query??"",limit:e.limit??20,offset:e.offset??0,sort_by:e.sortBy??{lastUpdatedOn:"desc"},fields:e.fields??["identifier","name","mimeType","contentType","primaryCategory","appIcon","channel","organisation","pkgVersion"]}},{headers:{"X-Source":"web","X-msgid":Math.random().toString(36).slice(2)}})).data)==null?void 0:o.result)??{},s=new Set(["count","facets"]);return{content:Object.entries(n).filter(([a])=>!s.has(a)).flatMap(([,a])=>Array.isArray(a)?a:[]),count:n.count??0}}async function PT(e){var r,n;return(n=(r=(await Ne.get(`/action/content/v3/read/${e}`)).data)==null?void 0:r.result)==null?void 0:n.content}const Vu="application/vnd.sunbird.question";function qu(e){return{cardinality:"single",type:"integer",defaultValue:e.maxScore??1}}function ip(e,t,r){if(!e)return null;if(e.identifier===t)return{question:e,parent:r};for(const n of e.children??[]){const s=ip(n,t,e);if(s)return s}return null}function MT(e,t){const r=ip(e,t);if(!r)return null;const{question:n,parent:s}=r,i={...e,children:[n],childNodes:[t],shuffle:s==null?void 0:s.shuffle,showSolutions:(s==null?void 0:s.showSolutions)??"No",showFeedback:(s==null?void 0:s.showFeedback)??"No"};return(s==null?void 0:s.shuffle)===!0?i.maxScore=1:n.qType==="SA"?delete i.maxScore:n.maxScore!=null&&(i.maxScore=n.maxScore),i}function LT(e,t){const r=((t==null?void 0:t.enabled)??!0)&&!!e;return $n({queryKey:["quml","questionset",e],enabled:r,queryFn:async()=>{const n=await Ff(e),s=u=>{if(!u)return[];const f=u.mimeType===Vu&&u.identifier?[u.identifier]:[],g=(u.children??[]).flatMap(s);return[...f,...g]},i=s(n),o=new Map;i.length&&(await x_(i)).forEach(f=>{const g=f.identifier;g&&o.set(g,f)});const a=u=>{if(!u)return u;if(u.mimeType===Vu&&u.identifier){const f=o.get(u.identifier)??u,g=f.outcomeDeclaration;return g!=null&&g.maxScore||(f.outcomeDeclaration={...g??{},maxScore:qu(f)}),f}return Array.isArray(u.children)&&(u.children=u.children.map(f=>a(f))),u},c=a(n),d=c.outcomeDeclaration;return d!=null&&d.maxScore||(c.outcomeDeclaration={...d??{},maxScore:qu(c)}),c}})}const zu="/assets/quml-player/sunbird-quml-player.js",FT="/assets/quml-player/styles.css",Hu="sunbird-quml-player";function $T(e){const t=e.children??[];return t.length?t.every(n=>n.objectType==="Question")?[e]:t:[]}const tt=class tt{constructor(){ts(this,"eventHandlers",new WeakMap)}loadScript(){return tt.scriptLoaded||customElements.get(Hu)?(tt.scriptLoaded=!0,Promise.resolve()):(tt.scriptLoading||(tt.scriptLoading=new Promise((t,r)=>{const n=document.createElement("script");n.src=zu,n.setAttribute("data-quml-player-script","true"),n.onload=()=>{tt.scriptLoaded=!0,tt.scriptLoading=void 0,t()},n.onerror=()=>{tt.scriptLoading=void 0,r(new Error(`Failed to load QuML player script: ${zu}`))},document.body.appendChild(n)})),tt.scriptLoading)}loadStyles(){if(tt.stylesLoaded||document.querySelector('[data-quml-player-styles="true"]')){tt.stylesLoaded=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=FT,t.setAttribute("data-quml-player-styles","true"),document.head.appendChild(t),tt.stylesLoaded=!0}static unloadStyles(){var t;(t=document.querySelector('[data-quml-player-styles="true"]'))==null||t.remove(),tt.stylesLoaded=!1}async createConfig(t,r,n){var i,o,a;return await this.loadScript(),{context:{mode:(n==null?void 0:n.mode)??"play",host:"",pdata:{id:((i=r==null?void 0:r.pdata)==null?void 0:i.id)??"sunbird.portal",ver:((o=r==null?void 0:r.pdata)==null?void 0:o.ver)??"1.0",pid:((a=r==null?void 0:r.pdata)==null?void 0:a.pid)??"sunbird-portal"},contentId:t.identifier??"",sid:(r==null?void 0:r.sid)??"",uid:(r==null?void 0:r.uid)??(r==null?void 0:r.userId)??"",channel:(r==null?void 0:r.channel)??"",did:(r==null?void 0:r.did)??"",tags:(r==null?void 0:r.tags)??[],contextRollup:(n==null?void 0:n.contextRollup)??(r==null?void 0:r.rollup)??{},objectRollup:(n==null?void 0:n.objectRollup)??{},...n!=null&&n.cdata?{cdata:n.cdata}:{}},config:{language:"en"},data:{sections:$T(t),identifier:t.identifier??""},metadata:t}}createElement(t){this.loadStyles();const r=document.createElement(Hu);return r.setAttribute("player-config",JSON.stringify(t)),r.setAttribute("data-player-id",t.metadata.identifier??"quml"),r}attachEventListeners(t,r,n){this.removeEventListeners(t);const s=o=>r==null?void 0:r(o),i=o=>n==null?void 0:n(o.detail);t.addEventListener("playerEvent",s),t.addEventListener("telemetryEvent",i),this.eventHandlers.set(t,{player:s,telemetry:i})}removeEventListeners(t){const r=this.eventHandlers.get(t);r&&(t.removeEventListener("playerEvent",r.player),t.removeEventListener("telemetryEvent",r.telemetry),this.eventHandlers.delete(t))}};ts(tt,"scriptLoaded",!1),ts(tt,"scriptLoading"),ts(tt,"stylesLoaded",!1);let Ui=tt;const oi=new Ui,BT="_contentPlayerRoot_r6xk8_1",UT="_flowLayout_r6xk8_9",VT="_stage_r6xk8_13",qT="_aspectRatio_r6xk8_16",zT="_playerHeader_r6xk8_32",HT="_playerHeaderThumb_r6xk8_46",WT="_playerHeaderTitle_r6xk8_56",QT="_typeBadge_r6xk8_66",KT="_typeDot_r6xk8_105",GT="_playerFrame_r6xk8_125",YT="_coverOverlay_r6xk8_133",XT="_coverHidden_r6xk8_145",ZT="_coverThumb_r6xk8_150",JT="_coverPlayRing_r6xk8_159",eN="_coverPlayIcon_r6xk8_172",tN="_coverLabel_r6xk8_181",rN="_coverSkeleton_r6xk8_187",nN="_playerWrapper_r6xk8_213",sN="_infoStrip_r6xk8_223",iN="_infoChip_r6xk8_239",oN="_infoChipLabel_r6xk8_258",aN="_infoChipIcon_r6xk8_267",lN="_playerError_r6xk8_273",cN="_playerErrorIcon_r6xk8_287",uN="_playerErrorMsg_r6xk8_292",dN="_qumlRoot_r6xk8_299",Pe={contentPlayerRoot:BT,flowLayout:UT,stage:VT,aspectRatio:qT,playerHeader:zT,playerHeaderThumb:HT,playerHeaderTitle:WT,typeBadge:QT,typeDot:KT,playerFrame:GT,coverOverlay:YT,coverHidden:XT,coverThumb:ZT,coverPlayRing:JT,coverPlayIcon:eN,coverLabel:tN,coverSkeleton:rN,playerWrapper:nN,infoStrip:sN,infoChip:iN,infoChipLabel:oN,infoChipIcon:aN,playerError:lN,playerErrorIcon:cN,playerErrorMsg:uN,qumlRoot:dN},fN="application/vnd.sunbird.questionset";function hN(e,t){const r=new Map,n=i=>{for(const o of i)r.set(o.id,o),o.children&&n(o.children)};n(e);let s=r.get(t);for(;s;){if(s.mimeType===fN)return s.identifier;s=s.parent?r.get(s.parent):void 0}return null}const pN=[{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 gN(e){return pN.find(t=>t.mimes.includes(e))??{key:"other",label:"Content",icon:"📱"}}const mN={"pdf-player":["application/pdf"],"video-player":["video/mp4","video/webm"],"epub-player":["application/epub"]},yN={"pdf-player":"/assets/sunbird-pdf-player.js","video-player":"/assets/sunbird-video-player.js","epub-player":"/assets/sunbird-epub-player.js"},vN={"pdf-player":"sunbird-pdf-player","video-player":"sunbird-video-player","epub-player":"sunbird-epub-player"},bN="/content/preview/preview.html?webview=true&build_number=2.8.0.e552fcd";function Ho(e){for(const[t,r]of Object.entries(mN))if(r.includes(e))return t;return"default-player"}function _N(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 wN(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 SN(e,t,r=100){await wN(yN[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 xN=[{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 CN({node:e}){const t=e.metadata??{},r=xN.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:Pe.infoStrip,children:r.map(n=>l.jsxs("div",{className:Pe.infoChip,children:[n.icon&&l.jsx("span",{className:Pe.infoChipIcon,children:n.icon}),l.jsx("span",{className:Pe.infoChipLabel,children:n.label}),n.val]},n.key))}):null}function op({node:e,hidden:t}){var n;const r=e.appIcon??((n=e.metadata)==null?void 0:n.appIcon);return l.jsx("div",{className:`${Pe.coverOverlay} ${t?Pe.coverHidden:""}`,children:r?l.jsxs(l.Fragment,{children:[l.jsx("img",{src:r,alt:e.name,className:Pe.coverThumb}),l.jsx("div",{className:Pe.coverPlayRing,children:l.jsx("div",{className:Pe.coverPlayIcon})}),l.jsx("span",{className:Pe.coverLabel,children:"Loading preview…"})]}):l.jsx("div",{className:Pe.coverSkeleton})})}function ap({message:e}){return l.jsxs("div",{className:Pe.playerError,children:[l.jsx("span",{className:Pe.playerErrorIcon,children:"⚠"}),l.jsx("span",{className:Pe.playerErrorMsg,children:e})]})}function EN({mimeType:e}){const t=gN(e);return l.jsxs("span",{className:Pe.typeBadge,"data-type":t.key,children:[l.jsx("span",{className:Pe.typeDot}),t.label]})}const Ma=({node:e,editorMode:t,type:r,singleQuestion:n,layout:s="fill"})=>{var o;if(r==="quml")return l.jsx(DN,{node:e,editorMode:t,singleQuestion:!!n});const i=e.appIcon??((o=e.metadata)==null?void 0:o.appIcon);return l.jsxs("div",{className:`${Pe.contentPlayerRoot} ${s==="flow"?Pe.flowLayout:""}`,children:[l.jsxs("div",{className:Pe.stage,children:[l.jsxs("div",{className:Pe.playerHeader,children:[i&&l.jsx("img",{src:i,alt:"",className:Pe.playerHeaderThumb}),l.jsx("span",{className:Pe.playerHeaderTitle,children:e.name}),l.jsx(EN,{mimeType:e.mimeType??""})]}),l.jsx(ON,{node:e})]}),l.jsx(CN,{node:e})]})};function ON({node:e}){var y;const t=ae(v=>v.editorConfig),[r,n]=p.useState(()=>Ho(e.mimeType??"")),[s,i]=p.useState(!1),[o,a]=p.useState(null),[c,d]=p.useState(e.metadata??{}),[u,f]=p.useState(!1),g=p.useRef(null),m=p.useRef(null),_=((y=t==null?void 0:t.config)==null?void 0:y.previewCdnUrl)??bN;p.useEffect(()=>{let v=!1;return f(!1),i(!1),a(null),d(e.metadata??{}),n(Ho(e.mimeType??"")),PT(e.identifier).then(b=>{if(v)return;const S={...e.metadata??{},...b};d(S);const w=b.mimeType??e.mimeType??"";n(Ho(w)),f(!0)}).catch(()=>{v||f(!0)}),()=>{v=!0}},[e.identifier]);const h=_N(e,c,t);return p.useEffect(()=>{if(!u||r!=="default-player")return;const v=g.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.")}},S=()=>a("Preview player could not be loaded.");return v.addEventListener("load",b),v.addEventListener("error",S),()=>{v.removeEventListener("load",b),v.removeEventListener("error",S),v.src=""}},[e.identifier,r,_,u]),p.useEffect(()=>{if(!u||r==="default-player")return;const v=m.current;if(!v)return;const b=vN[r];if(!b)return;const S=h;SN(b,r).then(()=>{if(!m.current)return;if(!customElements.get(b)){n("default-player");return}const w=document.createElement(b);w.setAttribute("player-config",JSON.stringify(S)),w.addEventListener("playerEvent",()=>{}),w.addEventListener("telemetryEvent",()=>{}),v.innerHTML="",v.appendChild(w),setTimeout(()=>{try{w.playerConfig=S}catch{}i(!0)},200)}).catch(()=>{console.warn(`[ContentPlayer] ${r} script unavailable, falling back to iframe`),n("default-player")})},[e.identifier,r,u]),l.jsxs("div",{className:Pe.aspectRatio,children:[o?l.jsx(ap,{message:o}):l.jsx(op,{node:e,hidden:s}),r==="default-player"?l.jsx("iframe",{ref:g,id:"contentPlayer",title:e.name,className:Pe.playerFrame,name:"contentPlayer",allowFullScreen:!0}):l.jsx("div",{ref:m,className:Pe.playerFrame})]})}function DN({node:e,editorMode:t,singleQuestion:r}){const n=ae(g=>g.editorConfig),s=Oe(g=>g.treeData),i=p.useRef(null),o=r?hN(s,e.id):e.identifier,{data:a,isLoading:c,error:d}=LT(o??"",{enabled:!!o}),u=p.useMemo(()=>a?r?MT(a,e.identifier):a:null,[a,r,e.identifier]);p.useEffect(()=>{const g=i.current;if(!g||!u)return;let m=null,_=!1;return(async()=>{try{const h=await oi.createConfig(u,n==null?void 0:n.context,{mode:t==="edit"?"edit":"play"});if(_||!i.current)return;const y=oi.createElement(h);m=y,oi.attachEventListeners(y,v=>console.debug("[QumlPlayer] playerEvent",v.detail),v=>console.debug("[QumlPlayer] telemetryEvent",v)),g.innerHTML="",g.appendChild(y)}catch(h){console.error("[QumlPlayer] failed to initialize",h)}})(),()=>{_=!0,m&&(oi.removeEventListeners(m),m.remove()),Ui.unloadStyles()}},[u,n,t,r]);const f=d?`Unable to load questionset: ${d.message}`:r&&!o?"Could not resolve the parent questionset for this question.":r&&a&&!u?"Question not found in the questionset.":null;return l.jsxs("div",{className:Pe.qumlRoot,children:[f?l.jsx(ap,{message:f}):c||!u?l.jsx(op,{node:e,hidden:!1}):null,l.jsx("div",{ref:i,className:Pe.playerWrapper})]})}const IN="_overlay_ifddx_1",TN="_modal_ifddx_11",NN="_header_ifddx_21",jN="_body_ifddx_37",kN="_hint_ifddx_43",RN="_list_ifddx_49",AN="_item_ifddx_55",PN="_selected_ifddx_68",MN="_empty_ifddx_73",LN="_footer_ifddx_79",FN="_cancelBtn_ifddx_87",$N="_moveBtn_ifddx_95",Ut={overlay:IN,modal:TN,header:NN,body:jN,hint:kN,list:RN,item:AN,selected:PN,empty:MN,footer:LN,cancelBtn:FN,moveBtn:$N};function BN(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 UN=({resourceId:e,resourceName:t,currentUnitId:r,onClose:n})=>{var u;const{treeData:s,moveNode:i}=Oe(),o=BN(s,((u=s[0])==null?void 0:u.id)??"",r),[a,c]=p.useState(null),d=()=>{a&&(i(e,r,a),n())};return l.jsx("div",{className:Ut.overlay,role:"dialog","aria-label":"Move resource",children:l.jsxs("div",{className:Ut.modal,children:[l.jsxs("div",{className:Ut.header,children:[l.jsxs("span",{children:['Move "',t,'"']}),l.jsx("button",{onClick:n,"aria-label":"Close",children:l.jsx(dn,{size:16})})]}),l.jsxs("div",{className:Ut.body,children:[l.jsx("p",{className:Ut.hint,children:"Select a unit to move this content to:"}),l.jsxs("ul",{className:Ut.list,children:[o.map(f=>l.jsxs("li",{className:`${Ut.item} ${a===f.id?Ut.selected:""}`,onClick:()=>c(f.id),children:[l.jsx(Iy,{size:14}),l.jsx("span",{children:f.name})]},f.id)),o.length===0&&l.jsx("li",{className:Ut.empty,children:"No other units available"})]})]}),l.jsxs("div",{className:Ut.footer,children:[l.jsx("button",{className:Ut.cancelBtn,onClick:n,children:"Cancel"}),l.jsx("button",{className:Ut.moveBtn,onClick:d,disabled:!a,children:"Move here"})]})]})})},VN="_overlay_16at9_1",qN="_modal_16at9_11",zN="_header_16at9_21",HN="_body_16at9_37",WN="_table_16at9_43",QN="_pageInput_16at9_61",KN="_empty_16at9_68",GN="_footer_16at9_74",YN="_cancelBtn_16at9_82",XN="_saveBtn_16at9_90",ir={overlay:VN,modal:qN,header:zN,body:HN,table:WN,pageInput:QN,empty:KN,footer:GN,cancelBtn:YN,saveBtn:XN};function ZN(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 JN=({onClose:e})=>{const{treeData:t,updateNode:r}=Oe(),n=ZN(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:ir.overlay,role:"dialog","aria-label":"Assign Page Numbers",children:l.jsxs("div",{className:ir.modal,children:[l.jsxs("div",{className:ir.header,children:[l.jsx("span",{children:"Assign Page Numbers"}),l.jsx("button",{onClick:e,"aria-label":"Close",children:l.jsx(dn,{size:16})})]}),l.jsx("div",{className:ir.body,children:n.length===0?l.jsx("p",{className:ir.empty,children:"No content items found in this collection."}):l.jsxs("table",{className:ir.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Content"}),l.jsx("th",{children:"Page Number"})]})}),l.jsx("tbody",{children:n.map(a=>l.jsxs("tr",{children:[l.jsx("td",{children:a.name}),l.jsx("td",{children:l.jsx("input",{type:"number",min:1,value:s[a.id]??"",onChange:c=>i(d=>({...d,[a.id]:c.target.value})),className:ir.pageInput})})]},a.id))})]})}),l.jsxs("div",{className:ir.footer,children:[l.jsx("button",{className:ir.cancelBtn,onClick:e,children:"Cancel"}),l.jsxs("button",{className:ir.saveBtn,onClick:o,children:[l.jsx(My,{size:14})," Save"]})]})]})})},ej="_container_1a7t2_1",tj="_panelHeader_1a7t2_10",rj="_panelHeaderLeft_1a7t2_19",nj="_panelCollapseBtn_1a7t2_27",sj="_titleRow_1a7t2_46",ij="_field_1a7t2_47",oj="_moveBtn_1a7t2_64",aj="_icon_1a7t2_84",lj="_nameInput_1a7t2_93",cj="_fieldHeader_1a7t2_118",uj="_label_1a7t2_124",dj="_fieldCount_1a7t2_133",fj="_chips_1a7t2_170",hj="_chip_1a7t2_170",pj="_chipRemove_1a7t2_188",gj="_keywordInput_1a7t2_202",mj="_input_1a7t2_207",yj="_addBtn_1a7t2_220",vj="_radioGroup_1a7t2_234",bj="_radioLabel_1a7t2_239",Ve={container:ej,panelHeader:tj,panelHeaderLeft:rj,panelCollapseBtn:nj,titleRow:sj,field:ij,moveBtn:oj,icon:aj,nameInput:lj,fieldHeader:cj,label:uj,fieldCount:dj,chips:fj,chip:hj,chipRemove:pj,keywordInput:gj,input:mj,addBtn:yj,radioGroup:vj,radioLabel:bj},_j=({node:e,editorMode:t,onMoveClick:r,reorderDialog:n})=>{var A,B;const{updateNode:s,markDirty:i}=Oe(),o=t==="edit",a=ao(e),c=ae(R=>R.relationalFormConfig),d=R=>c==null?void 0:c.find(P=>P.code===R),u=R=>!c||!!d(R),f=(R,P)=>{var F;return((F=d(R))==null?void 0:F.label)||P},[g,m]=p.useState(!0),_=((A=e.metadata)==null?void 0:A.relationalMetadata)??{},[h,y]=p.useState(_.name??e.name??""),[v,b]=p.useState(""),[S,w]=p.useState(Array.isArray(_.keywords)?_.keywords:Array.isArray((B=e.metadata)==null?void 0:B.keywords)?e.metadata.keywords:[]),[C,D]=p.useState(!!_.optional);p.useEffect(()=>{var P,F;const R=((P=e.metadata)==null?void 0:P.relationalMetadata)??{};y(R.name??e.name??""),w(Array.isArray(R.keywords)?R.keywords:Array.isArray((F=e.metadata)==null?void 0:F.keywords)?e.metadata.keywords:[]),D(!!R.optional)},[e.id]);const j=()=>{h.trim()&&h!==e.name&&(s(e.id,{name:h.trim()}),i())},k=()=>{const R=v.trim();if(R&&!S.includes(R)){const P=[...S,R];w(P),s(e.id,{keywords:P}),i()}b("")},L=R=>{const P=S.filter(F=>F!==R);w(P),s(e.id,{keywords:P}),i()},T=R=>{D(R),s(e.id,{optional:R}),i()};return l.jsxs("div",{className:Ve.container,children:[l.jsxs("div",{className:Ve.panelHeader,children:[l.jsxs("div",{className:Ve.panelHeaderLeft,children:[l.jsx("span",{className:`sbx-ct-badge--${a.key}`,children:a.label}),o&&l.jsx("button",{type:"button",className:Ve.moveBtn,onClick:r,children:"Move to another unit"})]}),l.jsx("button",{type:"button",className:Ve.panelCollapseBtn,onClick:()=>m(R=>!R),"aria-expanded":g,"aria-label":g?"Collapse metadata panel":"Expand metadata panel",title:g?"Collapse":"Expand",children:g?l.jsx(Bs,{size:15}):l.jsx(Cy,{size:15})})]}),g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:Ve.titleRow,children:[e.appIcon&&l.jsx("img",{src:e.appIcon,alt:"icon",className:Ve.icon}),l.jsx("input",{type:"text",className:Ve.nameInput,value:h,disabled:!o,onChange:R=>y(R.target.value),onBlur:j,placeholder:"Content name"})]}),u("keywords")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("div",{className:Ve.fieldHeader,children:l.jsxs("label",{className:Ve.label,children:[f("keywords","Keywords"),S.length>0&&l.jsx("span",{className:Ve.fieldCount,children:S.length})]})}),S.length>0&&l.jsx("div",{className:Ve.chips,children:S.map(R=>l.jsxs("span",{className:Ve.chip,children:[R,o&&l.jsx("button",{type:"button",className:Ve.chipRemove,onClick:()=>L(R),children:"×"})]},R))}),o&&l.jsxs("div",{className:Ve.keywordInput,children:[l.jsx("input",{type:"text",className:Ve.input,value:v,placeholder:"Add keyword and press Enter",onChange:R=>b(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),k())}}),l.jsx("button",{type:"button",className:Ve.addBtn,onClick:k,children:"Add"})]})]}),u("optional")&&l.jsxs("div",{className:Ve.field,children:[l.jsx("label",{className:Ve.label,children:f("optional","Optional in Collection")}),l.jsxs("div",{className:Ve.radioGroup,children:[l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!0,onChange:()=>T(!0),disabled:!o}),"Yes"]}),l.jsxs("label",{className:Ve.radioLabel,children:[l.jsx("input",{type:"radio",name:`optional-${e.id}`,checked:C===!1,onChange:()=>T(!1),disabled:!o}),"No"]})]})]})]}),n]})},wj="_iconBtn_vl14u_1",Sj="_editable_vl14u_14",xj="_iconImg_vl14u_26",Cj="_placeholder_vl14u_34",Ej="_removeBtn_vl14u_41",cs={iconBtn:wj,editable:Sj,iconImg:xj,placeholder:Cj,removeBtn:Ej},Oj=({nodeId:e,value:t,editable:r})=>{const[n,s]=p.useState(!1),{updateNode:i,markDirty:o}=Oe(),a=d=>{i(e,{appIcon:d}),o(),s(!1)},c=d=>{d.stopPropagation(),i(e,{appIcon:""}),o()};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:[cs.iconBtn,r?cs.editable:""].filter(Boolean).join(" "),role:r?"button":void 0,tabIndex:r?0:-1,"aria-label":r?"Select app icon":"App icon",onClick:()=>r&&s(!0),onKeyDown:d=>{r&&(d.key==="Enter"||d.key===" ")&&s(!0)},children:[t?l.jsx("img",{src:t,alt:"App icon",className:cs.iconImg}):l.jsx("div",{className:cs.placeholder,children:l.jsx(rf,{size:18})}),t&&r&&l.jsx("button",{type:"button",className:cs.removeBtn,onClick:c,"aria-label":"Remove icon",children:l.jsx(Za,{size:11})})]}),n&&l.jsx(Zh,{nodeId:e,currentValue:t,onSelect:a,onClose:()=>s(!1)})]})},Dj="_leafContentLayout_1lchu_1",Ij="_container_1lchu_15",Tj="_emptyState_1lchu_24",Nj="_titleRow_1lchu_34",jj="_nodeTitle_1lchu_50",kj="_formArea_1lchu_72",Rj="_contentListArea_1lchu_76",Aj="_dropZone_1lchu_81",Pj="_reviewComment_1lchu_88",Mj="_reviewCommentLabel_1lchu_101",Lj="_reviewCommentText_1lchu_107",Wt={leafContentLayout:Dj,container:Ij,emptyState:Tj,titleRow:Nj,nodeTitle:jj,formArea:kj,contentListArea:Rj,dropZone:Aj,reviewComment:Pj,reviewCommentLabel:Mj,reviewCommentText:Lj},Fj="application/vnd.sunbird.questionset",lp="application/vnd.sunbird.question",$j=[Fj,lp];function Wu(e){var t,r;if(!(!e||e.status!=="Draft"||((t=e.metadata)==null?void 0:t.prevStatus)!=="Review"))return(r=e.metadata)==null?void 0:r.rejectComment}const Bj=({editorMode:e,onToolbarEvent:t})=>{var B;const[r,n]=p.useState("details"),[s,i]=p.useState([]),[o,a]=p.useState(null),[c,d]=p.useState(!1),u=p.useRef(null),f=p.useRef(),{selectedNodeId:g,breadcrumb:m,activeNodeMeta:_,updateNode:h,treeData:y}=Oe(),v=ae(R=>{var P,F,X,se;return((F=(P=R.editorConfig)==null?void 0:P.context)==null?void 0:F.contentId)??((se=(X=R.editorConfig)==null?void 0:X.context)==null?void 0:se.identifier)??""}),b=g?cp(y,g):null,S=!!b&&!b.parent,w=!!(b!=null&&b.isFolder),C=b&&$j.includes(b.mimeType??""),D=(b==null?void 0:b.mimeType)===lp,j=b&&!b.isFolder&&!C&&!S,k=Wu(b)??(S?Wu(y[0]):void 0),L=p.useCallback(()=>{const R=u.current;if(!R||!g)return;const P=R.innerText.trim();clearTimeout(f.current),f.current=setTimeout(()=>{h(g,{name:P})},600)},[g,h]),T=p.useCallback(R=>{t({action:"onFormValueChange",data:R})},[t]),A=p.useCallback((R,P)=>{i(P),t({action:"onFormStatusChange",data:{isValid:R,nodeId:g}})},[t,g]);return b?C?l.jsx(Ma,{node:b,editorMode:e,type:"quml",singleQuestion:D}):j?l.jsxs("div",{className:Wt.leafContentLayout,children:[l.jsx(Ma,{node:b,editorMode:e,type:"content",layout:"flow"}),l.jsx(_j,{node:b,editorMode:e,onMoveClick:()=>a(b.identifier),reorderDialog:o?l.jsx(UN,{resourceId:o,resourceName:b.name,currentUnitId:b.parent??"",onClose:()=>a(null)}):null})]}):l.jsxs("div",{className:Wt.container,children:[l.jsx(gO,{crumbs:m}),k&&l.jsxs("div",{className:Wt.reviewComment,role:"alert",children:[l.jsx("span",{className:Wt.reviewCommentLabel,children:"Reviewer comment:"}),l.jsx("span",{className:Wt.reviewCommentText,children:k})]}),l.jsxs("div",{className:Wt.titleRow,children:[S&&g&&l.jsx(Oj,{nodeId:g,value:String(b.appIcon??((B=b.metadata)==null?void 0:B.appIcon)??""),editable:e==="edit"}),l.jsx("div",{ref:u,className:Wt.nodeTitle,contentEditable:e==="edit",suppressContentEditableWarning:!0,onInput:L,onBlur:L,"data-placeholder":"Untitled","aria-label":"Node title",children:b.name})]}),l.jsx(wO,{activeTab:r,onChange:R=>n(R),errorTabs:s,visibleTabs:S?void 0:["details"]}),l.jsx("div",{className:Wt.formArea,children:l.jsx(YI,{nodeMetadata:_,activeTab:r,isRoot:S,isFolder:w,editorMode:e,onFormValueChange:T,onFormStatusChange:A},`${g??"none"}:${S?"root":"node"}`)}),(w||S)&&r==="details"&&l.jsx("div",{className:Wt.contentListArea,children:l.jsx(NT,{editorMode:e})}),l.jsx(RT,{isActive:!1,label:"Drop to add content to this unit",nodeId:g??void 0,className:Wt.dropZone}),c&&l.jsx(JN,{contentId:v,onClose:()=>d(!1)})]}):l.jsx("div",{className:Wt.emptyState,children:l.jsx("p",{children:"Select a unit from the outline to edit its details"})})};function cp(e,t){for(const r of e){if(r.id===t)return r;if(r.children){const n=cp(r.children,t);if(n)return n}}}const up=Zi((e,t)=>({allContent:[],filteredContent:[],searchQuery:"",activeFilter:"all",advancedFilters:{},isLoading:!1,totalCount:0,offset:0,sortAZ:!1,setContent:(r,n)=>{e({allContent:r,totalCount:n,offset:r.length}),t().applyFilter()},appendContent:(r,n)=>{const i=[...t().allContent,...r];e({allContent:i,totalCount:n,offset:i.length}),t().applyFilter()},setFilter:r=>{e({activeFilter:r}),t().applyFilter()},setSearch:r=>{e({searchQuery:r}),t().applyFilter()},setLoading:r=>e({isLoading:r}),setAdvancedFilters:r=>e({advancedFilters:r}),setOffset:r=>e({offset:r}),setSortAZ:r=>e({sortAZ:r}),applyFilter:()=>{const{allContent:r,activeFilter:n,searchQuery:s}=t();let i=r;if(n&&n!=="all"){const o=n.toLowerCase();i=i.filter(a=>[a.mimeType??"",a.primaryCategory??"",a.contentType??""].join(" ").toLowerCase().includes(o))}if(s&&s.trim()!==""){const o=s.toLowerCase().trim();i=i.filter(a=>(a.name??"").toLowerCase().includes(o))}e({filteredContent:i})}})),Uj=20;function dp(){var d;const e=ae(u=>u.editorConfig),t=Oe(u=>u.selectedNodeId),r=Oe(u=>u.treeData),n=p.useCallback(()=>{if(!t||!r.length)return 0;function u(f,g,m=0){var _;for(const h of f){if(h.id===g)return m;if((_=h.children)!=null&&_.length){const y=u(h.children,g,m+1);if(y>=0)return y}}return-1}return Math.max(0,u(r,t))},[t,r])(),s=(d=e==null?void 0:e.config)==null?void 0:d.hierarchy;if(!s)return[...xu];const i=`level${n}`,o=s[i],a=o==null?void 0:o.children,c=a==null?void 0:a.Content;return c!=null&&c.length?c:[...xu]}function Vj(){const e=up(),t=ae(f=>{var g,m;return((m=(g=f.editorConfig)==null?void 0:g.context)==null?void 0:m.channel)??""}),r=dp(),n=p.useRef(),s=p.useCallback(async(f="",g="all",m={},_=!0,h=!1)=>{var y,v,b,S,w;e.setLoading(!0);try{const C={status:["Live"],primaryCategory:g&&g!=="all"?[g]:r};(y=m==null?void 0:m.board)!=null&&y.length&&(C.board=m.board),(v=m==null?void 0:m.medium)!=null&&v.length&&(C.medium=m.medium),(b=m==null?void 0:m.gradeLevel)!=null&&b.length&&(C.gradeLevel=m.gradeLevel),(S=m==null?void 0:m.subject)!=null&&S.length&&(C.subject=m.subject),(w=m==null?void 0:m.primaryCategory)!=null&&w.length&&(C.primaryCategory=m.primaryCategory);const D=_?0:e.offset,{content:j,count:k}=await AT({filters:C,query:f,limit:f?50:Uj,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]),d=p.useCallback(()=>{e.isLoading||s(e.searchQuery,e.activeFilter,e.advancedFilters,!1,e.sortAZ)},[e.isLoading,e.searchQuery,e.activeFilter,e.advancedFilters,e.sortAZ,s]),u=e.allContent.length<e.totalCount;return{content:e.filteredContent,isLoading:e.isLoading,totalCount:e.totalCount,activeFilter:e.activeFilter,advancedFilters:e.advancedFilters,searchQuery:e.searchQuery,sortAZ:e.sortAZ,hasMore:u,search:i,setFilter:o,applyAdvancedFilters:a,toggleSort:c,loadMore:d,refetch:()=>s(e.searchQuery,e.activeFilter,e.advancedFilters,!0,e.sortAZ)}}const qj="_card_jzciw_1",zj="_addBtn_jzciw_17",Hj="_dragging_jzciw_24",Wj="_ctIcon_jzciw_29",Qj="_info_jzciw_33",Kj="_name_jzciw_41",Gj="_meta_jzciw_50",Yj="_addBtnMuted_jzciw_78",Xj="_added_jzciw_87",Zj="_addedBadge_jzciw_96",or={card:qj,addBtn:zj,dragging:Hj,ctIcon:Wj,info:Qj,name:Kj,meta:Gj,addBtnMuted:Yj,added:Xj,addedBadge:Zj},Jj={video:Ja,pdf:Ka,h5p:Ga,scorm:Xa,audio:Ya,quiz:Qa,default:Kn},ek=({item:e,onAdd:t,onPreview:r,isDraggable:n,isAdded:s})=>{var h,y;const i=ao(e),o=Jj[i.key]??Kn,a=yl(),c=X1(),d=a&&!s&&c,{attributes:u,listeners:f,setNodeRef:g,isDragging:m}=Kd({id:e.identifier,disabled:!n||!a||!c,data:{type:"library-item",item:e}}),_=()=>{r&&r(e)};return l.jsxs("div",{ref:g,className:[or.card,m?or.dragging:"",s?or.added:""].join(" "),"aria-label":e.name,...n?{...u,...f}:{},role:"listitem",onClick:_,children:[l.jsx("span",{className:[`sbx-ct-sq--${i.key}`,or.ctIcon].join(" "),"aria-hidden":"true",children:l.jsx(o,{size:14})}),l.jsxs("div",{className:or.info,children:[l.jsx("span",{className:or.name,title:e.name,children:e.name}),l.jsxs("span",{className:or.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:or.addedBadge,"aria-label":"Already added",title:"Already added to this collection",children:l.jsx(Qn,{size:12})}),!s&&l.jsx("button",{type:"button",className:[or.addBtn,!d&&a?or.addBtnMuted:""].join(" "),onClick:v=>{v.stopPropagation(),t(e)},disabled:!a,"aria-disabled":!d,"aria-label":`Add ${e.name} to unit`,title:a?c?"Add to unit":"Select a unit to add":"Only Draft content can be added",children:l.jsx(Us,{size:14})})]})},tk="_chips_xhhaq_1",rk="_chip_xhhaq_1",Qu={chips:tk,chip:rk},nk=({filters:e,active:t,onChange:r})=>l.jsx("div",{className:Qu.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",Qu.chip].join(" "),onClick:()=>r(n.value),children:n.label},n.value))}),sk="_panel_1cl11_1",ik="_header_1cl11_10",ok="_headerTitle_1cl11_19",ak="_closeBtn_1cl11_25",lk="_body_1cl11_43",ck="_section_1cl11_59",uk="_sectionLabel_1cl11_65",dk="_chips_1cl11_73",fk="_chip_1cl11_73",hk="_active_1cl11_96",pk="_footer_1cl11_102",gk="_resetBtn_1cl11_112",mk="_applyBtn_1cl11_129",st={panel:sk,header:ik,headerTitle:ok,closeBtn:ak,body:lk,section:ck,sectionLabel:uk,chips:dk,chip:fk,active:hk,footer:pk,resetBtn:gk,applyBtn:mk},yk=[{key:"board",label:"Board"},{key:"medium",label:"Medium"},{key:"gradeLevel",label:"Class"},{key:"subject",label:"Subject"}],vk=new Set(["board","medium","gradeLevel","subject","topic"]),bk=({local:e,toggle:t})=>{const r=dp();return r.length?l.jsxs("div",{className:st.section,children:[l.jsx("div",{className:st.sectionLabel,children:"Primary Category"}),l.jsx("div",{className:st.chips,children:r.map(n=>l.jsx("button",{type:"button",className:[st.chip,(e.primaryCategory??[]).includes(n)?st.active:""].join(" "),onClick:()=>t("primaryCategory",n),children:n},n))})]}):null},_k=({isOpen:e,filters:t,onApply:r,onClose:n})=>{var h,y;const s=ae(v=>v.editorConfig),i=ae(v=>v.searchFormConfig),o=ae(v=>v.contentFramework),a=ae(v=>v.contentTargetFWIds),{organisationFramework:c}=Wh(o??((h=s==null?void 0:s.context)==null?void 0:h.framework),a??((y=s==null?void 0:s.context)==null?void 0:y.targetFWIds)),[d,u]=p.useState(t),f=i!=null&&i.length?i.filter(v=>vk.has(v.code)).map(v=>({key:v.code,label:v.label||v.code})):yk;p.useEffect(()=>{u(t)},[t]);const g=(v,b)=>{u(S=>{const w=S[v]??[],C=w.includes(b)?w.filter(D=>D!==b):[...w,b];return{...S,[v]:C}})},m=(c==null?void 0:c.categories)??[],_=v=>{var b;return((b=m.find(S=>S.code===v))==null?void 0:b.terms)??[]};return e?l.jsxs("div",{className:st.panel,role:"dialog","aria-label":"Filter library","aria-modal":"true",children:[l.jsxs("div",{className:st.header,children:[l.jsx("span",{className:st.headerTitle,children:"Filters"}),l.jsx("button",{type:"button",className:st.closeBtn,onClick:n,"aria-label":"Close filters",children:l.jsx(dn,{size:16})})]}),l.jsxs("div",{className:st.body,children:[f.map(({key:v,label:b})=>{const S=_(v);return S.length?l.jsxs("div",{className:st.section,children:[l.jsx("div",{className:st.sectionLabel,children:b}),l.jsx("div",{className:st.chips,children:S.slice(0,20).map(w=>l.jsx("button",{type:"button",className:[st.chip,(d[v]??[]).includes(w.name)?st.active:""].join(" "),onClick:()=>g(v,w.name),children:w.name},w.identifier))})]},v):null}),l.jsx(bk,{local:d,toggle:g})]}),l.jsxs("div",{className:st.footer,children:[l.jsx("button",{type:"button",className:st.resetBtn,onClick:()=>u({}),children:"Reset"}),l.jsx("button",{type:"button",className:st.applyBtn,onClick:()=>{r(d),n()},children:"Apply"})]})]}):null},wk="_header_6qdpu_10",Sk="_title_6qdpu_20",xk="_headerActions_6qdpu_31",Ck="_iconBtn_6qdpu_38",Ek="_playerArea_6qdpu_56",Ok="_footer_6qdpu_64",Dk="_addBtn_6qdpu_73",Ik="_modalOverlay_6qdpu_92",Tk="_modalPanel_6qdpu_103",gr={header:wk,title:Sk,headerActions:xk,iconBtn:Ck,playerArea:Ek,footer:Ok,addBtn:Dk,modalOverlay:Ik,modalPanel:Tk},Nk="application/vnd.sunbird.questionset",jk=({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 Lr.createPortal(l.jsx("div",{className:gr.modalOverlay,role:"dialog","aria-modal":"true","aria-label":"Content preview",onClick:r,children:l.jsxs("div",{className:gr.modalPanel,onClick:s=>s.stopPropagation(),children:[l.jsxs("div",{className:gr.header,children:[l.jsx("span",{className:gr.title,title:e.name,children:e.name}),l.jsx("div",{className:gr.headerActions,children:l.jsx("button",{type:"button",className:gr.iconBtn,onClick:r,"aria-label":"Close preview",children:l.jsx(dn,{size:16})})})]}),l.jsx("div",{className:gr.playerArea,children:l.jsx(Ma,{node:n,editorMode:"read",type:e.mimeType===Nk?"quml":"content"})}),l.jsx("div",{className:gr.footer,children:l.jsx("button",{type:"button",className:gr.addBtn,onClick:()=>t(e),children:"+ Add to Unit"})})]})}),document.body)},kk="_dock_1lpg0_1",Rk="_header_1lpg0_8",Ak="_headerLeft_1lpg0_17",Pk="_headerTitle_1lpg0_24",Mk="_count_1lpg0_30",Lk="_searchRow_1lpg0_39",Fk="_searchWrap_1lpg0_47",$k="_searchIcon_1lpg0_53",Bk="_searchInput_1lpg0_62",Uk="_filterToggleBtn_1lpg0_80",Vk="_filterToggleBtnActive_1lpg0_99",qk="_filterBadge_1lpg0_105",zk="_filters_1lpg0_124",Hk="_mainArea_1lpg0_134",Wk="_sidePanelOverlay_1lpg0_143",Qk="_cardList_1lpg0_152",Kk="_skeleton_1lpg0_168",Gk="_skeletonIcon_1lpg0_178",Yk="_skeletonText_1lpg0_186",Xk="_skeletonLine_1lpg0_193",Zk="_skeletonLineSm_1lpg0_200",Jk="_loadMoreBtn_1lpg0_215",eR="_emptyState_1lpg0_240",tR="_collapseBtn_1lpg0_260",Fe={dock:kk,header:Rk,headerLeft:Ak,headerTitle:Pk,count:Mk,searchRow:Lk,searchWrap:Fk,searchIcon:$k,searchInput:Bk,filterToggleBtn:Uk,filterToggleBtnActive:Vk,filterBadge:qk,filters:zk,mainArea:Hk,sidePanelOverlay:Wk,cardList:Qk,skeleton:Kk,skeletonIcon:Gk,skeletonText:Yk,skeletonLine:Xk,skeletonLineSm:Zk,loadMoreBtn:Jk,emptyState:eR,collapseBtn:tR};function rR(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 nR=({editorMode:e,collapsed:t=!1,onToggleCollapse:r})=>{const{content:n,isLoading:s,totalCount:i,activeFilter:o,searchQuery:a,sortAZ:c,hasMore:d,search:u,setFilter:f,applyAdvancedFilters:g,toggleSort:m,loadMore:_}=Vj(),{addResource:h,selectedNodeId:y,treeData:v}=Oe(),b=e==="edit",[S,w]=p.useState(!1),[C,D]=p.useState({}),[j,k]=p.useState(null),L=p.useMemo(()=>rR(v),[v]),T=p.useCallback(F=>{var De;if(!y){Ce.error("Select a unit first");return}const X=(De=v[0])==null?void 0:De.id;if(y===X){Ce("Select a unit from the outline to add content — resources cannot be added directly to the course.",{icon:"ℹ️",duration:4e3});return}if(h(F,y)===!1){Ce.error(`"${F.name}" is already in this collection`);return}Ce.success(`Added "${F.name}"`)},[y,h,v]),A=p.useCallback(F=>{D(F),g(F)},[g]),B=p.useCallback(F=>{k(F)},[]),R=p.useCallback(F=>{T(F),k(null)},[T]),P=p.useMemo(()=>Object.values(C).reduce((F,X)=>F+((X==null?void 0:X.length)??0),0),[C]);return l.jsxs("div",{className:Fe.dock,children:[l.jsx("div",{className:Fe.header,children:l.jsxs("div",{className:Fe.headerLeft,children:[l.jsx("button",{type:"button",className:Fe.collapseBtn,onClick:r,"aria-label":"Collapse library panel",title:"Collapse library",children:l.jsx(Ay,{size:15})}),l.jsx(jy,{size:16}),l.jsx("span",{className:Fe.headerTitle,children:"Library"}),i>0&&l.jsx("span",{className:Fe.count,children:i})]})}),l.jsxs("div",{className:Fe.searchRow,children:[l.jsxs("div",{className:Fe.searchWrap,children:[l.jsx(ha,{size:14,className:Fe.searchIcon}),l.jsx("input",{type:"search",className:Fe.searchInput,placeholder:"Search content…",value:a,onChange:F=>u(F.target.value),"aria-label":"Search library"})]}),l.jsx("button",{type:"button",className:[Fe.filterToggleBtn,c?Fe.filterToggleBtnActive:""].join(" "),onClick:m,"aria-label":c?"Sort: A–Z (click for Recent)":"Sort: Recent (click for A–Z)",title:c?"A–Z":"Recent",children:c?l.jsx(Sy,{size:15}):l.jsx(Oy,{size:15})}),l.jsxs("button",{type:"button",className:[Fe.filterToggleBtn,S?Fe.filterToggleBtnActive:""].join(" "),onClick:()=>w(F=>!F),"aria-label":"Toggle advanced filters","aria-pressed":S,title:"Advanced filters",children:[l.jsx($y,{size:15}),P>0&&l.jsx("span",{className:Fe.filterBadge,children:P})]})]}),l.jsx("div",{className:Fe.filters,children:l.jsx(nk,{filters:Z1,active:o,onChange:f})}),l.jsxs("div",{className:Fe.mainArea,children:[l.jsx("div",{className:Fe.cardList,role:"list","aria-label":"Library content",children:s&&n.length===0?Array.from({length:4}).map((F,X)=>l.jsxs("div",{className:Fe.skeleton,"aria-hidden":"true",children:[l.jsx("div",{className:Fe.skeletonIcon}),l.jsxs("div",{className:Fe.skeletonText,children:[l.jsx("div",{className:Fe.skeletonLine}),l.jsx("div",{className:Fe.skeletonLineSm})]})]},X)):n.length>0?l.jsxs(l.Fragment,{children:[n.map(F=>l.jsx(ek,{item:F,onAdd:T,onPreview:B,isDraggable:b,isAdded:L.has(F.identifier)},F.identifier)),d&&l.jsx("button",{type:"button",className:Fe.loadMoreBtn,onClick:_,disabled:s,"aria-label":"Load more content",children:s?"Loading…":"Load More"})]}):l.jsxs("div",{className:Fe.emptyState,children:[l.jsx(ha,{size:24}),l.jsx("p",{children:"No content found"}),l.jsx("span",{children:"Try a different search or filter"})]})}),S&&l.jsx("div",{className:Fe.sidePanelOverlay,children:l.jsx(_k,{isOpen:S,filters:C,onApply:A,onClose:()=>w(!1)})}),j&&l.jsx(jk,{content:j,onAdd:R,onClose:()=>k(null)})]})]})};function sR(e,t,r){const n={},s={},i=new Set(["id","isFolder","children","parent","isNew","breadcrumb","title","relationalMetadata","optional"]),o=new Set(["targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","targetFWIds","targetTopicIds","topic","topicsIds"]),a=new Set(["audience","attributions","keywords","language","additionalCategories","medium","gradeLevel","subject","boardIds","mediumIds","gradeLevelIds","subjectIds","targetBoardIds","targetMediumIds","targetGradeLevelIds","targetSubjectIds","dialcodes"]),c=new Set(["copyrightYear","compatibilityLevel","version"]);function d(g,m=!1){const _={};for(const[h,y]of Object.entries(g))if(!i.has(h)&&!(m&&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 u(g){var _;const m={};for(const h of g.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 S=((_=h.metadata)==null?void 0:_.relationalMetadata)??{};m[h.identifier]={name:h.name,...S,...b}}return m}function f(g,m){var S,w;const _=g.identifier,h=t[_],y=_.startsWith("temp-")||!!(h!=null&&h.isNew),v=!g.isFolder&&!m;if(m||y||h&&!v){let C;if(y)C={mimeType:"application/vnd.ekstep.content-collection",code:_,contentType:((S=g.metadata)==null?void 0:S.contentType)??"CourseUnit",primaryCategory:((w=g.metadata)==null?void 0:w.primaryCategory)??"Course Unit",name:g.name,visibility:"Parent",channel:r,...d(g.metadata??{})};else if(m){const{isNew:D,...j}=h??{};C={...d(g.metadata??{},!0),...d(j,!1),name:g.name}}else{const{isNew:D,...j}=h??{};C={name:g.name,visibility:"Parent",...d(j,!0)}}n[_]={metadata:C,objectType:g.objectType||(g.isFolder?"Collection":"Content"),root:m,isNew:y}}const b=g.isFolder?u(g):{};s[_]={name:g.name,children:(g.children??[]).map(C=>C.identifier),...Object.keys(b).length>0?{relationalMetadata:b}:{},root:m},(g.children??[]).forEach(C=>f(C,!1))}return e.forEach((g,m)=>f(g,m===0)),{nodesModified:n,hierarchy:s}}function iR(){const[e,t]=p.useState(!1),r=Oe(u=>u.treeCache),n=Oe(u=>u.treeData),s=ae(u=>u.isDirty),i=ae(u=>u.lastSaved),{setIsDirty:o,setLastSaved:a}=ae(),c=ae(u=>u.editorConfig);return{save:p.useCallback(async()=>{if(!c||e)return;const u=c.context.contentId??c.context.identifier??"";if(!u)return;const f=c.context.channel??"",g=c.context.userId??c.context.uid??"";t(!0);try{const{nodesModified:m,hierarchy:_}=sR(n,r,f),{identifiers:h}=await E_(u,m,_,g);h&&Object.keys(h).length>0&&Oe.getState().replaceNodeIds(h);const y=new Date().toISOString();a(y),o(!1)}catch(m){console.error("[useSaveHierarchy] save failed:",m),Ce.error("Failed to save. Please try again.")}finally{t(!1)}},[c,e,n,r,o,a]),isSaving:e,isDirty:s,lastSaved:i}}const oR={};function aR(e){return e==null||e===""||Array.isArray(e)&&e.length===0}function lR(e,t,r,n,s){const i=[],o=(a,c)=>{var d;for(const u of a){const f=c&&!u.parent,g=f?r:u.isFolder?n:null;if(g&&g.length>0){const m={...u.metadata??{},...t[u.id]??{}},h=Kh(g,m,oR,f,s).filter(y=>y.required&&y.visible!==!1&&y.inputType!=="appIcon"&&aR(y.currentValue)).map(y=>y.label);h.length>0&&i.push({nodeId:u.id,nodeName:u.name||"Untitled",missing:h})}(d=u.children)!=null&&d.length&&o(u.children,!1)}};return o(e,!0),i}function cR(e){const t=ae(f=>f.editorConfig),r=ae(f=>f.setButtonLoader),n=ae(f=>f.validateAllForms),s=ae(f=>f.rootFormConfig),i=ae(f=>f.unitFormConfig),o=Oe(f=>f.treeData),a=Oe(f=>f.treeCache),c=Oe(f=>f.selectNode),d=p.useCallback(()=>{var h,y,v;const f={editorMode:"edit",objectType:(h=t==null?void 0:t.config)==null?void 0:h.objectType,userFullName:(v=(y=t==null?void 0:t.context)==null?void 0:y.user)==null?void 0:v.fullName},g=lR(o,a,s,i,f);if(g.length===0)return!0;const m=g[0];Ce.error(`"${m.nodeName}": please fill required field${m.missing.length>1?"s":""} — ${m.missing.join(", ")}`);const{setFormStatus:_}=ae.getState();return g.forEach(b=>_(b.nodeId,!1)),c(m.nodeId),!1},[o,a,s,i,t,c]);return{runAction:p.useCallback(async(f,g)=>{var h,y,v,b;const m=((h=t==null?void 0:t.context)==null?void 0:h.contentId)??((y=t==null?void 0:t.context)==null?void 0:y.identifier)??"";if(!m)return Ce.error("No content identifier found."),!1;const _=((v=t==null?void 0:t.context)==null?void 0:v.userId)??((b=t==null?void 0:t.context)==null?void 0:b.uid)??"";try{switch(f){case"sendForReview":return d()?n(o)?(r("saveCollection",!0),await e(),await I_(m),Ce.success("Content sent for review"),!0):(Ce.error("Some units have missing required fields. Please fill them before sending for review."),!1):!1;case"reject":{r("rejectCollection",!0);const S=(g==null?void 0:g.comment)??"";return await T_(m,S),Ce.success("Content rejected and sent back to the author"),!0}case"publish":return d()?n(o)?(r("publishCollection",!0),await e(),await O_(m,_),Ce.success("Content published successfully"),!0):(Ce.error("Some units have missing required fields. Please fill them before publishing."),!1):!1;default:return!1}}catch(S){console.error(`[useToolbarActions] ${f} failed`,S);const w=f==="sendForReview"?"send for review":f==="reject"?"reject":"publish";return Ce.error(`Failed to ${w}. Please try again.`),!1}finally{r("saveCollection",!1),r("rejectCollection",!1),r("publishCollection",!1)}},[t,e,r,d,n,o]),checkRequiredFields:d}}const uR="_shell_90fon_1",dR="_workspace_90fon_8",fR="_sidebarCollapsed_90fon_16",hR="_dockCollapsed_90fon_19",pR="_dock_90fon_19",gR="_outline_90fon_40",mR="_reopenTab_90fon_45",yR="_outlineHidden_90fon_79",vR="_editor_90fon_86",bR="_dockHidden_90fon_101",_R="_dockReopenTab_90fon_108",wR="_dragChip_90fon_133",SR="_dragChipLabel_90fon_148",kt={shell:uR,workspace:dR,sidebarCollapsed:fR,dockCollapsed:hR,dock:pR,outline:gR,reopenTab:mR,outlineHidden:yR,editor:vR,dockHidden:bR,dockReopenTab:_R,dragChip:wR,dragChipLabel:SR},xR=({editorMode:e,onToolbarEvent:t,onContentAdded:r,onHierarchySaved:n})=>{const[s,i]=p.useState(null),[o,a]=p.useState(!1),[c,d]=p.useState(!1),[u,f]=p.useState(!1),{addResource:g,treeData:m}=Oe(),_=ae(P=>P.setFormStatus),[h,y]=p.useState(!0),v=Oe(P=>P.selectedNodeId),{save:b,isSaving:S,isDirty:w,lastSaved:C}=iR(),{runAction:D,checkRequiredFields:j}=cR(b);p.useEffect(()=>{if(!w)return;const P=F=>{F.preventDefault(),F.returnValue=""};return window.addEventListener("beforeunload",P),()=>window.removeEventListener("beforeunload",P)},[w]);const k=Id(ca(Gi,{activationConstraint:{distance:8}})),L=p.useCallback(P=>{var X;const F=(X=P.active.data.current)==null?void 0:X.item;F&&i(F)},[]),T=p.useCallback(P=>{var ve,q;i(null);const F=(ve=P.active.data.current)==null?void 0:ve.item;if(!F)return;const X=P.over,se=(X==null?void 0:X.id)??v??void 0;if(!se){Ce.error("Drop onto a unit to add content");return}const De=(q=m[0])==null?void 0:q.id;if(se===De){Ce.error("Drop content onto a unit, not directly on the course.");return}if(!g(F,se)){Ce.error(`"${F.name}" is already in this collection`);return}r==null||r(F,se),Ce.success(`Added "${F.name}" to unit`)},[v,g,r]),A=p.useCallback(async P=>{if(P.action==="onFormStatusChange"){const{isValid:F,nodeId:X}=P.data??{},se=F!==!1;y(se),X&&_(X,se);return}if(P.action==="back"&&w&&e==="edit"){f(!0);return}if(P.action==="saveCollection"){if(!h){Ce.error("Please fill the required metadata");return}if(!j())return;await b(),n==null||n(m),t==null||t(P);return}if(P.action==="sendForReview"||P.action==="reject"||P.action==="publish"){await D(P.action,P.data)&&(t==null||t(P));return}t==null||t(P)},[b,D,j,t,n,m,w,h,e]),B=p.useCallback(async()=>{if(!j()){f(!1);return}await b(),f(!1),n==null||n(m),t==null||t({action:"back"})},[b,j,n,t,m]),R=p.useCallback(()=>{f(!1),t==null||t({action:"back"})},[t]);return l.jsxs(Qd,{sensors:k,onDragStart:L,onDragEnd:T,children:[l.jsxs("div",{className:kt.shell,children:[l.jsx(Fw,{editorMode:e,isSaving:S,isDirty:w,lastSaved:C,isFormValid:h,onToolbarEvent:A}),l.jsxs("div",{className:[kt.workspace,o?kt.sidebarCollapsed:"",c?kt.dockCollapsed:""].filter(Boolean).join(" "),children:[l.jsx("aside",{className:[kt.outline,o?kt.outlineHidden:""].join(" "),"aria-label":"Course outline","aria-hidden":o,children:l.jsx(uO,{editorMode:e,collapsed:o,onToggleCollapse:()=>a(P=>!P)})}),o&&l.jsx("button",{className:kt.reopenTab,onClick:()=>a(!1),title:"Show outline",type:"button",children:"›"}),l.jsx("main",{className:kt.editor,role:"main","aria-label":"Content editor",children:l.jsx(Bj,{editorMode:e,onToolbarEvent:A})}),l.jsx("aside",{className:[kt.dock,c?kt.dockHidden:""].filter(Boolean).join(" "),"aria-label":"Content library","aria-hidden":c,children:l.jsx(nR,{editorMode:e,collapsed:c,onToggleCollapse:()=>d(P=>!P)})}),c&&l.jsx("button",{className:kt.dockReopenTab,onClick:()=>d(!1),title:"Show library",type:"button",children:"‹"})]})]}),l.jsx(yy,{dropAnimation:null,children:s?l.jsx("div",{className:kt.dragChip,children:l.jsx("span",{className:kt.dragChipLabel,children:s.name})}):null}),u&&l.jsx($w,{onSave:B,onDiscard:R,onCancel:()=>f(!1),isSaving:S})]})},CR="v1";function ER(e){const t=e.validations,r=t==null?void 0:t.find(s=>s.type==="maxlength"||s.type==="maxLength");if(!r)return e.maxLength;const n=Number(r.value);return Number.isFinite(n)?n:void 0}function Ku(e,t){var r;return{code:e.code??"",label:e.label??e.name??e.code??"",name:e.name,inputType:e.inputType,dataType:e.dataType,required:e.required===!0||Array.isArray(e.validations)&&e.validations.some(n=>n.type==="required")||String(((r=e.renderingHints)==null?void 0:r.class)??"").includes("required"),editable:e.editable!==!1,visible:e.visible!==!1,placeholder:e.placeholder,maxLength:ER(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 Cr(e){const t=e==null?void 0:e.properties;if(!Array.isArray(t))return[];const r=[];for(const n of t)if(Array.isArray(n.fields)){const s=n.name??void 0,i=n.fields.filter(o=>!!o.code).sort((o,a)=>(o.index??0)-(a.index??0));for(const o of i)r.push(Ku(o,s))}else n.code&&r.push(Ku(n));return r}function 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 DR(e,t,r="Collection",n=CR){var d,u;const i=(u=(d=(await Ne.post(`/action/object/category/definition/${n}/read?fields=objectMetadata,forms,name,label`,{request:{objectCategoryDefinition:{objectType:r,name:e,...t?{channel:t}:{}}}})).data)==null?void 0:d.result)==null?void 0:u.objectCategoryDefinition,o=(i==null?void 0:i.forms)??{},a=(i==null?void 0:i.objectMetadata)??{},c=a.config??{};return{rootForm:Cr(o.create),unitForm:Cr(o.unitMetadata),childForm:Cr(o.childMetadata),searchForm:Cr(o.search??o.searchConfig),relationalForm:Cr(o.relationalMetadata),publishChecklist:Cr(o.publishchecklist),reviewChecklist:Cr(o.review),rfcChecklist:Cr(o.requestforchangeschecklist),schemaDefaults:OR(a.schema),frameworkMetadata:c.frameworkMetadata??{},sourcingSettings:c.sourcingSettings??{}}}function IR({config:e,onError:t}){const[r,n]=p.useState(!0),[s,i]=p.useState(null),[o,a]=p.useState(!1),{setEditorConfig:c,setEditorMode:d,setCategoryDefinition:u,setContentFramework:f}=ae(),{setTreeData:g,selectNode:m}=Oe();return p.useEffect(()=>{let _=!1;async function h(){var y,v;try{n(!0),i(null),e.apiBaseUrl&&Pf(e.apiBaseUrl),c(e),d(e.config.mode);const b=e.context.contentId??e.context.identifier??"";if(b){const S=e.config.objectType==="QuestionSet",{rootNode:w}=S?await C_(b):await $f(b);if(!_&&(g(w?[w]:[]),w)){m(w.id);const L=w.metadata??{},T=L.framework??e.context.framework??null,A=L.targetFWIds??e.context.targetFWIds??null;f(T,A)}const C=e.config.primaryCategory??"Course",D=e.context.channel??"",j=e.config.categoryDefinitionApiVersion??"v1";try{const k=await DR(C,D,e.config.objectType??"Collection",j);if(!_){u(k);const L=((y=k.sourcingSettings)==null?void 0:y.collection)??{},T={};L.maxDepth&&!e.config.maxDepth&&(T.maxDepth=L.maxDepth),L.children&&!e.config.children&&(T.children=L.children),L.hierarchy&&!((v=e.config.hierarchy)!=null&&v.level1)&&(T.hierarchy={...e.config.hierarchy??{},...L.hierarchy}),Object.keys(T).length>0&&c({...e,config:{...e.config,...T}})}}catch{}}_||a(!0)}catch(b){if(!_){const S=b instanceof Error?b:new Error(String(b));i(S),t==null||t(S)}}finally{_||n(!1)}}return h(),()=>{_=!0}},[e.context.contentId,e.context.identifier]),{isLoading:r,error:s,isReady:o}}const TR="_root_qcpw6_1",NR="_loadingState_qcpw6_10",jR="_loadingSpinner_qcpw6_20",kR="_errorState_qcpw6_34",hs={root:TR,loadingState:NR,loadingSpinner:jR,errorState:kR},RR=new Up({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});class AR 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:hs.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 PR(e){const{isLoading:t,error:r}=IR({config:e,onError:e.onError}),n=ae(s=>s.editorMode);return t?l.jsxs("div",{className:hs.loadingState,children:[l.jsx("div",{className:hs.loadingSpinner}),l.jsx("p",{children:"Loading editor..."})]}):r?l.jsxs("div",{className:hs.errorState,children:[l.jsx("h3",{children:"Failed to load editor"}),l.jsx("p",{children:r.message})]}):l.jsx("div",{className:`sb-split-builder ${hs.root}`,children:l.jsx(xR,{editorMode:n,onToolbarEvent:e.onToolbarEvent,onContentAdded:e.onContentAdded,onHierarchySaved:e.onHierarchySaved})})}const fp=e=>l.jsx(AR,{onError:e.onError,children:l.jsxs(qp,{client:RR,children:[l.jsx(PR,{...e}),l.jsx(Vg,{position:"top-right",toastOptions:{duration:3e3}})]})}),Vi=Symbol.for("r2wc.reactRender"),Gu=Symbol.for("r2wc.shouldRender"),ai=Symbol.for("r2wc.root");function MR(e=""){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function LR(e=""){return e.replace(/-([a-z0-9])/g,function(t){return t[1].toUpperCase()})}var Yu={expando:function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:function(){return r},set:function(n){r=n,this[Vi]()}}),e[Vi]()}};function FR(e,t,r,n={}){var s={isConnected:"isConnected"in HTMLElement.prototype},i=!1,o=function(){var d=Reflect.construct(HTMLElement,arguments,this.constructor);return typeof n.shadow=="string"?d.attachShadow({mode:n.shadow}):n.shadow&&(console.warn('Specifying the "shadow" option as a boolean is deprecated and will be removed in a future version.'),d.attachShadow({mode:"open"})),d},a=Object.create(HTMLElement.prototype);a.constructor=o;var c=new Proxy(a,{has:function(d,u){return u in e.propTypes||u in a},set:function(d,u,f,g){return i&&(s[u]=!0),typeof u=="symbol"||s[u]||u in d?(e.propTypes&&u in e.propTypes&&Yu.expando(g,u,f),Reflect.set(d,u,f,g)):(Yu.expando(g,u,f),!0)},getOwnPropertyDescriptor:function(d,u){var f=Reflect.getOwnPropertyDescriptor(d,u);if(f)return f;if(u in e.propTypes)return{configurable:!0,enumerable:!0,writable:!0,value:void 0}}});return o.prototype=c,a.connectedCallback=function(){this[Gu]=!0,this[Vi]()},a.disconnectedCallback=function(){typeof r.createRoot=="function"?this[ai].unmount():r.unmountComponentAtNode(this)},a[Vi]=function(){if(this[Gu]===!0){var d={};Object.keys(this).forEach(function(g){s[g]!==!1&&(d[g]=this[g])},this),i=!0;const u=n.shadow?this.shadowRoot:this,f=t.createElement(e,d);typeof r.createRoot=="function"?(this[ai]||(this[ai]=r.createRoot(u)),this[ai].render(f)):r.render(f,u),i=!1}},e.propTypes&&(o.observedAttributes=n.dashStyleAttributes?Object.keys(e.propTypes).map(function(d){return MR(d)}):Object.keys(e.propTypes),a.attributeChangedCallback=function(d,u,f){var g=n.dashStyleAttributes?LR(d):d;this[g]=f}),o}var ps={},us=Lr;if(process.env.NODE_ENV==="production")ps.createRoot=us.createRoot,ps.hydrateRoot=us.hydrateRoot;else{var li=us.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ps.createRoot=function(e,t){li.usingClientEntryPoint=!0;try{return us.createRoot(e,t)}finally{li.usingClientEntryPoint=!1}},ps.hydrateRoot=function(e,t,r){li.usingClientEntryPoint=!0;try{return us.hydrateRoot(e,t,r)}finally{li.usingClientEntryPoint=!1}}}function $R(){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 BR(e="sb-collection-editor"){if($R(),typeof customElements>"u"||customElements.get(e))return;const t=FR(fp,p,ps,{});customElements.define(e,t)}exports.CollectionEditor=fp;exports.registerCollectionEditor=BR;exports.setApiBaseUrl=Pf;exports.useEditorStore=ae;exports.useLibraryStore=up;exports.useTreeStore=Oe;
|